diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-23 10:25:11 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-23 10:25:11 +0200 |
| commit | 5ea819f80c6840c492386bfafbffb059c7e2091f (patch) | |
| tree | 42ad0b1d82eff090d14278a088ea0f4840a0f938 | |
| parent | 43a42f108af6bcbd91f2672731c3047c26213af1 (diff) | |
| download | qtwebkit-5ea819f80c6840c492386bfafbffb059c7e2091f.tar.gz | |
Imported WebKit commit 20434eb8eb95065803473139d8794e98a7672f75 (http://svn.webkit.org/repository/webkit/trunk@132191)
New snapshot that should fix build with latest qtbase and the QPlastiqueStyle removal
376 files changed, 6661 insertions, 2375 deletions
diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp index e2a102948..162c825aa 100644 --- a/Source/JavaScriptCore/API/JSContextRef.cpp +++ b/Source/JavaScriptCore/API/JSContextRef.cpp @@ -54,7 +54,7 @@ using namespace JSC; JSContextGroupRef JSContextGroupCreate() { initializeThreading(); - return toRef(JSGlobalData::createContextGroup(ThreadStackTypeSmall).leakRef()); + return toRef(JSGlobalData::createContextGroup().leakRef()); } JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) @@ -89,7 +89,7 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass { initializeThreading(); - RefPtr<JSGlobalData> globalData = group ? PassRefPtr<JSGlobalData>(toJS(group)) : JSGlobalData::createContextGroup(ThreadStackTypeSmall); + RefPtr<JSGlobalData> globalData = group ? PassRefPtr<JSGlobalData>(toJS(group)) : JSGlobalData::createContextGroup(); APIEntryShim entryShim(globalData.get(), false); globalData->makeUsableFromMultipleThreads(); diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index c6b5ce758..c096c4bd0 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,186 @@ +2012-10-23 Mark Lam <mark.lam@apple.com> + + Make topCallFrame reliable. + https://bugs.webkit.org/show_bug.cgi?id=98928. + + Reviewed by Geoffrey Garen. + + - VM entry points and the GC now uses topCallFrame. + - The callerFrame value in CallFrames are now always the previous + frame on the stack, except for the first frame which has a + callerFrame of 0 (not counting the HostCallFrameFlag). + Hence, we can now traverse every frame on the stack all the way + back to the first frame. + - GlobalExec's will no longer be used as the callerFrame values in + call frames. + - Added fences and traps for debugging the JSStack in debug builds. + + * bytecode/SamplingTool.h: + (SamplingTool): + (JSC::SamplingTool::CallRecord::CallRecord): + * dfg/DFGOperations.cpp: + - Fixed 2 DFG helper functions to flush topCallFrame as expected. + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::prepareForExternalCall): + * interpreter/CallFrame.h: + (JSC::ExecState::callerFrameNoFlags): + (ExecState): + (JSC::ExecState::argIndexForRegister): + (JSC::ExecState::getArgumentUnsafe): + * interpreter/CallFrameClosure.h: + (CallFrameClosure): + * interpreter/Interpreter.cpp: + (JSC): + (JSC::eval): + (JSC::Interpreter::Interpreter): + (JSC::Interpreter::throwException): + (JSC::Interpreter::execute): + (JSC::Interpreter::executeCall): + (JSC::Interpreter::executeConstruct): + (JSC::Interpreter::prepareForRepeatCall): + (JSC::Interpreter::endRepeatCall): + * interpreter/Interpreter.h: + (JSC): + (Interpreter): + * interpreter/JSStack.cpp: + (JSC::JSStack::JSStack): + (JSC::JSStack::gatherConservativeRoots): + (JSC::JSStack::disableErrorStackReserve): + * interpreter/JSStack.h: + (JSC): + (JSStack): + (JSC::JSStack::installFence): + (JSC::JSStack::validateFence): + (JSC::JSStack::installTrapsAfterFrame): + * interpreter/JSStackInlines.h: Added. + (JSC): + (JSC::JSStack::getTopOfFrame): + (JSC::JSStack::getTopOfStack): + (JSC::JSStack::getStartOfFrame): + (JSC::JSStack::pushFrame): + (JSC::JSStack::popFrame): + (JSC::JSStack::generateFenceValue): + (JSC::JSStack::installFence): + (JSC::JSStack::validateFence): + (JSC::JSStack::installTrapsAfterFrame): + * jit/JITStubs.cpp: + (JSC::jitCompileFor): + (JSC::lazyLinkFor): + - Set frame->codeBlock to 0 for both the above because they are called + with partially intitialized frames (cb uninitialized), but may + trigger a GC. + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + +2012-10-22 Filip Pizlo <fpizlo@apple.com> + + DFG::Array::Undecided should be called DFG::Array::SelectUsingPredictions + https://bugs.webkit.org/show_bug.cgi?id=100052 + + Reviewed by Oliver Hunt. + + No functional change, just renaming. It's a clearer name that more accurately + reflects the meaning, and it eliminates the namespace confusion that will happen + with the Undecided indexing type in https://bugs.webkit.org/show_bug.cgi?id=98606 + + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGArrayMode.cpp: + (JSC::DFG::fromObserved): + (JSC::DFG::refineArrayMode): + (JSC::DFG::modeAlreadyChecked): + (JSC::DFG::modeToString): + * dfg/DFGArrayMode.h: + (JSC::DFG::canCSEStorage): + (JSC::DFG::modeIsSpecific): + (JSC::DFG::modeSupportsLength): + (JSC::DFG::benefitsFromStructureCheck): + * dfg/DFGFixupPhase.cpp: + (JSC::DFG::FixupPhase::fixupNode): + (JSC::DFG::FixupPhase::blessArrayOperation): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::arrayify): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-10-22 Mark Lam <mark.lam@apple.com> + + Change stack recursion checks to be based on stack availability. + https://bugs.webkit.org/show_bug.cgi?id=99872. + + Reviewed by Filip Pizlo and Geoffrey Garen. + + - Remove m_reentryDepth, ThreadStackType which are now obsolete. + - Replaced the reentryDepth checks with a StackBounds check. + - Added the Interpreter::StackPolicy class to compute a reasonable + stack capacity requirement given the native stack that the + interpreter is executing on at that time. + - Reserved an amount of JSStack space for the use of error handling + and enable its use (using Interpreter::ErrorHandlingMode) when + we're about to throw or report an exception. + - Interpreter::StackPolicy also allows more native stack space + to be used when in ErrorHandlingMode. This is needed in the case + of native stack overflows. + - Fixed the parser so that it throws a StackOverflowError instead of + a SyntaxError when it encounters a stack overflow. + + * API/JSContextRef.cpp: + (JSContextGroupCreate): + (JSGlobalContextCreateInGroup): + * JavaScriptCore.order: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::ErrorHandlingMode::ErrorHandlingMode): + (JSC): + (JSC::Interpreter::ErrorHandlingMode::~ErrorHandlingMode): + (JSC::Interpreter::StackPolicy::StackPolicy): + (JSC::Interpreter::Interpreter): + (JSC::Interpreter::execute): + (JSC::Interpreter::executeCall): + (JSC::Interpreter::executeConstruct): + (JSC::Interpreter::prepareForRepeatCall): + * interpreter/Interpreter.h: + (JSC): + (Interpreter): + (ErrorHandlingMode): + (StackPolicy): + (JSC::Interpreter::StackPolicy::requiredCapacity): + * interpreter/JSStack.cpp: + (JSC): + (JSC::JSStack::JSStack): + (JSC::JSStack::growSlowCase): + (JSC::JSStack::enableErrorStackReserve): + (JSC::JSStack::disableErrorStackReserve): + * interpreter/JSStack.h: + (JSStack): + (JSC::JSStack::reservationEnd): + (JSC): + * jsc.cpp: + (jscmain): + * parser/Parser.cpp: + (JSC::::Parser): + * parser/Parser.h: + (Parser): + (JSC::::parse): + * runtime/ExceptionHelpers.cpp: + (JSC::throwStackOverflowError): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + (JSC::JSGlobalData::createContextGroup): + (JSC::JSGlobalData::create): + (JSC::JSGlobalData::createLeaked): + (JSC::JSGlobalData::sharedInstance): + * runtime/JSGlobalData.h: + (JSC): + (JSGlobalData): + * runtime/StringRecursionChecker.h: + (JSC::StringRecursionChecker::performCheck): + * testRegExp.cpp: + (realMain): + 2012-10-20 Martin Robinson <mrobinson@igalia.com> Fix 'make dist' for the GTK+ port diff --git a/Source/JavaScriptCore/JavaScriptCore.order b/Source/JavaScriptCore/JavaScriptCore.order index aa3d0ef32..6a1946684 100644 --- a/Source/JavaScriptCore/JavaScriptCore.order +++ b/Source/JavaScriptCore/JavaScriptCore.order @@ -120,7 +120,7 @@ _JSGlobalContextCreate __ZN3JSC6JSLock4lockENS_14JSLockBehaviorE __ZN3JSCL17createJSLockCountEv __ZN3JSC12JSGlobalData14sharedInstanceEv -__ZN3JSC12JSGlobalDataC2ENS0_14GlobalDataTypeENS_15ThreadStackTypeE +__ZN3JSC12JSGlobalDataC2ENS0_14GlobalDataTypeENS_8HeapTypeE __ZN3JSC21createIdentifierTableEv __ZN3JSC17CommonIdentifiersC1EPNS_12JSGlobalDataE __ZN3JSC17CommonIdentifiersC2EPNS_12JSGlobalDataE @@ -440,7 +440,7 @@ __ZN3WTF6strtodEPKcPPc __ZN3WTF10StringImpl22containsOnlyWhitespaceEv __ZN3WTF10StringImpl11reverseFindEPS0_j __ZN3WTF17equalIgnoringCaseEPNS_10StringImplES1_ -__ZN3JSC12JSGlobalData12createLeakedENS_15ThreadStackTypeE +__ZN3JSC12JSGlobalData12createLeakedENS_8HeapTypeE __ZN3JSC24JSObjectWithGlobalObjectC2ERNS_12JSGlobalDataEPNS_14JSGlobalObjectEPNS_9StructureE __ZN3JSC8evaluateEPNS_9ExecStateEPNS_14ScopeChainNodeERKNS_10SourceCodeENS_7JSValueE __ZN3JSC17ProgramExecutableC1EPNS_9ExecStateERKNS_10SourceCodeE @@ -1707,7 +1707,7 @@ __ZN3JSC8JSParser21parseDoWhileStatementINS_13SyntaxCheckerEEENT_9StatementERS3_ __ZN3JSCL16mathProtoFuncMinEPNS_9ExecStateE __ZN3JSCL21arrayProtoFuncReverseEPNS_9ExecStateE __ZN3JSC17ProgramExecutable13visitChildrenERNS_9MarkStackE -__ZN3JSC12JSGlobalData18createContextGroupENS_15ThreadStackTypeE +__ZN3JSC12JSGlobalData18createContextGroupENS_8HeapTypeE __ZN3JSC12JSGlobalData22clearBuiltinStructuresEv __ZN3JSC4Heap7destroyEv __ZN3JSC9JITThunks22clearHostFunctionStubsEv @@ -1842,7 +1842,7 @@ _JSObjectHasProperty _JSObjectGetPrototype __ZN3JSC8JSObject15unwrappedObjectEv __ZN3JSC11createErrorEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE +__ZN3JSC12JSGlobalData6createENS_8HeapTypeE __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj __ZN3JSC12JSGlobalData13startSamplingEv __ZN3JSC11Interpreter13startSamplingEv diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index a386b4c2b..b23100547 100755 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -10,6 +10,8 @@ EXPORTS ??0DropAllLocks@JSLock@JSC@@QAE@PAVExecState@2@@Z ??0DropAllLocks@JSLock@JSC@@QAE@PAVJSGlobalData@2@@Z ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z + ??0ErrorHandlingMode@Interpreter@JSC@@QAE@PAVExecState@2@@Z + ??1ErrorHandlingMode@Interpreter@JSC@@QAE@XZ ??0InternalFunction@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@@Z ??0JSGlobalObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@PBUGlobalObjectMethodTable@1@@Z ??0JSLockHolder@JSC@@QAE@AAVJSGlobalData@1@@Z @@ -118,13 +120,13 @@ EXPORTS ?convertUTF8ToUTF16@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBDPBDPAPA_WPA_WPA_N_N@Z ?copyBackingStore@JSObject@JSC@@SAXPAVJSCell@2@AAVCopyVisitor@2@@Z ?create@JSFunction@JSC@@SAPAV12@PAVExecState@2@PAVJSGlobalObject@2@HABVString@WTF@@P6I_J0@ZW4Intrinsic@2@3@Z - ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@W4HeapType@2@@Z + ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4HeapType@2@@Z ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVString@3@@Z ?create@RegExp@JSC@@SAPAV12@AAVJSGlobalData@2@ABVString@WTF@@W4RegExpFlags@2@@Z ?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z ?createInterruptedExecutionException@JSC@@YAPAVJSObject@1@PAVJSGlobalData@1@@Z - ?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@W4HeapType@2@@Z + ?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4HeapType@2@@Z ?createNotEnoughArgumentsError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z ?createRangeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z diff --git a/Source/JavaScriptCore/bytecode/SamplingTool.h b/Source/JavaScriptCore/bytecode/SamplingTool.h index 8f90c3e17..6c9df62ee 100644 --- a/Source/JavaScriptCore/bytecode/SamplingTool.h +++ b/Source/JavaScriptCore/bytecode/SamplingTool.h @@ -230,17 +230,18 @@ namespace JSC { class SamplingTool { public: friend struct CallRecord; - friend class HostCallRecord; #if ENABLE(OPCODE_SAMPLING) class CallRecord { WTF_MAKE_NONCOPYABLE(CallRecord); public: - CallRecord(SamplingTool* samplingTool) + CallRecord(SamplingTool* samplingTool, bool isHostCall = false) : m_samplingTool(samplingTool) , m_savedSample(samplingTool->m_sample) , m_savedCodeBlock(samplingTool->m_codeBlock) { + if (isHostcall) + samplingTool->m_sample |= 0x1; } ~CallRecord() @@ -254,32 +255,15 @@ namespace JSC { intptr_t m_savedSample; CodeBlock* m_savedCodeBlock; }; - - class HostCallRecord : public CallRecord { - public: - HostCallRecord(SamplingTool* samplingTool) - : CallRecord(samplingTool) - { - samplingTool->m_sample |= 0x1; - } - }; #else class CallRecord { WTF_MAKE_NONCOPYABLE(CallRecord); public: - CallRecord(SamplingTool*) + CallRecord(SamplingTool*, bool = false) { } }; - - class HostCallRecord : public CallRecord { - public: - HostCallRecord(SamplingTool* samplingTool) - : CallRecord(samplingTool) - { - } - }; -#endif +#endif SamplingTool(Interpreter* interpreter) : m_interpreter(interpreter) diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index 928788bf3..58ff7d23c 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -840,7 +840,7 @@ bool AbstractState::execute(unsigned indexInBlock) case GetByVal: { node.setCanExit(true); switch (node.arrayMode()) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::Unprofiled: ASSERT_NOT_REACHED(); break; diff --git a/Source/JavaScriptCore/dfg/DFGArrayMode.cpp b/Source/JavaScriptCore/dfg/DFGArrayMode.cpp index 623e9d743..a3aafde01 100644 --- a/Source/JavaScriptCore/dfg/DFGArrayMode.cpp +++ b/Source/JavaScriptCore/dfg/DFGArrayMode.cpp @@ -40,7 +40,7 @@ Array::Mode fromObserved(ArrayProfile* profile, Array::Action action, bool makeS case asArrayModes(NonArray): if (action == Array::Write && !profile->mayInterceptIndexedAccesses()) return Array::ToContiguous; // FIXME: we don't know whether to go to contiguous or array storage. We're making a static guess here. In future we should use exit profiling for this. - return Array::Undecided; + return Array::SelectUsingPredictions; case asArrayModes(NonArrayWithContiguous): return makeSafe ? Array::ContiguousOutOfBounds : (profile->mayStoreToHole() ? Array::ContiguousToTail : Array::Contiguous); case asArrayModes(ArrayWithContiguous): @@ -71,23 +71,23 @@ Array::Mode fromObserved(ArrayProfile* profile, Array::Action action, bool makeS case asArrayModes(NonArray) | asArrayModes(NonArrayWithContiguous): if (action == Array::Write && !profile->mayInterceptIndexedAccesses()) return Array::ToContiguous; - return Array::Undecided; + return Array::SelectUsingPredictions; case asArrayModes(NonArray) | asArrayModes(NonArrayWithContiguous) | asArrayModes(NonArrayWithArrayStorage): case asArrayModes(NonArray) | asArrayModes(NonArrayWithArrayStorage): if (action == Array::Write && !profile->mayInterceptIndexedAccesses()) return Array::ToArrayStorage; - return Array::Undecided; + return Array::SelectUsingPredictions; case asArrayModes(NonArray) | asArrayModes(NonArrayWithSlowPutArrayStorage): case asArrayModes(NonArray) | asArrayModes(NonArrayWithArrayStorage) | asArrayModes(NonArrayWithSlowPutArrayStorage): if (action == Array::Write && !profile->mayInterceptIndexedAccesses()) return Array::ToSlowPutArrayStorage; - return Array::Undecided; + return Array::SelectUsingPredictions; default: // We know that this is possibly a kind of array for which, though there is no // useful data in the array profile, we may be able to extract useful data from // the value profiles of the inputs. Hence, we leave it as undecided, and let // the predictions propagator decide later. - return Array::Undecided; + return Array::SelectUsingPredictions; } } @@ -110,7 +110,7 @@ Array::Mode refineArrayMode(Array::Mode arrayMode, SpeculatedType base, Speculat return Array::ForceExit; } - if (arrayMode != Array::Undecided) + if (arrayMode != Array::SelectUsingPredictions) return arrayMode; if (isStringSpeculation(base)) @@ -250,7 +250,7 @@ bool modeAlreadyChecked(AbstractValue& value, Array::Mode arrayMode) case Array::Float64Array: return isFloat64ArraySpeculation(value.m_type); - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::Unprofiled: break; } @@ -262,8 +262,8 @@ bool modeAlreadyChecked(AbstractValue& value, Array::Mode arrayMode) const char* modeToString(Array::Mode mode) { switch (mode) { - case Array::Undecided: - return "Undecided"; + case Array::SelectUsingPredictions: + return "SelectUsingPredictions"; case Array::Unprofiled: return "Unprofiled"; case Array::Generic: diff --git a/Source/JavaScriptCore/dfg/DFGArrayMode.h b/Source/JavaScriptCore/dfg/DFGArrayMode.h index f7ac92733..a1cd74114 100644 --- a/Source/JavaScriptCore/dfg/DFGArrayMode.h +++ b/Source/JavaScriptCore/dfg/DFGArrayMode.h @@ -47,7 +47,7 @@ enum Action { }; enum Mode { - Undecided, // Implies that we need predictions to decide. We will never get to the backend in this mode. + SelectUsingPredictions, // Implies that we need predictions to decide. We will never get to the backend in this mode. Unprofiled, // Implies that array profiling didn't see anything. But that could be because the operands didn't comply with basic type assumptions (base is cell, property is int). This either becomes Generic or ForceExit depending on value profiling. ForceExit, // Implies that we have no idea how to execute this operation, so we should just give up. Generic, @@ -266,7 +266,7 @@ inline bool mayStoreToHole(Array::Mode arrayMode) inline bool canCSEStorage(Array::Mode arrayMode) { switch (arrayMode) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::Unprofiled: case Array::ForceExit: case Array::Generic: @@ -299,7 +299,7 @@ inline Array::Mode modeForPut(Array::Mode arrayMode) inline bool modeIsSpecific(Array::Mode mode) { switch (mode) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::Unprofiled: case Array::ForceExit: case Array::Generic: @@ -312,7 +312,7 @@ inline bool modeIsSpecific(Array::Mode mode) inline bool modeSupportsLength(Array::Mode mode) { switch (mode) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::Unprofiled: case Array::ForceExit: case Array::Generic: @@ -329,7 +329,7 @@ inline bool benefitsFromStructureCheck(Array::Mode mode) { switch (mode) { case ALL_EFFECTFUL_MODES: - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::Unprofiled: case Array::ForceExit: case Array::Generic: diff --git a/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp b/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp index 49212730c..5dcfe08a5 100644 --- a/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp @@ -86,7 +86,7 @@ private: ArrayProfile* arrayProfile = m_graph.baselineCodeBlockFor(nodePtr->codeOrigin)->getArrayProfile( nodePtr->codeOrigin.bytecodeIndex); - Array::Mode arrayMode = Array::Undecided; + Array::Mode arrayMode = Array::SelectUsingPredictions; if (arrayProfile) { arrayProfile->computeUpdatedPrediction(); arrayMode = refineArrayMode( @@ -436,7 +436,7 @@ private: return; } - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::Unprofiled: ASSERT_NOT_REACHED(); return; diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index 11c2c1cef..13e04388c 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -1165,20 +1165,24 @@ JSCell* DFG_OPERATION operationCreateActivation(ExecState* exec) JSCell* DFG_OPERATION operationCreateArguments(ExecState* exec) { + JSGlobalData& globalData = exec->globalData(); + NativeCallFrameTracer tracer(&globalData, exec); // NB: This needs to be exceedingly careful with top call frame tracking, since it // may be called from OSR exit, while the state of the call stack is bizarre. - Arguments* result = Arguments::create(exec->globalData(), exec); - ASSERT(!exec->globalData().exception); + Arguments* result = Arguments::create(globalData, exec); + ASSERT(!globalData.exception); return result; } JSCell* DFG_OPERATION operationCreateInlinedArguments( ExecState* exec, InlineCallFrame* inlineCallFrame) { + JSGlobalData& globalData = exec->globalData(); + NativeCallFrameTracer tracer(&globalData, exec); // NB: This needs to be exceedingly careful with top call frame tracking, since it // may be called from OSR exit, while the state of the call stack is bizarre. - Arguments* result = Arguments::create(exec->globalData(), exec, inlineCallFrame); - ASSERT(!exec->globalData().exception); + Arguments* result = Arguments::create(globalData, exec, inlineCallFrame); + ASSERT(!globalData.exception); return result; } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index a9b91d046..7cb028388 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -497,7 +497,7 @@ void SpeculativeJIT::arrayify(Node& node, GPRReg baseReg, GPRReg propertyReg) break; default: CRASH(); - desiredArrayMode = Array::Undecided; + desiredArrayMode = Array::ForceExit; break; } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index 3796cc704..aadcdb06b 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -1925,6 +1925,15 @@ public: #if !defined(NDEBUG) && !CPU(ARM) void prepareForExternalCall() { + // We're about to call out to a "native" helper function. The helper + // function is expected to set topCallFrame itself with the ExecState + // that is passed to it. + // + // We explicitly trash topCallFrame here so that we'll know if some of + // the helper functions are not setting topCallFrame when they should + // be doing so. Note: the previous value in topcallFrame was not valid + // anyway since it was not being updated by JIT'ed code by design. + for (unsigned i = 0; i < sizeof(void*) / 4; i++) m_jit.store32(TrustedImm32(0xbadbeef), reinterpret_cast<char*>(&m_jit.globalData()->topCallFrame) + i * 4); } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index 453851ba3..ab089ba36 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -2653,7 +2653,7 @@ void SpeculativeJIT::compile(Node& node) case GetByVal: { switch (node.arrayMode()) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::ForceExit: ASSERT_NOT_REACHED(); terminateSpeculativeExecution(InadequateCoverage, JSValueRegs(), NoNode); @@ -2833,7 +2833,7 @@ void SpeculativeJIT::compile(Node& node) bool alreadyHandled = false; switch (arrayMode) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::ForceExit: ASSERT_NOT_REACHED(); terminateSpeculativeExecution(InadequateCoverage, JSValueRegs(), NoNode); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index 42ab40341..f11fd1663 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -2680,7 +2680,7 @@ void SpeculativeJIT::compile(Node& node) case GetByVal: { switch (node.arrayMode()) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::ForceExit: ASSERT_NOT_REACHED(); terminateSpeculativeExecution(InadequateCoverage, JSValueRegs(), NoNode); @@ -2840,7 +2840,7 @@ void SpeculativeJIT::compile(Node& node) bool alreadyHandled = false; switch (arrayMode) { - case Array::Undecided: + case Array::SelectUsingPredictions: case Array::ForceExit: ASSERT_NOT_REACHED(); terminateSpeculativeExecution(InadequateCoverage, JSValueRegs(), NoNode); diff --git a/Source/JavaScriptCore/interpreter/CallFrame.h b/Source/JavaScriptCore/interpreter/CallFrame.h index 7aa49a9b0..2b0ea3aac 100644 --- a/Source/JavaScriptCore/interpreter/CallFrame.h +++ b/Source/JavaScriptCore/interpreter/CallFrame.h @@ -256,6 +256,7 @@ namespace JSC { CodeBlock* someCodeBlockForPossiblyInlinedCode() { return codeBlock(); } #endif + CallFrame* callerFrameNoFlags() { return callerFrame()->removeHostCallFrameFlag(); } // Call this to get the true call frame (accounted for inlining and any // other optimizations), when you have entered into VM code through one @@ -281,6 +282,36 @@ namespace JSC { ExecState(); ~ExecState(); + // The following are for internal use in debugging and verification + // code only and not meant as an API for general usage: + + size_t argIndexForRegister(Register* reg) + { + // The register at 'offset' number of slots from the frame pointer + // i.e. + // reg = frame[offset]; + // ==> reg = frame + offset; + // ==> offset = reg - frame; + int offset = reg - this->registers(); + + // The offset is defined (based on argumentOffset()) to be: + // offset = s_firstArgumentOffset - argIndex; + // Hence: + // argIndex = s_firstArgumentOffset - offset; + size_t argIndex = s_firstArgumentOffset - offset; + return argIndex; + } + + JSValue getArgumentUnsafe(size_t argIndex) + { + // User beware! This method does not verify that there is a valid + // argument at the specified argIndex. This is used for debugging + // and verification code only. The caller is expected to know what + // he/she is doing when calling this method. + return this[argumentOffset(argIndex)].jsValue(); + } + + friend class JSStack; friend class VMInspector; }; diff --git a/Source/JavaScriptCore/interpreter/CallFrameClosure.h b/Source/JavaScriptCore/interpreter/CallFrameClosure.h index 157d1b3b9..010c9655b 100644 --- a/Source/JavaScriptCore/interpreter/CallFrameClosure.h +++ b/Source/JavaScriptCore/interpreter/CallFrameClosure.h @@ -34,7 +34,6 @@ struct CallFrameClosure { JSFunction* function; FunctionExecutable* functionExecutable; JSGlobalData* globalData; - Register* oldEnd; JSScope* scope; int parameterCountIncludingThis; int argumentCountIncludingThis; diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index 8c09019da..0d475b416 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -48,6 +48,7 @@ #include "JSNameScope.h" #include "JSNotAnObject.h" #include "JSPropertyNameIterator.h" +#include "JSStackInlines.h" #include "JSString.h" #include "JSWithScope.h" #include "LLIntCLoop.h" @@ -67,6 +68,7 @@ #include <stdio.h> #include <wtf/StackStats.h> #include <wtf/Threading.h> +#include <wtf/WTFThreadData.h> #include <wtf/text/StringBuilder.h> #if ENABLE(JIT) @@ -79,41 +81,131 @@ using namespace std; namespace JSC { -static CallFrame* getCallerInfo(JSGlobalData*, CallFrame*, int& lineNumber, unsigned& bytecodeOffset); - -// Returns the depth of the scope chain within a given call frame. -static int depth(CodeBlock* codeBlock, JSScope* sc) +Interpreter::ErrorHandlingMode::ErrorHandlingMode(ExecState *exec) + : m_interpreter(*exec->interpreter()) { - if (!codeBlock->needsFullScopeChain()) - return 0; - return sc->localDepth(); + if (!m_interpreter.m_errorHandlingModeReentry) + m_interpreter.stack().enableErrorStackReserve(); + m_interpreter.m_errorHandlingModeReentry++; } -ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newCodeBlock, JSStack* stack, CallFrame* callFrame, size_t registerOffset, int argumentCountIncludingThis) +Interpreter::ErrorHandlingMode::~ErrorHandlingMode() { - // This ensures enough space for the worst case scenario of zero arguments passed by the caller. - if (!stack->grow(callFrame->registers() + registerOffset + newCodeBlock->numParameters() + newCodeBlock->m_numCalleeRegisters)) - return 0; + m_interpreter.m_errorHandlingModeReentry--; + ASSERT(m_interpreter.m_errorHandlingModeReentry >= 0); + if (!m_interpreter.m_errorHandlingModeReentry) + m_interpreter.stack().disableErrorStackReserve(); +} - if (argumentCountIncludingThis >= newCodeBlock->numParameters()) { - Register* newCallFrame = callFrame->registers() + registerOffset; - return CallFrame::create(newCallFrame); - } - // Too few arguments -- copy arguments, then fill in missing arguments with undefined. - size_t delta = newCodeBlock->numParameters() - argumentCountIncludingThis; - CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset + delta); +// The Interpreter::StackPolicy class is used to compute a stack capacity +// requirement to ensure that we have enough room on the native stack for: +// 1. the max cummulative stack used by the interpreter and all code +// paths sub of it up till leaf functions. +// 2. the max cummulative stack used by the interpreter before it reaches +// the next checkpoint (execute...() function) in the interpreter. +// +// The interpreter can be run on different threads and hence, different +// native stacks (with different sizes) before exiting out of the first +// frame. Hence, the required capacity needs to be re-computed on every +// entry into the interpreter. +// +// Currently the requiredStack is computed based on a policy. See comments +// in StackPolicy::StackPolicy() for details. + +Interpreter::StackPolicy::StackPolicy(Interpreter& interpreter, const StackBounds& stack) + : m_interpreter(interpreter) +{ + int size = stack.size(); + + const int DEFAULT_REQUIRED_STACK = 1024 * 1024; + const int DEFAULT_MINIMUM_USEABLE_STACK = 128 * 1024; + const int DEFAULT_ERROR_MODE_REQUIRED_STACK = 32 * 1024; + + // Here's the policy in a nutshell: + // + // 1. If we have a large stack, let JS use as much stack as possible + // but require that we have at least DEFAULT_REQUIRED_STACK capacity + // remaining on the stack: + // + // stack grows this way --> + // --------------------------------------------------------- + // | ... | <-- DEFAULT_REQUIRED_STACK --> | ... + // --------------------------------------------------------- + // ^ ^ + // start current sp + // + // 2. In event that we're re-entering the interpreter to handle + // exceptions (in error mode), we'll be a little more generous and + // require less stack capacity for the interpreter to be re-entered. + // + // This is needed because we may have just detected an eminent stack + // overflow based on the normally computed required stack capacity. + // However, the normal required capacity far exceeds what is needed + // for exception handling work. Hence, in error mode, we only require + // DEFAULT_ERROR_MODE_REQUIRED_STACK capacity. + // + // stack grows this way --> + // ----------------------------------------------------------------- + // | ... | <-- DEFAULT_ERROR_MODE_REQUIRED_STACK --> | ... + // ----------------------------------------------------------------- + // ^ ^ + // start current sp + // + // This smaller requried capacity also means that we won't re-trigger + // a stack overflow for processing the exception caused by the original + // StackOverflowError. + // + // 3. If the stack is not large enough, give JS at least a minimum + // amount of useable stack: + // + // stack grows this way --> + // -------------------------------------------------------------------- + // | <-- DEFAULT_MINIMUM_USEABLE_STACK --> | <-- requiredCapacity --> | + // -------------------------------------------------------------------- + // ^ ^ + // start current sp + // + // The minimum useable capacity is DEFAULT_MINIMUM_USEABLE_STACK. + // In this case, the requiredCapacity is whatever is left of the + // total stack capacity after we have give JS its minimum stack + // i.e. requiredCapcity can even be 0 if there's not enough stack. + + + // Policy 1: Normal mode: required = DEFAULT_REQUIRED_STACK. + // Policy 2: Erro mode: required = DEFAULT_ERROR_MODE_REQUIRED_STACK. + int requiredCapacity = !m_interpreter.m_errorHandlingModeReentry ? + DEFAULT_REQUIRED_STACK : DEFAULT_ERROR_MODE_REQUIRED_STACK; + + int useableStack = size - requiredCapacity; + + // Policy 3: Ensure the useable stack is not too small: + if (useableStack < DEFAULT_MINIMUM_USEABLE_STACK) + useableStack = DEFAULT_MINIMUM_USEABLE_STACK; + + // Sanity check: Make sure we do not use more space than the stack's + // total capacity: + if (useableStack > size) + useableStack = size; + + // Re-compute the requiredCapacity based on the adjusted useable stack + // size: + // interpreter stack checks: + requiredCapacity = size - useableStack; + ASSERT((requiredCapacity >= 0) && (requiredCapacity < size)); + + m_requiredCapacity = requiredCapacity; +} - Register* dst = &newCallFrame->uncheckedR(CallFrame::thisArgumentOffset()); - Register* end = dst - argumentCountIncludingThis; - for ( ; dst != end; --dst) - *dst = *(dst - delta); - end -= delta; - for ( ; dst != end; --dst) - *dst = jsUndefined(); +static CallFrame* getCallerInfo(JSGlobalData*, CallFrame*, int& lineNumber, unsigned& bytecodeOffset); - return newCallFrame; +// Returns the depth of the scope chain within a given call frame. +static int depth(CodeBlock* codeBlock, JSScope* sc) +{ + if (!codeBlock->needsFullScopeChain()) + return 0; + return sc->localDepth(); } JSValue eval(CallFrame* callFrame) @@ -164,7 +256,7 @@ JSValue eval(CallFrame* callFrame) JSValue thisValue = callerFrame->thisValue(); ASSERT(isValidThisObject(thisValue, callFrame)); Interpreter* interpreter = callFrame->globalData().interpreter; - return interpreter->execute(eval, callFrame, thisValue, callerScopeChain, callFrame->registers() - interpreter->stack().begin() + 1 + JSStack::CallFrameHeaderSize); + return interpreter->execute(eval, callFrame, thisValue, callerScopeChain); } CallFrame* loadVarargs(CallFrame* callFrame, JSStack* stack, JSValue thisValue, JSValue arguments, int firstFreeRegister) @@ -245,9 +337,10 @@ CallFrame* loadVarargs(CallFrame* callFrame, JSStack* stack, JSValue thisValue, return newCallFrame; } -Interpreter::Interpreter() +Interpreter::Interpreter(JSGlobalData& globalData) : m_sampleEntryDepth(0) - , m_reentryDepth(0) + , m_stack(globalData) + , m_errorHandlingModeReentry(0) #if !ASSERT_DISABLED , m_initialized(false) #endif @@ -681,26 +774,13 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV if (!unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock)) { if (Profiler* profiler = callFrame->globalData().enabledProfiler()) profiler->exceptionUnwind(callFrame); - callFrame->globalData().topCallFrame = callFrame; return 0; } } - callFrame->globalData().topCallFrame = callFrame; if (Profiler* profiler = callFrame->globalData().enabledProfiler()) profiler->exceptionUnwind(callFrame); - // Shrink the JS stack, in case stack overflow made it huge. - Register* highWaterMark = 0; - for (CallFrame* callerFrame = callFrame; callerFrame; callerFrame = callerFrame->callerFrame()->removeHostCallFrameFlag()) { - CodeBlock* codeBlock = callerFrame->codeBlock(); - if (!codeBlock) - continue; - Register* callerHighWaterMark = callerFrame->registers() + codeBlock->m_numCalleeRegisters; - highWaterMark = max(highWaterMark, callerHighWaterMark); - } - m_stack.shrink(highWaterMark); - // Unwind the scope chain within the exception handler's call frame. JSScope* scope = callFrame->scope(); int scopeDelta = 0; @@ -747,20 +827,24 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, J SamplingScope samplingScope(this); JSScope* scope = callFrame->scope(); + JSGlobalData& globalData = *scope->globalData(); + ASSERT(isValidThisObject(thisObj, callFrame)); - ASSERT(!scope->globalData()->exception); - ASSERT(!callFrame->globalData().isCollectorBusy()); - if (callFrame->globalData().isCollectorBusy()) + ASSERT(!globalData.exception); + ASSERT(!globalData.isCollectorBusy()); + if (globalData.isCollectorBusy()) CRASH(); StackStats::CheckPoint stackCheckPoint; - if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth) + const StackBounds& nativeStack = wtfThreadData().stack(); + StackPolicy policy(*this, nativeStack); + if (!nativeStack.isSafeToRecurse(policy.requiredCapacity())) return checkedReturn(throwStackOverflowError(callFrame)); // First check if the "program" is actually just a JSON object. If so, // we'll handle the JSON object here. Else, we'll handle real JS code // below at failedJSONP. - DynamicGlobalObjectScope globalObjectScope(*scope->globalData(), scope->globalObject()); + DynamicGlobalObjectScope globalObjectScope(globalData, scope->globalObject()); Vector<JSONPData> JSONPData; bool parseResult; const String programSource = program->source().toString(); @@ -869,20 +953,16 @@ failedJSONP: return checkedReturn(throwError(callFrame, error)); CodeBlock* codeBlock = &program->generatedBytecode(); - // Reserve stack space for this invocation: - Register* oldEnd = m_stack.end(); - Register* newEnd = oldEnd + codeBlock->numParameters() + JSStack::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters; - if (!m_stack.grow(newEnd)) - return checkedReturn(throwStackOverflowError(callFrame)); - // Push the call frame for this invocation: - CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->numParameters() + JSStack::CallFrameHeaderSize); ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'. - newCallFrame->init(codeBlock, 0, scope, CallFrame::noCaller(), codeBlock->numParameters(), 0); + CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0); + if (UNLIKELY(!newCallFrame)) + return checkedReturn(throwStackOverflowError(callFrame)); + + // Set the arguments for the callee: newCallFrame->setThisValue(thisObj); - TopCallFrameSetter topCallFrame(callFrame->globalData(), newCallFrame); - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) + if (Profiler* profiler = globalData.enabledProfiler()) profiler->willExecute(callFrame, program->sourceURL(), program->lineNo()); // Execute the code: @@ -890,213 +970,168 @@ failedJSONP: { SamplingTool::CallRecord callRecord(m_sampler.get()); - m_reentryDepth++; #if ENABLE(LLINT_C_LOOP) result = LLInt::CLoop::execute(newCallFrame, llint_program_prologue); #elif ENABLE(JIT) - result = program->generatedJITCode().execute(&m_stack, newCallFrame, scope->globalData()); + result = program->generatedJITCode().execute(&m_stack, newCallFrame, &globalData); #endif // ENABLE(JIT) - - m_reentryDepth--; } - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) + if (Profiler* profiler = globalData.enabledProfiler()) profiler->didExecute(callFrame, program->sourceURL(), program->lineNo()); - m_stack.shrink(oldEnd); + m_stack.popFrame(newCallFrame); return checkedReturn(result); } JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args) { + JSGlobalData& globalData = callFrame->globalData(); ASSERT(isValidThisObject(thisValue, callFrame)); ASSERT(!callFrame->hadException()); - ASSERT(!callFrame->globalData().isCollectorBusy()); - if (callFrame->globalData().isCollectorBusy()) + ASSERT(!globalData.isCollectorBusy()); + if (globalData.isCollectorBusy()) return jsNull(); StackStats::CheckPoint stackCheckPoint; - if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth) + const StackBounds& nativeStack = wtfThreadData().stack(); + StackPolicy policy(*this, nativeStack); + if (!nativeStack.isSafeToRecurse(policy.requiredCapacity())) return checkedReturn(throwStackOverflowError(callFrame)); - Register* oldEnd = m_stack.end(); - ASSERT(callFrame->frameExtent() <= oldEnd || callFrame == callFrame->scope()->globalObject()->globalExec()); - int argCount = 1 + args.size(); // implicit "this" parameter - size_t registerOffset = argCount + JSStack::CallFrameHeaderSize; - - CallFrame* newCallFrame = CallFrame::create(oldEnd + registerOffset); - if (!m_stack.grow(newCallFrame->registers())) - return checkedReturn(throwStackOverflowError(callFrame)); + bool isJSCall = (callType == CallTypeJS); + JSScope* scope; + CodeBlock* newCodeBlock; + size_t argsCount = 1 + args.size(); // implicit "this" parameter - newCallFrame->setThisValue(thisValue); - for (size_t i = 0; i < args.size(); ++i) - newCallFrame->setArgument(i, args.at(i)); - - if (callType == CallTypeJS) { - JSScope* callDataScope = callData.js.scope; - - DynamicGlobalObjectScope globalObjectScope(*callDataScope->globalData(), callDataScope->globalObject()); + if (isJSCall) + scope = callData.js.scope; + else { + ASSERT(callType == CallTypeHost); + scope = callFrame->scope(); + } + DynamicGlobalObjectScope globalObjectScope(globalData, scope->globalObject()); - JSObject* compileError = callData.js.functionExecutable->compileForCall(callFrame, callDataScope); + if (isJSCall) { + // Compile the callee: + JSObject* compileError = callData.js.functionExecutable->compileForCall(callFrame, scope); if (UNLIKELY(!!compileError)) { - m_stack.shrink(oldEnd); return checkedReturn(throwError(callFrame, compileError)); } + newCodeBlock = &callData.js.functionExecutable->generatedBytecodeForCall(); + ASSERT(!!newCodeBlock); + } else + newCodeBlock = 0; - CodeBlock* newCodeBlock = &callData.js.functionExecutable->generatedBytecodeForCall(); - newCallFrame = slideRegisterWindowForCall(newCodeBlock, &m_stack, newCallFrame, 0, argCount); - if (UNLIKELY(!newCallFrame)) { - m_stack.shrink(oldEnd); - return checkedReturn(throwStackOverflowError(callFrame)); - } - - newCallFrame->init(newCodeBlock, 0, callDataScope, callFrame->addHostCallFrameFlag(), argCount, function); + CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function); + if (UNLIKELY(!newCallFrame)) + return checkedReturn(throwStackOverflowError(callFrame)); - TopCallFrameSetter topCallFrame(callFrame->globalData(), newCallFrame); + // Set the arguments for the callee: + newCallFrame->setThisValue(thisValue); + for (size_t i = 0; i < args.size(); ++i) + newCallFrame->setArgument(i, args.at(i)); - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) - profiler->willExecute(callFrame, function); + if (Profiler* profiler = globalData.enabledProfiler()) + profiler->willExecute(callFrame, function); - JSValue result; - { - SamplingTool::CallRecord callRecord(m_sampler.get()); + JSValue result; + { + SamplingTool::CallRecord callRecord(m_sampler.get(), !isJSCall); - m_reentryDepth++; + // Execute the code: + if (isJSCall) { #if ENABLE(LLINT_C_LOOP) result = LLInt::CLoop::execute(newCallFrame, llint_function_for_call_prologue); #elif ENABLE(JIT) - result = callData.js.functionExecutable->generatedJITCodeForCall().execute(&m_stack, newCallFrame, callDataScope->globalData()); + result = callData.js.functionExecutable->generatedJITCodeForCall().execute(&m_stack, newCallFrame, &globalData); #endif // ENABLE(JIT) - - m_reentryDepth--; - } - - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) - profiler->didExecute(callFrame, function); - - m_stack.shrink(oldEnd); - return checkedReturn(result); - } - - ASSERT(callType == CallTypeHost); - JSScope* scope = callFrame->scope(); - newCallFrame->init(0, 0, scope, callFrame->addHostCallFrameFlag(), argCount, function); - - TopCallFrameSetter topCallFrame(callFrame->globalData(), newCallFrame); - - DynamicGlobalObjectScope globalObjectScope(*scope->globalData(), scope->globalObject()); - - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) - profiler->willExecute(callFrame, function); - - JSValue result; - { - SamplingTool::HostCallRecord callRecord(m_sampler.get()); - result = JSValue::decode(callData.native.function(newCallFrame)); + } else + result = JSValue::decode(callData.native.function(newCallFrame)); } - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) + if (Profiler* profiler = globalData.enabledProfiler()) profiler->didExecute(callFrame, function); - m_stack.shrink(oldEnd); + m_stack.popFrame(newCallFrame); return checkedReturn(result); } JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* constructor, ConstructType constructType, const ConstructData& constructData, const ArgList& args) { + JSGlobalData& globalData = callFrame->globalData(); ASSERT(!callFrame->hadException()); - ASSERT(!callFrame->globalData().isCollectorBusy()); + ASSERT(!globalData.isCollectorBusy()); // We throw in this case because we have to return something "valid" but we're // already in an invalid state. - if (callFrame->globalData().isCollectorBusy()) + if (globalData.isCollectorBusy()) return checkedReturn(throwStackOverflowError(callFrame)); StackStats::CheckPoint stackCheckPoint; - if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth) - return checkedReturn(throwStackOverflowError(callFrame)); - - Register* oldEnd = m_stack.end(); - int argCount = 1 + args.size(); // implicit "this" parameter - size_t registerOffset = argCount + JSStack::CallFrameHeaderSize; - - if (!m_stack.grow(oldEnd + registerOffset)) + const StackBounds& nativeStack = wtfThreadData().stack(); + StackPolicy policy(*this, nativeStack); + if (!nativeStack.isSafeToRecurse(policy.requiredCapacity())) return checkedReturn(throwStackOverflowError(callFrame)); - CallFrame* newCallFrame = CallFrame::create(oldEnd + registerOffset); - newCallFrame->setThisValue(jsUndefined()); - for (size_t i = 0; i < args.size(); ++i) - newCallFrame->setArgument(i, args.at(i)); + bool isJSConstruct = (constructType == ConstructTypeJS); + JSScope* scope; + CodeBlock* newCodeBlock; + size_t argsCount = 1 + args.size(); // implicit "this" parameter - if (constructType == ConstructTypeJS) { - JSScope* constructDataScope = constructData.js.scope; + if (isJSConstruct) + scope = constructData.js.scope; + else { + ASSERT(constructType == ConstructTypeHost); + scope = callFrame->scope(); + } - DynamicGlobalObjectScope globalObjectScope(*constructDataScope->globalData(), constructDataScope->globalObject()); + DynamicGlobalObjectScope globalObjectScope(globalData, scope->globalObject()); - JSObject* compileError = constructData.js.functionExecutable->compileForConstruct(callFrame, constructDataScope); + if (isJSConstruct) { + // Compile the callee: + JSObject* compileError = constructData.js.functionExecutable->compileForConstruct(callFrame, scope); if (UNLIKELY(!!compileError)) { - m_stack.shrink(oldEnd); return checkedReturn(throwError(callFrame, compileError)); } + newCodeBlock = &constructData.js.functionExecutable->generatedBytecodeForConstruct(); + ASSERT(!!newCodeBlock); + } else + newCodeBlock = 0; - CodeBlock* newCodeBlock = &constructData.js.functionExecutable->generatedBytecodeForConstruct(); - newCallFrame = slideRegisterWindowForCall(newCodeBlock, &m_stack, newCallFrame, 0, argCount); - if (UNLIKELY(!newCallFrame)) { - m_stack.shrink(oldEnd); - return checkedReturn(throwStackOverflowError(callFrame)); - } - - newCallFrame->init(newCodeBlock, 0, constructDataScope, callFrame->addHostCallFrameFlag(), argCount, constructor); + CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, constructor); + if (UNLIKELY(!newCallFrame)) + return checkedReturn(throwStackOverflowError(callFrame)); - TopCallFrameSetter topCallFrame(callFrame->globalData(), newCallFrame); + // Set the arguments for the callee: + newCallFrame->setThisValue(jsUndefined()); + for (size_t i = 0; i < args.size(); ++i) + newCallFrame->setArgument(i, args.at(i)); - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) - profiler->willExecute(callFrame, constructor); + if (Profiler* profiler = globalData.enabledProfiler()) + profiler->willExecute(callFrame, constructor); - JSValue result; - { - SamplingTool::CallRecord callRecord(m_sampler.get()); + JSValue result; + { + SamplingTool::CallRecord callRecord(m_sampler.get(), !isJSConstruct); - m_reentryDepth++; + // Execute the code. + if (isJSConstruct) { #if ENABLE(LLINT_C_LOOP) result = LLInt::CLoop::execute(newCallFrame, llint_function_for_construct_prologue); #elif ENABLE(JIT) - result = constructData.js.functionExecutable->generatedJITCodeForConstruct().execute(&m_stack, newCallFrame, constructDataScope->globalData()); + result = constructData.js.functionExecutable->generatedJITCodeForConstruct().execute(&m_stack, newCallFrame, &globalData); #endif // ENABLE(JIT) - m_reentryDepth--; + } else { + result = JSValue::decode(constructData.native.function(newCallFrame)); } - - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) - profiler->didExecute(callFrame, constructor); - - m_stack.shrink(oldEnd); - if (callFrame->hadException()) - return 0; - ASSERT(result.isObject()); - return checkedReturn(asObject(result)); - } - - ASSERT(constructType == ConstructTypeHost); - JSScope* scope = callFrame->scope(); - newCallFrame->init(0, 0, scope, callFrame->addHostCallFrameFlag(), argCount, constructor); - - TopCallFrameSetter topCallFrame(callFrame->globalData(), newCallFrame); - - DynamicGlobalObjectScope globalObjectScope(*scope->globalData(), scope->globalObject()); - - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) - profiler->willExecute(callFrame, constructor); - - JSValue result; - { - SamplingTool::HostCallRecord callRecord(m_sampler.get()); - result = JSValue::decode(constructData.native.function(newCallFrame)); } - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) + if (Profiler* profiler = globalData.enabledProfiler()) profiler->didExecute(callFrame, constructor); - m_stack.shrink(oldEnd); + m_stack.popFrame(newCallFrame); + if (callFrame->hadException()) return 0; ASSERT(result.isObject()); @@ -1105,101 +1140,118 @@ JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* construc CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope) { - ASSERT(!scope->globalData()->exception); + JSGlobalData& globalData = *scope->globalData(); + ASSERT(!globalData.exception); - if (callFrame->globalData().isCollectorBusy()) + if (globalData.isCollectorBusy()) return CallFrameClosure(); StackStats::CheckPoint stackCheckPoint; - if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth) { - throwStackOverflowError(callFrame); - return CallFrameClosure(); - } - - Register* oldEnd = m_stack.end(); - size_t registerOffset = argumentCountIncludingThis + JSStack::CallFrameHeaderSize; - - CallFrame* newCallFrame = CallFrame::create(oldEnd + registerOffset); - if (!m_stack.grow(newCallFrame->registers())) { + const StackBounds& nativeStack = wtfThreadData().stack(); + StackPolicy policy(*this, nativeStack); + if (!nativeStack.isSafeToRecurse(policy.requiredCapacity())) { throwStackOverflowError(callFrame); return CallFrameClosure(); } + // Compile the callee: JSObject* error = functionExecutable->compileForCall(callFrame, scope); if (error) { throwError(callFrame, error); - m_stack.shrink(oldEnd); return CallFrameClosure(); } - CodeBlock* codeBlock = &functionExecutable->generatedBytecodeForCall(); + CodeBlock* newCodeBlock = &functionExecutable->generatedBytecodeForCall(); - newCallFrame = slideRegisterWindowForCall(codeBlock, &m_stack, newCallFrame, 0, argumentCountIncludingThis); + size_t argsCount = argumentCountIncludingThis; + + CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function); if (UNLIKELY(!newCallFrame)) { throwStackOverflowError(callFrame); - m_stack.shrink(oldEnd); return CallFrameClosure(); } - newCallFrame->init(codeBlock, 0, scope, callFrame->addHostCallFrameFlag(), argumentCountIncludingThis, function); - scope->globalData()->topCallFrame = newCallFrame; - CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, scope->globalData(), oldEnd, scope, codeBlock->numParameters(), argumentCountIncludingThis }; + + if (UNLIKELY(!newCallFrame)) { + throwStackOverflowError(callFrame); + return CallFrameClosure(); + } + + // Return the successful closure: + CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, &globalData, scope, newCodeBlock->numParameters(), argumentCountIncludingThis }; return result; } JSValue Interpreter::execute(CallFrameClosure& closure) { + JSGlobalData& globalData = *closure.globalData; SamplingScope samplingScope(this); - ASSERT(!closure.oldCallFrame->globalData().isCollectorBusy()); - if (closure.oldCallFrame->globalData().isCollectorBusy()) + ASSERT(!globalData.isCollectorBusy()); + if (globalData.isCollectorBusy()) return jsNull(); StackStats::CheckPoint stackCheckPoint; + m_stack.validateFence(closure.newCallFrame, "BEFORE"); closure.resetCallFrame(); - if (Profiler* profiler = closure.oldCallFrame->globalData().enabledProfiler()) + m_stack.validateFence(closure.newCallFrame, "STEP 1"); + + if (Profiler* profiler = globalData.enabledProfiler()) profiler->willExecute(closure.oldCallFrame, closure.function); - TopCallFrameSetter topCallFrame(*closure.globalData, closure.newCallFrame); + // The code execution below may push more frames and point the topCallFrame + // to those newer frames, or it may pop to the top frame to the caller of + // the current repeat frame, or it may leave the top frame pointing to the + // current repeat frame. + // + // Hence, we need to preserve the topCallFrame here ourselves before + // repeating this call on a second callback function. + TopCallFrameSetter topCallFrame(globalData, closure.newCallFrame); + + // Execute the code: JSValue result; { SamplingTool::CallRecord callRecord(m_sampler.get()); - m_reentryDepth++; #if ENABLE(LLINT_C_LOOP) result = LLInt::CLoop::execute(closure.newCallFrame, llint_function_for_call_prologue); #elif ENABLE(JIT) - result = closure.functionExecutable->generatedJITCodeForCall().execute(&m_stack, closure.newCallFrame, closure.globalData); + result = closure.functionExecutable->generatedJITCodeForCall().execute(&m_stack, closure.newCallFrame, &globalData); #endif // ENABLE(JIT) - m_reentryDepth--; } - if (Profiler* profiler = closure.oldCallFrame->globalData().enabledProfiler()) + if (Profiler* profiler = globalData.enabledProfiler()) profiler->didExecute(closure.oldCallFrame, closure.function); + + m_stack.validateFence(closure.newCallFrame, "AFTER"); return checkedReturn(result); } void Interpreter::endRepeatCall(CallFrameClosure& closure) { - closure.globalData->topCallFrame = closure.oldCallFrame; - m_stack.shrink(closure.oldEnd); + m_stack.popFrame(closure.newCallFrame); } -JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope, int globalRegisterOffset) +JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope) { + JSGlobalData& globalData = *scope->globalData(); SamplingScope samplingScope(this); + ASSERT(scope->globalData() == &callFrame->globalData()); ASSERT(isValidThisObject(thisValue, callFrame)); - ASSERT(!scope->globalData()->exception); - ASSERT(!callFrame->globalData().isCollectorBusy()); - if (callFrame->globalData().isCollectorBusy()) + ASSERT(!globalData.exception); + ASSERT(!globalData.isCollectorBusy()); + if (globalData.isCollectorBusy()) return jsNull(); - DynamicGlobalObjectScope globalObjectScope(*scope->globalData(), scope->globalObject()); + DynamicGlobalObjectScope globalObjectScope(globalData, scope->globalObject()); StackStats::CheckPoint stackCheckPoint; - if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth) + const StackBounds& nativeStack = wtfThreadData().stack(); + StackPolicy policy(*this, nativeStack); + if (!nativeStack.isSafeToRecurse(policy.requiredCapacity())) return checkedReturn(throwStackOverflowError(callFrame)); + // Compile the callee: JSObject* compileError = eval->compile(callFrame, scope); if (UNLIKELY(!!compileError)) return checkedReturn(throwError(callFrame, compileError)); @@ -1222,7 +1274,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue variableObject = scope; } // Scope for BatchedTransitionOptimizer - BatchedTransitionOptimizer optimizer(callFrame->globalData(), variableObject); + BatchedTransitionOptimizer optimizer(globalData, variableObject); for (unsigned i = 0; i < numVariables; ++i) { const Identifier& ident = codeBlock->variable(i); @@ -1239,40 +1291,34 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue } } - Register* oldEnd = m_stack.end(); - Register* newEnd = m_stack.begin() + globalRegisterOffset + codeBlock->m_numCalleeRegisters; - if (!m_stack.grow(newEnd)) + // Push the frame: + ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'. + CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0); + if (UNLIKELY(!newCallFrame)) return checkedReturn(throwStackOverflowError(callFrame)); - CallFrame* newCallFrame = CallFrame::create(m_stack.begin() + globalRegisterOffset); - - ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'. - newCallFrame->init(codeBlock, 0, scope, callFrame->addHostCallFrameFlag(), codeBlock->numParameters(), 0); + // Set the arguments for the callee: newCallFrame->setThisValue(thisValue); - TopCallFrameSetter topCallFrame(callFrame->globalData(), newCallFrame); - - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) + if (Profiler* profiler = globalData.enabledProfiler()) profiler->willExecute(callFrame, eval->sourceURL(), eval->lineNo()); + // Execute the code: JSValue result; { SamplingTool::CallRecord callRecord(m_sampler.get()); - - m_reentryDepth++; #if ENABLE(LLINT_C_LOOP) result = LLInt::CLoop::execute(newCallFrame, llint_eval_prologue); #elif ENABLE(JIT) - result = eval->generatedJITCode().execute(&m_stack, newCallFrame, scope->globalData()); + result = eval->generatedJITCode().execute(&m_stack, newCallFrame, &globalData); #endif // ENABLE(JIT) - m_reentryDepth--; } - if (Profiler* profiler = callFrame->globalData().enabledProfiler()) + if (Profiler* profiler = globalData.enabledProfiler()) profiler->didExecute(callFrame, eval->sourceURL(), eval->lineNo()); - m_stack.shrink(oldEnd); + m_stack.popFrame(newCallFrame); return checkedReturn(result); } diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h index 11c6f078a..c3bca1ad7 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.h +++ b/Source/JavaScriptCore/interpreter/Interpreter.h @@ -48,6 +48,7 @@ namespace JSC { class EvalExecutable; class ExecutableBase; class FunctionExecutable; + class JSGlobalData; class JSGlobalObject; class LLIntOffsetsExtractor; class ProgramExecutable; @@ -170,21 +171,22 @@ namespace JSC { } }; - // We use a smaller reentrancy limit on iPhone because of the high amount of - // stack space required on the web thread. -#if PLATFORM(IOS) - enum { MaxLargeThreadReentryDepth = 64, MaxSmallThreadReentryDepth = 16 }; -#else - enum { MaxLargeThreadReentryDepth = 256, MaxSmallThreadReentryDepth = 16 }; -#endif // PLATFORM(IOS) - class Interpreter { WTF_MAKE_FAST_ALLOCATED; friend class CachedCall; friend class LLIntOffsetsExtractor; friend class JIT; + public: - Interpreter(); + class ErrorHandlingMode { + public: + JS_EXPORT_PRIVATE ErrorHandlingMode(ExecState*); + JS_EXPORT_PRIVATE ~ErrorHandlingMode(); + private: + Interpreter& m_interpreter; + }; + + Interpreter(JSGlobalData &); ~Interpreter(); void initialize(bool canUseJIT); @@ -218,7 +220,6 @@ namespace JSC { JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&); JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&); JSValue execute(EvalExecutable*, CallFrame*, JSValue thisValue, JSScope*); - JSValue execute(EvalExecutable*, CallFrame*, JSValue thisValue, JSScope*, int globalRegisterOffset); JSValue retrieveArgumentsFromVMCode(CallFrame*, JSFunction*) const; JSValue retrieveCallerFromVMCode(CallFrame*, JSFunction*) const; @@ -241,6 +242,16 @@ namespace JSC { JS_EXPORT_PRIVATE void dumpCallFrame(CallFrame*); private: + class StackPolicy { + public: + StackPolicy(Interpreter&, const StackBounds&); + inline size_t requiredCapacity() { return m_requiredCapacity; } + + private: + Interpreter& m_interpreter; + size_t m_requiredCapacity; + }; + enum ExecutionFlag { Normal, InitializeAndReturn }; CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*); @@ -249,8 +260,6 @@ namespace JSC { NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValue, unsigned& bytecodeOffset, CodeBlock*&); - static ALWAYS_INLINE CallFrame* slideRegisterWindowForCall(CodeBlock*, JSStack*, CallFrame*, size_t registerOffset, int argc); - static CallFrame* findFunctionCallFrameFromVMCode(CallFrame*, JSFunction*); void dumpRegisters(CallFrame*); @@ -261,9 +270,8 @@ namespace JSC { int m_sampleEntryDepth; OwnPtr<SamplingTool> m_sampler; - int m_reentryDepth; - JSStack m_stack; + int m_errorHandlingModeReentry; #if ENABLE(COMPUTED_GOTO_OPCODES) && ENABLE(LLINT) Opcode* m_opcodeTable; // Maps OpcodeID => Opcode for compiling @@ -281,11 +289,6 @@ namespace JSC { return !thisValue.isObject() || thisValue.toThisObject(exec) == thisValue; } - inline JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope) - { - return execute(eval, callFrame, thisValue, scope, m_stack.size() + 1 + JSStack::CallFrameHeaderSize); - } - JSValue eval(CallFrame*); CallFrame* loadVarargs(CallFrame*, JSStack*, JSValue thisValue, JSValue arguments, int firstFreeRegister); diff --git a/Source/JavaScriptCore/interpreter/JSStack.cpp b/Source/JavaScriptCore/interpreter/JSStack.cpp index 5dd708a48..f5f9e3763 100644 --- a/Source/JavaScriptCore/interpreter/JSStack.cpp +++ b/Source/JavaScriptCore/interpreter/JSStack.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "JSStack.h" +#include "JSStackInlines.h" #include "ConservativeRoots.h" #include "Interpreter.h" @@ -41,7 +42,22 @@ static Mutex& stackStatisticsMutex() DEFINE_STATIC_LOCAL(Mutex, staticMutex, ()); return staticMutex; } - + +JSStack::JSStack(JSGlobalData& globalData, size_t capacity) + : m_end(0) + , m_topCallFrame(globalData.topCallFrame) +{ + ASSERT(capacity && isPageAligned(capacity)); + + m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages); + m_end = static_cast<Register*>(m_reservation.base()); + m_commitEnd = static_cast<Register*>(m_reservation.base()); + + disableErrorStackReserve(); + + m_topCallFrame = 0; +} + JSStack::~JSStack() { void* base = m_reservation.base(); @@ -52,15 +68,22 @@ JSStack::~JSStack() bool JSStack::growSlowCase(Register* newEnd) { + // If we have already committed enough memory to satisfy this request, + // just update the end pointer and return. if (newEnd <= m_commitEnd) { m_end = newEnd; return true; } + // Compute the chunk size of additional memory to commit, and see if we + // have it is still within our budget. If not, we'll fail to grow and + // return false. long delta = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize); - if (reinterpret_cast<char*>(m_commitEnd) + delta > static_cast<char*>(m_reservation.base()) + m_reservation.size()) + if (reinterpret_cast<char*>(m_commitEnd) + delta > reinterpret_cast<char*>(m_useableEnd)) return false; + // Otherwise, the growth is still within our budget. Go ahead and commit + // it and return true. m_reservation.commit(m_commitEnd, delta); addToCommittedByteCount(delta); m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) + delta); @@ -70,12 +93,12 @@ bool JSStack::growSlowCase(Register* newEnd) void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots) { - conservativeRoots.add(begin(), end()); + conservativeRoots.add(begin(), getTopOfStack()); } void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots, JITStubRoutineSet& jitStubRoutines, DFGCodeBlocks& dfgCodeBlocks) { - conservativeRoots.add(begin(), end(), jitStubRoutines, dfgCodeBlocks); + conservativeRoots.add(begin(), getTopOfStack(), jitStubRoutines, dfgCodeBlocks); } void JSStack::releaseExcessCapacity() @@ -104,4 +127,25 @@ void JSStack::addToCommittedByteCount(long byteCount) committedBytesCount += byteCount; } +void JSStack::enableErrorStackReserve() +{ + m_useableEnd = reservationEnd(); +} + +void JSStack::disableErrorStackReserve() +{ + char* useableEnd = reinterpret_cast<char*>(reservationEnd()) - commitSize; + m_useableEnd = reinterpret_cast<Register*>(useableEnd); + + // By the time we get here, we are guaranteed to be destructing the last + // Interpreter::ErrorHandlingMode that enabled this reserve in the first + // place. That means the stack space beyond m_useableEnd before we + // enabled the reserve was not previously in use. Hence, it is safe to + // shrink back to that m_useableEnd. + if (m_end > m_useableEnd) { + ASSERT(m_topCallFrame->frameExtent() <= m_useableEnd); + shrink(m_useableEnd); + } +} + } // namespace JSC diff --git a/Source/JavaScriptCore/interpreter/JSStack.h b/Source/JavaScriptCore/interpreter/JSStack.h index 86fa40be7..3beb59ebf 100644 --- a/Source/JavaScriptCore/interpreter/JSStack.h +++ b/Source/JavaScriptCore/interpreter/JSStack.h @@ -35,11 +35,17 @@ #include <wtf/PageReservation.h> #include <wtf/VMTags.h> +#if !defined(NDEBUG) && !defined(ENABLE_DEBUG_JSSTACK) +#define ENABLE_DEBUG_JSSTACK 1 +#endif + namespace JSC { class ConservativeRoots; class DFGCodeBlocks; + class ExecState; class JITStubRoutineSet; + class JSGlobalData; class LLIntOffsetsExtractor; class JSStack { @@ -61,7 +67,7 @@ namespace JSC { // Allow 8k of excess registers before we start trying to reap the stack static const ptrdiff_t maxExcessCapacity = 8 * 1024; - JSStack(size_t capacity = defaultCapacity); + JSStack(JSGlobalData&, size_t capacity = defaultCapacity); ~JSStack(); void gatherConservativeRoots(ConservativeRoots&); @@ -72,7 +78,6 @@ namespace JSC { size_t size() const { return end() - begin(); } bool grow(Register*); - void shrink(Register*); static size_t committedByteCount(); static void initializeThreading(); @@ -82,26 +87,55 @@ namespace JSC { return &m_end; } + Register* getTopOfFrame(CallFrame*); + Register* getStartOfFrame(CallFrame*); + Register* getTopOfStack(); + + CallFrame* pushFrame(CallFrame* callerFrame, class CodeBlock*, + JSScope*, int argsCount, JSObject* callee); + + void popFrame(CallFrame*); + + void enableErrorStackReserve(); + void disableErrorStackReserve(); + +#if ENABLE(DEBUG_JSSTACK) + void installFence(CallFrame*, const char *function = "", int lineNo = 0); + void validateFence(CallFrame*, const char *function = "", int lineNo = 0); + static const int FenceSize = 4; +#else // !ENABLE(DEBUG_JSSTACK) + void installFence(CallFrame*, const char* = "", int = 0) { } + void validateFence(CallFrame*, const char* = "", int = 0) { } +#endif // !ENABLE(DEBUG_JSSTACK) + private: - friend class LLIntOffsetsExtractor; + Register* reservationEnd() const + { + char* base = static_cast<char*>(m_reservation.base()); + char* reservationEnd = base + m_reservation.size(); + return reinterpret_cast<Register*>(reservationEnd); + } + +#if ENABLE(DEBUG_JSSTACK) + static JSValue generateFenceValue(size_t argIndex); + void installTrapsAfterFrame(CallFrame*); +#else + void installTrapsAfterFrame(CallFrame*) { } +#endif bool growSlowCase(Register*); + void shrink(Register*); void releaseExcessCapacity(); void addToCommittedByteCount(long); + Register* m_end; Register* m_commitEnd; + Register* m_useableEnd; PageReservation m_reservation; - }; + CallFrame*& m_topCallFrame; - inline JSStack::JSStack(size_t capacity) - : m_end(0) - { - ASSERT(capacity && isPageAligned(capacity)); - - m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages); - m_end = static_cast<Register*>(m_reservation.base()); - m_commitEnd = static_cast<Register*>(m_reservation.base()); - } + friend class LLIntOffsetsExtractor; + }; inline void JSStack::shrink(Register* newEnd) { diff --git a/Source/JavaScriptCore/interpreter/JSStackInlines.h b/Source/JavaScriptCore/interpreter/JSStackInlines.h new file mode 100644 index 000000000..25b7dcf5a --- /dev/null +++ b/Source/JavaScriptCore/interpreter/JSStackInlines.h @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSStackInlines_h +#define JSStackInlines_h + +#include "CallFrame.h" +#include "CodeBlock.h" +#include "JSStack.h" +#include <wtf/UnusedParam.h> + +namespace JSC { + +inline Register* JSStack::getTopOfFrame(CallFrame* frame) +{ + if (UNLIKELY(!frame)) + return begin(); + return frame->frameExtent(); +} + +inline Register* JSStack::getTopOfStack() +{ + return getTopOfFrame(m_topCallFrame); +} + +inline Register* JSStack::getStartOfFrame(CallFrame* frame) +{ + CallFrame* callerFrame = frame->callerFrameNoFlags(); + return getTopOfFrame(callerFrame); +} + +inline CallFrame* JSStack::pushFrame(CallFrame* callerFrame, + class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee) +{ + ASSERT(!!scope); + Register* oldEnd = getTopOfStack(); + + // Ensure that we have enough space for the parameters: + size_t paddedArgsCount = argsCount; + if (codeBlock) { + size_t numParameters = codeBlock->numParameters(); + if (paddedArgsCount < numParameters) + paddedArgsCount = numParameters; + } + + Register* newCallFrameSlot = oldEnd + paddedArgsCount + JSStack::CallFrameHeaderSize; +#if ENABLE(DEBUG_JSSTACK) + newCallFrameSlot += JSStack::FenceSize; +#endif + Register* newEnd = newCallFrameSlot; + if (!!codeBlock) + newEnd += codeBlock->m_numCalleeRegisters; + + // Ensure that we have the needed stack capacity to push the new frame: + if (!grow(newEnd)) + return 0; + + // Compute the address of the new frame for this invocation: + CallFrame* newCallFrame = CallFrame::create(newCallFrameSlot); + ASSERT(!!newCallFrame); + + // The caller frame should always be the real previous frame on the stack, + // and not a potential GlobalExec that was passed in. Point callerFrame to + // the top frame on the stack. + callerFrame = m_topCallFrame; + + // Initialize the frame header: + newCallFrame->init(codeBlock, 0, scope, + callerFrame->addHostCallFrameFlag(), argsCount, callee); + + ASSERT(!!newCallFrame->scope()); + + // Pad additional args if needed: + // Note: we need to subtract 1 from argsCount and paddedArgsCount to + // exclude the this pointer. + for (size_t i = argsCount-1; i < paddedArgsCount-1; ++i) + newCallFrame->setArgument(i, jsUndefined()); + + installFence(newCallFrame, __FUNCTION__, __LINE__); + validateFence(newCallFrame, __FUNCTION__, __LINE__); + installTrapsAfterFrame(newCallFrame); + + // Push the new frame: + m_topCallFrame = newCallFrame; + + return newCallFrame; +} + +inline void JSStack::popFrame(CallFrame* frame) +{ + validateFence(frame, __FUNCTION__, __LINE__); + CallFrame* callerFrame = frame->callerFrameNoFlags(); + + // Pop to the caller: + m_topCallFrame = callerFrame; + + // If we are popping the very first frame from the stack i.e. no more + // frames before this, then we can now safely shrink the stack. In + // this case, we're shrinking all the way to the beginning since there + // are no more frames on the stack. + if (!callerFrame) + shrink(begin()); + + installTrapsAfterFrame(callerFrame); +} + + +#if ENABLE(DEBUG_JSSTACK) +inline JSValue JSStack::generateFenceValue(size_t argIndex) +{ + unsigned fenceBits = 0xfacebad0 | ((argIndex+1) & 0xf); + JSValue fenceValue = JSValue(fenceBits); + return fenceValue; +} + +// The JSStack fences mechanism works as follows: +// 1. A fence is a number (JSStack::FenceSize) of JSValues that are initialized +// with values generated by JSStack::generateFenceValue(). +// 2. When pushFrame() is called, the fence is installed after the max extent +// of the previous topCallFrame and the last arg of the new frame: +// +// | ... | +// |--------------------------------------| +// | Frame Header of previous frame | +// |--------------------------------------| +// topCallFrame --> | | +// | Locals of previous frame | +// |--------------------------------------| +// | *** the Fence *** | +// |--------------------------------------| +// | Args of new frame | +// |--------------------------------------| +// | Frame Header of new frame | +// |--------------------------------------| +// frame --> | Locals of new frame | +// | | +// +// 3. In popFrame() and elsewhere, we can call JSStack::validateFence() to +// assert that the fence contains the values we expect. + +inline void JSStack::installFence(CallFrame* frame, const char *function, int lineNo) +{ + UNUSED_PARAM(function); + UNUSED_PARAM(lineNo); + Register* startOfFrame = getStartOfFrame(frame); + + // The last argIndex is at: + size_t maxIndex = frame->argIndexForRegister(startOfFrame) + 1; + size_t startIndex = maxIndex - FenceSize; + for (size_t i = startIndex; i < maxIndex; ++i) { + JSValue fenceValue = generateFenceValue(i); + frame->setArgument(i, fenceValue); + } +} + +inline void JSStack::validateFence(CallFrame* frame, const char *function, int lineNo) +{ + UNUSED_PARAM(function); + UNUSED_PARAM(lineNo); + ASSERT(!!frame->scope()); + Register* startOfFrame = getStartOfFrame(frame); + size_t maxIndex = frame->argIndexForRegister(startOfFrame) + 1; + size_t startIndex = maxIndex - FenceSize; + for (size_t i = startIndex; i < maxIndex; ++i) { + JSValue fenceValue = generateFenceValue(i); + JSValue actualValue = frame->getArgumentUnsafe(i); + ASSERT(fenceValue == actualValue); + } +} + +// When debugging the JSStack, we install bad values after the extent of the +// topCallFrame at the end of pushFrame() and popFrame(). The intention is +// to trigger crashes in the event that memory in this supposedly unused +// region is read and consumed without proper initialization. After the trap +// words are installed, the stack looks like this: +// +// | ... | +// |-----------------------------| +// | Frame Header of frame | +// |-----------------------------| +// topCallFrame --> | | +// | Locals of frame | +// |-----------------------------| +// | *** Trap words *** | +// |-----------------------------| +// | Unused space ... | +// | ... | + +inline void JSStack::installTrapsAfterFrame(CallFrame* frame) +{ + Register* topOfFrame = getTopOfFrame(frame); + const int sizeOfTrap = 64; + int32_t* startOfTrap = reinterpret_cast<int32_t*>(topOfFrame); + int32_t* endOfTrap = startOfTrap + sizeOfTrap; + int32_t* endOfCommitedMemory = reinterpret_cast<int32_t*>(m_commitEnd); + + // Make sure we're not exceeding the amount of available memory to write to: + if (endOfTrap > endOfCommitedMemory) + endOfTrap = endOfCommitedMemory; + + // Lay the traps: + int32_t* p = startOfTrap; + while (p < endOfTrap) + *p++ = 0xabadcafe; // A bad word to trigger a crash if deref'ed. +} +#endif // ENABLE(DEBUG_JSSTACK) + +} // namespace JSC + +#endif // JSStackInlines_h diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index a16b328ad..ba8c76cfb 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -2142,6 +2142,23 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_func) inline void* jitCompileFor(CallFrame* callFrame, CodeSpecializationKind kind) { + // This function is called by cti_op_call_jitCompile() and + // cti_op_construct_jitCompile() JIT glue trampolines to compile the + // callee function that we want to call. Both cti glue trampolines are + // called by JIT'ed code which has pushed a frame and initialized most of + // the frame content except for the codeBlock. + // + // Normally, the prologue of the callee is supposed to set the frame's cb + // pointer to the cb of the callee. But in this case, the callee code does + // not exist yet until it is compiled below. The compilation process will + // allocate memory which may trigger a GC. The GC, in turn, will scan the + // JSStack, and will expect the frame's cb to either be valid or 0. If + // we don't initialize it, the GC will be accessing invalid memory and may + // crash. + // + // Hence, we should nullify it here before proceeding with the compilation. + callFrame->setCodeBlock(0); + JSFunction* function = jsCast<JSFunction*>(callFrame->callee()); ASSERT(!function->isHostFunction()); FunctionExecutable* executable = function->jsExecutable(); @@ -2222,6 +2239,23 @@ inline void* lazyLinkFor(CallFrame* callFrame, CodeSpecializationKind kind) CodeBlock* codeBlock = 0; CallLinkInfo* callLinkInfo = &callFrame->callerFrame()->codeBlock()->getCallLinkInfo(callFrame->returnPC()); + // This function is called by cti_vm_lazyLinkCall() and + // cti_lazyLinkConstruct JIT glue trampolines to link the callee function + // that we want to call. Both cti glue trampolines are called by JIT'ed + // code which has pushed a frame and initialized most of the frame content + // except for the codeBlock. + // + // Normally, the prologue of the callee is supposed to set the frame's cb + // field to the cb of the callee. But in this case, the callee may not + // exist yet, and if not, it will be generated in the compilation below. + // The compilation will allocate memory which may trigger a GC. The GC, in + // turn, will scan the JSStack, and will expect the frame's cb to be valid + // or 0. If we don't initialize it, the GC will be accessing invalid + // memory and may crash. + // + // Hence, we should nullify it here before proceeding with the compilation. + callFrame->setCodeBlock(0); + if (executable->isHostFunction()) codePtr = executable->generatedJITCodeFor(kind).addressForCall(); else { @@ -2298,7 +2332,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction) EncodedJSValue returnValue; { - SamplingTool::HostCallRecord callRecord(CTI_SAMPLER); + SamplingTool::CallRecord callRecord(CTI_SAMPLER, true); returnValue = callData.native.function(callFrame); } @@ -2424,7 +2458,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct) EncodedJSValue returnValue; { - SamplingTool::HostCallRecord callRecord(CTI_SAMPLER); + SamplingTool::CallRecord callRecord(CTI_SAMPLER, true); returnValue = constructData.native.function(callFrame); } diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index 06dad2701..b8cf49da6 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -746,7 +746,7 @@ int jscmain(int argc, char** argv) // Note that the options parsing can affect JSGlobalData creation, and thus // comes first. CommandLine options(argc, argv); - RefPtr<JSGlobalData> globalData = JSGlobalData::create(ThreadStackTypeLarge, LargeHeap); + RefPtr<JSGlobalData> globalData = JSGlobalData::create(LargeHeap); JSLockHolder lock(globalData.get()); int result; diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp index 0f734d3a1..049a51939 100644 --- a/Source/JavaScriptCore/parser/Parser.cpp +++ b/Source/JavaScriptCore/parser/Parser.cpp @@ -39,6 +39,7 @@ #define failWithToken(tok) do { if (!m_error) updateErrorMessage(tok); return 0; } while (0) #define failWithMessage(msg) do { if (!m_error) updateErrorMessage(msg); return 0; } while (0) #define failWithNameAndMessage(before, name, after) do { if (!m_error) updateErrorWithNameAndMessage(before, name, after); return 0; } while (0) +#define failWithStackOverflow() do { m_error = true; m_hasStackOverflow = true; return 0; } while (0) #define failIfFalse(cond) do { if (!(cond)) fail(); } while (0) #define failIfFalseWithMessage(cond, msg) do { if (!(cond)) failWithMessage(msg); } while (0) #define failIfFalseWithNameAndMessage(cond, before, name, msg) do { if (!(cond)) failWithNameAndMessage(before, name, msg); } while (0) @@ -54,7 +55,7 @@ #define consumeOrFail(tokenType) do { if (!consume(tokenType)) failWithToken(tokenType); } while (0) #define consumeOrFailWithFlags(tokenType, flags) do { if (!consume(tokenType, flags)) failWithToken(tokenType); } while (0) #define matchOrFail(tokenType) do { if (!match(tokenType)) failWithToken(tokenType); } while (0) -#define failIfStackOverflow() do { failIfFalseWithMessage(canRecurse(), "Code nested too deeply."); } while (0) +#define failIfStackOverflow() do { if (!canRecurse()) failWithStackOverflow(); } while (0) using namespace std; @@ -65,6 +66,7 @@ Parser<LexerType>::Parser(JSGlobalData* globalData, const SourceCode& source, Fu : m_globalData(globalData) , m_source(&source) , m_stack(wtfThreadData().stack()) + , m_hasStackOverflow(false) , m_error(false) , m_errorMessage("Parse error") , m_allowsIn(true) diff --git a/Source/JavaScriptCore/parser/Parser.h b/Source/JavaScriptCore/parser/Parser.h index dc42d36ba..3b0316f81 100644 --- a/Source/JavaScriptCore/parser/Parser.h +++ b/Source/JavaScriptCore/parser/Parser.h @@ -896,6 +896,7 @@ private: OwnPtr<LexerType> m_lexer; StackBounds m_stack; + bool m_hasStackOverflow; bool m_error; String m_errorMessage; JSToken m_token; @@ -987,7 +988,7 @@ PassRefPtr<ParsedNode> Parser<LexerType>::parse(JSGlobalObject* lexicalGlobalObj // we ran out of stack while parsing. If we see an error while parsing eval or program // code we assume that it was a syntax error since running out of stack is much less // likely, and we are currently unable to distinguish between the two cases. - if (isFunctionBodyNode(static_cast<ParsedNode*>(0))) + if (isFunctionBodyNode(static_cast<ParsedNode*>(0)) || m_hasStackOverflow) *exception = createStackOverflowError(lexicalGlobalObject); else if (isEvalNode<ParsedNode>()) *exception = createSyntaxError(lexicalGlobalObject, errMsg); diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp index 38c525268..a3281b6d6 100644 --- a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp +++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp @@ -163,6 +163,7 @@ JSObject* throwOutOfMemoryError(ExecState* exec) JSObject* throwStackOverflowError(ExecState* exec) { + Interpreter::ErrorHandlingMode mode(exec); return throwError(exec, createStackOverflowError(exec)); } diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp index bc3d00067..5fb682bdb 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp @@ -130,7 +130,7 @@ static bool enableAssembler(ExecutableAllocator& executableAllocator) } #endif // ENABLE(!ASSEMBLER) -JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType, HeapType heapType) +JSGlobalData::JSGlobalData(GlobalDataType globalDataType, HeapType heapType) : #if ENABLE(ASSEMBLER) executableAllocator(*this), @@ -171,7 +171,6 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread #endif , dynamicGlobalObject(0) , cachedUTCOffset(std::numeric_limits<double>::quiet_NaN()) - , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) , m_enabledProfiler(0) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) @@ -198,7 +197,7 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread #endif , m_inDefineOwnProperty(false) { - interpreter = new Interpreter; + interpreter = new Interpreter(*this); // Need to be careful to keep everything consistent here JSLockHolder lock(this); @@ -310,19 +309,19 @@ JSGlobalData::~JSGlobalData() #endif } -PassRefPtr<JSGlobalData> JSGlobalData::createContextGroup(ThreadStackType type, HeapType heapType) +PassRefPtr<JSGlobalData> JSGlobalData::createContextGroup(HeapType heapType) { - return adoptRef(new JSGlobalData(APIContextGroup, type, heapType)); + return adoptRef(new JSGlobalData(APIContextGroup, heapType)); } -PassRefPtr<JSGlobalData> JSGlobalData::create(ThreadStackType type, HeapType heapType) +PassRefPtr<JSGlobalData> JSGlobalData::create(HeapType heapType) { - return adoptRef(new JSGlobalData(Default, type, heapType)); + return adoptRef(new JSGlobalData(Default, heapType)); } -PassRefPtr<JSGlobalData> JSGlobalData::createLeaked(ThreadStackType type, HeapType heapType) +PassRefPtr<JSGlobalData> JSGlobalData::createLeaked(HeapType heapType) { - return create(type, heapType); + return create(heapType); } bool JSGlobalData::sharedInstanceExists() @@ -335,7 +334,7 @@ JSGlobalData& JSGlobalData::sharedInstance() GlobalJSLock globalLock; JSGlobalData*& instance = sharedInstanceInternal(); if (!instance) { - instance = adoptRef(new JSGlobalData(APIShared, ThreadStackTypeSmall, SmallHeap)).leakRef(); + instance = adoptRef(new JSGlobalData(APIShared, SmallHeap)).leakRef(); instance->makeUsableFromMultipleThreads(); } return *instance; diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h index 6cc0aad8d..e97c0a015 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.h +++ b/Source/JavaScriptCore/runtime/JSGlobalData.h @@ -104,11 +104,6 @@ namespace JSC { double increment; }; - enum ThreadStackType { - ThreadStackTypeLarge, - ThreadStackTypeSmall - }; - #if ENABLE(DFG_JIT) class ConservativeRoots; @@ -164,9 +159,9 @@ namespace JSC { static bool sharedInstanceExists(); JS_EXPORT_PRIVATE static JSGlobalData& sharedInstance(); - JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> create(ThreadStackType, HeapType = SmallHeap); - JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> createLeaked(ThreadStackType, HeapType = SmallHeap); - static PassRefPtr<JSGlobalData> createContextGroup(ThreadStackType, HeapType = SmallHeap); + JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> create(HeapType = SmallHeap); + JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> createLeaked(HeapType = SmallHeap); + static PassRefPtr<JSGlobalData> createContextGroup(HeapType = SmallHeap); JS_EXPORT_PRIVATE ~JSGlobalData(); void makeUsableFromMultipleThreads() { heap.machineThreads().makeUsableFromMultipleThreads(); } @@ -346,8 +341,6 @@ namespace JSC { String cachedDateString; double cachedDateStringValue; - int maxReentryDepth; - Profiler* m_enabledProfiler; RegExpCache* m_regExpCache; BumpPointerAllocator m_regExpAllocator; @@ -447,7 +440,7 @@ namespace JSC { private: friend class LLIntOffsetsExtractor; - JSGlobalData(GlobalDataType, ThreadStackType, HeapType); + JSGlobalData(GlobalDataType, HeapType); static JSGlobalData*& sharedInstanceInternal(); void createNativeThunk(); #if ENABLE(ASSEMBLER) diff --git a/Source/JavaScriptCore/runtime/StringRecursionChecker.h b/Source/JavaScriptCore/runtime/StringRecursionChecker.h index 831e25b46..a1b4a51fe 100644 --- a/Source/JavaScriptCore/runtime/StringRecursionChecker.h +++ b/Source/JavaScriptCore/runtime/StringRecursionChecker.h @@ -22,6 +22,7 @@ #include "Interpreter.h" #include <wtf/StackStats.h> +#include <wtf/WTFThreadData.h> namespace JSC { @@ -48,8 +49,8 @@ private: inline JSValue StringRecursionChecker::performCheck() { - int size = m_exec->globalData().stringRecursionCheckVisitedObjects.size(); - if (size >= MaxSmallThreadReentryDepth && size >= m_exec->globalData().maxReentryDepth) + const StackBounds& nativeStack = wtfThreadData().stack(); + if (!nativeStack.isSafeToRecurse()) return throwStackOverflowError(); bool alreadyVisited = !m_exec->globalData().stringRecursionCheckVisitedObjects.add(m_thisObject).isNewEntry; if (alreadyVisited) diff --git a/Source/JavaScriptCore/testRegExp.cpp b/Source/JavaScriptCore/testRegExp.cpp index 60e6c4650..527c9359d 100644 --- a/Source/JavaScriptCore/testRegExp.cpp +++ b/Source/JavaScriptCore/testRegExp.cpp @@ -498,7 +498,7 @@ static void parseArguments(int argc, char** argv, CommandLine& options) int realMain(int argc, char** argv) { - RefPtr<JSGlobalData> globalData = JSGlobalData::create(ThreadStackTypeLarge, LargeHeap); + RefPtr<JSGlobalData> globalData = JSGlobalData::create(LargeHeap); JSLockHolder lock(globalData.get()); CommandLine options; diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 458eb3dcd..f170a5d1b 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,17 @@ +2012-10-22 Michael Saboff <msaboff@apple.com> + + Regression(r131655): Crash in StringImpl::findIgnoringCase + https://bugs.webkit.org/show_bug.cgi?id=99753 + + Reviewed by Geoffrey Garen. + + Fixed to use the searchLength to take into account the start index. + + Added LayoutTests/fast/js/find-ignoring-case-regress-99753.html + + * wtf/text/StringImpl.cpp: + (WTF::StringImpl::findIgnoringCase): + 2012-10-22 Simon Hausmann <simon.hausmann@digia.com> Unreviewed: Re-enable LLINT on Qt/Linux after r131932. diff --git a/Source/WTF/wtf/text/StringImpl.cpp b/Source/WTF/wtf/text/StringImpl.cpp index 53d92b0dc..23a05f17f 100644 --- a/Source/WTF/wtf/text/StringImpl.cpp +++ b/Source/WTF/wtf/text/StringImpl.cpp @@ -1082,14 +1082,14 @@ size_t StringImpl::findIgnoringCase(StringImpl* matchString, unsigned index) if (is8Bit()) { if (matchString->is8Bit()) - return findIgnoringCaseInner(characters8() + index, matchString->characters8(), index, length(), matchLength); - return findIgnoringCaseInner(characters8() + index, matchString->characters16(), index, length(), matchLength); + return findIgnoringCaseInner(characters8() + index, matchString->characters8(), index, searchLength, matchLength); + return findIgnoringCaseInner(characters8() + index, matchString->characters16(), index, searchLength, matchLength); } if (matchString->is8Bit()) - return findIgnoringCaseInner(characters16() + index, matchString->characters8(), index, length(), matchLength); + return findIgnoringCaseInner(characters16() + index, matchString->characters8(), index, searchLength, matchLength); - return findIgnoringCaseInner(characters16() + index, matchString->characters16(), index, length(), matchLength); + return findIgnoringCaseInner(characters16() + index, matchString->characters16(), index, searchLength, matchLength); } size_t StringImpl::reverseFind(UChar c, unsigned index) diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 78f9898df..47b29e664 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1682,6 +1682,7 @@ SET(WebCore_SOURCES loader/cache/CachedResource.cpp loader/cache/CachedResourceHandle.cpp loader/cache/CachedResourceLoader.cpp + loader/cache/CachedResourceRequest.cpp loader/cache/CachedScript.cpp loader/cache/CachedShader.cpp loader/cache/CachedSVGDocument.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 820680b03..df6e122eb 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,1436 @@ +2012-10-23 Kent Tamura <tkent@chromium.org> + + Support full month names in DateTimeEditElement, and use them in input[type=month] by default + https://bugs.webkit.org/show_bug.cgi?id=100060 + + Reviewed by Kentaro Hara. + + According to https://plus.google.com/104770450049736549185/posts/4zsoeHoa7SM + no one wants to show abbreviated month names for input[type=month]. + This change add support for full month names in DateTimeEditELement, and + LocaleICU and LocaleMac retun month formats with full month names. Note + that LocaleWin::monthFormat returns formats for full month names. + + No new tests. Covered by fast/forms/month-multiple-fields/month-multiple-fields-appearance-*.html + + * html/shadow/DateTimeEditElement.cpp: + (WebCore::DateTimeEditBuilder::visitField): + If count is 4, use Localizer::monthLabels or standAloneMonthLabels. + * platform/text/LocaleICU.cpp: + (WebCore::LocaleICU::monthFormat): + Returns a format for full month names. + * platform/text/mac/LocaleMac.mm: + (WebCore::LocaleMac::monthFormat): Ditto. + +2012-10-23 Mike West <mkwst@chromium.org> + + Viewport errors should be slightly friendlier with regard to ';'. + https://bugs.webkit.org/show_bug.cgi?id=100003 + + Reviewed by Adam Barth. + + This patch scans viewport values that cause errors for ';'. If found, + a quick message is appended to the error, noting that semicolons are + not valid separators in viewport contents, and that commas would be + the proper substitute. + + No functional changes, just a better error message. + + * dom/ViewportArguments.cpp: + (WebCore::reportViewportWarning): + +2012-10-23 Timothy Hatcher <timothy@apple.com> + + Docking/undocking the Web Inspector does not work correctly in Safari. + + The "docked" and "bottom" strings need quoted instead of being passed as identifiers. + + https://bugs.webkit.org/show_bug.cgi?id=100080 + + Reviewed by Yury Semikhatsky. + + * inspector/InspectorFrontendClientLocal.cpp: + (WebCore::InspectorFrontendClientLocal::setAttachedWindow): Put quotes around the %s. + +2012-10-23 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] Compilation warning in GraphicsContext3DPrivate.cpp when AC is enabled + https://bugs.webkit.org/show_bug.cgi?id=99723 + + Reviewed by Kenneth Rohde Christiansen. + + Fix compilation warning in GraphicsContext3DPrivate.cpp when AC is + enabled. + + No new tests, no change in behavior. + + * platform/graphics/efl/GraphicsContext3DPrivate.cpp: + (WebCore::GraphicsContext3DPrivate::createSurface): + +2012-10-23 Dan Carney <dcarney@google.com> + + When blocking localStorage, Firefox throws a security exception on access, and maybe so should we + https://bugs.webkit.org/show_bug.cgi?id=63257 + + Reviewed by Jochen Eisinger. + + Throw security exception when local storage is accessed + under certain circumstances to match firefox. + + No new tests. Existing tests modified. + + * bindings/js/JSStorageCustom.cpp: + (WebCore::JSStorage::canGetItemsForName): + (WebCore::JSStorage::nameGetter): + (WebCore::JSStorage::deleteProperty): + (WebCore::JSStorage::getOwnPropertyNames): + * bindings/v8/custom/V8StorageCustom.cpp: + (WebCore): + (WebCore::setDOMException): + (WebCore::V8Storage::namedPropertyEnumerator): + (WebCore::storageGetter): + (WebCore::V8Storage::namedPropertyQuery): + (WebCore::storageDeleter): + * inspector/InspectorDOMStorageAgent.cpp: + (WebCore::InspectorDOMStorageAgent::getDOMStorageEntries): + (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::sessionStorage): + (WebCore::DOMWindow::localStorage): + * storage/Storage.cpp: + * storage/Storage.h: + (WebCore): + (WebCore::Storage::length): + (WebCore::Storage::key): + (WebCore::Storage::getItem): + (WebCore::Storage::setItem): + (WebCore::Storage::removeItem): + (WebCore::Storage::clear): + (WebCore::Storage::contains): + * storage/Storage.idl: + * storage/StorageArea.h: + (StorageArea): + * storage/StorageAreaImpl.cpp: + (WebCore::StorageAreaImpl::canAccessStorage): Checks whether access to storage is a security violation. + (WebCore): + (WebCore::StorageAreaImpl::disabledByPrivateBrowsingInFrame): + (WebCore::StorageAreaImpl::length): + (WebCore::StorageAreaImpl::key): + (WebCore::StorageAreaImpl::getItem): + (WebCore::StorageAreaImpl::setItem): + (WebCore::StorageAreaImpl::removeItem): + (WebCore::StorageAreaImpl::clear): + (WebCore::StorageAreaImpl::contains): + * storage/StorageAreaImpl.h: + (StorageAreaImpl): + +2012-10-22 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Remove custom binding code for IDBCursor.value + https://bugs.webkit.org/show_bug.cgi?id=100034 + + Reviewed by Kentaro Hara. + + Now that we're using ScriptValue instead of SerializedScriptValue we can just expose + IDBCursor.value as an |any| (IDL) or |ScriptValue| (C++) to maintain the specified + semantics that the object identity is retained across accesses. + + Test: storage/indexeddb/cursor-value.html + + * Modules/indexeddb/IDBCursor.cpp: Remove "dirty" tracking. + (WebCore::IDBCursor::IDBCursor): + (WebCore::IDBCursor::value): + (WebCore::IDBCursor::setValueReady): + * Modules/indexeddb/IDBCursor.h: IDBAny -> ScriptValue + (IDBCursor): + * Modules/indexeddb/IDBCursorWithValue.idl: IDBAny -> any + * Modules/indexeddb/IDBObjectStore.cpp: No need to route through IDBAny to get ScriptValue. + (WebCore): + * UseV8.cmake: Remove references to IDBCustomBindings.cpp + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * bindings/v8/IDBCustomBindings.cpp: Removed. + +2012-10-22 Dan Bernstein <mitz@apple.com> + + Font’s fast code path is used for partial runs with kerning and ligatures, but shouldn’t be + https://bugs.webkit.org/show_bug.cgi?id=100068 + + Reviewed by Sam Weinig. + + As described in <http://webkit.org/b/100050>, the fast code path doesn’t handle partial runs + correctly when kerning or ligatures are enabled. Since the partial-run case is uncommon, + for now just use the complex code path in this case. + + * platform/graphics/Font.cpp: + (WebCore::Font::drawText): Changed to use the complex path for partial runs if there are any + typesetting features. + (WebCore::Font::drawEmphasisMarks): Ditto. + (WebCore::Font::selectionRectForText): Ditto. + (WebCore::Font::offsetForPosition): Changed to use the complex path if there are any + typesetting features. + +2012-10-22 Peter Wang <peter.wang@torchmobile.com.cn> + + [BlackBerry] Missing some cookies in HTTP response header when set several cookies in one "Set-Cookie" header. + https://bugs.webkit.org/show_bug.cgi?id=99950 + + Reviewed by George Staikos. + + In "NetworkJob::handleNotifyHeaderReceived", if there are several "Set-Cookie" headers, + we should combine the following ones with the first. + + No new test case. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::handleNotifyHeaderReceived): + +2012-10-22 MORITA Hajime <morrita@google.com> + + Assertion failed at WebCore::toInsertionPoint / WebCore::ContentDistributor::distribute + https://bugs.webkit.org/show_bug.cgi?id=100038 + + Reviewed by Kent Tamura. + + isHTMLContentElement() assumes that the content element always has + a tag name "content" but it doesn't when Shadow DOM feature is + disabled. This fix let the function see the correct tag name. + + Test: fast/dom/shadow/insertion-points-with-shadow-disabled.html + + * html/shadow/HTMLContentElement.cpp: + (WebCore::HTMLContentElement::contentTagName): + * html/shadow/HTMLContentElement.h: + (HTMLContentElement): + (WebCore::isHTMLContentElement): + +2012-10-22 Shinya Kawanaka <shinyak@chromium.org> + + [Shadow] Fallback content should also be reprojection. + https://bugs.webkit.org/show_bug.cgi?id=99750 + + Reviewed by Dimitri Glazkov. + + Fallback content of InsertionPoint should be reprojected. The existing assumption that + only the direct child of host element can be distributed to InsertionPoint does not hold anymore. + So, if the parent of an element is InsertionPoint which should show fallback element, we have to + check the grand parent of the element instead of the element. + + Tests: fast/dom/shadow/content-reprojection-fallback-reprojection.html + fast/dom/shadow/content-reprojection-fallback.html + + * css/StyleResolver.cpp: + (WebCore::shouldResetStyleInheritance): Checks the grandparent of the element if the parent is + an InsertionPoint which uses fallback content. + * dom/ComposedShadowTreeWalker.cpp: + (WebCore::shadowOfParentForDistribution): + (WebCore): + (WebCore::resolveReprojection): + (WebCore::ComposedShadowTreeWalker::traverseParent): + * html/shadow/InsertionPoint.cpp: + (WebCore::InsertionPoint::shouldUseFallbackElements): True if the InsertionPoint should use fallback content. + (WebCore): + * html/shadow/InsertionPoint.h: + (WebCore::parentElementForDistribution): Returns the grandparent element if the parent is InsertionPoint which uses + fallback content. Returns parent element otherwise. + (WebCore): + +2012-10-22 Keishi Hattori <keishi@webkit.org> + + Label position is wrong in the suggestion picker when all the suggestions have labels + https://bugs.webkit.org/show_bug.cgi?id=99965 + + Reviewed by Kent Tamura. + + Somehow the scrollbar was appearing and so the label element was being wrapped to the next line. + + No new tests. Can't reproduce in layout test. + + * Resources/pagepopups/suggestionPicker.css: + (.suggestion-list): + * Resources/pagepopups/suggestionPicker.js: + (SuggestionPicker.prototype._fixWindowSize): Explicitly show the scroll bar. + +2012-10-22 MORITA Hajime <morrita@google.com> + + [Chromium] Needs to track ShadowRoot usage + https://bugs.webkit.org/show_bug.cgi?id=99955 + + Reviewed by Dimitri Glazkov. + + Added an UMA instrumentation. + + * dom/ShadowRoot.cpp: + (WebCore::determineUsageType): + (WebCore): + (WebCore::ShadowRoot::create): + +2012-10-22 Kent Tamura <tkent@chromium.org> + + Introduce Localizer::standAloneMonthLabels + https://bugs.webkit.org/show_bug.cgi?id=99963 + + Reviewed by Kentaro Hara. + + We realized full month names and full stand-alone month names were + necessary for input[type=month] UI. We change the compile-flag for + Localizer::monthLabels from "ENABLE(CALENDAR_PICKER)" to + "ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI)," and + introduce Localizer::standAloneMonthLabels. + + Tests: Add some test cases to Source/WebKit/chromium/LocaleMacTest.cpp + and LocalizedDateICUTest.cpp. + + * platform/text/Localizer.h: + (Localizer): + - Add pure virtual standAloneMonthLabels. + - Change the condition for monthLabels. + + * platform/text/LocaleNone.cpp: + (LocaleNone): Declare monthLabels, standAloneMonthLabels, and m_monthLabels. + (WebCore::LocaleNone::monthLabels): + Added. It always returns English month names. + (WebCore::LocaleNone::standAloneMonthLabels): + Added. Just calls monthLabels. + + * platform/text/LocaleWin.h: + (LocaleWin): + Declare standAloneMonthLabels, and change the condition for monthLabels. + * platform/text/LocaleWin.cpp: + (WebCore): Change the condition for monthLabels. + (WebCore::LocaleWin::standAloneMonthLabels): + Added. Just calls monthLabels. + + * platform/text/mac/LocaleMac.h: + (LocaleMac): + - Add standAloneMonthLabels and m_standAloneMonthLabels + - Change the condition for monthLabels and m_monthLabels. + * platform/text/mac/LocaleMac.mm: + (WebCore): Change the condition for monthLabels. + (WebCore::LocaleMac::standAloneMonthLabels): + Added. Get the information with NSDateFormatter::standaloneMonthSymbols. + + * platform/text/LocaleICU.h: + (LocaleICU): + - Add standAloneMonthLabels and m_standAloneMonthLabels + - Change the condition for monthLabels and m_monthLabels. + * platform/text/LocaleICU.cpp: + (WebCore::LocaleICU::initializeCalendar): + Remove m_monthLabels initialization in order to avoid dependecy from monthLabels. + (WebCore): + (WebCore::createFallbackMonthLabels): Change the compile condition. + (WebCore::LocaleICU::monthLabels): + - Change the compile condition. + - Don't depend on initializeCalendar to make the code for + ENABLE(INPUT_MULTIPLE_FIELDS_UI) && !ENABLE(CALENDAR_PICKER) minimal. + (WebCore::LocaleICU::standAloneMonthLabels): + Added. The code is similar to shortStandAloneMonthLabels. + +2012-10-22 Shinya Kawanaka <shinyak@chromium.org> + + Refactoring around ContainerNode::attachChildren + https://bugs.webkit.org/show_bug.cgi?id=99968 + + Reviewed by Hajime Morita. + + Since ContainerNode::attach() is now equivalent to ContainerNode::attachChildren() + Node::attach(), we should call + ContainerNode::attach() instead of calling them. + + No new tests, no change in behavior. + + * dom/ContainerNode.h: + (ContainerNode): + * dom/Element.cpp: + (WebCore::Element::attach): + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::attach): + +2012-10-22 Michael Saboff <msaboff@apple.com> + + HTML Parser should produce 8 bit strings for doctype, comment and tagName tokens + https://bugs.webkit.org/show_bug.cgi?id=99889 + + Reviewed by Geoffrey Garen. + + Added 8 bit check for accumulating all token data in MarkupTokenBase. Added code to convert + "name" token data directly to a string (8 or 16 as appropriate). Changed to accumulate + m_bufferedEndTagName as LChar's. + + No new tests, covered by existing tests. + + * html/parser/HTMLToken.h: + (HTMLToken): + * html/parser/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::nextToken): + (WebCore::HTMLTokenizer::addToPossibleEndTag): + (WebCore::HTMLTokenizer::isAppropriateEndTag): + * html/parser/HTMLTokenizer.h: + (HTMLTokenizer): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeLeading): + * xml/parser/MarkupTokenBase.h: + (WebCore::MarkupTokenBase::beginStartTag): + (WebCore::MarkupTokenBase::beginEndTag): + (MarkupTokenBase): + (WebCore::MarkupTokenBase::beginDOCTYPE): + (WebCore::MarkupTokenBase::appendToComment): + (WebCore::MarkupTokenBase::appendToName): + (WebCore::MarkupTokenBase::nameString): + (WebCore::AtomicMarkupTokenBase::AtomicMarkupTokenBase): + +2012-10-22 Tony Chang <tony@chromium.org> + + margin-top/bottom has no effect for child nodes of flex items + https://bugs.webkit.org/show_bug.cgi?id=99923 + + Reviewed by Ojan Vafai. + + Flexitems, like table cells, shouldn't collapse margins. + + Test: css3/flexbox/flexitem-no-margin-collapsing.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::MarginInfo::MarginInfo): Check to see if the parent is a flexible box. + We should always have a parent if we make it this far in the check. + +2012-10-22 Marja Hölttä <marja@chromium.org> + + Refactor CachedResourceLoader: add CachedResourceRequest + https://bugs.webkit.org/show_bug.cgi?id=99736 + + Reviewed by Adam Barth. + + For fixing bugs 84883 and 92761, + CachedResourceLoader::requestResource should take as parameter + information about who initiated the request. But the parameter + list was already long. This gathers all the parameters into a + separate class, CachedResourceRequest. The next step is to add + information about who initiated the request into + CachedResourceRequest. + + No new tests because no changes in functionality, just moving code + around. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::cachedFont): + * css/CSSImageSetValue.cpp: + (WebCore::CSSImageSetValue::cachedImageSet): + * css/CSSImageValue.cpp: + (WebCore::CSSImageValue::cachedImage): + * css/StyleRuleImport.cpp: + (WebCore::StyleRuleImport::requestStyleSheet): + * css/WebKitCSSSVGDocumentValue.cpp: + (WebCore::WebKitCSSSVGDocumentValue::load): + * css/WebKitCSSShaderValue.cpp: + (WebCore::WebKitCSSShaderValue::cachedShader): + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::checkStyleSheet): + * dom/ScriptElement.cpp: + (WebCore::ScriptElement::requestScript): + * html/HTMLLinkElement.cpp: + (WebCore::HTMLLinkElement::process): + * loader/DocumentThreadableLoader.cpp: + (WebCore::DocumentThreadableLoader::loadRequest): + * loader/ImageLoader.cpp: + (WebCore::ImageLoader::updateFromElement): + * loader/LinkLoader.cpp: + (WebCore::LinkLoader::loadLink): + * loader/TextTrackLoader.cpp: + (WebCore::TextTrackLoader::load): + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::requestImage): + (WebCore::CachedResourceLoader::requestFont): + (WebCore::CachedResourceLoader::requestTextTrack): + (WebCore::CachedResourceLoader::requestShader): + (WebCore::CachedResourceLoader::requestCSSStyleSheet): + (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): + (WebCore::CachedResourceLoader::requestScript): + (WebCore::CachedResourceLoader::requestXSLStyleSheet): + (WebCore::CachedResourceLoader::requestSVGDocument): + (WebCore::CachedResourceLoader::requestLinkResource): + (WebCore::CachedResourceLoader::requestRawResource): + (WebCore::CachedResourceLoader::requestResource): + (WebCore::CachedResourceLoader::requestPreload): + (WebCore::CachedResourceLoader::defaultCachedResourceOptions): + (WebCore): + * loader/cache/CachedResourceLoader.h: + (WebCore): + (CachedResourceLoader): + * loader/cache/CachedResourceRequest.cpp: Added. + (WebCore): + (WebCore::CachedResourceRequest::CachedResourceRequest): + * loader/cache/CachedResourceRequest.h: Added. + (WebCore): + (CachedResourceRequest): + (WebCore::CachedResourceRequest::mutableResourceRequest): + (WebCore::CachedResourceRequest::resourceRequest): + (WebCore::CachedResourceRequest::charset): + (WebCore::CachedResourceRequest::setCharset): + (WebCore::CachedResourceRequest::options): + (WebCore::CachedResourceRequest::priority): + (WebCore::CachedResourceRequest::forPreload): + (WebCore::CachedResourceRequest::setForPreload): + (WebCore::CachedResourceRequest::defer): + (WebCore::CachedResourceRequest::setDefer): + * loader/icon/IconLoader.cpp: + (WebCore::IconLoader::startLoading): + * svg/SVGFEImageElement.cpp: + (WebCore::SVGFEImageElement::requestImageResource): + * svg/SVGFontFaceUriElement.cpp: + (WebCore::SVGFontFaceUriElement::loadFont): + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::svgAttributeChanged): + * xml/XSLImportRule.cpp: + (WebCore::XSLImportRule::loadSheet): + +2012-10-22 Adam Barth <abarth@webkit.org> + + [V8] ASSERT that removeAllDOMObjects() is called only on worker threads + https://bugs.webkit.org/show_bug.cgi?id=100046 + + Reviewed by Eric Seidel. + + This function is called only on worker threads. We should ASSERT that + fact and remove the dead code that tries to handle the main thread + case. + + * bindings/v8/V8DOMMap.cpp: + (WebCore::removeAllDOMObjects): + +2012-10-22 Adam Barth <abarth@webkit.org> + + [V8] We should call the faster v8::Integer::New APIs + https://bugs.webkit.org/show_bug.cgi?id=100016 + + Reviewed by Eric Seidel. + + In working to remove the integer cache, I added some faster APIs for + creating v8::Integers. These APIs are faster than the old APIs, but not + quite fast enough to replace the integer cache. We should still use + them when we miss the integer cache. + + I've also included a small refactoring to V8PerIsolateData to make it + clearer when we're calling v8::Isolate::GetCurrent(). + + * bindings/v8/DOMData.cpp: + (WebCore::DOMData::getCurrentStore): + * bindings/v8/V8Binding.h: + (WebCore::v8ExternalString): + (WebCore::v8Integer): + (WebCore::v8UnsignedInteger): + * bindings/v8/V8PerIsolateData.h: + (WebCore::V8PerIsolateData::current): + (WebCore::V8PerIsolateData::from): + * bindings/v8/V8ValueCache.cpp: + (WebCore::StringCache::v8ExternalStringSlow): + (WebCore::IntegerCache::createSmallIntegers): + * bindings/v8/V8ValueCache.h: + (WebCore::IntegerCache::v8Integer): + (WebCore::IntegerCache::v8UnsignedInteger): + (IntegerCache): + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + (WebCore::V8HTMLCanvasElement::getContextCallback): + +2012-10-22 Julien Chaffraix <jchaffraix@webkit.org> + + RenderTableCol::computePreferredLogicalWidths and RenderTableCol::layout should never be called + https://bugs.webkit.org/show_bug.cgi?id=99861 + + Reviewed by Ojan Vafai. + + RenderTableCol's computePreferredLogicalWidths and layout's only purpose were to clear the preferred logical + widths dirty / layout flag so that we would properly propagate the information to our containing table. This + led to clunky code where the table layout code had to forcefully call RenderTableCol::computePreferredLogicalWidths + or else we would ignore the next layout hint on the <col> or <colgroup>. + + Test: fast/table/col-span-change-relayout.html + + * rendering/AutoTableLayout.cpp: + (WebCore::AutoTableLayout::recalcColumn): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::layout): + Simplified the code now that we only need to iterate over the sections. + + * rendering/FixedTableLayout.cpp: + (WebCore::FixedTableLayout::calcWidthArray): + Removed call to computePreferredLogicalWidths. + + * rendering/RenderTableCol.cpp: + (WebCore::RenderTableCol::styleDidChange): + (WebCore::RenderTableCol::updateFromElement): + Forward a layout hint to the table so that we properly recompute the cell's logical withs. + + (WebCore::RenderTableCol::computePreferredLogicalWidths): + (WebCore::RenderTableCol::layout): + Change our implementations of those 2 methods to be no-ops, while enforcing that they are + never called. + + (WebCore::RenderTableCol::propagateLayoutCueToTable): + New helper function that forward any layout cue to the containing table, this works around + us not clearing the flags which confuses RenderObject markContainingBlocksForLayout and + invalidateContainerPreferredLogicalWidths. + + * rendering/RenderTableCol.h: + Made the function that we are not expected to be called private. + +2012-10-22 Pan Deng <pan.deng@intel.com> + + [User Timing]Integrate with Perforamnce Timeline. + https://bugs.webkit.org/show_bug.cgi?id=91072. + + Reviewed by Tony Gentilcore. + + This patch expose user timing entries via performance timeline interface. JavaScriptCore custom binding will be another patch + + No new tests, user timing test cases have been landed. + + * page/Performance.cpp: + (WebCore::Performance::Performance): + (WebCore::Performance::webkitGetEntries): + (WebCore::Performance::webkitGetEntriesByType): + (WebCore::Performance::webkitGetEntriesByName): + * page/PerformanceEntry.h: + (WebCore::PerformanceEntry::startTimeCompareLessThan): + (PerformanceEntry): + * page/PerformanceEntryList.cpp: + (WebCore::PerformanceEntryList::sort): + (WebCore): + * page/PerformanceEntryList.h: + (PerformanceEntryList): + * page/PerformanceUserTiming.cpp: + (WebCore::convertToEntrySequence): + (WebCore): + (WebCore::getEntrySequenceByName): + (WebCore::UserTiming::getMarks): + (WebCore::UserTiming::getMeasures): + * page/PerformanceUserTiming.h: + (UserTiming): + +2012-10-22 Pan Deng <pan.deng@intel.com> + + Modify obsolete code in User Timing + https://bugs.webkit.org/show_bug.cgi?id=99851 + + Reviewed by Tony Gentilcore. + + Modify user timing implementation as PlatformString.h, prefix of webkitNow is removed, etc. + + No new tests. + + * page/PerformanceUserTiming.cpp: + (WebCore::insertPerformanceEntry): + (WebCore::UserTiming::mark): + (WebCore::UserTiming::measure): + * page/PerformanceUserTiming.h: + +2012-10-22 Mark Lam <mark.lam@apple.com> + + Change stack recursion checks to be based on stack availability. + https://bugs.webkit.org/show_bug.cgi?id=99872. + + Reviewed by Filip Pizlo and Geoffrey Garen. + + Removed the use of ThreadStackType. Enabled the reserved JSStack space + for error processing before doing work in reportException(). + + * bindings/js/JSDOMBinding.cpp: + (WebCore::reportException): + * bindings/js/JSDOMWindowBase.cpp: + (WebCore::JSDOMWindowBase::commonJSGlobalData): + * bindings/js/WorkerScriptController.cpp: + (WebCore::WorkerScriptController::WorkerScriptController): + +2012-10-22 Andreas Kling <kling@webkit.org> + + REGRESSION(r131104): Heap-use-after-free in WebCore::Element::attributeChanged + <http://webkit.org/b/99937> + + Reviewed by Anders Carlsson. + + Setting the "type" attribute on an HTMLInputElement that has no "value" attribute set will cause the + input type changing mechanism to write a value attribute onto the element. This happens in + HTMLInputElement::updateType(), below parseAttribute(). + + It's done via Element::setAttribute(), so we end up re-entering Element::setAttributeInternal() + where the 'existingAttribute' pointer may now be invalid if adding the "value" attribute caused + a reallocation in the ElementAttributeData's underlying Vector<Attribute>. + + To make it harder to introduce this kind of bug in the future, I changed almost all functions that take + a "const Attribute&" to take a QualifiedName/AtomicString couple instead (the idea being that the + fewer references into the attribute store we have, the better.) + + Test: fast/html/input-type-change-crash.html + + * dom/Attr.cpp: + (WebCore::Attr::setValue): + (WebCore::Attr::childrenChanged): + * dom/Element.cpp: + (WebCore::Element::setAttributeInternal): + (WebCore::Element::attributeChanged): + (WebCore::Element::parserSetAttributes): + (WebCore::Element::addAttributeInternal): + (WebCore::Element::didAddAttribute): + (WebCore::Element::didModifyAttribute): + (WebCore::Element::didRemoveAttribute): + * dom/Element.h: + (Element): + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::cloneDataFrom): + * dom/StyledElement.cpp: + (WebCore::StyledElement::attributeChanged): + * dom/StyledElement.h: + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::updateType): + * svg/SVGElement.cpp: + (WebCore::SVGElement::attributeChanged): + * svg/SVGElement.h: + (SVGElement): + +2012-10-22 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Bounds check for IDBCursor.advance() incorrect + https://bugs.webkit.org/show_bug.cgi?id=100014 + + Reviewed by Tony Chang. + + Fix introduced by trac.webkit.org/changeset/131658 restricted cursor.advance()'s argument + as [EnforceRange] unsigned long long, but it's typed as [EnforceRange] unsigned long; the + useless comparison was caught by a clang check. + + In lieu of webkit.org/b/96798 make it long long and correct the range check. + + Test: storage/indexeddb/cursor-advance.html + + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::advance): + * Modules/indexeddb/IDBCursor.h: + (IDBCursor): + * Modules/indexeddb/IDBCursor.idl: + +2012-10-22 Tony Chang <tony@chromium.org> + + WebKit does not support 'flex-wrap: nowrap' + https://bugs.webkit.org/show_bug.cgi?id=99924 + + Reviewed by Ojan Vafai. + + The spec changed back from using none to nowrap for the single-line + flexbox case. + http://dev.w3.org/csswg/css3-flexbox/#flex-wrap-property + + No new tests, covered by css3/flexbox/css-properties.html and others. + + * css/CSSParser.cpp: + (WebCore::isValidKeywordPropertyAndValue): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + (WebCore::CSSPrimitiveValue::operator EFlexWrap): + * css/CSSValueKeywords.in: + * rendering/RenderBox.cpp: + (WebCore::isStretchingColumnFlexItem): + (WebCore::RenderBox::sizesLogicalWidthToFitContent): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::isMultiline): + * rendering/style/RenderStyle.h: + * rendering/style/RenderStyleConstants.h: + +2012-10-22 Mike West <mkwst@chromium.org> + + 'image/pjpeg' should be treated as an image by Web Inspector. + https://bugs.webkit.org/show_bug.cgi?id=100001 + + Reviewed by Pavel Feldman. + + It's not exactly a "real" MIME type, but it's in use. + + * inspector/front-end/NetworkManager.js: + (WebInspector.NetworkManager): + Adding 'image/pjpeg' as an image MIME type. + +2012-10-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r132119. + http://trac.webkit.org/changeset/132119 + https://bugs.webkit.org/show_bug.cgi?id=100019 + + Fails its own test on Mac platforms. (Requested by leviw on + #webkit). + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleGestureEvent): + (WebCore::EventHandler::sendContextMenuEventForGesture): + * page/EventHandler.h: + (EventHandler): + +2012-10-22 Hans Muller <hmuller@adobe.com> + + [CSS Exclusions] Points on the bottom and right edges of an exclusion shape should be classified as "outside" + https://bugs.webkit.org/show_bug.cgi?id=98967 + + Reviewed by Dirk Schulze. + + Changed the way lines are represented in the ExclusionShapeInsideInfo and ExclusionShape classes + so that they're consistent with the rendering code that depends on them. Lines are now defined + by logicalTop, logicalHeight, instead of logicalTop,logicalBottom. This a clean-up, not a change + in functionality. It's already covered by the existing fast/exclusions LayoutTests. + + Test: fast/exclusions/shape-inside/shape-inside-bottom-edge.html + + * rendering/ExclusionPolygon.cpp: + (WebCore::ExclusionPolygon::getExcludedIntervals): + (WebCore::ExclusionPolygon::getIncludedIntervals): + * rendering/ExclusionPolygon.h: + * rendering/ExclusionRectangle.cpp: + (WebCore::ExclusionRectangle::getExcludedIntervals): + (WebCore::ExclusionRectangle::getIncludedIntervals): + * rendering/ExclusionRectangle.h: + * rendering/ExclusionShape.h: + (LineSegment): Moved the struct fields below the constructor per webkit style. + (ExclusionShape): + (WebCore::ExclusionShape::minYForLogicalLine): + (WebCore::ExclusionShape::maxYForLogicalLine): + * rendering/ExclusionShapeInsideInfo.cpp: + (WebCore::ExclusionShapeInsideInfo::computeSegmentsForLine): + * rendering/ExclusionShapeInsideInfo.h: + (ExclusionShapeInsideInfo): + (WebCore::ExclusionShapeInsideInfo::lineOverlapsShapeBounds): Changed the test to not include + lines whose logicalTop is equal to the shape's top+height. + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::layoutRunsAndFloatsInRange): + +2012-10-22 Chris Rogers <crogers@google.com> + + Update some AudioContext create() method names to latest Web Audio spec + https://bugs.webkit.org/show_bug.cgi?id=99888 + + Reviewed by Adam Barth. + + The following AudioContext method names are being changed, with legacy support for the old names: + createGainNode -> createGain + createDelayNode -> createDelay + createJavaScriptNode -> createScriptProcessor + + For details: + https://www.w3.org/Bugs/Public/show_bug.cgi?id=18332 + + Tests changed: webaudio/delaynode.html, webaudio/gain.html, webaudio/javascriptaudionode.html + to test coverage of the new names. + + * Modules/webaudio/AudioBufferSourceNode.idl: + * Modules/webaudio/AudioContext.cpp: + (WebCore::AudioContext::createScriptProcessor): + (WebCore::AudioContext::createGain): + (WebCore::AudioContext::createDelay): + * Modules/webaudio/AudioContext.h: + (AudioContext): + * Modules/webaudio/AudioContext.idl: + * page/FeatureObserver.h: + +2012-10-22 Varun Jain <varunjain@chromium.org> + + Context menu generated from touch gestures on textareas has + context of the cursor position instead of the position where the event occurs. + https://bugs.webkit.org/show_bug.cgi?id=99520 + + Reviewed by Kenneth Rohde Christiansen. + + Send a synthetic mouse down event for context menu-summoning-gesture events so + that textareas can correctly set cursors before receiving the context menu event. + + Test: fast/events/touch/gesture/right-click-gestures-set-cursor-at-correct-position.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleGestureEvent): + (WebCore::EventHandler::handleGestureTwoFingerTap): + (WebCore): + (WebCore::EventHandler::sendContextMenuEventForGesture): + * page/EventHandler.h: + (EventHandler): + +2012-10-22 Zeno Albisser <zeno@webkit.org> + + TextureMapperSurfaceBackingStore should check if GraphicsSurface is valid. + https://bugs.webkit.org/show_bug.cgi?id=100002 + + Reviewed by Kenneth Rohde Christiansen. + + * platform/graphics/texmap/TextureMapperBackingStore.cpp: + (WebCore::TextureMapperSurfaceBackingStore::setGraphicsSurface): + Check if a surface has been created before accessing the pointer. + (WebCore::TextureMapperSurfaceBackingStore::paintToTextureMapper): + Check if m_graphicsSurface is a valid pointer before dereferencing it. + +2012-10-22 Michael Saboff <msaboff@apple.com> + + r131955 is has improper function call in LinkHashChromium.cpp + https://bugs.webkit.org/show_bug.cgi?id=100008 + + Reviewed by Alexey Proskuryakov. + + Followup fix to r131955 for chromium platform. Added call to + (const UChar*, unsigned) version of visitedLinkHash from String& version. + + * platform/chromium/LinkHashChromium.cpp: + (WebCore::visitedLinkHash): + +2012-10-22 Aaron Colwell <acolwell@chromium.org> + + webkitsourceopen event doesn't always fire + https://bugs.webkit.org/show_bug.cgi?id=99868 + + Reviewed by Adam Barth. + + Changed MediaSource to derive from ActiveDOMObject so that event listeners + will still fire even if all references to the object go out of scope. + + Test: http/tests/media/media-source/video-media-source-garbage-collection-before-sourceopen.html + + * Modules/mediasource/MediaSource.cpp: + (WebCore::MediaSource::create): + (WebCore::MediaSource::MediaSource): + (WebCore::MediaSource::scriptExecutionContext): + (WebCore): + (WebCore::MediaSource::hasPendingActivity): + (WebCore::MediaSource::stop): Clears m_player & m_asyncEventQueue so they don't indicate pending activity anymore. + * Modules/mediasource/MediaSource.h: + (MediaSource): + * Modules/mediasource/MediaSource.idl: + * Modules/mediasource/MediaSourceRegistry.cpp: + (WebCore::MediaSourceRegistry::registerMediaSourceURL): Added setPendingActivity() call so the MediaSource object stays active while in the registry. + (WebCore::MediaSourceRegistry::unregisterMediaSourceURL): Added unsetPendingActivity() call so the MediaSource object can become inactive after being removed from the registry. + +2012-10-22 Adam Barth <abarth@webkit.org> + + [V8] Vastly simplify V8GCController's NodeVisitor + https://bugs.webkit.org/show_bug.cgi?id=99884 + + Reviewed by Kentaro Hara. + + NodeVisitor was vastly more complicated than necessary. + + This patch improve performance on these new gc benchmarks: + + gc-forest: 1.14% better + gc-mini-tree: 5.09% better + gc-tree: 4.60% better + + * bindings/v8/V8GCController.cpp: + (WebCore::ObjectVisitor::visitDOMWrapper): + (WebCore::addImplicitReferencesForNodeWithEventListeners): + (WebCore::rootForGC): + (WebCore::NodeVisitor::visitDOMWrapper): + (WebCore::NodeVisitor::applyGrouping): + (NodeVisitor): + +2012-10-22 Emil A Eklund <eae@chromium.org> + + Change baselinePosition and maxAscent/maxDescent to int + https://bugs.webkit.org/show_bug.cgi?id=99767 + + Reviewed by Levi Weintraub. + + Currently baselinePostion, maxAscent and maxDescent are + LayoutUnits while ascent, descent and m_lineHeight are ints. + This can lead to subtle alignment and rounding problems. + + Change baselinePosition and maxAscent/maxDescent to int to avoid + these issues. + + Test: fast/sub-pixel/replaced-element-baseline.html + + * editing/FrameSelection.cpp: + (WebCore::repaintRectForCaret): + Inflate Y dimension just like we do for X to ensure that the + repaint rect fully contains the caret. + + * rendering/InlineBox.cpp: + (WebCore::InlineBox::baselinePosition): + * rendering/InlineBox.h: + (InlineBox): + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::adjustMaxAscentAndDescent): + (WebCore::InlineFlowBox::computeLogicalBoxHeights): + (WebCore::InlineFlowBox::placeBoxesInBlockDirection): + Change maxAscent/maxDescent to int to match ascent/descent. + + * rendering/InlineFlowBox.h: + (InlineFlowBox): + * rendering/InlineTextBox.cpp: + (WebCore::InlineTextBox::baselinePosition): + * rendering/InlineTextBox.h: + (InlineTextBox): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::baselinePosition): + (WebCore::RenderBlock::firstLineBoxBaseline): + (WebCore::RenderBlock::lastLineBoxBaseline): + * rendering/RenderBlock.h: + (RenderBlock): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::baselinePosition): + * rendering/RenderBox.h: + (WebCore::RenderBox::firstLineBoxBaseline): + (WebCore::RenderBox::lastLineBoxBaseline): + (RenderBox): + * rendering/RenderBoxModelObject.h: + (RenderBoxModelObject): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::baselinePosition): + (WebCore::RenderFlexibleBox::firstLineBoxBaseline): + * rendering/RenderFlexibleBox.h: + * rendering/RenderInline.cpp: + (WebCore::RenderInline::baselinePosition): + * rendering/RenderInline.h: + (RenderInline): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::baselinePosition): + * rendering/RenderListBox.h: + (RenderListBox): + * rendering/RenderListMarker.cpp: + (WebCore::RenderListMarker::baselinePosition): + * rendering/RenderListMarker.h: + (RenderListMarker): + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::baselinePosition): + * rendering/RenderSlider.h: + (RenderSlider): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::baselinePosition): + (WebCore::RenderTable::lastLineBoxBaseline): + (WebCore::RenderTable::firstLineBoxBaseline): + * rendering/RenderTable.h: + (RenderTable): + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::firstLineBoxBaseline): + * rendering/RenderTableSection.h: + (RenderTableSection): + * rendering/RenderTextControlMultiLine.cpp: + (WebCore::RenderTextControlMultiLine::baselinePosition): + * rendering/RenderTextControlMultiLine.h: + (RenderTextControlMultiLine): + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::baselinePosition): + * rendering/RenderTheme.h: + (RenderTheme): + * rendering/RenderThemeSafari.cpp: + (WebCore::RenderThemeSafari::baselinePosition): + * rendering/RenderThemeSafari.h: + (RenderThemeSafari): + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::baselinePosition): + (WebCore::RootInlineBox::alignBoxesInBlockDirection): + * rendering/RootInlineBox.h: + (RootInlineBox): + * rendering/mathml/RenderMathMLBlock.cpp: + (WebCore::RenderMathMLBlock::baselinePosition): + (WebCore::RenderMathMLTable::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLBlock.h: + (RenderMathMLBlock): + (RenderMathMLTable): + * rendering/mathml/RenderMathMLFraction.cpp: + (WebCore::RenderMathMLFraction::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLFraction.h: + (RenderMathMLFraction): + * rendering/mathml/RenderMathMLOperator.cpp: + (WebCore::RenderMathMLOperator::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLOperator.h: + * rendering/mathml/RenderMathMLUnderOver.cpp: + (WebCore::RenderMathMLUnderOver::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLUnderOver.h: + (RenderMathMLUnderOver): + +2012-10-22 Emil A Eklund <eae@chromium.org> + + Modify LayoutState ASSERTS to support SATURATED_LAYOUT_ARITHMETIC + https://bugs.webkit.org/show_bug.cgi?id=98692 + + Reviewed by Dan Bernstein. + + We currently overflow/wrap when computing the delta in + RenderBlock::setLogicalTopForChild in cases where we have an + element with a width or height exceeding maxLayoutUnit. When + the delta is later added back in RenderBlock::layoutBlockChild + the number wraps again getting us back to the correct value. + + With SATURATED_LAYOUT_ARITHMETIC enabled the values no longer + wraps, which seems like the correct thing to do however this + causes the compare to fail for obvious reasons. By accounting + for this we can keep the asserts (which have proven very + helpful) even when SATURATED_LAYOUT_ARITHMETIC is turned on. + + No new tests, covered by existing tests. + + * rendering/LayoutState.cpp: + (WebCore::LayoutState::LayoutState): + * rendering/LayoutState.h: + (WebCore::LayoutState::LayoutState): + (LayoutState): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlockChild): + * rendering/RenderView.cpp: + (WebCore::RenderView::layout): + * rendering/RenderView.h: + (WebCore::RenderView::addLayoutDelta): + (RenderView): + (WebCore::RenderView::layoutDeltaMatches): + +2012-10-22 Tony Chang <tony@chromium.org> + + Fix some baseline flexbox alignment + https://bugs.webkit.org/show_bug.cgi?id=99879 + + Reviewed by Ojan Vafai. + + Fix a bug where we weren't handling margin properly on inline-flexbox. + Fix a bug where we weren't getting the edge of the content box properly when synthesizing + a baseline. + + Test: css3/flexbox/flexbox-baseline-margins.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::baselinePosition): + (WebCore::RenderBlock::inlineBlockBaseline): Add a new method that is used when calculating an inline-block's + baseline. Previously we would use lastLineBoxBaseline. + (WebCore::RenderBlock::lastLineBoxBaseline): Pass in direction and when searching children, use inlineBlockBaseline. + * rendering/RenderBlock.h: + (RenderBlock): Make lastLineBoxBaseline non-virtual. + * rendering/RenderBox.h: + (WebCore::RenderBox::inlineBlockBaseline): Replace lastLineBoxBaseline with inlineBlockBaseline. + * rendering/RenderFlexibleBox.cpp: + (WebCore::synthesizedBaselineFromContentBox): Helper method for getting the baseline from the content box. + (WebCore::RenderFlexibleBox::baselinePosition): Always include the margin. This fixes the inline-flexbox case. + (WebCore::RenderFlexibleBox::firstLineBoxBaseline): Fix a case where we didn't synthesize a baseline. Returning -1 means there is no baseline, but we can + synthesize a baseline if we have a flexitem without text. + (WebCore::RenderFlexibleBox::inlineBlockBaseline): + * rendering/RenderFlexibleBox.h: + * rendering/RenderTable.cpp: Replace lastLineBoxBaseline with inlineBlockBaseline. + (WebCore::RenderTable::inlineBlockBaseline): Try to make comment more direct. + * rendering/RenderTable.h: + (RenderTable): Replace lastLineBoxBaseline with inlineBlockBaseline. + +2012-10-22 Levi Weintraub <leviw@chromium.org> + + Unreviewed Chromium build fix following r132074. + + * WebCore.gypi: + +2012-10-22 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] Don't use deprecated AccessibilityObject methods after r99502 + https://bugs.webkit.org/show_bug.cgi?id=99985 + + Reviewed by Chris Fleizach. + + Update callers for AccessibilityObject's title() and + accessibilityDescription() so they now use AccessibilityText. + + * accessibility/gtk/WebKitAccessibleUtil.cpp: + (titleTagShouldBeUsedInDescriptionField): Internal helper function. + (accessibilityTitle): New helper function, returns an String with + the title for a AccessibilityObject, using AccessibleText. + (accessibilityDescription): New helper function, returns an String with + the description for a AccessibilityObject, using AccessibleText. + * accessibility/gtk/WebKitAccessibleUtil.h: Added public + declarations for accessibilityTitle and accessibilityDescription. + + * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: + (webkitAccessibleGetName): Use new helpers for retrieving the title. + (webkitAccessibleGetDescription): Use new helpers for retrieving + the title and description. + + * accessibility/gtk/WebKitAccessibleInterfaceImage.cpp: + (webkitAccessibleImageGetImageDescription): Use new helpers for + retrieving the title. + +2012-10-16 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: add timeline instrumentation for scrolling of a layer + https://bugs.webkit.org/show_bug.cgi?id=99461 + + Reviewed by Pavel Feldman. + + - added timeline instrumentation for scrolling of a layer; + - added TRACE_EVENT for ScrollableArea::scrollPositionChanged() + + * inspector/InspectorInstrumentation.cpp: + (WebCore): + (WebCore::InspectorInstrumentation::willScrollLayerImpl): + (WebCore::InspectorInstrumentation::didScrollLayerImpl): + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + (WebCore::InspectorInstrumentation::willScrollLayer): + (WebCore): + (WebCore::InspectorInstrumentation::didScrollLayer): + * inspector/InspectorTimelineAgent.cpp: + (TimelineRecordType): + (WebCore::InspectorTimelineAgent::willScroll): + (WebCore): + (WebCore::InspectorTimelineAgent::didScroll): + * inspector/InspectorTimelineAgent.h: + (InspectorTimelineAgent): + * inspector/front-end/TimelineModel.js: + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel._initRecordStyles): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollTo): + * platform/ScrollableArea.cpp: + (WebCore::ScrollableArea::scrollPositionChanged): + +2012-10-22 Jan Keromnes <janx@linux.com> + + Moved cmdevtools.js to folder cm/ + + Web Inspector: Move file `cmdevtools.css` to `cm/` + https://bugs.webkit.org/show_bug.cgi?id=99956 + + Reviewed by Pavel Feldman. + + The file cmdevtools.js belongs to the CodeMirror editor experiment in cm/. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/cm/cmdevtools.css: Renamed from Source/WebCore/inspector/front-end/cmdevtools.css. + (.CodeMirror): + (.CodeMirror-scroll): + (.cm-highlight): + (@-webkit-keyframes fadeout): + (to): + (.cm-breakpoint): + (.cm-breakpoint-disabled): + (.cm-breakpoint-conditional): + (.cm-execution-line): + (.cm-s-web-inspector-js span.cm-keyword): + (.cm-s-web-inspector-js span.cm-number): + (.cm-s-web-inspector-js span.cm-comment): + (.cm-s-web-inspector-js span.cm-string): + (.cm-s-web-inspector-js span.cm-string-2): + (.cm-s-web-inspector-css span.cm-keyword): + (.cm-s-web-inspector-css span.cm-number): + (.cm-s-web-inspector-css span.cm-comment): + (.cm-s-web-inspector-css span.cm-string): + (.cm-s-web-inspector-css span.cm-string-2): + (.cm-s-web-inspector-css span.cm-link): + (.cm-s-web-inspector-css span.cm-variable): + (.cm-s-web-inspector-html span.cm-meta): + (.cm-s-web-inspector-html span.cm-comment): + (.cm-s-web-inspector-html span.cm-string): + (.cm-s-web-inspector-html span.cm-tag): + (.cm-s-web-inspector-html span.cm-attribute): + (.cm-s-web-inspector-html span.cm-link): + (.webkit-html-message-bubble): + (.webkit-html-warning-message): + (.webkit-html-error-message): + (.webkit-html-message-line): + (.webkit-html-message-line-hover): + +2012-10-22 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Prepare mappings to moving uiSourceCodes creation out of them to workspace. + https://bugs.webkit.org/show_bug.cgi?id=99997 + + Reviewed by Pavel Feldman. + + Source mappings could now store a link to temporary uiSourceCodes only. + Otherwise it should retrieve uiSourceCodes from workspace by URL. + Original uiSourceCodes are now temporary in CompilerScriptMapping. + + * inspector/front-end/CompilerScriptMapping.js: + (WebInspector.CompilerScriptMapping): + (WebInspector.CompilerScriptMapping.prototype.rawLocationToUILocation): + (WebInspector.CompilerScriptMapping.prototype.loadSourceMapForScript): + (WebInspector.CompilerScriptMapping.prototype._reset): + * inspector/front-end/NetworkUISourceCodeProvider.js: + (WebInspector.NetworkUISourceCodeProvider): + (WebInspector.NetworkUISourceCodeProvider.prototype._parsedScriptSource): + (WebInspector.NetworkUISourceCodeProvider.prototype._resourceAdded): + (WebInspector.NetworkUISourceCodeProvider.prototype._addUISourceCode): + (WebInspector.NetworkUISourceCodeProvider.prototype._projectWillReset): + * inspector/front-end/SASSSourceMapping.js: + (WebInspector.SASSSourceMapping): + (_bindUISourceCode): + (_reset): + +2012-10-22 Nicolas Dufresne <nicolas.dufresne@collabora.com> + + Gstreamer 1.0 not working + https://bugs.webkit.org/show_bug.cgi?id=99852 + + Reviewed by Philippe Normand. + + There was a series of trivial issue, g_object_is_floating() was called + on type GstCaps (which is not a GObject), webkitGstGetPadCaps() was + returning non-fixed caps and GST_MESSAGE_DURATION has been renamed + to GST_MESSAGE_DURATION_CHANGED. + + Most failing test passes now. + + * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: + (WTF::adoptGRef): + * platform/graphics/gstreamer/GStreamerVersioning.cpp: + (webkitGstGetPadCaps): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::handleMessage): + +2012-10-22 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Treat dynamic anonymous scripts as other anonymous and fix anonymous script editing and breakpoints. + https://bugs.webkit.org/show_bug.cgi?id=99989 + + Reviewed by Pavel Feldman. + + Dynamic anonymous scripts are now mapped to anonymous temporary uiSourceCodes. + ResourceScriptMapping now supports two types of temporary uiSourceCodes: + - original uiSourceCodes represent scripts while main uiSourceCodes are diverged; + - temporary uiSourceCodes represent scripts for which resources are not yet loaded. + + * inspector/front-end/BreakpointManager.js: + (WebInspector.BreakpointManager.breakpointStorageId): + (WebInspector.BreakpointManager.Storage.prototype._updateBreakpoint): + * inspector/front-end/NetworkUISourceCodeProvider.js: + (WebInspector.NetworkUISourceCodeProvider.prototype._parsedScriptSource): + * inspector/front-end/ResourceScriptMapping.js: + (WebInspector.ResourceScriptMapping): + (WebInspector.ResourceScriptMapping.prototype.rawLocationToUILocation): + (WebInspector.ResourceScriptMapping.prototype._hasMergedToVM): + (WebInspector.ResourceScriptMapping.prototype.addScript): + (WebInspector.ResourceScriptMapping.prototype._deleteOriginalUISourceCodeForScripts): + (WebInspector.ResourceScriptMapping.prototype._deleteTemporaryUISourceCodeForScripts): + (WebInspector.ResourceScriptMapping.prototype._bindUISourceCodeToScripts): + (WebInspector.ResourceScriptMapping.prototype._createUISourceCode): + (WebInspector.ResourceScriptMapping.prototype._getOrCreateTemporaryUISourceCode): + (WebInspector.ResourceScriptMapping.prototype._getOrCreateOriginalUISourceCode): + (WebInspector.ResourceScriptMapping.prototype._uiSourceCodeAddedToWorkspace): + (WebInspector.ResourceScriptMapping.prototype._scriptsForUISourceCode.get if): + (WebInspector.ResourceScriptMapping.prototype._reset): + +2012-10-22 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> + + [css3-text] Add rendering support for -webkit-text-decoration-style + https://bugs.webkit.org/show_bug.cgi?id=94094 + + Reviewed by Julien Chaffraix. + + This patch implements the "text-decoration-style" property rendering as + specified in CSS3 working draft, with "-webkit-" prefix. The specification can + be found here: http://dev.w3.org/csswg/css3-text/#text-decoration-style + + Additionally, Mozilla implementation details can be found here: + https://developer.mozilla.org/en/CSS/text-decoration-style + + Tests: fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style.html + fast/css3-text/css3-text-decoration/text-decoration-style.html + + * platform/graphics/GraphicsContext.h: + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::setPlatformStrokeStyle): + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::drawLine): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::toQPenStyle): + (WebCore::GraphicsContext::drawLine): + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::setupPaintForStroking): + * platform/graphics/wince/GraphicsContextWinCE.cpp: + (WebCore::createPen): + * platform/graphics/wx/GraphicsContextWx.cpp: + (WebCore::strokeStyleToWxPenStyle): + Added 'DoubleStroke' and 'WavyStroke' to StrokeStyle enum and updated + platform-specific stroke handling. Some styles requires + platform-specific implementation (handled in bug 92868). + * rendering/InlineTextBox.cpp: + (WebCore::InlineTextBox::paint): + (WebCore::textDecorationStyleToStrokeStyle): Added static function that + translates text decoration to stroke styles. + (WebCore::InlineTextBox::paintDecoration): Text decoration style does + not specify a property for line thickness (like border-width does for + border style), so we statically set it to 1 for now. The 'double' style + implementation simply adds a parallel line (depending if it is + underline, overline or line-through) and the space between lines follows + the approach used by border's 'double' style. + * rendering/InlineTextBox.h: + (InlineTextBox): + * rendering/style/RenderStyle.h: + * rendering/style/RenderStyleConstants.h: + Added text decoration style rendering support to + InlineTextBox::paintDecoration(). + +2012-10-22 Allan Sandfeld Jensen <allan.jensen@digia.com> + + [Qt] Use the DNS resolve queue + https://bugs.webkit.org/show_bug.cgi?id=99994 + + Reviewed by Simon Hausmann. + + Use the DNS resolve queue, to ensure we can prefetch more than just the first 10 hostname encountered + during parsing. It also ensure each hostname is only appears once in the queue. + + * Target.pri: + * platform/network/qt/DNSQt.cpp: Added. + (DnsPrefetchHelper): + (WebCore::DnsPrefetchHelper::DnsPrefetchHelper): + (WebCore::DnsPrefetchHelper::lookup): + (WebCore::DnsPrefetchHelper::lookedUp): + (WebCore::prefetchDNS): + (WebCore::DNSResolveQueue::platformProxyIsEnabledInSystemPreferences): + (WebCore::DNSResolveQueue::platformResolve): + * platform/network/qt/DnsPrefetchHelper.cpp: Removed. + * platform/network/qt/DnsPrefetchHelper.h: Removed. + (DnsPrefetchHelper): + +2012-10-22 Erik Arvidsson <arv@chromium.org> + + HTMLBaseElement href attribute binding returns wrong URL + https://bugs.webkit.org/show_bug.cgi?id=98184 + + Reviewed by Ojan Vafai. + + Resolve the href attribute binding relative to the document URL instead of resolving it to the + base element itself. If there is no href attribute this should return the fallback base URL. + + http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-base-element + + Tests: fast/dom/HTMLAnchorElement/set-href-attribute-rebase.html + fast/dom/HTMLBaseElement/href-attribute-resolves-with-respect-to-document.html + + * html/HTMLBaseElement.cpp: + (WebCore::HTMLBaseElement::href): Don't use completeURL. Resolve href based on document's URL instead + of the generic [Reflect, URL] binding. + (WebCore::HTMLBaseElement::setHref): Just sets the attribute. + * html/HTMLBaseElement.h: + * html/HTMLBaseElement.idl: We can no longer use [Reflect, URL] + +2012-10-22 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Revisions should not be restored and persisted for anonymous uiSourceCodes. + https://bugs.webkit.org/show_bug.cgi?id=99991 + + Reviewed by Alexander Pavlov. + + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode): + +2012-10-22 Florin Malita <fmalita@chromium.org> + + Incorrect embedded SVG image sizing on first load + https://bugs.webkit.org/show_bug.cgi?id=99489 + + Reviewed by Nikolas Zimmermann. + + RenderSVGImage::updateImageViewport() must be called after the image loader is finished, + to ensure that a SVGImageCache::SizeAndScalesMap entry is created even if layout has + already been performed. + + Test: svg/custom/svg-image-initial-size.html + + * rendering/svg/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::imageChanged): + 2012-10-22 Keishi Hattori <keishi@webkit.org> Remove monthFormatInLDML diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index cff98c86e..7b85ba4fb 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -3845,6 +3845,8 @@ webcore_sources += \ Source/WebCore/loader/cache/CachedResourceHandle.h \ Source/WebCore/loader/cache/CachedResourceLoader.cpp \ Source/WebCore/loader/cache/CachedResourceLoader.h \ + Source/WebCore/loader/cache/CachedResourceRequest.cpp \ + Source/WebCore/loader/cache/CachedResourceRequest.h \ Source/WebCore/loader/cache/CachedScript.cpp \ Source/WebCore/loader/cache/CachedScript.h \ Source/WebCore/loader/cache/CachedShader.cpp \ diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp index 990e3a455..f2ad16342 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp @@ -39,6 +39,7 @@ #include "IDBTransaction.h" #include "ScriptCallStack.h" #include "ScriptExecutionContext.h" +#include <limits> namespace WebCore { @@ -80,7 +81,6 @@ IDBCursor::IDBCursor(PassRefPtr<IDBCursorBackendInterface> backend, Direction di , m_transaction(transaction) , m_transactionNotifier(transaction, this) , m_gotValue(false) - , m_valueIsDirty(true) { ASSERT(m_backend); ASSERT(m_request); @@ -113,10 +113,9 @@ PassRefPtr<IDBKey> IDBCursor::primaryKey() const return m_currentPrimaryKey; } -PassRefPtr<IDBAny> IDBCursor::value() +const ScriptValue& IDBCursor::value() const { IDB_TRACE("IDBCursor::value"); - m_valueIsDirty = false; return m_currentValue; } @@ -156,7 +155,7 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, Script return objectStore->put(IDBObjectStoreBackendInterface::CursorUpdate, IDBAny::create(this), context, value, m_currentPrimaryKey, ec); } -void IDBCursor::advance(long count, ExceptionCode& ec) +void IDBCursor::advance(long long count, ExceptionCode& ec) { IDB_TRACE("IDBCursor::advance"); if (!m_gotValue) { @@ -170,8 +169,7 @@ void IDBCursor::advance(long count, ExceptionCode& ec) } // FIXME: This should only need to check for 0 once webkit.org/b/96798 lands. - const int64_t maxECMAScriptInteger = 0x20000000000000LL - 1; - if (count < 1 || count > maxECMAScriptInteger) { + if (count < 1 || count > UINT_MAX) { ec = NATIVE_TYPE_ERR; return; } @@ -277,10 +275,9 @@ void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primary ASSERT_UNUSED(injected, injected); } } - m_currentValue = IDBAny::create(value); + m_currentValue = value; m_gotValue = true; - m_valueIsDirty = true; } PassRefPtr<IDBObjectStore> IDBCursor::effectiveObjectStore() diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.h b/Source/WebCore/Modules/indexeddb/IDBCursor.h index 5589c222f..abe6becd8 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.h +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.h @@ -72,11 +72,12 @@ public: const String& direction() const; PassRefPtr<IDBKey> key() const; PassRefPtr<IDBKey> primaryKey() const; - PassRefPtr<IDBAny> value(); + const ScriptValue& value() const; IDBAny* source() const; PassRefPtr<IDBRequest> update(ScriptExecutionContext*, ScriptValue&, ExceptionCode&); - void advance(long, ExceptionCode&); + // FIXME: Make this unsigned long once webkit.org/b/96798 lands. + void advance(long long, ExceptionCode&); void continueFunction(PassRefPtr<IDBKey>, ExceptionCode&); PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, ExceptionCode&); @@ -84,11 +85,6 @@ public: void close(); void setValueReady(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, ScriptValue&); - // The spec requires that the script object that wraps the value - // be unchanged until the value changes as a result of the cursor - // advancing. - bool valueIsDirty() { return m_valueIsDirty; } - protected: IDBCursor(PassRefPtr<IDBCursorBackendInterface>, Direction, IDBRequest*, IDBAny* source, IDBTransaction*); virtual bool isKeyCursor() const { return true; } @@ -107,8 +103,7 @@ private: // are still valid for the current success handlers. RefPtr<IDBKey> m_currentKey; RefPtr<IDBKey> m_currentPrimaryKey; - RefPtr<IDBAny> m_currentValue; - bool m_valueIsDirty; + ScriptValue m_currentValue; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.idl b/Source/WebCore/Modules/indexeddb/IDBCursor.idl index b514fe951..0d9dd0ad1 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.idl +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.idl @@ -40,7 +40,7 @@ [CallWith=ScriptExecutionContext] IDBRequest update(in any value) raises (IDBDatabaseException); // FIXME: Make this [EnforceRange] unsigned long once webkit.org/b/96798 lands. - void advance(in long count) + void advance(in long long count) raises (IDBDatabaseException); [ImplementedAs=continueFunction] void continue(in [Optional] IDBKey key) raises (IDBDatabaseException); diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl index 98cc65b32..01750dcba 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl +++ b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl @@ -26,5 +26,5 @@ [ Conditional=INDEXED_DATABASE ] interface IDBCursorWithValue : IDBCursor { - [V8CustomGetter] readonly attribute IDBAny value; + readonly attribute any value; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp index e3ec15b29..3fcc38f66 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp @@ -326,10 +326,7 @@ private: ASSERT(!ec); RefPtr<IDBKey> primaryKey = cursor->primaryKey(); - RefPtr<IDBAny> valueAny = cursor->value(); - - ASSERT(valueAny->type() == IDBAny::ScriptValueType); - ScriptValue value = valueAny->scriptValue(); + ScriptValue value = cursor->value(); IDBObjectStore::IndexKeys indexKeys; generateIndexKeysForValue(m_indexMetadata, value, &indexKeys); diff --git a/Source/WebCore/Modules/mediasource/MediaSource.cpp b/Source/WebCore/Modules/mediasource/MediaSource.cpp index 97a57383b..a915c273d 100644 --- a/Source/WebCore/Modules/mediasource/MediaSource.cpp +++ b/Source/WebCore/Modules/mediasource/MediaSource.cpp @@ -42,11 +42,13 @@ namespace WebCore { PassRefPtr<MediaSource> MediaSource::create(ScriptExecutionContext* context) { - return adoptRef(new MediaSource(context)); + RefPtr<MediaSource> mediaSource(adoptRef(new MediaSource(context))); + mediaSource->suspendIfNeeded(); + return mediaSource.release(); } MediaSource::MediaSource(ScriptExecutionContext* context) - : ContextDestructionObserver(context) + : ActiveDOMObject(context, this) , m_readyState(closedKeyword()) , m_player(0) , m_asyncEventQueue(GenericEventQueue::create(this)) @@ -325,7 +327,19 @@ const AtomicString& MediaSource::interfaceName() const ScriptExecutionContext* MediaSource::scriptExecutionContext() const { - return ContextDestructionObserver::scriptExecutionContext(); + return ActiveDOMObject::scriptExecutionContext(); +} + +bool MediaSource::hasPendingActivity() const +{ + return m_player || m_asyncEventQueue->hasPendingEvents() + || ActiveDOMObject::hasPendingActivity(); +} + +void MediaSource::stop() +{ + m_player = 0; + m_asyncEventQueue->cancelAllEvents(); } EventTargetData* MediaSource::eventTargetData() diff --git a/Source/WebCore/Modules/mediasource/MediaSource.h b/Source/WebCore/Modules/mediasource/MediaSource.h index 2ed2bf2c3..1d3f3476b 100644 --- a/Source/WebCore/Modules/mediasource/MediaSource.h +++ b/Source/WebCore/Modules/mediasource/MediaSource.h @@ -33,7 +33,7 @@ #if ENABLE(MEDIA_SOURCE) -#include "ContextDestructionObserver.h" +#include "ActiveDOMObject.h" #include "GenericEventQueue.h" #include "MediaPlayer.h" #include "SourceBuffer.h" @@ -42,7 +42,7 @@ namespace WebCore { -class MediaSource : public RefCounted<MediaSource>, public EventTarget, public ContextDestructionObserver { +class MediaSource : public RefCounted<MediaSource>, public EventTarget, public ActiveDOMObject { public: static const String& openKeyword(); static const String& closedKeyword(); @@ -76,6 +76,10 @@ public: virtual const AtomicString& interfaceName() const OVERRIDE; virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; + // ActiveDOMObject interface + virtual bool hasPendingActivity() const OVERRIDE; + virtual void stop() OVERRIDE; + using RefCounted<MediaSource>::ref; using RefCounted<MediaSource>::deref; diff --git a/Source/WebCore/Modules/mediasource/MediaSource.idl b/Source/WebCore/Modules/mediasource/MediaSource.idl index bc0f6c969..6168a217a 100644 --- a/Source/WebCore/Modules/mediasource/MediaSource.idl +++ b/Source/WebCore/Modules/mediasource/MediaSource.idl @@ -31,6 +31,7 @@ [ Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource, + ActiveDOMObject, EventTarget, Constructor, CallWith=ScriptExecutionContext diff --git a/Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp b/Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp index 0fb8ceb38..1c6267467 100644 --- a/Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp +++ b/Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp @@ -49,13 +49,24 @@ MediaSourceRegistry& MediaSourceRegistry::registry() void MediaSourceRegistry::registerMediaSourceURL(const KURL& url, PassRefPtr<MediaSource> source) { ASSERT(isMainThread()); + + source->setPendingActivity(source.get()); + m_mediaSources.set(url.string(), source); } void MediaSourceRegistry::unregisterMediaSourceURL(const KURL& url) { ASSERT(isMainThread()); - m_mediaSources.remove(url.string()); + HashMap<String, RefPtr<MediaSource> >::iterator iter = m_mediaSources.find(url.string()); + if (iter == m_mediaSources.end()) + return; + + RefPtr<MediaSource> source = iter->value; + m_mediaSources.remove(iter); + + // Remove the pending activity added in registerMediaSourceURL(). + source->unsetPendingActivity(source.get()); } MediaSource* MediaSourceRegistry::lookupMediaSource(const String& url) diff --git a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl index a838c791f..c7c0254a1 100644 --- a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl +++ b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl @@ -48,8 +48,8 @@ void stop(in double when); #if defined(ENABLE_LEGACY_WEB_AUDIO) && ENABLE_LEGACY_WEB_AUDIO - [V8MeasureAs=LegacyWebAudioNoteOn] void noteOn(in double when); - [V8MeasureAs=LegacyWebAudioNoteOn] void noteGrainOn(in double when, in double grainOffset, in double grainDuration); + [V8MeasureAs=LegacyWebAudio] void noteOn(in double when); + [V8MeasureAs=LegacyWebAudio] void noteGrainOn(in double when, in double grainOffset, in double grainDuration); void noteOff(in double when); #endif }; diff --git a/Source/WebCore/Modules/webaudio/AudioContext.cpp b/Source/WebCore/Modules/webaudio/AudioContext.cpp index 233a32454..fceddf3de 100644 --- a/Source/WebCore/Modules/webaudio/AudioContext.cpp +++ b/Source/WebCore/Modules/webaudio/AudioContext.cpp @@ -420,19 +420,19 @@ PassRefPtr<MediaStreamAudioSourceNode> AudioContext::createMediaStreamSource(Med } #endif -PassRefPtr<ScriptProcessorNode> AudioContext::createJavaScriptNode(size_t bufferSize, ExceptionCode& ec) +PassRefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t bufferSize, ExceptionCode& ec) { // Set number of input/output channels to stereo by default. - return createJavaScriptNode(bufferSize, 2, 2, ec); + return createScriptProcessor(bufferSize, 2, 2, ec); } -PassRefPtr<ScriptProcessorNode> AudioContext::createJavaScriptNode(size_t bufferSize, size_t numberOfInputChannels, ExceptionCode& ec) +PassRefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, ExceptionCode& ec) { // Set number of output channels to stereo by default. - return createJavaScriptNode(bufferSize, numberOfInputChannels, 2, ec); + return createScriptProcessor(bufferSize, numberOfInputChannels, 2, ec); } -PassRefPtr<ScriptProcessorNode> AudioContext::createJavaScriptNode(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode& ec) +PassRefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode& ec) { ASSERT(isMainThread()); lazyInitialize(); @@ -489,20 +489,20 @@ PassRefPtr<AnalyserNode> AudioContext::createAnalyser() return AnalyserNode::create(this, m_destinationNode->sampleRate()); } -PassRefPtr<GainNode> AudioContext::createGainNode() +PassRefPtr<GainNode> AudioContext::createGain() { ASSERT(isMainThread()); lazyInitialize(); return GainNode::create(this, m_destinationNode->sampleRate()); } -PassRefPtr<DelayNode> AudioContext::createDelayNode() +PassRefPtr<DelayNode> AudioContext::createDelay() { const double defaultMaxDelayTime = 1; - return createDelayNode(defaultMaxDelayTime); + return createDelay(defaultMaxDelayTime); } -PassRefPtr<DelayNode> AudioContext::createDelayNode(double maxDelayTime) +PassRefPtr<DelayNode> AudioContext::createDelay(double maxDelayTime) { ASSERT(isMainThread()); lazyInitialize(); diff --git a/Source/WebCore/Modules/webaudio/AudioContext.h b/Source/WebCore/Modules/webaudio/AudioContext.h index 08167f531..267ee4262 100644 --- a/Source/WebCore/Modules/webaudio/AudioContext.h +++ b/Source/WebCore/Modules/webaudio/AudioContext.h @@ -119,18 +119,18 @@ public: #if ENABLE(MEDIA_STREAM) PassRefPtr<MediaStreamAudioSourceNode> createMediaStreamSource(MediaStream*, ExceptionCode&); #endif - PassRefPtr<GainNode> createGainNode(); + PassRefPtr<GainNode> createGain(); PassRefPtr<BiquadFilterNode> createBiquadFilter(); PassRefPtr<WaveShaperNode> createWaveShaper(); - PassRefPtr<DelayNode> createDelayNode(); - PassRefPtr<DelayNode> createDelayNode(double maxDelayTime); + PassRefPtr<DelayNode> createDelay(); + PassRefPtr<DelayNode> createDelay(double maxDelayTime); PassRefPtr<PannerNode> createPanner(); PassRefPtr<ConvolverNode> createConvolver(); PassRefPtr<DynamicsCompressorNode> createDynamicsCompressor(); PassRefPtr<AnalyserNode> createAnalyser(); - PassRefPtr<ScriptProcessorNode> createJavaScriptNode(size_t bufferSize, ExceptionCode&); - PassRefPtr<ScriptProcessorNode> createJavaScriptNode(size_t bufferSize, size_t numberOfInputChannels, ExceptionCode&); - PassRefPtr<ScriptProcessorNode> createJavaScriptNode(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode&); + PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, ExceptionCode&); + PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, ExceptionCode&); + PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode&); PassRefPtr<ChannelSplitterNode> createChannelSplitter(ExceptionCode&); PassRefPtr<ChannelSplitterNode> createChannelSplitter(size_t numberOfOutputs, ExceptionCode&); PassRefPtr<ChannelMergerNode> createChannelMerger(ExceptionCode&); diff --git a/Source/WebCore/Modules/webaudio/AudioContext.idl b/Source/WebCore/Modules/webaudio/AudioContext.idl index 8ee2dc29d..00f49cfe3 100644 --- a/Source/WebCore/Modules/webaudio/AudioContext.idl +++ b/Source/WebCore/Modules/webaudio/AudioContext.idl @@ -69,15 +69,15 @@ #endif // Processing nodes - GainNode createGainNode(); - DelayNode createDelayNode(in [Optional] double maxDelayTime); + GainNode createGain(); + DelayNode createDelay(in [Optional] double maxDelayTime); BiquadFilterNode createBiquadFilter(); WaveShaperNode createWaveShaper(); PannerNode createPanner(); ConvolverNode createConvolver(); DynamicsCompressorNode createDynamicsCompressor(); AnalyserNode createAnalyser(); - ScriptProcessorNode createJavaScriptNode(in unsigned long bufferSize, in [Optional] unsigned long numberOfInputChannels, in [Optional] unsigned long numberOfOutputChannels) + ScriptProcessorNode createScriptProcessor(in unsigned long bufferSize, in [Optional] unsigned long numberOfInputChannels, in [Optional] unsigned long numberOfOutputChannels) raises(DOMException); OscillatorNode createOscillator(); WaveTable createWaveTable(in Float32Array real, in Float32Array imag) @@ -93,4 +93,13 @@ // void prepareOfflineBufferRendering(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate); attribute EventListener oncomplete; void startRendering(); + +#if defined(ENABLE_LEGACY_WEB_AUDIO) && ENABLE_LEGACY_WEB_AUDIO + [V8MeasureAs=LegacyWebAudio, ImplementedAs=createGain] GainNode createGainNode(); + [V8MeasureAs=LegacyWebAudio, ImplementedAs=createDelay] DelayNode createDelayNode(in [Optional] double maxDelayTime); + + [V8MeasureAs=LegacyWebAudio, ImplementedAs=createScriptProcessor] ScriptProcessorNode createJavaScriptNode(in unsigned long bufferSize, in [Optional] unsigned long numberOfInputChannels, in [Optional] unsigned long numberOfOutputChannels) + raises(DOMException); +#endif + }; diff --git a/Source/WebCore/Resources/pagepopups/suggestionPicker.css b/Source/WebCore/Resources/pagepopups/suggestionPicker.css index dbde03e18..1b7af0394 100644 --- a/Source/WebCore/Resources/pagepopups/suggestionPicker.css +++ b/Source/WebCore/Resources/pagepopups/suggestionPicker.css @@ -5,8 +5,7 @@ font: -webkit-small-control; border: 1px solid #7f9db9; background-color: white; - overflow-x: hidden; - overflow-y: auto; + overflow: hidden; } .suggestion-list-entry { diff --git a/Source/WebCore/Resources/pagepopups/suggestionPicker.js b/Source/WebCore/Resources/pagepopups/suggestionPicker.js index 084406364..503494d75 100644 --- a/Source/WebCore/Resources/pagepopups/suggestionPicker.js +++ b/Source/WebCore/Resources/pagepopups/suggestionPicker.js @@ -155,6 +155,7 @@ SuggestionPicker.prototype._fixWindowSize = function() { this._containerElement.style.maxHeight = (maxHeight - ListBorder) + "px"; desiredWindowWidth += getScrollbarWidth(); desiredWindowHeight = maxHeight; + this._containerElement.style.overflowY = "scroll"; } var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, desiredWindowWidth, 0); diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index 0dd49e7a3..f2c4d6d85 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -817,6 +817,7 @@ SOURCES += \ loader/CrossOriginAccessControl.cpp \ loader/CrossOriginPreflightResultCache.cpp \ loader/cache/CachedResourceLoader.cpp \ + loader/cache/CachedResourceRequest.cpp \ loader/DocumentLoadTiming.cpp \ loader/DocumentLoader.cpp \ loader/DocumentThreadableLoader.cpp \ @@ -2216,6 +2217,7 @@ HEADERS += \ platform/network/Credential.h \ platform/network/CredentialStorage.h \ platform/network/ContentTypeParser.h \ + platform/network/DNSResolveQueue.h \ platform/network/FormDataBuilder.h \ platform/network/FormData.h \ platform/network/HTTPHeaderMap.h \ @@ -2237,7 +2239,6 @@ HEADERS += \ platform/network/ResourceLoadTiming.h \ platform/network/ResourceRequestBase.h \ platform/network/ResourceResponseBase.h \ - platform/network/qt/DnsPrefetchHelper.h \ platform/network/qt/NetworkStateNotifierPrivate.h \ platform/PlatformExportMacros.h \ platform/PlatformMemoryInstrumentation.h \ @@ -2792,11 +2793,12 @@ SOURCES += \ platform/graphics/texmap/TextureMapperBackingStore.cpp \ platform/graphics/texmap/TextureMapperImageBuffer.cpp \ platform/graphics/texmap/TextureMapperLayer.cpp \ + platform/network/DNSResolveQueue.cpp \ platform/network/MIMESniffing.cpp \ platform/network/qt/CredentialStorageQt.cpp \ platform/network/qt/ResourceHandleQt.cpp \ platform/network/qt/ResourceRequestQt.cpp \ - platform/network/qt/DnsPrefetchHelper.cpp \ + platform/network/qt/DNSQt.cpp \ platform/network/qt/NetworkStateNotifierQt.cpp \ platform/network/qt/ProxyServerQt.cpp \ platform/network/qt/QtMIMETypeSniffer.cpp \ diff --git a/Source/WebCore/UseV8.cmake b/Source/WebCore/UseV8.cmake index 5cd42c803..82b1da4fa 100644 --- a/Source/WebCore/UseV8.cmake +++ b/Source/WebCore/UseV8.cmake @@ -24,7 +24,6 @@ LIST(APPEND WebCore_SOURCES bindings/v8/DOMWrapperWorld.cpp bindings/v8/DateExtension.cpp bindings/v8/IDBBindingUtilities.cpp - bindings/v8/IDBCustomBindings.cpp bindings/v8/Dictionary.cpp bindings/v8/PageScriptDebugServer.cpp bindings/v8/RetainedDOMInfo.cpp diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 08c5d67f3..b1c7a1e81 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -206,6 +206,7 @@ 'loader/cache/CachedResourceClient.h', 'loader/cache/CachedResourceHandle.h', 'loader/cache/CachedResourceLoader.h', + 'loader/cache/CachedResourceRequest.h', 'loader/cache/CachedShader.h', 'loader/cache/CachedStyleSheetClient.h', 'loader/cache/MemoryCache.h', @@ -2236,7 +2237,6 @@ 'bindings/v8/DateExtension.h', 'bindings/v8/IDBBindingUtilities.cpp', 'bindings/v8/IDBBindingUtilities.h', - 'bindings/v8/IDBCustomBindings.cpp', 'bindings/v8/IntrusiveDOMWrapperMap.h', 'bindings/v8/JavaScriptCallFrame.cpp', 'bindings/v8/JavaScriptCallFrame.h', @@ -3063,6 +3063,7 @@ 'loader/cache/CachedResourceClientWalker.h', 'loader/cache/CachedResourceHandle.cpp', 'loader/cache/CachedResourceLoader.cpp', + 'loader/cache/CachedResourceRequest.cpp', 'loader/cache/CachedScript.cpp', 'loader/cache/CachedScript.h', 'loader/cache/CachedShader.cpp', @@ -5535,6 +5536,8 @@ 'platform/network/Credential.cpp', 'platform/network/CredentialStorage.cpp', 'platform/network/DNS.h', + 'platform/network/DNSResolveQueue.cpp', + 'platform/network/DNSResolveQueue.h', 'platform/network/DataURL.cpp', 'platform/network/DataURL.h', 'platform/network/FormData.cpp', @@ -5625,8 +5628,7 @@ 'platform/network/mac/WebCoreURLResponse.mm', 'platform/network/qt/AuthenticationChallenge.h', 'platform/network/qt/CredentialStorageQt.cpp', - 'platform/network/qt/DnsPrefetchHelper.cpp', - 'platform/network/qt/DnsPrefetchHelper.h', + 'platform/network/qt/DNSQt.cpp', 'platform/network/qt/NetworkStateNotifierPrivate.h', 'platform/network/qt/NetworkStateNotifierQt.cpp', 'platform/network/qt/ProxyServerQt.cpp', @@ -6510,9 +6512,9 @@ 'webinspector_standalone_css_files': [ 'inspector/front-end/auditsPanel.css', 'inspector/front-end/breadcrumbList.css', + 'inspector/front-end/cm/cmdevtools.css', 'inspector/front-end/cm/codemirror.css', 'inspector/front-end/cssNamedFlows.css', - 'inspector/front-end/cmdevtools.css', 'inspector/front-end/dataGrid.css', 'inspector/front-end/elementsPanel.css', 'inspector/front-end/filteredItemSelectionDialog.css', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 8e4d8515f..fd2561c10 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -28194,6 +28194,14 @@ >
</File>
<File
+ RelativePath="..\loader\cache\CachedResourceRequest.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\loader\cache\CachedResourceRequest.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\cache\CachedScript.cpp"
>
</File>
@@ -64950,58 +64958,6 @@ >
</File>
<File
- RelativePath="..\bindings\js\IDBCustomBindings.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Production|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath="..\bindings\js\JavaScriptCallFrame.cpp"
>
<FileConfiguration
@@ -76214,6 +76170,10 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\cm\cmdevtools.css"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\cm\codemirror.css"
>
</File>
@@ -76238,10 +76198,6 @@ >
</File>
<File
- RelativePath="..\inspector\front-end\cmdevtools.css"
- >
- </File>
- <File
RelativePath="..\inspector\front-end\Database.js"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 3689f46b6..6c158566f 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -1491,6 +1491,8 @@ 503D0CAB14B5B08700F32F57 /* CustomFilterProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = 503D0CA814B5B08700F32F57 /* CustomFilterProgram.h */; settings = {ATTRIBUTES = (); }; }; 503D0CAC14B5B08700F32F57 /* CustomFilterProgramClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 503D0CA914B5B08700F32F57 /* CustomFilterProgramClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 503D0CAE14B5B0BA00F32F57 /* StyleCustomFilterProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = 503D0CAD14B5B0BA00F32F57 /* StyleCustomFilterProgram.h */; settings = {ATTRIBUTES = (); }; }; + 5081E3C33CE580C16EF8B48B /* CachedResourceRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5081E3DF3CFC80C16EF8B48B /* CachedResourceRequest.cpp */; }; + 5081E3E03CFF80C16EF8B48B /* CachedResourceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 5081E3E13D0280C16EF8B48B /* CachedResourceRequest.h */; settings = {ATTRIBUTES = (Private, ); }; }; 508CCA4F13CF106B003151F3 /* RenderFlowThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 508CCA4D13CF106B003151F3 /* RenderFlowThread.h */; }; 508CCA5013CF106B003151F3 /* RenderFlowThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 508CCA4E13CF106B003151F3 /* RenderFlowThread.cpp */; }; 50987C26157D676D00BDA835 /* CustomFilterGlobalContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50987C24157D676D00BDA835 /* CustomFilterGlobalContext.cpp */; }; @@ -12963,6 +12965,8 @@ BCB16C0F0979C3BD00467741 /* CachedXSLStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedXSLStyleSheet.h; sourceTree = "<group>"; }; BCB16C100979C3BD00467741 /* CachedResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CachedResourceLoader.cpp; sourceTree = "<group>"; }; BCB16C110979C3BD00467741 /* CachedResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedResourceLoader.h; sourceTree = "<group>"; }; + 5081E3DF3CFC80C16EF8B48B /* CachedResourceRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CachedResourceRequest.cpp; sourceTree = "<group>"; }; + 5081E3E13D0280C16EF8B48B /* CachedResourceRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedResourceRequest.h; sourceTree = "<group>"; }; BCB7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeFilterCondition.cpp; sourceTree = "<group>"; }; BCB7735F0C17853D00132BA4 /* JSNodeFilterCondition.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNodeFilterCondition.h; sourceTree = "<group>"; }; BCB773600C17853D00132BA4 /* JSNodeFilterCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeFilterCustom.cpp; sourceTree = "<group>"; }; @@ -19204,6 +19208,8 @@ E47B4BE60E71241600038854 /* CachedResourceHandle.h */, BCB16C100979C3BD00467741 /* CachedResourceLoader.cpp */, BCB16C110979C3BD00467741 /* CachedResourceLoader.h */, + 5081E3DF3CFC80C16EF8B48B /* CachedResourceRequest.cpp */, + 5081E3E13D0280C16EF8B48B /* CachedResourceRequest.h */, BCB16C0A0979C3BD00467741 /* CachedScript.cpp */, BCB16C0B0979C3BD00467741 /* CachedScript.h */, 5038BE3E1472AD980095E0D1 /* CachedShader.cpp */, @@ -22501,6 +22507,7 @@ BCB16C220979C3BD00467741 /* CachedResourceClientWalker.h in Headers */, E47B4BE80E71241600038854 /* CachedResourceHandle.h in Headers */, BCB16C2A0979C3BD00467741 /* CachedResourceLoader.h in Headers */, + 5081E3E03CFF80C16EF8B48B /* CachedResourceRequest.h in Headers */, BCB16C240979C3BD00467741 /* CachedScript.h in Headers */, BCD533640ED6848900887468 /* CachedScriptSourceProvider.h in Headers */, 5038BE411472AD980095E0D1 /* CachedShader.h in Headers */, @@ -26124,6 +26131,7 @@ BCB16C1F0979C3BD00467741 /* CachedResource.cpp in Sources */, E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */, BCB16C290979C3BD00467741 /* CachedResourceLoader.cpp in Sources */, + 5081E3C33CE580C16EF8B48B /* CachedResourceRequest.cpp in Sources */, BCB16C230979C3BD00467741 /* CachedScript.cpp in Sources */, 5038BE401472AD980095E0D1 /* CachedShader.cpp in Sources */, A104F24314C71F7A009E2C23 /* CachedSVGDocument.cpp in Sources */, diff --git a/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp b/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp index f9e42b84a..3ecc9647a 100644 --- a/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp +++ b/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.cpp @@ -54,7 +54,7 @@ static void webkitAccessibleImageGetImagePosition(AtkImage* image, gint* x, gint static const gchar* webkitAccessibleImageGetImageDescription(AtkImage* image) { - return returnString(core(image)->accessibilityDescription()); + return returnString(accessibilityDescription(core(image))); } static void webkitAccessibleImageGetImageSize(AtkImage* image, gint* width, gint* height) diff --git a/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp b/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp index 43f413f89..a3a0e17c5 100644 --- a/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp +++ b/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.cpp @@ -85,6 +85,65 @@ const char* returnString(const String& str) return returnedString.data(); } +// FIXME: Different kinds of elements are putting the title tag to use +// in different AX fields. This might not be 100% correct but we will +// keep it now in order to achieve consistency with previous behavior. +static bool titleTagShouldBeUsedInDescriptionField(AccessibilityObject* coreObject) +{ + return (coreObject->isLink() && !coreObject->isImageMapLink()) || coreObject->isImage(); +} + +// This should be the "visible" text that's actually on the screen if possible. +// If there's alternative text, that can override the title. +String accessibilityTitle(AccessibilityObject* coreObject) +{ + Vector<AccessibilityText> textOrder; + coreObject->accessibilityText(textOrder); + + unsigned length = textOrder.size(); + for (unsigned k = 0; k < length; k++) { + const AccessibilityText& text = textOrder[k]; + + // Once we encounter visible text, or the text from our children that should be used foremost. + if (text.textSource == VisibleText || text.textSource == ChildrenText) + return text.text; + + // If there's an element that labels this object and it's not exposed, then we should use + // that text as our title. + if (text.textSource == LabelByElementText && !coreObject->exposesTitleUIElement()) + return text.text; + + // Elements of role ToolbarRole will return its title as AlternativeText. + if (coreObject->roleValue() == ToolbarRole && text.textSource == AlternativeText) + return text.text; + + // FIXME: The title tag is used in certain cases for the title. This usage should + // probably be in the description field since it's not "visible". + if (text.textSource == TitleTagText && !titleTagShouldBeUsedInDescriptionField(coreObject)) + return text.text; + } + return String(); +} + +String accessibilityDescription(AccessibilityObject* coreObject) +{ + Vector<AccessibilityText> textOrder; + coreObject->accessibilityText(textOrder); + + unsigned length = textOrder.size(); + for (unsigned k = 0; k < length; k++) { + const AccessibilityText& text = textOrder[k]; + + if (text.textSource == AlternativeText) + return text.text; + + if (text.textSource == TitleTagText && titleTagShouldBeUsedInDescriptionField(coreObject)) + return text.text; + } + + return String(); +} + bool selectionBelongsToObject(AccessibilityObject* coreObject, VisibleSelection& selection) { if (!coreObject || !coreObject->isAccessibilityRenderObject()) diff --git a/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h b/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h index ec1cd51ce..cd69b29d6 100644 --- a/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h +++ b/Source/WebCore/accessibility/gtk/WebKitAccessibleUtil.h @@ -37,6 +37,10 @@ void contentsRelativeToAtkCoordinateType(WebCore::AccessibilityObject*, AtkCoord const char* returnString(const String&); +String accessibilityTitle(WebCore::AccessibilityObject*); + +String accessibilityDescription(WebCore::AccessibilityObject*); + bool selectionBelongsToObject(WebCore::AccessibilityObject*, WebCore::VisibleSelection&); #endif // WebKitAccessibleUtil_h diff --git a/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp b/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp index b197cb243..a1f647b92 100644 --- a/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp +++ b/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp @@ -141,7 +141,7 @@ static const gchar* webkitAccessibleGetName(AtkObject* object) // Nothing worked so far, try with the AccessibilityObject's // title() before going ahead with stringValue(). - String axTitle = coreObject->title(); + String axTitle = accessibilityTitle(coreObject); if (!axTitle.isEmpty()) return returnString(axTitle); @@ -155,7 +155,7 @@ static const gchar* webkitAccessibleGetDescription(AtkObject* object) if (coreObject->isAccessibilityRenderObject()) node = coreObject->node(); if (!node || !node->isHTMLElement() || coreObject->ariaRoleAttribute() != UnknownRole) - return returnString(coreObject->accessibilityDescription()); + return returnString(accessibilityDescription(coreObject)); // atk_table_get_summary returns an AtkObject. We have no summary object, so expose summary here. if (coreObject->roleValue() == TableRole) { @@ -170,7 +170,7 @@ static const gchar* webkitAccessibleGetDescription(AtkObject* object) if (!title.isEmpty()) return returnString(title); - return returnString(coreObject->accessibilityDescription()); + return returnString(accessibilityDescription(coreObject)); } static void setAtkRelationSetFromCoreObject(AccessibilityObject* coreObject, AtkRelationSet* relationSet) diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp index 560ee8c66..df7d15f2b 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.cpp +++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp @@ -31,6 +31,7 @@ #include "JSDOMWindowCustom.h" #include "JSExceptionBase.h" #include "ScriptCallStack.h" +#include <interpreter/Interpreter.h> #include <runtime/DateInstance.h> #include <runtime/Error.h> #include <runtime/ExceptionHelpers.h> @@ -149,6 +150,7 @@ void reportException(ExecState* exec, JSValue exception) if (isTerminatedExecutionException(exception)) return; + Interpreter::ErrorHandlingMode mode(exec); String errorMessage = exception.toString(exec)->value(exec); JSObject* exceptionObject = exception.toObject(exec); int lineNumber = exceptionObject->get(exec, Identifier(exec, "line")).toInt32(exec); diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp index e7ea47bf1..a6ac21d91 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp @@ -181,7 +181,7 @@ JSGlobalData* JSDOMWindowBase::commonJSGlobalData() static JSGlobalData* globalData = 0; if (!globalData) { ScriptController::initializeThreading(); - globalData = JSGlobalData::createLeaked(ThreadStackTypeLarge, LargeHeap).leakRef(); + globalData = JSGlobalData::createLeaked(LargeHeap).leakRef(); globalData->timeoutChecker.setTimeoutInterval(10000); // 10 seconds #ifndef NDEBUG globalData->exclusiveThread = currentThread(); diff --git a/Source/WebCore/bindings/js/JSStorageCustom.cpp b/Source/WebCore/bindings/js/JSStorageCustom.cpp index 24446d43a..e4fe8538e 100644 --- a/Source/WebCore/bindings/js/JSStorageCustom.cpp +++ b/Source/WebCore/bindings/js/JSStorageCustom.cpp @@ -34,9 +34,12 @@ using namespace JSC; namespace WebCore { -bool JSStorage::canGetItemsForName(ExecState*, Storage* impl, PropertyName propertyName) +bool JSStorage::canGetItemsForName(ExecState* exec, Storage* impl, PropertyName propertyName) { - return impl->contains(propertyNameToString(propertyName)); + ExceptionCode ec = 0; + bool result = impl->contains(propertyNameToString(propertyName), ec); + setDOMException(exec, ec); + return result; } JSValue JSStorage::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName) @@ -47,7 +50,10 @@ JSValue JSStorage::nameGetter(ExecState* exec, JSValue slotBase, PropertyName pr if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName)) return asObject(prototype)->get(exec, propertyName); - return jsStringOrNull(exec, thisObj->impl()->getItem(propertyNameToString(propertyName))); + ExceptionCode ec = 0; + JSValue result = jsStringOrNull(exec, thisObj->impl()->getItem(propertyNameToString(propertyName), ec)); + setDOMException(exec, ec); + return result; } bool JSStorage::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) @@ -64,7 +70,9 @@ bool JSStorage::deleteProperty(JSCell* cell, ExecState* exec, PropertyName prope if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName)) return false; - thisObject->m_impl->removeItem(propertyNameToString(propertyName)); + ExceptionCode ec = 0; + thisObject->m_impl->removeItem(propertyNameToString(propertyName), ec); + setDOMException(exec, ec); return true; } @@ -76,9 +84,17 @@ bool JSStorage::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned pr void JSStorage::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { JSStorage* thisObject = jsCast<JSStorage*>(object); - unsigned length = thisObject->m_impl->length(); - for (unsigned i = 0; i < length; ++i) - propertyNames.add(Identifier(exec, thisObject->m_impl->key(i))); + ExceptionCode ec = 0; + unsigned length = thisObject->m_impl->length(ec); + setDOMException(exec, ec); + if (exec->hadException()) + return; + for (unsigned i = 0; i < length; ++i) { + propertyNames.add(Identifier(exec, thisObject->m_impl->key(i, ec))); + setDOMException(exec, ec); + if (exec->hadException()) + return; + } Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } diff --git a/Source/WebCore/bindings/js/WorkerScriptController.cpp b/Source/WebCore/bindings/js/WorkerScriptController.cpp index 55c34767b..e009c0b90 100644 --- a/Source/WebCore/bindings/js/WorkerScriptController.cpp +++ b/Source/WebCore/bindings/js/WorkerScriptController.cpp @@ -55,7 +55,7 @@ using namespace JSC; namespace WebCore { WorkerScriptController::WorkerScriptController(WorkerContext* workerContext) - : m_globalData(JSGlobalData::create(ThreadStackTypeSmall)) + : m_globalData(JSGlobalData::create()) , m_workerContext(workerContext) , m_workerContextWrapper(*m_globalData) , m_executionForbidden(false) diff --git a/Source/WebCore/bindings/v8/DOMData.cpp b/Source/WebCore/bindings/v8/DOMData.cpp index af50a1eca..da6ea5b1a 100644 --- a/Source/WebCore/bindings/v8/DOMData.cpp +++ b/Source/WebCore/bindings/v8/DOMData.cpp @@ -40,7 +40,9 @@ namespace WebCore { DOMDataStore& DOMData::getCurrentStore(v8::Isolate* isolate) { DEFINE_STATIC_LOCAL(StaticDOMDataStore, defaultStore, ()); - V8PerIsolateData* data = V8PerIsolateData::current(isolate); + if (UNLIKELY(!isolate)) + isolate = v8::Isolate::GetCurrent(); + V8PerIsolateData* data = V8PerIsolateData::from(isolate); if (UNLIKELY(data->domDataStore() != 0)) return *data->domDataStore(); V8DOMWindowShell* context = V8DOMWindowShell::getEntered(); diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index a40e75aae..19ba8bf2d 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -96,9 +96,9 @@ namespace WebCore { StringImpl* stringImpl = string.impl(); if (!stringImpl) return isolate ? v8::String::Empty(isolate) : v8::String::Empty(); - - V8PerIsolateData* data = V8PerIsolateData::current(isolate); - return data->stringCache()->v8ExternalString(stringImpl, isolate); + if (UNLIKELY(!isolate)) + isolate = v8::Isolate::GetCurrent(); + return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(stringImpl, isolate); } // Convert a string to a V8 string. @@ -109,14 +109,16 @@ namespace WebCore { inline v8::Handle<v8::Integer> v8Integer(int value, v8::Isolate* isolate = 0) { - V8PerIsolateData* data = V8PerIsolateData::current(isolate); - return data->integerCache()->v8Integer(value); + if (UNLIKELY(!isolate)) + isolate = v8::Isolate::GetCurrent(); + return V8PerIsolateData::from(isolate)->integerCache()->v8Integer(value, isolate); } inline v8::Handle<v8::Integer> v8UnsignedInteger(unsigned value, v8::Isolate* isolate = 0) { - V8PerIsolateData* data = V8PerIsolateData::current(isolate); - return data->integerCache()->v8UnsignedInteger(value); + if (UNLIKELY(!isolate)) + isolate = v8::Isolate::GetCurrent(); + return V8PerIsolateData::from(isolate)->integerCache()->v8UnsignedInteger(value, isolate); } inline v8::Handle<v8::Value> v8Undefined() diff --git a/Source/WebCore/bindings/v8/V8DOMMap.cpp b/Source/WebCore/bindings/v8/V8DOMMap.cpp index 50925a82e..751642fae 100644 --- a/Source/WebCore/bindings/v8/V8DOMMap.cpp +++ b/Source/WebCore/bindings/v8/V8DOMMap.cpp @@ -77,20 +77,10 @@ void removeAllDOMObjects() DOMDataStore& store = DOMData::getCurrentStore(); v8::HandleScope scope; + ASSERT(!isMainThread()); - // The DOM objects with the following types only exist on the main thread. - if (isMainThread()) { - // Remove all DOM nodes. - DOMData::removeObjectsFromWrapperMap<Node>(&store, store.domNodeMap()); - - // Remove all active DOM nodes. - DOMData::removeObjectsFromWrapperMap<Node>(&store, store.activeDomNodeMap()); - } - - // Remove all DOM objects in the wrapper map. + // Note: We skip the Node wrapper maps because they exist only on the main thread. DOMData::removeObjectsFromWrapperMap<void>(&store, store.domObjectMap()); - - // Remove all active DOM objects in the wrapper map. DOMData::removeObjectsFromWrapperMap<void>(&store, store.activeDomObjectMap()); } diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index 9007dab97..95d91e27f 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -101,199 +101,108 @@ public: } }; -// Implements v8::RetainedObjectInfo. -class UnspecifiedGroup : public RetainedObjectInfo { +class ObjectVisitor : public DOMWrapperMap<void>::Visitor { public: - explicit UnspecifiedGroup(void* object) - : m_object(object) - { - ASSERT(m_object); - } - - virtual void Dispose() { delete this; } - - virtual bool IsEquivalent(v8::RetainedObjectInfo* other) - { - ASSERT(other); - return other == this || static_cast<WebCore::RetainedObjectInfo*>(other)->GetEquivalenceClass() == this->GetEquivalenceClass(); - } - - virtual intptr_t GetHash() - { - return PtrHash<void*>::hash(m_object); - } - - virtual const char* GetLabel() - { - return "Object group"; - } - - virtual intptr_t GetEquivalenceClass() + void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper) { - return reinterpret_cast<intptr_t>(m_object); + V8DOMWrapper::domWrapperType(wrapper)->visitDOMWrapper(store, object, wrapper); } - -private: - void* m_object; }; -class GroupId { -public: - GroupId() : m_type(NullType), m_groupId(0) {} - GroupId(Node* node) : m_type(NodeType), m_node(node) {} - GroupId(void* other) : m_type(OtherType), m_other(other) {} - bool operator!() const { return m_type == NullType; } - uintptr_t groupId() const { return m_groupId; } - RetainedObjectInfo* createRetainedObjectInfo() const - { - switch (m_type) { - case NullType: - return 0; - case NodeType: - return new RetainedDOMInfo(m_node); - case OtherType: - return new UnspecifiedGroup(m_other); - default: - return 0; - } +static void addImplicitReferencesForNodeWithEventListeners(Node* node, v8::Persistent<v8::Object> wrapper) +{ + ASSERT(node->hasEventListeners()); + + Vector<v8::Persistent<v8::Value> > listeners; + + EventListenerIterator iterator(node); + while (EventListener* listener = iterator.nextListener()) { + if (listener->type() != EventListener::JSEventListenerType) + continue; + V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener); + if (!v8listener->hasExistingListenerObject()) + continue; + listeners.append(v8listener->existingListenerObjectPersistentHandle()); } - -private: - enum Type { - NullType, - NodeType, - OtherType - }; - Type m_type; - union { - uintptr_t m_groupId; - Node* m_node; - void* m_other; - }; -}; - -class GrouperItem { -public: - GrouperItem(GroupId groupId, v8::Persistent<v8::Object> wrapper) : m_groupId(groupId), m_wrapper(wrapper) {} - uintptr_t groupId() const { return m_groupId.groupId(); } - RetainedObjectInfo* createRetainedObjectInfo() const { return m_groupId.createRetainedObjectInfo(); } - v8::Persistent<v8::Object> wrapper() const { return m_wrapper; } -private: - GroupId m_groupId; - v8::Persistent<v8::Object> m_wrapper; -}; + if (listeners.isEmpty()) + return; -bool operator<(const GrouperItem& a, const GrouperItem& b) -{ - return a.groupId() < b.groupId(); + v8::V8::AddImplicitReferences(wrapper, listeners.data(), listeners.size()); } -typedef Vector<GrouperItem> GrouperList; - -// If the node is in document, put it in the ownerDocument's object group. -// -// If an image element was created by JavaScript "new Image", -// it is not in a document. However, if the load event has not -// been fired (still onloading), it is treated as in the document. -// -// Otherwise, the node is put in an object group identified by the root -// element of the tree to which it belongs. -static GroupId calculateGroupId(Node* node) +static Node* rootForGC(Node* node) { if (node->inDocument() || (node->hasTagName(HTMLNames::imgTag) && static_cast<HTMLImageElement*>(node)->hasPendingActivity())) - return GroupId(node->document()); + return node->document(); - Node* root = node; if (node->isAttributeNode()) { - root = static_cast<Attr*>(node)->ownerElement(); - // If the attribute has no element, no need to put it in the group, - // because it'll always be a group of 1. - if (!root) - return GroupId(); + node = static_cast<Attr*>(node)->ownerElement(); + if (!node) + return 0; } - while (Node* parent = root->parentOrHostNode()) - root = parent; - return GroupId(root); + while (Node* parent = node->parentOrHostNode()) + node = parent; + + return node; } -class ObjectVisitor : public DOMWrapperMap<void>::Visitor { +class ImplicitConnection { public: - void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper) + ImplicitConnection(Node* root, v8::Persistent<v8::Value> wrapper) + : m_root(root) + , m_wrapper(wrapper) { - V8DOMWrapper::domWrapperType(wrapper)->visitDOMWrapper(store, object, wrapper); } + + Node* root() const { return m_root; } + v8::Persistent<v8::Value> wrapper() const { return m_wrapper; } + +public: + Node* m_root; + v8::Persistent<v8::Value> m_wrapper; }; +bool operator<(const ImplicitConnection& left, const ImplicitConnection& right) +{ + return left.root() < right.root(); +} + class NodeVisitor : public DOMWrapperMap<Node>::Visitor { public: void visitDOMWrapper(DOMDataStore*, Node* node, v8::Persistent<v8::Object> wrapper) { - if (node->hasEventListeners()) { - Vector<v8::Persistent<v8::Value> > listeners; - EventListenerIterator iterator(node); - while (EventListener* listener = iterator.nextListener()) { - if (listener->type() != EventListener::JSEventListenerType) - continue; - V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener); - if (!v8listener->hasExistingListenerObject()) - continue; - listeners.append(v8listener->existingListenerObjectPersistentHandle()); - } - if (!listeners.isEmpty()) - v8::V8::AddImplicitReferences(wrapper, listeners.data(), listeners.size()); - } + if (node->hasEventListeners()) + addImplicitReferencesForNodeWithEventListeners(node, wrapper); - GroupId groupId = calculateGroupId(node); - if (!groupId) + Node* root = rootForGC(node); + if (!root) return; - m_grouper.append(GrouperItem(groupId, wrapper)); + m_connections.append(ImplicitConnection(root, wrapper)); } void applyGrouping() { - // Group by sorting by the group id. - std::sort(m_grouper.begin(), m_grouper.end()); - - for (size_t i = 0; i < m_grouper.size(); ) { - // Seek to the next key (or the end of the list). - size_t nextKeyIndex = m_grouper.size(); - for (size_t j = i; j < m_grouper.size(); ++j) { - if (m_grouper[i].groupId() != m_grouper[j].groupId()) { - nextKeyIndex = j; - break; - } - } - - ASSERT(nextKeyIndex > i); + std::sort(m_connections.begin(), m_connections.end()); + Vector<v8::Persistent<v8::Value> > group; + size_t i = 0; + while (i < m_connections.size()) { + Node* root = m_connections[i].root(); - // We only care about a group if it has more than one object. If it only - // has one object, it has nothing else that needs to be kept alive. - if (nextKeyIndex - i <= 1) { - i = nextKeyIndex; - continue; - } - - size_t rootIndex = i; - - Vector<v8::Persistent<v8::Value> > group; - group.reserveCapacity(nextKeyIndex - i); - for (; i < nextKeyIndex; ++i) { - v8::Persistent<v8::Value> wrapper = m_grouper[i].wrapper(); - if (!wrapper.IsEmpty()) - group.append(wrapper); - } + do { + group.append(m_connections[i++].wrapper()); + } while (i < m_connections.size() && root == m_connections[i].root()); if (group.size() > 1) - v8::V8::AddObjectGroup(&group[0], group.size(), m_grouper[rootIndex].createRetainedObjectInfo()); + v8::V8::AddObjectGroup(group.data(), group.size(), new RetainedDOMInfo(root)); - ASSERT(i == nextKeyIndex); + group.shrink(0); } } private: - GrouperList m_grouper; + Vector<ImplicitConnection> m_connections; }; // Create object groups for DOM tree nodes. diff --git a/Source/WebCore/bindings/v8/V8PerIsolateData.h b/Source/WebCore/bindings/v8/V8PerIsolateData.h index 108298638..b7d5f6550 100644 --- a/Source/WebCore/bindings/v8/V8PerIsolateData.h +++ b/Source/WebCore/bindings/v8/V8PerIsolateData.h @@ -52,10 +52,13 @@ class V8PerIsolateData { public: static V8PerIsolateData* create(v8::Isolate*); static void ensureInitialized(v8::Isolate*); - static V8PerIsolateData* current(v8::Isolate* isolate = 0) + static V8PerIsolateData* current() { - if (UNLIKELY(!isolate)) - isolate = v8::Isolate::GetCurrent(); + return from(v8::Isolate::GetCurrent()); + } + static V8PerIsolateData* from(v8::Isolate* isolate) + { + ASSERT(isolate); ASSERT(isolate->GetData()); return static_cast<V8PerIsolateData*>(isolate->GetData()); } diff --git a/Source/WebCore/bindings/v8/V8ValueCache.cpp b/Source/WebCore/bindings/v8/V8ValueCache.cpp index c636f2c01..39cffc5a2 100644 --- a/Source/WebCore/bindings/v8/V8ValueCache.cpp +++ b/Source/WebCore/bindings/v8/V8ValueCache.cpp @@ -61,7 +61,7 @@ void StringCache::remove(StringImpl* stringImpl) v8::Local<v8::String> StringCache::v8ExternalStringSlow(StringImpl* stringImpl, v8::Isolate* isolate) { if (!stringImpl->length()) - return isolate ? v8::String::Empty(isolate) : v8::String::Empty(); + return v8::String::Empty(isolate); v8::String* cachedV8String = m_stringCache.get(stringImpl); if (cachedV8String) { @@ -99,14 +99,14 @@ void WebCoreStringResource::visitStrings(ExternalStringVisitor* visitor) visitor->visitJSExternalString(m_atomicString.impl()); } -void IntegerCache::createSmallIntegers() +void IntegerCache::createSmallIntegers(v8::Isolate* isolate) { ASSERT(!m_initialized); // We initialize m_smallIntegers not in a constructor but in v8Integer(), // because Integer::New() requires a HandleScope. At the point where // IntegerCache is constructed, a HandleScope might not exist. for (int value = 0; value < numberOfCachedSmallIntegers; value++) - m_smallIntegers[value] = v8::Persistent<v8::Integer>::New(v8::Integer::New(value)); + m_smallIntegers[value] = v8::Persistent<v8::Integer>::New(v8::Integer::New(value, isolate)); m_initialized = true; } diff --git a/Source/WebCore/bindings/v8/V8ValueCache.h b/Source/WebCore/bindings/v8/V8ValueCache.h index 72a1b7045..671f68dd4 100644 --- a/Source/WebCore/bindings/v8/V8ValueCache.h +++ b/Source/WebCore/bindings/v8/V8ValueCache.h @@ -156,26 +156,26 @@ public: IntegerCache() : m_initialized(false) { }; ~IntegerCache(); - v8::Handle<v8::Integer> v8Integer(int value) + v8::Handle<v8::Integer> v8Integer(int value, v8::Isolate* isolate) { if (!m_initialized) - createSmallIntegers(); + createSmallIntegers(isolate); if (0 <= value && value < numberOfCachedSmallIntegers) return m_smallIntegers[value]; - return v8::Integer::New(value); + return v8::Integer::New(value, isolate); } - v8::Handle<v8::Integer> v8UnsignedInteger(unsigned value) + v8::Handle<v8::Integer> v8UnsignedInteger(unsigned value, v8::Isolate* isolate) { if (!m_initialized) - createSmallIntegers(); + createSmallIntegers(isolate); if (value < static_cast<unsigned>(numberOfCachedSmallIntegers)) return m_smallIntegers[value]; - return v8::Integer::NewFromUnsigned(value); + return v8::Integer::NewFromUnsigned(value, isolate); } private: - void createSmallIntegers(); + void createSmallIntegers(v8::Isolate*); v8::Persistent<v8::Integer> m_smallIntegers[numberOfCachedSmallIntegers]; bool m_initialized; diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index 14ad4abac..01e476412 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -101,7 +101,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument // 3D canvas contexts can hold on to lots of GPU resources, and we want to take an // opportunity to get rid of them as soon as possible when we navigate away from pages using // them. - V8PerIsolateData* perIsolateData = V8PerIsolateData::current(args.GetIsolate()); + V8PerIsolateData* perIsolateData = V8PerIsolateData::from(args.GetIsolate()); perIsolateData->setShouldCollectGarbageSoon(); v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext*>(result), args.Holder(), args.GetIsolate()); diff --git a/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp index cd9fb1632..b0fa8f3dd 100644 --- a/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp @@ -36,19 +36,32 @@ namespace WebCore { +template<class T> +static v8::Handle<T> setDOMException(ExceptionCode ec, const v8::AccessorInfo& info) +{ + setDOMException(ec, info.GetIsolate()); + return v8::Handle<T>(); +} + // Get an array containing the names of indexed properties in a collection. v8::Handle<v8::Array> V8Storage::namedPropertyEnumerator(const v8::AccessorInfo& info) { Storage* storage = V8Storage::toNative(info.Holder()); - unsigned int length = storage->length(); + ExceptionCode ec = 0; + unsigned length = storage->length(ec); + if (ec) + return setDOMException<v8::Array>(ec, info); v8::Handle<v8::Array> properties = v8::Array::New(length); - for (unsigned int i = 0; i < length; ++i) { - String key = storage->key(i); + for (unsigned i = 0; i < length; ++i) { + String key = storage->key(i, ec); + if (ec) + return setDOMException<v8::Array>(ec, info); ASSERT(!key.isNull()); - String val = storage->getItem(key); + String val = storage->getItem(key, ec); + if (ec) + return setDOMException<v8::Array>(ec, info); properties->Set(v8Integer(i, info.GetIsolate()), v8String(key, info.GetIsolate())); } - return properties; } @@ -57,10 +70,18 @@ static v8::Handle<v8::Value> storageGetter(v8::Local<v8::String> v8Name, const v Storage* storage = V8Storage::toNative(info.Holder()); String name = toWebCoreString(v8Name); - if (name != "length" && storage->contains(name)) - return v8String(storage->getItem(name), info.GetIsolate()); - - return v8Undefined(); + if (name == "length") + return v8Undefined(); + ExceptionCode ec = 0; + bool found = storage->contains(name, ec); + if (ec) + return setDOMException(ec, info.GetIsolate()); + if (!found) + return v8Undefined(); + String result = storage->getItem(name, ec); + if (ec) + return setDOMException(ec, info.GetIsolate()); + return v8String(result, info.GetIsolate()); } v8::Handle<v8::Value> V8Storage::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) @@ -85,10 +106,15 @@ v8::Handle<v8::Integer> V8Storage::namedPropertyQuery(v8::Local<v8::String> v8Na Storage* storage = V8Storage::toNative(info.Holder()); String name = toWebCoreString(v8Name); - if (name != "length" && storage->contains(name)) - return v8Integer(0, info.GetIsolate()); - - return v8::Handle<v8::Integer>(); + if (name == "length") + return v8::Handle<v8::Integer>(); + ExceptionCode ec = 0; + bool found = storage->contains(name, ec); + if (ec) + return setDOMException<v8::Integer>(ec, info); + if (!found) + return v8::Handle<v8::Integer>(); + return v8Integer(0, info.GetIsolate()); } static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Local<v8::Value> v8Value, const v8::AccessorInfo& info) @@ -130,12 +156,16 @@ static v8::Handle<v8::Boolean> storageDeleter(v8::Local<v8::String> v8Name, cons Storage* storage = V8Storage::toNative(info.Holder()); String name = toWebCoreString(v8Name); - if (storage->contains(name)) { - storage->removeItem(name); - return v8Boolean(true, info.GetIsolate()); - } - - return v8::Handle<v8::Boolean>(); + ExceptionCode ec = 0; + bool found = storage->contains(name, ec); + if (ec) + return setDOMException<v8::Boolean>(ec, info); + if (!found) + return v8::Handle<v8::Boolean>(); + storage->removeItem(name, ec); + if (ec) + return setDOMException<v8::Boolean>(ec, info); + return v8Boolean(true, info.GetIsolate()); } v8::Handle<v8::Boolean> V8Storage::indexedPropertyDeleter(uint32_t index, const v8::AccessorInfo& info) diff --git a/Source/WebCore/css/CSSFontFaceSrcValue.cpp b/Source/WebCore/css/CSSFontFaceSrcValue.cpp index 2a1c04787..369078933 100644 --- a/Source/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/Source/WebCore/css/CSSFontFaceSrcValue.cpp @@ -27,6 +27,7 @@ #include "CSSFontFaceSrcValue.h" #include "CachedFont.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "FontCustomPlatformData.h" #include "Node.h" @@ -95,7 +96,7 @@ bool CSSFontFaceSrcValue::hasFailedOrCanceledSubresources() const CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document) { if (!m_cachedFont) { - ResourceRequest request(document->completeURL(m_resource)); + CachedResourceRequest request(ResourceRequest(document->completeURL(m_resource))); m_cachedFont = document->cachedResourceLoader()->requestFont(request); } return m_cachedFont.get(); @@ -113,4 +114,3 @@ void CSSFontFaceSrcValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryOb } } - diff --git a/Source/WebCore/css/CSSImageSetValue.cpp b/Source/WebCore/css/CSSImageSetValue.cpp index 6e02a20f9..6dc76f580 100644 --- a/Source/WebCore/css/CSSImageSetValue.cpp +++ b/Source/WebCore/css/CSSImageSetValue.cpp @@ -32,6 +32,7 @@ #include "CSSPrimitiveValue.h" #include "CachedImage.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "Page.h" #include "StyleCachedImageSet.h" @@ -108,7 +109,7 @@ StyleCachedImageSet* CSSImageSetValue::cachedImageSet(CachedResourceLoader* load // All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(), // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698 ImageWithScale image = bestImageForScaleFactor(); - ResourceRequest request(loader->document()->completeURL(image.imageURL)); + CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(image.imageURL))); if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request)) { m_imageSet = StyleCachedImageSet::create(cachedImage.get(), image.scaleFactor, this); m_accessedBestFitImage = true; diff --git a/Source/WebCore/css/CSSImageValue.cpp b/Source/WebCore/css/CSSImageValue.cpp index 726c2c043..6b73d4631 100644 --- a/Source/WebCore/css/CSSImageValue.cpp +++ b/Source/WebCore/css/CSSImageValue.cpp @@ -26,6 +26,7 @@ #include "CSSValueKeywords.h" #include "CachedImage.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "MemoryCache.h" #include "StyleCachedImage.h" @@ -82,7 +83,7 @@ StyleCachedImage* CSSImageValue::cachedImage(CachedResourceLoader* loader, const if (!m_accessedImage) { m_accessedImage = true; - ResourceRequest request(loader->document()->completeURL(url)); + CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(url))); if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request)) m_image = StyleCachedImage::create(cachedImage.get()); } diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index af3bab602..d16537e6c 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -806,7 +806,7 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int return true; break; case CSSPropertyWebkitFlexWrap: - if (valueID == CSSValueNone || valueID == CSSValueWrap || valueID == CSSValueWrapReverse) + if (valueID == CSSValueNowrap || valueID == CSSValueWrap || valueID == CSSValueWrapReverse) return true; break; case CSSPropertyWebkitJustifyContent: diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index 06c18ba9f..984c0826e 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -1380,8 +1380,8 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexWrap e) { m_primitiveUnitType = CSS_IDENT; switch (e) { - case FlexWrapNone: - m_value.ident = CSSValueNone; + case FlexNoWrap: + m_value.ident = CSSValueNowrap; break; case FlexWrap: m_value.ident = CSSValueWrap; @@ -1395,8 +1395,8 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexWrap e) template<> inline CSSPrimitiveValue::operator EFlexWrap() const { switch (m_value.ident) { - case CSSValueNone: - return FlexWrapNone; + case CSSValueNowrap: + return FlexNoWrap; case CSSValueWrap: return FlexWrap; case CSSValueWrapReverse: @@ -1404,7 +1404,7 @@ template<> inline CSSPrimitiveValue::operator EFlexWrap() const } ASSERT_NOT_REACHED(); - return FlexWrapNone; + return FlexNoWrap; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e) diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index 37eafdca9..c60aa586d 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -517,7 +517,7 @@ row row-reverse column column-reverse -// none +// nowrap // wrap wrap-reverse diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index 9318b7a16..ad8ddcb3c 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -75,6 +75,7 @@ #include "HTMLProgressElement.h" #include "HTMLStyleElement.h" #include "HTMLTextAreaElement.h" +#include "InsertionPoint.h" #include "InspectorInstrumentation.h" #include "KeyframeList.h" #include "LinkHash.h" @@ -961,8 +962,9 @@ inline bool shouldResetStyleInheritance(NodeRenderingContext& context) InsertionPoint* insertionPoint = context.insertionPoint(); if (!insertionPoint) return false; - ASSERT(context.node()->parentElement()); - ElementShadow* shadow = context.node()->parentElement()->shadow(); + + ASSERT(parentElementForDistribution(context.node())); + ElementShadow* shadow = parentElementForDistribution(context.node())->shadow(); ASSERT(shadow); for ( ; insertionPoint; ) { diff --git a/Source/WebCore/css/StyleRuleImport.cpp b/Source/WebCore/css/StyleRuleImport.cpp index 26f29e82f..eec350771 100644 --- a/Source/WebCore/css/StyleRuleImport.cpp +++ b/Source/WebCore/css/StyleRuleImport.cpp @@ -25,6 +25,7 @@ #include "CSSStyleSheet.h" #include "CachedCSSStyleSheet.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "SecurityOrigin.h" #include "StyleSheetContents.h" @@ -115,11 +116,11 @@ void StyleRuleImport::requestStyleSheet() rootSheet = sheet; } - ResourceRequest request(absURL); + CachedResourceRequest request(ResourceRequest(absURL), m_parentStyleSheet->charset()); if (m_parentStyleSheet->isUserStyleSheet()) - m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, m_parentStyleSheet->charset()); + m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request); else - m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request, m_parentStyleSheet->charset()); + m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request); if (m_cachedSheet) { // if the import rule is issued dynamically, the sheet may be // removed from the pending sheet count, so let the doc know diff --git a/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp b/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp index 44c880894..67e84e3c9 100644 --- a/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp +++ b/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp @@ -29,6 +29,7 @@ #include "CSSParser.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "WebCoreMemoryInstrumentation.h" @@ -52,7 +53,7 @@ CachedSVGDocument* WebKitCSSSVGDocumentValue::load(CachedResourceLoader* loader) if (!m_loadRequested) { m_loadRequested = true; - ResourceRequest request(loader->document()->completeURL(m_url)); + CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url))); m_document = loader->requestSVGDocument(request); } diff --git a/Source/WebCore/css/WebKitCSSShaderValue.cpp b/Source/WebCore/css/WebKitCSSShaderValue.cpp index 6f9373e0f..fa04190c3 100644 --- a/Source/WebCore/css/WebKitCSSShaderValue.cpp +++ b/Source/WebCore/css/WebKitCSSShaderValue.cpp @@ -32,8 +32,9 @@ #if ENABLE(CSS_SHADERS) #include "WebKitCSSShaderValue.h" -#include "CachedResourceLoader.h" #include "CSSParser.h" +#include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "StyleCachedShader.h" #include "StylePendingShader.h" @@ -59,7 +60,7 @@ StyleCachedShader* WebKitCSSShaderValue::cachedShader(CachedResourceLoader* load if (!m_accessedShader) { m_accessedShader = true; - ResourceRequest request(loader->document()->completeURL(m_url)); + CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url))); if (CachedResourceHandle<CachedShader> cachedShader = loader->requestShader(request)) m_shader = StyleCachedShader::create(cachedShader.get()); } diff --git a/Source/WebCore/dom/Attr.cpp b/Source/WebCore/dom/Attr.cpp index 95c3fe052..57efe2982 100644 --- a/Source/WebCore/dom/Attr.cpp +++ b/Source/WebCore/dom/Attr.cpp @@ -130,7 +130,7 @@ void Attr::setValue(const AtomicString& value, ExceptionCode&) setValue(value); if (m_element) - m_element->didModifyAttribute(elementAttribute()); + m_element->didModifyAttribute(qualifiedName(), value); } void Attr::setNodeValue(const String& v, ExceptionCode& ec) @@ -182,7 +182,7 @@ void Attr::childrenChanged(bool, Node*, Node*, int) m_standaloneValue = newValue; if (m_element) - m_element->attributeChanged(elementAttribute()); + m_element->attributeChanged(qualifiedName(), newValue); } bool Attr::isId() const diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp index 8b0ec7e24..e88230e64 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp @@ -30,6 +30,7 @@ #include "ContentDistributor.h" #include "Element.h" #include "ElementShadow.h" +#include "HTMLContentElement.h" #include "InsertionPoint.h" namespace WebCore { @@ -51,11 +52,22 @@ static inline ElementShadow* shadowOfParent(const Node* node) return 0; } +static inline ElementShadow* shadowOfParentForDistribution(const Node* node) +{ + if (!node) + return 0; + + if (Element* parent = parentElementForDistribution(node)) + return parent->shadow(); + + return 0; +} + static inline InsertionPoint* resolveReprojection(const Node* node) { InsertionPoint* insertionPoint = 0; const Node* current = node; - while (ElementShadow* shadow = shadowOfParent(current)) { + while (ElementShadow* shadow = shadowOfParentForDistribution(current)) { shadow->ensureDistribution(); if (InsertionPoint* insertedTo = shadow->insertionPointFor(node)) { current = insertedTo; @@ -260,7 +272,7 @@ Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTraversal ASSERT(toShadowRoot(node)->isYoungest()); return 0; } - if (ElementShadow* shadow = shadowOfParent(node)) { + if (ElementShadow* shadow = shadowOfParentForDistribution(node)) { shadow->ensureDistribution(); if (InsertionPoint* insertionPoint = resolveReprojection(node)) { if (details) diff --git a/Source/WebCore/dom/ContainerNode.h b/Source/WebCore/dom/ContainerNode.h index dd4a9898d..69b5f421a 100644 --- a/Source/WebCore/dom/ContainerNode.h +++ b/Source/WebCore/dom/ContainerNode.h @@ -124,7 +124,6 @@ public: // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value. virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - void attachAsNode(); void attachChildren(); void attachChildrenLazily(); void detachChildren(); @@ -200,11 +199,6 @@ inline ContainerNode::ContainerNode(Document* document, ConstructionType type) { } -inline void ContainerNode::attachAsNode() -{ - Node::attach(); -} - inline void ContainerNode::attachChildren() { for (Node* child = firstChild(); child; child = child->nextSibling()) { diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 97dc9c9f6..e8456f704 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -692,61 +692,60 @@ inline void Element::setAttributeInternal(size_t index, const QualifiedName& nam existingAttribute->setValue(newValue); if (!inSynchronizationOfLazyAttribute) - didModifyAttribute(*existingAttribute); + didModifyAttribute(name, newValue); } -void Element::attributeChanged(const Attribute& attribute) +void Element::attributeChanged(const QualifiedName& name, const AtomicString& newValue) { - parseAttribute(attribute); + parseAttribute(Attribute(name, newValue)); document()->incDOMTreeVersion(); - if (isIdAttributeName(attribute.name())) { - if (attribute.value() != attributeData()->idForStyleResolution()) { - if (attribute.isNull()) + if (isIdAttributeName(name)) { + if (newValue != attributeData()->idForStyleResolution()) { + if (newValue.isNull()) attributeData()->setIdForStyleResolution(nullAtom); else if (document()->inQuirksMode()) - attributeData()->setIdForStyleResolution(attribute.value().lower()); + attributeData()->setIdForStyleResolution(newValue.lower()); else - attributeData()->setIdForStyleResolution(attribute.value()); + attributeData()->setIdForStyleResolution(newValue); setNeedsStyleRecalc(); } - } else if (attribute.name() == HTMLNames::nameAttr) - setHasName(!attribute.isNull()); + } else if (name == HTMLNames::nameAttr) + setHasName(!newValue.isNull()); if (!needsStyleRecalc() && document()->attached()) { StyleResolver* styleResolver = document()->styleResolverIfExists(); - if (!styleResolver || styleResolver->hasSelectorForAttribute(attribute.name().localName())) + if (!styleResolver || styleResolver->hasSelectorForAttribute(name.localName())) setNeedsStyleRecalc(); } - invalidateNodeListCachesInAncestors(&attribute.name(), this); + invalidateNodeListCachesInAncestors(&name, this); if (!AXObjectCache::accessibilityEnabled()) return; - const QualifiedName& attrName = attribute.name(); - if (attrName == aria_activedescendantAttr) { + if (name == aria_activedescendantAttr) { // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact document()->axObjectCache()->handleActiveDescendantChanged(this); - } else if (attrName == roleAttr) { + } else if (name == roleAttr) { // the role attribute can change at any time, and the AccessibilityObject must pick up these changes document()->axObjectCache()->handleAriaRoleChanged(this); - } else if (attrName == aria_valuenowAttr) { + } else if (name == aria_valuenowAttr) { // If the valuenow attribute changes, AX clients need to be notified. document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, true); - } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) { + } else if (name == aria_labelAttr || name == aria_labeledbyAttr || name == altAttr || name == titleAttr) { // If the content of an element changes due to an attribute change, notify accessibility. document()->axObjectCache()->contentChanged(this); - } else if (attrName == aria_checkedAttr) + } else if (name == aria_checkedAttr) document()->axObjectCache()->checkedStateChanged(this); - else if (attrName == aria_selectedAttr) + else if (name == aria_selectedAttr) document()->axObjectCache()->selectedChildrenChanged(this); - else if (attrName == aria_expandedAttr) + else if (name == aria_expandedAttr) document()->axObjectCache()->handleAriaExpandedChange(this); - else if (attrName == aria_hiddenAttr) + else if (name == aria_hiddenAttr) document()->axObjectCache()->childrenChanged(this); - else if (attrName == aria_invalidAttr) + else if (name == aria_invalidAttr) document()->axObjectCache()->postNotification(this, AXObjectCache::AXInvalidStatusChanged, true); } @@ -854,7 +853,7 @@ void Element::parserSetAttributes(const Vector<Attribute>& attributeVector, Frag // attributeChanged mutates m_attributeData. // FIXME: Find a way so we don't have to do this. for (unsigned i = 0; i < filteredAttributes.size(); ++i) - attributeChanged(filteredAttributes[i]); + attributeChanged(filteredAttributes[i].name(), filteredAttributes[i].value()); } bool Element::hasAttributes() const @@ -1016,13 +1015,11 @@ void Element::attach() if (ElementShadow* shadow = this->shadow()) { parentPusher.push(); shadow->attach(); - attachChildren(); - attachAsNode(); } else { if (firstChild()) parentPusher.push(); - ContainerNode::attach(); } + ContainerNode::attach(); if (hasRareData()) { ElementRareData* data = elementRareData(); @@ -1565,7 +1562,7 @@ void Element::addAttributeInternal(const QualifiedName& name, const AtomicString willModifyAttribute(name, nullAtom, value); m_attributeData->addAttribute(Attribute(name, value)); if (!inSynchronizationOfLazyAttribute) - didAddAttribute(Attribute(name, value)); + didAddAttribute(name, value); } void Element::removeAttribute(const AtomicString& name) @@ -2181,23 +2178,23 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& #endif } -void Element::didAddAttribute(const Attribute& attribute) +void Element::didAddAttribute(const QualifiedName& name, const AtomicString& value) { - attributeChanged(attribute); - InspectorInstrumentation::didModifyDOMAttr(document(), this, attribute.localName(), attribute.value()); + attributeChanged(name, value); + InspectorInstrumentation::didModifyDOMAttr(document(), this, name.localName(), value); dispatchSubtreeModifiedEvent(); } -void Element::didModifyAttribute(const Attribute& attribute) +void Element::didModifyAttribute(const QualifiedName& name, const AtomicString& value) { - attributeChanged(attribute); - InspectorInstrumentation::didModifyDOMAttr(document(), this, attribute.localName(), attribute.value()); + attributeChanged(name, value); + InspectorInstrumentation::didModifyDOMAttr(document(), this, name.localName(), value); // Do not dispatch a DOMSubtreeModified event here; see bug 81141. } void Element::didRemoveAttribute(const QualifiedName& name) { - attributeChanged(Attribute(name, nullAtom)); + attributeChanged(name, nullAtom); InspectorInstrumentation::didRemoveDOMAttr(document(), this, name.localName()); dispatchSubtreeModifiedEvent(); } diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 519c50d77..893bbeef0 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -245,7 +245,7 @@ public: NamedNodeMap* attributes() const; // This method is called whenever an attribute is added, changed or removed. - virtual void attributeChanged(const Attribute&); + virtual void attributeChanged(const QualifiedName&, const AtomicString&); virtual void parseAttribute(const Attribute&); // Only called by the parser immediately after element construction. @@ -474,9 +474,9 @@ private: enum SynchronizationOfLazyAttribute { NotInSynchronizationOfLazyAttribute = 0, InSynchronizationOfLazyAttribute }; - void didAddAttribute(const Attribute&); + void didAddAttribute(const QualifiedName&, const AtomicString&); void willModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue); - void didModifyAttribute(const Attribute&); + void didModifyAttribute(const QualifiedName&, const AtomicString&); void didRemoveAttribute(const QualifiedName&); void updateInvalidAttributes() const; diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index 981ae5814..1f0fd858b 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -338,7 +338,7 @@ void ElementAttributeData::cloneDataFrom(const ElementAttributeData& sourceData, static_cast<StyledElement&>(targetElement).styleAttributeChanged(attribute.value(), StyledElement::DoNotReparseStyleAttribute); continue; } - targetElement.attributeChanged(attribute); + targetElement.attributeChanged(attribute.name(), attribute.value()); } if (targetElement.isStyledElement() && sourceData.m_inlineStyleDecl) { diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp index 4bca1d1eb..ec1733c74 100644 --- a/Source/WebCore/dom/ProcessingInstruction.cpp +++ b/Source/WebCore/dom/ProcessingInstruction.cpp @@ -24,6 +24,7 @@ #include "CSSStyleSheet.h" #include "CachedCSSStyleSheet.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "CachedXSLStyleSheet.h" #include "Document.h" #include "DocumentStyleSheetCollection.h" @@ -163,7 +164,7 @@ void ProcessingInstruction::checkStyleSheet() m_loading = true; document()->styleSheetCollection()->addPendingSheet(); - ResourceRequest request(document()->completeURL(href)); + CachedResourceRequest request(ResourceRequest(document()->completeURL(href))); #if ENABLE(XSLT) if (m_isXSL) m_cachedSheet = document()->cachedResourceLoader()->requestXSLStyleSheet(request); @@ -173,8 +174,9 @@ void ProcessingInstruction::checkStyleSheet() String charset = attrs.get("charset"); if (charset.isEmpty()) charset = document()->charset(); + request.setCharset(charset); - m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(request, charset); + m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(request); } if (m_cachedSheet) m_cachedSheet->addClient(this); diff --git a/Source/WebCore/dom/ScriptElement.cpp b/Source/WebCore/dom/ScriptElement.cpp index 209fc79c1..cfdd1a436 100644 --- a/Source/WebCore/dom/ScriptElement.cpp +++ b/Source/WebCore/dom/ScriptElement.cpp @@ -26,6 +26,7 @@ #include "CachedScript.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "ContentSecurityPolicy.h" #include "CrossOriginAccessControl.h" #include "Document.h" @@ -256,16 +257,17 @@ bool ScriptElement::requestScript(const String& sourceUrl) ASSERT(!m_cachedScript); if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { - ResourceRequest request = ResourceRequest(m_element->document()->completeURL(sourceUrl)); + CachedResourceRequest request(ResourceRequest(m_element->document()->completeURL(sourceUrl))); String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr); if (!crossOriginMode.isNull()) { m_requestUsesAccessControl = true; StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; - updateRequestForAccessControl(request, m_element->document()->securityOrigin(), allowCredentials); + updateRequestForAccessControl(request.mutableResourceRequest(), m_element->document()->securityOrigin(), allowCredentials); } + request.setCharset(scriptCharset()); - m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(request, scriptCharset()); + m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(request); m_isExternalScript = true; } diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 0da9f27a9..75192cded 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -38,6 +38,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HTMLTextAreaElement.h" +#include "HistogramSupport.h" #include "InsertionPoint.h" #include "NodeRareData.h" #include "RuntimeEnabledFeatures.h" @@ -86,8 +87,28 @@ static bool allowsAuthorShadowRoot(Element* element) return element->areAuthorShadowsAllowed(); } +enum ShadowRootUsageOriginType { + ShadowRootUsageOriginWeb = 0, + ShadowRootUsageOriginNotWeb, + ShadowRootUsageOriginTypes +}; + +static inline ShadowRootUsageOriginType determineUsageType(Element* host) +{ + // Enables only on CHROMIUM since this cost won't worth paying for platforms which don't collect this metrics. +#if PLATFORM(CHROMIUM) + if (!host) + return ShadowRootUsageOriginWeb; + return host->document()->url().string().startsWith("http") ? ShadowRootUsageOriginWeb : ShadowRootUsageOriginNotWeb; +#else + UNUSED_PARAM(host); + return ShadowRootUsageOriginWeb; +#endif +} + PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ExceptionCode& ec) { + HistogramSupport::histogramEnumeration("WebCore.ShadowRoot.constructor", determineUsageType(element), ShadowRootUsageOriginTypes); return create(element, AuthorShadowRoot, ec); } @@ -215,8 +236,7 @@ void ShadowRoot::attach() { StyleResolver* styleResolver = document()->styleResolver(); styleResolver->pushParentShadowRoot(this); - attachChildren(); - attachAsNode(); + DocumentFragment::attach(); styleResolver->popParentShadowRoot(this); } diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index d4c5e94b9..576aa2284 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -148,14 +148,14 @@ CSSStyleDeclaration* StyledElement::style() return ensureInlineStyle()->ensureInlineCSSStyleDeclaration(this); } -void StyledElement::attributeChanged(const Attribute& attribute) +void StyledElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue) { - if (isPresentationAttribute(attribute.name())) { + if (isPresentationAttribute(name)) { setAttributeStyleDirty(); setNeedsStyleRecalc(InlineStyleChange); } - Element::attributeChanged(attribute); + Element::attributeChanged(name, newValue); } void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, ShouldReparseStyleAttribute shouldReparse) diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h index 0d0f773ca..cf59ed1ad 100644 --- a/Source/WebCore/dom/StyledElement.h +++ b/Source/WebCore/dom/StyledElement.h @@ -62,7 +62,7 @@ public: protected: StyledElement(const QualifiedName&, Document*, ConstructionType); - virtual void attributeChanged(const Attribute&) OVERRIDE; + virtual void attributeChanged(const QualifiedName&, const AtomicString&) OVERRIDE; virtual void parseAttribute(const Attribute&) OVERRIDE; virtual bool isPresentationAttribute(const QualifiedName&) const { return false; } diff --git a/Source/WebCore/dom/ViewportArguments.cpp b/Source/WebCore/dom/ViewportArguments.cpp index e457b037a..dc16bd63a 100644 --- a/Source/WebCore/dom/ViewportArguments.cpp +++ b/Source/WebCore/dom/ViewportArguments.cpp @@ -363,6 +363,9 @@ void reportViewportWarning(Document* document, ViewportErrorCode errorCode, cons if (!replacement2.isNull()) message.replace("%replacement2", replacement2); + if ((errorCode == UnrecognizedViewportArgumentValueError || errorCode == TruncatedViewportArgumentValueError) && replacement1.find(';') != WTF::notFound) + message.append(" Note that ';' is not a separator in viewport values. The list should be comma-separated."); + document->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, viewportErrorMessageLevel(errorCode), message, document->url().string(), parserLineNumber(document)); } diff --git a/Source/WebCore/editing/FrameSelection.cpp b/Source/WebCore/editing/FrameSelection.cpp index 2e5d37537..f0e249a8d 100644 --- a/Source/WebCore/editing/FrameSelection.cpp +++ b/Source/WebCore/editing/FrameSelection.cpp @@ -1280,6 +1280,7 @@ static LayoutRect repaintRectForCaret(LayoutRect caret) // Ensure that the dirty rect intersects the block that paints the caret even in the case where // the caret itself is just outside the block. See <https://bugs.webkit.org/show_bug.cgi?id=19086>. caret.inflateX(1); + caret.inflateY(1); return caret; } diff --git a/Source/WebCore/html/HTMLBaseElement.cpp b/Source/WebCore/html/HTMLBaseElement.cpp index 2754717c0..b58035e99 100644 --- a/Source/WebCore/html/HTMLBaseElement.cpp +++ b/Source/WebCore/html/HTMLBaseElement.cpp @@ -26,6 +26,8 @@ #include "Attribute.h" #include "Document.h" #include "HTMLNames.h" +#include "HTMLParserIdioms.h" +#include "TextResourceDecoder.h" namespace WebCore { @@ -75,4 +77,29 @@ String HTMLBaseElement::target() const return fastGetAttribute(targetAttr); } +KURL HTMLBaseElement::href() const +{ + // This does not use the getURLAttribute function because that will resolve relative to the document's base URL; + // base elements like this one can be used to set that base URL. Thus we need to resolve relative to the document's + // URL and ignore the base URL. + + const AtomicString& attributeValue = fastGetAttribute(hrefAttr); + if (attributeValue.isNull()) + return document()->url(); + + KURL url = !document()->decoder() ? + KURL(document()->url(), stripLeadingAndTrailingHTMLSpaces(attributeValue)) : + KURL(document()->url(), stripLeadingAndTrailingHTMLSpaces(attributeValue), document()->decoder()->encoding()); + + if (!url.isValid()) + return KURL(); + + return url; +} + +void HTMLBaseElement::setHref(const AtomicString& value) +{ + setAttribute(hrefAttr, value); +} + } diff --git a/Source/WebCore/html/HTMLBaseElement.h b/Source/WebCore/html/HTMLBaseElement.h index bb74fb730..e6b0a41a2 100644 --- a/Source/WebCore/html/HTMLBaseElement.h +++ b/Source/WebCore/html/HTMLBaseElement.h @@ -31,6 +31,9 @@ class HTMLBaseElement : public HTMLElement { public: static PassRefPtr<HTMLBaseElement> create(const QualifiedName&, Document*); + KURL href() const; + void setHref(const AtomicString&); + private: HTMLBaseElement(const QualifiedName&, Document*); diff --git a/Source/WebCore/html/HTMLBaseElement.idl b/Source/WebCore/html/HTMLBaseElement.idl index 0f63ddd19..4d9d39f0f 100644 --- a/Source/WebCore/html/HTMLBaseElement.idl +++ b/Source/WebCore/html/HTMLBaseElement.idl @@ -18,7 +18,6 @@ */ interface HTMLBaseElement : HTMLElement { - [Reflect, URL] attribute DOMString href; + [TreatNullAs=NullString] attribute DOMString href; [Reflect] attribute DOMString target; }; - diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index c4a8bf675..4f21a0f43 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -515,11 +515,11 @@ void HTMLInputElement::updateType() if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttributes()) { ASSERT(attributeData()); if (Attribute* height = getAttributeItem(heightAttr)) - attributeChanged(*height); + attributeChanged(heightAttr, height->value()); if (Attribute* width = getAttributeItem(widthAttr)) - attributeChanged(*width); + attributeChanged(widthAttr, width->value()); if (Attribute* align = getAttributeItem(alignAttr)) - attributeChanged(*align); + attributeChanged(alignAttr, align->value()); } if (wasAttached) { diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp index fdc7a5cce..7c96b19b1 100644 --- a/Source/WebCore/html/HTMLLinkElement.cpp +++ b/Source/WebCore/html/HTMLLinkElement.cpp @@ -29,6 +29,7 @@ #include "CachedCSSStyleSheet.h" #include "CachedResource.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "DocumentStyleSheetCollection.h" #include "EventSender.h" @@ -220,8 +221,8 @@ void HTMLLinkElement::process() // Load stylesheets that are not needed for the rendering immediately with low priority. ResourceLoadPriority priority = blocking ? ResourceLoadPriorityUnresolved : ResourceLoadPriorityVeryLow; - ResourceRequest request(document()->completeURL(m_url)); - m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(request, charset, priority); + CachedResourceRequest request(ResourceRequest(document()->completeURL(m_url)), charset, priority); + m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(request); if (m_cachedSheet) m_cachedSheet->addClient(this); diff --git a/Source/WebCore/html/parser/HTMLToken.h b/Source/WebCore/html/parser/HTMLToken.h index 3099c785c..e2e93a777 100644 --- a/Source/WebCore/html/parser/HTMLToken.h +++ b/Source/WebCore/html/parser/HTMLToken.h @@ -63,7 +63,7 @@ public: ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag || m_type == HTMLTokenTypes::DOCTYPE); MarkupTokenBase<HTMLTokenTypes, HTMLTokenTypes::DoctypeData>::appendToName(character); } - + const DataVector& name() const { ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag || m_type == HTMLTokenTypes::DOCTYPE); diff --git a/Source/WebCore/html/parser/HTMLTokenizer.cpp b/Source/WebCore/html/parser/HTMLTokenizer.cpp index 90bc39fad..4ffd319c0 100644 --- a/Source/WebCore/html/parser/HTMLTokenizer.cpp +++ b/Source/WebCore/html/parser/HTMLTokenizer.cpp @@ -316,10 +316,10 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(EndTagOpenState) { if (isASCIIUpper(cc)) { - m_token->beginEndTag(toLowerCase(cc)); + m_token->beginEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(TagNameState); } else if (isASCIILower(cc)) { - m_token->beginEndTag(cc); + m_token->beginEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(TagNameState); } else if (cc == '>') { parseError(); @@ -373,11 +373,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RCDATAEndTagOpenState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else { bufferCharacter('<'); @@ -390,11 +390,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RCDATAEndTagNameState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { @@ -438,11 +438,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RAWTEXTEndTagOpenState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else { bufferCharacter('<'); @@ -455,11 +455,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RAWTEXTEndTagNameState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { @@ -507,11 +507,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEndTagOpenState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else { bufferCharacter('<'); @@ -524,11 +524,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEndTagNameState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { @@ -653,11 +653,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEscapedEndTagOpenState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else { bufferCharacter('<'); @@ -670,11 +670,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEscapedEndTagNameState) { if (isASCIIUpper(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(toLowerCase(cc)); + addToPossibleEndTag(static_cast<LChar>(toLowerCase(cc))); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else if (isASCIILower(cc)) { m_temporaryBuffer.append(static_cast<LChar>(cc)); - addToPossibleEndTag(cc); + addToPossibleEndTag(static_cast<LChar>(cc)); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { @@ -1611,7 +1611,7 @@ inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) return vectorEqualsString(m_temporaryBuffer, expectedString); } -inline void HTMLTokenizer::addToPossibleEndTag(UChar cc) +inline void HTMLTokenizer::addToPossibleEndTag(LChar cc) { ASSERT(isEndTagBufferingState(m_state)); m_bufferedEndTagName.append(cc); @@ -1619,7 +1619,17 @@ inline void HTMLTokenizer::addToPossibleEndTag(UChar cc) inline bool HTMLTokenizer::isAppropriateEndTag() { - return m_bufferedEndTagName == m_appropriateEndTagName; + if (m_bufferedEndTagName.size() != m_appropriateEndTagName.size()) + return false; + + size_t numCharacters = m_bufferedEndTagName.size(); + + for (size_t i = 0; i < numCharacters; i++) { + if (m_bufferedEndTagName[i] != m_appropriateEndTagName[i]) + return false; + } + + return true; } inline void HTMLTokenizer::parseError() diff --git a/Source/WebCore/html/parser/HTMLTokenizer.h b/Source/WebCore/html/parser/HTMLTokenizer.h index 4c665f7a3..d8b536d53 100644 --- a/Source/WebCore/html/parser/HTMLTokenizer.h +++ b/Source/WebCore/html/parser/HTMLTokenizer.h @@ -194,7 +194,7 @@ private: // Sometimes we speculatively consume input characters and we don't // know whether they represent end tags or RCDATA, etc. These // functions help manage these state. - inline void addToPossibleEndTag(UChar cc); + inline void addToPossibleEndTag(LChar cc); inline void saveEndTagNameIfNeeded() { @@ -214,7 +214,7 @@ private: // We occationally want to emit both a character token and an end tag // token (e.g., when lexing script). We buffer the name of the end tag // token here so we remember it next time we re-enter the tokenizer. - Vector<UChar, 32> m_bufferedEndTagName; + Vector<LChar, 32> m_bufferedEndTagName; bool m_usePreHTML5ParserQuirks; }; diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 940800ef8..c78562b33 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -256,6 +256,8 @@ private: skipLeading<characterPredicate>(); if (start == m_current) return String(); + if (isAll8BitData()) + return String::make8BitFrom16BitSource(start, m_current - start); return String(start, m_current - start); } diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.cpp b/Source/WebCore/html/shadow/DateTimeEditElement.cpp index 1b644d4c9..b6f0a0af7 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeEditElement.cpp @@ -92,8 +92,9 @@ bool DateTimeEditBuilder::needMillisecondField() const void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int count) { - // In LDML, M and MM are numeric, and MMM, MMMM, and MMMMM are symbolic. - const int symbolicMonthThreshold = 3; + const int countForAbbreviatedMonth = 3; + const int countForFullMonth = 4; + const int countForNarrowMonth = 5; Document* const document = m_editElement.document(); switch (fieldType) { @@ -126,19 +127,33 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int co } case DateTimeFormat::FieldTypeMonth: - if (count >= symbolicMonthThreshold) { - // We always use abbreviations. + switch (count) { + case countForNarrowMonth: // Fallthrough. + case countForAbbreviatedMonth: m_editElement.addField(DateTimeSymbolicMonthFieldElement::create(document, m_editElement, m_parameters.localizer.shortMonthLabels())); - } else + break; + case countForFullMonth: + m_editElement.addField(DateTimeSymbolicMonthFieldElement::create(document, m_editElement, m_parameters.localizer.monthLabels())); + break; + default: m_editElement.addField(DateTimeMonthFieldElement::create(document, m_editElement, m_parameters.placeholderForMonth)); + break; + } return; case DateTimeFormat::FieldTypeMonthStandAlone: - if (count >= symbolicMonthThreshold) { - // We always use abbreviations. + switch (count) { + case countForNarrowMonth: // Fallthrough. + case countForAbbreviatedMonth: m_editElement.addField(DateTimeSymbolicMonthFieldElement::create(document, m_editElement, m_parameters.localizer.shortStandAloneMonthLabels())); - } else + break; + case countForFullMonth: + m_editElement.addField(DateTimeSymbolicMonthFieldElement::create(document, m_editElement, m_parameters.localizer.standAloneMonthLabels())); + break; + default: m_editElement.addField(DateTimeMonthFieldElement::create(document, m_editElement, m_parameters.placeholderForMonth)); + break; + } return; case DateTimeFormat::FieldTypePeriod: diff --git a/Source/WebCore/html/shadow/HTMLContentElement.cpp b/Source/WebCore/html/shadow/HTMLContentElement.cpp index 6c063c1b6..dec9e08f7 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.cpp +++ b/Source/WebCore/html/shadow/HTMLContentElement.cpp @@ -40,7 +40,7 @@ namespace WebCore { using HTMLNames::selectAttr; -static const QualifiedName& contentTagName(Document*) +const QualifiedName& HTMLContentElement::contentTagName(Document*) { #if ENABLE(SHADOW_DOM) if (!RuntimeEnabledFeatures::shadowDOMEnabled()) diff --git a/Source/WebCore/html/shadow/HTMLContentElement.h b/Source/WebCore/html/shadow/HTMLContentElement.h index 6be48669d..ea7fb89a5 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.h +++ b/Source/WebCore/html/shadow/HTMLContentElement.h @@ -38,6 +38,7 @@ namespace WebCore { class HTMLContentElement : public InsertionPoint { public: + static const QualifiedName& contentTagName(Document*); static PassRefPtr<HTMLContentElement> create(const QualifiedName&, Document*); static PassRefPtr<HTMLContentElement> create(Document*); @@ -59,7 +60,7 @@ private: inline bool isHTMLContentElement(const Node* node) { ASSERT(node); - return node->hasTagName(HTMLNames::contentTag); + return node->hasTagName(HTMLContentElement::contentTagName(node->document())); } } diff --git a/Source/WebCore/html/shadow/InsertionPoint.cpp b/Source/WebCore/html/shadow/InsertionPoint.cpp index 092077467..d34a07953 100644 --- a/Source/WebCore/html/shadow/InsertionPoint.cpp +++ b/Source/WebCore/html/shadow/InsertionPoint.cpp @@ -69,6 +69,11 @@ void InsertionPoint::detach() HTMLElement::detach(); } +bool InsertionPoint::shouldUseFallbackElements() const +{ + return isActive() && !hasDistribution(); +} + bool InsertionPoint::isShadowBoundary() const { return treeScope()->rootNode()->isShadowRoot() && isActive(); diff --git a/Source/WebCore/html/shadow/InsertionPoint.h b/Source/WebCore/html/shadow/InsertionPoint.h index 95f7995d7..aef9813f5 100644 --- a/Source/WebCore/html/shadow/InsertionPoint.h +++ b/Source/WebCore/html/shadow/InsertionPoint.h @@ -62,6 +62,8 @@ public: virtual void detach(); virtual bool isInsertionPoint() const OVERRIDE { return true; } + bool shouldUseFallbackElements() const; + size_t indexOf(Node* node) const { return m_distribution.find(node); } bool contains(const Node* node) const { return m_distribution.contains(const_cast<Node*>(node)) || (node->isShadowRoot() && toShadowRoot(node)->assignedTo() == this); } size_t size() const { return m_distribution.size(); } @@ -118,6 +120,19 @@ inline bool isLowerEncapsulationBoundary(Node* node) return toInsertionPoint(node)->isShadowBoundary(); } +inline Element* parentElementForDistribution(const Node* node) +{ + ASSERT(node); + if (Element* parent = node->parentElement()) { + if (isInsertionPoint(parent) && toInsertionPoint(parent)->shouldUseFallbackElements()) + return parent->parentElement(); + + return parent; + } + + return 0; +} + } // namespace WebCore #endif // InsertionPoint_h diff --git a/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp b/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp index ebdf1f395..5d305890c 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp @@ -120,11 +120,17 @@ void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, const String& Frame* frame = storageResource->frame(); if (!frame) return; - + + // FIXME: Exceptions are not reported here. + ExceptionCode ec = 0; StorageArea* storageArea = storageResource->storageArea(); - for (unsigned i = 0; i < storageArea->length(frame); ++i) { - String name(storageArea->key(i, frame)); - String value(storageArea->getItem(name, frame)); + for (unsigned i = 0; i < storageArea->length(ec, frame); ++i) { + String name(storageArea->key(i, ec, frame)); + if (ec) + return; + String value(storageArea->getItem(name, ec, frame)); + if (ec) + return; RefPtr<TypeBuilder::Array<String> > entry = TypeBuilder::Array<String>::create(); entry->addItem(name); entry->addItem(value); @@ -147,8 +153,9 @@ void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, const String& { InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId); if (storageResource) { - storageResource->storageArea()->removeItem(key, storageResource->frame()); - *success = true; + ExceptionCode exception = 0; + storageResource->storageArea()->removeItem(key, exception, storageResource->frame()); + *success = !exception; } else *success = false; } diff --git a/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp b/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp index dbee707c5..abc9168c7 100644 --- a/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp +++ b/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp @@ -211,7 +211,7 @@ void InspectorFrontendClientLocal::moveWindowBy(float x, float y) void InspectorFrontendClientLocal::setAttachedWindow(bool attached) { - evaluateOnLoad(String::format("[\"setDockSide\", %s]", attached ? "bottom" : "undocked")); + evaluateOnLoad(String::format("[\"setDockSide\", \"%s\"]", attached ? "bottom" : "undocked")); } void InspectorFrontendClientLocal::restoreAttachedWindowHeight() diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index 81dded3e0..08f2b0d9e 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -515,6 +515,18 @@ void InspectorInstrumentation::didPaintImpl(const InspectorInstrumentationCookie pageAgent->didPaint(); } +void InspectorInstrumentation::willScrollLayerImpl(InstrumentingAgents* instrumentingAgents, Frame* frame) +{ + if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) + timelineAgent->willScroll(frame); +} + +void InspectorInstrumentation::didScrollLayerImpl(InstrumentingAgents* instrumentingAgents) +{ + if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) + timelineAgent->didScroll(); +} + void InspectorInstrumentation::willCompositeImpl(InstrumentingAgents* instrumentingAgents) { if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 4588865c6..469e68690 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -143,6 +143,8 @@ public: static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&); static InspectorInstrumentationCookie willPaint(Frame*, GraphicsContext*, const LayoutRect&); static void didPaint(const InspectorInstrumentationCookie&); + static void willScrollLayer(Frame*); + static void didScrollLayer(Frame*); static void willComposite(Page*); static void didComposite(Page*); static InspectorInstrumentationCookie willRecalculateStyle(Document*); @@ -333,6 +335,8 @@ private: static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&); static InspectorInstrumentationCookie willPaintImpl(InstrumentingAgents*, GraphicsContext*, const LayoutRect&, Frame*); static void didPaintImpl(const InspectorInstrumentationCookie&); + static void willScrollLayerImpl(InstrumentingAgents*, Frame*); + static void didScrollLayerImpl(InstrumentingAgents*); static void willCompositeImpl(InstrumentingAgents*); static void didCompositeImpl(InstrumentingAgents*); static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*); @@ -918,6 +922,24 @@ inline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCoo #endif } +inline void InspectorInstrumentation::willScrollLayer(Frame* frame) +{ +#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + willScrollLayerImpl(instrumentingAgents, frame); +#endif +} + +inline void InspectorInstrumentation::didScrollLayer(Frame* frame) +{ +#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + didScrollLayerImpl(instrumentingAgents); +#endif +} + inline void InspectorInstrumentation::willComposite(Page* page) { #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/InspectorTimelineAgent.cpp index 1a2281529..25e5388ec 100644 --- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/Source/WebCore/inspector/InspectorTimelineAgent.cpp @@ -73,6 +73,7 @@ static const char RecalculateStyles[] = "RecalculateStyles"; static const char InvalidateLayout[] = "InvalidateLayout"; static const char Layout[] = "Layout"; static const char Paint[] = "Paint"; +static const char ScrollLayer[] = "ScrollLayer"; static const char DecodeImage[] = "DecodeImage"; static const char ResizeImage[] = "ResizeImage"; static const char CompositeLayers[] = "CompositeLayers"; @@ -278,6 +279,16 @@ void InspectorTimelineAgent::didPaint() didCompleteCurrentRecord(TimelineRecordType::Paint); } +void InspectorTimelineAgent::willScroll(Frame* frame) +{ + pushCurrentRecord(InspectorObject::create(), TimelineRecordType::ScrollLayer, false, frame); +} + +void InspectorTimelineAgent::didScroll() +{ + didCompleteCurrentRecord(TimelineRecordType::ScrollLayer); +} + void InspectorTimelineAgent::willDecodeImage(const String& imageType) { pushCurrentRecord(TimelineRecordFactory::createDecodeImageData(imageType), TimelineRecordType::DecodeImage, true, 0); diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.h b/Source/WebCore/inspector/InspectorTimelineAgent.h index 8f048cfcb..4b7bc7780 100644 --- a/Source/WebCore/inspector/InspectorTimelineAgent.h +++ b/Source/WebCore/inspector/InspectorTimelineAgent.h @@ -108,6 +108,9 @@ public: void willPaint(const LayoutRect&, Frame*); void didPaint(); + void willScroll(Frame*); + void didScroll(); + void willComposite(); void didComposite(); diff --git a/Source/WebCore/inspector/front-end/BreakpointManager.js b/Source/WebCore/inspector/front-end/BreakpointManager.js index 1d9d3e286..709cf1193 100644 --- a/Source/WebCore/inspector/front-end/BreakpointManager.js +++ b/Source/WebCore/inspector/front-end/BreakpointManager.js @@ -60,6 +60,8 @@ WebInspector.BreakpointManager.Events = { WebInspector.BreakpointManager.breakpointStorageId = function(uiSourceCode) { + if (uiSourceCode.isTemporary) + return ""; return uiSourceCode.formatted() ? "deobfuscated:" + uiSourceCode.url : uiSourceCode.url; } @@ -575,7 +577,7 @@ WebInspector.BreakpointManager.Storage.prototype = { */ _updateBreakpoint: function(breakpoint) { - if (this._muted) + if (this._muted || !breakpoint._breakpointStorageId()) return; this._breakpoints[breakpoint._breakpointStorageId()] = new WebInspector.BreakpointManager.Storage.Item(breakpoint); this._save(); diff --git a/Source/WebCore/inspector/front-end/CompilerScriptMapping.js b/Source/WebCore/inspector/front-end/CompilerScriptMapping.js index 9a0b1035f..f7a502a3c 100644 --- a/Source/WebCore/inspector/front-end/CompilerScriptMapping.js +++ b/Source/WebCore/inspector/front-end/CompilerScriptMapping.js @@ -36,13 +36,16 @@ WebInspector.CompilerScriptMapping = function(workspace) { this._workspace = workspace; - this._sourceMapByURL = {}; + /** @type {Object.<string, WebInspector.SourceMapParser>} */ + this._sourceMapForSourceMapURL = {}; + /** @type {Object.<string, WebInspector.SourceMapParser>} */ this._sourceMapForScriptId = {}; this._scriptForSourceMap = new Map(); - this._sourceMapForUISourceCode = new Map(); - this._uiSourceCodeByURL = {}; + /** @type {Object.<string, WebInspector.SourceMapParser>} */ + this._sourceMapForURL = {}; + /** @type {Object.<string, WebInspector.UISourceCode>} */ this._originalUISourceCodeForScriptId = {}; - this._scriptForOriginalUISource = new Map(); + this._scriptForOriginalUISourceCode = new Map(); this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this); } @@ -58,9 +61,12 @@ WebInspector.CompilerScriptMapping.prototype = { var lineNumber = debuggerModelLocation.lineNumber; var columnNumber = debuggerModelLocation.columnNumber || 0; var entry = sourceMap.findEntry(lineNumber, columnNumber); - if (entry.length === 2) - return new WebInspector.UILocation(this._originalUISourceCodeForScriptId[debuggerModelLocation.scriptId], lineNumber, columnNumber); - return new WebInspector.UILocation(this._uiSourceCodeByURL[entry[2]], entry[3], entry[4]); + if (entry.length === 2) { + var temporaryUISourceCode = this._originalUISourceCodeForScriptId[debuggerModelLocation.scriptId]; + return new WebInspector.UILocation(temporaryUISourceCode, lineNumber, columnNumber); + } + var uiSourceCode = this._workspace.uiSourceCodeForURL(entry[2]); + return new WebInspector.UILocation(uiSourceCode, entry[3], entry[4]); }, /** @@ -71,10 +77,10 @@ WebInspector.CompilerScriptMapping.prototype = { */ uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) { - var script = this._scriptForOriginalUISource.get(uiSourceCode); + var script = this._scriptForOriginalUISourceCode.get(uiSourceCode); if (script) return WebInspector.debuggerModel.createRawLocation(script, lineNumber, columnNumber); - var sourceMap = this._sourceMapForUISourceCode.get(uiSourceCode); + var sourceMap = this._sourceMapForURL[uiSourceCode.url]; var entry = sourceMap.findEntryReversed(uiSourceCode.url, lineNumber); return WebInspector.debuggerModel.createRawLocation(this._scriptForSourceMap.get(sourceMap), entry[0], entry[1]); }, @@ -84,10 +90,13 @@ WebInspector.CompilerScriptMapping.prototype = { */ addScript: function(script) { - var originalUISourceCode = new WebInspector.UISourceCode(script.sourceURL, script, true); + // FIXME: We should only create temporary uiSourceCodes on demand and should set this as a mapping to + // relevant uiSourceCodes added by NetworkUISourceCodeProvider. + var originalUISourceCode = new WebInspector.UISourceCode(script.sourceURL, script, false); this._originalUISourceCodeForScriptId[script.scriptId] = originalUISourceCode; - this._scriptForOriginalUISource.put(originalUISourceCode, script); - this._workspace.project().addUISourceCode(originalUISourceCode); + this._scriptForOriginalUISourceCode.put(originalUISourceCode, script); + originalUISourceCode.setSourceMapping(this); + this._workspace.project().addTemporaryUISourceCode(originalUISourceCode); var sourceMap = this.loadSourceMapForScript(script); @@ -97,12 +106,12 @@ WebInspector.CompilerScriptMapping.prototype = { return; } - var uiSourceCodeList = []; var sourceURLs = sourceMap.sources(); for (var i = 0; i < sourceURLs.length; ++i) { var sourceURL = sourceURLs[i]; - if (this._uiSourceCodeByURL[sourceURL]) + if (this._workspace.uiSourceCodeForURL(sourceURL)) continue; + this._sourceMapForURL[sourceURL] = sourceMap; var sourceContent = sourceMap.sourceContent(sourceURL); var contentProvider; if (sourceContent) @@ -110,19 +119,15 @@ WebInspector.CompilerScriptMapping.prototype = { else contentProvider = new WebInspector.CompilerSourceMappingContentProvider(sourceURL); var uiSourceCode = new WebInspector.UISourceCode(sourceURL, contentProvider, false); + this._workspace.project().addUISourceCode(uiSourceCode); + uiSourceCode.setSourceMapping(this); uiSourceCode.isContentScript = script.isContentScript; - this._uiSourceCodeByURL[sourceURL] = uiSourceCode; - this._sourceMapForUISourceCode.put(uiSourceCode, sourceMap); - uiSourceCodeList.push(uiSourceCode); } this._sourceMapForScriptId[script.scriptId] = sourceMap; this._scriptForSourceMap.put(sourceMap, script); script.setSourceMapping(this); - - for (var i = 0; i < uiSourceCodeList.length; ++i) - this._workspace.project().addUISourceCode(uiSourceCodeList[i]); }, /** @@ -132,7 +137,7 @@ WebInspector.CompilerScriptMapping.prototype = { loadSourceMapForScript: function(script) { var sourceMapURL = WebInspector.SourceMapParser.prototype._canonicalizeURL(script.sourceMapURL, script.sourceURL); - var sourceMap = this._sourceMapByURL[sourceMapURL]; + var sourceMap = this._sourceMapForSourceMapURL[sourceMapURL]; if (sourceMap) return sourceMap; @@ -147,19 +152,18 @@ WebInspector.CompilerScriptMapping.prototype = { console.error(e.message); return null; } - this._sourceMapByURL[sourceMapURL] = sourceMap; + this._sourceMapForSourceMapURL[sourceMapURL] = sourceMap; return sourceMap; }, _reset: function() { - this._sourceMapByURL = {}; + this._sourceMapForSourceMapURL = {}; this._sourceMapForScriptId = {}; this._scriptForSourceMap = new Map(); - this._sourceMapForUISourceCode = new Map(); - this._uiSourceCodeByURL = {}; + this._sourceMapForURL = {}; this._originalUISourceCodeForScriptId = {}; - this._scriptForOriginalUISource = new Map(); + this._scriptForOriginalUISourceCode = new Map(); } } diff --git a/Source/WebCore/inspector/front-end/NetworkManager.js b/Source/WebCore/inspector/front-end/NetworkManager.js index e56c7ebd5..da29d8951 100644 --- a/Source/WebCore/inspector/front-end/NetworkManager.js +++ b/Source/WebCore/inspector/front-end/NetworkManager.js @@ -63,6 +63,7 @@ WebInspector.NetworkManager._MIMETypes = { "text/css": {"stylesheet": true}, "text/xsl": {"stylesheet": true}, "image/jpeg": {"image": true}, + "image/pjpeg": {"image": true}, "image/png": {"image": true}, "image/gif": {"image": true}, "image/bmp": {"image": true}, diff --git a/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js b/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js index c3300aa0f..ec18dcf32 100644 --- a/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js +++ b/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js @@ -40,7 +40,7 @@ WebInspector.NetworkUISourceCodeProvider = function(workspace) this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectDidReset, this._projectDidReset, this); WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this); - this._uiSourceCodeForResource = {}; + this._processedURLs = {}; this._lastDynamicAnonymousScriptIndexForURL = {}; } @@ -72,13 +72,9 @@ WebInspector.NetworkUISourceCodeProvider.prototype = { // Only add uiSourceCodes for // - content scripts; // - scripts with explicit sourceURL comment; - // - dynamic anonymous scripts (script elements without src attribute); // - dynamic scripts (script elements with src attribute) when inspector is opened after the script was loaded. if (!script.hasSourceURL && !script.isContentScript) { - var resource = WebInspector.resourceForURL(script.sourceURL); - if (resource && resource.contentType() === WebInspector.resourceTypes.Document) - isDynamicAnonymousScript = true; - else if (resource || WebInspector.networkLog.requestForURL(script.sourceURL)) + if (WebInspector.resourceForURL(script.sourceURL) || WebInspector.networkLog.requestForURL(script.sourceURL)) return; } // Filter out embedder injected content scripts. @@ -87,17 +83,7 @@ WebInspector.NetworkUISourceCodeProvider.prototype = { if (!parsedURL.host) return; } - if (this._uiSourceCodeForResource[script.sourceURL] && !isDynamicAnonymousScript) - return; - var url = script.sourceURL; - if (isDynamicAnonymousScript) { - var dynamicAnonymousScriptIndex = (this._lastDynamicAnonymousScriptIndexForURL[url] || 0) + 1; - this._lastDynamicAnonymousScriptIndexForURL[url] = dynamicAnonymousScriptIndex; - url += " (" + dynamicAnonymousScriptIndex + ")"; - } - var uiSourceCode = new WebInspector.UISourceCode(url, script, true); - this._uiSourceCodeForResource[script.sourceURL] = uiSourceCode; - this._workspace.project().addUISourceCode(uiSourceCode); + this._addUISourceCode(script.sourceURL, script); }, /** @@ -106,29 +92,28 @@ WebInspector.NetworkUISourceCodeProvider.prototype = { _resourceAdded: function(event) { var resource = /** @type {WebInspector.Resource} */ event.data; - if (this._uiSourceCodeForResource[resource.url]) + this._addUISourceCode(resource.url, resource); + }, + + /** + * @param {WebInspector.ContentProvider} contentProvider + */ + _addUISourceCode: function(url, contentProvider) + { + var type = contentProvider.contentType(); + if (type !== WebInspector.resourceTypes.Stylesheet && type !== WebInspector.resourceTypes.Document && type !== WebInspector.resourceTypes.Script) return; - var uiSourceCode; - switch (resource.type) { - case WebInspector.resourceTypes.Stylesheet: - uiSourceCode = new WebInspector.UISourceCode(resource.url, resource, true); - break; - case WebInspector.resourceTypes.Document: - uiSourceCode = new WebInspector.UISourceCode(resource.url, resource, false); - break; - case WebInspector.resourceTypes.Script: - uiSourceCode = new WebInspector.UISourceCode(resource.url, resource, true); - break; - } - if (uiSourceCode) { - this._uiSourceCodeForResource[resource.url] = uiSourceCode; - this._workspace.project().addUISourceCode(uiSourceCode); - } + if (this._processedURLs[url]) + return; + this._processedURLs[url] = true; + var isEditable = type !== WebInspector.resourceTypes.Document; + var uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, isEditable); + this._workspace.project().addUISourceCode(uiSourceCode); }, _projectWillReset: function() { - this._uiSourceCodeForResource = {}; + this._processedURLs = {}; this._lastDynamicAnonymousScriptIndexForURL = {}; }, diff --git a/Source/WebCore/inspector/front-end/ResourceScriptMapping.js b/Source/WebCore/inspector/front-end/ResourceScriptMapping.js index db3c2a72f..bd6b2fa3e 100644 --- a/Source/WebCore/inspector/front-end/ResourceScriptMapping.js +++ b/Source/WebCore/inspector/front-end/ResourceScriptMapping.js @@ -41,6 +41,11 @@ WebInspector.ResourceScriptMapping = function(workspace) /** @type {Object.<string, WebInspector.UISourceCode>} */ this._temporaryUISourceCodeForScriptId = {}; + this._scriptIdsForTemporaryUISourceCode = new Map(); + /** @type {Object.<string, WebInspector.UISourceCode>} */ + this._originalUISourceCodeForScriptId = {}; + this._scriptIdsForOriginalUISourceCode = new Map(); + this._scripts = []; } @@ -53,14 +58,9 @@ WebInspector.ResourceScriptMapping.prototype = { { var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Location} */ rawLocation; var script = WebInspector.debuggerModel.scriptForId(debuggerModelLocation.scriptId); - var uiSourceCode = this._workspaceUISourceCodeForScript(script); - if (!uiSourceCode) - uiSourceCode = this._getOrCreateTemporaryUISourceCode(script); - else if (uiSourceCode.scriptFile() && uiSourceCode.scriptFile().hasDivergedFromVM()) { - var temporaryUISourceCode = this._getOrCreateTemporaryUISourceCode(script); - temporaryUISourceCode.divergedVersion = uiSourceCode; - uiSourceCode = temporaryUISourceCode; - } + var uiSourceCode = this._workspaceUISourceCodeForScript(script) || this._getOrCreateTemporaryUISourceCode(script); + if (uiSourceCode.scriptFile() && uiSourceCode.scriptFile().hasDivergedFromVM()) + uiSourceCode = this._getOrCreateOriginalUISourceCode(script, uiSourceCode); console.assert(!!uiSourceCode); return new WebInspector.UILocation(uiSourceCode, debuggerModelLocation.lineNumber, debuggerModelLocation.columnNumber || 0); }, @@ -73,9 +73,9 @@ WebInspector.ResourceScriptMapping.prototype = { var scripts = this._scriptsForUISourceCode(uiSourceCode); if (!scripts.length) return; + this._deleteOriginalUISourceCodeForScripts(scripts); for (var i = 0; i < scripts.length; ++i) scripts[i].setSourceMapping(this); - this._deleteTemporaryUISourceCodeForScripts(scripts); }, /** @@ -129,8 +129,27 @@ WebInspector.ResourceScriptMapping.prototype = { } var scripts = script.isInlineScript() ? this._scriptsForSourceURL(script.sourceURL, true) : [script]; - if (this._deleteTemporaryUISourceCodeForScripts(scripts)) + + if (this._deleteTemporaryUISourceCodeForScripts(scripts)) { + this._deleteOriginalUISourceCodeForScripts(scripts); uiSourceCode = this._getOrCreateTemporaryUISourceCode(script); + } + }, + + /** + * @param {Array.<WebInspector.Script>} scripts + */ + _deleteOriginalUISourceCodeForScripts: function(scripts) + { + var originalUISourceCode; + for (var i = 0; i < scripts.length; ++i) { + originalUISourceCode = originalUISourceCode || this._originalUISourceCodeForScriptId[scripts[i].scriptId]; + delete this._originalUISourceCodeForScriptId[scripts[i].scriptId]; + } + if (!originalUISourceCode) + return; + this._workspace.project().removeTemporaryUISourceCode(originalUISourceCode); + this._scriptIdsForOriginalUISourceCode.remove(originalUISourceCode); }, /** @@ -141,13 +160,14 @@ WebInspector.ResourceScriptMapping.prototype = { { var temporaryUISourceCode; for (var i = 0; i < scripts.length; ++i) { - var script = scripts[i]; - temporaryUISourceCode = temporaryUISourceCode || this._temporaryUISourceCodeForScriptId[script.scriptId]; - delete this._temporaryUISourceCodeForScriptId[script.scriptId]; + temporaryUISourceCode = temporaryUISourceCode || this._temporaryUISourceCodeForScriptId[scripts[i].scriptId]; + delete this._temporaryUISourceCodeForScriptId[scripts[i].scriptId]; } - if (temporaryUISourceCode) - this._workspace.project().removeTemporaryUISourceCode(temporaryUISourceCode); - return !!temporaryUISourceCode; + if (!temporaryUISourceCode) + return false; + this._workspace.project().removeTemporaryUISourceCode(temporaryUISourceCode); + this._scriptIdsForTemporaryUISourceCode.remove(temporaryUISourceCode); + return true; }, /** @@ -161,7 +181,7 @@ WebInspector.ResourceScriptMapping.prototype = { scripts[i].setSourceMapping(this); uiSourceCode.isContentScript = scripts[0].isContentScript; uiSourceCode.setSourceMapping(this); - if (!uiSourceCode.isTemporary) { + if (uiSourceCode.isEditable()) { var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode); uiSourceCode.setScriptFile(scriptFile); } @@ -195,6 +215,22 @@ WebInspector.ResourceScriptMapping.prototype = { }, /** + * @param {Array.<WebInspector.Script>} scripts + * @param {WebInspector.UISourceCode=} divergedVersion + * @return {WebInspector.UISourceCode} + */ + _createUISourceCode: function(scripts, divergedVersion) + { + var script = scripts[0]; + var contentProvider = script.isInlineScript() ? new WebInspector.ConcatenatedScriptsContentProvider(scripts) : script; + var isDynamicScript = this._isDynamicScript(script); + var url = isDynamicScript ? "" : script.sourceURL; + var temporaryUISourceCode = new WebInspector.UISourceCode(url, contentProvider, !script.isInlineScript() && !divergedVersion); + temporaryUISourceCode.divergedVersion = divergedVersion; + return temporaryUISourceCode; + }, + + /** * @param {WebInspector.Script} script * @return {WebInspector.UISourceCode} */ @@ -205,17 +241,42 @@ WebInspector.ResourceScriptMapping.prototype = { return temporaryUISourceCode; var scripts = script.isInlineScript() ? this._scriptsForSourceURL(script.sourceURL, true) : [script]; - var contentProvider = script.isInlineScript() ? new WebInspector.ConcatenatedScriptsContentProvider(scripts) : script; - var isDynamicScript = this._isDynamicScript(script); - var url = isDynamicScript ? "" : script.sourceURL; - temporaryUISourceCode = new WebInspector.UISourceCode(url, contentProvider, false); - for (var i = 0; i < scripts.length; ++i) + temporaryUISourceCode = this._createUISourceCode(scripts); + var scriptIds = []; + for (var i = 0; i < scripts.length; ++i) { this._temporaryUISourceCodeForScriptId[scripts[i].scriptId] = temporaryUISourceCode; - this._bindUISourceCodeToScripts(temporaryUISourceCode, scripts); + scriptIds.push(scripts[i].scriptId); + } + this._scriptIdsForTemporaryUISourceCode.put(temporaryUISourceCode, scriptIds); this._workspace.project().addTemporaryUISourceCode(temporaryUISourceCode); + this._bindUISourceCodeToScripts(temporaryUISourceCode, scripts); return temporaryUISourceCode; }, + /** + * @param {WebInspector.Script} script + * @param {WebInspector.UISourceCode} divergedVersion + * @return {WebInspector.UISourceCode} + */ + _getOrCreateOriginalUISourceCode: function(script, divergedVersion) + { + var originalUISourceCode = this._originalUISourceCodeForScriptId[script.scriptId]; + if (originalUISourceCode) + return originalUISourceCode; + + var scripts = script.isInlineScript() ? this._scriptsForSourceURL(script.sourceURL, true) : [script]; + originalUISourceCode = this._createUISourceCode(scripts, divergedVersion); + var scriptIds = []; + for (var i = 0; i < scripts.length; ++i) { + this._originalUISourceCodeForScriptId[scripts[i].scriptId] = originalUISourceCode; + scriptIds.push(scripts[i].scriptId); + } + this._scriptIdsForOriginalUISourceCode.put(originalUISourceCode, scriptIds); + this._workspace.project().addTemporaryUISourceCode(originalUISourceCode); + this._bindUISourceCodeToScripts(originalUISourceCode, scripts); + return originalUISourceCode; + }, + _uiSourceCodeAddedToWorkspace: function(event) { var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; @@ -226,6 +287,7 @@ WebInspector.ResourceScriptMapping.prototype = { return; this._deleteTemporaryUISourceCodeForScripts(scripts); + this._deleteOriginalUISourceCodeForScripts(scripts); this._bindUISourceCodeToScripts(uiSourceCode, scripts); }, @@ -235,6 +297,10 @@ WebInspector.ResourceScriptMapping.prototype = { */ _scriptsForUISourceCode: function(uiSourceCode) { + var scriptIds = this._scriptIdsForOriginalUISourceCode.get(uiSourceCode) || this._scriptIdsForTemporaryUISourceCode.get(uiSourceCode); + if (scriptIds) + return scriptIds.map(WebInspector.debuggerModel.scriptForId.bind(WebInspector.debuggerModel)); + var isInlineScript; switch (uiSourceCode.contentType()) { case WebInspector.resourceTypes.Document: @@ -246,13 +312,15 @@ WebInspector.ResourceScriptMapping.prototype = { default: return []; } - return this._scriptsForSourceURL(uiSourceCode.url, isInlineScript); }, _reset: function() { this._temporaryUISourceCodeForScriptId = {}; + this._scriptIdsForTemporaryUISourceCode = new Map(); + this._originalUISourceCodeForScriptId = {}; + this._scriptIdsForOriginalUISourceCode = new Map(); this._scripts = []; }, } diff --git a/Source/WebCore/inspector/front-end/SASSSourceMapping.js b/Source/WebCore/inspector/front-end/SASSSourceMapping.js index a114df901..85b521dce 100644 --- a/Source/WebCore/inspector/front-end/SASSSourceMapping.js +++ b/Source/WebCore/inspector/front-end/SASSSourceMapping.js @@ -36,7 +36,6 @@ WebInspector.SASSSourceMapping = function(workspace) { this._workspace = workspace; - this._uiSourceCodeForURL = {}; this._uiLocations = {}; WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this); @@ -112,12 +111,11 @@ WebInspector.SASSSourceMapping.prototype = { */ _bindUISourceCode: function(url, line, rawURL, rawLine) { - var uiSourceCode = this._uiSourceCodeForURL[url]; + var uiSourceCode = this._workspace.uiSourceCodeForURL(url); if (!uiSourceCode) { var content = InspectorFrontendHost.loadResourceSynchronously(url); var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content, "text/x-scss"); uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, true); - this._uiSourceCodeForURL[url] = uiSourceCode; this._workspace.project().addUISourceCode(uiSourceCode); WebInspector.cssModel.setSourceMapping(rawURL, this); } @@ -154,7 +152,6 @@ WebInspector.SASSSourceMapping.prototype = { _reset: function() { - this._uiSourceCodeForURL = {}; this._uiLocations = {}; this._populate(); } diff --git a/Source/WebCore/inspector/front-end/TimelineModel.js b/Source/WebCore/inspector/front-end/TimelineModel.js index 5d9d4c96c..e50cd5b60 100644 --- a/Source/WebCore/inspector/front-end/TimelineModel.js +++ b/Source/WebCore/inspector/front-end/TimelineModel.js @@ -56,6 +56,7 @@ WebInspector.TimelineModel.RecordType = { InvalidateLayout: "InvalidateLayout", Layout: "Layout", Paint: "Paint", + ScrollLayer: "ScrollLayer", DecodeImage: "DecodeImage", ResizeImage: "ResizeImage", CompositeLayers: "CompositeLayers", diff --git a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js index baa1a1c8d..7020d1aa3 100644 --- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +++ b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js @@ -77,6 +77,7 @@ WebInspector.TimelinePresentationModel._initRecordStyles = function() recordStyles[recordTypes.InvalidateLayout] = { title: WebInspector.UIString("Invalidate Layout"), category: categories["rendering"] }; recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] }; recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] }; + recordStyles[recordTypes.ScrollLayer] = { title: WebInspector.UIString("Scroll"), category: categories["painting"] }; recordStyles[recordTypes.DecodeImage] = { title: WebInspector.UIString("Image Decode"), category: categories["painting"] }; recordStyles[recordTypes.ResizeImage] = { title: WebInspector.UIString("Image Resize"), category: categories["painting"] }; recordStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["painting"] }; diff --git a/Source/WebCore/inspector/front-end/UISourceCode.js b/Source/WebCore/inspector/front-end/UISourceCode.js index 8613dff82..32010a40b 100644 --- a/Source/WebCore/inspector/front-end/UISourceCode.js +++ b/Source/WebCore/inspector/front-end/UISourceCode.js @@ -61,7 +61,7 @@ WebInspector.UISourceCode = function(url, contentProvider, isEditable) * @type {Array.<WebInspector.Revision>} */ this.history = []; - if (this.isEditable()) + if (this.isEditable() && this._url) this._restoreRevisionHistory(); this._formatterMapping = new WebInspector.IdentityFormatterSourceMapping(); } @@ -850,7 +850,7 @@ WebInspector.Revision.prototype = { return; var url = this.contentURL(); - if (url.startsWith("inspector://")) + if (!url || url.startsWith("inspector://")) return; var loaderId = WebInspector.resourceTreeModel.mainFrame.loaderId; diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index 3486c4996..467ee66dd 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -36,6 +36,7 @@ <file>CSSNamedFlowView.js</file> <file>CSSSelectorProfileView.js</file> <file>CSSStyleModel.js</file> + <file>cm/cmdevtools.css</file> <file>cm/codemirror.css</file> <file>cm/codemirror.js</file> <file>cm/css.js</file> @@ -220,7 +221,6 @@ <file>canvasProfiler.css</file> <file>cssNamedFlows.css</file> <file>dataGrid.css</file> - <file>cmdevtools.css</file> <file>dialog.css</file> <file>elementsPanel.css</file> <file>filteredItemSelectionDialog.css</file> diff --git a/Source/WebCore/inspector/front-end/cmdevtools.css b/Source/WebCore/inspector/front-end/cm/cmdevtools.css index c4b83c113..3e8be97cc 100644 --- a/Source/WebCore/inspector/front-end/cmdevtools.css +++ b/Source/WebCore/inspector/front-end/cm/cmdevtools.css @@ -39,6 +39,8 @@ .cm-s-web-inspector-css span.cm-keyword { color: rgb(7, 144, 154);} .cm-s-web-inspector-css span.cm-number {color: rgb(50, 0, 255);} .cm-s-web-inspector-css span.cm-comment {color: rgb(0, 116, 0);} +.cm-s-web-inspector-css span.cm-meta {color: rgb(200, 0, 0);} +.cm-s-web-inspector-css span.cm-atom {color: rgb(7, 144, 154);} .cm-s-web-inspector-css span.cm-string {color: rgb(7, 144, 154);} .cm-s-web-inspector-css span.cm-string-2 {color: rgb(7, 144, 154);} .cm-s-web-inspector-css span.cm-link {color: rgb(7, 144, 154);} diff --git a/Source/WebCore/loader/DocumentThreadableLoader.cpp b/Source/WebCore/loader/DocumentThreadableLoader.cpp index 71a1ad3b1..9c889cdf5 100644 --- a/Source/WebCore/loader/DocumentThreadableLoader.cpp +++ b/Source/WebCore/loader/DocumentThreadableLoader.cpp @@ -33,6 +33,7 @@ #include "CachedRawResource.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "CrossOriginAccessControl.h" #include "CrossOriginPreflightResultCache.h" #include "Document.h" @@ -376,17 +377,17 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur options.shouldBufferData = BufferData; } - ResourceRequest newRequest(request); + CachedResourceRequest newRequest(request, options); #if ENABLE(INSPECTOR) if (m_actualRequest) { // Because willSendRequest only gets called during redirects, we initialize the identifier and the first willSendRequest here. m_preflightRequestIdentifier = m_document->frame()->page()->progress()->createUniqueIdentifier(); ResourceResponse redirectResponse = ResourceResponse(); - InspectorInstrumentation::willSendRequest(m_document->frame(), m_preflightRequestIdentifier, m_document->frame()->loader()->documentLoader(), newRequest, redirectResponse); + InspectorInstrumentation::willSendRequest(m_document->frame(), m_preflightRequestIdentifier, m_document->frame()->loader()->documentLoader(), newRequest.mutableResourceRequest(), redirectResponse); } #endif ASSERT(!m_resource); - m_resource = m_document->cachedResourceLoader()->requestRawResource(newRequest, options); + m_resource = m_document->cachedResourceLoader()->requestRawResource(newRequest); if (m_resource) { #if ENABLE(INSPECTOR) if (m_resource->loader()) { diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp index a6da61e65..c12be2ff9 100644 --- a/Source/WebCore/loader/ImageLoader.cpp +++ b/Source/WebCore/loader/ImageLoader.cpp @@ -24,6 +24,7 @@ #include "CachedImage.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "CrossOriginAccessControl.h" #include "Document.h" #include "Element.h" @@ -177,18 +178,18 @@ void ImageLoader::updateFromElement() // an empty string. CachedResourceHandle<CachedImage> newImage = 0; if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) { - ResourceRequest request = ResourceRequest(document()->completeURL(sourceURI(attr))); + CachedResourceRequest request(ResourceRequest(document()->completeURL(sourceURI(attr)))); String crossOriginMode = client()->sourceElement()->fastGetAttribute(HTMLNames::crossoriginAttr); if (!crossOriginMode.isNull()) { StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; - updateRequestForAccessControl(request, document()->securityOrigin(), allowCredentials); + updateRequestForAccessControl(request.mutableResourceRequest(), document()->securityOrigin(), allowCredentials); } if (m_loadManually) { bool autoLoadOtherImages = document()->cachedResourceLoader()->autoLoadImages(); document()->cachedResourceLoader()->setAutoLoadImages(false); - newImage = new CachedImage(request); + newImage = new CachedImage(request.resourceRequest()); newImage->setLoading(true); newImage->setOwningCachedResourceLoader(document()->cachedResourceLoader()); document()->cachedResourceLoader()->m_documentResources.set(newImage->url(), newImage.get()); diff --git a/Source/WebCore/loader/LinkLoader.cpp b/Source/WebCore/loader/LinkLoader.cpp index af25a8680..e50b379d9 100644 --- a/Source/WebCore/loader/LinkLoader.cpp +++ b/Source/WebCore/loader/LinkLoader.cpp @@ -35,6 +35,7 @@ #include "CSSStyleSheet.h" #include "CachedCSSStyleSheet.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "ContainerNode.h" #include "DNS.h" #include "Document.h" @@ -119,13 +120,13 @@ bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const String& ty priority = ResourceLoadPriorityLow; type = CachedResource::LinkSubresource; } - ResourceRequest linkRequest(document->completeURL(href)); + CachedResourceRequest linkRequest(ResourceRequest(document->completeURL(href)), priority); if (m_cachedLinkResource) { m_cachedLinkResource->removeClient(this); m_cachedLinkResource = 0; } - m_cachedLinkResource = document->cachedResourceLoader()->requestLinkResource(type, linkRequest, priority); + m_cachedLinkResource = document->cachedResourceLoader()->requestLinkResource(type, linkRequest); if (m_cachedLinkResource) m_cachedLinkResource->addClient(this); } diff --git a/Source/WebCore/loader/TextTrackLoader.cpp b/Source/WebCore/loader/TextTrackLoader.cpp index a9b7f960b..7e14b4334 100644 --- a/Source/WebCore/loader/TextTrackLoader.cpp +++ b/Source/WebCore/loader/TextTrackLoader.cpp @@ -30,6 +30,7 @@ #include "TextTrackLoader.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "CachedTextTrack.h" #include "CrossOriginAccessControl.h" #include "Document.h" @@ -153,12 +154,12 @@ bool TextTrackLoader::load(const KURL& url, const String& crossOriginMode) ASSERT(m_scriptExecutionContext->isDocument()); Document* document = static_cast<Document*>(m_scriptExecutionContext); - ResourceRequest cueRequest(document->completeURL(url)); + CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url))); if (!crossOriginMode.isNull()) { m_crossOriginMode = crossOriginMode; StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; - updateRequestForAccessControl(cueRequest, document->securityOrigin(), allowCredentials); + updateRequestForAccessControl(cueRequest.mutableResourceRequest(), document->securityOrigin(), allowCredentials); } else { // Cross-origin resources that are not suitably CORS-enabled may not load. if (!document->securityOrigin()->canRequest(url)) { diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp index 1ffca4fc1..1ccaed9bf 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp @@ -32,6 +32,7 @@ #include "CachedFont.h" #include "CachedImage.h" #include "CachedRawResource.h" +#include "CachedResourceRequest.h" #include "CachedScript.h" #include "CachedXSLStyleSheet.h" #include "Console.h" @@ -107,12 +108,6 @@ static CachedResource* createResource(CachedResource::Type type, ResourceRequest return 0; } -static const ResourceLoaderOptions& defaultCachedResourceOptions() -{ - static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForCrossOriginCredentials, DoSecurityCheck); - return options; -} - CachedResourceLoader::CachedResourceLoader(DocumentLoader* documentLoader) : m_document(0) , m_documentLoader(documentLoader) @@ -155,56 +150,57 @@ Frame* CachedResourceLoader::frame() const return m_documentLoader ? m_documentLoader->frame() : 0; } -CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(ResourceRequest& request) +CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResourceRequest& request) { if (Frame* f = frame()) { if (f->loader()->pageDismissalEventBeingDispatched() != FrameLoader::NoDismissal) { - KURL requestURL = request.url(); + KURL requestURL = request.resourceRequest().url(); if (requestURL.isValid() && canRequest(CachedResource::ImageResource, requestURL)) PingLoader::loadImage(f, requestURL); return 0; } } - return static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, request, String(), defaultCachedResourceOptions(), ResourceLoadPriorityUnresolved, false, clientDefersImage(request.url()) ? DeferredByClient : NoDefer).get()); + request.setDefer(clientDefersImage(request.resourceRequest().url()) ? DeferredByClient : NoDefer); + return static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, request).get()); } -CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(ResourceRequest& request) +CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest& request) { - return static_cast<CachedFont*>(requestResource(CachedResource::FontResource, request, String(), defaultCachedResourceOptions()).get()); + return static_cast<CachedFont*>(requestResource(CachedResource::FontResource, request).get()); } #if ENABLE(VIDEO_TRACK) -CachedResourceHandle<CachedTextTrack> CachedResourceLoader::requestTextTrack(ResourceRequest& request) +CachedResourceHandle<CachedTextTrack> CachedResourceLoader::requestTextTrack(CachedResourceRequest& request) { - return static_cast<CachedTextTrack*>(requestResource(CachedResource::TextTrackResource, request, String(), defaultCachedResourceOptions()).get()); + return static_cast<CachedTextTrack*>(requestResource(CachedResource::TextTrackResource, request).get()); } #endif #if ENABLE(CSS_SHADERS) -CachedResourceHandle<CachedShader> CachedResourceLoader::requestShader(ResourceRequest& request) +CachedResourceHandle<CachedShader> CachedResourceLoader::requestShader(CachedResourceRequest& request) { - return static_cast<CachedShader*>(requestResource(CachedResource::ShaderResource, request, String(), defaultCachedResourceOptions()).get()); + return static_cast<CachedShader*>(requestResource(CachedResource::ShaderResource, request).get()); } #endif -CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestCSSStyleSheet(ResourceRequest& request, const String& charset, ResourceLoadPriority priority) +CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestCSSStyleSheet(CachedResourceRequest& request) { - return static_cast<CachedCSSStyleSheet*>(requestResource(CachedResource::CSSStyleSheet, request, charset, defaultCachedResourceOptions(), priority).get()); + return static_cast<CachedCSSStyleSheet*>(requestResource(CachedResource::CSSStyleSheet, request).get()); } -CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(ResourceRequest& request, const String& charset) +CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest& request) { - KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(request.url()); + KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(request.resourceRequest().url()); if (CachedResource* existing = memoryCache()->resourceForURL(url)) { if (existing->type() == CachedResource::CSSStyleSheet) return static_cast<CachedCSSStyleSheet*>(existing); memoryCache()->remove(existing); } - if (url.string() != request.url()) - request.setURL(url); + if (url.string() != request.resourceRequest().url()) + request.mutableResourceRequest().setURL(url); - CachedResourceHandle<CachedCSSStyleSheet> userSheet = new CachedCSSStyleSheet(request, charset); + CachedResourceHandle<CachedCSSStyleSheet> userSheet = new CachedCSSStyleSheet(request.resourceRequest(), request.charset()); memoryCache()->add(userSheet.get()); // FIXME: loadResource calls setOwningCachedResourceLoader() if the resource couldn't be added to cache. Does this function need to call it, too? @@ -214,37 +210,37 @@ CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSSt return userSheet; } -CachedResourceHandle<CachedScript> CachedResourceLoader::requestScript(ResourceRequest& request, const String& charset) +CachedResourceHandle<CachedScript> CachedResourceLoader::requestScript(CachedResourceRequest& request) { - return static_cast<CachedScript*>(requestResource(CachedResource::Script, request, charset, defaultCachedResourceOptions()).get()); + return static_cast<CachedScript*>(requestResource(CachedResource::Script, request).get()); } #if ENABLE(XSLT) -CachedResourceHandle<CachedXSLStyleSheet> CachedResourceLoader::requestXSLStyleSheet(ResourceRequest& request) +CachedResourceHandle<CachedXSLStyleSheet> CachedResourceLoader::requestXSLStyleSheet(CachedResourceRequest& request) { - return static_cast<CachedXSLStyleSheet*>(requestResource(CachedResource::XSLStyleSheet, request, String(), defaultCachedResourceOptions()).get()); + return static_cast<CachedXSLStyleSheet*>(requestResource(CachedResource::XSLStyleSheet, request).get()); } #endif #if ENABLE(SVG) -CachedResourceHandle<CachedSVGDocument> CachedResourceLoader::requestSVGDocument(ResourceRequest& request) +CachedResourceHandle<CachedSVGDocument> CachedResourceLoader::requestSVGDocument(CachedResourceRequest& request) { - return static_cast<CachedSVGDocument*>(requestResource(CachedResource::SVGDocumentResource, request, String(), defaultCachedResourceOptions()).get()); + return static_cast<CachedSVGDocument*>(requestResource(CachedResource::SVGDocumentResource, request).get()); } #endif #if ENABLE(LINK_PREFETCH) -CachedResourceHandle<CachedResource> CachedResourceLoader::requestLinkResource(CachedResource::Type type, ResourceRequest& request, ResourceLoadPriority priority) +CachedResourceHandle<CachedResource> CachedResourceLoader::requestLinkResource(CachedResource::Type type, CachedResourceRequest& request) { ASSERT(frame()); ASSERT(type == CachedResource::LinkPrefetch || type == CachedResource::LinkSubresource); - return requestResource(type, request, String(), defaultCachedResourceOptions(), priority); + return requestResource(type, request); } #endif -CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestRawResource(ResourceRequest& request, const ResourceLoaderOptions& options) +CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestRawResource(CachedResourceRequest& request) { - return static_cast<CachedRawResource*>(requestResource(CachedResource::RawResource, request, String(), options, ResourceLoadPriorityUnresolved, false).get()); + return static_cast<CachedRawResource*>(requestResource(CachedResource::RawResource, request).get()); } bool CachedResourceLoader::checkInsecureContent(CachedResource::Type type, const KURL& url) const @@ -402,11 +398,11 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url return true; } -CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, ResourceRequest& request, const String& charset, const ResourceLoaderOptions& options, ResourceLoadPriority priority, bool forPreload, DeferOption defer) +CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest& request) { - KURL url = request.url(); + KURL url = request.resourceRequest().url(); - LOG(ResourceLoading, "CachedResourceLoader::requestResource '%s', charset '%s', priority=%d, forPreload=%u", url.string().latin1().data(), charset.latin1().data(), priority, forPreload); + LOG(ResourceLoading, "CachedResourceLoader::requestResource '%s', charset '%s', priority=%d, forPreload=%u", url.string().latin1().data(), request.charset().latin1().data(), request.priority(), request.forPreload()); // If only the fragment identifiers differ, it is the same resource. url = MemoryCache::removeFragmentIdentifierIfNeeded(url); @@ -414,7 +410,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache if (!url.isValid()) return 0; - if (!canRequest(type, url, forPreload)) + if (!canRequest(type, url, request.forPreload())) return 0; if (memoryCache()->disabled()) { @@ -428,16 +424,16 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache // See if we can use an existing resource from the cache. CachedResourceHandle<CachedResource> resource = memoryCache()->resourceForURL(url); - if (request.url() != url) - request.setURL(url); + if (request.resourceRequest().url() != url) + request.mutableResourceRequest().setURL(url); - const RevalidationPolicy policy = determineRevalidationPolicy(type, request, forPreload, resource.get(), defer); + const RevalidationPolicy policy = determineRevalidationPolicy(type, request.mutableResourceRequest(), request.forPreload(), resource.get(), request.defer()); switch (policy) { case Reload: memoryCache()->remove(resource.get()); // Fall through case Load: - resource = loadResource(type, request, charset); + resource = loadResource(type, request.mutableResourceRequest(), request.charset()); break; case Revalidate: resource = revalidateResource(resource.get()); @@ -451,9 +447,9 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache if (!resource) return 0; - resource->setLoadPriority(priority); - if ((policy != Use || resource->stillNeedsLoad()) && NoDefer == defer) { - resource->load(this, options); + resource->setLoadPriority(request.priority()); + if ((policy != Use || resource->stillNeedsLoad()) && NoDefer == request.defer()) { + resource->load(this, request.options()); // We don't support immediate loads, but we do support immediate failure. if (resource->errorOccurred()) { @@ -463,8 +459,8 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache } } - if (!request.url().protocolIsData()) - m_validatedURLs.add(request.url()); + if (!request.resourceRequest().url().protocolIsData()) + m_validatedURLs.add(request.resourceRequest().url()); ASSERT(resource->url() == url.string()); m_documentResources.set(resource->url(), resource); @@ -793,7 +789,10 @@ void CachedResourceLoader::requestPreload(CachedResource::Type type, ResourceReq if (type == CachedResource::Script || type == CachedResource::CSSStyleSheet) encoding = charset.isEmpty() ? m_document->charset() : charset; - CachedResourceHandle<CachedResource> resource = requestResource(type, request, encoding, defaultCachedResourceOptions(), ResourceLoadPriorityUnresolved, true); + CachedResourceRequest cachedResourceRequest(request, encoding); + cachedResourceRequest.setForPreload(true); + + CachedResourceHandle<CachedResource> resource = requestResource(type, cachedResourceRequest); if (!resource || (m_preloads && m_preloads->contains(resource.get()))) return; resource->increasePreloadCount(); @@ -912,4 +911,10 @@ void CachedResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) info.addMember(m_pendingPreloads); } +const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions() +{ + static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForCrossOriginCredentials, DoSecurityCheck); + return options; +} + } diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h index 2a7985e6c..0fcb1e37d 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.h +++ b/Source/WebCore/loader/cache/CachedResourceLoader.h @@ -44,6 +44,7 @@ class CachedSVGDocument; class CachedFont; class CachedImage; class CachedRawResource; +class CachedResourceRequest; class CachedScript; class CachedShader; class CachedTextTrack; @@ -68,30 +69,31 @@ friend class ImageLoader; friend class ResourceCacheValidationSuppressor; public: + enum DeferOption { NoDefer, DeferredByClient }; static PassRefPtr<CachedResourceLoader> create(DocumentLoader* documentLoader) { return adoptRef(new CachedResourceLoader(documentLoader)); } ~CachedResourceLoader(); - CachedResourceHandle<CachedImage> requestImage(ResourceRequest&); - CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(ResourceRequest&, const String& charset, ResourceLoadPriority = ResourceLoadPriorityUnresolved); - CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(ResourceRequest&, const String& charset); - CachedResourceHandle<CachedScript> requestScript(ResourceRequest&, const String& charset); - CachedResourceHandle<CachedFont> requestFont(ResourceRequest&); - CachedResourceHandle<CachedRawResource> requestRawResource(ResourceRequest&, const ResourceLoaderOptions&); + CachedResourceHandle<CachedImage> requestImage(CachedResourceRequest&); + CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(CachedResourceRequest&); + CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(CachedResourceRequest&); + CachedResourceHandle<CachedScript> requestScript(CachedResourceRequest&); + CachedResourceHandle<CachedFont> requestFont(CachedResourceRequest&); + CachedResourceHandle<CachedRawResource> requestRawResource(CachedResourceRequest&); #if ENABLE(SVG) - CachedResourceHandle<CachedSVGDocument> requestSVGDocument(ResourceRequest&); + CachedResourceHandle<CachedSVGDocument> requestSVGDocument(CachedResourceRequest&); #endif #if ENABLE(XSLT) - CachedResourceHandle<CachedXSLStyleSheet> requestXSLStyleSheet(ResourceRequest&); + CachedResourceHandle<CachedXSLStyleSheet> requestXSLStyleSheet(CachedResourceRequest&); #endif #if ENABLE(LINK_PREFETCH) - CachedResourceHandle<CachedResource> requestLinkResource(CachedResource::Type, ResourceRequest&, ResourceLoadPriority = ResourceLoadPriorityUnresolved); + CachedResourceHandle<CachedResource> requestLinkResource(CachedResource::Type, CachedResourceRequest&); #endif #if ENABLE(VIDEO_TRACK) - CachedResourceHandle<CachedTextTrack> requestTextTrack(ResourceRequest&); + CachedResourceHandle<CachedTextTrack> requestTextTrack(CachedResourceRequest&); #endif #if ENABLE(CSS_SHADERS) - CachedResourceHandle<CachedShader> requestShader(ResourceRequest&); + CachedResourceHandle<CachedShader> requestShader(CachedResourceRequest&); #endif // Logs an access denied message to the console for the specified URL. @@ -135,11 +137,12 @@ public: void reportMemoryUsage(MemoryObjectInfo*) const; + static const ResourceLoaderOptions& defaultCachedResourceOptions(); + private: explicit CachedResourceLoader(DocumentLoader*); - enum DeferOption { NoDefer, DeferredByClient }; - CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, ResourceRequest&, const String& charset, const ResourceLoaderOptions&, ResourceLoadPriority = ResourceLoadPriorityUnresolved, bool isPreload = false, DeferOption = NoDefer); + CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&); CachedResourceHandle<CachedResource> revalidateResource(CachedResource*); CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, ResourceRequest&, const String& charset); void requestPreload(CachedResource::Type, ResourceRequest&, const String& charset); diff --git a/Source/WebCore/loader/cache/CachedResourceRequest.cpp b/Source/WebCore/loader/cache/CachedResourceRequest.cpp new file mode 100644 index 000000000..6add39b96 --- /dev/null +++ b/Source/WebCore/loader/cache/CachedResourceRequest.cpp @@ -0,0 +1,59 @@ +/* + * 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 GOOGLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CachedResourceRequest.h" + +namespace WebCore { + +CachedResourceRequest::CachedResourceRequest(const ResourceRequest& resourceRequest, const String& charset, ResourceLoadPriority priority) + : m_resourceRequest(resourceRequest) + , m_charset(charset) + , m_options(CachedResourceLoader::defaultCachedResourceOptions()) + , m_priority(priority) + , m_forPreload(false) + , m_defer(CachedResourceLoader::NoDefer) +{ +} + +CachedResourceRequest::CachedResourceRequest(const ResourceRequest& resourceRequest, const ResourceLoaderOptions& options) + : m_resourceRequest(resourceRequest) + , m_options(options) + , m_priority(ResourceLoadPriorityUnresolved) + , m_forPreload(false) + , m_defer(CachedResourceLoader::NoDefer) +{ +} + +CachedResourceRequest::CachedResourceRequest(const ResourceRequest& resourceRequest, ResourceLoadPriority priority) + : m_resourceRequest(resourceRequest) + , m_options(CachedResourceLoader::defaultCachedResourceOptions()) + , m_priority(priority) + , m_forPreload(false) + , m_defer(CachedResourceLoader::NoDefer) +{ +} + +} diff --git a/Source/WebCore/loader/cache/CachedResourceRequest.h b/Source/WebCore/loader/cache/CachedResourceRequest.h new file mode 100644 index 000000000..cb043dfe3 --- /dev/null +++ b/Source/WebCore/loader/cache/CachedResourceRequest.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 GOOGLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CachedResourceRequest_h +#define CachedResourceRequest_h + +#include "CachedResourceLoader.h" +#include "ResourceLoadPriority.h" + +namespace WebCore { + +class CachedResourceRequest { +public: + explicit CachedResourceRequest(const ResourceRequest&, const String& charset = String(), ResourceLoadPriority = ResourceLoadPriorityUnresolved); + CachedResourceRequest(const ResourceRequest&, const ResourceLoaderOptions&); + CachedResourceRequest(const ResourceRequest&, ResourceLoadPriority); + + ResourceRequest& mutableResourceRequest() { return m_resourceRequest; } + const ResourceRequest& resourceRequest() const { return m_resourceRequest; } + const String& charset() const { return m_charset; } + void setCharset(const String& charset) { m_charset = charset; } + const ResourceLoaderOptions& options() const { return m_options; } + ResourceLoadPriority priority() const { return m_priority; } + bool forPreload() const { return m_forPreload; } + void setForPreload(bool forPreload) { m_forPreload = forPreload; } + CachedResourceLoader::DeferOption defer() const { return m_defer; } + void setDefer(CachedResourceLoader::DeferOption defer) { m_defer = defer; } + +private: + ResourceRequest m_resourceRequest; + String m_charset; + ResourceLoaderOptions m_options; + ResourceLoadPriority m_priority; + bool m_forPreload; + CachedResourceLoader::DeferOption m_defer; +}; + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/loader/icon/IconLoader.cpp b/Source/WebCore/loader/icon/IconLoader.cpp index 63bc0ea1c..8c9d0cecb 100644 --- a/Source/WebCore/loader/icon/IconLoader.cpp +++ b/Source/WebCore/loader/icon/IconLoader.cpp @@ -28,6 +28,7 @@ #include "CachedRawResource.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "Frame.h" #include "FrameLoader.h" @@ -59,14 +60,14 @@ void IconLoader::startLoading() if (m_resource || !m_frame->document()) return; - ResourceRequest resourceRequest(m_frame->loader()->icon()->url()); + CachedResourceRequest request(ResourceRequest(m_frame->loader()->icon()->url()), ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck)); + #if PLATFORM(BLACKBERRY) - resourceRequest.setTargetType(ResourceRequest::TargetIsFavicon); + request.mutableResourceRequest().setTargetType(ResourceRequest::TargetIsFavicon); #endif - resourceRequest.setPriority(ResourceLoadPriorityLow); + request.mutableResourceRequest().setPriority(ResourceLoadPriorityLow); - m_resource = m_frame->document()->cachedResourceLoader()->requestRawResource(resourceRequest, - ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck)); + m_resource = m_frame->document()->cachedResourceLoader()->requestRawResource(request); if (m_resource) m_resource->addClient(this); else diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index faa4ba048..a84fec59c 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -745,14 +745,23 @@ Storage* DOMWindow::sessionStorage(ExceptionCode& ec) const return 0; } - if (m_sessionStorage) + if (m_sessionStorage) { + if (!m_sessionStorage->area()->canAccessStorage(m_frame)) { + ec = SECURITY_ERR; + return 0; + } return m_sessionStorage.get(); + } Page* page = document->page(); if (!page) return 0; RefPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin()); + if (!storageArea->canAccessStorage(m_frame)) { + ec = SECURITY_ERR; + return 0; + } InspectorInstrumentation::didUseDOMStorage(page, storageArea.get(), false, m_frame); m_sessionStorage = Storage::create(m_frame, storageArea.release()); @@ -773,8 +782,13 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const return 0; } - if (m_localStorage) + if (m_localStorage) { + if (!m_localStorage->area()->canAccessStorage(m_frame)) { + ec = SECURITY_ERR; + return 0; + } return m_localStorage.get(); + } Page* page = document->page(); if (!page) @@ -784,6 +798,10 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const return 0; RefPtr<StorageArea> storageArea = page->group().localStorage()->storageArea(document->securityOrigin()); + if (!storageArea->canAccessStorage(m_frame)) { + ec = SECURITY_ERR; + return 0; + } InspectorInstrumentation::didUseDOMStorage(page, storageArea.get(), true, m_frame); m_localStorage = Storage::create(m_frame, storageArea.release()); diff --git a/Source/WebCore/page/FeatureObserver.h b/Source/WebCore/page/FeatureObserver.h index 8e0e84588..1b79f6790 100644 --- a/Source/WebCore/page/FeatureObserver.h +++ b/Source/WebCore/page/FeatureObserver.h @@ -45,7 +45,7 @@ public: PrefixedIndexedDB, WorkerStart, SharedWorkerStart, - LegacyWebAudioNoteOn, + LegacyWebAudio, WebAudioStart, PrefixedContentSecurityPolicy, UnprefixedIndexedDB, diff --git a/Source/WebCore/page/Performance.cpp b/Source/WebCore/page/Performance.cpp index 24987ced8..26588f784 100644 --- a/Source/WebCore/page/Performance.cpp +++ b/Source/WebCore/page/Performance.cpp @@ -57,7 +57,10 @@ Performance::Performance(Frame* frame) : DOMWindowProperty(frame) #if ENABLE(RESOURCE_TIMING) , m_resourceTimingBufferSize(defaultResourceTimingBufferSize) -#endif +#endif // ENABLE(RESOURCE_TIMING) +#if ENABLE(USER_TIMING) + , m_userTiming(0) +#endif // ENABLE(USER_TIMING) { } @@ -108,7 +111,14 @@ PassRefPtr<PerformanceEntryList> Performance::webkitGetEntries() const entries->appendAll(m_resourceTimingBuffer); #endif // ENABLE(RESOURCE_TIMING) - // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072 +#if ENABLE(USER_TIMING) + if (m_userTiming) { + entries->appendAll(m_userTiming->getMarks()); + entries->appendAll(m_userTiming->getMeasures()); + } +#endif // ENABLE(USER_TIMING) + + entries->sort(); return entries; } @@ -122,7 +132,16 @@ PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByType(const Strin entries->append(*resource); #endif // ENABLE(RESOURCE_TIMING) - // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072 +#if ENABLE(USER_TIMING) + if (m_userTiming) { + if (equalIgnoringCase(entryType, "mark")) + entries->appendAll(m_userTiming->getMarks()); + else if (equalIgnoringCase(entryType, "measure")) + entries->appendAll(m_userTiming->getMeasures()); + } +#endif // ENABLE(USER_TIMING) + + entries->sort(); return entries; } @@ -137,7 +156,16 @@ PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByName(const Strin entries->append(*resource); #endif // ENABLE(RESOURCE_TIMING) - // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072 +#if ENABLE(USER_TIMING) + if (m_userTiming) { + if (entryType.isNull() || equalIgnoringCase(entryType, "mark")) + entries->appendAll(m_userTiming->getMarks(name)); + if (entryType.isNull() || equalIgnoringCase(entryType, "measure")) + entries->appendAll(m_userTiming->getMeasures(name)); + } +#endif // ENABLE(USER_TIMING) + + entries->sort(); return entries; } diff --git a/Source/WebCore/page/PerformanceEntry.h b/Source/WebCore/page/PerformanceEntry.h index 6d9672197..5ade8453b 100644 --- a/Source/WebCore/page/PerformanceEntry.h +++ b/Source/WebCore/page/PerformanceEntry.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2012 Intel Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -51,6 +52,11 @@ public: virtual bool isResource() { return false; } + static bool startTimeCompareLessThan(PassRefPtr<PerformanceEntry> a, PassRefPtr<PerformanceEntry> b) + { + return a->startTime() < b->startTime(); + } + protected: PerformanceEntry(const String& name, const String& entryType, double startTime, double duration); diff --git a/Source/WebCore/page/PerformanceEntryList.cpp b/Source/WebCore/page/PerformanceEntryList.cpp index 9f273bc44..0a8cc6ab9 100644 --- a/Source/WebCore/page/PerformanceEntryList.cpp +++ b/Source/WebCore/page/PerformanceEntryList.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2012 Intel Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -67,6 +68,11 @@ void PerformanceEntryList::appendAll(const Vector<RefPtr<PerformanceEntry> >& en m_entries.append(entries); } +void PerformanceEntryList::sort() +{ + std::sort(m_entries.begin(), m_entries.end(), PerformanceEntry::startTimeCompareLessThan); +} + } // namespace WebCore #endif // ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE) diff --git a/Source/WebCore/page/PerformanceEntryList.h b/Source/WebCore/page/PerformanceEntryList.h index 8f76267e1..4feb4e7f1 100644 --- a/Source/WebCore/page/PerformanceEntryList.h +++ b/Source/WebCore/page/PerformanceEntryList.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2012 Intel Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -53,6 +54,8 @@ public: void append(PassRefPtr<PerformanceEntry>); void appendAll(const Vector<RefPtr<PerformanceEntry> >&); + void sort(); + private: PerformanceEntryList(); diff --git a/Source/WebCore/page/PerformanceUserTiming.cpp b/Source/WebCore/page/PerformanceUserTiming.cpp index b5f729294..8ac04d4f4 100644 --- a/Source/WebCore/page/PerformanceUserTiming.cpp +++ b/Source/WebCore/page/PerformanceUserTiming.cpp @@ -83,7 +83,7 @@ static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, Pas RefPtr<PerformanceEntry> entry = performanceEntry; PerformanceEntryMap::iterator it = performanceEntryMap.find(entry->name()); if (it != performanceEntryMap.end()) - it->second.append(entry); + it->value.append(entry); else { Vector<RefPtr<PerformanceEntry> > v(1); v[0] = entry; @@ -110,7 +110,7 @@ void UserTiming::mark(const String& markName, ExceptionCode& ec) return; } - double startTime = m_performance->webkitNow(); + double startTime = m_performance->now(); insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTime)); } @@ -139,9 +139,9 @@ void UserTiming::measure(const String& measureName, const String& startMark, con double endTime = 0.0; if (startMark.isNull()) - endTime = m_performance->webkitNow(); + endTime = m_performance->now(); else if (endMark.isNull()) { - endTime = m_performance->webkitNow(); + endTime = m_performance->now(); startTime = findExistingMarkStartTime(startMark, ec); if (ec) return; @@ -162,6 +162,47 @@ void UserTiming::clearMeasures(const String& measureName) clearPeformanceEntries(m_measuresMap, measureName); } +static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const PerformanceEntryMap& performanceEntryMap) +{ + Vector<RefPtr<PerformanceEntry> > entries; + + for (PerformanceEntryMap::const_iterator it = performanceEntryMap.begin(); it != performanceEntryMap.end(); ++it) + entries.append(it->value); + + return entries; +} + +static Vector<RefPtr<PerformanceEntry> > getEntrySequenceByName(const PerformanceEntryMap& performanceEntryMap, const String& name) +{ + Vector<RefPtr<PerformanceEntry> > entries; + + PerformanceEntryMap::const_iterator it = performanceEntryMap.find(name); + if (it != performanceEntryMap.end()) + entries.append(it->value); + + return entries; +} + +Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks() const +{ + return convertToEntrySequence(m_marksMap); +} + +Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks(const String& name) const +{ + return getEntrySequenceByName(m_marksMap, name); +} + +Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures() const +{ + return convertToEntrySequence(m_measuresMap); +} + +Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) const +{ + return getEntrySequenceByName(m_measuresMap, name); +} + } // namespace WebCore #endif // ENABLE(USER_TIMING) diff --git a/Source/WebCore/page/PerformanceUserTiming.h b/Source/WebCore/page/PerformanceUserTiming.h index 08441eee0..c6e69d4e9 100644 --- a/Source/WebCore/page/PerformanceUserTiming.h +++ b/Source/WebCore/page/PerformanceUserTiming.h @@ -32,7 +32,6 @@ #include "ExceptionCode.h" #include "Performance.h" #include "PerformanceTiming.h" -#include "PlatformString.h" #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -56,6 +55,12 @@ public: void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode&); void clearMeasures(const String& measureName); + Vector<RefPtr<PerformanceEntry> > getMarks() const; + Vector<RefPtr<PerformanceEntry> > getMeasures() const; + + Vector<RefPtr<PerformanceEntry> > getMarks(const String& name) const; + Vector<RefPtr<PerformanceEntry> > getMeasures(const String& name) const; + private: explicit UserTiming(Performance*); static HashMap<String, NavigationTimingFunction> m_restrictedKeyMap; diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp index 69bd4f1ea..e99b7a3b7 100644 --- a/Source/WebCore/platform/ScrollableArea.cpp +++ b/Source/WebCore/platform/ScrollableArea.cpp @@ -40,6 +40,10 @@ #include "ScrollbarTheme.h" #include <wtf/PassOwnPtr.h> +#if PLATFORM(CHROMIUM) +#include "TraceEvent.h" +#endif + namespace WebCore { struct SameSizeAsScrollableArea { @@ -142,6 +146,10 @@ void ScrollableArea::notifyScrollPositionChanged(const IntPoint& position) void ScrollableArea::scrollPositionChanged(const IntPoint& position) { +#if PLATFORM(CHROMIUM) + TRACE_EVENT0("webkit", "ScrollableArea::scrollPositionChanged"); +#endif + IntPoint oldPosition = scrollPosition(); // Tell the derived class to scroll its contents. setScrollOffset(position); diff --git a/Source/WebCore/platform/chromium/LinkHashChromium.cpp b/Source/WebCore/platform/chromium/LinkHashChromium.cpp index 3dc07abf2..f8aa83150 100644 --- a/Source/WebCore/platform/chromium/LinkHashChromium.cpp +++ b/Source/WebCore/platform/chromium/LinkHashChromium.cpp @@ -53,7 +53,7 @@ LinkHash visitedLinkHash(const UChar* url, unsigned length) LinkHash visitedLinkHash(const String& url) { - return (url.characters(), url.length()); + return visitedLinkHash(url.characters(), url.length()); } LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL) diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.cpp b/Source/WebCore/platform/efl/RenderThemeEfl.cpp index 7272b00b9..b1ca21c4c 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/Source/WebCore/platform/efl/RenderThemeEfl.cpp @@ -643,7 +643,7 @@ bool RenderThemeEfl::controlSupportsTints(const RenderObject* object) const return isEnabled(object); } -LayoutUnit RenderThemeEfl::baselinePosition(const RenderObject* object) const +int RenderThemeEfl::baselinePosition(const RenderObject* object) const { if (!object->isBox()) return 0; diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.h b/Source/WebCore/platform/efl/RenderThemeEfl.h index 63b0f49a3..483c0be2d 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.h +++ b/Source/WebCore/platform/efl/RenderThemeEfl.h @@ -98,7 +98,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual LayoutUnit baselinePosition(const RenderObject*) const; + virtual int baselinePosition(const RenderObject*) const; virtual Color platformActiveSelectionBackgroundColor() const; virtual Color platformInactiveSelectionBackgroundColor() const; diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp index 1b2e9b8d9..38ce35425 100644 --- a/Source/WebCore/platform/graphics/Font.cpp +++ b/Source/WebCore/platform/graphics/Font.cpp @@ -159,6 +159,9 @@ void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoi to = (to == -1 ? run.length() : to); CodePath codePathToUse = codePath(run); + // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 + if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.length())) + codePathToUse = Complex; if (codePathToUse != Complex) return drawSimpleText(context, run, point, from, to); @@ -174,7 +177,12 @@ void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const if (to < 0) to = run.length(); - if (codePath(run) != Complex) + CodePath codePathToUse = codePath(run); + // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 + if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.length())) + codePathToUse = Complex; + + if (codePathToUse != Complex) drawEmphasisMarksForSimpleText(context, run, mark, point, from, to); else drawEmphasisMarksForComplexText(context, run, mark, point, from, to); @@ -232,7 +240,12 @@ FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point { to = (to == -1 ? run.length() : to); - if (codePath(run) != Complex) + CodePath codePathToUse = codePath(run); + // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 + if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.length())) + codePathToUse = Complex; + + if (codePathToUse != Complex) return selectionRectForSimpleText(run, point, h, from, to); return selectionRectForComplexText(run, point, h, from, to); @@ -240,7 +253,8 @@ FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const { - if (codePath(run) != Complex) + // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 + if (codePath(run) != Complex && !typesettingFeatures()) return offsetForPositionForSimpleText(run, x, includePartialGlyphs); return offsetForPositionForComplexText(run, x, includePartialGlyphs); diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h index d4a8c1f69..fe65f8860 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -137,7 +137,11 @@ namespace WebCore { NoStroke, SolidStroke, DottedStroke, - DashedStroke + DashedStroke, +#if ENABLE(CSS3_TEXT) + DoubleStroke, + WavyStroke, +#endif // CSS3_TEXT }; enum InterpolationQuality { diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 89093d58c..e5adf4110 100644 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -802,6 +802,10 @@ void GraphicsContext::setPlatformStrokeStyle(StrokeStyle strokeStyle) cairo_set_line_width(platformContext()->cr(), 0); break; case SolidStroke: +#if ENABLE(CSS3_TEXT) + case DoubleStroke: + case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94110 - Needs platform support. +#endif // CSS3_TEXT cairo_set_dash(platformContext()->cr(), 0, 0, 0); break; case DottedStroke: diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 14142f6cd..6ceace35d 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -425,6 +425,10 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) switch (strokeStyle()) { case NoStroke: case SolidStroke: +#if ENABLE(CSS3_TEXT) + case DoubleStroke: + case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94112 - Needs platform support. +#endif // CSS3_TEXT break; case DottedStroke: patWidth = (int)width; diff --git a/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp b/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp index 1c1dc568a..0ab98929f 100644 --- a/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp +++ b/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp @@ -122,7 +122,8 @@ bool GraphicsContext3DPrivate::createSurface(PageClientEfl* pageClient, bool ren EVAS_GL_RGBA_8888, EVAS_GL_DEPTH_BIT_8, EVAS_GL_STENCIL_NONE, // FIXME: set EVAS_GL_STENCIL_BIT_8 after fixing Evas_GL bug. - EVAS_GL_OPTIONS_NONE + EVAS_GL_OPTIONS_NONE, + EVAS_GL_MULTISAMPLE_NONE }; // Create a new Evas_GL_Surface object diff --git a/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp index deeb339d2..ffb0e1673 100644 --- a/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp @@ -88,7 +88,6 @@ template <> void derefGPtr<GstPadTemplate>(GstPadTemplate* ptr) template <> GRefPtr<GstCaps> adoptGRef(GstCaps* ptr) { - ASSERT(!ptr || !gstObjectIsFloating(GST_OBJECT(ptr))); return GRefPtr<GstCaps>(ptr, GRefPtrAdopt); } diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp index 638f480ff..7158caf62 100644 --- a/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp @@ -40,10 +40,7 @@ GRefPtr<GstCaps> webkitGstGetPadCaps(GstPad* pad) return 0; #ifdef GST_API_VERSION_1 - GstCaps* caps = gst_pad_get_current_caps(pad); - if (!caps) - caps = gst_pad_query_caps(pad, 0); - return adoptGRef(caps); // gst_pad_query_caps and gst_pad_get_current_caps return a new reference. + return adoptGRef(gst_pad_get_current_caps(pad)); // gst_pad_get_current_caps return a new reference. #else return GST_PAD_CAPS(pad); #endif diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index a4d47451d..f2bd29259 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -857,7 +857,11 @@ gboolean MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message) case GST_MESSAGE_BUFFERING: processBufferingStats(message); break; +#ifdef GST_API_VERSION_1 + case GST_MESSAGE_DURATION_CHANGED: +#else case GST_MESSAGE_DURATION: +#endif LOG_MEDIA_MESSAGE("Duration changed"); durationChanged(); break; diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index c41983bfd..6f9bf26bb 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -156,6 +156,10 @@ static Qt::PenStyle toQPenStyle(StrokeStyle style) return Qt::NoPen; break; case SolidStroke: +#if ENABLE(CSS3_TEXT) + case DoubleStroke: + case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support. +#endif return Qt::SolidLine; break; case DottedStroke: @@ -402,6 +406,10 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) switch (style) { case NoStroke: case SolidStroke: +#if ENABLE(CSS3_TEXT) + case DoubleStroke: + case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support. +#endif break; case DottedStroke: { capStyle = Qt::RoundCap; diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index 5d6bf936c..344bc17d3 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -412,6 +412,10 @@ float PlatformContextSkia::setupPaintForStroking(SkPaint* paint, SkRect* rect, i switch (m_state->m_strokeStyle) { case NoStroke: case SolidStroke: +#if ENABLE(CSS3_TEXT) + case DoubleStroke: + case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93509 - Needs platform support. +#endif // CSS3_TEXT break; case DashedStroke: width = m_state->m_dashRatio * width; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp index 112fb42de..ff96f168c 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp @@ -44,7 +44,7 @@ void TextureMapperSurfaceBackingStore::setGraphicsSurface(const GraphicsSurfaceT } RefPtr<WebCore::GraphicsSurface> surface = graphicsSurface(); - if (surface->frontBuffer() != frontBuffer) + if (surface && surface->frontBuffer() != frontBuffer) surface->swapBuffers(); } @@ -58,7 +58,8 @@ PassRefPtr<BitmapTexture> TextureMapperSurfaceBackingStore::texture() const void TextureMapperSurfaceBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask) { - m_graphicsSurface->paintToTextureMapper(textureMapper, targetRect, transform, opacity, mask); + if (m_graphicsSurface) + m_graphicsSurface->paintToTextureMapper(textureMapper, targetRect, transform, opacity, mask); } void TextureMapperSurfaceBackingStore::setSurface(PassRefPtr<GraphicsSurface> surface) diff --git a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp index 1c93496f0..c89e84c15 100644 --- a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp @@ -354,6 +354,10 @@ static PassOwnPtr<HPEN> createPen(const Color& col, double fWidth, StrokeStyle s int penStyle = PS_NULL; switch (style) { case SolidStroke: +#if ENABLE(CSS3_TEXT) + case DoubleStroke: + case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94114 - Needs platform support. +#endif // CSS3_TEXT penStyle = PS_SOLID; break; case DottedStroke: // not supported on Windows CE diff --git a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 6d59eae7d..29c9ad2f8 100644 --- a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -99,6 +99,12 @@ static int strokeStyleToWxPenStyle(int p) return wxDOT; if (p == DashedStroke) return wxLONG_DASH; +#if ENABLE(CSS3_TEXT) + if (p == DoubleStroke) + return wxSOLID; + if (p == WavyStroke) // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94111 - Needs platform support. + return wxSOLID; +#endif // CSS3_TEXT if (p == NoStroke) return wxTRANSPARENT; diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp index 8c4eab13b..00aea2564 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -165,7 +165,7 @@ bool RenderThemeGtk::controlSupportsTints(const RenderObject* o) const return isEnabled(o); } -LayoutUnit RenderThemeGtk::baselinePosition(const RenderObject* o) const +int RenderThemeGtk::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.h b/Source/WebCore/platform/gtk/RenderThemeGtk.h index 5b4fbe1aa..f54588c1e 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.h +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.h @@ -60,7 +60,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual LayoutUnit baselinePosition(const RenderObject*) const; + virtual int baselinePosition(const RenderObject*) const; // The platform selection color. virtual Color platformActiveSelectionBackgroundColor() const; diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index 720ba1339..079fe51ae 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -333,12 +333,13 @@ void NetworkJob::handleNotifyHeaderReceived(const String& key, const String& val // For now we check for this explicitly by checking m_frame->page(). But we should find out why the network job hasn't been cancelled when the frame was detached. // See RIM PR 134207 if (m_frame && m_frame->page() && m_frame->loader() && m_frame->loader()->client() - && static_cast<FrameLoaderClientBlackBerry*>(m_frame->loader()->client())->cookiesEnabled()) + && static_cast<FrameLoaderClientBlackBerry*>(m_frame->loader()->client())->cookiesEnabled()) { handleSetCookieHeader(value); - - if (m_response.httpHeaderFields().contains("Set-Cookie")) { - m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); - return; + // If there are several "Set-Cookie" headers, we should combine the following ones with the first. + if (m_response.httpHeaderFields().contains("Set-Cookie")) { + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + ", " + value); + return; + } } } else if (equalIgnoringCase(key, BlackBerry::Platform::NetworkRequest::HEADER_BLACKBERRY_FTP)) handleFTPHeader(value); diff --git a/Source/WebCore/platform/network/qt/DNSQt.cpp b/Source/WebCore/platform/network/qt/DNSQt.cpp new file mode 100644 index 000000000..8ebb14b9c --- /dev/null +++ b/Source/WebCore/platform/network/qt/DNSQt.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + (C) 2012 Digia Plc. and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#include "DNSResolveQueue.h" + +#include <QHostInfo> +#include <QObject> +#include <QString> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class DnsPrefetchHelper : public QObject { + Q_OBJECT +public: + DnsPrefetchHelper() : QObject() { } + +public Q_SLOTS: + void lookup(QString hostname) + { + if (hostname.isEmpty()) { + DNSResolveQueue::shared().decrementRequestCount(); + return; // this actually happens + } + + QHostInfo::lookupHost(hostname, this, SLOT(lookedUp(QHostInfo))); + } + + void lookedUp(const QHostInfo&) + { + // we do not cache the result, we throw it away. + // we currently rely on the OS to cache the results. If it does not do that + // then at least the ISP nameserver did it. + // Since Qt 4.6.3, Qt also has a small DNS cache. + DNSResolveQueue::shared().decrementRequestCount(); + } +}; + +// This is called on mouse over a href and on page loading. +void prefetchDNS(const String& hostname) +{ + if (hostname.isEmpty()) + return; + DNSResolveQueue::shared().add(hostname); +} + +bool DNSResolveQueue::platformProxyIsEnabledInSystemPreferences() +{ + // Qt expects the system or a proxy to cache the result, but other platforms disable WebCore DNS prefetching when proxies are enabled. + return false; +} + +// This is called by the platform-independent DNSResolveQueue. +void DNSResolveQueue::platformResolve(const String& hostname) +{ + static DnsPrefetchHelper dnsPrefetchHelper; + dnsPrefetchHelper.lookup(QString(hostname)); +} + +} // namespace + +#include "DNSQt.moc" diff --git a/Source/WebCore/platform/network/qt/DnsPrefetchHelper.cpp b/Source/WebCore/platform/network/qt/DnsPrefetchHelper.cpp deleted file mode 100644 index 5f9ec5676..000000000 --- a/Source/WebCore/platform/network/qt/DnsPrefetchHelper.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" -#include "DnsPrefetchHelper.h" - -#include <wtf/text/WTFString.h> - -namespace WebCore { -// this is called on mouse over a href and on page loading -void prefetchDNS(const String& hostname) -{ - static DnsPrefetchHelper dnsPrefetchHelper; - dnsPrefetchHelper.lookup(QString(hostname)); -} - -} diff --git a/Source/WebCore/platform/network/qt/DnsPrefetchHelper.h b/Source/WebCore/platform/network/qt/DnsPrefetchHelper.h deleted file mode 100644 index d2ab1cf82..000000000 --- a/Source/WebCore/platform/network/qt/DnsPrefetchHelper.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef DnsPrefetchHelper_h -#define DnsPrefetchHelper_h - -#include <QCache> -#include <QHostInfo> -#include <QObject> -#include <QSet> -#include <QString> -#include <QTime> - -namespace WebCore { - - class DnsPrefetchHelper : public QObject { - Q_OBJECT - public: - DnsPrefetchHelper() : QObject(), currentLookups(0) { } - - public Q_SLOTS: - void lookup(QString hostname) - { - if (hostname.isEmpty()) - return; // this actually happens - if (currentLookups >= 10) - return; // do not launch more than 10 lookups at the same time - - currentLookups++; - QHostInfo::lookupHost(hostname, this, SLOT(lookedUp(QHostInfo))); - } - - void lookedUp(const QHostInfo&) - { - // we do not cache the result, we throw it away. - // we currently rely on the OS to cache the results. If it does not do that - // then at least the ISP nameserver did it. - // Since Qt 4.6.3, Qt also has a small DNS cache. - currentLookups--; - } - - protected: - int currentLookups; - }; - - -} - -#endif // DnsPrefetchHelper_h diff --git a/Source/WebCore/platform/qt/RenderThemeQt.cpp b/Source/WebCore/platform/qt/RenderThemeQt.cpp index af36a4f7a..e09b50dbe 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQt.cpp @@ -177,7 +177,7 @@ bool RenderThemeQt::supportsFocusRing(const RenderStyle* style) const } } -LayoutUnit RenderThemeQt::baselinePosition(const RenderObject* o) const +int RenderThemeQt::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; diff --git a/Source/WebCore/platform/qt/RenderThemeQt.h b/Source/WebCore/platform/qt/RenderThemeQt.h index 29ac33b59..f16b50f33 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.h +++ b/Source/WebCore/platform/qt/RenderThemeQt.h @@ -58,7 +58,7 @@ public: virtual bool supportsHover(const RenderStyle*) const; virtual bool supportsFocusRing(const RenderStyle*) const; - virtual LayoutUnit baselinePosition(const RenderObject*) const; + virtual int baselinePosition(const RenderObject*) const; // A method asking if the control changes its tint when the window has focus or not. virtual bool controlSupportsTints(const RenderObject*) const; diff --git a/Source/WebCore/platform/text/LocaleICU.cpp b/Source/WebCore/platform/text/LocaleICU.cpp index e1a1eb17b..5bcf4dd72 100644 --- a/Source/WebCore/platform/text/LocaleICU.cpp +++ b/Source/WebCore/platform/text/LocaleICU.cpp @@ -287,15 +287,6 @@ PassOwnPtr<Vector<String> > LocaleICU::createLabelVector(const UDateFormat* date return labels.release(); } -static PassOwnPtr<Vector<String> > createFallbackMonthLabels() -{ - OwnPtr<Vector<String> > labels = adoptPtr(new Vector<String>()); - labels->reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName)); - for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i) - labels->append(WTF::monthFullName[i]); - return labels.release(); -} - static PassOwnPtr<Vector<String> > createFallbackWeekDayShortLabels() { OwnPtr<Vector<String> > labels = adoptPtr(new Vector<String>()); @@ -312,32 +303,47 @@ static PassOwnPtr<Vector<String> > createFallbackWeekDayShortLabels() void LocaleICU::initializeCalendar() { - if (m_monthLabels && m_weekDayShortLabels) + if (m_weekDayShortLabels) return; if (!initializeShortDateFormat()) { m_firstDayOfWeek = 0; - m_monthLabels = createFallbackMonthLabels(); m_weekDayShortLabels = createFallbackWeekDayShortLabels(); return; } m_firstDayOfWeek = ucal_getAttribute(udat_getCalendar(m_shortDateFormat), UCAL_FIRST_DAY_OF_WEEK) - UCAL_SUNDAY; - m_monthLabels = createLabelVector(m_shortDateFormat, UDAT_MONTHS, UCAL_JANUARY, 12); - if (!m_monthLabels) - m_monthLabels = createFallbackMonthLabels(); - m_weekDayShortLabels = createLabelVector(m_shortDateFormat, UDAT_SHORT_WEEKDAYS, UCAL_SUNDAY, 7); if (!m_weekDayShortLabels) m_weekDayShortLabels = createFallbackWeekDayShortLabels(); } +#endif + +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) +static PassOwnPtr<Vector<String> > createFallbackMonthLabels() +{ + OwnPtr<Vector<String> > labels = adoptPtr(new Vector<String>()); + labels->reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName)); + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i) + labels->append(WTF::monthFullName[i]); + return labels.release(); +} const Vector<String>& LocaleICU::monthLabels() { - initializeCalendar(); + if (m_monthLabels) + return *m_monthLabels; + if (initializeShortDateFormat()) { + m_monthLabels = createLabelVector(m_shortDateFormat, UDAT_MONTHS, UCAL_JANUARY, 12); + if (m_monthLabels) + return *m_monthLabels; + } + m_monthLabels = createFallbackMonthLabels(); return *m_monthLabels; } +#endif +#if ENABLE(CALENDAR_PICKER) const Vector<String>& LocaleICU::weekDayShortLabels() { initializeCalendar(); @@ -423,9 +429,9 @@ String LocaleICU::monthFormat() { if (!m_monthFormat.isNull()) return m_monthFormat; - // Gets a format for "MMM", not "MM" because Windows API always provides - // formats for "MMM". - m_monthFormat = getFormatForSkeleton(m_locale.data(), ASCIILiteral("yyyyMMM")); + // Gets a format for "MMMM" because Windows API always provides formats for + // "MMMM" in some locales. + m_monthFormat = getFormatForSkeleton(m_locale.data(), ASCIILiteral("yyyyMMMM")); return m_monthFormat; } @@ -457,6 +463,20 @@ const Vector<String>& LocaleICU::shortMonthLabels() return m_shortMonthLabels; } +const Vector<String>& LocaleICU::standAloneMonthLabels() +{ + if (!m_standAloneMonthLabels.isEmpty()) + return m_standAloneMonthLabels; + if (initializeShortDateFormat()) { + if (OwnPtr<Vector<String> > labels = createLabelVector(m_shortDateFormat, UDAT_STANDALONE_MONTHS, UCAL_JANUARY, 12)) { + m_standAloneMonthLabels = *labels; + return m_standAloneMonthLabels; + } + } + m_standAloneMonthLabels = monthLabels(); + return m_standAloneMonthLabels; +} + const Vector<String>& LocaleICU::shortStandAloneMonthLabels() { if (!m_shortStandAloneMonthLabels.isEmpty()) diff --git a/Source/WebCore/platform/text/LocaleICU.h b/Source/WebCore/platform/text/LocaleICU.h index 6c62f92fc..ee80cbfdc 100644 --- a/Source/WebCore/platform/text/LocaleICU.h +++ b/Source/WebCore/platform/text/LocaleICU.h @@ -54,18 +54,20 @@ public: #if ENABLE(CALENDAR_PICKER) virtual String dateFormatText() OVERRIDE; - virtual const Vector<String>& monthLabels() OVERRIDE; virtual const Vector<String>& weekDayShortLabels() OVERRIDE; virtual unsigned firstDayOfWeek() OVERRIDE; virtual bool isRTL() OVERRIDE; #endif - +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) + virtual const Vector<String>& monthLabels() OVERRIDE; +#endif #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) virtual String dateFormat() OVERRIDE; virtual String monthFormat() OVERRIDE; virtual String timeFormat() OVERRIDE; virtual String shortTimeFormat() OVERRIDE; virtual const Vector<String>& shortMonthLabels() OVERRIDE; + virtual const Vector<String>& standAloneMonthLabels() OVERRIDE; virtual const Vector<String>& shortStandAloneMonthLabels() OVERRIDE; virtual const Vector<String>& timeAMPMLabels() OVERRIDE; #endif @@ -103,17 +105,19 @@ private: #if ENABLE(CALENDAR_PICKER) String m_localizedDateFormatText; - OwnPtr<Vector<String> > m_monthLabels; OwnPtr<Vector<String> > m_weekDayShortLabels; unsigned m_firstDayOfWeek; #endif - +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) + OwnPtr<Vector<String> > m_monthLabels; +#endif #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) String m_dateFormat; String m_monthFormat; UDateFormat* m_mediumTimeFormat; UDateFormat* m_shortTimeFormat; Vector<String> m_shortMonthLabels; + Vector<String> m_standAloneMonthLabels; Vector<String> m_shortStandAloneMonthLabels; Vector<String> m_timeAMPMLabels; bool m_didCreateTimeFormat; diff --git a/Source/WebCore/platform/text/LocaleNone.cpp b/Source/WebCore/platform/text/LocaleNone.cpp index 2535d896a..61173806e 100644 --- a/Source/WebCore/platform/text/LocaleNone.cpp +++ b/Source/WebCore/platform/text/LocaleNone.cpp @@ -41,14 +41,21 @@ private: virtual String dateFormatText() OVERRIDE; virtual bool isRTL() OVERRIDE; #endif +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) + virtual const Vector<String>& monthLabels() OVERRIDE; +#endif #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) virtual String dateFormat() OVERRIDE; virtual String monthFormat() OVERRIDE; virtual const Vector<String>& shortMonthLabels() OVERRIDE; + virtual const Vector<String>& standAloneMonthLabels() OVERRIDE; virtual const Vector<String>& shortStandAloneMonthLabels() OVERRIDE; -#endif Vector<String> m_shortMonthLabels; +#endif +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) + Vector<String> m_monthLabels; +#endif }; PassOwnPtr<Localizer> Localizer::create(const AtomicString&) @@ -81,6 +88,18 @@ bool LocaleNone::isRTL() } #endif +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) +const Vector<String>& LocaleNone::monthLabels() +{ + if (!m_monthLabels.isEmpty()) + return m_monthLabels; + m_monthLabels.reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName)); + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i) + m_monthLabels.append(WTF::monthFullName[i]); + return m_monthLabels; +} +#endif + #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) String LocaleNone::dateFormat() { @@ -106,6 +125,11 @@ const Vector<String>& LocaleNone::shortStandAloneMonthLabels() { return shortMonthLabels(); } + +const Vector<String>& LocaleNone::standAloneMonthLabels() +{ + return monthLabels(); +} #endif } // namespace WebCore diff --git a/Source/WebCore/platform/text/LocaleWin.cpp b/Source/WebCore/platform/text/LocaleWin.cpp index 584a6a06f..edefda299 100644 --- a/Source/WebCore/platform/text/LocaleWin.cpp +++ b/Source/WebCore/platform/text/LocaleWin.cpp @@ -551,13 +551,15 @@ void LocaleWin::ensureWeekDayShortLabels() } } -#if ENABLE(CALENDAR_PICKER) +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) const Vector<String>& LocaleWin::monthLabels() { ensureMonthLabels(); return m_monthLabels; } +#endif +#if ENABLE(CALENDAR_PICKER) const Vector<String>& LocaleWin::weekDayShortLabels() { ensureWeekDayShortLabels(); @@ -741,6 +743,12 @@ const Vector<String>& LocaleWin::shortMonthLabels() return m_shortMonthLabels; } +const Vector<String>& LocaleWin::standAloneMonthLabels() +{ + // Windows doesn't provide a way to get stand-alone month labels. + return monthLabels(); +} + const Vector<String>& LocaleWin::shortStandAloneMonthLabels() { // Windows doesn't provide a way to get stand-alone month labels. diff --git a/Source/WebCore/platform/text/LocaleWin.h b/Source/WebCore/platform/text/LocaleWin.h index a2b15d3f0..0c300abde 100644 --- a/Source/WebCore/platform/text/LocaleWin.h +++ b/Source/WebCore/platform/text/LocaleWin.h @@ -49,18 +49,20 @@ public: virtual double parseDateTime(const String&, DateComponents::Type) OVERRIDE; #if ENABLE(CALENDAR_PICKER) virtual String dateFormatText() OVERRIDE; - virtual const Vector<String>& monthLabels() OVERRIDE; virtual const Vector<String>& weekDayShortLabels() OVERRIDE; virtual unsigned firstDayOfWeek() OVERRIDE; virtual bool isRTL() OVERRIDE; #endif - +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) + virtual const Vector<String>& monthLabels() OVERRIDE; +#endif #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) virtual String dateFormat() OVERRIDE; virtual String monthFormat() OVERRIDE; virtual String timeFormat() OVERRIDE; virtual String shortTimeFormat() OVERRIDE; virtual const Vector<String>& shortMonthLabels() OVERRIDE; + virtual const Vector<String>& standAloneMonthLabels() OVERRIDE; virtual const Vector<String>& shortStandAloneMonthLabels() OVERRIDE; virtual const Vector<String>& timeAMPMLabels() OVERRIDE; #endif diff --git a/Source/WebCore/platform/text/Localizer.h b/Source/WebCore/platform/text/Localizer.h index 6f527195e..b422faab7 100644 --- a/Source/WebCore/platform/text/Localizer.h +++ b/Source/WebCore/platform/text/Localizer.h @@ -88,6 +88,12 @@ public: // Dec. These strings should be short. virtual const Vector<String>& shortMonthLabels() = 0; + // Returns a vector of string of which size is 12. The first item is a + // stand-alone localized string of January and the last item is a + // stand-alone localized string of December. These strings should not be + // abbreviations. + virtual const Vector<String>& standAloneMonthLabels() = 0; + // Stand-alone month version of shortMonthLabels. virtual const Vector<String>& shortStandAloneMonthLabels() = 0; @@ -95,12 +101,14 @@ public: virtual const Vector<String>& timeAMPMLabels(); #endif -#if ENABLE(CALENDAR_PICKER) +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) // Returns a vector of string of which size is 12. The first item is a // localized string of January, and the last item is a localized string of // December. These strings should not be abbreviations. virtual const Vector<String>& monthLabels() = 0; +#endif +#if ENABLE(CALENDAR_PICKER) // Returns a vector of string of which size is 7. The first item is a // localized short string of Monday, and the last item is a localized // short string of Saturday. These strings should be short. diff --git a/Source/WebCore/platform/text/mac/LocaleMac.h b/Source/WebCore/platform/text/mac/LocaleMac.h index a3f22beb1..a7a72da2e 100644 --- a/Source/WebCore/platform/text/mac/LocaleMac.h +++ b/Source/WebCore/platform/text/mac/LocaleMac.h @@ -54,11 +54,13 @@ public: #if ENABLE(CALENDAR_PICKER) virtual String dateFormatText() OVERRIDE; - virtual const Vector<String>& monthLabels() OVERRIDE; virtual const Vector<String>& weekDayShortLabels() OVERRIDE; virtual unsigned firstDayOfWeek() OVERRIDE; virtual bool isRTL() OVERRIDE; #endif +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) + virtual const Vector<String>& monthLabels() OVERRIDE; +#endif #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) virtual String dateFormat() OVERRIDE; @@ -66,6 +68,7 @@ public: virtual String timeFormat() OVERRIDE; virtual String shortTimeFormat() OVERRIDE; virtual const Vector<String>& shortMonthLabels() OVERRIDE; + virtual const Vector<String>& standAloneMonthLabels() OVERRIDE; virtual const Vector<String>& shortStandAloneMonthLabels() OVERRIDE; virtual const Vector<String>& timeAMPMLabels() OVERRIDE; #endif @@ -79,9 +82,11 @@ private: RetainPtr<NSCalendar> m_gregorianCalendar; #if ENABLE(CALENDAR_PICKER) String m_localizedDateFormatText; - Vector<String> m_monthLabels; Vector<String> m_weekDayShortLabels; #endif +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) + Vector<String> m_monthLabels; +#endif #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) RetainPtr<NSDateFormatter> timeFormatter(); RetainPtr<NSDateFormatter> shortTimeFormatter(); @@ -91,6 +96,7 @@ private: String m_localizedTimeFormatText; String m_localizedShortTimeFormatText; Vector<String> m_shortMonthLabels; + Vector<String> m_standAloneMonthLabels; Vector<String> m_shortStandAloneMonthLabels; Vector<String> m_timeAMPMLabels; #endif diff --git a/Source/WebCore/platform/text/mac/LocaleMac.mm b/Source/WebCore/platform/text/mac/LocaleMac.mm index 6c365df26..bbc86507a 100644 --- a/Source/WebCore/platform/text/mac/LocaleMac.mm +++ b/Source/WebCore/platform/text/mac/LocaleMac.mm @@ -178,7 +178,9 @@ String LocaleMac::dateFormatText() m_localizedDateFormatText = localizeDateFormat([shortDateFormatter().get() dateFormat]); return m_localizedDateFormatText; } +#endif +#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI) const Vector<String>& LocaleMac::monthLabels() { if (!m_monthLabels.isEmpty()) @@ -194,7 +196,9 @@ const Vector<String>& LocaleMac::monthLabels() m_monthLabels.append(WTF::monthFullName[i]); return m_monthLabels; } +#endif +#if ENABLE(CALENDAR_PICKER) const Vector<String>& LocaleMac::weekDayShortLabels() { if (!m_weekDayShortLabels.isEmpty()) @@ -250,9 +254,9 @@ String LocaleMac::monthFormat() { if (!m_monthFormat.isNull()) return m_monthFormat; - // Gets a format for "MMM", not "MM" because Windows API always provides - // formats for "MMM". - m_monthFormat = [NSDateFormatter dateFormatFromTemplate:@"yyyyMMM" options:0 locale:m_locale.get()]; + // Gets a format for "MMMM" because Windows API always provides formats for + // "MMMM" in some locales. + m_monthFormat = [NSDateFormatter dateFormatFromTemplate:@"yyyyMMMM" options:0 locale:m_locale.get()]; return m_monthFormat; } @@ -288,6 +292,21 @@ const Vector<String>& LocaleMac::shortMonthLabels() return m_shortMonthLabels; } +const Vector<String>& LocaleMac::standAloneMonthLabels() +{ + if (!m_standAloneMonthLabels.isEmpty()) + return m_standAloneMonthLabels; + NSArray *array = [shortDateFormatter().get() standaloneMonthSymbols]; + if ([array count] == 12) { + m_standAloneMonthLabels.reserveCapacity(12); + for (unsigned i = 0; i < 12; ++i) + m_standAloneMonthLabels.append([array objectAtIndex:i]); + return m_standAloneMonthLabels; + } + m_standAloneMonthLabels = shortMonthLabels(); + return m_standAloneMonthLabels; +} + const Vector<String>& LocaleMac::shortStandAloneMonthLabels() { if (!m_shortStandAloneMonthLabels.isEmpty()) diff --git a/Source/WebCore/rendering/AutoTableLayout.cpp b/Source/WebCore/rendering/AutoTableLayout.cpp index 08ecff90e..fb436ca55 100644 --- a/Source/WebCore/rendering/AutoTableLayout.cpp +++ b/Source/WebCore/rendering/AutoTableLayout.cpp @@ -49,81 +49,77 @@ void AutoTableLayout::recalcColumn(unsigned effCol) RenderTableCell* fixedContributor = 0; RenderTableCell* maxContributor = 0; - for (RenderObject* child = m_table->children()->firstChild(); child; child = child->nextSibling()) { - if (child->isRenderTableCol()) - toRenderTableCol(child)->computePreferredLogicalWidths(); - else if (child->isTableSection()) { - RenderTableSection* section = toRenderTableSection(child); - unsigned numRows = section->numRows(); - for (unsigned i = 0; i < numRows; i++) { - RenderTableSection::CellStruct current = section->cellAt(i, effCol); - RenderTableCell* cell = current.primaryCell(); - - if (current.inColSpan || !cell) - continue; - - bool cellHasContent = cell->children()->firstChild() || cell->style()->hasBorder() || cell->style()->hasPadding(); - if (cellHasContent) - columnLayout.emptyCellsOnly = false; - - // A cell originates in this column. Ensure we have - // a min/max width of at least 1px for this column now. - columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0); - columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1); - - if (cell->colSpan() == 1) { - if (cell->preferredLogicalWidthsDirty()) - cell->computePreferredLogicalWidths(); - columnLayout.minLogicalWidth = max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth); - if (cell->maxPreferredLogicalWidth() > columnLayout.maxLogicalWidth) { - columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth(); - maxContributor = cell; - } + for (RenderTableSection* section = m_table->topNonEmptySection(); section; section = m_table->sectionBelow(section, SkipEmptySections)) { + unsigned numRows = section->numRows(); + ASSERT(numRows); + for (unsigned i = 0; i < numRows; i++) { + RenderTableSection::CellStruct current = section->cellAt(i, effCol); + RenderTableCell* cell = current.primaryCell(); + + if (current.inColSpan || !cell) + continue; - // All browsers implement a size limit on the cell's max width. - // Our limit is based on KHTML's representation that used 16 bits widths. - // FIXME: Other browsers have a lower limit for the cell's max width. - const int cCellMaxWidth = 32760; - Length cellLogicalWidth = cell->styleOrColLogicalWidth(); - if (cellLogicalWidth.value() > cCellMaxWidth) - cellLogicalWidth.setValue(cCellMaxWidth); - if (cellLogicalWidth.isNegative()) - cellLogicalWidth.setValue(0); - switch (cellLogicalWidth.type()) { - case Fixed: - // ignore width=0 - if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercent()) { - LayoutUnit logicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(cellLogicalWidth.value()); - if (columnLayout.logicalWidth.isFixed()) { - // Nav/IE weirdness - if ((logicalWidth > columnLayout.logicalWidth.value()) - || ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) { - columnLayout.logicalWidth.setValue(Fixed, logicalWidth); - fixedContributor = cell; - } - } else { + bool cellHasContent = cell->children()->firstChild() || cell->style()->hasBorder() || cell->style()->hasPadding(); + if (cellHasContent) + columnLayout.emptyCellsOnly = false; + + // A cell originates in this column. Ensure we have + // a min/max width of at least 1px for this column now. + columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0); + columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1); + + if (cell->colSpan() == 1) { + if (cell->preferredLogicalWidthsDirty()) + cell->computePreferredLogicalWidths(); + columnLayout.minLogicalWidth = max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth); + if (cell->maxPreferredLogicalWidth() > columnLayout.maxLogicalWidth) { + columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth(); + maxContributor = cell; + } + + // All browsers implement a size limit on the cell's max width. + // Our limit is based on KHTML's representation that used 16 bits widths. + // FIXME: Other browsers have a lower limit for the cell's max width. + const int cCellMaxWidth = 32760; + Length cellLogicalWidth = cell->styleOrColLogicalWidth(); + if (cellLogicalWidth.value() > cCellMaxWidth) + cellLogicalWidth.setValue(cCellMaxWidth); + if (cellLogicalWidth.isNegative()) + cellLogicalWidth.setValue(0); + switch (cellLogicalWidth.type()) { + case Fixed: + // ignore width=0 + if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercent()) { + LayoutUnit logicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(cellLogicalWidth.value()); + if (columnLayout.logicalWidth.isFixed()) { + // Nav/IE weirdness + if ((logicalWidth > columnLayout.logicalWidth.value()) + || ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) { columnLayout.logicalWidth.setValue(Fixed, logicalWidth); fixedContributor = cell; } + } else { + columnLayout.logicalWidth.setValue(Fixed, logicalWidth); + fixedContributor = cell; } - break; - case Percent: - m_hasPercent = true; - if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value())) - columnLayout.logicalWidth = cellLogicalWidth; - break; - case Relative: - // FIXME: Need to understand this case and whether it makes sense to compare values - // which are not necessarily of the same type. - if (cellLogicalWidth.value() > columnLayout.logicalWidth.value()) - columnLayout.logicalWidth = cellLogicalWidth; - default: - break; } - } else if (!effCol || section->primaryCellAt(i, effCol - 1) != cell) { - // This spanning cell originates in this column. Insert the cell into spanning cells list. - insertSpanCell(cell); + break; + case Percent: + m_hasPercent = true; + if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value())) + columnLayout.logicalWidth = cellLogicalWidth; + break; + case Relative: + // FIXME: Need to understand this case and whether it makes sense to compare values + // which are not necessarily of the same type. + if (cellLogicalWidth.value() > columnLayout.logicalWidth.value()) + columnLayout.logicalWidth = cellLogicalWidth; + default: + break; } + } else if (!effCol || section->primaryCellAt(i, effCol - 1) != cell) { + // This spanning cell originates in this column. Insert the cell into spanning cells list. + insertSpanCell(cell); } } } diff --git a/Source/WebCore/rendering/ExclusionPolygon.cpp b/Source/WebCore/rendering/ExclusionPolygon.cpp index ba20dc2e6..eaeeba70d 100644 --- a/Source/WebCore/rendering/ExclusionPolygon.cpp +++ b/Source/WebCore/rendering/ExclusionPolygon.cpp @@ -241,13 +241,13 @@ void ExclusionPolygon::computeEdgeIntersections(float y1, float y2, Vector<Exclu sortExclusionIntervals(result); } -void ExclusionPolygon::getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const +void ExclusionPolygon::getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const { if (isEmpty()) return; - float y1 = minYForLogicalLine(logicalTop, logicalBottom); - float y2 = maxYForLogicalLine(logicalTop, logicalBottom); + float y1 = minYForLogicalLine(logicalTop, logicalHeight); + float y2 = maxYForLogicalLine(logicalTop, logicalHeight); Vector<ExclusionInterval> y1XIntervals, y2XIntervals; computeXIntersections(y1, y1XIntervals); @@ -268,13 +268,13 @@ void ExclusionPolygon::getExcludedIntervals(float logicalTop, float logicalBotto } } -void ExclusionPolygon::getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const +void ExclusionPolygon::getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const { if (isEmpty()) return; - float y1 = minYForLogicalLine(logicalTop, logicalBottom); - float y2 = maxYForLogicalLine(logicalTop, logicalBottom); + float y1 = minYForLogicalLine(logicalTop, logicalHeight); + float y2 = maxYForLogicalLine(logicalTop, logicalHeight); Vector<ExclusionInterval> y1XIntervals, y2XIntervals; computeXIntersections(y1, y1XIntervals); diff --git a/Source/WebCore/rendering/ExclusionPolygon.h b/Source/WebCore/rendering/ExclusionPolygon.h index 57e35520d..be28a7f45 100644 --- a/Source/WebCore/rendering/ExclusionPolygon.h +++ b/Source/WebCore/rendering/ExclusionPolygon.h @@ -60,9 +60,9 @@ public: WindRule fillRule() const { return m_fillRule; } virtual FloatRect shapeLogicalBoundingBox() const OVERRIDE { return internalToLogicalBoundingBox(m_boundingBox); } - virtual void getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const OVERRIDE; - virtual void getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const OVERRIDE; virtual bool isEmpty() const OVERRIDE { return m_empty; } + virtual void getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const OVERRIDE; + virtual void getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const OVERRIDE; private: float rightVertexY(unsigned) const; diff --git a/Source/WebCore/rendering/ExclusionRectangle.cpp b/Source/WebCore/rendering/ExclusionRectangle.cpp index 0ccf6224a..328cba2f3 100644 --- a/Source/WebCore/rendering/ExclusionRectangle.cpp +++ b/Source/WebCore/rendering/ExclusionRectangle.cpp @@ -40,13 +40,13 @@ static inline float ellipseXIntercept(float y, float rx, float ry) return rx * sqrt(1 - (y*y) / (ry*ry)); } -void ExclusionRectangle::getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const +void ExclusionRectangle::getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const { if (isEmpty()) return; - float y1 = minYForLogicalLine(logicalTop, logicalBottom); - float y2 = maxYForLogicalLine(logicalTop, logicalBottom); + float y1 = minYForLogicalLine(logicalTop, logicalHeight); + float y2 = maxYForLogicalLine(logicalTop, logicalHeight); if (y2 < m_y || y1 >= m_y + m_height) return; @@ -71,13 +71,13 @@ void ExclusionRectangle::getExcludedIntervals(float logicalTop, float logicalBot result.append(LineSegment(x1, x2)); } -void ExclusionRectangle::getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const +void ExclusionRectangle::getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const { if (isEmpty()) return; - float y1 = minYForLogicalLine(logicalTop, logicalBottom); - float y2 = maxYForLogicalLine(logicalTop, logicalBottom); + float y1 = minYForLogicalLine(logicalTop, logicalHeight); + float y2 = maxYForLogicalLine(logicalTop, logicalHeight); if (y1 < m_y || y2 > m_y + m_height) return; diff --git a/Source/WebCore/rendering/ExclusionRectangle.h b/Source/WebCore/rendering/ExclusionRectangle.h index 0078264dd..5839eec47 100644 --- a/Source/WebCore/rendering/ExclusionRectangle.h +++ b/Source/WebCore/rendering/ExclusionRectangle.h @@ -51,9 +51,9 @@ public: } virtual FloatRect shapeLogicalBoundingBox() const OVERRIDE { return internalToLogicalBoundingBox(FloatRect(m_x, m_y, m_width, m_height)); } - virtual void getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const OVERRIDE; - virtual void getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const OVERRIDE; virtual bool isEmpty() const OVERRIDE { return m_width <= 0 || m_height <= 0; } + virtual void getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const OVERRIDE; + virtual void getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const OVERRIDE; private: float m_x; diff --git a/Source/WebCore/rendering/ExclusionShape.h b/Source/WebCore/rendering/ExclusionShape.h index a75ab70e8..075c002c7 100644 --- a/Source/WebCore/rendering/ExclusionShape.h +++ b/Source/WebCore/rendering/ExclusionShape.h @@ -39,14 +39,14 @@ namespace WebCore { struct LineSegment { - float logicalLeft; - float logicalRight; - LineSegment(float logicalLeft, float logicalRight) : logicalLeft(logicalLeft) , logicalRight(logicalRight) { } + + float logicalLeft; + float logicalRight; }; typedef Vector<LineSegment> SegmentList; @@ -64,14 +64,13 @@ public: virtual ~ExclusionShape() { } virtual FloatRect shapeLogicalBoundingBox() const = 0; - virtual FloatRect shapeBoundingBox() const { return m_boundingBox; } - virtual void getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const = 0; - virtual void getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const = 0; virtual bool isEmpty() const = 0; + virtual void getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const = 0; + virtual void getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const = 0; protected: - float minYForLogicalLine(float logicalTop, float logicalBottom) const { return (m_writingMode == RightToLeftWritingMode) ? m_logicalBoxHeight - logicalBottom : logicalTop; } - float maxYForLogicalLine(float logicalTop, float logicalBottom) const { return (m_writingMode == RightToLeftWritingMode) ? m_logicalBoxHeight - logicalTop : logicalBottom; } + float minYForLogicalLine(float logicalTop, float logicalHeight) const { return (m_writingMode == RightToLeftWritingMode) ? m_logicalBoxHeight - logicalTop - logicalHeight : logicalTop; } + float maxYForLogicalLine(float logicalTop, float logicalHeight) const { return (m_writingMode == RightToLeftWritingMode) ? m_logicalBoxHeight - logicalTop : logicalTop + logicalHeight; } FloatRect internalToLogicalBoundingBox(FloatRect r) const { return (m_writingMode == RightToLeftWritingMode) ? FloatRect(r.x(), m_logicalBoxHeight - r.maxY(), r.width(), r.height()) : r; } private: diff --git a/Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp b/Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp index bf7f30dfd..b7830f10e 100644 --- a/Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp +++ b/Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp @@ -100,16 +100,16 @@ void ExclusionShapeInsideInfo::computeShapeSize(LayoutUnit logicalWidth, LayoutU ASSERT(m_shape); } -bool ExclusionShapeInsideInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineBottom) +bool ExclusionShapeInsideInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) { - ASSERT(lineTop <= lineBottom); + ASSERT(lineHeight >= 0); m_lineTop = lineTop; - m_lineBottom = lineBottom; + m_lineHeight = lineHeight; m_segments.clear(); if (lineOverlapsShapeBounds()) { ASSERT(m_shape); - m_shape->getIncludedIntervals(lineTop, std::min(lineBottom, shapeLogicalBottom()), m_segments); + m_shape->getIncludedIntervals(lineTop, std::min(lineHeight, shapeLogicalBottom() - lineTop), m_segments); } return m_segments.size(); } diff --git a/Source/WebCore/rendering/ExclusionShapeInsideInfo.h b/Source/WebCore/rendering/ExclusionShapeInsideInfo.h index 9db1b101e..bea2b45a0 100644 --- a/Source/WebCore/rendering/ExclusionShapeInsideInfo.h +++ b/Source/WebCore/rendering/ExclusionShapeInsideInfo.h @@ -73,7 +73,7 @@ public: ASSERT(hasSegments()); return m_segments; } - bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineBottom); + bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight); bool lineOverlapsShapeBounds() const; void computeShapeSize(LayoutUnit logicalWidth, LayoutUnit logicalHeight); void dirtyShapeSize() { m_shapeSizeDirty = true; } @@ -85,7 +85,7 @@ private: OwnPtr<ExclusionShape> m_shape; LayoutUnit m_lineTop; - LayoutUnit m_lineBottom; + LayoutUnit m_lineHeight; LayoutUnit m_logicalWidth; LayoutUnit m_logicalHeight; @@ -97,7 +97,7 @@ inline bool ExclusionShapeInsideInfo::lineOverlapsShapeBounds() const { ASSERT(m_shape); FloatRect shapeBounds = m_shape->shapeLogicalBoundingBox(); - return m_lineTop <= shapeBounds.maxY() && m_lineBottom >= shapeBounds.y(); + return m_lineTop < shapeBounds.maxY() && m_lineTop + m_lineHeight >= shapeBounds.y(); } } diff --git a/Source/WebCore/rendering/FixedTableLayout.cpp b/Source/WebCore/rendering/FixedTableLayout.cpp index 2a08ad6b5..eed6e0b54 100644 --- a/Source/WebCore/rendering/FixedTableLayout.cpp +++ b/Source/WebCore/rendering/FixedTableLayout.cpp @@ -88,8 +88,6 @@ int FixedTableLayout::calcWidthArray(int) unsigned currentEffectiveColumn = 0; for (RenderTableCol* col = m_table->firstColumn(); col; col = col->nextColumn()) { - col->computePreferredLogicalWidths(); - // Width specified by column-groups that have column child does not affect column width in fixed layout tables if (col->isTableColumnGroupWithColumnChildren()) continue; diff --git a/Source/WebCore/rendering/InlineBox.cpp b/Source/WebCore/rendering/InlineBox.cpp index 01742e5bf..18079ff0b 100644 --- a/Source/WebCore/rendering/InlineBox.cpp +++ b/Source/WebCore/rendering/InlineBox.cpp @@ -159,7 +159,7 @@ float InlineBox::logicalHeight() const return result; } -LayoutUnit InlineBox::baselinePosition(FontBaseline baselineType) const +int InlineBox::baselinePosition(FontBaseline baselineType) const { return boxModelObject()->baselinePosition(baselineType, m_bitfields.firstLine(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); } diff --git a/Source/WebCore/rendering/InlineBox.h b/Source/WebCore/rendering/InlineBox.h index a6b94debb..e2cf85fdc 100644 --- a/Source/WebCore/rendering/InlineBox.h +++ b/Source/WebCore/rendering/InlineBox.h @@ -246,7 +246,7 @@ public: FloatRect logicalFrameRect() const { return isHorizontal() ? FloatRect(m_topLeft.x(), m_topLeft.y(), m_logicalWidth, logicalHeight()) : FloatRect(m_topLeft.y(), m_topLeft.x(), m_logicalWidth, logicalHeight()); } - virtual LayoutUnit baselinePosition(FontBaseline baselineType) const; + virtual int baselinePosition(FontBaseline baselineType) const; virtual LayoutUnit lineHeight() const; virtual int caretMinOffset() const; diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp index 8e6714068..66bc11e09 100644 --- a/Source/WebCore/rendering/InlineFlowBox.cpp +++ b/Source/WebCore/rendering/InlineFlowBox.cpp @@ -475,7 +475,7 @@ bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo return false; } -void InlineFlowBox::adjustMaxAscentAndDescent(LayoutUnit& maxAscent, LayoutUnit& maxDescent, LayoutUnit maxPositionTop, LayoutUnit maxPositionBottom) +void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, int maxPositionTop, int maxPositionBottom) { for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { // The computed lineheight needs to be extended for the @@ -483,7 +483,7 @@ void InlineFlowBox::adjustMaxAscentAndDescent(LayoutUnit& maxAscent, LayoutUnit& if (curr->renderer()->isOutOfFlowPositioned()) continue; // Positioned placeholders don't affect calculations. if (curr->verticalAlign() == TOP || curr->verticalAlign() == BOTTOM) { - LayoutUnit lineHeight = curr->lineHeight(); + int lineHeight = curr->lineHeight(); if (curr->verticalAlign() == TOP) { if (maxAscent + maxDescent < lineHeight) maxDescent = lineHeight - maxAscent; @@ -503,7 +503,7 @@ void InlineFlowBox::adjustMaxAscentAndDescent(LayoutUnit& maxAscent, LayoutUnit& } void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit& maxPositionTop, LayoutUnit& maxPositionBottom, - LayoutUnit& maxAscent, LayoutUnit& maxDescent, bool& setMaxAscent, bool& setMaxDescent, + int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, FontBaseline baselineType, VerticalPositionCache& verticalPositionCache) { @@ -599,7 +599,7 @@ void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit& } } -void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHeight, LayoutUnit maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop, +void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop, LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType) { bool isRootBox = isRootInlineBox(); diff --git a/Source/WebCore/rendering/InlineFlowBox.h b/Source/WebCore/rendering/InlineFlowBox.h index 5a34f6c65..48b720c75 100644 --- a/Source/WebCore/rendering/InlineFlowBox.h +++ b/Source/WebCore/rendering/InlineFlowBox.h @@ -175,11 +175,11 @@ public: LayoutUnit getFlowSpacingLogicalWidth(); float placeBoxesInInlineDirection(float logicalLeft, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); void computeLogicalBoxHeights(RootInlineBox*, LayoutUnit& maxPositionTop, LayoutUnit& maxPositionBottom, - LayoutUnit& maxAscent, LayoutUnit& maxDescent, bool& setMaxAscent, bool& setMaxDescent, + int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&, FontBaseline, VerticalPositionCache&); - void adjustMaxAscentAndDescent(LayoutUnit& maxAscent, LayoutUnit& maxDescent, - LayoutUnit maxPositionTop, LayoutUnit maxPositionBottom); - void placeBoxesInBlockDirection(LayoutUnit logicalTop, LayoutUnit maxHeight, LayoutUnit maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop, + void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, + int maxPositionTop, int maxPositionBottom); + void placeBoxesInBlockDirection(LayoutUnit logicalTop, LayoutUnit maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop, LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline); void flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lineBottom); bool requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap&) const; diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp index ae316d498..ca1fef31b 100644 --- a/Source/WebCore/rendering/InlineTextBox.cpp +++ b/Source/WebCore/rendering/InlineTextBox.cpp @@ -88,7 +88,7 @@ void InlineTextBox::setLogicalOverflowRect(const LayoutRect& rect) gTextBoxesWithOverflow->add(this, rect); } -LayoutUnit InlineTextBox::baselinePosition(FontBaseline baselineType) const +int InlineTextBox::baselinePosition(FontBaseline baselineType) const { if (!isText() || !parent()) return 0; @@ -766,10 +766,10 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, } // Paint decorations - int textDecorations = styleToUse->textDecorationsInEffect(); + ETextDecoration textDecorations = styleToUse->textDecorationsInEffect(); if (textDecorations != TDNONE && paintInfo.phase != PaintPhaseSelection) { updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace()); - paintDecoration(context, boxOrigin, textDecorations, textShadow); + paintDecoration(context, boxOrigin, textDecorations, styleToUse->textDecorationStyle(), textShadow); } if (paintInfo.phase == PaintPhaseForeground) { @@ -925,8 +925,38 @@ void InlineTextBox::paintCustomHighlight(const LayoutPoint& paintOffset, const A #endif -void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& boxOrigin, int deco, const ShadowData* shadow) +static StrokeStyle textDecorationStyleToStrokeStyle(TextDecorationStyle decorationStyle) { + StrokeStyle strokeStyle = SolidStroke; + switch (decorationStyle) { + case TextDecorationStyleSolid: + strokeStyle = SolidStroke; + break; +#if ENABLE(CSS3_TEXT) + case TextDecorationStyleDouble: + strokeStyle = DoubleStroke; + break; + case TextDecorationStyleDotted: + strokeStyle = DottedStroke; + break; + case TextDecorationStyleDashed: + strokeStyle = DashedStroke; + break; + case TextDecorationStyleWavy: + // FIXME: https://bugs.webkit.org/show_bug.cgi?id=92868 - Needs platform support. + strokeStyle = WavyStroke; + break; +#endif // CSS3_TEXT + } + + return strokeStyle; +} + +void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& boxOrigin, ETextDecoration deco, TextDecorationStyle decorationStyle, const ShadowData* shadow) +{ + // FIXME: We should improve this rule and not always just assume 1. + const float textDecorationThickness = 1.f; + if (m_truncation == cFullTruncation) return; @@ -947,7 +977,7 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& // Use a special function for underlines to get the positioning exactly right. bool isPrinting = textRenderer()->document()->printing(); - context->setStrokeThickness(1.0f); // FIXME: We should improve this rule and not always just assume 1. + context->setStrokeThickness(textDecorationThickness); bool linesAreOpaque = !isPrinting && (!(deco & UNDERLINE) || underline.alpha() == 255) && (!(deco & OVERLINE) || overline.alpha() == 255) && (!(deco & LINE_THROUGH) || linethrough.alpha() == 255); @@ -976,7 +1006,7 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& ColorSpace colorSpace = renderer()->style()->colorSpace(); bool setShadow = false; - + do { if (shadow) { if (!shadow->next()) { @@ -991,21 +1021,35 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& shadow = shadow->next(); } +#if ENABLE(CSS3_TEXT) + // Offset between lines - always non-zero, so lines never cross each other. + float doubleOffset = textDecorationThickness + 1.f; +#endif // CSS3_TEXT + context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle)); if (deco & UNDERLINE) { context->setStrokeColor(underline, colorSpace); - context->setStrokeStyle(SolidStroke); // Leave one pixel of white between the baseline and the underline. context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1), width, isPrinting); +#if ENABLE(CSS3_TEXT) + if (decorationStyle == TextDecorationStyleDouble) + context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1 + doubleOffset), width, isPrinting); +#endif // CSS3_TEXT } if (deco & OVERLINE) { context->setStrokeColor(overline, colorSpace); - context->setStrokeStyle(SolidStroke); context->drawLineForText(localOrigin, width, isPrinting); +#if ENABLE(CSS3_TEXT) + if (decorationStyle == TextDecorationStyleDouble) + context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() - doubleOffset), width, isPrinting); +#endif // CSS3_TEXT } if (deco & LINE_THROUGH) { context->setStrokeColor(linethrough, colorSpace); - context->setStrokeStyle(SolidStroke); context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting); +#if ENABLE(CSS3_TEXT) + if (decorationStyle == TextDecorationStyleDouble) + context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + doubleOffset + 2 * baseline / 3), width, isPrinting); +#endif // CSS3_TEXT } } while (shadow); diff --git a/Source/WebCore/rendering/InlineTextBox.h b/Source/WebCore/rendering/InlineTextBox.h index f0b081d73..1f2a63acf 100644 --- a/Source/WebCore/rendering/InlineTextBox.h +++ b/Source/WebCore/rendering/InlineTextBox.h @@ -85,7 +85,7 @@ public: static inline bool compareByStart(const InlineTextBox* first, const InlineTextBox* second) { return first->start() < second->start(); } - virtual LayoutUnit baselinePosition(FontBaseline) const; + virtual int baselinePosition(FontBaseline) const; virtual LayoutUnit lineHeight() const; bool getEmphasisMarkPosition(RenderStyle*, TextEmphasisPosition&) const; @@ -183,7 +183,7 @@ protected: #endif private: - void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, int decoration, const ShadowData*); + void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, ETextDecoration, TextDecorationStyle, const ShadowData*); void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color textColor); void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar); void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&); diff --git a/Source/WebCore/rendering/LayoutState.cpp b/Source/WebCore/rendering/LayoutState.cpp index fac96e648..d389b93b3 100644 --- a/Source/WebCore/rendering/LayoutState.cpp +++ b/Source/WebCore/rendering/LayoutState.cpp @@ -36,7 +36,12 @@ namespace WebCore { LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo) - : m_columnInfo(columnInfo) + : m_clipped(false) +#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + , m_layoutDeltaXSaturated(false) + , m_layoutDeltaYSaturated(false) +#endif + , m_columnInfo(columnInfo) , m_lineGrid(0) , m_next(prev) #ifndef NDEBUG @@ -119,6 +124,10 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz #endif m_layoutDelta = m_next->m_layoutDelta; +#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + m_layoutDeltaXSaturated = m_next->m_layoutDeltaXSaturated; + m_layoutDeltaYSaturated = m_next->m_layoutDeltaYSaturated; +#endif m_isPaginated = m_pageLogicalHeight || m_columnInfo || renderer->isRenderFlowThread(); @@ -135,6 +144,10 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz LayoutState::LayoutState(RenderObject* root) : m_clipped(false) , m_isPaginated(false) +#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + , m_layoutDeltaXSaturated(false) + , m_layoutDeltaYSaturated(false) +#endif , m_pageLogicalHeight(0) , m_pageLogicalHeightChanged(false) , m_columnInfo(0) diff --git a/Source/WebCore/rendering/LayoutState.h b/Source/WebCore/rendering/LayoutState.h index 5450df9cb..b0ac4943e 100644 --- a/Source/WebCore/rendering/LayoutState.h +++ b/Source/WebCore/rendering/LayoutState.h @@ -48,6 +48,10 @@ public: LayoutState() : m_clipped(false) , m_isPaginated(false) +#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + , m_layoutDeltaXSaturated(false) + , m_layoutDeltaYSaturated(false) +#endif , m_pageLogicalHeight(0) , m_pageLogicalHeightChanged(false) , m_columnInfo(0) @@ -109,6 +113,10 @@ private: public: bool m_clipped; bool m_isPaginated; +#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + bool m_layoutDeltaXSaturated; + bool m_layoutDeltaYSaturated; +#endif LayoutRect m_clipRect; // x/y offset from container. Includes relative positioning and scroll offsets. diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 6e1087d35..f20b0b22f 100644 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -161,13 +161,11 @@ RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, LayoutUnit beforeBorderP , m_marginAfterQuirk(false) , m_determinedMarginBeforeQuirk(false) { - // Whether or not we can collapse our own margins with our children. We don't do this - // if we had any border/padding (obviously), if we're the root or HTML elements, or if - // we're positioned, floating, a table cell. RenderStyle* blockStyle = block->style(); + ASSERT(block->isRenderView() || block->parent()); m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isOutOfFlowPositioned() && !block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable() - && !block->isWritingModeRoot() && blockStyle->hasAutoColumnCount() && blockStyle->hasAutoColumnWidth() + && !block->isWritingModeRoot() && !block->parent()->isFlexibleBox() && blockStyle->hasAutoColumnCount() && blockStyle->hasAutoColumnWidth() && !blockStyle->columnSpan(); m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && !beforeBorderPadding && blockStyle->marginBeforeCollapse() != MSEPARATE; @@ -2567,7 +2565,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay setLogicalHeight(newHeight); } - ASSERT(oldLayoutDelta == view()->layoutDelta()); + ASSERT(view()->layoutDeltaMatches(oldLayoutDelta)); } void RenderBlock::simplifiedNormalFlowLayout() @@ -6182,7 +6180,7 @@ LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction, return m_lineHeight; } -LayoutUnit RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { // Inline blocks are replaced elements. Otherwise, just pass off to // the base class. If we're being queried as though we're the root line @@ -6205,7 +6203,7 @@ LayoutUnit RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLi bool ignoreBaseline = (layer() && (layer()->marquee() || (direction == HorizontalLine ? (layer()->verticalScrollbar() || layer()->scrollYOffset() != 0) : (layer()->horizontalScrollbar() || layer()->scrollXOffset() != 0)))) || (isWritingModeRoot() && !isRubyRun()); - LayoutUnit baselinePos = ignoreBaseline ? static_cast<LayoutUnit>(-1) : lastLineBoxBaseline(); + int baselinePos = ignoreBaseline ? -1 : inlineBlockBaseline(direction); LayoutUnit bottomOfContent = direction == HorizontalLine ? borderTop() + paddingTop() + contentHeight() : borderRight() + paddingRight() + contentWidth(); if (baselinePos != -1 && baselinePos <= bottomOfContent) @@ -6218,7 +6216,7 @@ LayoutUnit RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLi return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; } -LayoutUnit RenderBlock::firstLineBoxBaseline() const +int RenderBlock::firstLineBoxBaseline() const { if (!isBlockFlow() || (isWritingModeRoot() && !isRubyRun())) return -1; @@ -6232,7 +6230,7 @@ LayoutUnit RenderBlock::firstLineBoxBaseline() const else { for (RenderBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBox()) { if (!curr->isFloatingOrOutOfFlowPositioned()) { - LayoutUnit result = curr->firstLineBoxBaseline(); + int result = curr->firstLineBoxBaseline(); if (result != -1) return curr->logicalTop() + result; // Translate to our coordinate space. } @@ -6242,13 +6240,16 @@ LayoutUnit RenderBlock::firstLineBoxBaseline() const return -1; } -LayoutUnit RenderBlock::lastLineBoxBaseline() const +int RenderBlock::inlineBlockBaseline(LineDirectionMode direction) const +{ + return lastLineBoxBaseline(direction); +} + +int RenderBlock::lastLineBoxBaseline(LineDirectionMode lineDirection) const { if (!isBlockFlow() || (isWritingModeRoot() && !isRubyRun())) return -1; - LineDirectionMode lineDirection = isHorizontalWritingMode() ? HorizontalLine : VerticalLine; - if (childrenInline()) { if (!firstLineBox() && hasLineIfEmpty()) { const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); @@ -6264,7 +6265,7 @@ LayoutUnit RenderBlock::lastLineBoxBaseline() const for (RenderBox* curr = lastChildBox(); curr; curr = curr->previousSiblingBox()) { if (!curr->isFloatingOrOutOfFlowPositioned()) { haveNormalFlowChild = true; - LayoutUnit result = curr->lastLineBoxBaseline(); + int result = curr->inlineBlockBaseline(lineDirection); if (result != -1) return curr->logicalTop() + result; // Translate to our coordinate space. } diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 24cce99b4..567d7dcb4 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -93,7 +93,7 @@ public: // These two functions are overridden for inline-block. virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; RenderLineBoxList* lineBoxes() { return &m_lineBoxes; } const RenderLineBoxList* lineBoxes() const { return &m_lineBoxes; } @@ -463,8 +463,9 @@ protected: virtual void computePreferredLogicalWidths(); - virtual LayoutUnit firstLineBoxBaseline() const; - virtual LayoutUnit lastLineBoxBaseline() const; + virtual int firstLineBoxBaseline() const; + virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE; + int lastLineBoxBaseline(LineDirectionMode) const; virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&); diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index 1cfd1e098..756a3c31e 100644 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -1436,8 +1436,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin // case these segments may be incorrect. if (exclusionShapeInsideInfo) { LayoutUnit lineTop = logicalHeight() + absoluteLogicalTop; - LayoutUnit lineBottom = lineTop + lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); - exclusionShapeInsideInfo->computeSegmentsForLine(lineTop, lineBottom); + exclusionShapeInsideInfo->computeSegmentsForLine(lineTop, lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)); } #endif WordMeasurements wordMeasurements; diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 779277d14..683c23839 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -1786,7 +1786,7 @@ static bool isStretchingColumnFlexItem(const RenderObject* flexitem) return true; // We don't stretch multiline flexboxes because they need to apply line spacing (align-content) first. - if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexWrapNone && parent->style()->isColumnFlexDirection() && flexItemHasStretchAlignment(flexitem)) + if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap && parent->style()->isColumnFlexDirection() && flexItemHasStretchAlignment(flexitem)) return true; return false; } @@ -1820,7 +1820,7 @@ bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const // stretched size to avoid an extra layout when applying alignment. if (parent()->isFlexibleBox()) { // For multiline columns, we need to apply align-content first, so we can't stretch now. - if (!parent()->style()->isColumnFlexDirection() || parent()->style()->flexWrap() != FlexWrapNone) + if (!parent()->style()->isColumnFlexDirection() || parent()->style()->flexWrap() != FlexNoWrap) return true; if (!flexItemHasStretchAlignment(this)) return true; @@ -3831,10 +3831,10 @@ LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction return 0; } -LayoutUnit RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const +int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const { if (isReplaced()) { - LayoutUnit result = direction == HorizontalLine ? m_marginBox.top() + height() + m_marginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left(); + int result = direction == HorizontalLine ? m_marginBox.top() + height() + m_marginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left(); if (baselineType == AlphabeticBaseline) return result; return result - result / 2; diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 50150bd66..4d1328cfa 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -472,8 +472,8 @@ public: RenderLayer* enclosingFloatPaintingLayer() const; - virtual LayoutUnit firstLineBoxBaseline() const { return -1; } - virtual LayoutUnit lastLineBoxBaseline() const { return -1; } + virtual int firstLineBoxBaseline() const { return -1; } + virtual int inlineBlockBaseline(LineDirectionMode) const { return -1; } // Returns -1 if we should skip this box when computing the baseline of an inline-block. bool shrinkToAvoidFloats() const; virtual bool avoidsFloats() const; @@ -485,7 +485,7 @@ public: bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); } virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; virtual LayoutUnit offsetLeft() const OVERRIDE; virtual LayoutUnit offsetTop() const OVERRIDE; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index b2fa38583..4e08d9993 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -156,7 +156,7 @@ public: // Overridden by subclasses to determine line height and baseline position. virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0; virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const OVERRIDE; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 86e655e89..ee425b3f4 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -235,18 +235,22 @@ void RenderFlexibleBox::computePreferredLogicalWidths() setPreferredLogicalWidthsDirty(false); } -LayoutUnit RenderFlexibleBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +static int synthesizedBaselineFromContentBox(const RenderBox* box, LineDirectionMode direction) { - LayoutUnit baseline = firstLineBoxBaseline(); - if (baseline != -1) { - LayoutUnit marginAscent = direction == HorizontalLine ? marginTop() : marginRight(); - return baseline + marginAscent; - } + return direction == HorizontalLine ? box->borderTop() + box->paddingTop() + box->contentHeight() : box->borderRight() + box->paddingRight() + box->contentWidth(); +} + +int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const +{ + int baseline = firstLineBoxBaseline(); + if (baseline == -1) + baseline = synthesizedBaselineFromContentBox(this, direction); - return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode); + int marginAscent = direction == HorizontalLine ? marginTop() : marginRight(); + return baseline + marginAscent; } -LayoutUnit RenderFlexibleBox::firstLineBoxBaseline() const +int RenderFlexibleBox::firstLineBoxBaseline() const { ASSERT(m_orderIterator); @@ -273,13 +277,27 @@ LayoutUnit RenderFlexibleBox::firstLineBoxBaseline() const if (isColumnFlow() && !hasOrthogonalFlow(baselineChild)) return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop(); - LayoutUnit baseline = baselineChild->firstLineBoxBaseline(); - if (baseline == -1) - return -1; + int baseline = baselineChild->firstLineBoxBaseline(); + if (baseline == -1) { + // FIXME: We should pass |direction| into firstLineBoxBaseline and stop bailing out if we're a writing mode root. + // This would also fix some cases where the flexbox is orthogonal to its container. + LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine; + return synthesizedBaselineFromContentBox(baselineChild, direction) + baselineChild->logicalTop(); + } return baseline + baselineChild->logicalTop(); } +int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const +{ + int baseline = firstLineBoxBaseline(); + if (baseline != -1) + return baseline; + + int marginAscent = direction == HorizontalLine ? marginTop() : marginRight(); + return synthesizedBaselineFromContentBox(this, direction) + marginAscent; +} + void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit) { ASSERT(needsLayout()); @@ -407,7 +425,7 @@ bool RenderFlexibleBox::isLeftToRightFlow() const bool RenderFlexibleBox::isMultiline() const { - return style()->flexWrap() != FlexWrapNone; + return style()->flexWrap() != FlexNoWrap; } Length RenderFlexibleBox::flexBasisForChild(RenderBox* child) const diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index 495179659..acbdba928 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -49,8 +49,9 @@ public: virtual void computePreferredLogicalWidths() OVERRIDE; virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; - virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; + virtual int firstLineBoxBaseline() const OVERRIDE; + virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE; virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) OVERRIDE; diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 9f71ff15f..51f54b452 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -1301,7 +1301,7 @@ LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio return style()->computedLineHeight(view()); } -LayoutUnit RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; diff --git a/Source/WebCore/rendering/RenderInline.h b/Source/WebCore/rendering/RenderInline.h index 59b8fcb80..562ff47b9 100644 --- a/Source/WebCore/rendering/RenderInline.h +++ b/Source/WebCore/rendering/RenderInline.h @@ -153,7 +153,7 @@ private: virtual void dirtyLinesFromChangedChild(RenderObject* child) { m_lineBoxes.dirtyLinesFromChangedChild(this, child); } virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual void childBecameNonInline(RenderObject* child); diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 32471d88b..69908af42 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -1719,6 +1719,9 @@ void RenderLayer::scrollTo(int x, int y) return; m_scrollOffset = newScrollOffset; + Frame* frame = renderer()->frame(); + InspectorInstrumentation::willScrollLayer(frame); + // Update the positions of our child layers (if needed as only fixed layers should be impacted by a scroll). // We don't update compositing layers, because we need to do a deep update from the compositing ancestor. updateLayerPositionsAfterScroll(); @@ -1745,7 +1748,6 @@ void RenderLayer::scrollTo(int x, int y) } RenderLayerModelObject* repaintContainer = renderer()->containerForRepaint(); - Frame* frame = renderer()->frame(); if (frame) { // The caret rect needs to be invalidated after scrolling frame->selection()->setCaretRectNeedsUpdate(); @@ -1763,6 +1765,8 @@ void RenderLayer::scrollTo(int x, int y) // Schedule the scroll DOM event. if (renderer()->node()) renderer()->node()->document()->eventQueue()->enqueueOrDispatchScrollEvent(renderer()->node(), DocumentEventQueue::ScrollEventElementTarget); + + InspectorInstrumentation::didScrollLayer(frame); } static inline bool frameElementAndViewPermitScroll(HTMLFrameElement* frameElement, FrameView* frameView) diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp index 2af9635d4..b92d9f08d 100644 --- a/Source/WebCore/rendering/RenderListBox.cpp +++ b/Source/WebCore/rendering/RenderListBox.cpp @@ -269,7 +269,7 @@ void RenderListBox::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, Logi RenderBox::computeLogicalHeight(height, logicalTop, computedValues); } -LayoutUnit RenderListBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const +int RenderListBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const { return RenderBox::baselinePosition(baselineType, firstLine, lineDirection, linePositionMode) - baselineAdjustment; } diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h index e936dc2ce..c662af27f 100644 --- a/Source/WebCore/rendering/RenderListBox.h +++ b/Source/WebCore/rendering/RenderListBox.h @@ -76,7 +76,7 @@ private: virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0); virtual void computePreferredLogicalWidths(); - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; virtual void layout(); diff --git a/Source/WebCore/rendering/RenderListMarker.cpp b/Source/WebCore/rendering/RenderListMarker.cpp index b7cbaa038..a7a3791fd 100644 --- a/Source/WebCore/rendering/RenderListMarker.cpp +++ b/Source/WebCore/rendering/RenderListMarker.cpp @@ -1542,7 +1542,7 @@ LayoutUnit RenderListMarker::lineHeight(bool firstLine, LineDirectionMode direct return RenderBox::lineHeight(firstLine, direction, linePositionMode); } -LayoutUnit RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { if (!isImage()) return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes); diff --git a/Source/WebCore/rendering/RenderListMarker.h b/Source/WebCore/rendering/RenderListMarker.h index c1f1d676e..e220ce798 100644 --- a/Source/WebCore/rendering/RenderListMarker.h +++ b/Source/WebCore/rendering/RenderListMarker.h @@ -59,7 +59,7 @@ private: virtual InlineBox* createInlineBox(); virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; bool isImage() const; bool isText() const { return !isImage(); } diff --git a/Source/WebCore/rendering/RenderSlider.cpp b/Source/WebCore/rendering/RenderSlider.cpp index 87c4b744c..07b1d7d14 100644 --- a/Source/WebCore/rendering/RenderSlider.cpp +++ b/Source/WebCore/rendering/RenderSlider.cpp @@ -64,7 +64,7 @@ bool RenderSlider::canBeReplacedWithInlineRunIn() const return false; } -LayoutUnit RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const +int RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const { // FIXME: Patch this function for writing-mode. return height() + marginTop(); diff --git a/Source/WebCore/rendering/RenderSlider.h b/Source/WebCore/rendering/RenderSlider.h index 181ed915f..252cd080c 100644 --- a/Source/WebCore/rendering/RenderSlider.h +++ b/Source/WebCore/rendering/RenderSlider.h @@ -43,7 +43,7 @@ private: virtual bool isSlider() const { return true; } virtual bool canBeReplacedWithInlineRunIn() const OVERRIDE; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual void computePreferredLogicalWidths(); virtual bool requiresForcedStyleRecalcPropagation() const { return true; } virtual void layout(); diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index f9bf44609..d5c58bc9c 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -378,20 +378,15 @@ void RenderTable::layout() bool collapsing = collapseBorders(); - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->isTableSection()) { - RenderTableSection* section = toRenderTableSection(child); - if (m_columnLogicalWidthChanged) - section->setChildNeedsLayout(true, MarkOnlyThis); - section->layoutIfNeeded(); - totalSectionLogicalHeight += section->calcRowLogicalHeight(); - if (collapsing) - section->recalcOuterBorder(); - ASSERT(!section->needsLayout()); - } else if (child->isRenderTableCol()) { - child->layoutIfNeeded(); - ASSERT(!child->needsLayout()); - } + // We ignore table col / colgroup in this iteration as they are only used to size the cell's widths during auto / fixed table layout. + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) { + if (m_columnLogicalWidthChanged) + section->setChildNeedsLayout(true, MarkOnlyThis); + section->layoutIfNeeded(); + totalSectionLogicalHeight += section->calcRowLogicalHeight(); + if (collapsing) + section->recalcOuterBorder(); + ASSERT(!section->needsLayout()); } // If any table section moved vertically, we will just repaint everything from that @@ -1220,7 +1215,7 @@ void RenderTable::updateFirstLetter() { } -LayoutUnit RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +int RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { LayoutUnit baseline = firstLineBoxBaseline(); if (baseline != -1) @@ -1229,13 +1224,13 @@ LayoutUnit RenderTable::baselinePosition(FontBaseline baselineType, bool firstLi return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode); } -LayoutUnit RenderTable::lastLineBoxBaseline() const +int RenderTable::inlineBlockBaseline(LineDirectionMode) const { - // Tables don't contribute their baseline towards the computation of an inline-block's baseline. + // Tables are skipped when computing an inline-block's baseline. return -1; } -LayoutUnit RenderTable::firstLineBoxBaseline() const +int RenderTable::firstLineBoxBaseline() const { // The baseline of a 'table' is the same as the 'inline-table' baseline per CSS 3 Flexbox (CSS 2.1 // doesn't define the baseline of a 'table' only an 'inline-table'). @@ -1250,7 +1245,7 @@ LayoutUnit RenderTable::firstLineBoxBaseline() const if (!topNonEmptySection) return -1; - LayoutUnit baseline = topNonEmptySection->firstLineBoxBaseline(); + int baseline = topNonEmptySection->firstLineBoxBaseline(); if (baseline > 0) return topNonEmptySection->logicalTop() + baseline; diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h index de4b5a6b0..390f2b367 100644 --- a/Source/WebCore/rendering/RenderTable.h +++ b/Source/WebCore/rendering/RenderTable.h @@ -277,9 +277,9 @@ private: virtual void computePreferredLogicalWidths(); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; - virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; - virtual LayoutUnit lastLineBoxBaseline() const OVERRIDE; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; + virtual int firstLineBoxBaseline() const OVERRIDE; + virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE; RenderTableCol* slowColElement(unsigned col, bool* startEdge, bool* endEdge) const; diff --git a/Source/WebCore/rendering/RenderTableCol.cpp b/Source/WebCore/rendering/RenderTableCol.cpp index 7aa8341a7..6db54cca1 100644 --- a/Source/WebCore/rendering/RenderTableCol.cpp +++ b/Source/WebCore/rendering/RenderTableCol.cpp @@ -49,6 +49,9 @@ void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old { RenderBox::styleDidChange(diff, oldStyle); + if (diff == StyleDifferenceLayout) + propagateLayoutCueToTable(); + // If border was changed, notify table. if (parent()) { RenderTable* table = this->table(); @@ -66,8 +69,9 @@ void RenderTableCol::updateFromElement() m_span = tc->span(); } else m_span = !(style() && style()->display() == TABLE_COLUMN_GROUP); - if (m_span != oldSpan && style() && parent()) - setNeedsLayoutAndPrefWidthsRecalc(); + + if (m_span != oldSpan && style()) + propagateLayoutCueToTable(); } void RenderTableCol::willBeRemovedFromTree() @@ -114,10 +118,25 @@ void RenderTableCol::imageChanged(WrappedImagePtr, const IntRect*) void RenderTableCol::computePreferredLogicalWidths() { - setPreferredLogicalWidthsDirty(false); + // <col> and <colgroup> don't have preferred logical widths as they have + // no content so computing our preferred logical widths is wasteful. + ASSERT_NOT_REACHED(); +} + +void RenderTableCol::layout() +{ + // There is no need to layout table <col> or <colgroup> as they have no content. + ASSERT_NOT_REACHED(); +} - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) - child->setPreferredLogicalWidthsDirty(false); +void RenderTableCol::propagateLayoutCueToTable() const +{ + // Forward any layout hint to the table: this is required as the table is + // the one to layout / compute preferred logical widths on all the cells. + if (RenderTable* table = this->table()) { + table->setChildNeedsLayout(true); + table->setPreferredLogicalWidthsDirty(true); + } } RenderTable* RenderTableCol::table() const diff --git a/Source/WebCore/rendering/RenderTableCol.h b/Source/WebCore/rendering/RenderTableCol.h index 1a9fac6ec..1e8e80257 100644 --- a/Source/WebCore/rendering/RenderTableCol.h +++ b/Source/WebCore/rendering/RenderTableCol.h @@ -40,8 +40,6 @@ public: const RenderObjectChildList* children() const { return &m_children; } RenderObjectChildList* children() { return &m_children; } - virtual void computePreferredLogicalWidths(); - unsigned span() const { return m_span; } void setSpan(unsigned span) { m_span = span; } @@ -77,6 +75,9 @@ private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } + virtual void computePreferredLogicalWidths() OVERRIDE; + virtual void layout() OVERRIDE; + virtual const char* renderName() const { return "RenderTableCol"; } virtual bool isRenderTableCol() const OVERRIDE { return true; } virtual void updateFromElement(); @@ -92,6 +93,8 @@ private: virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + void propagateLayoutCueToTable() const; + RenderTable* table() const; RenderObjectChildList m_children; diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 341c90512..1d628fe59 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -882,12 +882,12 @@ void RenderTableSection::recalcOuterBorder() m_outerBorderEnd = calcOuterBorderEnd(); } -LayoutUnit RenderTableSection::firstLineBoxBaseline() const +int RenderTableSection::firstLineBoxBaseline() const { if (!m_grid.size()) return -1; - LayoutUnit firstLineBaseline = m_grid[0].baseline; + int firstLineBaseline = m_grid[0].baseline; if (firstLineBaseline) return firstLineBaseline + m_rowPos[0]; @@ -898,7 +898,7 @@ LayoutUnit RenderTableSection::firstLineBoxBaseline() const const RenderTableCell* cell = cs.primaryCell(); // Only cells with content have a baseline if (cell && cell->contentLogicalHeight()) - firstLineBaseline = max(firstLineBaseline, cell->logicalTop() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight()); + firstLineBaseline = max<int>(firstLineBaseline, cell->logicalTop() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight()); } return firstLineBaseline; diff --git a/Source/WebCore/rendering/RenderTableSection.h b/Source/WebCore/rendering/RenderTableSection.h index 2bb9ce364..cd6eb9739 100644 --- a/Source/WebCore/rendering/RenderTableSection.h +++ b/Source/WebCore/rendering/RenderTableSection.h @@ -70,7 +70,7 @@ public: virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); - virtual LayoutUnit firstLineBoxBaseline() const; + virtual int firstLineBoxBaseline() const OVERRIDE; void addCell(RenderTableCell*, RenderTableRow* row); diff --git a/Source/WebCore/rendering/RenderTextControlMultiLine.cpp b/Source/WebCore/rendering/RenderTextControlMultiLine.cpp index be91de927..92d002829 100644 --- a/Source/WebCore/rendering/RenderTextControlMultiLine.cpp +++ b/Source/WebCore/rendering/RenderTextControlMultiLine.cpp @@ -76,7 +76,7 @@ LayoutUnit RenderTextControlMultiLine::computeControlHeight(LayoutUnit lineHeigh return lineHeight * static_cast<HTMLTextAreaElement*>(node())->rows() + nonContentHeight; } -LayoutUnit RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +int RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode); } diff --git a/Source/WebCore/rendering/RenderTextControlMultiLine.h b/Source/WebCore/rendering/RenderTextControlMultiLine.h index a4539959a..6dad346c5 100644 --- a/Source/WebCore/rendering/RenderTextControlMultiLine.h +++ b/Source/WebCore/rendering/RenderTextControlMultiLine.h @@ -39,7 +39,7 @@ private: virtual float getAvgCharWidth(AtomicString family); virtual LayoutUnit preferredContentWidth(float charWidth) const; virtual LayoutUnit computeControlHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const OVERRIDE; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual RenderStyle* textBaseStyle() const; virtual PassRefPtr<RenderStyle> createInnerTextStyle(const RenderStyle* startStyle) const; diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp index ed425758d..47acfc8ec 100644 --- a/Source/WebCore/rendering/RenderTheme.cpp +++ b/Source/WebCore/rendering/RenderTheme.cpp @@ -639,7 +639,7 @@ CString RenderTheme::extraCalendarPickerStyleSheet() } #endif -LayoutUnit RenderTheme::baselinePosition(const RenderObject* o) const +int RenderTheme::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; diff --git a/Source/WebCore/rendering/RenderTheme.h b/Source/WebCore/rendering/RenderTheme.h index 5db283605..b568953cb 100644 --- a/Source/WebCore/rendering/RenderTheme.h +++ b/Source/WebCore/rendering/RenderTheme.h @@ -102,7 +102,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual LayoutUnit baselinePosition(const RenderObject*) const; + virtual int baselinePosition(const RenderObject*) const; // A method for asking if a control is a container or not. Leaf controls have to have some special behavior (like // the baseline position API above). diff --git a/Source/WebCore/rendering/RenderThemeSafari.cpp b/Source/WebCore/rendering/RenderThemeSafari.cpp index 4ff0fd07c..21d978c8b 100644 --- a/Source/WebCore/rendering/RenderThemeSafari.cpp +++ b/Source/WebCore/rendering/RenderThemeSafari.cpp @@ -312,7 +312,7 @@ IntRect RenderThemeSafari::inflateRect(const IntRect& r, const IntSize& size, co return result; } -LayoutUnit RenderThemeSafari::baselinePosition(const RenderObject* o) const +int RenderThemeSafari::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; diff --git a/Source/WebCore/rendering/RenderThemeSafari.h b/Source/WebCore/rendering/RenderThemeSafari.h index cb861e668..fe26f326b 100644 --- a/Source/WebCore/rendering/RenderThemeSafari.h +++ b/Source/WebCore/rendering/RenderThemeSafari.h @@ -52,7 +52,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual LayoutUnit baselinePosition(const RenderObject*) const; + virtual int baselinePosition(const RenderObject*) const; // A method asking if the control changes its tint when the window has focus or not. virtual bool controlSupportsTints(const RenderObject*) const; diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index d40e53dcf..7e118c7d0 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -148,7 +148,7 @@ void RenderView::layoutContent(const LayoutState& state) #ifndef NDEBUG void RenderView::checkLayoutState(const LayoutState& state) { - ASSERT(layoutDelta() == LayoutSize()); + ASSERT(layoutDeltaMatches(LayoutSize())); ASSERT(!m_layoutStateDisableCount); ASSERT(m_layoutState == &state); } diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index 0f5c6e881..084d7d5a7 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -124,9 +124,27 @@ public: } void addLayoutDelta(const LayoutSize& delta) { - if (m_layoutState) + if (m_layoutState) { m_layoutState->m_layoutDelta += delta; +#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + m_layoutState->m_layoutDeltaXSaturated |= m_layoutState->m_layoutDelta.width() == FractionalLayoutUnit::max() || m_layoutState->m_layoutDelta.width() == FractionalLayoutUnit::min(); + m_layoutState->m_layoutDeltaYSaturated |= m_layoutState->m_layoutDelta.height() == FractionalLayoutUnit::max() || m_layoutState->m_layoutDelta.height() == FractionalLayoutUnit::min(); +#endif + } + } + +#if !ASSERT_DISABLED + bool layoutDeltaMatches(const LayoutSize& delta) + { + if (!m_layoutState) + return false; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + return (delta.width() == m_layoutState->m_layoutDelta.width() || m_layoutState->m_layoutDeltaXSaturated) && (delta.height() == m_layoutState->m_layoutDelta.height() || m_layoutState->m_layoutDeltaYSaturated); +#else + return delta == m_layoutState->m_layoutDelta; +#endif } +#endif bool doingFullRepaint() const { return m_frameView->needsFullRepaint(); } diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp index f932e6f21..a26025981 100644 --- a/Source/WebCore/rendering/RootInlineBox.cpp +++ b/Source/WebCore/rendering/RootInlineBox.cpp @@ -100,7 +100,7 @@ bool RootInlineBox::isHyphenated() const return false; } -LayoutUnit RootInlineBox::baselinePosition(FontBaseline baselineType) const +int RootInlineBox::baselinePosition(FontBaseline baselineType) const { return boxModelObject()->baselinePosition(baselineType, isFirstLineStyle(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); } @@ -261,8 +261,8 @@ LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G LayoutUnit maxPositionTop = 0; LayoutUnit maxPositionBottom = 0; - LayoutUnit maxAscent = 0; - LayoutUnit maxDescent = 0; + int maxAscent = 0; + int maxDescent = 0; bool setMaxAscent = false; bool setMaxDescent = false; diff --git a/Source/WebCore/rendering/RootInlineBox.h b/Source/WebCore/rendering/RootInlineBox.h index 525b29503..120afaa31 100644 --- a/Source/WebCore/rendering/RootInlineBox.h +++ b/Source/WebCore/rendering/RootInlineBox.h @@ -109,7 +109,7 @@ public: bool isHyphenated() const; - virtual LayoutUnit baselinePosition(FontBaseline baselineType) const; + virtual int baselinePosition(FontBaseline baselineType) const; virtual LayoutUnit lineHeight() const; #if PLATFORM(MAC) diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp index 0bfc1678e..5eed89fd5 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp @@ -198,7 +198,7 @@ LayoutUnit RenderMathMLBlock::preferredLogicalHeightAfterSizing(RenderObject* ch return child->style()->fontSize(); } -LayoutUnit RenderMathMLBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +int RenderMathMLBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { // mathml.css sets math { -webkit-line-box-contain: glyphs replaced; line-height: 0; }, so when linePositionMode == PositionOfInteriorLineBoxes we want to // return 0 here to match our line-height. This matters when RootInlineBox::ascentAndDescentForBox is called on a RootInlineBox for an inline-block. @@ -259,7 +259,7 @@ void RenderMathMLBlock::paint(PaintInfo& info, const LayoutPoint& paintOffset) } #endif // ENABLE(DEBUG_MATH_LAYOUT) -LayoutUnit RenderMathMLTable::firstLineBoxBaseline() const +int RenderMathMLTable::firstLineBoxBaseline() const { // In legal MathML, we'll have a MathML parent. That RenderFlexibleBox parent will use our firstLineBoxBaseline() for baseline alignment, per // http://dev.w3.org/csswg/css3-flexbox/#flex-baselines. We want to vertically center an <mtable>, such as a matrix. Essentially the whole <mtable> element fits on a diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h index 5d9f4de4f..36e62ad67 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h @@ -78,7 +78,7 @@ public: // computePreferredLogicalWidths() in derived classes must ensure m_preferredLogicalHeight is set to < 0 or its correct value. virtual void computePreferredLogicalWidths() OVERRIDE; - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; + virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; #if ENABLE(DEBUG_MATH_LAYOUT) virtual void paint(PaintInfo&, const LayoutPoint&); @@ -124,7 +124,7 @@ class RenderMathMLTable : public RenderTable { public: explicit RenderMathMLTable(Node* node) : RenderTable(node) { } - virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; + virtual int firstLineBoxBaseline() const OVERRIDE; private: virtual const char* renderName() const OVERRIDE { return "RenderMathMLTable"; } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp index a08680bfd..540846493 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp @@ -149,7 +149,7 @@ void RenderMathMLFraction::paint(PaintInfo& info, const LayoutPoint& paintOffset info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + denominatorWrapper->pixelSnappedOffsetWidth(), adjustedPaintOffset.y())); } -LayoutUnit RenderMathMLFraction::firstLineBoxBaseline() const +int RenderMathMLFraction::firstLineBoxBaseline() const { if (RenderBox* denominatorWrapper = lastChildBox()) return denominatorWrapper->logicalTop() + static_cast<int>(lroundf((m_lineThickness + style()->fontMetrics().xHeight()) / 2)); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h index 5b068dd31..4c10e361a 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h @@ -41,7 +41,7 @@ public: virtual RenderMathMLOperator* unembellishedOperator(); - virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; + virtual int firstLineBoxBaseline() const OVERRIDE; virtual void paint(PaintInfo&, const LayoutPoint&); protected: virtual void layout(); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp index ae7badac4..66a1621c2 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp @@ -381,7 +381,7 @@ RenderBlock* RenderMathMLOperator::createGlyph(UChar glyph, int lineHeight, int return container; } -LayoutUnit RenderMathMLOperator::firstLineBoxBaseline() const +int RenderMathMLOperator::firstLineBoxBaseline() const { if (m_isStacked) return m_stretchHeight * 2 / 3 - (m_stretchHeight - static_cast<int>(m_stretchHeight / gOperatorExpansion)) / 2; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h index 85c2c3a8e..e2cdd0572 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h @@ -45,7 +45,7 @@ public: virtual RenderMathMLOperator* unembellishedOperator() OVERRIDE { return this; } void stretchToHeight(int pixelHeight); - virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; + virtual int firstLineBoxBaseline() const OVERRIDE; protected: virtual void computePreferredLogicalWidths() OVERRIDE; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp index 93c59a894..c65805183 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp @@ -57,7 +57,7 @@ RenderMathMLOperator* RenderMathMLUnderOver::unembellishedOperator() return toRenderMathMLBlock(base)->unembellishedOperator(); } -LayoutUnit RenderMathMLUnderOver::firstLineBoxBaseline() const +int RenderMathMLUnderOver::firstLineBoxBaseline() const { RenderBox* base = firstChildBox(); if (!base) diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h index c7593349a..caf4fc499 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h @@ -38,7 +38,7 @@ public: virtual RenderMathMLOperator* unembellishedOperator(); - virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; + virtual int firstLineBoxBaseline() const OVERRIDE; private: virtual const char* renderName() const { return "RenderMathMLUnderOver"; } diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 6a589714e..d1fd13e5e 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -619,6 +619,8 @@ public: ETextDecoration textDecoration() const { return static_cast<ETextDecoration>(visual->textDecoration); } #if ENABLE(CSS3_TEXT) TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); } +#else + TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; } #endif // CSS3_TEXT int wordSpacing() const; int letterSpacing() const; @@ -1632,7 +1634,7 @@ public: static EAlignItems initialAlignItems() { return AlignStretch; } static EAlignItems initialAlignSelf() { return AlignAuto; } static EFlexDirection initialFlexDirection() { return FlowRow; } - static EFlexWrap initialFlexWrap() { return FlexWrapNone; } + static EFlexWrap initialFlexWrap() { return FlexNoWrap; } static EJustifyContent initialJustifyContent() { return JustifyFlexStart; } static int initialMarqueeLoopCount() { return -1; } static int initialMarqueeSpeed() { return 85; } diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index c2701f9e7..d3d34e5b4 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -171,7 +171,7 @@ enum EBoxDirection { BNORMAL, BREVERSE }; enum EAlignContent { AlignContentFlexStart, AlignContentFlexEnd, AlignContentCenter, AlignContentSpaceBetween, AlignContentSpaceAround, AlignContentStretch }; enum EAlignItems { AlignAuto, AlignFlexStart, AlignFlexEnd, AlignCenter, AlignStretch, AlignBaseline }; enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse }; -enum EFlexWrap { FlexWrapNone, FlexWrap, FlexWrapReverse }; +enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse }; enum EJustifyContent { JustifyFlexStart, JustifyFlexEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround }; enum ETextSecurity { @@ -336,15 +336,15 @@ enum ETextDecoration { inline ETextDecoration operator|(ETextDecoration a, ETextDecoration b) { return ETextDecoration(int(a) | int(b)); } inline ETextDecoration& operator|=(ETextDecoration& a, ETextDecoration b) { return a = a | b; } -#if ENABLE(CSS3_TEXT) enum TextDecorationStyle { TextDecorationStyleSolid, +#if ENABLE(CSS3_TEXT) TextDecorationStyleDouble, TextDecorationStyleDotted, TextDecorationStyleDashed, TextDecorationStyleWavy -}; #endif // CSS3_TEXT +}; enum EPageBreak { PBAUTO, PBALWAYS, PBAVOID diff --git a/Source/WebCore/rendering/svg/RenderSVGImage.cpp b/Source/WebCore/rendering/svg/RenderSVGImage.cpp index 5487b5e16..47947e12c 100644 --- a/Source/WebCore/rendering/svg/RenderSVGImage.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGImage.cpp @@ -179,6 +179,11 @@ void RenderSVGImage::imageChanged(WrappedImagePtr, const IntRect*) // Eventually notify parent resources, that we've changed. RenderSVGResource::markForLayoutAndParentResourceInvalidation(this, false); + // Update the SVGImageCache sizeAndScales entry in case image loading finished after layout. + // (https://bugs.webkit.org/show_bug.cgi?id=99489) + m_objectBoundingBox = FloatRect(); + updateImageViewport(); + repaint(); } diff --git a/Source/WebCore/storage/Storage.cpp b/Source/WebCore/storage/Storage.cpp index 44d0b2764..793a836d7 100644 --- a/Source/WebCore/storage/Storage.cpp +++ b/Source/WebCore/storage/Storage.cpp @@ -29,7 +29,6 @@ #include "Frame.h" #include "Page.h" #include "Settings.h" -#include "StorageArea.h" #include <wtf/PassRefPtr.h> #include <wtf/text/WTFString.h> @@ -56,61 +55,4 @@ Storage::~Storage() m_storageArea->decrementAccessCount(); } -unsigned Storage::length() const -{ - if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame)) - return 0; - - return m_storageArea->length(m_frame); -} - -String Storage::key(unsigned index) const -{ - if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame)) - return String(); - - return m_storageArea->key(index, m_frame); -} - -String Storage::getItem(const String& key) const -{ - if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame)) - return String(); - - return m_storageArea->getItem(key, m_frame); -} - -void Storage::setItem(const String& key, const String& value, ExceptionCode& ec) -{ - ec = 0; - if (!m_frame) - return; - - m_storageArea->setItem(key, value, ec, m_frame); -} - -void Storage::removeItem(const String& key) -{ - if (!m_frame) - return; - - m_storageArea->removeItem(key, m_frame); -} - -void Storage::clear() -{ - if (!m_frame) - return; - - m_storageArea->clear(m_frame); -} - -bool Storage::contains(const String& key) const -{ - if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame)) - return false; - - return m_storageArea->contains(key, m_frame); -} - } diff --git a/Source/WebCore/storage/Storage.h b/Source/WebCore/storage/Storage.h index 5eabf0ff6..c2496bd48 100644 --- a/Source/WebCore/storage/Storage.h +++ b/Source/WebCore/storage/Storage.h @@ -27,6 +27,7 @@ #define Storage_h #include "DOMWindowProperty.h" +#include "StorageArea.h" #include <wtf/Forward.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -34,7 +35,6 @@ namespace WebCore { class Frame; - class StorageArea; typedef int ExceptionCode; class Storage : public RefCounted<Storage>, public DOMWindowProperty { @@ -42,14 +42,13 @@ namespace WebCore { static PassRefPtr<Storage> create(Frame*, PassRefPtr<StorageArea>); ~Storage(); - unsigned length() const; - String key(unsigned index) const; - String getItem(const String&) const; - void setItem(const String& key, const String& value, ExceptionCode&); - void removeItem(const String&); - void clear(); - - bool contains(const String& key) const; + unsigned length(ExceptionCode& ec) const { return m_storageArea->length(ec, m_frame); } + String key(unsigned index, ExceptionCode& ec) const { return m_storageArea->key(index, ec, m_frame); } + String getItem(const String& key, ExceptionCode& ec) const { return m_storageArea->getItem(key, ec, m_frame); } + void setItem(const String& key, const String& value, ExceptionCode& ec) { m_storageArea->setItem(key, value, ec, m_frame); } + void removeItem(const String& key, ExceptionCode& ec) { m_storageArea->removeItem(key, ec, m_frame); } + void clear(ExceptionCode& ec) { m_storageArea->clear(ec, m_frame); } + bool contains(const String& key, ExceptionCode& ec) const { return m_storageArea->contains(key, ec, m_frame); } StorageArea* area() const { return m_storageArea.get(); } diff --git a/Source/WebCore/storage/Storage.idl b/Source/WebCore/storage/Storage.idl index 55da55505..58b0e2c26 100644 --- a/Source/WebCore/storage/Storage.idl +++ b/Source/WebCore/storage/Storage.idl @@ -30,12 +30,16 @@ CustomEnumerateProperty, CustomNamedSetter, ] interface Storage { - [NotEnumerable] readonly attribute unsigned long length; - [NotEnumerable, TreatReturnedNullStringAs=Null] DOMString key(in unsigned long index); - [NotEnumerable, TreatReturnedNullStringAs=Null] DOMString getItem(in DOMString key); + [NotEnumerable] readonly attribute unsigned long length getter raises(DOMException); + [NotEnumerable, TreatReturnedNullStringAs=Null] DOMString key(in unsigned long index) + raises(DOMException); + [NotEnumerable, TreatReturnedNullStringAs=Null] DOMString getItem(in DOMString key) + raises(DOMException); [NotEnumerable] void setItem(in DOMString key, in DOMString data) raises(DOMException); - [NotEnumerable] void removeItem(in DOMString key); - [NotEnumerable] void clear(); + [NotEnumerable] void removeItem(in DOMString key) + raises(DOMException); + [NotEnumerable] void clear() + raises(DOMException); }; diff --git a/Source/WebCore/storage/StorageArea.h b/Source/WebCore/storage/StorageArea.h index f69d7b53a..97034c889 100644 --- a/Source/WebCore/storage/StorageArea.h +++ b/Source/WebCore/storage/StorageArea.h @@ -46,15 +46,15 @@ namespace WebCore { // The HTML5 DOM Storage API // FIXME: We should pass Document instead of Frame. Also, that parameter should go first. - virtual unsigned length(Frame* sourceFrame) const = 0; - virtual String key(unsigned index, Frame* sourceFrame) const = 0; - virtual String getItem(const String& key, Frame* sourceFrame) const = 0; + virtual unsigned length(ExceptionCode&, Frame* sourceFrame) const = 0; + virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) const = 0; + virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) const = 0; virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame) = 0; - virtual void removeItem(const String& key, Frame* sourceFrame) = 0; - virtual void clear(Frame* sourceFrame) = 0; - virtual bool contains(const String& key, Frame* sourceFrame) const = 0; + virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame) = 0; + virtual void clear(ExceptionCode&, Frame* sourceFrame) = 0; + virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) const = 0; - virtual bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const = 0; + virtual bool canAccessStorage(Frame*) const = 0; virtual size_t memoryBytesUsedByCache() const = 0; diff --git a/Source/WebCore/storage/StorageAreaImpl.cpp b/Source/WebCore/storage/StorageAreaImpl.cpp index 37c4f596c..8f57db777 100644 --- a/Source/WebCore/storage/StorageAreaImpl.cpp +++ b/Source/WebCore/storage/StorageAreaImpl.cpp @@ -104,10 +104,13 @@ StorageAreaImpl::StorageAreaImpl(StorageAreaImpl* area) ASSERT(!m_isShutdown); } +bool StorageAreaImpl::canAccessStorage(Frame* frame) const +{ + return frame && frame->page(); +} + bool StorageAreaImpl::disabledByPrivateBrowsingInFrame(const Frame* frame) const { - if (!frame->page()) - return true; if (!frame->page()->settings()->privateBrowsingEnabled()) return false; if (m_storageType != LocalStorage) @@ -115,24 +118,48 @@ bool StorageAreaImpl::disabledByPrivateBrowsingInFrame(const Frame* frame) const return !SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(frame->document()->securityOrigin()->protocol()); } -unsigned StorageAreaImpl::length(Frame*) const +unsigned StorageAreaImpl::length(ExceptionCode& ec, Frame* frame) const { + ec = 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return 0; + } + if (disabledByPrivateBrowsingInFrame(frame)) + return 0; + ASSERT(!m_isShutdown); blockUntilImportComplete(); return m_storageMap->length(); } -String StorageAreaImpl::key(unsigned index, Frame*) const +String StorageAreaImpl::key(unsigned index, ExceptionCode& ec, Frame* frame) const { + ec = 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return String(); + } + if (disabledByPrivateBrowsingInFrame(frame)) + return String(); + ASSERT(!m_isShutdown); blockUntilImportComplete(); return m_storageMap->key(index); } -String StorageAreaImpl::getItem(const String& key, Frame*) const +String StorageAreaImpl::getItem(const String& key, ExceptionCode& ec, Frame* frame) const { + ec = 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return String(); + } + if (disabledByPrivateBrowsingInFrame(frame)) + return String(); + ASSERT(!m_isShutdown); blockUntilImportComplete(); @@ -141,6 +168,12 @@ String StorageAreaImpl::getItem(const String& key, Frame*) const void StorageAreaImpl::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { + ec = 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return; + } + ASSERT(!m_isShutdown); ASSERT(!value.isNull()); blockUntilImportComplete(); @@ -169,8 +202,14 @@ void StorageAreaImpl::setItem(const String& key, const String& value, ExceptionC StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame); } -void StorageAreaImpl::removeItem(const String& key, Frame* frame) +void StorageAreaImpl::removeItem(const String& key, ExceptionCode& ec, Frame* frame) { + ec = 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return; + } + ASSERT(!m_isShutdown); blockUntilImportComplete(); @@ -190,8 +229,14 @@ void StorageAreaImpl::removeItem(const String& key, Frame* frame) StorageEventDispatcher::dispatch(key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame); } -void StorageAreaImpl::clear(Frame* frame) +void StorageAreaImpl::clear(ExceptionCode& ec, Frame* frame) { + ec = 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return; + } + ASSERT(!m_isShutdown); blockUntilImportComplete(); @@ -209,8 +254,16 @@ void StorageAreaImpl::clear(Frame* frame) StorageEventDispatcher::dispatch(String(), String(), String(), m_storageType, m_securityOrigin.get(), frame); } -bool StorageAreaImpl::contains(const String& key, Frame*) const +bool StorageAreaImpl::contains(const String& key, ExceptionCode& ec, Frame* frame) const { + ec = 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return false; + } + if (disabledByPrivateBrowsingInFrame(frame)) + return false; + ASSERT(!m_isShutdown); blockUntilImportComplete(); diff --git a/Source/WebCore/storage/StorageAreaImpl.h b/Source/WebCore/storage/StorageAreaImpl.h index 1f2b7e080..384af5f7f 100644 --- a/Source/WebCore/storage/StorageAreaImpl.h +++ b/Source/WebCore/storage/StorageAreaImpl.h @@ -44,15 +44,15 @@ namespace WebCore { virtual ~StorageAreaImpl(); // The HTML5 DOM Storage API (and contains) - virtual unsigned length(Frame* sourceFrame) const; - virtual String key(unsigned index, Frame* sourceFrame) const; - virtual String getItem(const String& key, Frame* sourceFrame) const; + virtual unsigned length(ExceptionCode&, Frame* sourceFrame) const; + virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) const; + virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) const; virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame); - virtual void removeItem(const String& key, Frame* sourceFrame); - virtual void clear(Frame* sourceFrame); - virtual bool contains(const String& key, Frame* sourceFrame) const; + virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame); + virtual void clear(ExceptionCode&, Frame* sourceFrame); + virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) const; - virtual bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const; + virtual bool canAccessStorage(Frame* sourceFrame) const; virtual size_t memoryBytesUsedByCache() const; @@ -76,6 +76,7 @@ namespace WebCore { void blockUntilImportComplete() const; void closeDatabaseTimerFired(Timer<StorageAreaImpl>*); + bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const; StorageType m_storageType; RefPtr<SecurityOrigin> m_securityOrigin; diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp index 4b9883b78..a110f5e75 100644 --- a/Source/WebCore/svg/SVGElement.cpp +++ b/Source/WebCore/svg/SVGElement.cpp @@ -527,9 +527,9 @@ bool SVGElement::childShouldCreateRenderer(const NodeRenderingContext& childCont return false; } -void SVGElement::attributeChanged(const Attribute& attribute) +void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue) { - StyledElement::attributeChanged(attribute); + StyledElement::attributeChanged(name, newValue); // When an animated SVG property changes through SVG DOM, svgAttributeChanged() is called, not attributeChanged(). // Next time someone tries to access the XML attributes, the synchronization code starts. During that synchronization @@ -539,15 +539,15 @@ void SVGElement::attributeChanged(const Attribute& attribute) if (isSynchronizingSVGAttributes()) return; - if (isIdAttributeName(attribute.name())) { + if (isIdAttributeName(name)) { document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this); document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); } // Changes to the style attribute are processed lazily (see Element::getAttribute() and related methods), // so we don't want changes to the style attribute to result in extra work here. - if (attribute.name() != HTMLNames::styleAttr) - svgAttributeChanged(attribute.name()); + if (name != HTMLNames::styleAttr) + svgAttributeChanged(name); } void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h index bd45f536a..5720c356a 100644 --- a/Source/WebCore/svg/SVGElement.h +++ b/Source/WebCore/svg/SVGElement.h @@ -126,7 +126,7 @@ protected: virtual void parseAttribute(const Attribute&) OVERRIDE; virtual void finishParsingChildren(); - virtual void attributeChanged(const Attribute&) OVERRIDE; + virtual void attributeChanged(const QualifiedName&, const AtomicString&) OVERRIDE; virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE; virtual void removedFrom(ContainerNode*) OVERRIDE; diff --git a/Source/WebCore/svg/SVGFEImageElement.cpp b/Source/WebCore/svg/SVGFEImageElement.cpp index 7635738fd..87ff0d681 100644 --- a/Source/WebCore/svg/SVGFEImageElement.cpp +++ b/Source/WebCore/svg/SVGFEImageElement.cpp @@ -27,6 +27,7 @@ #include "Attr.h" #include "CachedImage.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "ColorSpace.h" #include "Document.h" #include "Image.h" @@ -80,7 +81,7 @@ void SVGFEImageElement::clearResourceReferences() void SVGFEImageElement::requestImageResource() { - ResourceRequest request(ownerDocument()->completeURL(href())); + CachedResourceRequest request(ResourceRequest(ownerDocument()->completeURL(href()))); m_cachedImage = document()->cachedResourceLoader()->requestImage(request); if (m_cachedImage) diff --git a/Source/WebCore/svg/SVGFontFaceUriElement.cpp b/Source/WebCore/svg/SVGFontFaceUriElement.cpp index f61053772..c34fed87d 100644 --- a/Source/WebCore/svg/SVGFontFaceUriElement.cpp +++ b/Source/WebCore/svg/SVGFontFaceUriElement.cpp @@ -27,6 +27,7 @@ #include "CSSFontFaceSrcValue.h" #include "CachedFont.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "SVGFontFaceElement.h" #include "SVGNames.h" @@ -96,7 +97,7 @@ void SVGFontFaceUriElement::loadFont() const AtomicString& href = getAttribute(XLinkNames::hrefAttr); if (!href.isNull()) { CachedResourceLoader* cachedResourceLoader = document()->cachedResourceLoader(); - ResourceRequest request(document()->completeURL(href)); + CachedResourceRequest request(ResourceRequest(document()->completeURL(href))); m_cachedFont = cachedResourceLoader->requestFont(request); if (m_cachedFont) { m_cachedFont->addClient(this); diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp index d19ea195d..6046ec61b 100644 --- a/Source/WebCore/svg/SVGUseElement.cpp +++ b/Source/WebCore/svg/SVGUseElement.cpp @@ -29,6 +29,7 @@ #include "Attribute.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "ElementShadow.h" #include "Event.h" @@ -254,7 +255,7 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) if (isExternalReference) { KURL url = document()->completeURL(href()); if (url.hasFragmentIdentifier()) { - ResourceRequest request(url.string()); + CachedResourceRequest request(ResourceRequest(url.string())); m_cachedDocument = document()->cachedResourceLoader()->requestSVGDocument(request); if (m_cachedDocument) m_cachedDocument->addClient(this); diff --git a/Source/WebCore/xml/XSLImportRule.cpp b/Source/WebCore/xml/XSLImportRule.cpp index 0a1770d03..e62959e99 100644 --- a/Source/WebCore/xml/XSLImportRule.cpp +++ b/Source/WebCore/xml/XSLImportRule.cpp @@ -26,6 +26,7 @@ #include "CachedXSLStyleSheet.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "Document.h" #include "XSLStyleSheet.h" @@ -98,7 +99,7 @@ void XSLImportRule::loadSheet() return; } - ResourceRequest request(cachedResourceLoader->document()->completeURL(absHref)); + CachedResourceRequest request(ResourceRequest(cachedResourceLoader->document()->completeURL(absHref))); m_cachedSheet = cachedResourceLoader->requestXSLStyleSheet(request); if (m_cachedSheet) { diff --git a/Source/WebCore/xml/parser/MarkupTokenBase.h b/Source/WebCore/xml/parser/MarkupTokenBase.h index 896d1ff20..599f90cde 100644 --- a/Source/WebCore/xml/parser/MarkupTokenBase.h +++ b/Source/WebCore/xml/parser/MarkupTokenBase.h @@ -98,7 +98,6 @@ public: m_baseOffset = 0; m_data.clear(); m_orAllData = 0; - m_convertTo8BitIfPossible = false; } bool isUninitialized() { return m_type == TypeSet::Uninitialized; } @@ -132,10 +131,10 @@ public: m_attributes.clear(); m_data.append(character); + m_orAllData |= character; } - template<typename T> - void beginEndTag(T characters) + void beginEndTag(LChar character) { ASSERT(m_type == TypeSet::Uninitialized); m_type = TypeSet::EndTag; @@ -143,7 +142,18 @@ public: m_currentAttribute = 0; m_attributes.clear(); - m_data.append(characters); + m_data.append(character); + } + + void beginEndTag(Vector<LChar, 32> characters) + { + ASSERT(m_type == TypeSet::Uninitialized); + m_type = TypeSet::EndTag; + m_selfClosing = false; + m_currentAttribute = 0; + m_attributes.clear(); + + m_data.appendVector(characters); } // Starting a character token works slightly differently than starting @@ -172,6 +182,7 @@ public: ASSERT(character); beginDOCTYPE(); m_data.append(character); + m_orAllData |= character; } void appendToCharacter(char character) @@ -198,6 +209,7 @@ public: ASSERT(character); ASSERT(m_type == TypeSet::Comment); m_data.append(character); + m_orAllData |= character; } void addNewAttribute() @@ -373,13 +385,23 @@ protected: { ASSERT(character); m_data.append(character); + m_orAllData |= character; } - + inline const DataVector& name() const { return m_data; } + inline const String nameString() const + { + if (!m_data.size()) + return emptyString(); + if (isAll8BitData()) + return String::make8BitFrom16BitSource(m_data.data(), m_data.size()); + return String(m_data.data(), m_data.size()); + } + // FIXME: I'm not sure what the final relationship between MarkupTokenBase and // AtomicMarkupTokenBase will be. I'm marking this a friend for now, but we'll // want to end up with a cleaner interface between the two classes. @@ -391,7 +413,6 @@ protected: int m_baseOffset; DataVector m_data; UChar m_orAllData; - bool m_convertTo8BitIfPossible; // For DOCTYPE OwnPtr<DoctypeData> m_doctypeData; @@ -418,7 +439,7 @@ public: ASSERT_NOT_REACHED(); break; case Token::Type::DOCTYPE: - m_name = AtomicString(token->name().data(), token->name().size()); + m_name = AtomicString(token->nameString()); m_doctypeData = token->m_doctypeData.release(); break; case Token::Type::EndOfFile: @@ -426,12 +447,15 @@ public: case Token::Type::StartTag: case Token::Type::EndTag: { m_selfClosing = token->selfClosing(); - m_name = AtomicString(token->name().data(), token->name().size()); + m_name = AtomicString(token->nameString()); initializeAttributes(token->attributes()); break; } case Token::Type::Comment: - m_data = String(token->comment().data(), token->comment().size()); + if (token->isAll8BitData()) + m_data = String::make8BitFrom16BitSource(token->comment().data(), token->comment().size()); + else + m_data = String(token->comment().data(), token->comment().size()); break; case Token::Type::Character: m_externalCharacters = &token->characters(); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 62914fd11..3555feadd 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,21 @@ +2012-10-22 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Remove specialized handling for isIndex fields. + https://bugs.webkit.org/show_bug.cgi?id=100004 + + Reviewed by Rob Buis. + + PR 214342. + + Remove special handling for isIndex field as the tag + is rewritten. + + Reviewed Internally by Yongxin Dai and Nima Ghanavatian. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::inputStyle): + (BlackBerry::WebKit::InputHandler::elementType): + 2012-10-22 Jocelyn Turcotte <jocelyn.turcotte@digia.com> [Qt] Fix "ASSERTION FAILED: !document->inPageCache()" when loading a page diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index 07397011b..0c23f4acc 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -229,7 +229,6 @@ static int64_t inputStyle(BlackBerryInputType type, const Element* element) // with autocorrect disabled explicitly. Only enable predictions. return NO_AUTO_TEXT | NO_AUTO_CORRECTION; } - case InputTypeIsIndex: case InputTypePassword: case InputTypeNumber: case InputTypeTelephone: @@ -394,12 +393,6 @@ WTF::String InputHandler::elementText() BlackBerryInputType InputHandler::elementType(Element* element) const { - // <isIndex> is bundled with input so we need to check the formControlName - // first to differentiate it from input which is essentially the same as - // isIndex has been deprecated. - if (element->formControlName() == HTMLNames::isindexTag) - return InputTypeIsIndex; - if (const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element->toInputElement())) return convertInputType(inputElement); diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index b2a38d2b7..b49e64166 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,122 @@ +2012-10-23 Kent Tamura <tkent@chromium.org> + + Support full month names in DateTimeEditElement, and use them in input[type=month] by default + https://bugs.webkit.org/show_bug.cgi?id=100060 + + Reviewed by Kentaro Hara. + + * tests/LocaleMacTest.cpp: + (TEST_F): Follow LocaleMac::monthFormat change. + * tests/LocalizedDateICUTest.cpp: + (TEST_F): Follow LocaleICU::monthFormat change. + +2012-10-23 Dan Carney <dcarney@google.com> + + When blocking localStorage, Firefox throws a security exception on access, and maybe so should we + https://bugs.webkit.org/show_bug.cgi?id=63257 + + Reviewed by Jochen Eisinger. + + Add security check and security check cache. + + * src/StorageAreaProxy.cpp: + (WebCore::StorageAreaProxy::StorageAreaProxy): + (WebCore::StorageAreaProxy::length): + (WebCore::StorageAreaProxy::key): + (WebCore::StorageAreaProxy::getItem): + (WebCore::StorageAreaProxy::setItem): + (WebCore::StorageAreaProxy::removeItem): + (WebCore::StorageAreaProxy::clear): + (WebCore::StorageAreaProxy::contains): + (WebCore::StorageAreaProxy::canAccessStorage): + * src/StorageAreaProxy.h: + (StorageAreaProxy): + (WebCore::StorageAreaProxy::canAccessStorage): + +2012-10-22 James Robinson <jamesr@chromium.org> + + [chromium] Suppress compositor invalidations during FrameView recreation in force-compositing-mode + https://bugs.webkit.org/show_bug.cgi?id=99882 + + Reviewed by Adrienne Walker. + + In force compositing mode, page navigation temporarily takes us in and out of compositing mode because the + root GraphicsLayer is owned by the FrameView which is destroyed and recreated. These changes generate + invalidations on the WebViewClient that trigger frames but aren't actually terribly useful. WebCore suppresses + repaints too early during page load to avoid flashing white or mostly white and to avoid impacting page load time. + + This suppresses compositor invalidations during FrameView recreation. + + Covered by chromium's page cycler performance tests. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::commitDocumentData): + (WebKit::WebFrameImpl::createFrameView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::suppressInvalidations): + (WebKit): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::scheduleComposite): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-10-22 Kent Tamura <tkent@chromium.org> + + Introduce Localizer::standAloneMonthLabels + https://bugs.webkit.org/show_bug.cgi?id=99963 + + Reviewed by Kentaro Hara. + + Note that we don't add tests to LocaleWinTest because new function + LocaleWin::standAloneMonthLabels is equivalent to monthLabels. + + * tests/LocaleMacTest.cpp: + (LocaleMacTest::standAloneMonthLabel): Added a helper function. + (TEST_F): Add some tests. We don't test ru_ru locale because it has + different data on OSX versions. + * tests/LocalizedDateICUTest.cpp: + (LocalizedDateICUTest::standAloneMonthLabel): Added a helper function. + (TEST_F): Add some tests. + +2012-10-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r132119. + http://trac.webkit.org/changeset/132119 + https://bugs.webkit.org/show_bug.cgi?id=100019 + + Fails its own test on Mac platforms. (Requested by leviw on + #webkit). + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + +2012-10-22 Varun Jain <varunjain@chromium.org> + + Context menu generated from touch gestures on textareas has + context of the cursor position instead of the position where the event occurs. + https://bugs.webkit.org/show_bug.cgi?id=99520 + + Reviewed by Kenneth Rohde Christiansen. + + Send a synthetic mouse down event for context menu-summoning-gesture events so + that textareas can correctly set cursors before receiving the context menu event. + Also in this change, WebInputEvent::GestureTwoFingerTap now follows the same + code path as WebInputEvent::GestureLongPress, hence fixing this bug for both gestures. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + +2012-10-22 Adam Barth <abarth@webkit.org> + + [Chromium] Roll Chromium DEPS to get new version of V8 + https://bugs.webkit.org/show_bug.cgi?id=100015 + + Unreviewed. + + * DEPS: + - Bigger is better. + 2012-10-22 Keishi Hattori <keishi@webkit.org> Remove monthFormatInLDML diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 42b3e567d..ec98d6853 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': '162983' + 'chromium_rev': '163297' } deps = { diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index 2e33d08fb..e1b35e926 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -53,6 +53,8 @@ namespace WebCore { StorageAreaProxy::StorageAreaProxy(WebKit::WebStorageArea* storageArea, StorageType storageType) : m_storageArea(adoptPtr(storageArea)) , m_storageType(storageType) + , m_canAccessStorageCachedResult(false) + , m_canAccessStorageCachedFrame(0) { } @@ -60,64 +62,88 @@ StorageAreaProxy::~StorageAreaProxy() { } -unsigned StorageAreaProxy::length(Frame* frame) const +unsigned StorageAreaProxy::length(ExceptionCode& ec, Frame* frame) const { - if (canAccessStorage(frame)) - return m_storageArea->length(); - return 0; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return 0; + } + ec = 0; + return m_storageArea->length(); } -String StorageAreaProxy::key(unsigned index, Frame* frame) const +String StorageAreaProxy::key(unsigned index, ExceptionCode& ec, Frame* frame) const { - if (canAccessStorage(frame)) - return m_storageArea->key(index); - return String(); + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return String(); + } + ec = 0; + return m_storageArea->key(index); } -String StorageAreaProxy::getItem(const String& key, Frame* frame) const +String StorageAreaProxy::getItem(const String& key, ExceptionCode& ec, Frame* frame) const { - if (canAccessStorage(frame)) - return m_storageArea->getItem(key); - return String(); + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return String(); + } + ec = 0; + return m_storageArea->getItem(key); } void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { - if (!canAccessStorage(frame)) - ec = QUOTA_EXCEEDED_ERR; - else { - WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; - m_storageArea->setItem(key, value, frame->document()->url(), result); - ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return; } + WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; + m_storageArea->setItem(key, value, frame->document()->url(), result); + ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; } -void StorageAreaProxy::removeItem(const String& key, Frame* frame) +void StorageAreaProxy::removeItem(const String& key, ExceptionCode& ec, Frame* frame) { - if (!canAccessStorage(frame)) + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; return; + } + ec = 0; m_storageArea->removeItem(key, frame->document()->url()); } -void StorageAreaProxy::clear(Frame* frame) +void StorageAreaProxy::clear(ExceptionCode& ec, Frame* frame) { - if (!canAccessStorage(frame)) + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; return; + } + ec = 0; m_storageArea->clear(frame->document()->url()); } -bool StorageAreaProxy::contains(const String& key, Frame* frame) const +bool StorageAreaProxy::contains(const String& key, ExceptionCode& ec, Frame* frame) const { - return !getItem(key, frame).isNull(); + if (!canAccessStorage(frame)) { + ec = SECURITY_ERR; + return false; + } + return !getItem(key, ec, frame).isNull(); } bool StorageAreaProxy::canAccessStorage(Frame* frame) const { - if (!frame->page()) + if (!frame || !frame->page()) return false; + if (m_canAccessStorageCachedFrame == frame) + return m_canAccessStorageCachedResult; WebKit::WebFrameImpl* webFrame = WebKit::WebFrameImpl::fromFrame(frame); WebKit::WebViewImpl* webView = webFrame->viewImpl(); - return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage); + bool result = !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage); + m_canAccessStorageCachedFrame = frame; + m_canAccessStorageCachedResult = result; + return result; } size_t StorageAreaProxy::memoryBytesUsedByCache() const diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.h b/Source/WebKit/chromium/src/StorageAreaProxy.h index cae359358..4a96c0d81 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.h +++ b/Source/WebKit/chromium/src/StorageAreaProxy.h @@ -48,15 +48,15 @@ public: virtual ~StorageAreaProxy(); // The HTML5 DOM Storage API - virtual unsigned length(Frame* sourceFrame) const; - virtual String key(unsigned index, Frame* sourceFrame) const; - virtual String getItem(const String& key, Frame* sourceFrame) const; + virtual unsigned length(ExceptionCode&, Frame* sourceFrame) const; + virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) const; + virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) const; virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame); - virtual void removeItem(const String& key, Frame* sourceFrame); - virtual void clear(Frame* sourceFrame); - virtual bool contains(const String& key, Frame* sourceFrame) const; + virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame); + virtual void clear(ExceptionCode&, Frame* sourceFrame); + virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) const; - virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; } + virtual bool canAccessStorage(Frame*) const; virtual size_t memoryBytesUsedByCache() const; @@ -69,12 +69,12 @@ public: WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); private: - bool canAccessStorage(Frame*) const; - static bool isEventSource(Storage*, WebKit::WebStorageArea* sourceAreaInstance); OwnPtr<WebKit::WebStorageArea> m_storageArea; StorageType m_storageType; + mutable bool m_canAccessStorageCachedResult; + mutable Frame* m_canAccessStorageCachedFrame; }; } // namespace WebCore diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 98bec3aba..7eef29343 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1114,7 +1114,15 @@ WebURLLoader* WebFrameImpl::createAssociatedURLLoader(const WebURLLoaderOptions& void WebFrameImpl::commitDocumentData(const char* data, size_t length) { + WebViewImpl* webView = viewImpl(); + bool isMainFrame = webView->mainFrameImpl()->frame() == frame(); + if (isMainFrame) + webView->suppressInvalidations(true); + frame()->loader()->documentLoader()->commitData(data, length); + + if (isMainFrame) + webView->suppressInvalidations(false); } unsigned WebFrameImpl::unloadListenerCount() const @@ -2271,10 +2279,16 @@ void WebFrameImpl::createFrameView() WebViewImpl* webView = viewImpl(); bool isMainFrame = webView->mainFrameImpl()->frame() == frame(); + if (isMainFrame) + webView->suppressInvalidations(true); + frame()->createView(webView->size(), Color::white, webView->isTransparent(), webView->fixedLayoutSize(), IntRect(), isMainFrame ? webView->isFixedLayoutModeEnabled() : 0); if (webView->shouldAutoResize() && isMainFrame) frame()->view()->enableAutoSizeMode(true, webView->minAutoSize(), webView->maxAutoSize()); + if (isMainFrame) + webView->suppressInvalidations(false); + if (isMainFrame && webView->devToolsAgentPrivate()) webView->devToolsAgentPrivate()->mainFrameViewCreated(this); } diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 9f2a845dd..5277b7b34 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -445,6 +445,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) #endif , m_flingModifier(0) , m_validationMessage(ValidationMessageClientImpl::create(*client)) + , m_suppressInvalidations(false) { // WebKit/win/WebView.cpp does the same thing, except they call the // KJS specific wrapper around this method. We need to have threading @@ -3766,6 +3767,11 @@ bool WebViewImpl::tabsToLinks() const return m_tabsToLinks; } +void WebViewImpl::suppressInvalidations(bool enable) +{ + m_suppressInvalidations = enable; +} + #if USE(ACCELERATED_COMPOSITING) bool WebViewImpl::allowsAcceleratedCompositing() { @@ -3774,6 +3780,8 @@ bool WebViewImpl::allowsAcceleratedCompositing() void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) { + TemporaryChange<bool> change(m_suppressInvalidations, true); + m_rootGraphicsLayer = layer; m_rootLayer = layer ? layer->platformLayer() : 0; @@ -3797,7 +3805,7 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) } IntRect damagedRect(0, 0, m_size.width, m_size.height); - if (!m_isAcceleratedCompositingActive) + if (!m_isAcceleratedCompositingActive && !m_suppressInvalidations) m_client->didInvalidateRect(damagedRect); } @@ -4096,6 +4104,11 @@ void WebViewImpl::didRecreateOutputSurface(bool success) void WebViewImpl::scheduleComposite() { + if (m_suppressInvalidations) { + TRACE_EVENT0("webkit", "WebViewImpl invalidations suppressed"); + return; + } + ASSERT(!Platform::current()->compositorSupport()->isThreadingEnabled()); m_client->scheduleComposite(); } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 47907f124..439e0e6b1 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -325,6 +325,8 @@ public: // WebViewImpl + void suppressInvalidations(bool enable); + void setIgnoreInputEvents(bool newValue); WebDevToolsAgentPrivate* devToolsAgentPrivate() { return m_devToolsAgent.get(); } @@ -872,6 +874,8 @@ private: OwnPtr<LinkHighlight> m_linkHighlight; #endif OwnPtr<ValidationMessageClientImpl> m_validationMessage; + + bool m_suppressInvalidations; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/tests/LocaleMacTest.cpp b/Source/WebKit/chromium/tests/LocaleMacTest.cpp index 91482d94d..e9e55d81c 100644 --- a/Source/WebKit/chromium/tests/LocaleMacTest.cpp +++ b/Source/WebKit/chromium/tests/LocaleMacTest.cpp @@ -144,6 +144,12 @@ protected: return locale->shortMonthLabels()[index]; } + String standAloneMonthLabel(const String& localeString, unsigned index) + { + OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + return locale->standAloneMonthLabels()[index]; + } + String shortStandAloneMonthLabel(const String& localeString, unsigned index) { OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); @@ -256,7 +262,7 @@ TEST_F(LocaleMacTest, isRTL) #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) TEST_F(LocaleMacTest, monthFormat) { - EXPECT_STREQ("MMM yyyy", monthFormat("en_US").utf8().data()); + EXPECT_STREQ("MMMM yyyy", monthFormat("en_US").utf8().data()); EXPECT_STREQ("yyyy\xE5\xB9\xB4M\xE6\x9C\x88", monthFormat("ja_JP").utf8().data()); // fr_FR and ru return different results on OS versions. @@ -278,6 +284,21 @@ TEST_F(LocaleMacTest, shortTimeFormat) EXPECT_STREQ("H:mm", shortTimeFormat("ja_JP").utf8().data()); } +TEST_F(LocaleMacTest, standAloneMonthLabels) +{ + EXPECT_STREQ("January", standAloneMonthLabel("en_US", January).utf8().data()); + EXPECT_STREQ("June", standAloneMonthLabel("en_US", June).utf8().data()); + EXPECT_STREQ("December", standAloneMonthLabel("en_US", December).utf8().data()); + + EXPECT_STREQ("janvier", standAloneMonthLabel("fr_FR", January).utf8().data()); + EXPECT_STREQ("juin", standAloneMonthLabel("fr_FR", June).utf8().data()); + EXPECT_STREQ("d\xC3\xA9" "cembre", standAloneMonthLabel("fr_FR", December).utf8().data()); + + EXPECT_STREQ("1\xE6\x9C\x88", standAloneMonthLabel("ja_JP", January).utf8().data()); + EXPECT_STREQ("6\xE6\x9C\x88", standAloneMonthLabel("ja_JP", June).utf8().data()); + EXPECT_STREQ("12\xE6\x9C\x88", standAloneMonthLabel("ja_JP", December).utf8().data()); +} + TEST_F(LocaleMacTest, shortMonthLabels) { EXPECT_STREQ("Jan", shortMonthLabel("en_US", 0).utf8().data()); diff --git a/Source/WebKit/chromium/tests/LocalizedDateICUTest.cpp b/Source/WebKit/chromium/tests/LocalizedDateICUTest.cpp index 88946e84d..03d0e1340 100644 --- a/Source/WebKit/chromium/tests/LocalizedDateICUTest.cpp +++ b/Source/WebKit/chromium/tests/LocalizedDateICUTest.cpp @@ -118,6 +118,12 @@ protected: return locale->shortStandAloneMonthLabels()[index]; } + String standAloneMonthLabel(const char* localeString, unsigned index) + { + OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + return locale->standAloneMonthLabels()[index]; + } + Labels timeAMPMLabels(const char* localeString) { OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); @@ -146,8 +152,8 @@ TEST_F(LocalizedDateICUTest, isRTL) TEST_F(LocalizedDateICUTest, monthFormat) { - EXPECT_STREQ("MMM yyyy", monthFormat("en_US").utf8().data()); - EXPECT_STREQ("MMM yyyy", monthFormat("fr").utf8().data()); + EXPECT_STREQ("MMMM yyyy", monthFormat("en_US").utf8().data()); + EXPECT_STREQ("MMMM yyyy", monthFormat("fr").utf8().data()); EXPECT_STREQ("yyyy\xE5\xB9\xB4M\xE6\x9C\x88", monthFormat("ja").utf8().data()); } @@ -166,6 +172,24 @@ TEST_F(LocalizedDateICUTest, localizedShortDateFormatText) EXPECT_STREQ("H:mm", localizedShortDateFormatText("ja").utf8().data()); } +TEST_F(LocalizedDateICUTest, standAloneMonthLabels) +{ + EXPECT_STREQ("January", standAloneMonthLabel("en_US", 0).utf8().data()); + EXPECT_STREQ("June", standAloneMonthLabel("en_US", 5).utf8().data()); + EXPECT_STREQ("December", standAloneMonthLabel("en_US", 11).utf8().data()); + + EXPECT_STREQ("janvier", standAloneMonthLabel("fr_FR", 0).utf8().data()); + EXPECT_STREQ("juin", standAloneMonthLabel("fr_FR", 5).utf8().data()); + EXPECT_STREQ("d\xC3\xA9" "cembre", standAloneMonthLabel("fr_FR", 11).utf8().data()); + + EXPECT_STREQ("1\xE6\x9C\x88", standAloneMonthLabel("ja_JP", 0).utf8().data()); + EXPECT_STREQ("6\xE6\x9C\x88", standAloneMonthLabel("ja_JP", 5).utf8().data()); + EXPECT_STREQ("12\xE6\x9C\x88", standAloneMonthLabel("ja_JP", 11).utf8().data()); + + EXPECT_STREQ("\xD0\x9C\xD0\xB0\xD1\x80\xD1\x82", standAloneMonthLabel("ru_RU", 2).utf8().data()); + EXPECT_STREQ("\xD0\x9C\xD0\xB0\xD0\xB9", standAloneMonthLabel("ru_RU", 4).utf8().data()); +} + TEST_F(LocalizedDateICUTest, shortMonthLabels) { EXPECT_STREQ("Jan", shortMonthLabel("en_US", 0).utf8().data()); diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 553d7fa20..4cc7e72c2 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,14 @@ +2012-10-23 Simon Hausmann <simon.hausmann@digia.com> + + Unreviewed build fix with newer Qt 5. + + QPlastiqueStyle has been removed, but as pointed out by Jens it's also not + maintained anymore and hence safe to remove. We can do tweaks with the new + fusion style if required. + + * WebCoreSupport/QStyleFacadeImp.cpp: + (WebKit::QStyleFacadeImp::paintInnerSpinButton): + 2012-10-22 Simon Hausmann <simon.hausmann@digia.com> [Qt] Fix build without QtWidgets diff --git a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp b/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp index b9e478709..7fc5cc56e 100644 --- a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp @@ -30,9 +30,6 @@ #include <QMacStyle> #include <QPainter> #include <QPushButton> -#ifndef QT_NO_STYLE_PLASTIQUE -#include <QPlastiqueStyle> -#endif #include <QStyleFactory> #include <QStyleOption> @@ -373,13 +370,6 @@ void QStyleFacadeImp::paintInnerSpinButton(QPainter* painter, const QStyleFacade option.state |= QStyle::State_Mini; } #endif -#if !defined(QT_NO_STYLE_PLASTIQUE) - // QPlastiqueStyle looks best when the spin buttons are flush with the frame's edge. - if (qobject_cast<QPlastiqueStyle*>(style())) { - inflateX = 0; - inflateY = 0; - } -#endif buttonRect.inflateX(inflateX); buttonRect.inflateY(inflateY); diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index 235af260c..b6bfc7c6f 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -127,6 +127,7 @@ SET(WebKit2_SOURCES Platform/CoreIPC/MessageDecoder.cpp Platform/CoreIPC/MessageEncoder.cpp Platform/CoreIPC/MessageReceiverMap.cpp + Platform/CoreIPC/StringReference.cpp PluginProcess/PluginControllerProxy.cpp PluginProcess/PluginCreationParameters.cpp diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index e34143e69..fd2f47ef0 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,495 @@ +2012-10-23 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Make page load client a C++ class + https://bugs.webkit.org/show_bug.cgi?id=100081 + + Reviewed by Kenneth Rohde Christiansen. + + Make page load client a C++ class and move it + up to UIProcess/efl since it is not really part + of the public API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (_ewk_view_initialize): + * UIProcess/API/efl/ewk_view_loader_client_private.h: Removed. + * UIProcess/efl/PageLoadClientEfl.cpp: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp. + (WebKit): + (WebKit::toPageLoadClientEfl): + (WebKit::PageLoadClientEfl::didReceiveTitleForFrame): + (WebKit::PageLoadClientEfl::didReceiveIntentForFrame): + (WebKit::PageLoadClientEfl::registerIntentServiceForFrame): + (WebKit::PageLoadClientEfl::didChangeProgress): + (WebKit::PageLoadClientEfl::didFinishLoadForFrame): + (WebKit::PageLoadClientEfl::didFailLoadWithErrorForFrame): + (WebKit::PageLoadClientEfl::didStartProvisionalLoadForFrame): + (WebKit::PageLoadClientEfl::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::PageLoadClientEfl::didFailProvisionalLoadWithErrorForFrame): + (WebKit::PageLoadClientEfl::didChangeBackForwardList): + (WebKit::PageLoadClientEfl::didSameDocumentNavigationForFrame): + (WebKit::PageLoadClientEfl::PageLoadClientEfl): + * UIProcess/efl/PageLoadClientEfl.h: Added. + (WebKit): + (PageLoadClientEfl): + (WebKit::PageLoadClientEfl::create): + (WebKit::PageLoadClientEfl::view): + +2012-10-22 Anders Carlsson <andersca@apple.com> + + Handle ArgumentCoder template specializations that take the ArgumentEncoder as a reference + https://bugs.webkit.org/show_bug.cgi?id=100056 + + Reviewed by Andreas Kling. + + Use template magic to make it possible to have ArgumentCoder specializations where the encode + function takes the ArgumentEncoder object as a reference instead of as a pointer. Also, add an + operator<< to ArgumentEncoder and change the string related ArgumentCoder specializations over to taking + the encoder as a reference and using stream operators. + + * Platform/CoreIPC/ArgumentCoders.cpp: + (CoreIPC::::encode): + * Platform/CoreIPC/ArgumentCoders.h: + * Platform/CoreIPC/ArgumentEncoder.h: + (ArgumentEncoder): + (UsesDeprecatedEncodeFunction): + (NoType): + (CoreIPC::ArgumentEncoder::encode): + (CoreIPC::ArgumentEncoder::operator<<): + +2012-10-22 Anders Carlsson <andersca@apple.com> + + More Argument coder cleanup + https://bugs.webkit.org/show_bug.cgi?id=100022 + + Reviewed by Andreas Kling. + + Remove the ArgumentDecoder::decode overload that takes a const reference - if the call to decode ends up creating a temporary + we'll encode into it and then destroy it. Since this decode overload was mostly used with the CoreIPC::Out functions, remove them + (and CoreIPC::In) as well. Clean up a couple of ArgumentCoders as well. + + * Platform/CoreIPC/ArgumentCoders.h: + * Platform/CoreIPC/ArgumentDecoder.h: + * Platform/CoreIPC/Arguments.h: + * Platform/CoreIPC/Connection.h: + (Connection): + * Platform/mac/SharedMemoryMac.cpp: + (WebKit::SharedMemory::Handle::decode): + * Shared/PrintInfo.cpp: + (WebKit::PrintInfo::encode): + (WebKit::PrintInfo::decode): + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::encode): + (WebKit::WebContextMenuItemData::decode): + * Shared/WebEvent.cpp: + (WebKit::WebEvent::encode): + (WebKit::WebEvent::decode): + * Shared/WebGeolocationPosition.cpp: + (WebKit::WebGeolocationPosition::Data::encode): + (WebKit::WebGeolocationPosition::Data::decode): + * Shared/WebMouseEvent.cpp: + (WebKit::WebMouseEvent::encode): + (WebKit::WebMouseEvent::decode): + * Shared/WebPopupItem.cpp: + (WebKit::WebPopupItem::encode): + (WebKit::WebPopupItem::decode): + * UIProcess/WebConnectionToWebProcess.cpp: + (WebKit::WebConnectionToWebProcess::decodeMessageBody): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didReceiveMessage): + (WebKit::WebContext::didReceiveSyncMessage): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postMessage): + (WebKit::InjectedBundle::postSynchronousMessage): + * WebProcess/WebConnectionToUIProcess.cpp: + (WebKit::WebConnectionToUIProcess::decodeMessageBody): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::postInjectedBundleMessage): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::postInjectedBundleMessage): + +2012-10-22 Anders Carlsson <andersca@apple.com> + + Remove MessageReceiverMap::deprecatedAddMessageReceiver + https://bugs.webkit.org/show_bug.cgi?id=100012 + + Reviewed by Andreas Kling. + + Get rid of MessageReceiverMap::deprecatedAddMessageReceiver and make callers use addMessageReceiver instead. + Also, remove the message receiver map inside Connection and add a message receiver map to WebProcess instead. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::dispatchMessage): + * Platform/CoreIPC/Connection.h: + (Connection): + * Platform/CoreIPC/MessageReceiverMap.cpp: + (CoreIPC::MessageReceiverMap::invalidate): + (CoreIPC::MessageReceiverMap::dispatchMessage): + (CoreIPC::MessageReceiverMap::dispatchSyncMessage): + * Platform/CoreIPC/MessageReceiverMap.h: + (MessageReceiverMap): + * UIProcess/Notifications/WebNotificationManagerProxy.cpp: + (WebKit::WebNotificationManagerProxy::WebNotificationManagerProxy): + * UIProcess/WebApplicationCacheManagerProxy.cpp: + (WebKit::WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy): + * UIProcess/WebContext.cpp: + * UIProcess/WebContext.h: + (WebContext): + * UIProcess/WebCookieManagerProxy.cpp: + (WebKit::WebCookieManagerProxy::WebCookieManagerProxy): + * UIProcess/WebDatabaseManagerProxy.cpp: + (WebKit::WebDatabaseManagerProxy::WebDatabaseManagerProxy): + * UIProcess/WebGeolocationManagerProxy.cpp: + (WebKit::WebGeolocationManagerProxy::WebGeolocationManagerProxy): + * UIProcess/WebIconDatabase.cpp: + (WebKit::WebIconDatabase::WebIconDatabase): + * UIProcess/WebKeyValueStorageManagerProxy.cpp: + (WebKit::WebKeyValueStorageManagerProxy::WebKeyValueStorageManagerProxy): + * UIProcess/WebMediaCacheManagerProxy.cpp: + (WebKit::WebMediaCacheManagerProxy::WebMediaCacheManagerProxy): + * UIProcess/WebResourceCacheManagerProxy.cpp: + (WebKit::WebResourceCacheManagerProxy::WebResourceCacheManagerProxy): + * WebProcess/Authentication/AuthenticationManager.cpp: + (WebKit::AuthenticationManager::AuthenticationManager): + * WebProcess/Geolocation/WebGeolocationManager.cpp: + (WebKit::WebGeolocationManager::WebGeolocationManager): + (WebKit::WebGeolocationManager::registerWebPage): + * WebProcess/Geolocation/WebGeolocationManager.h: + (WebGeolocationManager): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::addMessageReceiver): + (WebKit): + (WebKit::WebProcess::didReceiveSyncMessage): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + (WebProcess): + +2012-10-22 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] ewk_view_color_picker_color_set() is leaking + https://bugs.webkit.org/show_bug.cgi?id=100007 + + Reviewed by Kenneth Rohde Christiansen. + + Fix a leak in ewk_view_color_picker_color_set() by adopting WKStringRef + returned by WKStringCreateWithUTF8CString(). + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_color_picker_color_set): + +2012-10-22 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Make the resource load client a C++ class + https://bugs.webkit.org/show_bug.cgi?id=99982 + + Reviewed by Kenneth Rohde Christiansen. + + Create a C++ class for the resource load client and + move the id <-> resource mapping from the Ewk_View + to ResourceLoadClientEfl for better a cleaner + separation. + + The resource load client code was also moved out of + UIProcess/API/efl to UIProcess/efl since this is not + part of the WK2 EFL API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (_ewk_view_initialize): + (ewk_view_wkpage_get): + (ewk_view_resource_load_initiated): + (ewk_view_resource_load_response): + (ewk_view_resource_load_failed): + (ewk_view_resource_load_finished): + (ewk_view_resource_request_sent): + (ewk_view_load_provisional_started): + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/API/efl/ewk_view_resource_load_client.cpp: Removed. + * UIProcess/API/efl/ewk_view_resource_load_client_private.h: Removed. + * UIProcess/efl/ResourceLoadClientEfl.cpp: Added. + (WebKit): + (WebKit::toResourceLoadClientEfl): + (WebKit::ResourceLoadClientEfl::didInitiateLoadForResource): + (WebKit::ResourceLoadClientEfl::didSendRequestForResource): + (WebKit::ResourceLoadClientEfl::didReceiveResponseForResource): + (WebKit::ResourceLoadClientEfl::didFinishLoadForResource): + (WebKit::ResourceLoadClientEfl::didFailLoadForResource): + (WebKit::ResourceLoadClientEfl::onViewProvisionalLoadStarted): + (WebKit::ResourceLoadClientEfl::ResourceLoadClientEfl): + (WebKit::ResourceLoadClientEfl::~ResourceLoadClientEfl): + * UIProcess/efl/ResourceLoadClientEfl.h: Added. + (WebKit): + (ResourceLoadClientEfl): + (WebKit::ResourceLoadClientEfl::create): + +2012-10-22 Anders Carlsson <andersca@apple.com> + + [WK2] Regression(r131990): plugins/npruntime/remove-property.html started failing + https://bugs.webkit.org/show_bug.cgi?id=99977 + + Reviewed by Alexey Proskuryakov. + + Remove int32_t casts - the ArgumentDecoder::decode overload that takes a const int would cause + a temporary to be created which the number was then decoded into. + + * Shared/Plugins/NPIdentifierData.cpp: + (WebKit::NPIdentifierData::encode): + (WebKit::NPIdentifierData::decode): + +2012-10-22 Anders Carlsson <andersca@apple.com> + + Don't use CStrings for message receiver names and message names + https://bugs.webkit.org/show_bug.cgi?id=99853 + + Reviewed by Andreas Kling. + + Re-land this with a fix to MessageReceiverMap::dispatchSyncMessage to look in the new global message receivers map. + + Introduce StringReference which is similar to DataReference except it holds a pointer to + length of a char * + and can be created from a string literal. Use this in place of CString in MessageEncoder/MessageDecoder and + make MessageReceiverMap use a HashMap from StringReferences to MessageReceivers for global message receivers. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::createSyncMessageEncoder): + (CoreIPC::Connection::dispatchSyncMessage): + * Platform/CoreIPC/Connection.h: + (Connection): + (CoreIPC::Connection::deprecatedSendSync): + (CoreIPC::Connection::deprecatedSend): + * Platform/CoreIPC/MessageDecoder.cpp: + (CoreIPC::MessageDecoder::MessageDecoder): + * Platform/CoreIPC/MessageDecoder.h: + (CoreIPC::MessageDecoder::messageReceiverName): + (CoreIPC::MessageDecoder::messageName): + (MessageDecoder): + * Platform/CoreIPC/MessageEncoder.cpp: + (CoreIPC::MessageEncoder::create): + (CoreIPC::MessageEncoder::MessageEncoder): + * Platform/CoreIPC/MessageEncoder.h: + (CoreIPC): + (MessageEncoder): + * Platform/CoreIPC/MessageReceiverMap.cpp: + (CoreIPC::MessageReceiverMap::addMessageReceiver): + (CoreIPC): + (CoreIPC::MessageReceiverMap::dispatchMessage): + * Platform/CoreIPC/MessageReceiverMap.h: + (MessageReceiverMap): + * Platform/CoreIPC/StringReference.cpp: Added. + (CoreIPC): + (CoreIPC::StringReference::encode): + (CoreIPC::StringReference::decode): + (CoreIPC::StringReference::Hash::hash): + * Platform/CoreIPC/StringReference.h: Added. + (CoreIPC): + (StringReference): + (CoreIPC::StringReference::StringReference): + (CoreIPC::StringReference::isEmpty): + (CoreIPC::StringReference::size): + (CoreIPC::StringReference::data): + (CoreIPC::StringReference::operator==): + (Hash): + (CoreIPC::StringReference::Hash::equal): + (WTF): + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::open): + * Scripts/webkit2/messages.py: + (message_to_struct_declaration): + (forward_declarations_and_headers): + (generate_messages_header): + * Scripts/webkit2/messages_unittest.py: + * Shared/CoreIPCSupport/WebContextMessageKinds.h: + * Target.pri: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::addMessageReceiver): + (WebKit): + * UIProcess/WebContext.h: + (WebContext): + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::deprecatedSend): + (WebKit::WebProcessProxy::send): + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2012-10-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r132072. + http://trac.webkit.org/changeset/132072 + https://bugs.webkit.org/show_bug.cgi?id=100011 + + Made most of the tests crash on the WK2 bot. (Requested by + rakuco on #webkit). + + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::handleDownloadRequest): + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context): + (Ewk_Context::Ewk_Context): + (ewk_context_ref): + (ewk_context_unref): + (ewk_context_cookie_manager_get): + (ewk_context_favicon_database_get): + (ewk_context_WKContext_get): + (ewk_context_new_from_WKContext): + (ewk_context_download_job_add): + (ewk_context_download_job_get): + (ewk_context_download_job_remove): + (ewk_context_request_manager_get): + (ewk_context_url_scheme_request_received): + (ewk_context_default_get): + (ewk_context_new): + (ewk_context_new_with_injected_bundle_path): + (ewk_context_url_scheme_register): + (ewk_context_vibration_client_callbacks_set): + (ewk_context_history_callbacks_set): + (ewk_context_history_client_get): + (ewk_context_visited_link_add): + (ewk_context_cache_model_set): + (ewk_context_cache_model_get): + * UIProcess/API/efl/ewk_context_download_client.cpp: + (decideDestinationWithSuggestedFilename): + (didReceiveResponse): + (didCreateDestination): + (didReceiveData): + (didFail): + (didCancel): + (didFinish): + (ewk_context_download_client_attach): + * UIProcess/API/efl/ewk_context_history_client.cpp: + (getEwkHistoryDelegate): + (didNavigateWithNavigationData): + (didPerformClientRedirect): + (didPerformServerRedirect): + (didUpdateHistoryTitle): + (populateVisitedLinks): + (ewk_context_history_client_attach): + * UIProcess/API/efl/ewk_context_private.h: + * UIProcess/API/efl/ewk_context_request_manager_client.cpp: + (didReceiveURIRequest): + (ewk_context_request_manager_client_attach): + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (Ewk_View_Private_Data::Ewk_View_Private_Data): + (Ewk_View_Private_Data::~Ewk_View_Private_Data): + (_ewk_view_priv_del): + (_ewk_view_initialize): + (ewk_view_base_add): + (ewk_view_add_with_context): + (ewk_view_context_get): + (ewk_view_update_icon): + +2012-10-22 Darin Adler <darin@apple.com> + + * UIProcess/API/mac/WKView.mm: + (-[WKView view:stringForToolTip:point:userData:]): Fix build. Forgot to save file + before committing. + +2012-10-22 Darin Adler <darin@apple.com> + + REGRESSION (r131686): Crash in NSToolTipManager mouseEnteredToolTip + <rdar://problem/12527528> and https://bugs.webkit.org/show_bug.cgi?id=99792 + + Roll out the tool tip part of r131686 since it still seems to be causing trouble. + + * UIProcess/API/mac/WKView.mm: + (-[WKView view:stringForToolTip:point:userData:]): Added this method back. + (-[WKView _wk_toolTipChangedFrom:to:]): Use self as owner again, eliminating the + separate WKToolTipDelegate object. + +2012-10-22 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Memory leak in Ewk_Form_Submission_Request::fieldValue() + https://bugs.webkit.org/show_bug.cgi?id=99993 + + Reviewed by Kenneth Rohde Christiansen. + + Adopt the WKStringRef returned by toCopiedAPI() in + Ewk_Form_Submission_Request::fieldValue() to avoid + a memory leak. + + * UIProcess/API/efl/ewk_form_submission_request.cpp: + (Ewk_Form_Submission_Request::fieldValue): + +2012-10-22 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Refactor Ewk_Context + https://bugs.webkit.org/show_bug.cgi?id=99594 + + Reviewed by Kenneth Rohde Christiansen. + + Ewk_Context is now encapsulated to a C++ class inherited from WTF::RefCounted. + + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::handleDownloadRequest): + * UIProcess/API/efl/ewk_context.cpp: + (Ewk_Context::Ewk_Context): + (Ewk_Context::~Ewk_Context): + (Ewk_Context::create): + (Ewk_Context::defaultContext): + (Ewk_Context::cookieManager): + (Ewk_Context::faviconDatabase): + (Ewk_Context::registerURLScheme): + (Ewk_Context::vibrationProvider): + (Ewk_Context::addVisitedLink): + (Ewk_Context::setCacheModel): + (Ewk_Context::cacheModel): + (ewk_context_ref): + (ewk_context_unref): + (ewk_context_cookie_manager_get): + (ewk_context_favicon_database_get): + (Ewk_Context::wkContext): + (Ewk_Context::addDownloadJob): + (Ewk_Context::downloadJob): + (Ewk_Context::removeDownloadJob): + (Ewk_Context::requestManager): + (Ewk_Context::urlSchemeRequestReceived): + (ewk_context_default_get): + (ewk_context_new): + (ewk_context_new_with_injected_bundle_path): + (ewk_context_url_scheme_register): + (ewk_context_vibration_client_callbacks_set): + (ewk_context_history_callbacks_set): + (ewk_context_visited_link_add): + (ewk_context_cache_model_set): + (ewk_context_cache_model_get): + * UIProcess/API/efl/ewk_context_download_client.cpp: + (decideDestinationWithSuggestedFilename): + (didReceiveResponse): + (didCreateDestination): + (didReceiveData): + (didFail): + (didCancel): + (didFinish): + (ewk_context_download_client_attach): + * UIProcess/API/efl/ewk_context_history_client.cpp: + (getEwkHistoryClient): + (didNavigateWithNavigationData): + (didPerformClientRedirect): + (didPerformServerRedirect): + (didUpdateHistoryTitle): + (populateVisitedLinks): + (ewk_context_history_client_attach): + * UIProcess/API/efl/ewk_context_private.h: + (Ewk_Context): + (Ewk_Context::create): + (Ewk_Context::historyClient): + * UIProcess/API/efl/ewk_context_request_manager_client.cpp: + (didReceiveURIRequest): + (ewk_context_request_manager_client_attach): + * UIProcess/API/efl/ewk_view.cpp: + (Ewk_View_Private_Data): + (Ewk_View_Private_Data::Ewk_View_Private_Data): + (Ewk_View_Private_Data::~Ewk_View_Private_Data): + (_ewk_view_priv_del): + (_ewk_view_initialize): + (ewk_view_base_add): + (ewk_view_add_with_context): + (ewk_view_context_get): + (ewk_view_update_icon): + 2012-10-22 Simon Hausmann <simon.hausmann@digia.com> [Qt] Fix build without QtWidgets diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index 4cf80f965..416cf26c5 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -266,6 +266,8 @@ webkit2_sources += \ Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp \ Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h \ Source/WebKit2/Platform/CoreIPC/MessageSender.h \ + Source/WebKit2/Platform/CoreIPC/StringReference.cpp \ + Source/WebKit2/Platform/CoreIPC/StringReference.h \ Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp \ Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \ Source/WebKit2/Platform/gtk/LoggingGtk.cpp \ @@ -1234,6 +1236,8 @@ webkit2_plugin_process_sources += \ Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp \ Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h \ Source/WebKit2/Platform/CoreIPC/MessageSender.h \ + Source/WebKit2/Platform/CoreIPC/StringReference.cpp \ + Source/WebKit2/Platform/CoreIPC/StringReference.h \ Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp \ Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \ Source/WebKit2/Platform/Module.cpp \ diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp index f0c17d38e..7153c2748 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp @@ -26,14 +26,15 @@ #include "config.h" #include "ArgumentCoders.h" +#include "DataReference.h" #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> namespace CoreIPC { -void ArgumentCoder<AtomicString>::encode(ArgumentEncoder* encoder, const AtomicString& atomicString) +void ArgumentCoder<AtomicString>::encode(ArgumentEncoder& encoder, const AtomicString& atomicString) { - encoder->encode(atomicString.string()); + encoder << atomicString.string(); } bool ArgumentCoder<AtomicString>::decode(ArgumentDecoder* decoder, AtomicString& atomicString) @@ -46,17 +47,16 @@ bool ArgumentCoder<AtomicString>::decode(ArgumentDecoder* decoder, AtomicString& return true; } -void ArgumentCoder<CString>::encode(ArgumentEncoder* encoder, const CString& string) +void ArgumentCoder<CString>::encode(ArgumentEncoder& encoder, const CString& string) { // Special case the null string. if (string.isNull()) { - encoder->encode(std::numeric_limits<uint32_t>::max()); + encoder << std::numeric_limits<uint32_t>::max(); return; } uint32_t length = string.length(); - encoder->encode(length); - encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.data()), length, 1); + encoder << length << CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(string.data()), length); } bool ArgumentCoder<CString>::decode(ArgumentDecoder* decoder, CString& result) @@ -87,22 +87,23 @@ bool ArgumentCoder<CString>::decode(ArgumentDecoder* decoder, CString& result) } -void ArgumentCoder<String>::encode(ArgumentEncoder* encoder, const String& string) +void ArgumentCoder<String>::encode(ArgumentEncoder& encoder, const String& string) { // Special case the null string. if (string.isNull()) { - encoder->encode(std::numeric_limits<uint32_t>::max()); + encoder << std::numeric_limits<uint32_t>::max(); return; } uint32_t length = string.length(); - encoder->encode(length); bool is8Bit = string.is8Bit(); - encoder->encode(is8Bit); + + encoder << length << is8Bit; + if (is8Bit) - encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar), __alignof(LChar)); + encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar), __alignof(LChar)); else - encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar), __alignof(UChar)); + encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar), __alignof(UChar)); } template <typename CharacterType> diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h index f16d7c92f..339cd2d1e 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h @@ -197,20 +197,20 @@ template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTrai }; template<> struct ArgumentCoder<AtomicString> { - static void encode(ArgumentEncoder*, const AtomicString&); + static void encode(ArgumentEncoder&, const AtomicString&); static bool decode(ArgumentDecoder*, AtomicString&); }; template<> struct ArgumentCoder<CString> { - static void encode(ArgumentEncoder*, const CString&); + static void encode(ArgumentEncoder&, const CString&); static bool decode(ArgumentDecoder*, CString&); }; template<> struct ArgumentCoder<String> { - static void encode(ArgumentEncoder*, const String&); + static void encode(ArgumentEncoder&, const String&); static bool decode(ArgumentDecoder*, String&); }; } // namespace CoreIPC -#endif // SimpleArgumentCoder_h +#endif // ArgumentCoders_h diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h index 3c81eb377..c1d4b6e05 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h @@ -90,13 +90,6 @@ public: return ArgumentCoder<T>::decode(this, t); } - // This overload exists so we can pass temporaries to decode. In the Star Trek future, it - // can take an rvalue reference instead. - template<typename T> bool decode(const T& t) - { - return decode(const_cast<T&>(t)); - } - bool removeAttachment(Attachment&); #ifndef NDEBUG diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h index 54780134a..5fa006fd3 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h @@ -60,13 +60,44 @@ public: encode(static_cast<uint64_t>(t)); } + + template<bool B, typename T = void> + struct EnableIf { }; + + template<typename T> + struct EnableIf<true, T> { typedef T Type; }; - // Generic type encode function. - template<typename T> void encode(const T& t) + template<typename T> class UsesDeprecatedEncodeFunction { + typedef char YesType; + struct NoType { + char padding[8]; + }; + + static YesType checkEncode(void (*)(ArgumentEncoder*, const T&)); + static NoType checkEncode(...); + + public: + static const bool value = sizeof(checkEncode(ArgumentCoder<T>::encode)) == sizeof(YesType); + }; + + // FIXME: This is the function that gets chosen if the argument coder takes the ArgumentEncoder as a pointer. + // This is the deprecated form - get rid of it. + template<typename T> void encode(const T& t, typename EnableIf<UsesDeprecatedEncodeFunction<T>::value>::Type* = 0) { ArgumentCoder<T>::encode(this, t); } + template<typename T> void encode(const T& t, typename EnableIf<!UsesDeprecatedEncodeFunction<T>::value>::Type* = 0) + { + ArgumentCoder<T>::encode(*this, t); + } + + template<typename T> ArgumentEncoder& operator<<(const T& t) + { + encode(t); + return *this; + } + uint8_t* buffer() const { return m_buffer; } size_t bufferSize() const { return m_bufferSize; } diff --git a/Source/WebKit2/Platform/CoreIPC/Arguments.h b/Source/WebKit2/Platform/CoreIPC/Arguments.h index 5bd75502c..1d4c5dc4e 100644 --- a/Source/WebKit2/Platform/CoreIPC/Arguments.h +++ b/Source/WebKit2/Platform/CoreIPC/Arguments.h @@ -45,16 +45,6 @@ struct Arguments0 { } }; -inline Arguments0 In() -{ - return Arguments0(); -} - -inline Arguments0 Out() -{ - return Arguments0(); -} - template<typename T1> struct Arguments1 { typedef Arguments1<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type> ValueType; @@ -80,16 +70,6 @@ template<typename T1> struct Arguments1 { T1 argument1; }; -template<typename T1> Arguments1<const T1&> In(const T1& t1) -{ - return Arguments1<const T1&>(t1); -} - -template<typename T1> Arguments1<T1&> Out(T1& t1) -{ - return Arguments1<T1&>(t1); -} - template<typename T1, typename T2> struct Arguments2 : Arguments1<T1> { typedef Arguments2<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type> ValueType; @@ -121,16 +101,6 @@ template<typename T1, typename T2> struct Arguments2 : Arguments1<T1> { T2 argument2; }; -template<typename T1, typename T2> Arguments2<const T1&, const T2&> In(const T1& t1, const T2& t2) -{ - return Arguments2<const T1&, const T2&>(t1, t2); -} - -template<typename T1, typename T2> Arguments2<T1&, T2&> Out(T1& t1, T2& t2) -{ - return Arguments2<T1&, T2&>(t1, t2); -} - template<typename T1, typename T2, typename T3> struct Arguments3 : Arguments2<T1, T2> { typedef Arguments3<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, @@ -163,16 +133,6 @@ template<typename T1, typename T2, typename T3> struct Arguments3 : Arguments2<T T3 argument3; }; -template<typename T1, typename T2, typename T3> Arguments3<const T1&, const T2&, const T3&> In(const T1& t1, const T2& t2, const T3 &t3) -{ - return Arguments3<const T1&, const T2&, const T3&>(t1, t2, t3); -} - -template<typename T1, typename T2, typename T3> Arguments3<T1&, T2&, T3&> Out(T1& t1, T2& t2, T3& t3) -{ - return Arguments3<T1&, T2&, T3&>(t1, t2, t3); -} - template<typename T1, typename T2, typename T3, typename T4> struct Arguments4 : Arguments3<T1, T2, T3> { typedef Arguments4<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, @@ -206,16 +166,6 @@ template<typename T1, typename T2, typename T3, typename T4> struct Arguments4 : T4 argument4; }; -template<typename T1, typename T2, typename T3, typename T4> Arguments4<const T1&, const T2&, const T3&, const T4&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4) -{ - return Arguments4<const T1&, const T2&, const T3&, const T4&>(t1, t2, t3, t4); -} - -template<typename T1, typename T2, typename T3, typename T4> Arguments4<T1&, T2&, T3&, T4&> Out(T1& t1, T2& t2, T3& t3, T4& t4) -{ - return Arguments4<T1&, T2&, T3&, T4&>(t1, t2, t3, t4); -} - template<typename T1, typename T2, typename T3, typename T4, typename T5> struct Arguments5 : Arguments4<T1, T2, T3, T4> { typedef Arguments5<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, @@ -250,16 +200,6 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5> struct T5 argument5; }; -template<typename T1, typename T2, typename T3, typename T4, typename T5> Arguments5<const T1&, const T2&, const T3&, const T4&, const T5&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5) -{ - return Arguments5<const T1&, const T2&, const T3&, const T4&, const T5&>(t1, t2, t3, t4, t5); -} - -template<typename T1, typename T2, typename T3, typename T4, typename T5> Arguments5<T1&, T2&, T3&, T4&, T5&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5) -{ - return Arguments5<T1&, T2&, T3&, T4&, T5&>(t1, t2, t3, t4, t5); -} - template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct Arguments6 : Arguments5<T1, T2, T3, T4, T5> { typedef Arguments6<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, @@ -295,16 +235,6 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena T6 argument6; }; -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> Arguments6<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6) -{ - return Arguments6<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&>(t1, t2, t3, t4, t5, t6); -} - -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> Arguments6<T1&, T2&, T3&, T4&, T5&, T6&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6) -{ - return Arguments6<T1&, T2&, T3&, T4&, T5&, T6&>(t1, t2, t3, t4, t5, t6); -} - template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> struct Arguments7 : Arguments6<T1, T2, T3, T4, T5, T6> { typedef Arguments7<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, @@ -341,16 +271,6 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena T7 argument7; }; -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> Arguments7<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) -{ - return Arguments7<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&>(t1, t2, t3, t4, t5, t6, t7); -} - -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> Arguments7<T1&, T2&, T3&, T4&, T5&, T6&, T7&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7) -{ - return Arguments7<T1&, T2&, T3&, T4&, T5&, T6&, T7&>(t1, t2, t3, t4, t5, t6, t7); -} - template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct Arguments8 : Arguments7<T1, T2, T3, T4, T5, T6, T7> { typedef Arguments8<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, @@ -386,16 +306,6 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena T8 argument8; }; -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> Arguments8<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) -{ - return Arguments8<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&>(t1, t2, t3, t4, t5, t6, t7, t8); -} - -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> Arguments8<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8) -{ - return Arguments8<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>(t1, t2, t3, t4, t5, t6, t7, t8); -} - template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> struct Arguments10 : Arguments8<T1, T2, T3, T4, T5, T6, T7, T8> { typedef Arguments10<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, @@ -437,16 +347,6 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena T10 argument10; }; -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> Arguments10<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&, const T9&, const T10&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10) -{ - return Arguments10<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&, const T9&, const T10&>(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10); -} - -template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> Arguments10<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9, T10& t10) -{ - return Arguments10<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&>(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10); -} - } // namespace CoreIPC #endif // Arguments_h diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp index b9f8fcfdc..934583417 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp @@ -283,7 +283,7 @@ void Connection::markCurrentlyDispatchedMessageAsInvalid() m_didReceiveInvalidMessage = true; } -PassOwnPtr<MessageEncoder> Connection::createSyncMessageEncoder(const CString& messageReceiverName, const CString& messageName, uint64_t destinationID, uint64_t& syncRequestID) +PassOwnPtr<MessageEncoder> Connection::createSyncMessageEncoder(const StringReference messageReceiverName, const StringReference messageName, uint64_t destinationID, uint64_t& syncRequestID) { OwnPtr<MessageEncoder> encoder = MessageEncoder::create(messageReceiverName, messageName, destinationID); @@ -626,7 +626,7 @@ void Connection::dispatchSyncMessage(MessageID messageID, MessageDecoder& decode return; } - OwnPtr<MessageEncoder> replyEncoder = MessageEncoder::create("", "", syncRequestID); + OwnPtr<MessageEncoder> replyEncoder = MessageEncoder::create("IPC", "", syncRequestID); // Hand off both the decoder and encoder to the client. m_client->didReceiveSyncMessage(this, messageID, decoder, replyEncoder); @@ -656,10 +656,6 @@ void Connection::enqueueIncomingMessage(IncomingMessage& incomingMessage) void Connection::dispatchMessage(MessageID messageID, MessageDecoder& decoder) { - // Try the message receiver map first. - if (m_messageReceiverMap.dispatchMessage(this, messageID, decoder)) - return; - m_client->didReceiveMessage(this, messageID, decoder); } diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h index fb42d9e72..4a7a3a818 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.h +++ b/Source/WebKit2/Platform/CoreIPC/Connection.h @@ -32,7 +32,6 @@ #include "MessageDecoder.h" #include "MessageEncoder.h" #include "MessageReceiver.h" -#include "MessageReceiverMap.h" #include "WorkQueue.h" #include <wtf/PassRefPtr.h> #include <wtf/OwnPtr.h> @@ -174,11 +173,6 @@ public: void addQueueClient(QueueClient*); void removeQueueClient(QueueClient*); - void deprecatedAddMessageReceiver(MessageClass messageClass, MessageReceiver* messageReceiver) - { - m_messageReceiverMap.deprecatedAddMessageReceiver(messageClass, messageReceiver); - } - bool open(); void invalidate(); void markCurrentlyDispatchedMessageAsInvalid(); @@ -191,8 +185,9 @@ public: template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = NoTimeout, unsigned syncSendFlags = 0); template<typename T> bool waitForAndDispatchImmediately(uint64_t destinationID, double timeout); - PassOwnPtr<MessageEncoder> createSyncMessageEncoder(const CString& messageReceiverName, const CString& messageName, uint64_t destinationID, uint64_t& syncRequestID); + PassOwnPtr<MessageEncoder> createSyncMessageEncoder(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, uint64_t& syncRequestID); bool sendMessage(MessageID, PassOwnPtr<MessageEncoder>, unsigned messageSendFlags = 0); + PassOwnPtr<MessageDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, PassOwnPtr<MessageEncoder>, double timeout, unsigned syncSendFlags = 0); bool sendSyncReply(PassOwnPtr<MessageEncoder>); // FIXME: These variants of send, sendSync and waitFor are all deprecated. @@ -254,7 +249,6 @@ private: PassOwnPtr<MessageDecoder> waitForMessage(MessageID, uint64_t destinationID, double timeout); - PassOwnPtr<MessageDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, PassOwnPtr<MessageEncoder>, double timeout, unsigned syncSendFlags = 0); PassOwnPtr<MessageDecoder> waitForSyncReply(uint64_t syncRequestID, double timeout, unsigned syncSendFlags); // Called on the connection work queue. @@ -305,8 +299,6 @@ private: Mutex m_incomingMessagesLock; Deque<IncomingMessage> m_incomingMessages; - MessageReceiverMap m_messageReceiverMap; - // Outgoing messages. Mutex m_outgoingMessagesLock; Deque<OutgoingMessage> m_outgoingMessages; @@ -450,7 +442,7 @@ template<typename E, typename T, typename U> inline bool Connection::deprecatedSendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout) { uint64_t syncRequestID = 0; - OwnPtr<MessageEncoder> encoder = createSyncMessageEncoder("", "", destinationID, syncRequestID); + OwnPtr<MessageEncoder> encoder = createSyncMessageEncoder(CoreIPC::MessageKindTraits<E>::messageReceiverName(), "", destinationID, syncRequestID); // Encode the input arguments. encoder->encode(arguments); @@ -467,7 +459,7 @@ inline bool Connection::deprecatedSendSync(E messageID, uint64_t destinationID, template<typename E, typename T> bool Connection::deprecatedSend(E messageID, uint64_t destinationID, const T& arguments) { - OwnPtr<MessageEncoder> encoder = MessageEncoder::create("", "", destinationID); + OwnPtr<MessageEncoder> encoder = MessageEncoder::create(CoreIPC::MessageKindTraits<E>::messageReceiverName(), "", destinationID); encoder->encode(arguments); return sendMessage(MessageID(messageID), encoder.release()); diff --git a/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp b/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp index e0aef3525..416cf1edb 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp +++ b/Source/WebKit2/Platform/CoreIPC/MessageDecoder.cpp @@ -28,7 +28,7 @@ #include "ArgumentCoders.h" #include "DataReference.h" -#include <wtf/text/CString.h> +#include "StringReference.h" namespace CoreIPC { @@ -50,12 +50,10 @@ MessageDecoder::~MessageDecoder() MessageDecoder::MessageDecoder(const DataReference& buffer, Deque<Attachment>& attachments) : ArgumentDecoder(buffer.data(), buffer.size(), attachments) { - CString messageReceiverName; - if (!decode(messageReceiverName)) + if (!decode(m_messageReceiverName)) return; - CString messageName; - if (!decode(messageName)) + if (!decode(m_messageName)) return; decodeUInt64(m_destinationID); diff --git a/Source/WebKit2/Platform/CoreIPC/MessageDecoder.h b/Source/WebKit2/Platform/CoreIPC/MessageDecoder.h index 848c9b4b9..9707a6ee0 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageDecoder.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageDecoder.h @@ -27,6 +27,7 @@ #define MessageDecoder_h #include "ArgumentDecoder.h" +#include "StringReference.h" namespace CoreIPC { @@ -38,8 +39,14 @@ public: static PassOwnPtr<MessageDecoder> create(const DataReference& buffer, Deque<Attachment>&); virtual ~MessageDecoder(); + StringReference messageReceiverName() const { return m_messageReceiverName; } + StringReference messageName() const { return m_messageName; } + private: MessageDecoder(const DataReference& buffer, Deque<Attachment>&); + + StringReference m_messageReceiverName; + StringReference m_messageName; }; } // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp b/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp index 53858b6eb..fbed562dc 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp +++ b/Source/WebKit2/Platform/CoreIPC/MessageEncoder.cpp @@ -27,16 +27,19 @@ #include "MessageEncoder.h" #include "ArgumentCoders.h" +#include "StringReference.h" namespace CoreIPC { -PassOwnPtr<MessageEncoder> MessageEncoder::create(const CString& messageReceiverName, const CString& messageName, uint64_t destinationID) +PassOwnPtr<MessageEncoder> MessageEncoder::create(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID) { return adoptPtr(new MessageEncoder(messageReceiverName, messageName, destinationID)); } -MessageEncoder::MessageEncoder(const CString& messageReceiverName, const CString& messageName, uint64_t destinationID) +MessageEncoder::MessageEncoder(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID) { + ASSERT(!messageReceiverName.isEmpty()); + encode(messageReceiverName); encode(messageName); encode(destinationID); diff --git a/Source/WebKit2/Platform/CoreIPC/MessageEncoder.h b/Source/WebKit2/Platform/CoreIPC/MessageEncoder.h index 2a87850b9..029929245 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageEncoder.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageEncoder.h @@ -31,13 +31,15 @@ namespace CoreIPC { +class StringReference; + class MessageEncoder : public ArgumentEncoder { public: - static PassOwnPtr<MessageEncoder> create(const CString& messageReceiverName, const CString& messageName, uint64_t destinationID); + static PassOwnPtr<MessageEncoder> create(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID); virtual ~MessageEncoder(); private: - MessageEncoder(const CString& messageReceiverName, const CString& messageName, uint64_t destinationID); + MessageEncoder(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID); }; diff --git a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp index 50ab296ec..f123b3dda 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp +++ b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "MessageReceiverMap.h" +#include "MessageDecoder.h" #include "MessageReceiver.h" namespace CoreIPC { @@ -38,20 +39,20 @@ MessageReceiverMap::~MessageReceiverMap() { } -void MessageReceiverMap::deprecatedAddMessageReceiver(MessageClass messageClass, MessageReceiver* messageReceiver) +void MessageReceiverMap::addMessageReceiver(StringReference messageReceiverName, MessageReceiver* messageReceiver) { - ASSERT(!m_deprecatedGlobalMessageReceivers.contains(messageClass)); - m_deprecatedGlobalMessageReceivers.set(messageClass, messageReceiver); + ASSERT(!m_globalMessageReceivers.contains(messageReceiverName)); + m_globalMessageReceivers.set(messageReceiverName, messageReceiver); } void MessageReceiverMap::invalidate() { - m_deprecatedGlobalMessageReceivers.clear(); + m_globalMessageReceivers.clear(); } bool MessageReceiverMap::dispatchMessage(Connection* connection, MessageID messageID, MessageDecoder& decoder) { - if (MessageReceiver* messageReceiver = m_deprecatedGlobalMessageReceivers.get(messageID.messageClass())) { + if (MessageReceiver* messageReceiver = m_globalMessageReceivers.get(decoder.messageReceiverName())) { messageReceiver->didReceiveMessage(connection, messageID, decoder); return true; } @@ -61,7 +62,7 @@ bool MessageReceiverMap::dispatchMessage(Connection* connection, MessageID messa bool MessageReceiverMap::dispatchSyncMessage(Connection* connection, MessageID messageID, MessageDecoder& decoder, OwnPtr<MessageEncoder>& replyEncoder) { - if (MessageReceiver* messageReceiver = m_deprecatedGlobalMessageReceivers.get(messageID.messageClass())) { + if (MessageReceiver* messageReceiver = m_globalMessageReceivers.get(decoder.messageReceiverName())) { messageReceiver->didReceiveSyncMessage(connection, messageID, decoder, replyEncoder); return true; } diff --git a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h index c9240e416..3844ef1b5 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h @@ -27,6 +27,7 @@ #define MessageReceiverMap_h #include "MessageID.h" +#include "StringReference.h" #include <wtf/HashMap.h> #include <wtf/text/CString.h> @@ -42,8 +43,7 @@ public: MessageReceiverMap(); ~MessageReceiverMap(); - // FIXME: Stop using this deprecated function and get rid of it. - void deprecatedAddMessageReceiver(MessageClass, MessageReceiver*); + void addMessageReceiver(StringReference messageReceiverName, MessageReceiver*); void invalidate(); @@ -52,7 +52,7 @@ public: private: // Message receivers that don't require a destination ID. - HashMap<unsigned, MessageReceiver*> m_deprecatedGlobalMessageReceivers; + HashMap<StringReference, MessageReceiver*> m_globalMessageReceivers; }; }; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h b/Source/WebKit2/Platform/CoreIPC/StringReference.cpp index 615c019fc..56e8c1a37 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h +++ b/Source/WebKit2/Platform/CoreIPC/StringReference.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,12 +23,36 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ewk_view_loader_client_private_h -#define ewk_view_loader_client_private_h +#include "config.h" +#include "StringReference.h" -#include <Evas.h> -#include <WebKit2/WKBase.h> +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "DataReference.h" +#include <wtf/StringHasher.h> -void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView); +namespace CoreIPC { -#endif // ewk_view_loader_client_private_h +void StringReference::encode(ArgumentEncoder* encoder) const +{ + encoder->encodeVariableLengthByteArray(DataReference(reinterpret_cast<const uint8_t*>(m_data), m_size)); +} + +bool StringReference::decode(ArgumentDecoder* decoder, StringReference& result) +{ + DataReference dataReference; + if (!decoder->decodeVariableLengthByteArray(dataReference)) + return false; + + result.m_data = reinterpret_cast<const char*>(dataReference.data()); + result.m_size = dataReference.size(); + + return true; +} + +unsigned StringReference::Hash::hash(const StringReference& a) +{ + return StringHasher::computeHash(reinterpret_cast<const unsigned char*>(a.data()), a.size()); +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/StringReference.h b/Source/WebKit2/Platform/CoreIPC/StringReference.h new file mode 100644 index 000000000..ed482e53f --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/StringReference.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef StringReference_h +#define StringReference_h + +#include <wtf/HashTraits.h> + +namespace CoreIPC { + +class ArgumentEncoder; +class ArgumentDecoder; + +class StringReference { +public: + StringReference() + : m_data(0) + , m_size(0) + { + } + + StringReference(const char* data, size_t size) + : m_data(data) + , m_size(size) + { + } + + template<size_t length> + StringReference(const char (&string)[length]) + : m_data(string) + , m_size(length - 1) + { + } + + bool isEmpty() const { return !m_size; } + + size_t size() const { return m_size; } + const char* data() const { return m_data; } + + friend bool operator==(const StringReference& a, const StringReference& b) + { + return a.m_size == b.m_size && !memcmp(a.m_data, b.m_data, a.m_size); + } + + void encode(ArgumentEncoder*) const; + static bool decode(ArgumentDecoder*, StringReference&); + + struct Hash { + static unsigned hash(const StringReference& a); + static bool equal(const StringReference& a, const StringReference& b) { return a == b; } + static const bool safeToCompareToEmptyOrDeleted = true; + }; + +private: + const char* m_data; + size_t m_size; +}; + +} // namespace CoreIPC + +namespace WTF { +template<typename T> struct DefaultHash; + +template<> struct DefaultHash<CoreIPC::StringReference> { + typedef CoreIPC::StringReference::Hash Hash; +}; + +template<> struct HashTraits<CoreIPC::StringReference> : GenericHashTraits<CoreIPC::StringReference> { + static const bool emptyValueIsZero = 0; + static void constructDeletedValue(CoreIPC::StringReference& stringReference) { stringReference = CoreIPC::StringReference(0, std::numeric_limits<size_t>::max()); } + static bool isDeletedValue(const CoreIPC::StringReference& stringReference) { return stringReference.size() == std::numeric_limits<size_t>::max(); } +}; + +} // namespace WTF + +#endif // StringReference_h diff --git a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp index c13b23ba5..17d8ecbc8 100644 --- a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp +++ b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp @@ -112,7 +112,7 @@ bool Connection::open() m_isConnected = true; // Send the initialize message, which contains a send right for the server to use. - OwnPtr<MessageEncoder> encoder = MessageEncoder::create("", "", 0); + OwnPtr<MessageEncoder> encoder = MessageEncoder::create("IPC", "", 0); encoder->encode(MachPort(m_receivePort, MACH_MSG_TYPE_MAKE_SEND)); sendMessage(MessageID(CoreIPCMessage::InitializeConnection), encoder.release()); @@ -131,7 +131,7 @@ bool Connection::open() if (m_exceptionPort) { m_connectionQueue.registerMachPortEventHandler(m_exceptionPort, WorkQueue::MachPortDataAvailable, bind(&Connection::exceptionSourceEventHandler, this)); - OwnPtr<MessageEncoder> encoder = MessageEncoder::create("", "", 0); + OwnPtr<MessageEncoder> encoder = MessageEncoder::create("IPC", "", 0); encoder->encode(MachPort(m_exceptionPort, MACH_MSG_TYPE_MAKE_SEND)); sendMessage(MessageID(CoreIPCMessage::SetExceptionPort), encoder.release()); diff --git a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp index 338192240..4019a8d85 100644 --- a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp +++ b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp @@ -72,7 +72,7 @@ bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& han return false; CoreIPC::MachPort machPort; - if (!decoder->decode(CoreIPC::Out(machPort))) + if (!decoder->decode(machPort)) return false; handle.m_size = size; diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 519adfb47..3b062ae11 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -73,13 +73,13 @@ LIST(APPEND WebKit2_SOURCES UIProcess/API/efl/ewk_view.cpp UIProcess/API/efl/ewk_view_find_client.cpp UIProcess/API/efl/ewk_view_form_client.cpp - UIProcess/API/efl/ewk_view_loader_client.cpp UIProcess/API/efl/ewk_view_policy_client.cpp - UIProcess/API/efl/ewk_view_resource_load_client.cpp UIProcess/API/efl/ewk_view_ui_client.cpp UIProcess/cairo/BackingStoreCairo.cpp + UIProcess/efl/PageLoadClientEfl.cpp + UIProcess/efl/ResourceLoadClientEfl.cpp UIProcess/efl/TextCheckerEfl.cpp UIProcess/efl/WebContextEfl.cpp UIProcess/efl/WebFullScreenManagerProxyEfl.cpp diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py index 4584a8531..f1cd50389 100644 --- a/Source/WebKit2/Scripts/webkit2/messages.py +++ b/Source/WebKit2/Scripts/webkit2/messages.py @@ -129,8 +129,8 @@ def message_to_struct_declaration(message): result.append('struct %s : %s' % (message.name, base_class(message))) result.append(' {\n') result.append(' static const Kind messageID = %s;\n' % message.id()) - result.append(' static const char* receiverName() { return messageReceiverName(); }\n') - result.append(' static const char* name() { return "%s"; }\n' % message.name) + result.append(' static CoreIPC::StringReference receiverName() { return messageReceiverName(); }\n') + result.append(' static CoreIPC::StringReference name() { return CoreIPC::StringReference("%s"); }\n' % message.name) result.append('\n') if message.reply_parameters != None: if message.has_attribute(DELAYED_ATTRIBUTE): @@ -229,6 +229,7 @@ def forward_declarations_and_headers(receiver): '"Arguments.h"', '"MessageEncoder.h"', '"MessageID.h"', + '"StringReference.h"', ]) for message in receiver.messages: @@ -284,9 +285,9 @@ def generate_messages_header(file): result.append('namespace Messages {\nnamespace %s {\n' % receiver.name) result.append('\n') - result.append('static inline const char* messageReceiverName()\n') + result.append('static inline CoreIPC::StringReference messageReceiverName()\n') result.append('{\n') - result.append(' return "%s";\n' % receiver.name) + result.append(' return CoreIPC::StringReference("%s");\n' % receiver.name) result.append('}\n') result.append('\n') diff --git a/Source/WebKit2/Scripts/webkit2/messages_unittest.py b/Source/WebKit2/Scripts/webkit2/messages_unittest.py index e8d190d45..f4fa1eee8 100644 --- a/Source/WebKit2/Scripts/webkit2/messages_unittest.py +++ b/Source/WebKit2/Scripts/webkit2/messages_unittest.py @@ -318,6 +318,7 @@ _expected_header = """/* #include "MessageEncoder.h" #include "MessageID.h" #include "Plugin.h" +#include "StringReference.h" #include <WebCore/KeyboardEvent.h> #include <WebCore/PluginData.h> #include <wtf/ThreadSafeRefCounted.h> @@ -341,9 +342,9 @@ namespace WebKit { namespace Messages { namespace WebPage { -static inline const char* messageReceiverName() +static inline CoreIPC::StringReference messageReceiverName() { - return "WebPage"; + return CoreIPC::StringReference("WebPage"); } enum Kind { @@ -379,8 +380,8 @@ enum Kind { struct LoadURL : CoreIPC::Arguments1<const WTF::String&> { static const Kind messageID = LoadURLID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "LoadURL"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("LoadURL"); } typedef CoreIPC::Arguments1<const WTF::String&> DecodeType; explicit LoadURL(const WTF::String& url) @@ -392,8 +393,8 @@ struct LoadURL : CoreIPC::Arguments1<const WTF::String&> { #if ENABLE(TOUCH_EVENTS) struct TouchEvent : CoreIPC::Arguments1<const WebKit::WebTouchEvent&> { static const Kind messageID = TouchEventID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "TouchEvent"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("TouchEvent"); } typedef CoreIPC::Arguments1<const WebKit::WebTouchEvent&> DecodeType; explicit TouchEvent(const WebKit::WebTouchEvent& event) @@ -405,8 +406,8 @@ struct TouchEvent : CoreIPC::Arguments1<const WebKit::WebTouchEvent&> { struct DidReceivePolicyDecision : CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t> { static const Kind messageID = DidReceivePolicyDecisionID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "DidReceivePolicyDecision"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("DidReceivePolicyDecision"); } typedef CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t> DecodeType; DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction) @@ -417,16 +418,16 @@ struct DidReceivePolicyDecision : CoreIPC::Arguments3<uint64_t, uint64_t, uint32 struct Close : CoreIPC::Arguments0 { static const Kind messageID = CloseID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "Close"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("Close"); } typedef CoreIPC::Arguments0 DecodeType; }; struct PreferencesDidChange : CoreIPC::Arguments1<const WebKit::WebPreferencesStore&> { static const Kind messageID = PreferencesDidChangeID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "PreferencesDidChange"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("PreferencesDidChange"); } typedef CoreIPC::Arguments1<const WebKit::WebPreferencesStore&> DecodeType; explicit PreferencesDidChange(const WebKit::WebPreferencesStore& store) @@ -437,8 +438,8 @@ struct PreferencesDidChange : CoreIPC::Arguments1<const WebKit::WebPreferencesSt struct SendDoubleAndFloat : CoreIPC::Arguments2<double, float> { static const Kind messageID = SendDoubleAndFloatID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "SendDoubleAndFloat"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("SendDoubleAndFloat"); } typedef CoreIPC::Arguments2<double, float> DecodeType; SendDoubleAndFloat(double d, float f) @@ -449,8 +450,8 @@ struct SendDoubleAndFloat : CoreIPC::Arguments2<double, float> { struct SendInts : CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vector<uint64_t> >&> { static const Kind messageID = SendIntsID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "SendInts"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("SendInts"); } typedef CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vector<uint64_t> >&> DecodeType; SendInts(const Vector<uint64_t>& ints, const Vector<Vector<uint64_t> >& intVectors) @@ -461,8 +462,8 @@ struct SendInts : CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vect struct CreatePlugin : CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&> { static const Kind messageID = CreatePluginID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "CreatePlugin"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("CreatePlugin"); } typedef CoreIPC::Arguments1<bool&> Reply; typedef CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&> DecodeType; @@ -474,8 +475,8 @@ struct CreatePlugin : CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parame struct RunJavaScriptAlert : CoreIPC::Arguments2<uint64_t, const WTF::String&> { static const Kind messageID = RunJavaScriptAlertID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "RunJavaScriptAlert"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("RunJavaScriptAlert"); } typedef CoreIPC::Arguments0 Reply; typedef CoreIPC::Arguments2<uint64_t, const WTF::String&> DecodeType; @@ -487,8 +488,8 @@ struct RunJavaScriptAlert : CoreIPC::Arguments2<uint64_t, const WTF::String&> { struct GetPlugins : CoreIPC::Arguments1<bool> { static const Kind messageID = GetPluginsID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "GetPlugins"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("GetPlugins"); } typedef CoreIPC::Arguments1<Vector<WebCore::PluginInfo>&> Reply; typedef CoreIPC::Arguments1<bool> DecodeType; @@ -500,8 +501,8 @@ struct GetPlugins : CoreIPC::Arguments1<bool> { struct GetPluginProcessConnection : CoreIPC::Arguments1<const WTF::String&> { static const Kind messageID = GetPluginProcessConnectionID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "GetPluginProcessConnection"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("GetPluginProcessConnection"); } struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> { DelayedReply(PassRefPtr<CoreIPC::Connection>, PassOwnPtr<CoreIPC::MessageEncoder>); @@ -524,8 +525,8 @@ struct GetPluginProcessConnection : CoreIPC::Arguments1<const WTF::String&> { struct TestMultipleAttributes : CoreIPC::Arguments0 { static const Kind messageID = TestMultipleAttributesID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "TestMultipleAttributes"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("TestMultipleAttributes"); } struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> { DelayedReply(PassRefPtr<CoreIPC::Connection>, PassOwnPtr<CoreIPC::MessageEncoder>); @@ -544,8 +545,8 @@ struct TestMultipleAttributes : CoreIPC::Arguments0 { struct TestConnectionQueue : CoreIPC::Arguments1<uint64_t> { static const Kind messageID = TestConnectionQueueID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "TestConnectionQueue"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("TestConnectionQueue"); } typedef CoreIPC::Arguments1<uint64_t> DecodeType; explicit TestConnectionQueue(uint64_t pluginID) @@ -556,8 +557,8 @@ struct TestConnectionQueue : CoreIPC::Arguments1<uint64_t> { struct TestParameterAttributes : CoreIPC::Arguments3<uint64_t, double, double> { static const Kind messageID = TestParameterAttributesID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "TestParameterAttributes"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("TestParameterAttributes"); } typedef CoreIPC::Arguments3<uint64_t, double, double> DecodeType; TestParameterAttributes(uint64_t foo, double bar, double baz) @@ -569,8 +570,8 @@ struct TestParameterAttributes : CoreIPC::Arguments3<uint64_t, double, double> { #if PLATFORM(MAC) struct DidCreateWebProcessConnection : CoreIPC::Arguments1<const CoreIPC::MachPort&> { static const Kind messageID = DidCreateWebProcessConnectionID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "DidCreateWebProcessConnection"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("DidCreateWebProcessConnection"); } typedef CoreIPC::Arguments1<const CoreIPC::MachPort&> DecodeType; explicit DidCreateWebProcessConnection(const CoreIPC::MachPort& connectionIdentifier) @@ -583,8 +584,8 @@ struct DidCreateWebProcessConnection : CoreIPC::Arguments1<const CoreIPC::MachPo #if PLATFORM(MAC) struct InterpretKeyEvent : CoreIPC::Arguments1<uint32_t> { static const Kind messageID = InterpretKeyEventID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "InterpretKeyEvent"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("InterpretKeyEvent"); } typedef CoreIPC::Arguments1<Vector<WebCore::KeypressCommand>&> Reply; typedef CoreIPC::Arguments1<uint32_t> DecodeType; @@ -598,8 +599,8 @@ struct InterpretKeyEvent : CoreIPC::Arguments1<uint32_t> { #if ENABLE(DEPRECATED_FEATURE) struct DeprecatedOperation : CoreIPC::Arguments1<const CoreIPC::DummyType&> { static const Kind messageID = DeprecatedOperationID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "DeprecatedOperation"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("DeprecatedOperation"); } typedef CoreIPC::Arguments1<const CoreIPC::DummyType&> DecodeType; explicit DeprecatedOperation(const CoreIPC::DummyType& dummy) @@ -612,8 +613,8 @@ struct DeprecatedOperation : CoreIPC::Arguments1<const CoreIPC::DummyType&> { #if ENABLE(EXPERIMENTAL_FEATURE) struct ExperimentalOperation : CoreIPC::Arguments1<const CoreIPC::DummyType&> { static const Kind messageID = ExperimentalOperationID; - static const char* receiverName() { return messageReceiverName(); } - static const char* name() { return "ExperimentalOperation"; } + static CoreIPC::StringReference receiverName() { return messageReceiverName(); } + static CoreIPC::StringReference name() { return CoreIPC::StringReference("ExperimentalOperation"); } typedef CoreIPC::Arguments1<const CoreIPC::DummyType&> DecodeType; explicit ExperimentalOperation(const CoreIPC::DummyType& dummy) diff --git a/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h index e8194b587..631d053eb 100644 --- a/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h +++ b/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h @@ -29,6 +29,7 @@ // Messages sent from the injected bundle to the WebContext. #include "MessageID.h" +#include "StringReference.h" namespace WebContextLegacyMessage { @@ -43,6 +44,10 @@ namespace CoreIPC { template<> struct MessageKindTraits<WebContextLegacyMessage::Kind> { static const MessageClass messageClass = MessageClassWebContextLegacy; + static StringReference messageReceiverName() + { + return StringReference("WebContextLegacyMessage"); + } }; } diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp index 747172504..ff2bef140 100644 --- a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp +++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp @@ -73,7 +73,7 @@ void NPIdentifierData::encode(CoreIPC::ArgumentEncoder* encoder) const if (m_isString) encoder->encode(m_string); else - encoder->encode(static_cast<int32_t>(m_number)); + encoder->encode(m_number); } bool NPIdentifierData::decode(CoreIPC::ArgumentDecoder* decoder, NPIdentifierData& result) @@ -84,7 +84,7 @@ bool NPIdentifierData::decode(CoreIPC::ArgumentDecoder* decoder, NPIdentifierDat if (result.m_isString) return decoder->decode(result.m_string); - return decoder->decode(static_cast<int32_t>(result.m_number)); + return decoder->decode(result.m_number); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/PrintInfo.cpp b/Source/WebKit2/Shared/PrintInfo.cpp index ce11935ad..107884a07 100644 --- a/Source/WebKit2/Shared/PrintInfo.cpp +++ b/Source/WebKit2/Shared/PrintInfo.cpp @@ -45,7 +45,10 @@ PrintInfo::PrintInfo() void PrintInfo::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(pageSetupScaleFactor, availablePaperWidth, availablePaperHeight)); + encoder->encode(pageSetupScaleFactor); + encoder->encode(availablePaperWidth); + encoder->encode(availablePaperHeight); + #if PLATFORM(GTK) CoreIPC::encode(encoder, printSettings.get()); CoreIPC::encode(encoder, pageSetup.get()); @@ -54,7 +57,11 @@ void PrintInfo::encode(CoreIPC::ArgumentEncoder* encoder) const bool PrintInfo::decode(CoreIPC::ArgumentDecoder* decoder, PrintInfo& info) { - if (!decoder->decode(CoreIPC::Out(info.pageSetupScaleFactor, info.availablePaperWidth, info.availablePaperHeight))) + if (!decoder->decode(info.pageSetupScaleFactor)) + return false; + if (!decoder->decode(info.availablePaperWidth)) + return false; + if (!decoder->decode(info.availablePaperHeight)) return false; #if PLATFORM(GTK) diff --git a/Source/WebKit2/Shared/WebBatteryStatus.cpp b/Source/WebKit2/Shared/WebBatteryStatus.cpp index c8d806da9..30a5e59a1 100644 --- a/Source/WebKit2/Shared/WebBatteryStatus.cpp +++ b/Source/WebKit2/Shared/WebBatteryStatus.cpp @@ -47,12 +47,24 @@ WebBatteryStatus::~WebBatteryStatus() void WebBatteryStatus::Data::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(isCharging, chargingTime, dischargingTime, level)); + encoder->encode(isCharging); + encoder->encode(chargingTime); + encoder->encode(dischargingTime); + encoder->encode(level); } -bool WebBatteryStatus::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& data) +bool WebBatteryStatus::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& result) { - return decoder->decode(CoreIPC::Out(data.isCharging, data.chargingTime, data.dischargingTime, data.level)); + if (!decoder->decode(result.isCharging)) + return false; + if (!decoder->decode(result.chargingTime)) + return false; + if (!decoder->decode(result.dischargingTime)) + return false; + if (!decoder->decode(result.level)) + return false; + + return true; } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.cpp b/Source/WebKit2/Shared/WebContextMenuItemData.cpp index 1eb1c495b..901ce9c47 100644 --- a/Source/WebKit2/Shared/WebContextMenuItemData.cpp +++ b/Source/WebKit2/Shared/WebContextMenuItemData.cpp @@ -106,29 +106,48 @@ void WebContextMenuItemData::setUserData(APIObject* userData) void WebContextMenuItemData::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), static_cast<uint32_t>(m_action), m_title, m_checked, m_enabled, m_submenu)); + encoder->encodeEnum(m_type); + encoder->encodeEnum(m_action); + encoder->encode(m_title); + encoder->encode(m_checked); + encoder->encode(m_enabled); + encoder->encode(m_submenu); } bool WebContextMenuItemData::decode(CoreIPC::ArgumentDecoder* decoder, WebContextMenuItemData& item) { - uint32_t type; - uint32_t action; + WebCore::ContextMenuItemType type; + if (!decoder->decodeEnum(type)) + return false; + + WebCore::ContextMenuAction action; + if (!decoder->decodeEnum(action)) + return false; + String title; + if (!decoder->decode(title)) + return false; + bool checked; + if (!decoder->decode(checked)) + return false; + bool enabled; - Vector<WebContextMenuItemData> submenu; + if (!decoder->decode(enabled)) + return false; - if (!decoder->decode(CoreIPC::Out(type, action, title, checked, enabled, submenu))) + Vector<WebContextMenuItemData> submenu; + if (!decoder->decode(submenu)) return false; switch (type) { case WebCore::ActionType: case WebCore::SeparatorType: case WebCore::CheckableActionType: - item = WebContextMenuItemData(static_cast<WebCore::ContextMenuItemType>(type), static_cast<WebCore::ContextMenuAction>(action), title, enabled, checked); + item = WebContextMenuItemData(type, action, title, enabled, checked); break; case WebCore::SubmenuType: - item = WebContextMenuItemData(static_cast<WebCore::ContextMenuAction>(action), title, enabled, submenu); + item = WebContextMenuItemData(action, title, enabled, submenu); break; default: ASSERT_NOT_REACHED(); diff --git a/Source/WebKit2/Shared/WebEvent.cpp b/Source/WebKit2/Shared/WebEvent.cpp index 8edc3fd35..70bffa2c1 100644 --- a/Source/WebKit2/Shared/WebEvent.cpp +++ b/Source/WebKit2/Shared/WebEvent.cpp @@ -48,12 +48,20 @@ WebEvent::WebEvent(Type type, Modifiers modifiers, double timestamp) void WebEvent::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(m_type, m_modifiers, m_timestamp)); + encoder->encode(m_type); + encoder->encode(m_modifiers); + encoder->encode(m_timestamp); } -bool WebEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebEvent& t) +bool WebEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebEvent& result) { - return decoder->decode(CoreIPC::Out(t.m_type, t.m_modifiers, t.m_timestamp)); + if (!decoder->decode(result.m_type)) + return false; + if (!decoder->decode(result.m_modifiers)) + return false; + if (!decoder->decode(result.m_timestamp)) + return false; + return true; } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.cpp b/Source/WebKit2/Shared/WebGeolocationPosition.cpp index c9e36fa37..77d524cf4 100644 --- a/Source/WebKit2/Shared/WebGeolocationPosition.cpp +++ b/Source/WebKit2/Shared/WebGeolocationPosition.cpp @@ -53,15 +53,12 @@ WebGeolocationPosition::~WebGeolocationPosition() void WebGeolocationPosition::Data::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(timestamp, latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading)); - encoder->encode(CoreIPC::In(canProvideSpeed, speed)); + CoreIPC::SimpleArgumentCoder<WebGeolocationPosition::Data>::encode(encoder, *this); } bool WebGeolocationPosition::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& data) { - if (!decoder->decode(CoreIPC::Out(data.timestamp, data.latitude, data.longitude, data.accuracy, data.canProvideAltitude, data.altitude, data.canProvideAltitudeAccuracy, data.altitudeAccuracy, data.canProvideHeading, data.heading))) - return false; - return decoder->decode(CoreIPC::Out(data.canProvideSpeed, data.speed)); + return CoreIPC::SimpleArgumentCoder<WebGeolocationPosition::Data>::decode(decoder, data); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebMouseEvent.cpp b/Source/WebKit2/Shared/WebMouseEvent.cpp index 7aa7dff23..32e6ac1f3 100644 --- a/Source/WebKit2/Shared/WebMouseEvent.cpp +++ b/Source/WebKit2/Shared/WebMouseEvent.cpp @@ -82,25 +82,44 @@ void WebMouseEvent::encode(CoreIPC::ArgumentEncoder* encoder) const { WebEvent::encode(encoder); + encoder->encode(m_button); + encoder->encode(m_position); + encoder->encode(m_globalPosition); + encoder->encode(m_deltaX); + encoder->encode(m_deltaY); + encoder->encode(m_deltaZ); + encoder->encode(m_clickCount); + #if PLATFORM(WIN) - // Include m_didActivateWebView on Windows. - encoder->encode(CoreIPC::In(m_button, m_position, m_globalPosition, m_deltaX, m_deltaY, m_deltaZ, m_clickCount, m_didActivateWebView)); -#else - encoder->encode(CoreIPC::In(m_button, m_position, m_globalPosition, m_deltaX, m_deltaY, m_deltaZ, m_clickCount)); + encoder->encode(m_didActivateWebView); #endif } -bool WebMouseEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebMouseEvent& t) +bool WebMouseEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebMouseEvent& result) { - if (!WebEvent::decode(decoder, t)) + if (!WebEvent::decode(decoder, result)) return false; + if (!decoder->decode(result.m_button)) + return false; + if (!decoder->decode(result.m_position)) + return false; + if (!decoder->decode(result.m_globalPosition)) + return false; + if (!decoder->decode(result.m_deltaX)) + return false; + if (!decoder->decode(result.m_deltaY)) + return false; + if (!decoder->decode(result.m_deltaZ)) + return false; + if (!decoder->decode(result.m_clickCount)) + return false; #if PLATFORM(WIN) - // Include m_didActivateWebView on Windows. - return decoder->decode(CoreIPC::Out(t.m_button, t.m_position, t.m_globalPosition, t.m_deltaX, t.m_deltaY, t.m_deltaZ, t.m_clickCount, t.m_didActivateWebView)); -#else - return decoder->decode(CoreIPC::Out(t.m_button, t.m_position, t.m_globalPosition, t.m_deltaX, t.m_deltaY, t.m_deltaZ, t.m_clickCount)); + if (!decoder->decode(result.m_didActivateWebView)) + return false; #endif + + return true; } bool WebMouseEvent::isMouseEventType(Type type) diff --git a/Source/WebKit2/Shared/WebNetworkInfo.cpp b/Source/WebKit2/Shared/WebNetworkInfo.cpp index cc31bdccb..a2852341a 100644 --- a/Source/WebKit2/Shared/WebNetworkInfo.cpp +++ b/Source/WebKit2/Shared/WebNetworkInfo.cpp @@ -45,12 +45,18 @@ WebNetworkInfo::~WebNetworkInfo() void WebNetworkInfo::Data::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(bandwidth, metered)); + encoder->encode(bandwidth); + encoder->encode(metered); } -bool WebNetworkInfo::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& data) +bool WebNetworkInfo::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& result) { - return decoder->decode(CoreIPC::Out(data.bandwidth, data.metered)); + if (!decoder->decode(result.bandwidth)) + return false; + if (!decoder->decode(result.metered)) + return false; + + return true; } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp index d86fc7aef..39026e0f5 100644 --- a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp +++ b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp @@ -59,12 +59,33 @@ WebPlatformTouchPoint::WebPlatformTouchPoint(unsigned id, TouchPointState state, void WebPlatformTouchPoint::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(m_id, m_state, m_screenPosition, m_position, m_radius, m_rotationAngle, m_force)); + encoder->encode(m_id); + encoder->encode(m_state); + encoder->encode(m_screenPosition); + encoder->encode(m_position); + encoder->encode(m_radius); + encoder->encode(m_rotationAngle); + encoder->encode(m_force); } -bool WebPlatformTouchPoint::decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& t) +bool WebPlatformTouchPoint::decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& result) { - return decoder->decode(CoreIPC::Out(t.m_id, t.m_state, t.m_screenPosition, t.m_position, t.m_radius, t.m_rotationAngle, t.m_force)); + if (!decoder->decode(result.m_id)) + return false; + if (!decoder->decode(result.m_state)) + return false; + if (!decoder->decode(result.m_screenPosition)) + return false; + if (!decoder->decode(result.m_position)) + return false; + if (!decoder->decode(result.m_radius)) + return false; + if (!decoder->decode(result.m_rotationAngle)) + return false; + if (!decoder->decode(result.m_force)) + return false; + + return true; } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPopupItem.cpp b/Source/WebKit2/Shared/WebPopupItem.cpp index c215f3568..07a29e416 100644 --- a/Source/WebKit2/Shared/WebPopupItem.cpp +++ b/Source/WebKit2/Shared/WebPopupItem.cpp @@ -68,29 +68,56 @@ WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDire void WebPopupItem::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), m_text, static_cast<uint64_t>(m_textDirection), m_hasTextDirectionOverride, m_toolTip, m_accessibilityText, m_isEnabled, m_isLabel)); - encoder->encode(CoreIPC::In(m_isSelected)); + encoder->encodeEnum(m_type); + encoder->encode(m_text); + encoder->encodeEnum(m_textDirection); + encoder->encode(m_hasTextDirectionOverride); + encoder->encode(m_toolTip); + encoder->encode(m_accessibilityText); + encoder->encode(m_isEnabled); + encoder->encode(m_isLabel); + encoder->encode(m_isSelected); } bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) { - uint32_t type; + Type type; + if (!decoder->decodeEnum(type)) + return false; + String text; - uint64_t textDirection; + if (!decoder->decode(text)) + return false; + + TextDirection textDirection; + if (!decoder->decodeEnum(textDirection)) + return false; + bool hasTextDirectionOverride; + if (!decoder->decode(hasTextDirectionOverride)) + return false; + String toolTip; + if (!decoder->decode(toolTip)) + return false; + String accessibilityText; + if (!decoder->decode(accessibilityText)) + return false; + bool isEnabled; - bool isLabel; - bool isSelected; + if (!decoder->decode(isEnabled)) + return false; - if (!decoder->decode(CoreIPC::Out(type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel))) + bool isLabel; + if (!decoder->decode(isLabel)) return false; - if (!decoder->decode(CoreIPC::Out(isSelected))) + bool isSelected; + if (!decoder->decode(isSelected)) return false; - item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel, isSelected); + item = WebPopupItem(type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel, isSelected); return true; } diff --git a/Source/WebKit2/Shared/WebTouchEvent.cpp b/Source/WebKit2/Shared/WebTouchEvent.cpp index 05d7cd254..7213c78db 100644 --- a/Source/WebKit2/Shared/WebTouchEvent.cpp +++ b/Source/WebKit2/Shared/WebTouchEvent.cpp @@ -44,15 +44,18 @@ void WebTouchEvent::encode(CoreIPC::ArgumentEncoder* encoder) const { WebEvent::encode(encoder); - encoder->encode(CoreIPC::In(m_touchPoints)); + encoder->encode(m_touchPoints); } -bool WebTouchEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebTouchEvent& t) +bool WebTouchEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebTouchEvent& result) { - if (!WebEvent::decode(decoder, t)) + if (!WebEvent::decode(decoder, result)) return false; - return decoder->decode(CoreIPC::Out(t.m_touchPoints)); + if (!decoder->decode(result.m_touchPoints)) + return false; + + return true; } bool WebTouchEvent::isTouchEventType(Type type) diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri index 6c99c85b6..aa23748d2 100644 --- a/Source/WebKit2/Target.pri +++ b/Source/WebKit2/Target.pri @@ -31,6 +31,7 @@ HEADERS += \ Platform/CoreIPC/MessageReceiver.h \ Platform/CoreIPC/MessageReceiverMap.h \ Platform/CoreIPC/MessageSender.h \ + Platform/CoreIPC/StringReference.h \ Platform/Logging.h \ Platform/Module.h \ Platform/PlatformProcessIdentifier.h \ @@ -392,6 +393,7 @@ SOURCES += \ Platform/CoreIPC/MessageDecoder.cpp \ Platform/CoreIPC/MessageEncoder.cpp \ Platform/CoreIPC/MessageReceiverMap.cpp \ + Platform/CoreIPC/StringReference.cpp \ Platform/Logging.cpp \ Platform/Module.cpp \ Platform/WorkQueue.cpp \ diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp index 76de21a4f..cecad7652 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp @@ -51,7 +51,7 @@ Ewk_Form_Submission_Request::~Ewk_Form_Submission_Request() String Ewk_Form_Submission_Request::fieldValue(const String& fieldName) const { ASSERT(fieldName); - WKRetainPtr<WKStringRef> wkFieldName = toCopiedAPI(fieldName); + WKRetainPtr<WKStringRef> wkFieldName = adoptWK(toCopiedAPI(fieldName)); WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(m_wkValues.get(), wkFieldName.get())); return wkValue ? toImpl(wkValue)->string() : String(); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index d8608aa48..fc955ec82 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -25,7 +25,9 @@ #include "NativeWebMouseEvent.h" #include "NativeWebWheelEvent.h" #include "PageClientImpl.h" +#include "PageLoadClientEfl.h" #include "RefPtrEfl.h" +#include "ResourceLoadClientEfl.h" #include "WKAPICast.h" #include "WKColorPickerResultListener.h" #include "WKEinaSharedString.h" @@ -51,10 +53,8 @@ #include "ewk_settings_private.h" #include "ewk_view_find_client_private.h" #include "ewk_view_form_client_private.h" -#include "ewk_view_loader_client_private.h" #include "ewk_view_policy_client_private.h" #include "ewk_view_private.h" -#include "ewk_view_resource_load_client_private.h" #include "ewk_view_ui_client_private.h" #include <Ecore_Evas.h> #include <Edje.h> @@ -86,7 +86,6 @@ static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; static const int defaultCursorSize = 16; -typedef HashMap< uint64_t, RefPtr<Ewk_Resource> > LoadingResourcesMap; static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo); typedef HashMap<const WebPageProxy*, const Evas_Object*> PageViewMap; @@ -119,6 +118,8 @@ struct Ewk_View_Private_Data { OwnPtr<PageViewportControllerClientEfl> pageViewportControllerClient; #endif RefPtr<WebPageProxy> pageProxy; + OwnPtr<PageLoadClientEfl> pageLoadClient; + OwnPtr<ResourceLoadClientEfl> resourceLoadClient; WKEinaSharedString url; WKEinaSharedString title; @@ -127,7 +128,6 @@ struct Ewk_View_Private_Data { WKEinaSharedString cursorGroup; WKEinaSharedString faviconURL; RefPtr<Evas_Object> cursorObject; - LoadingResourcesMap loadingResourcesMap; OwnPtr<Ewk_Back_Forward_List> backForwardList; OwnPtr<Ewk_Settings> settings; bool areMouseEventsEnabled; @@ -828,17 +828,18 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP priv->pageViewportControllerClient = PageViewportControllerClientEfl::create(ewkView); #endif + // Initialize page clients. WKPageRef wkPage = toAPI(priv->pageProxy.get()); ewk_view_find_client_attach(wkPage, ewkView); ewk_view_form_client_attach(wkPage, ewkView); - ewk_view_loader_client_attach(wkPage, ewkView); ewk_view_policy_client_attach(wkPage, ewkView); - ewk_view_resource_load_client_attach(wkPage, ewkView); ewk_view_ui_client_attach(wkPage, ewkView); #if ENABLE(FULLSCREEN_API) priv->pageProxy->fullScreenManager()->setWebView(ewkView); ewk_settings_fullscreen_enabled_set(priv->settings.get(), true); #endif + priv->pageLoadClient = PageLoadClientEfl::create(ewkView); + priv->resourceLoadClient = ResourceLoadClientEfl::create(ewkView); /* Listen for favicon changes */ Ewk_Favicon_Database* iconDatabase = ewk_context_favicon_database_get(priv->context); @@ -1015,20 +1016,26 @@ Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView) /** * @internal + * Retrieves the internal WKPage for this view. + */ +WKPageRef ewk_view_wkpage_get(const Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + + return toAPI(priv->pageProxy.get()); +} + +/** + * @internal * Load was initiated for a resource in the view. * * Emits signal: "resource,request,new" with pointer to resource request. */ -void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Resource* resource, Ewk_Url_Request* request) +void ewk_view_resource_load_initiated(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - Ewk_Resource_Request resourceRequest = {resource, request, 0}; - // Keep the resource internally to reuse it later. - priv->loadingResourcesMap.add(resourceIdentifier, resource); - evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest); } @@ -1038,16 +1045,9 @@ void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIde * * Emits signal: "resource,request,response" with pointer to resource response. */ -void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response) +void ewk_view_resource_load_response(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Response* response) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Load_Response resourceLoadResponse = {resource.get(), response}; + Ewk_Resource_Load_Response resourceLoadResponse = {resource, response}; evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse); } @@ -1057,16 +1057,9 @@ void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIden * * Emits signal: "resource,request,finished" with pointer to the resource load error. */ -void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Error* error) +void ewk_view_resource_load_failed(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Error* error) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Load_Error resourceLoadError = {resource.get(), error}; + Ewk_Resource_Load_Error resourceLoadError = {resource, error}; evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError); } @@ -1076,16 +1069,9 @@ void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdenti * * Emits signal: "resource,request,finished" with pointer to the resource. */ -void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier) +void ewk_view_resource_load_finished(Evas_Object* ewkView, Ewk_Resource* resource) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.take(resourceIdentifier); - evas_object_smart_callback_call(ewkView, "resource,request,finished", resource.get()); + evas_object_smart_callback_call(ewkView, "resource,request,finished", resource); } /** @@ -1094,17 +1080,9 @@ void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIden * * Emits signal: "resource,request,sent" with pointer to resource request and possible redirect response. */ -void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse) +void ewk_view_resource_request_sent(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Request resourceRequest = {resource.get(), request, redirectResponse}; - + Ewk_Resource_Request resourceRequest = {resource, request, redirectResponse}; evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest); } @@ -1538,13 +1516,6 @@ void ewk_view_load_provisional_redirect(Evas_Object* ewkView) */ void ewk_view_load_provisional_started(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - // The main frame started provisional load, we should clear - // the loadingResources HashMap to start clean. - priv->loadingResourcesMap.clear(); - ewk_view_url_update(ewkView); evas_object_smart_callback_call(ewkView, "load,provisional,started", 0); } @@ -1942,8 +1913,8 @@ Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, in EINA_SAFETY_ON_NULL_RETURN_VAL(priv->colorPickerResultListener, false); WebCore::Color color = WebCore::Color(r, g, b, a); - const WKStringRef colorString = WKStringCreateWithUTF8CString(color.serialized().utf8().data()); - WKColorPickerResultListenerSetColor(priv->colorPickerResultListener.get(), colorString); + WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data())); + WKColorPickerResultListenerSetColor(priv->colorPickerResultListener.get(), colorString.get()); priv->colorPickerResultListener.clear(); return true; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index 61c7bd41a..2066f9eff 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -77,17 +77,19 @@ void ewk_view_page_close(Evas_Object* ewkView); WKPageRef ewk_view_page_create(Evas_Object* ewkView); void ewk_view_title_changed(Evas_Object* ewkView, const char* title); void ewk_view_tooltip_text_set(Evas_Object* ewkView, const char* text); -void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Error* error); -void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier); -void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Resource* resource, Ewk_Url_Request* request); -void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response); -void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse); +void ewk_view_resource_load_failed(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Error* error); +void ewk_view_resource_load_finished(Evas_Object* ewkView, Ewk_Resource* resource); +void ewk_view_resource_load_initiated(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request); +void ewk_view_resource_load_response(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Response* response); +void ewk_view_resource_request_sent(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse); void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount); void ewk_view_url_update(Evas_Object* ewkView); void ewk_view_contents_size_changed(const Evas_Object* ewkView, const WebCore::IntSize&); void ewk_view_back_forward_list_changed(Evas_Object* ewkView); void ewk_view_update_icon(Evas_Object* ewkView); +WKPageRef ewk_view_wkpage_get(const Evas_Object* ewkView); + Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef); #if ENABLE(WEB_INTENTS) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp deleted file mode 100644 index ce62539d3..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2012 Intel Corporation. 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 "WKAPICast.h" -#include "WKFrame.h" -#include "WKPage.h" -#include "WKRetainPtr.h" -#include "WKURL.h" -#include "WKURLRequest.h" -#include "WKURLResponse.h" -#include "ewk_error_private.h" -#include "ewk_resource.h" -#include "ewk_resource_private.h" -#include "ewk_url_request.h" -#include "ewk_url_request_private.h" -#include "ewk_url_response.h" -#include "ewk_url_response_private.h" -#include "ewk_view_private.h" -#include "ewk_view_resource_load_client_private.h" -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> - -using namespace WebCore; -using namespace WebKit; - -static inline Evas_Object* toEwkView(const void* clientInfo) -{ - return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); -} - -static void didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, bool pageIsProvisionallyLoading, const void* clientInfo) -{ - bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading); - WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest)); - - RefPtr<Ewk_Resource> resource = Ewk_Resource::create(wkUrl.get(), isMainResource); - RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); - ewk_view_resource_load_initiated(toEwkView(clientInfo), resourceIdentifier, resource.get(), request.get()); -} - -static void didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo) -{ - RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); - RefPtr<Ewk_Url_Response> redirectResponse = Ewk_Url_Response::create(wkRedirectResponse); - ewk_view_resource_request_sent(toEwkView(clientInfo), resourceIdentifier, request.get(), redirectResponse.get()); -} - -static void didReceiveResponseForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLResponseRef wkResponse, const void* clientInfo) -{ - RefPtr<Ewk_Url_Response> response = Ewk_Url_Response::create(wkResponse); - ewk_view_resource_load_response(toEwkView(clientInfo), resourceIdentifier, response.get()); -} - -static void didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, const void* clientInfo) -{ - ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier); -} - -static void didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef wkError, const void* clientInfo) -{ - OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(wkError); - ewk_view_resource_load_failed(toEwkView(clientInfo), resourceIdentifier, ewkError.get()); - ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier); -} - -void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView) -{ - WKPageResourceLoadClient wkResourceLoadClient; - memset(&wkResourceLoadClient, 0, sizeof(WKPageResourceLoadClient)); - wkResourceLoadClient.version = kWKPageResourceLoadClientCurrentVersion; - wkResourceLoadClient.clientInfo = ewkView; - wkResourceLoadClient.didInitiateLoadForResource = didInitiateLoadForResource; - wkResourceLoadClient.didSendRequestForResource = didSendRequestForResource; - wkResourceLoadClient.didReceiveResponseForResource = didReceiveResponseForResource; - wkResourceLoadClient.didFinishLoadForResource = didFinishLoadForResource; - wkResourceLoadClient.didFailLoadForResource = didFailLoadForResource; - - WKPageSetPageResourceLoadClient(pageRef, &wkResourceLoadClient); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h deleted file mode 100644 index 1f404b920..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2012 Intel Corporation. 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 ewk_view_resource_load_client_private_h -#define ewk_view_resource_load_client_private_h - -#include <Evas.h> -#include <WebKit2/WKBase.h> - -void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView); - -#endif // ewk_view_resource_load_client_private_h diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index cd2de8d25..ac037fb30 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -26,11 +26,6 @@ #import "config.h" #import "WKView.h" -#if USE(DICTATION_ALTERNATIVES) -#import <AppKit/NSTextAlternatives.h> -#import <AppKit/NSAttributedString.h> -#endif - #import "AttributedString.h" #import "ColorSpaceData.h" #import "DataReference.h" @@ -90,6 +85,10 @@ #import <wtf/RefPtr.h> #import <wtf/RetainPtr.h> +#if USE(DICTATION_ALTERNATIVES) +#import <AppKit/NSTextAlternatives.h> +#endif + @interface NSApplication (WKNSApplicationDetails) - (void)speakString:(NSString *)string; - (void)_setCurrentEvent:(NSEvent *)event; @@ -139,12 +138,6 @@ struct WKViewInterpretKeyEventsParameters { - (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState; @end -@interface WKToolTipDelegate : NSObject { - RefPtr<WebPageProxy> _page; -} -- (id)initWithPage:(WebPageProxy *)page; -@end - @interface WKViewData : NSObject { @public OwnPtr<PageClientImpl> _pageClient; @@ -217,7 +210,6 @@ struct WKViewInterpretKeyEventsParameters { String _promisedFilename; String _promisedURL; - RetainPtr<WKToolTipDelegate> _toolTipDelegate; RetainPtr<NSMutableArray> _observers; } @@ -2520,6 +2512,11 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [_data->_trackingRectOwner mouseEntered:fakeEvent]; } +- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data +{ + return nsStringFromWebCoreString(_data->_page->toolTip()); +} + - (void)_wk_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip { if (oldToolTip) @@ -2529,9 +2526,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I // See radar 3500217 for why we remove all tooltips rather than just the single one we created. [self removeAllToolTips]; NSRect wideOpenRect = NSMakeRect(-100000, -100000, 200000, 200000); - if (!_data->_toolTipDelegate) - _data->_toolTipDelegate = adoptNS([[WKToolTipDelegate alloc] initWithPage:_data->_page.get()]); - _data->_lastToolTipTag = [self addToolTipRect:wideOpenRect owner:_data->_toolTipDelegate.get() userData:NULL]; + _data->_lastToolTipTag = [self addToolTipRect:wideOpenRect owner:self userData:NULL]; [self _wk_sendToolTipMouseEntered]; } } @@ -3198,21 +3193,3 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } @end - -@implementation WKToolTipDelegate - -- (id)initWithPage:(WebPageProxy *)page -{ - self = [super init]; - if (!self) - return nil; - _page = page; - return self; -} - -- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data -{ - return nsStringFromWebCoreString(_page->toolTip()); -} - -@end diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp index 08009b9da..9dfe29b00 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp @@ -31,6 +31,7 @@ #include "WebContext.h" #include "WebNotification.h" #include "WebNotificationManagerMessages.h" +#include "WebNotificationManagerProxyMessages.h" #include "WebPageProxy.h" #include "WebSecurityOrigin.h" @@ -47,7 +48,7 @@ PassRefPtr<WebNotificationManagerProxy> WebNotificationManagerProxy::create(WebC WebNotificationManagerProxy::WebNotificationManagerProxy(WebContext* context) : m_context(context) { - m_context->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebNotificationManagerProxy, this); + m_context->addMessageReceiver(Messages::WebNotificationManagerProxy::messageReceiverName(), this); } void WebNotificationManagerProxy::invalidate() diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp index de668ab0e..474f06dac 100644 --- a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp @@ -28,6 +28,7 @@ #include "SecurityOriginData.h" #include "WebApplicationCacheManagerMessages.h" +#include "WebApplicationCacheManagerProxyMessages.h" #include "WebContext.h" #include "WebSecurityOrigin.h" @@ -41,7 +42,7 @@ PassRefPtr<WebApplicationCacheManagerProxy> WebApplicationCacheManagerProxy::cre WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebApplicationCacheManagerProxy, this); + m_webContext->addMessageReceiver(Messages::WebApplicationCacheManagerProxy::messageReceiverName(), this); } WebApplicationCacheManagerProxy::~WebApplicationCacheManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp index 44b5aca0a..01eb98052 100644 --- a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp @@ -29,6 +29,7 @@ #if ENABLE(BATTERY_STATUS) #include "WebBatteryManagerMessages.h" +#include "WebBatteryManagerProxyMessages.h" #include "WebContext.h" namespace WebKit { @@ -42,7 +43,7 @@ WebBatteryManagerProxy::WebBatteryManagerProxy(WebContext* context) : m_isUpdating(false) , m_context(context) { - m_context->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebBatteryManagerProxy, this); + m_context->addMessageReceiver(Messages::WebBatteryManagerProxy::messageReceiverName(), this); } WebBatteryManagerProxy::~WebBatteryManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp index ff43b3411..6202608bd 100644 --- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp +++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp @@ -59,7 +59,9 @@ void WebConnectionToWebProcess::encodeMessageBody(CoreIPC::ArgumentEncoder& enco bool WebConnectionToWebProcess::decodeMessageBody(CoreIPC::ArgumentDecoder& decoder, RefPtr<APIObject>& messageBody) { - if (!decoder.decode(WebContextUserMessageDecoder(messageBody, m_process))) + WebContextUserMessageDecoder messageBodyDecoder(messageBody, m_process); + + if (!decoder.decode(messageBodyDecoder)) return false; return true; diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index 76cb514b9..56a017c6f 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -27,6 +27,7 @@ #include "WebContext.h" #include "DownloadProxy.h" +#include "DownloadProxyMessages.h" #include "ImmutableArray.h" #include "Logging.h" #include "MutableDictionary.h" @@ -36,6 +37,7 @@ #include "WKContextPrivate.h" #include "WebApplicationCacheManagerProxy.h" #include "WebContextMessageKinds.h" +#include "WebContextMessages.h" #include "WebContextUserMessageCoders.h" #include "WebCookieManagerProxy.h" #include "WebCoreArgumentCoders.h" @@ -133,9 +135,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa , m_usesNetworkProcess(false) #endif { - deprecatedAddMessageReceiver(CoreIPC::MessageClassWebContext, this); - deprecatedAddMessageReceiver(CoreIPC::MessageClassDownloadProxy, this); - deprecatedAddMessageReceiver(CoreIPC::MessageClassWebContextLegacy, this); + addMessageReceiver(Messages::WebContext::messageReceiverName(), this); + addMessageReceiver(Messages::DownloadProxy::messageReceiverName(), this); + addMessageReceiver(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), this); // NOTE: These sub-objects must be initialized after m_messageReceiverMap.. m_applicationCacheManagerProxy = WebApplicationCacheManagerProxy::create(this); @@ -783,9 +785,9 @@ HashSet<String, CaseFoldingHash> WebContext::pdfAndPostScriptMIMETypes() return mimeTypes; } -void WebContext::deprecatedAddMessageReceiver(CoreIPC::MessageClass messageClass, CoreIPC::MessageReceiver* messageReceiver) +void WebContext::addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver* messageReceiver) { - m_messageReceiverMap.deprecatedAddMessageReceiver(messageClass, messageReceiver); + m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver); } bool WebContext::dispatchMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) @@ -816,10 +818,12 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes case WebContextLegacyMessage::PostMessage: { String messageName; RefPtr<APIObject> messageBody; - WebContextUserMessageDecoder messageDecoder(messageBody, WebProcessProxy::fromConnection(connection)); - if (!decoder.decode(CoreIPC::Out(messageName, messageDecoder))) + WebContextUserMessageDecoder messageBodyDecoder(messageBody, WebProcessProxy::fromConnection(connection)); + if (!decoder.decode(messageName)) return; - + if (!decoder.decode(messageBodyDecoder)) + return; + didReceiveMessageFromInjectedBundle(messageName, messageBody.get()); return; } @@ -849,13 +853,15 @@ void WebContext::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC: String messageName; RefPtr<APIObject> messageBody; - WebContextUserMessageDecoder messageDecoder(messageBody, WebProcessProxy::fromConnection(connection)); - if (!decoder.decode(CoreIPC::Out(messageName, messageDecoder))) + WebContextUserMessageDecoder messageBodyDecoder(messageBody, WebProcessProxy::fromConnection(connection)); + if (!decoder.decode(messageName)) + return; + if (!decoder.decode(messageBodyDecoder)) return; RefPtr<APIObject> returnData; didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody.get(), returnData); - replyEncoder->encode(CoreIPC::In(WebContextUserMessageEncoder(returnData.get()))); + replyEncoder->encode(WebContextUserMessageEncoder(returnData.get())); return; } case WebContextLegacyMessage::PostMessage: diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index e3f6a69db..93dc68e70 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -86,7 +86,7 @@ public: static const Vector<WebContext*>& allContexts(); - void deprecatedAddMessageReceiver(CoreIPC::MessageClass, CoreIPC::MessageReceiver*); + void addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver*); bool dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); bool dispatchSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&); diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp index 6f876cfcc..b63c80c7e 100644 --- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp @@ -27,8 +27,9 @@ #include "WebCookieManagerProxy.h" #include "SecurityOriginData.h" -#include "WebCookieManagerMessages.h" #include "WebContext.h" +#include "WebCookieManagerMessages.h" +#include "WebCookieManagerProxyMessages.h" #include "WebSecurityOrigin.h" namespace WebKit { @@ -41,7 +42,7 @@ PassRefPtr<WebCookieManagerProxy> WebCookieManagerProxy::create(WebContext* cont WebCookieManagerProxy::WebCookieManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebCookieManagerProxy, this); + m_webContext->addMessageReceiver(Messages::WebCookieManagerProxy::messageReceiverName(), this); } WebCookieManagerProxy::~WebCookieManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp index 8f24028cb..116fd56e6 100644 --- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp @@ -30,8 +30,9 @@ #include "ImmutableArray.h" #include "ImmutableDictionary.h" -#include "WebDatabaseManagerMessages.h" #include "WebContext.h" +#include "WebDatabaseManagerMessages.h" +#include "WebDatabaseManagerProxyMessages.h" #include "WebSecurityOrigin.h" using namespace WebCore; @@ -94,7 +95,7 @@ PassRefPtr<WebDatabaseManagerProxy> WebDatabaseManagerProxy::create(WebContext* WebDatabaseManagerProxy::WebDatabaseManagerProxy(WebContext* webContext) : m_webContext(webContext) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebDatabaseManagerProxy, this); + m_webContext->addMessageReceiver(Messages::WebDatabaseManagerProxy::messageReceiverName(), this); } WebDatabaseManagerProxy::~WebDatabaseManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp index 6cccd849c..74b90797f 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp @@ -28,6 +28,7 @@ #include "WebContext.h" #include "WebGeolocationManagerMessages.h" +#include "WebGeolocationManagerProxyMessages.h" namespace WebKit { @@ -40,7 +41,7 @@ WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebContext* context) : m_isUpdating(false) , m_context(context) { - m_context->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebGeolocationManagerProxy, this); + m_context->addMessageReceiver(Messages::WebGeolocationManagerProxy::messageReceiverName(), this); } WebGeolocationManagerProxy::~WebGeolocationManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.cpp b/Source/WebKit2/UIProcess/WebIconDatabase.cpp index 1092b9ac5..40158f4a0 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabase.cpp +++ b/Source/WebKit2/UIProcess/WebIconDatabase.cpp @@ -29,6 +29,7 @@ #include "DataReference.h" #include "Logging.h" #include "WebContext.h" +#include "WebIconDatabaseMessages.h" #include "WebIconDatabaseProxyMessages.h" #include <WebCore/FileSystem.h> #include <WebCore/IconDatabase.h> @@ -54,7 +55,7 @@ WebIconDatabase::WebIconDatabase(WebContext* context) , m_urlImportCompleted(false) , m_databaseCleanupDisabled(false) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebIconDatabase, this); + m_webContext->addMessageReceiver(Messages::WebIconDatabase::messageReceiverName(), this); } void WebIconDatabase::invalidate() diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp index 5c3088d98..43f69a445 100644 --- a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp @@ -27,8 +27,9 @@ #include "WebKeyValueStorageManagerProxy.h" #include "SecurityOriginData.h" -#include "WebKeyValueStorageManagerMessages.h" #include "WebContext.h" +#include "WebKeyValueStorageManagerMessages.h" +#include "WebKeyValueStorageManagerProxyMessages.h" #include "WebSecurityOrigin.h" namespace WebKit { @@ -41,7 +42,7 @@ PassRefPtr<WebKeyValueStorageManagerProxy> WebKeyValueStorageManagerProxy::creat WebKeyValueStorageManagerProxy::WebKeyValueStorageManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebKeyValueStorageManagerProxy, this); + m_webContext->addMessageReceiver(Messages::WebKeyValueStorageManagerProxy::messageReceiverName(), this); } WebKeyValueStorageManagerProxy::~WebKeyValueStorageManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp index 39cf73a89..b0f9bd196 100644 --- a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp @@ -28,6 +28,7 @@ #include "WebContext.h" #include "WebMediaCacheManagerMessages.h" +#include "WebMediaCacheManagerProxyMessages.h" #include "WebSecurityOrigin.h" namespace WebKit { @@ -40,7 +41,7 @@ PassRefPtr<WebMediaCacheManagerProxy> WebMediaCacheManagerProxy::create(WebConte WebMediaCacheManagerProxy::WebMediaCacheManagerProxy(WebContext* context) : m_webContext(context) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebMediaCacheManagerProxy, this); + m_webContext->addMessageReceiver(Messages::WebMediaCacheManagerProxy::messageReceiverName(), this); } WebMediaCacheManagerProxy::~WebMediaCacheManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp index 7f30a5340..4173463f4 100644 --- a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp @@ -31,6 +31,7 @@ #include "WebContext.h" #include "WebNetworkInfo.h" #include "WebNetworkInfoManagerMessages.h" +#include "WebNetworkInfoManagerProxyMessages.h" namespace WebKit { @@ -43,7 +44,7 @@ WebNetworkInfoManagerProxy::WebNetworkInfoManagerProxy(WebContext* context) : m_isUpdating(false) , m_context(context) { - m_context->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebNetworkInfoManagerProxy, this); + m_context->addMessageReceiver(Messages::WebNetworkInfoManagerProxy::messageReceiverName(), this); } WebNetworkInfoManagerProxy::~WebNetworkInfoManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index 29dc5498f..afa5bd4b2 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -221,7 +221,7 @@ private: template<typename E, typename T> bool WebProcessProxy::deprecatedSend(E messageID, uint64_t destinationID, const T& arguments) { - OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create("", "", destinationID); + OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(CoreIPC::MessageKindTraits<E>::messageReceiverName(), "", destinationID); encoder->encode(arguments); return sendMessage(CoreIPC::MessageID(messageID), encoder.release(), 0); @@ -230,7 +230,7 @@ bool WebProcessProxy::deprecatedSend(E messageID, uint64_t destinationID, const template<typename T> bool WebProcessProxy::send(const T& message, uint64_t destinationID, unsigned messageSendFlags) { - OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create("", "", destinationID); + OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(T::receiverName(), "", destinationID); encoder->encode(message); return sendMessage(CoreIPC::MessageID(T::messageID), encoder.release(), messageSendFlags); diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp index fcb056db0..22a41a12d 100644 --- a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp @@ -31,6 +31,7 @@ #include "SecurityOriginData.h" #include "WebContext.h" #include "WebResourceCacheManagerMessages.h" +#include "WebResourceCacheManagerProxyMessages.h" #include "WebSecurityOrigin.h" using namespace WebCore; @@ -45,7 +46,7 @@ PassRefPtr<WebResourceCacheManagerProxy> WebResourceCacheManagerProxy::create(We WebResourceCacheManagerProxy::WebResourceCacheManagerProxy(WebContext* webContext) : m_webContext(webContext) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebResourceCacheManagerProxy, this); + m_webContext->addMessageReceiver(Messages::WebResourceCacheManagerProxy::messageReceiverName(), this); } WebResourceCacheManagerProxy::~WebResourceCacheManagerProxy() diff --git a/Source/WebKit2/UIProcess/WebVibrationProxy.cpp b/Source/WebKit2/UIProcess/WebVibrationProxy.cpp index 6b0717c18..4a645d543 100644 --- a/Source/WebKit2/UIProcess/WebVibrationProxy.cpp +++ b/Source/WebKit2/UIProcess/WebVibrationProxy.cpp @@ -29,6 +29,7 @@ #if ENABLE(VIBRATION) #include "WebContext.h" +#include "WebVibrationProxyMessages.h" namespace WebKit { @@ -40,7 +41,7 @@ PassRefPtr<WebVibrationProxy> WebVibrationProxy::create(WebContext* context) WebVibrationProxy::WebVibrationProxy(WebContext* context) : m_context(context) { - m_context->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebVibrationProxy, this); + m_context->addMessageReceiver(Messages::WebVibrationProxy::messageReceiverName(), this); } WebVibrationProxy::~WebVibrationProxy() diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp index 0d6d5a347..2425b157d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp +++ b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp @@ -24,106 +24,107 @@ */ #include "config.h" -#include "ewk_view.h" +#include "PageLoadClientEfl.h" #include "WKFrame.h" +#include "WKPage.h" #include "ewk_back_forward_list_private.h" #include "ewk_error_private.h" -#include "ewk_intent.h" #include "ewk_intent_private.h" -#include "ewk_intent_service.h" #include "ewk_intent_service_private.h" -#include "ewk_view_loader_client_private.h" -#include "ewk_view_private.h" -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> +#include "ewk_view.h" -using namespace WebKit; +namespace WebKit { -static void didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo) +static inline PageLoadClientEfl* toPageLoadClientEfl(const void* clientInfo) +{ + return static_cast<PageLoadClientEfl*>(const_cast<void*>(clientInfo)); +} + +void PageLoadClientEfl::didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); ewk_view_title_changed(ewkView, toImpl(title)->string().utf8().data()); } #if ENABLE(WEB_INTENTS) -static void didReceiveIntentForFrame(WKPageRef, WKFrameRef, WKIntentDataRef intent, WKTypeRef, const void* clientInfo) +void PageLoadClientEfl::didReceiveIntentForFrame(WKPageRef, WKFrameRef, WKIntentDataRef intent, WKTypeRef, const void* clientInfo) { - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); RefPtr<Ewk_Intent> ewkIntent = Ewk_Intent::create(intent); ewk_view_intent_request_new(ewkView, ewkIntent.get()); } #endif #if ENABLE(WEB_INTENTS_TAG) -static void registerIntentServiceForFrame(WKPageRef, WKFrameRef, WKIntentServiceInfoRef serviceInfo, WKTypeRef, const void *clientInfo) +void PageLoadClientEfl::registerIntentServiceForFrame(WKPageRef, WKFrameRef, WKIntentServiceInfoRef serviceInfo, WKTypeRef, const void* clientInfo) { - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); RefPtr<Ewk_Intent_Service> ewkIntentService = Ewk_Intent_Service::create(serviceInfo); ewk_view_intent_service_register(ewkView, ewkIntentService.get()); } #endif -static void didChangeProgress(WKPageRef page, const void* clientInfo) +void PageLoadClientEfl::didChangeProgress(WKPageRef page, const void* clientInfo) { - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); ewk_view_load_progress_changed(ewkView, WKPageGetEstimatedProgress(page)); } -static void didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void *clientInfo) +void PageLoadClientEfl::didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); ewk_view_load_finished(ewkView); } -static void didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void *clientInfo) +void PageLoadClientEfl::didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); ewk_view_load_error(ewkView, ewkError.get()); ewk_view_load_finished(ewkView); } -static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) +void PageLoadClientEfl::didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); ewk_view_load_provisional_started(ewkView); } -static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) +void PageLoadClientEfl::didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); ewk_view_load_provisional_redirect(ewkView); } -static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo) +void PageLoadClientEfl::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); ewk_view_load_provisional_failed(ewkView, ewkError.get()); } -static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo) +void PageLoadClientEfl::didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo) { - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); ASSERT(ewkView); Ewk_Back_Forward_List* list = ewk_view_back_forward_list_get(ewkView); @@ -133,21 +134,25 @@ static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedIt ewk_view_back_forward_list_changed(ewkView); } -static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo) +void PageLoadClientEfl::didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo) { if (!WKFrameIsMainFrame(frame)) return; - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + Evas_Object* ewkView = toPageLoadClientEfl(clientInfo)->view(); ewk_view_url_update(ewkView); } -void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView) +PageLoadClientEfl::PageLoadClientEfl(Evas_Object* view) + : m_view(view) { + WKPageRef pageRef = ewk_view_wkpage_get(m_view); + ASSERT(pageRef); + WKPageLoaderClient loadClient; memset(&loadClient, 0, sizeof(WKPageLoaderClient)); loadClient.version = kWKPageLoaderClientCurrentVersion; - loadClient.clientInfo = ewkView; + loadClient.clientInfo = this; loadClient.didReceiveTitleForFrame = didReceiveTitleForFrame; #if ENABLE(WEB_INTENTS) loadClient.didReceiveIntentForFrame = didReceiveIntentForFrame; @@ -167,3 +172,5 @@ void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView) loadClient.didSameDocumentNavigationForFrame = didSameDocumentNavigationForFrame; WKPageSetPageLoaderClient(pageRef, &loadClient); } + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.h b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.h new file mode 100644 index 000000000..68cc17d6a --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2012 Intel Corporation. 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 PageLoadClientEfl_h +#define PageLoadClientEfl_h + +#include "ewk_view_private.h" +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +class PageLoadClientEfl { +public: + static PassOwnPtr<PageLoadClientEfl> create(Evas_Object* view) + { + return adoptPtr(new PageLoadClientEfl(view)); + } + +private: + explicit PageLoadClientEfl(Evas_Object* view); + + inline Evas_Object* view() const { return m_view; } + + static void didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef, WKTypeRef, const void* clientInfo); +#if ENABLE(WEB_INTENTS) + static void didReceiveIntentForFrame(WKPageRef, WKFrameRef, WKIntentDataRef, WKTypeRef, const void* clientInfo); +#endif +#if ENABLE(WEB_INTENTS_TAG) + static void registerIntentServiceForFrame(WKPageRef, WKFrameRef, WKIntentServiceInfoRef, WKTypeRef, const void* clientInfo); +#endif + static void didChangeProgress(WKPageRef, const void* clientInfo); + static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); + static void didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo); + static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); + static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo); + static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo); + static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo); + static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo); + + Evas_Object* m_view; +}; + +} // namespace WebKit + +#endif // PageLoadClientEfl_h diff --git a/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.cpp b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.cpp new file mode 100644 index 000000000..6539cce36 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2012 Intel Corporation. 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 "ResourceLoadClientEfl.h" + +#include "WKAPICast.h" +#include "WKFrame.h" +#include "WKPage.h" +#include "WKRetainPtr.h" +#include "ewk_error_private.h" +#include "ewk_url_request_private.h" +#include "ewk_url_response_private.h" + +using namespace WebCore; + +namespace WebKit { + +static inline ResourceLoadClientEfl* toResourceLoadClientEfl(const void* clientInfo) +{ + return static_cast<ResourceLoadClientEfl*>(const_cast<void*>(clientInfo)); +} + +void ResourceLoadClientEfl::didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, bool pageIsProvisionallyLoading, const void* clientInfo) +{ + ResourceLoadClientEfl* resourceLoadClient = toResourceLoadClientEfl(clientInfo); + bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading); + WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest)); + + RefPtr<Ewk_Resource> resource = Ewk_Resource::create(wkUrl.get(), isMainResource); + + // Keep the resource internally to reuse it later. + resourceLoadClient->m_loadingResourcesMap.add(resourceIdentifier, resource); + + RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); + ewk_view_resource_load_initiated(resourceLoadClient->m_view, resource.get(), request.get()); +} + +void ResourceLoadClientEfl::didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo) +{ + ResourceLoadClientEfl* resourceLoadClient = toResourceLoadClientEfl(clientInfo); + + RefPtr<Ewk_Resource> resource = resourceLoadClient->m_loadingResourcesMap.get(resourceIdentifier); + // Only process if we know about this resource. + if (!resource) + return; + + RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); + RefPtr<Ewk_Url_Response> redirectResponse = Ewk_Url_Response::create(wkRedirectResponse); + ewk_view_resource_request_sent(resourceLoadClient->m_view, resource.get(), request.get(), redirectResponse.get()); +} + +void ResourceLoadClientEfl::didReceiveResponseForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLResponseRef wkResponse, const void* clientInfo) +{ + ResourceLoadClientEfl* resourceLoadClient = toResourceLoadClientEfl(clientInfo); + + RefPtr<Ewk_Resource> resource = resourceLoadClient->m_loadingResourcesMap.get(resourceIdentifier); + // Only process if we know about this resource. + if (!resource) + return; + + RefPtr<Ewk_Url_Response> response = Ewk_Url_Response::create(wkResponse); + ewk_view_resource_load_response(resourceLoadClient->m_view, resource.get(), response.get()); +} + +void ResourceLoadClientEfl::didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, const void* clientInfo) +{ + ResourceLoadClientEfl* resourceLoadClient = toResourceLoadClientEfl(clientInfo); + + RefPtr<Ewk_Resource> resource = resourceLoadClient->m_loadingResourcesMap.get(resourceIdentifier); + // Only process if we know about this resource. + if (!resource) + return; + + ewk_view_resource_load_finished(resourceLoadClient->m_view, resource.get()); +} + +void ResourceLoadClientEfl::didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef wkError, const void* clientInfo) +{ + ResourceLoadClientEfl* resourceLoadClient = toResourceLoadClientEfl(clientInfo); + + RefPtr<Ewk_Resource> resource = resourceLoadClient->m_loadingResourcesMap.take(resourceIdentifier); + // Only process if we know about this resource. + if (!resource) + return; + + OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(wkError); + ewk_view_resource_load_failed(resourceLoadClient->m_view, resource.get(), ewkError.get()); + ewk_view_resource_load_finished(resourceLoadClient->m_view, resource.get()); +} + +void ResourceLoadClientEfl::onViewProvisionalLoadStarted(void* userData, Evas_Object*, void*) +{ + ResourceLoadClientEfl* resourceLoadClient = toResourceLoadClientEfl(userData); + + // The view started a new load, clear internal resource map. + resourceLoadClient->m_loadingResourcesMap.clear(); +} + +ResourceLoadClientEfl::ResourceLoadClientEfl(Evas_Object* view) + : m_view(view) +{ + // Listen for "load,provisional,started" on the view to clear internal resources map. + evas_object_smart_callback_add(m_view, "load,provisional,started", onViewProvisionalLoadStarted, this); + + WKPageRef pageRef = ewk_view_wkpage_get(m_view); + ASSERT(pageRef); + + WKPageResourceLoadClient wkResourceLoadClient; + memset(&wkResourceLoadClient, 0, sizeof(WKPageResourceLoadClient)); + wkResourceLoadClient.version = kWKPageResourceLoadClientCurrentVersion; + wkResourceLoadClient.clientInfo = this; + wkResourceLoadClient.didInitiateLoadForResource = didInitiateLoadForResource; + wkResourceLoadClient.didSendRequestForResource = didSendRequestForResource; + wkResourceLoadClient.didReceiveResponseForResource = didReceiveResponseForResource; + wkResourceLoadClient.didFinishLoadForResource = didFinishLoadForResource; + wkResourceLoadClient.didFailLoadForResource = didFailLoadForResource; + + WKPageSetPageResourceLoadClient(pageRef, &wkResourceLoadClient); +} + +ResourceLoadClientEfl::~ResourceLoadClientEfl() +{ + evas_object_smart_callback_del(m_view, "load,provisional,started", onViewProvisionalLoadStarted); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.h b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.h new file mode 100644 index 000000000..58f52b4b7 --- /dev/null +++ b/Source/WebKit2/UIProcess/efl/ResourceLoadClientEfl.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2012 Intel Corporation. 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 ResourceLoadClientEfl_h +#define ResourceLoadClientEfl_h + +#include "ewk_resource_private.h" +#include "ewk_view_private.h" +#include <wtf/HashMap.h> +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +class ResourceLoadClientEfl { +public: + ~ResourceLoadClientEfl(); + + static PassOwnPtr<ResourceLoadClientEfl> create(Evas_Object* view) + { + return adoptPtr(new ResourceLoadClientEfl(view)); + } + +private: + explicit ResourceLoadClientEfl(Evas_Object* view); + + static void didInitiateLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, bool pageIsProvisionallyLoading, const void* clientInfo); + static void didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, WKURLResponseRef, const void* clientInfo); + static void didReceiveResponseForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLResponseRef, const void* clientInfo); + static void didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, const void* clientInfo); + static void didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef, const void* clientInfo); + + static void onViewProvisionalLoadStarted(void* userData, Evas_Object* view, void* clientInfo); + + Evas_Object* m_view; + HashMap< uint64_t, RefPtr<Ewk_Resource> > m_loadingResourcesMap; +}; + +} // namespace WebKit + +#endif // ResourceLoadClientEfl_h diff --git a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp index 679be2bed..33698cd7c 100644 --- a/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp @@ -23,6 +23,7 @@ #include "WebContext.h" #include "WebData.h" #include "WebSoupRequestManagerMessages.h" +#include "WebSoupRequestManagerProxyMessages.h" namespace WebKit { @@ -35,7 +36,7 @@ WebSoupRequestManagerProxy::WebSoupRequestManagerProxy(WebContext* context) : m_webContext(context) , m_loadFailed(false) { - m_webContext->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebSoupRequestManagerProxy, this); + m_webContext->addMessageReceiver(Messages::WebSoupRequestManagerProxy::messageReceiverName(), this); } WebSoupRequestManagerProxy::~WebSoupRequestManagerProxy() diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index 6c87cde72..9b5ac7bcc 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -70,6 +70,8 @@ 1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */; }; 1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */; }; 1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A119A94127B796200A9ECB1 /* MessageSender.h */; }; + 1A13BEB31635A9C800F19C03 /* StringReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A13BEB11635A9C800F19C03 /* StringReference.cpp */; }; + 1A13BEB41635A9C800F19C03 /* StringReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A13BEB21635A9C800F19C03 /* StringReference.h */; }; 1A17977F137EE82C00F97D45 /* PluginCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A17977D137EE82C00F97D45 /* PluginCreationParameters.cpp */; }; 1A179780137EE82C00F97D45 /* PluginCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A17977E137EE82C00F97D45 /* PluginCreationParameters.h */; }; 1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */; }; @@ -1200,6 +1202,8 @@ 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkProvider.cpp; sourceTree = "<group>"; }; 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkProvider.h; sourceTree = "<group>"; }; 1A119A94127B796200A9ECB1 /* MessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageSender.h; sourceTree = "<group>"; }; + 1A13BEB11635A9C800F19C03 /* StringReference.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringReference.cpp; sourceTree = "<group>"; }; + 1A13BEB21635A9C800F19C03 /* StringReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringReference.h; sourceTree = "<group>"; }; 1A17977D137EE82C00F97D45 /* PluginCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginCreationParameters.cpp; sourceTree = "<group>"; }; 1A17977E137EE82C00F97D45 /* PluginCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginCreationParameters.h; sourceTree = "<group>"; }; 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeHost.h; sourceTree = "<group>"; }; @@ -2820,6 +2824,8 @@ 1A3EED0C161A535300AEB4F5 /* MessageReceiverMap.cpp */, 1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */, 1A119A94127B796200A9ECB1 /* MessageSender.h */, + 1A13BEB11635A9C800F19C03 /* StringReference.cpp */, + 1A13BEB21635A9C800F19C03 /* StringReference.h */, ); path = CoreIPC; sourceTree = "<group>"; @@ -4736,6 +4742,7 @@ 5105B0DE162F7E9D00E27709 /* NetworkProcessManager.h in Headers */, 513A163D163088F6005D7D22 /* NetworkProcessProxyMessages.h in Headers */, 513A164D1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h in Headers */, + 1A13BEB41635A9C800F19C03 /* StringReference.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5686,6 +5693,7 @@ 513A163C163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp in Sources */, 513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */, 5183DDEC1630BDFC008BE5C7 /* NetworkProcessConnection.cpp in Sources */, + 1A13BEB31635A9C800F19C03 /* StringReference.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp index f5d8e62f4..3850e644a 100644 --- a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp +++ b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "AuthenticationManager.h" +#include "AuthenticationManagerMessages.h" #include "Download.h" #include "DownloadProxyMessages.h" #include "MessageID.h" @@ -55,7 +56,7 @@ AuthenticationManager& AuthenticationManager::shared() AuthenticationManager::AuthenticationManager() { - WebProcess::shared().connection()->deprecatedAddMessageReceiver(CoreIPC::MessageClassAuthenticationManager, this); + WebProcess::shared().addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), this); } void AuthenticationManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp index 4bd627c2f..46b846b4a 100644 --- a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WebGeolocationManager.h" +#include "WebGeolocationManagerMessages.h" #include "WebGeolocationManagerProxyMessages.h" #include "WebPage.h" #include "WebProcess.h" @@ -41,8 +42,8 @@ namespace WebKit { WebGeolocationManager::WebGeolocationManager(WebProcess* process) : m_process(process) - , m_didAddMessageReceiver(false) { + m_process->addMessageReceiver(Messages::WebGeolocationManager::messageReceiverName(), this); } WebGeolocationManager::~WebGeolocationManager() @@ -56,11 +57,6 @@ void WebGeolocationManager::didReceiveMessage(CoreIPC::Connection* connection, C void WebGeolocationManager::registerWebPage(WebPage* page) { - if (!m_didAddMessageReceiver) { - m_process->connection()->deprecatedAddMessageReceiver(CoreIPC::MessageClassWebGeolocationManager, this); - m_didAddMessageReceiver = true; - } - bool wasEmpty = m_pageSet.isEmpty(); m_pageSet.add(page); diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h index 6e245570d..6f5d83fe2 100644 --- a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h @@ -64,7 +64,6 @@ private: void didFailToDeterminePosition(const String& errorMessage); WebProcess* m_process; - bool m_didAddMessageReceiver; HashSet<WebPage*> m_pageSet; }; diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 458b1c169..4d0aa56a3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -93,20 +93,27 @@ void InjectedBundle::initializeClient(WKBundleClient* client) void InjectedBundle::postMessage(const String& messageName, APIObject* messageBody) { - WebProcess::shared().connection()->deprecatedSend(WebContextLegacyMessage::PostMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody))); + OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), "", 0); + encoder->encode(messageName); + encoder->encode(InjectedBundleUserMessageEncoder(messageBody)); + + WebProcess::shared().connection()->sendMessage(CoreIPC::MessageID(WebContextLegacyMessage::PostMessage), encoder.release()); } void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject* messageBody, RefPtr<APIObject>& returnData) { - RefPtr<APIObject> returnDataTmp; - InjectedBundleUserMessageDecoder messageDecoder(returnDataTmp); - - bool succeeded = WebProcess::shared().connection()->deprecatedSendSync(WebContextLegacyMessage::PostSynchronousMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)), CoreIPC::Out(messageDecoder)); + InjectedBundleUserMessageDecoder messageDecoder(returnData); - if (!succeeded) - return; + uint64_t syncRequestID; + OwnPtr<CoreIPC::MessageEncoder> encoder = WebProcess::shared().connection()->createSyncMessageEncoder(CoreIPC::MessageKindTraits<WebContextLegacyMessage::Kind>::messageReceiverName(), "", 0, syncRequestID); + encoder->encode(messageName); + encoder->encode(InjectedBundleUserMessageEncoder(messageBody)); - returnData = returnDataTmp; + OwnPtr<CoreIPC::MessageDecoder> replyDecoder = WebProcess::shared().connection()->sendSyncMessage(CoreIPC::MessageID(WebContextLegacyMessage::PostSynchronousMessage), syncRequestID, encoder.release(), CoreIPC::Connection::NoTimeout); + if (!replyDecoder || !replyDecoder->decode(messageDecoder)) { + returnData = nullptr; + return; + } } WebConnection* InjectedBundle::webConnectionToUIProcess() const diff --git a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp index e39ba39d2..538007d4f 100644 --- a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp +++ b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp @@ -56,10 +56,8 @@ void WebConnectionToUIProcess::encodeMessageBody(CoreIPC::ArgumentEncoder& encod bool WebConnectionToUIProcess::decodeMessageBody(CoreIPC::ArgumentDecoder& decoder, RefPtr<APIObject>& messageBody) { - if (!decoder.decode(InjectedBundleUserMessageDecoder(messageBody))) - return false; - - return true; + InjectedBundleUserMessageDecoder messageBodyDecoder(messageBody); + return decoder.decode(messageBodyDecoder); } // CoreIPC::Connection::Client diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 1afe3e324..3d8583d8d 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -1222,7 +1222,8 @@ void WebPage::postInjectedBundleMessage(const String& messageName, CoreIPC::Mess return; RefPtr<APIObject> messageBody; - if (!decoder.decode(InjectedBundleUserMessageDecoder(messageBody))) + InjectedBundleUserMessageDecoder messageBodyDecoder(messageBody); + if (!decoder.decode(messageBodyDecoder)) return; injectedBundle->didReceiveMessageToPage(this, messageName, messageBody.get()); diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 43e7d7021..33be75989 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -194,6 +194,11 @@ void WebProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, Ru startRandomCrashThreadIfRequested(); } +void WebProcess::addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver* messageReceiver) +{ + m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver); +} + void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::MessageDecoder& decoder) { ASSERT(m_pageMap.isEmpty()); @@ -645,7 +650,10 @@ void WebProcess::terminate() } void WebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder) -{ +{ + if (m_messageReceiverMap.dispatchSyncMessage(connection, messageID, decoder, replyEncoder)) + return; + uint64_t pageID = decoder.destinationID(); if (!pageID) return; @@ -659,6 +667,9 @@ void WebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC: void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) { + if (m_messageReceiverMap.dispatchMessage(connection, messageID, decoder)) + return; + if (messageID.is<CoreIPC::MessageClassWebProcess>()) { didReceiveWebProcessMessage(connection, messageID, decoder); return; @@ -1056,7 +1067,8 @@ void WebProcess::postInjectedBundleMessage(const CoreIPC::DataReference& message return; RefPtr<APIObject> messageBody; - if (!decoder->decode(InjectedBundleUserMessageDecoder(messageBody))) + InjectedBundleUserMessageDecoder messageBodyDecoder(messageBody); + if (!decoder->decode(messageBodyDecoder)) return; injectedBundle->didReceiveMessage(messageName, messageBody.get()); diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index ac6455250..88b5f5799 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -30,6 +30,7 @@ #include "ChildProcess.h" #include "DrawingArea.h" #include "EventDispatcher.h" +#include "MessageReceiverMap.h" #include "PluginInfoStore.h" #include "ResourceCachesToClear.h" #include "SandboxExtension.h" @@ -113,6 +114,8 @@ public: CoreIPC::Connection* connection() const { return m_connection->connection(); } WebCore::RunLoop* runLoop() const { return m_runLoop; } + void addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver*); + WebConnectionToUIProcess* webConnectionToUIProcess() const { return m_connection.get(); } WebPage* webPage(uint64_t pageID) const; @@ -292,6 +295,7 @@ private: #endif RefPtr<WebConnectionToUIProcess> m_connection; + CoreIPC::MessageReceiverMap m_messageReceiverMap; HashMap<uint64_t, RefPtr<WebPage> > m_pageMap; HashMap<uint64_t, RefPtr<WebPageGroupProxy> > m_pageGroupMap; diff --git a/Source/WebKit2/win/WebKit2.vcproj b/Source/WebKit2/win/WebKit2.vcproj index 6397b4412..064ae8516 100755 --- a/Source/WebKit2/win/WebKit2.vcproj +++ b/Source/WebKit2/win/WebKit2.vcproj @@ -4129,6 +4129,14 @@ RelativePath="..\Platform\CoreIPC\MessageSender.h"
>
</File>
+ <File
+ RelativePath="..\Platform\CoreIPC\StringReference.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Platform\CoreIPC\StringReference.h"
+ >
+ </File>
<Filter
Name="win"
>
diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 180b6b275..3397e46ae 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,247 @@ +2012-10-23 Simon Pena <spena@igalia.com> + + Unreviewed. Adding myself as committer. + + * Scripts/webkitpy/common/config/committers.py: + +2012-10-22 Jochen Eisinger <jochen@chromium.org> + + [chromium] Move the call to RegisterIsolatedFileSystem to the WebTestDelegate interface + https://bugs.webkit.org/show_bug.cgi?id=100048 + + Reviewed by Adam Barth. + + The call needs to be done outside of the sandbox. + + * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h: + (WebTestDelegate): + * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp: + (WebTestRunner): + (WebTestRunner::EventSender::beginDragWithFiles): + * DumpRenderTree/chromium/TestRunner/src/TestDelegate.h: + (TestDelegate): + * DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp: + (WebTestInterfaces::Internal): + (WebTestRunner::WebTestInterfaces::Internal::registerIsolatedFileSystem): + (WebTestRunner): + * DumpRenderTree/chromium/WebViewHost.cpp: + (WebViewHost::registerIsolatedFileSystem): + * DumpRenderTree/chromium/WebViewHost.h: + (WebViewHost): + +2012-10-22 Dirk Pranke <dpranke@chromium.org> + + webkitpy: remove unneeded debug messages from find_files() + https://bugs.webkit.org/show_bug.cgi?id=100041 + + Reviewed by Adam Barth. + + This routine gets called all the time when loading the virtual + suites, and the debug messages were spamming me. + + * Scripts/webkitpy/common/find_files.py: + (_normalized_find): + +2012-10-22 Tony Chang <tony@chromium.org> + + [chromium] Add Mac 10.7 Debug bot since it's on the waterfall + https://bugs.webkit.org/show_bug.cgi?id=100028 + + Reviewed by Eric Seidel. + + garden-o-matic can't baseline without this entry. + + * Scripts/webkitpy/layout_tests/port/builders.py: + +2012-10-22 Jochen Eisinger <jochen@chromium.org> + + [chromium] introduce WebTask to the TestRunner library + https://bugs.webkit.org/show_bug.cgi?id=99964 + + Reviewed by Adam Barth. + + I'm also removing the dependency on webkit_support, and instead go + through the WebTestDelegate interface. + + * DumpRenderTree/DumpRenderTree.gypi: + * DumpRenderTree/chromium/DRTDevToolsAgent.cpp: + * DumpRenderTree/chromium/DRTDevToolsAgent.h: + (DRTDevToolsAgent::taskList): + * DumpRenderTree/chromium/DRTDevToolsClient.cpp: + * DumpRenderTree/chromium/DRTDevToolsClient.h: + (DRTDevToolsClient::taskList): + * DumpRenderTree/chromium/DRTTestRunner.cpp: + (InvokeCallbackTask::InvokeCallbackTask): + * DumpRenderTree/chromium/DRTTestRunner.h: + (DRTTestRunner::taskList): + (DRTTestRunner::WorkQueue::taskList): + * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp: + (RTCSessionDescriptionRequestSuccededTask::RTCSessionDescriptionRequestSuccededTask): + (RTCSessionDescriptionRequestFailedTask::RTCSessionDescriptionRequestFailedTask): + (RTCStatsRequestSucceededTask::RTCStatsRequestSucceededTask): + (RTCVoidRequestTask::RTCVoidRequestTask): + (StringDataTask::StringDataTask): + (CharPtrDataTask::CharPtrDataTask): + (DataChannelReadyStateTask::DataChannelReadyStateTask): + (RTCPeerConnectionReadyStateTask::RTCPeerConnectionReadyStateTask): + * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h: + (MockWebRTCPeerConnectionHandler): + (MockWebRTCPeerConnectionHandler::taskList): + * DumpRenderTree/chromium/MockWebSpeechInputController.cpp: + (MockWebSpeechInputController::SpeechTask::SpeechTask): + * DumpRenderTree/chromium/MockWebSpeechInputController.h: + (MockWebSpeechInputController::taskList): + (MockWebSpeechInputController): + * DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp: + * DumpRenderTree/chromium/MockWebSpeechRecognizer.h: + (MockWebSpeechRecognizer::taskList): + (MockWebSpeechRecognizer): + (MockWebSpeechRecognizer::StepTask::StepTask): + * DumpRenderTree/chromium/Task.cpp: Copied from Tools/DumpRenderTree/chromium/TestRunner/src/Task.cpp. + (WebTestRunner): + (WebTestRunner::invokeTask): + (TaskWrapper): + (WebTestRunner::TaskWrapper::TaskWrapper): + (WebTestRunner::TaskWrapper::~TaskWrapper): + (WebTestRunner::TaskWrapper::Run): + (postTask): + (postDelayedTask): + * DumpRenderTree/chromium/Task.h: Copied from Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h. + (WebTestRunner): + * DumpRenderTree/chromium/TestRunner/public/WebTask.h: Renamed from Tools/DumpRenderTree/chromium/TestRunner/src/Task.h. + (WebTestRunner): + (WebTask): + (WebTaskList): + (WebMethodTask): + (WebTestRunner::WebMethodTask::WebMethodTask): + (WebTestRunner::WebMethodTask::~WebMethodTask): + (WebTestRunner::WebMethodTask::run): + (WebTestRunner::WebMethodTask::cancel): + * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h: + (WebTestRunner): + (WebTestDelegate): + * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp: + (WebTestRunner): + (WebTestRunner::EventSender::scheduleAsynchronousClick): + (WebTestRunner::KeyDownTask::KeyDownTask): + (WebTestRunner::EventSender::scheduleAsynchronousKeyDown): + * DumpRenderTree/chromium/TestRunner/src/EventSender.h: + (WebTestRunner::EventSender::taskList): + (EventSender): + * DumpRenderTree/chromium/TestRunner/src/TestDelegate.h: + (WebTestRunner): + (TestDelegate): + * DumpRenderTree/chromium/TestRunner/src/TestRunner.h: + * DumpRenderTree/chromium/TestRunner/src/WebTask.cpp: Renamed from Tools/DumpRenderTree/chromium/TestRunner/src/Task.cpp. + (WebTestRunner): + (WebTestRunner::WebTask::WebTask): + (WebTestRunner::WebTask::~WebTask): + (WebTestRunner::WebTaskList::WebTaskList): + (WebTestRunner::WebTaskList::~WebTaskList): + (WebTestRunner::WebTaskList::registerTask): + (WebTestRunner::WebTaskList::unregisterTask): + (WebTestRunner::WebTaskList::revokeAll): + * DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp: + (WebTestInterfaces::Internal): + (WebTestRunner::WebTestInterfaces::Internal::postTask): + (WebTestRunner): + (WebTestRunner::WebTestInterfaces::Internal::postDelayedTask): + * DumpRenderTree/chromium/TestShell.cpp: + (TestShell::initialize): + * DumpRenderTree/chromium/WebUserMediaClientMock.cpp: + (UserMediaRequestTask::UserMediaRequestTask): + * DumpRenderTree/chromium/WebUserMediaClientMock.h: + (WebUserMediaClientMock::taskList): + (WebUserMediaClientMock): + * DumpRenderTree/chromium/WebViewHost.cpp: + (WebViewHost::postTask): + (WebViewHost::postDelayedTask): + * DumpRenderTree/chromium/WebViewHost.h: + (WebViewHost): + (WebViewHost::taskList): + (WebViewHost::HostMethodTask::HostMethodTask): + +2012-10-22 Ojan Vafai <ojan@chromium.org> + + Update flakiness dashboard to match the state of the builders. + * TestResultServer/static-dashboards/builders.js: + (isChromiumDepsGTestRunner): + Broaden the filter since Chromium naming scheme is not consistent. + (loadBuildersList): + The main Chromium master now only runs builders, no tests. + * TestResultServer/static-dashboards/dashboard_base.js: + Remove test suites that no longer run on any of these masters. + +2012-10-22 Jochen Eisinger <jochen@chromium.org> + + [chromium] add a method for printing message to the WebTestDelegate + https://bugs.webkit.org/show_bug.cgi?id=99960 + + Reviewed by Adam Barth. + + When using the TestRunner library from the content_shell, we can't print + message directly but need to send them to the browser process. + + * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h: + (WebTestDelegate): + * DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp: + (WebTestRunner::AccessibilityController::fallbackCallback): + * DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h: + (WebTestRunner::AccessibilityController::setDelegate): + (AccessibilityController): + * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp: + (WebTestRunner): + (WebTestRunner::EventSender::dumpFilenameBeingDragged): + * DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp: + (GamepadController::connect): + (GamepadController::disconnect): + (GamepadController::setId): + (GamepadController::setButtonCount): + (GamepadController::setButtonData): + (GamepadController::setAxisCount): + (GamepadController::setAxisData): + (GamepadController::fallbackCallback): + * DumpRenderTree/chromium/TestRunner/src/TestDelegate.h: + (TestDelegate): + * DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp: + (TestInterfaces::~TestInterfaces): + (TestInterfaces::setDelegate): + * DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp: + (WebTestInterfaces::Internal): + (WebTestRunner::WebTestInterfaces::Internal::printMessage): + (WebTestRunner): + * DumpRenderTree/chromium/WebViewHost.cpp: + (WebViewHost::didBeginEditing): + (WebViewHost::lastContextMenuData): + (WebViewHost::clearContextMenuData): + (WebViewHost::setEditCommand): + (WebViewHost::clearEditCommand): + (WebViewHost::fillSpellingSuggestionList): + (WebViewHost::setGamepadData): + (WebViewHost::printMessage): + * DumpRenderTree/chromium/WebViewHost.h: + (WebViewHost): + +2012-10-22 Allan Sandfeld Jensen <allan.jensen@digia.com> + + I now only watch Selectors instead of all of CSS. + + Unreviewed update of watchlist. + + * Scripts/webkitpy/common/config/watchlist: + +2012-10-22 Yury Semikhatsky <yurys@chromium.org> + + Make sure base and derived class pointers are different in MemoryInstrumentationTest.instrumentedWithMultipleAncestors + https://bugs.webkit.org/show_bug.cgi?id=99987 + + Reviewed by Alexander Pavlov. + + * TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp: changed first parent + class in the list so that it has virtual table as well as the second one. This + way we may be sure that pointer to the second ancestor class will differ from + the pointer to the derived class. + 2012-10-22 Yury Semikhatsky <yurys@chromium.org> Unreviewed. Fix compilation after r132059. diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi index 7e7d69bad..26722ece7 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gypi +++ b/Tools/DumpRenderTree/DumpRenderTree.gypi @@ -30,6 +30,8 @@ 'chromium/MockWebSpeechRecognizer.h', 'chromium/NotificationPresenter.h', 'chromium/NotificationPresenter.cpp', + 'chromium/Task.h', + 'chromium/Task.cpp', 'chromium/TestEventPrinter.h', 'chromium/TestEventPrinter.cpp', 'chromium/TestNavigationController.cpp', @@ -67,6 +69,7 @@ 'chromium/TestRunner/public/WebAccessibilityController.h', 'chromium/TestRunner/public/WebTestDelegate.h', 'chromium/TestRunner/public/WebEventSender.h', + 'chromium/TestRunner/public/WebTask.h', 'chromium/TestRunner/public/WebTestInterfaces.h', 'chromium/TestRunner/src/AccessibilityControllerChromium.cpp', 'chromium/TestRunner/src/AccessibilityControllerChromium.h', @@ -80,8 +83,6 @@ 'chromium/TestRunner/src/EventSender.h', 'chromium/TestRunner/src/GamepadController.cpp', 'chromium/TestRunner/src/GamepadController.h', - 'chromium/TestRunner/src/Task.cpp', - 'chromium/TestRunner/src/Task.h', 'chromium/TestRunner/src/TestInterfaces.cpp', 'chromium/TestRunner/src/TestInterfaces.h', 'chromium/TestRunner/src/TextInputController.cpp', @@ -90,6 +91,7 @@ 'chromium/TestRunner/src/TestRunner.h', 'chromium/TestRunner/src/WebAccessibilityController.cpp', 'chromium/TestRunner/src/WebEventSender.cpp', + 'chromium/TestRunner/src/WebTask.cpp', 'chromium/TestRunner/src/WebTestInterfaces.cpp', ], 'test_plugin_files': [ diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp index b6659a47f..eb21b2c85 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp @@ -33,12 +33,14 @@ #include "DRTDevToolsClient.h" +#include "Task.h" #include "platform/WebCString.h" #include "WebDevToolsAgent.h" #include "WebView.h" #include "webkit/support/webkit_support.h" using namespace WebKit; +using namespace WebTestRunner; DRTDevToolsAgent::DRTDevToolsAgent() : m_drtDevToolsClient(0) diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h index d066b7a71..c13aef7fa 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h @@ -31,8 +31,8 @@ #ifndef DRTDevToolsAgent_h #define DRTDevToolsAgent_h -#include "TestRunner/src/Task.h" #include "WebDevToolsAgentClient.h" +#include "WebTask.h" #include "platform/WebString.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> @@ -69,23 +69,23 @@ public: void detach(); bool evaluateInWebInspector(long callID, const std::string& script); - TaskList* taskList() { return &m_taskList; } + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } private: void call(const WebKit::WebString& args); WebKit::WebDevToolsAgent* webDevToolsAgent(); - class AsyncCallTask: public MethodTask<DRTDevToolsAgent> { + class AsyncCallTask: public WebTestRunner::WebMethodTask<DRTDevToolsAgent> { public: AsyncCallTask(DRTDevToolsAgent* object, const WebKit::WebString& args) - : MethodTask<DRTDevToolsAgent>(object), m_args(args) { } + : WebTestRunner::WebMethodTask<DRTDevToolsAgent>(object), m_args(args) { } virtual void runIfValid() { m_object->call(m_args); } private: WebKit::WebString m_args; }; - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; DRTDevToolsClient* m_drtDevToolsClient; int m_routingID; WebKit::WebView* m_webView; diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp index a7fc4d048..08df1d52a 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp @@ -32,6 +32,7 @@ #include "DRTDevToolsClient.h" #include "DRTDevToolsAgent.h" +#include "Task.h" #include "WebDevToolsAgent.h" #include "WebDevToolsFrontend.h" #include "WebFrame.h" @@ -41,6 +42,7 @@ #include <wtf/PassOwnPtr.h> using namespace WebKit; +using namespace WebTestRunner; DRTDevToolsClient::DRTDevToolsClient(DRTDevToolsAgent* agent, WebView* webView) : m_webView(webView) diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h index ead396379..5f486ddd0 100644 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h +++ b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h @@ -31,8 +31,8 @@ #ifndef DRTDevToolsClient_h #define DRTDevToolsClient_h -#include "TestRunner/src/Task.h" #include "WebDevToolsFrontendClient.h" +#include "WebTask.h" #include "platform/WebString.h" #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -64,21 +64,21 @@ public: void asyncCall(const WebKit::WebString& args); void allMessagesProcessed(); - TaskList* taskList() { return &m_taskList; } + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } private: void call(const WebKit::WebString& args); - class AsyncCallTask: public MethodTask<DRTDevToolsClient> { + class AsyncCallTask: public WebTestRunner::WebMethodTask<DRTDevToolsClient> { public: AsyncCallTask(DRTDevToolsClient* object, const WebKit::WebString& args) - : MethodTask<DRTDevToolsClient>(object), m_args(args) { } + : WebTestRunner::WebMethodTask<DRTDevToolsClient>(object), m_args(args) { } virtual void runIfValid() { m_object->call(m_args); } private: WebKit::WebString m_args; }; - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; WebKit::WebView* m_webView; DRTDevToolsAgent* m_drtDevToolsAgent; WTF::OwnPtr<WebKit::WebDevToolsFrontend> m_webDevToolsFrontend; diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp index 082597a11..b31d7da70 100644 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp +++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp @@ -36,6 +36,7 @@ #include "DRTDevToolsAgent.h" #include "MockWebSpeechInputController.h" #include "MockWebSpeechRecognizer.h" +#include "Task.h" #include "TestShell.h" #include "WebAnimationController.h" #include "WebBindings.h" @@ -83,6 +84,7 @@ using namespace WebCore; using namespace WebKit; +using namespace WebTestRunner; using namespace std; class EmptyWebDeliveredIntentClient : public WebKit::WebDeliveredIntentClient { @@ -2114,10 +2116,10 @@ void DRTTestRunner::setTextSubpixelPositioning(const CppArgumentList& arguments, result->setNull(); } -class InvokeCallbackTask : public MethodTask<DRTTestRunner> { +class InvokeCallbackTask : public WebMethodTask<DRTTestRunner> { public: InvokeCallbackTask(DRTTestRunner* object, PassOwnArrayPtr<CppVariant> callbackArguments, uint32_t numberOfArguments) - : MethodTask<DRTTestRunner>(object) + : WebMethodTask<DRTTestRunner>(object) , m_callbackArguments(callbackArguments) , m_numberOfArguments(numberOfArguments) { diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.h b/Tools/DumpRenderTree/chromium/DRTTestRunner.h index 60a038a27..ec4778fd5 100644 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.h +++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.h @@ -43,6 +43,7 @@ #define DRTTestRunner_h #include "TestRunner/src/TestRunner.h" +#include "WebTask.h" class TestShell; @@ -511,7 +512,7 @@ public: virtual bool run(TestShell*) = 0; }; - TaskList* taskList() { return &m_taskList; } + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } bool shouldStayOnPageAfterHandlingBeforeUnload() const { return m_shouldStayOnPageAfterHandlingBeforeUnload; } @@ -534,17 +535,17 @@ private: void setFrozen(bool frozen) { m_frozen = frozen; } bool isEmpty() { return m_queue.isEmpty(); } - TaskList* taskList() { return &m_taskList; } + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } private: void processWork(); - class WorkQueueTask: public MethodTask<WorkQueue> { + class WorkQueueTask: public WebTestRunner::WebMethodTask<WorkQueue> { public: - WorkQueueTask(WorkQueue* object): MethodTask<WorkQueue>(object) { } + WorkQueueTask(WorkQueue* object): WebTestRunner::WebMethodTask<WorkQueue>(object) { } virtual void runIfValid() { m_object->processWork(); } }; - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; Deque<WorkItem*> m_queue; bool m_frozen; DRTTestRunner* m_controller; @@ -558,9 +559,9 @@ private: void logErrorToConsole(const std::string&); void completeNotifyDone(bool isTimeout); - class NotifyDoneTimedOutTask: public MethodTask<DRTTestRunner> { + class NotifyDoneTimedOutTask: public WebTestRunner::WebMethodTask<DRTTestRunner> { public: - NotifyDoneTimedOutTask(DRTTestRunner* object): MethodTask<DRTTestRunner>(object) { } + NotifyDoneTimedOutTask(DRTTestRunner* object): WebTestRunner::WebMethodTask<DRTTestRunner>(object) { } virtual void runIfValid() { m_object->completeNotifyDone(true); } }; @@ -571,7 +572,7 @@ private: int numberOfActiveAnimations(); // Used for test timeouts. - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; // Non-owning pointer. The DRTTestRunner is owned by the host. TestShell* m_shell; diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp index d6e5e7f05..6eaf9d603 100644 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp @@ -34,6 +34,7 @@ #include "MockWebRTCPeerConnectionHandler.h" #include "MockConstraints.h" +#include "Task.h" #include <public/WebMediaConstraints.h> #include <public/WebMediaStreamComponent.h> #include <public/WebMediaStreamDescriptor.h> @@ -48,11 +49,12 @@ #include <wtf/DateMath.h> using namespace WebKit; +using namespace WebTestRunner; -class RTCSessionDescriptionRequestSuccededTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class RTCSessionDescriptionRequestSuccededTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: RTCSessionDescriptionRequestSuccededTask(MockWebRTCPeerConnectionHandler* object, const WebRTCSessionDescriptionRequest& request, const WebRTCSessionDescription& result) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_request(request) , m_result(result) { @@ -68,10 +70,10 @@ private: WebRTCSessionDescription m_result; }; -class RTCSessionDescriptionRequestFailedTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class RTCSessionDescriptionRequestFailedTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: RTCSessionDescriptionRequestFailedTask(MockWebRTCPeerConnectionHandler* object, const WebRTCSessionDescriptionRequest& request) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_request(request) { } @@ -85,10 +87,10 @@ private: WebRTCSessionDescriptionRequest m_request; }; -class RTCStatsRequestSucceededTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class RTCStatsRequestSucceededTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCStatsRequest& request, const WebKit::WebRTCStatsResponse& response) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_request(request) , m_response(response) { @@ -104,10 +106,10 @@ private: WebKit::WebRTCStatsResponse m_response; }; -class RTCVoidRequestTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class RTCVoidRequestTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: RTCVoidRequestTask(MockWebRTCPeerConnectionHandler* object, const WebRTCVoidRequest& request, bool succeeded) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_request(request) , m_succeeded(succeeded) { @@ -126,10 +128,10 @@ private: bool m_succeeded; }; -class StringDataTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class StringDataTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: StringDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const WebString& data) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_dataChannel(dataChannel) , m_data(data) { @@ -145,10 +147,10 @@ private: WebString m_data; }; -class CharPtrDataTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class CharPtrDataTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: CharPtrDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const char* data, size_t length) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_dataChannel(dataChannel) , m_length(length) { @@ -168,10 +170,10 @@ private: size_t m_length; }; -class DataChannelReadyStateTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class DataChannelReadyStateTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: DataChannelReadyStateTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, WebRTCDataChannel::ReadyState state) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_dataChannel(dataChannel) , m_state(state) { @@ -187,10 +189,10 @@ private: WebRTCDataChannel::ReadyState m_state; }; -class RTCPeerConnectionReadyStateTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +class RTCPeerConnectionReadyStateTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { public: RTCPeerConnectionReadyStateTask(MockWebRTCPeerConnectionHandler* object, WebRTCPeerConnectionHandlerClient* client, WebRTCPeerConnectionHandlerClient::ReadyState state) - : MethodTask<MockWebRTCPeerConnectionHandler>(object) + : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) , m_client(client) , m_state(state) { diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h index 5ddd2fc45..a1522f4fb 100644 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h +++ b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h @@ -33,7 +33,7 @@ #if ENABLE(MEDIA_STREAM) -#include "TestRunner/src/Task.h" +#include "WebTask.h" #include <public/WebRTCDataChannel.h> #include <public/WebRTCPeerConnectionHandler.h> #include <public/WebRTCSessionDescription.h> @@ -68,15 +68,15 @@ public: virtual bool sendRawData(const WebKit::WebRTCDataChannel&, const char*, size_t) OVERRIDE; virtual void closeDataChannel(const WebKit::WebRTCDataChannel&) OVERRIDE; - // Task related methods - TaskList* taskList() { return &m_taskList; } + // WebTask related methods + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } private: MockWebRTCPeerConnectionHandler() { } WebKit::WebRTCPeerConnectionHandlerClient* m_client; bool m_stopped; - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; WebKit::WebRTCSessionDescription m_localDescription; WebKit::WebRTCSessionDescription m_remoteDescription; int m_streamCount; diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp index 13c8ff1ec..528455bd6 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "MockWebSpeechInputController.h" +#include "Task.h" #include "WebSpeechInputListener.h" #include "platform/WebCString.h" #include "platform/WebVector.h" @@ -35,6 +36,7 @@ #if ENABLE(INPUT_SPEECH) using namespace WebKit; +using namespace WebTestRunner; PassOwnPtr<MockWebSpeechInputController> MockWebSpeechInputController::create(WebSpeechInputListener* listener) { @@ -182,7 +184,7 @@ void MockWebSpeechInputController::speechTaskFired() } MockWebSpeechInputController::SpeechTask::SpeechTask(MockWebSpeechInputController* mock) - : MethodTask<MockWebSpeechInputController>::MethodTask(mock) + : WebMethodTask<MockWebSpeechInputController>::WebMethodTask(mock) { } diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h index 6494a7f25..075f2541f 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h @@ -28,7 +28,7 @@ #if ENABLE(INPUT_SPEECH) -#include "TestRunner/src/Task.h" +#include "WebTask.h" #include "platform/WebRect.h" #include "WebSpeechInputController.h" #include "WebSpeechInputResult.h" @@ -58,13 +58,13 @@ public: virtual void cancelRecognition(int requestId) OVERRIDE; virtual void stopRecording(int requestId) OVERRIDE; - TaskList* taskList() { return &m_taskList; } + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } private: MockWebSpeechInputController(WebKit::WebSpeechInputListener*); void speechTaskFired(); - class SpeechTask : public MethodTask<MockWebSpeechInputController> { + class SpeechTask : public WebTestRunner::WebMethodTask<MockWebSpeechInputController> { public: SpeechTask(MockWebSpeechInputController*); void stop(); @@ -75,7 +75,7 @@ private: WebKit::WebSpeechInputListener* m_listener; - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; SpeechTask* m_speechTask; bool m_recording; diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp index 502addea9..88143c0ba 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp @@ -28,10 +28,12 @@ #if ENABLE(SCRIPTED_SPEECH) +#include "Task.h" #include "WebSpeechRecognitionResult.h" #include "WebSpeechRecognizerClient.h" using namespace WebKit; +using namespace WebTestRunner; namespace { diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h index 4cc045669..419c5e504 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h @@ -28,8 +28,8 @@ #if ENABLE(SCRIPTED_SPEECH) -#include "TestRunner/src/Task.h" #include "WebSpeechRecognizer.h" +#include "WebTask.h" #include <wtf/Compiler.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> @@ -58,7 +58,7 @@ public: // Methods accessed from Task objects: WebKit::WebSpeechRecognizerClient* client() { return m_client; } WebKit::WebSpeechRecognitionHandle& handle() { return m_handle; } - TaskList* taskList() { return &m_taskList; } + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } class Task { public: @@ -74,7 +74,7 @@ private: void startTaskQueue(); void clearTaskQueue(); - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; WebKit::WebSpeechRecognitionHandle m_handle; WebKit::WebSpeechRecognizerClient* m_client; Vector<WebKit::WebString> m_mockTranscripts; @@ -86,9 +86,9 @@ private: bool m_taskQueueRunning; // Task for stepping the queue. - class StepTask : public MethodTask<MockWebSpeechRecognizer> { + class StepTask : public WebTestRunner::WebMethodTask<MockWebSpeechRecognizer> { public: - StepTask(MockWebSpeechRecognizer* object) : MethodTask<MockWebSpeechRecognizer>(object) { } + StepTask(MockWebSpeechRecognizer* object) : WebTestRunner::WebMethodTask<MockWebSpeechRecognizer>(object) { } virtual void runIfValid() OVERRIDE; }; }; diff --git a/Tools/DumpRenderTree/chromium/Task.cpp b/Tools/DumpRenderTree/chromium/Task.cpp new file mode 100644 index 000000000..a619017f5 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/Task.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Task.h" + +#include "WebKit.h" +#include "WebTask.h" +#include "platform/WebKitPlatformSupport.h" +#include "webkit/support/webkit_support.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +using namespace WebKit; +using namespace WebTestRunner; + +namespace { + +void invokeTask(void* context) +{ + WebTask* task = static_cast<WebTask*>(context); + task->run(); + delete task; +} + +class TaskWrapper : public webkit_support::TaskAdaptor { +public: + explicit TaskWrapper(WebTask* task) + : m_task(adoptPtr(task)) + { + } + virtual ~TaskWrapper() { } + virtual void Run() + { + m_task->run(); + } + +private: + OwnPtr<WebTask> m_task; +}; + +} + +void postTask(WebTask* task) +{ + webKitPlatformSupport()->callOnMainThread(invokeTask, static_cast<void*>(task)); +} + +void postDelayedTask(WebTask* task, long long ms) +{ + webkit_support::PostDelayedTask(new TaskWrapper(task), ms); +} diff --git a/Source/WebCore/bindings/v8/IDBCustomBindings.cpp b/Tools/DumpRenderTree/chromium/Task.h index 968cc0c64..c8755a83c 100644 --- a/Source/WebCore/bindings/v8/IDBCustomBindings.cpp +++ b/Tools/DumpRenderTree/chromium/Task.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,33 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "V8IDBCursorWithValue.h" +#ifndef Task_h +#define Task_h -#if ENABLE(INDEXED_DATABASE) - -#include "V8IDBAny.h" - -namespace WebCore { - -v8::Handle<v8::Value> V8IDBCursorWithValue::valueAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - INC_STATS("DOM.IDBCursorWithValue.value._get"); - - IDBCursorWithValue* imp = V8IDBCursorWithValue::toNative(info.Holder()); - v8::Handle<v8::String> propertyName = v8::String::NewSymbol("value"); - if (!imp->valueIsDirty()) { - v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName); - if (!value.IsEmpty()) - return value; - } - - RefPtr<IDBAny> result = imp->value(); - v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIsolate()); - info.Holder()->SetHiddenValue(propertyName, wrapper); - return wrapper; +namespace WebTestRunner { +class WebTask; } -} +void postTask(WebTestRunner::WebTask*); +void postDelayedTask(WebTestRunner::WebTask*, long long ms); -#endif +#endif // Task_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/Task.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h index 0b32c472b..ef73e177e 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/Task.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h @@ -28,69 +28,75 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef Task_h -#define Task_h +#ifndef WebTask_h +#define WebTask_h -#include "webkit/support/webkit_support.h" -#include <wtf/OwnPtr.h> -#include <wtf/Vector.h> +namespace WebTestRunner { -class TaskList; +class WebTaskList; -// WebTask represents a task which can run by postTask() or postDelayedTask(). -// it is named "WebTask", not "Task", to avoid conflist with base/task.h. -class WebTask : public webkit_support::TaskAdaptor { +// WebTask represents a task which can run by WebTestDelegate::postTask() or +// WebTestDelegate::postDelayedTask(). +class WebTask { public: - WebTask(TaskList*); + explicit WebTask(WebTaskList*); + virtual ~WebTask(); + // The main code of this task. // An implementation of run() should return immediately if cancel() was called. virtual void run() = 0; virtual void cancel() = 0; - virtual ~WebTask(); - -private: - virtual void Run() { run(); } protected: - TaskList* m_taskList; + WebTaskList* m_taskList; }; -class TaskList { +class WebTaskList { public: - TaskList() { } - ~TaskList() { revokeAll(); } - void registerTask(WebTask* task) { m_tasks.append(task); } + WebTaskList(); + ~WebTaskList(); + void registerTask(WebTask*); void unregisterTask(WebTask*); void revokeAll(); private: - Vector<WebTask*> m_tasks; + class Private; + Private* m_private; }; -// A task containing an object pointer of class T. Is is supposed that -// runifValid() calls a member function of the object pointer. -// Class T must have "TaskList* taskList()". -template<class T> class MethodTask: public WebTask { +// A task containing an object pointer of class T. Derived classes should +// override runIfValid() which in turn can safely invoke methods on the +// m_object. The Class T must have "WebTaskList* taskList()". +template<class T> +class WebMethodTask : public WebTask { public: - MethodTask(T* object): WebTask(object->taskList()), m_object(object) { } + explicit WebMethodTask(T* object) + : WebTask(object->taskList()) + , m_object(object) + { + } + + virtual ~WebMethodTask() { } + virtual void run() { if (m_object) runIfValid(); } + virtual void cancel() { m_object = 0; m_taskList->unregisterTask(this); m_taskList = 0; } + virtual void runIfValid() = 0; protected: T* m_object; }; -void postTask(WebTask*); -void postDelayedTask(WebTask*, int64_t ms); +} -#endif // Task_h +#endif // WebTask_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h index a4f62021c..dd3303352 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h @@ -41,6 +41,8 @@ class WebGamepads; namespace WebTestRunner { +class WebTask; + class WebTestDelegate { public: virtual void clearContextMenuData() = 0; @@ -49,6 +51,14 @@ public: virtual void setEditCommand(const std::string& name, const std::string& value) = 0; virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0; virtual void setGamepadData(const WebKit::WebGamepads&) = 0; + virtual void printMessage(const std::string& message) const = 0; + + // The delegate takes ownership of the WebTask objects and is responsible + // for deleting them. + virtual void postTask(WebTask*) = 0; + virtual void postDelayedTask(WebTask*, long long ms) = 0; + + virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) = 0; }; } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp index 8e25db2d2..5f1b4f9a9 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "AccessibilityControllerChromium.h" +#include "TestDelegate.h" #include "WebAccessibilityObject.h" #include "WebElement.h" #include "WebFrame.h" @@ -197,8 +198,7 @@ void AccessibilityController::accessibleElementByIdGetterCallback(const CppArgum void AccessibilityController::fallbackCallback(const CppArgumentList&, CppVariant* result) { - printf("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on " - "AccessibilityController\n"); + m_delegate->printMessage("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on AccessibilityController\n"); result->setNull(); } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h index 4dd7f8705..35bf06c56 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h @@ -40,6 +40,8 @@ class WebFrame; class WebView; } +class TestDelegate; + namespace WebTestRunner { class AccessibilityController : public CppBoundClass { @@ -59,6 +61,7 @@ public: void notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName); + void setDelegate(TestDelegate* delegate) { m_delegate = delegate; } void setWebView(WebKit::WebView* webView) { m_webView = webView; } private: @@ -84,6 +87,7 @@ private: std::vector<CppVariant> m_notificationCallbacks; + TestDelegate* m_delegate; WebKit::WebView* m_webView; }; diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp index 310ae6c48..2f4a0554c 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp @@ -51,6 +51,7 @@ #include "platform/WebDragData.h" #include "platform/WebPoint.h" #include "platform/WebString.h" +#include "platform/WebVector.h" #include "webkit/support/webkit_support.h" #include <wtf/Deque.h> #include <wtf/StringExtras.h> @@ -369,7 +370,7 @@ void EventSender::dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*) break; } } - printf("Filename being dragged: %s\n", filename.utf8().data()); + m_delegate->printMessage(std::string("Filename being dragged: ") + filename.utf8().data() + "\n"); } WebMouseEvent::Button EventSender::getButtonTypeFromButtonNumber(int buttonCode) @@ -854,20 +855,20 @@ void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* res result->set(WebBindings::makeStringArray(makeMenuItemStringsFor(lastContextMenu, m_delegate))); } -class MouseDownTask: public MethodTask<EventSender> { +class MouseDownTask: public WebMethodTask<EventSender> { public: MouseDownTask(EventSender* obj, const CppArgumentList& arg) - : MethodTask<EventSender>(obj), m_arguments(arg) { } + : WebMethodTask<EventSender>(obj), m_arguments(arg) { } virtual void runIfValid() { m_object->mouseDown(m_arguments, 0); } private: CppArgumentList m_arguments; }; -class MouseUpTask: public MethodTask<EventSender> { +class MouseUpTask: public WebMethodTask<EventSender> { public: MouseUpTask(EventSender* obj, const CppArgumentList& arg) - : MethodTask<EventSender>(obj), m_arguments(arg) { } + : WebMethodTask<EventSender>(obj), m_arguments(arg) { } virtual void runIfValid() { m_object->mouseUp(m_arguments, 0); } private: @@ -877,14 +878,14 @@ private: void EventSender::scheduleAsynchronousClick(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); - postTask(new MouseDownTask(this, arguments)); - postTask(new MouseUpTask(this, arguments)); + m_delegate->postTask(new MouseDownTask(this, arguments)); + m_delegate->postTask(new MouseUpTask(this, arguments)); } -class KeyDownTask : public MethodTask<EventSender> { +class KeyDownTask : public WebMethodTask<EventSender> { public: KeyDownTask(EventSender* obj, const CppArgumentList& arg) - : MethodTask<EventSender>(obj), m_arguments(arg) { } + : WebMethodTask<EventSender>(obj), m_arguments(arg) { } virtual void runIfValid() { m_object->keyDown(m_arguments, 0); } private: @@ -894,22 +895,22 @@ private: void EventSender::scheduleAsynchronousKeyDown(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); - postTask(new KeyDownTask(this, arguments)); + m_delegate->postTask(new KeyDownTask(this, arguments)); } void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVariant* result) { currentDragData.initialize(); Vector<string> files = arguments[0].toStringVector(); - Vector<WebString> absoluteFilenames; + WebVector<WebString> absoluteFilenames(files.size()); for (size_t i = 0; i < files.size(); ++i) { WebDragData::Item item; item.storageType = WebDragData::Item::StorageTypeFilename; item.filenameData = webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i]); currentDragData.addItem(item); - absoluteFilenames.append(item.filenameData); + absoluteFilenames[i] = item.filenameData; } - currentDragData.setFilesystemId(webkit_support::RegisterIsolatedFileSystem(absoluteFilenames)); + currentDragData.setFilesystemId(m_delegate->registerIsolatedFileSystem(absoluteFilenames)); currentDragEffectsAllowed = WebKit::WebDragOperationCopy; // Provide a drag source. diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h index 65dfccb8c..d07e14cc6 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h @@ -38,9 +38,9 @@ #define EventSender_h #include "CppBoundClass.h" -#include "Task.h" #include "WebDragOperation.h" #include "WebInputEvent.h" +#include "WebTask.h" #include "platform/WebPoint.h" namespace WebKit { @@ -131,7 +131,7 @@ public: CppVariant wmSysDeadChar; #endif - TaskList* taskList() { return &m_taskList; } + WebTaskList* taskList() { return &m_taskList; } private: WebKit::WebView* webview() { return m_webView; } @@ -165,7 +165,7 @@ private: // Handle a request to send a wheel event. void handleMouseWheel(const CppArgumentList&, CppVariant*, bool continuous); - TaskList m_taskList; + WebTaskList m_taskList; TestDelegate* m_delegate; WebKit::WebView* m_webView; diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp index cb36bfdfb..282ce44de 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp @@ -67,7 +67,7 @@ void GamepadController::reset() void GamepadController::connect(const CppArgumentList& args, CppVariant* result) { if (args.size() < 1) { - printf("Invalid args"); + m_delegate->printMessage("Invalid args"); return; } int index = args[0].toInt32(); @@ -85,7 +85,7 @@ void GamepadController::connect(const CppArgumentList& args, CppVariant* result) void GamepadController::disconnect(const CppArgumentList& args, CppVariant* result) { if (args.size() < 1) { - printf("Invalid args"); + m_delegate->printMessage("Invalid args"); return; } int index = args[0].toInt32(); @@ -103,7 +103,7 @@ void GamepadController::disconnect(const CppArgumentList& args, CppVariant* resu void GamepadController::setId(const CppArgumentList& args, CppVariant* result) { if (args.size() < 2) { - printf("Invalid args"); + m_delegate->printMessage("Invalid args"); return; } int index = args[0].toInt32(); @@ -121,7 +121,7 @@ void GamepadController::setId(const CppArgumentList& args, CppVariant* result) void GamepadController::setButtonCount(const CppArgumentList& args, CppVariant* result) { if (args.size() < 2) { - printf("Invalid args"); + m_delegate->printMessage("Invalid args"); return; } int index = args[0].toInt32(); @@ -138,7 +138,7 @@ void GamepadController::setButtonCount(const CppArgumentList& args, CppVariant* void GamepadController::setButtonData(const CppArgumentList& args, CppVariant* result) { if (args.size() < 3) { - printf("Invalid args"); + m_delegate->printMessage("Invalid args"); return; } int index = args[0].toInt32(); @@ -156,7 +156,7 @@ void GamepadController::setButtonData(const CppArgumentList& args, CppVariant* r void GamepadController::setAxisCount(const CppArgumentList& args, CppVariant* result) { if (args.size() < 2) { - printf("Invalid args"); + m_delegate->printMessage("Invalid args"); return; } int index = args[0].toInt32(); @@ -173,7 +173,7 @@ void GamepadController::setAxisCount(const CppArgumentList& args, CppVariant* re void GamepadController::setAxisData(const CppArgumentList& args, CppVariant* result) { if (args.size() < 3) { - printf("Invalid args"); + m_delegate->printMessage("Invalid args"); return; } int index = args[0].toInt32(); @@ -190,7 +190,6 @@ void GamepadController::setAxisData(const CppArgumentList& args, CppVariant* res void GamepadController::fallbackCallback(const CppArgumentList&, CppVariant* result) { - printf("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on " - "GamepadController\n"); + m_delegate->printMessage("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on GamepadController\n"); result->setNull(); } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h index 0b0d9622e..218bbdf42 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h @@ -39,6 +39,10 @@ struct WebContextMenuData; class WebGamepads; } +namespace WebTestRunner { +class WebTask; +} + class TestDelegate { public: virtual void clearContextMenuData() = 0; @@ -47,6 +51,10 @@ public: virtual void setEditCommand(const std::string& name, const std::string& value) = 0; virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0; virtual void setGamepadData(const WebKit::WebGamepads&) = 0; + virtual void printMessage(const std::string& message) const = 0; + virtual void postTask(WebTestRunner::WebTask*) = 0; + virtual void postDelayedTask(WebTestRunner::WebTask*, long long ms) = 0; + virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) = 0; }; #endif // TestDelegate_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp index cc821214b..8959bb1ba 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp @@ -58,7 +58,7 @@ TestInterfaces::~TestInterfaces() // m_gamepadController doesn't depend on WebView. m_textInputController->setWebView(0); - // m_accessibilityController doesn't depend on TestDelegate. + m_accessibilityController->setDelegate(0); m_eventSender->setDelegate(0); m_gamepadController->setDelegate(0); // m_textInputController doesn't depend on TestDelegate. @@ -74,7 +74,7 @@ void TestInterfaces::setWebView(WebView* webView) void TestInterfaces::setDelegate(TestDelegate* delegate) { - // m_accessibilityController doesn't depend on TestDelegate. + m_accessibilityController->setDelegate(delegate); m_eventSender->setDelegate(delegate); m_gamepadController->setDelegate(delegate); // m_textInputController doesn't depend on TestDelegate. diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h index f7069401a..39e19d573 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h @@ -33,7 +33,6 @@ #define TestRunner_h #include "CppBoundClass.h" -#include "Task.h" #include "WebDeliveredIntentClient.h" #include "WebTextDirection.h" #include "platform/WebArrayBufferView.h" diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/Task.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTask.cpp index d80beef34..97531c80d 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/Task.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTask.cpp @@ -29,12 +29,14 @@ */ #include "config.h" -#include "Task.h" +#include "WebTask.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" +#include <wtf/Vector.h> -WebTask::WebTask(TaskList* list) +namespace WebTestRunner { + +WebTask::WebTask(WebTaskList* list) : m_taskList(list) { m_taskList->registerTask(this); @@ -46,34 +48,36 @@ WebTask::~WebTask() m_taskList->unregisterTask(this); } -void TaskList::unregisterTask(WebTask* task) +class WebTaskList::Private : public Vector<WebTask*> { +}; + +WebTaskList::WebTaskList() + : m_private(new Private) { - size_t index = m_tasks.find(task); - if (index != notFound) - m_tasks.remove(index); } -void TaskList::revokeAll() +WebTaskList::~WebTaskList() { - while (!m_tasks.isEmpty()) - m_tasks[0]->cancel(); + revokeAll(); + delete m_private; } -static void invokeTask(void* context) +void WebTaskList::registerTask(WebTask* task) { - WebTask* task = static_cast<WebTask*>(context); - task->run(); - delete task; + m_private->append(task); } -void postTask(WebTask* task) +void WebTaskList::unregisterTask(WebTask* task) { - WebKit::webKitPlatformSupport()->callOnMainThread(invokeTask, static_cast<void*>(task)); + size_t index = m_private->find(task); + if (index != notFound) + m_private->remove(index); } -void postDelayedTask(WebTask* task, int64_t ms) +void WebTaskList::revokeAll() { - webkit_support::PostDelayedTask(task, ms); + while (!m_private->isEmpty()) + (*m_private)[0]->cancel(); } - +} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp index 3d5b0de3e..632d9664b 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp @@ -63,6 +63,10 @@ public: virtual void setEditCommand(const std::string& name, const std::string& value); virtual WebContextMenuData* lastContextMenuData() const; virtual void setGamepadData(const WebGamepads&); + virtual void printMessage(const std::string& message) const; + virtual void postTask(WebTask*); + virtual void postDelayedTask(WebTask*, long long ms); + virtual WebString registerIsolatedFileSystem(const WebVector<WebString>& absoluteFilenames); private: TestInterfaces m_interfaces; @@ -123,6 +127,26 @@ void WebTestInterfaces::Internal::setGamepadData(const WebGamepads& pads) m_delegate->setGamepadData(pads); } +void WebTestInterfaces::Internal::printMessage(const std::string& message) const +{ + m_delegate->printMessage(message); +} + +void WebTestInterfaces::Internal::postTask(WebTask* task) +{ + m_delegate->postTask(task); +} + +void WebTestInterfaces::Internal::postDelayedTask(WebTask* task, long long ms) +{ + m_delegate->postDelayedTask(task, ms); +} + +WebString WebTestInterfaces::Internal::registerIsolatedFileSystem(const WebVector<WebString>& absoluteFilenames) +{ + return m_delegate->registerIsolatedFileSystem(absoluteFilenames); +} + WebTestInterfaces::WebTestInterfaces() { m_internal = new Internal; diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 4854f5ea3..2692e7458 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -68,6 +68,7 @@ using namespace WebKit; +using namespace WebTestRunner; using namespace std; // Content area size for newly created windows. @@ -154,7 +155,7 @@ TestShell::TestShell() void TestShell::initialize() { m_webPermissions = adoptPtr(new WebPermissions(this)); - m_testInterfaces = adoptPtr(new WebTestRunner::WebTestInterfaces()); + m_testInterfaces = adoptPtr(new WebTestInterfaces()); m_testRunner = adoptPtr(new DRTTestRunner(this)); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) m_notificationPresenter = adoptPtr(new NotificationPresenter(this)); diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp index ed13ffa58..3878ff167 100644 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp +++ b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp @@ -34,6 +34,7 @@ #include "WebUserMediaClientMock.h" #include "MockConstraints.h" +#include "Task.h" #include "WebDocument.h" #include "WebMediaStreamRegistry.h" #include "WebUserMediaRequest.h" @@ -44,11 +45,12 @@ #include <wtf/Assertions.h> using namespace WebKit; +using namespace WebTestRunner; -class UserMediaRequestTask : public MethodTask<WebUserMediaClientMock> { +class UserMediaRequestTask : public WebMethodTask<WebUserMediaClientMock> { public: UserMediaRequestTask(WebUserMediaClientMock* object, const WebUserMediaRequest& request, const WebMediaStreamDescriptor result) - : MethodTask<WebUserMediaClientMock>(object) + : WebMethodTask<WebUserMediaClientMock>(object) , m_request(request) , m_result(result) { diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h index f43875976..ef4cb51d1 100644 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h +++ b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h @@ -33,7 +33,7 @@ #if ENABLE(MEDIA_STREAM) -#include "TestRunner/src/Task.h" +#include "WebTask.h" #include "WebUserMediaClient.h" #include "webkit/support/test_media_stream_client.h" #include <public/WebCommon.h> @@ -50,12 +50,12 @@ public: virtual void cancelUserMediaRequest(const WebKit::WebUserMediaRequest&); // Task related methods - TaskList* taskList() { return &m_taskList; } + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } private: WebUserMediaClientMock() { } - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; }; #endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index 106caa978..18422db58 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -35,6 +35,7 @@ #include "MockGrammarCheck.h" #include "MockWebSpeechInputController.h" #include "MockWebSpeechRecognizer.h" +#include "Task.h" #include "TestNavigationController.h" #include "TestShell.h" #include "TestWebPlugin.h" @@ -88,6 +89,7 @@ using namespace WebCore; using namespace WebKit; +using namespace WebTestRunner; using namespace std; static const int screenWidth = 1920; @@ -579,16 +581,6 @@ void WebViewHost::showContextMenu(WebFrame*, const WebContextMenuData& contextMe m_lastContextMenuData = adoptPtr(new WebContextMenuData(contextMenuData)); } -void WebViewHost::clearContextMenuData() -{ - m_lastContextMenuData.clear(); -} - -WebContextMenuData* WebViewHost::lastContextMenuData() const -{ - return m_lastContextMenuData.get(); -} - void WebViewHost::setStatusText(const WebString& text) { if (!testRunner()->shouldDumpStatusCallbacks()) @@ -774,11 +766,6 @@ MockSpellCheck* WebViewHost::mockSpellCheck() return &m_spellcheck; } -void WebViewHost::fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) -{ - mockSpellCheck()->fillSuggestionList(word, suggestions); -} - WebDeviceOrientationClient* WebViewHost::deviceOrientationClient() { return deviceOrientationClientMock(); @@ -1459,6 +1446,60 @@ void WebViewHost::deliveredIntentFailure(WebFrame* frame, int id, const WebSeria printf("Web intent failure for id %d\n", id); } +// WebTestDelegate ------------------------------------------------------------ + +WebContextMenuData* WebViewHost::lastContextMenuData() const +{ + return m_lastContextMenuData.get(); +} + +void WebViewHost::clearContextMenuData() +{ + m_lastContextMenuData.clear(); +} + +void WebViewHost::setEditCommand(const string& name, const string& value) +{ + m_editCommandName = name; + m_editCommandValue = value; +} + +void WebViewHost::clearEditCommand() +{ + m_editCommandName.clear(); + m_editCommandValue.clear(); +} + +void WebViewHost::fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) +{ + mockSpellCheck()->fillSuggestionList(word, suggestions); +} + +void WebViewHost::setGamepadData(const WebGamepads& pads) +{ + webkit_support::SetGamepadData(pads); +} + +void WebViewHost::printMessage(const std::string& message) const +{ + printf("%s", message.c_str()); +} + +void WebViewHost::postTask(WebTask* task) +{ + ::postTask(task); +} + +void WebViewHost::postDelayedTask(WebTask* task, long long ms) +{ + ::postDelayedTask(task, ms); +} + +WebString WebViewHost::registerIsolatedFileSystem(const WebVector<WebString>& absoluteFilenames) +{ + return webkit_support::RegisterIsolatedFileSystem(absoluteFilenames); +} + // Public functions ----------------------------------------------------------- WebViewHost::WebViewHost(TestShell* shell) @@ -1594,18 +1635,6 @@ void WebViewHost::waitForPolicyDelegate() m_policyDelegateShouldNotifyDone = true; } -void WebViewHost::setEditCommand(const string& name, const string& value) -{ - m_editCommandName = name; - m_editCommandValue = value; -} - -void WebViewHost::clearEditCommand() -{ - m_editCommandName.clear(); - m_editCommandValue.clear(); -} - void WebViewHost::loadURLForFrame(const WebURL& url, const WebString& frameName) { if (!url.isValid()) @@ -1790,11 +1819,6 @@ void WebViewHost::setDeviceScaleFactor(float deviceScaleFactor) discardBackingStore(); } -void WebViewHost::setGamepadData(const WebGamepads& pads) -{ - webkit_support::SetGamepadData(pads); -} - void WebViewHost::setPageTitle(const WebString&) { // Nothing to do in layout test. diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index ba763503a..41237cba9 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -33,13 +33,13 @@ #include "MockSpellCheck.h" #include "TestNavigationController.h" -#include "TestRunner/src/Task.h" #include "WebAccessibilityNotification.h" #include "WebCursorInfo.h" #include "WebFrameClient.h" #include "WebIntentRequest.h" #include "WebPrerendererClient.h" #include "WebSpellCheckClient.h" +#include "WebTask.h" #include "WebTestDelegate.h" #include "WebViewClient.h" #include <wtf/HashMap.h> @@ -95,13 +95,9 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, WebKit::WebFrame* topLoadingFrame() { return m_topLoadingFrame; } void setBlockRedirects(bool block) { m_blocksRedirects = block; } void setRequestReturnNull(bool returnNull) { m_requestReturnNull = returnNull; } - virtual void setEditCommand(const std::string& name, const std::string& value) OVERRIDE; - virtual void clearEditCommand() OVERRIDE; void setPendingExtraData(PassOwnPtr<TestShellExtraData>); void setDeviceScaleFactor(float); - virtual void setGamepadData(const WebKit::WebGamepads&); - void paintRect(const WebKit::WebRect&); void updatePaintRect(const WebKit::WebRect&); void paintInvalidatedRegion(); @@ -116,9 +112,6 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, const HashSet<WTF::String>& clearHeaders() const { return m_clearHeaders; } void closeWidget(); - virtual WebKit::WebContextMenuData* lastContextMenuData() const OVERRIDE; - virtual void clearContextMenuData() OVERRIDE; - #if ENABLE(INPUT_SPEECH) MockWebSpeechInputController* speechInputControllerMock() { return m_speechInputControllerMock.get(); } #endif @@ -135,6 +128,18 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, void setPointerLockWillFailSynchronously() { m_pointerLockPlannedResult = PointerLockWillFailSync; } #endif + // WebTestDelegate. + virtual WebKit::WebContextMenuData* lastContextMenuData() const OVERRIDE; + virtual void clearContextMenuData() OVERRIDE; + virtual void setEditCommand(const std::string& name, const std::string& value) OVERRIDE; + virtual void clearEditCommand() OVERRIDE; + virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) OVERRIDE; + virtual void setGamepadData(const WebKit::WebGamepads&) OVERRIDE; + virtual void printMessage(const std::string& message) const OVERRIDE; + virtual void postTask(WebTestRunner::WebTask*) OVERRIDE; + virtual void postDelayedTask(WebTestRunner::WebTask*, long long ms) OVERRIDE; + virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) OVERRIDE; + // NavigationHost virtual bool navigate(const TestNavigationEntry&, bool reload); @@ -281,24 +286,23 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, // Spellcheck related helper APIs MockSpellCheck* mockSpellCheck(); void finishLastTextCheck(); - virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) OVERRIDE; // Geolocation client mocks for DRTTestRunner WebKit::WebGeolocationClientMock* geolocationClientMock(); - // Pending task list, Note taht the method is referred from MethodTask class. - TaskList* taskList() { return &m_taskList; } + // Pending task list, Note taht the method is referred from WebMethodTask class. + WebTestRunner::WebTaskList* taskList() { return &m_taskList; } // The current web intents request. WebKit::WebIntentRequest* currentIntentRequest() { return &m_currentRequest; } private: - class HostMethodTask : public MethodTask<WebViewHost> { + class HostMethodTask : public WebTestRunner::WebMethodTask<WebViewHost> { public: typedef void (WebViewHost::*CallbackMethodType)(); HostMethodTask(WebViewHost* object, CallbackMethodType callback) - : MethodTask<WebViewHost>(object) + : WebTestRunner::WebMethodTask<WebViewHost>(object) , m_callback(callback) { } @@ -441,7 +445,7 @@ private: WebKit::WebString m_lastRequestedTextCheckString; WebKit::WebTextCheckingCompletion* m_lastRequestedTextCheckingCompletion; - TaskList m_taskList; + WebTestRunner::WebTaskList m_taskList; Vector<WebKit::WebWidget*> m_popupmenus; #if ENABLE(POINTER_LOCK) diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py index 06f0d04b3..5396024a0 100644 --- a/Tools/Scripts/webkitpy/common/config/committers.py +++ b/Tools/Scripts/webkitpy/common/config/committers.py @@ -379,6 +379,7 @@ committers_unable_to_review = [ Committer("Shawn Singh", "shawnsingh@chromium.org", "shawnsingh"), Committer("Shinya Kawanaka", "shinyak@chromium.org", "shinyak"), Committer("Siddharth Mathur", "siddharth.mathur@nokia.com", "simathur"), + Committer("Simon Pena", "spena@igalia.com", "spenap"), Committer("Stephen Chenney", "schenney@chromium.org", "schenney"), Committer("Steve Lacey", "sjl@chromium.org", "stevela"), Committer("Taiju Tsuiki", "tzik@chromium.org", "tzik"), diff --git a/Tools/Scripts/webkitpy/common/config/watchlist b/Tools/Scripts/webkitpy/common/config/watchlist index 941f9b2b9..ac2270004 100755 --- a/Tools/Scripts/webkitpy/common/config/watchlist +++ b/Tools/Scripts/webkitpy/common/config/watchlist @@ -183,6 +183,12 @@ r"|.*\w+\.cmake" r"|Source/cmake/", }, + "Selectors": { + "filename": r"Source/WebCore/css/CSSSelector*" + r"|Source/WebCore/css/SelectorChecker.*" + r"|Source/WebCore/css/StyleResolver.*" + r"|Source/WebCore/dom/SelectorQuery.*", + }, "SoupNetwork": { "filename": r"Source/WebCore/platform/network/soup/", }, @@ -286,7 +292,7 @@ "BlackBerry": [ "mifenton@rim.com", "rwlbuis@gmail.com", "tonikitoo@webkit.org" ], "Cairo": [ "dominik.rottsches@intel.com" ], "CMake": [ "rakuco@webkit.org", "gyuyoung.kim@samsung.com" ], - "CSS": [ "alexis@webkit.org", "macpherson@chromium.org", "cmarcelo@webkit.org", "allan.jensen@digia.com" ], + "CSS": [ "alexis@webkit.org", "macpherson@chromium.org", "cmarcelo@webkit.org"], "ChromiumGraphics": [ "jamesr@chromium.org", "cc-bugs@chromium.org" ], "ChromiumPublicApi": [ "abarth@webkit.org", "dglazkov@chromium.org", "fishd@chromium.org", "jamesr@chromium.org", "tkent+wkapi@chromium.org" ], "DOMAttributes": [ "cmarcelo@webkit.org", ], @@ -316,6 +322,7 @@ "ScrollingCoordinator": [ "andersca@apple.com", "jamesr@chromium.org", "tonikitoo@webkit.org" ], "SecurityCritical": [ "abarth@webkit.org" ], "SkiaGraphics": [ "senorblanco@chromium.org" ], + "Selectors": [ "allan.jensen@digia.com" ], "SoupNetwork": [ "rakuco@webkit.org", "gns@gnome.org", "mrobinson@webkit.org", "danw@gnome.org" ], "StyleChecker": [ "levin@chromium.org", ], "TestFailures": [ "abarth@webkit.org", "dglazkov@chromium.org" ], diff --git a/Tools/Scripts/webkitpy/common/find_files.py b/Tools/Scripts/webkitpy/common/find_files.py index 82bbc91dd..32ce4d105 100644 --- a/Tools/Scripts/webkitpy/common/find_files.py +++ b/Tools/Scripts/webkitpy/common/find_files.py @@ -44,13 +44,6 @@ If a callback is passed in, it will be called for the each file and the file will be included into the result if the callback returns True. The callback has to take three arguments: filesystem, dirname and filename.""" -import time - -from webkitpy.common.system import logutils - - -_log = logutils.get_logger(__file__) - def find(filesystem, base_dir, paths=None, skipped_directories=None, file_filter=None): """Finds the set of tests under a given list of sub-paths. @@ -78,7 +71,6 @@ def _normalized_find(filesystem, paths, skipped_directories, file_filter): paths: a list of absolute path expressions to search. Glob patterns are ok. """ - gather_start_time = time.time() paths_to_walk = set() for path in paths: @@ -95,7 +87,4 @@ def _normalized_find(filesystem, paths, skipped_directories, file_filter): files = filesystem.files_under(path, skipped_directories, file_filter) all_files.update(set(files)) - gather_time = time.time() - gather_start_time - _log.debug("Test gathering took %f seconds" % gather_time) - return all_files diff --git a/Tools/Scripts/webkitpy/layout_tests/port/builders.py b/Tools/Scripts/webkitpy/layout_tests/port/builders.py index 74af7b4b7..c2ab8d212 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/builders.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/builders.py @@ -57,6 +57,7 @@ _exact_matches = { "WebKit Mac10.6": {"port_name": "chromium-mac-snowleopard", "specifiers": set(["snowleopard"])}, "WebKit Mac10.6 (dbg)": {"port_name": "chromium-mac-snowleopard", "specifiers": set(["snowleopard", "debug"])}, "WebKit Mac10.7": {"port_name": "chromium-mac-lion", "specifiers": set(["lion", "release"])}, + "WebKit Mac10.7 (dbg)": {"port_name": "chromium-mac-lion", "specifiers": set(["lion", "debug"])}, "WebKit Mac10.8": {"port_name": "chromium-mac-mountainlion", "specifiers": set(["mountainlion", "release"])}, # These builders are on build.webkit.org. diff --git a/Tools/TestResultServer/static-dashboards/builders.js b/Tools/TestResultServer/static-dashboards/builders.js index 43902ffe7..2a6b67d14 100644 --- a/Tools/TestResultServer/static-dashboards/builders.js +++ b/Tools/TestResultServer/static-dashboards/builders.js @@ -45,7 +45,6 @@ BuilderMaster.prototype.builderJsonPath = function() return this.basePath + 'json/builders'; }; -CHROMIUM_BUILDER_MASTER = new BuilderMaster('Chromium', 'http://build.chromium.org/p/chromium/'); CHROMIUM_WIN_BUILDER_MASTER = new BuilderMaster('ChromiumWin', 'http://build.chromium.org/p/chromium.win/'); CHROMIUM_MAC_BUILDER_MASTER = new BuilderMaster('ChromiumMac', 'http://build.chromium.org/p/chromium.mac/'); CHROMIUM_LINUX_BUILDER_MASTER = new BuilderMaster('ChromiumLinux', 'http://build.chromium.org/p/chromium.linux/'); @@ -178,7 +177,7 @@ function isChromiumWebkitDepsTestRunner(builder) function isChromiumDepsGTestRunner(builder) { - return (builder.indexOf('Tests') != -1 || builder.indexOf('Sync') != -1) && builder.indexOf('Chrome Frame') == -1; + return builder.indexOf('Builder') == -1; } function isChromiumDepsCrosGTestRunner(builder) @@ -289,7 +288,6 @@ function loadBuildersList(groupName, testType) { switch(groupName) { case '@DEPS - chromium.org': var builderGroup = new BuilderGroup(BuilderGroup.DEPS_WEBKIT); - requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_BUILDER_MASTER, groupName, builderGroup); requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_WIN_BUILDER_MASTER, groupName, builderGroup); requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_MAC_BUILDER_MASTER, groupName, builderGroup); requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_LINUX_BUILDER_MASTER, groupName, builderGroup); diff --git a/Tools/TestResultServer/static-dashboards/dashboard_base.js b/Tools/TestResultServer/static-dashboards/dashboard_base.js index 59502d603..6ec0c8e42 100644 --- a/Tools/TestResultServer/static-dashboards/dashboard_base.js +++ b/Tools/TestResultServer/static-dashboards/dashboard_base.js @@ -114,8 +114,6 @@ var ONE_WEEK_SECONDS = ONE_DAY_SECONDS * 7; // These should match the testtype uploaded to test-results.appspot.com. // See http://test-results.appspot.com/testfile. var TEST_TYPES = [ - 'aura_unittests', - 'aura_shell_unittests', 'base_unittests', 'browser_tests', 'cacheinvalidation_unittests', @@ -136,7 +134,6 @@ var TEST_TYPES = [ 'layout-tests', 'media_unittests', 'mini_installer_test', - 'nacl_ui_tests', 'net_unittests', 'printing_unittests', 'remoting_unittests', diff --git a/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp b/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp index c6368bf3f..9a998da03 100644 --- a/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp +++ b/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp @@ -734,7 +734,15 @@ TEST(MemoryInstrumentationTest, arrayBuffer) EXPECT_EQ(2u, helper.visitedObjects()); } -class ClassWithTwoAncestors : public NotInstrumented, public Instrumented { +class AncestorWithVirtualMethod { +public: + virtual char* data() { return m_data; } + +private: + char m_data[10]; +}; + +class ClassWithTwoAncestors : public AncestorWithVirtualMethod, public Instrumented { public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { @@ -751,10 +759,11 @@ TEST(MemoryInstrumentationTest, instrumentedWithMultipleAncestors) InstrumentedOwner<ClassWithTwoAncestors*> descendantPointerOwner(descendantPointer); Instrumented* ancestorPointer = descendantPointer; InstrumentedOwner<Instrumented*> ancestorPointerOwner(ancestorPointer); + EXPECT_NE(static_cast<void*>(ancestorPointer), static_cast<void*>(descendantPointer)); helper.addRootObject(descendantPointerOwner); helper.addRootObject(ancestorPointerOwner); EXPECT_EQ(sizeof(ClassWithTwoAncestors), helper.reportedSizeForAllTypes()); - EXPECT_EQ(1u, helper.visitedObjects()); + EXPECT_EQ(2u, helper.visitedObjects()); } } // namespace |
