diff options
Diffstat (limited to 'Source')
383 files changed, 6912 insertions, 3282 deletions
diff --git a/Source/JavaScriptCore/API/JSValueRef.cpp b/Source/JavaScriptCore/API/JSValueRef.cpp index 04d7f661d..9b7268a2d 100644 --- a/Source/JavaScriptCore/API/JSValueRef.cpp +++ b/Source/JavaScriptCore/API/JSValueRef.cpp @@ -266,7 +266,7 @@ bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); - return jsValue.toBoolean(); + return jsValue.toBoolean(exec); } double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 987ca8ecf..a8434ccc7 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,204 @@ +2011-08-23 Geoffrey Garen <ggaren@apple.com> + + Unreviewed, rolling out r126505. + http://trac.webkit.org/changeset/126505 + https://bugs.webkit.org/show_bug.cgi?id=94840 + + Caused testapi to crash on launch + + * DerivedSources.make: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/Opcode.h: + (JSC): + (JSC::padOpcodeName): + * bytecode/OpcodeDefinitions.h: Removed. + * bytecode/opcodes: Removed. + * opcode_definition_generator.py: Removed. + * opcode_generator.py: Removed. + * opcode_parser.py: Removed. + +2012-08-23 Oliver Hunt <oliver@apple.com> + + Autogenerate Opcode definitions + https://bugs.webkit.org/show_bug.cgi?id=94840 + + Reviewed by Gavin Barraclough. + + Start the process of autogenerating the code emission for the bytecode. + We'll just start with automatic generation of the list of Opcodes as that + requires the actual definition of the opcodes, and the logic for parsing + them. + + Due to some rather annoying dependency cycles, this initial version has + the OpcodeDefinitions.h file checked into the tree, although with some + work I hope to be able to fix that. + + * DerivedSources.make: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/Opcode.h: + Include OpcodeDefinitions.h as our definitive source of info + about the opcodes. + * bytecode/OpcodeDefinitions.h: Added. + Autogenerated file + * bytecode/opcodes: Added. + The new opcode definition file + * opcode_definition_generator.py: Added. + (generateOpcodeDefinition): + (generate): + Module that generates the content for OpcodeDefinitions.h + * opcode_generator.py: Added. + (printUsage): + (main): + Driver script + * opcode_parser.py: Added. + Simple parser for the opcode definitions. + +2012-08-23 Mark Hahnenberg <mhahnenberg@apple.com> + + Change behavior of MasqueradesAsUndefined to better accommodate DFG changes + https://bugs.webkit.org/show_bug.cgi?id=93884 + + Reviewed by Filip Pizlo. + + With some upcoming changes to the DFG to remove uses of ClassInfo, we will be changing the behavior of + MasqueradesAsUndefined. In order to make this change consistent across all of our execution engines, + we will make this change to MasqueradesAsUndefined as a separate patch. After this patch, MasqueradesAsUndefined + objects will only masquerade as undefined in their original context (i.e. their original JSGlobalObject). + For example, if an object that masquerades as undefined in frame A is passed to frame B, it will not + masquerade as undefined within frame B, but it will continue to masquerade in frame A. + + There are two primary changes that are taking place here. One is to thread the ExecState* through + JSValue::toBoolean and JSCell::toBoolean so that JSCell::toBoolean can check the object's + JSGlobalObject to compare it to the lexical JSGlobalObject of the currently running code. If the two + are distinct, then the object cannot MasqueradeAsUndefined. + + The other change is to perform this comparison of JSGlobalObjects everywhere where the MasqueradesAsUndefined + flag in the Structure is checked. For C++ code, this check has been factored into its own function in + Structure::masqueradesAsUndefined. We only perform this check in the DFG if the current JSGlobalObject has + had a MasqueradesAsUndefined object allocated within its context. This conditional compilation is managed + through the use of a WatchpointSet in each JSGlobalObject and alternate create() functions for JS DOM wrappers + that are MasqueradesAsUndefined. + + * API/JSValueRef.cpp: + (JSValueToBoolean): + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * bytecode/Watchpoint.h: + (WatchpointSet): + * debugger/DebuggerCallFrame.h: + (JSC::DebuggerCallFrame::callFrame): + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGCFGSimplificationPhase.cpp: + (JSC::DFG::CFGSimplificationPhase::run): + * dfg/DFGOperations.cpp: + * dfg/DFGOperations.h: + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull): + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull): + (JSC::DFG::SpeculativeJIT::compile): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_is_undefined): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_eq_null): + (JSC::JIT::emit_op_neq_null): + * jit/JITOpcodes32_64.cpp: + (JSC::JIT::emit_op_is_undefined): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_eq_null): + (JSC::JIT::emit_op_neq_null): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * llint/LLIntSlowPaths.cpp: + (JSC::LLInt::LLINT_SLOW_PATH_DECL): + * llint/LowLevelInterpreter32_64.asm: + * llint/LowLevelInterpreter64.asm: + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncFilter): + (JSC::arrayProtoFuncEvery): + (JSC::arrayProtoFuncSome): + * runtime/BooleanConstructor.cpp: + (JSC::constructBoolean): + (JSC::callBooleanConstructor): + * runtime/JSCell.h: + (JSCell): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::JSGlobalObject): + * runtime/JSGlobalObject.h: + (JSGlobalObject): + (JSC::JSGlobalObject::masqueradesAsUndefinedWatchpoint): + * runtime/JSString.h: + (JSC::JSCell::toBoolean): + (JSC::JSValue::toBoolean): + * runtime/JSValue.h: + * runtime/ObjectConstructor.cpp: + (JSC::toPropertyDescriptor): + * runtime/Operations.cpp: + (JSC::jsTypeStringForValue): + (JSC::jsIsObjectType): + * runtime/Operations.h: + (JSC): + (JSC::JSValue::equalSlowCaseInline): + * runtime/RegExpConstructor.cpp: + (JSC::setRegExpConstructorMultiline): + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncToString): + * runtime/Structure.h: + (Structure): + (JSC::Structure::globalObjectOffset): + (JSC::Structure::masqueradesAsUndefined): + (JSC): + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Make JavaScriptCore build with the latest version of clang. + + Reviewed by Dan Bernstein. + + * heap/MachineStackMarker.cpp: + (JSC::MachineThreads::MachineThreads): The m_heap member is only used within + assertions, so guard its initialization with !ASSERT_DISABLED. + * heap/MachineStackMarker.h: + (MachineThreads): Ditto for its declaration. + * jit/JITStubCall.h: + (JSC::JITStubCall::JITStubCall): The m_returnType member is only used within + assertions or if we're using JSVALUE32_64, so guard its uses with the appropriate + #if. + (JITStubCall): Ditto. + +2012-08-23 Christophe Dumez <christophe.dumez@intel.com> + + Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics + https://bugs.webkit.org/show_bug.cgi?id=65292 + + Reviewed by Oliver Hunt. + + Add function to construct a StringObject from a JSValue. + Similar functions already exist for NumberObject and + BooleanObject for example. + + Export several symbols so address linking errors in + WebCore. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * runtime/BooleanObject.h: + (BooleanObject): + * runtime/NumberObject.h: + (NumberObject): + (JSC): + * runtime/StringObject.cpp: + (JSC::constructString): + (JSC): + * runtime/StringObject.h: + (JSC): + 2012-08-22 Filip Pizlo <fpizlo@apple.com> Array accesses should remember what kind of array they are predicted to access diff --git a/Source/JavaScriptCore/Configurations/Version.xcconfig b/Source/JavaScriptCore/Configurations/Version.xcconfig index b619d3602..cff1fe049 100644 --- a/Source/JavaScriptCore/Configurations/Version.xcconfig +++ b/Source/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 6; +MINOR_VERSION = 8; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index 8032ed178..e3453201b 100755 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -1,6 +1,7 @@ EXPORTS ??0ArrayBufferView@WTF@@IAE@V?$PassRefPtr@VArrayBuffer@WTF@@@1@I@Z + ??0BooleanObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z ??0CString@WTF@@QAE@PBD@Z ??0CString@WTF@@QAE@PBDI@Z ??0Collator@WTF@@QAE@PBD@Z @@ -107,6 +108,8 @@ EXPORTS ?constructArray@JSC@@YAPAVJSArray@1@PAVExecState@1@ABVArgList@1@@Z ?constructEmptyObject@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z ?constructFunctionSkippingEvalEnabledCheck@JSC@@YAPAVJSObject@1@PAVExecState@1@PAVJSGlobalObject@1@ABVArgList@1@ABVIdentifier@1@ABVUString@1@ABVTextPosition@WTF@@@Z + ?constructNumber@JSC@@YAPAVNumberObject@1@PAVExecState@1@PAVJSGlobalObject@1@VJSValue@1@@Z + ?constructString@JSC@@YAPAVStringObject@1@PAVExecState@1@PAVJSGlobalObject@1@VJSValue@1@@Z ?convertLatin1ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBEPBEPAPADPAD@Z ?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z ?convertUTF8ToUTF16@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBDPBDPAPA_WPA_W_N@Z @@ -186,6 +189,7 @@ EXPORTS ?fillGetterPropertySlot@JSObject@JSC@@AAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z ?finalize@WeakHandleOwner@JSC@@UAEXV?$Handle@W4Unknown@JSC@@@2@PAX@Z ?findAllocator@WeakSet@JSC@@AAEPAUFreeCell@WeakBlock@2@XZ + ?finishCreation@BooleanObject@JSC@@IAEXAAVJSGlobalData@2@@Z ?finishCreation@DateInstance@JSC@@IAEXAAVJSGlobalData@2@N@Z ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVUString@2@@Z ?finishCreation@JSArray@JSC@@IAEXAAVJSGlobalData@2@I@Z @@ -258,6 +262,7 @@ EXPORTS ?neuter@ArrayBufferView@WTF@@MAEXXZ ?newUninitialized@CString@WTF@@SA?AV12@IAAPAD@Z ?notifyWriteSlow@SymbolTableEntry@JSC@@AAEXXZ + ?notifyWriteSlow@WatchpointSet@JSC@@QAEXXZ ?nullptr@@3Vnullptr_t@std@@A ?number@String@WTF@@SA?AV12@NII@Z ?number@UString@JSC@@SA?AV12@H@Z diff --git a/Source/JavaScriptCore/bytecode/Watchpoint.h b/Source/JavaScriptCore/bytecode/Watchpoint.h index 8e0526c0f..e6fba93a9 100644 --- a/Source/JavaScriptCore/bytecode/Watchpoint.h +++ b/Source/JavaScriptCore/bytecode/Watchpoint.h @@ -78,7 +78,7 @@ public: bool* addressOfIsWatched() { return &m_isWatched; } - void notifyWriteSlow(); // Call only if you've checked isWatched. + JS_EXPORT_PRIVATE void notifyWriteSlow(); // Call only if you've checked isWatched. private: void fireAllWatchpoints(); diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.h b/Source/JavaScriptCore/debugger/DebuggerCallFrame.h index 8605af54d..dca7487c0 100644 --- a/Source/JavaScriptCore/debugger/DebuggerCallFrame.h +++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.h @@ -48,6 +48,7 @@ namespace JSC { { } + CallFrame* callFrame() const { return m_callFrame; } JSGlobalObject* dynamicGlobalObject() const { return m_callFrame->dynamicGlobalObject(); } ScopeChainNode* scopeChain() const { return m_callFrame->scopeChain(); } JS_EXPORT_PRIVATE const UString* functionName() const; diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index cfe915947..43b5a03f3 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -618,7 +618,7 @@ bool AbstractState::execute(unsigned indexInBlock) case LogicalNot: { JSValue childConst = forNode(node.child1()).value(); - if (childConst && trySetConstant(nodeIndex, jsBoolean(!childConst.toBoolean()))) { + if (childConst && trySetConstant(nodeIndex, jsBoolean(!childConst.toBoolean(m_codeBlock->globalObjectFor(node.codeOrigin)->globalExec())))) { m_foundConstants = true; node.setCanExit(false); break; @@ -650,16 +650,23 @@ bool AbstractState::execute(unsigned indexInBlock) case IsString: case IsObject: case IsFunction: { - node.setCanExit(false); + node.setCanExit(node.op() == IsUndefined && m_codeBlock->globalObjectFor(node.codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()); JSValue child = forNode(node.child1()).value(); if (child) { bool constantWasSet; switch (node.op()) { case IsUndefined: - constantWasSet = trySetConstant(nodeIndex, jsBoolean( - child.isCell() - ? child.asCell()->structure()->typeInfo().masqueradesAsUndefined() - : child.isUndefined())); + if (m_codeBlock->globalObjectFor(node.codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) { + constantWasSet = trySetConstant(nodeIndex, jsBoolean( + child.isCell() + ? false + : child.isUndefined())); + } else { + constantWasSet = trySetConstant(nodeIndex, jsBoolean( + child.isCell() + ? child.asCell()->structure()->masqueradesAsUndefined(m_codeBlock->globalObjectFor(node.codeOrigin)) + : child.isUndefined())); + } break; case IsBoolean: constantWasSet = trySetConstant(nodeIndex, jsBoolean(child.isBoolean())); @@ -739,8 +746,8 @@ bool AbstractState::execute(unsigned indexInBlock) && m_graph.valueOfJSConstant(node.child1().index()).isNull()) || (m_graph.isConstant(node.child2().index()) && m_graph.valueOfJSConstant(node.child2().index()).isNull())) { - // We know that this won't clobber the world. But that's all we know. - node.setCanExit(false); + // We can exit if we haven't fired the MasqueradesAsUndefind watchpoint yet. + node.setCanExit(m_codeBlock->globalObjectFor(node.codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()); break; } @@ -1077,7 +1084,7 @@ bool AbstractState::execute(unsigned indexInBlock) case Branch: { JSValue value = forNode(node.child1()).value(); if (value) { - bool booleanValue = value.toBoolean(); + bool booleanValue = value.toBoolean(m_codeBlock->globalObjectFor(node.codeOrigin)->globalExec()); if (booleanValue) m_branchDirection = TakeTrue; else diff --git a/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp b/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp index f054707e2..aecce83ed 100644 --- a/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp @@ -101,7 +101,7 @@ public: // Branch on constant -> jettison the not-taken block and merge. if (m_graph[m_graph[block->last()].child1()].hasConstant()) { bool condition = - m_graph.valueOfJSConstant(m_graph[block->last()].child1().index()).toBoolean(); + m_graph.valueOfJSConstant(m_graph[block->last()].child1().index()).toBoolean(m_graph.globalObjectFor(m_graph[block->last()].codeOrigin)->globalExec()); BasicBlock* targetBlock = m_graph.m_blocks[ m_graph.successorForCondition(block, condition)].get(); if (targetBlock->m_predecessors.size() == 1) { diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index 882e1cd02..b5c3b961b 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -1273,9 +1273,9 @@ JSCell* DFG_OPERATION operationNewFunctionExpression(ExecState* exec, JSCell* fu return function; } -size_t DFG_OPERATION operationIsObject(EncodedJSValue value) +size_t DFG_OPERATION operationIsObject(ExecState* exec, EncodedJSValue value) { - return jsIsObjectType(JSValue::decode(value)); + return jsIsObjectType(exec, JSValue::decode(value)); } size_t DFG_OPERATION operationIsFunction(EncodedJSValue value) @@ -1368,7 +1368,7 @@ size_t DFG_OPERATION dfgConvertJSValueToBoolean(ExecState* exec, EncodedJSValue JSGlobalData* globalData = &exec->globalData(); NativeCallFrameTracer tracer(globalData, exec); - return JSValue::decode(encodedOp).toBoolean(); + return JSValue::decode(encodedOp).toBoolean(exec); } #if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE) diff --git a/Source/JavaScriptCore/dfg/DFGOperations.h b/Source/JavaScriptCore/dfg/DFGOperations.h index 0ff721216..455c2bcc3 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.h +++ b/Source/JavaScriptCore/dfg/DFGOperations.h @@ -180,7 +180,7 @@ EncodedJSValue DFG_OPERATION operationGetArgumentByVal(ExecState*, int32_t, int3 JSCell* DFG_OPERATION operationNewFunction(ExecState*, JSCell*) WTF_INTERNAL; JSCell* DFG_OPERATION operationNewFunctionExpression(ExecState*, JSCell*) WTF_INTERNAL; double DFG_OPERATION operationFModOnInts(int32_t, int32_t) WTF_INTERNAL; -size_t DFG_OPERATION operationIsObject(EncodedJSValue) WTF_INTERNAL; +size_t DFG_OPERATION operationIsObject(ExecState*, EncodedJSValue) WTF_INTERNAL; size_t DFG_OPERATION operationIsFunction(EncodedJSValue) WTF_INTERNAL; void DFG_OPERATION operationReallocateStorageAndFinishPut(ExecState*, JSObject*, Structure*, PropertyOffset, EncodedJSValue) WTF_INTERNAL; char* DFG_OPERATION operationAllocatePropertyStorageWithInitialCapacity(ExecState*) WTF_INTERNAL; diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index 26a48dcec..846d078ba 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -623,10 +623,29 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool inv JITCompiler::Jump notCell; if (!isKnownCell(operand.index())) notCell = m_jit.branch32(MacroAssembler::NotEqual, argTagGPR, TrustedImm32(JSValue::CellTag)); - - m_jit.loadPtr(JITCompiler::Address(argPayloadGPR, JSCell::structureOffset()), resultPayloadGPR); - m_jit.test8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultPayloadGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), resultPayloadGPR); - + + JITCompiler::Jump notMasqueradesAsUndefined; + if (m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) { + m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint()); + m_jit.move(invert ? TrustedImm32(1) : TrustedImm32(0), resultPayloadGPR); + notMasqueradesAsUndefined = m_jit.jump(); + } else { + m_jit.loadPtr(JITCompiler::Address(argPayloadGPR, JSCell::structureOffset()), resultPayloadGPR); + JITCompiler::Jump isMasqueradesAsUndefined = m_jit.branchTest8(JITCompiler::NonZero, JITCompiler::Address(resultPayloadGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined)); + + m_jit.move(invert ? TrustedImm32(1) : TrustedImm32(0), resultPayloadGPR); + notMasqueradesAsUndefined = m_jit.jump(); + + isMasqueradesAsUndefined.link(&m_jit); + GPRTemporary localGlobalObject(this); + GPRTemporary remoteGlobalObject(this); + GPRReg localGlobalObjectGPR = localGlobalObject.gpr(); + GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); + m_jit.move(JITCompiler::TrustedImmPtr(m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)), localGlobalObjectGPR); + m_jit.loadPtr(JITCompiler::Address(resultPayloadGPR, Structure::globalObjectOffset()), remoteGlobalObjectGPR); + m_jit.compare32(invert ? JITCompiler::NotEqual : JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, resultPayloadGPR); + } + if (!isKnownCell(operand.index())) { JITCompiler::Jump done = m_jit.jump(); @@ -640,6 +659,8 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool inv done.link(&m_jit); } + notMasqueradesAsUndefined.link(&m_jit); + booleanResult(resultPayloadGPR, m_compileIndex); } @@ -668,9 +689,22 @@ void SpeculativeJIT::nonSpeculativePeepholeBranchNull(Edge operand, NodeIndex br if (!isKnownCell(operand.index())) notCell = m_jit.branch32(MacroAssembler::NotEqual, argTagGPR, TrustedImm32(JSValue::CellTag)); - m_jit.loadPtr(JITCompiler::Address(argPayloadGPR, JSCell::structureOffset()), resultGPR); - branchTest8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), taken); - + if (m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) { + m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint()); + jump(invert ? taken : notTaken, ForceJump); + } else { + m_jit.loadPtr(JITCompiler::Address(argPayloadGPR, JSCell::structureOffset()), resultGPR); + branchTest8(JITCompiler::Zero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), invert ? taken : notTaken); + + GPRTemporary localGlobalObject(this); + GPRTemporary remoteGlobalObject(this); + GPRReg localGlobalObjectGPR = localGlobalObject.gpr(); + GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); + m_jit.move(TrustedImmPtr(m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)), localGlobalObjectGPR); + m_jit.loadPtr(JITCompiler::Address(resultGPR, Structure::globalObjectOffset()), remoteGlobalObjectGPR); + branchPtr(JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, invert ? notTaken : taken); + } + if (!isKnownCell(operand.index())) { jump(notTaken, ForceJump); @@ -3580,9 +3614,28 @@ void SpeculativeJIT::compile(Node& node) JITCompiler::Jump done = m_jit.jump(); isCell.link(&m_jit); - m_jit.loadPtr(JITCompiler::Address(value.payloadGPR(), JSCell::structureOffset()), result.gpr()); - m_jit.test8(JITCompiler::NonZero, JITCompiler::Address(result.gpr(), Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), result.gpr()); - + JITCompiler::Jump notMasqueradesAsUndefined; + if (m_jit.graph().globalObjectFor(node.codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) { + m_jit.graph().globalObjectFor(node.codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint()); + m_jit.move(TrustedImm32(0), result.gpr()); + notMasqueradesAsUndefined = m_jit.jump(); + } else { + m_jit.loadPtr(JITCompiler::Address(value.payloadGPR(), JSCell::structureOffset()), result.gpr()); + JITCompiler::Jump isMasqueradesAsUndefined = m_jit.branchTest8(JITCompiler::NonZero, JITCompiler::Address(result.gpr(), Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + m_jit.move(TrustedImm32(0), result.gpr()); + notMasqueradesAsUndefined = m_jit.jump(); + + isMasqueradesAsUndefined.link(&m_jit); + GPRTemporary localGlobalObject(this); + GPRTemporary remoteGlobalObject(this); + GPRReg localGlobalObjectGPR = localGlobalObject.gpr(); + GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); + m_jit.move(TrustedImmPtr(m_jit.globalObjectFor(node.codeOrigin)), localGlobalObjectGPR); + m_jit.loadPtr(JITCompiler::Address(result.gpr(), Structure::globalObjectOffset()), remoteGlobalObjectGPR); + m_jit.compare32(JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, result.gpr()); + } + + notMasqueradesAsUndefined.link(&m_jit); done.link(&m_jit); booleanResult(result.gpr(), m_compileIndex); break; diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index c2e207264..b69d53600 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -588,10 +588,29 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool inv if (!isKnownCell(operand.index())) notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, argGPR, GPRInfo::tagMaskRegister); - - m_jit.loadPtr(JITCompiler::Address(argGPR, JSCell::structureOffset()), resultGPR); - m_jit.test8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), resultGPR); - + + JITCompiler::Jump notMasqueradesAsUndefined; + if (m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) { + m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint()); + m_jit.move(invert ? TrustedImm32(1) : TrustedImm32(0), resultGPR); + notMasqueradesAsUndefined = m_jit.jump(); + } else { + m_jit.loadPtr(JITCompiler::Address(argGPR, JSCell::structureOffset()), resultGPR); + JITCompiler::Jump isMasqueradesAsUndefined = m_jit.branchTest8(JITCompiler::NonZero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined)); + + m_jit.move(invert ? TrustedImm32(1) : TrustedImm32(0), resultGPR); + notMasqueradesAsUndefined = m_jit.jump(); + + isMasqueradesAsUndefined.link(&m_jit); + GPRTemporary localGlobalObject(this); + GPRTemporary remoteGlobalObject(this); + GPRReg localGlobalObjectGPR = localGlobalObject.gpr(); + GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); + m_jit.move(JITCompiler::TrustedImmPtr(m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)), localGlobalObjectGPR); + m_jit.loadPtr(JITCompiler::Address(resultGPR, Structure::globalObjectOffset()), remoteGlobalObjectGPR); + m_jit.comparePtr(invert ? JITCompiler::NotEqual : JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, resultGPR); + } + if (!isKnownCell(operand.index())) { JITCompiler::Jump done = m_jit.jump(); @@ -603,7 +622,9 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool inv done.link(&m_jit); } - + + notMasqueradesAsUndefined.link(&m_jit); + m_jit.or32(TrustedImm32(ValueFalse), resultGPR); jsValueResult(resultGPR, m_compileIndex, DataFormatJSBoolean); } @@ -632,9 +653,22 @@ void SpeculativeJIT::nonSpeculativePeepholeBranchNull(Edge operand, NodeIndex br if (!isKnownCell(operand.index())) notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, argGPR, GPRInfo::tagMaskRegister); - m_jit.loadPtr(JITCompiler::Address(argGPR, JSCell::structureOffset()), resultGPR); - branchTest8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), taken); - + if (m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) { + m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint()); + jump(invert ? taken : notTaken, ForceJump); + } else { + m_jit.loadPtr(JITCompiler::Address(argGPR, JSCell::structureOffset()), resultGPR); + branchTest8(JITCompiler::Zero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), invert ? taken : notTaken); + + GPRTemporary localGlobalObject(this); + GPRTemporary remoteGlobalObject(this); + GPRReg localGlobalObjectGPR = localGlobalObject.gpr(); + GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); + m_jit.move(TrustedImmPtr(m_jit.graph().globalObjectFor(m_jit.graph()[operand].codeOrigin)), localGlobalObjectGPR); + m_jit.loadPtr(JITCompiler::Address(resultGPR, Structure::globalObjectOffset()), remoteGlobalObjectGPR); + branchPtr(JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, invert ? notTaken : taken); + } + if (!isKnownCell(operand.index())) { jump(notTaken, ForceJump); @@ -3553,9 +3587,28 @@ void SpeculativeJIT::compile(Node& node) JITCompiler::Jump done = m_jit.jump(); isCell.link(&m_jit); - m_jit.loadPtr(JITCompiler::Address(value.gpr(), JSCell::structureOffset()), result.gpr()); - m_jit.test8(JITCompiler::NonZero, JITCompiler::Address(result.gpr(), Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), result.gpr()); - + JITCompiler::Jump notMasqueradesAsUndefined; + if (m_jit.graph().globalObjectFor(node.codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) { + m_jit.graph().globalObjectFor(node.codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint()); + m_jit.move(TrustedImm32(0), result.gpr()); + notMasqueradesAsUndefined = m_jit.jump(); + } else { + m_jit.loadPtr(JITCompiler::Address(value.gpr(), JSCell::structureOffset()), result.gpr()); + JITCompiler::Jump isMasqueradesAsUndefined = m_jit.branchTest8(JITCompiler::NonZero, JITCompiler::Address(result.gpr(), Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + m_jit.move(TrustedImm32(0), result.gpr()); + notMasqueradesAsUndefined = m_jit.jump(); + + isMasqueradesAsUndefined.link(&m_jit); + GPRTemporary localGlobalObject(this); + GPRTemporary remoteGlobalObject(this); + GPRReg localGlobalObjectGPR = localGlobalObject.gpr(); + GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); + m_jit.move(TrustedImmPtr(m_jit.globalObjectFor(node.codeOrigin)), localGlobalObjectGPR); + m_jit.loadPtr(JITCompiler::Address(result.gpr(), Structure::globalObjectOffset()), remoteGlobalObjectGPR); + m_jit.comparePtr(JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, result.gpr()); + } + + notMasqueradesAsUndefined.link(&m_jit); done.link(&m_jit); m_jit.or32(TrustedImm32(ValueFalse), result.gpr()); jsValueResult(result.gpr(), m_compileIndex, DataFormatJSBoolean); diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/Source/JavaScriptCore/heap/MachineStackMarker.cpp index 537a34e48..3c7ff9c3e 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.cpp +++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp @@ -133,10 +133,13 @@ public: }; MachineThreads::MachineThreads(Heap* heap) - : m_heap(heap) - , m_registeredThreads(0) + : m_registeredThreads(0) , m_threadSpecific(0) +#if !ASSERT_DISABLED + , m_heap(heap) +#endif { + UNUSED_PARAM(heap); } MachineThreads::~MachineThreads() diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.h b/Source/JavaScriptCore/heap/MachineStackMarker.h index 3d4aa22d4..cece29cd3 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.h +++ b/Source/JavaScriptCore/heap/MachineStackMarker.h @@ -52,10 +52,12 @@ namespace JSC { void gatherFromOtherThread(ConservativeRoots&, Thread*); - Heap* m_heap; Mutex m_registeredThreadsMutex; Thread* m_registeredThreads; WTF::ThreadSpecificKey m_threadSpecific; +#if !ASSERT_DISABLED + Heap* m_heap; +#endif }; } // namespace JSC diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index a9118f43b..f6a197ef0 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -2118,7 +2118,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi NEXT_INSTRUCTION(); } - callFrame->uncheckedR(dst) = jsBoolean(src.isCell() && src.asCell()->structure()->typeInfo().masqueradesAsUndefined()); + callFrame->uncheckedR(dst) = jsBoolean(src.isCell() && src.asCell()->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject())); vPC += OPCODE_LENGTH(op_eq_null); NEXT_INSTRUCTION(); } @@ -2158,7 +2158,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi NEXT_INSTRUCTION(); } - callFrame->uncheckedR(dst) = jsBoolean(!src.isCell() || !src.asCell()->structure()->typeInfo().masqueradesAsUndefined()); + callFrame->uncheckedR(dst) = jsBoolean(!src.isCell() || !src.asCell()->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject())); vPC += OPCODE_LENGTH(op_neq_null); NEXT_INSTRUCTION(); } @@ -2632,7 +2632,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi */ int dst = vPC[1].u.operand; int src = vPC[2].u.operand; - JSValue result = jsBoolean(!callFrame->r(src).jsValue().toBoolean()); + JSValue result = jsBoolean(!callFrame->r(src).jsValue().toBoolean(callFrame)); CHECK_FOR_EXCEPTION(); callFrame->uncheckedR(dst) = result; @@ -2708,7 +2708,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi int dst = vPC[1].u.operand; int src = vPC[2].u.operand; JSValue v = callFrame->r(src).jsValue(); - callFrame->uncheckedR(dst) = jsBoolean(v.isCell() ? v.asCell()->structure()->typeInfo().masqueradesAsUndefined() : v.isUndefined()); + callFrame->uncheckedR(dst) = jsBoolean(v.isCell() ? v.asCell()->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject()) : v.isUndefined()); vPC += OPCODE_LENGTH(op_is_undefined); NEXT_INSTRUCTION(); @@ -2764,7 +2764,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi */ int dst = vPC[1].u.operand; int src = vPC[2].u.operand; - callFrame->uncheckedR(dst) = jsBoolean(jsIsObjectType(callFrame->r(src).jsValue())); + callFrame->uncheckedR(dst) = jsBoolean(jsIsObjectType(callFrame, callFrame->r(src).jsValue())); vPC += OPCODE_LENGTH(op_is_object); NEXT_INSTRUCTION(); @@ -3980,7 +3980,7 @@ skip_id_custom_self: */ int cond = vPC[1].u.operand; int target = vPC[2].u.operand; - if (callFrame->r(cond).jsValue().toBoolean()) { + if (callFrame->r(cond).jsValue().toBoolean(callFrame)) { vPC += target; CHECK_FOR_TIMEOUT(); NEXT_INSTRUCTION(); @@ -4000,7 +4000,7 @@ skip_id_custom_self: */ int cond = vPC[1].u.operand; int target = vPC[2].u.operand; - if (!callFrame->r(cond).jsValue().toBoolean()) { + if (!callFrame->r(cond).jsValue().toBoolean(callFrame)) { vPC += target; CHECK_FOR_TIMEOUT(); NEXT_INSTRUCTION(); @@ -4017,7 +4017,7 @@ skip_id_custom_self: */ int cond = vPC[1].u.operand; int target = vPC[2].u.operand; - if (callFrame->r(cond).jsValue().toBoolean()) { + if (callFrame->r(cond).jsValue().toBoolean(callFrame)) { vPC += target; NEXT_INSTRUCTION(); } @@ -4033,7 +4033,7 @@ skip_id_custom_self: */ int cond = vPC[1].u.operand; int target = vPC[2].u.operand; - if (!callFrame->r(cond).jsValue().toBoolean()) { + if (!callFrame->r(cond).jsValue().toBoolean(callFrame)) { vPC += target; NEXT_INSTRUCTION(); } @@ -4051,7 +4051,7 @@ skip_id_custom_self: int target = vPC[2].u.operand; JSValue srcValue = callFrame->r(src).jsValue(); - if (srcValue.isUndefinedOrNull() || (srcValue.isCell() && srcValue.asCell()->structure()->typeInfo().masqueradesAsUndefined())) { + if (srcValue.isUndefinedOrNull() || (srcValue.isCell() && srcValue.asCell()->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject()))) { vPC += target; NEXT_INSTRUCTION(); } @@ -4069,7 +4069,7 @@ skip_id_custom_self: int target = vPC[2].u.operand; JSValue srcValue = callFrame->r(src).jsValue(); - if (!srcValue.isUndefinedOrNull() && (!srcValue.isCell() || !srcValue.asCell()->structure()->typeInfo().masqueradesAsUndefined())) { + if (!srcValue.isUndefinedOrNull() && (!srcValue.isCell() || !(srcValue.asCell()->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject())))) { vPC += target; NEXT_INSTRUCTION(); } diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp index 0d24961b8..8ebad61ff 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp @@ -479,8 +479,16 @@ void JIT::emit_op_is_undefined(Instruction* currentInstruction) isCell.link(this); loadPtr(Address(regT0, JSCell::structureOffset()), regT1); - test8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT0); - + Jump isMasqueradesAsUndefined = branchTest8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImm32(0), regT0); + Jump notMasqueradesAsUndefined = jump(); + + isMasqueradesAsUndefined.link(this); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + loadPtr(Address(regT1, Structure::globalObjectOffset()), regT1); + comparePtr(Equal, regT0, regT1, regT0); + + notMasqueradesAsUndefined.link(this); done.link(this); emitTagAsBoolImmediate(regT0); emitPutVirtualRegister(dst); @@ -760,15 +768,18 @@ void JIT::emit_op_jeq_null(Instruction* currentInstruction) // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. loadPtr(Address(regT0, JSCell::structureOffset()), regT2); - addJump(branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target); - Jump wasNotImmediate = jump(); + Jump isNotMasqueradesAsUndefined = branchTest8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + addJump(branchPtr(Equal, Address(regT2, Structure::globalObjectOffset()), regT0), target); + Jump masqueradesGlobalObjectIsForeign = jump(); // Now handle the immediate cases - undefined & null isImmediate.link(this); andPtr(TrustedImm32(~TagBitUndefined), regT0); addJump(branchPtr(Equal, regT0, TrustedImmPtr(JSValue::encode(jsNull()))), target); - wasNotImmediate.link(this); + isNotMasqueradesAsUndefined.link(this); + masqueradesGlobalObjectIsForeign.link(this); }; void JIT::emit_op_jneq_null(Instruction* currentInstruction) { @@ -781,6 +792,8 @@ void JIT::emit_op_jneq_null(Instruction* currentInstruction) // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. loadPtr(Address(regT0, JSCell::structureOffset()), regT2); addJump(branchTest8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + addJump(branchPtr(NotEqual, Address(regT2, Structure::globalObjectOffset()), regT0), target); Jump wasNotImmediate = jump(); // Now handle the immediate cases - undefined & null @@ -1172,8 +1185,14 @@ void JIT::emit_op_eq_null(Instruction* currentInstruction) Jump isImmediate = emitJumpIfNotJSCell(regT0); loadPtr(Address(regT0, JSCell::structureOffset()), regT2); - test8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT0); - + Jump isMasqueradesAsUndefined = branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImm32(0), regT0); + Jump wasNotMasqueradesAsUndefined = jump(); + + isMasqueradesAsUndefined.link(this); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + loadPtr(Address(regT2, Structure::globalObjectOffset()), regT2); + comparePtr(Equal, regT0, regT2, regT0); Jump wasNotImmediate = jump(); isImmediate.link(this); @@ -1182,6 +1201,7 @@ void JIT::emit_op_eq_null(Instruction* currentInstruction) comparePtr(Equal, regT0, TrustedImm32(ValueNull), regT0); wasNotImmediate.link(this); + wasNotMasqueradesAsUndefined.link(this); emitTagAsBoolImmediate(regT0); emitPutVirtualRegister(dst); @@ -1197,8 +1217,14 @@ void JIT::emit_op_neq_null(Instruction* currentInstruction) Jump isImmediate = emitJumpIfNotJSCell(regT0); loadPtr(Address(regT0, JSCell::structureOffset()), regT2); - test8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT0); - + Jump isMasqueradesAsUndefined = branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImm32(1), regT0); + Jump wasNotMasqueradesAsUndefined = jump(); + + isMasqueradesAsUndefined.link(this); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + loadPtr(Address(regT2, Structure::globalObjectOffset()), regT2); + comparePtr(NotEqual, regT0, regT2, regT0); Jump wasNotImmediate = jump(); isImmediate.link(this); @@ -1207,6 +1233,7 @@ void JIT::emit_op_neq_null(Instruction* currentInstruction) comparePtr(NotEqual, regT0, TrustedImm32(ValueNull), regT0); wasNotImmediate.link(this); + wasNotMasqueradesAsUndefined.link(this); emitTagAsBoolImmediate(regT0); emitPutVirtualRegister(dst); diff --git a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp index eec9df36f..00c886eb7 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp @@ -646,8 +646,16 @@ void JIT::emit_op_is_undefined(Instruction* currentInstruction) isCell.link(this); loadPtr(Address(regT0, JSCell::structureOffset()), regT1); - test8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT0); + Jump isMasqueradesAsUndefined = branchTest8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImm32(0), regT0); + Jump notMasqueradesAsUndefined = jump(); + isMasqueradesAsUndefined.link(this); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + loadPtr(Address(regT1, Structure::globalObjectOffset()), regT1); + compare32(Equal, regT0, regT1, regT0); + + notMasqueradesAsUndefined.link(this); done.link(this); emitStoreBool(dst, regT0); } @@ -930,18 +938,19 @@ void JIT::emit_op_jeq_null(Instruction* currentInstruction) // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. loadPtr(Address(regT0, JSCell::structureOffset()), regT2); - addJump(branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target); - - Jump wasNotImmediate = jump(); + Jump isNotMasqueradesAsUndefined = branchTest8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + addJump(branchPtr(Equal, Address(regT2, Structure::globalObjectOffset()), regT0), target); + Jump masqueradesGlobalObjectIsForeign = jump(); // Now handle the immediate cases - undefined & null isImmediate.link(this); - ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && (JSValue::NullTag & 0x1)); or32(TrustedImm32(1), regT1); addJump(branch32(Equal, regT1, TrustedImm32(JSValue::NullTag)), target); - wasNotImmediate.link(this); + isNotMasqueradesAsUndefined.link(this); + masqueradesGlobalObjectIsForeign.link(this); } void JIT::emit_op_jneq_null(Instruction* currentInstruction) @@ -956,7 +965,8 @@ void JIT::emit_op_jneq_null(Instruction* currentInstruction) // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. loadPtr(Address(regT0, JSCell::structureOffset()), regT2); addJump(branchTest8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target); - + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + addJump(branchPtr(NotEqual, Address(regT2, Structure::globalObjectOffset()), regT0), target); Jump wasNotImmediate = jump(); // Now handle the immediate cases - undefined & null @@ -1158,8 +1168,14 @@ void JIT::emit_op_eq_null(Instruction* currentInstruction) Jump isImmediate = branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)); loadPtr(Address(regT0, JSCell::structureOffset()), regT1); - test8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT1); - + Jump isMasqueradesAsUndefined = branchTest8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImm32(0), regT1); + Jump wasNotMasqueradesAsUndefined = jump(); + + isMasqueradesAsUndefined.link(this); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + loadPtr(Address(regT2, Structure::globalObjectOffset()), regT2); + compare32(Equal, regT0, regT2, regT1); Jump wasNotImmediate = jump(); isImmediate.link(this); @@ -1169,6 +1185,7 @@ void JIT::emit_op_eq_null(Instruction* currentInstruction) or32(regT2, regT1); wasNotImmediate.link(this); + wasNotMasqueradesAsUndefined.link(this); emitStoreBool(dst, regT1); } @@ -1182,8 +1199,14 @@ void JIT::emit_op_neq_null(Instruction* currentInstruction) Jump isImmediate = branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)); loadPtr(Address(regT0, JSCell::structureOffset()), regT1); - test8(Zero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT1); - + Jump isMasqueradesAsUndefined = branchTest8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)); + move(TrustedImm32(1), regT1); + Jump wasNotMasqueradesAsUndefined = jump(); + + isMasqueradesAsUndefined.link(this); + move(TrustedImmPtr(m_codeBlock->globalObject()), regT0); + loadPtr(Address(regT2, Structure::globalObjectOffset()), regT2); + compare32(NotEqual, regT0, regT2, regT1); Jump wasNotImmediate = jump(); isImmediate.link(this); @@ -1193,6 +1216,7 @@ void JIT::emit_op_neq_null(Instruction* currentInstruction) and32(regT2, regT1); wasNotImmediate.link(this); + wasNotMasqueradesAsUndefined.link(this); emitStoreBool(dst, regT1); } diff --git a/Source/JavaScriptCore/jit/JITStubCall.h b/Source/JavaScriptCore/jit/JITStubCall.h index a525ff227..352956559 100644 --- a/Source/JavaScriptCore/jit/JITStubCall.h +++ b/Source/JavaScriptCore/jit/JITStubCall.h @@ -37,7 +37,9 @@ namespace JSC { JITStubCall(JIT* jit, JSObject* (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Cell) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -45,7 +47,9 @@ namespace JSC { JITStubCall(JIT* jit, JSPropertyNameIterator* (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Cell) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -53,7 +57,9 @@ namespace JSC { JITStubCall(JIT* jit, void* (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(VoidPtr) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -61,7 +67,9 @@ namespace JSC { JITStubCall(JIT* jit, int (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Int) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -69,7 +77,9 @@ namespace JSC { JITStubCall(JIT* jit, bool (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Int) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -77,7 +87,9 @@ namespace JSC { JITStubCall(JIT* jit, void (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Void) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -265,7 +277,9 @@ namespace JSC { JIT* m_jit; FunctionPtr m_stub; +#if USE(JSVALUE32_64) || !ASSERT_DISABLED enum { Void, VoidPtr, Int, Value, Cell } m_returnType; +#endif size_t m_stackIndex; }; } diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index cb5adc2fa..cc899587f 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -2777,7 +2777,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_not) JSValue src = stackFrame.args[0].jsValue(); - JSValue result = jsBoolean(!src.toBoolean()); + JSValue result = jsBoolean(!src.toBoolean(stackFrame.callFrame)); CHECK_FOR_EXCEPTION_AT_END(); return JSValue::encode(result); } @@ -2788,7 +2788,7 @@ DEFINE_STUB_FUNCTION(int, op_jtrue) JSValue src1 = stackFrame.args[0].jsValue(); - bool result = src1.toBoolean(); + bool result = src1.toBoolean(stackFrame.callFrame); CHECK_FOR_EXCEPTION_AT_END(); return result; } @@ -2819,13 +2819,13 @@ DEFINE_STUB_FUNCTION(int, op_eq) start: if (src2.isUndefined()) { return src1.isNull() || - (src1.isCell() && src1.asCell()->structure()->typeInfo().masqueradesAsUndefined()) + (src1.isCell() && src1.asCell()->structure()->masqueradesAsUndefined(stackFrame.callFrame->lexicalGlobalObject())) || src1.isUndefined(); } if (src2.isNull()) { return src1.isUndefined() || - (src1.isCell() && src1.asCell()->structure()->typeInfo().masqueradesAsUndefined()) + (src1.isCell() && src1.asCell()->structure()->masqueradesAsUndefined(stackFrame.callFrame->lexicalGlobalObject())) || src1.isNull(); } @@ -2862,10 +2862,10 @@ DEFINE_STUB_FUNCTION(int, op_eq) } if (src1.isUndefined()) - return src2.isCell() && src2.asCell()->structure()->typeInfo().masqueradesAsUndefined(); + return src2.isCell() && src2.asCell()->structure()->masqueradesAsUndefined(stackFrame.callFrame->lexicalGlobalObject()); if (src1.isNull()) - return src2.isCell() && src2.asCell()->structure()->typeInfo().masqueradesAsUndefined(); + return src2.isCell() && src2.asCell()->structure()->masqueradesAsUndefined(stackFrame.callFrame->lexicalGlobalObject()); JSCell* cell1 = src1.asCell(); @@ -3178,7 +3178,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_object) { STUB_INIT_STACK_FRAME(stackFrame); - return JSValue::encode(jsBoolean(jsIsObjectType(stackFrame.args[0].jsValue()))); + return JSValue::encode(jsBoolean(jsIsObjectType(stackFrame.callFrame, stackFrame.args[0].jsValue()))); } DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_function) diff --git a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp index 58bf1bdeb..eef54ac7b 100644 --- a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp +++ b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp @@ -517,7 +517,7 @@ LLINT_SLOW_PATH_DECL(slow_path_new_regexp) LLINT_SLOW_PATH_DECL(slow_path_not) { LLINT_BEGIN(); - LLINT_RETURN(jsBoolean(!LLINT_OP_C(2).jsValue().toBoolean())); + LLINT_RETURN(jsBoolean(!LLINT_OP_C(2).jsValue().toBoolean(exec))); } LLINT_SLOW_PATH_DECL(slow_path_eq) @@ -739,7 +739,7 @@ LLINT_SLOW_PATH_DECL(slow_path_typeof) LLINT_SLOW_PATH_DECL(slow_path_is_object) { LLINT_BEGIN(); - LLINT_RETURN(jsBoolean(jsIsObjectType(LLINT_OP_C(2).jsValue()))); + LLINT_RETURN(jsBoolean(jsIsObjectType(exec, LLINT_OP_C(2).jsValue()))); } LLINT_SLOW_PATH_DECL(slow_path_is_function) @@ -1173,13 +1173,13 @@ LLINT_SLOW_PATH_DECL(slow_path_jmp_scopes) LLINT_SLOW_PATH_DECL(slow_path_jtrue) { LLINT_BEGIN(); - LLINT_BRANCH(op_jtrue, LLINT_OP_C(1).jsValue().toBoolean()); + LLINT_BRANCH(op_jtrue, LLINT_OP_C(1).jsValue().toBoolean(exec)); } LLINT_SLOW_PATH_DECL(slow_path_jfalse) { LLINT_BEGIN(); - LLINT_BRANCH(op_jfalse, !LLINT_OP_C(1).jsValue().toBoolean()); + LLINT_BRANCH(op_jfalse, !LLINT_OP_C(1).jsValue().toBoolean(exec)); } LLINT_SLOW_PATH_DECL(slow_path_jless) diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm index 5f280ce1b..c0f136889 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm @@ -444,7 +444,13 @@ _llint_op_eq_null: loadi PayloadOffset[cfr, t0, 8], t0 bineq t1, CellTag, .opEqNullImmediate loadp JSCell::m_structure[t0], t1 - tbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, t1 + btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opEqNullMasqueradesAsUndefined + move 0, t1 + jmp .opEqNullNotImmediate +.opEqNullMasqueradesAsUndefined: + loadp CodeBlock[cfr], t0 + loadp CodeBlock::m_globalObject[t0], t0 + cpeq Structure::m_globalObject[t1], t0, t1 jmp .opEqNullNotImmediate .opEqNullImmediate: cieq t1, NullTag, t2 @@ -485,7 +491,13 @@ _llint_op_neq_null: loadi PayloadOffset[cfr, t0, 8], t0 bineq t1, CellTag, .opNeqNullImmediate loadp JSCell::m_structure[t0], t1 - tbz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, t1 + btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opNeqNullMasqueradesAsUndefined + move 1, t1 + jmp .opNeqNullNotImmediate +.opNeqNullMasqueradesAsUndefined: + loadp CodeBlock[cfr], t0 + loadp CodeBlock::m_globalObject[t0], t0 + cpneq Structure::m_globalObject[t1], t0, t1 jmp .opNeqNullNotImmediate .opNeqNullImmediate: cineq t1, NullTag, t2 @@ -875,7 +887,14 @@ _llint_op_is_undefined: dispatch(3) .opIsUndefinedCell: loadp JSCell::m_structure[t3], t1 - tbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, t1 + btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opIsUndefinedMasqueradesAsUndefined + move 0, t1 + storei t1, PayloadOffset[cfr, t0, 8] + dispatch(3) +.opIsUndefinedMasqueradesAsUndefined: + loadp CodeBlock[cfr], t3 + loadp CodeBlock::m_globalObject[t3], t3 + cpeq Structure::m_globalObject[t1], t3, t1 storei t1, PayloadOffset[cfr, t0, 8] dispatch(3) @@ -1406,7 +1425,7 @@ macro equalNull(cellHandler, immediateHandler) loadi PayloadOffset[cfr, t0, 8], t0 bineq t1, CellTag, .immediate loadp JSCell::m_structure[t0], t2 - cellHandler(Structure::m_typeInfo + TypeInfo::m_flags[t2], .target) + cellHandler(t2, Structure::m_typeInfo + TypeInfo::m_flags[t2], .target) dispatch(3) .target: @@ -1421,14 +1440,25 @@ end _llint_op_jeq_null: traceExecution() equalNull( - macro (value, target) btbnz value, MasqueradesAsUndefined, target end, + macro (structure, value, target) + btbz value, MasqueradesAsUndefined, .opJeqNullNotMasqueradesAsUndefined + loadp CodeBlock[cfr], t0 + loadp CodeBlock::m_globalObject[t0], t0 + bpeq Structure::m_globalObject[structure], t0, target +.opJeqNullNotMasqueradesAsUndefined: + end, macro (value, target) bieq value, NullTag, target end) _llint_op_jneq_null: traceExecution() equalNull( - macro (value, target) btbz value, MasqueradesAsUndefined, target end, + macro (structure, value, target) + btbz value, MasqueradesAsUndefined, target + loadp CodeBlock[cfr], t0 + loadp CodeBlock::m_globalObject[t0], t0 + bpneq Structure::m_globalObject[structure], t0, target + end, macro (value, target) bineq value, NullTag, target end) diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm index f1a7e2998..73e8613de 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm @@ -324,7 +324,13 @@ macro equalNullComparison() loadp [cfr, t0, 8], t0 btpnz t0, tagMask, .immediate loadp JSCell::m_structure[t0], t2 - tbnz Structure::m_typeInfo + TypeInfo::m_flags[t2], MasqueradesAsUndefined, t0 + btbnz Structure::m_typeInfo + TypeInfo::m_flags[t2], MasqueradesAsUndefined, .masqueradesAsUndefined + move 0, t0 + jmp .done +.masqueradesAsUndefined: + loadp CodeBlock[cfr], t0 + loadp CodeBlock::m_globalObject[t0], t0 + cpeq Structure::m_globalObject[t2], t0, t0 jmp .done .immediate: andp ~TagBitUndefined, t0 @@ -733,10 +739,17 @@ _llint_op_is_undefined: dispatch(3) .opIsUndefinedCell: loadp JSCell::m_structure[t0], t0 - tbnz Structure::m_typeInfo + TypeInfo::m_flags[t0], MasqueradesAsUndefined, t1 - orp ValueFalse, t1 + btbnz Structure::m_typeInfo + TypeInfo::m_flags[t0], MasqueradesAsUndefined, .masqueradesAsUndefined + move ValueFalse, t1 storep t1, [cfr, t2, 8] dispatch(3) +.masqueradesAsUndefined: + loadp CodeBlock[cfr], t1 + loadp CodeBlock::m_globalObject[t1], t1 + cpeq Structure::m_globalObject[t0], t1, t3 + orp ValueFalse, t3 + storep t3, [cfr, t2, 8] + dispatch(3) _llint_op_is_boolean: @@ -1250,7 +1263,7 @@ macro equalNull(cellHandler, immediateHandler) loadp [cfr, t0, 8], t0 btpnz t0, tagMask, .immediate loadp JSCell::m_structure[t0], t2 - cellHandler(Structure::m_typeInfo + TypeInfo::m_flags[t2], .target) + cellHandler(t2, Structure::m_typeInfo + TypeInfo::m_flags[t2], .target) dispatch(3) .target: @@ -1265,14 +1278,25 @@ end _llint_op_jeq_null: traceExecution() equalNull( - macro (value, target) btbnz value, MasqueradesAsUndefined, target end, + macro (structure, value, target) + btbz value, MasqueradesAsUndefined, .notMasqueradesAsUndefined + loadp CodeBlock[cfr], t0 + loadp CodeBlock::m_globalObject[t0], t0 + bpeq Structure::m_globalObject[structure], t0, target +.notMasqueradesAsUndefined: + end, macro (value, target) bpeq value, ValueNull, target end) _llint_op_jneq_null: traceExecution() equalNull( - macro (value, target) btbz value, MasqueradesAsUndefined, target end, + macro (structure, value, target) + btbz value, MasqueradesAsUndefined, target + loadp CodeBlock[cfr], t0 + loadp CodeBlock::m_globalObject[t0], t0 + bpneq Structure::m_globalObject[structure], t0, target + end, macro (value, target) bpneq value, ValueNull, target end) diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp index b0adb7f0f..a97cf82de 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -797,7 +797,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); - if (result.toBoolean()) + if (result.toBoolean(exec)) resultArray->putDirectIndex(exec, filterIndex++, v); } if (k == length) @@ -818,7 +818,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) eachArguments.append(thisObj); JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); - if (result.toBoolean()) + if (result.toBoolean(exec)) resultArray->putDirectIndex(exec, filterIndex++, v); } return JSValue::encode(resultArray); @@ -917,7 +917,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) cachedCall.setArgument(1, jsNumber(k)); cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); - if (!result.toBoolean()) + if (!result.toBoolean(exec)) return JSValue::encode(jsBoolean(false)); } } @@ -934,7 +934,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) if (exec->hadException()) return JSValue::encode(jsUndefined()); - bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(); + bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); if (!predicateResult) { result = jsBoolean(false); break; @@ -1025,7 +1025,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) cachedCall.setArgument(1, jsNumber(k)); cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); - if (result.toBoolean()) + if (result.toBoolean(exec)) return JSValue::encode(jsBoolean(true)); } } @@ -1042,7 +1042,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) if (exec->hadException()) return JSValue::encode(jsUndefined()); - bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(); + bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); if (predicateResult) { result = jsBoolean(true); break; diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp index 090be0aaa..9b666292c 100644 --- a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp +++ b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp @@ -49,7 +49,7 @@ void BooleanConstructor::finishCreation(ExecState* exec, BooleanPrototype* boole JSObject* constructBoolean(ExecState* exec, const ArgList& args) { BooleanObject* obj = BooleanObject::create(exec->globalData(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure()); - obj->setInternalValue(exec->globalData(), jsBoolean(args.at(0).toBoolean())); + obj->setInternalValue(exec->globalData(), jsBoolean(args.at(0).toBoolean(exec))); return obj; } @@ -68,7 +68,7 @@ ConstructType BooleanConstructor::getConstructData(JSCell*, ConstructData& const // ECMA 15.6.1 static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec) { - return JSValue::encode(jsBoolean(exec->argument(0).toBoolean())); + return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec))); } CallType BooleanConstructor::getCallData(JSCell*, CallData& callData) diff --git a/Source/JavaScriptCore/runtime/BooleanObject.h b/Source/JavaScriptCore/runtime/BooleanObject.h index 2704ff3cd..bd0f66944 100644 --- a/Source/JavaScriptCore/runtime/BooleanObject.h +++ b/Source/JavaScriptCore/runtime/BooleanObject.h @@ -27,8 +27,8 @@ namespace JSC { class BooleanObject : public JSWrapperObject { protected: - BooleanObject(JSGlobalData&, Structure*); - void finishCreation(JSGlobalData&); + JS_EXPORT_PRIVATE BooleanObject(JSGlobalData&, Structure*); + JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&); public: typedef JSWrapperObject Base; @@ -40,7 +40,7 @@ namespace JSC { return boolean; } - static const ClassInfo s_info; + static JS_EXPORTDATA const ClassInfo s_info; static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) { diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h index 90e531cec..39f98356f 100644 --- a/Source/JavaScriptCore/runtime/JSCell.h +++ b/Source/JavaScriptCore/runtime/JSCell.h @@ -98,7 +98,7 @@ namespace JSC { // Basic conversions. JS_EXPORT_PRIVATE JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const; - bool toBoolean() const; + bool toBoolean(ExecState*) const; JS_EXPORT_PRIVATE double toNumber(ExecState*) const; JS_EXPORT_PRIVATE JSObject* toObject(ExecState*, JSGlobalObject*) const; diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index 0edc0a8a9..ff7b1486f 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -115,6 +115,7 @@ template <typename T> static inline void visitIfNeeded(SlotVisitor& visitor, Wri JSGlobalObject::JSGlobalObject(JSGlobalData& globalData, Structure* structure, const GlobalObjectMethodTable* globalObjectMethodTable) : JSSegmentedVariableObject(globalData, structure, &m_symbolTable) , m_globalScopeChain() + , m_masqueradesAsUndefinedWatchpoint(adoptRef(new WatchpointSet(InitializedWatching))) , m_weakRandom(Options::forceWeakRandomSeed() ? Options::forcedWeakRandomSeed() : static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0))) , m_evalEnabled(true) , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable) diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index af03f32e6..248004bd5 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -30,6 +30,7 @@ #include "NumberPrototype.h" #include "StringPrototype.h" #include "StructureChain.h" +#include "Watchpoint.h" #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> #include <wtf/RandomNumber.h> @@ -142,6 +143,8 @@ namespace JSC { Debugger* m_debugger; + RefPtr<WatchpointSet> m_masqueradesAsUndefinedWatchpoint; + OwnPtr<JSGlobalObjectRareData> m_rareData; WeakRandom m_weakRandom; @@ -270,6 +273,8 @@ namespace JSC { Structure* regExpStructure() const { return m_regExpStructure.get(); } Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); } + WatchpointSet* masqueradesAsUndefinedWatchpoint() { return m_masqueradesAsUndefinedWatchpoint.get(); } + void setProfileGroup(unsigned value) { createRareDataIfNeeded(); m_rareData->profileGroup = value; } unsigned profileGroup() const { diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h index d6fc4c2a1..e91553aeb 100644 --- a/Source/JavaScriptCore/runtime/JSString.h +++ b/Source/JavaScriptCore/runtime/JSString.h @@ -500,23 +500,23 @@ namespace JSC { inline bool isJSString(JSValue v) { return v.isCell() && v.asCell()->classInfo() == &JSString::s_info; } - inline bool JSCell::toBoolean() const + inline bool JSCell::toBoolean(ExecState* exec) const { if (isString()) return static_cast<const JSString*>(this)->toBoolean(); - return !structure()->typeInfo().masqueradesAsUndefined(); + return !structure()->masqueradesAsUndefined(exec->lexicalGlobalObject()); } // --- JSValue inlines ---------------------------- - inline bool JSValue::toBoolean() const + inline bool JSValue::toBoolean(ExecState* exec) const { if (isInt32()) return asInt32(); if (isDouble()) return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN if (isCell()) - return asCell()->toBoolean(); + return asCell()->toBoolean(exec); return isTrue(); // false, null, and undefined all convert to false. } diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index 19a8c4759..7aa5453e4 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -209,7 +209,7 @@ namespace JSC { JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const; bool getPrimitiveNumber(ExecState*, double& number, JSValue&); - bool toBoolean() const; + bool toBoolean(ExecState*) const; // toNumber conversion is expected to be side effect free if an exception has // been set in the ExecState already. diff --git a/Source/JavaScriptCore/runtime/NumberObject.h b/Source/JavaScriptCore/runtime/NumberObject.h index 07334722b..ed84207d9 100644 --- a/Source/JavaScriptCore/runtime/NumberObject.h +++ b/Source/JavaScriptCore/runtime/NumberObject.h @@ -40,7 +40,7 @@ namespace JSC { return number; } - static const ClassInfo s_info; + static JS_EXPORTDATA const ClassInfo s_info; static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) { @@ -48,7 +48,7 @@ namespace JSC { } }; - NumberObject* constructNumber(ExecState*, JSGlobalObject*, JSValue); + JS_EXPORT_PRIVATE NumberObject* constructNumber(ExecState*, JSGlobalObject*, JSValue); } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp index 7b6a5f669..5a6fcddf0 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -214,14 +214,14 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor PropertySlot enumerableSlot(description); if (description->getPropertySlot(exec, exec->propertyNames().enumerable, enumerableSlot)) { - desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean()); + desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean(exec)); if (exec->hadException()) return false; } PropertySlot configurableSlot(description); if (description->getPropertySlot(exec, exec->propertyNames().configurable, configurableSlot)) { - desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean()); + desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean(exec)); if (exec->hadException()) return false; } @@ -236,7 +236,7 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor PropertySlot writableSlot(description); if (description->getPropertySlot(exec, exec->propertyNames().writable, writableSlot)) { - desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean()); + desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean(exec)); if (exec->hadException()) return false; } diff --git a/Source/JavaScriptCore/runtime/Operations.cpp b/Source/JavaScriptCore/runtime/Operations.cpp index 4cb9de505..d96bae575 100644 --- a/Source/JavaScriptCore/runtime/Operations.cpp +++ b/Source/JavaScriptCore/runtime/Operations.cpp @@ -70,7 +70,7 @@ JSValue jsTypeStringForValue(CallFrame* callFrame, JSValue v) if (v.isObject()) { // Return "undefined" for objects that should be treated // as null when doing comparisons. - if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined()) + if (asObject(v)->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject())) return globalData.smallStrings.undefinedString(&globalData); CallData callData; JSObject* object = asObject(v); @@ -80,7 +80,7 @@ JSValue jsTypeStringForValue(CallFrame* callFrame, JSValue v) return globalData.smallStrings.objectString(&globalData); } -bool jsIsObjectType(JSValue v) +bool jsIsObjectType(CallFrame* callFrame, JSValue v) { if (!v.isCell()) return v.isNull(); @@ -89,7 +89,7 @@ bool jsIsObjectType(JSValue v) if (type == NumberType || type == StringType) return false; if (type >= ObjectType) { - if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined()) + if (asObject(v)->structure()->masqueradesAsUndefined(callFrame->lexicalGlobalObject())) return false; CallData callData; JSObject* object = asObject(v); diff --git a/Source/JavaScriptCore/runtime/Operations.h b/Source/JavaScriptCore/runtime/Operations.h index 497b19d82..88fffdac4 100644 --- a/Source/JavaScriptCore/runtime/Operations.h +++ b/Source/JavaScriptCore/runtime/Operations.h @@ -31,7 +31,7 @@ namespace JSC { NEVER_INLINE JSValue jsAddSlowCase(CallFrame*, JSValue, JSValue); JSValue jsTypeStringForValue(CallFrame*, JSValue); - bool jsIsObjectType(JSValue); + bool jsIsObjectType(CallFrame*, JSValue); bool jsIsFunctionType(JSValue); ALWAYS_INLINE JSValue jsString(ExecState* exec, JSString* s1, JSString* s2) @@ -134,13 +134,13 @@ namespace JSC { return true; if (!v2.isCell()) return false; - return v2.asCell()->structure()->typeInfo().masqueradesAsUndefined(); + return v2.asCell()->structure()->masqueradesAsUndefined(exec->lexicalGlobalObject()); } if (v2.isUndefinedOrNull()) { if (!v1.isCell()) return false; - return v1.asCell()->structure()->typeInfo().masqueradesAsUndefined(); + return v1.asCell()->structure()->masqueradesAsUndefined(exec->lexicalGlobalObject()); } if (v1.isObject()) { diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp index 0f2091c27..0b463474f 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -249,9 +249,9 @@ void setRegExpConstructorInput(ExecState* exec, JSObject* baseObject, JSValue va asRegExpConstructor(baseObject)->setInput(exec, value.toString(exec)); } -void setRegExpConstructorMultiline(ExecState*, JSObject* baseObject, JSValue value) +void setRegExpConstructorMultiline(ExecState* exec, JSObject* baseObject, JSValue value) { - asRegExpConstructor(baseObject)->setMultiline(value.toBoolean()); + asRegExpConstructor(baseObject)->setMultiline(value.toBoolean(exec)); } // ECMA 15.10.4 diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp index 6080a1c99..24c7c8027 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -147,11 +147,11 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec) char postfix[5] = { '/', 0, 0, 0, 0 }; int index = 1; - if (thisObject->get(exec, exec->propertyNames().global).toBoolean()) + if (thisObject->get(exec, exec->propertyNames().global).toBoolean(exec)) postfix[index++] = 'g'; - if (thisObject->get(exec, exec->propertyNames().ignoreCase).toBoolean()) + if (thisObject->get(exec, exec->propertyNames().ignoreCase).toBoolean(exec)) postfix[index++] = 'i'; - if (thisObject->get(exec, exec->propertyNames().multiline).toBoolean()) + if (thisObject->get(exec, exec->propertyNames().multiline).toBoolean(exec)) postfix[index] = 'm'; UString source = thisObject->get(exec, exec->propertyNames().source).toString(exec)->value(exec); // If source is empty, use "/(?:)/" to avoid colliding with comment syntax diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp index 1dac06b46..3c037bcd1 100644 --- a/Source/JavaScriptCore/runtime/StringObject.cpp +++ b/Source/JavaScriptCore/runtime/StringObject.cpp @@ -22,6 +22,7 @@ #include "StringObject.h" #include "Error.h" +#include "JSGlobalObject.h" #include "PropertyNameArray.h" namespace JSC { @@ -143,4 +144,11 @@ void StringObject::getOwnPropertyNames(JSObject* object, ExecState* exec, Proper return JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } +StringObject* constructString(ExecState* exec, JSGlobalObject* globalObject, JSValue string) +{ + StringObject* object = StringObject::create(exec, globalObject->stringObjectStructure()); + object->setInternalValue(exec->globalData(), string); + return object; +} + } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/StringObject.h b/Source/JavaScriptCore/runtime/StringObject.h index 7089e8983..f0c445e91 100644 --- a/Source/JavaScriptCore/runtime/StringObject.h +++ b/Source/JavaScriptCore/runtime/StringObject.h @@ -78,6 +78,8 @@ namespace JSC { return static_cast<StringObject*>(asObject(value)); } + JS_EXPORT_PRIVATE StringObject* constructString(ExecState*, JSGlobalObject*, JSValue); + } // namespace JSC #endif // StringObject_h diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index 0b9c92210..2bb0107b7 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -256,6 +256,8 @@ namespace JSC { && offset <= lastValidOffset(); } + bool masqueradesAsUndefined(JSGlobalObject* lexicalGlobalObject); + PropertyOffset get(JSGlobalData&, PropertyName); PropertyOffset get(JSGlobalData&, const UString& name); JS_EXPORT_PRIVATE PropertyOffset get(JSGlobalData&, PropertyName, unsigned& attributes, JSCell*& specificValue); @@ -313,6 +315,11 @@ namespace JSC { return OBJECT_OFFSETOF(Structure, m_prototype); } + static ptrdiff_t globalObjectOffset() + { + return OBJECT_OFFSETOF(Structure, m_globalObject); + } + static ptrdiff_t typeInfoFlagsOffset() { return OBJECT_OFFSETOF(Structure, m_typeInfo) + TypeInfo::flagsOffset(); @@ -505,6 +512,11 @@ namespace JSC { return entry ? entry->offset : invalidOffset; } + inline bool Structure::masqueradesAsUndefined(JSGlobalObject* lexicalGlobalObject) + { + return typeInfo().masqueradesAsUndefined() && globalObject() == lexicalGlobalObject; + } + inline JSValue JSValue::structureOrUndefined() const { if (isCell()) diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index 12aa87c4a..bca5ad8ad 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,36 @@ +2012-08-23 James Robinson <jamesr@chromium.org> + + [chromium] Convert WebAnimationCurve subtypes into pure virtual + https://bugs.webkit.org/show_bug.cgi?id=94068 + + Reviewed by Adrienne Walker. + + This makes the Web*AnimationCurve interfaces pure virtual to provide better insulation from the implementation + details of the classes. + + * chromium/public/WebAnimation.h: + (WebKit::WebAnimation::WebAnimation): + (WebAnimation): + * chromium/public/WebAnimationCurve.h: + * chromium/public/WebFloatAnimationCurve.h: + (WebFloatAnimationCurve): + (WebKit::WebFloatAnimationCurve::~WebFloatAnimationCurve): + * chromium/public/WebTransformAnimationCurve.h: + (WebTransformAnimationCurve): + (WebKit::WebTransformAnimationCurve::~WebTransformAnimationCurve): + +2012-08-22 James Robinson <jamesr@chromium.org> + + [chromium] Remove WebLayer::setChildren API + https://bugs.webkit.org/show_bug.cgi?id=94749 + + Reviewed by Adrienne Walker. + + This is redundant with removeAllChildren() / addChild() and less efficient. + + * chromium/public/WebLayer.h: + (WebLayer): + 2012-08-22 James Robinson <jamesr@chromium.org> [chromium] Change WebLayer from a concrete type to a pure virtual interface diff --git a/Source/Platform/chromium/public/WebAnimation.h b/Source/Platform/chromium/public/WebAnimation.h index 238bbaae1..621330c7c 100644 --- a/Source/Platform/chromium/public/WebAnimation.h +++ b/Source/Platform/chromium/public/WebAnimation.h @@ -49,7 +49,7 @@ public: TargetPropertyOpacity }; - // The caller takes ownership of the returned valuev + // The caller takes ownership of the returned value. WEBKIT_EXPORT static WebAnimation* create(const WebAnimationCurve&, TargetProperty); // An animationId is effectively the animation's name, and it is not unique. diff --git a/Source/Platform/chromium/public/WebAnimationCurve.h b/Source/Platform/chromium/public/WebAnimationCurve.h index e9ecc1eda..ec05d3793 100644 --- a/Source/Platform/chromium/public/WebAnimationCurve.h +++ b/Source/Platform/chromium/public/WebAnimationCurve.h @@ -26,19 +26,11 @@ #define WebAnimationCurve_h #include "WebCommon.h" -#include "WebNonCopyable.h" -#if WEBKIT_IMPLEMENTATION -#include <wtf/Forward.h> -#endif - -namespace WebCore { -class CCAnimationCurve; -} namespace WebKit { -class WebAnimationCurve : public WebNonCopyable { +class WebAnimationCurve { public: virtual ~WebAnimationCurve() { } @@ -50,12 +42,12 @@ public: TimingFunctionTypeLinear }; -#if WEBKIT_IMPLEMENTATION - virtual operator PassOwnPtr<WebCore::CCAnimationCurve>() const = 0; -#endif + enum AnimationCurveType { + AnimationCurveTypeFloat, + AnimationCurveTypeTransform, + }; -protected: - WebAnimationCurve() { } + virtual AnimationCurveType type() const = 0; }; } // namespace WebKit diff --git a/Source/Platform/chromium/public/WebFloatAnimationCurve.h b/Source/Platform/chromium/public/WebFloatAnimationCurve.h index 65a7f2438..b56b3bd4d 100644 --- a/Source/Platform/chromium/public/WebFloatAnimationCurve.h +++ b/Source/Platform/chromium/public/WebFloatAnimationCurve.h @@ -29,43 +29,24 @@ #include "WebCommon.h" #include "WebFloatKeyframe.h" -#include "WebPrivateOwnPtr.h" - -#if WEBKIT_IMPLEMENTATION -#include <wtf/Forward.h> -#endif - -namespace WebCore { -class CCAnimationCurve; -class CCKeyframedFloatAnimationCurve; -} namespace WebKit { // A keyframed float animation curve. class WebFloatAnimationCurve : public WebAnimationCurve { public: - WebFloatAnimationCurve() { initialize(); } - virtual ~WebFloatAnimationCurve() { destroy(); } + WEBKIT_EXPORT static WebFloatAnimationCurve* create(); + + virtual ~WebFloatAnimationCurve() { } // Adds the keyframe with the default timing function (ease). - WEBKIT_EXPORT void add(const WebFloatKeyframe&); - WEBKIT_EXPORT void add(const WebFloatKeyframe&, TimingFunctionType); + virtual void add(const WebFloatKeyframe&) = 0; + virtual void add(const WebFloatKeyframe&, TimingFunctionType) = 0; // Adds the keyframe with a custom, bezier timing function. Note, it is // assumed that x0 = y0 = 0, and x3 = y3 = 1. - WEBKIT_EXPORT void add(const WebFloatKeyframe&, double x1, double y1, double x2, double y2); - - WEBKIT_EXPORT float getValue(double time) const; - -#if WEBKIT_IMPLEMENTATION - virtual operator PassOwnPtr<WebCore::CCAnimationCurve>() const; -#endif - -private: - WEBKIT_EXPORT void initialize(); - WEBKIT_EXPORT void destroy(); + virtual void add(const WebFloatKeyframe&, double x1, double y1, double x2, double y2) = 0; - WebPrivateOwnPtr<WebCore::CCKeyframedFloatAnimationCurve> m_private; + virtual float getValue(double time) const = 0; }; } // namespace WebKit diff --git a/Source/Platform/chromium/public/WebLayer.h b/Source/Platform/chromium/public/WebLayer.h index 60ed69423..9bdeb4c01 100644 --- a/Source/Platform/chromium/public/WebLayer.h +++ b/Source/Platform/chromium/public/WebLayer.h @@ -67,7 +67,6 @@ public: virtual void addChild(WebLayer*) = 0; virtual void insertChild(WebLayer*, size_t index) = 0; virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) = 0; - virtual void setChildren(const WebVector<WebLayer*>&) = 0; virtual void removeFromParent() = 0; virtual void removeAllChildren() = 0; diff --git a/Source/Platform/chromium/public/WebTransformAnimationCurve.h b/Source/Platform/chromium/public/WebTransformAnimationCurve.h index 99cb67055..699e498c8 100644 --- a/Source/Platform/chromium/public/WebTransformAnimationCurve.h +++ b/Source/Platform/chromium/public/WebTransformAnimationCurve.h @@ -28,45 +28,27 @@ #include "WebAnimationCurve.h" #include "WebCommon.h" -#include "WebPrivateOwnPtr.h" #include "WebTransformKeyframe.h" #include "WebTransformationMatrix.h" -#if WEBKIT_IMPLEMENTATION -#include <wtf/Forward.h> -#endif - -namespace WebCore { -class CCAnimationCurve; -class CCKeyframedTransformAnimationCurve; -} - namespace WebKit { // A keyframed transform animation curve. class WebTransformAnimationCurve : public WebAnimationCurve { public: - WebTransformAnimationCurve() { initialize(); } - virtual ~WebTransformAnimationCurve() { destroy(); } + WEBKIT_EXPORT static WebTransformAnimationCurve* create(); + + virtual ~WebTransformAnimationCurve() { } // Adds the keyframe with the default timing function (ease). - WEBKIT_EXPORT void add(const WebTransformKeyframe&); - WEBKIT_EXPORT void add(const WebTransformKeyframe&, TimingFunctionType); + virtual void add(const WebTransformKeyframe&) = 0; + virtual void add(const WebTransformKeyframe&, TimingFunctionType) = 0; // Adds the keyframe with a custom, bezier timing function. Note, it is // assumed that x0 = y0 = 0, and x3 = y3 = 1. - WEBKIT_EXPORT void add(const WebTransformKeyframe&, double x1, double y1, double x2, double y2); - - WEBKIT_EXPORT WebTransformationMatrix getValue(double time) const; - -#if WEBKIT_IMPLEMENTATION - virtual operator PassOwnPtr<WebCore::CCAnimationCurve>() const; -#endif + virtual void add(const WebTransformKeyframe&, double x1, double y1, double x2, double y2) = 0; -protected: - WEBKIT_EXPORT void initialize(); - WEBKIT_EXPORT void destroy(); + virtual WebTransformationMatrix getValue(double time) const = 0; - WebPrivateOwnPtr<WebCore::CCKeyframedTransformAnimationCurve> m_private; }; } // namespace WebKit diff --git a/Source/ThirdParty/ChangeLog b/Source/ThirdParty/ChangeLog index 9dff5fac4..2a7973e0c 100644 --- a/Source/ThirdParty/ChangeLog +++ b/Source/ThirdParty/ChangeLog @@ -1,3 +1,12 @@ +2012-08-23 Mark Rowe <mrowe@apple.com> + + Make gtest build with the latest version of clang. + + Reviewed by Dan Bernstein. + + * gtest/src/gtest-internal-inl.h: + (GTestFlagSaver): Remove an unused member. + 2012-07-03 Tony Chang <tony@chromium.org> [chromium] Unreviewed, update .gitignore to handle VS2010 files. diff --git a/Source/ThirdParty/gtest/src/gtest-internal-inl.h b/Source/ThirdParty/gtest/src/gtest-internal-inl.h index 855b21554..01415f7d9 100644 --- a/Source/ThirdParty/gtest/src/gtest-internal-inl.h +++ b/Source/ThirdParty/gtest/src/gtest-internal-inl.h @@ -200,7 +200,6 @@ class GTestFlagSaver { bool list_tests_; String output_; bool print_time_; - bool pretty_; internal::Int32 random_seed_; internal::Int32 repeat_; bool shuffle_; diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 56c76934e..6fa29193f 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,90 @@ +2012-08-23 Julien Chaffraix <jchaffraix@webkit.org> + + [Chromium] Enable AtomicString && CString && WTFString && StringImpl unit tests + https://bugs.webkit.org/show_bug.cgi?id=94871 + + Reviewed by Benjamin Poulain. + + * wtf/PassRefPtr.h: + We need to include Assertions.h due to the COMPILE_ASSERT added in r89283. + This matches other files in WTF though I am not sure why Chromium is the only + platform complaining about that. + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Build fix for old, old versions of Clang. + + * wtf/FastMalloc.cpp: + (WTF): Rejigger things so that they parse correctly if __has_warning isn't defined. + +2012-08-23 Emil A Eklund <eae@chromium.org> + + Add saturation arithmetic support to FractionalLayoutUnit + https://bugs.webkit.org/show_bug.cgi?id=94364 + + Reviewed by Benjamin Poulain. + + Add support functions for saturated addition and subtraction. + + Test: TestWebKitAPI/Tests/WTF/SaturatedArithmeticOperations.cpp + + * GNUmakefile.list.am: + * WTF.gypi: + * WTF.pro: + * WTF.vcproj/WTF.vcproj: + * WTF.xcodeproj/project.pbxproj: + * WTF/wtf/CMakeLists.txt: + Add SaturatedArithmetic.h to build files. + + * wtf/SaturatedArithmetic.h: Added. + (saturatedAddition): + (saturatedSubtraction): + Support functions for saturated addition/subtraction. Compares the signed + bit of the values instead of using range checks to reduce branching. + + * wtf/Platform.h: + Add ENABLE_SATURATED_LAYOUT_ARITHMETIC flag. + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Roll back in the part of r126475 that I had rolled out. + + * wtf/FastMalloc.cpp: + (WTF): Disable the -Wunused-private-field warning around the declaration of + TCMalloc_Central_FreeListPadded since the padding is intentionally unused. + Only disable the warning if we detect it is enabled, since the warning may not + be supported by the version of Clang that is being used. + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Roll out part of r126475 that breaks the build with older versions of Clang. + + * wtf/FastMalloc.cpp: + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Make WTF build with the latest version of clang. + + Reviewed by Dan Bernstein. + + * wtf/FastMalloc.cpp: + (WTF): Disable the -Wunused-private-field warning around the declaration of + TCMalloc_Central_FreeListPadded since the padding is intentionally unused. + (WTF::AdminRegionRecorder): Remove the unused m_reader member. + (WTF::FastMallocZone::enumerate): Don't pass in the RemoteMemoryReader since + it is no longer needed. + +2012-08-22 Geoffrey Garen <ggaren@apple.com> + + Fixed a fastMallocForbid/Allow compile error for some compilers + https://bugs.webkit.org/show_bug.cgi?id=94775 + + Reviewed by Gavin Barraclough. + + * wtf/FastMalloc.h: + (WTF::fastMallocForbid()): + (WTF::fastMallocAllow()): Export, since these are called by JavaScriptCore. + 2012-08-22 Geoffrey Garen <ggaren@apple.com> ThreadRestrictionVerifier should be opt-in, not opt-out diff --git a/Source/WTF/GNUmakefile.list.am b/Source/WTF/GNUmakefile.list.am index 7d34ee1b1..7c123e537 100644 --- a/Source/WTF/GNUmakefile.list.am +++ b/Source/WTF/GNUmakefile.list.am @@ -128,6 +128,7 @@ wtf_sources += \ Source/WTF/wtf/RetainPtr.h \ Source/WTF/wtf/SHA1.cpp \ Source/WTF/wtf/SHA1.h \ + Source/WTF/wtf/SaturatedArithmetic.h \ Source/WTF/wtf/SegmentedVector.h \ Source/WTF/wtf/SentinelLinkedList.h \ Source/WTF/wtf/SimpleStats.h \ diff --git a/Source/WTF/WTF.gypi b/Source/WTF/WTF.gypi index 5d27970cc..531b4381d 100644 --- a/Source/WTF/WTF.gypi +++ b/Source/WTF/WTF.gypi @@ -75,6 +75,7 @@ 'wtf/RefPtr.h', 'wtf/RefPtrHashMap.h', 'wtf/RetainPtr.h', + 'wtf/SaturatedArithmetic.h', 'wtf/SentinelLinkedList.h', 'wtf/SinglyLinkedList.h', 'wtf/StackBounds.h', diff --git a/Source/WTF/WTF.pro b/Source/WTF/WTF.pro index d66e29560..f8223112d 100644 --- a/Source/WTF/WTF.pro +++ b/Source/WTF/WTF.pro @@ -119,6 +119,7 @@ HEADERS += \ RefPtrHashMap.h \ RetainPtr.h \ SHA1.h \ + SaturatedArithmetic.h \ Spectrum.h \ StackBounds.h \ StaticConstructors.h \ diff --git a/Source/WTF/WTF.vcproj/WTF.vcproj b/Source/WTF/WTF.vcproj/WTF.vcproj index 332a18419..959edae34 100644 --- a/Source/WTF/WTF.vcproj/WTF.vcproj +++ b/Source/WTF/WTF.vcproj/WTF.vcproj @@ -1085,6 +1085,10 @@ > </File> <File + RelativePath="..\wtf\SaturatedArithmetic.h" + > + </File> + <File RelativePath="..\wtf\SegmentedVector.h" > </File> diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj index 97e2250b3..b26784f32 100644 --- a/Source/WTF/WTF.xcodeproj/project.pbxproj +++ b/Source/WTF/WTF.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD81AC4154FB22E00983E72 /* FastBitVector.h */; settings = {ATTRIBUTES = (); }; }; 143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143F611D1565F0F900DB514A /* RAMSize.cpp */; }; 143F61201565F0F900DB514A /* RAMSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 143F611E1565F0F900DB514A /* RAMSize.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C05385315BC819000F21B96 /* GregorianDateTime.h */; }; 2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; }; 4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4330F38E15745B0500AAFA8F /* URLString.cpp */; }; @@ -254,6 +255,7 @@ 0FD81AC4154FB22E00983E72 /* FastBitVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastBitVector.h; sourceTree = "<group>"; }; 143F611D1565F0F900DB514A /* RAMSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RAMSize.cpp; sourceTree = "<group>"; }; 143F611E1565F0F900DB514A /* RAMSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMSize.h; sourceTree = "<group>"; }; + 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaturatedArithmetic.h; sourceTree = "<group>"; }; 2C05385315BC819000F21B96 /* GregorianDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GregorianDateTime.h; sourceTree = "<group>"; }; 2CCD892915C0390200285083 /* GregorianDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GregorianDateTime.cpp; sourceTree = "<group>"; }; 4330F38E15745B0500AAFA8F /* URLString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLString.cpp; sourceTree = "<group>"; }; @@ -690,6 +692,7 @@ A8A47303151A825B004123FF /* RefPtr.h */, A8A47304151A825B004123FF /* RefPtrHashMap.h */, A8A47305151A825B004123FF /* RetainPtr.h */, + 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */, A8A47306151A825B004123FF /* SegmentedVector.h */, A8A47307151A825B004123FF /* SentinelLinkedList.h */, A8A47308151A825B004123FF /* SHA1.cpp */, @@ -1003,6 +1006,7 @@ A8A4741C151A825B004123FF /* RefPtr.h in Headers */, A8A4741D151A825B004123FF /* RefPtrHashMap.h in Headers */, A8A4741E151A825B004123FF /* RetainPtr.h in Headers */, + 14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */, A8A47466151A825B004123FF /* ScriptCodesFromICU.h in Headers */, A8A4741F151A825B004123FF /* SegmentedVector.h in Headers */, A8A47420151A825B004123FF /* SentinelLinkedList.h in Headers */, diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt index 1f12fb851..543755904 100644 --- a/Source/WTF/wtf/CMakeLists.txt +++ b/Source/WTF/wtf/CMakeLists.txt @@ -82,6 +82,7 @@ SET(WTF_HEADERS RefPtr.h RefPtrHashMap.h RetainPtr.h + SaturatedArithmetic.h SegmentedVector.h SHA1.h StackBounds.h diff --git a/Source/WTF/wtf/FastMalloc.cpp b/Source/WTF/wtf/FastMalloc.cpp index dba8f9d30..6c304be7c 100644 --- a/Source/WTF/wtf/FastMalloc.cpp +++ b/Source/WTF/wtf/FastMalloc.cpp @@ -2469,12 +2469,23 @@ class TCMalloc_Central_FreeList { int32_t cache_size_; }; +#if COMPILER(CLANG) && defined(__has_warning) +#pragma clang diagnostic push +#if __has_warning("-Wunused-private-field") +#pragma clang diagnostic ignored "-Wunused-private-field" +#endif +#endif + // Pad each CentralCache object to multiple of 64 bytes class TCMalloc_Central_FreeListPadded : public TCMalloc_Central_FreeList { private: char pad_[(64 - (sizeof(TCMalloc_Central_FreeList) % 64)) % 64]; }; +#if COMPILER(CLANG) && defined(__has_warning) +#pragma clang diagnostic pop +#endif + //------------------------------------------------------------------- // Global variables //------------------------------------------------------------------- @@ -4539,17 +4550,15 @@ class AdminRegionRecorder { void* m_context; unsigned m_typeMask; vm_range_recorder_t* m_recorder; - const RemoteMemoryReader& m_reader; Vector<vm_range_t, 1024> m_pendingRegions; public: - AdminRegionRecorder(task_t task, void* context, unsigned typeMask, vm_range_recorder_t* recorder, const RemoteMemoryReader& reader) + AdminRegionRecorder(task_t task, void* context, unsigned typeMask, vm_range_recorder_t* recorder) : m_task(task) , m_context(context) , m_typeMask(typeMask) , m_recorder(recorder) - , m_reader(reader) { } void recordRegion(vm_address_t ptr, size_t size) @@ -4602,7 +4611,7 @@ kern_return_t FastMallocZone::enumerate(task_t task, void* context, unsigned typ pageMap->visitValues(usageRecorder, memoryReader); usageRecorder.recordPendingRegions(); - AdminRegionRecorder adminRegionRecorder(task, context, typeMask, recorder, memoryReader); + AdminRegionRecorder adminRegionRecorder(task, context, typeMask, recorder); pageMap->visitAllocations(adminRegionRecorder, memoryReader); PageHeapAllocator<Span>* spanAllocator = memoryReader(mzone->m_spanAllocator); diff --git a/Source/WTF/wtf/FastMalloc.h b/Source/WTF/wtf/FastMalloc.h index 871be3756..1300a8ed6 100644 --- a/Source/WTF/wtf/FastMalloc.h +++ b/Source/WTF/wtf/FastMalloc.h @@ -76,8 +76,8 @@ namespace WTF { WTF_EXPORT_PRIVATE void fastFree(void*); #ifndef NDEBUG - void fastMallocForbid(); - void fastMallocAllow(); + WTF_EXPORT_PRIVATE void fastMallocForbid(); + WTF_EXPORT_PRIVATE void fastMallocAllow(); #endif WTF_EXPORT_PRIVATE void releaseFastMallocFreeMemory(); diff --git a/Source/WTF/wtf/PassRefPtr.h b/Source/WTF/wtf/PassRefPtr.h index b85806083..5f5067113 100644 --- a/Source/WTF/wtf/PassRefPtr.h +++ b/Source/WTF/wtf/PassRefPtr.h @@ -22,6 +22,7 @@ #define WTF_PassRefPtr_h #include <wtf/AlwaysInline.h> +#include <wtf/Assertions.h> #include <wtf/NullPtr.h> namespace WTF { diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index d1383df29..4a4efe846 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -834,6 +834,14 @@ #endif #endif +#if !defined(ENABLE_SATURATED_LAYOUT_ARITHMETIC) +#define ENABLE_SATURATED_LAYOUT_ARITHMETIC 0 +#endif + +#if ENABLE(ENABLE_SATURATED_LAYOUT_ARITHMETIC) && !ENABLE(ENABLE_SUBPIXEL_LAYOUT) +#error "ENABLE_SATURATED_LAYOUT_ARITHMETIC requires ENABLE_SUBPIXEL_LAYOUT" +#endif + #define ENABLE_DEBUG_WITH_BREAKPOINT 0 #define ENABLE_SAMPLING_COUNTERS 0 #define ENABLE_SAMPLING_FLAGS 0 diff --git a/Source/WTF/wtf/SaturatedArithmetic.h b/Source/WTF/wtf/SaturatedArithmetic.h new file mode 100644 index 000000000..cf9e8e17e --- /dev/null +++ b/Source/WTF/wtf/SaturatedArithmetic.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2012, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SaturatedArithmetic_h +#define SaturatedArithmetic_h + +#include <limits> +#include <stdint.h> +#include <stdlib.h> + +inline int32_t saturatedAddition(int32_t a, int32_t b) +{ + uint32_t ua = a; + uint32_t ub = b; + uint32_t result = ua + ub; + + // Can only overflow if the signed bit of the two values match. If the signed + // bit of the result and one of the values differ it did overflow. + if (!((ua ^ ub) >> 31) & (result ^ ua) >> 31) + result = std::numeric_limits<int>::max() + (ua >> 31); + + return result; +} + +inline int32_t saturatedSubtraction(int32_t a, int32_t b) +{ + uint32_t ua = a; + uint32_t ub = b; + uint32_t result = ua - ub; + + // Can only overflow if the signed bit of the two values do not match. If the + // signed bit of the result and the first value differ it did overflow. + if ((ua ^ ub) >> 31 & (result ^ ua) >> 31) + result = std::numeric_limits<int>::max() + (ua >> 31); + + return result; +} + +#endif // SaturatedArithmetic_h diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 07823029d..138082037 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,1793 @@ +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] V8DOMWindowShell should use ScopedPersistent + https://bugs.webkit.org/show_bug.cgi?id=94882 + + Reviewed by Kentaro Hara. + + This patch updates V8DOMWindowShell to use ScopedPersistent rather than + manually managing v8::Persistent handles. I've also fixed some style + issues in code I needed to edit for this patch. This class could use + more touchup, but I'm going to hold off until the next patch. + + * bindings/v8/ScopedPersistent.h: + (WebCore::ScopedPersistent::adopt): + (ScopedPersistent): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::initializeV8IfNeeded): + (WebCore): + (WebCore::V8DOMWindowShell::isContextInitialized): + (WebCore::V8DOMWindowShell::disposeContextHandles): + (WebCore::V8DOMWindowShell::destroyGlobal): + (WebCore::V8DOMWindowShell::clearForClose): + (WebCore::V8DOMWindowShell::clearForNavigation): + (WebCore::V8DOMWindowShell::initContextIfNeeded): + (WebCore::V8DOMWindowShell::setContext): + (WebCore::V8DOMWindowShell::updateDocumentWrapper): + (WebCore::V8DOMWindowShell::clearDocumentWrapper): + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + (WebCore::V8DOMWindowShell::clearDocumentWrapperCache): + (WebCore::V8DOMWindowShell::setSecurityToken): + (WebCore::V8DOMWindowShell::updateDocument): + (WebCore::getter): + (WebCore::V8DOMWindowShell::namedItemAdded): + (WebCore::V8DOMWindowShell::namedItemRemoved): + (WebCore::V8DOMWindowShell::updateSecurityOrigin): + * bindings/v8/V8DOMWindowShell.h: + (WebCore::V8DOMWindowShell::context): + (V8DOMWindowShell): + +2012-08-23 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126496. + http://trac.webkit.org/changeset/126496 + https://bugs.webkit.org/show_bug.cgi?id=94895 + + Broke TestNotificationActiveDescendantChanged (Requested by + dominicc on #webkit). + + * accessibility/AccessibilityNodeObject.cpp: + * accessibility/AccessibilityNodeObject.h: + (AccessibilityNodeObject): + * accessibility/AccessibilityObject.cpp: + * accessibility/AccessibilityObject.h: + (AccessibilityObject): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::title): + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + (WebCore::AccessibilityRenderObject::isDescendantOfElementType): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + +2012-08-23 Frederik Gladhorn <gladhorn@kde.org> + + Make it possible to build WebKit with Python 3 (and 2) + https://bugs.webkit.org/show_bug.cgi?id=94814 + + Exceptions need a hack to work with both. + string.join was already deprecated in Python 2. + Relative imports are no longer supported, use package name instead. + + Reviewed by Ryosuke Niwa. + + * inspector/CodeGeneratorInspector.py: + (EnumConstants.get_enum_constant_code): + (TypeBindings.create_type_declaration_.EnumBinding.get_code_generator.CodeGenerator.generate_type_builder): + (Generator.go): + (Generator.process_event): + (Generator.process_command): + +2012-08-23 Antoine Labour <piman@chromium.org> + + [chromium] Fix lost context when textures are evicted + https://bugs.webkit.org/show_bug.cgi?id=94892 + + Reviewed by James Robinson. + + After eviction, the CCPrioritizedTextureManager is in a limbo state + where all its resources are invalid. If we try to release them we will + double-destroy them. + + New test: CCLayerTreeHostTestLostContextAfterEvictTextures. + + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::recreateContextOnImplThread): + +2012-08-23 Keishi Hattori <keishi@webkit.org> + + REGRESSION(r126132): thumb doesn't match click position for rtl input type=range + https://bugs.webkit.org/show_bug.cgi?id=94890 + + Reviewed by Kent Tamura. + + r126132 broke rtl input type=range so the thumb doesn't match click position. + + Added new tests to range-hit-test-with-padding.html. + + * html/shadow/SliderThumbElement.cpp: + (WebCore::SliderThumbElement::setPositionFromPoint): + +2012-08-23 James Robinson <jamesr@chromium.org> + + Add OVERRIDE and deinline virtual getters on *PlatformGestureCurve + https://bugs.webkit.org/show_bug.cgi?id=94887 + + Reviewed by Dirk Pranke. + + This makes clang happy. Clang makes me happy. By induction, this makes me happy. + + * platform/TouchpadFlingPlatformGestureCurve.cpp: + (WebCore::TouchpadFlingPlatformGestureCurve::debugName): + (WebCore): + * platform/TouchpadFlingPlatformGestureCurve.h: + (TouchpadFlingPlatformGestureCurve): + * platform/WheelFlingPlatformGestureCurve.cpp: + (WebCore::WheelFlingPlatformGestureCurve::debugName): + (WebCore): + * platform/WheelFlingPlatformGestureCurve.h: + (WheelFlingPlatformGestureCurve): + +2012-08-23 Yoshifumi Inoue <yosin@chromium.org> + + [Forms] Step mismatched value should be editable in multiple field time UI. + https://bugs.webkit.org/show_bug.cgi?id=94664 + + Reviewed by Kent Tamura. + + This patch changes layout method of multiple field time input UI to + check value of the "input" element in addition to step and range to + allow users to change step mismatched value from UI. + + Tests: fast/forms/time-multiple-fields/time-multiple-fields-change-layout-by-value.html: for changing layout by value change. + This patch also adds new test case into fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic.html. + + * html/TimeInputType.cpp: + (WebCore::TimeInputType::createShadowSubtree): Changed for DateTimeEditElement::create signature change. + (WebCore::TimeInputType::minOrMaxAttributeChanged): Changed to call updateInnerTextValue instead of removed updateEditElementLayout() + (WebCore::TimeInputType::stepAttributeChanged): ditto. + (WebCore::TimeInputType::updateInnerTextValue): Changed for DateTimeEditElement::setValueAsDate() and setEmptyValue() signature change. + * html/TimeInputType.h: + (TimeInputType): Removed updateEditElementLayout() declaration. + * html/shadow/DateTimeEditElement.cpp: + (DateTimeEditBuilder): + (WebCore::DateTimeEditBuilder::DateTimeEditBuilder): Added a new parameter date value to constructor to use it for layout decision. + (WebCore::DateTimeEditBuilder::needMillisecondField): Changed to check date value too. + (WebCore::DateTimeEditBuilder::needMinuteField): ditto + (WebCore::DateTimeEditBuilder::needSecondField): ditto + (WebCore::DateTimeEditBuilder::shouldMillisecondFieldReadOnly): ditto + (WebCore::DateTimeEditBuilder::shouldMinuteFieldReadOnly): ditto + (WebCore::DateTimeEditBuilder::shouldSecondFieldReadOnly): ditto + (WebCore::DateTimeEditElement::create): Changed for removing stepRange parameter. + (WebCore::DateTimeEditElement::layout): Changed to keep focus field for new layout. + (WebCore::DateTimeEditElement::setValueAsDate): Changed to call layout() with StepRange and date value. + (WebCore::DateTimeEditElement::setEmptyValue): ditto + * html/shadow/DateTimeEditElement.h: + (DateTimeEditElement): + +2012-08-23 Andreas Kling <kling@webkit.org> + + Use immutable StylePropertySets for element inline style declarations. + <http://webkit.org/b/94714> + + Reviewed by Antti Koivisto. + + Construct the inline styles as immutable StylePropertySets initially (until they are + modified through CSSOM APIs), reducing their memory footprint and enabling us to do + sharing optimizations in the future. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseInlineStyleDeclaration): + (WebCore::CSSParser::parseDeclaration): + * css/CSSParser.h: + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::updateInlineStyleAvoidingMutation): + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] V8AbstractEventListener re-implements ScopedPersistent by hand + https://bugs.webkit.org/show_bug.cgi?id=94873 + + Reviewed by Eric Seidel. + + Rather than calling New/Dispose manually, this patch changes + V8AbstractEventListener to use ScopedPersistent. + + * bindings/v8/V8AbstractEventListener.cpp: + (WebCore::V8AbstractEventListener::weakEventListenerCallback): + (WebCore::V8AbstractEventListener::~V8AbstractEventListener): + (WebCore::V8AbstractEventListener::setListenerObject): + (WebCore::V8AbstractEventListener::getReceiverObject): + * bindings/v8/V8AbstractEventListener.h: + (WebCore::V8AbstractEventListener::getListenerObject): + (WebCore::V8AbstractEventListener::getExistingListenerObject): + (WebCore::V8AbstractEventListener::existingListenerObjectPersistentHandle): + (WebCore::V8AbstractEventListener::hasExistingListenerObject): + (V8AbstractEventListener): + +2012-08-23 Simon Fraser <simon.fraser@apple.com> + + Prep work for: Implement sticky positioning + https://bugs.webkit.org/show_bug.cgi?id=90046 + + Reviewed by Dave Hyatt. + + Do some method renaming in preparation for adding a new kind + of in-flow positioning: sticky positioning. + + Rename RenderStyle::isOutOfFlowPositioned() to hasOutOfFlowPosition(). + Add RenderStyle::hasInFlowPosition(). + + Use RenderObject::isInFlowPositioned() in places where it will apply + for both relative and sticky positioning. + + Add RenderBoxModelObject::offsetForInFlowPosition(), which currently + applies just to relative positioning, but will also apply to sticky. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::getPositionOffsetValue): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * editing/TextIterator.cpp: + (WebCore::ignoresContainerClip): + * rendering/LayoutState.cpp: + (WebCore::LayoutState::LayoutState): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::styleWillChange): + (WebCore::RenderBlock::isSelectionRoot): + (WebCore::RenderBlock::blockSelectionGaps): + (WebCore::positionForPointRespectingEditingBoundaries): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::styleWillChange): + (WebCore::RenderBox::updateBoxModelInfoFromStyle): + (WebCore::RenderBox::mapLocalToContainer): + (WebCore::RenderBox::offsetFromContainer): + (WebCore::RenderBox::computeRectForRepaint): + (WebCore::RenderBox::containingBlockLogicalWidthForPositioned): + (WebCore::RenderBox::containingBlockLogicalHeightForPositioned): + (WebCore::RenderBox::layoutOverflowRectForPropagation): + * rendering/RenderBox.h: + * rendering/RenderBoxModelObject.cpp: + (WebCore::accumulateInFlowPositionOffsets): + (WebCore::RenderBoxModelObject::relativePositionOffset): + (WebCore::RenderBoxModelObject::offsetForInFlowPosition): + (WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint): + * rendering/RenderBoxModelObject.h: + (RenderBoxModelObject): + (WebCore::RenderBoxModelObject::stickyPositionLogicalOffset): + (WebCore::RenderBoxModelObject::requiresLayer): + * rendering/RenderInline.cpp: + (WebCore::inFlowPositionedInlineAncestor): We need to actually return + the ancestor, since we will need to copy its position type once there + is more than one kind of in-flow position. + (WebCore::updateStyleOfAnonymousBlockContinuations): + (WebCore::RenderInline::styleDidChange): + (WebCore::RenderInline::addChildIgnoringContinuation): + (WebCore::RenderInline::clippedOverflowRectForRepaint): + (WebCore::RenderInline::computeRectForRepaint): + (WebCore::RenderInline::offsetFromContainer): + (WebCore::RenderInline::mapLocalToContainer): + (WebCore::RenderInline::offsetForInFlowPositionedInline): + * rendering/RenderInline.h: + (WebCore::RenderInline::requiresLayer): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::updateLayerPosition): + (WebCore::isPositionedContainer): + (WebCore::RenderLayer::calculateClipRects): + (WebCore::RenderLayer::shouldBeNormalFlowOnly): + * rendering/RenderLayer.h: + (WebCore::RenderLayer::offsetForInFlowPosition): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::markContainingBlocksForLayout): + (WebCore::RenderObject::setPreferredLogicalWidthsDirty): + (WebCore::RenderObject::invalidateContainerPreferredLogicalWidths): + (WebCore::RenderObject::containingBlock): + * rendering/RenderObject.h: + (WebCore::RenderObject::isRelPositioned): + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::updateBeforeAfterContent): + * rendering/style/RenderStyle.h: + +2012-08-23 Ryosuke Niwa <rniwa@webkit.org> + + EFL build fix attempt after r126494. Try touching the IDL file. + + * Modules/battery/BatteryManager.idl: + +2012-08-23 Adam Barth <abarth@webkit.org> + + Unreviewed attempt to fix build failure in Debug. + + * bindings/v8/ScriptValue.h: + +2012-08-23 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Expose mechanism for database to force a connection to close + https://bugs.webkit.org/show_bug.cgi?id=91010 + + Reviewed by Tony Chang. + + In response to user action (e.g. "delete my browsing data") a connection may + need to be forcibly terminated. This allows an event to be sent to a connection + from the back end via IDBDatabaseCallbacks to initiate closing the connection. + + Test: [chromium] webkit_unit_test --gtest_filter='IDBDatabaseBackendTest.ForcedClose' + + * Modules/indexeddb/IDBDatabase.cpp: + (WebCore::IDBDatabase::forceClose): Abort all transactions and close. + (WebCore): + * Modules/indexeddb/IDBDatabase.h: + (IDBDatabase): Entry point. + * Modules/indexeddb/IDBDatabaseCallbacks.h: + (IDBDatabaseCallbacks): Event plumbing from back end. + * Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp: + (WebCore::IDBDatabaseCallbacksImpl::onForcedClose): Ditto. + (WebCore): + * Modules/indexeddb/IDBDatabaseCallbacksImpl.h: + (IDBDatabaseCallbacksImpl): Ditto. + * inspector/InspectorIndexedDBAgent.cpp: + (WebCore): Method stub. + +2012-08-23 James Robinson <jamesr@chromium.org> + + [chromium] Convert WebAnimationCurve subtypes into pure virtual + https://bugs.webkit.org/show_bug.cgi?id=94068 + + Reviewed by Adrienne Walker. + + Updates users of the Web*AnimationCurve interface for its new pointery goodness. + + * platform/graphics/chromium/AnimationTranslationUtil.cpp: + (WebCore::appendKeyframeWithStandardTimingFunction): + (WebCore::appendKeyframeWithCustomBezierTimingFunction): + (WebCore::WebTransformAnimationCurve): + (WebCore::createWebAnimation): + +2012-08-23 Emil A Eklund <eae@chromium.org> + + Add saturation arithmetic support to FractionalLayoutUnit + https://bugs.webkit.org/show_bug.cgi?id=94364 + + Reviewed by Benjamin Poulain. + + Add experimental saturation arithmetic support to FractionalLayoutUnit, + guarded by a flag. + The idea here is to saturate (or clamp) rather than overflow when + computing positions and sizes. + + No new tests for WebCore, not enabled by default. + + * platform/FractionalLayoutUnit.h: + (WebCore::FractionalLayoutUnit::intMinForLayoutUnit): + Use INT_MIN instead of -INT_MAX to compute minimum value as the two are + not the same. + + (WebCore::FractionalLayoutUnit::FractionalLayoutUnit): + (WebCore::FractionalLayoutUnit::fromFloatCeil): + (WebCore::FractionalLayoutUnit::fromFloatFloor): + (WebCore::FractionalLayoutUnit::fromFloatRound): + (WebCore::FractionalLayoutUnit::setValue): + Add range checks. + + (WebCore::operator*): + (WebCore::operator+): + (WebCore::operator-): + (WebCore::operator+=): + (WebCore::operator-=): + Use the saturatedAddition and saturatedSubtraction functions, which have + been optimized to reduce branching, instead of range checks for the most + common operators. + +2012-08-23 Kenneth Russell <kbr@google.com> + + Unreviewed, rolling out r126483. + http://trac.webkit.org/changeset/126483 + https://bugs.webkit.org/show_bug.cgi?id=92272 + + Caused two Chromium browser_tests to time out 100% reliably. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::init): + (WebCore::FrameLoader::prepareForLoadStart): + (WebCore::FrameLoader::clearProvisionalLoad): + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + (WebCore::FrameLoader::detachFromParent): + * loader/FrameLoader.h: + (FrameLoader): + +2012-08-23 Kentaro Hara <haraken@chromium.org> + + Unreviewed. Just added comments I forgot to add in r126506. + + * bindings/v8/ScriptController.h: + (WebCore): + (ScriptController): + +2012-08-23 Kenneth Russell <kbr@google.com> + + Unreviewed, rolling out r126483. + http://trac.webkit.org/changeset/126483 + https://bugs.webkit.org/show_bug.cgi?id=92272 + + Caused two Chromium browser_tests to time out 100% reliably. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::init): + (WebCore::FrameLoader::prepareForLoadStart): + (WebCore::FrameLoader::clearProvisionalLoad): + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + (WebCore::FrameLoader::detachFromParent): + * loader/FrameLoader.h: + (FrameLoader): + +2012-08-23 Kentaro Hara <haraken@chromium.org> + + [V8] Remove V8Proxy.{h,cpp} + https://bugs.webkit.org/show_bug.cgi?id=94794 + + Reviewed by Dimitri Glazkov. + + Now V8Proxy is no longer used. We can completely remove V8Proxy from the codebase. + + No tests. No change in behavior. + + * UseV8.cmake: + * WebCore.gypi: + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateImplementation): + (GenerateCallbackImplementation): + * bindings/scripts/test/V8/V8Float64Array.cpp: + * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: + * bindings/scripts/test/V8/V8TestCallback.cpp: + * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: + * bindings/scripts/test/V8/V8TestEventConstructor.cpp: + * bindings/scripts/test/V8/V8TestEventTarget.cpp: + * bindings/scripts/test/V8/V8TestException.cpp: + * bindings/scripts/test/V8/V8TestInterface.cpp: + * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: + * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: + * bindings/scripts/test/V8/V8TestNode.cpp: + * bindings/scripts/test/V8/V8TestObj.cpp: + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::ScriptController): + (WebCore::ScriptController::~ScriptController): + (WebCore::ScriptController::callFunction): + (WebCore::ScriptController::clearWindowShell): + * bindings/v8/ScriptController.h: + (WebCore): + (ScriptController): + * bindings/v8/V8AbstractEventListener.h: + (WebCore): + * bindings/v8/V8Binding.cpp: + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::reportFatalErrorInV8): + * bindings/v8/V8DOMWrapper.h: + (WebCore): + * bindings/v8/V8ObjectConstructor.cpp: + (WebCore::V8ObjectConstructor::newInstanceInDocument): + * bindings/v8/V8Proxy.cpp: Removed. + * bindings/v8/V8Proxy.h: Removed. + * bindings/v8/V8RecursionScope.h: + (WebCore): + * bindings/v8/V8Utilities.cpp: + * bindings/v8/custom/V8CustomXPathNSResolver.h: + +2012-08-23 Otto Derek Cheung <otcheung@rim.com> + + + [BlackBerry] Add a check to filter out cookies that tries to set the domain to a top level domain + https://bugs.webkit.org/show_bug.cgi?id=94722 + + Reviewed by Rob Buis. + + Changing the topleveldomain method name for better readability. + + Also renaming the TopLevelDomain.h in platform to DomainTools + because there exists other tests that should belong in the same file. + + Only changing method names and include file names. + + * platform/blackberry/CookieParser.cpp: + (WebCore::CookieParser::parseOneCookie): + +2012-08-23 Shezan Baig <shezbaig.wk@gmail.com> + + Fix cross-direction stretch for replaced elements in column flexbox + https://bugs.webkit.org/show_bug.cgi?id=94604 + + Reviewed by Ojan Vafai. + + Moved the logic that constrains logical width by MinSize and MaxSize to + a new helper function called constrainLogicalWidthInRegionByMinMax. + This helper function is used from both computeLogicalWidthInRegion and + RenderFlexibleBox::applyStretchAlignmentToChild. + + RenderFlexibleBox no longer checks for isMultiline when stretching + elements in a column flexbox. Instead, we now constrain the available + width by the child's min-width and max-width, and set the override + width only if that constrained width is different from the child's + current logicalWidth. + + No new tests. The existing css3/flexbox/flexitem.html test was extended + to exercise the new code. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::constrainLogicalWidthInRegionByMinMax): New helper + method to constrain logical width by min-width and max-width. + (WebCore): + (WebCore::RenderBox::computeLogicalWidthInRegion): Changed to use the + new constrainLogicalWidthInRegionByMinMax helper method. + * rendering/RenderBox.h: + (RenderBox): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Changed to + use constrainLogicalWidthInRegionByMinMax to determine the override + width for the child. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] ScriptState is using stone knifes and bear skins + https://bugs.webkit.org/show_bug.cgi?id=94846 + + Reviewed by Eric Seidel. + + This patch just modernizes ScriptState to use some of the newer tools + available in the V8 bindings. There shouldn't be any behavior changes. + + * bindings/v8/ScriptState.cpp: + (WebCore::ScriptState::ScriptState): + (WebCore::ScriptState::~ScriptState): + (WebCore::ScriptState::domWindow): + (WebCore::ScriptState::scriptExecutionContext): + (WebCore::ScriptState::forContext): + (WebCore::ScriptState::current): + * bindings/v8/ScriptState.h: + (WebCore): + (WebCore::ScriptState::context): + (ScriptState): + (WebCore::ScriptStateProtectedPtr::ScriptStateProtectedPtr): + (ScriptStateProtectedPtr): + * bindings/v8/V8Binding.cpp: + (WebCore::toScriptExecutionContext): + (WebCore): + * bindings/v8/V8Binding.h: + (WebCore): + +2012-08-23 Dana Jansens <danakj@chromium.org> + + [chromium] Don't require a RenderSurface* in order to create a RenderPass + https://bugs.webkit.org/show_bug.cgi?id=94862 + + Reviewed by Adrienne Walker. + + If a test wants to create a RenderPass, they are required to create a + Layer, and a RenderSurface. This is not ideal, we should let tests + create RenderPasses more simply by giving the information that it needs. + + This also helps us recreate the RenderPasses after receiving a copy + via IPC. + + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::create): + (WebCore::CCRenderPass::CCRenderPass): + * platform/graphics/chromium/cc/CCRenderPass.h: + (CCRenderPass): + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] ScriptValue should use ScopedPresistent rather than calling New/Dispose directly + https://bugs.webkit.org/show_bug.cgi?id=94864 + + Reviewed by Eric Seidel. + + ScriptValue was created before ScopedPersistent existed and therefore + calls New/Dispose manually. Instead, it should use the less error-prone + approach of having ScopedPersistent balance those calls. + + * bindings/v8/ScriptValue.cpp: + (WebCore::ScriptValue::serialize): + (WebCore::ScriptValue::getString): + (WebCore::ScriptValue::toString): + (WebCore::ScriptValue::toInspectorValue): + * bindings/v8/ScriptValue.h: + (WebCore::ScriptValue::ScriptValue): + (WebCore::ScriptValue::operator=): + (WebCore::ScriptValue::operator==): + (WebCore::ScriptValue::isEqual): + (WebCore::ScriptValue::isFunction): + (WebCore::ScriptValue::isNull): + (WebCore::ScriptValue::isUndefined): + (WebCore::ScriptValue::isObject): + (WebCore::ScriptValue::hasNoValue): + (WebCore::ScriptValue::clear): + (WebCore::ScriptValue::v8Value): + (ScriptValue): + +2012-08-22 James Robinson <jamesr@chromium.org> + + [chromium] Remove WebLayer::setChildren API + https://bugs.webkit.org/show_bug.cgi?id=94749 + + Reviewed by Adrienne Walker. + + Sets up the child list directly instead of building an intermediate buffer. Covered by compositing/* + + * platform/graphics/chromium/GraphicsLayerChromium.cpp: + (WebCore::GraphicsLayerChromium::updateChildList): + +2012-08-23 Dominic Mazzoni <dmazzoni@google.com> + + AX: Focusable elements without a role should not be ignored + https://bugs.webkit.org/show_bug.cgi?id=94302 + + Reviewed by Chris Fleizach. + + Changes the accessibility logic so that a generic element that's focusable is + not ignored for accessibility, and returns its inner text as its title. That way + if you Tab to the element, a reasonable accessibility notification is generated. + + One exception is the body element, because focusing the body is equivalent to + blurring the current focused element and does not result in a "focus" accessibility + notification. + + Also fixes logic that determined if an element was contentEditable by making + sure it catches the case with no attribute value (e.g. <div contentEditable>), + which also implies contentEditable=true according to the spec. + + Test: accessibility/focusable-div.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore): + (WebCore::nodeHasContentEditableAttributeSet): + (WebCore::AccessibilityRenderObject::title): + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + +2012-08-23 Julien Chaffraix <jchaffraix@webkit.org> + + Remove RenderTable::removeChild + https://bugs.webkit.org/show_bug.cgi?id=94842 + + Reviewed by Abhishek Arya. + + This change removed removeChild, replaced by willBeRemovedFromTree calls. The upside is that + the invalidations are now guaranteed to run if we split a table (which is not guaranteed when + using removeChild). This change also shows that our code may be doing too much work in some + of the child's removal, in which case the code was marked as needed. + + Covered by existing tests. + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::removeCaption): + Helper function used to remove the caption from our Vector. The invalidation are very likely + unneeded so added a comment about that. + + * rendering/RenderTable.h: + * rendering/RenderTableCaption.cpp: + (WebCore::RenderTableCaption::willBeRemovedFromTree): + (WebCore::RenderTableCaption::table): + * rendering/RenderTableCaption.h: + * rendering/RenderTableCol.cpp: + (WebCore::RenderTableCol::willBeRemovedFromTree): + * rendering/RenderTableCol.h: + Added the following functions to do the invalidation. + +2012-08-23 Mark Hahnenberg <mhahnenberg@apple.com> + + Change behavior of MasqueradesAsUndefined to better accommodate DFG changes + https://bugs.webkit.org/show_bug.cgi?id=93884 + + Reviewed by Filip Pizlo. + + With some upcoming changes to the DFG to remove uses of ClassInfo, we will be changing the behavior of + MasqueradesAsUndefined. In order to make this change consistent across all of our execution engines, + we will make this change to MasqueradesAsUndefined as a separate patch. After this patch, MasqueradesAsUndefined + objects will only masquerade as undefined in their original context (i.e. their original JSGlobalObject). + For example, if an object that masquerades as undefined in frame A is passed to frame B, it will not + masquerade as undefined within frame B, but it will continue to masquerade in frame A. + + Test: fast/js/document-all-between-frames.html + + All of the changes in WebCore are simply passing the additional ExecState argument to JSValue::toBoolean. + + * bindings/js/JSCustomSQLStatementErrorCallback.cpp: + (WebCore::JSSQLStatementErrorCallback::handleEvent): + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::addEventListener): + (WebCore::JSDOMWindow::removeEventListener): + * bindings/js/JSDataViewCustom.cpp: + (WebCore::getDataViewMember): + * bindings/js/JSDeviceMotionEventCustom.cpp: + (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): + * bindings/js/JSDeviceOrientationEventCustom.cpp: + (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent): + * bindings/js/JSDictionary.cpp: + (WebCore::JSDictionary::convertValue): + * bindings/js/JSHTMLCanvasElementCustom.cpp: + (WebCore::JSHTMLCanvasElement::getContext): + * bindings/js/JSInspectorFrontendHostCustom.cpp: + (WebCore::populateContextMenuItems): + * bindings/js/JSMessageEventCustom.cpp: + (WebCore::handleInitMessageEvent): + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::dataFunctionMatrix): + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::open): + * bindings/js/JavaScriptCallFrame.cpp: + (WebCore::JavaScriptCallFrame::exec): + (WebCore): + * bindings/js/JavaScriptCallFrame.h: + (JavaScriptCallFrame): + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::hasBreakpoint): + * bindings/js/SerializedScriptValue.cpp: + (WebCore::CloneSerializer::dumpIfTerminal): + * bindings/scripts/CodeGeneratorJS.pm: Also add the custom create function for MasqueradesAsUndefined JS DOM wrappers. + (GenerateEventListenerCall): + (GenerateHeader): + (JSValueToNative): + * bindings/scripts/test/JS/JSTestEventTarget.cpp: + (WebCore::jsTestEventTargetPrototypeFunctionAddEventListener): + (WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener): + * bindings/scripts/test/JS/JSTestEventTarget.h: + (WebCore::JSTestEventTarget::create): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::setJSTestObjCreate): + (WebCore::setJSTestObjReflectedBooleanAttr): + (WebCore::setJSTestObjReflectedCustomBooleanAttr): + (WebCore::jsTestObjPrototypeFunctionAddEventListener): + (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): + * bridge/c/c_utility.cpp: + (JSC::Bindings::convertValueToNPVariant): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::convertValueToJObject): + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2012-08-23 Adenilson Cavalcanti <cavalcantii@gmail.com> + + CSSParser: Move enumeration to a common place (StylePropertyShorthand) + https://bugs.webkit.org/show_bug.cgi?id=93210 + + Reviewed by Dean Jackson. + + CSSParser::parseAnimationShorthand() uses an enumeration with the same + elements as another enumeration present in StylePropertyShorthand, but + with different ordering of values. This patch puts both enums in the same place. + + No new tests. No change in behavior. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseAnimationShorthand): + * css/StylePropertyShorthand.cpp: + (WebCore::webkitAnimationShorthandForParsing): + (WebCore): + * css/StylePropertyShorthand.h: + (WebCore): + +2012-08-23 Mike West <mkwst@chromium.org> + + Trailing spaces in CSP source lists should not generate console warnings. + https://bugs.webkit.org/show_bug.cgi?id=94847 + + Reviewed by Adam Barth. + + Trailing space after a valid source in a Content Security Policy source + list was accidentally generating console warnings about an invalid + (empty) source. This patch silently ignores trailing whitespace instead. + + A test-case has been added to 'source-list-parsing-02.html' to cover + this case. + + * page/ContentSecurityPolicy.cpp: + (WebCore::CSPSourceList::parse): + Return early if we reach the end of the source list after skipping + leading whitespace. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] OwnHandle is a bit of a misnomer + https://bugs.webkit.org/show_bug.cgi?id=94841 + + Reviewed by Eric Seidel. + + You don't really own the handle in the same way that you own a pointer + with OwnPtr. This class is more correctly called ScopedPersistent + because it just forces you to balance New() and Dispose() calls. + + * WebCore.gypi: + * bindings/v8/JavaScriptCallFrame.h: + (JavaScriptCallFrame): + * bindings/v8/OwnHandle.h: Removed. + * bindings/v8/ScheduledAction.h: + (ScheduledAction): + * bindings/v8/ScopedPersistent.h: Copied from Source/WebCore/bindings/v8/OwnHandle.h. + (ScopedPersistent): + (WebCore::ScopedPersistent::ScopedPersistent): + (WebCore::ScopedPersistent::~ScopedPersistent): + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::compileScript): + (WebCore::ScriptDebugServer::runScript): + * bindings/v8/ScriptDebugServer.h: + (ScriptDebugServer): + * bindings/v8/ScriptInstance.h: + (V8ScriptInstance): + * bindings/v8/V8PerContextData.h: + (V8PerContextData): + +2012-08-23 Nate Chapin <japhet@chromium.org> + + ProgressTracker never completes if iframe detached during parsing + https://bugs.webkit.org/show_bug.cgi?id=92272 + + Reviewed by Adam Barth. + + Add a simple helper class to FrameLoader to ensure progressStarted/progressCompleted calls are matched, + and balance the calls when the Frame is detached. + + No new tests, as this behavior has only been producing reliably by setting a breakpoint in a specific place. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::init): + (WebCore::FrameLoader::FrameProgressTracker::progressStarted): + (WebCore::FrameLoader::FrameProgressTracker::progressCompleted): + (WebCore::FrameLoader::FrameProgressTracker::~FrameProgressTracker): + (WebCore::FrameLoader::prepareForLoadStart): + (WebCore::FrameLoader::clearProvisionalLoad): + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + (WebCore::FrameLoader::detachFromParent): + * loader/FrameLoader.h: + (FrameProgressTracker): + (WebCore::FrameLoader::FrameProgressTracker::create): + (WebCore::FrameLoader::FrameProgressTracker::FrameProgressTracker): + +2012-08-23 Dana Jansens <danakj@chromium.org> + + [chromium] Create sharedQuadState at same time as creating quads and give them to the quadSink + https://bugs.webkit.org/show_bug.cgi?id=94752 + + Reviewed by Adrienne Walker. + + Previously, CCRenderPass would create a sharedQuadState for a layer, + and pass it in to the layer. Then the layer would point all its quads + at the sharedQuadState. + + After this change, the layer creates its own sharedQuadState, gives it + to the RenderPass (via CCQuadSink), and points its quads at it. + + This approach allows a layer to generate more than one sharedQuadState + with different quads pointing to different shared states. Also, this + will allow the layer representing a delegating renderer (via ubercomp) + to copy sharedQuadStates from the delegating renderer in order to + merge its quads into the RenderPass for the current renderer. + + Covered by existing tests, no change in behaviour. + + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp: + (WebCore::CCHeadsUpDisplayLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h: + (CCHeadsUpDisplayLayerImpl): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h: + (CCIOSurfaceLayerImpl): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::createSharedQuadState): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + (WebCore::CCLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + (WebCore::CCQuadCuller::CCQuadCuller): + (WebCore::CCQuadCuller::append): + (WebCore::CCQuadCuller::useSharedQuadState): + (WebCore): + * platform/graphics/chromium/cc/CCQuadCuller.h: + (WebCore): + (CCQuadCuller): + * platform/graphics/chromium/cc/CCQuadSink.h: + (WebCore): + (CCQuadSink): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsForLayer): + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + (WebCore::CCRenderPass::appendQuadsToFillScreen): + * platform/graphics/chromium/cc/CCRenderPass.h: + (WebCore): + (CCRenderPass): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp: + (WebCore::CCScrollbarLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h: + (CCScrollbarLayerImpl): + * platform/graphics/chromium/cc/CCSharedQuadState.cpp: + (WebCore::CCSharedQuadState::create): + (WebCore::CCSharedQuadState::CCSharedQuadState): + * platform/graphics/chromium/cc/CCSharedQuadState.h: + (CCSharedQuadState): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp: + (WebCore::CCSolidColorLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: + (CCSolidColorLayerImpl): + * platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: + (WebCore::CCTextureLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTextureLayerImpl.h: + (CCTextureLayerImpl): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + (CCVideoLayerImpl): + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Remove some unneeded cruft from WebCore.xcodeproj. + + * WebCore.xcodeproj/project.pbxproj: + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Make WebCore build with the latest version of clang. + + Reviewed by Dan Bernstein. + + * html/shadow/MediaControlRootElement.h: Remove m_textTrackDisplay as it is unused. + * platform/audio/mac/AudioFileReaderMac.cpp: + (WebCore::AudioFileReader::AudioFileReader): Remove m_filePath as it is unused. + * platform/audio/mac/AudioFileReaderMac.h: + (AudioFileReader): Ditto. + * platform/graphics/ImageSource.h: + (ImageSource): Guard m_alphaOption and m_gammaAndColorProfileOption with !USE(CG) + as they're unused on platforms using CG. + * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: + (MediaPlayerPrivateAVFoundationObjC): Remove m_player as it is unused. + * platform/graphics/cg/ImageSourceCG.cpp: + (WebCore::ImageSource::ImageSource): Don't initialize the m_alphaOption and + m_gammaAndColorProfileOption members since we never use them. + * platform/graphics/mac/GraphicsContext3DMac.mm: + (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate): Remove m_graphicsContext3D + as it is unused. + +2012-08-23 Alexandre Elias <aelias@chromium.org> + + [chromium] Rename LayerRendererChromium to GL-specific name + https://bugs.webkit.org/show_bug.cgi?id=94835 + + Reviewed by James Robinson. + + Over time, LayerRendererChromium has evolved to be a GL-specific + subclass of CCRenderer that has no awareness of layers (as it operates + only with drawQuads). + + This patch renames LayerRendererChromium to CCRendererGL, replaces all + instances of "layerRenderer" with just "renderer", and removes a + few unnecessary includes of LayerRendererChromium.h. + + No new tests (no-op refactoring). + + * WebCore.gypi: + * platform/graphics/chromium/Canvas2DLayerBridge.cpp: + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/GeometryBinding.cpp: + * platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp: + (WebCore::HeadsUpDisplayLayerChromium::update): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/LayerTextureSubImage.cpp: + * platform/graphics/chromium/ProgramBinding.cpp: + * platform/graphics/chromium/RenderSurfaceChromium.h: + (WebCore): + * platform/graphics/chromium/ScrollbarLayerChromium.cpp: + (WebCore::ScrollbarLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/TextureCopier.cpp: + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::updateTileSizeAndTilingOption): + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp: + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::sortLayers): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::initializeRenderer): + (WebCore::CCLayerTreeHost::deleteContentsTexturesOnImplThread): + (WebCore::CCLayerTreeHost::finishAllRendering): + (WebCore::CCLayerTreeHost::rendererCapabilities): + (WebCore::CCLayerTreeHost::initializeRendererIfNeeded): + (WebCore::CCLayerTreeHost::updateLayers): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore::RendererCapabilities::RendererCapabilities): + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::canDraw): + (WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList): + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::CCLayerTreeHostImpl::drawLayers): + (WebCore::CCLayerTreeHostImpl::finishAllRendering): + (WebCore::CCLayerTreeHostImpl::isContextLost): + (WebCore::CCLayerTreeHostImpl::rendererCapabilities): + (WebCore::CCLayerTreeHostImpl::swapBuffers): + (WebCore::CCLayerTreeHostImpl::readback): + (WebCore::CCLayerTreeHostImpl::setVisible): + (WebCore::CCLayerTreeHostImpl::initializeRenderer): + (WebCore::CCLayerTreeHostImpl::setViewportSize): + (WebCore::CCLayerTreeHostImpl::ensureRenderSurfaceLayerList): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (WebCore): + (WebCore::CCLayerTreeHostImpl::renderer): + (CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + * platform/graphics/chromium/cc/CCPriorityCalculator.cpp: + * platform/graphics/chromium/cc/CCProxy.h: + (WebCore): + (CCProxy): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderer.h: + (CCRenderer): + * platform/graphics/chromium/cc/CCRendererGL.cpp: Renamed from Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp. + (WebCore::CCRendererGL::create): + (WebCore): + (WebCore::CCRendererGL::CCRendererGL): + (WebCore::CCRendererGL::initialize): + (WebCore::CCRendererGL::~CCRendererGL): + (WebCore::CCRendererGL::context): + (WebCore::CCRendererGL::debugGLCall): + (WebCore::CCRendererGL::setVisible): + (WebCore::CCRendererGL::releaseRenderPassTextures): + (WebCore::CCRendererGL::viewportChanged): + (WebCore::CCRendererGL::clearFramebuffer): + (WebCore::CCRendererGL::beginDrawingFrame): + (WebCore::CCRendererGL::doNoOp): + (WebCore::CCRendererGL::drawQuad): + (WebCore::CCRendererGL::drawCheckerboardQuad): + (WebCore::CCRendererGL::drawDebugBorderQuad): + (WebCore::applyFilters): + (WebCore::CCRendererGL::drawBackgroundFilters): + (WebCore::CCRendererGL::drawRenderPassQuad): + (WebCore::CCRendererGL::drawSolidColorQuad): + (TileProgramUniforms): + (WebCore::tileUniformLocation): + (WebCore::CCRendererGL::drawTileQuad): + (WebCore::CCRendererGL::drawYUVVideoQuad): + (WebCore::CCRendererGL::drawStreamVideoQuad): + (WebCore::TextureProgramBinding::set): + (TextureProgramBinding): + (WebCore::TexTransformTextureProgramBinding::set): + (TexTransformTextureProgramBinding): + (WebCore::CCRendererGL::drawTextureQuad): + (WebCore::CCRendererGL::drawIOSurfaceQuad): + (WebCore::CCRendererGL::finishDrawingFrame): + (WebCore::CCRendererGL::toGLMatrix): + (WebCore::CCRendererGL::setShaderFloatQuad): + (WebCore::CCRendererGL::setShaderOpacity): + (WebCore::CCRendererGL::drawQuadGeometry): + (WebCore::CCRendererGL::copyTextureToFramebuffer): + (WebCore::CCRendererGL::finish): + (WebCore::CCRendererGL::swapBuffers): + (WebCore::CCRendererGL::onSwapBuffersComplete): + (WebCore::CCRendererGL::onMemoryAllocationChanged): + (WebCore::CCRendererGL::onMemoryAllocationChangedOnImplThread): + (WebCore::CCRendererGL::discardFramebuffer): + (WebCore::CCRendererGL::ensureFramebuffer): + (WebCore::CCRendererGL::onContextLost): + (WebCore::CCRendererGL::getFramebufferPixels): + (WebCore::CCRendererGL::getFramebufferTexture): + (WebCore::CCRendererGL::useScopedTexture): + (WebCore::CCRendererGL::bindFramebufferToOutputSurface): + (WebCore::CCRendererGL::bindFramebufferToTexture): + (WebCore::CCRendererGL::enableScissorTestRect): + (WebCore::CCRendererGL::disableScissorTest): + (WebCore::CCRendererGL::setDrawViewportSize): + (WebCore::CCRendererGL::makeContextCurrent): + (WebCore::CCRendererGL::initializeSharedObjects): + (WebCore::CCRendererGL::tileCheckerboardProgram): + (WebCore::CCRendererGL::solidColorProgram): + (WebCore::CCRendererGL::renderPassProgram): + (WebCore::CCRendererGL::renderPassProgramAA): + (WebCore::CCRendererGL::renderPassMaskProgram): + (WebCore::CCRendererGL::renderPassMaskProgramAA): + (WebCore::CCRendererGL::tileProgram): + (WebCore::CCRendererGL::tileProgramOpaque): + (WebCore::CCRendererGL::tileProgramAA): + (WebCore::CCRendererGL::tileProgramSwizzle): + (WebCore::CCRendererGL::tileProgramSwizzleOpaque): + (WebCore::CCRendererGL::tileProgramSwizzleAA): + (WebCore::CCRendererGL::textureProgram): + (WebCore::CCRendererGL::textureProgramFlip): + (WebCore::CCRendererGL::textureIOSurfaceProgram): + (WebCore::CCRendererGL::videoYUVProgram): + (WebCore::CCRendererGL::videoStreamTextureProgram): + (WebCore::CCRendererGL::cleanupSharedObjects): + (WebCore::CCRendererGL::isContextLost): + * platform/graphics/chromium/cc/CCRendererGL.h: Renamed from Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h. + (WebKit): + (WebCore): + (CCRendererGL): + (WebCore::CCRendererGL::sharedGeometryQuad): + (WebCore::CCRendererGL::sharedGeometry): + (WebCore::CCRendererGL::isFramebufferDiscarded): + * platform/graphics/chromium/cc/CCResourceProvider.cpp: + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::CCSingleThreadProxy): + (WebCore::CCSingleThreadProxy::initializeRenderer): + (WebCore::CCSingleThreadProxy::recreateContext): + (WebCore::CCSingleThreadProxy::rendererCapabilities): + (WebCore::CCSingleThreadProxy::doCommit): + (WebCore::CCSingleThreadProxy::forceSerializeOnSwapBuffers): + (WebCore::CCSingleThreadProxy::commitAndComposite): + * platform/graphics/chromium/cc/CCSingleThreadProxy.h: + (CCSingleThreadProxy): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::CCThreadProxy): + (WebCore::CCThreadProxy::compositeAndReadback): + (WebCore::CCThreadProxy::initializeRenderer): + (WebCore::CCThreadProxy::recreateContext): + (WebCore::CCThreadProxy::rendererCapabilities): + (WebCore::CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread): + (WebCore::CCThreadProxy::beginFrame): + (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread): + (WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal): + (WebCore::CCThreadProxy::initializeRendererOnImplThread): + (WebCore::CCThreadProxy::recreateContextOnImplThread): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + +2012-08-23 Shezan Baig <shezbaig.wk@gmail.com> + + Flexbox doesn't need to compute logical height for stretched items in row flow + https://bugs.webkit.org/show_bug.cgi?id=94807 + + Reviewed by Tony Chang. + + Change logicalHeightConstrainedByMinMax to + constrainLogicalHeightByMinMax. The new method doesn't compute the + MainOrPreferred logical height (that computation has been moved back to + computeLogicalHeight). RenderFlexibleBox now just constrains the + stretchedLogicalHeight by min/max. + + No new tests. This is a cleanup of bug 94237. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::constrainLogicalHeightByMinMax): Instead of + computing the MainOrPreferred logical height, just constrain the given + logical height by MinSize and MaxSize. + (WebCore::RenderBox::computeLogicalHeight): Compute the MainOrPreferred + logical height before constraining by min/max. + * rendering/RenderBox.h: + (RenderBox): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Use + constrainLogicalHeightByMinMax to constrain the stretchedLogicalHeight. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] V8ScriptInstance is much more complicated than necessary + https://bugs.webkit.org/show_bug.cgi?id=94785 + + Reviewed by Kentaro Hara. + + V8ScriptInstance just needs to be a one-line wrapper around OwnHandle. + + * bindings/v8/OwnHandle.h: + (WebCore::OwnHandle::get): + * bindings/v8/ScriptInstance.cpp: + (WebCore::V8ScriptInstance::V8ScriptInstance): + (WebCore::V8ScriptInstance::~V8ScriptInstance): + (WebCore::V8ScriptInstance::instance): + * bindings/v8/ScriptInstance.h: + (WebCore::V8ScriptInstance::create): + (V8ScriptInstance): + +2012-08-23 Christophe Dumez <christophe.dumez@intel.com> + + Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics + https://bugs.webkit.org/show_bug.cgi?id=65292 + + Reviewed by Oliver Hunt. + + JSC now correctly serialize Boolean, Number and String objects as per + the structured clone algorithm specification. This patch reduces the + delta with the V8 implementation of SerializedScriptValue. + + No new tests, already tested by fast/dom/Window/window-postmessage-clone.html + + * bindings/js/SerializedScriptValue.cpp: + (WebCore): + (WebCore::CloneSerializer::dumpStringObject): + (CloneSerializer): + (WebCore::CloneSerializer::dumpIfTerminal): + (WebCore::CloneDeserializer::readTerminal): + +2012-08-23 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Move onSuccess(IDBDatabaseBackendInterface) to IDBOpenDBRequest + https://bugs.webkit.org/show_bug.cgi?id=94757 + + Reviewed by Tony Chang. + + Move the implementation of IDBCallbacks::onSuccess(IDBDatabaseBackendInterface) + from IDBRequest to the new IDBOpenDBRequest, which is the only request type that + should be receiving that callback. + + No new tests - no functional changes. + + * Modules/indexeddb/IDBCallbacks.h: + (IDBCallbacks): + (WebCore::IDBCallbacks::onSuccess): + * Modules/indexeddb/IDBOpenDBRequest.cpp: + (WebCore::IDBOpenDBRequest::onUpgradeNeeded): + (WebCore::IDBOpenDBRequest::onSuccess): + (WebCore): + * Modules/indexeddb/IDBOpenDBRequest.h: + (IDBOpenDBRequest): + * Modules/indexeddb/IDBRequest.cpp: + * Modules/indexeddb/IDBRequest.h: + +2012-08-23 Andrei Onea <onea@adobe.com> + + [CSSRegions]Crash when moving anonymous block children inside a named flow + https://bugs.webkit.org/show_bug.cgi?id=90865 + + Reviewed by Abhishek Arya. + + When an anonymous block's children are detached in RenderBlock::collapseAnonymousBoxChild, the reference + to their enclosingRenderFlowThread is lost and causes a crash in RenderObject::willBeRemovedFromTree. + Because of this, we now maintain the enclosingRenderFlowThread during the whole lifetime of the + RenderBlock::collapseAnonymousBoxChild function, using a CurrentRenderFlowThreadMaintainer local. + + + Test: fast/regions/move-anonymous-block-inside-named-flow-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::collapseAnonymousBoxChild): + * rendering/RenderFlowThread.cpp: + (WebCore::CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer): + (WebCore): + (WebCore::CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer): + Moved CurrentRenderFlowThreadMaintaner declaration from .cpp to .h, so that we can access it from + RenderBlock::collapseAnonymousBoxChild. + * rendering/RenderFlowThread.h: + (CurrentRenderFlowThreadMaintainer): + (WebCore): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::willBeRemovedFromTree): + +2012-08-23 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Add wx to the list of platforms that use CoreText + APIs on Mac. + + * platform/graphics/SimpleFontData.h: + (SimpleFontData): + +2012-08-23 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Don't rely on implicit casts, explicitly use the + Cursor constructor that takes a platform cursor for creating native cursors. + + * platform/wx/CursorWx.cpp: + (WebCore::pointerCursor): + (WebCore::crossCursor): + (WebCore::handCursor): + (WebCore::iBeamCursor): + (WebCore::waitCursor): + (WebCore::helpCursor): + (WebCore::eastResizeCursor): + (WebCore::northResizeCursor): + (WebCore::northEastResizeCursor): + (WebCore::northWestResizeCursor): + (WebCore::columnResizeCursor): + (WebCore::rowResizeCursor): + (WebCore::notAllowedCursor): + (WebCore::zoomInCursor): + (WebCore::moveCursor): + +2012-08-23 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> + + Remove redundant check for negative values when using WebCore::Color::alpha() + https://bugs.webkit.org/show_bug.cgi?id=94811 + + Reviewed by Eric Seidel. + + Though alpha() returns a signed value (int), its value is stored on an unsigned + typedef (RGBA32) and is safeguarded by alphaChannel() that its value never goes + beyond 255, so no integer overflow, thus we can safely remove redundant check + for negative values while using it. + + This change does not affect behavior, so no new tests needed. + + * platform/graphics/Image.cpp: + (WebCore::Image::fillWithSolidColor): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): Using hasAlpha() for readibility. + * rendering/RenderView.cpp: + (WebCore::RenderView::paintBoxDecorations): + * rendering/style/RenderStyle.h: + +2012-08-23 Zan Dobersek <zandobersek@gmail.com> + + [Gtk] Move feature defines processing into a GNUmakefile that's simple to autogenerate + https://bugs.webkit.org/show_bug.cgi?id=87127 + + Reviewed by Martin Robinson. + + List all the feature defines with their default value in + GNUmakefile.features.am and append them to the 'feature_defines_defaults'. + variable. + + In GNUmakefile.am, include the GNUmakefile.features.am. When checking the + AM conditionals for feature-enabling, append the appropriate define to + 'feature_defines_overrides'. + + After all such overrides are performed, append the proper define (of which + value was possibly overridden) for each feature to the 'feature_defines' + variable. Finally, append all these defines to webcore_cppflags in the form + of macros for preprocessing. + + No new tests - no new functionality. + + * GNUmakefile.am: + * GNUmakefile.features.am: Added. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] ScheduledAction is ugly and needs a cleanup + https://bugs.webkit.org/show_bug.cgi?id=94784 + + Reviewed by Eric Seidel. + + This patch updates ScheduledAction to use modern WebKit machinery, like + OwnHandle and Vector. + + * bindings/v8/OwnHandle.h: + (OwnHandle): + * bindings/v8/ScheduledAction.cpp: + (WebCore::ScheduledAction::ScheduledAction): + (WebCore::ScheduledAction::~ScheduledAction): + (WebCore::ScheduledAction::execute): + * bindings/v8/ScheduledAction.h: + (WebCore): + (ScheduledAction): + (WebCore::ScheduledAction::ScheduledAction): + +2012-08-23 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: dblclick on Timeline overview no longer selects entire timeline range + https://bugs.webkit.org/show_bug.cgi?id=94826 + + Reviewed by Vsevolod Vlasov. + + Only install a glass pane for drag-n-drop upon first mouseout event -- otherwise, glass pane + will interfere with double clicks. + + * inspector/front-end/UIUtils.js: + (WebInspector._elementDragStart.onMouseOut): + (WebInspector._elementDragStart): + (WebInspector._elementDragEnd): + +2012-08-23 Adrienne Walker <enne@google.com> + + Convert ScrollableArea ASSERT_NOT_REACHED virtuals + https://bugs.webkit.org/show_bug.cgi?id=93306 + + Reviewed by Darin Adler. + + ASSERT_NOT_REACHED is a bad way to make sure that a virtual function + gets an override, because it only fails at run-time in debug builds. + + To fix this, convert the virtuals in ScrollableArea that have + ASSERT_NOT_REACHED to be either pure virtual or implemented directly + in ScrollableArea. Add implementations where necessary to make derived + classes concrete. + + Additionally, consistently add OVERRIDE for virtual functions in + derived classes that override ScrollableArea methods. + + * WebCore.exp.in: + * page/FrameView.h: + (FrameView): + * platform/ScrollView.h: + (ScrollView): + * platform/ScrollableArea.cpp: + (WebCore::ScrollableArea::scrollPosition): + (WebCore): + (WebCore::ScrollableArea::minimumScrollPosition): + (WebCore::ScrollableArea::maximumScrollPosition): + (WebCore::ScrollableArea::visibleContentRect): + * platform/ScrollableArea.h: + (ScrollableArea): + (WebCore::ScrollableArea::overhangAmount): + * platform/chromium/FramelessScrollView.cpp: + (WebCore::FramelessScrollView::isOnActivePage): + (WebCore): + (WebCore::FramelessScrollView::scrollableAreaBoundingBox): + * platform/chromium/FramelessScrollView.h: + (FramelessScrollView): + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::visibleHeight): + (WebCore): + (WebCore::PopupMenuWin::visibleWidth): + (WebCore::PopupMenuWin::contentsSize): + (WebCore::PopupMenuWin::isOnActivePage): + (WebCore::PopupMenuWin::scrollableAreaBoundingBox): + * platform/win/PopupMenuWin.h: + (PopupMenuWin): + * rendering/RenderListBox.cpp: + * rendering/RenderListBox.h: + (RenderListBox): + +2012-08-23 Alexander Shalamov <alexander.shalamov@intel.com> + + getComputedStyle returns wrong value for CSS3 2D transformations + https://bugs.webkit.org/show_bug.cgi?id=94211 + + Reviewed by Simon Fraser. + + When computed style is calculated for CSS3 2D transformation, content + box size is used. According to W3C specification, object's bounding + box should be used. This patch fixes transformation matrix calculation. + + Layout tests getComputedStyle-transform.html and computed-style-origin.html + were modified to test changes. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::computedTransform): + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + (WebCore::pixelSnappedSizingBox): Removed unused method + +2012-08-23 Takashi Sakamoto <tasak@google.com> + + Distributed nodes should not share styles. + https://bugs.webkit.org/show_bug.cgi?id=90661 + + Reviewed by Hajime Morita. + + styleForElement tries to use previous sibling's style for distributed + nodes. However distributed nodes are children of a shadow host, but + the nodes are not siblings as the result of distribution. + The spec is: + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-dom-subtrees + So sharing previous sibling's style should be disabled for distrbuted + nodes. + + Test: fast/dom/shadow/style-of-distributed-node.html + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::StyleResolver): + Initialized m_distributedToInsertionPoint. Its initial value is false. + (WebCore::StyleResolver::initForStyleResolve): + After invoking NodeRenderingContext, if the context returns any + insertion point, set m_distributedToInsertionPoint to be true. + Otherwise, false. The value is used in styleForElement. + (WebCore::StyleResolver::styleForElement): + If m_distributedToInsertionPoint is true, disable local sibling style + cache. + * css/StyleResolver.h: + (StyleResolver): + Added a new member variable, m_distributedToInsertionPoint. + The variable keeps whether the m_element is distributed to an + insertion point. + +2012-08-23 John Griggs <jgriggs@rim.com> + + Replace access ot HTMLMediaElement from MediaPlayerPrivateBlackBerry with methods in MediaPlayerClient - updated with notes from initial reviews. https://bugs.webkit.org/show_bug.cgi?id=84291 + + Reviewed by Eric Carlson. + + Code standard compliance - no functional change, so no new tests required. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::mediaPlayerExitFullscreen): + (WebCore): + (WebCore::HTMLMediaElement::mediaPlayerIsVideo): + (WebCore::HTMLMediaElement::mediaPlayerContentBoxRect): + (WebCore::HTMLMediaElement::mediaPlayerSetSize): + (WebCore::HTMLMediaElement::mediaPlayerPause): + (WebCore::HTMLMediaElement::mediaPlayerPlay): + (WebCore::HTMLMediaElement::mediaPlayerIsPaused): + (WebCore::HTMLMediaElement::mediaPlayerHostWindow): + (WebCore::HTMLMediaElement::mediaPlayerWindowClipRect): + * html/HTMLMediaElement.h: + (HTMLMediaElement): + * platform/graphics/MediaPlayer.h: + (WebCore): + (WebCore::MediaPlayerClient::mediaPlayerExitFullscreen): + (WebCore::MediaPlayerClient::mediaPlayerIsVideo): + (WebCore::MediaPlayerClient::mediaPlayerContentBoxRect): + (WebCore::MediaPlayerClient::mediaPlayerSetSize): + (WebCore::MediaPlayerClient::mediaPlayerPause): + (WebCore::MediaPlayerClient::mediaPlayerPlay): + (WebCore::MediaPlayerClient::mediaPlayerIsPaused): + (WebCore::MediaPlayerClient::mediaPlayerHostWindow): + (WebCore::MediaPlayerClient::mediaPlayerWindowClipRect): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate): + (WebCore::MediaPlayerPrivate::load): + (WebCore::MediaPlayerPrivate::paint): + (WebCore::MediaPlayerPrivate::resizeSourceDimensions): + (WebCore::MediaPlayerPrivate::updateStates): + (WebCore::MediaPlayerPrivate::onPauseStateChanged): + (WebCore::MediaPlayerPrivate::onPlayNotified): + (WebCore::MediaPlayerPrivate::onPauseNotified): + (WebCore::MediaPlayerPrivate::onAuthenticationNeeded): + (WebCore::MediaPlayerPrivate::showErrorDialog): + (WebCore::MediaPlayerPrivate::platformWindow): + (WebCore::MediaPlayerPrivate::isElementPaused): + (WebCore::MediaPlayerPrivate::isTabVisible): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h: + (MediaPlayerPrivate): + +2012-08-23 John Mellor <johnme@chromium.org> + + Text Autosizing: Multiply large fonts less, as they are already more legible. + https://bugs.webkit.org/show_bug.cgi?id=94227 + + Reviewed by Kenneth Rohde Christiansen. + + Rather than uniformly multiplying font sizes by the multiplier (derived + from the width of the block), we should multiply fonts that are already + large less, since they are already more legible hence there is less need + for them to grow. + + However it is still important to maintain differentiation between text + that the author specified to be of different sizes. + + This algorithm multiplies text by the multiplier up until a predefined + "pleasant" font size; beyond that the computedSize goes up with + specifiedSize but at a gradient of less than 1 in order to gradually + fade out the size increase; finally for very large specifiedSizes the + computedSize will be the same as the specifiedSize. + + For further details, including a graph, please see the bug report. + + Test: fast/text-autosizing/various-font-sizes.html + + * rendering/TextAutosizer.cpp: + (WebCore::TextAutosizer::computeAutosizedFontSize): + + Implements the custom multiplication. See comment for details. + + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::lineHeight): + + Use computeAutosizedFontSize instead of directly multiplying. + + (WebCore::RenderStyle::setFontSize): + + Use computeAutosizedFontSize instead of directly multiplying. + +2012-08-23 Emil A Eklund <eae@chromium.org> + + Remove dependency on RenderStyle from FractionalLayoutBoxExtent and LayoutBox + https://bugs.webkit.org/show_bug.cgi?id=94146 + + Reviewed by Eric Seidel. + + FractionalLayoutBoxExtent and LayoutBox currently have a dependency on + RenderStyle to resolve writing mode and text direction. + This is undesirable and breaks encapsulation. + + Change FractionalLayoutBoxExtent and LengthBox to take a writing mode + parameter, and text direction as needed, instead of a pointer to a + RenderStyle object. + + No new tests, no change in functionality. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + Add new WritingMode.h file. + + * css/CSSPrimitiveValueMappings.h: + * css/CSSProperty.h: + * css/CSSToStyleMap.h: + Change includes as needed. + + * platform/LengthBox.h: + * platform/LengthBox.cpp: + (WebCore::LengthBox::logicalLeft): + (WebCore::LengthBox::logicalRight): + (WebCore::LengthBox::before): + (WebCore::LengthBox::after): + Change methods to take a WirtingMode parameter instead of a RenderStyle pointer. + + (WebCore::LengthBox::start): + (WebCore::LengthBox::end): + Change methods to take WritingMode and TextDirection parameters instead of a RenderStyle pointer. + + * platform/graphics/FractionalLayoutBoxExtent.h: + * platform/graphics/FractionalLayoutBoxExtent.cpp: + (WebCore::FractionalLayoutBoxExtent::logicalTop): + (WebCore::FractionalLayoutBoxExtent::logicalBottom): + (WebCore::FractionalLayoutBoxExtent::logicalLeft): + (WebCore::FractionalLayoutBoxExtent::logicalRight): + (WebCore::FractionalLayoutBoxExtent::before): + (WebCore::FractionalLayoutBoxExtent::after): + (WebCore::FractionalLayoutBoxExtent::setBefore): + (WebCore::FractionalLayoutBoxExtent::setAfter): + (WebCore::FractionalLayoutBoxExtent::mutableLogicalLeft): + (WebCore::FractionalLayoutBoxExtent::mutableLogicalRight): + (WebCore::FractionalLayoutBoxExtent::mutableBefore): + (WebCore::FractionalLayoutBoxExtent::mutableAfter): + Change methods to take a WritingMode parameter instead of a RenderStyle pointer. + + (WebCore::FractionalLayoutBoxExtent::start): + (WebCore::FractionalLayoutBoxExtent::end): + (WebCore::FractionalLayoutBoxExtent::setStart): + (WebCore::FractionalLayoutBoxExtent::setEnd): + Change methods to take WritingMode and TextDirection parameters instead of a RenderStyle pointer. + + * platform/text/TextDirection.h: + (WebCore::isLeftToRightDirection): + Add convenience method. + + * platform/text/WritingMode.h: Added. + Move WritingMode enum from RenderStyleConstants to new file. + + (WebCore::isHorizontalWritingMode): + (WebCore::isFlippedLinesWritingMode): + (WebCore::isFlippedBlocksWritingMode): + Add convenience methods for working with writing modes. + + * rendering/InlineFlowBox.cpp: + * rendering/RenderBox.cpp: + * rendering/RenderBox.h: + * rendering/style/RenderStyle.h: + Update calls to FractionalLayoutBoxExtent/LengthBox to pass WritingMode/ + TextDirection as needed. + + * rendering/style/RenderStyleConstants.h: + Remove WritingMode enum as it is now in a dedicated file. + +2012-08-23 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: introduce canFilter on panel (otherwise we check for function existence). + https://bugs.webkit.org/show_bug.cgi?id=94820 + + Reviewed by Alexander Pavlov. + + Drive-by: fix for network panel sorting null pointer access. + + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkPanel.prototype.performSearch): + (WebInspector.NetworkPanel.prototype.canFilter): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.replaceAllWith): + (WebInspector.Panel.prototype.canFilter): + (WebInspector.Panel.prototype.performFilter): + * inspector/front-end/SearchController.js: + (WebInspector.SearchController.prototype._updateFilterVisibility): + (WebInspector.SearchController.prototype._performFilter): + +2012-08-23 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: introduce TimelineGrid.Calculator interface. + https://bugs.webkit.org/show_bug.cgi?id=94819 + + Reviewed by Alexander Pavlov. + + This way we can compile TimelineGrid properly. + + * inspector/front-end/MemoryStatistics.js: + (WebInspector.MemoryStatistics.prototype._calculateVisibleIndexes): + * inspector/front-end/TimelineGrid.js: + (WebInspector.TimelineGrid.prototype.updateDividers): + (WebInspector.TimelineGrid.Calculator): + (WebInspector.TimelineGrid.Calculator.prototype.computePosition): + (WebInspector.TimelineGrid.Calculator.prototype.formatTime): + (WebInspector.TimelineGrid.Calculator.prototype.minimumBoundary): + (WebInspector.TimelineGrid.Calculator.prototype.maximumBoundary): + (WebInspector.TimelineGrid.Calculator.prototype.boundarySpan): + * inspector/front-end/TimelineOverviewPane.js: + (WebInspector.TimelineOverviewCalculator.prototype.computePosition): + (WebInspector.TimelineOverviewCalculator.prototype.computeBarGraphPercentages): + (WebInspector.TimelineOverviewCalculator.prototype.setWindow): + (WebInspector.TimelineOverviewCalculator.prototype.formatTime): + (WebInspector.TimelineOverviewCalculator.prototype.maximumBoundary): + (WebInspector.TimelineOverviewCalculator.prototype.minimumBoundary): + (WebInspector.TimelineOverviewCalculator.prototype.boundarySpan): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._shouldShowFrames): + (WebInspector.TimelineCalculator.prototype.computePosition): + (WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages): + (WebInspector.TimelineCalculator.prototype.setWindow): + (WebInspector.TimelineCalculator.prototype.formatTime): + (WebInspector.TimelineCalculator.prototype.maximumBoundary): + (WebInspector.TimelineCalculator.prototype.minimumBoundary): + (WebInspector.TimelineCalculator.prototype.boundarySpan): + +2012-08-23 David Reveman <reveman@chromium.org> + + [Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer. + https://bugs.webkit.org/show_bug.cgi?id=94719 + + Reviewed by James Robinson. + + Replace nextTickTime() with nextTickTimeIfActivated() and return + appropriate value when timer is inactive. + + No new tests. + + * platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp: + (WebCore::CCDelayBasedTimeSource::nextTickTimeIfActivated): + (WebCore::CCDelayBasedTimeSource::nextTickTarget): + (WebCore): + (WebCore::CCDelayBasedTimeSource::postNextTickTask): + * platform/graphics/chromium/cc/CCDelayBasedTimeSource.h: + * platform/graphics/chromium/cc/CCFrameRateController.cpp: + (WebCore::CCFrameRateController::nextTickTimeIfActivated): + * platform/graphics/chromium/cc/CCFrameRateController.h: + (CCFrameRateController): + * platform/graphics/chromium/cc/CCScheduler.cpp: + (WebCore::CCScheduler::processScheduledActions): + * platform/graphics/chromium/cc/CCTimeSource.h: + (CCTimeSource): + +2012-08-23 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: make treeoutline.js compiler-friendly + https://bugs.webkit.org/show_bug.cgi?id=94818 + + Reviewed by Alexander Pavlov. + + This change declares base methods on TreeElement so that we did not need to check for their existence. + + * inspector/front-end/AdvancedSearchController.js: + (WebInspector.FileBasedSearchResultsPane.prototype._appendShowMoreMatchesElement): + (WebInspector.FileBasedSearchResultsPane.prototype._addFileTreeElement): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype.onselect): + * inspector/front-end/SidebarPane.js: + (WebInspector.SidebarPane.prototype.expand): + (WebInspector.SidebarPane.prototype.onexpand): + (WebInspector.SidebarPane.prototype.collapse): + * inspector/front-end/treeoutline.js: + (TreeOutline.prototype._treeKeyDown): + (TreeOutline.prototype._searchInputKeyDown): + (TreeElement.prototype._fireDidChange): + (TreeElement.prototype._attach): + (TreeElement.treeElementDoubleClicked): + (TreeElement.prototype.collapse): + (TreeElement.prototype.expand): + (TreeElement.prototype.reveal): + (TreeElement.prototype.select): + (TreeElement.prototype.deselect): + (TreeElement.prototype.onpopulate): + (TreeElement.prototype.onenter): + (TreeElement.prototype.ondelete): + (TreeElement.prototype.onspace): + (TreeElement.prototype.onattach): + (TreeElement.prototype.onexpand): + (TreeElement.prototype.oncollapse): + (TreeElement.prototype.ondblclick): + (TreeElement.prototype.onreveal): + (TreeElement.prototype.onselect): + +2012-08-23 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: use temporary directory for modules generated by compile-front-end.py + https://bugs.webkit.org/show_bug.cgi?id=94804 + + Reviewed by Pavel Feldman. + + Create temporary directory for generated js modules and remove the directory + after the compilation. + + * inspector/compile-front-end.py: + 2012-08-23 Simon Hausmann <simon.hausmann@nokia.com> [Qt] Fix make install on Windows diff --git a/Source/WebCore/Configurations/Version.xcconfig b/Source/WebCore/Configurations/Version.xcconfig index c5c8365a3..428a583bc 100644 --- a/Source/WebCore/Configurations/Version.xcconfig +++ b/Source/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 6; +MINOR_VERSION = 8; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index 5974082f3..2f06ae3c6 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -1,3 +1,4 @@ +include $(srcdir)/Source/WebCore/GNUmakefile.features.am include $(srcdir)/Source/WebCore/GNUmakefile.list.am WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.in @@ -43,6 +44,7 @@ webcore_cppflags += \ -I$(srcdir)/Source/WebCore/loader \ -I$(srcdir)/Source/WebCore/loader/appcache \ -I$(srcdir)/Source/WebCore/loader/archive \ + -I$(srcdir)/Source/WebCore/loader/archive/mhtml \ -I$(srcdir)/Source/WebCore/loader/cache \ -I$(srcdir)/Source/WebCore/loader/icon \ -I$(srcdir)/Source/WebCore/mathml \ @@ -118,25 +120,21 @@ webcoregtk_cppflags += \ -I$(srcdir)/Source/WebCore/platform/text/gtk # --- -# Features enabled by default at compilation time -# --- -FEATURE_DEFINES += ENABLE_SMOOTH_SCROLLING=1 -webcore_cppflags += -DENABLE_SMOOTH_SCROLLING=1 - -# --- # Channel mesaging support # --- if ENABLE_CHANNEL_MESSAGING -FEATURE_DEFINES += ENABLE_CHANNEL_MESSAGING=1 -webcore_cppflags += -DENABLE_CHANNEL_MESSAGING=1 +feature_defines_overrides += ENABLE_CHANNEL_MESSAGING=1 +else +feature_defines_overrides += ENABLE_CHANNEL_MESSAGING=0 endif # END ENABLE_CHANNEL_MESSAGING # --- # Fast Mobile Scrolling # --- if ENABLE_FAST_MOBILE_SCROLLING -FEATURE_DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1 -webcore_cppflags += -DENABLE_FAST_MOBILE_SCROLLING=1 +feature_defines_overrides += ENABLE_FAST_MOBILE_SCROLLING=1 +else +feature_defines_overrides += ENABLE_FAST_MOBILE_SCROLLING=0 endif # END ENABLE_FAST_MOBILE_SCROLLING # --- @@ -169,86 +167,90 @@ endif # END TARGET_WIN32 # HTML Details Element # ---- if ENABLE_DETAILS_ELEMENT -FEATURE_DEFINES += ENABLE_DETAILS_ELEMENT=1 -webcore_cppflags += -DENABLE_DETAILS_ELEMENT=1 +feature_defines_overrides += ENABLE_DETAILS_ELEMENT=1 +else +feature_defines_overrides += ENABLE_DETAILS_ELEMENT=0 endif # END ENABLE_DETAILS_ELEMENT # ---- # HTML Meter Element # ---- if ENABLE_METER_ELEMENT -FEATURE_DEFINES += ENABLE_METER_ELEMENT=1 -webcore_cppflags += -DENABLE_METER_ELEMENT=1 +feature_defines_overrides += ENABLE_METER_ELEMENT=1 +else +feature_defines_overrides += ENABLE_METER_ELEMENT=0 endif # END ENABLE_METER_ELEMENT # ---- # HTML Progress Element # ---- if ENABLE_PROGRESS_ELEMENT -FEATURE_DEFINES += ENABLE_PROGRESS_ELEMENT=1 -webcore_cppflags += -DENABLE_PROGRESS_ELEMENT=1 +feature_defines_overrides += ENABLE_PROGRESS_ELEMENT=1 +else +feature_defines_overrides += ENABLE_PROGRESS_ELEMENT=0 endif # END ENABLE_PROGRESS_ELEMENT # ---- # JavaScript Debugger/Profiler # ---- if ENABLE_JAVASCRIPT_DEBUGGER -FEATURE_DEFINES += ENABLE_JAVASCRIPT_DEBUGGER=1 -webcore_cppflags += -DENABLE_JAVASCRIPT_DEBUGGER=1 +feature_defines_overrides += ENABLE_JAVASCRIPT_DEBUGGER=1 else -webcore_cppflags += -DENABLE_JAVASCRIPT_DEBUGGER=0 +feature_defines_overrides += ENABLE_JAVASCRIPT_DEBUGGER=0 endif # END ENABLE_JAVASCRIPT_DEBUGGER # ---- # Gamepad support # --- if ENABLE_GAMEPAD -FEATURE_DEFINES += ENABLE_GAMEPAD=1 -webcore_cppflags += -DENABLE_GAMEPAD=1 +feature_defines_overrides += ENABLE_GAMEPAD=1 else -webcore_cppflags += -DENABLE_GAMEPAD=0 +feature_defines_overrides += ENABLE_GAMEPAD=0 endif # END ENABLE_GAMEPAD # ---- # Database Support # ---- if ENABLE_SQL_DATABASE -FEATURE_DEFINES += ENABLE_SQL_DATABASE=1 -webcore_cppflags += -DENABLE_SQL_DATABASE=1 +feature_defines_overrides += ENABLE_SQL_DATABASE=1 else -webcore_cppflags += -DENABLE_SQL_DATABASE=0 +feature_defines_overrides += ENABLE_SQL_DATABASE=0 endif # END ENABLE_SQL_DATABASE # ---- # HTML5 datalist Support # ---- if ENABLE_DATALIST_ELEMENT -FEATURE_DEFINES += ENABLE_DATALIST_ELEMENT=1 -webcore_cppflags += -DENABLE_DATALIST_ELEMENT=1 +feature_defines_overrides += ENABLE_DATALIST_ELEMENT=1 +else +feature_defines_overrides += ENABLE_DATALIST_ELEMENT=0 endif # END ENABLE_DATALIST_ELEMENT # ---- # HTML5 data transfer items support # ---- if ENABLE_DATA_TRANSFER_ITEMS -FEATURE_DEFINES += ENABLE_DATA_TRANSFER_ITEMS=1 -webcore_cppflags += -DENABLE_DATA_TRANSFER_ITEMS=1 +feature_defines_overrides += ENABLE_DATA_TRANSFER_ITEMS=1 +else +feature_defines_overrides += ENABLE_DATA_TRANSFER_ITEMS=0 endif # END ENABLE_DATA_TRANSFER_ITEMS # ---- # HTML5 <style scoped> support # ---- if ENABLE_STYLE_SCOPED -FEATURE_DEFINES += ENABLE_STYLE_SCOPED=1 -webcore_cppflags += -DENABLE_STYLE_SCOPED=1 +feature_defines_overrides += ENABLE_STYLE_SCOPED=1 +else +feature_defines_overrides += ENABLE_STYLE_SCOPED=0 endif # END ENABLE_STYLE_SCOPED # ---- # Indexed Database API support # ---- if ENABLE_INDEXED_DATABASE -FEATURE_DEFINES += ENABLE_INDEXED_DATABASE=1 -webcore_cppflags += -DENABLE_INDEXED_DATABASE=1 +feature_defines_overrides += ENABLE_INDEXED_DATABASE=1 +else +feature_defines_overrides += ENABLE_INDEXED_DATABASE=0 endif # END ENABLE_INDEXED_DATABASE if USE_LEVELDB @@ -259,153 +261,149 @@ endif # END USE_LEVELDB # Support for <input type="file" directory> # ---- if ENABLE_DIRECTORY_UPLOAD -FEATURE_DEFINES += ENABLE_DIRECTORY_UPLOAD=1 -webcore_cppflags += -DENABLE_DIRECTORY_UPLOAD=1 +feature_defines_overrides += ENABLE_DIRECTORY_UPLOAD=1 else -webcore_cppflags += -DENABLE_DIRECTORY_UPLOAD=0 +feature_defines_overrides += ENABLE_DIRECTORY_UPLOAD=0 endif # END ENABLE_DIRECTORY_UPLOAD # ---- # DOM mutation observer support # ---- if ENABLE_MUTATION_OBSERVERS -FEATURE_DEFINES += ENABLE_MUTATION_OBSERVERS=1 -webcore_cppflags += -DENABLE_MUTATION_OBSERVERS=1 +feature_defines_overrides += ENABLE_MUTATION_OBSERVERS=1 +else +feature_defines_overrides += ENABLE_MUTATION_OBSERVERS=0 endif # END ENABLE_MUTATION_OBSERVERS # ---- # FileSystem API support # ---- if ENABLE_FILE_SYSTEM -FEATURE_DEFINES += ENABLE_FILE_SYSTEM=1 -webcore_cppflags += -DENABLE_FILE_SYSTEM=1 +feature_defines_overrides += ENABLE_FILE_SYSTEM=1 +else +feature_defines_overrides += ENABLE_FILE_SYSTEM=0 endif # END ENABLE_FILE_SYSTEM # ---- # Quota support # ---- if ENABLE_QUOTA -FEATURE_DEFINES += ENABLE_QUOTA=1 -webcore_cppflags += -DENABLE_QUOTA=1 +feature_defines_overrides += ENABLE_QUOTA=1 +else +feature_defines_overrides += ENABLE_QUOTA=0 endif # END ENABLE_QUOTA # ---- # Touch Icon Loading # ---- if ENABLE_TOUCH_ICON_LOADING -FEATURE_DEFINES += ENABLE_TOUCH_ICON_LOADING=1 -webcore_cppflags += -DENABLE_TOUCH_ICON_LOADING=1 +feature_defines_overrides += ENABLE_TOUCH_ICON_LOADING=1 else -webcore_cppflags += -DENABLE_TOUCH_ICON_LOADING=0 +feature_defines_overrides += ENABLE_TOUCH_ICON_LOADING=0 endif # END ENABLE_TOUCH_ICON_LOADING # ---- # Color Input API support # ---- if ENABLE_INPUT_TYPE_COLOR -FEATURE_DEFINES += ENABLE_INPUT_TYPE_COLOR=1 -webcore_cppflags += -DENABLE_INPUT_TYPE_COLOR=1 +feature_defines_overrides += ENABLE_INPUT_TYPE_COLOR=1 else -webcore_cppflags += -DENABLE_INPUT_TYPE_COLOR=0 +feature_defines_overrides += ENABLE_INPUT_TYPE_COLOR=0 endif # END ENABLE_INPUT_TYPE_COLOR # ---- # Speech Input API support # ---- if ENABLE_INPUT_SPEECH -FEATURE_DEFINES += ENABLE_INPUT_SPEECH=1 -webcore_cppflags += -DENABLE_INPUT_SPEECH=1 +feature_defines_overrides += ENABLE_INPUT_SPEECH=1 else -webcore_cppflags += -DENABLE_INPUT_SPEECH=0 +feature_defines_overrides += ENABLE_INPUT_SPEECH=0 endif # END ENABLE_INPUT_SPEECH # ---- # Scripted Speech API support # ---- if ENABLE_SCRIPTED_SPEECH -FEATURE_DEFINES += ENABLE_SCRIPTED_SPEECH=1 -webcore_cppflags += -DENABLE_SCRIPTED_SPEECH=1 +feature_defines_overrides += ENABLE_SCRIPTED_SPEECH=1 else -webcore_cppflags += -DENABLE_SCRIPTED_SPEECH=0 +feature_defines_overrides += ENABLE_SCRIPTED_SPEECH=0 endif # END ENABLE_SCRIPTED_SPEECH # ---- # Icon Database Support # ---- if ENABLE_ICONDATABASE -webcore_cppflags += -DENABLE_ICONDATABASE=1 +feature_defines_overrides += -DENABLE_ICONDATABASE=1 else -webcore_cppflags += -DENABLE_ICONDATABASE=0 +feature_defines_overrides += -DENABLE_ICONDATABASE=0 endif # END ENABLE_ICONDATABASE # ---- # Orientation Events # ---- if ENABLE_ORIENTATION_EVENTS -FEATURE_DEFINES += ENABLE_ORIENTATION_EVENTS=1 -webcore_cppflags += -DENABLE_ORIENTATION_EVENTS=1 +feature_defines_overrides += ENABLE_ORIENTATION_EVENTS=1 +else +feature_defines_overrides += ENABLE_ORIENTATION_EVENTS=0 endif # END ENABLE_ORIENTATION_EVENTS # ---- # Video Support # ---- if ENABLE_VIDEO -FEATURE_DEFINES += ENABLE_VIDEO=1 -webcore_cppflags += -DENABLE_VIDEO=1 - +feature_defines_overrides += ENABLE_VIDEO=1 if USE_GSTREAMER if ENABLE_DEBUG webcore_cppflags += -DGST_DISABLE_DEPRECATED endif # END ENABLE_DEBUG endif # END USE_GSTREAMER +else +feature_defines_overrides += ENABLE_VIDEO=0 endif # END ENABLE_VIDEO # ---- # Media Source Support # ---- if ENABLE_MEDIA_SOURCE -FEATURE_DEFINES += ENABLE_MEDIA_SOURCE=1 -webcore_cppflags += -DENABLE_MEDIA_SOURCE=1 +feature_defines_overrides += ENABLE_MEDIA_SOURCE=1 else -webcore_cppflags += -DENABLE_MEDIA_SOURCE=0 +feature_defines_overrides += ENABLE_MEDIA_SOURCE=0 endif # END ENABLE_MEDIA_SOURCE # ---- # Media Statistics Support # ---- if ENABLE_MEDIA_STATISTICS -FEATURE_DEFINES += ENABLE_MEDIA_STATISTICS=1 -webcore_cppflags += -DENABLE_MEDIA_STATISTICS=1 +feature_defines_overrides += ENABLE_MEDIA_STATISTICS=1 else -webcore_cppflags += -DENABLE_MEDIA_STATISTICS=0 +feature_defines_overrides += ENABLE_MEDIA_STATISTICS=0 endif # END ENABLE_MEDIA_STATISTICS # ---- # Javascript Fullscreen Support # ---- if ENABLE_FULLSCREEN_API -FEATURE_DEFINES += ENABLE_FULLSCREEN_API=1 -webcore_cppflags += -DENABLE_FULLSCREEN_API=1 +feature_defines_overrides += ENABLE_FULLSCREEN_API=1 +else +feature_defines_overrides += ENABLE_FULLSCREEN_API=0 endif # END ENABLE_FULLSCREEN_API # ---- # Track Support # ---- if ENABLE_VIDEO_TRACK -FEATURE_DEFINES += ENABLE_VIDEO_TRACK=1 -webcore_cppflags += -DENABLE_VIDEO_TRACK=1 +feature_defines_overrides += ENABLE_VIDEO_TRACK=1 else -webcore_cppflags += -DENABLE_VIDEO_TRACK=0 +feature_defines_overrides += ENABLE_VIDEO_TRACK=0 endif # END ENABLE_VIDEO_TRACK # ---- # Media Stream Support # ---- if ENABLE_MEDIA_STREAM -FEATURE_DEFINES += ENABLE_MEDIA_STREAM=1 -webcore_cppflags += -DENABLE_MEDIA_STREAM=1 +feature_defines_overrides += ENABLE_MEDIA_STREAM=1 else -webcore_cppflags += -DENABLE_MEDIA_STREAM=0 +feature_defines_overrides += ENABLE_MEDIA_STREAM=0 endif # END ENABLE_MEDIA_STREAM # XPath grammar @@ -426,101 +424,108 @@ $(GENSOURCES_WEBCORE)/XPathGrammar.cpp: $(WebCore)/xml/XPathGrammar.y # XSLT Support # ---- if ENABLE_XSLT -FEATURE_DEFINES += ENABLE_XSLT=1 -webcore_cppflags += -DENABLE_XSLT=1 +feature_defines_overrides += ENABLE_XSLT=1 +else +feature_defines_overrides += ENABLE_XSLT=0 endif # END ENABLE_XSLT # ---- # Web Workers support # ---- if ENABLE_WORKERS -FEATURE_DEFINES += ENABLE_WORKERS=1 -webcore_cppflags += -DENABLE_WORKERS=1 +feature_defines_overrides += ENABLE_WORKERS=1 +else +feature_defines_overrides += ENABLE_WORKERS=0 endif # --- # Shadow DOM support # --- if ENABLE_SHADOW_DOM -FEATURE_DEFINES += ENABLE_SHADOW_DOM=1 -webcore_cppflags += -DENABLE_SHADOW_DOM=1 +feature_defines_overrides += ENABLE_SHADOW_DOM=1 +else +feature_defines_overrides += ENABLE_SHADOW_DOM=0 endif # --- # SharedWorker support # --- if ENABLE_SHARED_WORKERS -FEATURE_DEFINES += ENABLE_SHARED_WORKERS=1 -webcore_cppflags += -DENABLE_SHARED_WORKERS=1 +feature_defines_overrides += ENABLE_SHARED_WORKERS=1 +else +feature_defines_overrides += ENABLE_SHARED_WORKERS=0 endif # ---- # Filters # ---- if ENABLE_FILTERS -FEATURE_DEFINES += ENABLE_FILTERS=1 -webcore_cppflags += -DENABLE_FILTERS=1 +feature_defines_overrides += ENABLE_FILTERS=1 +else +feature_defines_overrides += ENABLE_FILTERS=0 endif # END ENABLE_FILTERS # ---- # CSS box decoration break # ---- if ENABLE_CSS_BOX_DECORATION_BREAK -FEATURE_DEFINES += ENABLE_CSS_BOX_DECORATION_BREAK=1 -webcore_cppflags += -DENABLE_CSS_BOX_DECORATION_BREAK=1 - +feature_defines_overrides += ENABLE_CSS_BOX_DECORATION_BREAK=1 +else +feature_defines_overrides += ENABLE_CSS_BOX_DECORATION_BREAK=0 endif # END ENABLE_CSS_BOX_DECORATION_BREAK # ---- # Regions # ---- if ENABLE_CSS_REGIONS -FEATURE_DEFINES += ENABLE_CSS_REGIONS=1 -webcore_cppflags += -DENABLE_CSS_REGIONS=1 - +feature_defines_overrides += ENABLE_CSS_REGIONS=1 +else +feature_defines_overrides += ENABLE_CSS_REGIONS=0 endif # END ENABLE_CSS_REGIONS # ---- # Filters # ---- if ENABLE_CSS_FILTERS -FEATURE_DEFINES += ENABLE_CSS_FILTERS=1 -webcore_cppflags += -DENABLE_CSS_FILTERS=1 - +feature_defines_overrides += ENABLE_CSS_FILTERS=1 +else +feature_defines_overrides += ENABLE_CSS_FILTERS=0 endif # END ENABLE_CSS_FILTERS # ---- # Compositing # ---- if ENABLE_CSS_COMPOSITING -FEATURE_DEFINES += ENABLE_CSS_COMPOSITING=1 -webcore_cppflags += -DENABLE_CSS_COMPOSITING=1 +feature_defines_overrides += ENABLE_CSS_COMPOSITING=1 +else +feature_defines_overrides += ENABLE_CSS_COMPOSITING=0 endif # END ENABLE_CSS_COMPOSITING # ---- # Exclusions # ---- if ENABLE_CSS_EXCLUSIONS -FEATURE_DEFINES += ENABLE_CSS_EXCLUSIONS=1 -webcore_cppflags += -DENABLE_CSS_EXCLUSIONS=1 - +feature_defines_overrides += ENABLE_CSS_EXCLUSIONS=1 +else +feature_defines_overrides += ENABLE_CSS_EXCLUSIONS=0 endif # END ENABLE_CSS_EXCLUSIONS # ---- # Geolocation # ---- if ENABLE_GEOLOCATION - -FEATURE_DEFINES += ENABLE_GEOLOCATION=1 -webcore_cppflags += -DENABLE_GEOLOCATION=1 +feature_defines_overrides += ENABLE_GEOLOCATION=1 +else +feature_defines_overrides += ENABLE_GEOLOCATION=0 endif # END ENABLE_GEOLOCATION # ---- # MathML support # ---- if ENABLE_MATHML -FEATURE_DEFINES += ENABLE_MATHML=1 -webcore_cppflags += -DENABLE_MATHML=1 +feature_defines_overrides += ENABLE_MATHML=1 +else +feature_defines_overrides += ENABLE_MATHML=0 endif # END ENABLE_MATHML # MathML tag and attribute names, and element factory @@ -533,8 +538,9 @@ DerivedSources/WebCore/MathMLElementFactory.cpp DerivedSources/WebCore/MathMLNam # Notifications support # ---- if ENABLE_NOTIFICATIONS -FEATURE_DEFINES += ENABLE_NOTIFICATIONS=1 ENABLE_LEGACY_NOTIFICATIONS=1 -webcore_cppflags += -DENABLE_NOTIFICATIONS=1 -DENABLE_LEGACY_NOTIFICATIONS=1 +feature_defines_overrides += ENABLE_NOTIFICATIONS=1 ENABLE_LEGACY_NOTIFICATIONS=1 +else +feature_defines_overrides += ENABLE_NOTIFICATIONS=0 ENABLE_LEGACY_NOTIFICATIONS=0 endif # END ENABLE_NOTIFICATIONS # ---- @@ -543,24 +549,24 @@ endif # END ENABLE_NOTIFICATIONS # FIXME: allow a more fine-grained inclusion/generation of sources per SVG feature # ---- if ENABLE_SVG -FEATURE_DEFINES += ENABLE_SVG=1 -webcore_cppflags += -DENABLE_SVG=1 +feature_defines_overrides += ENABLE_SVG=1 WEBCORE_CSS_PROPERTY_NAMES += $(WebCore)/css/SVGCSSPropertyNames.in WEBCORE_CSS_VALUE_KEYWORDS += $(WebCore)/css/SVGCSSValueKeywords.in - # SVG Features if ENABLE_SVG_FONTS -FEATURE_DEFINES += ENABLE_SVG_FONTS=1 -webcore_cppflags += -DENABLE_SVG_FONTS=1 +feature_defines_overrides += ENABLE_SVG_FONTS=1 +else +feature_defines_overrides += ENABLE_SVG_FONTS=0 endif - +else +feature_defines_overrides += ENABLE_SVG=0 ENABLE_SVG_FONTS=0 endif # END ENABLE_SVG # SVG tag and attribute names (need to pass an extra flag if svg experimental features are enabled) DerivedSources/WebCore/SVGNames.cpp: DerivedSources/WebCore/SVGElementFactory.cpp DerivedSources/WebCore/JSSVGElementWrapperFactory.cpp: DerivedSources/WebCore/SVGElementFactory.cpp DerivedSources/WebCore/SVGElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/svg/svgtags.in $(WebCore)/svg/svgattrs.in - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(FEATURE_DEFINES)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(feature_defines)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" # end SVG Features @@ -572,8 +578,9 @@ DerivedSources/WebCore/XLinkNames.cpp : $(WebCore)/dom/make_names.pl $(WebCore)/ # Web Audio Support # ---- if ENABLE_WEB_AUDIO -FEATURE_DEFINES += ENABLE_WEB_AUDIO=1 -webcore_cppflags += -DENABLE_WEB_AUDIO=1 +feature_defines_overrides += ENABLE_WEB_AUDIO=1 +else +feature_defines_overrides += ENABLE_WEB_AUDIO=0 endif if USE_WEBAUDIO_GSTREAMER @@ -584,59 +591,63 @@ endif # Web Sockets Support # ---- if ENABLE_WEB_SOCKETS -FEATURE_DEFINES += ENABLE_WEB_SOCKETS=1 -webcore_cppflags += -DENABLE_WEB_SOCKETS=1 +feature_defines_overrides += ENABLE_WEB_SOCKETS=1 else -webcore_cppflags += -DENABLE_WEB_SOCKETS=0 +feature_defines_overrides += ENABLE_WEB_SOCKETS=0 endif # END ENABLE_WEB_SOCKETS # --- # Blob support # --- if ENABLE_BLOB -FEATURE_DEFINES += ENABLE_BLOB=1 -webcore_cppflags += -DENABLE_BLOB=1 +feature_defines_overrides += ENABLE_BLOB=1 +else +feature_defines_overrides += ENABLE_BLOB=0 endif # END ENABLE_BLOB # --- # Legacy WebKitBlobBuilder support # --- if ENABLE_LEGACY_WEBKIT_BLOB_BUILDER -FEATURE_DEFINES += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 -webcore_cppflags += -DENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 +feature_defines_overrides += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 +else +feature_defines_overrides += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=0 endif # END ENABLE_LEGACY_WEBKIT_BLOB_BUILDER # --- # Animation API support # --- if ENABLE_ANIMATION_API -FEATURE_DEFINES += ENABLE_ANIMATION_API=1 -webcore_cppflags += -DENABLE_ANIMATION_API=1 +feature_defines_overrides += ENABLE_ANIMATION_API=1 +else +feature_defines_overrides += ENABLE_ANIMATION_API=0 endif # END ENABLE_ANIMATION_API # --- # RequestAnimationFrame support # --- if ENABLE_REQUEST_ANIMATION_FRAME -FEATURE_DEFINES += ENABLE_REQUEST_ANIMATION_FRAME=1 -webcore_cppflags += -DENABLE_REQUEST_ANIMATION_FRAME=1 +feature_defines_overrides += ENABLE_REQUEST_ANIMATION_FRAME=1 +else +feature_defines_overrides += ENABLE_REQUEST_ANIMATION_FRAME=0 endif # END ENABLE_REQUEST_ANIMATION_FRAME # --- # 3D canvas (WebGL) support # --- if ENABLE_WEBGL -FEATURE_DEFINES += ENABLE_WEBGL=1 -webcore_cppflags += -DENABLE_WEBGL=1 +feature_defines_overrides += ENABLE_WEBGL=1 +else +feature_defines_overrides += ENABLE_WEBGL=0 endif # END ENABLE_WEBGL # --- # Accelerated compositing support # --- if USE_ACCELERATED_COMPOSITING -FEATURE_DEFINES += \ - ENABLE_3D_RENDERING=1 \ - ACCELERATED_COMPOSITING=1 +feature_defines_overrides += ENABLE_3D_RENDERING=1 +else +feature_defines_overrides += ENABLE_3D_RENDERING=0 endif # END USE_ACCELERATED_COMPOSITING if USE_TEXTURE_MAPPER_CAIRO @@ -659,104 +670,143 @@ endif # END USE_CLUTTER # MHTML support # --- if ENABLE_MHTML -FEATURE_DEFINES += ENABLE_MHTML=1 -webcore_cppflags += \ - -DENABLE_MHTML=1 \ - -I$(srcdir)/Source/WebCore/loader/archive/mhtml +feature_defines_overrides += ENABLE_MHTML=1 +else +feature_defines_overrides += ENABLE_MHTML=0 endif # END ENABLE_MHTML # --- # HTML5 Microdata support # --- if ENABLE_MICRODATA -FEATURE_DEFINES += ENABLE_MICRODATA=1 -webcore_cppflags += -DENABLE_MICRODATA=1 +feature_defines_overrides += ENABLE_MICRODATA=1 +else +feature_defines_overrides += ENABLE_MICRODATA=0 endif # END ENABLE_MICRODATA # --- # Register Protocol Handler support # --- if ENABLE_REGISTER_PROTOCOL_HANDLER -FEATURE_DEFINES += ENABLE_REGISTER_PROTOCOL_HANDLER=1 -webcore_cppflags += -DENABLE_REGISTER_PROTOCOL_HANDLER=1 +feature_defines_overrides += ENABLE_REGISTER_PROTOCOL_HANDLER=1 +else +feature_defines_overrides += ENABLE_REGISTER_PROTOCOL_HANDLER=0 endif # END ENABLE_REGISTER_PROTOCOL_HANDLER # --- # DeviceOrientation support # --- if ENABLE_DEVICE_ORIENTATION -FEATURE_DEFINES += ENABLE_DEVICE_ORIENTATION=1 -webcore_cppflags += -DENABLE_DEVICE_ORIENTATION=1 +feature_defines_overrides += ENABLE_DEVICE_ORIENTATION=1 +else +feature_defines_overrides += ENABLE_DEVICE_ORIENTATION=0 endif # END ENABLE_DEVICE_ORIENTATION # --- # Text Autosizing support # --- if ENABLE_TEXT_AUTOSIZING -FEATURE_DEFINES += ENABLE_TEXT_AUTOSIZING=1 -webcore_cppflags += -DENABLE_TEXT_AUTOSIZING=1 +feature_defines_overrides += ENABLE_TEXT_AUTOSIZING=1 +else +feature_defines_overrides += ENABLE_TEXT_AUTOSIZING=0 endif # END ENABLE_TEXT_AUTOSIZING # --- # Web Timing support # --- if ENABLE_WEB_TIMING -FEATURE_DEFINES += ENABLE_WEB_TIMING=1 -webcore_cppflags += -DENABLE_WEB_TIMING=1 +feature_defines_overrides += ENABLE_WEB_TIMING=1 +else +feature_defines_overrides += ENABLE_WEB_TIMING=0 endif # END ENABLE_WEB_TIMING # --- # HTML iframe seamless attribute support # --- if ENABLE_IFRAME_SEAMLESS -FEATURE_DEFINES += ENABLE_IFRAME_SEAMLESS=1 -webcore_cppflags += -DENABLE_IFRAME_SEAMLESS=1 +feature_defines_overrides += ENABLE_IFRAME_SEAMLESS=1 +else +feature_defines_overrides += ENABLE_IFRAME_SEAMLESS=0 endif # END ENABLE_IFRAME_SEAMLESS # --- # CSS3 Flexbox support # --- if ENABLE_CSS3_FLEXBOX -FEATURE_DEFINES += ENABLE_CSS3_FLEXBOX=1 -webcore_cppflags += -DENABLE_CSS3_FLEXBOX=1 +feature_defines_overrides += ENABLE_CSS3_FLEXBOX=1 +else +feature_defines_overrides += ENABLE_CSS3_FLEXBOX=0 endif # END ENABLE_CSS3_FLEXBOX # --- # CSS3 Text Decoration support if ENABLE_CSS3_TEXT_DECORATION -FEATURE_DEFINES += ENABLE_CSS3_TEXT_DECORATION=1 -webcore_cppflags += -DENABLE_CSS3_TEXT_DECORATION=1 +feature_defines_overrides += ENABLE_CSS3_TEXT_DECORATION=1 +else +feature_defines_overrides += ENABLE_CSS3_TEXT_DECORATION=0 endif # END ENABLE_CSS3_TEXT_DECORATION # --- # Link prefetch support # --- if ENABLE_LINK_PREFETCH -FEATURE_DEFINES += ENABLE_LINK_PREFETCH=1 -webcore_cppflags += -DENABLE_LINK_PREFETCH=1 +feature_defines_overrides += ENABLE_LINK_PREFETCH=1 +else +feature_defines_overrides += ENABLE_LINK_PREFETCH=0 endif # END ENABLE_LINK_PREFETCH # --- # Widget region support # --- if ENABLE_WIDGET_REGION -FEATURE_DEFINES += ENABLE_WIDGET_REGION=1 -webcore_cppflags += -DENABLE_WIDGET_REGION=1 +feature_defines_overrides += ENABLE_WIDGET_REGION=1 +else +feature_defines_overrides += ENABLE_WIDGET_REGION=0 endif # END ENABLE_WIDGET_REGION # --- # Spell check support # --- if ENABLE_SPELLCHECK -FEATURE_DEFINES += ENABLE_SPELLCHECK=1 -webcore_cppflags += -DENABLE_SPELLCHECK=1 +feature_defines_overrides += ENABLE_SPELLCHECK=1 +else +feature_defines_overrides += ENABLE_SPELLCHECK=0 endif # END ENABLE_SPELLCHECK +# --- +# Unstable features +# If unstable features should not be enabled, their defines should be overriden with a 0 value. +# --- +if !ENABLE_UNSTABLE_FEATURES +# FIXME: List unstable features here once their configuration options are removed. +feature_defines_overrides += +endif + + +# Fill the feature_defines variable with all the defines, making it possible +# to override the default define value (as set in feature_defines_defaults) +# through adding the feature define with the desired value to feature_defines_overrides. +feature_defines += $(strip $(foreach bare_define, \ + $(foreach define,$(feature_defines_defaults), \ + $(foreach fvalue,0 1, \ + $(if $(findstring =$(fvalue),$(define)),$(patsubst %=$(fvalue),%,$(define))) \ + ) \ + ), \ + $(if $(findstring $(bare_define), $(feature_defines_overrides)), \ + $(filter $(bare_define)=%,$(feature_defines_overrides)), \ + $(filter $(bare_define)=%,$(feature_defines_defaults)) \ + ) \ +)) + +# Add the feature defines to webcore_cppflags in macro form. +webcore_cppflags += $(foreach define,$(feature_defines),-D$(define)) + + DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h DerivedSources/WebCore/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/makeprop.pl $(AM_V_GEN) $(AM_V_at)cat $(WEBCORE_CSS_PROPERTY_NAMES) > CSSPropertyNames.in - $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makeprop.pl" --defines "$(FEATURE_DEFINES)" + $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makeprop.pl" --defines "$(feature_defines)" $(AM_V_at)mv CSSPropertyNames* $(GENSOURCES_WEBCORE) # Lower case all the values, as CSS values are case-insensitive @@ -764,7 +814,7 @@ DerivedSources/WebCore/CSSValueKeywords.cpp: DerivedSources/WebCore/CSSValueKeyw DerivedSources/WebCore/CSSValueKeywords.h: $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/makevalues.pl $(AM_V_GEN) $(AM_V_at)cat $(WEBCORE_CSS_VALUE_KEYWORDS) > CSSValueKeywords.in - $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makevalues.pl" --defines "$(FEATURE_DEFINES)" + $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makevalues.pl" --defines "$(feature_defines)" $(AM_V_at)mv CSSValueKeywords* $(GENSOURCES_WEBCORE) # XML Viewer CSS @@ -825,7 +875,7 @@ SCRIPTS_FOR_PREPROCESS_IDLS = \ DerivedSources/WebCore/UserAgentStyleSheetsData.cpp: DerivedSources/WebCore/UserAgentStyleSheets.h DerivedSources/WebCore/UserAgentStyleSheets.h: $(WebCore)/css/make-css-file-arrays.pl $(WebCore)/bindings/scripts/preprocessor.pm $(USER_AGENT_STYLE_SHEETS) - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --defines "$(FEATURE_DEFINES)" $@ DerivedSources/WebCore/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --defines "$(feature_defines)" $@ DerivedSources/WebCore/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) DerivedSources/WebCore/WebKitFontFamilyNames.cpp: DerivedSources/WebCore/WebKitFontFamilyNames.h DerivedSources/WebCore/WebKitFontFamilyNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/css/WebKitFontFamilyNames.in @@ -838,7 +888,7 @@ DerivedSources/WebCore/HTMLElementFactory.cpp: DerivedSources/WebCore/HTMLElemen DerivedSources/WebCore/HTMLElementFactory.h: DerivedSources/WebCore/HTMLNames.cpp DerivedSources/WebCore/HTMLNames.cpp: DerivedSources/WebCore/HTMLNames.h DerivedSources/WebCore/HTMLNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/html/HTMLTagNames.in $(WebCore)/html/HTMLAttributeNames.in - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(FEATURE_DEFINES)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(feature_defines)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" DerivedSources/WebCore/XMLNSNames.cpp DerivedSources/WebCore/XMLNSNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/xml/xmlnsattrs.in @@ -930,7 +980,7 @@ $(supplemental_dependency_file): $(SCRIPTS_FOR_PREPROCESS_IDLS) $(dom_binding_id $(AM_V_GEN) $(AM_V_at)echo -n > $(idl_files_list) $(AM_V_at)($(foreach idl, $(dom_binding_idls), echo $(idl) &&) echo -n) >> $(idl_files_list) - $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --idlFilesList $(idl_files_list) --supplementalDependencyFile $@ --idlAttributesFile $(idl_attributes_file) + $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --idlFilesList $(idl_files_list) --supplementalDependencyFile $@ --idlAttributesFile $(idl_attributes_file) # This does not appear to work correctly with gnumake unless # it includes an empty command list (the semicolon). @@ -938,7 +988,7 @@ DerivedSources/WebCore/JS%.cpp: DerivedSources/WebCore/JS%.h; .SECONDARY: DerivedSources/WebCore/JS%.h: %.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file) - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $< + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $< # See https://bugs.webkit.org/show_bug.cgi?id=76388 # We need to introduce a manual dependency to prevent non-generated sources from diff --git a/Source/WebCore/GNUmakefile.features.am b/Source/WebCore/GNUmakefile.features.am new file mode 100644 index 000000000..0a8c3ce65 --- /dev/null +++ b/Source/WebCore/GNUmakefile.features.am @@ -0,0 +1,96 @@ +feature_defines_defaults += \ + ENABLE_3D_RENDERING=0 \ + ENABLE_ACCELERATED_2D_CANVAS=0 \ + ENABLE_ANIMATION_API=0 \ + ENABLE_BATTERY_STATUS=0 \ + ENABLE_BLOB=1 \ + ENABLE_CHANNEL_MESSAGING=1 \ + ENABLE_CSP_NEXT=0 \ + ENABLE_CSS_BOX_DECORATION_BREAK=1 \ + ENABLE_CSS_COMPOSITING=1 \ + ENABLE_CSS_EXCLUSIONS=1 \ + ENABLE_CSS_FILTERS=0 \ + ENABLE_CSS_HIERARCHIES=0 \ + ENABLE_CSS_IMAGE_ORIENTATION=0 \ + ENABLE_CSS_IMAGE_RESOLUTION=0 \ + ENABLE_CSS_REGIONS=1 \ + ENABLE_CSS_SHADERS=0 \ + ENABLE_CSS_VARIABLES=0 \ + ENABLE_CSS3_FLEXBOX=1 \ + ENABLE_CUSTOM_SCHEME_HANDLER=0 \ + ENABLE_DASHBOARD_SUPPORT=0 \ + ENABLE_DATALIST_ELEMENT=1 \ + ENABLE_DATA_TRANSFER_ITEMS=0 \ + ENABLE_DETAILS_ELEMENT=1 \ + ENABLE_DEVICE_ORIENTATION=0 \ + ENABLE_DIALOG_ELEMENT=0 \ + ENABLE_DIRECTORY_UPLOAD=0 \ + ENABLE_DOWNLOAD_ATTRIBUTE=0 \ + ENABLE_FILE_SYSTEM=0 \ + ENABLE_FILTERS=1 \ + ENABLE_FTPDIR=0 \ + ENABLE_FULLSCREEN_API=1 \ + ENABLE_GAMEPAD=1 \ + ENABLE_GEOLOCATION=1 \ + ENABLE_HIGH_DPI_CANVAS=0 \ + ENABLE_ICONDATABASE=1 \ + ENABLE_IFRAME_SEAMLESS=1 \ + ENABLE_INDEXED_DATABASE=0 \ + ENABLE_INPUT_SPEECH=0 \ + ENABLE_INPUT_TYPE_COLOR=0 \ + ENABLE_INPUT_TYPE_DATE=0 \ + ENABLE_INPUT_TYPE_DATETIME=0 \ + ENABLE_INPUT_TYPE_DATETIMELOCAL=0 \ + ENABLE_INPUT_TYPE_MONTH=0 \ + ENABLE_INPUT_TYPE_TIME=0 \ + ENABLE_INPUT_TYPE_WEEK=0 \ + ENABLE_INSPECTOR=1 \ + ENABLE_JAVASCRIPT_DEBUGGER=1 \ + ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0 \ + ENABLE_LEGACY_NOTIFICATIONS=0 \ + ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 \ + ENABLE_LINK_PREFETCH=1 \ + ENABLE_LINK_PRERENDER=0 \ + ENABLE_MATHML=1 \ + ENABLE_MEDIA_CAPTURE=0 \ + ENABLE_MEDIA_SOURCE=0 \ + ENABLE_MEDIA_STATISTICS=0 \ + ENABLE_MEDIA_STREAM=1 \ + ENABLE_METER_ELEMENT=1 \ + ENABLE_MHTML=0 \ + ENABLE_MICRODATA=0 \ + ENABLE_MUTATION_OBSERVERS=1 \ + ENABLE_NETSCAPE_PLUGIN_API=1 \ + ENABLE_NETWORK_INFO=0 \ + ENABLE_NOTIFICATIONS=0 \ + ENABLE_ORIENTATION_EVENTS=0 \ + ENABLE_PAGE_VISIBILITY_API=0 \ + ENABLE_PROGRESS_ELEMENT=1 \ + ENABLE_QUOTA=0 \ + ENABLE_REGISTER_PROTOCOL_HANDLER=0 \ + ENABLE_REQUEST_ANIMATION_FRAME=1 \ + ENABLE_SCRIPTED_SPEECH=0 \ + ENABLE_SHADOW_DOM=1 \ + ENABLE_SHARED_WORKERS=1 \ + ENABLE_SMOOTH_SCROLLING=1 \ + ENABLE_SPELLCHECK=1 \ + ENABLE_SQL_DATABASE=1 \ + ENABLE_STYLE_SCOPED=0 \ + ENABLE_SVG=1 \ + ENABLE_SVG_DOM_OBJC_BINDINGS=0 \ + ENABLE_SVG_FONTS=1 \ + ENABLE_TEXT_AUTOSIZING=0 \ + ENABLE_TOUCH_EVENTS=0 \ + ENABLE_TOUCH_ICON_LOADING=0 \ + ENABLE_UNDO_MANAGER=0 \ + ENABLE_VIBRATION=0 \ + ENABLE_VIDEO=1 \ + ENABLE_VIDEO_TRACK=1 \ + ENABLE_WEBGL=1 \ + ENABLE_WEB_AUDIO=0 \ + ENABLE_WEB_INTENTS=0 \ + ENABLE_WEB_INTENTS_TAG=0 \ + ENABLE_WEB_SOCKETS=1 \ + ENABLE_WEB_TIMING=1 \ + ENABLE_WORKERS=1 \ + ENABLE_XSLT=1 diff --git a/Source/WebCore/Modules/battery/BatteryManager.idl b/Source/WebCore/Modules/battery/BatteryManager.idl index e552df36e..49a2056ab 100644 --- a/Source/WebCore/Modules/battery/BatteryManager.idl +++ b/Source/WebCore/Modules/battery/BatteryManager.idl @@ -42,7 +42,7 @@ module window { void removeEventListener(in DOMString type, in EventListener listener, in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) + boolean dispatchEvent(in Event event) raises(EventException); }; diff --git a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h index a79483e9b..1feb0d701 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h +++ b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h @@ -54,8 +54,6 @@ public: virtual void onSuccess(PassRefPtr<DOMStringList>) = 0; // From IDBObjectStore/IDBIndex.openCursor(), IDBIndex.openKeyCursor() virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>) = 0; - // From IDBFactory.open() - virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) = 0; // From IDBObjectStore.add()/put(), IDBIndex.getKey() virtual void onSuccess(PassRefPtr<IDBKey>) = 0; // From IDBDatabase.setVersion() @@ -68,9 +66,12 @@ public: virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>) = 0; // From IDBCursor.advance()/continue() virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >& keys, const Vector<RefPtr<IDBKey> >& primaryKeys, const Vector<RefPtr<SerializedScriptValue> >& values) = 0; + // From IDBFactory.open()/deleteDatabase(), IDBDatabase.setVersion() virtual void onBlocked() { ASSERT_NOT_REACHED(); } virtual void onBlocked(int64_t existingVersion) { ASSERT_NOT_REACHED(); } + // From IDBFactory.open() virtual void onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransactionBackendInterface>, PassRefPtr<IDBDatabaseBackendInterface>) { ASSERT_NOT_REACHED(); } + virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) { ASSERT_NOT_REACHED(); } }; } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp index dab74ed0e..aa93e6a82 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp @@ -272,6 +272,14 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont return transaction(context, prpStoreNames, modeString, ec); } +void IDBDatabase::forceClose() +{ + ExceptionCode ec = 0; + for (HashSet<IDBTransaction*>::iterator it = m_transactions.begin(); it != m_transactions.end(); ++it) + (*it)->abort(ec); + this->close(); +} + void IDBDatabase::close() { if (m_closePending) diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.h b/Source/WebCore/Modules/indexeddb/IDBDatabase.h index a7d72ce19..27f03b6e3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.h @@ -88,6 +88,7 @@ public: virtual const AtomicString& interfaceName() const; virtual ScriptExecutionContext* scriptExecutionContext() const; + void forceClose(); void registerFrontendCallbacks(); const IDBDatabaseMetadata metadata() const { return m_metadata; } void enqueueEvent(PassRefPtr<Event>); diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h index faa166f7f..e83de5128 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h @@ -37,6 +37,7 @@ class IDBDatabaseCallbacks : public RefCounted<IDBDatabaseCallbacks> { public: virtual ~IDBDatabaseCallbacks() { } + virtual void onForcedClose() = 0; virtual void onVersionChange(const String& version) = 0; virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) = 0; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp index ceb7af31f..f6565dca1 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp @@ -46,6 +46,12 @@ IDBDatabaseCallbacksImpl::~IDBDatabaseCallbacksImpl() { } +void IDBDatabaseCallbacksImpl::onForcedClose() +{ + if (m_database) + m_database->forceClose(); +} + void IDBDatabaseCallbacksImpl::onVersionChange(const String& version) { if (m_database) diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h index 02c8de0df..792be3ad7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h @@ -41,6 +41,7 @@ public: static PassRefPtr<IDBDatabaseCallbacksImpl> create(IDBDatabase*); virtual ~IDBDatabaseCallbacksImpl(); + virtual void onForcedClose(); virtual void onVersionChange(const String& version); virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); void unregisterDatabase(IDBDatabase*); diff --git a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp index 1d849488f..e89a74cfd 100644 --- a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp @@ -30,6 +30,7 @@ #include "IDBDatabase.h" #include "IDBPendingTransactionMonitor.h" +#include "IDBTracing.h" #include "IDBUpgradeNeededEvent.h" #include "ScriptExecutionContext.h" @@ -67,6 +68,7 @@ void IDBOpenDBRequest::onBlocked(int64_t oldVersion) void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransactionBackendInterface> prpTransactionBackend, PassRefPtr<IDBDatabaseBackendInterface> prpDatabaseBackend) { + IDB_TRACE("IDBOpenDBRequest::onUpgradeNeeded()"); if (!shouldEnqueueEvent()) return; @@ -86,6 +88,24 @@ void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransac enqueueEvent(IDBUpgradeNeededEvent::create(oldVersion, m_version, eventNames().upgradeneededEvent)); } +void IDBOpenDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) +{ + IDB_TRACE("IDBOpenDBRequest::onSuccess()"); + if (!shouldEnqueueEvent()) + return; + + RefPtr<IDBDatabase> idbDatabase; + if (m_result) { + idbDatabase = m_result->idbDatabase(); + ASSERT(idbDatabase); + } else { + idbDatabase = IDBDatabase::create(scriptExecutionContext(), backend); + m_result = IDBAny::create(idbDatabase.get()); + } + idbDatabase->registerFrontendCallbacks(); + enqueueEvent(Event::create(eventNames().successEvent, false, false)); +} + bool IDBOpenDBRequest::shouldEnqueueEvent() const { if (m_contextStopped || !scriptExecutionContext()) diff --git a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h index 638f63157..c87db7ed1 100644 --- a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h @@ -37,8 +37,11 @@ public: static PassRefPtr<IDBOpenDBRequest> create(ScriptExecutionContext*, PassRefPtr<IDBAny> source, int64_t version); virtual ~IDBOpenDBRequest(); + using IDBRequest::onSuccess; + virtual void onBlocked(int64_t existingVersion) OVERRIDE; virtual void onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransactionBackendInterface>, PassRefPtr<IDBDatabaseBackendInterface>) OVERRIDE; + virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) OVERRIDE; // EventTarget virtual const AtomicString& interfaceName() const; diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp index c96b32565..a94af33ca 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp @@ -291,24 +291,6 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRe enqueueEvent(createSuccessEvent()); } -void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) -{ - IDB_TRACE("IDBRequest::onSuccess(IDBDatabase)"); - if (!shouldEnqueueEvent()) - return; - - RefPtr<IDBDatabase> idbDatabase; - if (m_result) { - idbDatabase = m_result->idbDatabase(); - ASSERT(idbDatabase); - } else { - idbDatabase = IDBDatabase::create(scriptExecutionContext(), backend); - m_result = IDBAny::create(idbDatabase.get()); - } - idbDatabase->registerFrontendCallbacks(); - enqueueEvent(createSuccessEvent()); -} - void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) { IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); @@ -428,11 +410,6 @@ void IDBRequest::stop() markEarlyDeath(); } -void IDBRequest::onBlocked() -{ - ASSERT_NOT_REACHED(); -} - const AtomicString& IDBRequest::interfaceName() const { return eventNames().interfaceForIDBRequest; diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index 92d58b748..7f9992485 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -83,7 +83,6 @@ public: // IDBCallbacks virtual void onError(PassRefPtr<IDBDatabaseError>); virtual void onSuccess(PassRefPtr<DOMStringList>); - virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>); virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>); virtual void onSuccess(PassRefPtr<IDBKey>); virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>); @@ -91,8 +90,6 @@ public: virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&); virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>); virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { ASSERT_NOT_REACHED(); } // Not implemented. Callback should not reach the renderer side. - virtual void onBlocked(); - virtual void onBlocked(int64_t existingVersion) { ASSERT_NOT_REACHED(); } // ActiveDOMObject virtual bool hasPendingActivity() const OVERRIDE; diff --git a/Source/WebCore/UseV8.cmake b/Source/WebCore/UseV8.cmake index 91ce8352e..45eee600e 100755 --- a/Source/WebCore/UseV8.cmake +++ b/Source/WebCore/UseV8.cmake @@ -64,7 +64,6 @@ LIST(APPEND WebCore_SOURCES bindings/v8/V8ObjectConstructor.cpp bindings/v8/V8PerContextData.cpp bindings/v8/V8PerIsolateData.cpp - bindings/v8/V8Proxy.cpp bindings/v8/V8RecursionScope.cpp bindings/v8/V8ThrowException.cpp bindings/v8/V8Utilities.cpp diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 770dd858c..dd677fd81 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -1619,6 +1619,7 @@ __ZN7WebCore7nsColorERKNS_5ColorE __ZN7WebCore8IntPointC1ERK8_NSPoint __ZN7WebCore9FloatRectC1ERK7_NSRect __ZNK7WebCore10FloatPointcv8_NSPointEv +__ZNK7WebCore14ScrollableArea18visibleContentRectEb __ZNK7WebCore6Cursor14platformCursorEv __ZNK7WebCore7IntRectcv7_NSRectEv __ZNK7WebCore7IntSizecv6CGSizeEv diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index a6e62cada..0ba33776f 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -531,6 +531,7 @@ 'platform/text/TextStream.h', 'platform/text/UnicodeBidi.h', 'platform/text/UnicodeRange.h', + 'platform/text/WritingMode.h', 'platform/text/mac/CharsetData.h', 'plugins/PluginData.h', 'plugins/PluginMainThreadScheduler.h', @@ -2204,7 +2205,6 @@ 'bindings/v8/NPV8Object.h', 'bindings/v8/Dictionary.cpp', 'bindings/v8/Dictionary.h', - 'bindings/v8/OwnHandle.h', 'bindings/v8/PageScriptDebugServer.cpp', 'bindings/v8/PageScriptDebugServer.h', 'bindings/v8/RetainedDOMInfo.cpp', @@ -2214,6 +2214,7 @@ 'bindings/v8/ScheduledAction.h', 'bindings/v8/ScopedDOMDataStore.cpp', 'bindings/v8/ScopedDOMDataStore.h', + 'bindings/v8/ScopedPersistent.h', 'bindings/v8/ScriptCachedFrameData.cpp', 'bindings/v8/ScriptCachedFrameData.h', 'bindings/v8/ScriptCallStackFactory.cpp', @@ -2299,8 +2300,6 @@ 'bindings/v8/V8PerContextData.h', 'bindings/v8/V8PerIsolateData.cpp', 'bindings/v8/V8PerIsolateData.h', - 'bindings/v8/V8Proxy.cpp', - 'bindings/v8/V8Proxy.h', 'bindings/v8/V8RecursionScope.cpp', 'bindings/v8/V8RecursionScope.h', 'bindings/v8/V8StringResource.cpp', @@ -8352,8 +8351,6 @@ 'platform/graphics/chromium/LayerChromium.cpp', 'platform/graphics/chromium/LayerChromium.h', 'platform/graphics/chromium/LayerPainterChromium.h', - 'platform/graphics/chromium/LayerRendererChromium.cpp', - 'platform/graphics/chromium/LayerRendererChromium.h', 'platform/graphics/chromium/LayerTextureSubImage.cpp', 'platform/graphics/chromium/LayerTextureSubImage.h', 'platform/graphics/chromium/LayerTextureUpdater.h', @@ -8463,6 +8460,8 @@ 'platform/graphics/chromium/cc/CCQuadCuller.cpp', 'platform/graphics/chromium/cc/CCQuadCuller.h', 'platform/graphics/chromium/cc/CCRenderer.h', + 'platform/graphics/chromium/cc/CCRendererGL.cpp', + 'platform/graphics/chromium/cc/CCRendererGL.h', 'platform/graphics/chromium/cc/CCRenderPass.cpp', 'platform/graphics/chromium/cc/CCRenderPass.h', 'platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 88752e296..8758fce19 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -34026,6 +34026,10 @@ > </File> <File + RelativePath="..\platform\text\WritingMode.h" + > + </File> + <File RelativePath="..\platform\graphics\WidthIterator.cpp" > </File> diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index d95f65847..a974ffaf6 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -307,6 +307,7 @@ 142B97CA13138943008BEF4B /* TextControlInnerElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 142B97C813138943008BEF4B /* TextControlInnerElements.h */; }; 1432E8470C51493800B1500F /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1432E8460C51493800B1500F /* GCController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1432E8490C51493F00B1500F /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1432E8480C51493F00B1500F /* GCController.cpp */; }; + 14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14476AA715DC4BB100305DB2 /* WritingMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1449E24A107D4A8400B5793F /* JSCallbackData.h */; }; 1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1449E286107D4DB400B5793F /* JSCallbackData.cpp */; }; 144FCE5214EC79BC000D17A3 /* FractionalLayoutUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 144FCE5114EC79BC000D17A3 /* FractionalLayoutUnit.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -7321,6 +7322,7 @@ 142B97C813138943008BEF4B /* TextControlInnerElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextControlInnerElements.h; sourceTree = "<group>"; }; 1432E8460C51493800B1500F /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; }; 1432E8480C51493F00B1500F /* GCController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GCController.cpp; sourceTree = "<group>"; }; + 14476AA715DC4BB100305DB2 /* WritingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritingMode.h; sourceTree = "<group>"; }; 1449E24A107D4A8400B5793F /* JSCallbackData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackData.h; sourceTree = "<group>"; }; 1449E286107D4DB400B5793F /* JSCallbackData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackData.cpp; sourceTree = "<group>"; }; 144FCE5114EC79BC000D17A3 /* FractionalLayoutUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FractionalLayoutUnit.h; sourceTree = "<group>"; }; @@ -19986,6 +19988,7 @@ A863E2001343412000274926 /* UnicodeBidi.h */, B2C3DA1C0D006C1D00EF6F26 /* UnicodeRange.cpp */, B2C3DA1D0D006C1D00EF6F26 /* UnicodeRange.h */, + 14476AA715DC4BB100305DB2 /* WritingMode.h */, ); path = text; sourceTree = "<group>"; @@ -25445,6 +25448,7 @@ 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, FD537353137B651800008DCE /* ZeroPole.h in Headers */, 9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */, + 14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -28592,11 +28596,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */; buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; }; name = Debug; @@ -28605,11 +28604,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */; buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; }; name = Release; @@ -28619,11 +28613,6 @@ baseConfigurationReference = 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */; buildSettings = { BUILD_VARIANTS = normal; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; }; name = Production; }; diff --git a/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp b/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp index 34c28e9ce..0f53d4420 100644 --- a/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp +++ b/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp @@ -64,7 +64,7 @@ bool JSSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLEr // Therefore an exception and returning true are the same thing - so, return true on an exception return true; } - return result.toBoolean(); + return result.toBoolean(exec); } } diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp index 39beae5da..a1f0c1b22 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -641,7 +641,7 @@ JSValue JSDOMWindow::addEventListener(ExecState* exec) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean()); + impl()->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return jsUndefined(); } @@ -655,7 +655,7 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec) if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean()); + impl()->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return jsUndefined(); } diff --git a/Source/WebCore/bindings/js/JSDataViewCustom.cpp b/Source/WebCore/bindings/js/JSDataViewCustom.cpp index a88989bad..3eb7a3e1a 100644 --- a/Source/WebCore/bindings/js/JSDataViewCustom.cpp +++ b/Source/WebCore/bindings/js/JSDataViewCustom.cpp @@ -73,7 +73,7 @@ static JSValue getDataViewMember(ExecState* exec, DataView* imp, DataViewAccessT bool littleEndian = false; if (exec->argumentCount() > 1 && (type == AccessDataViewMemberAsFloat32 || type == AccessDataViewMemberAsFloat64)) { - littleEndian = exec->argument(1).toBoolean(); + littleEndian = exec->argument(1).toBoolean(exec); if (exec->hadException()) return jsUndefined(); } diff --git a/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp b/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp index f4d2bf6d8..8e9948f1a 100644 --- a/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp @@ -165,8 +165,8 @@ JSValue JSDeviceMotionEvent::interval(ExecState*) const JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState* exec) { const String& type = ustringToString(exec->argument(0).toString(exec)->value(exec)); - bool bubbles = exec->argument(1).toBoolean(); - bool cancelable = exec->argument(2).toBoolean(); + bool bubbles = exec->argument(1).toBoolean(exec); + bool cancelable = exec->argument(2).toBoolean(exec); // If any of the parameters are null or undefined, mark them as not provided. // Otherwise, use the standard JavaScript conversion. diff --git a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp index 25976e411..d03b740aa 100644 --- a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp @@ -71,8 +71,8 @@ JSValue JSDeviceOrientationEvent::absolute(ExecState*) const JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec) { const String& type = ustringToString(exec->argument(0).toString(exec)->value(exec)); - bool bubbles = exec->argument(1).toBoolean(); - bool cancelable = exec->argument(2).toBoolean(); + bool bubbles = exec->argument(1).toBoolean(exec); + bool cancelable = exec->argument(2).toBoolean(exec); // If alpha, beta or gamma are null or undefined, mark them as not provided. // Otherwise, use the standard JavaScript conversion. bool alphaProvided = !exec->argument(3).isUndefinedOrNull(); @@ -82,7 +82,7 @@ JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec) bool gammaProvided = !exec->argument(5).isUndefinedOrNull(); double gamma = exec->argument(5).toNumber(exec); bool absoluteProvided = !exec->argument(6).isUndefinedOrNull(); - bool absolute = exec->argument(6).toBoolean(); + bool absolute = exec->argument(6).toBoolean(exec); RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute); DeviceOrientationEvent* imp = static_cast<DeviceOrientationEvent*>(impl()); imp->initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get()); diff --git a/Source/WebCore/bindings/js/JSDictionary.cpp b/Source/WebCore/bindings/js/JSDictionary.cpp index ec8948ccf..85b759198 100644 --- a/Source/WebCore/bindings/js/JSDictionary.cpp +++ b/Source/WebCore/bindings/js/JSDictionary.cpp @@ -63,9 +63,9 @@ JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propert return PropertyFound; } -void JSDictionary::convertValue(ExecState*, JSValue value, bool& result) +void JSDictionary::convertValue(ExecState* exec, JSValue value, bool& result) { - result = value.toBoolean(); + result = value.toBoolean(exec); } void JSDictionary::convertValue(ExecState* exec, JSValue value, int& result) diff --git a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp index a72af1062..3f9a39fd2 100644 --- a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp @@ -55,22 +55,22 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec) JSObject* jsAttrs = exec->argument(1).getObject(); Identifier alpha(exec, "alpha"); if (jsAttrs->hasProperty(exec, alpha)) - webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean()); + webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean(exec)); Identifier depth(exec, "depth"); if (jsAttrs->hasProperty(exec, depth)) - webGLAttrs->setDepth(jsAttrs->get(exec, depth).toBoolean()); + webGLAttrs->setDepth(jsAttrs->get(exec, depth).toBoolean(exec)); Identifier stencil(exec, "stencil"); if (jsAttrs->hasProperty(exec, stencil)) - webGLAttrs->setStencil(jsAttrs->get(exec, stencil).toBoolean()); + webGLAttrs->setStencil(jsAttrs->get(exec, stencil).toBoolean(exec)); Identifier antialias(exec, "antialias"); if (jsAttrs->hasProperty(exec, antialias)) - webGLAttrs->setAntialias(jsAttrs->get(exec, antialias).toBoolean()); + webGLAttrs->setAntialias(jsAttrs->get(exec, antialias).toBoolean(exec)); Identifier premultipliedAlpha(exec, "premultipliedAlpha"); if (jsAttrs->hasProperty(exec, premultipliedAlpha)) - webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean()); + webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean(exec)); Identifier preserveDrawingBuffer(exec, "preserveDrawingBuffer"); if (jsAttrs->hasProperty(exec, preserveDrawingBuffer)) - webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean()); + webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean(exec)); } } #endif diff --git a/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp index 7c4945053..338f4c479 100644 --- a/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp +++ b/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp @@ -118,9 +118,9 @@ static void populateContextMenuItems(ExecState* exec, JSArray* array, ContextMen ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec)); ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, ustringToString(label.toString(exec)->value(exec))); if (!enabled.isUndefined()) - menuItem.setEnabled(enabled.toBoolean()); + menuItem.setEnabled(enabled.toBoolean(exec)); if (!checked.isUndefined()) - menuItem.setChecked(checked.toBoolean()); + menuItem.setChecked(checked.toBoolean(exec)); menu.appendItem(menuItem); } } diff --git a/Source/WebCore/bindings/js/JSMessageEventCustom.cpp b/Source/WebCore/bindings/js/JSMessageEventCustom.cpp index 3511e679e..64fcef88a 100644 --- a/Source/WebCore/bindings/js/JSMessageEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSMessageEventCustom.cpp @@ -103,8 +103,8 @@ JSValue JSMessageEvent::ports(ExecState* exec) const static JSC::JSValue handleInitMessageEvent(JSMessageEvent* jsEvent, JSC::ExecState* exec) { const UString& typeArg = exec->argument(0).toString(exec)->value(exec); - bool canBubbleArg = exec->argument(1).toBoolean(); - bool cancelableArg = exec->argument(2).toBoolean(); + bool canBubbleArg = exec->argument(1).toBoolean(exec); + bool cancelableArg = exec->argument(2).toBoolean(exec); const UString& originArg = exec->argument(4).toString(exec)->value(exec); const UString& lastEventIdArg = exec->argument(5).toString(exec)->value(exec); DOMWindow* sourceArg = toDOMWindow(exec->argument(6)); diff --git a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index d6a171fb9..af008074f 100644 --- a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -613,7 +613,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat if (exec->hadException()) return jsUndefined(); - bool transpose = exec->argument(1).toBoolean(); + bool transpose = exec->argument(1).toBoolean(exec); if (exec->hadException()) return jsUndefined(); diff --git a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index 40c329b73..c08c29560 100644 --- a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -89,7 +89,7 @@ JSValue JSXMLHttpRequest::open(ExecState* exec) ExceptionCode ec = 0; if (exec->argumentCount() >= 3) { - bool async = exec->argument(2).toBoolean(); + bool async = exec->argument(2).toBoolean(exec); if (exec->argumentCount() >= 4 && !exec->argument(3).isUndefined()) { String user = valueToStringWithNullCheck(exec, exec->argument(3)); diff --git a/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp b/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp index 3aefad167..9ea9ec8f0 100644 --- a/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp +++ b/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp @@ -100,6 +100,14 @@ JSObject* JavaScriptCallFrame::thisObject() const return m_debuggerCallFrame.thisObject(); } +ExecState* JavaScriptCallFrame::exec() const +{ + ASSERT(m_isValid); + if (!m_isValid) + return 0; + return m_debuggerCallFrame.callFrame(); +} + // Evaluate some JavaScript code in the scope of this frame. JSValue JavaScriptCallFrame::evaluate(const UString& script, JSValue& exception) const { diff --git a/Source/WebCore/bindings/js/JavaScriptCallFrame.h b/Source/WebCore/bindings/js/JavaScriptCallFrame.h index a581c4fc7..e987ecf88 100644 --- a/Source/WebCore/bindings/js/JavaScriptCallFrame.h +++ b/Source/WebCore/bindings/js/JavaScriptCallFrame.h @@ -71,6 +71,7 @@ public: JSC::DebuggerCallFrame::Type type() const; JSC::ScopeChainNode* scopeChain() const; JSC::JSGlobalObject* dynamicGlobalObject() const; + JSC::ExecState* exec() const; JSC::JSObject* thisObject() const; JSC::JSValue evaluate(const JSC::UString& script, JSC::JSValue& exception) const; diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.cpp b/Source/WebCore/bindings/js/ScriptDebugServer.cpp index 967b3d21f..bbcd54299 100644 --- a/Source/WebCore/bindings/js/ScriptDebugServer.cpp +++ b/Source/WebCore/bindings/js/ScriptDebugServer.cpp @@ -206,7 +206,7 @@ bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, const TextPosition& pos // An erroneous condition counts as "false". return false; } - return result.toBoolean(); + return result.toBoolean(m_currentCallFrame->exec()); } void ScriptDebugServer::clearBreakpoints() diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp index 9d5ca654d..ea702295b 100644 --- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp @@ -56,6 +56,7 @@ #include <limits> #include <JavaScriptCore/APICast.h> #include <JavaScriptCore/APIShims.h> +#include <runtime/BooleanObject.h> #include <runtime/DateInstance.h> #include <runtime/Error.h> #include <runtime/ExceptionHelpers.h> @@ -108,6 +109,11 @@ enum SerializationTag { ArrayBufferTag = 21, ArrayBufferViewTag = 22, ArrayBufferTransferTag = 23, + TrueObjectTag = 24, + FalseObjectTag = 25, + StringObjectTag = 26, + EmptyStringObjectTag = 27, + NumberObjectTag = 28, ErrorTag = 255 }; @@ -152,8 +158,10 @@ static unsigned typedArrayElementSize(ArrayBufferViewSubtag tag) * * Initial version was 1. * Version 2. added the ObjectReferenceTag and support for serialization of cyclic graphs. + * Version 3. added the FalseObjectTag, TrueObjectTag, NumberObjectTag, StringObjectTag + * and EmptyStringObjectTag for serialization of Boolean, Number and String objects. */ -static const unsigned int CurrentVersion = 2; +static const unsigned int CurrentVersion = 3; static const unsigned int TerminatorTag = 0xFFFFFFFF; static const unsigned int StringPoolTag = 0xFFFFFFFE; @@ -182,10 +190,14 @@ static const unsigned int StringPoolTag = 0xFFFFFFFE; * | OneTag * | FalseTag * | TrueTag + * | FalseObjectTag + * | TrueObjectTag * | DoubleTag <value:double> + * | NumberObjectTag <value:double> * | DateTag <value:double> * | String * | EmptyStringTag + * | EmptyStringObjectTag * | File * | FileList * | ImageData @@ -200,6 +212,10 @@ static const unsigned int StringPoolTag = 0xFFFFFFFE; * EmptyStringTag * StringTag StringData * + * StringObject: + * EmptyStringObjectTag + * StringObjectTag StringData + * * StringData :- * StringPoolTag <cpIndex:IndexType> * (not (TerminatorTag | StringPoolTag))<length:uint32_t><characters:UChar{length}> // Added to constant pool when seen, string length 0xFFFFFFFF is disallowed @@ -517,6 +533,16 @@ private: } } + void dumpStringObject(UString str) + { + if (str.isEmpty()) + write(EmptyStringObjectTag); + else { + write(StringObjectTag); + write(str); + } + } + bool dumpArrayBufferView(JSObject* obj, SerializationReturnCode& code) { write(ArrayBufferViewTag); @@ -585,6 +611,27 @@ private: if (value.isObject()) { JSObject* obj = asObject(value); + if (obj->inherits(&BooleanObject::s_info)) { + if (!startObjectInternal(obj)) // handle duplicates + return true; + write(asBooleanObject(value)->internalValue().toBoolean(m_exec) ? TrueObjectTag : FalseObjectTag); + return true; + } + if (obj->inherits(&StringObject::s_info)) { + if (!startObjectInternal(obj)) // handle duplicates + return true; + UString str = asString(asStringObject(value)->internalValue())->value(m_exec); + dumpStringObject(str); + return true; + } + if (obj->inherits(&NumberObject::s_info)) { + if (!startObjectInternal(obj)) // handle duplicates + return true; + write(NumberObjectTag); + NumberObject* obj = static_cast<NumberObject*>(asObject(value)); + write(obj->internalValue().asNumber()); + return true; + } if (obj->inherits(&JSFile::s_info)) { write(FileTag); write(toFile(obj)); @@ -1398,12 +1445,32 @@ private: return jsBoolean(false); case TrueTag: return jsBoolean(true); + case FalseObjectTag: { + BooleanObject* obj = BooleanObject::create(m_exec->globalData(), m_globalObject->booleanObjectStructure()); + obj->setInternalValue(m_exec->globalData(), jsBoolean(false)); + m_gcBuffer.append(obj); + return obj; + } + case TrueObjectTag: { + BooleanObject* obj = BooleanObject::create(m_exec->globalData(), m_globalObject->booleanObjectStructure()); + obj->setInternalValue(m_exec->globalData(), jsBoolean(true)); + m_gcBuffer.append(obj); + return obj; + } case DoubleTag: { double d; if (!read(d)) return JSValue(); return jsNumber(d); } + case NumberObjectTag: { + double d; + if (!read(d)) + return JSValue(); + NumberObject* obj = constructNumber(m_exec, m_globalObject, jsNumber(d)); + m_gcBuffer.append(obj); + return obj; + } case DateTag: { double d; if (!read(d)) @@ -1479,6 +1546,19 @@ private: } case EmptyStringTag: return jsEmptyString(&m_exec->globalData()); + case StringObjectTag: { + CachedStringRef cachedString; + if (!readStringData(cachedString)) + return JSValue(); + StringObject* obj = constructString(m_exec, m_globalObject, cachedString->jsString(m_exec)); + m_gcBuffer.append(obj); + return obj; + } + case EmptyStringObjectTag: { + StringObject* obj = constructString(m_exec, m_globalObject, jsEmptyString(&m_exec->globalData())); + m_gcBuffer.append(obj); + return obj; + } case RegExpTag: { CachedStringRef pattern; if (!readStringData(pattern)) diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 997be4137..e680dbf44 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -165,7 +165,7 @@ END JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean()); + impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); END return @GenerateEventListenerImpl; @@ -751,6 +751,15 @@ sub GenerateHeader push(@headerContent, " ptr->finishCreation(globalData);\n"); push(@headerContent, " return ptr;\n"); push(@headerContent, " }\n\n"); + } elsif ($dataNode->extendedAttributes->{"MasqueradesAsUndefined"}) { + AddIncludesForTypeInHeader($implType) unless $svgPropertyOrListPropertyType; + push(@headerContent, " static $className* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n"); + push(@headerContent, " {\n"); + push(@headerContent, " globalObject->masqueradesAsUndefinedWatchpoint()->notifyWrite();\n"); + push(@headerContent, " $className* ptr = new (NotNull, JSC::allocateCell<$className>(globalObject->globalData().heap)) $className(structure, globalObject, impl);\n"); + push(@headerContent, " ptr->finishCreation(globalObject->globalData());\n"); + push(@headerContent, " return ptr;\n"); + push(@headerContent, " }\n\n"); } else { AddIncludesForTypeInHeader($implType) unless $svgPropertyOrListPropertyType; push(@headerContent, " static $className* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n"); @@ -3015,7 +3024,7 @@ sub JSValueToNative my $conditional = $signature->extendedAttributes->{"Conditional"}; my $type = $codeGenerator->StripModule($signature->type); - return "$value.toBoolean()" if $type eq "boolean"; + return "$value.toBoolean(exec)" if $type eq "boolean"; return "$value.toNumber(exec)" if $type eq "double"; return "$value.toFloat(exec)" if $type eq "float"; return "$value.toInt32(exec)" if $type eq "long" or $type eq "short"; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 5969d2d47..c68331820 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -2522,7 +2522,6 @@ sub GenerateImplementation AddToImplIncludes("BindingState.h"); AddToImplIncludes("ContextFeatures.h"); AddToImplIncludes("RuntimeEnabledFeatures.h"); - AddToImplIncludes("V8Proxy.h"); AddToImplIncludes("V8Binding.h"); AddToImplIncludes("V8DOMWrapper.h"); AddToImplIncludes("V8IsolatedContext.h"); @@ -3212,11 +3211,10 @@ sub GenerateCallbackImplementation # - Add default header template push(@implFixedHeader, GenerateImplementationContentHeader($dataNode)); - + AddToImplIncludes("ScriptExecutionContext.h"); AddToImplIncludes("V8Binding.h"); AddToImplIncludes("V8Callback.h"); - AddToImplIncludes("V8Proxy.h"); push(@implContent, "#include <wtf/Assertions.h>\n\n"); push(@implContent, "namespace WebCore {\n\n"); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp index 8474b1ab6..4cf95c9cf 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp @@ -253,7 +253,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionAddEventListener( JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean()); + impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } @@ -268,7 +268,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListen JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean()); + impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h index c3aa1f0cd..b442c0701 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h @@ -34,6 +34,7 @@ public: typedef JSDOMWrapper Base; static JSTestEventTarget* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestEventTarget> impl) { + globalObject->masqueradesAsUndefinedWatchpoint()->notifyWrite(); JSTestEventTarget* ptr = new (NotNull, JSC::allocateCell<JSTestEventTarget>(globalObject->globalData().heap)) JSTestEventTarget(structure, globalObject, impl); ptr->finishCreation(globalObject->globalData()); return ptr; diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 18affcc79..e172cf6c7 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -1048,7 +1048,7 @@ void setJSTestObjCreate(ExecState* exec, JSObject* thisObject, JSValue value) UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setCreate(value.toBoolean()); + impl->setCreate(value.toBoolean(exec)); } @@ -1084,7 +1084,7 @@ void setJSTestObjReflectedBooleanAttr(ExecState* exec, JSObject* thisObject, JSV UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value.toBoolean()); + impl->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value.toBoolean(exec)); } @@ -1120,7 +1120,7 @@ void setJSTestObjReflectedCustomBooleanAttr(ExecState* exec, JSObject* thisObjec UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value.toBoolean()); + impl->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value.toBoolean(exec)); } @@ -1681,7 +1681,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecStat JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean()); + impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } @@ -1696,7 +1696,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecS JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean()); + impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp index c93730d3a..bda47a5ac 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp @@ -33,7 +33,6 @@ #include "V8Float32Array.h" #include "V8Int32Array.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/Float32Array.h> #include <wtf/Float64Array.h> #include <wtf/GetPtr.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp index 23872e961..6e4be7579 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp @@ -30,7 +30,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index 0f19bfc91..ed2de6ee6 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -30,7 +30,6 @@ #include "V8Class2.h" #include "V8Class8.h" #include "V8DOMStringList.h" -#include "V8Proxy.h" #include "V8ThisClass.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp index e568d57ae..8975cf632 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp @@ -29,7 +29,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp index dacbd1d8d..fe3eb4fff 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp @@ -29,7 +29,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp index b10b607a9..1940d7dbd 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp @@ -32,7 +32,6 @@ #include "V8Event.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp index ffb49fd4b..9375ce310 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp @@ -28,7 +28,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index d4b8161af..0098d5eb0 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -33,7 +33,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8TestObj.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp index ab66706d6..ac1167998 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp @@ -30,7 +30,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp index d37f46dc0..7a74f5827 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp @@ -29,7 +29,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp index 9a3cef794..ce42f92ed 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp @@ -29,7 +29,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 3f0b324f0..553a3d1a6 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -44,7 +44,6 @@ #include "V8Document.h" #include "V8Float32Array.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include "V8SVGDocument.h" #include "V8SVGPoint.h" #include "V8ScriptProfile.h" diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp index 45ace2076..ae8d18d45 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp @@ -34,7 +34,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8MessagePort.h" -#include "V8Proxy.h" #include <wtf/ArrayBuffer.h> #include <wtf/UnusedParam.h> diff --git a/Source/WebCore/bindings/v8/JavaScriptCallFrame.h b/Source/WebCore/bindings/v8/JavaScriptCallFrame.h index 021616e56..21a1d6d54 100644 --- a/Source/WebCore/bindings/v8/JavaScriptCallFrame.h +++ b/Source/WebCore/bindings/v8/JavaScriptCallFrame.h @@ -33,8 +33,8 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) -#include "OwnHandle.h" #include "PlatformString.h" +#include "ScopedPersistent.h" #include <v8-debug.h> #include <wtf/RefCounted.h> @@ -66,8 +66,8 @@ private: JavaScriptCallFrame(v8::Handle<v8::Context> debuggerContext, v8::Handle<v8::Object> callFrame); RefPtr<JavaScriptCallFrame> m_caller; - OwnHandle<v8::Context> m_debuggerContext; - OwnHandle<v8::Object> m_callFrame; + ScopedPersistent<v8::Context> m_debuggerContext; + ScopedPersistent<v8::Object> m_callFrame; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScheduledAction.cpp b/Source/WebCore/bindings/v8/ScheduledAction.cpp index 2a5f89d2d..40ab33dfa 100644 --- a/Source/WebCore/bindings/v8/ScheduledAction.cpp +++ b/Source/WebCore/bindings/v8/ScheduledAction.cpp @@ -49,49 +49,20 @@ namespace WebCore { -ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> func, int argc, v8::Handle<v8::Value> argv[]) +ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[]) : m_context(context) + , m_function(function) , m_code(String(), KURL(), TextPosition::belowRangePosition()) { - m_function = v8::Persistent<v8::Function>::New(func); - -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCHEDULED_ACTION, this, m_function); -#endif - - m_argc = argc; - if (argc > 0) { - m_argv = new v8::Persistent<v8::Value>[argc]; - for (int i = 0; i < argc; i++) { - m_argv[i] = v8::Persistent<v8::Value>::New(argv[i]); - -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCHEDULED_ACTION, this, m_argv[i]); -#endif - } - } else - m_argv = 0; + m_args.reserveCapacity(argc); + for (int i = 0; i < argc; ++i) + m_args.append(v8::Persistent<v8::Value>::New(argv[i])); } ScheduledAction::~ScheduledAction() { - if (m_function.IsEmpty()) - return; - -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_function); -#endif - m_function.Dispose(); - - for (int i = 0; i < m_argc; i++) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_argv[i]); -#endif - m_argv[i].Dispose(); - } - - if (m_argc > 0) - delete[] m_argv; + for (size_t i = 0; i < m_args.size(); ++i) + m_args[i].Dispose(); } void ScheduledAction::execute(ScriptExecutionContext* context) @@ -102,7 +73,7 @@ void ScheduledAction::execute(ScriptExecutionContext* context) return; if (!frame->script()->canExecuteScripts(AboutToExecuteScript)) return; - execute(frame->script()); + execute(frame); } #if ENABLE(WORKERS) else { @@ -112,47 +83,46 @@ void ScheduledAction::execute(ScriptExecutionContext* context) #endif } -void ScheduledAction::execute(ScriptController* script) +void ScheduledAction::execute(Frame* frame) { - ASSERT(script->proxy()); - v8::HandleScope handleScope; - v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context.get()); - if (v8Context.IsEmpty()) - return; // JS may not be enabled. + + v8::Handle<v8::Context> context = v8::Local<v8::Context>::New(m_context.get()); + if (context.IsEmpty()) + return; + v8::Context::Scope scope(context); #if PLATFORM(CHROMIUM) TRACE_EVENT0("v8", "ScheduledAction::execute"); #endif - v8::Context::Scope scope(v8Context); - - // FIXME: Need to implement timeouts for preempting a long-running script. - if (!m_function.IsEmpty() && m_function->IsFunction()) - script->callFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv); + v8::Handle<v8::Function> function = m_function.get(); + if (!function.IsEmpty()) + frame->script()->callFunction(function, context->Global(), m_args.size(), m_args.data()); else - script->compileAndRunScript(m_code); + frame->script()->compileAndRunScript(m_code); - // The 'proxy' may be invalid at this point since JS could have released the owning Frame. + // The frame might be invalid at this point because JavaScript could have released it. } #if ENABLE(WORKERS) -void ScheduledAction::execute(WorkerContext* workerContext) +void ScheduledAction::execute(WorkerContext* worker) { - // In a Worker, the execution should always happen on a worker thread. - ASSERT(workerContext->thread()->threadID() == currentThread()); + ASSERT(worker->thread()->threadID() == currentThread()); - V8RecursionScope recursionScope(workerContext); - WorkerScriptController* scriptController = workerContext->script(); + V8RecursionScope recursionScope(worker); - if (!m_function.IsEmpty() && m_function->IsFunction()) { + v8::Handle<v8::Function> function = m_function.get(); + if (!function.IsEmpty()) { v8::HandleScope handleScope; - v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context.get()); - ASSERT(!v8Context.IsEmpty()); - v8::Context::Scope scope(v8Context); - m_function->Call(v8Context->Global(), m_argc, m_argv); + + v8::Handle<v8::Context> context = v8::Local<v8::Context>::New(m_context.get()); + ASSERT(!context.IsEmpty()); + v8::Context::Scope scope(context); + + function->Call(context->Global(), m_args.size(), m_args.data()); } else - scriptController->evaluate(m_code); + worker->script()->evaluate(m_code); } #endif diff --git a/Source/WebCore/bindings/v8/ScheduledAction.h b/Source/WebCore/bindings/v8/ScheduledAction.h index e3f3bb440..17ca7b41a 100644 --- a/Source/WebCore/bindings/v8/ScheduledAction.h +++ b/Source/WebCore/bindings/v8/ScheduledAction.h @@ -31,45 +31,42 @@ #ifndef ScheduledAction_h #define ScheduledAction_h -#include "OwnHandle.h" +#include "ScopedPersistent.h" #include "ScriptSourceCode.h" -#include "V8GCController.h" -#include <wtf/Forward.h> - #include <v8.h> +#include <wtf/Forward.h> +#include <wtf/Vector.h> namespace WebCore { - class ScriptController; - class ScriptExecutionContext; - class WorkerContext; +class Frame; +class ScriptExecutionContext; +class WorkerContext; + +class ScheduledAction { +public: + ScheduledAction(v8::Handle<v8::Context>, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); - class ScheduledAction { - public: - ScheduledAction(v8::Handle<v8::Context>, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); - explicit ScheduledAction(v8::Handle<v8::Context> context, const WTF::String& code, const KURL& url = KURL()) - : m_context(context) - , m_argc(0) - , m_argv(0) - , m_code(code, url) - { - } + ScheduledAction(v8::Handle<v8::Context> context, const String& code, const KURL& url = KURL()) + : m_context(context) + , m_code(code, url) + { + } - virtual ~ScheduledAction(); - virtual void execute(ScriptExecutionContext*); + ~ScheduledAction(); + void execute(ScriptExecutionContext*); - private: - void execute(ScriptController*); +private: + void execute(Frame*); #if ENABLE(WORKERS) - void execute(WorkerContext*); + void execute(WorkerContext*); #endif - OwnHandle<v8::Context> m_context; - v8::Persistent<v8::Function> m_function; - int m_argc; - v8::Persistent<v8::Value>* m_argv; - ScriptSourceCode m_code; - }; + ScopedPersistent<v8::Context> m_context; + ScopedPersistent<v8::Function> m_function; + Vector<v8::Persistent<v8::Value> > m_args; + ScriptSourceCode m_code; +}; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/OwnHandle.h b/Source/WebCore/bindings/v8/ScopedPersistent.h index 668f5d414..f5d696ccc 100644 --- a/Source/WebCore/bindings/v8/OwnHandle.h +++ b/Source/WebCore/bindings/v8/ScopedPersistent.h @@ -28,29 +28,31 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef OwnHandle_h -#define OwnHandle_h +#ifndef ScopedPersistent_h +#define ScopedPersistent_h #include <v8.h> +#include <wtf/Noncopyable.h> namespace WebCore { template<typename T> -class OwnHandle { +class ScopedPersistent { + WTF_MAKE_NONCOPYABLE(ScopedPersistent); public: - OwnHandle() { } + ScopedPersistent() { } - explicit OwnHandle(v8::Handle<T> handle) + explicit ScopedPersistent(v8::Handle<T> handle) : m_handle(v8::Persistent<T>::New(handle)) { } - ~OwnHandle() + ~ScopedPersistent() { clear(); } - v8::Handle<T> get() const { return m_handle; } + v8::Persistent<T> get() const { return m_handle; } void set(v8::Handle<T> handle) { @@ -58,6 +60,12 @@ public: m_handle = v8::Persistent<T>::New(handle); } + void adopt(v8::Persistent<T> handle) + { + clear(); + m_handle = handle; + } + // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. void clear() { @@ -73,4 +81,4 @@ private: } // namespace WebCore -#endif // OwnHandle_h +#endif // ScopedPersistent_h diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index 1fb36b374..4672570e6 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -59,6 +59,7 @@ #include "V8Binding.h" #include "V8DOMWindow.h" #include "V8Event.h" +#include "V8GCController.h" #include "V8HiddenPropertyName.h" #include "V8HTMLEmbedElement.h" #include "V8IsolatedContext.h" @@ -111,7 +112,6 @@ ScriptController::ScriptController(Frame* frame) , m_sourceURL(0) , m_windowShell(V8DOMWindowShell::create(frame)) , m_paused(false) - , m_proxy(adoptPtr(new V8Proxy(frame))) #if ENABLE(NETSCAPE_PLUGIN_API) , m_wrappedWindowScriptNPObject(0) #endif @@ -120,6 +120,7 @@ ScriptController::ScriptController(Frame* frame) ScriptController::~ScriptController() { + windowShell()->destroyGlobal(); clearForClose(); } @@ -193,7 +194,7 @@ bool ScriptController::processingUserGesture() v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) { - // Keep Frame (and therefore ScriptController and V8Proxy) alive. + // Keep Frame (and therefore ScriptController) alive. RefPtr<Frame> protect(m_frame); return ScriptController::callFunctionWithInstrumentation(m_frame ? m_frame->document() : 0, function, receiver, argc, args); } @@ -647,7 +648,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement void ScriptController::clearWindowShell(DOMWindow*, bool) { // V8 binding expects ScriptController::clearWindowShell only be called - // when a frame is loading a new page. V8Proxy::clearForNavigation + // when a frame is loading a new page. ScriptController::clearForNavigation // creates a new context for the new page. clearForNavigation(); } diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index ca59838ac..ad9bf7116 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -31,18 +31,17 @@ #ifndef ScriptController_h #define ScriptController_h +#include "FrameLoaderTypes.h" #include "ScriptControllerBase.h" #include "ScriptInstance.h" #include "ScriptValue.h" -#include "V8Proxy.h" - #include <v8.h> - #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/text/TextPosition.h> struct NPObject; @@ -53,12 +52,25 @@ class Event; class Frame; class HTMLDocument; class HTMLPlugInElement; -class PagePopupClient; +class KURL; class ScriptSourceCode; class ScriptState; +class SecurityOrigin; class V8DOMWindowShell; +class V8IsolatedContext; class Widget; +// Note: although the pointer is raw, the instance is kept alive by a strong +// reference to the v8 context it contains, which is not made weak until we +// call world->destroy(). +// +// FIXME: We want to eventually be holding window shells instead of the +// IsolatedContext directly. +// https://bugs.webkit.org/show_bug.cgi?id=94875 +typedef HashMap<int, V8IsolatedContext*> IsolatedWorldMap; + +typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap; + typedef WTF::Vector<v8::Extension*> V8Extensions; class ScriptController { @@ -66,9 +78,8 @@ public: ScriptController(Frame*); ~ScriptController(); - // FIXME: V8Proxy should either be folded into ScriptController - // or this accessor should be made JSProxy* - V8Proxy* proxy() { return m_proxy.get(); } + // FIXME: This should eventually take DOMWrapperWorld argument. + // https://bugs.webkit.org/show_bug.cgi?id=94875 V8DOMWindowShell* windowShell() const { return m_windowShell.get(); } ScriptValue executeScript(const ScriptSourceCode&); @@ -150,11 +161,9 @@ public: // --- and there is only one VM instance. --- // Returns the frame for the entered context. See comments in - // V8Proxy::retrieveFrameForEnteredContext() for more information. static Frame* retrieveFrameForEnteredContext(); // Returns the frame for the current context. See comments in - // V8Proxy::retrieveFrameForEnteredContext() for more information. static Frame* retrieveFrameForCurrentContext(); // Returns V8 Context. If none exists, creates a new context. @@ -227,7 +236,6 @@ private: bool m_paused; - OwnPtr<V8Proxy> m_proxy; typedef HashMap<Widget*, NPObject*> PluginObjectMap; // A mapping between Widgets and their corresponding script object. diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp index 1455aaec4..ef1691eec 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -441,7 +441,7 @@ void ScriptDebugServer::compileScript(ScriptState* state, const String& expressi return; *scriptId = toWebCoreStringWithNullOrUndefinedCheck(script->Id()); - m_compiledScripts.set(*scriptId, adoptPtr(new OwnHandle<v8::Script>(script))); + m_compiledScripts.set(*scriptId, adoptPtr(new ScopedPersistent<v8::Script>(script))); } void ScriptDebugServer::clearCompiledScripts() @@ -454,8 +454,8 @@ void ScriptDebugServer::runScript(ScriptState* state, const String& scriptId, Sc if (!m_compiledScripts.contains(scriptId)) return; v8::HandleScope handleScope; - OwnHandle<v8::Script>* scriptOwnHandle = m_compiledScripts.get(scriptId); - v8::Local<v8::Script> script = v8::Local<v8::Script>::New(scriptOwnHandle->get()); + ScopedPersistent<v8::Script>* scriptHandle = m_compiledScripts.get(scriptId); + v8::Local<v8::Script> script = v8::Local<v8::Script>::New(scriptHandle->get()); m_compiledScripts.remove(scriptId); if (script.IsEmpty()) return; diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.h b/Source/WebCore/bindings/v8/ScriptDebugServer.h index 4d1e65e09..244d28577 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.h +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.h @@ -33,8 +33,8 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) -#include "OwnHandle.h" #include "PlatformString.h" +#include "ScopedPersistent.h" #include "ScriptBreakpoint.h" #include "Timer.h" #include <v8-debug.h> @@ -125,13 +125,13 @@ protected: v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]); PauseOnExceptionsState m_pauseOnExceptionsState; - OwnHandle<v8::Object> m_debuggerScript; - OwnHandle<v8::Object> m_executionState; + ScopedPersistent<v8::Object> m_debuggerScript; + ScopedPersistent<v8::Object> m_executionState; v8::Local<v8::Context> m_pausedContext; bool m_breakpointsActivated; - OwnHandle<v8::FunctionTemplate> m_breakProgramCallbackTemplate; - HashMap<String, OwnPtr<OwnHandle<v8::Script> > > m_compiledScripts; + ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; + HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScriptInstance.cpp b/Source/WebCore/bindings/v8/ScriptInstance.cpp index 1f407d0f5..e62fb7d7a 100644 --- a/Source/WebCore/bindings/v8/ScriptInstance.cpp +++ b/Source/WebCore/bindings/v8/ScriptInstance.cpp @@ -31,51 +31,11 @@ #include "config.h" #include "ScriptInstance.h" -#include "V8GCController.h" -#include <wtf/Assertions.h> - namespace WebCore { -V8ScriptInstance::V8ScriptInstance() -{ -} - V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance) + : m_instance(instance) { - set(instance); -} - -V8ScriptInstance::~V8ScriptInstance() -{ - clear(); -} - -v8::Persistent<v8::Object> V8ScriptInstance::instance() -{ - return m_instance; -} - -void V8ScriptInstance::clear() -{ - if (m_instance.IsEmpty()) - return; -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_instance); -#endif - m_instance.Dispose(); - m_instance.Clear(); -} - -void V8ScriptInstance::set(v8::Handle<v8::Object> instance) -{ - clear(); - if (instance.IsEmpty()) - return; - - m_instance = v8::Persistent<v8::Object>::New(instance); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTINSTANCE, this, m_instance); -#endif } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScriptInstance.h b/Source/WebCore/bindings/v8/ScriptInstance.h index 2fe37364f..7f6438799 100644 --- a/Source/WebCore/bindings/v8/ScriptInstance.h +++ b/Source/WebCore/bindings/v8/ScriptInstance.h @@ -31,8 +31,8 @@ #ifndef ScriptInstance_h #define ScriptInstance_h +#include "ScopedPersistent.h" #include <v8.h> - #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -41,19 +41,14 @@ namespace WebCore { class V8ScriptInstance : public RefCounted<V8ScriptInstance> { public: - static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) - { - return adoptRef(new V8ScriptInstance(instance)); - } - V8ScriptInstance(); - V8ScriptInstance(v8::Handle<v8::Object>); - ~V8ScriptInstance(); - v8::Persistent<v8::Object> instance(); + static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) { return adoptRef(new V8ScriptInstance(instance)); } + + v8::Persistent<v8::Object> instance() { return m_instance.get(); } private: - void clear(); - void set(v8::Handle<v8::Object>); - mutable v8::Persistent<v8::Object> m_instance; + explicit V8ScriptInstance(v8::Handle<v8::Object>); + + ScopedPersistent<v8::Object> m_instance; }; typedef RefPtr<V8ScriptInstance> ScriptInstance; diff --git a/Source/WebCore/bindings/v8/ScriptState.cpp b/Source/WebCore/bindings/v8/ScriptState.cpp index a975b14c5..8a0580bcd 100644 --- a/Source/WebCore/bindings/v8/ScriptState.cpp +++ b/Source/WebCore/bindings/v8/ScriptState.cpp @@ -41,76 +41,53 @@ #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" #include "WorkerScriptController.h" - #include <v8.h> #include <wtf/Assertions.h> namespace WebCore { ScriptState::ScriptState(v8::Handle<v8::Context> context) - : m_context(v8::Persistent<v8::Context>::New(context)) + : m_context(context) { - m_context.MakeWeak(this, &ScriptState::weakReferenceCallback); + m_context.get().MakeWeak(this, &ScriptState::weakReferenceCallback); } ScriptState::~ScriptState() { - m_context.Dispose(); - m_context.Clear(); } DOMWindow* ScriptState::domWindow() const { v8::HandleScope handleScope; - v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype()); - if (!V8DOMWrapper::isWrapperOfType(v8RealGlobal, &V8DOMWindow::info)) - return 0; - return V8DOMWindow::toNative(v8RealGlobal); + return toDOMWindow(m_context.get()); } ScriptExecutionContext* ScriptState::scriptExecutionContext() const { v8::HandleScope handleScope; - - v8::Handle<v8::Object> global = m_context->Global(); - v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(global->GetPrototype()); - if (V8DOMWrapper::isWrapperOfType(v8RealGlobal, &V8DOMWindow::info)) - return V8DOMWindow::toNative(v8RealGlobal)->scriptExecutionContext(); -#if ENABLE(WORKERS) - global = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global); - if (!global.IsEmpty()) - return V8WorkerContext::toNative(global)->scriptExecutionContext(); -#endif - return 0; + return toScriptExecutionContext(m_context.get()); } ScriptState* ScriptState::forContext(v8::Local<v8::Context> context) { v8::Context::Scope contextScope(context); - v8::Local<v8::Object> global = context->Global(); - // Skip proxy object. The proxy object will survive page navigation while we need - // an object whose lifetime coincides with that of the inspected context. - global = v8::Local<v8::Object>::Cast(global->GetPrototype()); + v8::Local<v8::Object> innerGlobal = v8::Local<v8::Object>::Cast(context->Global()->GetPrototype()); - v8::Handle<v8::String> key = V8HiddenPropertyName::scriptState(); - v8::Local<v8::Value> val = global->GetHiddenValue(key); - if (!val.IsEmpty() && val->IsExternal()) - return static_cast<ScriptState*>(v8::External::Cast(*val)->Value()); + v8::Local<v8::Value> scriptStateWrapper = innerGlobal->GetHiddenValue(V8HiddenPropertyName::scriptState()); + if (!scriptStateWrapper.IsEmpty() && scriptStateWrapper->IsExternal()) + return static_cast<ScriptState*>(v8::External::Cast(*scriptStateWrapper)->Value()); - ScriptState* state = new ScriptState(context); - global->SetHiddenValue(key, v8::External::New(state)); - return state; + ScriptState* scriptState = new ScriptState(context); + innerGlobal->SetHiddenValue(V8HiddenPropertyName::scriptState(), v8::External::New(scriptState)); + return scriptState; } ScriptState* ScriptState::current() { v8::HandleScope handleScope; v8::Local<v8::Context> context = v8::Context::GetCurrent(); - if (context.IsEmpty()) { - ASSERT_NOT_REACHED(); - return 0; - } + ASSERT(!context.IsEmpty()); return ScriptState::forContext(context); } diff --git a/Source/WebCore/bindings/v8/ScriptState.h b/Source/WebCore/bindings/v8/ScriptState.h index 009886a17..f59aa8da0 100644 --- a/Source/WebCore/bindings/v8/ScriptState.h +++ b/Source/WebCore/bindings/v8/ScriptState.h @@ -32,11 +32,13 @@ #define ScriptState_h #include "DOMWrapperWorld.h" +#include "ScopedPersistent.h" #include <v8.h> #include <wtf/Noncopyable.h> #include <wtf/RefCounted.h> namespace WebCore { + class DOMWindow; class DOMWrapperWorld; class Frame; @@ -57,7 +59,7 @@ public: v8::Local<v8::Context> context() const { - return v8::Local<v8::Context>::New(m_context); + return v8::Local<v8::Context>::New(m_context.get()); } DOMWindow* domWindow() const; @@ -77,7 +79,7 @@ private: static void weakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter); v8::Local<v8::Value> m_exception; - v8::Persistent<v8::Context> m_context; + ScopedPersistent<v8::Context> m_context; }; class EmptyScriptState : public ScriptState { @@ -89,24 +91,24 @@ public: class ScriptStateProtectedPtr { WTF_MAKE_NONCOPYABLE(ScriptStateProtectedPtr); public: - ScriptStateProtectedPtr() : m_scriptState(0) { } - ScriptStateProtectedPtr(ScriptState* scriptState) : m_scriptState(scriptState) + ScriptStateProtectedPtr() + : m_scriptState(0) { - v8::HandleScope handleScope; - // Keep the context from being GC'ed. ScriptState is guaranteed to be live while the context is live. - m_context = v8::Persistent<v8::Context>::New(scriptState->context()); } - ~ScriptStateProtectedPtr() + + ScriptStateProtectedPtr(ScriptState* scriptState) + : m_scriptState(scriptState) { - if (!m_context.IsEmpty()) { - m_context.Dispose(); - m_context.Clear(); - } + v8::HandleScope handleScope; + // Keep the context from being GC'ed. ScriptState is guaranteed to be live while the context is live. + m_context.set(scriptState->context()); } + ScriptState* get() const { return m_scriptState; } + private: ScriptState* m_scriptState; - v8::Persistent<v8::Context> m_context; + ScopedPersistent<v8::Context> m_context; }; DOMWindow* domWindowFromScriptState(ScriptState*); diff --git a/Source/WebCore/bindings/v8/ScriptValue.cpp b/Source/WebCore/bindings/v8/ScriptValue.cpp index 31bcd23ee..1c48fdfc6 100644 --- a/Source/WebCore/bindings/v8/ScriptValue.cpp +++ b/Source/WebCore/bindings/v8/ScriptValue.cpp @@ -40,14 +40,17 @@ namespace WebCore { +ScriptValue::~ScriptValue() +{ +} + PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState) { ScriptScope scope(scriptState); return SerializedScriptValue::create(v8Value()); } -PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, - MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow) +PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow) { ScriptScope scope(scriptState); return SerializedScriptValue::create(v8Value(), messagePorts, arrayBuffers, didThrow); @@ -61,24 +64,23 @@ ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptV bool ScriptValue::getString(String& result) const { - if (m_value.IsEmpty()) + if (m_value.get().IsEmpty()) return false; - if (!m_value->IsString()) + if (!m_value.get()->IsString()) return false; - result = toWebCoreString(m_value); + result = toWebCoreString(m_value.get()); return true; } String ScriptValue::toString(ScriptState*) const { v8::TryCatch block; - v8::Handle<v8::String> s = m_value->ToString(); - // Handle the case where an exception is thrown as part of invoking toString on the object. + v8::Handle<v8::String> string = m_value.get()->ToString(); if (block.HasCaught()) return String(); - return v8StringToWebCoreString<String>(s, DoNotExternalize); + return v8StringToWebCoreString<String>(string, DoNotExternalize); } #if ENABLE(INSPECTOR) @@ -140,7 +142,7 @@ PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ScriptState* scriptStat v8::HandleScope handleScope; // v8::Object::GetPropertyNames() expects current context to be not null. v8::Context::Scope contextScope(scriptState->context()); - return v8ToInspectorValue(m_value, InspectorValue::maxDepth); + return v8ToInspectorValue(m_value.get(), InspectorValue::maxDepth); } #endif diff --git a/Source/WebCore/bindings/v8/ScriptValue.h b/Source/WebCore/bindings/v8/ScriptValue.h index 0f489afbe..70dbff0dd 100644 --- a/Source/WebCore/bindings/v8/ScriptValue.h +++ b/Source/WebCore/bindings/v8/ScriptValue.h @@ -31,17 +31,17 @@ #ifndef ScriptValue_h #define ScriptValue_h -#include "PlatformString.h" +#include "ScopedPersistent.h" #include "ScriptState.h" - #include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> -#ifndef NDEBUG -#include "V8GCController.h" -#endif +#ifndef NDEBUG +#include "V8GCController.h" +#endif namespace WTF { class ArrayBuffer; @@ -57,28 +57,21 @@ typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray; class ScriptValue { public: - ScriptValue() {} + ScriptValue() { } + virtual ~ScriptValue(); ScriptValue(v8::Handle<v8::Value> value) { if (value.IsEmpty()) return; - - m_value = v8::Persistent<v8::Value>::New(value); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value); -#endif + m_value.set(value); } ScriptValue(const ScriptValue& value) { - if (value.m_value.IsEmpty()) + if (value.hasNoValue()) return; - - m_value = v8::Persistent<v8::Value>::New(value.m_value); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value); -#endif + m_value.set(value.m_value.get()); } ScriptValue& operator=(const ScriptValue& value) @@ -86,32 +79,28 @@ public: if (this == &value) return *this; - clear(); + m_value.clear(); - if (value.m_value.IsEmpty()) + if (value.hasNoValue()) return *this; - m_value = v8::Persistent<v8::Value>::New(value.m_value); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value); -#endif - + m_value.set(value.m_value.get()); return *this; } bool operator==(const ScriptValue& value) const { - return m_value == value.m_value; + return m_value.get() == value.m_value.get(); } bool isEqual(ScriptState*, const ScriptValue& value) const { - return m_value == value.m_value; + return m_value.get() == value.m_value.get(); } bool isFunction() const { - return m_value->IsFunction(); + return m_value.get()->IsFunction(); } bool operator!=(const ScriptValue& value) const @@ -121,22 +110,22 @@ public: bool isNull() const { - return m_value->IsNull(); + return m_value.get()->IsNull(); } bool isUndefined() const { - return m_value->IsUndefined(); + return m_value.get()->IsUndefined(); } bool isObject() const { - return m_value->IsObject(); + return m_value.get()->IsObject(); } bool hasNoValue() const { - return m_value.IsEmpty(); + return m_value.get().IsEmpty(); } PassRefPtr<SerializedScriptValue> serialize(ScriptState*); @@ -145,22 +134,11 @@ public: void clear() { - if (m_value.IsEmpty()) - return; - -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_value); -#endif - m_value.Dispose(); - m_value.Clear(); + m_value.clear(); } - virtual ~ScriptValue() - { - clear(); - } + v8::Handle<v8::Value> v8Value() const { return m_value.get(); } - v8::Handle<v8::Value> v8Value() const { return m_value; } bool getString(ScriptState*, String& result) const { return getString(result); } bool getString(String& result) const; String toString(ScriptState*) const; @@ -168,7 +146,7 @@ public: PassRefPtr<InspectorValue> toInspectorValue(ScriptState*) const; private: - mutable v8::Persistent<v8::Value> m_value; + ScopedPersistent<v8::Value> m_value; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp b/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp index 04f399163..0d2115276 100644 --- a/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp @@ -47,10 +47,10 @@ namespace WebCore { -static void weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter) +void V8AbstractEventListener::weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter) { V8AbstractEventListener* listener = static_cast<V8AbstractEventListener*>(parameter); - listener->disposeListenerObject(); + listener->m_listener.clear(); } V8AbstractEventListener::V8AbstractEventListener(bool isAttribute, const WorldContextHandle& worldContext) @@ -65,12 +65,10 @@ V8AbstractEventListener::V8AbstractEventListener(bool isAttribute, const WorldCo V8AbstractEventListener::~V8AbstractEventListener() { - if (!m_listener.IsEmpty()) { + if (!m_listener.get().IsEmpty()) { v8::HandleScope scope; - v8::Local<v8::Object> listener = v8::Local<v8::Object>::New(m_listener); - V8EventListenerList::clearWrapper(listener, m_isAttribute); + V8EventListenerList::clearWrapper(v8::Local<v8::Object>::New(m_listener.get()), m_isAttribute); } - disposeListenerObject(); #if ENABLE(INSPECTOR) ThreadLocalInspectorCounters::current().decrementCounter(ThreadLocalInspectorCounters::JSEventListenerCounter); #endif @@ -104,25 +102,10 @@ void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event invokeEventHandler(context, event, jsEvent); } -void V8AbstractEventListener::disposeListenerObject() -{ - if (!m_listener.IsEmpty()) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_listener); -#endif - m_listener.Dispose(); - m_listener.Clear(); - } -} - void V8AbstractEventListener::setListenerObject(v8::Handle<v8::Object> listener) { - disposeListenerObject(); - m_listener = v8::Persistent<v8::Object>::New(listener); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(EVENT_LISTENER, this, m_listener); -#endif - m_listener.MakeWeak(this, &weakEventListenerCallback); + m_listener.set(listener); + m_listener.get().MakeWeak(this, &V8AbstractEventListener::weakEventListenerCallback); } void V8AbstractEventListener::invokeEventHandler(ScriptExecutionContext* context, Event* event, v8::Handle<v8::Value> jsEvent) @@ -201,8 +184,8 @@ bool V8AbstractEventListener::shouldPreventDefault(v8::Local<v8::Value> returnVa v8::Local<v8::Object> V8AbstractEventListener::getReceiverObject(Event* event) { - if (!m_listener.IsEmpty() && !m_listener->IsFunction()) - return v8::Local<v8::Object>::New(m_listener); + if (!m_listener.get().IsEmpty() && !m_listener.get()->IsFunction()) + return v8::Local<v8::Object>::New(m_listener.get()); EventTarget* target = event->currentTarget(); v8::Handle<v8::Value> value = V8DOMWrapper::convertEventTargetToV8Object(target); diff --git a/Source/WebCore/bindings/v8/V8AbstractEventListener.h b/Source/WebCore/bindings/v8/V8AbstractEventListener.h index 672ba6dba..19a37e0a7 100644 --- a/Source/WebCore/bindings/v8/V8AbstractEventListener.h +++ b/Source/WebCore/bindings/v8/V8AbstractEventListener.h @@ -32,8 +32,8 @@ #define V8AbstractEventListener_h #include "EventListener.h" +#include "ScopedPersistent.h" #include "WorldContextHandle.h" - #include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -41,8 +41,6 @@ namespace WebCore { class Event; - class Frame; - class V8Proxy; // There are two kinds of event listeners: HTML or non-HMTL. onload, // onfocus, etc (attributes) are always HTML event handler type; Event @@ -80,29 +78,26 @@ namespace WebCore { v8::Local<v8::Object> getListenerObject(ScriptExecutionContext* context) { prepareListenerObject(context); - return v8::Local<v8::Object>::New(m_listener); + return v8::Local<v8::Object>::New(m_listener.get()); } v8::Local<v8::Object> getExistingListenerObject() { - return v8::Local<v8::Object>::New(m_listener); + return v8::Local<v8::Object>::New(m_listener.get()); } // Provides access to the underlying handle for GC. Returned // value is a weak handle and so not guaranteed to stay alive. v8::Persistent<v8::Object> existingListenerObjectPersistentHandle() { - return m_listener; + return m_listener.get(); } bool hasExistingListenerObject() { - return !m_listener.IsEmpty(); + return !m_listener.get().IsEmpty(); } - // Dispose listener object and clear the handle. - void disposeListenerObject(); - const WorldContextHandle& worldContext() const { return m_worldContext; } protected: @@ -118,6 +113,8 @@ namespace WebCore { v8::Local<v8::Object> getReceiverObject(Event*); private: + static void weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter); + // Implementation of EventListener function. virtual bool virtualisAttribute() const { return m_isAttribute; } @@ -125,7 +122,7 @@ namespace WebCore { virtual bool shouldPreventDefault(v8::Local<v8::Value> returnValue); - v8::Persistent<v8::Object> m_listener; + ScopedPersistent<v8::Object> m_listener; // Indicates if this is an HTML type listener. bool m_isAttribute; diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index bf57f8286..acd043aa5 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -37,17 +37,19 @@ #include "Frame.h" #include "MemoryInstrumentation.h" #include "PlatformString.h" +#include "PlatformSupport.h" #include "QualifiedName.h" #include "Settings.h" #include "V8DOMStringList.h" #include "V8DOMWindow.h" #include "V8Element.h" #include "V8ObjectConstructor.h" +#include "V8WorkerContext.h" #include "V8XPathNSResolver.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" +#include "WorldContextHandle.h" #include "XPathNSResolver.h" - #include <wtf/MathExtras.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> @@ -261,6 +263,21 @@ DOMWindow* toDOMWindow(v8::Handle<v8::Context> context) return V8DOMWindow::toNative(global); } +ScriptExecutionContext* toScriptExecutionContext(v8::Handle<v8::Context> context) +{ + v8::Handle<v8::Object> global = context->Global(); + v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global); + if (!windowWrapper.IsEmpty()) + return V8DOMWindow::toNative(windowWrapper)->scriptExecutionContext(); +#if ENABLE(WORKERS) + v8::Handle<v8::Object> workerWrapper = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global); + if (!workerWrapper.IsEmpty()) + return V8WorkerContext::toNative(workerWrapper)->scriptExecutionContext(); +#endif + // FIXME: Is this line of code reachable? + return 0; +} + Frame* toFrameIfNotDetached(v8::Handle<v8::Context> context) { DOMWindow* window = toDOMWindow(context); diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index 2333cede0..c8f31b28c 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -353,8 +353,8 @@ namespace WebCore { PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value>); PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>); - // Returns the window object associated with a context. DOMWindow* toDOMWindow(v8::Handle<v8::Context>); + ScriptExecutionContext* toScriptExecutionContext(v8::Handle<v8::Context>); // Returns the context associated with a ScriptExecutionContext. v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle&); diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index 3e6a78e24..4d87e72e1 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -54,6 +54,7 @@ #include "V8DOMMap.h" #include "V8DOMWindow.h" #include "V8Document.h" +#include "V8GCController.h" #include "V8GCForContextDispose.h" #include "V8HTMLDocument.h" #include "V8HiddenPropertyName.h" @@ -93,7 +94,7 @@ static void reportFatalErrorInV8(const char* location, const char* message) { // V8 is shutdown, we cannot use V8 api. // The only thing we can do is to disable JavaScript. - // FIXME: clean up V8Proxy and disable JavaScript. + // FIXME: clean up ScriptController and disable JavaScript. int memoryUsageMB = -1; #if PLATFORM(CHROMIUM) memoryUsageMB = MemoryUsageSupport::actualMemoryUsageMB(); @@ -158,6 +159,31 @@ static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessT targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage(activeDOMWindow(BindingState::instance()))); } +static void initializeV8IfNeeded() +{ + ASSERT(isMainThread()); + + static bool initialized = false; + if (initialized) + return; + initialized = true; + + v8::V8::IgnoreOutOfMemoryException(); + v8::V8::SetFatalErrorHandler(reportFatalErrorInV8); + v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue); + v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); + v8::V8::AddMessageListener(&v8UncaughtExceptionHandler); + v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess); +#if ENABLE(JAVASCRIPT_DEBUGGER) + ScriptProfiler::initialize(); +#endif + V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); + + // FIXME: Remove the following 2 lines when V8 default has changed. + const char es5ReadonlyFlag[] = "--es5_readonly"; + v8::V8::SetFlagsFromString(es5ReadonlyFlag, sizeof(es5ReadonlyFlag)); +} + PassRefPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame) { return adoptRef(new V8DOMWindowShell(frame)); @@ -172,16 +198,15 @@ bool V8DOMWindowShell::isContextInitialized() { // m_context, m_global, and m_wrapperBoilerplates should // all be non-empty if if m_context is non-empty. - ASSERT(m_context.IsEmpty() || !m_global.IsEmpty()); - return !m_context.IsEmpty(); + ASSERT(m_context.get().IsEmpty() || !m_global.get().IsEmpty()); + return !m_context.get().IsEmpty(); } void V8DOMWindowShell::disposeContextHandles() { - if (!m_context.IsEmpty()) { - m_frame->loader()->client()->willReleaseScriptContext(m_context, 0); - m_context.Dispose(); - m_context.Clear(); + if (!m_context.get().IsEmpty()) { + m_frame->loader()->client()->willReleaseScriptContext(m_context.get(), 0); + m_context.clear(); // It's likely that disposing the context has created a lot of // garbage. Notify V8 about this so it'll have a chance of cleaning @@ -195,48 +220,40 @@ void V8DOMWindowShell::disposeContextHandles() void V8DOMWindowShell::destroyGlobal() { - if (!m_global.IsEmpty()) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_global); -#endif - m_global.Dispose(); - m_global.Clear(); - } + m_global.clear(); } void V8DOMWindowShell::clearForClose() { - if (!m_context.IsEmpty()) { - v8::HandleScope handleScope; + if (m_context.get().IsEmpty()) + return; - clearDocumentWrapper(); - disposeContextHandles(); - } + v8::HandleScope handleScope; + clearDocumentWrapper(); + disposeContextHandles(); } void V8DOMWindowShell::clearForNavigation() { - if (!m_context.IsEmpty()) { - v8::HandleScope handle; - clearDocumentWrapper(); - - v8::Context::Scope contextScope(m_context); + if (m_context.get().IsEmpty()) + return; - // Clear the document wrapper cache before turning on access checks on - // the old DOMWindow wrapper. This way, access to the document wrapper - // will be protected by the security checks on the DOMWindow wrapper. - clearDocumentWrapperCache(); + v8::HandleScope handleScope; + clearDocumentWrapper(); - // Turn on access check on the old DOMWindow wrapper. - v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global); - ASSERT(!wrapper.IsEmpty()); - wrapper->TurnOnAccessCheck(); + // FIXME: Should we create a new Local handle here? + v8::Context::Scope contextScope(m_context.get()); - // Separate the context from its global object. - m_context->DetachGlobal(); + // Clear the document wrapper cache before turning on access checks on + // the old DOMWindow wrapper. This way, access to the document wrapper + // will be protected by the security checks on the DOMWindow wrapper. + clearDocumentWrapperCache(); - disposeContextHandles(); - } + v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global.get()); + ASSERT(!windowWrapper.IsEmpty()); + windowWrapper->TurnOnAccessCheck(); + m_context.get()->DetachGlobal(); + disposeContextHandles(); } // Create a new environment and setup the global object. @@ -276,67 +293,35 @@ void V8DOMWindowShell::clearForNavigation() // it won't be able to reach the outer window via its global object. bool V8DOMWindowShell::initContextIfNeeded() { - // Bail out if the context has already been initialized. - if (!m_context.IsEmpty()) + if (!m_context.get().IsEmpty()) return true; - // Create a handle scope for all local handles. v8::HandleScope handleScope; - // Setup the security handlers and message listener. This only has - // to be done once. - static bool isV8Initialized = false; - if (!isV8Initialized) { - // Tells V8 not to call the default OOM handler, binding code - // will handle it. - v8::V8::IgnoreOutOfMemoryException(); - v8::V8::SetFatalErrorHandler(reportFatalErrorInV8); - - v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue); - v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); - - v8::V8::AddMessageListener(&v8UncaughtExceptionHandler); - - v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess); -#if ENABLE(JAVASCRIPT_DEBUGGER) - ScriptProfiler::initialize(); -#endif - V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); - - // FIXME: Remove the following 2 lines when V8 default has changed. - const char es5ReadonlyFlag[] = "--es5_readonly"; - v8::V8::SetFlagsFromString(es5ReadonlyFlag, sizeof(es5ReadonlyFlag)); + initializeV8IfNeeded(); - isV8Initialized = true; - } - - m_context = createNewContext(m_global, 0, 0); - if (m_context.IsEmpty()) + m_context.adopt(createNewContext(m_global.get(), 0, 0)); + if (m_context.get().IsEmpty()) return false; - v8::Local<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context); - v8::Context::Scope contextScope(v8Context); + v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context.get()); + v8::Context::Scope contextScope(context); - // Store the first global object created so we can reuse it. - if (m_global.IsEmpty()) { - m_global = v8::Persistent<v8::Object>::New(v8Context->Global()); - // Bail out if allocation of the first global objects fails. - if (m_global.IsEmpty()) { + if (m_global.get().IsEmpty()) { + m_global.set(context->Global()); + if (m_global.get().IsEmpty()) { disposeContextHandles(); return false; } -#ifndef NDEBUG - V8GCController::registerGlobalHandle(PROXY, this, m_global); -#endif } - m_perContextData = V8PerContextData::create(m_context); + m_perContextData = V8PerContextData::create(m_context.get()); if (!m_perContextData->init()) { disposeContextHandles(); return false; } - if (!installDOMWindow(v8Context, m_frame->document()->domWindow())) { + if (!installDOMWindow(context, m_frame->document()->domWindow())) { disposeContextHandles(); return false; } @@ -346,9 +331,9 @@ bool V8DOMWindowShell::initContextIfNeeded() setSecurityToken(); if (m_frame->document()) - v8Context->AllowCodeGenerationFromStrings(m_frame->document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport)); + context->AllowCodeGenerationFromStrings(m_frame->document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport)); - m_frame->loader()->client()->didCreateScriptContext(m_context, 0, 0); + m_frame->loader()->client()->didCreateScriptContext(m_context.get(), 0, 0); // FIXME: This is wrong. We should actually do this for the proper world once // we do isolated worlds the WebCore way. @@ -400,12 +385,7 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob void V8DOMWindowShell::setContext(v8::Handle<v8::Context> context) { - // if we already have a context, clear it before setting the new one. - if (!m_context.IsEmpty()) { - m_context.Dispose(); - m_context.Clear(); - } - m_context = v8::Persistent<v8::Context>::New(context); + m_context.set(context); } bool V8DOMWindowShell::installDOMWindow(v8::Handle<v8::Context> context, DOMWindow* window) @@ -435,22 +415,13 @@ void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) { clearDocumentWrapper(); - ASSERT(m_document.IsEmpty()); - m_document = v8::Persistent<v8::Object>::New(wrapper); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(PROXY, this, m_document); -#endif + ASSERT(m_document.get().IsEmpty()); + m_document.set(wrapper); } void V8DOMWindowShell::clearDocumentWrapper() { - if (!m_document.IsEmpty()) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_document); -#endif - m_document.Dispose(); - m_document.Clear(); - } + m_document.clear(); } static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document) @@ -462,7 +433,8 @@ static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum void V8DOMWindowShell::updateDocumentWrapperCache() { v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_context); + // FIXME: Should we use a new Local handle here? + v8::Context::Scope contextScope(m_context.get()); // If the document has no frame, NodeToV8Object might get the // document wrapper for a document that is about to be deleted. @@ -471,16 +443,17 @@ void V8DOMWindowShell::updateDocumentWrapperCache() // wrapper cleared. Using the cleared global handle will lead to // crashes. In this case we clear the cache and let the DOMWindow // accessor handle access to the document. + // FIXME: This should not be possible anymore. if (!m_frame->document()->frame()) { clearDocumentWrapperCache(); return; } v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document()); - ASSERT(documentWrapper == m_document || m_document.IsEmpty()); - if (m_document.IsEmpty()) + ASSERT(documentWrapper == m_document.get() || m_document.get().IsEmpty()); + if (m_document.get().IsEmpty()) updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper)); - checkDocumentWrapper(m_document, m_frame->document()); + checkDocumentWrapper(m_document.get(), m_frame->document()); // If instantiation of the document wrapper fails, clear the cache // and let the DOMWindow accessor handle access to the document. @@ -489,27 +462,28 @@ void V8DOMWindowShell::updateDocumentWrapperCache() return; } ASSERT(documentWrapper->IsObject()); - m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); + m_context.get()->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); // We also stash a reference to the document on the real global object so that // DOMWindow objects we obtain from JavaScript references are guaranteed to have // live Document objects. - v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype()); + v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(m_context.get()->Global()->GetPrototype()); v8RealGlobal->SetHiddenValue(V8HiddenPropertyName::document(), documentWrapper); } void V8DOMWindowShell::clearDocumentWrapperCache() { - ASSERT(!m_context.IsEmpty()); - m_context->Global()->ForceDelete(v8::String::New("document")); + ASSERT(!m_context.get().IsEmpty()); + m_context.get()->Global()->ForceDelete(v8::String::New("document")); } void V8DOMWindowShell::setSecurityToken() { Document* document = m_frame->document(); - // Setup security origin and security token. + + // FIXME: This shouldn't be possible anymore. if (!document) { - m_context->UseDefaultSecurityToken(); + m_context.get()->UseDefaultSecurityToken(); return; } @@ -529,22 +503,23 @@ void V8DOMWindowShell::setSecurityToken() // case, we use the global object as the security token to avoid // calling canAccess when a script accesses its own objects. if (token.isEmpty() || token == "null") { - m_context->UseDefaultSecurityToken(); + m_context.get()->UseDefaultSecurityToken(); return; } CString utf8Token = token.utf8(); // NOTE: V8 does identity comparison in fast path, must use a symbol // as the security token. - m_context->SetSecurityToken(v8::String::NewSymbol(utf8Token.data(), utf8Token.length())); + m_context.get()->SetSecurityToken(v8::String::NewSymbol(utf8Token.data(), utf8Token.length())); } void V8DOMWindowShell::updateDocument() { + // FIXME: This shouldn't be possible anymore. if (!m_frame->document()) return; - if (m_global.IsEmpty()) + if (m_global.get().IsEmpty()) return; // There is an existing JavaScript wrapper for the global object @@ -561,9 +536,9 @@ void V8DOMWindowShell::updateDocument() updateSecurityOrigin(); } -v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { - // FIXME(antonm): consider passing AtomicStringImpl directly. + // FIXME: Consider passing AtomicStringImpl directly. AtomicString name = toWebCoreAtomicString(property); HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); ASSERT(htmlDocument); @@ -576,40 +551,40 @@ v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorI return v8::Undefined(); } -void V8DOMWindowShell::namedItemAdded(HTMLDocument* doc, const AtomicString& name) +void V8DOMWindowShell::namedItemAdded(HTMLDocument* document, const AtomicString& name) { if (!initContextIfNeeded()) return; v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_context); + v8::Context::Scope contextScope(m_context.get()); - ASSERT(!m_document.IsEmpty()); - checkDocumentWrapper(m_document, doc); - m_document->SetAccessor(v8String(name), getter); + ASSERT(!m_document.get().IsEmpty()); + checkDocumentWrapper(m_document.get(), document); + m_document.get()->SetAccessor(v8String(name), getter); } -void V8DOMWindowShell::namedItemRemoved(HTMLDocument* doc, const AtomicString& name) +void V8DOMWindowShell::namedItemRemoved(HTMLDocument* document, const AtomicString& name) { - if (doc->hasNamedItem(name.impl()) || doc->hasExtraNamedItem(name.impl())) + if (document->hasNamedItem(name.impl()) || document->hasExtraNamedItem(name.impl())) return; if (!initContextIfNeeded()) return; v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_context); + v8::Context::Scope contextScope(m_context.get()); - ASSERT(!m_document.IsEmpty()); - checkDocumentWrapper(m_document, doc); - m_document->Delete(v8String(name)); + ASSERT(!m_document.get().IsEmpty()); + checkDocumentWrapper(m_document.get(), document); + m_document.get()->Delete(v8String(name)); } void V8DOMWindowShell::updateSecurityOrigin() { - if (m_context.IsEmpty()) + if (m_context.get().IsEmpty()) return; - v8::HandleScope scope; + v8::HandleScope handleScope; setSecurityToken(); } diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.h b/Source/WebCore/bindings/v8/V8DOMWindowShell.h index b25bbfc48..e2ff81937 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.h +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.h @@ -31,6 +31,7 @@ #ifndef V8DOMWindowShell_h #define V8DOMWindowShell_h +#include "ScopedPersistent.h" #include "V8PerContextData.h" #include "WrapperTypeInfo.h" #include <wtf/Forward.h> @@ -52,7 +53,7 @@ class V8DOMWindowShell : public RefCounted<V8DOMWindowShell> { public: static PassRefPtr<V8DOMWindowShell> create(Frame*); - v8::Handle<v8::Context> context() const { return m_context; } + v8::Handle<v8::Context> context() const { return m_context.get(); } // Update document object of the frame. void updateDocument(); @@ -99,9 +100,9 @@ private: OwnPtr<V8PerContextData> m_perContextData; - v8::Persistent<v8::Context> m_context; - v8::Persistent<v8::Object> m_global; - v8::Persistent<v8::Object> m_document; + ScopedPersistent<v8::Context> m_context; + ScopedPersistent<v8::Object> m_global; + ScopedPersistent<v8::Object> m_document; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.h b/Source/WebCore/bindings/v8/V8DOMWrapper.h index f66e89e49..25c14d694 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.h +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.h @@ -53,9 +53,7 @@ namespace WebCore { class Frame; class Node; class V8PerContextData; - class V8Proxy; class WorkerContext; - class XPathResolver; enum ListenerLookupType { ListenerFindOnly, diff --git a/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp b/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp index f7877450a..d390185ca 100644 --- a/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp +++ b/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp @@ -74,8 +74,7 @@ v8::Local<v8::Object> V8ObjectConstructor::newInstanceInDocument(v8::Handle<v8:: TRACE_EVENT0("v8", "v8.newInstance"); #endif - // No artificial limitations on the depth of recursion, see comment in - // V8Proxy::callFunction. + // No artificial limitations on the depth of recursion. V8RecursionScope recursionScope(document); v8::Local<v8::Object> result = function->NewInstance(argc, argv); crashIfV8IsDead(); diff --git a/Source/WebCore/bindings/v8/V8PerContextData.h b/Source/WebCore/bindings/v8/V8PerContextData.h index c8cd6a5c6..20e910c16 100644 --- a/Source/WebCore/bindings/v8/V8PerContextData.h +++ b/Source/WebCore/bindings/v8/V8PerContextData.h @@ -31,7 +31,7 @@ #ifndef V8PerContextData_h #define V8PerContextData_h -#include "OwnHandle.h" +#include "ScopedPersistent.h" #include "WrapperTypeInfo.h" #include <v8.h> #include <wtf/HashMap.h> @@ -90,8 +90,8 @@ private: ConstructorMap m_constructorMap; v8::Handle<v8::Context> m_context; - OwnHandle<v8::Value> m_errorPrototype; - OwnHandle<v8::Value> m_objectPrototype; + ScopedPersistent<v8::Value> m_errorPrototype; + ScopedPersistent<v8::Value> m_objectPrototype; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h deleted file mode 100644 index 07a7781e2..000000000 --- a/Source/WebCore/bindings/v8/V8Proxy.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Proxy_h -#define V8Proxy_h - -#include "PlatformSupport.h" -#include "SharedPersistent.h" -#include "StatsCounter.h" -#include "V8AbstractEventListener.h" -#include "V8DOMWrapper.h" -#include "V8GCController.h" -#include "V8Utilities.h" -#include "WrapperTypeInfo.h" -#include <v8.h> -#include <wtf/Forward.h> -#include <wtf/HashMap.h> -#include <wtf/PassRefPtr.h> // so generated bindings don't have to -#include <wtf/Vector.h> -#include <wtf/text/TextPosition.h> - -namespace WebCore { - - class CachedScript; - class DOMWindow; - class Frame; - class Node; - class ScriptExecutionContext; - class ScriptSourceCode; - class SecurityOrigin; - class V8DOMWindowShell; - class V8EventListener; - class V8IsolatedContext; - class V8PerContextData; - class WorldContextHandle; - - // Note: although the pointer is raw, the instance is kept alive by a strong - // reference to the v8 context it contains, which is not made weak until we - // call world->destroy(). - // - // FIXME: We want to eventually be holding window shells instead of the - // IsolatedContext directly. - typedef HashMap<int, V8IsolatedContext*> IsolatedWorldMap; - - typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap; - - class V8Proxy { - public: - explicit V8Proxy(Frame*); - - ~V8Proxy(); - - Frame* frame() const { return m_frame; } - - // FIXME: This should eventually take DOMWrapperWorld argument! - // FIXME: This method will be soon removed, as all methods that access windowShell() - // will be moved to ScriptController. - V8DOMWindowShell* windowShell() const; - private: - Frame* m_frame; - }; -} - -#endif // V8Proxy_h diff --git a/Source/WebCore/bindings/v8/V8RecursionScope.h b/Source/WebCore/bindings/v8/V8RecursionScope.h index 78b3f2b75..64c6c8aed 100644 --- a/Source/WebCore/bindings/v8/V8RecursionScope.h +++ b/Source/WebCore/bindings/v8/V8RecursionScope.h @@ -46,7 +46,7 @@ namespace WebCore { // // Debug-time checking of this is enforced via this class. // -// Calls of type (1) should generally go through V8Proxy, as inspector +// Calls of type (1) should generally go through ScriptController, as inspector // instrumentation is needed. Calls of type (2) should always stack-allocate a // V8RecursionScope in the same block as the call into script. Calls of type (3) // should stack allocate a V8RecursionScope::MicrotaskSuppression -- this diff --git a/Source/WebCore/bindings/v8/V8Utilities.cpp b/Source/WebCore/bindings/v8/V8Utilities.cpp index 0a45dddf0..4621818e6 100644 --- a/Source/WebCore/bindings/v8/V8Utilities.cpp +++ b/Source/WebCore/bindings/v8/V8Utilities.cpp @@ -38,6 +38,7 @@ #include "MessagePort.h" #include "ScriptExecutionContext.h" #include "ScriptState.h" +#include "V8AbstractEventListener.h" #include "V8ArrayBuffer.h" #include "V8Binding.h" #include "V8MessagePort.h" diff --git a/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h b/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h index 72260e4b8..03f07e926 100644 --- a/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h +++ b/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h @@ -39,8 +39,6 @@ namespace WebCore { -class V8Proxy; - // V8CustomXPathNSResolver does not create a persistent handle to the // given resolver object. So the lifetime of V8CustomXPathNSResolver // must not exceed the lifetime of the passed handle. diff --git a/Source/WebCore/bridge/c/c_utility.cpp b/Source/WebCore/bridge/c/c_utility.cpp index dc3755f27..308af5afd 100644 --- a/Source/WebCore/bridge/c/c_utility.cpp +++ b/Source/WebCore/bridge/c/c_utility.cpp @@ -80,7 +80,7 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result) } else if (value.isNumber()) { DOUBLE_TO_NPVARIANT(value.toNumber(exec), *result); } else if (value.isBoolean()) { - BOOLEAN_TO_NPVARIANT(value.toBoolean(), *result); + BOOLEAN_TO_NPVARIANT(value.toBoolean(exec), *result); } else if (value.isNull()) { NULL_TO_NPVARIANT(*result); } else if (value.isObject()) { diff --git a/Source/WebCore/bridge/jni/jni_jsobject.mm b/Source/WebCore/bridge/jni/jni_jsobject.mm index 98f3aebdd..b5a7d220b 100644 --- a/Source/WebCore/bridge/jni/jni_jsobject.mm +++ b/Source/WebCore/bridge/jni/jni_jsobject.mm @@ -495,7 +495,7 @@ jobject JavaJSObject::convertValueToJObject(JSValue value) const jclass JSObjectClass = env->FindClass ("java/lang/Boolean"); jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(Z)V"); if (constructorID != NULL) { - result = env->NewObject (JSObjectClass, constructorID, (jboolean)value.toBoolean()); + result = env->NewObject (JSObjectClass, constructorID, (jboolean)value.toBoolean(exec)); } } else { diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp index 842f95d65..785e3a056 100644 --- a/Source/WebCore/bridge/qt/qt_runtime.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime.cpp @@ -291,9 +291,9 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type switch (hint) { case QMetaType::Bool: if (type == Object && object->inherits(&BooleanObject::s_info)) - ret = QVariant(asBooleanObject(value)->internalValue().toBoolean()); + ret = QVariant(asBooleanObject(value)->internalValue().toBoolean(exec)); else - ret = QVariant(value.toBoolean()); + ret = QVariant(value.toBoolean(exec)); if (type == Boolean) dist = 0; else diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index fe10eb0f6..0708c23ba 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -614,7 +614,7 @@ static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSProper return 0; } - if (style->position() == AbsolutePosition || style->position() == FixedPosition) { + if (style->hasOutOfFlowPosition()) { if (l.type() == WebCore::Fixed) return zoomAdjustedPixelValue(l.value(), style); else if (l.isViewportPercentage()) @@ -622,7 +622,7 @@ static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSProper return cssValuePool().createValue(l); } - if (style->position() == RelativePosition || style->position() == StickyPosition) { + if (style->hasInFlowPosition()) { // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined. // In other words if left is auto and right is not auto, then left's computed value is negative right(). // So we should get the opposite length unit and see if it is auto. @@ -715,21 +715,14 @@ static LayoutRect sizingBox(RenderObject* renderer) return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect(); } -static IntRect pixelSnappedSizingBox(RenderObject* renderer) -{ - if (!renderer->isBox()) - return IntRect(); - - RenderBox* box = toRenderBox(renderer); - return box->style()->boxSizing() == BORDER_BOX ? box->pixelSnappedBorderBoxRect() : pixelSnappedIntRect(box->computedCSSContentBoxRect()); -} - static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style) { - if (!renderer || style->transform().operations().isEmpty()) + if (!renderer || !renderer->hasTransform() || !style->hasTransform()) return cssValuePool().createIdentifierValue(CSSValueNone); - IntRect box = pixelSnappedSizingBox(renderer); + IntRect box; + if (renderer->isBox()) + box = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()); TransformationMatrix transform; style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin); @@ -2327,7 +2320,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyWebkitTransformOrigin: { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); if (renderer) { - LayoutRect box = sizingBox(renderer); + LayoutRect box; + if (renderer->isBox()) + box = toRenderBox(renderer)->borderBoxRect(); + RenderView* renderView = m_node->document()->renderView(); list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get())); list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get())); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 18c4c0352..7a5ea37d3 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -46,11 +46,13 @@ #include "CSSPropertySourceData.h" #include "CSSReflectValue.h" #include "CSSSelector.h" +#include "CSSStyleSheet.h" #include "CSSTimingFunctionValue.h" #include "CSSUnicodeRangeValue.h" #include "CSSValueKeywords.h" #include "CSSValueList.h" #include "CSSValuePool.h" +#include "StylePropertyShorthand.h" #if ENABLE(CSS_VARIABLES) #include "CSSVariableValue.h" #endif @@ -1241,6 +1243,30 @@ void CSSParser::parseSelector(const String& string, CSSSelectorList& selectorLis m_selectorListForParseSelector = 0; } +PassRefPtr<StylePropertySet> CSSParser::parseInlineStyleDeclaration(const String& string, Element* element) +{ + CSSParserContext context = element->document()->elementSheet()->contents()->parserContext(); + context.mode = strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode()); + return CSSParser(context).parseDeclaration(string, element->document()->elementSheet()->contents()); +} + +PassRefPtr<StylePropertySet> CSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet) +{ + setStyleSheet(contextStyleSheet); + + setupParser("@-webkit-decls{", string, "} "); + cssyyparse(this); + m_rule = 0; + + if (m_hasFontFaceOnlyValues) + deleteFontFaceOnlyValues(); + + RefPtr<StylePropertySet> style = createStylePropertySet(); + clearProperties(); + return style.release(); +} + + bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, PassRefPtr<CSSRuleSourceData> prpRuleSourceData, StyleSheetContents* contextStyleSheet) { // Length of the "@-webkit-decls{" prefix. @@ -3074,30 +3100,13 @@ void CSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> r bool CSSParser::parseAnimationShorthand(bool important) { - // When we parse the animation shorthand we need to look for animation-name - // last because otherwise it might match against the keywords for fill mode, - // timing functions and infinite iteration. This means that animation names - // that are the same as keywords (e.g. 'forwards') won't always match in the - // shorthand. In that case they should be using longhands (or reconsidering - // their approach). This is covered by the animations spec bug: - // https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 - // And in the spec (editor's draft) at: - // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property - - static const CSSPropertyID animationProperties[] = { - CSSPropertyWebkitAnimationDuration, - CSSPropertyWebkitAnimationTimingFunction, - CSSPropertyWebkitAnimationDelay, - CSSPropertyWebkitAnimationIterationCount, - CSSPropertyWebkitAnimationDirection, - CSSPropertyWebkitAnimationFillMode, - CSSPropertyWebkitAnimationName - }; + const StylePropertyShorthand& animationProperties = webkitAnimationShorthandForParsing(); const unsigned numProperties = 7; // The list of properties in the shorthand should be the same - // length as the list we have here, even though they are - // a different order. + // length as the list with animation name in last position, even though they are + // in a different order. + ASSERT(numProperties == webkitAnimationShorthandForParsing().length()); ASSERT(numProperties == webkitAnimationShorthand().length()); ShorthandScope scope(this, CSSPropertyWebkitAnimation); @@ -3124,7 +3133,7 @@ bool CSSParser::parseAnimationShorthand(bool important) for (i = 0; i < numProperties; ++i) { if (!parsedProperty[i]) { RefPtr<CSSValue> val; - if (parseAnimationProperty(animationProperties[i], val)) { + if (parseAnimationProperty(animationProperties.properties()[i], val)) { parsedProperty[i] = found = true; addAnimationValue(values[i], val.release()); break; @@ -3143,7 +3152,7 @@ bool CSSParser::parseAnimationShorthand(bool important) if (!parsedProperty[i]) addAnimationValue(values[i], cssValuePool().createImplicitInitialValue()); - addProperty(animationProperties[i], values[i].release(), important); + addProperty(animationProperties.properties()[i], values[i].release(), important); } return true; diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index aec1f6635..16e5bd70c 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -53,6 +53,7 @@ class CSSValue; class CSSValueList; class CSSWrapShape; class Document; +class Element; class MediaQueryExp; class MediaQuerySet; class StyleKeyframe; @@ -83,6 +84,7 @@ public: static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int ident, CSSParserValue*); bool parseDeclaration(StylePropertySet*, const String&, PassRefPtr<CSSRuleSourceData>, StyleSheetContents* contextStyleSheet); + static PassRefPtr<StylePropertySet> parseInlineStyleDeclaration(const String&, Element*); PassOwnPtr<MediaQuery> parseMediaQuery(const String&); void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false); @@ -402,6 +404,7 @@ private: bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&); bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet); + PassRefPtr<StylePropertySet> parseDeclaration(const String&, StyleSheetContents* contextStyleSheet); enum SizeParameterType { None, diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index c39a9c021..806605fe3 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -50,6 +50,7 @@ #include "TextRenderingMode.h" #include "ThemeTypes.h" #include "UnicodeBidi.h" +#include "WritingMode.h" #if ENABLE(CSS_SHADERS) #include "CustomFilterOperation.h" diff --git a/Source/WebCore/css/CSSProperty.h b/Source/WebCore/css/CSSProperty.h index 57a30124f..7afaa75ec 100644 --- a/Source/WebCore/css/CSSProperty.h +++ b/Source/WebCore/css/CSSProperty.h @@ -25,6 +25,7 @@ #include "CSSValue.h" #include "RenderStyleConstants.h" #include "TextDirection.h" +#include "WritingMode.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebCore/css/CSSToStyleMap.h b/Source/WebCore/css/CSSToStyleMap.h index 8e0fc953d..6bab40bfc 100644 --- a/Source/WebCore/css/CSSToStyleMap.h +++ b/Source/WebCore/css/CSSToStyleMap.h @@ -30,6 +30,7 @@ namespace WebCore { class FillLayer; class CSSValue; class Animation; +class RenderStyle; class StyleImage; class StyleResolver; class NinePieceImage; diff --git a/Source/WebCore/css/StylePropertyShorthand.cpp b/Source/WebCore/css/StylePropertyShorthand.cpp index 045bd24f0..d5ecd9746 100644 --- a/Source/WebCore/css/StylePropertyShorthand.cpp +++ b/Source/WebCore/css/StylePropertyShorthand.cpp @@ -261,6 +261,31 @@ const StylePropertyShorthand& webkitAnimationShorthand() return webkitAnimationLonghands; } +const StylePropertyShorthand& webkitAnimationShorthandForParsing() +{ + // When we parse the animation shorthand we need to look for animation-name + // last because otherwise it might match against the keywords for fill mode, + // timing functions and infinite iteration. This means that animation names + // that are the same as keywords (e.g. 'forwards') won't always match in the + // shorthand. In that case the authors should be using longhands (or + // reconsidering their approach). This is covered by the animations spec + // bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 + // And in the spec (editor's draft) at: + // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property + static const CSSPropertyID animationPropertiesForParsing[] = { + CSSPropertyWebkitAnimationDuration, + CSSPropertyWebkitAnimationTimingFunction, + CSSPropertyWebkitAnimationDelay, + CSSPropertyWebkitAnimationIterationCount, + CSSPropertyWebkitAnimationDirection, + CSSPropertyWebkitAnimationFillMode, + CSSPropertyWebkitAnimationName + }; + + DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing))); + return webkitAnimationLonghandsForParsing; +} + const StylePropertyShorthand& webkitBorderAfterShorthand() { static const CSSPropertyID borderAfterProperties[] = { CSSPropertyWebkitBorderAfterWidth, CSSPropertyWebkitBorderAfterStyle, CSSPropertyWebkitBorderAfterColor }; diff --git a/Source/WebCore/css/StylePropertyShorthand.h b/Source/WebCore/css/StylePropertyShorthand.h index ee331c732..72da501ce 100644 --- a/Source/WebCore/css/StylePropertyShorthand.h +++ b/Source/WebCore/css/StylePropertyShorthand.h @@ -80,6 +80,7 @@ const StylePropertyShorthand& outlineShorthand(); const StylePropertyShorthand& overflowShorthand(); const StylePropertyShorthand& paddingShorthand(); const StylePropertyShorthand& webkitAnimationShorthand(); +const StylePropertyShorthand& webkitAnimationShorthandForParsing(); const StylePropertyShorthand& webkitBorderAfterShorthand(); const StylePropertyShorthand& webkitBorderBeforeShorthand(); const StylePropertyShorthand& webkitBorderEndShorthand(); diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index a7397aed3..08ee28cda 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -377,6 +377,7 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles) , m_fontDirty(false) , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles) , m_sameOriginOnly(false) + , m_distributedToInsertionPoint(false) , m_fontSelector(CSSFontSelector::create(document)) , m_applyPropertyToRegularStyle(true) , m_applyPropertyToVisitedLinkStyle(false) @@ -1220,9 +1221,11 @@ inline void StyleResolver::initForStyleResolve(Element* e, RenderStyle* parentSt m_parentStyle = context.resetStyleInheritance()? 0 : parentStyle ? parentStyle : m_parentNode ? m_parentNode->renderStyle() : 0; + m_distributedToInsertionPoint = context.insertionPoint(); } else { m_parentNode = 0; m_parentStyle = parentStyle; + m_distributedToInsertionPoint = false; } Node* docElement = e ? e->document()->documentElement() : 0; @@ -1752,7 +1755,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS initElement(element); initForStyleResolve(element, defaultParent); m_regionForStyling = regionForStyling; - if (sharingBehavior == AllowStyleSharing) { + if (sharingBehavior == AllowStyleSharing && !m_distributedToInsertionPoint) { RenderStyle* sharedStyle = locateSharedStyle(); if (sharedStyle) return sharedStyle; @@ -2075,7 +2078,7 @@ static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) { return style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e) - || style->isFloating() || style->isOutOfFlowPositioned(); + || style->isFloating() || style->hasOutOfFlowPosition(); } static bool isDisplayFlexibleBox(EDisplay display) @@ -2145,7 +2148,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty style->setDisplay(BLOCK); // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display. - if (style->position() == AbsolutePosition || style->position() == FixedPosition || style->isFloating() || (e && e->document()->documentElement() == e)) + if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->document()->documentElement() == e)) style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing())); // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely @@ -2187,8 +2190,12 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty // Auto z-index becomes 0 for the root element and transparent objects. This prevents // cases where objects that should be blended as a single unit end up with a non-transparent // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections. - if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f - || style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect() || style->hasFilter() + if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) + || style->opacity() < 1.0f + || style->hasTransformRelatedProperty() + || style->hasMask() + || style->boxReflect() + || style->hasFilter() #ifdef FIXED_POSITION_CREATES_STACKING_CONTEXT || style->position() == FixedPosition #else diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h index 712085ba2..2bbc6823e 100644 --- a/Source/WebCore/css/StyleResolver.h +++ b/Source/WebCore/css/StyleResolver.h @@ -496,6 +496,7 @@ private: bool m_fontDirty; bool m_matchAuthorAndUserStyles; bool m_sameOriginOnly; + bool m_distributedToInsertionPoint; RefPtr<CSSFontSelector> m_fontSelector; Vector<OwnPtr<MediaQueryResult> > m_viewportDependentMediaQueryResults; diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index 7d89c8848..471e519e0 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -27,6 +27,7 @@ #include "ElementAttributeData.h" #include "Attr.h" +#include "CSSParser.h" #include "CSSStyleSheet.h" #include "MemoryInstrumentation.h" #include "StyledElement.h" @@ -211,8 +212,9 @@ void ElementAttributeData::updateInlineStyleAvoidingMutation(StyledElement* elem if (m_inlineStyleDecl && !m_inlineStyleDecl->isMutable()) m_inlineStyleDecl.clear(); if (!m_inlineStyleDecl) - m_inlineStyleDecl = StylePropertySet::create(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); - m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents()); + m_inlineStyleDecl = CSSParser::parseInlineStyleDeclaration(text, element); + else + m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents()); } void ElementAttributeData::destroyInlineStyle(StyledElement* element) const diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp index 5ca7282bc..789a3fabb 100644 --- a/Source/WebCore/editing/TextIterator.cpp +++ b/Source/WebCore/editing/TextIterator.cpp @@ -214,8 +214,7 @@ static inline bool ignoresContainerClip(Node* node) RenderObject* renderer = node->renderer(); if (!renderer || renderer->isText()) return false; - EPosition position = renderer->style()->position(); - return position == AbsolutePosition || position == FixedPosition; + return renderer->style()->hasOutOfFlowPosition(); } static void pushFullyClippedState(BitStack& stack, Node* node) diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index ffb30894b..02a5645c5 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -4377,6 +4377,54 @@ String HTMLMediaElement::mediaPlayerDocumentHost() const return document()->url().host(); } +void HTMLMediaElement::mediaPlayerExitFullscreen() +{ + exitFullscreen(); +} + +bool HTMLMediaElement::mediaPlayerIsVideo() const +{ + return isVideo(); +} + +LayoutRect HTMLMediaElement::mediaPlayerContentBoxRect() const +{ + if (renderer()) + return renderer()->enclosingBox()->contentBoxRect(); + return LayoutRect(); +} + +void HTMLMediaElement::mediaPlayerSetSize(const IntSize& size) +{ + setAttribute(widthAttr, String::number(size.width())); + setAttribute(heightAttr, String::number(size.height())); +} + +void HTMLMediaElement::mediaPlayerPause() +{ + pause(); +} + +void HTMLMediaElement::mediaPlayerPlay() +{ + play(); +} + +bool HTMLMediaElement::mediaPlayerIsPaused() const +{ + return paused(); +} + +HostWindow* HTMLMediaElement::mediaPlayerHostWindow() +{ + return mediaPlayerOwningDocument()->view()->hostWindow(); +} + +IntRect HTMLMediaElement::mediaPlayerWindowClipRect() +{ + return mediaPlayerOwningDocument()->view()->windowClipRect(); +} + void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture() { m_restrictions = NoRestrictions; diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index da102a6d2..32b547d32 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -422,6 +422,16 @@ private: virtual bool mediaPlayerNeedsSiteSpecificHacks() const OVERRIDE; virtual String mediaPlayerDocumentHost() const OVERRIDE; + virtual void mediaPlayerExitFullscreen() OVERRIDE; + virtual bool mediaPlayerIsVideo() const OVERRIDE; + virtual LayoutRect mediaPlayerContentBoxRect() const OVERRIDE; + virtual void mediaPlayerSetSize(const IntSize&) OVERRIDE; + virtual void mediaPlayerPause() OVERRIDE; + virtual void mediaPlayerPlay() OVERRIDE; + virtual bool mediaPlayerIsPaused() const OVERRIDE; + virtual HostWindow* mediaPlayerHostWindow() OVERRIDE; + virtual IntRect mediaPlayerWindowClipRect() OVERRIDE; + #if PLATFORM(WIN) && USE(AVFOUNDATION) virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const OVERRIDE; #endif diff --git a/Source/WebCore/html/TimeInputType.cpp b/Source/WebCore/html/TimeInputType.cpp index 798aeff9f..586103231 100644 --- a/Source/WebCore/html/TimeInputType.cpp +++ b/Source/WebCore/html/TimeInputType.cpp @@ -182,8 +182,7 @@ void TimeInputType::createShadowSubtree() { ASSERT(element()->shadow()); - const StepRange stepRange(createStepRange(AnyIsDefaultStep)); - RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(element()->document(), m_dateTimeEditControlOwnerImpl, stepRange)); + RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(element()->document(), m_dateTimeEditControlOwnerImpl)); m_dateTimeEditElement = dateTimeEditElement.get(); element()->userAgentShadowRoot()->appendChild(m_dateTimeEditElement); updateInnerTextValue(); @@ -238,7 +237,7 @@ bool TimeInputType::isMouseFocusable() const void TimeInputType::minOrMaxAttributeChanged() { - updateEditElementLayout(); + updateInnerTextValue(); } void TimeInputType::readonlyAttributeChanged() @@ -266,13 +265,7 @@ bool TimeInputType::shouldUseInputMethod() const void TimeInputType::stepAttributeChanged() { - updateEditElementLayout(); -} - -void TimeInputType::updateEditElementLayout() -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->layout(createStepRange(AnyIsDefaultStep)); + updateInnerTextValue(); } void TimeInputType::updateInnerTextValue() @@ -280,13 +273,13 @@ void TimeInputType::updateInnerTextValue() if (!m_dateTimeEditElement) return; + const StepRange stepRange(createStepRange(AnyIsDefaultStep)); DateComponents date; if (parseToDateComponents(element()->value(), &date)) - m_dateTimeEditElement->setValueAsDate(date); + m_dateTimeEditElement->setValueAsDate(stepRange, date); else { - const StepRange stepRange(createStepRange(AnyIsDefaultStep)); setMillisecondToDateComponents(stepRange.minimum().toDouble(), &date); - m_dateTimeEditElement->setEmptyValue(date); + m_dateTimeEditElement->setEmptyValue(stepRange, date); } } #else diff --git a/Source/WebCore/html/TimeInputType.h b/Source/WebCore/html/TimeInputType.h index 8dc6e7740..ee877dcf1 100644 --- a/Source/WebCore/html/TimeInputType.h +++ b/Source/WebCore/html/TimeInputType.h @@ -80,8 +80,6 @@ private: friend class DateTimeEditControlOwnerImpl; - void updateEditElementLayout(); - // InputType functions virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE FINAL; virtual void createShadowSubtree() OVERRIDE FINAL; diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.cpp b/Source/WebCore/html/shadow/DateTimeEditElement.cpp index 3a64b9914..44a1c2b0a 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeEditElement.cpp @@ -50,7 +50,7 @@ class DateTimeEditBuilder : private DateTimeFormat::TokenHandler { WTF_MAKE_NONCOPYABLE(DateTimeEditBuilder); public: - DateTimeEditBuilder(DateTimeEditElement&, const StepRange&); + DateTimeEditBuilder(DateTimeEditElement&, const StepRange&, const DateComponents&); bool build(const String&); bool needSecondField() const; @@ -67,11 +67,13 @@ private: virtual void visitLiteral(const String&) OVERRIDE FINAL; DateTimeEditElement& m_editElement; + const DateComponents& m_dateValue; const StepRange& m_stepRange; }; -DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& elemnt, const StepRange& stepRange) +DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& elemnt, const StepRange& stepRange, const DateComponents& dateValue) : m_editElement(elemnt) + , m_dateValue(dateValue) , m_stepRange(stepRange) { } @@ -84,19 +86,22 @@ bool DateTimeEditBuilder::build(const String& formatString) bool DateTimeEditBuilder::needMillisecondField() const { - return !m_stepRange.minimum().remainder(static_cast<int>(msPerSecond)).isZero() + return m_dateValue.millisecond() + || !m_stepRange.minimum().remainder(static_cast<int>(msPerSecond)).isZero() || !m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); } bool DateTimeEditBuilder::needMinuteField() const { - return !m_stepRange.minimum().remainder(static_cast<int>(msPerHour)).isZero() + return m_dateValue.minute() + || !m_stepRange.minimum().remainder(static_cast<int>(msPerHour)).isZero() || !m_stepRange.step().remainder(static_cast<int>(msPerHour)).isZero(); } bool DateTimeEditBuilder::needSecondField() const { - return !m_stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero() + return m_dateValue.second() + || !m_stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero() || !m_stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); } @@ -161,17 +166,17 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) bool DateTimeEditBuilder::shouldMillisecondFieldReadOnly() const { - return m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); + return !m_dateValue.millisecond() && m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); } bool DateTimeEditBuilder::shouldMinuteFieldReadOnly() const { - return m_stepRange.step().remainder(static_cast<int>(msPerHour)).isZero(); + return !m_dateValue.minute() && m_stepRange.step().remainder(static_cast<int>(msPerHour)).isZero(); } bool DateTimeEditBuilder::shouldSecondFieldReadOnly() const { - return m_stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); + return !m_dateValue.second() && m_stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); } void DateTimeEditBuilder::visitLiteral(const String& text) @@ -213,10 +218,9 @@ void DateTimeEditElement::addField(PassRefPtr<DateTimeFieldElement> field) appendChild(field); } -PassRefPtr<DateTimeEditElement> DateTimeEditElement::create(Document* document, EditControlOwner& editControlOwner, const StepRange& stepRange) +PassRefPtr<DateTimeEditElement> DateTimeEditElement::create(Document* document, EditControlOwner& editControlOwner) { RefPtr<DateTimeEditElement> container = adoptRef(new DateTimeEditElement(document, editControlOwner)); - container->layout(stepRange); return container.release(); } @@ -341,12 +345,14 @@ bool DateTimeEditElement::isReadOnly() const return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly(); } -void DateTimeEditElement::layout(const StepRange& stepRange) +void DateTimeEditElement::layout(const StepRange& stepRange, const DateComponents& dateValue) { + size_t focusFieldIndex = m_focusFieldIndex; DateTimeFieldElement* const focusField = fieldAt(m_focusFieldIndex); + const AtomicString focusFieldId = focusField ? focusField->shadowPseudoId() : nullAtom; focusFieldAt(invalidFieldIndex); - DateTimeEditBuilder builder(*this, stepRange); + DateTimeEditBuilder builder(*this, stepRange, dateValue); const String dateTimeFormat = builder.needSecondField() ? localizedTimeFormatText() : localizedShortTimeFormatText(); if (!builder.build(dateTimeFormat) || m_fields.isEmpty()) builder.build(builder.needSecondField() ? "HH:mm:ss" : "HH:mm"); @@ -355,13 +361,14 @@ void DateTimeEditElement::layout(const StepRange& stepRange) m_spinButton = spinButton.get(); appendChild(spinButton); - if (focusField) { + if (focusFieldIndex != invalidFieldIndex) { for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) { - if (focusField == m_fields[fieldIndex]) { - focusFieldAt(fieldIndex); + if (m_fields[fieldIndex]->shadowPseudoId() == focusFieldId) { + focusFieldIndex = fieldIndex; break; } } + focusFieldAt(std::min(focusFieldIndex, m_fields.size() - 1)); } } @@ -434,14 +441,16 @@ void DateTimeEditElement::defaultEventHandler(Event* event) focusField->defaultEventHandler(event); } -void DateTimeEditElement::setValueAsDate(const DateComponents& date) +void DateTimeEditElement::setValueAsDate(const StepRange& stepRange, const DateComponents& date) { + layout(stepRange, date); for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) m_fields[fieldIndex]->setValueAsDate(date); } -void DateTimeEditElement::setEmptyValue(const DateComponents& dateForReadOnlyField) +void DateTimeEditElement::setEmptyValue(const StepRange& stepRange, const DateComponents& dateForReadOnlyField) { + layout(stepRange, dateForReadOnlyField); for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) m_fields[fieldIndex]->setEmptyValue(dateForReadOnlyField, DateTimeFieldElement::DispatchNoEvent); } diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.h b/Source/WebCore/html/shadow/DateTimeEditElement.h index c6016febf..4767368f4 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.h +++ b/Source/WebCore/html/shadow/DateTimeEditElement.h @@ -59,18 +59,17 @@ public: virtual bool isEditControlOwnerReadOnly() const = 0; }; - static PassRefPtr<DateTimeEditElement> create(Document*, EditControlOwner&, const StepRange&); + static PassRefPtr<DateTimeEditElement> create(Document*, EditControlOwner&); virtual ~DateTimeEditElement(); void addField(PassRefPtr<DateTimeFieldElement>); virtual void defaultEventHandler(Event*) OVERRIDE; void disabledStateChanged(); - void layout(const StepRange&); void readOnlyStateChanged(); void removeEditControlOwner() { m_editControlOwner = 0; } void resetLayout(); - void setEmptyValue(const DateComponents& dateForReadOnlyField); - void setValueAsDate(const DateComponents&); + void setEmptyValue(const StepRange&, const DateComponents& dateForReadOnlyField); + void setValueAsDate(const StepRange&, const DateComponents&); double valueAsDouble() const; private: @@ -95,6 +94,7 @@ private: void handleMouseEvent(MouseEvent*); bool isDisabled() const; bool isReadOnly() const; + void layout(const StepRange&, const DateComponents&); size_t nextFieldIndex() const; size_t previousFieldIndex() const; void updateUIState(); diff --git a/Source/WebCore/html/shadow/MediaControlRootElement.h b/Source/WebCore/html/shadow/MediaControlRootElement.h index 5ce6ac7ea..a0b09d874 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElement.h +++ b/Source/WebCore/html/shadow/MediaControlRootElement.h @@ -152,7 +152,6 @@ private: MediaControlPanelElement* m_panel; #if ENABLE(VIDEO_TRACK) MediaControlTextTrackContainerElement* m_textDisplayContainer; - MediaControlTextTrackDisplayElement* m_textTrackDisplay; #endif Timer<MediaControlRootElement> m_hideFullscreenControlsTimer; bool m_isMouseOverControls; diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index f8685279e..155e3d2de 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -258,6 +258,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) input->setTextAsOfLastFormControlChangeEvent(input->value()); LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, false, true)); bool isVertical = hasVerticalAppearance(input); + bool isLeftToRightDirection = renderBox()->style()->isLeftToRightDirection(); LayoutUnit trackSize; LayoutUnit position; LayoutUnit currentPosition; @@ -276,6 +277,8 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) } else { trackSize = trackElement->renderBox()->contentWidth(); position = offset.x() - renderBox()->width() / 2 - trackBoundingBox.x() + inputBoundingBox.x(); + if (!isLeftToRightDirection) + position += renderBox()->width(); currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x(); } position = max<LayoutUnit>(0, min(position, trackSize)); @@ -283,7 +286,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) return; const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / trackSize); - const Decimal fraction = isVertical || !renderBox()->style()->isLeftToRightDirection() ? Decimal(1) - ratio : ratio; + const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio; StepRange stepRange(input->createStepRange(RejectAny)); Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction)); @@ -293,7 +296,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) Decimal closest = input->findClosestTickMarkValue(value); if (closest.isFinite()) { double closestFraction = stepRange.proportionFromValue(closest).toDouble(); - double closestRatio = isVertical || !renderBox()->style()->isLeftToRightDirection() ? 1.0 - closestFraction : closestFraction; + double closestRatio = isVertical || !isLeftToRightDirection ? 1.0 - closestFraction : closestFraction; LayoutUnit closestPosition = trackSize * closestRatio; if ((closestPosition - position).abs() <= snappingThreshold) value = closest; diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index f46ed355f..85222538b 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -32,7 +32,6 @@ import os.path import sys import string import optparse -from string import join try: import json except ImportError: @@ -86,8 +85,10 @@ try: raise Exception("Output .h directory must be specified") if not output_cpp_dirname: raise Exception("Output .cpp directory must be specified") -except Exception, e: - sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % e) +except Exception: + # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html + exc = sys.exc_info()[1] + sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) sys.stderr.write("Usage: <script> Inspector.json --output_h_dir <output_header_dir> --output_cpp_dir <output_cpp_dir>\n") exit(1) @@ -797,7 +798,7 @@ class EnumConstants: output = [] for item in cls.constants_: output.append(" \"" + item + "\"") - return join(output, ",\n") + "\n" + return ",\n".join(output) + "\n" # Typebuilder code is generated in several passes: first typedefs, then other classes. @@ -926,7 +927,7 @@ class TypeBindings: for enum_item in enum: enum_pos = EnumConstants.add_constant(enum_item) condition_list.append("s == \"%s\"" % enum_item) - validator_writer.newline(" ASSERT(%s);\n" % join(condition_list, " || ")) + validator_writer.newline(" ASSERT(%s);\n" % " || ".join(condition_list)) validator_writer.newline("}\n") if domain_guard: @@ -2700,7 +2701,7 @@ class Generator: Generator.frontend_domain_class_lines.append(Templates.frontend_domain_class.substitute(None, domainClassName=domain_name, domainFieldName=domain_name_lower, - frontendDomainMethodDeclarations=join(flatten_list(frontend_method_declaration_lines), ""))) + frontendDomainMethodDeclarations="".join(flatten_list(frontend_method_declaration_lines)))) agent_interface_name = Capitalizer.lower_camel_case_to_upper(domain_name) + "CommandHandler" Generator.backend_agent_interface_list.append(" class %s {\n" % agent_interface_name) @@ -2769,15 +2770,15 @@ class Generator: backend_js_event_param_list.append("\"%s\"" % parameter_name) method_line_list.append(" %sMessage->setObject(\"params\", paramsObject);\n" % event_name) frontend_method_declaration_lines.append( - " void %s(%s);\n" % (event_name, join(parameter_list, ", "))) + " void %s(%s);\n" % (event_name, ", ".join(parameter_list))) Generator.frontend_method_list.append(Templates.frontend_method.substitute(None, domainName=domain_name, eventName=event_name, - parameters=join(parameter_list, ", "), - code=join(method_line_list, ""))) + parameters=", ".join(parameter_list), + code="".join(method_line_list))) Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerEvent(\"%s.%s\", [%s]);\n" % ( - domain_name, event_name, join(backend_js_event_param_list, ", "))) + domain_name, event_name, ", ".join(backend_js_event_param_list))) @staticmethod def process_command(json_command, domain_name, agent_field_name, agent_interface_name): @@ -2851,7 +2852,7 @@ class Generator: js_param_list.append(js_param_text) - js_parameters_text = join(js_param_list, ", ") + js_parameters_text = ", ".join(js_param_list) response_cook_text = "" js_reply_list = "[]" @@ -2900,9 +2901,9 @@ class Generator: backend_js_reply_param_list.append("\"%s\"" % json_return_name) - js_reply_list = "[%s]" % join(backend_js_reply_param_list, ", ") + js_reply_list = "[%s]" % ", ".join(backend_js_reply_param_list) - response_cook_text = join(response_cook_list, "") + response_cook_text = "".join(response_cook_list) if len(response_cook_text) != 0: response_cook_text = " if (!error.length()) {\n" + response_cook_text + " }" @@ -2912,7 +2913,7 @@ class Generator: agentField="m_" + agent_field_name, methodInCode=method_in_code, methodOutCode=method_out_code, - agentCallParams=join(agent_call_param_list, ""), + agentCallParams="".join(agent_call_param_list), requestMessageObject=request_message_param, responseCook=response_cook_text, commandNameIndex=cmd_enum_name)) @@ -3090,38 +3091,38 @@ backend_js_file = SmartOutput(output_cpp_dirname + "/InspectorBackendCommands.js backend_h_file.write(Templates.backend_h.substitute(None, - virtualSetters=join(Generator.backend_virtual_setters_list, "\n"), - agentInterfaces=join(flatten_list(Generator.backend_agent_interface_list), ""), - methodNamesEnumContent=join(Generator.method_name_enum_list, "\n"))) + virtualSetters="\n".join(Generator.backend_virtual_setters_list), + agentInterfaces="".join(flatten_list(Generator.backend_agent_interface_list)), + methodNamesEnumContent="\n".join(Generator.method_name_enum_list))) backend_cpp_file.write(Templates.backend_cpp.substitute(None, - constructorInit=join(Generator.backend_constructor_init_list, "\n"), - setters=join(Generator.backend_setters_list, "\n"), - fieldDeclarations=join(Generator.backend_field_list, "\n"), - methodNameDeclarations=join(Generator.backend_method_name_declaration_list, "\n"), - methods=join(Generator.backend_method_implementation_list, "\n"), - methodDeclarations=join(Generator.backend_method_declaration_list, "\n"), - messageHandlers=join(Generator.method_handler_list, "\n"))) + constructorInit="\n".join(Generator.backend_constructor_init_list), + setters="\n".join(Generator.backend_setters_list), + fieldDeclarations="\n".join(Generator.backend_field_list), + methodNameDeclarations="\n".join(Generator.backend_method_name_declaration_list), + methods="\n".join(Generator.backend_method_implementation_list), + methodDeclarations="\n".join(Generator.backend_method_declaration_list), + messageHandlers="\n".join(Generator.method_handler_list))) frontend_h_file.write(Templates.frontend_h.substitute(None, - fieldDeclarations=join(Generator.frontend_class_field_lines, ""), - domainClassList=join(Generator.frontend_domain_class_lines, ""))) + fieldDeclarations="".join(Generator.frontend_class_field_lines), + domainClassList="".join(Generator.frontend_domain_class_lines))) frontend_cpp_file.write(Templates.frontend_cpp.substitute(None, - constructorInit=join(Generator.frontend_constructor_init_list, ""), - methods=join(Generator.frontend_method_list, "\n"))) + constructorInit="".join(Generator.frontend_constructor_init_list), + methods="\n".join(Generator.frontend_method_list))) typebuilder_h_file.write(Templates.typebuilder_h.substitute(None, - typeBuilders=join(flatten_list(Generator.type_builder_fragments), ""), - forwards=join(Generator.type_builder_forwards, ""))) + typeBuilders="".join(flatten_list(Generator.type_builder_fragments)), + forwards="".join(Generator.type_builder_forwards))) typebuilder_cpp_file.write(Templates.typebuilder_cpp.substitute(None, enumConstantValues=EnumConstants.get_enum_constant_code(), - implCode=join(flatten_list(Generator.type_builder_impl_list), ""), - validatorCode=join(flatten_list(Generator.validator_impl_list), ""))) + implCode="".join(flatten_list(Generator.type_builder_impl_list)), + validatorCode="".join(flatten_list(Generator.validator_impl_list)))) backend_js_file.write(Templates.backend_js.substitute(None, - domainInitializers=join(Generator.backend_js_domain_initializer_list, ""))) + domainInitializers="".join(Generator.backend_js_domain_initializer_list))) backend_h_file.close() backend_cpp_file.close() diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp index 70c2b5997..33b21b4fd 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp @@ -130,6 +130,7 @@ public: virtual void onVersionChange(const String& version) { } virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) { } + virtual void onForcedClose() { } private: InspectorIDBDatabaseCallbacks() { } }; diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index fee87cb77..31eadde70 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -30,7 +30,9 @@ import os import os.path import generate_protocol_externs +import shutil import sys +import tempfile inspector_path = "Source/WebCore/inspector" inspector_frontend_path = inspector_path + "/front-end" @@ -365,7 +367,8 @@ def dump_module(name, recursively, processed_modules): command += " \\\n --js " + inspector_frontend_path + "/" + script return command -compiler_command = "java -jar ~/closure/compiler.jar --summary_detail_level 3 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECMASCRIPT5 --accept_const_keyword \\\n" +modules_dir = tempfile.mkdtemp() +compiler_command = "java -jar ~/closure/compiler.jar --summary_detail_level 3 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECMASCRIPT5 --accept_const_keyword --module_output_path_prefix %s/ \\\n" % modules_dir process_recursively = len(sys.argv) == 2 if process_recursively: @@ -407,3 +410,5 @@ if not process_recursively: command += "\n" os.system(command) os.system("rm " + inspector_path + "/" + "InjectedScriptWebGLModuleSourceTmp.js") + +shutil.rmtree(modules_dir) diff --git a/Source/WebCore/inspector/front-end/AdvancedSearchController.js b/Source/WebCore/inspector/front-end/AdvancedSearchController.js index 695059375..be51bd764 100644 --- a/Source/WebCore/inspector/front-end/AdvancedSearchController.js +++ b/Source/WebCore/inspector/front-end/AdvancedSearchController.js @@ -585,7 +585,7 @@ WebInspector.FileBasedSearchResultsPane.prototype = { var showMoreMatchesElement = new TreeElement(showMoreMatchesText, null, false); fileTreeElement.appendChild(showMoreMatchesElement); showMoreMatchesElement.listItemElement.addStyleClass("show-more-matches"); - showMoreMatchesElement.onselect = this._showMoreMatchesElementSelected.bind(this, searchResult, startMatchIndex); + showMoreMatchesElement.onselect = this._showMoreMatchesElementSelected.bind(this, searchResult, startMatchIndex, showMoreMatchesElement); }, /** @@ -629,7 +629,7 @@ WebInspector.FileBasedSearchResultsPane.prototype = { fileTreeElement.listItemElement.appendChild(matchesCountSpan); var searchResult = this._searchResults[searchResultIndex]; - fileTreeElement.onexpand = this._fileTreeElementExpanded.bind(this, searchResult); + fileTreeElement.onexpand = this._fileTreeElementExpanded.bind(this, searchResult, fileTreeElement); // Expand until at least certain amount of matches is expanded. if (this._matchesExpandedCount < WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount) diff --git a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js index 18cab8ae4..fa3bfe94f 100644 --- a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -1042,7 +1042,7 @@ WebInspector.ElementsTreeElement.prototype = { } }, - onselect: function(treeElement, selectedByUser) + onselect: function(selectedByUser) { this.treeOutline.suppressRevealAndSelect = true; this.treeOutline.selectDOMNode(this.representedObject, selectedByUser); diff --git a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js index d8c45d879..9324a5467 100644 --- a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js +++ b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js @@ -175,7 +175,7 @@ WebInspector.EventListenersSection.prototype.__proto__ = WebInspector.Properties */ WebInspector.EventListenerBar = function(eventListener, nodeId, linkifier) { - WebInspector.ObjectPropertiesSection.call(this); + WebInspector.ObjectPropertiesSection.call(this, WebInspector.RemoteObject.fromPrimitiveValue("")); this.eventListener = eventListener; this._nodeId = nodeId; diff --git a/Source/WebCore/inspector/front-end/MemoryStatistics.js b/Source/WebCore/inspector/front-end/MemoryStatistics.js index aa52e222e..b4596e194 100644 --- a/Source/WebCore/inspector/front-end/MemoryStatistics.js +++ b/Source/WebCore/inspector/front-end/MemoryStatistics.js @@ -287,8 +287,8 @@ WebInspector.MemoryStatistics.prototype = { _calculateVisibleIndexes: function() { var calculator = this._timelinePanel.calculator; - var start = calculator.minimumBoundary * 1000; - var end = calculator.maximumBoundary * 1000; + var start = calculator.minimumBoundary() * 1000; + var end = calculator.maximumBoundary() * 1000; var firstIndex = 0; var lastIndex = this._counters.length - 1; for (var i = 0; i < this._counters.length; i++) { diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 6aa5fc935..b0b11e011 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -305,7 +305,7 @@ WebInspector.NetworkLogView.prototype = { this._timelineSortSelector.selectedIndex = 0; this._updateOffscreenRows(); - this.performSearch(null); + this.searchCanceled(); }, _sortByTimeline: function() @@ -451,7 +451,7 @@ WebInspector.NetworkLogView.prototype = { selectMultiple = true; this._filter(e.target, selectMultiple); - this.performSearch(null); + this.searchCanceled(); this._updateSummaryBar(); }, @@ -1083,6 +1083,7 @@ WebInspector.NetworkLogView.prototype = { _clearSearchMatchedList: function() { + delete this._searchRegExp; this._matchedRequests = []; this._matchedRequestsMap = {}; this._removeAllHighlights(); @@ -1170,8 +1171,8 @@ WebInspector.NetworkLogView.prototype = { if (this._currentMatchedRequestIndex !== -1) currentMatchedRequestId = this._matchedRequests[this._currentMatchedRequestIndex]; - this._searchRegExp = createPlainTextSearchRegex(searchQuery, "i"); this._clearSearchMatchedList(); + this._searchRegExp = createPlainTextSearchRegex(searchQuery, "i"); var childNodes = this._dataGrid.dataTableBody.childNodes; var requestNodes = Array.prototype.slice.call(childNodes, 0, childNodes.length - 1); // drop the filler row. @@ -1191,7 +1192,8 @@ WebInspector.NetworkLogView.prototype = { /** * @param {string} query */ - performFilter: function(query) { + performFilter: function(query) + { this._filteredOutRequests.clear(); var filterRegExp = createPlainTextSearchRegex(query, "i"); var shownRequests = []; @@ -1462,19 +1464,28 @@ WebInspector.NetworkPanel.prototype = { /** * @param {string} searchQuery - */ + */ performSearch: function(searchQuery) { this._networkLogView.performSearch(searchQuery); }, - + + /** + * @return {boolean} + */ + canFilter: function() + { + return true; + }, + /** * @param {string} query */ - performFilter: function(query){ + performFilter: function(query) + { this._networkLogView.performFilter(query); }, - + jumpToPreviousSearchResult: function() { this._networkLogView.jumpToPreviousSearchResult(); @@ -1514,6 +1525,7 @@ WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; /** * @constructor + * @implements {WebInspector.TimelineGrid.Calculator} */ WebInspector.NetworkBaseCalculator = function() { @@ -1522,12 +1534,12 @@ WebInspector.NetworkBaseCalculator = function() WebInspector.NetworkBaseCalculator.prototype = { computePosition: function(time) { - return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea; + return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea; }, computeBarGraphPercentages: function(item) { - return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100}; + return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan()) * 100}; }, computeBarGraphLabels: function(item) @@ -1536,18 +1548,18 @@ WebInspector.NetworkBaseCalculator.prototype = { return {left: label, right: label, tooltip: label}; }, - get boundarySpan() + boundarySpan: function() { - return this.maximumBoundary - this.minimumBoundary; + return this._maximumBoundary - this._minimumBoundary; }, updateBoundaries: function(item) { - this.minimumBoundary = 0; + this._minimumBoundary = 0; var value = this._value(item); - if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) { - this.maximumBoundary = value; + if (typeof this._maximumBoundary === "undefined" || value > this._maximumBoundary) { + this._maximumBoundary = value; return true; } return false; @@ -1555,8 +1567,18 @@ WebInspector.NetworkBaseCalculator.prototype = { reset: function() { - delete this.minimumBoundary; - delete this.maximumBoundary; + delete this._minimumBoundary; + delete this._maximumBoundary; + }, + + maximumBoundary: function() + { + return this._maximumBoundary; + }, + + minimumBoundary: function() + { + return this._minimumBoundary; }, _value: function(item) @@ -1590,17 +1612,17 @@ WebInspector.NetworkTimeCalculator.prototype = { computeBarGraphPercentages: function(request) { if (request.startTime !== -1) - var start = ((request.startTime - this.minimumBoundary) / this.boundarySpan) * 100; + var start = ((request.startTime - this._minimumBoundary) / this.boundarySpan()) * 100; else var start = 0; if (request.responseReceivedTime !== -1) - var middle = ((request.responseReceivedTime - this.minimumBoundary) / this.boundarySpan) * 100; + var middle = ((request.responseReceivedTime - this._minimumBoundary) / this.boundarySpan()) * 100; else var middle = (this.startAtZero ? start : 100); if (request.endTime !== -1) - var end = ((request.endTime - this.minimumBoundary) / this.boundarySpan) * 100; + var end = ((request.endTime - this._minimumBoundary) / this.boundarySpan()) * 100; else var end = (this.startAtZero ? middle : 100); @@ -1619,7 +1641,7 @@ WebInspector.NetworkTimeCalculator.prototype = { // of a specific event. If startAtZero is set, then this is useless, and we // want to return 0. if (eventTime !== -1 && !this.startAtZero) - return ((eventTime - this.minimumBoundary) / this.boundarySpan) * 100; + return ((eventTime - this._minimumBoundary) / this.boundarySpan()) * 100; return 0; }, @@ -1629,8 +1651,8 @@ WebInspector.NetworkTimeCalculator.prototype = { if (eventTime === -1 || this.startAtZero) return false; - if (typeof this.maximumBoundary === "undefined" || eventTime > this.maximumBoundary) { - this.maximumBoundary = eventTime; + if (typeof this._maximumBoundary === "undefined" || eventTime > this._maximumBoundary) { + this._maximumBoundary = eventTime; return true; } return false; @@ -1674,14 +1696,14 @@ WebInspector.NetworkTimeCalculator.prototype = { else lowerBound = this._lowerBound(request); - if (lowerBound !== -1 && (typeof this.minimumBoundary === "undefined" || lowerBound < this.minimumBoundary)) { - this.minimumBoundary = lowerBound; + if (lowerBound !== -1 && (typeof this._minimumBoundary === "undefined" || lowerBound < this._minimumBoundary)) { + this._minimumBoundary = lowerBound; didChange = true; } var upperBound = this._upperBound(request); - if (upperBound !== -1 && (typeof this.maximumBoundary === "undefined" || upperBound > this.maximumBoundary)) { - this.maximumBoundary = upperBound; + if (upperBound !== -1 && (typeof this._maximumBoundary === "undefined" || upperBound > this._maximumBoundary)) { + this._maximumBoundary = upperBound; didChange = true; } diff --git a/Source/WebCore/inspector/front-end/Panel.js b/Source/WebCore/inspector/front-end/Panel.js index e0f965b07..8cee1761c 100644 --- a/Source/WebCore/inspector/front-end/Panel.js +++ b/Source/WebCore/inspector/front-end/Panel.js @@ -126,9 +126,25 @@ WebInspector.Panel.prototype = { }, /** + * @param {string} query * @param {string} text */ - replaceAllWith: function(text) + replaceAllWith: function(query, text) + { + }, + + /** + * @return {boolean} + */ + canFilter: function() + { + return false; + }, + + /** + * @param {string} query + */ + performFilter: function(query) { }, diff --git a/Source/WebCore/inspector/front-end/SearchController.js b/Source/WebCore/inspector/front-end/SearchController.js index 8d2e726d3..04820da1d 100644 --- a/Source/WebCore/inspector/front-end/SearchController.js +++ b/Source/WebCore/inspector/front-end/SearchController.js @@ -276,7 +276,7 @@ WebInspector.SearchController.prototype = { _updateFilterVisibility: function() { - if (typeof WebInspector.inspectorView.currentPanel().performFilter === "function") + if (WebInspector.inspectorView.currentPanel().canFilter()) this._filterCheckboxContainer.removeStyleClass("hidden"); else this._filterCheckboxContainer.addStyleClass("hidden"); @@ -431,8 +431,7 @@ WebInspector.SearchController.prototype = { */ _performFilter: function(query) { - if (typeof WebInspector.inspectorView.currentPanel().performFilter === "function") - WebInspector.inspectorView.currentPanel().performFilter(query); + WebInspector.inspectorView.currentPanel().performFilter(query); }, _onFilterInput: function(event) diff --git a/Source/WebCore/inspector/front-end/SidebarPane.js b/Source/WebCore/inspector/front-end/SidebarPane.js index b7fa747dd..af6ed1abd 100644 --- a/Source/WebCore/inspector/front-end/SidebarPane.js +++ b/Source/WebCore/inspector/front-end/SidebarPane.js @@ -108,8 +108,11 @@ WebInspector.SidebarPane.prototype = { return; this._expanded = true; this.element.addStyleClass("expanded"); - if (this.onexpand) - this.onexpand(this); + this.onexpand(); + }, + + onexpand: function() + { }, collapse: function() @@ -118,8 +121,6 @@ WebInspector.SidebarPane.prototype = { return; this._expanded = false; this.element.removeStyleClass("expanded"); - if (this.oncollapse) - this.oncollapse(this); }, toggleExpanded: function() diff --git a/Source/WebCore/inspector/front-end/TimelineGrid.js b/Source/WebCore/inspector/front-end/TimelineGrid.js index a823adef6..a0cd7c85c 100644 --- a/Source/WebCore/inspector/front-end/TimelineGrid.js +++ b/Source/WebCore/inspector/front-end/TimelineGrid.js @@ -132,7 +132,7 @@ WebInspector.TimelineGrid.prototype = { left = dividersElementClientWidth / dividerCount * i + paddingLeft; dividerLabelBar._labelElement.textContent = ""; } else { - left = calculator.computePosition(calculator.minimumBoundary + slice * i); + left = calculator.computePosition(calculator.minimumBoundary() + slice * i); dividerLabelBar._labelElement.textContent = calculator.formatTime(slice * i); } var percentLeft = 100 * left / dividersElementClientWidth; @@ -200,3 +200,25 @@ WebInspector.TimelineGrid.prototype = { this._dividersElement.style.top = scrollTop + "px"; } } + +/** + * @interface + */ +WebInspector.TimelineGrid.Calculator = function() { } + +WebInspector.TimelineGrid.Calculator.prototype = { + /** @param {number} time */ + computePosition: function(time) { }, + + /** @param {number} time */ + formatTime: function(time) { }, + + /** @return {number} */ + minimumBoundary: function() { }, + + /** @return {number} */ + maximumBoundary: function() { }, + + /** @return {number} */ + boundarySpan: function() { } +} diff --git a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js index 48d99602c..797df208b 100644 --- a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js +++ b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js @@ -652,13 +652,13 @@ WebInspector.TimelineOverviewCalculator.prototype = { */ computePosition: function(time) { - return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea + this.paddingLeft; + return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea + this.paddingLeft; }, computeBarGraphPercentages: function(record) { - var start = (WebInspector.TimelineModel.startTimeInSeconds(record) - this.minimumBoundary) / this.boundarySpan * 100; - var end = (WebInspector.TimelineModel.endTimeInSeconds(record) - this.minimumBoundary) / this.boundarySpan * 100; + var start = (WebInspector.TimelineModel.startTimeInSeconds(record) - this._minimumBoundary) / this.boundarySpan() * 100; + var end = (WebInspector.TimelineModel.endTimeInSeconds(record) - this._minimumBoundary) / this.boundarySpan() * 100; return {start: start, end: end}; }, @@ -668,9 +668,8 @@ WebInspector.TimelineOverviewCalculator.prototype = { */ setWindow: function(minimum, maximum) { - this.minimumBoundary = minimum >= 0 ? minimum : undefined; - this.maximumBoundary = maximum >= 0 ? maximum : undefined; - this.boundarySpan = this.maximumBoundary - this.minimumBoundary; + this._minimumBoundary = minimum >= 0 ? minimum : undefined; + this._maximumBoundary = maximum >= 0 ? maximum : undefined; }, /** @@ -691,6 +690,21 @@ WebInspector.TimelineOverviewCalculator.prototype = { formatTime: function(value) { return Number.secondsToString(value); + }, + + maximumBoundary: function() + { + return this._maximumBoundary; + }, + + minimumBoundary: function() + { + return this._minimumBoundary; + }, + + boundarySpan: function() + { + return this._maximumBoundary - this._minimumBoundary; } } diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 661d6bb8c..dbfd8a8c0 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -415,7 +415,7 @@ WebInspector.TimelinePanel.prototype = { _shouldShowFrames: function() { - return this._frameMode && this._presentationModel.frames().length > 0 && this.calculator.boundarySpan < 1.0; + return this._frameMode && this._presentationModel.frames().length > 0 && this.calculator.boundarySpan() < 1.0; }, _updateFrames: function() @@ -996,6 +996,7 @@ WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype; /** * @constructor * @param {WebInspector.TimelineModel} model + * @implements {WebInspector.TimelineGrid.Calculator} */ WebInspector.TimelineCalculator = function(model) { @@ -1010,15 +1011,15 @@ WebInspector.TimelineCalculator.prototype = { */ computePosition: function(time) { - return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea + this.paddingLeft; + return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea + this.paddingLeft; }, computeBarGraphPercentages: function(record) { - var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100; - var end = (record.startTime + record.selfTime - this.minimumBoundary) / this.boundarySpan * 100; - var endWithChildren = (record.lastChildEndTime - this.minimumBoundary) / this.boundarySpan * 100; - var cpuWidth = record.cpuTime / this.boundarySpan * 100; + var start = (record.startTime - this._minimumBoundary) / this.boundarySpan() * 100; + var end = (record.startTime + record.selfTime - this._minimumBoundary) / this.boundarySpan() * 100; + var endWithChildren = (record.lastChildEndTime - this._minimumBoundary) / this.boundarySpan() * 100; + var cpuWidth = record.cpuTime / this.boundarySpan() * 100; return {start: start, end: end, endWithChildren: endWithChildren, cpuWidth: cpuWidth}; }, @@ -1043,9 +1044,8 @@ WebInspector.TimelineCalculator.prototype = { setWindow: function(minimumBoundary, maximumBoundary) { - this.minimumBoundary = minimumBoundary; - this.maximumBoundary = maximumBoundary; - this.boundarySpan = this.maximumBoundary - this.minimumBoundary; + this._minimumBoundary = minimumBoundary; + this._maximumBoundary = maximumBoundary; }, /** @@ -1060,7 +1060,22 @@ WebInspector.TimelineCalculator.prototype = { formatTime: function(value) { - return Number.secondsToString(value + this.minimumBoundary - this._model.minimumRecordTime()); + return Number.secondsToString(value + this._minimumBoundary - this._model.minimumRecordTime()); + }, + + maximumBoundary: function() + { + return this._maximumBoundary; + }, + + minimumBoundary: function() + { + return this._minimumBoundary; + }, + + boundarySpan: function() + { + return this._maximumBoundary - this._minimumBoundary; } } diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js index c1e07584e..e140cf6f7 100644 --- a/Source/WebCore/inspector/front-end/UIUtils.js +++ b/Source/WebCore/inspector/front-end/UIUtils.js @@ -60,29 +60,46 @@ WebInspector._elementDragStart = function(elementDragStart, elementDrag, element if (elementDragStart && !elementDragStart(event)) return; - // Install glass pane - if (WebInspector._elementDraggingGlassPane) + if (WebInspector._elementDraggingGlassPane) { WebInspector._elementDraggingGlassPane.dispose(); + delete WebInspector._elementDraggingGlassPane; + } - WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane(); + var targetDocument = event.target.ownerDocument; WebInspector._elementDraggingEventListener = elementDrag; WebInspector._elementEndDraggingEventListener = elementDragEnd; + WebInspector._mouseOutWhileDraggingTargetDocument = targetDocument; - var targetDocument = event.target.ownerDocument; targetDocument.addEventListener("mousemove", WebInspector._elementDraggingEventListener, true); targetDocument.addEventListener("mouseup", WebInspector._elementDragEnd, true); + targetDocument.addEventListener("mouseout", WebInspector._mouseOutWhileDragging, true); targetDocument.body.style.cursor = cursor; event.preventDefault(); } +WebInspector._mouseOutWhileDragging = function() +{ + WebInspector._unregisterMouseOutWhileDragging(); + WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane(); +} + +WebInspector._unregisterMouseOutWhileDragging = function() +{ + if (!WebInspector._mouseOutWhileDraggingTargetDocument) + return; + WebInspector._mouseOutWhileDraggingTargetDocument.removeEventListener("mouseout", WebInspector._mouseOutWhileDragging, true); + delete WebInspector._mouseOutWhileDraggingTargetDocument; +} + WebInspector._elementDragEnd = function(event) { var targetDocument = event.target.ownerDocument; targetDocument.removeEventListener("mousemove", WebInspector._elementDraggingEventListener, true); targetDocument.removeEventListener("mouseup", WebInspector._elementDragEnd, true); + WebInspector._unregisterMouseOutWhileDragging(); targetDocument.body.style.removeProperty("cursor"); diff --git a/Source/WebCore/inspector/front-end/treeoutline.js b/Source/WebCore/inspector/front-end/treeoutline.js index ddbdbb0e8..fd02f4e02 100644 --- a/Source/WebCore/inspector/front-end/treeoutline.js +++ b/Source/WebCore/inspector/front-end/treeoutline.js @@ -122,9 +122,6 @@ TreeOutline.prototype.insertChild = function(child, index) } child._attach(); - - if (this.treeOutline.onadd) - this.treeOutline.onadd(child); } TreeOutline.prototype.removeChildAtIndex = function(childIndex) @@ -286,15 +283,6 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, return this.getCachedTreeElement(representedObject); } -TreeOutline.prototype._treeElementDidChange = function(treeElement) -{ - if (treeElement.treeOutline !== this) - return; - - if (this.onchange) - this.onchange(treeElement); -} - TreeOutline.prototype.treeElementFromPoint = function(x, y) { var node = this._childrenListNode.ownerDocument.elementFromPoint(x, y); @@ -376,16 +364,12 @@ TreeOutline.prototype._treeKeyDown = function(event) this.selectedTreeElement.expand(); } } - } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* Delete */) { - if (this.selectedTreeElement.ondelete) - handled = this.selectedTreeElement.ondelete(); - } else if (isEnterKey(event)) { - if (this.selectedTreeElement.onenter) - handled = this.selectedTreeElement.onenter(); - } else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code) { - if (this.selectedTreeElement.onspace) - handled = this.selectedTreeElement.onspace(); - } + } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* Delete */) + handled = this.selectedTreeElement.ondelete(); + else if (isEnterKey(event)) + handled = this.selectedTreeElement.onenter(); + else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code) + handled = this.selectedTreeElement.onspace(); if (nextSelectedElement) { nextSelectedElement.reveal(); @@ -505,8 +489,7 @@ TreeOutline.prototype._searchInputKeyDown = function(event) } else if (isEnterKey(event)) { var lastSearchMatchElement = this._currentSearchMatchElement; this._searchFinished(); - if (lastSearchMatchElement && lastSearchMatchElement.onenter) - lastSearchMatchElement.onenter(); + lastSearchMatchElement.onenter(); handled = true; } @@ -713,9 +696,6 @@ TreeElement.prototype = { _fireDidChange: function() { delete this._didChangeTimeoutIdentifier; - - if (this.treeOutline) - this.treeOutline._treeElementDidChange(this); }, didChange: function() @@ -773,8 +753,7 @@ TreeElement.prototype._attach = function() this._listItemNode.addEventListener("click", TreeElement.treeElementToggled, false); this._listItemNode.addEventListener("dblclick", TreeElement.treeElementDoubleClicked, false); - if (this.onattach) - this.onattach(this); + this.onattach(); } var nextSibling = null; @@ -840,11 +819,10 @@ TreeElement.treeElementDoubleClicked = function(event) if (!element || !element.treeElement) return; - if (element.treeElement.ondblclick) { - var handled = element.treeElement.ondblclick.call(element.treeElement, event); - if (handled) - return; - } else if (element.treeElement.hasChildren && !element.treeElement.expanded) + var handled = element.treeElement.ondblclick.call(element.treeElement, event); + if (handled) + return; + if (element.treeElement.hasChildren && !element.treeElement.expanded) element.treeElement.expand(); } @@ -860,8 +838,7 @@ TreeElement.prototype.collapse = function() if (this.treeOutline) this.treeOutline._expandedStateMap.put(this.representedObject, false); - if (this.oncollapse) - this.oncollapse(this); + this.oncollapse(); } TreeElement.prototype.collapseRecursively = function() @@ -879,9 +856,9 @@ TreeElement.prototype.expand = function() if (!this.hasChildren || (this.expanded && !this._shouldRefreshChildren && this._childrenListNode)) return; - // Set this before onpopulate. Since onpopulate can add elements and call onadd, this makes + // Set this before onpopulate. Since onpopulate can add elements, this makes // sure the expanded flag is true before calling those functions. This prevents the possibility - // of an infinite loop if onpopulate or onadd were to call expand. + // of an infinite loop if onpopulate were to call expand. this.expanded = true; if (this.treeOutline) @@ -915,8 +892,7 @@ TreeElement.prototype.expand = function() if (this._childrenListNode) this._childrenListNode.classList.add("expanded"); - if (this.onexpand) - this.onexpand(this); + this.onexpand(); } TreeElement.prototype.expandRecursively = function(maxDepth) @@ -962,8 +938,7 @@ TreeElement.prototype.reveal = function() currentAncestor = currentAncestor.parent; } - if (this.onreveal) - this.onreveal(this); + this.onreveal(this); } TreeElement.prototype.revealed = function() @@ -1009,9 +984,7 @@ TreeElement.prototype.select = function(omitFocus, selectedByUser) if (this._listItemNode) this._listItemNode.classList.add("selected"); - if (this.onselect) - return this.onselect(this, selectedByUser); - return false; + return this.onselect(selectedByUser); } /** @@ -1035,16 +1008,21 @@ TreeElement.prototype.deselect = function(supressOnDeselect) this.treeOutline.selectedTreeElement = null; if (this._listItemNode) this._listItemNode.classList.remove("selected"); - - if (this.ondeselect && !supressOnDeselect) - this.ondeselect(this); return true; } -TreeElement.prototype.onpopulate = function() -{ - // Overriden by subclasses. -} +// Overridden by subclasses. +TreeElement.prototype.onpopulate = function() { } +TreeElement.prototype.onenter = function() { } +TreeElement.prototype.ondelete = function() { } +TreeElement.prototype.onspace = function() { } +TreeElement.prototype.onattach = function() { } +TreeElement.prototype.onexpand = function() { } +TreeElement.prototype.oncollapse = function() { } +TreeElement.prototype.ondblclick = function() { } +TreeElement.prototype.onreveal = function() { } +/** @param {boolean} selectedByUser */ +TreeElement.prototype.onselect = function(selectedByUser) { } /** * @param {boolean} skipUnrevealed diff --git a/Source/WebCore/page/ContentSecurityPolicy.cpp b/Source/WebCore/page/ContentSecurityPolicy.cpp index 74bec7bca..a3834faa7 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/ContentSecurityPolicy.cpp @@ -262,6 +262,9 @@ void CSPSourceList::parse(const UChar* begin, const UChar* end) bool isFirstSourceInList = true; while (position < end) { skipWhile<isASCIISpace>(position, end); + if (position == end) + return; + const UChar* beginSource = position; skipWhile<isSourceCharacter>(position, end); diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h index 6ab968e85..7e73150b8 100644 --- a/Source/WebCore/page/FrameView.h +++ b/Source/WebCore/page/FrameView.h @@ -398,23 +398,21 @@ private: // Override ScrollView methods to do point conversion via renderers, in order to // take transforms into account. - virtual IntRect convertToContainingView(const IntRect&) const; - virtual IntRect convertFromContainingView(const IntRect&) const; - virtual IntPoint convertToContainingView(const IntPoint&) const; - virtual IntPoint convertFromContainingView(const IntPoint&) const; + virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE; + virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE; + virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE; + virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE; // ScrollableArea interface - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const; - virtual void getTickmarks(Vector<IntRect>&) const; - virtual void scrollTo(const IntSize&); - virtual void setVisibleScrollerThumbRect(const IntRect&); - virtual bool isOnActivePage() const; - virtual ScrollableArea* enclosingScrollableArea() const; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE; + virtual void scrollTo(const IntSize&) OVERRIDE; + virtual void setVisibleScrollerThumbRect(const IntRect&) OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE; virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; - - void updateScrollableAreaSet(); - + virtual bool scrollAnimatorEnabled() const OVERRIDE; #if USE(ACCELERATED_COMPOSITING) virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE; @@ -424,9 +422,9 @@ private: #endif #endif - virtual void notifyPageThatContentAreaWillPaint() const; + void updateScrollableAreaSet(); - virtual bool scrollAnimatorEnabled() const; + virtual void notifyPageThatContentAreaWillPaint() const; void deferredRepaintTimerFired(Timer<FrameView>*); void doDeferredRepaints(); diff --git a/Source/WebCore/platform/FractionalLayoutUnit.h b/Source/WebCore/platform/FractionalLayoutUnit.h index f6daceac7..c3bd697d0 100644 --- a/Source/WebCore/platform/FractionalLayoutUnit.h +++ b/Source/WebCore/platform/FractionalLayoutUnit.h @@ -36,6 +36,7 @@ #include <math.h> #include <stdlib.h> #include <wtf/MathExtras.h> +#include <wtf/SaturatedArithmetic.h> #if PLATFORM(QT) #include <QDataStream> @@ -63,7 +64,7 @@ static const int kFixedPointDenominator = 60; static const int kFixedPointDenominator = 1; #endif const int intMaxForLayoutUnit = INT_MAX / kFixedPointDenominator; -const int intMinForLayoutUnit = -intMaxForLayoutUnit; +const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator; class FractionalLayoutUnit { public: @@ -73,11 +74,27 @@ public: FractionalLayoutUnit() : m_value(0) { } #if ENABLE(SUBPIXEL_LAYOUT) - FractionalLayoutUnit(int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(unsigned short value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(unsigned int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(float value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(double value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } + FractionalLayoutUnit(int value) { setValue(value); } + FractionalLayoutUnit(unsigned short value) { setValue(value); } + FractionalLayoutUnit(unsigned int value) { setValue(value); } + FractionalLayoutUnit(float value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + m_value = clampTo<float>(value * kFixedPointDenominator, INT_MIN, INT_MAX); +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } + FractionalLayoutUnit(double value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + m_value = clampTo<double>(value * kFixedPointDenominator, INT_MIN, INT_MAX); +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } #else FractionalLayoutUnit(int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value; } FractionalLayoutUnit(unsigned short value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value; } @@ -89,25 +106,42 @@ public: static FractionalLayoutUnit fromFloatCeil(float value) { - REPORT_OVERFLOW(isInBounds(value)); FractionalLayoutUnit v; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + v.m_value = clampToInteger(ceilf(value * kFixedPointDenominator)); +#else + REPORT_OVERFLOW(isInBounds(value)); v.m_value = ceilf(value * kFixedPointDenominator); +#endif return v; } static FractionalLayoutUnit fromFloatFloor(float value) { - REPORT_OVERFLOW(isInBounds(value)); FractionalLayoutUnit v; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + v.m_value = clampToInteger(floorf(value * kFixedPointDenominator)); +#else + REPORT_OVERFLOW(isInBounds(value)); v.m_value = floorf(value * kFixedPointDenominator); +#endif return v; } static FractionalLayoutUnit fromFloatRound(float value) { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) if (value >= 0) + return clamp(value + epsilon() / 2.0f); + return clamp(value - epsilon() / 2.0f); +#else + if (value >= 0) { + REPORT_OVERFLOW(isInBounds(value + epsilon() / 2.0f)); return FractionalLayoutUnit(value + epsilon() / 2.0f); + } + REPORT_OVERFLOW(isInBounds(value - epsilon() / 2.0f)); return FractionalLayoutUnit(value - epsilon() / 2.0f); +#endif } #if ENABLE(SUBPIXEL_LAYOUT) @@ -143,8 +177,8 @@ public: return *this; } - int rawValue() const { return m_value; } - void setRawValue(int value) { m_value = value; } + inline int rawValue() const { return m_value; } + inline void setRawValue(int value) { m_value = value; } void setRawValue(long long value) { REPORT_OVERFLOW(value > std::numeric_limits<int>::min() && value < std::numeric_limits<int>::max()); @@ -214,7 +248,7 @@ public: { return clampTo<FractionalLayoutUnit>(value, FractionalLayoutUnit::min(), FractionalLayoutUnit::max()); } - + private: static bool isInBounds(int value) { @@ -228,6 +262,33 @@ private: { return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator; } + + inline void setValue(int value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + if (value >= intMaxForLayoutUnit) + m_value = std::numeric_limits<int>::max(); + else if (value <= intMinForLayoutUnit) + m_value = std::numeric_limits<int>::min(); + else + m_value = value * kFixedPointDenominator; +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } + inline void setValue(unsigned value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + if (value >= static_cast<unsigned>(intMaxForLayoutUnit)) + m_value = std::numeric_limits<int>::max(); + else + m_value = value * kFixedPointDenominator; +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } int m_value; }; @@ -411,7 +472,9 @@ inline FractionalLayoutUnit boundedMultiply(const FractionalLayoutUnit& a, const inline FractionalLayoutUnit operator*(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { -#if ENABLE(SUBPIXEL_LAYOUT) +#if ENABLE(SUBPIXEL_LAYOUT) && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + return boundedMultiply(a, b); +#elif ENABLE(SUBPIXEL_LAYOUT) FractionalLayoutUnit returnVal; long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kFixedPointDenominator; returnVal.setRawValue(rawVal); @@ -516,7 +579,11 @@ inline FractionalLayoutUnit operator/(unsigned int a, const FractionalLayoutUnit inline FractionalLayoutUnit operator+(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { FractionalLayoutUnit returnVal; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + returnVal.setRawValue(saturatedAddition(a.rawValue(), b.rawValue())); +#else returnVal.setRawValue(a.rawValue() + b.rawValue()); +#endif return returnVal; } @@ -553,7 +620,11 @@ inline double operator+(const double a, const FractionalLayoutUnit& b) inline FractionalLayoutUnit operator-(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { FractionalLayoutUnit returnVal; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + returnVal.setRawValue(saturatedSubtraction(a.rawValue(), b.rawValue())); +#else returnVal.setRawValue(a.rawValue() - b.rawValue()); +#endif return returnVal; } @@ -627,7 +698,11 @@ inline FractionalLayoutUnit operator%(int a, const FractionalLayoutUnit& b) inline FractionalLayoutUnit& operator+=(FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + a.setRawValue(saturatedAddition(a.rawValue(), b.rawValue())); +#else a = a + b; +#endif return a; } @@ -657,7 +732,11 @@ inline FractionalLayoutUnit& operator-=(FractionalLayoutUnit& a, int b) inline FractionalLayoutUnit& operator-=(FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + a.setRawValue(saturatedSubtraction(a.rawValue(), b.rawValue())); +#else a = a - b; +#endif return a; } diff --git a/Source/WebCore/platform/LengthBox.cpp b/Source/WebCore/platform/LengthBox.cpp index 4aa745192..a5205f25c 100644 --- a/Source/WebCore/platform/LengthBox.cpp +++ b/Source/WebCore/platform/LengthBox.cpp @@ -31,23 +31,21 @@ #include "config.h" #include "LengthBox.h" -#include "RenderStyle.h" - namespace WebCore { -Length LengthBox::logicalLeft(const RenderStyle* style) const +Length LengthBox::logicalLeft(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_left : m_top; + return isHorizontalWritingMode(writingMode) ? m_left : m_top; } -Length LengthBox::logicalRight(const RenderStyle* style) const +Length LengthBox::logicalRight(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_right : m_bottom; + return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; } -Length LengthBox::before(const RenderStyle* style) const +Length LengthBox::before(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_top; case BottomToTopWritingMode: @@ -61,9 +59,9 @@ Length LengthBox::before(const RenderStyle* style) const return m_top; } -Length LengthBox::after(const RenderStyle* style) const +Length LengthBox::after(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_bottom; case BottomToTopWritingMode: @@ -77,18 +75,18 @@ Length LengthBox::after(const RenderStyle* style) const return m_bottom; } -Length LengthBox::start(const RenderStyle* style) const +Length LengthBox::start(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_left : m_right; - return style->isLeftToRightDirection() ? m_top : m_bottom; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_left : m_right; + return isLeftToRightDirection(direction) ? m_top : m_bottom; } -Length LengthBox::end(const RenderStyle* style) const +Length LengthBox::end(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_right : m_left; - return style->isLeftToRightDirection() ? m_bottom : m_top; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_right : m_left; + return isLeftToRightDirection(direction) ? m_bottom : m_top; } } // namespace WebCore diff --git a/Source/WebCore/platform/LengthBox.h b/Source/WebCore/platform/LengthBox.h index 389cb66f8..d5dfc13bd 100644 --- a/Source/WebCore/platform/LengthBox.h +++ b/Source/WebCore/platform/LengthBox.h @@ -23,6 +23,8 @@ #define LengthBox_h #include "Length.h" +#include "TextDirection.h" +#include "WritingMode.h" namespace WebCore { @@ -70,13 +72,13 @@ struct LengthBox { Length top() const { return m_top; } Length bottom() const { return m_bottom; } - Length logicalLeft(const RenderStyle*) const; - Length logicalRight(const RenderStyle*) const; + Length logicalLeft(WritingMode) const; + Length logicalRight(WritingMode) const; - Length before(const RenderStyle*) const; - Length after(const RenderStyle*) const; - Length start(const RenderStyle*) const; - Length end(const RenderStyle*) const; + Length before(WritingMode) const; + Length after(WritingMode) const; + Length start(WritingMode, TextDirection) const; + Length end(WritingMode, TextDirection) const; bool operator==(const LengthBox& o) const { diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h index 81a56b251..2cbcc270e 100644 --- a/Source/WebCore/platform/ScrollView.h +++ b/Source/WebCore/platform/ScrollView.h @@ -52,13 +52,14 @@ class ScrollView : public Widget, public ScrollableArea { public: ~ScrollView(); - // ScrollableArea functions. FrameView overrides the others. - virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual int scrollPosition(Scrollbar*) const; - virtual void setScrollOffset(const IntPoint&); + // ScrollableArea functions. + virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const IntPoint&) OVERRIDE; + virtual bool isScrollCornerVisible() const OVERRIDE; + virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE; + virtual void notifyPageThatContentAreaWillPaint() const; - virtual bool isScrollCornerVisible() const; - virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate); // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. virtual void scrollTo(const IntSize& newOffset); @@ -74,11 +75,11 @@ public: const HashSet<RefPtr<Widget> >* children() const { return &m_children; } virtual void addChild(PassRefPtr<Widget>); virtual void removeChild(Widget*); - + // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions // can be used to obtain those scrollbars. - virtual Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); } - virtual Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); } + virtual Scrollbar* horizontalScrollbar() const OVERRIDE { return m_horizontalScrollbar.get(); } + virtual Scrollbar* verticalScrollbar() const OVERRIDE { return m_verticalScrollbar.get(); } bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; } void positionScrollbarLayers(); @@ -107,7 +108,7 @@ public: virtual bool avoidScrollbarCreation() const { return false; } - virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle); + virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle) OVERRIDE; // By default you only receive paint events for the area that is visible. In the case of using a // tiled backing store, this function can be set, so that the view paints the entire contents. @@ -143,12 +144,12 @@ public: // In the situation the client is responsible for the scrolling (ie. with a tiled backing store) it is possible to use // the setFixedVisibleContentRect instead for the mainframe, though this must be updated manually, e.g just before resuming the page // which usually will happen when panning, pinching and rotation ends, or when scale or position are changed manually. - virtual IntRect visibleContentRect(bool includeScrollbars = false) const; + virtual IntRect visibleContentRect(bool includeScrollbars = false) const OVERRIDE; virtual void setFixedVisibleContentRect(const IntRect& visibleContentRect) { m_fixedVisibleContentRect = visibleContentRect; } IntRect fixedVisibleContentRect() const { return m_fixedVisibleContentRect; } IntSize visibleSize() const { return visibleContentRect().size(); } - int visibleWidth() const { return visibleContentRect().width(); } - int visibleHeight() const { return visibleContentRect().height(); } + virtual int visibleWidth() const OVERRIDE { return visibleContentRect().width(); } + virtual int visibleHeight() const OVERRIDE { return visibleContentRect().height(); } // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead. @@ -162,22 +163,22 @@ public: // Functions for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height // values). - IntSize contentsSize() const; // Always at least as big as the visibleWidth()/visibleHeight(). + virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as the visibleWidth()/visibleHeight(). int contentsWidth() const { return contentsSize().width(); } int contentsHeight() const { return contentsSize().height(); } virtual void setContentsSize(const IntSize&); // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values). - IntPoint scrollPosition() const { return visibleContentRect().location(); } + virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect().location(); } IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes. - IntPoint maximumScrollPosition() const; // The maximum position we can be scrolled to. - IntPoint minimumScrollPosition() const; // The minimum position we can be scrolled to. + virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum position we can be scrolled to. + virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum position we can be scrolled to. // Adjust the passed in scroll position to keep it between the minimum and maximum positions. IntPoint adjustScrollPositionWithinRange(const IntPoint&) const; int scrollX() const { return scrollPosition().x(); } int scrollY() const { return scrollPosition().y(); } - IntSize overhangAmount() const; + virtual IntSize overhangAmount() const OVERRIDE; void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(); } IntPoint cachedScrollPosition() const { return m_cachedScrollPosition; } @@ -277,10 +278,10 @@ public: virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&); - virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const; - virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; - virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; - virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; + virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const OVERRIDE; + virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const OVERRIDE; bool containsScrollableAreaWithOverlayScrollbars() const { return m_containsScrollableAreaWithOverlayScrollbars; } void setContainsScrollableAreaWithOverlayScrollbars(bool contains) { m_containsScrollableAreaWithOverlayScrollbars = contains; } @@ -302,7 +303,7 @@ protected: void setHasVerticalScrollbar(bool); virtual void updateScrollCorner(); - virtual void invalidateScrollCornerRect(const IntRect&); + virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE; // Scroll the content by blitting the pixels. virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp index 103e03899..b4e7e5591 100644 --- a/Source/WebCore/platform/ScrollableArea.cpp +++ b/Source/WebCore/platform/ScrollableArea.cpp @@ -373,4 +373,39 @@ void ScrollableArea::serviceScrollAnimations() scrollAnimator->serviceScrollAnimations(); } +IntPoint ScrollableArea::scrollPosition() const +{ + int x = horizontalScrollbar() ? horizontalScrollbar()->value() : 0; + int y = verticalScrollbar() ? verticalScrollbar()->value() : 0; + return IntPoint(x, y); +} + +IntPoint ScrollableArea::minimumScrollPosition() const +{ + return IntPoint(); +} + +IntPoint ScrollableArea::maximumScrollPosition() const +{ + return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().height() - visibleHeight()); +} + +IntRect ScrollableArea::visibleContentRect(bool includeScrollbars) const +{ + int verticalScrollbarWidth = 0; + int horizontalScrollbarHeight = 0; + + if (includeScrollbars) { + if (Scrollbar* verticalBar = verticalScrollbar()) + verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0; + if (Scrollbar* horizontalBar = horizontalScrollbar()) + horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0; + } + + return IntRect(scrollPosition().x(), + scrollPosition().y(), + std::max(0, visibleWidth() + verticalScrollbarWidth), + std::max(0, visibleHeight() + horizontalScrollbarHeight)); +} + } // namespace WebCore diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h index 5a278a9b5..721ec32ec 100644 --- a/Source/WebCore/platform/ScrollableArea.h +++ b/Source/WebCore/platform/ScrollableArea.h @@ -133,27 +133,27 @@ public: virtual Scrollbar* horizontalScrollbar() const { return 0; } virtual Scrollbar* verticalScrollbar() const { return 0; } - virtual IntPoint scrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); } - virtual IntPoint minimumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); } - virtual IntPoint maximumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); } - virtual IntRect visibleContentRect(bool /*includeScrollbars*/ = false) const { ASSERT_NOT_REACHED(); return IntRect(); } - virtual int visibleHeight() const { ASSERT_NOT_REACHED(); return 0; } - virtual int visibleWidth() const { ASSERT_NOT_REACHED(); return 0; } - virtual IntSize contentsSize() const { ASSERT_NOT_REACHED(); return IntSize(); } - virtual IntSize overhangAmount() const { ASSERT_NOT_REACHED(); return IntSize(); } + virtual IntPoint scrollPosition() const; + virtual IntPoint minimumScrollPosition() const; + virtual IntPoint maximumScrollPosition() const; + virtual IntRect visibleContentRect(bool /*includeScrollbars*/ = false) const; + virtual int visibleHeight() const = 0; + virtual int visibleWidth() const = 0; + virtual IntSize contentsSize() const = 0; + virtual IntSize overhangAmount() const { return IntSize(); } virtual IntPoint currentMousePosition() const { return IntPoint(); } virtual bool shouldSuspendScrollAnimations() const { return true; } virtual void scrollbarStyleChanged(int /*newStyle*/, bool /*forceUpdate*/) { } virtual void setVisibleScrollerThumbRect(const IntRect&) { } - virtual bool isOnActivePage() const { ASSERT_NOT_REACHED(); return true; } + virtual bool isOnActivePage() const = 0; // Note that this only returns scrollable areas that can actually be scrolled. virtual ScrollableArea* enclosingScrollableArea() const = 0; // Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view. - virtual IntRect scrollableAreaBoundingBox() const { ASSERT_NOT_REACHED(); return IntRect(); } + virtual IntRect scrollableAreaBoundingBox() const = 0; virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; } diff --git a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp index 09f185a9f..b2bfbea5e 100644 --- a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp +++ b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp @@ -129,6 +129,11 @@ TouchpadFlingPlatformGestureCurve::~TouchpadFlingPlatformGestureCurve() { } +const char* TouchpadFlingPlatformGestureCurve::debugName() const +{ + return "TouchpadFling"; +} + bool TouchpadFlingPlatformGestureCurve::apply(double time, PlatformGestureCurveTarget* target) { float displacement; diff --git a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h index 46b0aa5b6..e1c85575d 100644 --- a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h +++ b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h @@ -44,8 +44,8 @@ public: static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, float p0, float p1, float p2, float p3, float p4, float curveDuration, IntPoint cumulativeScroll = IntPoint()); virtual ~TouchpadFlingPlatformGestureCurve(); - virtual const char* debugName() const { return "TouchpadFling"; } - virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*); + virtual const char* debugName() const OVERRIDE; + virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*) OVERRIDE; private: TouchpadFlingPlatformGestureCurve(const FloatPoint& velocity, float p0, float p1, float p2, float p3, float p4, float curveDuration, const IntPoint& cumulativeScroll); diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp index c9f173289..73ffc381d 100644 --- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp +++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp @@ -46,6 +46,11 @@ WheelFlingPlatformGestureCurve::~WheelFlingPlatformGestureCurve() { } +const char* WheelFlingPlatformGestureCurve::debugName() const +{ + return "WheelFling"; +} + bool WheelFlingPlatformGestureCurve::apply(double time, PlatformGestureCurveTarget* target) { // Use a Rayleigh distribution for the curve. This simulates a velocity profile diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h index 44d552a86..96cfaca1a 100644 --- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h +++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h @@ -43,8 +43,8 @@ public: static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity); virtual ~WheelFlingPlatformGestureCurve(); - virtual const char* debugName() const { return "WheelFling"; } - virtual bool apply(double time, PlatformGestureCurveTarget*); + virtual const char* debugName() const OVERRIDE; + virtual bool apply(double time, PlatformGestureCurveTarget*) OVERRIDE; private: explicit WheelFlingPlatformGestureCurve(const FloatPoint& velocity); diff --git a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp index 29e81fc74..0572cc45c 100644 --- a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp +++ b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp @@ -60,7 +60,6 @@ static void destroyAudioBufferList(AudioBufferList* bufferList) AudioFileReader::AudioFileReader(const char* filePath) : m_data(0) , m_dataSize(0) - , m_filePath(filePath) , m_audioFileID(0) , m_extAudioFileRef(0) { @@ -75,7 +74,6 @@ AudioFileReader::AudioFileReader(const char* filePath) AudioFileReader::AudioFileReader(const void* data, size_t dataSize) : m_data(data) , m_dataSize(dataSize) - , m_filePath(0) , m_audioFileID(0) , m_extAudioFileRef(0) { diff --git a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h index 212343149..60af2f157 100644 --- a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h +++ b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h @@ -57,7 +57,6 @@ private: const void* m_data; size_t m_dataSize; - const char* m_filePath; AudioFileID m_audioFileID; ExtAudioFileRef m_extAudioFileRef; diff --git a/Source/WebCore/platform/blackberry/CookieParser.cpp b/Source/WebCore/platform/blackberry/CookieParser.cpp index e29ea28bd..2564c568e 100644 --- a/Source/WebCore/platform/blackberry/CookieParser.cpp +++ b/Source/WebCore/platform/blackberry/CookieParser.cpp @@ -29,7 +29,7 @@ #include "Logging.h" #include "ParsedCookie.h" -#include <network/TopLevelDomain.h> +#include <network/DomainTools.h> #include <wtf/CurrentTime.h> #include <wtf/text/CString.h> @@ -274,7 +274,7 @@ ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start, // Check whether the domain is a top level domain, if it is throw it out // http://publicsuffix.org/list/ - if (!BlackBerry::Platform::TopLevelDomain::isCookieWritableDomain(realDomain.utf8().data())) + if (BlackBerry::Platform::isTopLevelDomain(realDomain.utf8().data())) LOG_AND_DELETE("Invalid cookie %s (domain): it did not pass the top level domain check", cookie.ascii().data()); res->setDomain(realDomain); diff --git a/Source/WebCore/platform/chromium/FramelessScrollView.cpp b/Source/WebCore/platform/chromium/FramelessScrollView.cpp index 73bec0df8..c410677cb 100644 --- a/Source/WebCore/platform/chromium/FramelessScrollView.cpp +++ b/Source/WebCore/platform/chromium/FramelessScrollView.cpp @@ -63,6 +63,16 @@ ScrollableArea* FramelessScrollView::enclosingScrollableArea() const return 0; } +bool FramelessScrollView::isOnActivePage() const +{ + return isActive(); +} + +IntRect FramelessScrollView::scrollableAreaBoundingBox() const +{ + return windowClipRect(false); +} + void FramelessScrollView::invalidateRect(const IntRect& rect) { if (HostWindow* h = hostWindow()) diff --git a/Source/WebCore/platform/chromium/FramelessScrollView.h b/Source/WebCore/platform/chromium/FramelessScrollView.h index 3498475dc..ac1eecd1c 100644 --- a/Source/WebCore/platform/chromium/FramelessScrollView.h +++ b/Source/WebCore/platform/chromium/FramelessScrollView.h @@ -74,9 +74,11 @@ namespace WebCore { #endif // ScrollableArea public methods: - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const; - virtual ScrollableArea* enclosingScrollableArea() const; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // Widget public methods: virtual void invalidateRect(const IntRect&); diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp index e4e545a1b..f1c4e5b6f 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp @@ -31,33 +31,31 @@ #include "config.h" #include "FractionalLayoutBoxExtent.h" -#include "RenderStyle.h" - namespace WebCore { -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_top : m_left; + return isHorizontalWritingMode(writingMode) ? m_top : m_left; } -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_bottom : m_right; + return isHorizontalWritingMode(writingMode) ? m_bottom : m_right; } -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_left : m_top; + return isHorizontalWritingMode(writingMode) ? m_left : m_top; } -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalRight(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalRight(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_right : m_bottom; + return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; } -FractionalLayoutUnit FractionalLayoutBoxExtent::before(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::before(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_top; case BottomToTopWritingMode: @@ -71,9 +69,9 @@ FractionalLayoutUnit FractionalLayoutBoxExtent::before(const RenderStyle* style) return m_top; } -FractionalLayoutUnit FractionalLayoutBoxExtent::after(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::after(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_bottom; case BottomToTopWritingMode: @@ -87,23 +85,23 @@ FractionalLayoutUnit FractionalLayoutBoxExtent::after(const RenderStyle* style) return m_bottom; } -FractionalLayoutUnit FractionalLayoutBoxExtent::start(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::start(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_left : m_right; - return style->isLeftToRightDirection() ? m_top : m_bottom; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_left : m_right; + return isLeftToRightDirection(direction) ? m_top : m_bottom; } -FractionalLayoutUnit FractionalLayoutBoxExtent::end(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::end(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_right : m_left; - return style->isLeftToRightDirection() ? m_bottom : m_top; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_right : m_left; + return isLeftToRightDirection(direction) ? m_bottom : m_top; } -void FractionalLayoutBoxExtent::setBefore(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setBefore(WritingMode writingMode, FractionalLayoutUnit value) { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: m_top = value; break; @@ -122,9 +120,9 @@ void FractionalLayoutBoxExtent::setBefore(const RenderStyle* style, FractionalLa } } -void FractionalLayoutBoxExtent::setAfter(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setAfter(WritingMode writingMode, FractionalLayoutUnit value) { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: m_bottom = value; break; @@ -143,56 +141,56 @@ void FractionalLayoutBoxExtent::setAfter(const RenderStyle* style, FractionalLay } } -void FractionalLayoutBoxExtent::setStart(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setStart(WritingMode writingMode, TextDirection direction, FractionalLayoutUnit value) { - if (style->isHorizontalWritingMode()) { - if (style->isLeftToRightDirection()) + if (isHorizontalWritingMode(writingMode)) { + if (isLeftToRightDirection(direction)) m_left = value; else m_right = value; } else { - if (style->isLeftToRightDirection()) + if (isLeftToRightDirection(direction)) m_top = value; else m_bottom = value; } } -void FractionalLayoutBoxExtent::setEnd(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setEnd(WritingMode writingMode, TextDirection direction, FractionalLayoutUnit value) { - if (style->isHorizontalWritingMode()) { - if (style->isLeftToRightDirection()) + if (isHorizontalWritingMode(writingMode)) { + if (isLeftToRightDirection(direction)) m_right = value; else m_left = value; } else { - if (style->isLeftToRightDirection()) + if (isLeftToRightDirection(direction)) m_bottom = value; else m_top = value; } } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalLeft(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalLeft(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? m_left : m_top; + return isHorizontalWritingMode(writingMode) ? m_left : m_top; } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalRight(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalRight(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? m_right : m_bottom; + return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableBefore(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableBefore(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? (style->isFlippedBlocksWritingMode() ? m_bottom : m_top) : - (style->isFlippedBlocksWritingMode() ? m_right: m_left); + return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_bottom : m_top) : + (isFlippedBlocksWritingMode(writingMode) ? m_right: m_left); } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableAfter(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableAfter(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? (style->isFlippedBlocksWritingMode() ? m_top : m_bottom) : - (style->isFlippedBlocksWritingMode() ? m_left: m_right); + return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_top : m_bottom) : + (isFlippedBlocksWritingMode(writingMode) ? m_left: m_right); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h index 921c84b90..28bdb9cd7 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h @@ -32,11 +32,11 @@ #define FractionalLayoutBoxExtent_h #include "FractionalLayoutUnit.h" +#include "TextDirection.h" +#include "WritingMode.h" namespace WebCore { -class RenderStyle; - class FractionalLayoutBoxExtent { public: FractionalLayoutBoxExtent() : m_top(0), m_right(0), m_bottom(0), m_left(0) { } @@ -53,26 +53,26 @@ public: inline void setBottom(FractionalLayoutUnit value) { m_bottom = value; } inline void setLeft(FractionalLayoutUnit value) { m_left = value; } - FractionalLayoutUnit logicalTop(const RenderStyle*) const; - FractionalLayoutUnit logicalBottom(const RenderStyle*) const; - FractionalLayoutUnit logicalLeft(const RenderStyle*) const; - FractionalLayoutUnit logicalRight(const RenderStyle*) const; + FractionalLayoutUnit logicalTop(WritingMode) const; + FractionalLayoutUnit logicalBottom(WritingMode) const; + FractionalLayoutUnit logicalLeft(WritingMode) const; + FractionalLayoutUnit logicalRight(WritingMode) const; - FractionalLayoutUnit before(const RenderStyle*) const; - FractionalLayoutUnit after(const RenderStyle*) const; - FractionalLayoutUnit start(const RenderStyle*) const; - FractionalLayoutUnit end(const RenderStyle*) const; + FractionalLayoutUnit before(WritingMode) const; + FractionalLayoutUnit after(WritingMode) const; + FractionalLayoutUnit start(WritingMode, TextDirection) const; + FractionalLayoutUnit end(WritingMode, TextDirection) const; - void setBefore(const RenderStyle*, FractionalLayoutUnit); - void setAfter(const RenderStyle*, FractionalLayoutUnit); - void setStart(const RenderStyle*, FractionalLayoutUnit); - void setEnd(const RenderStyle*, FractionalLayoutUnit); + void setBefore(WritingMode, FractionalLayoutUnit); + void setAfter(WritingMode, FractionalLayoutUnit); + void setStart(WritingMode, TextDirection, FractionalLayoutUnit); + void setEnd(WritingMode, TextDirection, FractionalLayoutUnit); - FractionalLayoutUnit& mutableLogicalLeft(const RenderStyle*); - FractionalLayoutUnit& mutableLogicalRight(const RenderStyle*); + FractionalLayoutUnit& mutableLogicalLeft(WritingMode); + FractionalLayoutUnit& mutableLogicalRight(WritingMode); - FractionalLayoutUnit& mutableBefore(const RenderStyle*); - FractionalLayoutUnit& mutableAfter(const RenderStyle*); + FractionalLayoutUnit& mutableBefore(WritingMode); + FractionalLayoutUnit& mutableAfter(WritingMode); private: FractionalLayoutUnit m_top; diff --git a/Source/WebCore/platform/graphics/Image.cpp b/Source/WebCore/platform/graphics/Image.cpp index 2b19f1349..655b6d14f 100644 --- a/Source/WebCore/platform/graphics/Image.cpp +++ b/Source/WebCore/platform/graphics/Image.cpp @@ -80,7 +80,7 @@ bool Image::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived) void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, ColorSpace styleColorSpace, CompositeOperator op) { - if (color.alpha() <= 0) + if (!color.alpha()) return; CompositeOperator previousOperator = ctxt->compositeOperation(); diff --git a/Source/WebCore/platform/graphics/ImageSource.h b/Source/WebCore/platform/graphics/ImageSource.h index 40d757fa0..78f0de8ce 100644 --- a/Source/WebCore/platform/graphics/ImageSource.h +++ b/Source/WebCore/platform/graphics/ImageSource.h @@ -153,8 +153,11 @@ public: private: NativeImageSourcePtr m_decoder; + +#if !USE(CG) AlphaOption m_alphaOption; GammaAndColorProfileOption m_gammaAndColorProfileOption; +#endif #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) static unsigned s_maxPixelsPerDecodedImage; #endif diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h index de692227c..eac345c17 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.h +++ b/Source/WebCore/platform/graphics/MediaPlayer.h @@ -98,6 +98,7 @@ class IntSize; class MediaPlayer; struct MediaPlayerFactory; class TimeRanges; +class HostWindow; #if PLATFORM(WIN) && USE(AVFOUNDATION) struct GraphicsDeviceAdapter; @@ -189,6 +190,15 @@ public: virtual String mediaPlayerReferrer() const { return String(); } virtual String mediaPlayerUserAgent() const { return String(); } virtual CORSMode mediaPlayerCORSMode() const { return Unspecified; } + virtual void mediaPlayerExitFullscreen() { } + virtual bool mediaPlayerIsVideo() const { return false; } + virtual LayoutRect mediaPlayerContentBoxRect() const { return LayoutRect(); } + virtual void mediaPlayerSetSize(const IntSize&) { } + virtual void mediaPlayerPause() { } + virtual void mediaPlayerPlay() { } + virtual bool mediaPlayerIsPaused() const { return true; } + virtual HostWindow* mediaPlayerHostWindow() { return 0; } + virtual IntRect mediaPlayerWindowClipRect() { return IntRect(); } }; class MediaPlayerSupportsTypeClient { diff --git a/Source/WebCore/platform/graphics/SimpleFontData.h b/Source/WebCore/platform/graphics/SimpleFontData.h index c0b044d2c..820c26573 100644 --- a/Source/WebCore/platform/graphics/SimpleFontData.h +++ b/Source/WebCore/platform/graphics/SimpleFontData.h @@ -39,7 +39,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/text/StringHash.h> -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN)) #include <wtf/RetainPtr.h> #endif @@ -176,7 +176,7 @@ public: NSFont* getNSFont() const { return m_platformData.nsFont(); } #endif -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN)) CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; #endif @@ -273,7 +273,7 @@ private: float m_syntheticBoldOffset; #endif -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN)) mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport; #endif diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h index 0fe6131d6..d44a30c73 100644 --- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h +++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h @@ -124,7 +124,6 @@ private: void paintWithVideoOutput(GraphicsContext*, const IntRect&); #endif - MediaPlayer* m_player; RetainPtr<AVAsset> m_avAsset; RetainPtr<AVPlayer> m_avPlayer; RetainPtr<AVPlayerItem> m_avPlayerItem; diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp index 6fad26e53..d7f9acba6 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp @@ -27,7 +27,6 @@ #include "Frame.h" #include "FrameView.h" #include "GraphicsContext.h" -#include "HTMLMediaElement.h" #include "HTMLNames.h" #include "HostWindow.h" #include "MediaStreamDescriptor.h" @@ -122,8 +121,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) MediaPlayerPrivate::~MediaPlayerPrivate() { if (isFullscreen()) { - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - element->exitFullscreen(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerExitFullscreen(); } #if USE(ACCELERATED_COMPOSITING) // Remove media player from platform layer. @@ -151,9 +149,7 @@ void MediaPlayerPrivate::load(const String& url) modifiedUrl = decodeURLEscapeSequences(modifiedUrl); } - void* tabId = 0; - if (frameView() && frameView()->hostWindow()) - tabId = frameView()->hostWindow()->platformPageClient(); + void* tabId = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient(); deleteGuardedObject(m_platformPlayer); #if USE(ACCELERATED_COMPOSITING) @@ -370,7 +366,7 @@ void MediaPlayerPrivate::paintCurrentFrameInContext(GraphicsContext* context, co ASSERT(graphics); BlackBerry::Platform::IntRect platformRect(rect.x(), rect.y(), rect.width(), rect.height()); - IntRect clippedRect = frameView()->windowClipRect(); + IntRect clippedRect = m_webCorePlayer->mediaPlayerClient()->mediaPlayerWindowClipRect(); BlackBerry::Platform::IntRect platformWindowClipRect(clippedRect.x(), clippedRect.y(), clippedRect.width(), clippedRect.height()); m_platformPlayer->paint(graphics->canvas(), platformRect, platformWindowClipRect); } @@ -399,39 +395,27 @@ void MediaPlayerPrivate::resizeSourceDimensions() if (!m_webCorePlayer) return; - HTMLMediaElement* client = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - - if (!client || !client->isVideo()) - return; - - RenderObject* o = client->renderer(); - if (!o) + if (!m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsVideo()) return; // If we have an HTMLVideoElement but the source has no video, then we need to resize the media element. if (!hasVideo()) { - IntRect rect = o->enclosingBox()->contentBoxRect(); + LayoutRect rect = m_webCorePlayer->mediaPlayerClient()->mediaPlayerContentBoxRect(); static const int playbookMinAudioElementWidth = 300; static const int playbookMinAudioElementHeight = 32; // If the rect dimensions are less than the allowed minimum, use the minimum instead. - int newWidth = max(rect.width(), playbookMinAudioElementWidth); - int newHeight = max(rect.height(), playbookMinAudioElementHeight); - - char attrString[12]; + int newWidth = max(rect.width().toInt(), playbookMinAudioElementWidth); + int newHeight = max(rect.height().toInt(), playbookMinAudioElementHeight); - sprintf(attrString, "%d", newWidth); - client->setAttribute(HTMLNames::widthAttr, attrString); - - sprintf(attrString, "%d", newHeight); - client->setAttribute(HTMLNames::heightAttr, attrString); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerSetSize(IntSize(newWidth, newHeight)); } // If we don't know what the width and height of the video source is, then we need to set it to something sane. if (m_platformPlayer->sourceWidth() && m_platformPlayer->sourceHeight()) return; - IntRect rect = o->enclosingBox()->contentBoxRect(); - m_platformPlayer->setSourceDimension(rect.width(), rect.height()); + LayoutRect rect = m_webCorePlayer->mediaPlayerClient()->mediaPlayerContentBoxRect(); + m_platformPlayer->setSourceDimension(rect.width().toUnsigned(), rect.height().toUnsigned()); } void MediaPlayerPrivate::setFullscreenWebPageClient(BlackBerry::WebKit::WebPageClient* client) @@ -511,8 +495,6 @@ void MediaPlayerPrivate::updateStates() PlatformPlayer::Error currentError = m_platformPlayer->error(); - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - if (currentError != PlatformPlayer::MediaOK) { m_readyState = MediaPlayer::HaveNothing; if (currentError == PlatformPlayer::MediaDecodeError) @@ -549,7 +531,7 @@ void MediaPlayerPrivate::updateStates() } #endif if (isFullscreen()) - element->exitFullscreen(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerExitFullscreen(); break; case PlatformPlayer::MP_STATE_ACTIVE: #if USE(ACCELERATED_COMPOSITING) @@ -608,15 +590,14 @@ void MediaPlayerPrivate::onPauseStateChanged() if (!isFullscreen()) return; - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); // Paused state change not due to local controller. if (m_platformPlayer->isPaused()) - element->pause(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPause(); else { // The HMI fullscreen widget has resumed play. Check if the // pause timeout occurred. m_platformPlayer->processPauseTimeoutIfNecessary(); - element->play(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPlay(); } } @@ -644,14 +625,12 @@ void MediaPlayerPrivate::onSizeChanged() void MediaPlayerPrivate::onPlayNotified() { - if (HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient())) - element->play(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPlay(); } void MediaPlayerPrivate::onPauseNotified() { - if (HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient())) - element->pause(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPause(); } static const int popupDialogInterval = 10; @@ -726,8 +705,8 @@ bool MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge) Credential credential = CredentialStorage::get(protectionSpace); bool isConfirmed = false; if (credential.isEmpty()) { - if (frameView() && frameView()->hostWindow()) - isConfirmed = frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential); + isConfirmed = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential); + } else isConfirmed = true; @@ -783,11 +762,7 @@ int MediaPlayerPrivate::showErrorDialog(PlatformPlayer::Error type) LOG(Media, "Alert type does not exist."); return -1; } - - int rc = 0; - if (frameView() && frameView()->hostWindow()) - rc = frameView()->hostWindow()->platformPageClient()->showAlertDialog(atype); - return rc; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->showAlertDialog(atype); } static WebMediaStreamSource toWebMediaStreamSource(MediaStreamSource* src) @@ -817,23 +792,9 @@ WebMediaStreamDescriptor MediaPlayerPrivate::lookupMediaStream(const string& url return toWebMediaStreamDescriptor(descriptor); } -FrameView* MediaPlayerPrivate::frameView() const -{ - // We previously used m_webCorePlayer->frameView(), but this method returns - // a null frameView until quite late in the media player initialization, - // and starting quite early in the media player destruction (because - // it may be set to zero by the destructor in RenderVideo.cpp before - // our destructor is called, leaving us unable to clean up child windows - // in mmrDisconnect). - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - return element->document()->view(); -} - BlackBerry::Platform::Graphics::Window* MediaPlayerPrivate::platformWindow() { - if (frameView() && frameView()->hostWindow()) - return frameView()->hostWindow()->platformPageClient()->platformWindow(); - return 0; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->platformWindow(); } bool MediaPlayerPrivate::isFullscreen() const @@ -843,17 +804,12 @@ bool MediaPlayerPrivate::isFullscreen() const bool MediaPlayerPrivate::isElementPaused() const { - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - if (!element || element->paused()) - return true; - return false; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsPaused(); } bool MediaPlayerPrivate::isTabVisible() const { - if (frameView() && frameView()->hostWindow()) - return frameView()->hostWindow()->platformPageClient()->isVisible(); - return true; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->isVisible(); } #if USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h index 40156fbb7..570741ce2 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h @@ -145,7 +145,6 @@ public: private: MediaPlayerPrivate(MediaPlayer*); - FrameView* frameView() const; void updateStates(); String userAgent(const String&) const; diff --git a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp index 7cf02968e..b00666759 100644 --- a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -70,12 +70,10 @@ void sharedBufferRelease(void* info) } #endif -ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption) +ImageSource::ImageSource(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption) : m_decoder(0) - // FIXME: m_premultiplyAlpha is ignored in cg at the moment. - , m_alphaOption(alphaOption) - , m_gammaAndColorProfileOption(gammaAndColorProfileOption) { + // FIXME: AlphaOption and GammaAndColorProfileOption are ignored. } ImageSource::~ImageSource() diff --git a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp b/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp index 63cff30d9..8064ae38e 100644 --- a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp +++ b/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp @@ -123,16 +123,16 @@ WebTransformOperations toWebTransformOperations(const TransformOperations& trans } template <class Value, class Keyframe, class Curve> -bool appendKeyframeWithStandardTimingFunction(Curve& curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&) +bool appendKeyframeWithStandardTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&) { - curve.add(Keyframe(keyTime, value->value()), timingFunctionType); + curve->add(Keyframe(keyTime, value->value()), timingFunctionType); return true; } template <class Value, class Keyframe, class Curve> -bool appendKeyframeWithCustomBezierTimingFunction(Curve& curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&) +bool appendKeyframeWithCustomBezierTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&) { - curve.add(Keyframe(keyTime, value->value()), x1, y1, x2, y2); + curve->add(Keyframe(keyTime, value->value()), x1, y1, x2, y2); return true; } @@ -185,28 +185,28 @@ bool causesRotationOfAtLeast180Degrees(const TransformAnimationValue* value, con } template <> -bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve& curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize) +bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize) { if (causesRotationOfAtLeast180Degrees(value, lastValue)) return false; WebTransformOperations operations = toWebTransformOperations(*value->value(), boxSize); if (operations.apply().isInvertible()) { - curve.add(WebTransformKeyframe(keyTime, operations), timingFunctionType); + curve->add(WebTransformKeyframe(keyTime, operations), timingFunctionType); return true; } return false; } template <> -bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve& curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize) +bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize) { if (causesRotationOfAtLeast180Degrees(value, lastValue)) return false; WebTransformOperations operations = toWebTransformOperations(*value->value(), boxSize); if (operations.apply().isInvertible()) { - curve.add(WebTransformKeyframe(keyTime, operations), x1, y1, x2, y2); + curve->add(WebTransformKeyframe(keyTime, operations), x1, y1, x2, y2); return true; } return false; @@ -225,7 +225,7 @@ PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val reverse = true; } - Curve curve; + OwnPtr<Curve> curve = adoptPtr(Curve::create()); for (size_t i = 0; i < valueList.size(); i++) { size_t index = reverse ? valueList.size() - i - 1 : i; @@ -277,14 +277,14 @@ PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val bool addedKeyframe = false; if (isUsingCustomBezierTimingFunction) - addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize); + addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve.get(), keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize); else - addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize); + addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve.get(), keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize); if (!addedKeyframe) return nullptr; } - OwnPtr<WebKit::WebAnimation> anim(adoptPtr(WebKit::WebAnimation::create(curve, animationId, groupId, targetProperty))); + OwnPtr<WebKit::WebAnimation> anim(adoptPtr(WebKit::WebAnimation::create(*curve, animationId, groupId, targetProperty))); int iterations = (animation && animation->isIterationCountSet()) ? animation->iterationCount() : 1; anim->setIterations(iterations); diff --git a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp index 10654312c..ed332b187 100644 --- a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp +++ b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp @@ -27,10 +27,10 @@ #include "Canvas2DLayerBridge.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GrContext.h" #include "GraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" -#include "LayerRendererChromium.h" // For GLC() macro. #include "TraceEvent.h" #include <public/WebCompositor.h> #include <public/WebGraphicsContext3D.h> @@ -166,4 +166,3 @@ unsigned Canvas2DLayerBridge::backBufferTexture() } } - diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index a8f57e296..c2bf45ead 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -117,7 +117,7 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); m_textureUpdater->setOpaque(opaque()); - GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } diff --git a/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp b/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp index 67ab4624f..960ef958e 100644 --- a/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp +++ b/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp @@ -29,8 +29,8 @@ #include "GeometryBinding.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include <public/WebGraphicsContext3D.h> namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp index 7d5591be3..cf4435bda 100644 --- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp @@ -597,16 +597,17 @@ void GraphicsLayerChromium::setDebugBorder(const Color& color, float borderWidth void GraphicsLayerChromium::updateChildList() { - Vector<WebLayer*> newChildren; + WebLayer* childHost = m_transformLayer ? m_transformLayer.get() : m_layer->layer(); + childHost->removeAllChildren(); if (m_transformLayer) { // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind. - newChildren.append(m_layer->layer()); + childHost->addChild(m_layer->layer()); } else if (m_contentsLayer) { // FIXME: add the contents layer in the correct order with negative z-order children. // This does not cause visible rendering issues because currently contents layers are only used // for replaced elements that don't have children. - newChildren.append(m_contentsLayer); + childHost->addChild(m_contentsLayer); } const Vector<GraphicsLayer*>& childLayers = children(); @@ -614,29 +615,18 @@ void GraphicsLayerChromium::updateChildList() for (size_t i = 0; i < numChildren; ++i) { GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]); - newChildren.append(curChild->platformLayer()); + childHost->addChild(curChild->platformLayer()); } if (m_linkHighlight) - newChildren.append(m_linkHighlight->layer()); + childHost->addChild(m_linkHighlight->layer()); - for (size_t i = 0; i < newChildren.size(); ++i) - newChildren[i]->removeFromParent(); - - WebVector<WebLayer*> newWebChildren; - newWebChildren.assign(newChildren.data(), newChildren.size()); - - if (m_transformLayer) { - m_transformLayer->setChildren(newWebChildren); - - if (m_contentsLayer) { - // If we have a transform layer, then the contents layer is parented in the - // primary layer (which is itself a child of the transform layer). - m_layer->layer()->removeAllChildren(); - m_layer->layer()->addChild(m_contentsLayer); - } - } else - m_layer->layer()->setChildren(newWebChildren); + if (m_transformLayer && m_contentsLayer) { + // If we have a transform layer, then the contents layer is parented in the + // primary layer (which is itself a child of the transform layer). + m_layer->layer()->removeAllChildren(); + m_layer->layer()->addChild(m_contentsLayer); + } } void GraphicsLayerChromium::updateLayerPosition() diff --git a/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp index 2ae58ab7b..dc71d271c 100644 --- a/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp @@ -52,7 +52,7 @@ HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium() void HeadsUpDisplayLayerChromium::update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) { const CCLayerTreeSettings& settings = layerTreeHost()->settings(); - int maxTextureSize = layerTreeHost()->layerRendererCapabilities().maxTextureSize; + int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; IntSize bounds; if (settings.showPlatformLayerTree || settings.showDebugRects()) { diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index f8d869fad..1049e03ee 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -157,7 +157,7 @@ void ImageLayerChromium::createTextureUpdaterIfNeeded() return; m_textureUpdater = ImageLayerTextureUpdater::create(); - GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp index 83c7114ba..5c8960ee2 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp @@ -29,8 +29,8 @@ #include "LayerTextureSubImage.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "Extensions3DChromium.h" -#include "LayerRendererChromium.h" // For GLC() macro #include "TraceEvent.h" #include <public/WebGraphicsContext3D.h> diff --git a/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp b/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp index 2f6ca2286..ccc14875f 100644 --- a/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp +++ b/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp @@ -29,9 +29,9 @@ #include "ProgramBinding.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GeometryBinding.h" #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include "TraceEvent.h" #include <public/WebGraphicsContext3D.h> #include <wtf/text/CString.h> diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index 7b11f6aac..787eaaec2 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -37,7 +37,6 @@ namespace WebCore { class LayerChromium; -class LayerRendererChromium; class RenderSurfaceChromium { WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium); diff --git a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp index 67fbd3679..5dd1045ab 100644 --- a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp @@ -188,7 +188,7 @@ void ScrollbarLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() { - m_textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; if (!m_backTrackUpdater) m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart)); diff --git a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp index fbb7cffd5..e20c323cc 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp @@ -26,8 +26,8 @@ #include "TextureCopier.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" // For the GLC() macro #include "TraceEvent.h" #include <public/WebGraphicsContext3D.h> diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index 68bfa45b0..5dc65ec5a 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -149,7 +149,7 @@ void TiledLayerChromium::updateTileSizeAndTilingOption() isTiled = autoTiled; IntSize requestedSize = isTiled ? tileSize : contentBounds(); - const int maxSize = layerTreeHost()->layerRendererCapabilities().maxTextureSize; + const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize; IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize)); setTileSize(clampedSize); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp index 271174002..c2a8892d0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp @@ -97,9 +97,9 @@ double CCDelayBasedTimeSource::lastTickTime() return m_lastTickTime; } -double CCDelayBasedTimeSource::nextTickTime() +double CCDelayBasedTimeSource::nextTickTimeIfActivated() { - return active() ? m_currentParameters.tickTarget : 0.0; + return active() ? m_currentParameters.tickTarget : nextTickTarget(monotonicTimeNow()); } void CCDelayBasedTimeSource::onTimerFired() @@ -207,7 +207,7 @@ double CCDelayBasedTimeSource::monotonicTimeNow() const // now=37 tickTarget=16.667 newTarget=50.000 --> tick(), postDelayedTask(floor(50.000-37)) --> postDelayedTask(13) // // Note, that in the above discussion, times are expressed in milliseconds, but in the code, seconds are used. -void CCDelayBasedTimeSource::postNextTickTask(double now) +double CCDelayBasedTimeSource::nextTickTarget(double now) { double newInterval = m_nextParameters.interval; double intervalsElapsed = floor((now - m_nextParameters.tickTarget) / newInterval); @@ -221,9 +221,16 @@ void CCDelayBasedTimeSource::postNextTickTask(double now) if (newTickTarget - m_lastTickTime <= newInterval * doubleTickThreshold) newTickTarget += newInterval; + return newTickTarget; +} + +void CCDelayBasedTimeSource::postNextTickTask(double now) +{ + double newTickTarget = nextTickTarget(now); + // Post another task *before* the tick and update state double delay = newTickTarget - now; - ASSERT(delay <= newInterval * (1.0 + doubleTickThreshold)); + ASSERT(delay <= m_nextParameters.interval * (1.0 + doubleTickThreshold)); m_timer.startOneShot(delay); m_nextParameters.tickTarget = newTickTarget; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h index f99837446..c68dc0b99 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h @@ -50,9 +50,8 @@ public: virtual bool active() const OVERRIDE { return m_state != STATE_INACTIVE; } // Get the last and next tick times. - // If not active, nextTickTime will return 0. virtual double lastTickTime() OVERRIDE; - virtual double nextTickTime() OVERRIDE; + virtual double nextTickTimeIfActivated() OVERRIDE; // CCTimerClient implementation. virtual void onTimerFired() OVERRIDE; @@ -62,6 +61,7 @@ public: protected: CCDelayBasedTimeSource(double interval, CCThread*); + double nextTickTarget(double now); void postNextTickTask(double now); enum State { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp index 5b00fef79..8d85fb342 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp @@ -151,10 +151,10 @@ void CCFrameRateController::didAbortAllPendingFrames() m_numFramesPending = 0; } -double CCFrameRateController::nextTickTime() +double CCFrameRateController::nextTickTimeIfActivated() { if (m_isTimeSourceThrottling) - return m_timeSource->nextTickTime(); + return m_timeSource->nextTickTimeIfActivated(); return monotonicallyIncreasingTime(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h index 13d853b70..11b29a72e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h @@ -67,7 +67,7 @@ public: void didFinishFrame(); void didAbortAllPendingFrames(); void setMaxFramesPending(int); // 0 for unlimited. - double nextTickTime(); + double nextTickTimeIfActivated(); void setTimebaseAndInterval(double timebase, double intervalSeconds); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp index 5fdd2cd69..99df0ea57 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp @@ -35,7 +35,6 @@ #include "CCTextureDrawQuad.h" #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include "SkBitmap.h" #include "SkColorMatrixFilter.h" #include "SkPaint.h" @@ -91,16 +90,18 @@ void CCHeadsUpDisplayLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); } -void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { if (!m_hudTexture->id()) return; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + IntRect quadRect(IntPoint(), bounds()); bool premultipliedAlpha = true; FloatRect uvRect(0, 0, 1, 1); bool flipped = false; - quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped)); } void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourceProvider) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h index 1ee24c47e..f7d477fff 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h @@ -49,7 +49,7 @@ public: void setFontAtlas(PassOwnPtr<CCFontAtlas>); virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; void updateHudTexture(CCResourceProvider*); virtual void didDraw(CCResourceProvider*) OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp index 283b7c99a..9f69e238f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp @@ -33,8 +33,8 @@ #include "CCIOSurfaceDrawQuad.h" #include "CCLayerTreeHostImpl.h" #include "CCQuadSink.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "Extensions3D.h" -#include "LayerRendererChromium.h" #include "TextStream.h" #include <public/WebGraphicsContext3D.h> @@ -96,10 +96,13 @@ void CCIOSurfaceLayerImpl::willDraw(CCResourceProvider* resourceProvider) } } -void CCIOSurfaceLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCIOSurfaceLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, CCIOSurfaceDrawQuad::Flipped)); + quadSink.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, CCIOSurfaceDrawQuad::Flipped)); } void CCIOSurfaceLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h index 019b8fe2d..3a55bf2e2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h @@ -41,7 +41,7 @@ public: void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void willDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 8444d1d88..e6de00e24 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -144,9 +144,9 @@ bool CCLayerImpl::descendantDrawsContent() return false; } -PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState(int id) const +PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const { - return CCSharedQuadState::create(id, m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity, m_opaque); + return CCSharedQuadState::create(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity, m_opaque); } void CCLayerImpl::willDraw(CCResourceProvider*) @@ -263,7 +263,7 @@ void CCLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const void sortLayers(Vector<CCLayerImpl*>::iterator first, Vector<CCLayerImpl*>::iterator end, CCLayerSorter* layerSorter) { - TRACE_EVENT0("cc", "LayerRendererChromium::sortLayers"); + TRACE_EVENT0("cc", "CCLayerImpl::sortLayers"); layerSorter->sort(first, end); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index e951c5d7c..e12b1b1a7 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -89,15 +89,14 @@ public: CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; } - PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; + PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; // willDraw must be called before appendQuads. If willDraw is called, // didDraw is guaranteed to be called before another willDraw or before // the layer is destroyed. To enforce this, any class that overrides // willDraw/didDraw must call the base class version. virtual void willDraw(CCResourceProvider*); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) { } + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) { } virtual void didDraw(CCResourceProvider*); - void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*) const; virtual CCResourceProvider::ResourceId contentsResourceId() const; @@ -275,6 +274,8 @@ public: protected: explicit CCLayerImpl(int); + void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*) const; + virtual void dumpLayerProperties(TextStream&, int indent) const; static void writeIndent(TextStream&, int indent); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 2e3a7deb3..5ee1bf6e9 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -75,7 +75,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre , m_client(client) , m_commitNumber(0) , m_renderingStats() - , m_layerRendererInitialized(false) + , m_rendererInitialized(false) , m_contextLost(false) , m_numTimesRecreateShouldFail(0) , m_numFailedRecreateAttempts(0) @@ -131,30 +131,30 @@ void CCLayerTreeHost::setSurfaceReady() m_proxy->setSurfaceReady(); } -void CCLayerTreeHost::initializeLayerRenderer() +void CCLayerTreeHost::initializeRenderer() { - TRACE_EVENT0("cc", "CCLayerTreeHost::initializeLayerRenderer"); - if (!m_proxy->initializeLayerRenderer()) { + TRACE_EVENT0("cc", "CCLayerTreeHost::initializeRenderer"); + if (!m_proxy->initializeRenderer()) { // Uh oh, better tell the client that we can't do anything with this context. m_client->didRecreateOutputSurface(false); return; } // Update m_settings based on capabilities that we got back from the renderer. - m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting; + m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceleratedPainting; // Update m_settings based on partial update capability. m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); - m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize, CCRenderer::ContentPool); + m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, CCRenderer::ContentPool); m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA); - m_layerRendererInitialized = true; + m_rendererInitialized = true; - m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(), m_proxy->layerRendererCapabilities().maxTextureSize), - min(m_settings.defaultTileSize.height(), m_proxy->layerRendererCapabilities().maxTextureSize)); - m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.width(), m_proxy->layerRendererCapabilities().maxTextureSize), - min(m_settings.maxUntiledLayerSize.height(), m_proxy->layerRendererCapabilities().maxTextureSize)); + m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(), m_proxy->rendererCapabilities().maxTextureSize), + min(m_settings.defaultTileSize.height(), m_proxy->rendererCapabilities().maxTextureSize)); + m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.width(), m_proxy->rendererCapabilities().maxTextureSize), + min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize)); } CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() @@ -195,7 +195,7 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); - if (m_layerRendererInitialized) + if (m_rendererInitialized) m_contentsTextureManager->clearAllMemory(resourceProvider); } @@ -317,7 +317,7 @@ bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) void CCLayerTreeHost::finishAllRendering() { - if (!m_layerRendererInitialized) + if (!m_rendererInitialized) return; m_proxy->finishAllRendering(); } @@ -328,9 +328,9 @@ void CCLayerTreeHost::renderingStats(CCRenderingStats& stats) const m_proxy->implSideRenderingStats(stats); } -const LayerRendererCapabilities& CCLayerTreeHost::layerRendererCapabilities() const +const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const { - return m_proxy->layerRendererCapabilities(); + return m_proxy->rendererCapabilities(); } void CCLayerTreeHost::setNeedsAnimate() @@ -446,12 +446,12 @@ void CCLayerTreeHost::scheduleComposite() m_client->scheduleComposite(); } -bool CCLayerTreeHost::initializeLayerRendererIfNeeded() +bool CCLayerTreeHost::initializeRendererIfNeeded() { - if (!m_layerRendererInitialized) { - initializeLayerRenderer(); + if (!m_rendererInitialized) { + initializeRenderer(); // If we couldn't initialize, then bail since we're returning to software mode. - if (!m_layerRendererInitialized) + if (!m_rendererInitialized) return false; } if (m_contextLost) { @@ -464,7 +464,7 @@ bool CCLayerTreeHost::initializeLayerRendererIfNeeded() void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAllocationLimitBytes) { - ASSERT(m_layerRendererInitialized); + ASSERT(m_rendererInitialized); ASSERT(memoryAllocationLimitBytes); if (!rootLayer()) @@ -486,7 +486,7 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu { TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, layerRendererCapabilities().maxTextureSize, updateList); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); CCLayerTreeHostCommon::calculateVisibleRects(updateList); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index baee9e5e5..cc0b45d3d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -115,8 +115,8 @@ struct CCLayerTreeSettings { }; // Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost -struct LayerRendererCapabilities { - LayerRendererCapabilities() +struct RendererCapabilities { + RendererCapabilities() : bestTextureFormat(0) , contextHasCachedFrontBuffer(false) , usingPartialSwap(false) @@ -178,7 +178,7 @@ public: void deleteContentsTexturesOnImplThread(CCResourceProvider*); virtual void acquireLayerTextures(); // Returns false if we should abort this frame due to initialization failure. - bool initializeLayerRendererIfNeeded(); + bool initializeRendererIfNeeded(); void updateLayers(CCTextureUpdateQueue&, size_t contentsMemoryLimitBytes); CCLayerTreeHostClient* client() { return m_client; } @@ -200,7 +200,7 @@ public: void renderingStats(CCRenderingStats&) const; - const LayerRendererCapabilities& layerRendererCapabilities() const; + const RendererCapabilities& rendererCapabilities() const; // Test only hook void loseContext(int numTimes); @@ -269,7 +269,7 @@ private: typedef Vector<RefPtr<LayerChromium> > LayerList; typedef Vector<OwnPtr<CCPrioritizedTexture> > TextureList; - void initializeLayerRenderer(); + void initializeRenderer(); void update(LayerChromium*, CCTextureUpdateQueue&, const CCOcclusionTracker*); bool paintLayerContents(const LayerList&, CCTextureUpdateQueue&); @@ -297,7 +297,7 @@ private: CCRenderingStats m_renderingStats; OwnPtr<CCProxy> m_proxy; - bool m_layerRendererInitialized; + bool m_rendererInitialized; bool m_contextLost; int m_numTimesRecreateShouldFail; int m_numFailedRecreateAttempts; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 46edcc0a8..647de88f7 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -41,12 +41,12 @@ #include "CCPageScaleAnimation.h" #include "CCPrioritizedTextureManager.h" #include "CCRenderPassDrawQuad.h" +#include "CCRendererGL.h" #include "CCRenderingStats.h" #include "CCScrollbarAnimationController.h" #include "CCScrollbarLayerImpl.h" #include "CCSettings.h" #include "CCSingleThreadProxy.h" -#include "LayerRendererChromium.h" #include "TextStream.h" #include "TraceEvent.h" #include <wtf/CurrentTime.h> @@ -175,8 +175,8 @@ bool CCLayerTreeHostImpl::canDraw() TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw empty viewport"); return false; } - if (!m_layerRenderer) { - TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no layerRenderer"); + if (!m_renderer) { + TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no renderer"); return false; } if (m_contentsTexturesPurged) { @@ -255,11 +255,11 @@ void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSur { ASSERT(renderSurfaceLayerList.isEmpty()); ASSERT(m_rootLayerImpl); - ASSERT(m_layerRenderer); // For maxTextureSize. + ASSERT(m_renderer); // For maxTextureSize. { TRACE_EVENT0("cc", "CCLayerTreeHostImpl::calcDrawEtc"); - CCLayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), deviceViewportSize(), m_deviceScaleFactor, &m_layerSorter, layerRendererCapabilities().maxTextureSize, renderSurfaceLayerList); + CCLayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), deviceViewportSize(), m_deviceScaleFactor, &m_layerSorter, rendererCapabilities().maxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); trackDamageForAllSurfaces(m_rootLayerImpl.get(), renderSurfaceLayerList); @@ -281,7 +281,9 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); int renderPassId = renderSurfaceLayer->id(); - OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, renderPassId); + IntRect outputRect = renderSurface->contentRect(); + const WebTransformationMatrix& transformToRootTarget = renderSurface->screenSpaceTransform(); + OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderPassId, outputRect, transformToRootTarget); pass->setDamageRect(renderSurface->damageTracker()->currentDamageRect()); pass->setFilters(renderSurfaceLayer->filters()); pass->setBackgroundFilters(renderSurfaceLayer->backgroundFilters()); @@ -338,6 +340,13 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) occlusionTracker.leaveLayer(it); } +#if !ASSERT_DISABLED + for (size_t i = 0; i < frame.renderPasses.size(); ++i) { + for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j) + ASSERT(frame.renderPasses[i]->quadList()[j]->sharedQuadStateId() >= 0); + } +#endif + if (!m_hasTransparentBackground) { frame.renderPasses.last()->setHasTransparentBackground(false); frame.renderPasses.last()->appendQuadsToFillScreen(m_rootLayerImpl.get(), m_backgroundColor, occlusionTracker); @@ -347,8 +356,8 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) occlusionTracker.overdrawMetrics().recordMetrics(this); removeRenderPasses(CullRenderPassesWithNoQuads(), frame); - m_layerRenderer->decideRenderPassAllocationsForFrame(frame.renderPasses); - removeRenderPasses(CullRenderPassesWithCachedTextures(*m_layerRenderer), frame); + m_renderer->decideRenderPassAllocationsForFrame(frame.renderPasses); + removeRenderPasses(CullRenderPassesWithCachedTextures(*m_renderer), frame); return drawFrame; } @@ -557,7 +566,7 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) if (m_hudLayerImpl) m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); - m_layerRenderer->drawFrame(frame.renderPasses, frame.renderPassesById); + m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); // Once a RenderPass has been drawn, its damage should be cleared in // case the RenderPass will be reused next frame. @@ -578,26 +587,26 @@ void CCLayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) void CCLayerTreeHostImpl::finishAllRendering() { - if (m_layerRenderer) - m_layerRenderer->finish(); + if (m_renderer) + m_renderer->finish(); } bool CCLayerTreeHostImpl::isContextLost() { - return m_layerRenderer && m_layerRenderer->isContextLost(); + return m_renderer && m_renderer->isContextLost(); } -const LayerRendererCapabilities& CCLayerTreeHostImpl::layerRendererCapabilities() const +const RendererCapabilities& CCLayerTreeHostImpl::rendererCapabilities() const { - return m_layerRenderer->capabilities(); + return m_renderer->capabilities(); } bool CCLayerTreeHostImpl::swapBuffers() { - ASSERT(m_layerRenderer); + ASSERT(m_renderer); m_fpsCounter->markEndOfFrame(); - return m_layerRenderer->swapBuffers(); + return m_renderer->swapBuffers(); } void CCLayerTreeHostImpl::didLoseContext() @@ -612,8 +621,8 @@ void CCLayerTreeHostImpl::onSwapBuffersComplete() void CCLayerTreeHostImpl::readback(void* pixels, const IntRect& rect) { - ASSERT(m_layerRenderer); - m_layerRenderer->getFramebufferPixels(pixels, rect); + ASSERT(m_renderer); + m_renderer->getFramebufferPixels(pixels, rect); } static CCLayerImpl* findRootScrollLayer(CCLayerImpl* layer) @@ -681,15 +690,15 @@ void CCLayerTreeHostImpl::setVisible(bool visible) m_visible = visible; didVisibilityChange(this, m_visible); - if (!m_layerRenderer) + if (!m_renderer) return; - m_layerRenderer->setVisible(visible); + m_renderer->setVisible(visible); setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers); } -bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader) +bool CCLayerTreeHostImpl::initializeRenderer(PassOwnPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader) { if (!context->bindToClient(this)) return false; @@ -703,26 +712,26 @@ bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> OwnPtr<CCGraphicsContext> contextRef(context); OwnPtr<CCResourceProvider> resourceProvider = CCResourceProvider::create(contextRef.get()); - OwnPtr<LayerRendererChromium> layerRenderer; + OwnPtr<CCRendererGL> renderer; if (resourceProvider.get()) - layerRenderer = LayerRendererChromium::create(this, resourceProvider.get(), textureUploader); + renderer = CCRendererGL::create(this, resourceProvider.get(), textureUploader); - // Since we now have a new context/layerRenderer, we cannot continue to use the old + // Since we now have a new context/renderer, we cannot continue to use the old // resources (i.e. renderSurfaces and texture IDs). if (m_rootLayerImpl) { clearRenderSurfaces(); sendDidLoseContextRecursive(m_rootLayerImpl.get()); } - m_layerRenderer = layerRenderer.release(); + m_renderer = renderer.release(); m_resourceProvider = resourceProvider.release(); - if (m_layerRenderer) + if (m_renderer) m_context = contextRef.release(); - if (!m_visible && m_layerRenderer) - m_layerRenderer->setVisible(m_visible); + if (!m_visible && m_renderer) + m_renderer->setVisible(m_visible); - return m_layerRenderer; + return m_renderer; } void CCLayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize) @@ -735,8 +744,8 @@ void CCLayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, con updateMaxScrollPosition(); - if (m_layerRenderer) - m_layerRenderer->viewportChanged(); + if (m_renderer) + m_renderer->viewportChanged(); } static void adjustScrollsForPageScaleChange(CCLayerImpl* layerImpl, float pageScaleChange) @@ -840,7 +849,7 @@ bool CCLayerTreeHostImpl::ensureRenderSurfaceLayerList() { if (!m_rootLayerImpl) return false; - if (!m_layerRenderer) + if (!m_renderer) return false; // We need both a non-empty render surface layer list and a root render diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index 5a4b64a57..bfda2b129 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -47,8 +47,7 @@ class CCLayerTreeHostImplTimeSourceAdapter; class CCPageScaleAnimation; class CCRenderPassDrawQuad; class CCResourceProvider; -class LayerRendererChromium; -struct LayerRendererCapabilities; +struct RendererCapabilities; struct CCRenderingStats; // CCLayerTreeHost->CCProxy callback interface. @@ -129,10 +128,10 @@ public: void finishAllRendering(); int sourceAnimationFrameNumber() const; - bool initializeLayerRenderer(PassOwnPtr<CCGraphicsContext>, TextureUploaderOption); + bool initializeRenderer(PassOwnPtr<CCGraphicsContext>, TextureUploaderOption); bool isContextLost(); - CCRenderer* layerRenderer() { return m_layerRenderer.get(); } - const LayerRendererCapabilities& layerRendererCapabilities() const; + CCRenderer* renderer() { return m_renderer.get(); } + const RendererCapabilities& rendererCapabilities() const; bool swapBuffers(); @@ -267,7 +266,7 @@ private: OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; - OwnPtr<CCRenderer> m_layerRenderer; + OwnPtr<CCRenderer> m_renderer; OwnPtr<CCLayerImpl> m_rootLayerImpl; CCLayerImpl* m_rootScrollLayerImpl; CCLayerImpl* m_currentlyScrollingLayerImpl; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp index b1722763a..d9f68af0a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp @@ -28,7 +28,6 @@ #include "CCPrioritizedTextureManager.h" #include "CCPriorityCalculator.h" -#include "LayerRendererChromium.h" #include <algorithm> using namespace std; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp index 4a24179c5..96fb05d94 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp @@ -28,7 +28,6 @@ #include "CCPrioritizedTexture.h" #include "CCPriorityCalculator.h" -#include "LayerRendererChromium.h" #include "TraceEvent.h" #include <algorithm> diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp index 90084043d..5a8bebaca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp @@ -26,8 +26,6 @@ #include "CCPriorityCalculator.h" -#include "LayerRendererChromium.h" - using namespace std; namespace WebCore { @@ -92,4 +90,3 @@ int CCPriorityCalculator::priorityFromVisibility(bool visible, bool drawsToRootS } } // WebCore - diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h index 935f13361..602e9d49f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h @@ -36,7 +36,7 @@ namespace WebCore { class CCThread; struct CCRenderingStats; -struct LayerRendererCapabilities; +struct RendererCapabilities; // Abstract class responsible for proxying commands from the main-thread side of // the compositor over to the compositor implementation. @@ -64,7 +64,7 @@ public: virtual bool isStarted() const = 0; // Attempts to initialize a context to use for rendering. Returns false if the context could not be created. - // The context will not be used and no frames may be produced until initializeLayerRenderer() is called. + // The context will not be used and no frames may be produced until initializeRenderer() is called. virtual bool initializeContext() = 0; // Indicates that the compositing surface associated with our context is ready to use. @@ -73,7 +73,7 @@ public: virtual void setVisible(bool) = 0; // Attempts to initialize the layer renderer. Returns false if the context isn't usable for compositing. - virtual bool initializeLayerRenderer() = 0; + virtual bool initializeRenderer() = 0; // Attempts to recreate the context and layer renderer after a context lost. Returns false if the renderer couldn't be // reinitialized. @@ -83,7 +83,7 @@ public: virtual void implSideRenderingStats(CCRenderingStats&) = 0; - virtual const LayerRendererCapabilities& layerRendererCapabilities() const = 0; + virtual const RendererCapabilities& rendererCapabilities() const = 0; virtual void setNeedsAnimate() = 0; virtual void setNeedsCommit() = 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp index f2e9e9ffe..78a0bd9ec 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -48,8 +48,10 @@ static const int debugTileBorderColorRed = 160; static const int debugTileBorderColorGreen = 100; static const int debugTileBorderColorBlue = 0; -CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) +CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCSharedQuadStateList& sharedQuadStateList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) : m_quadList(quadList) + , m_sharedQuadStateList(sharedQuadStateList) + , m_currentSharedQuadState(0) , m_layer(layer) , m_occlusionTracker(occlusionTracker) , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) @@ -58,6 +60,17 @@ CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcc { } +CCSharedQuadState* CCQuadCuller::useSharedQuadState(PassOwnPtr<CCSharedQuadState> passSharedQuadState) +{ + OwnPtr<CCSharedQuadState> sharedQuadState(passSharedQuadState); + sharedQuadState->id = m_sharedQuadStateList.size(); + + // FIXME: If all quads are culled for the sharedQuadState, we can drop it from the list. + m_currentSharedQuadState = sharedQuadState.get(); + m_sharedQuadStateList.append(sharedQuadState.release()); + return m_currentSharedQuadState; +} + static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads) { OwnPtr<CCDrawQuad> drawQuad(passDrawQuad); @@ -82,6 +95,11 @@ static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad) { + ASSERT(passDrawQuad->sharedQuadState() == m_currentSharedQuadState); + ASSERT(passDrawQuad->sharedQuadStateId() == m_currentSharedQuadState->id); + ASSERT(!m_sharedQuadStateList.isEmpty()); + ASSERT(m_sharedQuadStateList.last().get() == m_currentSharedQuadState); + IntRect culledRect; bool hasOcclusionFromOutsideTargetSurface; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h index e67b4468d..7fd8efbe4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h @@ -27,27 +27,29 @@ #define CCQuadCuller_h #include "CCQuadSink.h" +#include "CCRenderPass.h" namespace WebCore { class CCLayerImpl; class CCRenderSurface; -class CCQuadList; template<typename LayerType, typename SurfaceType> class CCOcclusionTrackerBase; class CCQuadCuller : public CCQuadSink { public: - CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface); - + CCQuadCuller(CCQuadList&, CCSharedQuadStateList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface); virtual ~CCQuadCuller() { } - // Returns true if the quad is added to the list, and false if the quad is entirely culled. - virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad) OVERRIDE; + // CCQuadSink implementation. + virtual CCSharedQuadState* useSharedQuadState(PassOwnPtr<CCSharedQuadState>) OVERRIDE; + virtual bool append(PassOwnPtr<CCDrawQuad>) OVERRIDE; bool hasOcclusionFromOutsideTargetSurface() { return m_hasOcclusionFromOutsideTargetSurface; } private: CCQuadList& m_quadList; + CCSharedQuadStateList& m_sharedQuadStateList; + CCSharedQuadState* m_currentSharedQuadState; CCLayerImpl* m_layer; const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>* m_occlusionTracker; bool m_showCullingWithDebugBorderQuads; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h index 4ae6f238a..09bdd0ae2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h @@ -32,10 +32,16 @@ namespace WebCore { class CCDrawQuad; +struct CCSharedQuadState; + class CCQuadSink { public: virtual ~CCQuadSink() { } + // Call this to add a SharedQuadState before appending quads that refer to it. Returns a pointer + // to the given SharedQuadState for convenience, that can be set on the quads to append. + virtual CCSharedQuadState* useSharedQuadState(PassOwnPtr<CCSharedQuadState>) = 0; + // Returns true if the quad is added to the list, and false if the quad is entirely culled. virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad) = 0; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 3133e23d5..04fe91802 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -38,59 +38,44 @@ using WebKit::WebTransformationMatrix; namespace WebCore { -PassOwnPtr<CCRenderPass> CCRenderPass::create(CCRenderSurface* targetSurface, int id) +PassOwnPtr<CCRenderPass> CCRenderPass::create(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) { - return adoptPtr(new CCRenderPass(targetSurface, id)); + return adoptPtr(new CCRenderPass(id, outputRect, transformToRootTarget)); } -CCRenderPass::CCRenderPass(CCRenderSurface* targetSurface, int id) +CCRenderPass::CCRenderPass(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) : m_id(id) - , m_transformToRootTarget(targetSurface->screenSpaceTransform()) - , m_outputRect(targetSurface->contentRect()) + , m_transformToRootTarget(transformToRootTarget) + , m_outputRect(outputRect) , m_hasTransparentBackground(true) , m_hasOcclusionFromOutsideTargetSurface(false) { - ASSERT(targetSurface); ASSERT(id > 0); } void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImpl* occlusionTracker, bool& hadMissingTiles) { const bool forSurface = false; - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); + CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(m_sharedQuadStateList.size()); - layer->appendDebugBorderQuad(quadCuller, sharedQuadState.get()); - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); - m_sharedQuadStateList.append(sharedQuadState.release()); + layer->appendQuads(quadCuller, hadMissingTiles); m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl* occlusionTracker) { - // FIXME: render surface layers should be a CCLayerImpl-derived class and - // not be handled specially here. const bool forSurface = true; - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); + CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); - CCRenderSurface* surface = layer->renderSurface(); - - OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(m_sharedQuadStateList.size()); bool isReplica = false; - surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id()); - m_sharedQuadStateList.append(sharedQuadState.release()); - - m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); - - if (!layer->hasReplica()) - return; + layer->renderSurface()->appendQuads(quadCuller, isReplica, contributingRenderPass->id()); // Add replica after the surface so that it appears below the surface. - OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(m_sharedQuadStateList.size()); - isReplica = true; - surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass->id()); - m_sharedQuadStateList.append(replicaSharedQuadState.release()); + if (layer->hasReplica()) { + isReplica = true; + layer->renderSurface()->appendQuads(quadCuller, isReplica, contributingRenderPass->id()); + } m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } @@ -104,22 +89,25 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree if (fillRegion.isEmpty()) return; + bool forSurface = false; + CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusionTracker, rootLayer->hasDebugBorders(), forSurface); + // Manually create the quad state for the gutter quads, as the root layer // doesn't have any bounds and so can't generate this itself. // FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas). IntRect rootTargetRect = rootLayer->renderSurface()->contentRect(); float opacity = 1; bool opaque = true; - OwnPtr<CCSharedQuadState> sharedQuadState = CCSharedQuadState::create(0, rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque); + CCSharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(CCSharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque)); ASSERT(rootLayer->screenSpaceTransform().isInvertible()); WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient. IntRect layerRect = CCMathUtil::mapClippedRect(transformToLayerSpace, fillRects[i]); - m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState.get(), layerRect, screenBackgroundColor)); + // Skip the quad culler and just append the quads directly to avoid occlusion checks. + m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor)); } - m_sharedQuadStateList.append(sharedQuadState.release()); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 67ecb4306..4aaaf4717 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -53,10 +53,12 @@ public: inline constBackToFrontIterator backToFrontEnd() const { return rend(); } }; +typedef Vector<OwnPtr<CCSharedQuadState> > CCSharedQuadStateList; + class CCRenderPass { WTF_MAKE_NONCOPYABLE(CCRenderPass); public: - static PassOwnPtr<CCRenderPass> create(CCRenderSurface*, int id); + static PassOwnPtr<CCRenderPass> create(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, bool& hadMissingTiles); void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl*); @@ -88,14 +90,14 @@ public: bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; } void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; } protected: - CCRenderPass(CCRenderSurface*, int id); + CCRenderPass(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); int m_id; CCQuadList m_quadList; + CCSharedQuadStateList m_sharedQuadStateList; WebKit::WebTransformationMatrix m_transformToRootTarget; IntRect m_outputRect; FloatRect m_damageRect; - Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList; bool m_hasTransparentBackground; bool m_hasOcclusionFromOutsideTargetSurface; WebKit::WebFilterOperations m_filters; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index 11edbfa88..50234aca3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -36,8 +36,6 @@ #include "CCQuadSink.h" #include "CCRenderPassDrawQuad.h" #include "CCSharedQuadState.h" -#include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include "TextStream.h" #include <public/WebTransformationMatrix.h> #include <wtf/text/CString.h> @@ -181,30 +179,21 @@ static inline IntRect computeClippedRectInTarget(const CCLayerImpl* owningLayer) return clippedRectInTarget; } -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState(int id) const +void CCRenderSurface::appendQuads(CCQuadSink& quadSink, bool forReplica, int renderPassId) { - IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); - bool isOpaque = false; - return CCSharedQuadState::create(id, m_drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque); -} + ASSERT(!forReplica || m_owningLayer->hasReplica()); -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState(int id) const -{ IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); bool isOpaque = false; - return CCSharedQuadState::create(id, m_replicaDrawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque); -} - -void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) -{ - ASSERT(!forReplica || m_owningLayer->hasReplica()); + const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque)); if (m_owningLayer->hasDebugBorders()) { int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderColorRed; int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBorderColorGreen; int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorderColorBlue; SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue); - quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); + quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); } // FIXME: By using the same RenderSurface for both the content and its reflection, @@ -237,7 +226,7 @@ void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* share CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); - quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, + quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY)); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index 0e518b2aa..a7d639562 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -42,7 +42,6 @@ class CCDamageTracker; class CCQuadSink; class CCRenderPass; class CCLayerImpl; -class LayerRendererChromium; class TextStream; class CCRenderSurface { @@ -104,10 +103,7 @@ public: CCDamageTracker* damageTracker() const { return m_damageTracker.get(); } - PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; - PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState(int id) const; - - void appendQuads(CCQuadSink&, CCSharedQuadState*, bool forReplica, int renderPassId); + void appendQuads(CCQuadSink&, bool forReplica, int renderPassId); private: CCLayerImpl* m_owningLayer; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h index 40ab241c5..946aec633 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h @@ -66,7 +66,7 @@ public: virtual ~CCRenderer() { } - virtual const LayerRendererCapabilities& capabilities() const = 0; + virtual const RendererCapabilities& capabilities() const = 0; const CCLayerTreeSettings& settings() const { return m_client->settings(); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.cpp index 84f00a1c7..b91b59a57 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.cpp @@ -32,7 +32,7 @@ #include "config.h" #if USE(ACCELERATED_COMPOSITING) -#include "LayerRendererChromium.h" +#include "CCRendererGL.h" #include "CCDamageTracker.h" #include "CCLayerQuad.h" @@ -83,16 +83,16 @@ bool needsIOSurfaceReadbackWorkaround() } // anonymous namespace -PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) +PassOwnPtr<CCRendererGL> CCRendererGL::create(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) { - OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, resourceProvider, textureUploaderSetting))); - if (!layerRenderer->initialize()) + OwnPtr<CCRendererGL> renderer(adoptPtr(new CCRendererGL(client, resourceProvider, textureUploaderSetting))); + if (!renderer->initialize()) return nullptr; - return layerRenderer.release(); + return renderer.release(); } -LayerRendererChromium::LayerRendererChromium(CCRendererClient* client, +CCRendererGL::CCRendererGL(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) : CCDirectRenderer(client, resourceProvider) @@ -108,7 +108,7 @@ LayerRendererChromium::LayerRendererChromium(CCRendererClient* client, ASSERT(m_context); } -bool LayerRendererChromium::initialize() +bool CCRendererGL::initialize() { if (!m_context->makeContextCurrent()) return false; @@ -138,15 +138,13 @@ bool LayerRendererChromium::initialize() // Use the swapBuffers callback only with the threaded proxy. if (CCProxy::hasImplThread()) m_capabilities.usingSwapCompleteCallback = extensions.contains("GL_CHROMIUM_swapbuffers_complete_callback"); - if (m_capabilities.usingSwapCompleteCallback) { + if (m_capabilities.usingSwapCompleteCallback) m_context->setSwapBuffersCompleteCallbackCHROMIUM(this); - } m_capabilities.usingSetVisibility = extensions.contains("GL_CHROMIUM_set_visibility"); - if (extensions.contains("GL_CHROMIUM_iosurface")) { + if (extensions.contains("GL_CHROMIUM_iosurface")) ASSERT(extensions.contains("GL_ARB_texture_rectangle")); - } m_capabilities.usingGpuMemoryManager = extensions.contains("GL_CHROMIUM_gpu_memory_manager"); if (m_capabilities.usingGpuMemoryManager) @@ -169,7 +167,7 @@ bool LayerRendererChromium::initialize() return true; } -LayerRendererChromium::~LayerRendererChromium() +CCRendererGL::~CCRendererGL() { ASSERT(CCProxy::isImplThread()); m_context->setSwapBuffersCompleteCallbackCHROMIUM(0); @@ -178,19 +176,19 @@ LayerRendererChromium::~LayerRendererChromium() cleanupSharedObjects(); } -WebGraphicsContext3D* LayerRendererChromium::context() +WebGraphicsContext3D* CCRendererGL::context() { return m_context; } -void LayerRendererChromium::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) +void CCRendererGL::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) { unsigned long error = context->getError(); if (error != GraphicsContext3D::NO_ERROR) LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, static_cast<int>(error)); } -void LayerRendererChromium::setVisible(bool visible) +void CCRendererGL::setVisible(bool visible) { if (m_visible == visible) return; @@ -198,22 +196,21 @@ void LayerRendererChromium::setVisible(bool visible) // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage front/backbuffers // crbug.com/116049 - if (m_capabilities.usingSetVisibility) { + if (m_capabilities.usingSetVisibility) m_context->setVisibilityCHROMIUM(visible); - } } -void LayerRendererChromium::releaseRenderPassTextures() +void CCRendererGL::releaseRenderPassTextures() { m_renderPassTextures.clear(); } -void LayerRendererChromium::viewportChanged() +void CCRendererGL::viewportChanged() { m_isViewportChanged = true; } -void LayerRendererChromium::clearFramebuffer(DrawingFrame& frame) +void CCRendererGL::clearFramebuffer(DrawingFrame& frame) { // On DEBUG builds, opaque render passes are cleared to blue to easily see regions that were not drawn on the screen. if (frame.currentRenderPass->hasTransparentBackground()) @@ -227,7 +224,7 @@ void LayerRendererChromium::clearFramebuffer(DrawingFrame& frame) m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); } -void LayerRendererChromium::beginDrawingFrame(DrawingFrame& frame) +void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) { // FIXME: Remove this once framebuffer is automatically recreated on first use ensureFramebuffer(); @@ -235,7 +232,7 @@ void LayerRendererChromium::beginDrawingFrame(DrawingFrame& frame) if (viewportSize().isEmpty()) return; - TRACE_EVENT0("cc", "LayerRendererChromium::drawLayers"); + TRACE_EVENT0("cc", "CCRendererGL::drawLayers"); if (m_isViewportChanged) { // Only reshape when we know we are going to draw. Otherwise, the reshape // can leave the window at the wrong size if we never draw and the proper @@ -255,13 +252,13 @@ void LayerRendererChromium::beginDrawingFrame(DrawingFrame& frame) GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); } -void LayerRendererChromium::doNoOp() +void CCRendererGL::doNoOp() { GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); GLC(m_context, m_context->flush()); } -void LayerRendererChromium::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) +void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) { if (quad->needsBlending()) GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); @@ -302,7 +299,7 @@ void LayerRendererChromium::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad } } -void LayerRendererChromium::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheckerboardDrawQuad* quad) +void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheckerboardDrawQuad* quad) { const TileCheckerboardProgram* program = tileCheckerboardProgram(); ASSERT(program && program->initialized()); @@ -324,7 +321,7 @@ void LayerRendererChromium::drawCheckerboardQuad(const DrawingFrame& frame, cons drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); } -void LayerRendererChromium::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugBorderDrawQuad* quad) +void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugBorderDrawQuad* quad) { static float glMatrix[16]; const SolidColorProgram* program = solidColorProgram(); @@ -336,7 +333,7 @@ void LayerRendererChromium::drawDebugBorderQuad(const DrawingFrame& frame, const WebTransformationMatrix renderMatrix = quad->quadTransform(); renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y()); renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); - LayerRendererChromium::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); + CCRendererGL::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLocation(), 1, false, &glMatrix[0])); SkColor color = quad->color(); @@ -350,7 +347,7 @@ void LayerRendererChromium::drawDebugBorderQuad(const DrawingFrame& frame, const GLC(context(), context()->drawElements(GraphicsContext3D::LINE_LOOP, 4, GraphicsContext3D::UNSIGNED_SHORT, 6 * sizeof(unsigned short))); } -static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const WebKit::WebFilterOperations& filters, CCScopedTexture* sourceTexture) +static inline SkBitmap applyFilters(CCRendererGL* renderer, const WebKit::WebFilterOperations& filters, CCScopedTexture* sourceTexture) { if (filters.isEmpty()) return SkBitmap(); @@ -361,14 +358,14 @@ static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const if (!filterContext || !filterGrContext) return SkBitmap(); - layerRenderer->context()->flush(); + renderer->context()->flush(); - CCResourceProvider::ScopedWriteLockGL lock(layerRenderer->resourceProvider(), sourceTexture->id()); + CCResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourceTexture->id()); SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext); return source; } -PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(DrawingFrame& frame, const CCRenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform) +PassOwnPtr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& frame, const CCRenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform) { // This method draws a background filter, which applies a filter to any pixels behind the quad and seen through its background. // The algorithm works as follows: @@ -439,7 +436,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(Drawing return backgroundTexture.release(); } -void LayerRendererChromium::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDrawQuad* quad) +void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDrawQuad* quad) { CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); if (!contentsTexture || !contentsTexture->id()) @@ -581,7 +578,7 @@ void LayerRendererChromium::drawRenderPassQuad(DrawingFrame& frame, const CCRend drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatrixLocation); } -void LayerRendererChromium::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidColorDrawQuad* quad) +void CCRendererGL::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidColorDrawQuad* quad) { const SolidColorProgram* program = solidColorProgram(); GLC(context(), context()->useProgram(program->program())); @@ -620,7 +617,7 @@ static void tileUniformLocation(T program, TileProgramUniforms& uniforms) uniforms.edgeLocation = program->fragmentShader().edgeLocation(); } -void LayerRendererChromium::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) +void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) { IntRect tileRect = quad->quadVisibleRect(); @@ -754,7 +751,7 @@ void LayerRendererChromium::drawTileQuad(const DrawingFrame& frame, const CCTile localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped); // We should not ASSERT(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become - // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. + // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. } else { // Move fragment shader transform to vertex shader. We can do this while // still producing correct results as fragmentTexTransformLocation @@ -787,7 +784,7 @@ void LayerRendererChromium::drawTileQuad(const DrawingFrame& frame, const CCTile drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrixLocation); } -void LayerRendererChromium::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoDrawQuad* quad) +void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoDrawQuad* quad) { const VideoYUVProgram* program = videoYUVProgram(); ASSERT(program && program->initialized()); @@ -847,7 +844,7 @@ void LayerRendererChromium::drawYUVVideoQuad(const DrawingFrame& frame, const CC GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); } -void LayerRendererChromium::drawStreamVideoQuad(const DrawingFrame& frame, const CCStreamVideoDrawQuad* quad) +void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStreamVideoDrawQuad* quad) { static float glMatrix[16]; @@ -892,7 +889,7 @@ struct TexTransformTextureProgramBinding : TextureProgramBinding { int texTransformLocation; }; -void LayerRendererChromium::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad) +void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad) { ASSERT(CCProxy::isImplThread()); @@ -936,7 +933,7 @@ void LayerRendererChromium::drawTextureQuad(const DrawingFrame& frame, const CCT GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); } -void LayerRendererChromium::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) +void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) { ASSERT(CCProxy::isImplThread()); TexTransformTextureProgramBinding binding; @@ -958,7 +955,7 @@ void LayerRendererChromium::drawIOSurfaceQuad(const DrawingFrame& frame, const C GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); } -void LayerRendererChromium::finishDrawingFrame(DrawingFrame& frame) +void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) { m_currentFramebufferLock.clear(); m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect)); @@ -967,7 +964,7 @@ void LayerRendererChromium::finishDrawingFrame(DrawingFrame& frame) GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); } -void LayerRendererChromium::toGLMatrix(float* flattened, const WebTransformationMatrix& m) +void CCRendererGL::toGLMatrix(float* flattened, const WebTransformationMatrix& m) { flattened[0] = m.m11(); flattened[1] = m.m12(); @@ -987,7 +984,7 @@ void LayerRendererChromium::toGLMatrix(float* flattened, const WebTransformation flattened[15] = m.m44(); } -void LayerRendererChromium::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) +void CCRendererGL::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) { if (quadLocation == -1) return; @@ -1004,13 +1001,13 @@ void LayerRendererChromium::setShaderFloatQuad(const FloatQuad& quad, int quadLo GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); } -void LayerRendererChromium::setShaderOpacity(float opacity, int alphaLocation) +void CCRendererGL::setShaderOpacity(float opacity, int alphaLocation) { if (alphaLocation != -1) GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); } -void LayerRendererChromium::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation) +void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation) { WebTransformationMatrix quadRectMatrix; quadRectTransform(&quadRectMatrix, drawTransform, quadRect); @@ -1021,7 +1018,7 @@ void LayerRendererChromium::drawQuadGeometry(const DrawingFrame& frame, const We GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0)); } -void LayerRendererChromium::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) +void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) { const RenderPassProgram* program = renderPassProgram(); @@ -1038,18 +1035,18 @@ void LayerRendererChromium::copyTextureToFramebuffer(const DrawingFrame& frame, drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLocation()); } -void LayerRendererChromium::finish() +void CCRendererGL::finish() { - TRACE_EVENT0("cc", "LayerRendererChromium::finish"); + TRACE_EVENT0("cc", "CCRendererGL::finish"); m_context->finish(); } -bool LayerRendererChromium::swapBuffers() +bool CCRendererGL::swapBuffers() { ASSERT(m_visible); ASSERT(!m_isFramebufferDiscarded); - TRACE_EVENT0("cc", "LayerRendererChromium::swapBuffers"); + TRACE_EVENT0("cc", "CCRendererGL::swapBuffers"); // We're done! Time to swapbuffers! if (m_capabilities.usingPartialSwap) { @@ -1068,12 +1065,12 @@ bool LayerRendererChromium::swapBuffers() return true; } -void LayerRendererChromium::onSwapBuffersComplete() +void CCRendererGL::onSwapBuffersComplete() { m_client->onSwapBuffersComplete(); } -void LayerRendererChromium::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocation) +void CCRendererGL::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocation) { // FIXME: This is called on the main thread in single threaded mode, but we expect it on the impl thread. if (!CCProxy::hasImplThread()) { @@ -1086,7 +1083,7 @@ void LayerRendererChromium::onMemoryAllocationChanged(WebGraphicsMemoryAllocatio } } -void LayerRendererChromium::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation allocation) +void CCRendererGL::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation allocation) { if (m_visible && !allocation.gpuResourceSizeInBytes) return; @@ -1102,7 +1099,7 @@ void LayerRendererChromium::onMemoryAllocationChangedOnImplThread(WebKit::WebGra m_client->setMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes); } -void LayerRendererChromium::discardFramebuffer() +void CCRendererGL::discardFramebuffer() { if (m_isFramebufferDiscarded) return; @@ -1118,7 +1115,7 @@ void LayerRendererChromium::discardFramebuffer() m_client->setFullRootLayerDamage(); } -void LayerRendererChromium::ensureFramebuffer() +void CCRendererGL::ensureFramebuffer() { if (!m_isFramebufferDiscarded) return; @@ -1130,13 +1127,13 @@ void LayerRendererChromium::ensureFramebuffer() m_isFramebufferDiscarded = false; } -void LayerRendererChromium::onContextLost() +void CCRendererGL::onContextLost() { m_client->didLoseContext(); } -void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& rect) +void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) { ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight()); @@ -1184,7 +1181,7 @@ void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& re } if (!m_visible) { - TRACE_EVENT0("cc", "LayerRendererChromium::getFramebufferPixels dropping resources after readback"); + TRACE_EVENT0("cc", "CCRendererGL::getFramebufferPixels dropping resources after readback"); discardFramebuffer(); releaseRenderPassTextures(); m_client->releaseContentsTextures(); @@ -1192,7 +1189,7 @@ void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& re } } -bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) +bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) { ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); @@ -1206,7 +1203,7 @@ bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, cons return true; } -bool LayerRendererChromium::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) +bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) { ASSERT(texture->id()); frame.currentRenderPass = 0; @@ -1215,13 +1212,13 @@ bool LayerRendererChromium::useScopedTexture(DrawingFrame& frame, const CCScoped return bindFramebufferToTexture(frame, texture, viewportRect); } -void LayerRendererChromium::bindFramebufferToOutputSurface(DrawingFrame& frame) +void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) { m_currentFramebufferLock.clear(); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); } -bool LayerRendererChromium::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) +bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) { ASSERT(texture->id()); @@ -1243,30 +1240,30 @@ bool LayerRendererChromium::bindFramebufferToTexture(DrawingFrame& frame, const return true; } -void LayerRendererChromium::enableScissorTestRect(const IntRect& scissorRect) +void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect) { GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST)); GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorRect.width(), scissorRect.height())); } -void LayerRendererChromium::disableScissorTest() +void CCRendererGL::disableScissorTest() { GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); } -void LayerRendererChromium::setDrawViewportSize(const IntSize& viewportSize) +void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize) { GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.height())); } -bool LayerRendererChromium::makeContextCurrent() +bool CCRendererGL::makeContextCurrent() { return m_context->makeContextCurrent(); } -bool LayerRendererChromium::initializeSharedObjects() +bool CCRendererGL::initializeSharedObjects() { - TRACE_EVENT0("cc", "LayerRendererChromium::initializeSharedObjects"); + TRACE_EVENT0("cc", "CCRendererGL::initializeSharedObjects"); makeContextCurrent(); // Create an FBO for doing offscreen rendering. @@ -1290,191 +1287,191 @@ bool LayerRendererChromium::initializeSharedObjects() return true; } -const LayerRendererChromium::TileCheckerboardProgram* LayerRendererChromium::tileCheckerboardProgram() +const CCRendererGL::TileCheckerboardProgram* CCRendererGL::tileCheckerboardProgram() { if (!m_tileCheckerboardProgram) m_tileCheckerboardProgram = adoptPtr(new TileCheckerboardProgram(m_context)); if (!m_tileCheckerboardProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::checkerboardProgram::initalize"); + TRACE_EVENT0("cc", "CCRendererGL::checkerboardProgram::initalize"); m_tileCheckerboardProgram->initialize(m_context, m_isUsingBindUniform); } return m_tileCheckerboardProgram.get(); } -const LayerRendererChromium::SolidColorProgram* LayerRendererChromium::solidColorProgram() +const CCRendererGL::SolidColorProgram* CCRendererGL::solidColorProgram() { if (!m_solidColorProgram) m_solidColorProgram = adoptPtr(new SolidColorProgram(m_context)); if (!m_solidColorProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::solidColorProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::solidColorProgram::initialize"); m_solidColorProgram->initialize(m_context, m_isUsingBindUniform); } return m_solidColorProgram.get(); } -const LayerRendererChromium::RenderPassProgram* LayerRendererChromium::renderPassProgram() +const CCRendererGL::RenderPassProgram* CCRendererGL::renderPassProgram() { ASSERT(m_renderPassProgram); if (!m_renderPassProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassProgram::initialize"); m_renderPassProgram->initialize(m_context, m_isUsingBindUniform); } return m_renderPassProgram.get(); } -const LayerRendererChromium::RenderPassProgramAA* LayerRendererChromium::renderPassProgramAA() +const CCRendererGL::RenderPassProgramAA* CCRendererGL::renderPassProgramAA() { if (!m_renderPassProgramAA) m_renderPassProgramAA = adoptPtr(new RenderPassProgramAA(m_context)); if (!m_renderPassProgramAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassProgramAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassProgramAA::initialize"); m_renderPassProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_renderPassProgramAA.get(); } -const LayerRendererChromium::RenderPassMaskProgram* LayerRendererChromium::renderPassMaskProgram() +const CCRendererGL::RenderPassMaskProgram* CCRendererGL::renderPassMaskProgram() { if (!m_renderPassMaskProgram) m_renderPassMaskProgram = adoptPtr(new RenderPassMaskProgram(m_context)); if (!m_renderPassMaskProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassMaskProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassMaskProgram::initialize"); m_renderPassMaskProgram->initialize(m_context, m_isUsingBindUniform); } return m_renderPassMaskProgram.get(); } -const LayerRendererChromium::RenderPassMaskProgramAA* LayerRendererChromium::renderPassMaskProgramAA() +const CCRendererGL::RenderPassMaskProgramAA* CCRendererGL::renderPassMaskProgramAA() { if (!m_renderPassMaskProgramAA) m_renderPassMaskProgramAA = adoptPtr(new RenderPassMaskProgramAA(m_context)); if (!m_renderPassMaskProgramAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassMaskProgramAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassMaskProgramAA::initialize"); m_renderPassMaskProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_renderPassMaskProgramAA.get(); } -const LayerRendererChromium::TileProgram* LayerRendererChromium::tileProgram() +const CCRendererGL::TileProgram* CCRendererGL::tileProgram() { ASSERT(m_tileProgram); if (!m_tileProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgram::initialize"); m_tileProgram->initialize(m_context, m_isUsingBindUniform); } return m_tileProgram.get(); } -const LayerRendererChromium::TileProgramOpaque* LayerRendererChromium::tileProgramOpaque() +const CCRendererGL::TileProgramOpaque* CCRendererGL::tileProgramOpaque() { ASSERT(m_tileProgramOpaque); if (!m_tileProgramOpaque->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramOpaque::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramOpaque::initialize"); m_tileProgramOpaque->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramOpaque.get(); } -const LayerRendererChromium::TileProgramAA* LayerRendererChromium::tileProgramAA() +const CCRendererGL::TileProgramAA* CCRendererGL::tileProgramAA() { if (!m_tileProgramAA) m_tileProgramAA = adoptPtr(new TileProgramAA(m_context)); if (!m_tileProgramAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramAA::initialize"); m_tileProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramAA.get(); } -const LayerRendererChromium::TileProgramSwizzle* LayerRendererChromium::tileProgramSwizzle() +const CCRendererGL::TileProgramSwizzle* CCRendererGL::tileProgramSwizzle() { if (!m_tileProgramSwizzle) m_tileProgramSwizzle = adoptPtr(new TileProgramSwizzle(m_context)); if (!m_tileProgramSwizzle->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramSwizzle::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzle::initialize"); m_tileProgramSwizzle->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzle.get(); } -const LayerRendererChromium::TileProgramSwizzleOpaque* LayerRendererChromium::tileProgramSwizzleOpaque() +const CCRendererGL::TileProgramSwizzleOpaque* CCRendererGL::tileProgramSwizzleOpaque() { if (!m_tileProgramSwizzleOpaque) m_tileProgramSwizzleOpaque = adoptPtr(new TileProgramSwizzleOpaque(m_context)); if (!m_tileProgramSwizzleOpaque->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramSwizzleOpaque::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzleOpaque::initialize"); m_tileProgramSwizzleOpaque->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzleOpaque.get(); } -const LayerRendererChromium::TileProgramSwizzleAA* LayerRendererChromium::tileProgramSwizzleAA() +const CCRendererGL::TileProgramSwizzleAA* CCRendererGL::tileProgramSwizzleAA() { if (!m_tileProgramSwizzleAA) m_tileProgramSwizzleAA = adoptPtr(new TileProgramSwizzleAA(m_context)); if (!m_tileProgramSwizzleAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramSwizzleAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzleAA::initialize"); m_tileProgramSwizzleAA->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzleAA.get(); } -const LayerRendererChromium::TextureProgram* LayerRendererChromium::textureProgram() +const CCRendererGL::TextureProgram* CCRendererGL::textureProgram() { if (!m_textureProgram) m_textureProgram = adoptPtr(new TextureProgram(m_context)); if (!m_textureProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::textureProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::textureProgram::initialize"); m_textureProgram->initialize(m_context, m_isUsingBindUniform); } return m_textureProgram.get(); } -const LayerRendererChromium::TextureProgramFlip* LayerRendererChromium::textureProgramFlip() +const CCRendererGL::TextureProgramFlip* CCRendererGL::textureProgramFlip() { if (!m_textureProgramFlip) m_textureProgramFlip = adoptPtr(new TextureProgramFlip(m_context)); if (!m_textureProgramFlip->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::textureProgramFlip::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::textureProgramFlip::initialize"); m_textureProgramFlip->initialize(m_context, m_isUsingBindUniform); } return m_textureProgramFlip.get(); } -const LayerRendererChromium::TextureIOSurfaceProgram* LayerRendererChromium::textureIOSurfaceProgram() +const CCRendererGL::TextureIOSurfaceProgram* CCRendererGL::textureIOSurfaceProgram() { if (!m_textureIOSurfaceProgram) m_textureIOSurfaceProgram = adoptPtr(new TextureIOSurfaceProgram(m_context)); if (!m_textureIOSurfaceProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::textureIOSurfaceProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::textureIOSurfaceProgram::initialize"); m_textureIOSurfaceProgram->initialize(m_context, m_isUsingBindUniform); } return m_textureIOSurfaceProgram.get(); } -const LayerRendererChromium::VideoYUVProgram* LayerRendererChromium::videoYUVProgram() +const CCRendererGL::VideoYUVProgram* CCRendererGL::videoYUVProgram() { if (!m_videoYUVProgram) m_videoYUVProgram = adoptPtr(new VideoYUVProgram(m_context)); if (!m_videoYUVProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::videoYUVProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::videoYUVProgram::initialize"); m_videoYUVProgram->initialize(m_context, m_isUsingBindUniform); } return m_videoYUVProgram.get(); } -const LayerRendererChromium::VideoStreamTextureProgram* LayerRendererChromium::videoStreamTextureProgram() +const CCRendererGL::VideoStreamTextureProgram* CCRendererGL::videoStreamTextureProgram() { if (!m_videoStreamTextureProgram) m_videoStreamTextureProgram = adoptPtr(new VideoStreamTextureProgram(m_context)); if (!m_videoStreamTextureProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::streamTextureProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::streamTextureProgram::initialize"); m_videoStreamTextureProgram->initialize(m_context, m_isUsingBindUniform); } return m_videoStreamTextureProgram.get(); } -void LayerRendererChromium::cleanupSharedObjects() +void CCRendererGL::cleanupSharedObjects() { makeContextCurrent(); @@ -1528,7 +1525,7 @@ void LayerRendererChromium::cleanupSharedObjects() releaseRenderPassTextures(); } -bool LayerRendererChromium::isContextLost() +bool CCRendererGL::isContextLost() { return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.h index 3575c193d..832503352 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.h @@ -29,8 +29,8 @@ */ -#ifndef LayerRendererChromium_h -#define LayerRendererChromium_h +#ifndef CCRendererGL_h +#define CCRendererGL_h #if USE(ACCELERATED_COMPOSITING) @@ -60,17 +60,17 @@ class GeometryBinding; class ScopedEnsureFramebufferAllocation; // Class that handles drawing of composited render layers using GL. -class LayerRendererChromium : public CCDirectRenderer, - public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM, - public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM , - public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { - WTF_MAKE_NONCOPYABLE(LayerRendererChromium); +class CCRendererGL : public CCDirectRenderer, + public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM, + public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM , + public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { + WTF_MAKE_NONCOPYABLE(CCRendererGL); public: - static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); + static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); - virtual ~LayerRendererChromium(); + virtual ~CCRendererGL(); - virtual const LayerRendererCapabilities& capabilities() const OVERRIDE { return m_capabilities; } + virtual const RendererCapabilities& capabilities() const OVERRIDE { return m_capabilities; } WebKit::WebGraphicsContext3D* context(); @@ -100,7 +100,7 @@ public: virtual void setVisible(bool) OVERRIDE; protected: - LayerRendererChromium(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); + CCRendererGL(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } bool initialize(); @@ -156,7 +156,7 @@ private: // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. virtual void onContextLost() OVERRIDE; - LayerRendererCapabilities m_capabilities; + RendererCapabilities m_capabilities; unsigned m_offscreenFramebufferId; @@ -258,7 +258,7 @@ private: #define DEBUG_GL_CALLS 0 #if DEBUG_GL_CALLS && !defined ( NDEBUG ) -#define GLC(context, x) (x, LayerRendererChromium::debugGLCall(&*context, #x, __FILE__, __LINE__)) +#define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, __LINE__)) #else #define GLC(context, x) (x) #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp index fb36b4cae..3aad147ca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp @@ -27,9 +27,9 @@ #include "CCResourceProvider.h" #include "CCProxy.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "Extensions3DChromium.h" #include "IntRect.h" -#include "LayerRendererChromium.h" // For the GLC() macro #include "LayerTextureSubImage.h" #include <limits.h> #include <public/WebGraphicsContext3D.h> diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp index fa3dbe1ed..999a08ec9 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp @@ -175,7 +175,7 @@ void CCScheduler::processScheduledActions() break; case CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES: if (m_client->hasMoreResourceUpdates()) { - m_client->scheduledActionUpdateMoreResources(m_frameRateController->nextTickTime()); + m_client->scheduledActionUpdateMoreResources(m_frameRateController->nextTickTimeIfActivated()); m_updateMoreResourcesPending = true; } else m_stateMachine.beginUpdateMoreResourcesComplete(false); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp index e29931884..dc191dc2c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp @@ -89,13 +89,16 @@ static FloatRect toUVRect(const WebRect& r, const IntRect& bounds) static_cast<float>(r.width) / bounds.width(), static_cast<float>(r.height) / bounds.height()); } -void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { bool premultipledAlpha = false; bool flipped = false; FloatRect uvRect(0, 0, 1, 1); IntRect boundsRect(IntPoint(), contentBounds()); + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + WebRect thumbRect, backTrackRect, foreTrackRect; m_geometry->splitTrack(&m_scrollbar, m_geometry->trackRect(&m_scrollbar), backTrackRect, thumbRect, foreTrackRect); if (!m_geometry->hasThumb(&m_scrollbar)) @@ -104,7 +107,7 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadS if (m_thumbResourceId && !thumbRect.isEmpty()) { OwnPtr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadState, IntRect(thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height), m_thumbResourceId, premultipledAlpha, uvRect, flipped); quad->setNeedsBlending(); - quadList.append(quad.release()); + quadSink.append(quad.release()); } if (!m_backTrackResourceId) @@ -112,12 +115,12 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadS // We only paint the track in two parts if we were given a texture for the forward track part. if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(foreTrackRect.x, foreTrackRect.y, foreTrackRect.width, foreTrackRect.height), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(foreTrackRect.x, foreTrackRect.y, foreTrackRect.width, foreTrackRect.height), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); // Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and // fore track quads. The back track texture contains (and displays) the buttons. if (!boundsRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(boundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(boundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped)); } void CCScrollbarLayerImpl::didLoseContext() diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h index ca40d099f..f8fd7bf8c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h @@ -61,7 +61,7 @@ public: WebKit::WebScrollbar::Orientation orientation() const { return m_orientation; } - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void didLoseContext() OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp index 337987497..f3922b301 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp @@ -31,13 +31,13 @@ namespace WebCore { -PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) +PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) { - return adoptPtr(new CCSharedQuadState(id, quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + return adoptPtr(new CCSharedQuadState(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); } -CCSharedQuadState::CCSharedQuadState(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) - : id(id) +CCSharedQuadState::CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) + : id(-1) , quadTransform(quadTransform) , visibleContentRect(visibleContentRect) , clippedRectInTarget(clippedRectInTarget) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h index af12bec5a..f3adf0301 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h @@ -43,8 +43,8 @@ struct CCSharedQuadState { float opacity; bool opaque; - static PassOwnPtr<CCSharedQuadState> create(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); - CCSharedQuadState(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); + static PassOwnPtr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); + CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); bool isLayerAxisAlignedIntRect() const; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp index 88a8ffb82..6876ea218 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp @@ -47,7 +47,7 @@ CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) : m_layerTreeHost(layerTreeHost) , m_contextLost(false) , m_compositorIdentifier(-1) - , m_layerRendererInitialized(false) + , m_rendererInitialized(false) , m_nextFrameIsNewlyCommittedFrame(false) { TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); @@ -127,16 +127,16 @@ void CCSingleThreadProxy::setVisible(bool visible) m_layerTreeHostImpl->setVisible(visible); } -bool CCSingleThreadProxy::initializeLayerRenderer() +bool CCSingleThreadProxy::initializeRenderer() { ASSERT(CCProxy::isMainThread()); ASSERT(m_contextBeforeInitialization); { DebugScopedSetImplThread impl; - bool ok = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitialization.release(), UnthrottledUploader); + bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitialization.release(), UnthrottledUploader); if (ok) { - m_layerRendererInitialized = true; - m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); + m_rendererInitialized = true; + m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); } return ok; @@ -156,10 +156,11 @@ bool CCSingleThreadProxy::recreateContext() bool initialized; { DebugScopedSetImplThread impl; - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); - initialized = m_layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + if (!m_layerTreeHostImpl->contentsTexturesPurged()) + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); + initialized = m_layerTreeHostImpl->initializeRenderer(context.release(), UnthrottledUploader); if (initialized) { - m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); + m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); } } @@ -174,11 +175,11 @@ void CCSingleThreadProxy::implSideRenderingStats(CCRenderingStats& stats) m_layerTreeHostImpl->renderingStats(stats); } -const LayerRendererCapabilities& CCSingleThreadProxy::layerRendererCapabilities() const +const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const { - ASSERT(m_layerRendererInitialized); + ASSERT(m_rendererInitialized); // Note: this gets called during the commit by the "impl" thread - return m_layerRendererCapabilitiesForMainThread; + return m_RendererCapabilitiesForMainThread; } void CCSingleThreadProxy::loseContext() @@ -212,7 +213,7 @@ void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue) // single thread mode. For correctness, loop until no more updates are // pending. while (queue.hasMoreUpdates()) - CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), &queue, maxPartialTextureUpdates()); + CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader(), &queue, maxPartialTextureUpdates()); m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); @@ -287,8 +288,8 @@ void CCSingleThreadProxy::forceSerializeOnSwapBuffers() { { DebugScopedSetImplThread impl; - if (m_layerRendererInitialized) - m_layerTreeHostImpl->layerRenderer()->doNoOp(); + if (m_rendererInitialized) + m_layerTreeHostImpl->renderer()->doNoOp(); } } @@ -297,7 +298,7 @@ bool CCSingleThreadProxy::commitAndComposite() ASSERT(CCProxy::isMainThread()); - if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) + if (!m_layerTreeHost->initializeRendererIfNeeded()) return false; if (m_layerTreeHostImpl->contentsTexturesPurged()) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h index 7f8047859..a73a6aa17 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h @@ -48,11 +48,11 @@ public: virtual bool initializeContext() OVERRIDE; virtual void setSurfaceReady() OVERRIDE; virtual void setVisible(bool) OVERRIDE; - virtual bool initializeLayerRenderer() OVERRIDE; + virtual bool initializeRenderer() OVERRIDE; virtual bool recreateContext() OVERRIDE; virtual int compositorIdentifier() const OVERRIDE { return m_compositorIdentifier; } virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE; - virtual const LayerRendererCapabilities& layerRendererCapabilities() const OVERRIDE; + virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; virtual void loseContext() OVERRIDE; virtual void setNeedsAnimate() OVERRIDE; virtual void setNeedsCommit() OVERRIDE; @@ -89,14 +89,14 @@ private: bool m_contextLost; int m_compositorIdentifier; - // Holds on to the context between initializeContext() and initializeLayerRenderer() calls. Shouldn't + // Holds on to the context between initializeContext() and initializeRenderer() calls. Shouldn't // be used for anything else. OwnPtr<CCGraphicsContext> m_contextBeforeInitialization; // Used on the CCThread, but checked on main thread during initialization/shutdown. OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; - bool m_layerRendererInitialized; - LayerRendererCapabilities m_layerRendererCapabilitiesForMainThread; + bool m_rendererInitialized; + RendererCapabilities m_RendererCapabilitiesForMainThread; bool m_nextFrameIsNewlyCommittedFrame; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp index 23984f9d4..fe0007f55 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp @@ -49,8 +49,11 @@ CCSolidColorLayerImpl::~CCSolidColorLayerImpl() { } -void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + // We create a series of smaller quads instead of just one large one so that the // culler can reduce the total pixels drawn. int width = contentBounds().width(); @@ -58,7 +61,7 @@ void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuad for (int x = 0; x < width; x += m_tileSize) { for (int y = 0; y < height; y += m_tileSize) { IntRect solidTileRect(x, y, min(width - x, m_tileSize), min(height - y, m_tileSize)); - quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, solidTileRect, backgroundColor())); + quadSink.append(CCSolidColorDrawQuad::create(sharedQuadState, solidTileRect, backgroundColor())); } } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h index d19a230dc..a2914017d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h @@ -31,8 +31,6 @@ namespace WebCore { -class LayerRendererChromium; - class CCSolidColorLayerImpl : public CCLayerImpl { public: static PassOwnPtr<CCSolidColorLayerImpl> create(int id) @@ -41,7 +39,7 @@ public: } virtual ~CCSolidColorLayerImpl(); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; protected: explicit CCSolidColorLayerImpl(int id); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp index b981f713d..59dbc8ac0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp @@ -58,12 +58,16 @@ void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId); } -void CCTextureLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCTextureLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { if (!m_externalTextureResource) return; + + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped)); } void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h index 153eb918e..55d48b451 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h @@ -39,7 +39,7 @@ public: virtual ~CCTextureLayerImpl(); virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp index 297b13563..583c70c60 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp @@ -71,7 +71,7 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) , m_forcedCommitRequested(false) , m_layerTreeHost(layerTreeHost) , m_compositorIdentifier(-1) - , m_layerRendererInitialized(false) + , m_rendererInitialized(false) , m_started(false) , m_texturesAcquired(true) , m_inCompositeAndReadback(false) @@ -101,7 +101,7 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) ASSERT(isMainThread()); ASSERT(m_layerTreeHost); - if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) { + if (!m_layerTreeHost->initializeRendererIfNeeded()) { TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized"); return false; } @@ -208,23 +208,23 @@ void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool v completion->signal(); } -bool CCThreadProxy::initializeLayerRenderer() +bool CCThreadProxy::initializeRenderer() { - TRACE_EVENT0("cc", "CCThreadProxy::initializeLayerRenderer"); - // Make a blocking call to initializeLayerRendererOnImplThread. The results of that call + TRACE_EVENT0("cc", "CCThreadProxy::initializeRenderer"); + // Make a blocking call to initializeRendererOnImplThread. The results of that call // are pushed into the initializeSucceeded and capabilities local variables. CCCompletionEvent completion; bool initializeSucceeded = false; - LayerRendererCapabilities capabilities; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnImplThread, + RendererCapabilities capabilities; + CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeRendererOnImplThread, &completion, &initializeSucceeded, &capabilities)); completion.wait(); if (initializeSucceeded) { - m_layerRendererInitialized = true; - m_layerRendererCapabilitiesMainThreadCopy = capabilities; + m_rendererInitialized = true; + m_RendererCapabilitiesMainThreadCopy = capabilities; } return initializeSucceeded; } @@ -247,7 +247,7 @@ bool CCThreadProxy::recreateContext() // variables. CCCompletionEvent completion; bool recreateSucceeded = false; - LayerRendererCapabilities capabilities; + RendererCapabilities capabilities; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread, &completion, context.leakPtr(), @@ -256,7 +256,7 @@ bool CCThreadProxy::recreateContext() completion.wait(); if (recreateSucceeded) - m_layerRendererCapabilitiesMainThreadCopy = capabilities; + m_RendererCapabilitiesMainThreadCopy = capabilities; return recreateSucceeded; } @@ -277,10 +277,10 @@ void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats) completion.wait(); } -const LayerRendererCapabilities& CCThreadProxy::layerRendererCapabilities() const +const RendererCapabilities& CCThreadProxy::rendererCapabilities() const { - ASSERT(m_layerRendererInitialized); - return m_layerRendererCapabilitiesMainThreadCopy; + ASSERT(m_rendererInitialized); + return m_RendererCapabilitiesMainThreadCopy; } void CCThreadProxy::loseContext() @@ -418,8 +418,8 @@ void CCThreadProxy::forceSerializeOnSwapBuffers() void CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent* completion) { - if (m_layerRendererInitialized) - m_layerTreeHostImpl->layerRenderer()->doNoOp(); + if (m_rendererInitialized) + m_layerTreeHostImpl->renderer()->doNoOp(); completion->signal(); } @@ -517,7 +517,7 @@ void CCThreadProxy::beginFrame() m_commitRequested = false; m_forcedCommitRequested = false; - if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) + if (!m_layerTreeHost->initializeRendererIfNeeded()) return; if (request->contentsTexturesWereDeleted) @@ -577,7 +577,7 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion } else m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; - m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader()); + m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader()); m_commitCompletionEventOnImplThread = completion; m_schedulerOnImplThread->beginFrameComplete(); @@ -663,8 +663,8 @@ CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte if (!m_layerTreeHostImpl) return result; - ASSERT(m_layerTreeHostImpl->layerRenderer()); - if (!m_layerTreeHostImpl->layerRenderer()) + ASSERT(m_layerTreeHostImpl->renderer()); + if (!m_layerTreeHostImpl->renderer()) return result; // FIXME: compute the frame display time more intelligently @@ -850,14 +850,14 @@ void CCThreadProxy::initializeContextOnImplThread(CCGraphicsContext* context) m_contextBeforeInitializationOnImplThread = adoptPtr(context); } -void CCThreadProxy::initializeLayerRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities) +void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities) { - TRACE_EVENT0("cc", "CCThreadProxy::initializeLayerRendererOnImplThread"); + TRACE_EVENT0("cc", "CCThreadProxy::initializeRendererOnImplThread"); ASSERT(isImplThread()); ASSERT(m_contextBeforeInitializationOnImplThread); - *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitializationOnImplThread.release(), textureUploader); + *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitializationOnImplThread.release(), textureUploader); if (*initializeSucceeded) { - *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); + *capabilities = m_layerTreeHostImpl->rendererCapabilities(); if (capabilities->usingSwapCompleteCallback) m_schedulerOnImplThread->setMaxFramesPending(2); } @@ -888,14 +888,15 @@ size_t CCThreadProxy::maxPartialTextureUpdates() const return CCTextureUpdateController::maxPartialTextureUpdates(); } -void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, LayerRendererCapabilities* capabilities) +void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, RendererCapabilities* capabilities) { TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); ASSERT(isImplThread()); - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); - *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptPtr(contextPtr), textureUploader); + if (!m_layerTreeHostImpl->contentsTexturesPurged()) + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); + *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(adoptPtr(contextPtr), textureUploader); if (*recreateSucceeded) { - *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); + *capabilities = m_layerTreeHostImpl->rendererCapabilities(); m_schedulerOnImplThread->didRecreateContext(); } completion->signal(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h index 91a9e4d44..a240281c5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h @@ -57,11 +57,11 @@ public: virtual bool initializeContext() OVERRIDE; virtual void setSurfaceReady() OVERRIDE; virtual void setVisible(bool) OVERRIDE; - virtual bool initializeLayerRenderer() OVERRIDE; + virtual bool initializeRenderer() OVERRIDE; virtual bool recreateContext() OVERRIDE; virtual int compositorIdentifier() const OVERRIDE; virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE; - virtual const LayerRendererCapabilities& layerRendererCapabilities() const OVERRIDE; + virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; virtual void loseContext() OVERRIDE; virtual void setNeedsAnimate() OVERRIDE; virtual void setNeedsCommit() OVERRIDE; @@ -136,11 +136,11 @@ private: void setSurfaceReadyOnImplThread(); void setVisibleOnImplThread(CCCompletionEvent*, bool); void initializeContextOnImplThread(CCGraphicsContext*); - void initializeLayerRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*); + void initializeRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, RendererCapabilities*); void layerTreeHostClosedOnImplThread(CCCompletionEvent*); void setFullRootLayerDamageOnImplThread(); void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*); - void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, LayerRendererCapabilities*); + void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, RendererCapabilities*); void implSideRenderingStatsOnImplThread(CCCompletionEvent*, CCRenderingStats*); CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw); void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*); @@ -153,8 +153,8 @@ private: OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer; CCLayerTreeHost* m_layerTreeHost; int m_compositorIdentifier; - bool m_layerRendererInitialized; - LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy; + bool m_rendererInitialized; + RendererCapabilities m_RendererCapabilitiesMainThreadCopy; bool m_started; bool m_texturesAcquired; bool m_inCompositeAndReadback; @@ -168,7 +168,7 @@ private: RefPtr<CCScopedThreadProxy> m_mainThreadProxy; // Holds on to the context we might use for compositing in between initializeContext() - // and initializeLayerRenderer() calls. + // and initializeRenderer() calls. OwnPtr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread; // Set when the main thread is waiting on a scheduledActionBeginFrame to be issued. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index ad993ca15..b611d9891 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -125,13 +125,16 @@ DrawableTile* CCTiledLayerImpl::createTile(int i, int j) return addedTile; } -void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) +void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, bool& hadMissingTiles) { const IntRect& contentRect = visibleContentRect(); if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty()) return; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + int left, top, right, bottom; m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); @@ -146,7 +149,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderMissingTileColorRed, debugTileBorderMissingTileColorGreen, debugTileBorderMissingTileColorBlue); else borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); - quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, tileRect, borderColor, debugTileBorderWidth)); + quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, tileRect, borderColor, debugTileBorderWidth)); } } } @@ -167,9 +170,9 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState if (!tile || !tile->resourceId()) { if (drawCheckerboardForMissingTiles()) - hadMissingTiles |= quadList.append(CCCheckerboardDrawQuad::create(sharedQuadState, tileRect)); + hadMissingTiles |= quadSink.append(CCCheckerboardDrawQuad::create(sharedQuadState, tileRect)); else - hadMissingTiles |= quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, tileRect, backgroundColor())); + hadMissingTiles |= quadSink.append(CCSolidColorDrawQuad::create(sharedQuadState, tileRect, backgroundColor())); continue; } @@ -195,7 +198,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; - quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h index 6b877b341..1bc60aba4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h @@ -42,7 +42,7 @@ public: } virtual ~CCTiledLayerImpl(); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h b/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h index c6309d210..426a25364 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h @@ -52,7 +52,7 @@ public: virtual bool active() const = 0; virtual void setTimebaseAndInterval(double timebase, double intervalSeconds) = 0; virtual double lastTickTime() = 0; - virtual double nextTickTime() = 0; + virtual double nextTickTimeIfActivated() = 0; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index 14cb32726..662cd2f03 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -177,13 +177,16 @@ void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_frame->textureId()); } -void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { ASSERT(CCProxy::isImplThread()); if (!m_frame) return; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + // FIXME: When we pass quads out of process, we need to double-buffer, or // otherwise synchonize use of all textures in the quad. @@ -196,7 +199,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState const FramePlane& uPlane = m_framePlanes[WebKit::WebVideoFrame::uPlane]; const FramePlane& vPlane = m_framePlanes[WebKit::WebVideoFrame::vPlane]; OwnPtr<CCYUVVideoDrawQuad> yuvVideoQuad = CCYUVVideoDrawQuad::create(sharedQuadState, quadRect, yPlane, uPlane, vPlane); - quadList.append(yuvVideoQuad.release()); + quadSink.append(yuvVideoQuad.release()); break; } case GraphicsContext3D::RGBA: { @@ -208,7 +211,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState FloatRect uvRect(0, 0, widthScaleFactor, 1); bool flipped = false; OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); - quadList.append(textureQuad.release()); + quadSink.append(textureQuad.release()); break; } case GraphicsContext3D::TEXTURE_2D: { @@ -217,19 +220,19 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState FloatRect uvRect(0, 0, 1, 1); bool flipped = false; OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped); - quadList.append(textureQuad.release()); + quadSink.append(textureQuad.release()); break; } case Extensions3D::TEXTURE_RECTANGLE_ARB: { IntSize textureSize(m_frame->width(), m_frame->height()); OwnPtr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDrawQuad::Unflipped); - quadList.append(ioSurfaceQuad.release()); + quadSink.append(ioSurfaceQuad.release()); break; } case Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES: { // StreamTexture hardware decoder. OwnPtr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); - quadList.append(streamVideoQuad.release()); + quadSink.append(streamVideoQuad.release()); break; } default: diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index 30070c8c1..2c54e3513 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -51,7 +51,7 @@ public: virtual ~CCVideoLayerImpl(); virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; diff --git a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm index d042c660c..d570f485a 100644 --- a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm +++ b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm @@ -57,15 +57,9 @@ namespace WebCore { // the restructuring in https://bugs.webkit.org/show_bug.cgi?id=66903 is done class GraphicsContext3DPrivate { public: - GraphicsContext3DPrivate(GraphicsContext3D* graphicsContext3D) - : m_graphicsContext3D(graphicsContext3D) - { - } + GraphicsContext3DPrivate(GraphicsContext3D*) { } ~GraphicsContext3DPrivate() { } - -private: - GraphicsContext3D* m_graphicsContext3D; // Weak back-pointer }; static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest) diff --git a/Source/WebCore/platform/text/TextDirection.h b/Source/WebCore/platform/text/TextDirection.h index 5be416e49..9a074c85d 100644 --- a/Source/WebCore/platform/text/TextDirection.h +++ b/Source/WebCore/platform/text/TextDirection.h @@ -28,7 +28,9 @@ namespace WebCore { - enum TextDirection { RTL, LTR }; +enum TextDirection { RTL, LTR }; + +inline bool isLeftToRightDirection(TextDirection direction) { return direction == LTR; } } diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/platform/text/WritingMode.h index ed36d8675..9a4a2064b 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/platform/text/WritingMode.h @@ -1,10 +1,10 @@ /* - * Copyright (C) 2008, 2009 Google Inc. All rights reserved. - * + * Copyright (c) 2012, Google Inc. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -28,69 +28,30 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "V8Proxy.h" - -#include "BindingState.h" -#include "CachedMetadata.h" -#include "DateExtension.h" -#include "Document.h" -#include "DocumentLoader.h" -#include "ExceptionHeaders.h" -#include "ExceptionInterfaces.h" -#include "Frame.h" -#include "FrameLoaderClient.h" -#include "IDBFactoryBackendInterface.h" -#include "InspectorInstrumentation.h" -#include "PlatformSupport.h" -#include "ScriptCallStack.h" -#include "ScriptCallStackFactory.h" -#include "ScriptRunner.h" -#include "ScriptSourceCode.h" -#include "SecurityOrigin.h" -#include "Settings.h" -#include "StylePropertySet.h" -#include "V8Binding.h" -#include "V8Collection.h" -#include "V8DOMCoreException.h" -#include "V8DOMMap.h" -#include "V8DOMWindow.h" -#include "V8HiddenPropertyName.h" -#include "V8IsolatedContext.h" -#include "V8RecursionScope.h" -#include "WorkerContext.h" -#include "WorkerContextExecutionProxy.h" - -#include <algorithm> -#include <stdio.h> -#include <utility> -#include <wtf/Assertions.h> -#include <wtf/OwnArrayPtr.h> -#include <wtf/OwnPtr.h> -#include <wtf/StdLibExtras.h> -#include <wtf/StringExtras.h> -#include <wtf/UnusedParam.h> -#include <wtf/text/WTFString.h> - -#if PLATFORM(CHROMIUM) -#include "TraceEvent.h" -#endif +#ifndef WritingMode_h +#define WritingMode_h namespace WebCore { -V8Proxy::V8Proxy(Frame* frame) - : m_frame(frame) +enum WritingMode { + TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode +}; + +inline bool isHorizontalWritingMode(WritingMode writingMode) { + return writingMode == TopToBottomWritingMode || writingMode == BottomToTopWritingMode; } -V8Proxy::~V8Proxy() +inline bool isFlippedLinesWritingMode(WritingMode writingMode) { - windowShell()->destroyGlobal(); + return writingMode == LeftToRightWritingMode || writingMode == BottomToTopWritingMode; } -V8DOMWindowShell* V8Proxy::windowShell() const +inline bool isFlippedBlocksWritingMode(WritingMode writingMode) { - return frame()->script()->windowShell(); + return writingMode == RightToLeftWritingMode || writingMode == BottomToTopWritingMode; } -} // namespace WebCore +} // namespace WebCore + +#endif // WritingMode_h diff --git a/Source/WebCore/platform/win/PopupMenuWin.cpp b/Source/WebCore/platform/win/PopupMenuWin.cpp index eb5c5b1a0..a86847ddf 100644 --- a/Source/WebCore/platform/win/PopupMenuWin.cpp +++ b/Source/WebCore/platform/win/PopupMenuWin.cpp @@ -726,6 +726,31 @@ void PopupMenuWin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& ::InvalidateRect(m_popup, &r, false); } +int PopupMenuWin::visibleHeight() const +{ + return m_scrollbar ? m_scrollbar->visibleSize() : m_windowRect.height(); +} + +int PopupMenuWin::visibleWidth() const +{ + return m_windowRect.width(); +} + +IntSize PopupMenuWin::contentsSize() const +{ + return m_windowRect.size(); +} + +bool PopupMenuWin::isOnActivePage() const +{ + return m_showPopup; +} + +IntRect PopupMenuWin::scrollableAreaBoundingBox() const +{ + return m_windowRect; +} + void PopupMenuWin::registerClass() { static bool haveRegisteredWindowClass = false; diff --git a/Source/WebCore/platform/win/PopupMenuWin.h b/Source/WebCore/platform/win/PopupMenuWin.h index 3aee51cb9..9b6ffa7d3 100644 --- a/Source/WebCore/platform/win/PopupMenuWin.h +++ b/Source/WebCore/platform/win/PopupMenuWin.h @@ -91,16 +91,21 @@ private: void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } // ScrollableArea - virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual int scrollPosition(Scrollbar*) const; - virtual void setScrollOffset(const IntPoint&); - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { } - virtual bool isActive() const { return true; } - ScrollableArea* enclosingScrollableArea() const { return 0; } - virtual bool isScrollCornerVisible() const { return false; } - virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); } - virtual Scrollbar* verticalScrollbar() const { return m_scrollbar.get(); } + virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const IntPoint&) OVERRIDE; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } + virtual bool isActive() const OVERRIDE { return true; } + ScrollableArea* enclosingScrollableArea() const OVERRIDE { return 0; } + virtual bool isScrollCornerVisible() const OVERRIDE { return false; } + virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } + virtual Scrollbar* verticalScrollbar() const OVERRIDE { return m_scrollbar.get(); } + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual IntSize contentsSize() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. void scrollTo(int offset); diff --git a/Source/WebCore/platform/wx/CursorWx.cpp b/Source/WebCore/platform/wx/CursorWx.cpp index dd61f1e88..5ffaa9db9 100644 --- a/Source/WebCore/platform/wx/CursorWx.cpp +++ b/Source/WebCore/platform/wx/CursorWx.cpp @@ -62,61 +62,61 @@ Cursor::Cursor(wxCursor* c) const Cursor& pointerCursor() { - static Cursor c = new wxCursor(wxCURSOR_ARROW); + static Cursor c = Cursor(new wxCursor(wxCURSOR_ARROW)); return c; } const Cursor& crossCursor() { - static Cursor c = new wxCursor(wxCURSOR_CROSS); + static Cursor c = Cursor(new wxCursor(wxCURSOR_CROSS)); return c; } const Cursor& handCursor() { - static Cursor c = new wxCursor(wxCURSOR_HAND); + static Cursor c = Cursor(new wxCursor(wxCURSOR_HAND)); return c; } const Cursor& iBeamCursor() { - static Cursor c = new wxCursor(wxCURSOR_IBEAM); + static Cursor c = Cursor(new wxCursor(wxCURSOR_IBEAM)); return c; } const Cursor& waitCursor() { - static Cursor c = new wxCursor(wxCURSOR_WAIT); + static Cursor c = Cursor(new wxCursor(wxCURSOR_WAIT)); return c; } const Cursor& helpCursor() { - static Cursor c = new wxCursor(wxCURSOR_QUESTION_ARROW); + static Cursor c = Cursor(new wxCursor(wxCURSOR_QUESTION_ARROW)); return c; } const Cursor& eastResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZEWE); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZEWE)); return c; } const Cursor& northResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZENS); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZENS)); return c; } const Cursor& northEastResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZENESW); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZENESW)); return c; } const Cursor& northWestResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZENWSE); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZENWSE)); return c; } @@ -171,14 +171,14 @@ const Cursor& northWestSouthEastResizeCursor() const Cursor& columnResizeCursor() { // FIXME: Windows does not have a standard column resize cursor - static Cursor c = new wxCursor(wxCURSOR_SIZING); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZING)); return c; } const Cursor& rowResizeCursor() { // FIXME: Windows does not have a standard row resize cursor - static Cursor c = new wxCursor(wxCURSOR_SIZING); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZING)); return c; } @@ -270,13 +270,13 @@ const Cursor& noneCursor() const Cursor& notAllowedCursor() { - static Cursor c = new wxCursor(wxCURSOR_NO_ENTRY); + static Cursor c = Cursor(new wxCursor(wxCURSOR_NO_ENTRY)); return c; } const Cursor& zoomInCursor() { - static Cursor c = new wxCursor(wxCURSOR_MAGNIFIER); + static Cursor c = Cursor(new wxCursor(wxCURSOR_MAGNIFIER)); return c; } @@ -300,7 +300,7 @@ const Cursor& grabbingCursor() const Cursor& moveCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZING); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZING)); return c; } diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp index c3da10025..126db27f9 100644 --- a/Source/WebCore/rendering/InlineFlowBox.cpp +++ b/Source/WebCore/rendering/InlineFlowBox.cpp @@ -792,10 +792,10 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu FractionalLayoutBoxExtent borderOutsets = style->borderImageOutsets(); - LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style); - LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style); - LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style); - LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style); + LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style->writingMode()); + LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style->writingMode()); + LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style->writingMode()); + LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style->writingMode()); // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since // the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes. diff --git a/Source/WebCore/rendering/LayoutState.cpp b/Source/WebCore/rendering/LayoutState.cpp index f750cb159..1dff9533e 100644 --- a/Source/WebCore/rendering/LayoutState.cpp +++ b/Source/WebCore/rendering/LayoutState.cpp @@ -55,15 +55,15 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz if (renderer->isOutOfFlowPositioned() && !fixed) { if (RenderObject* container = renderer->container()) { - if (container->isRelPositioned() && container->isRenderInline()) - m_paintOffset += toRenderInline(container)->relativePositionedInlineOffset(renderer); + if (container->isInFlowPositioned() && container->isRenderInline()) + m_paintOffset += toRenderInline(container)->offsetForInFlowPositionedInline(renderer); } } m_layoutOffset = m_paintOffset; - if (renderer->isRelPositioned() && renderer->hasLayer()) - m_paintOffset += renderer->layer()->relativePositionOffset(); + if (renderer->isInFlowPositioned() && renderer->hasLayer()) + m_paintOffset += renderer->layer()->offsetForInFlowPosition(); m_clipped = !fixed && prev->m_clipped; if (m_clipped) diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index a4158f4e1..119cbb7fd 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -309,7 +309,7 @@ void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt toRenderBlock(cb)->removePositionedObjects(this); } - if (containsFloats() && !isFloating() && !isOutOfFlowPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition)) + if (containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newStyle->hasOutOfFlowPosition()) markAllDescendantsWithFloatsForLayout(); } @@ -1143,6 +1143,8 @@ void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* c RenderObject* nextSibling = child->nextSibling(); RenderFlowThread* childFlowThread = child->enclosingRenderFlowThread(); + CurrentRenderFlowThreadMaintainer flowThreadMaintainer(childFlowThread); + RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(parent, child, child->hasLayer())); anonBlock->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); // Delete the now-empty block's lines and nuke it. @@ -3174,9 +3176,10 @@ bool RenderBlock::isSelectionRoot() const if (isTable()) return false; - if (isBody() || isRoot() || hasOverflowClip() || isRelPositioned() - || isFloatingOrOutOfFlowPositioned() || isTableCell() || isInlineBlockOrInlineTable() || hasTransform() - || hasReflection() || hasMask() || isWritingModeRoot()) + if (isBody() || isRoot() || hasOverflowClip() + || isInFlowPositioned() || isFloatingOrOutOfFlowPositioned() + || isTableCell() || isInlineBlockOrInlineTable() + || hasTransform() || hasReflection() || hasMask() || isWritingModeRoot()) return true; if (view() && view()->selectionStart()) { @@ -3396,10 +3399,10 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoi if (curr->isFloatingOrOutOfFlowPositioned()) continue; // We must be a normal flow object in order to even be considered. - if (curr->isRelPositioned() && curr->hasLayer()) { + if (curr->isInFlowPositioned() && curr->hasLayer()) { // If the relposition offset is anything other than 0, then treat this just like an absolute positioned element. // Just disregard it completely. - LayoutSize relOffset = curr->layer()->relativePositionOffset(); + LayoutSize relOffset = curr->layer()->offsetForInFlowPosition(); if (relOffset.width() || relOffset.height()) continue; } @@ -4879,8 +4882,9 @@ static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBlock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) { LayoutPoint childLocation = child->location(); - if (child->isRelPositioned()) - childLocation += child->relativePositionOffset(); + if (child->isInFlowPositioned()) + childLocation += child->offsetForInFlowPosition(); + // FIXME: This is wrong if the child's writing-mode is different from the parent's. LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates - childLocation)); diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index a0056e03b..f16457b5e 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -197,9 +197,9 @@ void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyl markContainingBlocksForLayout(); if (oldStyle->position() == StaticPosition) repaint(); - else if (newStyle->isOutOfFlowPositioned()) + else if (newStyle->hasOutOfFlowPosition()) parent()->setChildNeedsLayout(true); - if (isFloating() && !isOutOfFlowPositioned() && newStyle->isOutOfFlowPositioned()) + if (isFloating() && !isOutOfFlowPositioned() && newStyle->hasOutOfFlowPosition()) removeFloatingOrPositionedChildFromBlockLists(); } } else if (newStyle && isBody()) @@ -301,7 +301,7 @@ void RenderBox::updateBoxModelInfoFromStyle() if (isRootObject || isViewObject) setHasBoxDecorations(true); - setPositioned(styleToUse->isOutOfFlowPositioned()); + setPositioned(styleToUse->hasOutOfFlowPosition()); setFloating(!isOutOfFlowPositioned() && styleToUse->isFloating()); // We also handle <body> and <html>, whose overflow applies to the viewport. @@ -433,19 +433,23 @@ void RenderBox::updateLayerTransform() layer()->updateTransform(); } -LayoutUnit RenderBox::logicalHeightConstrainedByMinMax(LayoutUnit availableHeight) +LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) { RenderStyle* styleToUse = style(); - LayoutUnit result = computeLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight()); - if (result == -1) - result = availableHeight; - LayoutUnit minH = computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight()); // Leave as -1 if unset. - LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? result : computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight()); - if (maxH == -1) - maxH = result; - result = min(maxH, result); - result = max(minH, result); - return result; + if (!styleToUse->logicalMaxWidth().isUndefined()) + logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSize, availableWidth, cb, region, offsetFromLogicalTopOfFirstPage)); + return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, availableWidth, cb, region, offsetFromLogicalTopOfFirstPage)); +} + +LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight) +{ + RenderStyle* styleToUse = style(); + if (!styleToUse->logicalMaxHeight().isUndefined()) { + LayoutUnit maxH = computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight()); + if (maxH != -1) + logicalHeight = min(logicalHeight, maxH); + } + return max(logicalHeight, computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight())); } IntRect RenderBox::absoluteContentBox() const @@ -1272,8 +1276,8 @@ void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, Tran if (v->layoutStateEnabled() && !repaintContainer) { LayoutState* layoutState = v->layoutState(); LayoutSize offset = layoutState->m_paintOffset + locationOffset(); - if (style()->position() == RelativePosition && layer()) - offset += layer()->relativePositionOffset(); + if (style()->hasInFlowPosition() && layer()) + offset += layer()->offsetForInFlowPosition(); transformState.move(offset); return; } @@ -1390,11 +1394,11 @@ LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& po ASSERT(o == container()); LayoutSize offset; - if (isRelPositioned()) - offset += relativePositionOffset(); + if (isInFlowPositioned()) + offset += offsetForInFlowPosition(); if (!isInline() || isReplaced()) { - if (!style()->isOutOfFlowPositioned() && o->hasColumns()) { + if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { RenderBlock* block = toRenderBlock(o); LayoutRect columnRect(frameRect()); block->adjustStartEdgeForWritingModeIncludingColumns(columnRect); @@ -1413,8 +1417,8 @@ LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& po if (o->hasOverflowClip()) offset -= toRenderBox(o)->scrolledContentOffset(); - if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->isRenderInline()) - offset += toRenderInline(o)->relativePositionedInlineOffset(this); + if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline()) + offset += toRenderInline(o)->offsetForInFlowPositionedInline(this); return offset; } @@ -1527,8 +1531,9 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La if (layer() && layer()->transform()) rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); - if (styleToUse->position() == RelativePosition && layer()) - rect.move(layer()->relativePositionOffset()); + // We can't trust the bits on RenderObject, because this might be called while re-resolving style. + if (styleToUse->hasInFlowPosition() && layer()) + rect.move(layer()->offsetForInFlowPosition()); rect.moveBy(location()); rect.move(layoutState->m_paintOffset); @@ -1570,14 +1575,14 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La } else if (position == FixedPosition) fixed = true; - if (position == AbsolutePosition && o->isRelPositioned() && o->isRenderInline()) - topLeft += toRenderInline(o)->relativePositionedInlineOffset(this); - else if (position == RelativePosition && layer()) { + if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline()) + topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this); + else if ((position == RelativePosition) && layer()) { // Apply the relative position offset when invalidating a rectangle. The layer // is translated, but the render box isn't, so we need to do this to get the // right dirty rect. Since this is called from RenderObject::setStyle, the relative position // flag on the RenderObject has been cleared, so use the one on the style(). - topLeft += layer()->relativePositionOffset(); + topLeft += layer()->offsetForInFlowPosition(); } if (o->isBlockFlow() && position != AbsolutePosition && position != FixedPosition) { @@ -1690,20 +1695,8 @@ void RenderBox::computeLogicalWidthInRegion(RenderRegion* region, LayoutUnit off if (treatAsReplaced) setLogicalWidth(logicalWidthLength.value() + borderAndPaddingLogicalWidth()); else { - // Calculate LogicalWidth - setLogicalWidth(computeLogicalWidthInRegionUsing(MainOrPreferredSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage)); - - // Calculate MaxLogicalWidth - if (!styleToUse->logicalMaxWidth().isUndefined()) { - LayoutUnit maxLogicalWidth = computeLogicalWidthInRegionUsing(MaxSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); - if (logicalWidth() > maxLogicalWidth) - setLogicalWidth(maxLogicalWidth); - } - - // Calculate MinLogicalWidth - LayoutUnit minLogicalWidth = computeLogicalWidthInRegionUsing(MinSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); - if (logicalWidth() < minLogicalWidth) - setLogicalWidth(minLogicalWidth); + LayoutUnit preferredWidth = computeLogicalWidthInRegionUsing(MainOrPreferredSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); + setLogicalWidth(constrainLogicalWidthInRegionByMinMax(preferredWidth, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage)); } // Fieldsets are currently the only objects that stretch to their minimum width. @@ -2013,9 +2006,12 @@ void RenderBox::computeLogicalHeight() } LayoutUnit heightResult; - if (checkMinMaxHeight) - heightResult = logicalHeightConstrainedByMinMax(logicalHeight()); - else { + if (checkMinMaxHeight) { + heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()); + if (heightResult == -1) + heightResult = logicalHeight(); + heightResult = constrainLogicalHeightByMinMax(heightResult); + } else { // The only times we don't check min/max height are when a fixed length has // been given as an override. Just use that. The value has already been adjusted // for box-sizing. @@ -2390,7 +2386,7 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo return result; } - ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned()); + ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositioned()); const RenderInline* flow = toRenderInline(containingBlock); InlineFlowBox* first = flow->firstLineBox(); @@ -2431,7 +2427,7 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM return result; } - ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned()); + ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositioned()); const RenderInline* flow = toRenderInline(containingBlock); InlineFlowBox* first = flow->firstLineBox(); @@ -2538,8 +2534,8 @@ void RenderBox::computePositionedLogicalWidth(RenderRegion* region, LayoutUnit o const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); const Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop(); const Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom(); - LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()); - LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()); + LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()->writingMode()); + LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()->writingMode()); Length logicalLeftLength = style()->logicalLeft(); Length logicalRightLength = style()->logicalRight(); @@ -2878,8 +2874,8 @@ void RenderBox::computePositionedLogicalHeight() const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); const Length marginBefore = styleToUse->marginBefore(); const Length marginAfter = styleToUse->marginAfter(); - LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(styleToUse); - LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(styleToUse); + LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(styleToUse->writingMode()); + LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(styleToUse->writingMode()); Length logicalTopLength = styleToUse->logicalTop(); Length logicalBottomLength = styleToUse->logicalBottom(); @@ -3145,8 +3141,8 @@ void RenderBox::computePositionedLogicalWidthReplaced() Length logicalRight = style()->logicalRight(); Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop(); Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom(); - LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()); - LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()); + LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()->writingMode()); + LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()->writingMode()); /*-----------------------------------------------------------------------*\ * 1. The used value of 'width' is determined as for inline replaced @@ -3306,8 +3302,8 @@ void RenderBox::computePositionedLogicalHeightReplaced() // Variables to solve. Length marginBefore = style()->marginBefore(); Length marginAfter = style()->marginAfter(); - LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(style()); - LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(style()); + LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(style()->writingMode()); + LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(style()->writingMode()); Length logicalTop = style()->logicalTop(); Length logicalBottom = style()->logicalBottom(); @@ -3836,7 +3832,7 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) rect.unite(layoutOverflowRect()); bool hasTransform = hasLayer() && layer()->transform(); - if (isRelPositioned() || hasTransform) { + if (isInFlowPositioned() || hasTransform) { // If we are relatively positioned or if we have a transform, then we have to convert // this rectangle into physical coordinates, apply relative positioning and transforms // to it, and then convert it back. @@ -3845,8 +3841,8 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) if (hasTransform) rect = layer()->currentTransform().mapRect(rect); - if (isRelPositioned()) - rect.move(relativePositionOffset()); + if (isInFlowPositioned()) + rect.move(offsetForInFlowPosition()); // Now we need to flip back. flipForWritingMode(rect); diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 00b05f4e1..f011714cb 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -44,7 +44,7 @@ public: // hasAutoZIndex only returns true if the element is positioned or a flex-item since // position:static elements that are not flex-items get their z-index coerced to auto. - virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); } + virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isInFlowPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); } // Use this with caution! No type checking is done! RenderBox* firstChildBox() const; @@ -75,7 +75,8 @@ public: LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); } LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); } - LayoutUnit logicalHeightConstrainedByMinMax(LayoutUnit); + LayoutUnit constrainLogicalWidthInRegionByMinMax(LayoutUnit, LayoutUnit, RenderBlock*, RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = ZERO_LAYOUT_UNIT); + LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit); int pixelSnappedLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedHeight() : pixelSnappedWidth(); } int pixelSnappedLogicalWidth() const { return style()->isHorizontalWritingMode() ? pixelSnappedWidth() : pixelSnappedHeight(); } @@ -234,17 +235,33 @@ public: void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); } void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); } - virtual LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style()); } - virtual LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(style()); } + virtual LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style()->writingMode()); } + virtual LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(style()->writingMode()); } - virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.before(overrideStyle ? overrideStyle : style()); } - virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.after(overrideStyle ? overrideStyle : style()); } - virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.start(overrideStyle ? overrideStyle : style()); } - virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.end(overrideStyle ? overrideStyle : style()); } - void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore(overrideStyle ? overrideStyle : style(), value); } - void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter(overrideStyle ? overrideStyle : style(), value); } - void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setStart(overrideStyle ? overrideStyle : style(), value); } - void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setEnd(overrideStyle ? overrideStyle : style(), value); } + virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.before((overrideStyle ? overrideStyle : style())->writingMode()); } + virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.after((overrideStyle ? overrideStyle : style())->writingMode()); } + virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const OVERRIDE + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + return m_marginBox.start(styleToUse->writingMode(), styleToUse->direction()); + } + virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVERRIDE + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + return m_marginBox.end(styleToUse->writingMode(), styleToUse->direction()); + } + void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore((overrideStyle ? overrideStyle : style())->writingMode(), value); } + void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter((overrideStyle ? overrideStyle : style())->writingMode(), value); } + void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0) + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + m_marginBox.setStart(styleToUse->writingMode(), styleToUse->direction(), value); + } + void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0) + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + m_marginBox.setEnd(styleToUse->writingMode(), styleToUse->direction(), value); + } // The following five functions are used to implement collapsing margins. // All objects know their maximal positive and negative margins. The diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index caf327b13..7dcd24129 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -459,16 +459,16 @@ void RenderBoxModelObject::updateBoxModelInfoFromStyle() setHorizontalWritingMode(styleToUse->isHorizontalWritingMode()); } -static LayoutSize accumulateRelativePositionOffsets(const RenderObject* child) +static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child) { - if (!child->isAnonymousBlock() || !child->isRelPositioned()) + if (!child->isAnonymousBlock() || !child->isInFlowPositioned()) return LayoutSize(); LayoutSize offset; RenderObject* p = toRenderBlock(child)->inlineElementContinuation(); while (p && p->isRenderInline()) { - if (p->isRelPositioned()) { + if (p->isInFlowPositioned()) { RenderInline* renderInline = toRenderInline(p); - offset += renderInline->relativePositionOffset(); + offset += renderInline->offsetForInFlowPosition(); } p = p->parent(); } @@ -477,7 +477,7 @@ static LayoutSize accumulateRelativePositionOffsets(const RenderObject* child) LayoutSize RenderBoxModelObject::relativePositionOffset() const { - LayoutSize offset = accumulateRelativePositionOffsets(this); + LayoutSize offset = accumulateInFlowPositionOffsets(this); RenderBlock* containingBlock = this->containingBlock(); @@ -550,6 +550,14 @@ LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const L return referencePoint; } +LayoutSize RenderBoxModelObject::offsetForInFlowPosition() const +{ + if (isRelPositioned()) + return relativePositionOffset(); + + return LayoutSize(); +} + LayoutUnit RenderBoxModelObject::offsetLeft() const { // Note that RenderInline and RenderBox override this to pass a different @@ -745,14 +753,14 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co // while rendering.) if (forceBackgroundToWhite) { // Note that we can't reuse this variable below because the bgColor might be changed - bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid() && bgColor.alpha() > 0; + bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid() && bgColor.alpha(); if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) { bgColor = Color::white; shouldPaintBackgroundImage = false; } } - bool colorVisible = bgColor.isValid() && bgColor.alpha() > 0; + bool colorVisible = bgColor.isValid() && bgColor.alpha(); // Fast path for drawing simple color backgrounds. if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && !bgLayer->next()) { @@ -2420,7 +2428,7 @@ bool RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(BackgroundBleedA return false; Color backgroundColor = style()->visitedDependentColor(CSSPropertyBackgroundColor); - if (!backgroundColor.isValid() || backgroundColor.alpha() < 255) + if (!backgroundColor.isValid() || backgroundColor.hasAlpha()) return false; const FillLayer* lastBackgroundLayer = style()->backgroundLayers(); @@ -2733,7 +2741,7 @@ void RenderBoxModelObject::mapAbsoluteToLocalPoint(bool fixed, bool useTransform LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); - if (!style()->isOutOfFlowPositioned() && o->hasColumns()) { + if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { RenderBlock* block = static_cast<RenderBlock*>(o); LayoutPoint point(roundedLayoutPoint(transformState.mappedPoint())); point -= containerOffset; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index 067f6046d..8d5e83e7a 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -62,6 +62,8 @@ public: LayoutSize relativePositionOffset() const; LayoutSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); } + LayoutSize offsetForInFlowPosition() const; + // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) // to return the remaining width on a given line (and the height of a single line). virtual LayoutUnit offsetLeft() const; @@ -74,13 +76,13 @@ public: int pixelSnappedOffsetWidth() const; int pixelSnappedOffsetHeight() const; - virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle) OVERRIDE; + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE; virtual void updateBoxModelInfoFromStyle(); bool hasSelfPaintingLayer() const; RenderLayer* layer() const { return m_layer; } - virtual bool requiresLayer() const { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); } + virtual bool requiresLayer() const { return isRoot() || isOutOfFlowPositioned() || isInFlowPositioned() || isTransparent() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); } // This will work on inlines to return the bounding box of all of the lines' border boxes. virtual IntRect borderBoundingBox() const = 0; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 448d4da6d..9f87cf835 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -1233,10 +1233,10 @@ void RenderFlexibleBox::alignChildren(OrderIterator& iterator, const WTF::Vector void RenderFlexibleBox::applyStretchAlignmentToChild(RenderBox* child, LayoutUnit lineCrossAxisExtent) { if (!isColumnFlow() && child->style()->logicalHeight().isAuto()) { - // FIXME: If the child has orthogonal flow, then it already has an override height set. How do we stretch? + // FIXME: If the child has orthogonal flow, then it already has an override height set, so use it. if (!hasOrthogonalFlow(child)) { LayoutUnit stretchedLogicalHeight = child->logicalHeight() + availableAlignmentSpaceForChild(lineCrossAxisExtent, child); - LayoutUnit desiredLogicalHeight = child->logicalHeightConstrainedByMinMax(stretchedLogicalHeight); + LayoutUnit desiredLogicalHeight = child->constrainLogicalHeightByMinMax(stretchedLogicalHeight); // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905. if (desiredLogicalHeight != child->logicalHeight()) { @@ -1246,14 +1246,18 @@ void RenderFlexibleBox::applyStretchAlignmentToChild(RenderBox* child, LayoutUni child->layoutIfNeeded(); } } - } else if (isColumnFlow() && child->style()->logicalWidth().isAuto() && isMultiline()) { - // FIXME: Handle min-width and max-width. - // FIXME: We only need to relayout here if the width changes. - // FIXME: The isMultiline check above may not be necessary if the width has not changed. See https://webkit.org/b/94237 - LayoutUnit childWidth = lineCrossAxisExtent - crossAxisMarginExtentForChild(child); - child->setOverrideLogicalContentWidth(std::max(ZERO_LAYOUT_UNIT, childWidth)); - child->setChildNeedsLayout(true, MarkOnlyThis); - child->layoutIfNeeded(); + } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) { + // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it. + if (hasOrthogonalFlow(child)) { + LayoutUnit childWidth = std::max(ZERO_LAYOUT_UNIT, lineCrossAxisExtent - crossAxisMarginExtentForChild(child)); + childWidth = child->constrainLogicalWidthInRegionByMinMax(childWidth, childWidth, this); + + if (childWidth != child->logicalWidth()) { + child->setOverrideLogicalContentWidth(childWidth); + child->setChildNeedsLayout(true, MarkOnlyThis); + child->layoutIfNeeded(); + } + } } } diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp index 429dad3a9..f3e47df47 100644 --- a/Source/WebCore/rendering/RenderFlowThread.cpp +++ b/Source/WebCore/rendering/RenderFlowThread.cpp @@ -107,26 +107,6 @@ void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion) checkRegionsWithStyling(); } -class CurrentRenderFlowThreadMaintainer { - WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadMaintainer); -public: - CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) - : m_renderFlowThread(renderFlowThread) - { - RenderView* view = m_renderFlowThread->view(); - ASSERT(!view->flowThreadController()->currentRenderFlowThread()); - view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread); - } - ~CurrentRenderFlowThreadMaintainer() - { - RenderView* view = m_renderFlowThread->view(); - ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFlowThread); - view->flowThreadController()->setCurrentRenderFlowThread(0); - } -private: - RenderFlowThread* m_renderFlowThread; -}; - class CurrentRenderFlowThreadDisabler { WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadDisabler); public: @@ -793,4 +773,24 @@ bool RenderFlowThread::objectInFlowRegion(const RenderObject* object, const Rend return false; } +CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) + : m_renderFlowThread(renderFlowThread) +{ + if (!m_renderFlowThread) + return; + RenderView* view = m_renderFlowThread->view(); + ASSERT(!view->flowThreadController()->currentRenderFlowThread()); + view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread); +} + +CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer() +{ + if (!m_renderFlowThread) + return; + RenderView* view = m_renderFlowThread->view(); + ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFlowThread); + view->flowThreadController()->setCurrentRenderFlowThread(0); +} + + } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h index 4730be8dc..34dec69d8 100644 --- a/Source/WebCore/rendering/RenderFlowThread.h +++ b/Source/WebCore/rendering/RenderFlowThread.h @@ -197,6 +197,15 @@ inline const RenderFlowThread* toRenderFlowThread(const RenderObject* object) // This will catch anyone doing an unnecessary cast. void toRenderFlowThread(const RenderFlowThread*); +class CurrentRenderFlowThreadMaintainer { + WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadMaintainer); +public: + CurrentRenderFlowThreadMaintainer(RenderFlowThread*); + ~CurrentRenderFlowThreadMaintainer(); +private: + RenderFlowThread* m_renderFlowThread; +}; + } // namespace WebCore #endif // RenderFlowThread_h diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index d58bfc1ab..b139bcb44 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -129,14 +129,14 @@ void RenderInline::updateBoxModelInfoFromStyle() setHasReflection(false); } -static bool hasRelPositionedInlineAncestor(RenderObject* p) +static RenderObject* inFlowPositionedInlineAncestor(RenderObject* p) { while (p && p->isRenderInline()) { - if (p->isRelPositioned()) - return true; + if (p->isInFlowPositioned()) + return p; p = p->parent(); } - return false; + return 0; } static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const RenderStyle* newStyle, const RenderStyle* oldStyle) @@ -144,10 +144,10 @@ static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const for (;block && block->isAnonymousBlock(); block = block->nextSibling()) { if (!toRenderBlock(block)->isAnonymousBlockContinuation() || block->style()->position() == newStyle->position()) continue; - // If we are no longer relatively positioned but our descendant block(s) still have a relatively positioned ancestor then - // their containing anonymous block should keep its relative positioning. + // If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then + // their containing anonymous block should keep its in-flow positioning. RenderInline* cont = toRenderBlock(block)->inlineElementContinuation(); - if (oldStyle->position() == RelativePosition && hasRelPositionedInlineAncestor(cont)) + if (oldStyle->hasInFlowPosition() && inFlowPositionedInlineAncestor(cont)) continue; RefPtr<RenderStyle> blockStyle = RenderStyle::createAnonymousStyleWithDisplay(block->style(), BLOCK); blockStyle->setPosition(newStyle->position()); @@ -174,10 +174,10 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt currCont->setContinuation(nextCont); } - // If an inline's relative positioning has changed then any descendant blocks will need to change their relative positioning accordingly. + // If an inline's in-flow positioning has changed then any descendant blocks will need to change their in-flow positioning accordingly. // Do this by updating the position of the descendant blocks' containing anonymous blocks - there may be more than one. - if (continuation && oldStyle && newStyle->position() != oldStyle->position() - && (newStyle->position() == RelativePosition || (oldStyle->position() == RelativePosition))) { + if (continuation && oldStyle && newStyle->position() != oldStyle->position() + && (newStyle->hasInFlowPosition() || oldStyle->hasInFlowPosition())) { // If any descendant blocks exist then they will be in the next anonymous block and its siblings. RenderObject* block = containingBlock()->nextSibling(); ASSERT(block && block->isAnonymousBlock()); @@ -310,10 +310,10 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb // the children after |beforeChild| and put them in a clone of this object. RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK); - // If inside an inline affected by relative positioning the block needs to be affected by it too. + // If inside an inline affected by in-flow positioning the block needs to be affected by it too. // Giving the block a layer like this allows it to collect the x/y offsets from inline parents later. - if (hasRelPositionedInlineAncestor(this)) - newStyle->setPosition(RelativePosition); + if (RenderObject* positionedAncestor = inFlowPositionedInlineAncestor(this)) + newStyle->setPosition(positionedAncestor->style()->position()); RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */); newBox->setStyle(newStyle.release()); @@ -969,7 +969,7 @@ LayoutRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* rep LayoutRect repaintRect(linesVisualOverflowBoundingBox()); bool hitRepaintContainer = false; - // We need to add in the relative position offsets of any inlines (including us) up to our + // We need to add in the in-flow position offsets of any inlines (including us) up to our // containing block. RenderBlock* cb = containingBlock(); for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRenderInline() && inlineFlow != cb; @@ -978,8 +978,8 @@ LayoutRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* rep hitRepaintContainer = true; break; } - if (inlineFlow->style()->position() == RelativePosition && inlineFlow->hasLayer()) - repaintRect.move(toRenderInline(inlineFlow)->layer()->relativePositionOffset()); + if (inlineFlow->style()->hasInFlowPosition() && inlineFlow->hasLayer()) + repaintRect.move(toRenderInline(inlineFlow)->layer()->offsetForInFlowPosition()); } LayoutUnit outlineSize = style()->outlineSize(); @@ -1032,8 +1032,8 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, // LayoutState is only valid for root-relative repainting if (v->layoutStateEnabled() && !repaintContainer) { LayoutState* layoutState = v->layoutState(); - if (style()->position() == RelativePosition && layer()) - rect.move(layer()->relativePositionOffset()); + if (style()->hasInFlowPosition() && layer()) + rect.move(layer()->offsetForInFlowPosition()); rect.move(layoutState->m_paintOffset); if (layoutState->m_clipped) rect.intersect(layoutState->m_clipRect); @@ -1051,7 +1051,7 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutPoint topLeft = rect.location(); - if (o->isBlockFlow() && !style()->isOutOfFlowPositioned()) { + if (o->isBlockFlow() && !style()->hasOutOfFlowPosition()) { RenderBlock* cb = toRenderBlock(o); if (cb->hasColumns()) { LayoutRect repaintRect(topLeft, rect.size()); @@ -1061,12 +1061,12 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, } } - if (style()->position() == RelativePosition && layer()) { - // Apply the relative position offset when invalidating a rectangle. The layer + if (style()->hasInFlowPosition() && layer()) { + // Apply the in-flow position offset when invalidating a rectangle. The layer // is translated, but the render box isn't, so we need to do this to get the - // right dirty rect. Since this is called from RenderObject::setStyle, the relative position + // right dirty rect. Since this is called from RenderObject::setStyle, the relative position // flag on the RenderObject has been cleared, so use the one on the style(). - topLeft += layer()->relativePositionOffset(); + topLeft += layer()->offsetForInFlowPosition(); } // FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout, @@ -1102,8 +1102,8 @@ LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const Layo ASSERT(container == this->container()); LayoutSize offset; - if (isRelPositioned()) - offset += relativePositionOffset(); + if (isInFlowPositioned()) + offset += offsetForInFlowPosition(); container->adjustForColumns(offset, point); @@ -1125,8 +1125,8 @@ void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, T if (v->layoutStateEnabled() && !repaintContainer) { LayoutState* layoutState = v->layoutState(); LayoutSize offset = layoutState->m_paintOffset; - if (style()->position() == RelativePosition && layer()) - offset += layer()->relativePositionOffset(); + if (style()->hasInFlowPosition() && layer()) + offset += layer()->offsetForInFlowPosition(); transformState.move(offset); return; } @@ -1311,12 +1311,12 @@ LayoutUnit RenderInline::baselinePosition(FontBaseline baselineType, bool firstL return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; } -LayoutSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const +LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox* child) const { // FIXME: This function isn't right with mixed writing modes. - ASSERT(isRelPositioned()); - if (!isRelPositioned()) + ASSERT(isInFlowPositioned()); + if (!isInFlowPositioned()) return LayoutSize(); // When we have an enclosing relpositioned inline, we need to add in the offset of the first line diff --git a/Source/WebCore/rendering/RenderInline.h b/Source/WebCore/rendering/RenderInline.h index bb43289be..9adec42b0 100644 --- a/Source/WebCore/rendering/RenderInline.h +++ b/Source/WebCore/rendering/RenderInline.h @@ -72,7 +72,7 @@ public: virtual void updateDragState(bool dragOn); - LayoutSize relativePositionedInlineOffset(const RenderBox* child) const; + LayoutSize offsetForInFlowPositionedInline(const RenderBox* child) const; virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&); void paintOutline(GraphicsContext*, const LayoutPoint&); @@ -124,7 +124,7 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; - virtual bool requiresLayer() const { return isRelPositioned() || isTransparent() || hasMask() || hasFilter(); } + virtual bool requiresLayer() const { return isInFlowPositioned() || isTransparent() || hasMask() || hasFilter(); } virtual LayoutUnit offsetLeft() const; virtual LayoutUnit offsetTop() const; diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 661d0eb08..edb3cf58d 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -847,8 +847,8 @@ void RenderLayer::updateLayerPosition() LayoutSize offset = positionedParent->scrolledContentOffset(); localPoint -= offset; - if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()->isRelPositioned() && positionedParent->renderer()->isRenderInline()) { - LayoutSize offset = toRenderInline(positionedParent->renderer())->relativePositionedInlineOffset(toRenderBox(renderer())); + if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()->isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { + LayoutSize offset = toRenderInline(positionedParent->renderer())->offsetForInFlowPositionedInline(toRenderBox(renderer())); localPoint += offset; } } else if (parent()) { @@ -867,12 +867,12 @@ void RenderLayer::updateLayerPosition() IntSize scrollOffset = parent()->scrolledContentOffset(); localPoint -= scrollOffset; } - - if (renderer()->isRelPositioned()) { - m_relativeOffset = renderer()->relativePositionOffset(); - localPoint.move(m_relativeOffset); + + if (renderer()->isInFlowPositioned()) { + m_offsetForInFlowPosition = renderer()->offsetForInFlowPosition(); + localPoint.move(m_offsetForInFlowPosition); } else { - m_relativeOffset = LayoutSize(); + m_offsetForInFlowPosition = LayoutSize(); } // FIXME: We'd really like to just get rid of the concept of a layer rectangle and rely on the renderers. @@ -933,7 +933,7 @@ RenderLayer* RenderLayer::stackingContext() const static inline bool isPositionedContainer(RenderLayer* layer) { RenderBoxModelObject* layerRenderer = layer->renderer(); - return layer->isRootLayer() || layerRenderer->isOutOfFlowPositioned() || layerRenderer->isRelPositioned() || layer->hasTransform(); + return layer->isRootLayer() || layerRenderer->isOutOfFlowPositioned() || layerRenderer->isInFlowPositioned() || layer->hasTransform(); } static inline bool isFixedPositionedContainer(RenderLayer* layer) @@ -3950,8 +3950,7 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* clipRects.setPosClipRect(clipRects.fixedClipRect()); clipRects.setOverflowClipRect(clipRects.fixedClipRect()); clipRects.setFixed(true); - } - else if (renderer()->style()->position() == RelativePosition) + } else if (renderer()->style()->hasInFlowPosition()) clipRects.setPosClipRect(clipRects.overflowClipRect()); else if (renderer()->style()->position() == AbsolutePosition) clipRects.setOverflowClipRect(clipRects.posClipRect()); @@ -3976,7 +3975,7 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* if (renderer()->style()->hasBorderRadius()) newOverflowClip.setHasRadius(true); clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect())); - if (renderer()->isOutOfFlowPositioned() || renderer()->isRelPositioned()) + if (renderer()->isOutOfFlowPositioned() || renderer()->isInFlowPositioned()) clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect())); } if (renderer()->hasClip()) { @@ -4779,7 +4778,7 @@ bool RenderLayer::shouldBeNormalFlowOnly() const || renderer()->isRenderIFrame() || (renderer()->style()->specifiesColumns() && !isRootLayer())) && !renderer()->isOutOfFlowPositioned() - && !renderer()->isRelPositioned() + && !renderer()->isInFlowPositioned() && !renderer()->hasTransform() #if ENABLE(CSS_FILTERS) && !renderer()->hasFilter() diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 00c5c19d2..e4f790e05 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -402,7 +402,7 @@ public: void updateBlendMode(); #endif - const LayoutSize& relativePositionOffset() const { return m_relativeOffset; } + const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlowPosition; } void clearClipRectsIncludingDescendants(ClipRectsType typeToClear = AllClipRectTypes); void clearClipRects(ClipRectsType typeToClear = AllClipRectTypes); @@ -951,7 +951,7 @@ protected: LayoutRect m_outlineBox; // Our current relative position offset. - LayoutSize m_relativeOffset; + LayoutSize m_offsetForInFlowPosition; // Our (x,y) coordinates are in our parent layer's coordinate space. LayoutPoint m_topLeft; diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp index 944ea5f08..6376b098b 100644 --- a/Source/WebCore/rendering/RenderListBox.cpp +++ b/Source/WebCore/rendering/RenderListBox.cpp @@ -632,11 +632,6 @@ void RenderListBox::setScrollOffset(const IntPoint& offset) scrollTo(offset.y()); } -IntPoint RenderListBox::scrollPosition() const -{ - return IntPoint(0, m_indexOffset); -} - void RenderListBox::scrollTo(int newOffset) { if (newOffset == m_indexOffset) diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h index d968c8717..496191206 100644 --- a/Source/WebCore/rendering/RenderListBox.h +++ b/Source/WebCore/rendering/RenderListBox.h @@ -101,28 +101,27 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; // ScrollableArea interface. - virtual int scrollSize(ScrollbarOrientation) const; - virtual int scrollPosition(Scrollbar*) const; - virtual void setScrollOffset(const IntPoint&); - virtual IntPoint scrollPosition() const OVERRIDE; - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const; - virtual bool isScrollCornerVisible() const { return false; } // We don't support resize on list boxes yet. If we did these would have to change. - virtual IntRect scrollCornerRect() const { return IntRect(); } - virtual void invalidateScrollCornerRect(const IntRect&) { } - virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const; - virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; - virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; - virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; - virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } - virtual IntSize contentsSize() const; - virtual int visibleHeight() const; - virtual int visibleWidth() const; - virtual IntPoint currentMousePosition() const; - virtual bool shouldSuspendScrollAnimations() const; - virtual bool isOnActivePage() const; - - virtual ScrollableArea* enclosingScrollableArea() const; + virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const IntPoint&) OVERRIDE; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual bool isScrollCornerVisible() const OVERRIDE { return false; } // We don't support resize on list boxes yet. If we did these would have to change. + virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } + virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } + virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const OVERRIDE; + virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const OVERRIDE; + virtual Scrollbar* verticalScrollbar() const OVERRIDE { return m_vBar.get(); } + virtual IntSize contentsSize() const OVERRIDE; + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual IntPoint currentMousePosition() const OVERRIDE; + virtual bool shouldSuspendScrollAnimations() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE; virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 391c11988..933a559c4 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -639,7 +639,7 @@ void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderOb RenderObject* container = object->container(); if (!container && !object->isRenderView()) return; - if (!last->isText() && last->style()->isOutOfFlowPositioned()) { + if (!last->isText() && last->style()->hasOutOfFlowPosition()) { bool willSkipRelativelyPositionedInlines = !object->isRenderBlock() || object->isAnonymousBlock() || object->isRenderFlowThreadContainer(); // Skip relatively positioned inlines and anonymous blocks (and the flow threads container) to get to the enclosing RenderBlock. while (object && (!object->isRenderBlock() || object->isAnonymousBlock() || object->isRenderFlowThreadContainer())) @@ -690,7 +690,7 @@ void RenderObject::setPreferredLogicalWidthsDirty(bool shouldBeDirty, MarkingBeh { bool alreadyDirty = preferredLogicalWidthsDirty(); m_bitfields.setPreferredLogicalWidthsDirty(shouldBeDirty); - if (shouldBeDirty && !alreadyDirty && markParents == MarkContainingBlockChain && (isText() || !style()->isOutOfFlowPositioned())) + if (shouldBeDirty && !alreadyDirty && markParents == MarkContainingBlockChain && (isText() || !style()->hasOutOfFlowPosition())) invalidateContainerPreferredLogicalWidths(); } @@ -707,7 +707,7 @@ void RenderObject::invalidateContainerPreferredLogicalWidths() break; o->m_bitfields.setPreferredLogicalWidthsDirty(true); - if (o->style()->isOutOfFlowPositioned()) + if (o->style()->hasOutOfFlowPosition()) // A positioned object has no effect on the min/max width of its containing block ever. // We can optimize this case and not go up any further. break; @@ -764,7 +764,7 @@ RenderBlock* RenderObject::containingBlock() const if (o->hasTransform() && o->isRenderBlock()) break; - if (o->style()->position() == RelativePosition && o->isInline() && !o->isReplaced()) { + if (o->style()->hasInFlowPosition() && o->isInline() && !o->isReplaced()) { o = o->containingBlock(); break; } @@ -2435,9 +2435,8 @@ void RenderObject::willBeRemovedFromTree() parent()->dirtyLinesFromChangedChild(this); if (inRenderFlowThread()) { - if (isBox()) - enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(this)); - enclosingRenderFlowThread()->clearRenderObjectCustomStyle(this); + ASSERT(enclosingRenderFlowThread()); + enclosingRenderFlowThread()->removeFlowChildInfo(this); } if (RenderNamedFlowThread* containerFlowThread = parent()->enclosingRenderNamedFlowThread()) diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index 3ca2a2255..05ccea48d 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -511,9 +511,11 @@ public: virtual RenderBoxModelObject* virtualContinuation() const { return 0; } bool isFloating() const { return m_bitfields.floating(); } + bool isOutOfFlowPositioned() const { return m_bitfields.positioned(); } // absolute or fixed positioning bool isInFlowPositioned() const { return m_bitfields.relPositioned(); } // relative positioning bool isRelPositioned() const { return m_bitfields.relPositioned(); } // relative positioning + bool isText() const { return m_bitfields.isText(); } bool isBox() const { return m_bitfields.isBox(); } bool isInline() const { return m_bitfields.isInline(); } // inline object diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp index bdb5516b7..98a287627 100644 --- a/Source/WebCore/rendering/RenderObjectChildList.cpp +++ b/Source/WebCore/rendering/RenderObjectChildList.cpp @@ -397,7 +397,7 @@ void RenderObjectChildList::updateBeforeAfterContent(RenderObject* owner, Pseudo return; if (owner->isRenderInline() && !pseudoElementStyle->isDisplayInlineType() && !pseudoElementStyle->isFloating() && - !(pseudoElementStyle->position() == AbsolutePosition || pseudoElementStyle->position() == FixedPosition)) + !pseudoElementStyle->hasOutOfFlowPosition()) // According to the CSS2 spec (the end of section 12.1), the only allowed // display values for the pseudo style are NONE and INLINE for inline flows. // FIXME: CSS2.1 lifted this restriction, but block display types will crash. diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 77428c499..b5c308373 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -197,16 +197,17 @@ void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild) section->addChild(child); } -void RenderTable::removeChild(RenderObject* oldChild) +void RenderTable::removeCaption(const RenderTableCaption* oldCaption) { - RenderBox::removeChild(oldChild); - - size_t index = m_captions.find(oldChild); - if (index != notFound) { - m_captions.remove(index); - if (node()) - node()->setNeedsStyleRecalc(); - } + size_t index = m_captions.find(oldCaption); + ASSERT(index != notFound); + m_captions.remove(index); + + // FIXME: The rest of this function is probably not needed since we have + // implemented proper multiple captions support (see bug 58249). + if (node()) + node()->setNeedsStyleRecalc(); + setNeedsSectionRecalc(); } diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h index e4c70f47f..bbafdb716 100644 --- a/Source/WebCore/rendering/RenderTable.h +++ b/Source/WebCore/rendering/RenderTable.h @@ -231,6 +231,8 @@ public: const BorderValue& tableStartBorderAdjoiningCell(const RenderTableCell*) const; const BorderValue& tableEndBorderAdjoiningCell(const RenderTableCell*) const; + void removeCaption(const RenderTableCaption*); + protected: virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); @@ -241,8 +243,6 @@ private: virtual bool avoidsFloats() const { return true; } - virtual void removeChild(RenderObject* oldChild); - virtual void paint(PaintInfo&, const LayoutPoint&); virtual void paintObject(PaintInfo&, const LayoutPoint&); virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); diff --git a/Source/WebCore/rendering/RenderTableCaption.cpp b/Source/WebCore/rendering/RenderTableCaption.cpp index b84891c7f..9785f372d 100644 --- a/Source/WebCore/rendering/RenderTableCaption.cpp +++ b/Source/WebCore/rendering/RenderTableCaption.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "RenderTableCaption.h" +#include "RenderTable.h" + namespace WebCore { RenderTableCaption::RenderTableCaption(Node* node) @@ -37,4 +39,16 @@ LayoutUnit RenderTableCaption::containingBlockLogicalWidthForContent() const return cb->logicalWidth(); } +void RenderTableCaption::willBeRemovedFromTree() +{ + RenderBlock::willBeRemovedFromTree(); + + table()->removeCaption(this); +} + +RenderTable* RenderTableCaption::table() const +{ + return toRenderTable(parent()); +} + } diff --git a/Source/WebCore/rendering/RenderTableCaption.h b/Source/WebCore/rendering/RenderTableCaption.h index 23079c0e9..b505ebe10 100644 --- a/Source/WebCore/rendering/RenderTableCaption.h +++ b/Source/WebCore/rendering/RenderTableCaption.h @@ -24,6 +24,8 @@ namespace WebCore { +class RenderTable; + class RenderTableCaption : public RenderBlock { public: explicit RenderTableCaption(Node*); @@ -32,6 +34,10 @@ public: private: virtual bool isTableCaption() const OVERRIDE { return true; } + + virtual void willBeRemovedFromTree() OVERRIDE; + + RenderTable* table() const; }; inline RenderTableCaption* toRenderTableCaption(RenderObject* object) diff --git a/Source/WebCore/rendering/RenderTableCol.cpp b/Source/WebCore/rendering/RenderTableCol.cpp index 97cd8cc3e..7c5e9ed10 100644 --- a/Source/WebCore/rendering/RenderTableCol.cpp +++ b/Source/WebCore/rendering/RenderTableCol.cpp @@ -69,6 +69,16 @@ void RenderTableCol::updateFromElement() setNeedsLayoutAndPrefWidthsRecalc(); } +void RenderTableCol::willBeRemovedFromTree() +{ + RenderBox::willBeRemovedFromTree(); + + // We don't really need to recompute our sections, but we need to update our + // column count and whether we have a column. Currently, we only have one + // size-fit-all flag but we may have to consider splitting it. + table()->setNeedsSectionRecalc(); +} + bool RenderTableCol::isChildAllowed(RenderObject* child, RenderStyle* style) const { // We cannot use isTableColumn here as style() may return 0. diff --git a/Source/WebCore/rendering/RenderTableCol.h b/Source/WebCore/rendering/RenderTableCol.h index 62f3288e8..887afd6c8 100644 --- a/Source/WebCore/rendering/RenderTableCol.h +++ b/Source/WebCore/rendering/RenderTableCol.h @@ -75,6 +75,8 @@ private: virtual bool isRenderTableCol() const OVERRIDE { return true; } virtual void updateFromElement(); + virtual void willBeRemovedFromTree() OVERRIDE; + virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; virtual bool canHaveChildren() const; virtual bool requiresLayer() const { return false; } diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index 02b54c660..8cc34a330 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -315,7 +315,7 @@ void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&) frameView()->setCannotBlitToWindow(); // The parent must show behind the child. else { Color baseColor = frameView()->baseBackgroundColor(); - if (baseColor.alpha() > 0) { + if (baseColor.alpha()) { CompositeOperator previousOperator = paintInfo.context->compositeOperation(); paintInfo.context->setCompositeOperation(CompositeCopy); paintInfo.context->fillRect(paintInfo.rect, baseColor, style()->colorSpace()); diff --git a/Source/WebCore/rendering/TextAutosizer.cpp b/Source/WebCore/rendering/TextAutosizer.cpp index 6122962b2..4cd735a1c 100644 --- a/Source/WebCore/rendering/TextAutosizer.cpp +++ b/Source/WebCore/rendering/TextAutosizer.cpp @@ -107,6 +107,34 @@ void TextAutosizer::setMultiplier(RenderObject* renderer, float multiplier) renderer->setStyle(newStyle.release()); } +float TextAutosizer::computeAutosizedFontSize(float specifiedSize, float multiplier) +{ + // Somewhat arbitrary "pleasant" font size. + const float pleasantSize = 16; + + // Multiply fonts that the page author has specified to be larger than + // pleasantSize by less and less, until huge fonts are not increased at all. + // For specifiedSize between 0 and pleasantSize we directly apply the + // multiplier; hence for specifiedSize == pleasantSize, computedSize will be + // multiplier * pleasantSize. For greater specifiedSizes we want to + // gradually fade out the multiplier, so for every 1px increase in + // specifiedSize beyond pleasantSize we will only increase computedSize + // by gradientAfterPleasantSize px until we meet the + // computedSize = specifiedSize line, after which we stay on that line (so + // then every 1px increase in specifiedSize increases computedSize by 1px). + const float gradientAfterPleasantSize = 0.5; + + float computedSize; + if (specifiedSize <= pleasantSize) + computedSize = multiplier * specifiedSize; + else { + computedSize = multiplier * pleasantSize + gradientAfterPleasantSize * (specifiedSize - pleasantSize); + if (computedSize < specifiedSize) + computedSize = specifiedSize; + } + return computedSize; +} + bool TextAutosizer::isNotAnAutosizingContainer(const RenderObject* renderer) { // "Autosizing containers" are the smallest unit for which we can enable/disable diff --git a/Source/WebCore/rendering/TextAutosizer.h b/Source/WebCore/rendering/TextAutosizer.h index 3524f5f95..c8ade00f7 100644 --- a/Source/WebCore/rendering/TextAutosizer.h +++ b/Source/WebCore/rendering/TextAutosizer.h @@ -51,6 +51,8 @@ public: bool processSubtree(RenderObject* layoutRoot); + static float computeAutosizedFontSize(float specifiedSize, float multiplier); + private: explicit TextAutosizer(Document*); diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 37d98904e..b1b5faab0 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -43,6 +43,10 @@ #include <wtf/StdLibExtras.h> #include <algorithm> +#if ENABLE(TEXT_AUTOSIZING) +#include "TextAutosizer.h" +#endif + using namespace std; namespace WebCore { @@ -1223,7 +1227,7 @@ Length RenderStyle::lineHeight() const // too, though this involves messily poking into CalcExpressionLength. float multiplier = textAutosizingMultiplier(); if (multiplier > 1 && lh.isFixed()) - return Length(lh.value() * multiplier, Fixed); + return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multiplier), Fixed); #endif return lh; } @@ -1262,8 +1266,7 @@ void RenderStyle::setFontSize(float size) #if ENABLE(TEXT_AUTOSIZING) float multiplier = textAutosizingMultiplier(); if (multiplier > 1) { - // FIXME: Large font sizes needn't be multiplied as much since they are already more legible. - desc.setComputedSize(size * multiplier); + desc.setComputedSize(TextAutosizer::computeAutosizedFontSize(size, multiplier)); } #endif diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 011950c8e..2378c7a72 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -439,7 +439,7 @@ public: bool hasBackground() const { Color color = visitedDependentColor(CSSPropertyBackgroundColor); - if (color.isValid() && color.alpha() > 0) + if (color.isValid() && color.alpha()) return true; return hasBackgroundImage(); } @@ -496,10 +496,10 @@ public: Length bottom() const { return surround->offset.bottom(); } // Accessors for positioned object edges that take into account writing mode. - Length logicalLeft() const { return surround->offset.logicalLeft(this); } - Length logicalRight() const { return surround->offset.logicalRight(this); } - Length logicalTop() const { return surround->offset.before(this); } - Length logicalBottom() const { return surround->offset.after(this); } + Length logicalLeft() const { return surround->offset.logicalLeft(writingMode()); } + Length logicalRight() const { return surround->offset.logicalRight(writingMode()); } + Length logicalTop() const { return surround->offset.before(writingMode()); } + Length logicalBottom() const { return surround->offset.after(writingMode()); } // Whether or not a positioned element requires normal flow x/y to be computed // to determine its position. @@ -509,7 +509,8 @@ public: bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); } EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); } - bool isOutOfFlowPositioned() const { return position() == AbsolutePosition || position() == FixedPosition; } + bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; } + bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; } EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); } Length width() const { return m_box->width(); } @@ -728,24 +729,24 @@ public: Length marginBottom() const { return surround->margin.bottom(); } Length marginLeft() const { return surround->margin.left(); } Length marginRight() const { return surround->margin.right(); } - Length marginBefore() const { return surround->margin.before(this); } - Length marginAfter() const { return surround->margin.after(this); } - Length marginStart() const { return surround->margin.start(this); } - Length marginEnd() const { return surround->margin.end(this); } - Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle); } - Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle); } - Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle); } - Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle); } + Length marginBefore() const { return surround->margin.before(writingMode()); } + Length marginAfter() const { return surround->margin.after(writingMode()); } + Length marginStart() const { return surround->margin.start(writingMode(), direction()); } + Length marginEnd() const { return surround->margin.end(writingMode(), direction()); } + Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); } + Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); } + Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); } + Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); } LengthBox paddingBox() const { return surround->padding; } Length paddingTop() const { return surround->padding.top(); } Length paddingBottom() const { return surround->padding.bottom(); } Length paddingLeft() const { return surround->padding.left(); } Length paddingRight() const { return surround->padding.right(); } - Length paddingBefore() const { return surround->padding.before(this); } - Length paddingAfter() const { return surround->padding.after(this); } - Length paddingStart() const { return surround->padding.start(this); } - Length paddingEnd() const { return surround->padding.end(this); } + Length paddingBefore() const { return surround->padding.before(writingMode()); } + Length paddingAfter() const { return surround->padding.after(writingMode()); } + Length paddingStart() const { return surround->padding.start(writingMode(), direction()); } + Length paddingEnd() const { return surround->padding.end(writingMode(), direction()); } ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); } @@ -955,8 +956,11 @@ public: ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); } WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); } + // Lines have horizontal orientation; modes horizontal-tb or horizontal-bt. bool isHorizontalWritingMode() const { return writingMode() == TopToBottomWritingMode || writingMode() == BottomToTopWritingMode; } + // Bottom of the line occurs earlier in the block; modes vertical-rl or horizontal-bt. bool isFlippedLinesWritingMode() const { return writingMode() == LeftToRightWritingMode || writingMode() == BottomToTopWritingMode; } + // Block progression increases in the opposite direction to normal; modes vertical-rl or horizontal-bt. bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; } #if ENABLE(CSS_IMAGE_ORIENTATION) diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index 880b62243..6d967cba3 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -130,11 +130,6 @@ enum ETableLayout { TAUTO, TFIXED }; -// CSS Text Layout Module Level 3: Vertical writing support -enum WritingMode { - TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode -}; - enum TextCombine { TextCombineNone, TextCombineHorizontal }; diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 878665054..b86cc5d11 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -75,7 +75,6 @@ using BlackBerry::Platform::IntSize; namespace BlackBerry { namespace WebKit { -const int s_renderTimerTimeout = 1.0; WebPage* BackingStorePrivate::s_currentBackingStoreOwner = 0; typedef std::pair<int, int> Divisor; @@ -217,8 +216,6 @@ BackingStorePrivate::BackingStorePrivate() m_frontState = reinterpret_cast<unsigned>(new BackingStoreGeometry); m_backState = reinterpret_cast<unsigned>(new BackingStoreGeometry); - m_renderTimer = adoptPtr(new Timer<BackingStorePrivate>(this, &BackingStorePrivate::renderOnTimer)); - // Need a recursive mutex to achieve a global lock. pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); @@ -500,62 +497,27 @@ bool BackingStorePrivate::shouldPerformRegularRenderJobs() const return shouldPerformRenderJobs() && !m_suspendRegularRenderJobs; } -void BackingStorePrivate::startRenderTimer() -{ - // Called when render queue has a new job added. - if (m_renderTimer->isActive() || m_renderQueue->isEmpty(!m_suspendRegularRenderJobs)) - return; - -#if DEBUG_BACKINGSTORE - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::startRenderTimer time=%f", WTF::currentTime()); -#endif - m_renderTimer->startOneShot(s_renderTimerTimeout); -} - -void BackingStorePrivate::stopRenderTimer() +static const BlackBerry::Platform::Message::Type RenderJobMessageType = BlackBerry::Platform::Message::generateUniqueMessageType(); +class RenderJobMessage : public BlackBerry::Platform::ExecutableMessage { - if (!m_renderTimer->isActive()) - return; - - // Called when we render something to restart. -#if DEBUG_BACKINGSTORE - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::stopRenderTimer time=%f", WTF::currentTime()); -#endif - m_renderTimer->stop(); -} +public: + RenderJobMessage(BlackBerry::Platform::MessageDelegate* delegate) + : BlackBerry::Platform::ExecutableMessage(delegate, BlackBerry::Platform::ExecutableMessage::UniqueCoalescing, RenderJobMessageType) + { } +}; -void BackingStorePrivate::renderOnTimer(WebCore::Timer<BackingStorePrivate>*) +void BackingStorePrivate::dispatchRenderJob() { - // This timer is a third method of starting a render operation that is a catch-all. If more - // than s_renderTimerTimeout elapses with no rendering taking place and render jobs in the queue, then - // renderOnTimer will be called which will actually render. - if (!shouldPerformRenderJobs()) - return; - -#if DEBUG_BACKINGSTORE - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::renderOnTimer time=%f", WTF::currentTime()); -#endif - while (m_renderQueue->hasCurrentVisibleZoomJob() || m_renderQueue->hasCurrentVisibleScrollJob()) - m_renderQueue->render(!m_suspendRegularRenderJobs); - - if (shouldPerformRegularRenderJobs() && m_renderQueue->hasCurrentRegularRenderJob()) - m_renderQueue->renderAllCurrentRegularRenderJobs(); - -#if USE(ACCELERATED_COMPOSITING) - drawLayersOnCommitIfNeeded(); -#endif + BlackBerry::Platform::MessageDelegate* messageDelegate = BlackBerry::Platform::createMethodDelegate(&BackingStorePrivate::renderJob, this); + BlackBerry::Platform::webKitThreadMessageClient()->dispatchMessage(new RenderJobMessage(messageDelegate)); } -void BackingStorePrivate::renderOnIdle() +void BackingStorePrivate::renderJob() { ASSERT(shouldPerformRenderJobs()); - // Let the render queue know that we entered a new event queue cycle - // so it can determine if it is under pressure. - m_renderQueue->eventQueueCycled(); - #if DEBUG_BACKINGSTORE - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::renderOnIdle"); + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::renderJob"); #endif m_renderQueue->render(!m_suspendRegularRenderJobs); @@ -563,41 +525,9 @@ void BackingStorePrivate::renderOnIdle() #if USE(ACCELERATED_COMPOSITING) drawLayersOnCommitIfNeeded(); #endif -} - -bool BackingStorePrivate::willFireTimer() -{ - // Let the render queue know that we entered a new event queue cycle - // so it can determine if it is under pressure. - m_renderQueue->eventQueueCycled(); - - if (!shouldPerformRegularRenderJobs() || !m_renderQueue->hasCurrentRegularRenderJob() || !m_renderQueue->currentRegularRenderJobBatchUnderPressure()) - return true; - -#if DEBUG_BACKINGSTORE - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::willFireTimer"); -#endif - - // We've detected that the regular render jobs are coming under pressure likely - // due to timers firing producing invalidation jobs and our efforts to break them - // up into bite size pieces has produced a situation where we can not complete - // a batch of them before receiving more that intersect them which causes us - // to start the batch over. To mitigate this we have to empty the current batch - // when this is detected. - - // We still want to perform priority jobs first to avoid redundant paints. - while (m_renderQueue->hasCurrentVisibleZoomJob() || m_renderQueue->hasCurrentVisibleScrollJob()) - m_renderQueue->render(!m_suspendRegularRenderJobs); - - if (m_renderQueue->hasCurrentRegularRenderJob()) - m_renderQueue->renderAllCurrentRegularRenderJobs(); -#if USE(ACCELERATED_COMPOSITING) - drawLayersOnCommitIfNeeded(); -#endif - - // Let the caller yield and reschedule the timer. - return false; + if (shouldPerformRenderJobs()) + dispatchRenderJob(); } Platform::IntRect BackingStorePrivate::expandedContentsRect() const @@ -2790,16 +2720,6 @@ void BackingStore::repaint(int x, int y, int width, int height, d->repaint(Platform::IntRect(x, y, width, height), contentChanged, immediate); } -bool BackingStore::hasRenderJobs() const -{ - return d->shouldPerformRenderJobs(); -} - -void BackingStore::renderOnIdle() -{ - d->renderOnIdle(); -} - bool BackingStore::isDirectRenderingToWindow() const { BackingStoreMutexLocker locker(d); diff --git a/Source/WebKit/blackberry/Api/BackingStore.h b/Source/WebKit/blackberry/Api/BackingStore.h index 6ac9c38fa..c3185dc44 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.h +++ b/Source/WebKit/blackberry/Api/BackingStore.h @@ -63,9 +63,6 @@ public: void blitContents(const BlackBerry::Platform::IntRect& dstRect, const BlackBerry::Platform::IntRect& contents); void repaint(int x, int y, int width, int height, bool contentChanged, bool immediate); - bool hasRenderJobs() const; - void renderOnIdle(); - // In the defers blit mode, any blit requests will just return early, and // a blit job will be queued that is executed by calling blitOnIdle(). bool defersBlit() const; diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index c29684717..77eeab951 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -131,11 +131,8 @@ public: bool shouldSuppressNonVisibleRegularRenderJobs() const; bool shouldPerformRenderJobs() const; bool shouldPerformRegularRenderJobs() const; - void startRenderTimer(); - void stopRenderTimer(); - void renderOnTimer(WebCore::Timer<BackingStorePrivate>*); - void renderOnIdle(); - bool willFireTimer(); + void dispatchRenderJob(); + void renderJob(); // Set of helper methods for the scrollBackingStore() method. Platform::IntRect contentsRect() const; @@ -364,9 +361,6 @@ public: Platform::IntRect m_visibleTileBufferRect; - // Last resort timer for rendering. - OwnPtr<WebCore::Timer<BackingStorePrivate> > m_renderTimer; - pthread_mutex_t m_mutex; #if USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/Api/InRegionScroller.cpp b/Source/WebKit/blackberry/Api/InRegionScroller.cpp index 205ef898b..aaf40168c 100644 --- a/Source/WebKit/blackberry/Api/InRegionScroller.cpp +++ b/Source/WebKit/blackberry/Api/InRegionScroller.cpp @@ -33,6 +33,7 @@ #include "RenderLayerBacking.h" #include "RenderObject.h" #include "RenderView.h" +#include "SelectionHandler.h" #include "WebPage_p.h" using namespace WebCore; @@ -65,12 +66,12 @@ bool InRegionScroller::setScrollPositionCompositingThread(unsigned camouflagedLa return d->setScrollPositionCompositingThread(camouflagedLayer, d->m_webPage->mapFromTransformed(scrollPosition)); } -bool InRegionScroller::setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& scrollPosition) +bool InRegionScroller::setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& scrollPosition, bool supportsAcceleratedScrolling) { ASSERT(Platform::webKitThreadMessageClient()->isCurrentThread()); // FIXME: Negative values won't work with map{To,From}Transform methods. - return d->setScrollPositionWebKitThread(camouflagedLayer, d->m_webPage->mapFromTransformed(scrollPosition)); + return d->setScrollPositionWebKitThread(camouflagedLayer, d->m_webPage->mapFromTransformed(scrollPosition), supportsAcceleratedScrolling); } InRegionScrollerPrivate::InRegionScrollerPrivate(WebPagePrivate* webPagePrivate) @@ -118,16 +119,25 @@ bool InRegionScrollerPrivate::setScrollPositionCompositingThread(unsigned camouf return true; } -bool InRegionScrollerPrivate::setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition) +bool InRegionScrollerPrivate::setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition, bool supportsAcceleratedScrolling) { RenderLayer* layer = 0; - LayerWebKitThread* layerWebKitThread = reinterpret_cast<LayerWebKitThread*>(camouflagedLayer); - ASSERT(layerWebKitThread); - if (layerWebKitThread->owner()) { - GraphicsLayer* graphicsLayer = layerWebKitThread->owner(); - RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(graphicsLayer->client()); - layer = backing->owningLayer(); + if (supportsAcceleratedScrolling) { + LayerWebKitThread* layerWebKitThread = reinterpret_cast<LayerWebKitThread*>(camouflagedLayer); + ASSERT(layerWebKitThread); + if (layerWebKitThread->owner()) { + GraphicsLayer* graphicsLayer = layerWebKitThread->owner(); + RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(graphicsLayer->client()); + layer = backing->owningLayer(); + } + } else { + Node* node = reinterpret_cast<Node*>(camouflagedLayer); + ASSERT(node); + if (!node->renderer()) + return false; + + layer = node->renderer()->enclosingLayer(); } if (!layer) @@ -137,16 +147,6 @@ bool InRegionScrollerPrivate::setScrollPositionWebKitThread(unsigned camouflaged return setLayerScrollPosition(layer, scrollPosition); } -bool InRegionScrollerPrivate::scrollBy(const Platform::IntSize& delta) -{ - ASSERT(Platform::webkitThreadMessageClient()->isCurrentThread()); - - if (!canScroll()) - return false; - - return scrollNodeRecursively(node(), delta); -} - void InRegionScrollerPrivate::calculateInRegionScrollableAreasForPoint(const WebCore::IntPoint& point) { ASSERT(m_activeInRegionScrollableAreas.empty()); @@ -243,8 +243,23 @@ bool InRegionScrollerPrivate::setLayerScrollPosition(RenderLayer* layer, const I Frame* frame = view->frame(); ASSERT_UNUSED(frame, frame); + ASSERT(canScrollInnerFrame(frame)); + + view->setCanBlitOnScroll(false); + + BackingStoreClient* backingStoreClient = m_webPage->backingStoreClientForFrame(view->frame()); + if (backingStoreClient) { + backingStoreClient->setIsClientGeneratedScroll(true); + backingStoreClient->setIsScrollNotificationSuppressed(true); + } view->setScrollPosition(scrollPosition); + + if (backingStoreClient) { + backingStoreClient->setIsClientGeneratedScroll(false); + backingStoreClient->setIsScrollNotificationSuppressed(false); + } + return true; } @@ -252,104 +267,13 @@ bool InRegionScrollerPrivate::setLayerScrollPosition(RenderLayer* layer, const I layer->scrollToOffset(scrollPosition.x(), scrollPosition.y()); // FIXME_agomes: Please recheck if it is needed still! layer->renderer()->repaint(true); - return true; -} - -bool InRegionScrollerPrivate::scrollNodeRecursively(WebCore::Node* node, const WebCore::IntSize& delta) -{ - if (delta.isZero()) - return true; - - if (!node) - return false; - - RenderObject* renderer = node->renderer(); - if (!renderer) - return false; - - FrameView* view = renderer->view()->frameView(); - if (!view) - return false; - - // Try scrolling the renderer. - if (scrollRenderer(renderer, delta)) - return true; - // We've hit the page, don't scroll it and return false. - if (view == m_webPage->m_mainFrame->view()) - return false; - - // Try scrolling the FrameView. - if (canScrollInnerFrame(view->frame())) { - IntSize viewDelta = delta; - IntPoint newViewOffset = view->scrollPosition(); - IntPoint maxViewOffset = view->maximumScrollPosition(); - adjustScrollDelta(maxViewOffset, newViewOffset, viewDelta); - - if (!viewDelta.isZero()) { - view->setCanBlitOnScroll(false); - - BackingStoreClient* backingStoreClient = m_webPage->backingStoreClientForFrame(view->frame()); - if (backingStoreClient) { - backingStoreClient->setIsClientGeneratedScroll(true); - backingStoreClient->setIsScrollNotificationSuppressed(true); - } - - setNode(view->frame()->document()); - - view->scrollBy(viewDelta); - - if (backingStoreClient) { - backingStoreClient->setIsClientGeneratedScroll(false); - backingStoreClient->setIsScrollNotificationSuppressed(false); - } - - return true; - } - } - - // Try scrolling the node of the enclosing frame. - Frame* frame = node->document()->frame(); - if (frame) { - Node* ownerNode = frame->ownerElement(); - if (scrollNodeRecursively(ownerNode, delta)) - return true; - } - - return false; -} - -bool InRegionScrollerPrivate::scrollRenderer(WebCore::RenderObject* renderer, const WebCore::IntSize& delta) -{ - RenderLayer* layer = renderer->enclosingLayer(); - if (!layer) - return false; - - // Try to scroll layer. - bool restrictedByLineClamp = false; - if (renderer->parent()) - restrictedByLineClamp = !renderer->parent()->style()->lineClamp().isNone(); - - if (renderer->hasOverflowClip() && !restrictedByLineClamp) { - IntSize layerDelta = delta; - IntPoint maxOffset(layer->scrollWidth() - layer->renderBox()->clientWidth(), layer->scrollHeight() - layer->renderBox()->clientHeight()); - IntPoint currentOffset(layer->scrollXOffset(), layer->scrollYOffset()); - adjustScrollDelta(maxOffset, currentOffset, layerDelta); - if (!layerDelta.isZero()) { - setNode(enclosingLayerNode(layer)); - IntPoint newOffset = currentOffset + layerDelta; - layer->scrollToOffset(IntSize(newOffset.x(), newOffset.y())); - renderer->repaint(true); - return true; - } - } - - while (layer = layer->parent()) { - if (canScrollRenderBox(layer->renderBox())) - return scrollRenderer(layer->renderBox(), delta); - } - - return false; + m_webPage->m_selectionHandler->selectionPositionChanged(); + // FIXME: We have code in place to handle scrolling and clipping tap highlight + // on in-region scrolling. As soon as it is fast enough (i.e. we have it backed by + // a backing store), we can reliably make use of it in the real world. + // m_touchEventHandler->drawTapHighlight(); + return true; } void InRegionScrollerPrivate::adjustScrollDelta(const WebCore::IntPoint& maxOffset, const WebCore::IntPoint& currentOffset, WebCore::IntSize& delta) const diff --git a/Source/WebKit/blackberry/Api/InRegionScroller.h b/Source/WebKit/blackberry/Api/InRegionScroller.h index bbdd94fff..3291f9759 100644 --- a/Source/WebKit/blackberry/Api/InRegionScroller.h +++ b/Source/WebKit/blackberry/Api/InRegionScroller.h @@ -36,7 +36,7 @@ public: ~InRegionScroller(); bool setScrollPositionCompositingThread(unsigned camouflagedLayer, const Platform::IntPoint& /*scrollPosition*/); - bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& /*scrollPosition*/); + bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const Platform::IntPoint& /*scrollPosition*/, bool acceleratedScrolling); private: friend class WebPagePrivate; diff --git a/Source/WebKit/blackberry/Api/InRegionScroller_p.h b/Source/WebKit/blackberry/Api/InRegionScroller_p.h index 080766a3f..d9e0ebab1 100644 --- a/Source/WebKit/blackberry/Api/InRegionScroller_p.h +++ b/Source/WebKit/blackberry/Api/InRegionScroller_p.h @@ -49,10 +49,8 @@ public: bool canScroll() const; bool hasNode() const; - bool scrollBy(const Platform::IntSize& delta); - bool setScrollPositionCompositingThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition); - bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition); + bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition, bool supportsAcceleratedScrolling); void calculateInRegionScrollableAreasForPoint(const WebCore::IntPoint&); const std::vector<Platform::ScrollViewBase*>& activeInRegionScrollableAreas() const; @@ -64,9 +62,6 @@ private: void pushBackInRegionScrollable(InRegionScrollableArea*); - // Obsolete codepath. - bool scrollNodeRecursively(WebCore::Node*, const WebCore::IntSize& delta); - bool scrollRenderer(WebCore::RenderObject*, const WebCore::IntSize& delta); void adjustScrollDelta(const WebCore::IntPoint& maxOffset, const WebCore::IntPoint& currentOffset, WebCore::IntSize& delta) const; RefPtr<WebCore::Node> m_inRegionScrollStartingNode; diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 7eb7e5904..2e34c366c 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -1467,40 +1467,17 @@ void WebPagePrivate::deferredTasksTimerFired(WebCore::Timer<WebPagePrivate>*) task->perform(this); } -bool WebPagePrivate::scrollBy(int deltaX, int deltaY, bool scrollMainFrame) +void WebPagePrivate::scrollBy(int deltaX, int deltaY) { IntSize delta(deltaX, deltaY); - if (!scrollMainFrame) { - // We need to work around the fact that ::map{To,From}Transformed do not - // work well with negative values, like a negative width or height of an IntSize. - IntSize copiedDelta(IntSize(abs(delta.width()), abs(delta.height()))); - IntSize untransformedCopiedDelta = mapFromTransformed(copiedDelta); - delta = IntSize( - delta.width() < 0 ? -untransformedCopiedDelta.width() : untransformedCopiedDelta.width(), - delta.height() < 0 ? -untransformedCopiedDelta.height(): untransformedCopiedDelta.height()); - - if (m_inRegionScroller->d->scrollBy(delta)) { - m_selectionHandler->selectionPositionChanged(); - // FIXME: We have code in place to handle scrolling and clipping tap highlight - // on in-region scrolling. As soon as it is fast enough (i.e. we have it backed by - // a backing store), we can reliably make use of it in the real world. - // m_touchEventHandler->drawTapHighlight(); - return true; - } - - return false; - } - setScrollPosition(scrollPosition() + delta); - return true; } -bool WebPage::scrollBy(const Platform::IntSize& delta, bool scrollMainFrame) +void WebPage::scrollBy(const Platform::IntSize& delta) { d->m_backingStoreClient->setIsClientGeneratedScroll(true); - bool b = d->scrollBy(delta.width(), delta.height(), scrollMainFrame); + d->scrollBy(delta.width(), delta.height()); d->m_backingStoreClient->setIsClientGeneratedScroll(false); - return b; } void WebPagePrivate::notifyInRegionScrollStopped() @@ -2488,8 +2465,8 @@ IntSize WebPagePrivate::fixedLayoutSize(bool snapToIncrement) const const int defaultLayoutHeight = m_defaultLayoutSize.height(); int minWidth = defaultLayoutWidth; - int maxWidth = defaultMaxLayoutSize().width(); - int maxHeight = defaultMaxLayoutSize().height(); + int maxWidth = DEFAULT_MAX_LAYOUT_WIDTH; + int maxHeight = DEFAULT_MAX_LAYOUT_HEIGHT; // If the load state is none then we haven't actually got anything yet, but we need to layout // the entire page so that the user sees the entire page (unrendered) instead of just part of it. @@ -3500,7 +3477,7 @@ IntSize WebPagePrivate::recomputeVirtualViewportFromViewportArguments() if (m_viewportArguments == defaultViewportArguments) return IntSize(); - int desktopWidth = defaultMaxLayoutSize().width(); + int desktopWidth = DEFAULT_MAX_LAYOUT_WIDTH; int deviceWidth = Platform::Graphics::Screen::primaryScreen()->width(); int deviceHeight = Platform::Graphics::Screen::primaryScreen()->height(); ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, m_webSettings->devicePixelRatio(), m_defaultLayoutSize); @@ -5292,14 +5269,6 @@ bool WebPage::defersLoading() const return d->m_page->defersLoading(); } -bool WebPage::willFireTimer() -{ - if (d->isLoading()) - return true; - - return d->m_backingStore->d->willFireTimer(); -} - void WebPage::notifyPagePause() { FOR_EACH_PLUGINVIEW(d->m_pluginViews) @@ -6203,16 +6172,6 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings) } } -IntSize WebPagePrivate::defaultMaxLayoutSize() -{ - static IntSize size; - if (size.isEmpty()) - size = IntSize(std::max(1024, Platform::Graphics::Screen::primaryScreen()->landscapeWidth()), - std::max(768, Platform::Graphics::Screen::primaryScreen()->landscapeHeight())); - - return size; -} - WebString WebPage::textHasAttribute(const WebString& query) const { if (Document* doc = d->m_page->focusController()->focusedOrMainFrame()->document()) diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index dc4cf165d..14d57a65f 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -175,7 +175,7 @@ public: Platform::IntPoint scrollPosition() const; // Scroll position provided should be in transformed coordinates. void setScrollPosition(const Platform::IntPoint&); - bool scrollBy(const Platform::IntSize&, bool scrollMainFrame = true); + void scrollBy(const Platform::IntSize&); void notifyInRegionScrollStopped(); void setScrollOriginPoint(const Platform::IntPoint&); @@ -322,8 +322,6 @@ public: bool defersLoading() const; - bool willFireTimer(); - bool isEnableLocalAccessToAllCookies() const; void setEnableLocalAccessToAllCookies(bool); diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index a005d81b6..1e5af0bce 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -41,6 +41,9 @@ #include <BlackBerryPlatformMessage.h> +#define DEFAULT_MAX_LAYOUT_WIDTH 1024 +#define DEFAULT_MAX_LAYOUT_HEIGHT 768 + namespace WebCore { class AutofillManager; class DOMWrapperWorld; @@ -147,7 +150,7 @@ public: WebCore::IntPoint scrollPosition() const; WebCore::IntPoint maximumScrollPosition() const; void setScrollPosition(const WebCore::IntPoint&); - bool scrollBy(int deltaX, int deltaY, bool scrollMainFrame = true); + void scrollBy(int deltaX, int deltaY); void enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(WebCore::Node*); void notifyInRegionScrollStopped(); @@ -446,7 +449,6 @@ public: static WebCore::RenderLayer* enclosingPositionedAncestorOrSelfIfPositioned(WebCore::RenderLayer*); static WebCore::RenderLayer* enclosingFixedPositionedAncestorOrSelfIfFixedPositioned(WebCore::RenderLayer*); - static WebCore::IntSize defaultMaxLayoutSize(); static const String& defaultUserAgent(); void setVisible(bool); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 1059181c0..a7715af0a 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,148 @@ +2012-08-23 Antonio Gomes <agomes@rim.com> + + [BlackBerry] Obsolete the in-region scroll codepath prior to BB10's + https://bugs.webkit.org/show_bug.cgi?id=94839 + PR #197775 + + Reviewed by George Staikos. + + This codepath is not needed anymore, so lets let it RIP. + + The only code addition is due to some code I've moved from WebPagePrivate::scrollNodeRecursively + and WebPagePrivate::scrollBy to InRegionScrollerPrivate::setLayerScrollPosition. + Rest is code removal ... + + * Api/InRegionScroller.cpp: + (BlackBerry::WebKit::InRegionScrollerPrivate::setLayerScrollPosition): + * Api/InRegionScroller_p.h: + (InRegionScrollerPrivate): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::scrollBy): + (BlackBerry::WebKit::WebPage::scrollBy): + * Api/WebPage.h: + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-08-23 Adam Treat <atreat@rim.com> + + [BlackBerry] Replace the three different rendering mechanisms for clearing the render queue + https://bugs.webkit.org/show_bug.cgi?id=94837 + + Reviewed by George Staikos. + + PR 197738 + + Currently, we have three different mechanisms for clearing the render queue. + The first mechanism is render on idle. Whenever the webkit thread becomes idle + (read: no more events in its queue) we render the next job in the render queue. + This is the primary means we use for clearing the render queue. However, this + mechanism has a flaw, it is such a low priority mechanism that sometimes the + queue grows so fast due to higher priority events adding rects to the queue + that this mechanism can't possibly keep up. That is what leads to the second + mechanism: rendering right before a timer is fired when we discover that the + render queue is under pressure and rendering on idle can't keep up. However, + there are still degenerate cases where even this mechanism does not allow us to + keep up. That brings us to the third mechanism: rendering based on a timer + that is a catch-all. + + The second and third mechanisms lead to very large render jobs as they try and + clear the queue faster when it comes under pressure. These very large render + jobs end up keeping the webkit thread busy with a message that can take large + fractions of a second to resolve. + + These three mechanisms were put in place when the backingstore had a different + overall design that was not truly asynchronous. This patch replaces these + three mechanisms with a single one that uses the platform messaging classes to + full purpose - a uniquely coalescing message that has a higher priority level + than timers making sure the render queue can never come under pressure. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate): + (WebKit): + (RenderJobMessage): + (BlackBerry::WebKit::RenderJobMessage::RenderJobMessage): + (BlackBerry::WebKit::BackingStorePrivate::dispatchRenderJob): + (BlackBerry::WebKit::BackingStorePrivate::renderJob): + (BlackBerry::WebKit::BackingStore::blitContents): + * Api/BackingStore.h: + * Api/BackingStore_p.h: + (BackingStorePrivate): + * Api/WebPage.cpp: + * Api/WebPage.h: + * WebKitSupport/RenderQueue.cpp: + (BlackBerry::WebKit::RenderQueue::reset): + (BlackBerry::WebKit::RenderQueue::addToRegularQueue): + (BlackBerry::WebKit::RenderQueue::addToScrollZoomQueue): + (BlackBerry::WebKit::RenderQueue::clear): + (BlackBerry::WebKit::RenderQueue::clearVisibleZoom): + (BlackBerry::WebKit::RenderQueue::render): + +2012-08-23 Antonio Gomes <agomes@rim.com> + + [BlackBerry] Unify slow and fast in-region scrolling code paths + https://bugs.webkit.org/show_bug.cgi?id=94834 + PR #197662 + + Reviewed by Rob Buis. + + Internally reviewed by Arvid Nilsson. + + In order to be able to remove a bunch of obsolete code from + InRegionScroller.cpp, we need to unify the codepaths for slow + and fast in-region scrolling. + + This patch caches the root scrollable node of each scrollable block + in InRegionScrollableArea also for the non-composited-scrolling case now too + (analogly to the way we cache LayerWebKitThread for the composited scrolling case). + + Now the client (libwebview) can dispatch an in-region scrolling with one single code path, + making use of a boolean (argh!) to inform if the scroll of the given + layer supports compositing or not. Later on, this boolean is used to casting the proper element. + + * Api/InRegionScroller.cpp: + (BlackBerry::WebKit::InRegionScroller::setScrollPositionWebKitThread): + (BlackBerry::WebKit::InRegionScrollerPrivate::setScrollPositionWebKitThread): + * Api/InRegionScroller.h: + * Api/InRegionScroller_p.h: + (InRegionScrollerPrivate): + * WebKitSupport/InRegionScrollableArea.cpp: + (WebKit): + (BlackBerry::WebKit::InRegionScrollableArea::InRegionScrollableArea): + (BlackBerry::WebKit::enclosingLayerNode): + * WebKitSupport/InRegionScrollableArea.h: + (WebCore): + (InRegionScrollableArea): + +2012-08-23 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] Web pages are zoomed out to much on initial load + https://bugs.webkit.org/show_bug.cgi?id=94830 + + Reviewed by Adam Treat. + + PR: 193943 + Browser continuously adds paddings to the left and right sides of the + main contents which makes the main contents even smaller. + The issue can be reproduced on the desktop websites such as + huffingtonpost.ca, bloomberg.com, online.wsj.com, nytimes.com, + yahoo.com, thestar.com, sina.com.cn, sohu.com and so on. + The root cause is that we layout those contents at the width of 1280 + although the fixed width of the main contents of those websites is + less than 1000, which results in adding the paddings. + To fix this, we need to get back to the default max layout size + 1024 * 768, which will make the main contents of those popular websites + take full advantage of the screen real estate and look much better. + + Internally reviewed by Adam Treat. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::fixedLayoutSize): + (BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments): + * Api/WebPage_p.h: + (WebPagePrivate): + * WebKitSupport/RenderQueue.cpp: + (BlackBerry::WebKit::RenderQueue::splittingFactor): + 2012-08-22 Crystal Zhang <haizhang@rim.com> [BlackBerry] Make all pickers non-zoomable diff --git a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp index 44e7b49a9..f1141c336 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp @@ -46,6 +46,17 @@ InRegionScrollableArea::~InRegionScrollableArea() m_cachedCompositedScrollableLayer->clearOverride(); } +// FIXME: Make RenderLayer::enclosingElement public so this one can be removed. +static Node* enclosingLayerNode(RenderLayer* layer) +{ + for (RenderObject* r = layer->renderer(); r; r = r->parent()) { + if (Node* e = r->node()) + return e; + } + ASSERT_NOT_REACHED(); + return 0; +} + InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLayer* layer) : m_webPage(webPage) , m_layer(layer) @@ -92,11 +103,17 @@ InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLa m_scrollsHorizontally = box->scrollWidth() != box->clientWidth() && box->scrollsOverflowX(); m_scrollsVertically = box->scrollHeight() != box->clientHeight() && box->scrollsOverflowY(); + // Both caches below are self-exclusive. if (m_layer->usesCompositedScrolling()) { m_supportsCompositedScrolling = true; ASSERT(m_layer->backing()->hasScrollingLayer()); m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(m_layer->backing()->scrollingLayer()->platformLayer()); m_cachedCompositedScrollableLayer = m_layer->backing()->scrollingLayer()->platformLayer(); + ASSERT(!m_cachedNonCompositedScrollableNode); + } else { + m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(enclosingLayerNode(m_layer)); + m_cachedNonCompositedScrollableNode = enclosingLayerNode(m_layer); + ASSERT(!m_cachedCompositedScrollableLayer); } m_overscrollLimitFactor = 0.0; diff --git a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.h b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.h index 679e490b5..443b94f5a 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.h +++ b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.h @@ -25,6 +25,7 @@ namespace WebCore { class LayerWebKitThread; +class Node; class RenderLayer; } @@ -49,7 +50,10 @@ private: WebPagePrivate* m_webPage; WebCore::RenderLayer* m_layer; + // We either cache one here: in case of a composited scrollable layer + // cache the LayerWebKitThread. Otherwise, the Node. RefPtr<WebCore::LayerWebKitThread> m_cachedCompositedScrollableLayer; + RefPtr<WebCore::Node> m_cachedNonCompositedScrollableNode; bool m_hasWindowVisibleRectCalculated; }; diff --git a/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp b/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp index 1f320b9a8..3460bd8f0 100644 --- a/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp @@ -231,7 +231,6 @@ void RenderQueue::reset() m_currentRegularRenderJobsBatch.clear(); m_currentRegularRenderJobsBatchRegion = Platform::IntRectRegion(); m_regularRenderJobsNotRenderedRegion = Platform::IntRectRegion(); - m_parent->stopRenderTimer(); ASSERT(isEmpty()); } @@ -244,8 +243,7 @@ int RenderQueue::splittingFactor(const Platform::IntRect& rect) const // rendered in any one pass should stay fixed with regard to the zoom level. Platform::IntRect untransformedRect = m_parent->m_webPage->d->mapFromTransformed(rect); double rectArea = untransformedRect.width() * untransformedRect.height(); - Platform::IntSize defaultMaxLayoutSize = WebPagePrivate::defaultMaxLayoutSize(); - double maxArea = defaultMaxLayoutSize.width() * defaultMaxLayoutSize.height(); + double maxArea = DEFAULT_MAX_LAYOUT_WIDTH * DEFAULT_MAX_LAYOUT_HEIGHT; // Defined in WebPage_p.h. const unsigned splitFactor = 1 << 0; double renderRectArea = maxArea / splitFactor; @@ -376,7 +374,7 @@ void RenderQueue::addToRegularQueue(const Platform::IntRect& rect) m_regularRenderJobsRegion = Platform::IntRectRegion::unionRegions(m_regularRenderJobsRegion, rect); if (!isEmpty()) - m_parent->startRenderTimer(); // Start the render timer since we could have some stale content here... + m_parent->dispatchRenderJob(); } void RenderQueue::addToScrollZoomQueue(const RenderRect& rect, RenderRectList* rectList) @@ -391,7 +389,7 @@ void RenderQueue::addToScrollZoomQueue(const RenderRect& rect, RenderRectList* r rectList->push_back(rect); if (!isEmpty()) - m_parent->startRenderTimer(); // Start the render timer since we know we could have some checkerboard here... + m_parent->dispatchRenderJob(); } void RenderQueue::quickSort(RenderRectList* queue) @@ -528,9 +526,6 @@ void RenderQueue::clear(const Platform::IntRect& rect, bool clearRegularRenderJo if (m_nonVisibleScrollJobs.empty() && !m_nonVisibleScrollJobsCompleted.empty()) nonVisibleScrollJobsCompleted(); - - if (isEmpty()) - m_parent->stopRenderTimer(); } void RenderQueue::clearRegularRenderJobs(const Platform::IntRect& rect) @@ -549,8 +544,6 @@ void RenderQueue::clearRegularRenderJobs(const Platform::IntRect& rect) void RenderQueue::clearVisibleZoom() { m_visibleZoomJobs.clear(); - if (isEmpty()) - m_parent->stopRenderTimer(); } bool RenderQueue::regularRenderJobsPreviouslyAttemptedButNotRendered(const Platform::IntRect& rect) @@ -591,9 +584,6 @@ void RenderQueue::render(bool shouldPerformRegularRenderJobs) renderRegularRenderJob(); } else if (!m_nonVisibleScrollJobs.empty()) renderNonVisibleScrollJob(); - - if (isEmpty()) - m_parent->stopRenderTimer(); } void RenderQueue::renderAllCurrentRegularRenderJobs() diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 396cc1114..2e08a17ed 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,332 @@ +2012-08-23 Antoine Labour <piman@chromium.org> + + [chromium] Fix lost context when textures are evicted + https://bugs.webkit.org/show_bug.cgi?id=94892 + + Reviewed by James Robinson. + + After eviction, the CCPrioritizedTextureManager is in a limbo state + where all its resources are invalid. If we try to release them we will + double-destroy them. + + New test: CCLayerTreeHostTestLostContextAfterEvictTextures. + + * tests/CCLayerTreeHostTest.cpp: + (CCLayerTreeHostTestLostContextAfterEvictTextures): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::CCLayerTreeHostTestLostContextAfterEvictTextures): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::beginTest): + (EvictTexturesAndLoseContextTask): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::EvictTexturesAndLoseContextTask): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::~EvictTexturesAndLoseContextTask): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::run): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::postEvictTexturesAndLoseContext): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::didCommitAndDrawFrame): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::didRecreateOutputSurface): + (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::afterTest): + (WTF): + (WTF::TEST_F): + +2012-08-23 Antoine Labour <piman@chromium.org> + + [chromium] Add OVERRIDEs in test code + https://bugs.webkit.org/show_bug.cgi?id=94894 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + +2012-08-23 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Expose mechanism for database to force a connection to close + https://bugs.webkit.org/show_bug.cgi?id=91010 + + Reviewed by Tony Chang. + + In Chromium, the browsing data deleter has a WebIDBDatabase handle which + it can use to terminate a connection. This handles forcefully closing + the front end connections and the back end, to unblock disk cleanup. + + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::forceClose): Entry point. + * public/WebIDBDatabaseCallbacks.h: + (WebKit::WebIDBDatabaseCallbacks::onForcedClose): Plumbing back to front. + * src/IDBDatabaseCallbacksProxy.cpp: + (WebKit::IDBDatabaseCallbacksProxy::onForcedClose): Plumbing back to front. + (WebKit): + * src/IDBDatabaseCallbacksProxy.h: + (IDBDatabaseCallbacksProxy): Plumbing. + * src/WebIDBDatabaseCallbacksImpl.cpp: + (WebKit::WebIDBDatabaseCallbacksImpl::onForcedClose): Plumbing back to front. + (WebKit): + * src/WebIDBDatabaseCallbacksImpl.h: + (WebIDBDatabaseCallbacksImpl): Plumbing back to front. + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::close): Tidy up dropping the callback reference. + (WebKit): + (WebKit::WebIDBDatabaseImpl::forceClose): Terminate the connection by notifying + the back end and the front end, while avoid re-entrant badness. + * src/WebIDBDatabaseImpl.h: Header tweak for unit test. + (WebIDBDatabaseImpl): + * tests/IDBDatabaseBackendTest.cpp: Added unit test to exercise connections. + +2012-08-23 James Robinson <jamesr@chromium.org> + + [chromium] Convert WebAnimationCurve subtypes into pure virtual + https://bugs.webkit.org/show_bug.cgi?id=94068 + + Reviewed by Adrienne Walker. + + Updates the implementations, some callers and tests of Web*AnimationCurve to its new interface. + + * WebKit.gyp: + * src/WebAnimation.cpp: + (WebKit::WebAnimation::initialize): + * src/WebFloatAnimationCurveImpl.cpp: Renamed from Source/WebKit/chromium/src/WebFloatAnimationCurve.cpp. + (WebKit): + (WebKit::WebFloatAnimationCurve::create): + (WebKit::WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl): + (WebKit::WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl): + (WebKit::WebFloatAnimationCurveImpl::type): + (WebKit::WebFloatAnimationCurveImpl::add): + (WebKit::WebFloatAnimationCurveImpl::getValue): + (WebKit::WebFloatAnimationCurveImpl::cloneToCCAnimationCurve): + * src/WebTransformAnimationCurve.cpp: Removed. + * tests/WebAnimationTest.cpp: + (WebKit::TEST): + * tests/WebFloatAnimationCurveTest.cpp: + (WebKit::TEST): + * tests/WebTransformAnimationCurveTest.cpp: + (WebKit::TEST): + +2012-08-23 Kentaro Hara <haraken@chromium.org> + + [V8] Remove V8Proxy.{h,cpp} + https://bugs.webkit.org/show_bug.cgi?id=94794 + + Reviewed by Dimitri Glazkov. + + Now V8Proxy is no longer used. We can completely remove V8Proxy from the codebase. + + No tests. No change in behavior. + + * src/ChromeClientImpl.cpp: + * src/WebBindings.cpp: + * src/WebDOMMessageEvent.cpp: + * src/WebDevToolsAgentImpl.cpp: + * src/WebMediaPlayerClientImpl.cpp: + +2012-08-23 Dana Jansens <danakj@chromium.org> + + [chromium] Don't require a RenderSurface* in order to create a RenderPass + https://bugs.webkit.org/show_bug.cgi?id=94862 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCRendererGLTest.cpp: + (FakeCCRendererClient::FakeCCRendererClient): + +2012-08-22 James Robinson <jamesr@chromium.org> + + [chromium] Remove WebLayer::setChildren API + https://bugs.webkit.org/show_bug.cgi?id=94749 + + Reviewed by Adrienne Walker. + + * src/WebLayer.cpp: + +2012-08-23 Dana Jansens <danakj@chromium.org> + + [chromium] Create sharedQuadState at same time as creating quads and give them to the quadSink + https://bugs.webkit.org/show_bug.cgi?id=94752 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::EvictionTestLayerImpl::appendQuads): + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + (CCLayerTestCommon::coverageVisibleRectOnTileBoundaries): + (CCLayerTestCommon::coverageVisibleRectIntersectsTiles): + (CCLayerTestCommon::coverageVisibleRectIntersectsBounds): + * tests/MockCCQuadCuller.h: + (WebCore::MockCCQuadCuller::MockCCQuadCuller): + (MockCCQuadCuller): + (WebCore::MockCCQuadCuller::quadList): + (WebCore::MockCCQuadCuller::sharedQuadStateList): + +2012-08-23 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed - fixing input list for timeline inspector module. + https://bugs.webkit.org/show_bug.cgi?id=94829 + + * WebKit.gyp: + +2012-08-23 Alexandre Elias <aelias@chromium.org> + + [chromium] Rename LayerRendererChromium to GL-specific name + https://bugs.webkit.org/show_bug.cgi?id=94835 + + Reviewed by James Robinson. + + Over time, LayerRendererChromium has evolved to be a GL-specific + subclass of CCRenderer that has no awareness of layers (as it operates + only with drawQuads). + + This patch renames LayerRendererChromium to CCRendererGL, replaces all + instances of "layerRenderer" with just "renderer", and removes a + few unnecessary includes of LayerRendererChromium.h. + + * WebKit.gypi: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest): + (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest): + (WTF::CCLayerTreeHostTestManySurfaces::beginTest): + (WTF::CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit::drawLayersOnCCThread): + * tests/CCRendererGLTest.cpp: Renamed from Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp. + (FrameCountingMemoryAllocationSettingContext): + (FrameCountingMemoryAllocationSettingContext::FrameCountingMemoryAllocationSettingContext): + (FrameCountingMemoryAllocationSettingContext::prepareTexture): + (FrameCountingMemoryAllocationSettingContext::setMemoryAllocationChangedCallbackCHROMIUM): + (FrameCountingMemoryAllocationSettingContext::getString): + (FrameCountingMemoryAllocationSettingContext::frameCount): + (FrameCountingMemoryAllocationSettingContext::setMemoryAllocation): + (FakeCCRendererClient): + (FakeCCRendererClient::FakeCCRendererClient): + (FakeCCRendererClient::setFullRootLayerDamageCount): + (FakeCCRendererClient::rootRenderPass): + (FakeCCRendererClient::renderPassesInDrawOrder): + (FakeCCRendererClient::renderPasses): + (FakeCCRendererClient::memoryAllocationLimitBytes): + (FakeCCRendererGL): + (FakeCCRendererGL::FakeCCRendererGL): + (CCRendererGLTest): + (CCRendererGLTest::CCRendererGLTest): + (CCRendererGLTest::SetUp): + (CCRendererGLTest::TearDown): + (CCRendererGLTest::swapBuffers): + (CCRendererGLTest::context): + (TEST_F): + (ForbidSynchronousCallContext): + (ForbidSynchronousCallContext::ForbidSynchronousCallContext): + (ForbidSynchronousCallContext::getActiveAttrib): + (ForbidSynchronousCallContext::getActiveUniform): + (ForbidSynchronousCallContext::getAttachedShaders): + (ForbidSynchronousCallContext::getAttribLocation): + (ForbidSynchronousCallContext::getBooleanv): + (ForbidSynchronousCallContext::getBufferParameteriv): + (ForbidSynchronousCallContext::getContextAttributes): + (ForbidSynchronousCallContext::getError): + (ForbidSynchronousCallContext::getFloatv): + (ForbidSynchronousCallContext::getFramebufferAttachmentParameteriv): + (ForbidSynchronousCallContext::getIntegerv): + (ForbidSynchronousCallContext::getProgramiv): + (ForbidSynchronousCallContext::getShaderiv): + (ForbidSynchronousCallContext::getString): + (ForbidSynchronousCallContext::getProgramInfoLog): + (ForbidSynchronousCallContext::getRenderbufferParameteriv): + (ForbidSynchronousCallContext::getShaderInfoLog): + (ForbidSynchronousCallContext::getShaderPrecisionFormat): + (ForbidSynchronousCallContext::getShaderSource): + (ForbidSynchronousCallContext::getTexParameterfv): + (ForbidSynchronousCallContext::getTexParameteriv): + (ForbidSynchronousCallContext::getUniformfv): + (ForbidSynchronousCallContext::getUniformiv): + (ForbidSynchronousCallContext::getUniformLocation): + (ForbidSynchronousCallContext::getVertexAttribfv): + (ForbidSynchronousCallContext::getVertexAttribiv): + (ForbidSynchronousCallContext::getVertexAttribOffset): + (TEST): + (LoseContextOnFirstGetContext): + (LoseContextOnFirstGetContext::LoseContextOnFirstGetContext): + (ContextThatDoesNotSupportMemoryManagmentExtensions): + (ContextThatDoesNotSupportMemoryManagmentExtensions::ContextThatDoesNotSupportMemoryManagmentExtensions): + (ContextThatDoesNotSupportMemoryManagmentExtensions::prepareTexture): + (ContextThatDoesNotSupportMemoryManagmentExtensions::setMemoryAllocationChangedCallbackCHROMIUM): + (ContextThatDoesNotSupportMemoryManagmentExtensions::getString): + (ClearCountingContext): + (ClearCountingContext::ClearCountingContext): + (ClearCountingContext::clear): + (ClearCountingContext::clearCount): + * tests/TiledLayerChromiumTest.cpp: + +2012-08-23 Stephen White <senorblanco@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-23 Wei Jia <wjia@chromium.org> + + create different WebKit::WebMediaPlayer based on URL + https://bugs.webkit.org/show_bug.cgi?id=91301 + + Reviewed by Adam Barth. + + Pass URL to WebFrameClient::createMediaPlayer(). This allows creation + of different WebMediaPlayer implementations based on the URL. + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::createMediaPlayer): add URL as additional argument. + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::createWebMediaPlayer): add URL as additional argument. + (WebKit::WebMediaPlayerClientImpl::loadInternal): + +2012-08-23 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Move onSuccess(IDBDatabaseBackendInterface) to IDBOpenDBRequest + https://bugs.webkit.org/show_bug.cgi?id=94757 + + Reviewed by Tony Chang. + + Drop onSuccess(IDBDatabaseBackendImpl) overload from test, as it is no longer + implemented by IDBRequest. + + * tests/IDBRequestTest.cpp: + (WebCore::TEST): + +2012-08-23 Kenneth Russell <kbr@google.com> + + Convert ScrollableArea ASSERT_NOT_REACHED virtuals into pure virtuals + https://bugs.webkit.org/show_bug.cgi?id=93306 + + Unreviewed build fix. + + * src/ScrollbarGroup.h: + +2012-08-23 Adrienne Walker <enne@google.com> + + Convert ScrollableArea ASSERT_NOT_REACHED virtuals + https://bugs.webkit.org/show_bug.cgi?id=93306 + + Reviewed by Darin Adler. + + Add implementations where necessary to make derived classes concrete. + Add OVERRIDE for ScrollableArea functions. + + * src/ScrollbarGroup.h: + (ScrollbarGroup): + (WebKit::ScrollbarGroup::scrollCornerRect): + * tests/ScrollAnimatorNoneTest.cpp: + (MockScrollableArea): + +2012-08-23 David Reveman <reveman@chromium.org> + + [Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer. + https://bugs.webkit.org/show_bug.cgi?id=94719 + + Reviewed by James Robinson. + + * tests/CCSchedulerTestCommon.h: + 2012-08-23 Peter Beverloo <peter@chromium.org> Unreviewed. Rolled DEPS. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 6322e4843..479de4270 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': '152985' + 'chromium_rev': '153032' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 1a46375fa..1fd2164bc 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -1177,7 +1177,7 @@ 'input_file': '../../WebCore/inspector/front-end/TimelinePanel.js', 'inputs': [ '<@(_script_name)', - '<@(webinspector_resources_js_files)', + '<@(webinspector_timeline_js_files)', ], 'search_path': '../../WebCore/inspector/front-end', 'outputs': ['<(PRODUCT_DIR)/resources/inspector/TimelinePanel.js'], diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index fc86f83b3..890b3f675 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -125,7 +125,7 @@ 'tests/KeyboardTest.cpp', 'tests/KURLTest.cpp', 'tests/LayerChromiumTest.cpp', - 'tests/LayerRendererChromiumTest.cpp', + 'tests/CCRendererGLTest.cpp', 'tests/LevelDBTest.cpp', 'tests/LinkHighlightTest.cpp', 'tests/ListenerLeakTest.cpp', @@ -187,7 +187,8 @@ 'src/WebContentLayerImpl.h', 'src/WebExternalTextureLayerImpl.cpp', 'src/WebExternalTextureLayerImpl.h', - 'src/WebFloatAnimationCurve.cpp', + 'src/WebFloatAnimationCurveImpl.cpp', + 'src/WebFloatAnimationCurveImpl.h', 'src/WebIOSurfaceLayerImpl.cpp', 'src/WebIOSurfaceLayerImpl.h', 'src/WebImageLayerImpl.cpp', @@ -201,7 +202,8 @@ 'src/WebScrollbarLayerImpl.h', 'src/WebSolidColorLayerImpl.cpp', 'src/WebSolidColorLayerImpl.h', - 'src/WebTransformAnimationCurve.cpp', + 'src/WebTransformAnimationCurveImpl.cpp', + 'src/WebTransformAnimationCurveImpl.h', 'src/WebVideoLayerImpl.cpp', 'src/WebVideoLayerImpl.h', ], diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h index cc8923d80..b4fccebc2 100644 --- a/Source/WebKit/chromium/public/WebFrameClient.h +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -88,7 +88,7 @@ public: virtual WebSharedWorker* createSharedWorker(WebFrame*, const WebURL&, const WebString&, unsigned long long) { return 0; } // May return null. - virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) { return 0; } + virtual WebMediaPlayer* createMediaPlayer(WebFrame*, const WebURL&, WebMediaPlayerClient*) { return 0; } // May return null. virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*) { return 0; } diff --git a/Source/WebKit/chromium/public/WebIDBDatabase.h b/Source/WebKit/chromium/public/WebIDBDatabase.h index 3eb1ecb74..a8b035c72 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabase.h +++ b/Source/WebKit/chromium/public/WebIDBDatabase.h @@ -64,6 +64,7 @@ public: return 0; } virtual void close() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void forceClose() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void open(WebIDBDatabaseCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h index 0907b8bf0..12da7e0b4 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h +++ b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h @@ -35,6 +35,7 @@ class WebIDBDatabaseCallbacks { public: virtual ~WebIDBDatabaseCallbacks() { } + virtual void onForcedClose() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onVersionChange(long long oldVersion, long long newVersion) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onVersionChange(const WebString& requestedVersion) { WEBKIT_ASSERT_NOT_REACHED(); } }; diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 329a99f19..d73654578 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -71,9 +71,6 @@ #include "SecurityOrigin.h" #include "Settings.h" #include "TextFieldDecorationElement.h" -#if USE(V8) -#include "V8Proxy.h" -#endif #include "WebAccessibilityObject.h" #if ENABLE(INPUT_TYPE_COLOR) #include "WebColorChooser.h" diff --git a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp index 019e59ba0..31897da9e 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp @@ -48,6 +48,11 @@ IDBDatabaseCallbacksProxy::~IDBDatabaseCallbacksProxy() { } +void IDBDatabaseCallbacksProxy::onForcedClose() +{ + m_callbacks->onForcedClose(); +} + void IDBDatabaseCallbacksProxy::onVersionChange(int64_t oldVersion, int64_t newVersion) { m_callbacks->onVersionChange(oldVersion, newVersion); diff --git a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h index 9995abd2b..cb1ddb346 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h +++ b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h @@ -40,6 +40,7 @@ public: static PassRefPtr<IDBDatabaseCallbacksProxy> create(PassOwnPtr<WebIDBDatabaseCallbacks>); virtual ~IDBDatabaseCallbacksProxy(); + virtual void onForcedClose(); virtual void onVersionChange(const String& requestedVersion); virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); diff --git a/Source/WebKit/chromium/src/LinkHighlight.cpp b/Source/WebKit/chromium/src/LinkHighlight.cpp index fa34d1d0d..2c804a8cd 100644 --- a/Source/WebKit/chromium/src/LinkHighlight.cpp +++ b/Source/WebKit/chromium/src/LinkHighlight.cpp @@ -200,13 +200,13 @@ void LinkHighlight::startHighlightAnimation() m_contentLayer->layer()->setOpacity(startOpacity); - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, startOpacity)); - curve.add(WebFloatKeyframe(duration / 2, startOpacity)); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, startOpacity)); + curve->add(WebFloatKeyframe(duration / 2, startOpacity)); // For layout tests we don't fade out. - curve.add(WebFloatKeyframe(duration, WebKit::layoutTestMode() ? startOpacity : 0)); + curve->add(WebFloatKeyframe(duration, WebKit::layoutTestMode() ? startOpacity : 0)); - m_animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity)); + m_animation = adoptPtr(WebAnimation::create(*curve, WebAnimation::TargetPropertyOpacity)); m_contentLayer->layer()->setDrawsContent(true); m_contentLayer->layer()->addAnimation(m_animation.get()); diff --git a/Source/WebKit/chromium/src/ScrollbarGroup.h b/Source/WebKit/chromium/src/ScrollbarGroup.h index a0479c206..b2df772f4 100644 --- a/Source/WebKit/chromium/src/ScrollbarGroup.h +++ b/Source/WebKit/chromium/src/ScrollbarGroup.h @@ -49,31 +49,31 @@ public: void setFrameRect(const WebCore::IntRect&); // WebCore::ScrollableArea methods - virtual int scrollSize(WebCore::ScrollbarOrientation) const; - virtual int scrollPosition(WebCore::Scrollbar*) const; - virtual void setScrollOffset(const WebCore::IntPoint&); - virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); - virtual void invalidateScrollCornerRect(const WebCore::IntRect&); - virtual bool isActive() const; - virtual ScrollableArea* enclosingScrollableArea() const; - virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); } - virtual bool isScrollCornerVisible() const; - virtual void getTickmarks(Vector<WebCore::IntRect>&) const; - virtual WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntPoint& parentPoint) const; - virtual WebCore::Scrollbar* horizontalScrollbar() const; - virtual WebCore::Scrollbar* verticalScrollbar() const; - virtual WebCore::IntPoint scrollPosition() const; - virtual WebCore::IntPoint minimumScrollPosition() const; - virtual WebCore::IntPoint maximumScrollPosition() const; - virtual int visibleHeight() const; - virtual int visibleWidth() const; - virtual WebCore::IntSize contentsSize() const; - virtual WebCore::IntSize overhangAmount() const; - virtual WebCore::IntPoint currentMousePosition() const; - virtual bool shouldSuspendScrollAnimations() const; - virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate); - virtual bool isOnActivePage() const; - virtual WebCore::IntRect scrollableAreaBoundingBox() const; + virtual int scrollSize(WebCore::ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(WebCore::Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const WebCore::IntPoint&) OVERRIDE; + virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&) OVERRIDE; + virtual void invalidateScrollCornerRect(const WebCore::IntRect&) OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE; + virtual WebCore::IntRect scrollCornerRect() const OVERRIDE { return WebCore::IntRect(); } + virtual bool isScrollCornerVisible() const OVERRIDE; + virtual void getTickmarks(Vector<WebCore::IntRect>&) const OVERRIDE; + virtual WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntPoint& parentPoint) const OVERRIDE; + virtual WebCore::Scrollbar* horizontalScrollbar() const OVERRIDE; + virtual WebCore::Scrollbar* verticalScrollbar() const OVERRIDE; + virtual WebCore::IntPoint scrollPosition() const OVERRIDE; + virtual WebCore::IntPoint minimumScrollPosition() const OVERRIDE; + virtual WebCore::IntPoint maximumScrollPosition() const OVERRIDE; + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual WebCore::IntSize contentsSize() const OVERRIDE; + virtual WebCore::IntSize overhangAmount() const OVERRIDE; + virtual WebCore::IntPoint currentMousePosition() const OVERRIDE; + virtual bool shouldSuspendScrollAnimations() const OVERRIDE; + virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual WebCore::IntRect scrollableAreaBoundingBox() const OVERRIDE; private: WebCore::FrameView* m_frameView; diff --git a/Source/WebKit/chromium/src/WebAnimationImpl.cpp b/Source/WebKit/chromium/src/WebAnimationImpl.cpp index 187272ef2..e5d9ef2a3 100644 --- a/Source/WebKit/chromium/src/WebAnimationImpl.cpp +++ b/Source/WebKit/chromium/src/WebAnimationImpl.cpp @@ -29,6 +29,8 @@ #include "AnimationIdVendor.h" #include "CCActiveAnimation.h" #include "CCAnimationCurve.h" +#include "WebFloatAnimationCurveImpl.h" +#include "WebTransformAnimationCurveImpl.h" #include <public/WebAnimation.h> #include <public/WebAnimationCurve.h> #include <wtf/OwnPtr.h> @@ -46,7 +48,30 @@ WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty) { - return new WebAnimationImpl(CCActiveAnimation::create(curve, animationId, groupId, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty))); + return new WebAnimationImpl(curve, animationId, groupId, targetProperty); +} + +WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, int animationId, int groupId, TargetProperty targetProperty) +{ + WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); + OwnPtr<WebCore::CCAnimationCurve> curve; + switch (curveType) { + case WebAnimationCurve::AnimationCurveTypeFloat: { + const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const WebFloatAnimationCurveImpl*>(&webCurve); + curve = floatCurveImpl->cloneToCCAnimationCurve(); + break; + } + case WebAnimationCurve::AnimationCurveTypeTransform: { + const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<const WebTransformAnimationCurveImpl*>(&webCurve); + curve = transformCurveImpl->cloneToCCAnimationCurve(); + break; + } + } + m_animation = CCActiveAnimation::create(curve.release(), animationId, groupId, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)); +} + +WebAnimationImpl::~WebAnimationImpl() +{ } WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const diff --git a/Source/WebKit/chromium/src/WebAnimationImpl.h b/Source/WebKit/chromium/src/WebAnimationImpl.h index 8677b9c60..d7ceba51f 100644 --- a/Source/WebKit/chromium/src/WebAnimationImpl.h +++ b/Source/WebKit/chromium/src/WebAnimationImpl.h @@ -37,11 +37,8 @@ namespace WebKit { class WebAnimationImpl : public WebAnimation { public: - explicit WebAnimationImpl(PassOwnPtr<WebCore::CCActiveAnimation> animation) - : m_animation(animation) - { - } - virtual ~WebAnimationImpl() { } + WebAnimationImpl(const WebAnimationCurve&, int animationId, int groupId, TargetProperty); + virtual ~WebAnimationImpl(); // WebAnimation implementation virtual TargetProperty targetProperty() const OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebBindings.cpp b/Source/WebKit/chromium/src/WebBindings.cpp index 71a74db1b..c44dc429e 100644 --- a/Source/WebKit/chromium/src/WebBindings.cpp +++ b/Source/WebKit/chromium/src/WebBindings.cpp @@ -45,7 +45,6 @@ #include "V8DOMWrapper.h" #include "V8Element.h" #include "V8NPUtils.h" -#include "V8Proxy.h" #include "V8Range.h" #include <wtf/ArrayBufferView.h> // FIXME: Remove the USE(JSC) ifdefs because we don't support USE(JSC) anymore. diff --git a/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp b/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp index 06cf66fc5..383c7de21 100644 --- a/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp +++ b/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp @@ -42,10 +42,6 @@ #include "platform/WebSerializedScriptValue.h" #include "platform/WebString.h" -#if USE(V8) -#include "V8Proxy.h" -#endif - using namespace WebCore; namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index e3a80e0d4..c639f674d 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -51,7 +51,6 @@ #include "ResourceRequest.h" #include "ResourceResponse.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WebDataSource.h" #include "WebDevToolsAgentClient.h" diff --git a/Source/WebKit/chromium/src/WebFloatAnimationCurve.cpp b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp index e8cf7c2d2..9f5665cb8 100644 --- a/Source/WebKit/chromium/src/WebFloatAnimationCurve.cpp +++ b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp @@ -24,8 +24,9 @@ #include "config.h" -#include <public/WebFloatAnimationCurve.h> +#include "WebFloatAnimationCurveImpl.h" +#include "CCAnimationCurve.h" #include "CCKeyframedAnimationCurve.h" #include "CCTimingFunction.h" #include "WebAnimationCurveCommon.h" @@ -34,39 +35,48 @@ namespace WebKit { -void WebFloatAnimationCurve::add(const WebFloatKeyframe& keyframe) +WebFloatAnimationCurve* WebFloatAnimationCurve::create() +{ + return new WebFloatAnimationCurveImpl(WebCore::CCKeyframedFloatAnimationCurve::create()); +} + +WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve> curve) + : m_curve(curve) { - add(keyframe, TimingFunctionTypeEase); } -void WebFloatAnimationCurve::add(const WebFloatKeyframe& keyframe, TimingFunctionType type) +WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() { - m_private->addKeyframe(WebCore::CCFloatKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); } -void WebFloatAnimationCurve::add(const WebFloatKeyframe& keyframe, double x1, double y1, double x2, double y2) +WebAnimationCurve::AnimationCurveType WebFloatAnimationCurveImpl::type() const { - m_private->addKeyframe(WebCore::CCFloatKeyframe::create(keyframe.time, keyframe.value, WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2))); + return WebAnimationCurve::AnimationCurveTypeFloat; +} + +void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) +{ + add(keyframe, TimingFunctionTypeEase); } -float WebFloatAnimationCurve::getValue(double time) const +void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFunctionType type) { - return m_private->getValue(time); + m_curve->addKeyframe(WebCore::CCFloatKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); } -WebFloatAnimationCurve::operator PassOwnPtr<WebCore::CCAnimationCurve>() const +void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, double x1, double y1, double x2, double y2) { - return m_private->clone(); + m_curve->addKeyframe(WebCore::CCFloatKeyframe::create(keyframe.time, keyframe.value, WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2))); } -void WebFloatAnimationCurve::initialize() +float WebFloatAnimationCurveImpl::getValue(double time) const { - m_private.reset(WebCore::CCKeyframedFloatAnimationCurve::create().leakPtr()); + return m_curve->getValue(time); } -void WebFloatAnimationCurve::destroy() +PassOwnPtr<WebCore::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationCurve() const { - m_private.reset(0); + return m_curve->clone(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h new file mode 100644 index 000000000..e8f1620d6 --- /dev/null +++ b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h @@ -0,0 +1,62 @@ +/* + * 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFloatAnimationCurveImpl_h +#define WebFloatAnimationCurveImpl_h + +#include <public/WebFloatAnimationCurve.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace WebCore { +class CCAnimationCurve; +class CCKeyframedFloatAnimationCurve; +} + +namespace WebKit { + +class WebFloatAnimationCurveImpl : public WebFloatAnimationCurve { +public: + explicit WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve>); + virtual ~WebFloatAnimationCurveImpl(); + + // WebAnimationCurve implementation. + virtual AnimationCurveType type() const OVERRIDE; + + // WebFloatAnimationCurve implementation. + virtual void add(const WebFloatKeyframe&) OVERRIDE; + virtual void add(const WebFloatKeyframe&, TimingFunctionType) OVERRIDE; + virtual void add(const WebFloatKeyframe&, double x1, double y1, double x2, double y2) OVERRIDE; + + virtual float getValue(double time) const OVERRIDE; + + PassOwnPtr<WebCore::CCAnimationCurve> cloneToCCAnimationCurve() const; + +private: + OwnPtr<WebCore::CCKeyframedFloatAnimationCurve> m_curve; +}; + +} + +#endif // WebFloatAnimationCurveImpl_h diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp index 14757bac6..5ae86a679 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp @@ -44,6 +44,11 @@ WebIDBDatabaseCallbacksImpl::~WebIDBDatabaseCallbacksImpl() { } +void WebIDBDatabaseCallbacksImpl::onForcedClose() +{ + m_callbacks->onForcedClose(); +} + void WebIDBDatabaseCallbacksImpl::onVersionChange(long long oldVersion, long long newVersion) { m_callbacks->onVersionChange(oldVersion, newVersion); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h index 1857ca658..b0737eeb2 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h @@ -43,6 +43,7 @@ public: WebIDBDatabaseCallbacksImpl(PassRefPtr<WebCore::IDBDatabaseCallbacks>); virtual ~WebIDBDatabaseCallbacksImpl(); + virtual void onForcedClose(); virtual void onVersionChange(long long oldVersion, long long newVersion); virtual void onVersionChange(const WebString& version); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 9343281cf..0d142bc02 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -99,8 +99,18 @@ void WebIDBDatabaseImpl::close() m_closePending = true; return; } - m_databaseBackend->close(m_databaseCallbacks); - m_databaseCallbacks = 0; + m_databaseBackend->close(m_databaseCallbacks.release()); +} + +void WebIDBDatabaseImpl::forceClose() +{ + if (!m_databaseCallbacks) { + m_closePending = true; + return; + } + RefPtr<IDBDatabaseCallbacksProxy> callbacks = m_databaseCallbacks.release(); + m_databaseBackend->close(callbacks); + callbacks->onForcedClose(); } void WebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h index 1409cb65f..4a8284ce5 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -28,6 +28,7 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBDatabaseCallbacksProxy.h" #include "platform/WebCommon.h" #include "WebExceptionCode.h" #include "WebIDBDatabase.h" @@ -38,7 +39,6 @@ namespace WebCore { class IDBDatabaseBackendInterface; } namespace WebKit { -class IDBDatabaseCallbacksProxy; class WebIDBDatabaseCallbacks; class WebIDBDatabaseMetadata; class WebIDBObjectStore; @@ -56,6 +56,7 @@ public: virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); virtual void setVersion(const WebString& version, WebIDBCallbacks*, WebExceptionCode&); virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode&); + virtual void forceClose(); virtual void close(); // FIXME: Rename "open" to registerFrontendCallbacks. diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp index 40ced485d..bf64a8f2a 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp @@ -123,14 +123,6 @@ void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* newLayer) m_layer->replaceChild(static_cast<WebLayerImpl*>(reference)->layer(), static_cast<WebLayerImpl*>(newLayer)->layer()); } -void WebLayerImpl::setChildren(const WebVector<WebLayer*>& webChildren) -{ - Vector<RefPtr<LayerChromium> > children(webChildren.size()); - for (size_t i = 0; i < webChildren.size(); ++i) - children[i] = static_cast<WebLayerImpl*>(webChildren[i])->layer(); - m_layer->setChildren(children); -} - void WebLayerImpl::removeFromParent() { m_layer->removeFromParent(); diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h index 7e3b533bc..0a61826a5 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.h +++ b/Source/WebKit/chromium/src/WebLayerImpl.h @@ -47,7 +47,6 @@ public: virtual void addChild(WebLayer*) OVERRIDE; virtual void insertChild(WebLayer*, size_t index) OVERRIDE; virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) OVERRIDE; - virtual void setChildren(const WebVector<WebLayer*>&) OVERRIDE; virtual void removeFromParent() OVERRIDE; virtual void removeAllChildren() OVERRIDE; virtual void setAnchorPoint(const WebFloatPoint&) OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index cb756233e..72e871637 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -7,6 +7,7 @@ #if ENABLE(VIDEO) +#include "AudioBus.h" #include "AudioSourceProvider.h" #include "AudioSourceProviderClient.h" #include "Frame.h" @@ -45,13 +46,13 @@ using namespace WebCore; namespace WebKit { -static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* client, Frame* frame) +static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* client, const WebURL& url, Frame* frame) { WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); if (!webFrame->client()) return nullptr; - return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, client)); + return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client)); } bool WebMediaPlayerClientImpl::m_isEnabled = false; @@ -321,7 +322,7 @@ void WebMediaPlayerClientImpl::loadInternal() #endif Frame* frame = static_cast<HTMLMediaElement*>(m_mediaPlayer->mediaPlayerClient())->document()->frame(); - m_webMediaPlayer = createWebMediaPlayer(this, frame); + m_webMediaPlayer = createWebMediaPlayer(this, KURL(ParsedURLString, m_url), frame); if (m_webMediaPlayer) { #if ENABLE(WEB_AUDIO) // Make sure if we create/re-create the WebMediaPlayer that we update our wrapper. diff --git a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp new file mode 100644 index 000000000..201042e95 --- /dev/null +++ b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp @@ -0,0 +1,81 @@ +/* + * 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "WebTransformAnimationCurveImpl.h" + +#include "CCKeyframedAnimationCurve.h" +#include "CCTimingFunction.h" +#include "WebAnimationCurveCommon.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +WebTransformAnimationCurve* WebTransformAnimationCurve::create() +{ + return new WebTransformAnimationCurveImpl(WebCore::CCKeyframedTransformAnimationCurve::create()); +} + +WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve> curve) + : m_curve(curve) +{ +} + +WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() +{ +} + +WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() const +{ + return WebAnimationCurve::AnimationCurveTypeTransform; +} + +void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) +{ + add(keyframe, TimingFunctionTypeEase); +} + +void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, TimingFunctionType type) +{ + m_curve->addKeyframe(WebCore::CCTransformKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); +} + +void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, double x1, double y1, double x2, double y2) +{ + m_curve->addKeyframe(WebCore::CCTransformKeyframe::create(keyframe.time, keyframe.value, WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2))); +} + +WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) const +{ + return m_curve->getValue(time); +} + +PassOwnPtr<WebCore::CCAnimationCurve> WebTransformAnimationCurveImpl::cloneToCCAnimationCurve() const +{ + return m_curve->clone(); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebTransformAnimationCurve.cpp b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h index dad084987..45a03ef06 100644 --- a/Source/WebKit/chromium/src/WebTransformAnimationCurve.cpp +++ b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h @@ -22,51 +22,41 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef WebTransformAnimationCurveImpl_h +#define WebTransformAnimationCurveImpl_h #include <public/WebTransformAnimationCurve.h> - -#include "CCKeyframedAnimationCurve.h" -#include "CCTimingFunction.h" -#include "WebAnimationCurveCommon.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> +namespace WebCore { +class CCAnimationCurve; +class CCKeyframedTransformAnimationCurve; +} + namespace WebKit { -void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe) -{ - add(keyframe, TimingFunctionTypeEase); -} +class WebTransformAnimationCurveImpl : public WebTransformAnimationCurve { +public: + explicit WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve>); + virtual ~WebTransformAnimationCurveImpl(); -void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe, TimingFunctionType type) -{ - m_private->addKeyframe(WebCore::CCTransformKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type))); -} + // WebAnimationCurve implementation. + virtual AnimationCurveType type() const OVERRIDE; -void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe, double x1, double y1, double x2, double y2) -{ - m_private->addKeyframe(WebCore::CCTransformKeyframe::create(keyframe.time, keyframe.value, WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2))); -} + // WebTransformAnimationCurve implementation. + virtual void add(const WebTransformKeyframe&) OVERRIDE; + virtual void add(const WebTransformKeyframe&, TimingFunctionType) OVERRIDE; + virtual void add(const WebTransformKeyframe&, double x1, double y1, double x2, double y2) OVERRIDE; -WebTransformationMatrix WebTransformAnimationCurve::getValue(double time) const -{ - return m_private->getValue(time); -} + virtual WebTransformationMatrix getValue(double time) const OVERRIDE; -WebTransformAnimationCurve::operator PassOwnPtr<WebCore::CCAnimationCurve>() const -{ - return m_private->clone(); -} + PassOwnPtr<WebCore::CCAnimationCurve> cloneToCCAnimationCurve() const; -void WebTransformAnimationCurve::initialize() -{ - m_private.reset(WebCore::CCKeyframedTransformAnimationCurve::create().leakPtr()); -} +private: + OwnPtr<WebCore::CCKeyframedTransformAnimationCurve> m_curve; +}; -void WebTransformAnimationCurve::destroy() -{ - m_private.reset(0); } -} // namespace WebKit +#endif // WebTransformAnimationCurveImpl_h diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index 6ec0ce5d7..a715f5b9a 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -35,6 +35,7 @@ #include "CCLayerTreeTestCommon.h" #include "CCQuadCuller.h" #include "CCRenderPassDrawQuad.h" +#include "CCRendererGL.h" #include "CCScrollbarLayerImpl.h" #include "CCSettings.h" #include "CCSingleThreadProxy.h" @@ -47,7 +48,6 @@ #include "FakeWebCompositorOutputSurface.h" #include "FakeWebGraphicsContext3D.h" #include "FakeWebScrollbarThemeGeometry.h" -#include "LayerRendererChromium.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebVideoFrame.h> @@ -76,7 +76,7 @@ public: settings.minimumOcclusionTrackingSize = IntSize(); m_hostImpl = CCLayerTreeHostImpl::create(settings, this); - m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader); + m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); } @@ -96,7 +96,7 @@ public: OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); - myHostImpl->initializeLayerRenderer(graphicsContext, UnthrottledUploader); + myHostImpl->initializeRenderer(graphicsContext, UnthrottledUploader); myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); OwnPtr<CCLayerImpl> root = rootPtr; @@ -165,9 +165,9 @@ public: return layer.release(); } - void initializeLayerRendererAndDrawFrame() + void initializeRendererAndDrawFrame() { - m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader); + m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); CCLayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); @@ -265,7 +265,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); @@ -286,7 +286,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) m_hostImpl = CCLayerTreeHostImpl::create(settings, this); // Initialization will fail here. - m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); setupScrollAndContentsLayers(IntSize(100, 100)); @@ -301,7 +301,7 @@ TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // We should not crash if the tree is replaced while we are scrolling. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); @@ -321,7 +321,7 @@ TEST_F(CCLayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // We should be able to scroll even if the root layer loses its render surface after the most // recent render. @@ -333,7 +333,7 @@ TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* root = m_hostImpl->rootLayer(); root->setHaveWheelEventHandlers(true); @@ -349,7 +349,7 @@ TEST_F(CCLayerTreeHostImplTest, shouldScrollOnMainThread) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* root = m_hostImpl->rootLayer(); root->setShouldScrollOnMainThread(true); @@ -362,7 +362,7 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic) { setupScrollAndContentsLayers(IntSize(200, 200)); m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* root = m_hostImpl->rootLayer(); root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); @@ -388,7 +388,7 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset) root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); root->setPosition(FloatPoint(-25, 0)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // This point would fall into the non-fast scrollable region except that we've moved the layer down by 25 pixels. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); @@ -403,7 +403,7 @@ TEST_F(CCLayerTreeHostImplTest, pinchGesture) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); ASSERT(scrollLayer); @@ -484,7 +484,7 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation) { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); ASSERT(scrollLayer); @@ -534,7 +534,7 @@ TEST_F(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); ASSERT(scrollLayer); @@ -588,7 +588,7 @@ TEST_F(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa { setupScrollAndContentsLayers(IntSize(100, 100)); m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); ASSERT(scrollLayer); @@ -849,7 +849,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootIgnored) OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setScrollable(false); m_hostImpl->setRootLayer(root.release()); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // Scroll event is ignored because layer is not scrollable. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); @@ -882,7 +882,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollNonCompositedRoot) m_hostImpl->setRootLayer(scrollLayer.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); @@ -900,7 +900,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) root->addChild(createScrollableLayer(2, surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); @@ -916,7 +916,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesChild) root->addChild(createScrollableLayer(2, surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // Scroll event is ignored because the input coordinate is outside the layer boundaries. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(15, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); @@ -938,7 +938,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) root->addChild(child.release()); m_hostImpl->setRootLayer(root.release()); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // Scroll event is ignored because the scrollable layer is not facing the viewer and there is // nothing scrollable behind it. @@ -959,7 +959,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollBlockedByContentLayer) m_hostImpl->setRootLayer(scrollLayer.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // Scrolling fails because the content layer is asking to be scrolled on the main thread. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread); @@ -972,7 +972,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); @@ -1004,7 +1004,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); @@ -1081,7 +1081,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) root->addChild(createScrollableLayer(scrollLayerId, surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); CCLayerImpl* child = m_hostImpl->rootLayer()->children()[0].get(); @@ -1125,7 +1125,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildBeyondLimit) root->addChild(child.release()); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); { IntSize scrollDelta(-8, -7); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); @@ -1157,7 +1157,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollEventBubbling) m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); { IntSize scrollDelta(0, 4); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); @@ -1179,7 +1179,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollBeforeRedraw) m_hostImpl->setViewportSize(surfaceSize, surfaceSize); // Draw one frame and then immediately rebuild the layer tree to mimic a tree synchronization. - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); m_hostImpl->detachLayerTree(); m_hostImpl->setRootLayer(createScrollableLayer(2, surfaceSize)); @@ -1198,7 +1198,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) IntSize surfaceSize(50, 50); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // Scroll to the right in screen coordinates with a gesture. IntSize gestureScrollDelta(10, 0); @@ -1242,7 +1242,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) IntSize surfaceSize(50, 50); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); { // Scroll down in screen coordinates with a gesture. @@ -1295,7 +1295,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollScaledLayer) IntSize surfaceSize(50, 50); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); - initializeLayerRendererAndDrawFrame(); + initializeRendererAndDrawFrame(); // Scroll down in screen coordinates with a gesture. IntSize scrollDelta(0, 10); @@ -1345,7 +1345,7 @@ class BlendStateCheckLayer : public CCLayerImpl { public: static PassOwnPtr<BlendStateCheckLayer> create(int id, CCResourceProvider* resourceProvider) { return adoptPtr(new BlendStateCheckLayer(id, resourceProvider)); } - virtual void appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE + virtual void appendQuads(CCQuadSink& quadSink, bool&) OVERRIDE { m_quadsAppended = true; @@ -1354,11 +1354,13 @@ public: opaqueRect = m_quadRect; else opaqueRect = m_opaqueContentRect; + + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); OwnPtr<CCDrawQuad> testBlendingDrawQuad = CCTileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, m_resourceId, IntPoint(), IntSize(1, 1), 0, false, false, false, false, false); testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect); EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending()); EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); - quadList.append(testBlendingDrawQuad.release()); + quadSink.append(testBlendingDrawQuad.release()); } void setExpectation(bool blend, bool hasRenderSurface) @@ -1622,7 +1624,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) TEST_F(CCLayerTreeHostImplTest, viewportCovered) { - m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader); + m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); m_hostImpl->setBackgroundColor(SK_ColorGRAY); IntSize viewportSize(1000, 1000); @@ -1733,7 +1735,7 @@ TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) { OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(adoptPtr(new ReshapeTrackerContext)); ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D()); - m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); + m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); root->setAnchorPoint(FloatPoint(0, 0)); @@ -1782,7 +1784,7 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) CCLayerTreeSettings settings; CCSettings::setPartialSwapEnabled(true); OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this); - layerTreeHostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); + layerTreeHostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); @@ -1877,12 +1879,14 @@ class FakeLayerWithQuads : public CCLayerImpl { public: static PassOwnPtr<FakeLayerWithQuads> create(int id) { return adoptPtr(new FakeLayerWithQuads(id)); } - virtual void appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE + virtual void appendQuads(CCQuadSink& quadSink, bool&) OVERRIDE { + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + SkColor gray = SkColorSetRGB(100, 100, 100); IntRect quadRect(IntPoint(0, 0), contentBounds()); OwnPtr<CCDrawQuad> myQuad = CCSolidColorDrawQuad::create(sharedQuadState, quadRect, gray); - quadList.append(myQuad.release()); + quadSink.append(myQuad.release()); } private: @@ -2067,7 +2071,7 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C CCLayerTreeSettings settings; OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, client); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); /* @@ -2206,7 +2210,7 @@ TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayer EXPECT_FALSE(layer1->didLoseContextCalled()); EXPECT_FALSE(layer2->didLoseContextCalled()); - m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader); + m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); EXPECT_TRUE(root->didLoseContextCalled()); EXPECT_TRUE(layer1->didLoseContextCalled()); @@ -2219,7 +2223,7 @@ TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) m_hostImpl = CCLayerTreeHostImpl::create(settings, this); // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. - m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); m_hostImpl->finishAllRendering(); } @@ -2501,7 +2505,7 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) rootLayer->addChild(scrollbarLayer.release()); // Use a context that supports IOSurfaces - m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D()->createTexture()); @@ -2517,7 +2521,7 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface, // that will warn if any resource from the previous context gets used. - m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); // Create dummy resources so that looking up an old resource will get an // invalid texture id mapping. @@ -2630,7 +2634,7 @@ TEST_F(CCLayerTreeHostImplTest, layersFreeTextures) // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the CCLayerTreeHostImpl takes ownership of). OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new TrackingWebGraphicsContext3D))); TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D()); - m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); + m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); m_hostImpl->setRootLayer(rootLayer.release()); @@ -2702,7 +2706,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, { OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); - layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + layerTreeHostImpl->initializeRenderer(context.release(), UnthrottledUploader); layerTreeHostImpl->setViewportSize(rootSize, rootSize); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); @@ -2728,9 +2732,9 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(5, 5, rootSize.width() - 25, rootSize.height() - 25), &childPtr); } -class LayerRendererChromiumWithReleaseTextures : public LayerRendererChromium { +class CCRendererGLWithReleaseTextures : public CCRendererGL { public: - using LayerRendererChromium::releaseRenderPassTextures; + using CCRendererGL::releaseRenderPassTextures; }; TEST_F(CCLayerTreeHostImplTest, textureCachingWithClipping) @@ -2748,7 +2752,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithClipping) IntSize rootSize(100, 100); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); @@ -2860,7 +2864,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusion) IntSize rootSize(1000, 1000); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); @@ -2973,7 +2977,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) IntSize rootSize(1000, 1000); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); @@ -3087,7 +3091,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) IntSize rootSize(1000, 1000); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); @@ -3170,7 +3174,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) IntSize rootSize(1000, 1000); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); @@ -3255,7 +3259,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) IntSize rootSize(1000, 1000); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); @@ -3373,7 +3377,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) IntRect grandChildRect(5, 5, 150, 150); OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); - myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); root->setAnchorPoint(FloatPoint(0, 0)); root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); @@ -3408,7 +3412,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) myHostImpl->setRootLayer(root.release()); myHostImpl->setViewportSize(rootRect.size(), rootRect.size()); - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_FALSE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); { CCLayerTreeHostImpl::FrameData frame; @@ -3418,7 +3422,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) } // We should have cached textures for surface 2. - EXPECT_TRUE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); { CCLayerTreeHostImpl::FrameData frame; @@ -3428,7 +3432,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) } // We should still have cached textures for surface 2 after drawing with no damage. - EXPECT_TRUE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); // Damage a single tile of surface 2. childPtr->setUpdateRect(IntRect(10, 10, 10, 10)); @@ -3441,7 +3445,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) } // We should have a cached texture for surface 2 again even though it was damaged. - EXPECT_TRUE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); } TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) @@ -3537,7 +3541,7 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) // Change opacity again, and evict the cached surface texture. surfaceLayerPtr->setOpacity(0.5f); - static_cast<LayerRendererChromiumWithReleaseTextures*>(myHostImpl->layerRenderer())->releaseRenderPassTextures(); + static_cast<CCRendererGLWithReleaseTextures*>(myHostImpl->renderer())->releaseRenderPassTextures(); // Change opacity and draw surfaceLayerPtr->setOpacity(0.6f); @@ -3559,7 +3563,7 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_TRUE(targetPass->damageRect().isEmpty()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); + EXPECT_FALSE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -3703,7 +3707,7 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) // Change opacity again, and evict the cached surface texture. surfaceLayerPtr->setOpacity(0.5f); - static_cast<LayerRendererChromiumWithReleaseTextures*>(myHostImpl->layerRenderer())->releaseRenderPassTextures(); + static_cast<CCRendererGLWithReleaseTextures*>(myHostImpl->renderer())->releaseRenderPassTextures(); // Change opacity and draw surfaceLayerPtr->setOpacity(0.6f); @@ -3725,7 +3729,7 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_TRUE(targetPass->damageRect().isEmpty()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); + EXPECT_FALSE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -3804,22 +3808,20 @@ struct RenderPassCacheEntry { struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { std::map<char, RenderPassCacheEntry> renderPassCache; - Vector<OwnPtr<CCRenderSurface> > renderSurfaceStore; - Vector<OwnPtr<CCLayerImpl> > layerStore; OwnPtr<CCSharedQuadState> sharedQuadState; }; class CCTestRenderPass: public CCRenderPass { public: - static PassOwnPtr<CCRenderPass> create(CCRenderSurface* renderSurface, int id) { return adoptPtr(new CCTestRenderPass(renderSurface, id)); } + static PassOwnPtr<CCRenderPass> create(int id, IntRect outputRect, const WebTransformationMatrix& rootTransform) { return adoptPtr(new CCTestRenderPass(id, outputRect, rootTransform)); } void appendQuad(PassOwnPtr<CCDrawQuad> quad) { m_quadList.append(quad); } protected: - CCTestRenderPass(CCRenderSurface* renderSurface, int id) : CCRenderPass(renderSurface, id) { } + CCTestRenderPass(int id, IntRect outputRect, const WebTransformationMatrix& rootTransform) : CCRenderPass(id, outputRect, rootTransform) { } }; -class CCTestRenderer : public LayerRendererChromium, public CCRendererClient { +class CCTestRenderer : public CCRendererGL, public CCRendererClient { public: static PassOwnPtr<CCTestRenderer> create(CCResourceProvider* resourceProvider) { @@ -3845,7 +3847,7 @@ public: virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE { } protected: - CCTestRenderer(CCResourceProvider* resourceProvider) : LayerRendererChromium(this, resourceProvider, UnthrottledUploader) { } + CCTestRenderer(CCResourceProvider* resourceProvider) : CCRendererGL(this, resourceProvider, UnthrottledUploader) { } private: CCLayerTreeSettings m_settings; @@ -3853,29 +3855,18 @@ private: HashSet<int> m_textures; }; -static PassOwnPtr<CCRenderPass> createDummyRenderPass(RenderPassRemovalTestData& testData, int id) -{ - OwnPtr<CCLayerImpl> layerImpl(CCLayerImpl::create(id)); - OwnPtr<CCRenderSurface> renderSurface(adoptPtr(new CCRenderSurface(layerImpl.get()))); - OwnPtr<CCRenderPass> renderPassPtr(CCTestRenderPass::create(renderSurface.get(), layerImpl->id())); - - testData.renderSurfaceStore.append(renderSurface.release()); - testData.layerStore.append(layerImpl.release()); - return renderPassPtr.release(); -} - static void configureRenderPassTestData(const char* testScript, RenderPassRemovalTestData& testData, CCTestRenderer* renderer) { renderer->clearCachedTextures(); // One shared state for all quads - we don't need the correct details - testData.sharedQuadState = CCSharedQuadState::create(0, WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); + testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); const char* currentChar = testScript; // Pre-create root pass char rootRenderPassId = testScript[0]; - OwnPtr<CCRenderPass> rootRenderPass = createDummyRenderPass(testData, rootRenderPassId); + OwnPtr<CCRenderPass> rootRenderPass = CCTestRenderPass::create(rootRenderPassId, IntRect(), WebTransformationMatrix()); testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(rootRenderPassId, RenderPassCacheEntry(rootRenderPass.release()))); while (*currentChar) { char renderPassId = currentChar[0]; @@ -3926,7 +3917,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova if (hasTexture) renderer->setHaveCachedResourcesForRenderPassId(newRenderPassId); - OwnPtr<CCRenderPass> renderPass = createDummyRenderPass(testData, newRenderPassId); + OwnPtr<CCRenderPass> renderPass = CCTestRenderPass::create(newRenderPassId, IntRect(), WebTransformationMatrix()); testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(renderPass.release()))); } diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 5202208b9..c026bd4f5 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -30,6 +30,7 @@ #include "CCLayerTreeHostImpl.h" #include "CCOcclusionTrackerTestCommon.h" #include "CCSettings.h" +#include "CCSingleThreadProxy.h" #include "CCTextureUpdateQueue.h" #include "CCThreadedTest.h" #include "CCTimingFunction.h" @@ -61,7 +62,7 @@ class CCLayerTreeHostTestShortlived1 : public CCLayerTreeHostTest { public: CCLayerTreeHostTestShortlived1() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { // Kill the layerTreeHost immediately. m_layerTreeHost->setRootLayer(0); @@ -70,7 +71,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -80,7 +81,7 @@ class CCLayerTreeHostTestShortlived2 : public CCLayerTreeHostTest { public: CCLayerTreeHostTestShortlived2() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); @@ -91,7 +92,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -103,7 +104,7 @@ class CCLayerTreeHostTestShortlived3 : public CCLayerTreeHostTest { public: CCLayerTreeHostTestShortlived3() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsRedrawToMainThread(); @@ -114,7 +115,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -130,19 +131,19 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { m_numCompleteCommits++; if (m_numCompleteCommits == 2) endTest(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { if (m_numDraws == 1) postSetNeedsCommitToMainThread(); @@ -150,7 +151,7 @@ public: postSetNeedsRedrawToMainThread(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -174,25 +175,25 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { m_numDraws++; if (!impl->sourceFrameNumber()) endTest(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { m_numCommits++; } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_GE(1, m_numCommits); EXPECT_GE(1, m_numDraws); @@ -218,12 +219,12 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { if (!impl->sourceFrameNumber()) postSetNeedsCommitToMainThread(); @@ -231,12 +232,12 @@ public: endTest(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { m_numCommits++; } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_EQ(2, m_numCommits); EXPECT_GE(2, m_numDraws); @@ -267,12 +268,12 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { EXPECT_EQ(0, impl->sourceFrameNumber()); if (!m_numDraws) @@ -282,13 +283,13 @@ public: m_numDraws++; } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { EXPECT_EQ(0, m_numDraws); m_numCommits++; } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_GE(2, m_numDraws); EXPECT_EQ(1, m_numCommits); @@ -312,19 +313,19 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { // Only the initial draw should bring us here. EXPECT_TRUE(impl->canDraw()); EXPECT_EQ(0, impl->sourceFrameNumber()); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { if (m_numCommits >= 1) { // After the first commit, we should not be able to draw. @@ -332,7 +333,7 @@ public: } } - virtual void didCommit() + virtual void didCommit() OVERRIDE { m_numCommits++; if (m_numCommits == 1) { @@ -348,7 +349,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -367,26 +368,26 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postAcquireLayerTextures(); postSetNeedsRedrawToMainThread(); // should be inhibited without blocking postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { m_numDraws++; EXPECT_EQ(m_numDraws, m_numCommits); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { m_numCommits++; endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_EQ(1, m_numCommits); } @@ -413,12 +414,12 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { m_numCommits++; if (m_numCommits == 2) @@ -431,7 +432,7 @@ public: } } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -452,11 +453,11 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { } - virtual void didCommitAndDrawFrame() + virtual void didCommitAndDrawFrame() OVERRIDE { m_numCommits++; if (m_numCommits == 1) { @@ -470,7 +471,7 @@ public: } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -489,7 +490,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { // Request a commit (from the main thread), which will trigger the commit flow from the impl side. m_layerTreeHost->setNeedsCommit(); @@ -505,7 +506,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -530,12 +531,12 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsAnimateToMainThread(); } - virtual void updateAnimations(double) + virtual void updateAnimations(double) OVERRIDE { if (!m_numAnimates) { m_layerTreeHost->setNeedsAnimate(); @@ -545,7 +546,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -570,12 +571,12 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postAddInstantAnimationToMainThread(); } - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { if (!m_numAnimates) { // The animation had zero duration so layerTreeHostImpl should no @@ -592,13 +593,13 @@ public: endTest(); } - virtual void notifyAnimationStarted(double wallClockTime) + virtual void notifyAnimationStarted(double wallClockTime) OVERRIDE { m_receivedAnimationStartedNotification = true; m_startTime = wallClockTime; } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -623,27 +624,27 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postAddAnimationToMainThread(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { m_startedAnimating = true; } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { if (m_startedAnimating) endTest(); } - virtual bool prepareToDrawOnCCThread(CCLayerTreeHostImpl*) + virtual bool prepareToDrawOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { return false; } @@ -666,7 +667,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postAddAnimationToMainThread(); } @@ -674,7 +675,7 @@ public: // Use willAnimateLayers to set visible false before the animation runs and // causes a commit, so we block the second visible animate in single-thread // mode. - virtual void willAnimateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + virtual void willAnimateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { if (m_numAnimates < 2) { if (!m_numAnimates) { @@ -687,7 +688,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -704,12 +705,12 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postAddAnimationToMainThread(); } - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { const CCActiveAnimation* animation = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity); if (!animation) @@ -726,7 +727,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -742,7 +743,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->rootLayer()->setDrawOpacity(1); m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); @@ -750,7 +751,7 @@ public: postAddAnimationToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { // If the subtree was skipped when preparing to draw, the layer's draw opacity // will not have been updated. It should be set to 0 due to the animation. @@ -759,7 +760,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -782,18 +783,18 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postAddAnimationToMainThread(); } // This is guaranteed to be called before CCLayerTreeHostImpl::animateLayers. - virtual void willAnimateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + virtual void willAnimateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) OVERRIDE { m_layerTreeHostImpl = layerTreeHostImpl; } - virtual void notifyAnimationStarted(double time) + virtual void notifyAnimationStarted(double time) OVERRIDE { EXPECT_TRUE(m_layerTreeHostImpl); @@ -807,7 +808,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -824,17 +825,17 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postAddInstantAnimationToMainThread(); } - virtual void notifyAnimationFinished(double time) + virtual void notifyAnimationFinished(double time) OVERRIDE { endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -853,14 +854,14 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->rootLayer()->setScrollable(true); m_layerTreeHost->rootLayer()->setScrollPosition(m_initialScroll); postSetNeedsCommitToMainThread(); } - virtual void layout() + virtual void layout() OVERRIDE { LayerChromium* root = m_layerTreeHost->rootLayer(); if (!m_layerTreeHost->commitNumber()) @@ -873,7 +874,7 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { CCLayerImpl* root = impl->rootLayer(); EXPECT_EQ(root->scrollDelta(), IntSize()); @@ -893,14 +894,14 @@ public: } } - virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) + virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE { IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); m_scrolls++; } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_EQ(1, m_scrolls); } @@ -925,14 +926,14 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->rootLayer()->setScrollable(true); m_layerTreeHost->rootLayer()->setScrollPosition(m_initialScroll); postSetNeedsCommitToMainThread(); } - virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) + virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { LayerChromium* root = m_layerTreeHost->rootLayer(); if (!impl->sourceFrameNumber()) @@ -943,7 +944,7 @@ public: EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { CCLayerImpl* root = impl->rootLayer(); root->setScrollable(true); @@ -974,14 +975,14 @@ public: } } - virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) + virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE { IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); m_scrolls++; } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_EQ(1, m_scrolls); } @@ -1002,7 +1003,7 @@ public: CCLayerTreeHostTestCommit() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setViewportSize(IntSize(20, 20), IntSize(20, 20)); m_layerTreeHost->setBackgroundColor(SK_ColorGRAY); @@ -1011,7 +1012,7 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { EXPECT_EQ(IntSize(20, 20), impl->layoutViewportSize()); EXPECT_EQ(SK_ColorGRAY, impl->backgroundColor()); @@ -1020,7 +1021,7 @@ public: endTest(); } - virtual void afterTest() { } + virtual void afterTest() OVERRIDE { } }; TEST_F(CCLayerTreeHostTestCommit, runTest) @@ -1038,7 +1039,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->rootLayer()->setScrollable(true); m_layerTreeHost->rootLayer()->setScrollPosition(IntPoint()); @@ -1052,7 +1053,7 @@ public: test->layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, 0); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { impl->rootLayer()->setScrollable(true); impl->rootLayer()->setScrollPosition(IntPoint()); @@ -1065,14 +1066,14 @@ public: } } - virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) + virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE { IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { impl->processScrollDeltas(); // We get one commit before the first draw, and the animation doesn't happen until the second draw. @@ -1083,7 +1084,7 @@ public: postSetNeedsRedrawToMainThread(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -1104,21 +1105,21 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetVisibleToMainThread(false); postSetNeedsRedrawToMainThread(); // This is suppressed while we're invisible. postSetVisibleToMainThread(true); // Triggers the redraw. } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { EXPECT_TRUE(impl->visible()); ++m_numDraws; endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_EQ(1, m_numDraws); } @@ -1145,8 +1146,6 @@ public: m_test->layerTreeHost()->rootLayer()->setOpacity(0); } - virtual bool preserves3D() { return false; } - private: CCLayerTreeHostTest* m_test; }; @@ -1186,7 +1185,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setRootLayer(m_updateCheckLayer); m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); @@ -1194,12 +1193,12 @@ public: postSetNeedsCommitToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE { endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { // update() should have been called once. EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount()); @@ -1235,7 +1234,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setViewportSize(IntSize(40, 40), IntSize(60, 60)); m_layerTreeHost->setDeviceScaleFactor(1.5); @@ -1256,7 +1255,7 @@ public: m_layerTreeHost->setRootLayer(m_rootLayer); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { // Get access to protected methods. MockLayerTreeHostImpl* mockImpl = static_cast<MockLayerTreeHostImpl*>(impl); @@ -1314,7 +1313,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { m_rootLayer.clear(); m_childLayer.clear(); @@ -1341,7 +1340,7 @@ public: m_settings.maxPartialTextureUpdates = 0; } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setRootLayer(m_layer); m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); @@ -1350,7 +1349,7 @@ public: postSetNeedsRedrawToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1384,7 +1383,7 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1399,12 +1398,12 @@ public: endTest(); } - virtual void layout() + virtual void layout() OVERRIDE { m_layer->setNeedsDisplay(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -1441,7 +1440,7 @@ public: m_settings.maxPartialTextureUpdates = 1; } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setRootLayer(m_parent); m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20)); @@ -1454,7 +1453,7 @@ public: postSetNeedsRedrawToMainThread(); } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1506,7 +1505,7 @@ public: } } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); @@ -1525,7 +1524,7 @@ public: endTest(); } - virtual void layout() + virtual void layout() OVERRIDE { switch (m_numCommits++) { case 0: @@ -1551,7 +1550,7 @@ public: } } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -1599,7 +1598,7 @@ class CCLayerTreeHostTestLayerOcclusion : public CCLayerTreeHostTest { public: CCLayerTreeHostTestLayerOcclusion() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create(); RefPtr<TestLayerChromium> child = TestLayerChromium::create(); @@ -1625,7 +1624,7 @@ public: m_layerTreeHost->setRootLayer(rootLayer); m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds()); - ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded()); + ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); CCTextureUpdateQueue queue; m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); @@ -1791,7 +1790,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -1802,7 +1801,7 @@ class CCLayerTreeHostTestLayerOcclusionWithFilters : public CCLayerTreeHostTest public: CCLayerTreeHostTestLayerOcclusionWithFilters() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create(); RefPtr<TestLayerChromium> child = TestLayerChromium::create(); @@ -1833,7 +1832,7 @@ public: m_layerTreeHost->setRootLayer(rootLayer); m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds()); - ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded()); + ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); CCTextureUpdateQueue queue; m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); @@ -1882,7 +1881,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -1893,7 +1892,7 @@ class CCLayerTreeHostTestManySurfaces : public CCLayerTreeHostTest { public: CCLayerTreeHostTestManySurfaces() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { // We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion. Region occluded; @@ -1922,7 +1921,7 @@ public: m_layerTreeHost->setRootLayer(layers[0].get()); m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds()); - ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded()); + ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); CCTextureUpdateQueue queue; m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); @@ -1941,7 +1940,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -1955,23 +1954,23 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); } - virtual void didCommitAndDrawFrame() + virtual void didCommitAndDrawFrame() OVERRIDE { m_layerTreeHost->loseContext(1); } - virtual void didRecreateOutputSurface(bool succeeded) + virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { EXPECT_TRUE(succeeded); endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -1989,24 +1988,24 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { postSetNeedsCommitToMainThread(); } - virtual void didCommitAndDrawFrame() + virtual void didCommitAndDrawFrame() OVERRIDE { m_layerTreeHost->loseContext(10); } - virtual void didRecreateOutputSurface(bool succeeded) + virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { EXPECT_FALSE(succeeded); m_layerTreeHost->finishAllRendering(); endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -2023,13 +2022,13 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->rootLayer()->setScrollable(true); postSetNeedsCommitToMainThread(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { CCLayerImpl* root = impl->rootLayer(); root->setMaxScrollPosition(IntSize(100, 100)); @@ -2051,13 +2050,13 @@ public: root->scrollBy(m_scrollAmount); } - virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) + virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE { IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } private: @@ -2078,12 +2077,12 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setNeedsRedraw(); } - virtual void didCommitAndDrawFrame() + virtual void didCommitAndDrawFrame() OVERRIDE { if (m_once) return; @@ -2102,13 +2101,13 @@ public: endTest(); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { Locker<Mutex> lock(m_mutex); ++m_drawCount; } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } private: @@ -2129,7 +2128,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { EXPECT_FALSE(m_addedAnimation); @@ -2148,12 +2147,12 @@ public: endTest(); } - virtual void didAddAnimation() + virtual void didAddAnimation() OVERRIDE { m_addedAnimation = true; } - virtual void afterTest() { } + virtual void afterTest() OVERRIDE { } private: bool m_addedAnimation; @@ -2249,7 +2248,7 @@ class CCLayerTreeHostTestCompositeAndReadbackCleanup : public CCLayerTreeHostTes public: CCLayerTreeHostTestCompositeAndReadbackCleanup() { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { LayerChromium* rootLayer = m_layerTreeHost->rootLayer(); @@ -2260,7 +2259,7 @@ public: endTest(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } }; @@ -2278,7 +2277,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setViewportSize(IntSize(100, 100), IntSize(100, 100)); @@ -2298,9 +2297,9 @@ public: m_layerTreeHost->setRootLayer(m_rootLayer); } - virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* hostImpl) + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* hostImpl) OVERRIDE { - CCRenderer* renderer = hostImpl->layerRenderer(); + CCRenderer* renderer = hostImpl->renderer(); unsigned surface1RenderPassId = hostImpl->rootLayer()->children()[0]->id(); unsigned surface2RenderPassId = hostImpl->rootLayer()->children()[0]->children()[0]->id(); @@ -2322,7 +2321,7 @@ public: } } - virtual void afterTest() + virtual void afterTest() OVERRIDE { EXPECT_EQ(2, m_rootLayer->paintContentsCount()); EXPECT_EQ(2, m_surfaceLayer1->paintContentsCount()); @@ -2409,7 +2408,7 @@ public: return adoptPtr(new EvictionTestLayerImpl(id)); } virtual ~EvictionTestLayerImpl() { } - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE { ASSERT_TRUE(m_hasTexture); ASSERT_NE(0u, layerTreeHostImpl()->resourceProvider()->numResources()); @@ -2464,7 +2463,7 @@ public: { } - virtual void beginTest() + virtual void beginTest() OVERRIDE { m_layerTreeHost->setRootLayer(m_layer); m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20)); @@ -2477,7 +2476,7 @@ public: public: EvictTexturesTask(CCLayerTreeHostTestEvictTextures* test) : m_test(test) { } virtual ~EvictTexturesTask() { } - virtual void run() + virtual void run() OVERRIDE { ASSERT(m_test->m_implForEvictTextures); m_test->m_implForEvictTextures->releaseContentsTextures(); @@ -2515,7 +2514,7 @@ public: // the beginFrame/commit pair. // Commits 5+6 test the path where an eviction happens during the eviction // recovery path. - virtual void didCommitAndDrawFrame() + virtual void didCommitAndDrawFrame() OVERRIDE { switch (m_numCommits) { case 1: @@ -2544,12 +2543,12 @@ public: } } - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { m_implForEvictTextures = impl; } - virtual void layout() + virtual void layout() OVERRIDE { ++m_numCommits; switch (m_numCommits) { @@ -2578,7 +2577,7 @@ public: m_layer->resetUpdated(); } - virtual void afterTest() + virtual void afterTest() OVERRIDE { } @@ -2594,4 +2593,97 @@ TEST_F(CCLayerTreeHostTestEvictTextures, runMultiThread) runTest(true); } +class CCLayerTreeHostTestLostContextAfterEvictTextures : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestLostContextAfterEvictTextures() + : m_layer(EvictionTestLayer::create()) + , m_implForEvictTextures(0) + , m_numCommits(0) + { + } + + virtual void beginTest() OVERRIDE + { + m_layerTreeHost->setRootLayer(m_layer); + m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20)); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true); + } + + class EvictTexturesTask : public WebKit::WebThread::Task { + public: + EvictTexturesTask(CCLayerTreeHostTestLostContextAfterEvictTextures* test) : m_test(test) { } + virtual ~EvictTexturesTask() { } + virtual void run() OVERRIDE + { + m_test->evictTexturesOnImplThread(); + } + + private: + CCLayerTreeHostTestLostContextAfterEvictTextures* m_test; + }; + + void postEvictTextures() + { + if (webThread()) + webThread()->postTask(new EvictTexturesTask(this)); + else { + DebugScopedSetImplThread impl; + evictTexturesOnImplThread(); + } + } + + void evictTexturesOnImplThread() + { + ASSERT(m_implForEvictTextures); + m_implForEvictTextures->releaseContentsTextures(); + } + + // Commit 1: Just commit and draw normally, then at the end, set ourselves + // invisible (to prevent a commit that would recreate textures after + // eviction, before the context recovery), and post a task that will evict + // textures, then cause the context to be lost, and then set ourselves + // visible again (to allow commits, since that's what causes context + // recovery in single thread). + virtual void didCommitAndDrawFrame() OVERRIDE + { + ++m_numCommits; + switch (m_numCommits) { + case 1: + EXPECT_TRUE(m_layer->updated()); + m_layerTreeHost->setVisible(false); + postEvictTextures(); + m_layerTreeHost->loseContext(1); + m_layerTreeHost->setVisible(true); + break; + default: + break; + } + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + { + m_implForEvictTextures = impl; + } + + virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE + { + EXPECT_TRUE(succeeded); + endTest(); + } + + virtual void afterTest() OVERRIDE + { + } + +private: + MockContentLayerDelegate m_delegate; + RefPtr<EvictionTestLayer> m_layer; + CCLayerTreeHostImpl* m_implForEvictTextures; + int m_numCommits; +}; + +SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLostContextAfterEvictTextures) + } // namespace diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index f732cdc68..2c5e8859c 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -96,14 +96,12 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We return layer.release(); } -static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> >& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker) +static void appendQuads(CCQuadList& quadList, CCSharedQuadStateList& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker) { occlusionTracker.enterLayer(it); - CCQuadCuller quadCuller(quadList, layer, &occlusionTracker, false, false); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); + CCQuadCuller quadCuller(quadList, sharedStateList, layer, &occlusionTracker, false, false); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); - sharedStateList.append(sharedQuadState.release()); + layer->appendQuads(quadCuller, hadMissingTiles); occlusionTracker.leaveLayer(it); ++it; } @@ -111,9 +109,9 @@ static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> > #define DECLARE_AND_INITIALIZE_TEST_QUADS \ DebugScopedSetImplThread impl; \ CCQuadList quadList; \ - Vector<OwnPtr<CCSharedQuadState> > sharedStateList; \ + CCSharedQuadStateList sharedStateList; \ Vector<CCLayerImpl*> renderSurfaceLayerList; \ - WebTransformationMatrix childTransform; \ + WebTransformationMatrix childTransform; \ IntSize rootSize = IntSize(300, 300); \ IntRect rootRect = IntRect(IntPoint(), rootSize); \ IntSize childSize = IntSize(200, 200); \ diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index a6a422e32..05d716641 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -29,6 +29,7 @@ #include "CCLayerImpl.h" #include "CCSharedQuadState.h" #include "CCSingleThreadProxy.h" +#include "MockCCQuadCuller.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> @@ -115,7 +116,15 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) renderSurface->setClipRect(clipRect); renderSurface->setDrawOpacity(1); - OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState(0); + CCQuadList quadList; + CCSharedQuadStateList sharedStateList; + MockCCQuadCuller mockQuadCuller(quadList, sharedStateList); + + bool forReplica = false; + renderSurface->appendQuads(mockQuadCuller, forReplica, 1); + + ASSERT_EQ(1u, sharedStateList.size()); + CCSharedQuadState* sharedQuadState = sharedStateList[0].get(); EXPECT_EQ(30, sharedQuadState->quadTransform.m41()); EXPECT_EQ(40, sharedQuadState->quadTransform.m42()); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/CCRendererGLTest.cpp index 36eddc534..2f3fd6a08 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/CCRendererGLTest.cpp @@ -23,7 +23,7 @@ */ #include "config.h" -#include "LayerRendererChromium.h" +#include "CCRendererGL.h" #include "CCDrawQuad.h" #include "CCPrioritizedTextureManager.h" @@ -36,6 +36,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebCompositor.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKit; @@ -79,8 +80,7 @@ public: , m_rootLayer(CCLayerImpl::create(1)) , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) { - m_rootLayer->createRenderSurface(); - OwnPtr<CCRenderPass> rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); + OwnPtr<CCRenderPass> rootRenderPass = CCRenderPass::create(m_rootLayer->id(), IntRect(), WebTransformationMatrix()); m_renderPassesInDrawOrder.append(rootRenderPass.get()); m_renderPasses.set(m_rootLayer->id(), rootRenderPass.release()); } @@ -112,32 +112,32 @@ private: size_t m_memoryAllocationLimitBytes; }; -class FakeLayerRendererChromium : public LayerRendererChromium { +class FakeCCRendererGL : public CCRendererGL { public: - FakeLayerRendererChromium(CCRendererClient* client, CCResourceProvider* resourceProvider) : LayerRendererChromium(client, resourceProvider, UnthrottledUploader) { } + FakeCCRendererGL(CCRendererClient* client, CCResourceProvider* resourceProvider) : CCRendererGL(client, resourceProvider, UnthrottledUploader) { } - // LayerRendererChromium methods. + // CCRendererGL methods. // Changing visibility to public. - using LayerRendererChromium::initialize; - using LayerRendererChromium::isFramebufferDiscarded; + using CCRendererGL::initialize; + using CCRendererGL::isFramebufferDiscarded; }; -class LayerRendererChromiumTest : public testing::Test { +class CCRendererGLTest : public testing::Test { protected: - LayerRendererChromiumTest() + CCRendererGLTest() : m_suggestHaveBackbufferYes(1, true) , m_suggestHaveBackbufferNo(1, false) , m_context(FakeWebCompositorOutputSurface::create(adoptPtr(new FrameCountingMemoryAllocationSettingContext()))) , m_resourceProvider(CCResourceProvider::create(m_context.get())) - , m_layerRendererChromium(&m_mockClient, m_resourceProvider.get()) + , m_renderer(&m_mockClient, m_resourceProvider.get()) { } virtual void SetUp() { WebKit::WebCompositor::initialize(0); - m_layerRendererChromium.initialize(); + m_renderer.initialize(); } virtual void TearDown() @@ -147,7 +147,7 @@ protected: void swapBuffers() { - m_layerRendererChromium.swapBuffers(); + m_renderer.swapBuffers(); } FrameCountingMemoryAllocationSettingContext* context() { return static_cast<FrameCountingMemoryAllocationSettingContext*>(m_context->context3D()); } @@ -158,92 +158,92 @@ protected: OwnPtr<CCGraphicsContext> m_context; FakeCCRendererClient m_mockClient; OwnPtr<CCResourceProvider> m_resourceProvider; - FakeLayerRendererChromium m_layerRendererChromium; + FakeCCRendererGL m_renderer; CCScopedSettings m_scopedSettings; }; -// Test LayerRendererChromium discardFramebuffer functionality: +// Test CCRendererGL discardFramebuffer functionality: // Suggest recreating framebuffer when one already exists. // Expected: it does nothing. -TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) +TEST_F(CCRendererGLTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) { context()->setMemoryAllocation(m_suggestHaveBackbufferYes); EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount()); - EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); + EXPECT_FALSE(m_renderer.isFramebufferDiscarded()); swapBuffers(); EXPECT_EQ(1, context()->frameCount()); } -// Test LayerRendererChromium discardFramebuffer functionality: +// Test CCRendererGL discardFramebuffer functionality: // Suggest discarding framebuffer when one exists and the renderer is not visible. // Expected: it is discarded and damage tracker is reset. -TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible) +TEST_F(CCRendererGLTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible) { - m_layerRendererChromium.setVisible(false); + m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); - EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); + EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); } -// Test LayerRendererChromium discardFramebuffer functionality: +// Test CCRendererGL discardFramebuffer functionality: // Suggest discarding framebuffer when one exists and the renderer is visible. // Expected: the allocation is ignored. -TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoDoNothingWhenVisible) +TEST_F(CCRendererGLTest, SuggestBackbufferNoDoNothingWhenVisible) { - m_layerRendererChromium.setVisible(true); + m_renderer.setVisible(true); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount()); - EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); + EXPECT_FALSE(m_renderer.isFramebufferDiscarded()); } -// Test LayerRendererChromium discardFramebuffer functionality: +// Test CCRendererGL discardFramebuffer functionality: // Suggest discarding framebuffer when one does not exist. // Expected: it does nothing. -TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing) +TEST_F(CCRendererGLTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing) { - m_layerRendererChromium.setVisible(false); + m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); - EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); + EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); - EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); + EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); } -// Test LayerRendererChromium discardFramebuffer functionality: +// Test CCRendererGL discardFramebuffer functionality: // Begin drawing a frame while a framebuffer is discarded. // Expected: will recreate framebuffer. -TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration) +TEST_F(CCRendererGLTest, DiscardedBackbufferIsRecreatedForScopeDuration) { - m_layerRendererChromium.setVisible(false); + m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); - EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); + EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); - m_layerRendererChromium.setVisible(true); - m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses()); - EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); + m_renderer.setVisible(true); + m_renderer.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses()); + EXPECT_FALSE(m_renderer.isFramebufferDiscarded()); swapBuffers(); EXPECT_EQ(1, context()->frameCount()); } -TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisible) +TEST_F(CCRendererGLTest, FramebufferDiscardedAfterReadbackWhenNotVisible) { - m_layerRendererChromium.setVisible(false); + m_renderer.setVisible(false); context()->setMemoryAllocation(m_suggestHaveBackbufferNo); - EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); + EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); char pixels[4]; - m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses()); - EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); + m_renderer.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses()); + EXPECT_FALSE(m_renderer.isFramebufferDiscarded()); - m_layerRendererChromium.getFramebufferPixels(pixels, IntRect(0, 0, 1, 1)); - EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); + m_renderer.getFramebufferPixels(pixels, IntRect(0, 0, 1, 1)); + EXPECT_TRUE(m_renderer.isFramebufferDiscarded()); EXPECT_EQ(2, m_mockClient.setFullRootLayerDamageCount()); } @@ -313,16 +313,16 @@ public: virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) { ADD_FAILURE(); return 0; } }; -// This test isn't using the same fixture as LayerRendererChromiumTest, and you can't mix TEST() and TEST_F() with the same name, hence LRC2. -TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) +// This test isn't using the same fixture as CCRendererGLTest, and you can't mix TEST() and TEST_F() with the same name, hence LRC2. +TEST(CCRendererGLTest2, initializationDoesNotMakeSynchronousCalls) { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ForbidSynchronousCallContext))); OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); + FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); - EXPECT_TRUE(layerRendererChromium.initialize()); + EXPECT_TRUE(renderer.initialize()); } class LoseContextOnFirstGetContext : public FakeWebGraphicsContext3D { @@ -358,15 +358,15 @@ private: bool m_contextLost; }; -TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAssert) +TEST(CCRendererGLTest2, initializationWithQuicklyLostContextDoesNotAssert) { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new LoseContextOnFirstGetContext))); OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); + FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); - layerRendererChromium.initialize(); + renderer.initialize(); } class ContextThatDoesNotSupportMemoryManagmentExtensions : public FakeWebGraphicsContext3D { @@ -381,14 +381,14 @@ public: virtual WebString getString(WebKit::WGC3Denum name) { return WebString(); } }; -TEST(LayerRendererChromiumTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) +TEST(CCRendererGLTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { FakeCCRendererClient mockClient; OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions))); OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); - FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); + FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); - layerRendererChromium.initialize(); + renderer.initialize(); EXPECT_GT(mockClient.memoryAllocationLimitBytes(), 0ul); } @@ -408,19 +408,19 @@ private: int m_clear; }; -TEST(LayerRendererChromiumTest2, opaqueBackground) +TEST(CCRendererGLTest2, opaqueBackground) { FakeCCRendererClient mockClient; OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext))); ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); - FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); + FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); mockClient.rootRenderPass()->setHasTransparentBackground(false); - EXPECT_TRUE(layerRendererChromium.initialize()); + EXPECT_TRUE(renderer.initialize()); - layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses()); + renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses()); // On DEBUG builds, render passes with opaque background clear to blue to // easily see regions that were not drawn on the screen. @@ -431,19 +431,19 @@ TEST(LayerRendererChromiumTest2, opaqueBackground) #endif } -TEST(LayerRendererChromiumTest2, transparentBackground) +TEST(CCRendererGLTest2, transparentBackground) { FakeCCRendererClient mockClient; OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext))); ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); - FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); + FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); mockClient.rootRenderPass()->setHasTransparentBackground(true); - EXPECT_TRUE(layerRendererChromium.initialize()); + EXPECT_TRUE(renderer.initialize()); - layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses()); + renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses()); EXPECT_EQ(1, context->clearCount()); } diff --git a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h index 824af26c7..a504b60bb 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h @@ -106,7 +106,7 @@ public: virtual bool active() const OVERRIDE { return m_active; } virtual void setTimebaseAndInterval(double timebase, double interval) OVERRIDE { } virtual double lastTickTime() OVERRIDE { return 0; } - virtual double nextTickTime() OVERRIDE { return 0; } + virtual double nextTickTimeIfActivated() OVERRIDE { return 0; } void tick() { diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index 1eba991c3..220189b41 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -53,9 +53,8 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); } @@ -78,9 +77,8 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->color(), testColor); @@ -104,9 +102,8 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->opacity()); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index 62336bb50..8b4bd20e8 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -76,9 +76,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); const unsigned numTiles = numTilesX * numTilesY; EXPECT_EQ(quadCuller.quadList().size(), numTiles); } @@ -89,9 +88,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setVisibleContentRect(IntRect()); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 0u); } @@ -103,9 +101,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setVisibleContentRect(outsideBounds); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 0u); } @@ -115,9 +112,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setSkipsDraw(true); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 0u); } } @@ -132,13 +128,12 @@ TEST(CCTiledLayerImplTest, checkerboarding) const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY); OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); // No checkerboarding { MockCCQuadCuller quadCuller; bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 4u); EXPECT_FALSE(hadMissingTiles); @@ -154,7 +149,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) { MockCCQuadCuller quadCuller; bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); + layer->appendQuads(quadCuller, hadMissingTiles); EXPECT_TRUE(hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 4u); for (size_t i = 0; i < quadCuller.quadList().size(); ++i) @@ -162,17 +157,15 @@ TEST(CCTiledLayerImplTest, checkerboarding) } } -static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) +static void getQuads(CCQuadList& quads, CCSharedQuadStateList& sharedStates, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); - MockCCQuadCuller quadCuller(quads); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); + MockCCQuadCuller quadCuller(quads, sharedStates); bool hadMissingTiles = false; - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); - return sharedQuadState.release(); // The shared data must be owned as long as the quad list exists. + layer->appendQuads(quadCuller, hadMissingTiles); } // Test with both border texels and without. @@ -192,8 +185,8 @@ static void coverageVisibleRectOnTileBoundaries(CCLayerTilingData::BorderTexelOp IntSize layerSize(1000, 1000); CCQuadList quads; - OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize)); + CCSharedQuadStateList sharedStates; + getQuads(quads, sharedStates, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize)); verifyQuadsExactlyCoverRect(quads, IntRect(IntPoint(), layerSize)); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectOnTileBoundaries); @@ -209,8 +202,8 @@ static void coverageVisibleRectIntersectsTiles(CCLayerTilingData::BorderTexelOpt IntSize layerSize(250, 250); CCQuadList quads; - OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleContentRect); + CCSharedQuadStateList sharedStates; + getQuads(quads, sharedStates, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleContentRect); verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles); @@ -222,8 +215,8 @@ static void coverageVisibleRectIntersectsBounds(CCLayerTilingData::BorderTexelOp IntSize layerSize(220, 210); IntRect visibleContentRect(IntPoint(), layerSize); CCQuadList quads; - OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleContentRect); + CCSharedQuadStateList sharedStates; + getQuads(quads, sharedStates, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleContentRect); verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds); @@ -235,8 +228,8 @@ TEST(CCTiledLayerImplTest, textureInfoForLayerNoBorders) IntSize tileSize(50, 50); IntSize layerSize(250, 250); CCQuadList quads; - OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); + CCSharedQuadStateList sharedStates; + getQuads(quads, sharedStates, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); for (size_t i = 0; i < quads.size(); ++i) { ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; @@ -256,8 +249,8 @@ TEST(CCTiledLayerImplTest, tileOpaqueRectForLayerNoBorders) IntSize tileSize(50, 50); IntSize layerSize(250, 250); CCQuadList quads; - OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); + CCSharedQuadStateList sharedStates; + getQuads(quads, sharedStates, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); for (size_t i = 0; i < quads.size(); ++i) { ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; diff --git a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp index 26627ec8d..c0a9cf2ef 100644 --- a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp @@ -96,9 +96,9 @@ TEST_F(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations) { ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0.0, 0.0)); - OwnPtr<WebAnimation> floatAnimation(adoptPtr(WebAnimation::create(curve, 1, 1, WebAnimation::TargetPropertyOpacity))); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0.0, 0.0)); + OwnPtr<WebAnimation> floatAnimation(adoptPtr(WebAnimation::create(*curve, 1, 1, WebAnimation::TargetPropertyOpacity))); ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation.get())); ASSERT_TRUE(m_platformLayer->hasActiveAnimation()); diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp index 8605c0f1a..ead7f9bb9 100644 --- a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp +++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp @@ -32,12 +32,17 @@ #include "IDBIndexBackendImpl.h" #include "IDBObjectStoreBackendImpl.h" #include "IDBTransactionCoordinator.h" +#include "WebIDBDatabaseCallbacksImpl.h" +#include "WebIDBDatabaseImpl.h" #include <gtest/gtest.h> #if ENABLE(INDEXED_DATABASE) using namespace WebCore; +using WebKit::WebIDBDatabase; +using WebKit::WebIDBDatabaseCallbacksImpl; +using WebKit::WebIDBDatabaseImpl; namespace { @@ -101,6 +106,7 @@ public: virtual ~FakeIDBDatabaseCallbacks() { } virtual void onVersionChange(const String& version) OVERRIDE { } virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) OVERRIDE { } + virtual void onForcedClose() OVERRIDE { } private: FakeIDBDatabaseCallbacks() { } }; @@ -134,6 +140,72 @@ TEST(IDBDatabaseBackendTest, ConnectionLifecycle) EXPECT_TRUE(backingStore->hasOneRef()); } +class MockIDBDatabaseBackendProxy : public IDBDatabaseBackendInterface { +public: + static PassRefPtr<MockIDBDatabaseBackendProxy> create(WebIDBDatabaseImpl& database) + { + return adoptRef(new MockIDBDatabaseBackendProxy(database)); + } + + ~MockIDBDatabaseBackendProxy() + { + EXPECT_TRUE(m_wasRegisterFrontendCallbacksCalled); + } + + virtual IDBDatabaseMetadata metadata() const { return IDBDatabaseMetadata(); } + virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&) { return 0; } + virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) { } + virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&) { } + virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, ExceptionCode&) { return 0; } + + virtual void close(PassRefPtr<IDBDatabaseCallbacks>) + { + m_wasCloseCalled = true; + m_webDatabase.close(); + } + virtual void registerFrontendCallbacks(PassRefPtr<IDBDatabaseCallbacks> connection) + { + m_wasRegisterFrontendCallbacksCalled = true; + m_webDatabase.open(new WebIDBDatabaseCallbacksImpl(connection)); + } + +private: + MockIDBDatabaseBackendProxy(WebIDBDatabaseImpl& webDatabase) + : m_wasRegisterFrontendCallbacksCalled(false) + , m_wasCloseCalled(false) + , m_webDatabase(webDatabase) { } + + bool m_wasRegisterFrontendCallbacksCalled; + bool m_wasCloseCalled; + + WebIDBDatabaseImpl& m_webDatabase; +}; + +TEST(IDBDatabaseBackendTest, ForcedClose) +{ + RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore()); + EXPECT_TRUE(backingStore->hasOneRef()); + + IDBTransactionCoordinator* coordinator = 0; + IDBFactoryBackendImpl* factory = 0; + RefPtr<IDBDatabaseBackendImpl> backend = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid"); + EXPECT_GT(backingStore->refCount(), 1); + + WebIDBDatabaseImpl webDatabase(backend); + + RefPtr<MockIDBCallbacks> request1 = MockIDBCallbacks::create(); + backend->openConnection(request1); + + RefPtr<MockIDBDatabaseBackendProxy> proxy = MockIDBDatabaseBackendProxy::create(webDatabase); + + ScriptExecutionContext* context = 0; + RefPtr<IDBDatabase> idbDatabase = IDBDatabase::create(context, proxy); + idbDatabase->registerFrontendCallbacks(); + + webDatabase.forceClose(); + EXPECT_TRUE(backingStore->hasOneRef()); +} + } // namespace #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/tests/IDBRequestTest.cpp b/Source/WebKit/chromium/tests/IDBRequestTest.cpp index 77757193b..9e2459d39 100644 --- a/Source/WebKit/chromium/tests/IDBRequestTest.cpp +++ b/Source/WebKit/chromium/tests/IDBRequestTest.cpp @@ -50,7 +50,6 @@ TEST(IDBRequestTest, EventsAfterStopping) // Ensure none of the following raise assertions in stopped state: request->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "Description goes here.")); request->onSuccess(DOMStringList::create()); - request->onSuccess(PassRefPtr<IDBDatabaseBackendInterface>()); request->onSuccess(PassRefPtr<IDBCursorBackendInterface>(), IDBKey::createInvalid(), IDBKey::createInvalid(), SerializedScriptValue::nullValue()); request->onSuccess(IDBKey::createInvalid()); request->onSuccess(PassRefPtr<IDBTransactionBackendInterface>()); diff --git a/Source/WebKit/chromium/tests/MockCCQuadCuller.h b/Source/WebKit/chromium/tests/MockCCQuadCuller.h index 7f6e0f85a..59a0073ce 100644 --- a/Source/WebKit/chromium/tests/MockCCQuadCuller.h +++ b/Source/WebKit/chromium/tests/MockCCQuadCuller.h @@ -32,19 +32,21 @@ namespace WebCore { -class MockCCQuadCuller : public WebCore::CCQuadSink { +class MockCCQuadCuller : public CCQuadSink { public: MockCCQuadCuller() : m_activeQuadList(m_quadListStorage) + , m_activeSharedQuadStateList(m_sharedQuadStateStorage) { } - explicit MockCCQuadCuller(CCQuadList& externalQuadList) + explicit MockCCQuadCuller(CCQuadList& externalQuadList, CCSharedQuadStateList& externalSharedQuadStateList) : m_activeQuadList(externalQuadList) + , m_activeSharedQuadStateList(externalSharedQuadStateList) { } - virtual bool append(WTF::PassOwnPtr<WebCore::CCDrawQuad> newQuad) + virtual bool append(WTF::PassOwnPtr<CCDrawQuad> newQuad) OVERRIDE { - OwnPtr<WebCore::CCDrawQuad> drawQuad = newQuad; + OwnPtr<CCDrawQuad> drawQuad = newQuad; if (!drawQuad->quadRect().isEmpty()) { m_activeQuadList.append(drawQuad.release()); return true; @@ -52,11 +54,24 @@ public: return false; } - const WebCore::CCQuadList& quadList() const { return m_activeQuadList; }; + virtual CCSharedQuadState* useSharedQuadState(PassOwnPtr<CCSharedQuadState> passSharedQuadState) OVERRIDE + { + OwnPtr<CCSharedQuadState> sharedQuadState(passSharedQuadState); + sharedQuadState->id = m_activeSharedQuadStateList.size(); + + CCSharedQuadState* rawPtr = sharedQuadState.get(); + m_activeSharedQuadStateList.append(sharedQuadState.release()); + return rawPtr; + } + + const CCQuadList& quadList() const { return m_activeQuadList; }; + const CCSharedQuadStateList& sharedQuadStateList() const { return m_activeSharedQuadStateList; }; private: - WebCore::CCQuadList& m_activeQuadList; - WebCore::CCQuadList m_quadListStorage; + CCQuadList& m_activeQuadList; + CCQuadList m_quadListStorage; + CCSharedQuadStateList& m_activeSharedQuadStateList; + CCSharedQuadStateList m_sharedQuadStateStorage; }; } // namespace WebCore diff --git a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp index 927d4a9c3..e71846adb 100644 --- a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp +++ b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp @@ -63,12 +63,20 @@ public: MOCK_METHOD1(invalidateScrollCornerRect, void(const IntRect&)); MOCK_METHOD1(setScrollOffsetFromAnimation, void(const IntPoint&)); MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*()); - - virtual IntPoint scrollPosition() const { return IntPoint(); } - virtual int visibleHeight() const { return 768; } - virtual int visibleWidth() const { return 1024; } - - bool scrollAnimatorEnabled() const { return m_scrollAnimatorEnabled; } + MOCK_CONST_METHOD0(minimumScrollPosition, IntPoint()); + MOCK_CONST_METHOD0(maximumScrollPosition, IntPoint()); + MOCK_CONST_METHOD1(visibleContentRect, IntRect(bool)); + MOCK_CONST_METHOD0(contentsSize, IntSize()); + MOCK_CONST_METHOD0(overhangAmount, IntSize()); + MOCK_CONST_METHOD0(isOnActivePage, bool()); + MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect()); + + virtual IntPoint scrollPosition() const OVERRIDE { return IntPoint(); } + virtual int visibleHeight() const OVERRIDE { return 768; } + virtual int visibleWidth() const OVERRIDE { return 1024; } + virtual bool scrollAnimatorEnabled() const OVERRIDE { return m_scrollAnimatorEnabled; } + +private: bool m_scrollAnimatorEnabled; }; diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 2efb8e5dc..00ee28a68 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -705,7 +705,7 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) WebKit::WebCompositor::initialize(0); FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); - ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded()); + ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); // Create two 300 x 300 tiled layers. IntSize contentBounds(300, 300); @@ -791,7 +791,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); - ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded()); + ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); // Create one 300 x 200 tiled layer with 3 x 2 tiles. IntSize contentBounds(300, 200); @@ -1333,7 +1333,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca CCLayerTreeSettings settings; FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); - ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded()); + ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); RefPtr<FakeTiledLayerChromium> root = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); RefPtr<LayerChromium> surface = LayerChromium::create(); diff --git a/Source/WebKit/chromium/tests/WebAnimationTest.cpp b/Source/WebKit/chromium/tests/WebAnimationTest.cpp index a682ab020..1822ff6a0 100644 --- a/Source/WebKit/chromium/tests/WebAnimationTest.cpp +++ b/Source/WebKit/chromium/tests/WebAnimationTest.cpp @@ -46,8 +46,8 @@ namespace { #endif TEST(WebAnimationTest, MAYBE_DefaultSettings) { - WebFloatAnimationCurve curve; - OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity)); + OwnPtr<WebAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(*curve, WebAnimation::TargetPropertyOpacity)); // Ensure that the defaults are correct. EXPECT_EQ(1, animation->iterations()); @@ -67,8 +67,8 @@ TEST(WebAnimationTest, MAYBE_DefaultSettings) #endif TEST(WebAnimationTest, MAYBE_ModifiedSettings) { - WebFloatAnimationCurve curve; - OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity)); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(*curve, WebAnimation::TargetPropertyOpacity)); animation->setIterations(2); animation->setStartTime(2); animation->setTimeOffset(2); diff --git a/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp index 3cac764b6..7a6a52405 100644 --- a/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp @@ -39,197 +39,197 @@ namespace { // Tests that a float animation with one keyframe works as expected. TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve.getValue(-1)); - EXPECT_FLOAT_EQ(2, curve.getValue(0)); - EXPECT_FLOAT_EQ(2, curve.getValue(0.5)); - EXPECT_FLOAT_EQ(2, curve.getValue(1)); - EXPECT_FLOAT_EQ(2, curve.getValue(2)); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); + EXPECT_FLOAT_EQ(2, curve->getValue(-1)); + EXPECT_FLOAT_EQ(2, curve->getValue(0)); + EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); + EXPECT_FLOAT_EQ(2, curve->getValue(1)); + EXPECT_FLOAT_EQ(2, curve->getValue(2)); } // Tests that a float animation with two keyframes works as expected. TEST(WebFloatAnimationCurveTest, TwoFloatKeyframe) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve.getValue(-1)); - EXPECT_FLOAT_EQ(2, curve.getValue(0)); - EXPECT_FLOAT_EQ(3, curve.getValue(0.5)); - EXPECT_FLOAT_EQ(4, curve.getValue(1)); - EXPECT_FLOAT_EQ(4, curve.getValue(2)); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); + EXPECT_FLOAT_EQ(2, curve->getValue(-1)); + EXPECT_FLOAT_EQ(2, curve->getValue(0)); + EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); + EXPECT_FLOAT_EQ(4, curve->getValue(1)); + EXPECT_FLOAT_EQ(4, curve->getValue(2)); } // Tests that a float animation with three keyframes works as expected. TEST(WebFloatAnimationCurveTest, ThreeFloatKeyframe) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(2, 8), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve.getValue(-1)); - EXPECT_FLOAT_EQ(2, curve.getValue(0)); - EXPECT_FLOAT_EQ(3, curve.getValue(0.5)); - EXPECT_FLOAT_EQ(4, curve.getValue(1)); - EXPECT_FLOAT_EQ(6, curve.getValue(1.5)); - EXPECT_FLOAT_EQ(8, curve.getValue(2)); - EXPECT_FLOAT_EQ(8, curve.getValue(3)); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(2, 8), WebAnimationCurve::TimingFunctionTypeLinear); + EXPECT_FLOAT_EQ(2, curve->getValue(-1)); + EXPECT_FLOAT_EQ(2, curve->getValue(0)); + EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); + EXPECT_FLOAT_EQ(4, curve->getValue(1)); + EXPECT_FLOAT_EQ(6, curve->getValue(1.5)); + EXPECT_FLOAT_EQ(8, curve->getValue(2)); + EXPECT_FLOAT_EQ(8, curve->getValue(3)); } // Tests that a float animation with multiple keys at a given time works sanely. TEST(WebFloatAnimationCurveTest, RepeatedFloatKeyTimes) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 4), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(1, 6), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(2, 6), WebAnimationCurve::TimingFunctionTypeLinear); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 4), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(1, 6), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(2, 6), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(4, curve.getValue(-1)); - EXPECT_FLOAT_EQ(4, curve.getValue(0)); - EXPECT_FLOAT_EQ(4, curve.getValue(0.5)); + EXPECT_FLOAT_EQ(4, curve->getValue(-1)); + EXPECT_FLOAT_EQ(4, curve->getValue(0)); + EXPECT_FLOAT_EQ(4, curve->getValue(0.5)); // There is a discontinuity at 1. Any value between 4 and 6 is valid. - float value = curve.getValue(1); + float value = curve->getValue(1); EXPECT_TRUE(value >= 4 && value <= 6); - EXPECT_FLOAT_EQ(6, curve.getValue(1.5)); - EXPECT_FLOAT_EQ(6, curve.getValue(2)); - EXPECT_FLOAT_EQ(6, curve.getValue(3)); + EXPECT_FLOAT_EQ(6, curve->getValue(1.5)); + EXPECT_FLOAT_EQ(6, curve->getValue(2)); + EXPECT_FLOAT_EQ(6, curve->getValue(3)); } // Tests that the keyframes may be added out of order. TEST(WebFloatAnimationCurveTest, UnsortedKeyframes) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(2, 8), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); - - EXPECT_FLOAT_EQ(2, curve.getValue(-1)); - EXPECT_FLOAT_EQ(2, curve.getValue(0)); - EXPECT_FLOAT_EQ(3, curve.getValue(0.5)); - EXPECT_FLOAT_EQ(4, curve.getValue(1)); - EXPECT_FLOAT_EQ(6, curve.getValue(1.5)); - EXPECT_FLOAT_EQ(8, curve.getValue(2)); - EXPECT_FLOAT_EQ(8, curve.getValue(3)); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(2, 8), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear); + + EXPECT_FLOAT_EQ(2, curve->getValue(-1)); + EXPECT_FLOAT_EQ(2, curve->getValue(0)); + EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); + EXPECT_FLOAT_EQ(4, curve->getValue(1)); + EXPECT_FLOAT_EQ(6, curve->getValue(1.5)); + EXPECT_FLOAT_EQ(8, curve->getValue(2)); + EXPECT_FLOAT_EQ(8, curve->getValue(3)); } // Tests that a cubic bezier timing function works as expected. TEST(WebFloatAnimationCurveTest, CubicBezierTimingFunction) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 0), 0.25, 0, 0.75, 1); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); - - EXPECT_FLOAT_EQ(0, curve.getValue(0)); - EXPECT_LT(0, curve.getValue(0.25)); - EXPECT_GT(0.25, curve.getValue(0.25)); - EXPECT_FLOAT_EQ(0.5, curve.getValue(0.5)); - EXPECT_LT(0.75, curve.getValue(0.75)); - EXPECT_GT(1, curve.getValue(0.75)); - EXPECT_FLOAT_EQ(1, curve.getValue(1)); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 0), 0.25, 0, 0.75, 1); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + + EXPECT_FLOAT_EQ(0, curve->getValue(0)); + EXPECT_LT(0, curve->getValue(0.25)); + EXPECT_GT(0.25, curve->getValue(0.25)); + EXPECT_FLOAT_EQ(0.5, curve->getValue(0.5)); + EXPECT_LT(0.75, curve->getValue(0.75)); + EXPECT_GT(1, curve->getValue(0.75)); + EXPECT_FLOAT_EQ(1, curve->getValue(1)); } // Tests that an ease timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseTimingFunction) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEase); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEase); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time)); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); } } // Tests using a linear timing function. TEST(WebFloatAnimationCurveTest, LinearTimingFunction) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(time, curve.getValue(time)); + EXPECT_FLOAT_EQ(time, curve->getValue(time)); } } // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseInTimingFunction) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseIn); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseIn); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time)); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); } } // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseOutTimingFunction) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseOut); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseOut); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time)); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); } } // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseInOutTimingFunction) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseInOut); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseInOut); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time)); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); } } // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, CustomBezierTimingFunction) { - WebFloatAnimationCurve curve; + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); double x1 = 0.3; double y1 = 0.2; double x2 = 0.8; double y2 = 0.7; - curve.add(WebFloatKeyframe(0, 0), x1, y1, x2, y2); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebFloatKeyframe(0, 0), x1, y1, x2, y2); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time)); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); } } // Tests that the default timing function is indeed ease. TEST(WebFloatAnimationCurveTest, DefaultTimingFunction) { - WebFloatAnimationCurve curve; - curve.add(WebFloatKeyframe(0, 0)); - curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + curve->add(WebFloatKeyframe(0, 0)); + curve->add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time)); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time)); } } diff --git a/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp index 2f4de73cb..96acb3cc1 100644 --- a/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp @@ -41,62 +41,62 @@ namespace { // Tests that a transform animation with one keyframe works as expected. TEST(WebTransformAnimationCurveTest, OneTransformKeyframe) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations; operations.appendTranslate(2, 0, 0); - curve.add(WebTransformKeyframe(0, operations), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41()); - EXPECT_FLOAT_EQ(2, curve.getValue(0).m41()); - EXPECT_FLOAT_EQ(2, curve.getValue(0.5).m41()); - EXPECT_FLOAT_EQ(2, curve.getValue(1).m41()); - EXPECT_FLOAT_EQ(2, curve.getValue(2).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(0).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(0.5).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(1).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(2).m41()); } // Tests that a transform animation with two keyframes works as expected. TEST(WebTransformAnimationCurveTest, TwoTransformKeyframe) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(2, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(4, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41()); - EXPECT_FLOAT_EQ(2, curve.getValue(0).m41()); - EXPECT_FLOAT_EQ(3, curve.getValue(0.5).m41()); - EXPECT_FLOAT_EQ(4, curve.getValue(1).m41()); - EXPECT_FLOAT_EQ(4, curve.getValue(2).m41()); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(0).m41()); + EXPECT_FLOAT_EQ(3, curve->getValue(0.5).m41()); + EXPECT_FLOAT_EQ(4, curve->getValue(1).m41()); + EXPECT_FLOAT_EQ(4, curve->getValue(2).m41()); } // Tests that a transform animation with three keyframes works as expected. TEST(WebTransformAnimationCurveTest, ThreeTransformKeyframe) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(2, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(4, 0, 0); WebKit::WebTransformOperations operations3; operations3.appendTranslate(8, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41()); - EXPECT_FLOAT_EQ(2, curve.getValue(0).m41()); - EXPECT_FLOAT_EQ(3, curve.getValue(0.5).m41()); - EXPECT_FLOAT_EQ(4, curve.getValue(1).m41()); - EXPECT_FLOAT_EQ(6, curve.getValue(1.5).m41()); - EXPECT_FLOAT_EQ(8, curve.getValue(2).m41()); - EXPECT_FLOAT_EQ(8, curve.getValue(3).m41()); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear); + EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(0).m41()); + EXPECT_FLOAT_EQ(3, curve->getValue(0.5).m41()); + EXPECT_FLOAT_EQ(4, curve->getValue(1).m41()); + EXPECT_FLOAT_EQ(6, curve->getValue(1.5).m41()); + EXPECT_FLOAT_EQ(8, curve->getValue(2).m41()); + EXPECT_FLOAT_EQ(8, curve->getValue(3).m41()); } // Tests that a transform animation with multiple keys at a given time works sanely. TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes) { // A step function. - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(4, 0, 0); WebKit::WebTransformOperations operations2; @@ -105,159 +105,159 @@ TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes) operations3.appendTranslate(6, 0, 0); WebKit::WebTransformOperations operations4; operations4.appendTranslate(6, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(1, operations3), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(2, operations4), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(1, operations3), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(2, operations4), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(4, curve.getValue(-1).m41()); - EXPECT_FLOAT_EQ(4, curve.getValue(0).m41()); - EXPECT_FLOAT_EQ(4, curve.getValue(0.5).m41()); + EXPECT_FLOAT_EQ(4, curve->getValue(-1).m41()); + EXPECT_FLOAT_EQ(4, curve->getValue(0).m41()); + EXPECT_FLOAT_EQ(4, curve->getValue(0.5).m41()); // There is a discontinuity at 1. Any value between 4 and 6 is valid. - WebTransformationMatrix value = curve.getValue(1); + WebTransformationMatrix value = curve->getValue(1); EXPECT_TRUE(value.m41() >= 4 && value.m41() <= 6); - EXPECT_FLOAT_EQ(6, curve.getValue(1.5).m41()); - EXPECT_FLOAT_EQ(6, curve.getValue(2).m41()); - EXPECT_FLOAT_EQ(6, curve.getValue(3).m41()); + EXPECT_FLOAT_EQ(6, curve->getValue(1.5).m41()); + EXPECT_FLOAT_EQ(6, curve->getValue(2).m41()); + EXPECT_FLOAT_EQ(6, curve->getValue(3).m41()); } // Tests that the keyframes may be added out of order. TEST(WebTransformAnimationCurveTest, UnsortedKeyframes) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(2, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(4, 0, 0); WebKit::WebTransformOperations operations3; operations3.appendTranslate(8, 0, 0); - curve.add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - - EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41()); - EXPECT_FLOAT_EQ(2, curve.getValue(0).m41()); - EXPECT_FLOAT_EQ(3, curve.getValue(0.5).m41()); - EXPECT_FLOAT_EQ(4, curve.getValue(1).m41()); - EXPECT_FLOAT_EQ(6, curve.getValue(1.5).m41()); - EXPECT_FLOAT_EQ(8, curve.getValue(2).m41()); - EXPECT_FLOAT_EQ(8, curve.getValue(3).m41()); + curve->add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + + EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41()); + EXPECT_FLOAT_EQ(2, curve->getValue(0).m41()); + EXPECT_FLOAT_EQ(3, curve->getValue(0.5).m41()); + EXPECT_FLOAT_EQ(4, curve->getValue(1).m41()); + EXPECT_FLOAT_EQ(6, curve->getValue(1.5).m41()); + EXPECT_FLOAT_EQ(8, curve->getValue(2).m41()); + EXPECT_FLOAT_EQ(8, curve->getValue(3).m41()); } // Tests that a cubic bezier timing function works as expected. TEST(WebTransformAnimationCurveTest, CubicBezierTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), 0.25, 0, 0.75, 1); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(0, curve.getValue(0).m41()); - EXPECT_LT(0, curve.getValue(0.25).m41()); - EXPECT_GT(0.25, curve.getValue(0.25).m41()); - EXPECT_FLOAT_EQ(0.5, curve.getValue(0.5).m41()); - EXPECT_LT(0.75, curve.getValue(0.75).m41()); - EXPECT_GT(1, curve.getValue(0.75).m41()); - EXPECT_FLOAT_EQ(1, curve.getValue(1).m41()); + curve->add(WebTransformKeyframe(0, operations1), 0.25, 0, 0.75, 1); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + EXPECT_FLOAT_EQ(0, curve->getValue(0).m41()); + EXPECT_LT(0, curve->getValue(0.25).m41()); + EXPECT_GT(0.25, curve->getValue(0.25).m41()); + EXPECT_FLOAT_EQ(0.5, curve->getValue(0.5).m41()); + EXPECT_LT(0.75, curve->getValue(0.75).m41()); + EXPECT_GT(1, curve->getValue(0.75).m41()); + EXPECT_FLOAT_EQ(1, curve->getValue(1).m41()); } // Tests that an ease timing function works as expected. TEST(WebTransformAnimationCurveTest, EaseTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEase); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEase); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41()); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); } } // Tests using a linear timing function. TEST(WebTransformAnimationCurveTest, LinearTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(time, curve.getValue(time).m41()); + EXPECT_FLOAT_EQ(time, curve->getValue(time).m41()); } } // Tests that an ease in timing function works as expected. TEST(WebTransformAnimationCurveTest, EaseInTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseIn); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseIn); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41()); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); } } // Tests that an ease in timing function works as expected. TEST(WebTransformAnimationCurveTest, EaseOutTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseOut); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseOut); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41()); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); } } // Tests that an ease in timing function works as expected. TEST(WebTransformAnimationCurveTest, EaseInOutTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseInOut); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseInOut); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInOutTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41()); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); } } // Tests that an ease in timing function works as expected. TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); double x1 = 0.3; double y1 = 0.2; double x2 = 0.8; @@ -266,31 +266,31 @@ TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction) operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1), x1, y1, x2, y2); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1), x1, y1, x2, y2); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41()); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); } } // Tests that the default timing function is indeed ease. TEST(WebTransformAnimationCurveTest, DefaultTimingFunction) { - WebTransformAnimationCurve curve; + OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(WebTransformAnimationCurve::create()); WebKit::WebTransformOperations operations1; operations1.appendTranslate(0, 0, 0); WebKit::WebTransformOperations operations2; operations2.appendTranslate(1, 0, 0); - curve.add(WebTransformKeyframe(0, operations1)); - curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); + curve->add(WebTransformKeyframe(0, operations1)); + curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear); OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create()); for (int i = 0; i <= 4; ++i) { const double time = i * 0.25; - EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41()); + EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m41()); } } diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index a22e49348..cc655735b 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,15 @@ +2012-08-23 Ryuan Choi <ryuan.choi@samsung.com> + + [EFL] Remove ewk_tile_matrix_tile_update. + https://bugs.webkit.org/show_bug.cgi?id=63437 + + Reviewed by Gyuyoung Kim. + + * ewk/ewk_tiled_matrix.cpp: + Removed ewk_tile_matrix_tile_update and ewk_tile_matrix_tile_update_full + which are dead code. + * ewk/ewk_tiled_matrix_private.h: Ditto. + 2012-08-21 Kihong Kwon <kihong.kwon@samsung.com> [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient diff --git a/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp b/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp index a14a1d7e5..f93764fe5 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp +++ b/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp @@ -523,59 +523,6 @@ Eina_Bool ewk_tile_matrix_tile_put(Ewk_Tile_Matrix* tileMatrix, Ewk_Tile* tile, return ewk_tile_unused_cache_tile_put(tileMatrix->tileUnusedCache, tile, _ewk_tile_matrix_tile_free, tileMatrix); } -Eina_Bool ewk_tile_matrix_tile_update(Ewk_Tile_Matrix* tileMatrix, unsigned long col, unsigned long row, const Eina_Rectangle* update) -{ - Eina_Rectangle newUpdate; - EINA_SAFETY_ON_NULL_RETURN_VAL(tileMatrix, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(update, false); - - memcpy(&newUpdate, update, sizeof(newUpdate)); - // check update is valid, otherwise return false - if (update->x < 0 || update->y < 0 || update->w <= 0 || update->h <= 0) { - ERR("invalid update region."); - return false; - } - - if (update->x + update->w - 1 >= tileMatrix->tile.width) - newUpdate.w = tileMatrix->tile.width - update->x; - if (update->y + update->h - 1 >= tileMatrix->tile.height) - newUpdate.h = tileMatrix->tile.height - update->y; - - Ewk_Tile* tile = static_cast<Ewk_Tile*>(eina_matrixsparse_data_idx_get(tileMatrix->matrix, row, col)); - if (!tile) - return true; - - if (!tile->updates && !tile->stats.full_update) - tileMatrix->updates = eina_list_append(tileMatrix->updates, tile); - ewk_tile_update_area(tile, &newUpdate); - - return true; -} - -Eina_Bool ewk_tile_matrix_tile_update_full(Ewk_Tile_Matrix* tileMatrix, unsigned long column, unsigned long row) -{ - Eina_Matrixsparse_Cell* cell; - EINA_SAFETY_ON_NULL_RETURN_VAL(tileMatrix, false); - - if (!eina_matrixsparse_cell_idx_get(tileMatrix->matrix, row, column, &cell)) - return false; - - if (!cell) - return true; - - Ewk_Tile* tile = static_cast<Ewk_Tile*>(eina_matrixsparse_cell_data_get(cell)); - if (!tile) { - CRITICAL("matrix cell with no tile!"); - return true; - } - - if (!tile->updates && !tile->stats.full_update) - tileMatrix->updates = eina_list_append(tileMatrix->updates, tile); - ewk_tile_update_full(tile); - - return true; -} - void ewk_tile_matrix_tile_updates_clear(Ewk_Tile_Matrix* tileMatrix, Ewk_Tile* tile) { EINA_SAFETY_ON_NULL_RETURN(tileMatrix); diff --git a/Source/WebKit/efl/ewk/ewk_tiled_matrix_private.h b/Source/WebKit/efl/ewk/ewk_tiled_matrix_private.h index b3793b5c7..151ebb0b7 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_matrix_private.h +++ b/Source/WebKit/efl/ewk/ewk_tiled_matrix_private.h @@ -44,8 +44,6 @@ Ewk_Tile *ewk_tile_matrix_tile_nearest_get(Ewk_Tile_Matrix *tm, unsigned long co Ewk_Tile *ewk_tile_matrix_tile_new(Ewk_Tile_Matrix *tm, Evas *evas, unsigned long col, unsigned long row, float zoom); Eina_Bool ewk_tile_matrix_tile_put(Ewk_Tile_Matrix *tm, Ewk_Tile *t, double last_used); -Eina_Bool ewk_tile_matrix_tile_update(Ewk_Tile_Matrix *tm, unsigned long col, unsigned long row, const Eina_Rectangle *update); -Eina_Bool ewk_tile_matrix_tile_update_full(Ewk_Tile_Matrix *tm, unsigned long col, unsigned long row); void ewk_tile_matrix_tile_updates_clear(Ewk_Tile_Matrix *tm, Ewk_Tile *t); Eina_Bool ewk_tile_matrix_update(Ewk_Tile_Matrix *tm, const Eina_Rectangle *update, float zoom); diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 53112e658..e156f61d2 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,20 @@ +2012-08-23 Mark Hahnenberg <mhahnenberg@apple.com> + + Change behavior of MasqueradesAsUndefined to better accommodate DFG changes + https://bugs.webkit.org/show_bug.cgi?id=93884 + + Reviewed by Filip Pizlo. + + With some upcoming changes to the DFG to remove uses of ClassInfo, we will be changing the behavior of + MasqueradesAsUndefined. In order to make this change consistent across all of our execution engines, + we will make this change to MasqueradesAsUndefined as a separate patch. After this patch, MasqueradesAsUndefined + objects will only masquerade as undefined in their original context (i.e. their original JSGlobalObject). + For example, if an object that masquerades as undefined in frame A is passed to frame B, it will not + masquerade as undefined within frame B, but it will continue to masquerade in frame A. + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::addValueToArray): Passing ExecState to toBoolean call. + 2012-08-22 Beth Dakin <bdakin@apple.com> https://bugs.webkit.org/show_bug.cgi?id=94401 diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index c88c7e97b..ac1a2c149 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 6; +MINOR_VERSION = 8; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index 4a7d3d266..91044305f 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -1271,7 +1271,7 @@ void NetscapePluginInstanceProxy::addValueToArray(NSMutableArray *array, ExecSta [array addObject:[NSNumber numberWithDouble:value.toNumber(exec)]]; } else if (value.isBoolean()) { [array addObject:[NSNumber numberWithInt:BoolValueType]]; - [array addObject:[NSNumber numberWithBool:value.toBoolean()]]; + [array addObject:[NSNumber numberWithBool:value.toBoolean(exec)]]; } else if (value.isNull()) [array addObject:[NSNumber numberWithInt:NullValueType]]; else if (value.isObject()) { diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 96ce099ee..319a75ceb 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,22 @@ +2012-08-23 Adrienne Walker <enne@google.com> + + Convert ScrollableArea ASSERT_NOT_REACHED virtuals + https://bugs.webkit.org/show_bug.cgi?id=93306 + + Reviewed by Darin Adler. + + Add implementations where necessary to make derived classes concrete. + Add OVERRIDE for ScrollableArea functions. + + * WebScrollBar.cpp: + (WebScrollBar::visibleHeight): + (WebScrollBar::visibleWidth): + (WebScrollBar::contentsSize): + (WebScrollBar::isOnActivePage): + (WebScrollBar::scrollableAreaBoundingBox): + * WebScrollBar.h: + (WebScrollBar): + 2012-08-22 Nikhil Bhargava <nbhargava@google.com> Reduce Font.h includes across project -- improves RenderObject.h compile time diff --git a/Source/WebKit/win/WebScrollBar.cpp b/Source/WebKit/win/WebScrollBar.cpp index d3388c3d9..f172196b3 100644 --- a/Source/WebKit/win/WebScrollBar.cpp +++ b/Source/WebKit/win/WebScrollBar.cpp @@ -284,3 +284,28 @@ Scrollbar* WebScrollBar::verticalScrollbar() const { return m_scrollBar->orientation() == VerticalScrollbar ? m_scrollBar.get() : 0; } + +int WebScrollBar::visibleHeight() const +{ + return m_scrollBar->height(); +} + +int WebScrollBar::visibleWidth() const +{ + return m_scrollBar->width(); +} + +WebCore::IntSize WebScrollBar::contentsSize() const +{ + return m_scrollBar->frameRect().size(); +} + +bool WebScrollBar::isOnActivePage() const +{ + return true; +} + +WebCore::IntRect WebScrollBar::scrollableAreaBoundingBox() const +{ + return m_scrollBar->frameRect(); +} diff --git a/Source/WebKit/win/WebScrollBar.h b/Source/WebKit/win/WebScrollBar.h index c97d0d701..dfd1ef040 100644 --- a/Source/WebKit/win/WebScrollBar.h +++ b/Source/WebKit/win/WebScrollBar.h @@ -117,6 +117,11 @@ protected: virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { } virtual WebCore::ScrollableArea* enclosingScrollableArea() const { return 0; } + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual WebCore::IntSize contentsSize() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual WebCore::IntRect scrollableAreaBoundingBox() const OVERRIDE; // FIXME: We should provide a way to set this value. virtual bool isActive() const { return true; } diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index c848e9e6d..c956117b3 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,114 @@ +2012-08-23 Frederik Gladhorn <gladhorn@kde.org> + + Make it possible to build WebKit with Python 3 (and 2) + https://bugs.webkit.org/show_bug.cgi?id=94814 + + Reviewed by Ryosuke Niwa. + + Exceptions need a hack to work with both. + string.join was already deprecated in Python 2. + Relative imports are no longer supported, use package name instead. + + * Scripts/webkit2/messages.py: + * Scripts/webkit2/parser.py: + +2012-08-23 Mark Hahnenberg <mhahnenberg@apple.com> + + Change behavior of MasqueradesAsUndefined to better accommodate DFG changes + https://bugs.webkit.org/show_bug.cgi?id=93884 + + Reviewed by Filip Pizlo. + + With some upcoming changes to the DFG to remove uses of ClassInfo, we will be changing the behavior of + MasqueradesAsUndefined. In order to make this change consistent across all of our execution engines, + we will make this change to MasqueradesAsUndefined as a separate patch. After this patch, MasqueradesAsUndefined + objects will only masquerade as undefined in their original context (i.e. their original JSGlobalObject). + For example, if an object that masquerades as undefined in frame A is passed to frame B, it will not + masquerade as undefined within frame B, but it will continue to masquerade in frame A. + + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): Passing ExecState to toBoolean call. + +2012-08-23 Brady Eidson <beidson@apple.com> + + REGRESSION (r124815): PDF in frame does not display any more + <rdar://problem/12063306> and https://bugs.webkit.org/show_bug.cgi?id=94869 + + Reviewed by Alexey Proskuryakov. + + * WebProcess/Plugins/PDF/BuiltInPDFView.mm: + (WebKit::BuiltInPDFView::initialize): Tell the controller that initialization was successful. + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Make WebKit2 build with the latest version of clang. + + Reviewed by Dan Bernstein. + + * Configurations/Base.xcconfig: Ensure that operator new isn't exported as a weak external symbol. + +2012-08-22 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + [EFL] Use WTF_USE_SOUP instead BUILDING_SOUP__ + https://bugs.webkit.org/show_bug.cgi?id=94744 + + Reviewed by Gustavo Noronha Silva. + + Use #if defined(WTF_USE_SOUP) instead of #if defined(BUILDING_SOUP__) + since the former is used everywhere. + + * Shared/API/c/WKBase.h: + +2012-08-23 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Free ewk context data on program exit. + https://bugs.webkit.org/show_bug.cgi?id=94808 + + Reviewed by Kenneth Rohde Christiansen. + + Make sure the default Ewk_Context gets freed + on program exit. + + The patch also fixes leaking of WKContextRef + inside Ewk_Context which should have been + adopted. + + * UIProcess/API/efl/ewk_context.cpp: + (_Ewk_Context::_Ewk_Context): + (ewk_context_default_get): + +2012-08-23 Adrienne Walker <enne@google.com> + + Convert ScrollableArea ASSERT_NOT_REACHED virtuals + https://bugs.webkit.org/show_bug.cgi?id=93306 + + Reviewed by Darin Adler. + + Add implementations where necessary to make derived classes concrete. + Add OVERRIDE for ScrollableArea functions. + + * UIProcess/win/WebPopupMenuProxyWin.cpp: + (WebKit::WebPopupMenuProxyWin::visibleHeight): + (WebKit): + (WebKit::WebPopupMenuProxyWin::visibleWidth): + (WebKit::WebPopupMenuProxyWin::contentsSize): + (WebKit::WebPopupMenuProxyWin::scrollableAreaBoundingBox): + * UIProcess/win/WebPopupMenuProxyWin.h: + (WebPopupMenuProxyWin): + * WebProcess/Plugins/PDF/BuiltInPDFView.h: + +2012-08-23 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] ewk_intent_request API test does not free Eina_List + https://bugs.webkit.org/show_bug.cgi?id=94809 + + Reviewed by Kenneth Rohde Christiansen. + + The used Eina_List should be freed due to ewk_intent_suggestions_get() documentation. + + * UIProcess/API/efl/tests/test_ewk2_intents.cpp: + (onIntentReceived): + 2012-08-23 Andras Becsi <andras.becsi@nokia.com> [Qt][WK2] Helper functions used by the raw webview tests should not be guarded by HAVE_QTQUICK diff --git a/Source/WebKit2/Configurations/Base.xcconfig b/Source/WebKit2/Configurations/Base.xcconfig index 0182371b9..ab4fec7fb 100644 --- a/Source/WebKit2/Configurations/Base.xcconfig +++ b/Source/WebKit2/Configurations/Base.xcconfig @@ -59,7 +59,7 @@ VALID_ARCHS = i386 x86_64; WARNING_CFLAGS = -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings $(COMPILER_SPECIFIC_WARNING_CFLAGS); // Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols. -OTHER_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv; +OTHER_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm; CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); CLANG_CXX_LIBRARY_1060 = libstdc++; diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index fef7ac72e..0b9cad4e0 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 6; +MINOR_VERSION = 8; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py index 2a87d62de..bd9dc9a28 100644 --- a/Source/WebKit2/Scripts/webkit2/messages.py +++ b/Source/WebKit2/Scripts/webkit2/messages.py @@ -22,9 +22,7 @@ import collections import re - -import parser - +from webkit2 import parser DELAYED_ATTRIBUTE = 'Delayed' DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE = 'DispatchOnConnectionQueue' diff --git a/Source/WebKit2/Scripts/webkit2/parser.py b/Source/WebKit2/Scripts/webkit2/parser.py index 525f137ec..c40080f0a 100644 --- a/Source/WebKit2/Scripts/webkit2/parser.py +++ b/Source/WebKit2/Scripts/webkit2/parser.py @@ -22,7 +22,7 @@ import re -import model +from webkit2 import model def parse(file): diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h index a6a8bd66f..06aa286ab 100644 --- a/Source/WebKit2/Shared/API/c/WKBase.h +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -37,7 +37,7 @@ #include <WebKit2/WKBaseGtk.h> #endif -#if defined(BUILDING_SOUP__) +#if defined(WTF_USE_SOUP) #include <WebKit2/WKBaseSoup.h> #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp index d6453757e..71504f641 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp @@ -70,18 +70,18 @@ struct _Ewk_Context { WKRetainPtr<WKSoupRequestManagerRef> requestManager; URLSchemeHandlerMap urlSchemeHandlers; - _Ewk_Context(WKContextRef contextRef) + _Ewk_Context(WKRetainPtr<WKContextRef> contextRef) : context(contextRef) , cookieManager(0) - , requestManager(WKContextGetSoupRequestManager(contextRef)) + , requestManager(WKContextGetSoupRequestManager(contextRef.get())) { #if ENABLE(BATTERY_STATUS) - WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(contextRef); + WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(contextRef.get()); batteryProvider = BatteryProvider::create(wkBatteryManager); #endif #if ENABLE(VIBRATION) - WKVibrationRef wkVibrationRef = WKContextGetVibration(contextRef); + WKVibrationRef wkVibrationRef = WKContextGetVibration(contextRef.get()); vibrationProvider = VibrationProvider::create(wkVibrationRef); #endif @@ -198,16 +198,11 @@ void ewk_context_url_scheme_request_received(Ewk_Context* ewkContext, Ewk_Url_Sc handler.callback(schemeRequest, handler.userData); } -static inline Ewk_Context* createDefaultEwkContext() -{ - return new Ewk_Context(WKContextCreate()); -} - Ewk_Context* ewk_context_default_get() { - static Ewk_Context* defaultContext = createDefaultEwkContext(); + static Ewk_Context defaultContext(adoptWK(WKContextCreate())); - return defaultContext; + return &defaultContext; } Eina_Bool ewk_context_uri_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData) diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp index fdf7fdf23..be8b0ffa8 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp @@ -92,6 +92,10 @@ static void onIntentReceived(void* userData, Evas_Object*, void* eventInfo) suggestions = eina_list_sort(suggestions, 2, stringSortCb); EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 0)), "http://service1.com/"); EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 1)), "http://service2.com/"); + + void* listData = 0; + EINA_LIST_FREE(suggestions, listData) + eina_stringshare_del(static_cast<const char*>(listData)); } } diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp index df4e9854b..a45280733 100644 --- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp @@ -469,6 +469,27 @@ void WebPopupMenuProxyWin::setScrollOffset(const IntPoint& offset) scrollTo(offset.y()); } +int WebPopupMenuProxyWin::visibleHeight() const +{ + return m_scrollbar ? m_scrollbar->visibleSize() : contentsSize().height(); +} + +int WebPopupMenuProxyWin::visibleWidth() const +{ + int scrollbarWidth = m_scrollbar ? m_scrollbar->frameRect().width() : 0; + return contentsSize().width() - scrollbarWidth; +} + +WebCore::IntSize WebPopupMenuProxyWin::contentsSize() const +{ + return clientRect().size(); +} + +WebCore::IntRect WebPopupMenuProxyWin::scrollableAreaBoundingBox() const +{ + return m_windowRect; +} + void WebPopupMenuProxyWin::scrollTo(int offset) { ASSERT(m_scrollbar); diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h index b7c4d6d29..1d25373f1 100644 --- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h @@ -61,16 +61,21 @@ private: WebCore::Scrollbar* scrollbar() const { return m_scrollbar.get(); } // ScrollableArea - virtual int scrollSize(WebCore::ScrollbarOrientation) const; - virtual int scrollPosition(WebCore::Scrollbar*) const; - virtual void setScrollOffset(const WebCore::IntPoint&); - virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); - virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { } - virtual bool isActive() const { return true; } - virtual bool isScrollCornerVisible() const { return false; } - virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); } - virtual WebCore::Scrollbar* verticalScrollbar() const { return m_scrollbar.get(); } - virtual WebCore::ScrollableArea* enclosingScrollableArea() const { return 0; } + virtual int scrollSize(WebCore::ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(WebCore::Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const WebCore::IntPoint&) OVERRIDE; + virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&) OVERRIDE; + virtual void invalidateScrollCornerRect(const WebCore::IntRect&) OVERRIDE { } + virtual bool isActive() const OVERRIDE { return true; } + virtual bool isScrollCornerVisible() const OVERRIDE { return false; } + virtual WebCore::IntRect scrollCornerRect() const OVERRIDE { return WebCore::IntRect(); } + virtual WebCore::Scrollbar* verticalScrollbar() const OVERRIDE { return m_scrollbar.get(); } + virtual WebCore::ScrollableArea* enclosingScrollableArea() const OVERRIDE { return 0; } + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual WebCore::IntSize contentsSize() const OVERRIDE; + virtual WebCore::IntRect scrollableAreaBoundingBox() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE { return true; } // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. void scrollTo(int offset); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp index 2b115f1e4..358533feb 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp @@ -154,7 +154,7 @@ void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue valu } if (value.isBoolean()) { - BOOLEAN_TO_NPVARIANT(value.toBoolean(), variant); + BOOLEAN_TO_NPVARIANT(value.toBoolean(exec), variant); return; } diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h index 8a7c28a5b..9ccd80400 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h @@ -122,30 +122,29 @@ private: virtual RetainPtr<PDFDocument> pdfDocumentForPrinting() const OVERRIDE { return m_pdfDocument; } // ScrollableArea methods. - virtual WebCore::IntRect scrollCornerRect() const; - virtual WebCore::ScrollableArea* enclosingScrollableArea() const; + virtual WebCore::IntRect scrollCornerRect() const OVERRIDE; + virtual WebCore::ScrollableArea* enclosingScrollableArea() const OVERRIDE; virtual WebCore::IntRect scrollableAreaBoundingBox() const OVERRIDE; - virtual void setScrollOffset(const WebCore::IntPoint&); - virtual int scrollSize(WebCore::ScrollbarOrientation) const; - virtual bool isActive() const; - virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); - virtual void invalidateScrollCornerRect(const WebCore::IntRect&); - virtual bool isScrollCornerVisible() const; - virtual int scrollPosition(WebCore::Scrollbar*) const; - virtual WebCore::IntPoint scrollPosition() const; - virtual WebCore::IntPoint minimumScrollPosition() const; - virtual WebCore::IntPoint maximumScrollPosition() const; - virtual int visibleHeight() const; - virtual int visibleWidth() const; - virtual WebCore::IntSize contentsSize() const; - virtual WebCore::Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); } - virtual WebCore::Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); } - virtual bool isOnActivePage() const; - virtual bool shouldSuspendScrollAnimations() const { return false; } // If we return true, ScrollAnimatorMac will keep cycling a timer forever, waiting for a good time to animate. - virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate); - + virtual void setScrollOffset(const WebCore::IntPoint&) OVERRIDE; + virtual int scrollSize(WebCore::ScrollbarOrientation) const OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&) OVERRIDE; + virtual void invalidateScrollCornerRect(const WebCore::IntRect&) OVERRIDE; + virtual bool isScrollCornerVisible() const OVERRIDE; + virtual int scrollPosition(WebCore::Scrollbar*) const OVERRIDE; + virtual WebCore::IntPoint scrollPosition() const OVERRIDE; + virtual WebCore::IntPoint minimumScrollPosition() const OVERRIDE; + virtual WebCore::IntPoint maximumScrollPosition() const OVERRIDE; + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual WebCore::IntSize contentsSize() const OVERRIDE; + virtual WebCore::Scrollbar* horizontalScrollbar() const OVERRIDE { return m_horizontalScrollbar.get(); } + virtual WebCore::Scrollbar* verticalScrollbar() const OVERRIDE { return m_verticalScrollbar.get(); } + virtual bool isOnActivePage() const OVERRIDE; + virtual bool shouldSuspendScrollAnimations() const OVERRIDE { return false; } // If we return true, ScrollAnimatorMac will keep cycling a timer forever, waiting for a good time to animate. + virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE; // FIXME: Implement the other conversion functions; this one is enough to get scrollbar hit testing working. - virtual WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntPoint& parentPoint) const; + virtual WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntPoint& parentPoint) const OVERRIDE; JSObjectRef makeJSPDFDoc(JSContextRef); static JSValueRef jsPDFDocPrint(JSContextRef, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm index 61db553fc..fe7f258b0 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm @@ -342,6 +342,7 @@ bool BuiltInPDFView::initialize(const Parameters& parameters) if (!parameters.shouldUseManualLoader && !parameters.url.isEmpty()) controller()->loadURL(pdfDocumentRequestID, "GET", parameters.url.string(), String(), HTTPHeaderMap(), Vector<uint8_t>(), false); + controller()->didInitializePlugin(); return true; } diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake index 581f4ab89..25bf597d9 100644 --- a/Source/cmake/OptionsEfl.cmake +++ b/Source/cmake/OptionsEfl.cmake @@ -33,7 +33,6 @@ SET(ENABLE_GLIB_SUPPORT ON) SET(WTF_USE_SOUP 1) ADD_DEFINITIONS(-DWTF_USE_SOUP=1) -ADD_DEFINITIONS(-DBUILDING_SOUP__=1) ADD_DEFINITIONS(-DENABLE_CONTEXT_MENUS=0) |