diff options
Diffstat (limited to 'Source')
703 files changed, 17886 insertions, 8022 deletions
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 10fca607d..4eeefa508 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,20 +1,285 @@ -2012-06-13 Patrick Gansterer <paroga@webkit.org> +2012-07-23 Kent Tamura <tkent@chromium.org> - [WIN] Remove dependency on pthread from MachineStackMarker - https://bugs.webkit.org/show_bug.cgi?id=68429 + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 - Reviewed by NOBODY (OOPS!). + Reviewed by Kentaro Hara. - Implement pthread TLS functionality with native windows functions. + A flag name for an elmement should be ENABLE_*_ELEMENT. - * heap/MachineStackMarker.cpp: Use the new functions instead of pthread directly. - * heap/MachineStackMarker.h: - * wtf/ThreadSpecific.h: - (WTF::ThreadSpecificKeyCreate): Added wrapper around pthread_key_create. - (WTF::ThreadSpecificKeyDelete): Added wrapper around pthread_key_delete. - (WTF::ThreadSpecificSet): Added wrapper around pthread_setspecific. - (WTF::ThreadSpecificGet): Added wrapper around pthread_getspecific. - * wtf/ThreadSpecificWin.cpp: + * Configurations/FeatureDefines.xcconfig: + +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91928 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-21 Patrick Gansterer <paroga@webkit.org> + + [WIN] Use GetDateFormat and GetTimeFormat instead of strftime + https://bugs.webkit.org/show_bug.cgi?id=83436 + + Reviewed by Brent Fulgham. + + The MS CRT implementation of strftime calls the same two functions. + Using them directly avoids the overhead of parsing the format string and removes + the dependency on strftime() for WinCE where this function does not exist. + + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + +2012-07-20 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91846 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-20 Han Shen <shenhan@google.com> + + [Chromium] Compilation fails under gcc 4.7 + https://bugs.webkit.org/show_bug.cgi?id=90227 + + Reviewed by Tony Chang. + + Disable warnings about c++0x compatibility in gcc newer than 4.6. + + * JavaScriptCore.gyp/JavaScriptCore.gyp: + +2012-07-18 Filip Pizlo <fpizlo@apple.com> + + DFG cell checks should be hoisted + https://bugs.webkit.org/show_bug.cgi?id=91717 + + Reviewed by Geoffrey Garen. + + The DFG has always had the policy of hoisting array and integer checks to + the point of variable assignment. Eventually, we added doubles and booleans + to the mix. But cells should really be part of this as well, particularly + for 32-bit where accessing a known-type variable is dramatically cheaper + than accessing a variable whose types is only predicted but otherwise + unproven. + + This appears to be a definite speed-up for V8 on 32-bit, a possible speed-up + for Kraken, and a possible slow-down for V8 on 64-bit (around 0.2% if at + all). Any slow-downs can, and should, be addressed by making the hoisting + logic cognizant of variables that are never used in a manner that requires + type checks, and by sinking argument checks to the point(s) of first use. + + To make this work I had to change some OSR machinery, and special-case the + type predictions of the 'this' argument for constructors. OSR exit normally + assumes that arguments are boxed, which happens to be true because the + type prediction used for check hoisting is LUB'd with the type of the + argument that was passed in - so either the arguments are always stored to + with the full tag+payload, or if only the payload is stored then the tag + matches whatever the caller would have set. But not so with the 'this' + argument for constructors, which is not initialized by the caller. We + could make this more precise by having argument types for OSR be inferred + using similar machinery to other locals, but I figured that for this patch + I should use the surgical fix. + + * assembler/MacroAssemblerX86_64.h: + (JSC::MacroAssemblerX86_64::branchTestPtr): + (MacroAssemblerX86_64): + * assembler/X86Assembler.h: + (JSC::X86Assembler::testq_rm): + (X86Assembler): + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::initialize): + (JSC::DFG::AbstractState::execute): + * dfg/DFGDriver.cpp: + (JSC::DFG::compile): + * dfg/DFGGraph.h: + (JSC::DFG::Graph::isCreatedThisArgument): + (Graph): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::checkArgumentTypes): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGValueSource.h: + (JSC::DFG::ValueSource::forSpeculation): + +2012-07-19 Filip Pizlo <fpizlo@apple.com> + + Fast path of storage resize should be removed from property storage reallocation, since it is only useful for arrays + https://bugs.webkit.org/show_bug.cgi?id=91796 + + Reviewed by Geoffrey Garen. + + * dfg/DFGRepatch.cpp: + (JSC::DFG::emitPutTransitionStub): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): + * runtime/JSObject.cpp: + (JSC::JSObject::growOutOfLineStorage): + +2012-07-19 Mark Lam <mark.lam@apple.com> + + Bug fixes and enhancements for OfflineASM annotation system. + https://bugs.webkit.org/show_bug.cgi?id=91690 + + Reviewed by Filip Pizlo. + + * offlineasm/armv7.rb: added default handling of Instruction lower(). + * offlineasm/asm.rb: added more support for annotations and more pretty printing. + * offlineasm/ast.rb: added more support for annotations. + * offlineasm/config.rb: added $preferredCommentStartColumn, simplified $enableInstrAnnotations. + * offlineasm/parser.rb: added more support for annotations. + * offlineasm/transform.rb: added more support for annotations. + * offlineasm/x86.rb: added default handling of Instruction lower(). + +2012-07-19 Patrick Gansterer <paroga@webkit.org> + + [WIN] Fix compilation of JSGlobalData.h with ENABLE(DFG_JIT) + https://bugs.webkit.org/show_bug.cgi?id=91243 + + Reviewed by Geoffrey Garen. + + Disable MSVC warning 4200 "zero-sized array in struct/union" for JSC::ScratchBuffer. + + * runtime/JSGlobalData.h: + (JSC): + +2012-07-19 Mark Lam <mark.lam@apple.com> + + Fixed broken ENABLE_JIT=0 build. + https://bugs.webkit.org/show_bug.cgi?id=91725 + + Reviewed by Oliver Hunt. + + * bytecode/Watchpoint.cpp: + * heap/JITStubRoutineSet.h: + (JSC): + (JITStubRoutineSet): + (JSC::JITStubRoutineSet::JITStubRoutineSet): + (JSC::JITStubRoutineSet::~JITStubRoutineSet): + (JSC::JITStubRoutineSet::add): + (JSC::JITStubRoutineSet::clearMarks): + (JSC::JITStubRoutineSet::mark): + (JSC::JITStubRoutineSet::deleteUnmarkedJettisonedStubRoutines): + (JSC::JITStubRoutineSet::traceMarkedStubRoutines): + +2012-07-19 Kristóf Kosztyó <kkristof@inf.u-szeged.hu> + + [Qt] Unreviewed buildfix after r123042. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::dumpRegisters): + +2012-07-18 Filip Pizlo <fpizlo@apple.com> + + DFG should emit inline code for property storage (re)allocation + https://bugs.webkit.org/show_bug.cgi?id=91597 + + Reviewed by Oliver Hunt. + + This adds two new ops to the DFG IR: AllocatePropertyStorage and + ReallocatePropertyStorage. It enables these to interact properly with + CSE so that a GetPropertyStorage on something for which we have + obviously done a (Re)AllocatePropertyStorage will result in the + GetPropertyStorage being eliminated. Other than that, the code + emitted for these ops is identical to the code we were emitting in + the corresponding PutById stub. + + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parseBlock): + * dfg/DFGCSEPhase.cpp: + (JSC::DFG::CSEPhase::putStructureStoreElimination): + (JSC::DFG::CSEPhase::getPropertyStorageLoadElimination): + * dfg/DFGNode.h: + (JSC::DFG::Node::hasStructureTransitionData): + * dfg/DFGNodeType.h: + (DFG): + * dfg/DFGOperations.cpp: + * dfg/DFGOperations.h: + * dfg/DFGPredictionPropagationPhase.cpp: + (JSC::DFG::PredictionPropagationPhase::propagate): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): + (DFG): + (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::callOperation): + (SpeculativeJIT): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * runtime/Structure.cpp: + (JSC::nextOutOfLineStorageCapacity): + * runtime/Structure.h: + (JSC): + +2012-07-16 Oliver Hunt <oliver@apple.com> + + dumpCallFrame is broken in ToT + https://bugs.webkit.org/show_bug.cgi?id=91444 + + Reviewed by Gavin Barraclough. + + Various changes have been made to the SF calling convention, but + dumpCallFrame has not been updated to reflect these changes. + That resulted in both bogus information, as well as numerous + assertions of sadness. + + This patch makes dumpCallFrame actually work again and adds the + wonderful feature of telling you the name of the variable that a + register reflects, or what value it contains. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::nameForRegister): + A really innefficient mechanism for finding the name of a local register. + This should only ever be used by debug code so this should be okay. + * bytecode/CodeBlock.h: + (CodeBlock): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::generate): + Debug builds no longer throw away a functions symbol table, this allows + us to actually perform a register# to name mapping + * dfg/DFGJITCompiler.cpp: + (JSC::DFG::JITCompiler::link): + We weren't propogating the bytecode offset here leading to assertions + in debug builds when dumping bytecode of DFG compiled code. + * interpreter/Interpreter.cpp: + (JSC): + (JSC::Interpreter::dumpRegisters): + Rework to actually be correct. + (JSC::getCallerInfo): + Return the byteocde offset as well now, given we have to determine it + anyway. + (JSC::Interpreter::getStackTrace): + (JSC::Interpreter::retrieveCallerFromVMCode): + * interpreter/Interpreter.h: + (Interpreter): + * jsc.cpp: + (GlobalObject::finishCreation): + (functionDumpCallFrame): + Give debug builds of JSC a method for calling dumpCallFrame so we can + inspect a callframe without requiring us to break in a debugger. + +2012-07-18 Filip Pizlo <fpizlo@apple.com> + + DFG 32-bit PutById transition stub storage reallocation case copies the first pointer of each JSValue instead of the whole JSValue + https://bugs.webkit.org/show_bug.cgi?id=91599 + + Reviewed by Geoffrey Garen. + + * dfg/DFGRepatch.cpp: + (JSC::DFG::emitPutTransitionStub): 2012-07-17 Filip Pizlo <fpizlo@apple.com> diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index dcea98333..31853f34c 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -48,9 +48,9 @@ ENABLE_CSS_VARIABLES = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; -ENABLE_DATALIST = ; +ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; -ENABLE_DETAILS = ENABLE_DETAILS; +ENABLE_DETAILS_ELEMENT = ENABLE_DETAILS_ELEMENT; ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; @@ -97,7 +97,7 @@ ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; ENABLE_MEDIA_SOURCE = ; ENABLE_MEDIA_STATISTICS = ; -ENABLE_METER_TAG = ENABLE_METER_TAG; +ENABLE_METER_ELEMENT = ENABLE_METER_ELEMENT; ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; @@ -107,7 +107,7 @@ ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; -ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; @@ -134,4 +134,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp b/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp index c60a2e68d..4f7a205e7 100644 --- a/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp +++ b/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp @@ -47,7 +47,7 @@ ], }, 'conditions': [ - ['os_posix == 1 and OS != "mac" and gcc_version==46', { + ['os_posix == 1 and OS != "mac" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such as nullptr) conflict # with upcoming c++0x types. diff --git a/Source/JavaScriptCore/JavaScriptCore.pri b/Source/JavaScriptCore/JavaScriptCore.pri index f6580c51f..380bbaf1b 100644 --- a/Source/JavaScriptCore/JavaScriptCore.pri +++ b/Source/JavaScriptCore/JavaScriptCore.pri @@ -34,6 +34,12 @@ INCLUDEPATH += \ win32-* { LIBS += -lwinmm + + win32-g++* { + LIBS += -lpthreadGC2 + } else:win32-msvc* { + LIBS += -lpthreadVC2 + } } wince* { diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index dfa38aafb..d8f838e87 100755 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -163,6 +163,7 @@ EXPORTS ?displayName@JSFunction@JSC@@QAE?BVUString@2@PAVExecState@2@@Z ?dtoa@WTF@@YAXQADNAA_NAAHAAI@Z ?dumpAllOptions@Options@JSC@@SAXPAU_iobuf@@@Z + ?dumpCallFrame@Interpreter@JSC@@QAEXPAVExecState@2@@Z ?dumpSampleData@JSGlobalData@JSC@@QAEXPAVExecState@2@@Z ?empty@StringImpl@WTF@@SAPAV12@XZ ?enumerable@PropertyDescriptor@JSC@@QBE_NXZ diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h index 43bcddb64..f5af51323 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h @@ -476,6 +476,12 @@ public: return Jump(m_assembler.jCC(x86Condition(cond))); } + Jump branchTestPtr(ResultCondition cond, Address address, RegisterID reg) + { + m_assembler.testq_rm(reg, address.offset, address.base); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + Jump branchTestPtr(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1)) { if (mask.m_value == -1) diff --git a/Source/JavaScriptCore/assembler/X86Assembler.h b/Source/JavaScriptCore/assembler/X86Assembler.h index 83d681cf7..fc1c27245 100644 --- a/Source/JavaScriptCore/assembler/X86Assembler.h +++ b/Source/JavaScriptCore/assembler/X86Assembler.h @@ -997,6 +997,11 @@ public: m_formatter.oneByteOp64(OP_TEST_EvGv, src, dst); } + void testq_rm(RegisterID src, int offset, RegisterID base) + { + m_formatter.oneByteOp64(OP_TEST_EvGv, src, base, offset); + } + void testq_i32r(int imm, RegisterID dst) { m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, dst); diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index d417a5fbd..363efa28a 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -2942,4 +2942,29 @@ bool CodeBlock::usesOpcode(OpcodeID opcodeID) return false; } +UString CodeBlock::nameForRegister(int registerNumber) +{ + SymbolTable::iterator end = m_symbolTable->end(); + for (SymbolTable::iterator ptr = m_symbolTable->begin(); ptr != end; ++ptr) { + if (ptr->second.getIndex() == registerNumber) + return UString(ptr->first); + } + if (needsActivation() && registerNumber == activationRegister()) + return "activation"; + if (registerNumber == thisRegister()) + return "this"; + if (usesArguments()) { + if (registerNumber == argumentsRegister()) + return "arguments"; + if (unmodifiedArgumentsRegister(argumentsRegister()) == registerNumber) + return "real arguments"; + } + if (registerNumber < 0) { + int argumentPosition = -registerNumber; + argumentPosition -= RegisterFile::CallFrameHeaderSize + 1; + return String::format("arguments[%3d]", argumentPosition - 1).impl(); + } + return ""; +} + } // namespace JSC diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index 56ede595a..2a7d2120a 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -578,7 +578,9 @@ namespace JSC { void createActivation(CallFrame*); void clearEvalCache(); - + + UString nameForRegister(int registerNumber); + void addPropertyAccessInstruction(unsigned propertyAccessInstruction) { m_propertyAccessInstructions.append(propertyAccessInstruction); diff --git a/Source/JavaScriptCore/bytecode/Watchpoint.cpp b/Source/JavaScriptCore/bytecode/Watchpoint.cpp index 6f80dfa5e..75dfe8a76 100644 --- a/Source/JavaScriptCore/bytecode/Watchpoint.cpp +++ b/Source/JavaScriptCore/bytecode/Watchpoint.cpp @@ -27,6 +27,7 @@ #include "Watchpoint.h" #include "LinkBuffer.h" +#include <wtf/PassRefPtr.h> namespace JSC { diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index b104788c8..33f282c66 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -193,8 +193,10 @@ JSObject* BytecodeGenerator::generate() if (s_dumpsGeneratedCode) m_codeBlock->dump(m_scopeChain->globalObject->globalExec()); +#ifdef NDEBUG if ((m_codeType == FunctionCode && !m_codeBlock->needsFullScopeChain() && !m_codeBlock->usesArguments()) || m_codeType == EvalCode) symbolTable().clear(); +#endif m_codeBlock->shrinkToFit(CodeBlock::EarlyShrink); diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index e4561da06..01996f132 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -128,6 +128,8 @@ void AbstractState::initialize(Graph& graph) root->valuesAtHead.argument(i).set(SpecFloat32Array); else if (isFloat64ArraySpeculation(prediction)) root->valuesAtHead.argument(i).set(SpecFloat64Array); + else if (isCellSpeculation(prediction)) + root->valuesAtHead.argument(i).set(SpecCell); else root->valuesAtHead.argument(i).makeTop(); @@ -272,7 +274,8 @@ bool AbstractState::execute(unsigned indexInBlock) } case SetLocal: { - if (node.variableAccessData()->isCaptured()) { + if (node.variableAccessData()->isCaptured() + || m_graph.isCreatedThisArgument(node.local())) { m_variables.operand(node.local()) = forNode(node.child1()); node.setCanExit(false); break; @@ -290,6 +293,9 @@ bool AbstractState::execute(unsigned indexInBlock) else if (isArraySpeculation(predictedType)) { node.setCanExit(!isArraySpeculation(forNode(node.child1()).m_type)); forNode(node.child1()).filter(SpecArray); + } else if (isCellSpeculation(predictedType)) { + node.setCanExit(!isCellSpeculation(forNode(node.child1()).m_type)); + forNode(node.child1()).filter(SpecCell); } else if (isBooleanSpeculation(predictedType)) speculateBooleanUnary(node); else @@ -1437,6 +1443,8 @@ bool AbstractState::execute(unsigned indexInBlock) m_haveStructures = true; break; case GetPropertyStorage: + case AllocatePropertyStorage: + case ReallocatePropertyStorage: node.setCanExit(false); forNode(node.child1()).filter(SpecCell); forNode(nodeIndex).clear(); // The result is not a JS value. diff --git a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp index 1b1395934..e4e94e90b 100644 --- a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp +++ b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp @@ -2271,7 +2271,6 @@ bool ByteCodeParser::parseBlock(unsigned limit) m_graph.m_storageAccessData.append(storageAccessData); } else if (!hasExitSite && putByIdStatus.isSimpleTransition() - && putByIdStatus.oldStructure()->outOfLineCapacity() == putByIdStatus.newStructure()->outOfLineCapacity() && structureChainIsStillValid( direct, putByIdStatus.oldStructure(), @@ -2293,20 +2292,38 @@ bool ByteCodeParser::parseBlock(unsigned limit) } } ASSERT(putByIdStatus.oldStructure()->transitionWatchpointSetHasBeenInvalidated()); - addToGraph( - PutStructure, - OpInfo( - m_graph.addStructureTransitionData( - StructureTransitionData( - putByIdStatus.oldStructure(), - putByIdStatus.newStructure()))), - base); NodeIndex propertyStorage; - if (isInlineOffset(putByIdStatus.offset())) - propertyStorage = base; - else - propertyStorage = addToGraph(GetPropertyStorage, base); + StructureTransitionData* transitionData = + m_graph.addStructureTransitionData( + StructureTransitionData( + putByIdStatus.oldStructure(), + putByIdStatus.newStructure())); + + if (putByIdStatus.oldStructure()->outOfLineCapacity() + != putByIdStatus.newStructure()->outOfLineCapacity()) { + + // If we're growing the property storage then it must be because we're + // storing into the out-of-line storage. + ASSERT(!isInlineOffset(putByIdStatus.offset())); + + if (!putByIdStatus.oldStructure()->outOfLineCapacity()) { + propertyStorage = addToGraph( + AllocatePropertyStorage, OpInfo(transitionData), base); + } else { + propertyStorage = addToGraph( + ReallocatePropertyStorage, OpInfo(transitionData), + base, addToGraph(GetPropertyStorage, base)); + } + } else { + if (isInlineOffset(putByIdStatus.offset())) + propertyStorage = base; + else + propertyStorage = addToGraph(GetPropertyStorage, base); + } + + addToGraph(PutStructure, OpInfo(transitionData), base); + addToGraph( PutByOffset, OpInfo(m_graph.m_storageAccessData.size()), diff --git a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp index 04c3ebc66..4532214ee 100644 --- a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp @@ -465,6 +465,8 @@ private: case NewArray: case NewObject: case CreateThis: + case AllocatePropertyStorage: + case ReallocatePropertyStorage: return NoNode; default: @@ -581,6 +583,17 @@ private: if (node.child1() == child1) return index; break; + + case AllocatePropertyStorage: + case ReallocatePropertyStorage: + // If we can cheaply prove this is a change to our object's storage, we + // can optimize and use its result. + if (node.child1() == child1) + return index; + // Otherwise, we currently can't prove that this doesn't change our object's + // storage, so we conservatively assume that it may change the storage + // pointer of any object, including ours. + return NoNode; case PutByOffset: case PutStructure: diff --git a/Source/JavaScriptCore/dfg/DFGDriver.cpp b/Source/JavaScriptCore/dfg/DFGDriver.cpp index 64fc0c7e5..f160b6d35 100644 --- a/Source/JavaScriptCore/dfg/DFGDriver.cpp +++ b/Source/JavaScriptCore/dfg/DFGDriver.cpp @@ -64,7 +64,7 @@ inline bool compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlo if (!Options::useDFGJIT()) return false; - + #if DFG_ENABLE(DEBUG_VERBOSE) dataLog("DFG compiling code block %p(%p) for executable %p, number of instructions = %u.\n", codeBlock, codeBlock->alternative(), codeBlock->ownerExecutable(), codeBlock->instructionCount()); #endif diff --git a/Source/JavaScriptCore/dfg/DFGGraph.h b/Source/JavaScriptCore/dfg/DFGGraph.h index 4091c48f7..3e6539353 100644 --- a/Source/JavaScriptCore/dfg/DFGGraph.h +++ b/Source/JavaScriptCore/dfg/DFGGraph.h @@ -441,6 +441,15 @@ public: return m_codeBlock->usesArguments(); } + bool isCreatedThisArgument(int operand) + { + if (!operandIsArgument(operand)) + return false; + if (operandToArgument(operand)) + return false; + return m_codeBlock->specializationKind() == CodeForConstruct; + } + unsigned numSuccessors(BasicBlock* block) { return at(block->last()).numSuccessors(); diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp index 5a9f972b8..ae28fad3f 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp @@ -188,6 +188,7 @@ void JITCompiler::link(LinkBuffer& linkBuffer) CallLinkInfo& info = m_codeBlock->callLinkInfo(i); info.callType = m_jsCalls[i].m_callType; info.isDFG = true; + info.bytecodeIndex = m_jsCalls[i].m_codeOrigin.bytecodeIndex; linkBuffer.link(m_jsCalls[i].m_slowCall, FunctionPtr((m_globalData->getCTIStub(info.callType == CallLinkInfo::Construct ? linkConstructThunkGenerator : linkCallThunkGenerator)).code().executableAddress())); info.callReturnLocation = linkBuffer.locationOfNearCall(m_jsCalls[i].m_slowCall); info.hotPathBegin = linkBuffer.locationOf(m_jsCalls[i].m_targetToCheck); diff --git a/Source/JavaScriptCore/dfg/DFGNode.h b/Source/JavaScriptCore/dfg/DFGNode.h index ae07d5512..e72bd5e36 100644 --- a/Source/JavaScriptCore/dfg/DFGNode.h +++ b/Source/JavaScriptCore/dfg/DFGNode.h @@ -632,7 +632,15 @@ struct Node { bool hasStructureTransitionData() { - return op() == PutStructure || op() == PhantomPutStructure; + switch (op()) { + case PutStructure: + case PhantomPutStructure: + case AllocatePropertyStorage: + case ReallocatePropertyStorage: + return true; + default: + return false; + } } StructureTransitionData& structureTransitionData() diff --git a/Source/JavaScriptCore/dfg/DFGNodeType.h b/Source/JavaScriptCore/dfg/DFGNodeType.h index 7fcd2ec14..0ca0039b9 100644 --- a/Source/JavaScriptCore/dfg/DFGNodeType.h +++ b/Source/JavaScriptCore/dfg/DFGNodeType.h @@ -133,6 +133,8 @@ namespace JSC { namespace DFG { macro(StructureTransitionWatchpoint, NodeMustGenerate) \ macro(PutStructure, NodeMustGenerate) \ macro(PhantomPutStructure, NodeMustGenerate | NodeDoesNotExit) \ + macro(AllocatePropertyStorage, NodeMustGenerate | NodeDoesNotExit | NodeResultStorage) \ + macro(ReallocatePropertyStorage, NodeMustGenerate | NodeDoesNotExit | NodeResultStorage) \ macro(GetPropertyStorage, NodeResultStorage) \ macro(GetIndexedPropertyStorage, NodeMustGenerate | NodeResultStorage) \ macro(GetByOffset, NodeResultJS) \ diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index 03c0666b7..9050d590e 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -28,6 +28,7 @@ #include "Arguments.h" #include "CodeBlock.h" +#include "CopiedSpaceInlineMethods.h" #include "DFGOSRExit.h" #include "DFGRepatch.h" #include "DFGThunks.h" @@ -894,7 +895,7 @@ static void* handleHostCall(ExecState* execCallee, JSValue callee, CodeSpecializ return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); } -inline void* linkFor(ExecState* execCallee, CodeSpecializationKind kind) +inline char* linkFor(ExecState* execCallee, CodeSpecializationKind kind) { ExecState* exec = execCallee->callerFrame(); JSGlobalData* globalData = &exec->globalData(); @@ -903,7 +904,7 @@ inline void* linkFor(ExecState* execCallee, CodeSpecializationKind kind) JSValue calleeAsValue = execCallee->calleeAsValue(); JSCell* calleeAsFunctionCell = getJSFunction(calleeAsValue); if (!calleeAsFunctionCell) - return handleHostCall(execCallee, calleeAsValue, kind); + return reinterpret_cast<char*>(handleHostCall(execCallee, calleeAsValue, kind)); JSFunction* callee = jsCast<JSFunction*>(calleeAsFunctionCell); execCallee->setScopeChain(callee->scopeUnchecked()); @@ -918,7 +919,7 @@ inline void* linkFor(ExecState* execCallee, CodeSpecializationKind kind) JSObject* error = functionExecutable->compileFor(execCallee, callee->scope(), kind); if (error) { globalData->exception = createStackOverflowError(exec); - return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); + return reinterpret_cast<char*>(globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress()); } codeBlock = &functionExecutable->generatedBytecodeFor(kind); if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters())) @@ -931,20 +932,20 @@ inline void* linkFor(ExecState* execCallee, CodeSpecializationKind kind) callLinkInfo.setSeen(); else dfgLinkFor(execCallee, callLinkInfo, codeBlock, callee, codePtr, kind); - return codePtr.executableAddress(); + return reinterpret_cast<char*>(codePtr.executableAddress()); } -void* DFG_OPERATION operationLinkCall(ExecState* execCallee) +char* DFG_OPERATION operationLinkCall(ExecState* execCallee) { return linkFor(execCallee, CodeForCall); } -void* DFG_OPERATION operationLinkConstruct(ExecState* execCallee) +char* DFG_OPERATION operationLinkConstruct(ExecState* execCallee) { return linkFor(execCallee, CodeForConstruct); } -inline void* virtualFor(ExecState* execCallee, CodeSpecializationKind kind) +inline char* virtualFor(ExecState* execCallee, CodeSpecializationKind kind) { ExecState* exec = execCallee->callerFrame(); JSGlobalData* globalData = &exec->globalData(); @@ -953,7 +954,7 @@ inline void* virtualFor(ExecState* execCallee, CodeSpecializationKind kind) JSValue calleeAsValue = execCallee->calleeAsValue(); JSCell* calleeAsFunctionCell = getJSFunction(calleeAsValue); if (UNLIKELY(!calleeAsFunctionCell)) - return handleHostCall(execCallee, calleeAsValue, kind); + return reinterpret_cast<char*>(handleHostCall(execCallee, calleeAsValue, kind)); JSFunction* function = jsCast<JSFunction*>(calleeAsFunctionCell); execCallee->setScopeChain(function->scopeUnchecked()); @@ -963,18 +964,18 @@ inline void* virtualFor(ExecState* execCallee, CodeSpecializationKind kind) JSObject* error = functionExecutable->compileFor(execCallee, function->scope(), kind); if (error) { exec->globalData().exception = error; - return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); + return reinterpret_cast<char*>(globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress()); } } - return executable->generatedJITCodeWithArityCheckFor(kind).executableAddress(); + return reinterpret_cast<char*>(executable->generatedJITCodeWithArityCheckFor(kind).executableAddress()); } -void* DFG_OPERATION operationVirtualCall(ExecState* execCallee) +char* DFG_OPERATION operationVirtualCall(ExecState* execCallee) { return virtualFor(execCallee, CodeForCall); } -void* DFG_OPERATION operationVirtualConstruct(ExecState* execCallee) +char* DFG_OPERATION operationVirtualConstruct(ExecState* execCallee) { return virtualFor(execCallee, CodeForConstruct); } @@ -1241,6 +1242,24 @@ void DFG_OPERATION operationReallocateStorageAndFinishPut(ExecState* exec, JSObj base->putDirectOffset(globalData, offset, JSValue::decode(value)); } +char* DFG_OPERATION operationAllocatePropertyStorageWithInitialCapacity(ExecState* exec) +{ + JSGlobalData& globalData = exec->globalData(); + void* result; + if (!globalData.heap.tryAllocateStorage(initialOutOfLineCapacity * sizeof(JSValue), &result)) + CRASH(); + return reinterpret_cast<char*>(result); +} + +char* DFG_OPERATION operationAllocatePropertyStorage(ExecState* exec, size_t newSize) +{ + JSGlobalData& globalData = exec->globalData(); + void* result; + if (!globalData.heap.tryAllocateStorage(newSize, &result)) + CRASH(); + return reinterpret_cast<char*>(result); +} + double DFG_OPERATION operationFModOnInts(int32_t a, int32_t b) { return fmod(a, b); diff --git a/Source/JavaScriptCore/dfg/DFGOperations.h b/Source/JavaScriptCore/dfg/DFGOperations.h index 109dcb2eb..d0fbf7ed4 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.h +++ b/Source/JavaScriptCore/dfg/DFGOperations.h @@ -104,7 +104,8 @@ typedef void DFG_OPERATION (*V_DFGOperation_EJJJ)(ExecState*, EncodedJSValue, En typedef void DFG_OPERATION (*V_DFGOperation_EJPP)(ExecState*, EncodedJSValue, EncodedJSValue, void*); typedef void DFG_OPERATION (*V_DFGOperation_EPZJ)(ExecState*, void*, int32_t, EncodedJSValue); typedef void DFG_OPERATION (*V_DFGOperation_W)(WatchpointSet*); -typedef void* DFG_OPERATION (*P_DFGOperation_E)(ExecState*); +typedef char* DFG_OPERATION (*P_DFGOperation_E)(ExecState*); +typedef char* DFG_OPERATION (*P_DFGOperation_ES)(ExecState*, size_t); // These routines are provide callbacks out to C++ implementations of operations too complex to JIT. JSCell* DFG_OPERATION operationNewObject(ExecState*) WTF_INTERNAL; @@ -162,10 +163,10 @@ size_t DFG_OPERATION operationCompareGreaterEq(ExecState*, EncodedJSValue encode size_t DFG_OPERATION operationCompareEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; size_t DFG_OPERATION operationCompareStrictEqCell(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; size_t DFG_OPERATION operationCompareStrictEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; -void* DFG_OPERATION operationVirtualCall(ExecState*) WTF_INTERNAL; -void* DFG_OPERATION operationLinkCall(ExecState*) WTF_INTERNAL; -void* DFG_OPERATION operationVirtualConstruct(ExecState*) WTF_INTERNAL; -void* DFG_OPERATION operationLinkConstruct(ExecState*) WTF_INTERNAL; +char* DFG_OPERATION operationVirtualCall(ExecState*) WTF_INTERNAL; +char* DFG_OPERATION operationLinkCall(ExecState*) WTF_INTERNAL; +char* DFG_OPERATION operationVirtualConstruct(ExecState*) WTF_INTERNAL; +char* DFG_OPERATION operationLinkConstruct(ExecState*) WTF_INTERNAL; JSCell* DFG_OPERATION operationCreateActivation(ExecState*) WTF_INTERNAL; JSCell* DFG_OPERATION operationCreateArguments(ExecState*) WTF_INTERNAL; JSCell* DFG_OPERATION operationCreateInlinedArguments(ExecState*, InlineCallFrame*) WTF_INTERNAL; @@ -181,6 +182,8 @@ double DFG_OPERATION operationFModOnInts(int32_t, int32_t) WTF_INTERNAL; size_t DFG_OPERATION operationIsObject(EncodedJSValue) WTF_INTERNAL; size_t DFG_OPERATION operationIsFunction(EncodedJSValue) WTF_INTERNAL; void DFG_OPERATION operationReallocateStorageAndFinishPut(ExecState*, JSObject*, Structure*, PropertyOffset, EncodedJSValue) WTF_INTERNAL; +char* DFG_OPERATION operationAllocatePropertyStorageWithInitialCapacity(ExecState*) WTF_INTERNAL; +char* DFG_OPERATION operationAllocatePropertyStorage(ExecState*, size_t newSize) WTF_INTERNAL; // This method is used to lookup an exception hander, keyed by faultLocation, which is // the return location from one of the calls out to one of the helper operations above. diff --git a/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp b/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp index d23cd8265..2e4f8094c 100644 --- a/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp @@ -449,7 +449,9 @@ private: } case GetPropertyStorage: - case GetIndexedPropertyStorage: { + case GetIndexedPropertyStorage: + case AllocatePropertyStorage: + case ReallocatePropertyStorage: { changed |= setPrediction(SpecOther); changed |= mergeDefaultFlags(node); break; diff --git a/Source/JavaScriptCore/dfg/DFGRepatch.cpp b/Source/JavaScriptCore/dfg/DFGRepatch.cpp index cfc2cd664..19e064f2c 100644 --- a/Source/JavaScriptCore/dfg/DFGRepatch.cpp +++ b/Source/JavaScriptCore/dfg/DFGRepatch.cpp @@ -829,33 +829,18 @@ static void emitPutTransitionStub( size_t oldSize = oldStructure->outOfLineCapacity() * sizeof(JSValue); ASSERT(newSize > oldSize); - // Optimistically assume that the old storage was the very last thing - // allocated. stubJit.loadPtr(MacroAssembler::Address(baseGPR, JSObject::offsetOfOutOfLineStorage()), scratchGPR3); - stubJit.loadPtr(&copiedAllocator->m_currentPayloadEnd, scratchGPR2); stubJit.loadPtr(&copiedAllocator->m_currentRemaining, scratchGPR1); - stubJit.subPtr(scratchGPR1, scratchGPR2); - stubJit.subPtr(MacroAssembler::TrustedImm32(oldSize), scratchGPR2); - MacroAssembler::Jump needFullRealloc = - stubJit.branchPtr(MacroAssembler::NotEqual, scratchGPR2, scratchGPR3); - slowPath.append(stubJit.branchSubPtr(MacroAssembler::Signed, MacroAssembler::TrustedImm32(newSize - oldSize), scratchGPR1)); - stubJit.storePtr(scratchGPR1, &copiedAllocator->m_currentRemaining); - stubJit.move(scratchGPR2, scratchGPR1); - MacroAssembler::Jump doneRealloc = stubJit.jump(); - - needFullRealloc.link(&stubJit); slowPath.append(stubJit.branchSubPtr(MacroAssembler::Signed, MacroAssembler::TrustedImm32(newSize), scratchGPR1)); stubJit.storePtr(scratchGPR1, &copiedAllocator->m_currentRemaining); stubJit.negPtr(scratchGPR1); stubJit.addPtr(MacroAssembler::AbsoluteAddress(&copiedAllocator->m_currentPayloadEnd), scratchGPR1); stubJit.subPtr(MacroAssembler::TrustedImm32(newSize), scratchGPR1); // We have scratchGPR1 = new storage, scratchGPR3 = old storage, scratchGPR2 = available - for (size_t offset = 0; offset < oldSize; offset += sizeof(JSValue)) { + for (size_t offset = 0; offset < oldSize; offset += sizeof(void*)) { stubJit.loadPtr(MacroAssembler::Address(scratchGPR3, offset), scratchGPR2); stubJit.storePtr(scratchGPR2, MacroAssembler::Address(scratchGPR1, offset)); } - - doneRealloc.link(&stubJit); } stubJit.storePtr(scratchGPR1, MacroAssembler::Address(baseGPR, JSObject::offsetOfOutOfLineStorage())); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index e8824b832..f368cf298 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -1241,7 +1241,8 @@ void SpeculativeJIT::checkArgumentTypes() m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr()); speculationCheck(BadType, valueSource, nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister)); speculationCheck(BadType, valueSource, nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr(), JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float64ArrayDescriptor().m_classInfo))); - } + } else if (isCellSpeculation(predictedType)) + speculationCheck(BadType, valueSource, nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, JITCompiler::addressFor(virtualRegister), GPRInfo::tagMaskRegister)); #else if (isInt32Speculation(predictedType)) speculationCheck(BadType, valueSource, nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag))); @@ -1307,7 +1308,8 @@ void SpeculativeJIT::checkArgumentTypes() speculationCheck(BadType, valueSource, nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag))); m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr()); speculationCheck(BadType, valueSource, nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr(), JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float64ArrayDescriptor().m_classInfo))); - } + } else if (isCellSpeculation(predictedType)) + speculationCheck(BadType, valueSource, nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::CellTag))); #endif } m_isCheckingArgumentTypes = false; @@ -3137,6 +3139,72 @@ bool SpeculativeJIT::compileRegExpExec(Node& node) return true; } +void SpeculativeJIT::compileAllocatePropertyStorage(Node& node) +{ + SpeculateCellOperand base(this, node.child1()); + GPRTemporary scratch(this); + + GPRReg baseGPR = base.gpr(); + GPRReg scratchGPR = scratch.gpr(); + + ASSERT(!node.structureTransitionData().previousStructure->outOfLineCapacity()); + ASSERT(initialOutOfLineCapacity == node.structureTransitionData().newStructure->outOfLineCapacity()); + size_t newSize = initialOutOfLineCapacity * sizeof(JSValue); + CopiedAllocator* copiedAllocator = &m_jit.globalData()->heap.storageAllocator(); + + m_jit.loadPtr(&copiedAllocator->m_currentRemaining, scratchGPR); + JITCompiler::Jump slowPath = m_jit.branchSubPtr(JITCompiler::Signed, JITCompiler::TrustedImm32(newSize), scratchGPR); + m_jit.storePtr(scratchGPR, &copiedAllocator->m_currentRemaining); + m_jit.negPtr(scratchGPR); + m_jit.addPtr(JITCompiler::AbsoluteAddress(&copiedAllocator->m_currentPayloadEnd), scratchGPR); + m_jit.subPtr(JITCompiler::TrustedImm32(newSize), scratchGPR); + + addSlowPathGenerator( + slowPathCall(slowPath, this, operationAllocatePropertyStorageWithInitialCapacity, scratchGPR)); + + m_jit.storePtr(scratchGPR, JITCompiler::Address(baseGPR, JSObject::offsetOfOutOfLineStorage())); + + storageResult(scratchGPR, m_compileIndex); +} + +void SpeculativeJIT::compileReallocatePropertyStorage(Node& node) +{ + SpeculateCellOperand base(this, node.child1()); + StorageOperand oldStorage(this, node.child2()); + GPRTemporary scratch1(this); + GPRTemporary scratch2(this); + + GPRReg baseGPR = base.gpr(); + GPRReg oldStorageGPR = oldStorage.gpr(); + GPRReg scratchGPR1 = scratch1.gpr(); + GPRReg scratchGPR2 = scratch2.gpr(); + + JITCompiler::Jump slowPath; + + size_t oldSize = node.structureTransitionData().previousStructure->outOfLineCapacity() * sizeof(JSValue); + size_t newSize = oldSize * outOfLineGrowthFactor; + ASSERT(newSize == node.structureTransitionData().newStructure->outOfLineCapacity() * sizeof(JSValue)); + CopiedAllocator* copiedAllocator = &m_jit.globalData()->heap.storageAllocator(); + + m_jit.loadPtr(&copiedAllocator->m_currentRemaining, scratchGPR2); + slowPath = m_jit.branchSubPtr(JITCompiler::Signed, JITCompiler::TrustedImm32(newSize), scratchGPR2); + m_jit.storePtr(scratchGPR2, &copiedAllocator->m_currentRemaining); + m_jit.negPtr(scratchGPR2); + m_jit.addPtr(JITCompiler::AbsoluteAddress(&copiedAllocator->m_currentPayloadEnd), scratchGPR2); + m_jit.subPtr(JITCompiler::TrustedImm32(newSize), scratchGPR2); + + addSlowPathGenerator( + slowPathCall(slowPath, this, operationAllocatePropertyStorage, scratchGPR2, newSize)); + // We have scratchGPR2 = new storage, scratchGPR1 = scratch + for (size_t offset = 0; offset < oldSize; offset += sizeof(void*)) { + m_jit.loadPtr(JITCompiler::Address(oldStorageGPR, offset), scratchGPR1); + m_jit.storePtr(scratchGPR1, JITCompiler::Address(scratchGPR2, offset)); + } + m_jit.storePtr(scratchGPR2, JITCompiler::Address(baseGPR, JSObject::offsetOfOutOfLineStorage())); + + storageResult(scratchGPR2, m_compileIndex); +} + } } // namespace JSC::DFG #endif diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index 487addd7f..cb7d89106 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -1151,6 +1151,16 @@ public: // machine registers, and delegate the calling convention specific // decision as to how to fill the regsiters to setupArguments* methods. #if USE(JSVALUE64) + JITCompiler::Call callOperation(P_DFGOperation_E operation, GPRReg result) + { + m_jit.setupArgumentsExecState(); + return appendCallWithExceptionCheckSetResult(operation, result); + } + JITCompiler::Call callOperation(P_DFGOperation_ES operation, GPRReg result, size_t size) + { + m_jit.setupArgumentsWithExecState(TrustedImmPtr(size)); + return appendCallWithExceptionCheckSetResult(operation, result); + } JITCompiler::Call callOperation(J_DFGOperation_E operation, GPRReg result) { m_jit.setupArgumentsExecState(); @@ -1413,6 +1423,16 @@ public: #define EABI_32BIT_DUMMY_ARG #endif + JITCompiler::Call callOperation(P_DFGOperation_E operation, GPRReg result) + { + m_jit.setupArgumentsExecState(); + return appendCallWithExceptionCheckSetResult(operation, result); + } + JITCompiler::Call callOperation(P_DFGOperation_ES operation, GPRReg result, size_t size) + { + m_jit.setupArgumentsWithExecState(TrustedImmPtr(size)); + return appendCallWithExceptionCheckSetResult(operation, result); + } JITCompiler::Call callOperation(Z_DFGOperation_D operation, GPRReg result, FPRReg arg1) { prepareForExternalCall(); @@ -2048,6 +2068,9 @@ public: bool compileStrictEq(Node&); + void compileAllocatePropertyStorage(Node&); + void compileReallocatePropertyStorage(Node&); + void compileGetCharCodeAt(Node&); void compileGetByValOnString(Node&); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index ed98e0800..c63ba8c21 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -1918,7 +1918,7 @@ void SpeculativeJIT::compile(Node& node) break; } - if (isArraySpeculation(value.m_type)) { + if (isArraySpeculation(value.m_type) || isCellSpeculation(value.m_type)) { GPRTemporary result(this); m_jit.load32(JITCompiler::payloadFor(node.local()), result.gpr()); @@ -2010,7 +2010,7 @@ void SpeculativeJIT::compile(Node& node) // OSR exit, would not be visible to the old JIT in any way. m_codeOriginForOSR = nextNode->codeOrigin; - if (!node.variableAccessData()->isCaptured()) { + if (!node.variableAccessData()->isCaptured() && !m_jit.graph().isCreatedThisArgument(node.local())) { if (node.variableAccessData()->shouldUseDoubleFormat()) { SpeculateDoubleOperand value(this, node.child1()); m_jit.storeDouble(value.fpr(), JITCompiler::addressFor(node.local())); @@ -2046,6 +2046,14 @@ void SpeculativeJIT::compile(Node& node) recordSetLocal(node.local(), ValueSource(CellInRegisterFile)); break; } + if (isCellSpeculation(predictedType)) { + SpeculateCellOperand cell(this, node.child1()); + GPRReg cellGPR = cell.gpr(); + m_jit.storePtr(cellGPR, JITCompiler::payloadFor(node.local())); + noResult(m_compileIndex); + recordSetLocal(node.local(), ValueSource(CellInRegisterFile)); + break; + } if (isBooleanSpeculation(predictedType)) { SpeculateBooleanOperand value(this, node.child1()); m_jit.store32(value.gpr(), JITCompiler::payloadFor(node.local())); @@ -3542,6 +3550,14 @@ void SpeculativeJIT::compile(Node& node) break; } + case AllocatePropertyStorage: + compileAllocatePropertyStorage(node); + break; + + case ReallocatePropertyStorage: + compileReallocatePropertyStorage(node); + break; + case GetPropertyStorage: { SpeculateCellOperand base(this, node.child1()); GPRTemporary result(this, base); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index 9e468e758..6dbb8a4b1 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -2052,7 +2052,7 @@ void SpeculativeJIT::compile(Node& node) // OSR exit, would not be visible to the old JIT in any way. m_codeOriginForOSR = nextNode->codeOrigin; - if (!node.variableAccessData()->isCaptured()) { + if (!node.variableAccessData()->isCaptured() && !m_jit.graph().isCreatedThisArgument(node.local())) { if (node.variableAccessData()->shouldUseDoubleFormat()) { SpeculateDoubleOperand value(this, node.child1()); m_jit.storeDouble(value.fpr(), JITCompiler::addressFor(node.local())); @@ -2082,6 +2082,14 @@ void SpeculativeJIT::compile(Node& node) recordSetLocal(node.local(), ValueSource(CellInRegisterFile)); break; } + if (isCellSpeculation(predictedType)) { + SpeculateCellOperand cell(this, node.child1()); + GPRReg cellGPR = cell.gpr(); + m_jit.storePtr(cellGPR, JITCompiler::addressFor(node.local())); + noResult(m_compileIndex); + recordSetLocal(node.local(), ValueSource(CellInRegisterFile)); + break; + } if (isBooleanSpeculation(predictedType)) { SpeculateBooleanOperand boolean(this, node.child1()); m_jit.storePtr(boolean.gpr(), JITCompiler::addressFor(node.local())); @@ -3557,6 +3565,14 @@ void SpeculativeJIT::compile(Node& node) break; } + case AllocatePropertyStorage: + compileAllocatePropertyStorage(node); + break; + + case ReallocatePropertyStorage: + compileReallocatePropertyStorage(node); + break; + case GetPropertyStorage: { SpeculateCellOperand base(this, node.child1()); GPRTemporary result(this, base); diff --git a/Source/JavaScriptCore/dfg/DFGValueSource.h b/Source/JavaScriptCore/dfg/DFGValueSource.h index be4a6e081..f776137d0 100644 --- a/Source/JavaScriptCore/dfg/DFGValueSource.h +++ b/Source/JavaScriptCore/dfg/DFGValueSource.h @@ -130,7 +130,7 @@ public: { if (isInt32Speculation(prediction)) return ValueSource(Int32InRegisterFile); - if (isArraySpeculation(prediction)) + if (isArraySpeculation(prediction) || isCellSpeculation(prediction)) return ValueSource(CellInRegisterFile); if (isBooleanSpeculation(prediction)) return ValueSource(BooleanInRegisterFile); diff --git a/Source/JavaScriptCore/heap/JITStubRoutineSet.h b/Source/JavaScriptCore/heap/JITStubRoutineSet.h index ea120132e..cb76ac8bd 100644 --- a/Source/JavaScriptCore/heap/JITStubRoutineSet.h +++ b/Source/JavaScriptCore/heap/JITStubRoutineSet.h @@ -28,8 +28,6 @@ #include <wtf/Platform.h> -#if ENABLE(JIT) - #include "JITStubRoutine.h" #include <wtf/FastAllocBase.h> #include <wtf/HashMap.h> @@ -40,6 +38,8 @@ namespace JSC { class GCAwareJITStubRoutine; class SlotVisitor; +#if ENABLE(JIT) + class JITStubRoutineSet { WTF_MAKE_NONCOPYABLE(JITStubRoutineSet); WTF_MAKE_FAST_ALLOCATED; @@ -72,9 +72,26 @@ private: Vector<GCAwareJITStubRoutine*> m_listOfRoutines; }; -} // namespace JSC +#else // !ENABLE(JIT) -#endif // ENABLE(JIT) +class JITStubRoutineSet { + WTF_MAKE_NONCOPYABLE(JITStubRoutineSet); + WTF_MAKE_FAST_ALLOCATED; + +public: + JITStubRoutineSet() { } + ~JITStubRoutineSet() { } + + void add(GCAwareJITStubRoutine*) { } + void clearMarks() { } + void mark(void*) { } + void deleteUnmarkedJettisonedStubRoutines() { } + void traceMarkedStubRoutines(SlotVisitor&) { } +}; + +#endif // !ENABLE(JIT) + +} // namespace JSC #endif // JITStubRoutineSet_h diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/Source/JavaScriptCore/heap/MachineStackMarker.cpp index 8e0c57b6a..7eb57479b 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.cpp +++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp @@ -141,8 +141,10 @@ MachineThreads::MachineThreads(Heap* heap) MachineThreads::~MachineThreads() { - if (m_threadSpecific) - ThreadSpecificKeyDelete(m_threadSpecific); + if (m_threadSpecific) { + int error = pthread_key_delete(m_threadSpecific); + ASSERT_UNUSED(error, !error); + } MutexLocker registeredThreadsLock(m_registeredThreadsMutex); for (Thread* t = m_registeredThreads; t;) { @@ -179,17 +181,19 @@ void MachineThreads::makeUsableFromMultipleThreads() if (m_threadSpecific) return; - ThreadSpecificKeyCreate(&m_threadSpecific, removeThread); + int error = pthread_key_create(&m_threadSpecific, removeThread); + if (error) + CRASH(); } void MachineThreads::addCurrentThread() { ASSERT(!m_heap->globalData()->exclusiveThread || m_heap->globalData()->exclusiveThread == currentThread()); - if (!m_threadSpecific || ThreadSpecificGet(m_threadSpecific)) + if (!m_threadSpecific || pthread_getspecific(m_threadSpecific)) return; - ThreadSpecificSet(m_threadSpecific, this); + pthread_setspecific(m_threadSpecific, this); Thread* thread = new Thread(getCurrentPlatformThread(), wtfThreadData().stack().origin()); MutexLocker lock(m_registeredThreadsMutex); diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.h b/Source/JavaScriptCore/heap/MachineStackMarker.h index 3d4aa22d4..5c7705fcf 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.h +++ b/Source/JavaScriptCore/heap/MachineStackMarker.h @@ -22,8 +22,8 @@ #ifndef MachineThreads_h #define MachineThreads_h +#include <pthread.h> #include <wtf/Noncopyable.h> -#include <wtf/ThreadSpecific.h> #include <wtf/ThreadingPrimitives.h> namespace JSC { @@ -55,7 +55,7 @@ namespace JSC { Heap* m_heap; Mutex m_registeredThreadsMutex; Thread* m_registeredThreads; - WTF::ThreadSpecificKey m_threadSpecific; + pthread_key_t m_threadSpecific; }; } // namespace JSC diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index b6072a5d6..3edb8589e 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -77,6 +77,8 @@ 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, ScopeChainNode* sc) { @@ -606,7 +608,13 @@ void Interpreter::initialize(LLInt::Data* llintData, bool canUseJIT) #endif } -#ifndef NDEBUG +#ifdef NDEBUG + +void Interpreter::dumpCallFrame(CallFrame*) +{ +} + +#else void Interpreter::dumpCallFrame(CallFrame* callFrame) { @@ -624,34 +632,42 @@ void Interpreter::dumpRegisters(CallFrame* callFrame) CodeBlock* codeBlock = callFrame->codeBlock(); const Register* it; const Register* end; - JSValue v; - it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->numParameters(); - v = (*it).jsValue(); -#if USE(JSVALUE32_64) - dataLog("[this] | %10p | %-16s 0x%llx \n", it, v.description(), JSValue::encode(v)); ++it; -#else - dataLog("[this] | %10p | %-16s %p \n", it, v.description(), JSValue::encode(v)); ++it; -#endif - end = it + max(codeBlock->numParameters() - 1, 0); // - 1 to skip "this" - if (it != end) { - do { - v = (*it).jsValue(); + it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - callFrame->argumentCountIncludingThis(); + end = callFrame->registers() - RegisterFile::CallFrameHeaderSize; + while (it < end) { + JSValue v = it->jsValue(); + int registerNumber = it - callFrame->registers(); + UString name = codeBlock->nameForRegister(registerNumber); #if USE(JSVALUE32_64) - dataLog("[param] | %10p | %-16s 0x%llx \n", it, v.description(), JSValue::encode(v)); + dataLog("[r% 3d %14s] | %10p | %-16s 0x%llx \n", registerNumber, name.ascii().data(), it, v.description(), JSValue::encode(v)); #else - dataLog("[param] | %10p | %-16s %p \n", it, v.description(), JSValue::encode(v)); + dataLog("[r% 3d %14s] | %10p | %-16s %p \n", registerNumber, name.ascii().data(), it, v.description(), JSValue::encode(v)); #endif - ++it; - } while (it != end); + it++; } + dataLog("-----------------------------------------------------------------------------\n"); - dataLog("[CodeBlock] | %10p | %p \n", it, (*it).codeBlock()); ++it; - dataLog("[ScopeChain] | %10p | %p \n", it, (*it).scopeChain()); ++it; - dataLog("[CallerRegisters] | %10p | %d \n", it, (*it).i()); ++it; - dataLog("[ReturnPC] | %10p | %p \n", it, (*it).vPC()); ++it; - dataLog("[ArgumentCount] | %10p | %d \n", it, (*it).i()); ++it; - dataLog("[Callee] | %10p | %p \n", it, (*it).function()); ++it; + dataLog("[ArgumentCount] | %10p | %lu \n", it, (unsigned long) callFrame->argumentCount()); + ++it; + dataLog("[CallerFrame] | %10p | %p \n", it, callFrame->callerFrame()); + ++it; + dataLog("[Callee] | %10p | %p \n", it, callFrame->callee()); + ++it; + dataLog("[ScopeChain] | %10p | %p \n", it, callFrame->scopeChain()); + ++it; +#if ENABLE(JIT) + AbstractPC pc = callFrame->abstractReturnPC(callFrame->globalData()); + if (pc.hasJITReturnAddress()) + dataLog("[ReturnJITPC] | %10p | %p \n", it, pc.jitReturnAddress().value()); +#endif + unsigned bytecodeOffset = 0; + int line = 0; + getCallerInfo(&callFrame->globalData(), callFrame, line, bytecodeOffset); + dataLog("[ReturnVPC] | %10p | %d (line %d)\n", it, bytecodeOffset, line); + ++it; + dataLog("[CodeBlock] | %10p | %p \n", it, callFrame->codeBlock()); + ++it; dataLog("-----------------------------------------------------------------------------\n"); int registerCount = 0; @@ -659,11 +675,13 @@ void Interpreter::dumpRegisters(CallFrame* callFrame) end = it + codeBlock->m_numVars; if (it != end) { do { - v = (*it).jsValue(); + JSValue v = it->jsValue(); + int registerNumber = it - callFrame->registers(); + UString name = codeBlock->nameForRegister(registerNumber); #if USE(JSVALUE32_64) - dataLog("[r%2d] | %10p | %-16s 0x%llx \n", registerCount, it, v.description(), JSValue::encode(v)); + dataLog("[r% 3d %14s] | %10p | %-16s 0x%llx \n", registerNumber, name.ascii().data(), it, v.description(), JSValue::encode(v)); #else - dataLog("[r%2d] | %10p | %-16s %p \n", registerCount, it, v.description(), JSValue::encode(v)); + dataLog("[r% 3d %14s] | %10p | %-16s %p \n", registerNumber, name.ascii().data(), it, v.description(), JSValue::encode(v)); #endif ++it; ++registerCount; @@ -674,11 +692,11 @@ void Interpreter::dumpRegisters(CallFrame* callFrame) end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numVars; if (it != end) { do { - v = (*it).jsValue(); + JSValue v = (*it).jsValue(); #if USE(JSVALUE32_64) - dataLog("[r%2d] | %10p | %-16s 0x%llx \n", registerCount, it, v.description(), JSValue::encode(v)); + dataLog("[r% 3d] | %10p | %-16s 0x%llx \n", registerCount, it, v.description(), JSValue::encode(v)); #else - dataLog("[r%2d] | %10p | %-16s %p \n", registerCount, it, v.description(), JSValue::encode(v)); + dataLog("[r% 3d] | %10p | %-16s %p \n", registerCount, it, v.description(), JSValue::encode(v)); #endif ++it; ++registerCount; @@ -838,10 +856,10 @@ static int getLineNumberForCallFrame(JSGlobalData* globalData, CallFrame* callFr #endif } -static CallFrame* getCallerInfo(JSGlobalData* globalData, CallFrame* callFrame, int& lineNumber) +static CallFrame* getCallerInfo(JSGlobalData* globalData, CallFrame* callFrame, int& lineNumber, unsigned& bytecodeOffset) { UNUSED_PARAM(globalData); - unsigned bytecodeOffset = 0; + bytecodeOffset = 0; lineNumber = -1; ASSERT(!callFrame->hasHostCallFrameFlag()); CallFrame* callerFrame = callFrame->codeBlock() ? callFrame->trueCallerFrame() : callFrame->callerFrame()->removeHostCallFrameFlag(); @@ -973,7 +991,8 @@ void Interpreter::getStackTrace(JSGlobalData* globalData, Vector<StackFrame>& re StackFrame s = { Strong<JSObject>(*globalData, callFrame->callee()), StackFrameNativeCode, Strong<ExecutableBase>(), -1, UString()}; results.append(s); } - callFrame = getCallerInfo(globalData, callFrame, line); + unsigned unusedBytecodeOffset = 0; + callFrame = getCallerInfo(globalData, callFrame, line, unusedBytecodeOffset); } } @@ -5330,7 +5349,8 @@ JSValue Interpreter::retrieveCallerFromVMCode(CallFrame* callFrame, JSFunction* return jsNull(); int lineNumber; - CallFrame* callerFrame = getCallerInfo(&callFrame->globalData(), functionCallFrame, lineNumber); + unsigned bytecodeOffset; + CallFrame* callerFrame = getCallerInfo(&callFrame->globalData(), functionCallFrame, lineNumber, bytecodeOffset); if (!callerFrame) return jsNull(); JSValue caller = callerFrame->callee(); @@ -5340,7 +5360,7 @@ JSValue Interpreter::retrieveCallerFromVMCode(CallFrame* callFrame, JSFunction* // Skip over function bindings. ASSERT(caller.isObject()); while (asObject(caller)->inherits(&JSBoundFunction::s_info)) { - callerFrame = getCallerInfo(&callFrame->globalData(), callerFrame, lineNumber); + callerFrame = getCallerInfo(&callFrame->globalData(), callerFrame, lineNumber, bytecodeOffset); if (!callerFrame) return jsNull(); caller = callerFrame->callee(); diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h index ba2f4fac4..8663bf8ec 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.h +++ b/Source/JavaScriptCore/interpreter/Interpreter.h @@ -248,6 +248,9 @@ namespace JSC { void dumpSampleData(ExecState* exec); void startSampling(); void stopSampling(); + + JS_EXPORT_PRIVATE void dumpCallFrame(CallFrame*); + private: enum ExecutionFlag { Normal, InitializeAndReturn }; @@ -279,7 +282,6 @@ namespace JSC { JSValue privateExecute(ExecutionFlag, RegisterFile*, CallFrame*); - void dumpCallFrame(CallFrame*); void dumpRegisters(CallFrame*); bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); } diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index 5f3dbdb99..00ad5d3b2 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -88,6 +88,7 @@ static EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState*); static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*); #ifndef NDEBUG static EncodedJSValue JSC_HOST_CALL functionReleaseExecutableMemory(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState*); #endif static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*); static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*); @@ -194,6 +195,7 @@ protected: addFunction(globalData, "quit", functionQuit, 0); addFunction(globalData, "gc", functionGC, 0); #ifndef NDEBUG + addFunction(globalData, "dumpCallFrame", functionDumpCallFrame, 0); addFunction(globalData, "releaseExecutableMemory", functionReleaseExecutableMemory, 0); #endif addFunction(globalData, "version", functionVersion, 1); @@ -281,6 +283,15 @@ EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec) return JSValue::encode(jsUndefined()); } +#ifndef NDEBUG +EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState* exec) +{ + if (!exec->callerFrame()->hasHostCallFrameFlag()) + exec->globalData().interpreter->dumpCallFrame(exec->callerFrame()); + return JSValue::encode(jsUndefined()); +} +#endif + EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec) { fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec)->value(exec).utf8().data()); diff --git a/Source/JavaScriptCore/offlineasm/armv7.rb b/Source/JavaScriptCore/offlineasm/armv7.rb index 18538120b..6595fdc71 100644 --- a/Source/JavaScriptCore/offlineasm/armv7.rb +++ b/Source/JavaScriptCore/offlineasm/armv7.rb @@ -743,8 +743,8 @@ end class Instruction def lowerARMv7 - $asm.codeOrigin codeOriginString - $asm.annotation annotation + $asm.codeOrigin codeOriginString if $enableCodeOriginComments + $asm.annotation annotation if $enableInstrAnnotations case opcode when "addi", "addp", "addis" @@ -1012,7 +1012,7 @@ class Instruction raise "Wrong number of arguments to smull in #{self.inspect} at #{codeOriginString}" unless operands.length == 4 $asm.puts "smull #{operands[2].armV7Operand}, #{operands[3].armV7Operand}, #{operands[0].armV7Operand}, #{operands[1].armV7Operand}" else - raise "Unhandled opcode #{opcode} at #{codeOriginString}" + lowerDefault end end end diff --git a/Source/JavaScriptCore/offlineasm/asm.rb b/Source/JavaScriptCore/offlineasm/asm.rb index 0cf6320af..1603f4af4 100644 --- a/Source/JavaScriptCore/offlineasm/asm.rb +++ b/Source/JavaScriptCore/offlineasm/asm.rb @@ -45,6 +45,8 @@ class Assembler @codeOrigin = nil @numLocalLabels = 0 @numGlobalLabels = 0 + + @newlineSpacerState = :none end def enterAsm @@ -66,33 +68,60 @@ class Assembler # Concatenates all the various components of the comment to dump. def lastComment + separator = " " result = "" - result = " #{@comment} ." if @comment - result += " #{@annotation} ." if @annotation and $enableTrailingInstrAnnotations - result += " #{@internalComment} ." if @internalComment - result += " #{@codeOrigin} ." if @codeOrigin and $enableCodeOriginComments + result = "#{@comment}" if @comment + if @annotation and $enableInstrAnnotations + result += separator if result != "" + result += "#{@annotation}" + end + if @internalComment + result += separator if result != "" + result += "#{@internalComment}" + end + if @codeOrigin and $enableCodeOriginComments + result += separator if result != "" + result += "#{@codeOrigin}" + end if result != "" - result = " //" + result + result = "// " + result end # Reset all the components that we've just sent to be dumped. @commentState = :none @comment = nil - @internalComment = nil @annotation = nil @codeOrigin = nil + @internalComment = nil result end - # Dumps the current instruction annotation in interlaced mode if appropriate. - def putInterlacedAnnotation() + def formatDump(dumpStr, comment, commentColumns=$preferredCommentStartColumn) + if comment.length > 0 + "%-#{commentColumns}s %s" % [dumpStr, comment] + else + dumpStr + end + end + + # private method for internal use only. + def putAnnotation(text) raise unless @state == :asm - if $enableInterlacedInstrAnnotations - @outp.puts(" // #{@annotation}") if @annotation + if $enableInstrAnnotations + @outp.puts text @annotation = nil end end + def putLocalAnnotation() + putAnnotation " // #{@annotation}" if @annotation + end + + def putGlobalAnnotation() + putsNewlineSpacerIfAppropriate(:annotation) + putAnnotation "// #{@annotation}" if @annotation + end + def putsLastComment comment = lastComment unless comment.empty? @@ -102,8 +131,7 @@ class Assembler def puts(*line) raise unless @state == :asm - putInterlacedAnnotation - @outp.puts(" \"\\t" + line.join('') + "\\n\"#{lastComment}") + @outp.puts(formatDump(" \"\\t" + line.join('') + "\\n\"", lastComment)) end def print(line) @@ -111,12 +139,20 @@ class Assembler @outp.print("\"" + line + "\"") end + def putsNewlineSpacerIfAppropriate(state) + if @newlineSpacerState != state + @outp.puts("\n") + @newlineSpacerState = state + end + end + def putsLabel(labelName) raise unless @state == :asm @numGlobalLabels += 1 - @outp.puts("\n") + putsNewlineSpacerIfAppropriate(:global) @internalComment = $enableLabelCountComments ? "Global Label #{@numGlobalLabels}" : nil - @outp.puts("OFFLINE_ASM_GLOBAL_LABEL(#{labelName})#{lastComment}") + @outp.puts(formatDump("OFFLINE_ASM_GLOBAL_LABEL(#{labelName})", lastComment)) + @newlineSpacerState = :none # After a global label, we can use another spacer. end def putsLocalLabel(labelName) @@ -124,7 +160,7 @@ class Assembler @numLocalLabels += 1 @outp.puts("\n") @internalComment = $enableLabelCountComments ? "Local Label #{@numLocalLabels}" : nil - @outp.puts("OFFLINE_ASM_LOCAL_LABEL(#{labelName})#{lastComment}") + @outp.puts(formatDump(" OFFLINE_ASM_LOCAL_LABEL(#{labelName})", lastComment)) end def self.labelReference(labelName) diff --git a/Source/JavaScriptCore/offlineasm/ast.rb b/Source/JavaScriptCore/offlineasm/ast.rb index 86ad6bcb2..9333247dc 100644 --- a/Source/JavaScriptCore/offlineasm/ast.rb +++ b/Source/JavaScriptCore/offlineasm/ast.rb @@ -806,6 +806,17 @@ class Instruction < Node def dump "\t" + opcode.to_s + " " + operands.collect{|v| v.dump}.join(", ") end + + def lowerDefault + case opcode + when "localAnnotation" + $asm.putLocalAnnotation + when "globalAnnotation" + $asm.putGlobalAnnotation + else + raise "Unhandled opcode #{opcode} at #{codeOriginString}" + end + end end class Error < NoChildren @@ -1180,7 +1191,7 @@ end class Macro < Node attr_reader :name, :variables, :body - + def initialize(codeOrigin, name, variables, body) super(codeOrigin) @name = name @@ -1202,14 +1213,15 @@ class Macro < Node end class MacroCall < Node - attr_reader :name, :operands + attr_reader :name, :operands, :annotation - def initialize(codeOrigin, name, operands) + def initialize(codeOrigin, name, operands, annotation) super(codeOrigin) @name = name @operands = operands raise unless @operands @operands.each{|v| raise unless v} + @annotation = annotation end def children @@ -1217,7 +1229,7 @@ class MacroCall < Node end def mapChildren(&proc) - MacroCall.new(codeOrigin, @name, @operands.map(&proc)) + MacroCall.new(codeOrigin, @name, @operands.map(&proc), @annotation) end def dump diff --git a/Source/JavaScriptCore/offlineasm/config.rb b/Source/JavaScriptCore/offlineasm/config.rb index ce1898170..e6287f367 100644 --- a/Source/JavaScriptCore/offlineasm/config.rb +++ b/Source/JavaScriptCore/offlineasm/config.rb @@ -21,6 +21,8 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +$preferredCommentStartColumn = 70 + # Turns on dumping of the count of labels. # For example, the output will look like this: @@ -45,32 +47,11 @@ $enableCodeOriginComments = true # Turns on recording and dumping of annotations in the generated output file. # An annotations can be specified for each instruction in the source asm files. -# -# $enableInterlacedInstrAnnotations will interlace the annotation between -# instructions. For example, the output will look like this: +# For example, the output will look like this: # # ... -# // @ t2<CodeBlock> = cfr.CodeBlock -# "\tmovq -8(%r13), %rcx\n" -# // @ t2<size_t> = t2<CodeBlock>.m_numVars -# "\tmovl 52(%rcx), %ecx\n" +# "\tmovq -8(%r13), %rcx\n" // t2<CodeBlock> = cfr.CodeBlock +# "\tmovl 52(%rcx), %ecx\n" // t2<size_t> = t2<CodeBlock>.m_numVars # ... # -# $enableTrailingInstrAnnotations will insert the annotation in the trailing -# comment after your instructions. For example, the output will look like this: -# -# ... -# "\tmovq -8(%r13), %rcx\n" // @ t2<CodeBlock> = cfr.CodeBlock -# "\tmovl 52(%rcx), %ecx\n" // @ t2<size_t> = t2<CodeBlock>.m_numVars -# ... -# -# If both $enableInterlacedInstrAnnotations and $enableTrailingInstrAnnotations -# are enabled, interlaced annotations will take precedence, and any available -# annotations will only be dumped in the interlaced format. -# -$enableInterlacedInstrAnnotations = false -$enableTrailingInstrAnnotations = false - - -# Sanity check for annotation configs. -$enableInstrAnnotations = ($enableInterlacedInstrAnnotations or $enableTrailingInstrAnnotations) +$enableInstrAnnotations = false diff --git a/Source/JavaScriptCore/offlineasm/parser.rb b/Source/JavaScriptCore/offlineasm/parser.rb index 8696a61a9..70b03cf70 100644 --- a/Source/JavaScriptCore/offlineasm/parser.rb +++ b/Source/JavaScriptCore/offlineasm/parser.rb @@ -74,6 +74,15 @@ class Token end end +class Annotation + attr_reader :codeOrigin, :type, :string + def initialize(codeOrigin, type, string) + @codeOrigin = codeOrigin + @type = type + @string = string + end +end + # # The lexer. Takes a string and returns an array of tokens. # @@ -83,17 +92,20 @@ def lex(str, fileName) result = [] lineNumber = 1 annotation = nil + whitespaceFound = false while not str.empty? case str when /\A\#([^\n]*)/ # comment, ignore - when /\A\/\/([^\n]*)/ + when /\A\/\/\ ?([^\n]*)/ # annotation annotation = $1 + annotationType = whitespaceFound ? :local : :global when /\A\n/ # We've found a '\n'. Emit the last comment recorded if appropriate: if $enableInstrAnnotations and annotation - result << Token.new(CodeOrigin.new(fileName, lineNumber), "@" + annotation) + result << Annotation.new(CodeOrigin.new(fileName, lineNumber), + annotationType, annotation) annotation = nil end result << Token.new(CodeOrigin.new(fileName, lineNumber), $&) @@ -106,6 +118,9 @@ def lex(str, fileName) result << Token.new(CodeOrigin.new(fileName, lineNumber), $&) when /\A([ \t]+)/ # whitespace, ignore + whitespaceFound = true + str = $~.post_match + next when /\A0x([0-9a-fA-F]+)/ result << Token.new(CodeOrigin.new(fileName, lineNumber), $&.hex.to_s) when /\A0([0-7]+)/ @@ -119,6 +134,7 @@ def lex(str, fileName) else raise "Lexer error at #{CodeOrigin.new(fileName, lineNumber).to_s}, unexpected sequence #{str[0..20].inspect}" end + whitespaceFound = false str = $~.post_match end result @@ -146,10 +162,6 @@ def isIdentifier(token) token =~ /\A[a-zA-Z]([a-zA-Z0-9_]*)\Z/ and not isKeyword(token) end -def isAnnotation(token) - token =~ /\A\@([^\n]*)/ -end - def isLabel(token) token =~ /\A_([a-zA-Z0-9_]*)\Z/ end @@ -175,6 +187,7 @@ class Parser def initialize(data, fileName) @tokens = lex(data, fileName) @idx = 0 + @annotation = nil end def parseError(*comment) @@ -487,6 +500,20 @@ class Parser loop { if (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final) break + elsif @tokens[@idx].is_a? Annotation + # This is the only place where we can encounter a global + # annotation, and hence need to be able to distinguish between + # them. + # globalAnnotations are the ones that start from column 0. All + # others are considered localAnnotations. The only reason to + # distinguish between them is so that we can format the output + # nicely as one would expect. + + codeOrigin = @tokens[@idx].codeOrigin + annotationOpcode = (@tokens[@idx].type == :global) ? "globalAnnotation" : "localAnnotation" + list << Instruction.new(codeOrigin, annotationOpcode, [], @tokens[@idx].string) + @annotation = nil + @idx += 2 # Consume the newline as well. elsif @tokens[@idx] == "\n" # ignore @idx += 1 @@ -547,21 +574,22 @@ class Parser @idx += 1 if (not final and @idx == @tokens.size) or (final and @tokens[@idx] =~ final) # Zero operand instruction, and it's the last one. - list << Instruction.new(codeOrigin, name, []) + list << Instruction.new(codeOrigin, name, [], @annotation) + @annotation = nil break - elsif isAnnotation @tokens[@idx] - annotation = @tokens[@idx].string - list << Instruction.new(codeOrigin, name, [], annotation) + elsif @tokens[@idx].is_a? Annotation + list << Instruction.new(codeOrigin, name, [], @tokens[@idx].string) + @annotation = nil @idx += 2 # Consume the newline as well. elsif @tokens[@idx] == "\n" # Zero operand instruction. - list << Instruction.new(codeOrigin, name, []) + list << Instruction.new(codeOrigin, name, [], @annotation) + @annotation = nil @idx += 1 else # It's definitely an instruction, and it has at least one operand. operands = [] endOfSequence = false - annotation = nil loop { operands << parseOperand("while inside of instruction #{name}") if (not final and @idx == @tokens.size) or (final and @tokens[@idx] =~ final) @@ -571,8 +599,8 @@ class Parser elsif @tokens[@idx] == "," # Has another operand. @idx += 1 - elsif isAnnotation @tokens[@idx] - annotation = @tokens[@idx].string + elsif @tokens[@idx].is_a? Annotation + @annotation = @tokens[@idx].string @idx += 2 # Consume the newline as well. break elsif @tokens[@idx] == "\n" @@ -583,11 +611,14 @@ class Parser parseError("Expected a comma, newline, or #{final} after #{operands.last.dump}") end } - list << Instruction.new(codeOrigin, name, operands, annotation) + list << Instruction.new(codeOrigin, name, operands, @annotation) + @annotation = nil if endOfSequence break end end + + # Check for potential macro invocation: elsif isIdentifier @tokens[@idx] codeOrigin = @tokens[@idx].codeOrigin name = @tokens[@idx].string @@ -624,7 +655,13 @@ class Parser end } end - list << MacroCall.new(codeOrigin, name, operands) + # Check if there's a trailing annotation after the macro invoke: + if @tokens[@idx].is_a? Annotation + @annotation = @tokens[@idx].string + @idx += 2 # Consume the newline as well. + end + list << MacroCall.new(codeOrigin, name, operands, @annotation) + @annotation = nil else parseError "Expected \"(\" after #{name}" end diff --git a/Source/JavaScriptCore/offlineasm/transform.rb b/Source/JavaScriptCore/offlineasm/transform.rb index a47ea0ad6..c838629f0 100644 --- a/Source/JavaScriptCore/offlineasm/transform.rb +++ b/Source/JavaScriptCore/offlineasm/transform.rb @@ -229,6 +229,9 @@ class Sequence mapping[myMacros[item.name].variables[idx]] = item.operands[idx] end } + if item.annotation + newList << Instruction.new(item.codeOrigin, "localAnnotation", [], item.annotation) + end newList += myMacros[item.name].body.substitute(mapping).demacroify(myMyMacros).renameLabels(item.name).list else newList << item.demacroify(myMacros) diff --git a/Source/JavaScriptCore/offlineasm/x86.rb b/Source/JavaScriptCore/offlineasm/x86.rb index 470318a09..cebc83326 100644 --- a/Source/JavaScriptCore/offlineasm/x86.rb +++ b/Source/JavaScriptCore/offlineasm/x86.rb @@ -624,8 +624,8 @@ class Instruction end def lowerX86Common - $asm.codeOrigin codeOriginString - $asm.annotation annotation + $asm.codeOrigin codeOriginString if $enableCodeOriginComments + $asm.annotation annotation if $enableInstrAnnotations case opcode when "addi" @@ -1028,7 +1028,7 @@ class Instruction when "leap" $asm.puts "lea#{x86Suffix(:ptr)} #{operands[0].x86AddressOperand(:ptr)}, #{operands[1].x86Operand(:ptr)}" else - raise "Bad opcode: #{opcode}" + lowerDefault end end end diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp index f81ae10f3..d3d0fe574 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.cpp +++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp @@ -66,10 +66,6 @@ #include <unicode/udat.h> #endif -#if OS(WINCE) && !PLATFORM(QT) -extern "C" size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t); //provided by libce -#endif - using namespace WTF; namespace JSC { @@ -223,22 +219,57 @@ static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, doubl static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, LocaleDateTimeFormat format) { +#if OS(WINDOWS) + SYSTEMTIME systemTime; + memset(&systemTime, 0, sizeof(systemTime)); + systemTime.wYear = gdt.year + 1900; + systemTime.wMonth = gdt.month + 1; + systemTime.wDay = gdt.monthDay; + systemTime.wDayOfWeek = gdt.weekDay; + systemTime.wHour = gdt.hour; + systemTime.wMinute = gdt.minute; + systemTime.wSecond = gdt.second; + + Vector<UChar, 128> buffer; + size_t length = 0; + + if (format == LocaleDate) { + buffer.resize(GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systemTime, 0, 0, 0)); + length = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systemTime, 0, buffer.data(), buffer.size()); + } else if (format == LocaleTime) { + buffer.resize(GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systemTime, 0, 0, 0)); + length = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systemTime, 0, buffer.data(), buffer.size()); + } else if (format == LocaleDateAndTime) { + buffer.resize(GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systemTime, 0, 0, 0) + GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systemTime, 0, 0, 0)); + length = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systemTime, 0, buffer.data(), buffer.size()); + if (length) { + buffer[length - 1] = ' '; + length += GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systemTime, 0, buffer.data() + length, buffer.size() - length); + } + } else + ASSERT_NOT_REACHED(); + + // Remove terminating null character. + if (length) + length--; + + return jsNontrivialString(exec, UString(buffer.data(), length)); + +#else // OS(WINDOWS) + #if HAVE(LANGINFO_H) static const nl_item formats[] = { D_T_FMT, D_FMT, T_FMT }; -#elif (OS(WINCE) && !PLATFORM(QT)) - // strftime() does not support '#' on WinCE - static const char* const formatStrings[] = { "%c", "%x", "%X" }; #else static const char* const formatStrings[] = { "%#c", "%#x", "%X" }; #endif - + // Offset year if needed struct tm localTM = gdt; int year = gdt.year + 1900; bool yearNeedsOffset = year < 1900 || year > 2038; if (yearNeedsOffset) localTM.tm_year = equivalentYearForDST(year) - 1900; - + #if HAVE(LANGINFO_H) // We do not allow strftime to generate dates with 2-digits years, // both to avoid ambiguity, and a crash in strncpy, for years that @@ -259,19 +290,19 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L #else size_t ret = strftime(timebuffer, bufsize, formatStrings[format], &localTM); #endif - + if (ret == 0) return jsEmptyString(exec); - + // Copy original into the buffer if (yearNeedsOffset && format != LocaleTime) { static const int yearLen = 5; // FIXME will be a problem in the year 10,000 char yearString[yearLen]; - + snprintf(yearString, yearLen, "%d", localTM.tm_year + 1900); char* yearLocation = strstr(timebuffer, yearString); snprintf(yearString, yearLen, "%d", year); - + strncpy(yearLocation, yearString, yearLen - 1); } @@ -296,6 +327,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L #endif return jsNontrivialString(exec, timebuffer); +#endif // OS(WINDOWS) } static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double, LocaleDateTimeFormat format) diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h index 90925778b..59a672f67 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.h +++ b/Source/JavaScriptCore/runtime/JSGlobalData.h @@ -129,6 +129,10 @@ namespace JSC { #if ENABLE(DFG_JIT) class ConservativeRoots; +#if COMPILER(MSVC) +#pragma warning(push) +#pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" warning +#endif struct ScratchBuffer { ScratchBuffer() : m_activeLength(0) @@ -151,6 +155,9 @@ namespace JSC { size_t m_activeLength; void* m_buffer[0]; }; +#if COMPILER(MSVC) +#pragma warning(pop) +#endif #endif class JSGlobalData : public ThreadSafeRefCounted<JSGlobalData> { diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index ccc49fd5c..587929f66 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -599,19 +599,13 @@ PropertyStorage JSObject::growOutOfLineStorage(JSGlobalData& globalData, size_t PropertyStorage oldPropertyStorage = m_outOfLineStorage.get(); PropertyStorage newPropertyStorage = 0; - if (!oldPropertyStorage) { - // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. - void* temp = newPropertyStorage; - if (!globalData.heap.tryAllocateStorage(sizeof(WriteBarrierBase<Unknown>) * newSize, &temp)) - CRASH(); - newPropertyStorage = static_cast<PropertyStorage>(temp); - } else { - // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. - void* temp = oldPropertyStorage; - if (!globalData.heap.tryReallocateStorage(&temp, sizeof(WriteBarrierBase<Unknown>) * oldSize, sizeof(WriteBarrierBase<Unknown>) * newSize)) - CRASH(); - newPropertyStorage = static_cast<PropertyStorage>(temp); - } + // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. + void* temp = newPropertyStorage; + if (!globalData.heap.tryAllocateStorage(sizeof(WriteBarrierBase<Unknown>) * newSize, &temp)) + CRASH(); + newPropertyStorage = static_cast<PropertyStorage>(temp); + + memcpy(newPropertyStorage, oldPropertyStorage, sizeof(WriteBarrierBase<Unknown>) * oldSize); ASSERT(newPropertyStorage); return newPropertyStorage; diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp index 509ff3d45..e02105826 100644 --- a/Source/JavaScriptCore/runtime/Structure.cpp +++ b/Source/JavaScriptCore/runtime/Structure.cpp @@ -259,8 +259,8 @@ void Structure::materializePropertyMap(JSGlobalData& globalData) inline size_t nextOutOfLineStorageCapacity(size_t currentCapacity) { if (!currentCapacity) - return 4; - return currentCapacity * 2; + return initialOutOfLineCapacity; + return currentCapacity * outOfLineGrowthFactor; } void Structure::growOutOfLineCapacity() diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index d2d025b98..712ea6bb5 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -53,6 +53,15 @@ namespace JSC { class SlotVisitor; class JSString; + // The out-of-line property storage capacity to use when first allocating out-of-line + // storage. Note that all objects start out without having any out-of-line storage; + // this comes into play only on the first property store that exhausts inline storage. + static const unsigned initialOutOfLineCapacity = 4; + + // The factor by which to grow out-of-line storage when it is exhausted, after the + // initial allocation. + static const unsigned outOfLineGrowthFactor = 2; + class Structure : public JSCell { public: friend class StructureTransitionTable; diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index 1fe99b13d..76c17133f 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,98 @@ +2012-07-18 Antoine Labour <piman@chromium.org> + + [chromium] Introduce CCResourceProvider, replacing TextureAllocator and hiding textures from clients to allow transport + https://bugs.webkit.org/show_bug.cgi?id=91044 + + Reviewed by Adrienne Walker. + + This does several things: + - Add a CCResourceProvider class, that hides textures and the 3D context + from layers (except those that need it). Instead layers manage + "resources". In the future, resources are expected to be transportable + to a "parent" CCResourceProvider to allow flattening of nested + compositors. + - Replace texture ids by resource ids in DrawQuads (allowing them to be + serializable). + - Replace TextureAllocator uses by the CCResourceProvider class. + - Upload of data is done through the CCResourceProvider instead of + explicit GL calls. + - External textures are wrapped into a resource at draw time (see + caveat/FIXME in CCTextureLayerImpl). + - Rendering with the resources is done through an explicit + beginRenderFrom/endRenderFrom that exposes the texture only between that + pair. + - Merge all the LayerTextureSubImage instances (one per layer), into a + single instance on the CCResourceProvider. + + Added CCResourceProviderTest, the refactoring is covered by existing tests. + + * chromium/public/WebCompositorTextureQuad.h: + (WebCompositorTextureQuad): + (WebKit::WebCompositorTextureQuad::resourceId): + * chromium/public/WebCompositorTileQuad.h: + (WebCompositorTileQuad): + (WebKit::WebCompositorTileQuad::resourceId): + +2012-07-18 Alexandre Elias <aelias@google.com> + + [chromium] Ubercomp: add id to SharedQuadState + https://bugs.webkit.org/show_bug.cgi?id=91670 + + Reviewed by Adrienne Walker. + + This assigns an integer ID to SharedQuadState objects and a + corresponding ID to quads. This ID is unique only within a + RenderPass and currently is just set to the index in the shared quad + state list. This is redundant with the pointer and exists to + simplify serialization. + + I found out that pointer rewriting within a pickler is blocked by + pointers to memory being const there, so the reassignment will have to + be performed in the application layer anyway. In that case, it's + simplest to add some ID integers. + + * chromium/public/WebCompositorQuad.h: + (WebKit::WebCompositorQuad::sharedQuadStateId): + (WebCompositorQuad): + * chromium/public/WebCompositorSharedQuadState.h: + (WebCompositorSharedQuadState): + +2012-07-18 Ryosuke Niwa <rniwa@webkit.org> + + Another Chromium Windows build fix attempt after r123014. + + * chromium/public/Platform.h: + +2012-07-18 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call SQLiteFileSystem-related functions directly + https://bugs.webkit.org/show_bug.cgi?id=91631 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * chromium/public/Platform.h: + (Platform): + (WebKit::Platform::databaseOpenFile): + (WebKit::Platform::databaseDeleteFile): + (WebKit::Platform::databaseGetFileAttributes): + (WebKit::Platform::databaseGetFileSize): + (WebKit::Platform::databaseGetSpaceAvailableForOrigin): + +2012-07-18 Sailesh Agrawal <sail@chromium.org> + + Chromium Mac: Add TEXTURE_RECTANGLE_ARB support to CCVideoLayerImpl + https://bugs.webkit.org/show_bug.cgi?id=91169 + + Reviewed by Adrienne Walker. + + Added a "orientation" field to WebCompositorIOSurfaceQuad. This is used at draw time to flip the texture if necessary. + + * chromium/public/WebCompositorIOSurfaceQuad.h: Added orientation field to the constructor. + (WebKit::WebCompositorIOSurfaceQuad::orientation): + (WebCompositorIOSurfaceQuad): The new orientation field should be set to Flipped if the texture should be flipped when drawing. + 2012-07-13 Tony Payne <tpayne@chromium.org> Remove Widget from screenColorProfile diff --git a/Source/Platform/chromium/public/Platform.h b/Source/Platform/chromium/public/Platform.h index 7e4320ba8..b0b0e6ed2 100644 --- a/Source/Platform/chromium/public/Platform.h +++ b/Source/Platform/chromium/public/Platform.h @@ -31,6 +31,10 @@ #ifndef Platform_h #define Platform_h +#ifdef WIN32 +#include <windows.h> +#endif + #include "WebAudioDevice.h" #include "WebCommon.h" #include "WebData.h" @@ -68,6 +72,14 @@ struct WebLocalizedString; class Platform { public: + // HTML5 Database ------------------------------------------------------ + +#ifdef WIN32 + typedef HANDLE FileHandle; +#else + typedef int FileHandle; +#endif + WEBKIT_EXPORT static void initialize(Platform*); WEBKIT_EXPORT static void shutdown(); WEBKIT_EXPORT static Platform* current(); @@ -104,6 +116,25 @@ public: virtual WebBlobRegistry* blobRegistry() { return 0; } + // Database ------------------------------------------------------------ + + // Opens a database file; dirHandle should be 0 if the caller does not need + // a handle to the directory containing this file + virtual FileHandle databaseOpenFile(const WebString& vfsFileName, int desiredFlags) { return FileHandle(); } + + // Deletes a database file and returns the error code + virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; } + + // Returns the attributes of the given database file + virtual long databaseGetFileAttributes(const WebString& vfsFileName) { return 0; } + + // Returns the size of the given database file + virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; } + + // Returns the space available for the given origin + virtual long long databaseGetSpaceAvailableForOrigin(const WebKit::WebString& originIdentifier) { return 0; } + + // DOM Storage -------------------------------------------------- // Return a LocalStorage namespace that corresponds to the following path. diff --git a/Source/Platform/chromium/public/WebCompositorIOSurfaceQuad.h b/Source/Platform/chromium/public/WebCompositorIOSurfaceQuad.h index 5d7eb1cbd..e850e0628 100644 --- a/Source/Platform/chromium/public/WebCompositorIOSurfaceQuad.h +++ b/Source/Platform/chromium/public/WebCompositorIOSurfaceQuad.h @@ -37,20 +37,27 @@ namespace WebKit { class WebCompositorIOSurfaceQuad : public WebCompositorQuad { public: #if WEBKIT_IMPLEMENTATION - static PassOwnPtr<WebCompositorIOSurfaceQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, const WebCore::IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); + enum Orientation { + Flipped, + Unflipped + }; + + static PassOwnPtr<WebCompositorIOSurfaceQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, const WebCore::IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation); WebCore::IntSize ioSurfaceSize() const { return m_ioSurfaceSize; } unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; } + Orientation orientation() const { return m_orientation; } #endif static const WebCompositorIOSurfaceQuad* materialCast(const WebCompositorQuad*); private: #if WEBKIT_IMPLEMENTATION - WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect&, const WebCore::IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); + WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect&, const WebCore::IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation); #endif WebSize m_ioSurfaceSize; unsigned m_ioSurfaceTextureId; + Orientation m_orientation; }; #pragma pack(pop) diff --git a/Source/Platform/chromium/public/WebCompositorQuad.h b/Source/Platform/chromium/public/WebCompositorQuad.h index e2ad0adab..68027fc55 100644 --- a/Source/Platform/chromium/public/WebCompositorQuad.h +++ b/Source/Platform/chromium/public/WebCompositorQuad.h @@ -85,7 +85,8 @@ public: unsigned size() const; const WebCompositorSharedQuadState* sharedQuadState() const { return m_sharedQuadState; } - void setSharedQuadState(const WebCompositorSharedQuadState* sharedQuadState) { m_sharedQuadState = sharedQuadState; } + int sharedQuadStateId() const { return m_sharedQuadStateId; } + void setSharedQuadState(const WebCompositorSharedQuadState*); protected: #if WEBKIT_IMPLEMENTATION @@ -96,6 +97,7 @@ protected: // efficiency. There is special treatment to reconstruct these pointers // during serialization. const WebCompositorSharedQuadState* m_sharedQuadState; + int m_sharedQuadStateId; Material m_material; WebRect m_quadRect; diff --git a/Source/Platform/chromium/public/WebCompositorSharedQuadState.h b/Source/Platform/chromium/public/WebCompositorSharedQuadState.h index 37c6d18aa..063d4073e 100644 --- a/Source/Platform/chromium/public/WebCompositorSharedQuadState.h +++ b/Source/Platform/chromium/public/WebCompositorSharedQuadState.h @@ -39,6 +39,8 @@ namespace WebKit { class WebCompositorSharedQuadState { public: + int id; + // Transforms from quad's original content space to its target content space. WebTransformationMatrix quadTransform; // This rect lives in the content space for the quad's originating layer. @@ -51,8 +53,8 @@ public: WebCompositorSharedQuadState(); #if WEBKIT_IMPLEMENTATION - static PassOwnPtr<WebCompositorSharedQuadState> create(const WebTransformationMatrix& quadTransform, const WebCore::IntRect& visibleContentRect, const WebCore::IntRect& scissorRect, float opacity, bool opaque); - WebCompositorSharedQuadState(const WebTransformationMatrix& quadTransform, const WebCore::IntRect& visibleContentRect, const WebCore::IntRect& scissorRect, float opacity, bool opaque); + static PassOwnPtr<WebCompositorSharedQuadState> create(int id, const WebTransformationMatrix& quadTransform, const WebCore::IntRect& visibleContentRect, const WebCore::IntRect& scissorRect, float opacity, bool opaque); + WebCompositorSharedQuadState(int id, const WebTransformationMatrix& quadTransform, const WebCore::IntRect& visibleContentRect, const WebCore::IntRect& scissorRect, float opacity, bool opaque); bool isLayerAxisAlignedIntRect() const; #endif }; diff --git a/Source/Platform/chromium/public/WebCompositorTextureQuad.h b/Source/Platform/chromium/public/WebCompositorTextureQuad.h index 9be6fd3e6..6b8869565 100644 --- a/Source/Platform/chromium/public/WebCompositorTextureQuad.h +++ b/Source/Platform/chromium/public/WebCompositorTextureQuad.h @@ -43,11 +43,11 @@ namespace WebKit { class WebCompositorTextureQuad : public WebCompositorQuad { public: #if WEBKIT_IMPLEMENTATION - static PassOwnPtr<WebCompositorTextureQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, unsigned textureId, bool premultipliedAlpha, const WebCore::FloatRect& uvRect, bool flipped); + static PassOwnPtr<WebCompositorTextureQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, unsigned resourceId, bool premultipliedAlpha, const WebCore::FloatRect& uvRect, bool flipped); WebCore::FloatRect uvRect() const { return m_uvRect; } #endif - unsigned textureId() const { return m_textureId; } + unsigned resourceId() const { return m_resourceId; } bool premultipliedAlpha() const { return m_premultipliedAlpha; } bool flipped() const { return m_flipped; } @@ -56,10 +56,10 @@ public: static const WebCompositorTextureQuad* materialCast(const WebCompositorQuad*); private: #if WEBKIT_IMPLEMENTATION - WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState*, const WebCore::IntRect&, unsigned texture_id, bool premultipliedAlpha, const WebCore::FloatRect& uvRect, bool flipped); + WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState*, const WebCore::IntRect&, unsigned resourceId, bool premultipliedAlpha, const WebCore::FloatRect& uvRect, bool flipped); #endif - unsigned m_textureId; + unsigned m_resourceId; bool m_premultipliedAlpha; WebFloatRect m_uvRect; bool m_flipped; diff --git a/Source/Platform/chromium/public/WebCompositorTileQuad.h b/Source/Platform/chromium/public/WebCompositorTileQuad.h index e0a255bb2..e20de7233 100644 --- a/Source/Platform/chromium/public/WebCompositorTileQuad.h +++ b/Source/Platform/chromium/public/WebCompositorTileQuad.h @@ -39,9 +39,9 @@ namespace WebKit { class WebCompositorTileQuad : public WebCompositorQuad { public: #if WEBKIT_IMPLEMENTATION - static PassOwnPtr<WebCompositorTileQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect& quadRect, const WebCore::IntRect& opaqueRect, Platform3DObject textureId, const WebCore::IntPoint& textureOffset, const WebCore::IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); + static PassOwnPtr<WebCompositorTileQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect& quadRect, const WebCore::IntRect& opaqueRect, unsigned resourceId, const WebCore::IntPoint& textureOffset, const WebCore::IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); - Platform3DObject textureId() const { return m_textureId; } + unsigned resourceId() const { return m_resourceId; } WebCore::IntPoint textureOffset() const { return m_textureOffset; } WebCore::IntSize textureSize() const { return m_textureSize; } GC3Dint textureFilter() const { return m_textureFilter; } @@ -58,10 +58,10 @@ public: static const WebCompositorTileQuad* materialCast(const WebCompositorQuad*); private: #if WEBKIT_IMPLEMENTATION - WebCompositorTileQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect& quadRect, const WebCore::IntRect& opaqueRect, Platform3DObject textureId, const WebCore::IntPoint& textureOffset, const WebCore::IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); + WebCompositorTileQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect& quadRect, const WebCore::IntRect& opaqueRect, unsigned resourceId, const WebCore::IntPoint& textureOffset, const WebCore::IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); #endif - Platform3DObject m_textureId; + unsigned m_resourceId; WebPoint m_textureOffset; WebSize m_textureSize; GC3Dint m_textureFilter; diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index c94173fed..b61d78c35 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,109 @@ +2012-07-20 Han Shen <shenhan@google.com> + + [Chromium] Compilation fails under gcc 4.7 + https://bugs.webkit.org/show_bug.cgi?id=90227 + + Reviewed by Tony Chang. + + Disable warnings about c++0x compatibility in gcc newer than 4.6. + + * WTF.gyp/WTF.gyp: + +2012-07-19 Dan Bernstein <mitz@apple.com> + + The ATSUI-based complex text code is unused + https://bugs.webkit.org/show_bug.cgi?id=91816 + + Reviewed by Sam Weinig. + + Removed definitions of WTF_USE_ATSUI and WTF_USE_CORE_TEXT. + + * wtf/Platform.h: + +2012-07-19 Wei James <james.wei@intel.com> + + enable Web Audio for chromium android port + https://bugs.webkit.org/show_bug.cgi?id=89428 + + Reviewed by Kenneth Russell. + + * wtf/MathExtras.h: + (log2): + (log2f): + +2012-07-19 Scott Graham <scottmg@chromium.org> + + [Chromium] disable warning on Windows from gcc-only pragma in Assertions.cpp" + https://bugs.webkit.org/show_bug.cgi?id=91776 + + Reviewed by Ryosuke Niwa. + + Avoids: + ...\source\wtf\wtf\assertions.cpp(31) : warning C4068: unknown pragma + + * WTF.gyp/WTF.gyp: + +2012-07-19 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] Switch the MACOSX_DEPLOYMENT_TARGET to 10.6 + https://bugs.webkit.org/show_bug.cgi?id=91752 + + Reviewed by Eric Seidel. + + When building CHROMIUM && DARWIN, do not enable ATSUI support. + + * wtf/Platform.h: + +2012-07-18 Yong Li <yoli@rim.com> + + [BlackBerry] Implement currentTime() and monotonicallyIncreasingTime() for OS(QNX) + https://bugs.webkit.org/show_bug.cgi?id=91659 + + Reviewed by Rob Buis. + + Implement currentTime() and monotonicallyIncreasingTime() for OS(QNX) with clock_gettime(). + + * wtf/CurrentTime.cpp: + (WTF): + (WTF::currentTime): + (WTF::monotonicallyIncreasingTime): + +2012-07-18 Tom Sepez <tsepez@chromium.org> + + OOB read of stack buffer below DoubleToStringConverter::CreateExponentialRepresentation() in debug builds + https://bugs.webkit.org/show_bug.cgi?id=91642 + + Reviewed by Abhishek Arya. + + * wtf/dtoa/double-conversion.cc: + (DoubleToStringConverter::CreateExponentialRepresentation): NUL-terminate string buffer before passing it to StringBuilder::AddSubstring() + +2012-07-18 Michael Saboff <msaboff@apple.com> + + Make TextCodecLatin1 handle 8 bit data without converting to UChar's + https://bugs.webkit.org/show_bug.cgi?id=90319 + + Reviewed by Oliver Hunt. + + * wtf/text/StringImpl.h: + (StringImpl): Exported LChar variant of adopt(). + * wtf/text/WTFString.h: + (WTF::String::createUninitialized): Exported LChar variant. + +2012-07-18 Rob Buis <rbuis@rim.com> + + Alignment crash in MIMESniffer + https://bugs.webkit.org/show_bug.cgi?id=89787 + + Reviewed by Yong Li. + + PR 169064 + + Change isPointerTypeAlignmentOkay so calling it does not require ifdefs. + + * wtf/StdLibExtras.h: + (isPointerTypeAlignmentOkay): + 2012-07-17 Gabor Ballabas <gaborb@inf.u-szeged.hu> [Qt][V8] Remove the V8 related codepaths and configuration diff --git a/Source/WTF/WTF.gyp/WTF.gyp b/Source/WTF/WTF.gyp/WTF.gyp index bca8366f0..db82dd25a 100644 --- a/Source/WTF/WTF.gyp/WTF.gyp +++ b/Source/WTF/WTF.gyp/WTF.gyp @@ -44,7 +44,7 @@ ], }, 'conditions': [ - ['os_posix == 1 and OS != "mac" and gcc_version==46', { + ['os_posix == 1 and OS != "mac" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such as nullptr) conflict # with upcoming c++0x types. @@ -154,7 +154,7 @@ '<(chromium_src_dir)/third_party/icu/icu.gyp:icui18n', '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', ], - 'msvs_disabled_warnings': [4127, 4355, 4510, 4512, 4610, 4706], + 'msvs_disabled_warnings': [4127, 4355, 4510, 4512, 4610, 4706, 4068], 'conditions': [ ['OS=="win"', { 'sources/': [ diff --git a/Source/WTF/wtf/CurrentTime.cpp b/Source/WTF/wtf/CurrentTime.cpp index 325630981..155051ac7 100644 --- a/Source/WTF/wtf/CurrentTime.cpp +++ b/Source/WTF/wtf/CurrentTime.cpp @@ -252,6 +252,16 @@ double currentTime() return ecore_time_unix_get(); } +#elif OS(QNX) + +double currentTime() +{ + struct timespec time; + if (clock_gettime(CLOCK_REALTIME, &time)) + CRASH(); + return time.tv_sec + time.tv_nsec / 1.0e9; +} + #else double currentTime() @@ -299,6 +309,16 @@ double monotonicallyIncreasingTime() return timer.nsecsElapsed() / 1.0e9; } +#elif OS(QNX) + +double monotonicallyIncreasingTime() +{ + struct timespec time; + if (clock_gettime(CLOCK_MONOTONIC, &time)) + CRASH(); + return time.tv_sec + time.tv_nsec / 1.0e9; +} + #else double monotonicallyIncreasingTime() diff --git a/Source/WTF/wtf/MathExtras.h b/Source/WTF/wtf/MathExtras.h index e44ab6c6b..b03d45d3c 100644 --- a/Source/WTF/wtf/MathExtras.h +++ b/Source/WTF/wtf/MathExtras.h @@ -138,6 +138,21 @@ inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); } inline long long abs(long num) { return labs(num); } #endif +#if OS(ANDROID) || COMPILER(MSVC) +// ANDROID and MSVC's math.h does not currently supply log2 or log2f. +inline double log2(double num) +{ + // This constant is roughly M_LN2, which is not provided by default on Windows and Android. + return log(num) / 0.693147180559945309417232121458176568; +} + +inline float log2f(float num) +{ + // This constant is roughly M_LN2, which is not provided by default on Windows and Android. + return logf(num) / 0.693147180559945309417232121458176568f; +} +#endif + #if COMPILER(MSVC) // The 64bit version of abs() is already defined in stdlib.h which comes with VC10 #if COMPILER(MSVC9_OR_LOWER) @@ -154,19 +169,6 @@ inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + inline double copysign(double x, double y) { return _copysign(x, y); } inline int isfinite(double x) { return _finite(x); } -// MSVC's math.h does not currently supply log2 or log2f. -inline double log2(double num) -{ - // This constant is roughly M_LN2, which is not provided by default on Windows. - return log(num) / 0.693147180559945309417232121458176568; -} - -inline float log2f(float num) -{ - // This constant is roughly M_LN2, which is not provided by default on Windows. - return logf(num) / 0.693147180559945309417232121458176568f; -} - // Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values. inline double wtf_atan2(double x, double y) { diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index c17f3e1bc..a7e1d52e3 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -466,8 +466,6 @@ #if PLATFORM(CHROMIUM) #if OS(DARWIN) #define WTF_USE_SKIA 1 -#define WTF_USE_ATSUI 1 -#define WTF_USE_CORE_TEXT 1 #define WTF_USE_ICCJPEG 1 #define WTF_USE_QCMSLIB 1 #elif OS(ANDROID) @@ -644,7 +642,6 @@ #define ENABLE_LLINT 0 #if OS(DARWIN) #define WTF_USE_CF 1 -#define WTF_USE_CORE_TEXT 1 #define ENABLE_WEB_ARCHIVE 1 #endif #endif @@ -997,12 +994,6 @@ #endif #endif -#if PLATFORM(MAC) -/* Complex text framework */ -#define WTF_USE_ATSUI 0 -#define WTF_USE_CORE_TEXT 1 -#endif - /* Accelerated compositing */ #if PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) #define WTF_USE_ACCELERATED_COMPOSITING 1 diff --git a/Source/WTF/wtf/StdLibExtras.h b/Source/WTF/wtf/StdLibExtras.h index 89e549893..e66df2c31 100644 --- a/Source/WTF/wtf/StdLibExtras.h +++ b/Source/WTF/wtf/StdLibExtras.h @@ -102,6 +102,11 @@ TypePtr reinterpret_cast_ptr(const void* ptr) return reinterpret_cast<TypePtr>(ptr); } #else +template<typename Type> +bool isPointerTypeAlignmentOkay(Type*) +{ + return true; +} #define reinterpret_cast_ptr reinterpret_cast #endif diff --git a/Source/WTF/wtf/ThreadSpecific.h b/Source/WTF/wtf/ThreadSpecific.h index 60c9907bd..f51ab4cf2 100644 --- a/Source/WTF/wtf/ThreadSpecific.h +++ b/Source/WTF/wtf/ThreadSpecific.h @@ -1,7 +1,6 @@ /* * Copyright (C) 2008 Apple Inc. All rights reserved. * Copyright (C) 2009 Jian Li <jianli@chromium.org> - * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -103,33 +102,6 @@ private: }; #if USE(PTHREADS) - -typedef pthread_key_t ThreadSpecificKey; - -inline void ThreadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *)) -{ - int error = pthread_key_create(key, destructor); - if (error) - CRASH(); -} - -inline void ThreadSpecificKeyDelete(ThreadSpecificKey key) -{ - int error = pthread_key_delete(key); - if (error) - CRASH(); -} - -inline void ThreadSpecificSet(ThreadSpecificKey key, void* value) -{ - pthread_setspecific(key, value); -} - -inline void* ThreadSpecificGet(ThreadSpecificKey key) -{ - return pthread_getspecific(key); -} - template<typename T> inline ThreadSpecific<T>::ThreadSpecific() { @@ -167,14 +139,6 @@ const int kMaxTlsKeySize = 256; WTF_EXPORT_PRIVATE long& tlsKeyCount(); WTF_EXPORT_PRIVATE DWORD* tlsKeys(); -class ThreadSpecificKeyValue; -typedef ThreadSpecificKeyValue* ThreadSpecificKey; - -void ThreadSpecificKeyCreate(ThreadSpecificKey*, void (*)(void *)); -void ThreadSpecificKeyDelete(ThreadSpecificKey); -void ThreadSpecificSet(ThreadSpecificKey, void*); -void* ThreadSpecificGet(ThreadSpecificKey); - template<typename T> inline ThreadSpecific<T>::ThreadSpecific() : m_index(-1) diff --git a/Source/WTF/wtf/ThreadSpecificWin.cpp b/Source/WTF/wtf/ThreadSpecificWin.cpp index 61a594251..d72996a7a 100644 --- a/Source/WTF/wtf/ThreadSpecificWin.cpp +++ b/Source/WTF/wtf/ThreadSpecificWin.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2009 Jian Li <jianli@chromium.org> - * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,72 +19,15 @@ */ #include "config.h" -#include "ThreadSpecific.h" -#include "StdLibExtras.h" -#include "ThreadingPrimitives.h" +#include "ThreadSpecific.h" -#if !USE(PTHREADS) +#if USE(PTHREADS) +#error This file should not be compiled by ports that do not use Windows native ThreadSpecific implementation. +#endif namespace WTF { -static Mutex& destructorsMutex() -{ - DEFINE_STATIC_LOCAL(Mutex, staticMutex, ()); - return staticMutex; -} - -class ThreadSpecificKeyValue { -public: - ThreadSpecificKeyValue(void (*destructor)(void *)) - : m_destructor(destructor) - { - m_tlsKey = TlsAlloc(); - if (m_tlsKey == TLS_OUT_OF_INDEXES) - CRASH(); - - MutexLocker locker(destructorsMutex()); - m_next = m_first; - m_first = this; - } - - ~ThreadSpecificKeyValue() - { - MutexLocker locker(destructorsMutex()); - ThreadSpecificKeyValue** next = &m_first; - while (*next != this) { - ASSERT(*next); - next = &(*next)->m_next; - } - *next = (*next)->m_next; - - TlsFree(m_tlsKey); - } - - void setValue(void* data) { TlsSetValue(m_tlsKey, data); } - void* value() { return TlsGetValue(m_tlsKey); } - - static void callDestructors() - { - MutexLocker locker(destructorsMutex()); - ThreadSpecificKeyValue* next = m_first; - while (next) { - if (void* data = next->value()) - next->m_destructor(data); - next = next->m_next; - } - } - -private: - void (*m_destructor)(void *); - DWORD m_tlsKey; - ThreadSpecificKeyValue* m_next; - - static ThreadSpecificKeyValue* m_first; -}; - -ThreadSpecificKeyValue* ThreadSpecificKeyValue::m_first = 0; - long& tlsKeyCount() { static long count; @@ -98,26 +40,6 @@ DWORD* tlsKeys() return keys; } -void ThreadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *)) -{ - *key = new ThreadSpecificKeyValue(destructor); -} - -void ThreadSpecificKeyDelete(ThreadSpecificKey key) -{ - delete key; -} - -void ThreadSpecificSet(ThreadSpecificKey key, void* data) -{ - key->setValue(data); -} - -void* ThreadSpecificGet(ThreadSpecificKey key) -{ - return key->value(); -} - void ThreadSpecificThreadExit() { for (long i = 0; i < tlsKeyCount(); i++) { @@ -126,10 +48,6 @@ void ThreadSpecificThreadExit() if (data) data->destructor(data); } - - ThreadSpecificKeyValue::callDestructors(); } } // namespace WTF - -#endif // !USE(PTHREADS) diff --git a/Source/WTF/wtf/dtoa/double-conversion.cc b/Source/WTF/wtf/dtoa/double-conversion.cc index 197389c83..c46dba98b 100644 --- a/Source/WTF/wtf/dtoa/double-conversion.cc +++ b/Source/WTF/wtf/dtoa/double-conversion.cc @@ -102,8 +102,9 @@ namespace double_conversion { } ASSERT(exponent < 1e4); const int kMaxExponentLength = 5; - char buffer[kMaxExponentLength]; + char buffer[kMaxExponentLength + 1]; int first_char_pos = kMaxExponentLength; + buffer[first_char_pos] = '\0'; while (exponent > 0) { buffer[--first_char_pos] = '0' + (exponent % 10); exponent /= 10; diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h index ec4493e73..d0060c470 100644 --- a/Source/WTF/wtf/text/StringImpl.h +++ b/Source/WTF/wtf/text/StringImpl.h @@ -282,7 +282,7 @@ public: return adoptRef(new StringImpl(rep->m_data16 + offset, length, ownerRep)); } - static PassRefPtr<StringImpl> createUninitialized(unsigned length, LChar*& data); + WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> createUninitialized(unsigned length, LChar*& data); WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> createUninitialized(unsigned length, UChar*& data); template <typename T> static ALWAYS_INLINE PassRefPtr<StringImpl> tryCreateUninitialized(unsigned length, T*& output) { @@ -336,8 +336,8 @@ public: return empty(); } - static PassRefPtr<StringImpl> adopt(StringBuffer<LChar>& buffer); - WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> adopt(StringBuffer<UChar>& buffer); + WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> adopt(StringBuffer<UChar>&); + WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> adopt(StringBuffer<LChar>&); #if PLATFORM(QT) && HAVE(QT5) static PassRefPtr<StringImpl> adopt(QStringData*); diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h index 6cebf803d..9f492a7a1 100644 --- a/Source/WTF/wtf/text/WTFString.h +++ b/Source/WTF/wtf/text/WTFString.h @@ -321,6 +321,7 @@ public: // into the buffer returned in data before the returned string is used. // Failure to do this will have unpredictable results. static String createUninitialized(unsigned length, UChar*& data) { return StringImpl::createUninitialized(length, data); } + static String createUninitialized(unsigned length, LChar*& data) { return StringImpl::createUninitialized(length, data); } WTF_EXPORT_PRIVATE void split(const String& separator, Vector<String>& result) const; WTF_EXPORT_PRIVATE void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const; diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 953676684..89d450281 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1,12 +1,17 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}" + "${WEBCORE_DIR}/Modules/battery" "${WEBCORE_DIR}/Modules/filesystem" + "${WEBCORE_DIR}/Modules/gamepad" "${WEBCORE_DIR}/Modules/geolocation" "${WEBCORE_DIR}/Modules/indexeddb" "${WEBCORE_DIR}/Modules/intents" + "${WEBCORE_DIR}/Modules/mediastream" + "${WEBCORE_DIR}/Modules/networkinfo" "${WEBCORE_DIR}/Modules/notifications" "${WEBCORE_DIR}/Modules/protocolhandler" "${WEBCORE_DIR}/Modules/quota" + "${WEBCORE_DIR}/Modules/vibration" "${WEBCORE_DIR}/Modules/webaudio" "${WEBCORE_DIR}/Modules/webdatabase" "${WEBCORE_DIR}/Modules/websockets" @@ -52,6 +57,7 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/image-decoders/png" "${WEBCORE_DIR}/platform/image-decoders/webp" "${WEBCORE_DIR}/platform/leveldb" + "${WEBCORE_DIR}/platform/mediastream" "${WEBCORE_DIR}/platform/mock" "${WEBCORE_DIR}/platform/network" "${WEBCORE_DIR}/platform/sql" @@ -121,6 +127,38 @@ SET(WebCore_IDL_INCLUDES ) SET(WebCore_IDL_FILES + Modules/battery/BatteryManager.idl + Modules/battery/NavigatorBattery.idl + + Modules/filesystem/DirectoryEntry.idl + Modules/filesystem/DirectoryEntrySync.idl + Modules/filesystem/DirectoryReader.idl + Modules/filesystem/DirectoryReaderSync.idl + Modules/filesystem/DOMFileSystem.idl + Modules/filesystem/DOMFileSystemSync.idl + Modules/filesystem/DOMWindowFileSystem.idl + Modules/filesystem/EntriesCallback.idl + Modules/filesystem/Entry.idl + Modules/filesystem/EntrySync.idl + Modules/filesystem/EntryArray.idl + Modules/filesystem/EntryArraySync.idl + Modules/filesystem/EntryCallback.idl + Modules/filesystem/ErrorCallback.idl + Modules/filesystem/FileCallback.idl + Modules/filesystem/FileEntry.idl + Modules/filesystem/FileEntrySync.idl + Modules/filesystem/FileSystemCallback.idl + Modules/filesystem/FileWriterCallback.idl + Modules/filesystem/FileWriter.idl + Modules/filesystem/FileWriterSync.idl + Modules/filesystem/Metadata.idl + Modules/filesystem/MetadataCallback.idl + Modules/filesystem/WorkerContextFileSystem.idl + + Modules/gamepad/Gamepad.idl + Modules/gamepad/GamepadList.idl + Modules/gamepad/NavigatorGamepad.idl + Modules/geolocation/Geolocation.idl Modules/geolocation/Geoposition.idl Modules/geolocation/NavigatorGeolocation.idl @@ -128,7 +166,66 @@ SET(WebCore_IDL_FILES Modules/geolocation/PositionError.idl Modules/geolocation/PositionErrorCallback.idl + Modules/indexeddb/DOMWindowIndexedDatabase.idl + Modules/indexeddb/IDBAny.idl + Modules/indexeddb/IDBCursor.idl + Modules/indexeddb/IDBCursorWithValue.idl + Modules/indexeddb/IDBDatabase.idl + Modules/indexeddb/IDBDatabaseException.idl + Modules/indexeddb/IDBFactory.idl + Modules/indexeddb/IDBIndex.idl + Modules/indexeddb/IDBKey.idl + Modules/indexeddb/IDBKeyRange.idl + Modules/indexeddb/IDBObjectStore.idl + Modules/indexeddb/IDBRequest.idl + Modules/indexeddb/IDBTransaction.idl + Modules/indexeddb/IDBVersionChangeEvent.idl + Modules/indexeddb/IDBVersionChangeRequest.idl + Modules/indexeddb/WorkerContextIndexedDatabase.idl + + Modules/intents/DeliveredIntent.idl + Modules/intents/DOMWindowIntents.idl + Modules/intents/Intent.idl + Modules/intents/IntentResultCallback.idl + Modules/intents/NavigatorIntents.idl + + Modules/mediastream/DeprecatedPeerConnection.idl + Modules/mediastream/DOMWindowMediaStream.idl + Modules/mediastream/IceCallback.idl + Modules/mediastream/IceCandidate.idl + Modules/mediastream/LocalMediaStream.idl + Modules/mediastream/MediaStream.idl + Modules/mediastream/MediaStreamEvent.idl + Modules/mediastream/MediaStreamList.idl + Modules/mediastream/MediaStreamTrack.idl + Modules/mediastream/MediaStreamTrackEvent.idl + Modules/mediastream/MediaStreamTrackList.idl + Modules/mediastream/NavigatorMediaStream.idl + Modules/mediastream/NavigatorUserMediaError.idl + Modules/mediastream/NavigatorUserMediaErrorCallback.idl + Modules/mediastream/NavigatorUserMediaSuccessCallback.idl + Modules/mediastream/PeerConnection00.idl + Modules/mediastream/SessionDescription.idl + Modules/mediastream/SignalingCallback.idl + + Modules/networkinfo/NavigatorNetworkInfoConnection.idl + Modules/networkinfo/NetworkInfoConnection.idl + + Modules/notifications/DOMWindowNotifications.idl + Modules/notifications/Notification.idl + Modules/notifications/NotificationCenter.idl + Modules/notifications/NotificationPermissionCallback.idl + Modules/notifications/WorkerContextNotifications.idl + Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl + + Modules/quota/DOMWindowQuota.idl + Modules/quota/StorageInfo.idl + Modules/quota/StorageInfoErrorCallback.idl + Modules/quota/StorageInfoQuotaCallback.idl + Modules/quota/StorageInfoUsageCallback.idl + + Modules/vibration/NavigatorVibration.idl Modules/webaudio/AudioBuffer.idl Modules/webaudio/AudioBufferCallback.idl @@ -158,8 +255,25 @@ SET(WebCore_IDL_FILES Modules/webaudio/WaveShaperNode.idl Modules/webaudio/WaveTable.idl + Modules/webdatabase/Database.idl + Modules/webdatabase/DatabaseCallback.idl + Modules/webdatabase/DatabaseSync.idl + Modules/webdatabase/DOMWindowWebDatabase.idl + Modules/webdatabase/SQLError.idl + Modules/webdatabase/SQLException.idl + Modules/webdatabase/SQLResultSet.idl + Modules/webdatabase/SQLResultSetRowList.idl + Modules/webdatabase/SQLStatementCallback.idl + Modules/webdatabase/SQLStatementErrorCallback.idl + Modules/webdatabase/SQLTransaction.idl + Modules/webdatabase/SQLTransactionCallback.idl + Modules/webdatabase/SQLTransactionErrorCallback.idl + Modules/webdatabase/SQLTransactionSync.idl + Modules/webdatabase/SQLTransactionSyncCallback.idl + Modules/websockets/CloseEvent.idl Modules/websockets/DOMWindowWebSocket.idl + Modules/websockets/WebSocket.idl Modules/websockets/WorkerContextWebSocket.idl css/Counter.idl @@ -178,8 +292,8 @@ SET(WebCore_IDL_FILES css/CSSValueList.idl css/MediaList.idl css/MediaQueryList.idl - css/Rect.idl css/RGBColor.idl + css/Rect.idl css/StyleMedia.idl css/StyleSheet.idl css/StyleSheetList.idl @@ -200,17 +314,18 @@ SET(WebCore_IDL_FILES dom/Comment.idl dom/CompositionEvent.idl dom/CustomEvent.idl + dom/DataTransferItem.idl dom/DataTransferItemList.idl dom/DeviceMotionEvent.idl dom/DeviceOrientationEvent.idl - dom/DocumentFragment.idl - dom/Document.idl - dom/DocumentType.idl dom/DOMCoreException.idl dom/DOMError.idl dom/DOMImplementation.idl dom/DOMStringList.idl dom/DOMStringMap.idl + dom/DocumentFragment.idl + dom/Document.idl + dom/DocumentType.idl dom/Element.idl dom/Entity.idl dom/EntityReference.idl @@ -241,7 +356,9 @@ SET(WebCore_IDL_FILES dom/ProgressEvent.idl dom/RangeException.idl dom/Range.idl + dom/RequestAnimationFrameCallback.idl dom/ShadowRoot.idl + dom/StringCallback.idl dom/TextEvent.idl dom/Text.idl dom/TouchEvent.idl @@ -257,10 +374,12 @@ SET(WebCore_IDL_FILES editing/UndoManager.idl fileapi/Blob.idl - fileapi/FileError.idl fileapi/File.idl + fileapi/FileError.idl + fileapi/FileException.idl fileapi/FileList.idl fileapi/FileReader.idl + fileapi/FileReaderSync.idl fileapi/WebKitBlobBuilder.idl html/DOMFormData.idl @@ -358,15 +477,37 @@ SET(WebCore_IDL_FILES html/canvas/CanvasRenderingContext2D.idl html/canvas/CanvasRenderingContext.idl html/canvas/DataView.idl + html/canvas/EXTTextureFilterAnisotropic.idl html/canvas/Float32Array.idl html/canvas/Float64Array.idl html/canvas/Int16Array.idl html/canvas/Int32Array.idl html/canvas/Int8Array.idl + html/canvas/OESStandardDerivatives.idl + html/canvas/OESTextureFloat.idl + html/canvas/OESVertexArrayObject.idl html/canvas/Uint16Array.idl html/canvas/Uint32Array.idl html/canvas/Uint8Array.idl html/canvas/Uint8ClampedArray.idl + html/canvas/WebGLActiveInfo.idl + html/canvas/WebGLBuffer.idl + html/canvas/WebGLCompressedTextureS3TC.idl + html/canvas/WebGLContextAttributes.idl + html/canvas/WebGLContextEvent.idl + html/canvas/WebGLDebugRendererInfo.idl + html/canvas/WebGLDebugShaders.idl + html/canvas/WebGLDepthTexture.idl + html/canvas/WebGLFramebuffer.idl + html/canvas/WebGLLoseContext.idl + html/canvas/WebGLProgram.idl + html/canvas/WebGLRenderbuffer.idl + html/canvas/WebGLRenderingContext.idl + html/canvas/WebGLShader.idl + html/canvas/WebGLShaderPrecisionFormat.idl + html/canvas/WebGLTexture.idl + html/canvas/WebGLUniformLocation.idl + html/canvas/WebGLVertexArrayObjectOES.idl html/shadow/HTMLContentElement.idl html/shadow/HTMLShadowElement.idl @@ -409,6 +550,7 @@ SET(WebCore_IDL_FILES page/WebKitAnimation.idl page/WebKitAnimationList.idl page/WebKitPoint.idl + page/WorkerNavigator.idl plugins/DOMMimeType.idl plugins/DOMMimeTypeArray.idl @@ -418,6 +560,14 @@ SET(WebCore_IDL_FILES storage/Storage.idl storage/StorageEvent.idl + workers/AbstractWorker.idl + workers/DedicatedWorkerContext.idl + workers/SharedWorker.idl + workers/SharedWorkerContext.idl + workers/Worker.idl + workers/WorkerContext.idl + workers/WorkerLocation.idl + xml/DOMParser.idl xml/XMLHttpRequest.idl xml/XMLHttpRequestException.idl @@ -432,13 +582,346 @@ SET(WebCore_IDL_FILES xml/XSLTProcessor.idl ) +# FIXME: The BlackBerry port doesn't support generating DOM bindings from the SVG IDL files. +# For now, we explicitly demarcate the SVG IDL files so that the BlackBerry port can skip them +# during DOM binding generation. See <https://bugs.webkit.org/show_bug.cgi?id=72773>. +SET(WebCore_SVG_IDL_FILES + svg/SVGAElement.idl + svg/SVGAltGlyphDefElement.idl + svg/SVGAltGlyphElement.idl + svg/SVGAltGlyphItemElement.idl + svg/SVGAngle.idl + svg/SVGAnimateColorElement.idl + svg/SVGAnimateMotionElement.idl + svg/SVGAnimateElement.idl + svg/SVGAnimateTransformElement.idl + svg/SVGAnimatedAngle.idl + svg/SVGAnimatedBoolean.idl + svg/SVGAnimatedEnumeration.idl + svg/SVGAnimatedInteger.idl + svg/SVGAnimatedLength.idl + svg/SVGAnimatedLengthList.idl + svg/SVGAnimatedNumber.idl + svg/SVGAnimatedNumberList.idl + svg/SVGAnimatedPreserveAspectRatio.idl + svg/SVGAnimatedRect.idl + svg/SVGAnimatedString.idl + svg/SVGAnimatedTransformList.idl + svg/SVGAnimationElement.idl + svg/SVGCircleElement.idl + svg/SVGClipPathElement.idl + svg/SVGColor.idl + svg/SVGComponentTransferFunctionElement.idl + svg/SVGCursorElement.idl + svg/SVGDefsElement.idl + svg/SVGDescElement.idl + svg/SVGDocument.idl + svg/SVGElement.idl + svg/SVGElementInstance.idl + svg/SVGElementInstanceList.idl + svg/SVGEllipseElement.idl + svg/SVGException.idl + svg/SVGFEBlendElement.idl + svg/SVGFEColorMatrixElement.idl + svg/SVGFEComponentTransferElement.idl + svg/SVGFECompositeElement.idl + svg/SVGFEConvolveMatrixElement.idl + svg/SVGFEDiffuseLightingElement.idl + svg/SVGFEDisplacementMapElement.idl + svg/SVGFEDistantLightElement.idl + svg/SVGFEDropShadowElement.idl + svg/SVGFEFloodElement.idl + svg/SVGFEFuncAElement.idl + svg/SVGFEFuncBElement.idl + svg/SVGFEFuncGElement.idl + svg/SVGFEFuncRElement.idl + svg/SVGFEGaussianBlurElement.idl + svg/SVGFEImageElement.idl + svg/SVGFEMergeElement.idl + svg/SVGFEMergeNodeElement.idl + svg/SVGFEMorphologyElement.idl + svg/SVGFEOffsetElement.idl + svg/SVGFEPointLightElement.idl + svg/SVGFESpecularLightingElement.idl + svg/SVGFESpotLightElement.idl + svg/SVGFETileElement.idl + svg/SVGFETurbulenceElement.idl + svg/SVGFilterElement.idl + svg/SVGFontElement.idl + svg/SVGFontFaceElement.idl + svg/SVGFontFaceFormatElement.idl + svg/SVGFontFaceNameElement.idl + svg/SVGFontFaceSrcElement.idl + svg/SVGFontFaceUriElement.idl + svg/SVGForeignObjectElement.idl + svg/SVGGElement.idl + svg/SVGGlyphElement.idl + svg/SVGGlyphRefElement.idl + svg/SVGGradientElement.idl + svg/SVGHKernElement.idl + svg/SVGImageElement.idl + svg/SVGLength.idl + svg/SVGLengthList.idl + svg/SVGLineElement.idl + svg/SVGLinearGradientElement.idl + svg/SVGMarkerElement.idl + svg/SVGMaskElement.idl + svg/SVGMatrix.idl + svg/SVGMetadataElement.idl + svg/SVGMissingGlyphElement.idl + svg/SVGMPathElement.idl + svg/SVGNumber.idl + svg/SVGNumberList.idl + svg/SVGPaint.idl + svg/SVGPathElement.idl + svg/SVGPathSeg.idl + svg/SVGPathSegArcAbs.idl + svg/SVGPathSegArcRel.idl + svg/SVGPathSegClosePath.idl + svg/SVGPathSegCurvetoCubicAbs.idl + svg/SVGPathSegCurvetoCubicRel.idl + svg/SVGPathSegCurvetoCubicSmoothAbs.idl + svg/SVGPathSegCurvetoCubicSmoothRel.idl + svg/SVGPathSegCurvetoQuadraticAbs.idl + svg/SVGPathSegCurvetoQuadraticRel.idl + svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl + svg/SVGPathSegCurvetoQuadraticSmoothRel.idl + svg/SVGPathSegLinetoAbs.idl + svg/SVGPathSegLinetoHorizontalAbs.idl + svg/SVGPathSegLinetoHorizontalRel.idl + svg/SVGPathSegLinetoRel.idl + svg/SVGPathSegLinetoVerticalAbs.idl + svg/SVGPathSegLinetoVerticalRel.idl + svg/SVGPathSegList.idl + svg/SVGPathSegMovetoAbs.idl + svg/SVGPathSegMovetoRel.idl + svg/SVGPatternElement.idl + svg/SVGPoint.idl + svg/SVGPointList.idl + svg/SVGPolygonElement.idl + svg/SVGPolylineElement.idl + svg/SVGPreserveAspectRatio.idl + svg/SVGRadialGradientElement.idl + svg/SVGRect.idl + svg/SVGRectElement.idl + svg/SVGRenderingIntent.idl + svg/SVGSVGElement.idl + svg/SVGScriptElement.idl + svg/SVGSetElement.idl + svg/SVGStopElement.idl + svg/SVGStringList.idl + svg/SVGStyleElement.idl + svg/SVGSwitchElement.idl + svg/SVGSymbolElement.idl + svg/SVGTRefElement.idl + svg/SVGTSpanElement.idl + svg/SVGTextContentElement.idl + svg/SVGTextElement.idl + svg/SVGTextPathElement.idl + svg/SVGTextPositioningElement.idl + svg/SVGTitleElement.idl + svg/SVGTransform.idl + svg/SVGTransformList.idl + svg/SVGUnitTypes.idl + svg/SVGUseElement.idl + svg/SVGViewElement.idl + svg/SVGViewSpec.idl + svg/SVGVKernElement.idl + svg/SVGZoomAndPan.idl + svg/SVGZoomEvent.idl +) + +LIST(APPEND WebCore_IDL_FILES + ${WebCore_SVG_IDL_FILES} +) + SET(WebCore_SOURCES + Modules/battery/BatteryController.cpp + Modules/battery/BatteryManager.cpp + Modules/battery/BatteryStatus.cpp + Modules/battery/NavigatorBattery.cpp + + Modules/filesystem/DOMFilePath.cpp + Modules/filesystem/DOMFileSystem.cpp + Modules/filesystem/DOMFileSystemBase.cpp + Modules/filesystem/DOMFileSystemSync.cpp + Modules/filesystem/DOMWindowFileSystem.cpp + Modules/filesystem/DirectoryEntry.cpp + Modules/filesystem/DirectoryEntrySync.cpp + Modules/filesystem/DirectoryReader.cpp + Modules/filesystem/DirectoryReaderSync.cpp + Modules/filesystem/Entry.cpp + Modules/filesystem/EntryArray.cpp + Modules/filesystem/EntryArraySync.cpp + Modules/filesystem/EntryBase.cpp + Modules/filesystem/EntrySync.cpp + Modules/filesystem/FileEntry.cpp + Modules/filesystem/FileEntrySync.cpp + Modules/filesystem/FileSystemCallbacks.cpp + Modules/filesystem/FileWriter.cpp + Modules/filesystem/FileWriterBase.cpp + Modules/filesystem/FileWriterSync.cpp + Modules/filesystem/LocalFileSystem.cpp + Modules/filesystem/WorkerContextFileSystem.cpp + + Modules/gamepad/Gamepad.cpp + Modules/gamepad/GamepadList.cpp + Modules/gamepad/NavigatorGamepad.cpp + Modules/geolocation/Geolocation.cpp Modules/geolocation/GeolocationController.cpp Modules/geolocation/NavigatorGeolocation.cpp + + Modules/indexeddb/DOMWindowIndexedDatabase.cpp + Modules/indexeddb/IDBAny.cpp + Modules/indexeddb/IDBCursor.cpp + Modules/indexeddb/IDBCursorBackendImpl.cpp + Modules/indexeddb/IDBCursorWithValue.cpp + Modules/indexeddb/IDBDatabase.cpp + Modules/indexeddb/IDBDatabaseBackendImpl.cpp + Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp + Modules/indexeddb/IDBDatabaseException.cpp + Modules/indexeddb/IDBEventDispatcher.cpp + Modules/indexeddb/IDBFactory.cpp + Modules/indexeddb/IDBFactoryBackendImpl.cpp + Modules/indexeddb/IDBFactoryBackendInterface.cpp + Modules/indexeddb/IDBIndex.cpp + Modules/indexeddb/IDBIndexBackendImpl.cpp + Modules/indexeddb/IDBKey.cpp + Modules/indexeddb/IDBKeyRange.cpp + Modules/indexeddb/IDBKeyPath.cpp + Modules/indexeddb/IDBKeyPathBackendImpl.cpp + Modules/indexeddb/IDBLevelDBBackingStore.cpp + Modules/indexeddb/IDBLevelDBCoding.cpp + Modules/indexeddb/IDBObjectStore.cpp + Modules/indexeddb/IDBObjectStoreBackendImpl.cpp + Modules/indexeddb/IDBPendingTransactionMonitor.cpp + Modules/indexeddb/IDBRequest.cpp + Modules/indexeddb/IDBTransaction.cpp + Modules/indexeddb/IDBTransactionBackendImpl.cpp + Modules/indexeddb/IDBTransactionCoordinator.cpp + Modules/indexeddb/IDBVersionChangeEvent.cpp + Modules/indexeddb/IDBVersionChangeRequest.cpp + Modules/indexeddb/PageGroupIndexedDatabase.cpp + Modules/indexeddb/WorkerContextIndexedDatabase.cpp + + Modules/intents/DOMWindowIntents.cpp + Modules/intents/DeliveredIntent.cpp + Modules/intents/Intent.cpp + Modules/intents/IntentRequest.cpp + Modules/intents/NavigatorIntents.cpp + + Modules/mediastream/DeprecatedPeerConnection.cpp + Modules/mediastream/IceCandidate.cpp + Modules/mediastream/LocalMediaStream.cpp + Modules/mediastream/MediaStream.cpp + Modules/mediastream/MediaStreamEvent.cpp + Modules/mediastream/MediaStreamList.cpp + Modules/mediastream/MediaStreamRegistry.cpp + Modules/mediastream/MediaStreamTrack.cpp + Modules/mediastream/MediaStreamTrackEvent.cpp + Modules/mediastream/MediaStreamTrackList.cpp + Modules/mediastream/NavigatorMediaStream.cpp + Modules/mediastream/PeerConnection00.cpp + Modules/mediastream/SessionDescription.cpp + Modules/mediastream/UserMediaController.cpp + Modules/mediastream/UserMediaRequest.cpp + + Modules/networkinfo/NavigatorNetworkInfoConnection.cpp + Modules/networkinfo/NetworkInfo.cpp + Modules/networkinfo/NetworkInfoConnection.cpp + Modules/networkinfo/NetworkInfoController.cpp + + Modules/notifications/DOMWindowNotifications.cpp + Modules/notifications/NotificationCenter.cpp + Modules/notifications/NotificationController.cpp + Modules/notifications/Notification.cpp + Modules/notifications/WorkerContextNotifications.cpp Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp + Modules/quota/DOMWindowQuota.cpp + Modules/quota/StorageInfo.cpp + + Modules/vibration/NavigatorVibration.cpp + Modules/vibration/Vibration.cpp + + Modules/webaudio/AsyncAudioDecoder.cpp + Modules/webaudio/AudioBasicInspectorNode.cpp + Modules/webaudio/AudioBasicProcessorNode.cpp + Modules/webaudio/AudioBuffer.cpp + Modules/webaudio/AudioBufferSourceNode.cpp + Modules/webaudio/AudioChannelMerger.cpp + Modules/webaudio/AudioChannelSplitter.cpp + Modules/webaudio/AudioContext.cpp + Modules/webaudio/AudioDestinationNode.cpp + Modules/webaudio/AudioGainNode.cpp + Modules/webaudio/AudioListener.cpp + Modules/webaudio/AudioNode.cpp + Modules/webaudio/AudioNodeInput.cpp + Modules/webaudio/AudioNodeOutput.cpp + Modules/webaudio/AudioPannerNode.cpp + Modules/webaudio/AudioParam.cpp + Modules/webaudio/AudioParamTimeline.cpp + Modules/webaudio/AudioProcessingEvent.cpp + Modules/webaudio/AudioScheduledSourceNode.cpp + Modules/webaudio/AudioSummingJunction.cpp + Modules/webaudio/BiquadDSPKernel.cpp + Modules/webaudio/BiquadFilterNode.cpp + Modules/webaudio/BiquadProcessor.cpp + Modules/webaudio/ConvolverNode.cpp + Modules/webaudio/DefaultAudioDestinationNode.cpp + Modules/webaudio/DelayDSPKernel.cpp + Modules/webaudio/DelayNode.cpp + Modules/webaudio/DelayProcessor.cpp + Modules/webaudio/DynamicsCompressorNode.cpp + Modules/webaudio/JavaScriptAudioNode.cpp + Modules/webaudio/MediaElementAudioSourceNode.cpp + Modules/webaudio/OfflineAudioCompletionEvent.cpp + Modules/webaudio/OfflineAudioDestinationNode.cpp + Modules/webaudio/Oscillator.cpp + Modules/webaudio/RealtimeAnalyser.cpp + Modules/webaudio/RealtimeAnalyserNode.cpp + Modules/webaudio/WaveShaperDSPKernel.cpp + Modules/webaudio/WaveShaperNode.cpp + Modules/webaudio/WaveShaperProcessor.cpp + Modules/webaudio/WaveTable.cpp + + Modules/webdatabase/AbstractDatabase.cpp + Modules/webdatabase/ChangeVersionWrapper.cpp + Modules/webdatabase/DOMWindowWebDatabase.cpp + Modules/webdatabase/Database.cpp + Modules/webdatabase/DatabaseAuthorizer.cpp + Modules/webdatabase/DatabaseContext.cpp + Modules/webdatabase/DatabaseSync.cpp + Modules/webdatabase/DatabaseTask.cpp + Modules/webdatabase/DatabaseThread.cpp + Modules/webdatabase/DatabaseTracker.cpp + Modules/webdatabase/OriginQuotaManager.cpp + Modules/webdatabase/OriginUsageRecord.cpp + Modules/webdatabase/SQLException.cpp + Modules/webdatabase/SQLResultSet.cpp + Modules/webdatabase/SQLResultSetRowList.cpp + Modules/webdatabase/SQLStatement.cpp + Modules/webdatabase/SQLStatementSync.cpp + Modules/webdatabase/SQLTransaction.cpp + Modules/webdatabase/SQLTransactionClient.cpp + Modules/webdatabase/SQLTransactionCoordinator.cpp + Modules/webdatabase/SQLTransactionSync.cpp + + Modules/websockets/ThreadableWebSocketChannel.cpp + Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp + Modules/websockets/WebSocket.cpp + Modules/websockets/WebSocketChannel.cpp + Modules/websockets/WebSocketDeflater.cpp + Modules/websockets/WebSocketDeflateFramer.cpp + Modules/websockets/WebSocketExtensionDispatcher.cpp + Modules/websockets/WebSocketFrame.cpp + Modules/websockets/WebSocketHandshake.cpp + Modules/websockets/WebSocketHandshakeRequest.cpp + Modules/websockets/WebSocketHandshakeResponse.cpp + Modules/websockets/WorkerThreadableWebSocketChannel.cpp + accessibility/AXObjectCache.cpp accessibility/AccessibilityARIAGrid.cpp accessibility/AccessibilityARIAGridCell.cpp @@ -453,6 +936,7 @@ SET(WebCore_SOURCES accessibility/AccessibilityMenuListPopup.cpp accessibility/AccessibilityMockObject.cpp accessibility/AccessibilityObject.cpp + accessibility/AccessibilityProgressIndicator.cpp accessibility/AccessibilityRenderObject.cpp accessibility/AccessibilityScrollbar.cpp accessibility/AccessibilityScrollView.cpp @@ -540,6 +1024,9 @@ SET(WebCore_SOURCES css/StyleSheet.cpp css/StyleSheetContents.cpp css/StyleSheetList.cpp + css/SVGCSSComputedStyleDeclaration.cpp + css/SVGCSSParser.cpp + css/SVGCSSStyleSelector.cpp css/WebKitCSSFilterValue.cpp css/WebKitCSSKeyframeRule.cpp css/WebKitCSSKeyframesRule.cpp @@ -572,6 +1059,7 @@ SET(WebCore_SOURCES dom/ContextFeatures.cpp dom/CustomEvent.cpp dom/DatasetDOMStringMap.cpp + dom/DataTransferItem.cpp dom/DecodedDataDocumentParser.cpp dom/DeviceMotionController.cpp dom/DeviceMotionData.cpp @@ -579,6 +1067,11 @@ SET(WebCore_SOURCES dom/DeviceOrientationController.cpp dom/DeviceOrientationData.cpp dom/DeviceOrientationEvent.cpp + dom/DOMCoreException.cpp + dom/DOMError.cpp + dom/DOMImplementation.cpp + dom/DOMStringList.cpp + dom/DOMStringMap.cpp dom/Document.cpp dom/DocumentMarkerController.cpp dom/DocumentMarker.cpp @@ -587,11 +1080,6 @@ SET(WebCore_SOURCES dom/DocumentParser.cpp dom/DocumentOrderedMap.cpp dom/DocumentType.cpp - dom/DOMCoreException.cpp - dom/DOMError.cpp - dom/DOMImplementation.cpp - dom/DOMStringList.cpp - dom/DOMStringMap.cpp dom/DynamicNodeList.cpp dom/EditingText.cpp dom/Element.cpp @@ -647,6 +1135,7 @@ SET(WebCore_SOURCES dom/RangeException.cpp dom/RegisteredEventListener.cpp dom/ScopedEventQueue.cpp + dom/ScriptedAnimationController.cpp dom/ScriptableDocumentParser.cpp dom/ScriptElement.cpp dom/ScriptExecutionContext.cpp @@ -657,6 +1146,7 @@ SET(WebCore_SOURCES dom/SpaceSplitString.cpp dom/StaticHashSetNodeList.cpp dom/StaticNodeList.cpp + dom/StringCallback.cpp dom/StyledElement.cpp dom/StyleElement.cpp dom/TagNodeList.cpp @@ -744,11 +1234,16 @@ SET(WebCore_SOURCES editing/markup.cpp editing/visible_units.cpp + fileapi/AsyncFileStream.cpp fileapi/Blob.cpp fileapi/BlobURL.cpp fileapi/File.cpp fileapi/FileException.cpp fileapi/FileList.cpp + fileapi/FileReader.cpp + fileapi/FileReaderLoader.cpp + fileapi/FileReaderSync.cpp + fileapi/FileThread.cpp fileapi/ThreadableBlobRegistry.cpp fileapi/WebKitBlobBuilder.cpp @@ -785,6 +1280,7 @@ SET(WebCore_SOURCES html/HTMLAnchorElement.cpp html/HTMLAppletElement.cpp html/HTMLAreaElement.cpp + html/HTMLAudioElement.cpp html/HTMLBRElement.cpp html/HTMLBaseElement.cpp html/HTMLBaseFontElement.cpp @@ -827,6 +1323,7 @@ SET(WebCore_SOURCES html/HTMLLinkElement.cpp html/HTMLMapElement.cpp html/HTMLMarqueeElement.cpp + html/HTMLMediaElement.cpp html/HTMLMenuElement.cpp html/HTMLMetaElement.cpp html/HTMLMeterElement.cpp @@ -849,6 +1346,7 @@ SET(WebCore_SOURCES html/HTMLQuoteElement.cpp html/HTMLScriptElement.cpp html/HTMLSelectElement.cpp + html/HTMLSourceElement.cpp html/HTMLSpanElement.cpp html/HTMLStyleElement.cpp html/HTMLSummaryElement.cpp @@ -863,7 +1361,9 @@ SET(WebCore_SOURCES html/HTMLTextAreaElement.cpp html/HTMLTextFormControlElement.cpp html/HTMLTitleElement.cpp + html/HTMLTrackElement.cpp html/HTMLUListElement.cpp + html/HTMLVideoElement.cpp html/HTMLViewSourceDocument.cpp html/HiddenInputType.cpp html/ImageData.cpp @@ -875,6 +1375,7 @@ SET(WebCore_SOURCES html/LinkRelAttribute.cpp html/MediaController.cpp html/MediaDocument.cpp + html/MediaFragmentURIParser.cpp html/MicroDataItemValue.cpp html/MonthInputType.cpp html/NumberInputType.cpp @@ -892,6 +1393,7 @@ SET(WebCore_SOURCES html/TextFieldInputType.cpp html/TextInputType.cpp html/TimeInputType.cpp + html/TimeRanges.cpp html/URLInputType.cpp html/ValidationMessage.cpp html/ValidityState.cpp @@ -904,6 +1406,33 @@ SET(WebCore_SOURCES html/canvas/CanvasRenderingContext2D.cpp html/canvas/CanvasStyle.cpp html/canvas/DataView.cpp + html/canvas/EXTTextureFilterAnisotropic.cpp + html/canvas/OESStandardDerivatives.cpp + html/canvas/OESTextureFloat.cpp + html/canvas/OESVertexArrayObject.cpp + html/canvas/WebGLBuffer.cpp + html/canvas/WebGLCompressedTextureS3TC.cpp + html/canvas/WebGLContextAttributes.cpp + html/canvas/WebGLContextEvent.cpp + html/canvas/WebGLContextGroup.cpp + html/canvas/WebGLContextObject.cpp + html/canvas/WebGLDebugRendererInfo.cpp + html/canvas/WebGLDebugShaders.cpp + html/canvas/WebGLDepthTexture.cpp + html/canvas/WebGLExtension.cpp + html/canvas/WebGLFramebuffer.cpp + html/canvas/WebGLGetInfo.cpp + html/canvas/WebGLLoseContext.cpp + html/canvas/WebGLObject.cpp + html/canvas/WebGLProgram.cpp + html/canvas/WebGLRenderbuffer.cpp + html/canvas/WebGLRenderingContext.cpp + html/canvas/WebGLShader.cpp + html/canvas/WebGLShaderPrecisionFormat.cpp + html/canvas/WebGLSharedObject.cpp + html/canvas/WebGLTexture.cpp + html/canvas/WebGLUniformLocation.cpp + html/canvas/WebGLVertexArrayObjectOES.cpp html/parser/CSSPreloadScanner.cpp html/parser/HTMLConstructionSite.cpp @@ -933,12 +1462,23 @@ SET(WebCore_SOURCES html/shadow/ImageInnerElement.cpp html/shadow/InsertionPoint.cpp html/shadow/MediaControls.cpp + html/shadow/MediaControlElements.cpp html/shadow/MediaControlRootElement.cpp html/shadow/MeterShadowElement.cpp html/shadow/ProgressShadowElement.cpp html/shadow/SliderThumbElement.cpp html/shadow/TextControlInnerElements.cpp + html/track/LoadableTextTrack.cpp + html/track/TextTrack.cpp + html/track/TextTrackCue.cpp + html/track/TextTrackCueList.cpp + html/track/TextTrackList.cpp + html/track/TrackBase.cpp + html/track/TrackEvent.cpp + html/track/WebVTTParser.cpp + html/track/WebVTTTokenizer.cpp + inspector/ConsoleMessage.cpp inspector/ContentSearchUtils.cpp inspector/DOMEditor.cpp @@ -1029,7 +1569,9 @@ SET(WebCore_SOURCES loader/SubframeLoader.cpp loader/SubresourceLoader.cpp loader/TextResourceDecoder.cpp + loader/TextTrackLoader.cpp loader/ThreadableLoader.cpp + loader/WorkerThreadableLoader.cpp loader/appcache/ApplicationCache.cpp loader/appcache/ApplicationCacheGroup.cpp @@ -1044,6 +1586,9 @@ SET(WebCore_SOURCES loader/archive/ArchiveResource.cpp loader/archive/ArchiveResourceCollection.cpp + loader/archive/mhtml/MHTMLArchive.cpp + loader/archive/mhtml/MHTMLParser.cpp + loader/cache/CachedCSSStyleSheet.cpp loader/cache/CachedFont.cpp loader/cache/CachedImage.cpp @@ -1053,6 +1598,7 @@ SET(WebCore_SOURCES loader/cache/CachedResourceLoader.cpp loader/cache/CachedScript.cpp loader/cache/CachedSVGDocument.cpp + loader/cache/CachedTextTrack.cpp loader/cache/CachedXSLStyleSheet.cpp loader/cache/MemoryCache.cpp @@ -1063,6 +1609,11 @@ SET(WebCore_SOURCES loader/icon/IconRecord.cpp loader/icon/PageURLRecord.cpp + mathml/MathMLElement.cpp + mathml/MathMLInlineContainerElement.cpp + mathml/MathMLMathElement.cpp + mathml/MathMLTextElement.cpp + page/BarInfo.cpp page/Chrome.cpp page/Console.cpp @@ -1115,6 +1666,7 @@ SET(WebCore_SOURCES page/WebKitAnimationList.cpp page/WindowFeatures.cpp page/WindowFocusAllowedIndicator.cpp + page/WorkerNavigator.cpp page/animation/AnimationBase.cpp page/animation/AnimationController.cpp @@ -1127,6 +1679,7 @@ SET(WebCore_SOURCES page/scrolling/ScrollingCoordinatorNone.cpp platform/Arena.cpp + platform/AsyncFileSystem.cpp platform/CalculationValue.cpp platform/Clock.cpp platform/ContextMenu.cpp @@ -1140,6 +1693,7 @@ SET(WebCore_SOURCES platform/EventTracer.cpp platform/FileChooser.cpp platform/FileIconLoader.cpp + platform/FileStream.cpp platform/FileSystem.cpp platform/ClockGeneric.cpp platform/HistogramSupport.cpp @@ -1176,6 +1730,40 @@ SET(WebCore_SOURCES platform/animation/Animation.cpp platform/animation/AnimationList.cpp + platform/audio/AudioBus.cpp + platform/audio/AudioChannel.cpp + platform/audio/AudioDSPKernelProcessor.cpp + platform/audio/AudioFIFO.cpp + platform/audio/AudioPullFIFO.cpp + platform/audio/AudioResampler.cpp + platform/audio/AudioResamplerKernel.cpp + platform/audio/AudioUtilities.cpp + platform/audio/Biquad.cpp + platform/audio/Cone.cpp + platform/audio/DirectConvolver.cpp + platform/audio/Distance.cpp + platform/audio/DynamicsCompressor.cpp + platform/audio/DynamicsCompressorKernel.cpp + platform/audio/EqualPowerPanner.cpp + platform/audio/FFTConvolver.cpp + platform/audio/FFTFrame.cpp + platform/audio/FFTFrameStub.cpp + platform/audio/HRTFDatabase.cpp + platform/audio/HRTFDatabaseLoader.cpp + platform/audio/HRTFElevation.cpp + platform/audio/HRTFKernel.cpp + platform/audio/HRTFPanner.cpp + platform/audio/MultiChannelResampler.cpp + platform/audio/Panner.cpp + platform/audio/Reverb.cpp + platform/audio/ReverbAccumulationBuffer.cpp + platform/audio/ReverbConvolver.cpp + platform/audio/ReverbConvolverStage.cpp + platform/audio/ReverbInputBuffer.cpp + platform/audio/SincResampler.cpp + platform/audio/VectorMath.cpp + platform/audio/ZeroPole.cpp + platform/graphics/BitmapImage.cpp platform/graphics/Color.cpp platform/graphics/CrossfadeGeneratedImage.cpp @@ -1204,6 +1792,7 @@ SET(WebCore_SOURCES platform/graphics/ImageBuffer.cpp platform/graphics/ImageOrientation.cpp platform/graphics/IntRect.cpp + platform/graphics/MediaPlayer.cpp platform/graphics/Path.cpp platform/graphics/PathTraversalState.cpp platform/graphics/Pattern.cpp @@ -1214,6 +1803,7 @@ SET(WebCore_SOURCES platform/graphics/SimpleFontData.cpp platform/graphics/StringTruncator.cpp platform/graphics/SurrogatePairAwareTextIterator.cpp + platform/graphics/SVGGlyph.cpp platform/graphics/TextRun.cpp platform/graphics/WidthIterator.cpp @@ -1268,6 +1858,17 @@ SET(WebCore_SOURCES platform/graphics/transforms/TransformState.cpp platform/graphics/transforms/TranslateTransformOperation.cpp + platform/leveldb/LevelDBDatabase.cpp + platform/leveldb/LevelDBTransaction.cpp + platform/leveldb/LevelDBWriteBatch.cpp + + platform/mediastream/IceCandidateDescriptor.cpp + platform/mediastream/IceOptions.cpp + platform/mediastream/MediaHints.cpp + platform/mediastream/MediaStreamCenter.cpp + platform/mediastream/PeerConnection00Handler.cpp + platform/mediastream/SessionDescriptionDescriptor.cpp + platform/mock/DeviceMotionClientMock.cpp platform/mock/DeviceOrientationClientMock.cpp platform/mock/GeolocationClientMock.cpp @@ -1351,6 +1952,7 @@ SET(WebCore_SOURCES rendering/InlineTextBox.cpp rendering/LayoutState.cpp rendering/LayoutRepainter.cpp + rendering/PointerEventsHitRules.cpp rendering/RenderApplet.cpp rendering/RenderArena.cpp rendering/RenderBR.cpp @@ -1388,6 +1990,7 @@ SET(WebCore_SOURCES rendering/RenderListItem.cpp rendering/RenderListMarker.cpp rendering/RenderMarquee.cpp + rendering/RenderMedia.cpp rendering/RenderMenuList.cpp rendering/RenderMeter.cpp rendering/RenderMultiColumnBlock.cpp @@ -1425,6 +2028,7 @@ SET(WebCore_SOURCES rendering/RenderTextFragment.cpp rendering/RenderTheme.cpp rendering/RenderTreeAsText.cpp + rendering/RenderVideo.cpp rendering/RenderView.cpp rendering/RenderWidget.cpp rendering/RenderWordBreak.cpp @@ -1432,6 +2036,17 @@ SET(WebCore_SOURCES rendering/ScrollBehavior.cpp rendering/break_lines.cpp + rendering/mathml/RenderMathMLBlock.cpp + rendering/mathml/RenderMathMLFenced.cpp + rendering/mathml/RenderMathMLFraction.cpp + rendering/mathml/RenderMathMLMath.cpp + rendering/mathml/RenderMathMLOperator.cpp + rendering/mathml/RenderMathMLRoot.cpp + rendering/mathml/RenderMathMLRow.cpp + rendering/mathml/RenderMathMLSquareRoot.cpp + rendering/mathml/RenderMathMLSubSup.cpp + rendering/mathml/RenderMathMLUnderOver.cpp + rendering/style/ContentData.cpp rendering/style/CounterDirectives.cpp rendering/style/FillLayer.cpp @@ -1458,6 +2073,61 @@ SET(WebCore_SOURCES rendering/style/StyleSurroundData.cpp rendering/style/StyleTransformData.cpp rendering/style/StyleVisualData.cpp + rendering/style/SVGRenderStyle.cpp + rendering/style/SVGRenderStyleDefs.cpp + + rendering/svg/RenderSVGBlock.cpp + rendering/svg/RenderSVGContainer.cpp + rendering/svg/RenderSVGEllipse.cpp + rendering/svg/RenderSVGGradientStop.cpp + rendering/svg/RenderSVGForeignObject.cpp + rendering/svg/RenderSVGHiddenContainer.cpp + rendering/svg/RenderSVGImage.cpp + rendering/svg/RenderSVGInline.cpp + rendering/svg/RenderSVGInlineText.cpp + rendering/svg/RenderSVGModelObject.cpp + rendering/svg/RenderSVGPath.cpp + rendering/svg/RenderSVGRect.cpp + rendering/svg/RenderSVGResource.cpp + rendering/svg/RenderSVGResourceClipper.cpp + rendering/svg/RenderSVGResourceContainer.cpp + rendering/svg/RenderSVGResourceFilter.cpp + rendering/svg/RenderSVGResourceFilterPrimitive.cpp + rendering/svg/RenderSVGResourceGradient.cpp + rendering/svg/RenderSVGResourceLinearGradient.cpp + rendering/svg/RenderSVGResourceMarker.cpp + rendering/svg/RenderSVGResourceMasker.cpp + rendering/svg/RenderSVGResourcePattern.cpp + rendering/svg/RenderSVGResourceRadialGradient.cpp + rendering/svg/RenderSVGResourceSolidColor.cpp + rendering/svg/RenderSVGRoot.cpp + rendering/svg/RenderSVGShape.cpp + rendering/svg/RenderSVGTSpan.cpp + rendering/svg/RenderSVGText.cpp + rendering/svg/RenderSVGTextPath.cpp + rendering/svg/RenderSVGTransformableContainer.cpp + rendering/svg/RenderSVGViewportContainer.cpp + rendering/svg/SVGInlineFlowBox.cpp + rendering/svg/SVGInlineTextBox.cpp + rendering/svg/SVGPathData.cpp + rendering/svg/SVGRenderSupport.cpp + rendering/svg/SVGRenderTreeAsText.cpp + rendering/svg/SVGRenderingContext.cpp + rendering/svg/SVGResources.cpp + rendering/svg/SVGResourcesCache.cpp + rendering/svg/SVGResourcesCycleSolver.cpp + rendering/svg/SVGRootInlineBox.cpp + rendering/svg/SVGTextChunk.cpp + rendering/svg/SVGTextChunkBuilder.cpp + rendering/svg/SVGTextLayoutAttributes.cpp + rendering/svg/SVGTextLayoutAttributesBuilder.cpp + rendering/svg/SVGTextLayoutEngine.cpp + rendering/svg/SVGTextLayoutEngineBaseline.cpp + rendering/svg/SVGTextLayoutEngineSpacing.cpp + rendering/svg/SVGTextRunRenderingContext.cpp + rendering/svg/SVGTextMetrics.cpp + rendering/svg/SVGTextMetricsBuilder.cpp + rendering/svg/SVGTextQuery.cpp storage/StorageTask.cpp storage/StorageThread.cpp @@ -1472,6 +2142,192 @@ SET(WebCore_SOURCES storage/StorageSyncManager.cpp storage/StorageTracker.cpp + svg/ColorDistance.cpp + svg/SVGAElement.cpp + svg/SVGAltGlyphDefElement.cpp + svg/SVGAltGlyphElement.cpp + svg/SVGAltGlyphItemElement.cpp + svg/SVGAngle.cpp + svg/SVGAnimateColorElement.cpp + svg/SVGAnimatedAngle.cpp + svg/SVGAnimatedBoolean.cpp + svg/SVGAnimatedColor.cpp + svg/SVGAnimatedEnumeration.cpp + svg/SVGAnimatedInteger.cpp + svg/SVGAnimatedIntegerOptionalInteger.cpp + svg/SVGAnimatedLength.cpp + svg/SVGAnimatedLengthList.cpp + svg/SVGAnimatedNumber.cpp + svg/SVGAnimatedNumberList.cpp + svg/SVGAnimatedNumberOptionalNumber.cpp + svg/SVGAnimatedPath.cpp + svg/SVGAnimatedPointList.cpp + svg/SVGAnimatedPreserveAspectRatio.cpp + svg/SVGAnimatedRect.cpp + svg/SVGAnimatedString.cpp + svg/SVGAnimatedTransformList.cpp + svg/SVGAnimatedType.cpp + svg/SVGAnimateElement.cpp + svg/SVGAnimateMotionElement.cpp + svg/SVGAnimateTransformElement.cpp + svg/SVGAnimationElement.cpp + svg/SVGCircleElement.cpp + svg/SVGClipPathElement.cpp + svg/SVGColor.cpp + svg/SVGComponentTransferFunctionElement.cpp + svg/SVGCursorElement.cpp + svg/SVGDefsElement.cpp + svg/SVGDescElement.cpp + svg/SVGDocument.cpp + svg/SVGDocumentExtensions.cpp + svg/SVGElement.cpp + svg/SVGElementInstance.cpp + svg/SVGElementInstanceList.cpp + svg/SVGEllipseElement.cpp + svg/SVGException.cpp + svg/SVGExternalResourcesRequired.cpp + svg/SVGFEBlendElement.cpp + svg/SVGFEColorMatrixElement.cpp + svg/SVGFEComponentTransferElement.cpp + svg/SVGFECompositeElement.cpp + svg/SVGFEConvolveMatrixElement.cpp + svg/SVGFEDiffuseLightingElement.cpp + svg/SVGFEDisplacementMapElement.cpp + svg/SVGFEDistantLightElement.cpp + svg/SVGFEDropShadowElement.cpp + svg/SVGFEFloodElement.cpp + svg/SVGFEFuncAElement.cpp + svg/SVGFEFuncBElement.cpp + svg/SVGFEFuncGElement.cpp + svg/SVGFEFuncRElement.cpp + svg/SVGFEGaussianBlurElement.cpp + svg/SVGFEImageElement.cpp + svg/SVGFELightElement.cpp + svg/SVGFEMergeElement.cpp + svg/SVGFEMergeNodeElement.cpp + svg/SVGFEMorphologyElement.cpp + svg/SVGFEOffsetElement.cpp + svg/SVGFEPointLightElement.cpp + svg/SVGFESpecularLightingElement.cpp + svg/SVGFESpotLightElement.cpp + svg/SVGFETileElement.cpp + svg/SVGFETurbulenceElement.cpp + svg/SVGFilterElement.cpp + svg/SVGFilterPrimitiveStandardAttributes.cpp + svg/SVGFitToViewBox.cpp + svg/SVGFontData.cpp + svg/SVGFontElement.cpp + svg/SVGFontFaceElement.cpp + svg/SVGFontFaceFormatElement.cpp + svg/SVGFontFaceNameElement.cpp + svg/SVGFontFaceSrcElement.cpp + svg/SVGFontFaceUriElement.cpp + svg/SVGForeignObjectElement.cpp + svg/SVGGElement.cpp + svg/SVGGlyphElement.cpp + svg/SVGGlyphRefElement.cpp + svg/SVGGradientElement.cpp + svg/SVGHKernElement.cpp + svg/SVGImageElement.cpp + svg/SVGImageLoader.cpp + svg/SVGLangSpace.cpp + svg/SVGLength.cpp + svg/SVGLengthContext.cpp + svg/SVGLengthList.cpp + svg/SVGLineElement.cpp + svg/SVGLinearGradientElement.cpp + svg/SVGLocatable.cpp + svg/SVGMPathElement.cpp + svg/SVGMarkerElement.cpp + svg/SVGMaskElement.cpp + svg/SVGMetadataElement.cpp + svg/SVGMissingGlyphElement.cpp + svg/SVGNumberList.cpp + svg/SVGPaint.cpp + svg/SVGParserUtilities.cpp + svg/SVGPathBlender.cpp + svg/SVGPathBuilder.cpp + svg/SVGPathByteStreamBuilder.cpp + svg/SVGPathByteStreamSource.cpp + svg/SVGPathElement.cpp + svg/SVGPathParser.cpp + svg/SVGPathSegList.cpp + svg/SVGPathSegListBuilder.cpp + svg/SVGPathSegListSource.cpp + svg/SVGPathStringBuilder.cpp + svg/SVGPathStringSource.cpp + svg/SVGPathTraversalStateBuilder.cpp + svg/SVGPathUtilities.cpp + svg/SVGPatternElement.cpp + svg/SVGPointList.cpp + svg/SVGPolyElement.cpp + svg/SVGPolygonElement.cpp + svg/SVGPolylineElement.cpp + svg/SVGPreserveAspectRatio.cpp + svg/SVGRadialGradientElement.cpp + svg/SVGRectElement.cpp + svg/SVGSVGElement.cpp + svg/SVGScriptElement.cpp + svg/SVGSetElement.cpp + svg/SVGStopElement.cpp + svg/SVGStringList.cpp + svg/SVGStylable.cpp + svg/SVGStyleElement.cpp + svg/SVGStyledElement.cpp + svg/SVGStyledLocatableElement.cpp + svg/SVGStyledTransformableElement.cpp + svg/SVGSwitchElement.cpp + svg/SVGSymbolElement.cpp + svg/SVGTRefElement.cpp + svg/SVGTSpanElement.cpp + svg/SVGTests.cpp + svg/SVGTextContentElement.cpp + svg/SVGTextElement.cpp + svg/SVGTextPathElement.cpp + svg/SVGTextPositioningElement.cpp + svg/SVGTitleElement.cpp + svg/SVGTransform.cpp + svg/SVGTransformDistance.cpp + svg/SVGTransformList.cpp + svg/SVGTransformable.cpp + svg/SVGURIReference.cpp + svg/SVGUseElement.cpp + svg/SVGViewElement.cpp + svg/SVGViewSpec.cpp + svg/SVGVKernElement.cpp + svg/SVGZoomAndPan.cpp + svg/SVGZoomEvent.cpp + + svg/animation/SMILTime.cpp + svg/animation/SMILTimeContainer.cpp + svg/animation/SVGSMILElement.cpp + + svg/graphics/SVGImage.cpp + svg/graphics/SVGImageCache.cpp + + svg/graphics/filters/SVGFEImage.cpp + svg/graphics/filters/SVGFilter.cpp + svg/graphics/filters/SVGFilterBuilder.cpp + + svg/properties/SVGAttributeToPropertyMap.cpp + svg/properties/SVGPathSegListPropertyTearOff.cpp + + workers/AbstractWorker.cpp + workers/DedicatedWorkerContext.cpp + workers/DedicatedWorkerThread.cpp + workers/DefaultSharedWorkerRepository.cpp + workers/SharedWorker.cpp + workers/SharedWorkerContext.cpp + workers/SharedWorkerThread.cpp + workers/Worker.cpp + workers/WorkerContext.cpp + workers/WorkerEventQueue.cpp + workers/WorkerLocation.cpp + workers/WorkerMessagingProxy.cpp + workers/WorkerRunLoop.cpp + workers/WorkerScriptLoader.cpp + workers/WorkerThread.cpp + xml/DOMParser.cpp xml/NativeXPathNSResolver.cpp xml/XMLErrors.cpp @@ -1526,66 +2382,6 @@ SET(WebCore_USER_AGENT_STYLE_SHEETS ${WEBCORE_DIR}/css/view-source.css ) -IF (ENABLE_BLOB) - LIST(APPEND WebCore_SOURCES - fileapi/AsyncFileStream.cpp - fileapi/FileReader.cpp - fileapi/FileReaderLoader.cpp - fileapi/FileReaderSync.cpp - fileapi/FileThread.cpp - platform/FileStream.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - fileapi/FileException.idl - fileapi/FileReaderSync.idl - ) -ENDIF () - -IF (ENABLE_SQL_DATABASE) - LIST(APPEND WebCore_SOURCES - Modules/webdatabase/AbstractDatabase.cpp - Modules/webdatabase/ChangeVersionWrapper.cpp - Modules/webdatabase/DOMWindowWebDatabase.cpp - Modules/webdatabase/Database.cpp - Modules/webdatabase/DatabaseAuthorizer.cpp - Modules/webdatabase/DatabaseContext.cpp - Modules/webdatabase/DatabaseSync.cpp - Modules/webdatabase/DatabaseTask.cpp - Modules/webdatabase/DatabaseThread.cpp - Modules/webdatabase/DatabaseTracker.cpp - Modules/webdatabase/OriginQuotaManager.cpp - Modules/webdatabase/OriginUsageRecord.cpp - Modules/webdatabase/SQLException.cpp - Modules/webdatabase/SQLResultSet.cpp - Modules/webdatabase/SQLResultSetRowList.cpp - Modules/webdatabase/SQLStatement.cpp - Modules/webdatabase/SQLStatementSync.cpp - Modules/webdatabase/SQLTransaction.cpp - Modules/webdatabase/SQLTransactionClient.cpp - Modules/webdatabase/SQLTransactionCoordinator.cpp - Modules/webdatabase/SQLTransactionSync.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/webdatabase/DOMWindowWebDatabase.idl - Modules/webdatabase/Database.idl - Modules/webdatabase/DatabaseCallback.idl - Modules/webdatabase/DatabaseSync.idl - Modules/webdatabase/SQLError.idl - Modules/webdatabase/SQLException.idl - Modules/webdatabase/SQLResultSet.idl - Modules/webdatabase/SQLResultSetRowList.idl - Modules/webdatabase/SQLStatementCallback.idl - Modules/webdatabase/SQLStatementErrorCallback.idl - Modules/webdatabase/SQLTransaction.idl - Modules/webdatabase/SQLTransactionCallback.idl - Modules/webdatabase/SQLTransactionErrorCallback.idl - Modules/webdatabase/SQLTransactionSync.idl - Modules/webdatabase/SQLTransactionSyncCallback.idl - ) -ENDIF () - IF (ENABLE_SQL_DATABASE AND ENABLE_WORKERS) LIST(APPEND WebCore_SOURCES Modules/webdatabase/WorkerContextWebDatabase.cpp @@ -1596,108 +2392,6 @@ IF (ENABLE_SQL_DATABASE AND ENABLE_WORKERS) ) ENDIF () -IF (ENABLE_DATA_TRANSFER_ITEMS) - LIST(APPEND WebCore_IDL_FILES - dom/DataTransferItem.idl - dom/StringCallback.idl - ) - LIST(APPEND WebCore_SOURCES - dom/DataTransferItem.cpp - dom/StringCallback.cpp - ) -ENDIF () - -IF (ENABLE_INDEXED_DATABASE) - LIST(APPEND WebCore_SOURCES - Modules/indexeddb/DOMWindowIndexedDatabase.cpp - Modules/indexeddb/IDBAny.cpp - Modules/indexeddb/IDBCursor.cpp - Modules/indexeddb/IDBCursorBackendImpl.cpp - Modules/indexeddb/IDBCursorWithValue.cpp - Modules/indexeddb/IDBDatabase.cpp - Modules/indexeddb/IDBDatabaseBackendImpl.cpp - Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp - Modules/indexeddb/IDBDatabaseException.cpp - Modules/indexeddb/IDBEventDispatcher.cpp - Modules/indexeddb/IDBFactory.cpp - Modules/indexeddb/IDBFactoryBackendImpl.cpp - Modules/indexeddb/IDBFactoryBackendInterface.cpp - Modules/indexeddb/IDBIndex.cpp - Modules/indexeddb/IDBIndexBackendImpl.cpp - Modules/indexeddb/IDBKey.cpp - Modules/indexeddb/IDBKeyRange.cpp - Modules/indexeddb/IDBKeyPath.cpp - Modules/indexeddb/IDBKeyPathBackendImpl.cpp - Modules/indexeddb/IDBObjectStore.cpp - Modules/indexeddb/IDBObjectStoreBackendImpl.cpp - Modules/indexeddb/IDBPendingTransactionMonitor.cpp - Modules/indexeddb/IDBRequest.cpp - Modules/indexeddb/IDBTransaction.cpp - Modules/indexeddb/IDBTransactionBackendImpl.cpp - Modules/indexeddb/IDBTransactionCoordinator.cpp - Modules/indexeddb/IDBVersionChangeEvent.cpp - Modules/indexeddb/IDBVersionChangeRequest.cpp - Modules/indexeddb/PageGroupIndexedDatabase.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/indexeddb/DOMWindowIndexedDatabase.idl - Modules/indexeddb/IDBAny.idl - Modules/indexeddb/IDBCursor.idl - Modules/indexeddb/IDBCursorWithValue.idl - Modules/indexeddb/IDBDatabase.idl - Modules/indexeddb/IDBDatabaseException.idl - Modules/indexeddb/IDBFactory.idl - Modules/indexeddb/IDBIndex.idl - Modules/indexeddb/IDBKey.idl - Modules/indexeddb/IDBKeyRange.idl - Modules/indexeddb/IDBObjectStore.idl - Modules/indexeddb/IDBRequest.idl - Modules/indexeddb/IDBTransaction.idl - Modules/indexeddb/IDBVersionChangeEvent.idl - Modules/indexeddb/IDBVersionChangeRequest.idl - ) -ENDIF () - -IF (ENABLE_INDEXED_DATABASE AND ENABLE_WORKERS) - LIST(APPEND WebCore_SOURCES - Modules/indexeddb/WorkerContextIndexedDatabase.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/indexeddb/WorkerContextIndexedDatabase.idl - ) -ENDIF () - -IF (WTF_USE_LEVELDB) - LIST(APPEND WebCore_SOURCES - Modules/indexeddb/IDBLevelDBBackingStore.cpp - Modules/indexeddb/IDBLevelDBCoding.cpp - platform/leveldb/LevelDBDatabase.cpp - platform/leveldb/LevelDBTransaction.cpp - platform/leveldb/LevelDBWriteBatch.cpp - ) -ENDIF () - -IF (ENABLE_MATHML) - LIST(APPEND WebCore_SOURCES - mathml/MathMLElement.cpp - mathml/MathMLInlineContainerElement.cpp - mathml/MathMLMathElement.cpp - mathml/MathMLTextElement.cpp - rendering/mathml/RenderMathMLBlock.cpp - rendering/mathml/RenderMathMLFenced.cpp - rendering/mathml/RenderMathMLFraction.cpp - rendering/mathml/RenderMathMLMath.cpp - rendering/mathml/RenderMathMLOperator.cpp - rendering/mathml/RenderMathMLRoot.cpp - rendering/mathml/RenderMathMLRow.cpp - rendering/mathml/RenderMathMLSquareRoot.cpp - rendering/mathml/RenderMathMLSubSup.cpp - rendering/mathml/RenderMathMLUnderOver.cpp - ) -ENDIF () - IF (ENABLE_NETSCAPE_PLUGIN_API) LIST(APPEND WebCore_SOURCES plugins/PluginDebug.cpp @@ -1706,521 +2400,15 @@ IF (ENABLE_NETSCAPE_PLUGIN_API) ) ENDIF () -IF (ENABLE_NETWORK_INFO) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - ${WEBCORE_DIR}/Modules/networkinfo - ) - - LIST(APPEND WebCore_SOURCES - Modules/networkinfo/NavigatorNetworkInfoConnection.cpp - Modules/networkinfo/NetworkInfo.cpp - Modules/networkinfo/NetworkInfoConnection.cpp - Modules/networkinfo/NetworkInfoController.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/networkinfo/NavigatorNetworkInfoConnection.idl - Modules/networkinfo/NetworkInfoConnection.idl - ) -ENDIF () - -IF (ENABLE_NOTIFICATIONS) - LIST(APPEND WebCore_SOURCES - Modules/notifications/DOMWindowNotifications.cpp - Modules/notifications/NotificationCenter.cpp - Modules/notifications/NotificationController.cpp - Modules/notifications/Notification.cpp - Modules/notifications/WorkerContextNotifications.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/notifications/DOMWindowNotifications.idl - Modules/notifications/Notification.idl - Modules/notifications/NotificationCenter.idl - Modules/notifications/NotificationPermissionCallback.idl - Modules/notifications/WorkerContextNotifications.idl - ) -ENDIF () - -if (ENABLE_FILE_SYSTEM) - LIST(APPEND WebCore_SOURCES - Modules/filesystem/DOMFilePath.cpp - Modules/filesystem/DOMFileSystem.cpp - Modules/filesystem/DOMFileSystemBase.cpp - Modules/filesystem/DOMFileSystemSync.cpp - Modules/filesystem/DOMWindowFileSystem.cpp - Modules/filesystem/DirectoryEntry.cpp - Modules/filesystem/DirectoryEntrySync.cpp - Modules/filesystem/DirectoryReader.cpp - Modules/filesystem/DirectoryReaderSync.cpp - Modules/filesystem/Entry.cpp - Modules/filesystem/EntryArray.cpp - Modules/filesystem/EntryArraySync.cpp - Modules/filesystem/EntryBase.cpp - Modules/filesystem/EntrySync.cpp - Modules/filesystem/FileEntry.cpp - Modules/filesystem/FileEntrySync.cpp - Modules/filesystem/FileSystemCallbacks.cpp - Modules/filesystem/FileWriter.cpp - Modules/filesystem/FileWriterBase.cpp - Modules/filesystem/FileWriterSync.cpp - Modules/filesystem/LocalFileSystem.cpp - Modules/filesystem/WorkerContextFileSystem.cpp - platform/AsyncFileSystem.cpp - ) - LIST(APPEND WebCore_IDL_FILES - Modules/filesystem/DOMWindowFileSystem.idl - Modules/filesystem/DirectoryEntry.idl - Modules/filesystem/DirectoryEntrySync.idl - Modules/filesystem/DirectoryReader.idl - Modules/filesystem/DirectoryReaderSync.idl - Modules/filesystem/DOMFileSystem.idl - Modules/filesystem/DOMFileSystemSync.idl - Modules/filesystem/EntriesCallback.idl - Modules/filesystem/Entry.idl - Modules/filesystem/EntrySync.idl - Modules/filesystem/EntryArray.idl - Modules/filesystem/EntryArraySync.idl - Modules/filesystem/EntryCallback.idl - Modules/filesystem/ErrorCallback.idl - Modules/filesystem/FileCallback.idl - Modules/filesystem/FileEntry.idl - Modules/filesystem/FileEntrySync.idl - Modules/filesystem/FileSystemCallback.idl - Modules/filesystem/FileWriterCallback.idl - Modules/filesystem/FileWriter.idl - Modules/filesystem/FileWriterSync.idl - Modules/filesystem/Metadata.idl - Modules/filesystem/MetadataCallback.idl - Modules/filesystem/WorkerContextFileSystem.idl - ) -ENDIF () - IF (ENABLE_SVG) - LIST(APPEND WebCore_SOURCES - css/SVGCSSComputedStyleDeclaration.cpp - css/SVGCSSParser.cpp - css/SVGCSSStyleSelector.cpp - platform/graphics/SVGGlyph.cpp - rendering/PointerEventsHitRules.cpp - rendering/style/SVGRenderStyle.cpp - rendering/style/SVGRenderStyleDefs.cpp - rendering/svg/RenderSVGBlock.cpp - rendering/svg/RenderSVGContainer.cpp - rendering/svg/RenderSVGEllipse.cpp - rendering/svg/RenderSVGGradientStop.cpp - rendering/svg/RenderSVGForeignObject.cpp - rendering/svg/RenderSVGHiddenContainer.cpp - rendering/svg/RenderSVGImage.cpp - rendering/svg/RenderSVGInline.cpp - rendering/svg/RenderSVGInlineText.cpp - rendering/svg/RenderSVGModelObject.cpp - rendering/svg/RenderSVGPath.cpp - rendering/svg/RenderSVGRect.cpp - rendering/svg/RenderSVGResource.cpp - rendering/svg/RenderSVGResourceClipper.cpp - rendering/svg/RenderSVGResourceContainer.cpp - rendering/svg/RenderSVGResourceFilter.cpp - rendering/svg/RenderSVGResourceFilterPrimitive.cpp - rendering/svg/RenderSVGResourceGradient.cpp - rendering/svg/RenderSVGResourceLinearGradient.cpp - rendering/svg/RenderSVGResourceMarker.cpp - rendering/svg/RenderSVGResourceMasker.cpp - rendering/svg/RenderSVGResourcePattern.cpp - rendering/svg/RenderSVGResourceRadialGradient.cpp - rendering/svg/RenderSVGResourceSolidColor.cpp - rendering/svg/RenderSVGRoot.cpp - rendering/svg/RenderSVGShape.cpp - rendering/svg/RenderSVGTSpan.cpp - rendering/svg/RenderSVGText.cpp - rendering/svg/RenderSVGTextPath.cpp - rendering/svg/RenderSVGTransformableContainer.cpp - rendering/svg/RenderSVGViewportContainer.cpp - rendering/svg/SVGInlineFlowBox.cpp - rendering/svg/SVGInlineTextBox.cpp - rendering/svg/SVGPathData.cpp - rendering/svg/SVGRenderSupport.cpp - rendering/svg/SVGRenderTreeAsText.cpp - rendering/svg/SVGRenderingContext.cpp - rendering/svg/SVGResources.cpp - rendering/svg/SVGResourcesCache.cpp - rendering/svg/SVGResourcesCycleSolver.cpp - rendering/svg/SVGRootInlineBox.cpp - rendering/svg/SVGTextChunk.cpp - rendering/svg/SVGTextChunkBuilder.cpp - rendering/svg/SVGTextLayoutAttributes.cpp - rendering/svg/SVGTextLayoutAttributesBuilder.cpp - rendering/svg/SVGTextLayoutEngine.cpp - rendering/svg/SVGTextLayoutEngineBaseline.cpp - rendering/svg/SVGTextLayoutEngineSpacing.cpp - rendering/svg/SVGTextRunRenderingContext.cpp - rendering/svg/SVGTextMetrics.cpp - rendering/svg/SVGTextMetricsBuilder.cpp - rendering/svg/SVGTextQuery.cpp - svg/ColorDistance.cpp - svg/SVGAElement.cpp - svg/SVGAltGlyphDefElement.cpp - svg/SVGAltGlyphElement.cpp - svg/SVGAltGlyphItemElement.cpp - svg/SVGAngle.cpp - svg/SVGAnimateColorElement.cpp - svg/SVGAnimatedAngle.cpp - svg/SVGAnimatedBoolean.cpp - svg/SVGAnimatedColor.cpp - svg/SVGAnimatedEnumeration.cpp - svg/SVGAnimatedInteger.cpp - svg/SVGAnimatedIntegerOptionalInteger.cpp - svg/SVGAnimatedLength.cpp - svg/SVGAnimatedLengthList.cpp - svg/SVGAnimatedNumber.cpp - svg/SVGAnimatedNumberList.cpp - svg/SVGAnimatedNumberOptionalNumber.cpp - svg/SVGAnimatedPath.cpp - svg/SVGAnimatedPointList.cpp - svg/SVGAnimatedPreserveAspectRatio.cpp - svg/SVGAnimatedRect.cpp - svg/SVGAnimatedString.cpp - svg/SVGAnimatedTransformList.cpp - svg/SVGAnimatedType.cpp - svg/SVGAnimateElement.cpp - svg/SVGAnimateMotionElement.cpp - svg/SVGAnimateTransformElement.cpp - svg/SVGAnimationElement.cpp - svg/SVGCircleElement.cpp - svg/SVGClipPathElement.cpp - svg/SVGColor.cpp - svg/SVGComponentTransferFunctionElement.cpp - svg/SVGCursorElement.cpp - svg/SVGDefsElement.cpp - svg/SVGDescElement.cpp - svg/SVGDocument.cpp - svg/SVGDocumentExtensions.cpp - svg/SVGElement.cpp - svg/SVGElementInstance.cpp - svg/SVGElementInstanceList.cpp - svg/SVGEllipseElement.cpp - svg/SVGException.cpp - svg/SVGExternalResourcesRequired.cpp - svg/SVGFEBlendElement.cpp - svg/SVGFEColorMatrixElement.cpp - svg/SVGFEComponentTransferElement.cpp - svg/SVGFECompositeElement.cpp - svg/SVGFEConvolveMatrixElement.cpp - svg/SVGFEDiffuseLightingElement.cpp - svg/SVGFEDisplacementMapElement.cpp - svg/SVGFEDistantLightElement.cpp - svg/SVGFEDropShadowElement.cpp - svg/SVGFEFloodElement.cpp - svg/SVGFEFuncAElement.cpp - svg/SVGFEFuncBElement.cpp - svg/SVGFEFuncGElement.cpp - svg/SVGFEFuncRElement.cpp - svg/SVGFEGaussianBlurElement.cpp - svg/SVGFEImageElement.cpp - svg/SVGFELightElement.cpp - svg/SVGFEMergeElement.cpp - svg/SVGFEMergeNodeElement.cpp - svg/SVGFEMorphologyElement.cpp - svg/SVGFEOffsetElement.cpp - svg/SVGFEPointLightElement.cpp - svg/SVGFESpecularLightingElement.cpp - svg/SVGFESpotLightElement.cpp - svg/SVGFETileElement.cpp - svg/SVGFETurbulenceElement.cpp - svg/SVGFilterElement.cpp - svg/SVGFilterPrimitiveStandardAttributes.cpp - svg/SVGFitToViewBox.cpp - svg/SVGFontData.cpp - svg/SVGFontElement.cpp - svg/SVGFontFaceElement.cpp - svg/SVGFontFaceFormatElement.cpp - svg/SVGFontFaceNameElement.cpp - svg/SVGFontFaceSrcElement.cpp - svg/SVGFontFaceUriElement.cpp - svg/SVGForeignObjectElement.cpp - svg/SVGGElement.cpp - svg/SVGGlyphElement.cpp - svg/SVGGlyphRefElement.cpp - svg/SVGGradientElement.cpp - svg/SVGHKernElement.cpp - svg/SVGImageElement.cpp - svg/SVGImageLoader.cpp - svg/SVGLangSpace.cpp - svg/SVGLength.cpp - svg/SVGLengthContext.cpp - svg/SVGLengthList.cpp - svg/SVGLineElement.cpp - svg/SVGLinearGradientElement.cpp - svg/SVGLocatable.cpp - svg/SVGMPathElement.cpp - svg/SVGMarkerElement.cpp - svg/SVGMaskElement.cpp - svg/SVGMetadataElement.cpp - svg/SVGMissingGlyphElement.cpp - svg/SVGNumberList.cpp - svg/SVGPaint.cpp - svg/SVGParserUtilities.cpp - svg/SVGPathBlender.cpp - svg/SVGPathBuilder.cpp - svg/SVGPathByteStreamBuilder.cpp - svg/SVGPathByteStreamSource.cpp - svg/SVGPathElement.cpp - svg/SVGPathParser.cpp - svg/SVGPathSegList.cpp - svg/SVGPathSegListBuilder.cpp - svg/SVGPathSegListSource.cpp - svg/SVGPathStringBuilder.cpp - svg/SVGPathStringSource.cpp - svg/SVGPathTraversalStateBuilder.cpp - svg/SVGPathUtilities.cpp - svg/SVGPatternElement.cpp - svg/SVGPointList.cpp - svg/SVGPolyElement.cpp - svg/SVGPolygonElement.cpp - svg/SVGPolylineElement.cpp - svg/SVGPreserveAspectRatio.cpp - svg/SVGRadialGradientElement.cpp - svg/SVGRectElement.cpp - svg/SVGSVGElement.cpp - svg/SVGScriptElement.cpp - svg/SVGSetElement.cpp - svg/SVGStopElement.cpp - svg/SVGStringList.cpp - svg/SVGStylable.cpp - svg/SVGStyleElement.cpp - svg/SVGStyledElement.cpp - svg/SVGStyledLocatableElement.cpp - svg/SVGStyledTransformableElement.cpp - svg/SVGSwitchElement.cpp - svg/SVGSymbolElement.cpp - svg/SVGTRefElement.cpp - svg/SVGTSpanElement.cpp - svg/SVGTests.cpp - svg/SVGTextContentElement.cpp - svg/SVGTextElement.cpp - svg/SVGTextPathElement.cpp - svg/SVGTextPositioningElement.cpp - svg/SVGTitleElement.cpp - svg/SVGTransform.cpp - svg/SVGTransformDistance.cpp - svg/SVGTransformList.cpp - svg/SVGTransformable.cpp - svg/SVGURIReference.cpp - svg/SVGUseElement.cpp - svg/SVGViewElement.cpp - svg/SVGViewSpec.cpp - svg/SVGVKernElement.cpp - svg/SVGZoomAndPan.cpp - svg/SVGZoomEvent.cpp - svg/animation/SMILTime.cpp - svg/animation/SMILTimeContainer.cpp - svg/animation/SVGSMILElement.cpp - svg/graphics/SVGImage.cpp - svg/graphics/SVGImageCache.cpp - svg/graphics/filters/SVGFEImage.cpp - svg/graphics/filters/SVGFilter.cpp - svg/graphics/filters/SVGFilterBuilder.cpp - svg/properties/SVGAttributeToPropertyMap.cpp - svg/properties/SVGPathSegListPropertyTearOff.cpp - ) - - # FIXME: The BlackBerry port doesn't support generating DOM bindings from the SVG IDL files. - # For now, we explicitly demarcate the SVG IDL files so that the BlackBerry port can skip them - # during DOM binding generation. See <https://bugs.webkit.org/show_bug.cgi?id=72773>. - SET(SVG_IDL_FILES - svg/SVGAElement.idl - svg/SVGAltGlyphDefElement.idl - svg/SVGAltGlyphElement.idl - svg/SVGAltGlyphItemElement.idl - svg/SVGAngle.idl - svg/SVGAnimateColorElement.idl - svg/SVGAnimateMotionElement.idl - svg/SVGAnimateElement.idl - svg/SVGAnimateTransformElement.idl - svg/SVGAnimatedAngle.idl - svg/SVGAnimatedBoolean.idl - svg/SVGAnimatedEnumeration.idl - svg/SVGAnimatedInteger.idl - svg/SVGAnimatedLength.idl - svg/SVGAnimatedLengthList.idl - svg/SVGAnimatedNumber.idl - svg/SVGAnimatedNumberList.idl - svg/SVGAnimatedPreserveAspectRatio.idl - svg/SVGAnimatedRect.idl - svg/SVGAnimatedString.idl - svg/SVGAnimatedTransformList.idl - svg/SVGAnimationElement.idl - svg/SVGCircleElement.idl - svg/SVGClipPathElement.idl - svg/SVGColor.idl - svg/SVGComponentTransferFunctionElement.idl - svg/SVGCursorElement.idl - svg/SVGDefsElement.idl - svg/SVGDescElement.idl - svg/SVGDocument.idl - svg/SVGElement.idl - svg/SVGElementInstance.idl - svg/SVGElementInstanceList.idl - svg/SVGEllipseElement.idl - svg/SVGException.idl - svg/SVGFEBlendElement.idl - svg/SVGFEColorMatrixElement.idl - svg/SVGFEComponentTransferElement.idl - svg/SVGFECompositeElement.idl - svg/SVGFEConvolveMatrixElement.idl - svg/SVGFEDiffuseLightingElement.idl - svg/SVGFEDisplacementMapElement.idl - svg/SVGFEDistantLightElement.idl - svg/SVGFEDropShadowElement.idl - svg/SVGFEFloodElement.idl - svg/SVGFEFuncAElement.idl - svg/SVGFEFuncBElement.idl - svg/SVGFEFuncGElement.idl - svg/SVGFEFuncRElement.idl - svg/SVGFEGaussianBlurElement.idl - svg/SVGFEImageElement.idl - svg/SVGFEMergeElement.idl - svg/SVGFEMergeNodeElement.idl - svg/SVGFEMorphologyElement.idl - svg/SVGFEOffsetElement.idl - svg/SVGFEPointLightElement.idl - svg/SVGFESpecularLightingElement.idl - svg/SVGFESpotLightElement.idl - svg/SVGFETileElement.idl - svg/SVGFETurbulenceElement.idl - svg/SVGFilterElement.idl - svg/SVGFontElement.idl - svg/SVGFontFaceElement.idl - svg/SVGFontFaceFormatElement.idl - svg/SVGFontFaceNameElement.idl - svg/SVGFontFaceSrcElement.idl - svg/SVGFontFaceUriElement.idl - svg/SVGForeignObjectElement.idl - svg/SVGGElement.idl - svg/SVGGlyphElement.idl - svg/SVGGlyphRefElement.idl - svg/SVGGradientElement.idl - svg/SVGHKernElement.idl - svg/SVGImageElement.idl - svg/SVGLength.idl - svg/SVGLengthList.idl - svg/SVGLineElement.idl - svg/SVGLinearGradientElement.idl - svg/SVGMarkerElement.idl - svg/SVGMaskElement.idl - svg/SVGMatrix.idl - svg/SVGMetadataElement.idl - svg/SVGMissingGlyphElement.idl - svg/SVGMPathElement.idl - svg/SVGNumber.idl - svg/SVGNumberList.idl - svg/SVGPaint.idl - svg/SVGPathElement.idl - svg/SVGPathSeg.idl - svg/SVGPathSegArcAbs.idl - svg/SVGPathSegArcRel.idl - svg/SVGPathSegClosePath.idl - svg/SVGPathSegCurvetoCubicAbs.idl - svg/SVGPathSegCurvetoCubicRel.idl - svg/SVGPathSegCurvetoCubicSmoothAbs.idl - svg/SVGPathSegCurvetoCubicSmoothRel.idl - svg/SVGPathSegCurvetoQuadraticAbs.idl - svg/SVGPathSegCurvetoQuadraticRel.idl - svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl - svg/SVGPathSegCurvetoQuadraticSmoothRel.idl - svg/SVGPathSegLinetoAbs.idl - svg/SVGPathSegLinetoHorizontalAbs.idl - svg/SVGPathSegLinetoHorizontalRel.idl - svg/SVGPathSegLinetoRel.idl - svg/SVGPathSegLinetoVerticalAbs.idl - svg/SVGPathSegLinetoVerticalRel.idl - svg/SVGPathSegList.idl - svg/SVGPathSegMovetoAbs.idl - svg/SVGPathSegMovetoRel.idl - svg/SVGPatternElement.idl - svg/SVGPoint.idl - svg/SVGPointList.idl - svg/SVGPolygonElement.idl - svg/SVGPolylineElement.idl - svg/SVGPreserveAspectRatio.idl - svg/SVGRadialGradientElement.idl - svg/SVGRect.idl - svg/SVGRectElement.idl - svg/SVGRenderingIntent.idl - svg/SVGSVGElement.idl - svg/SVGScriptElement.idl - svg/SVGSetElement.idl - svg/SVGStopElement.idl - svg/SVGStringList.idl - svg/SVGStyleElement.idl - svg/SVGSwitchElement.idl - svg/SVGSymbolElement.idl - svg/SVGTRefElement.idl - svg/SVGTSpanElement.idl - svg/SVGTextContentElement.idl - svg/SVGTextElement.idl - svg/SVGTextPathElement.idl - svg/SVGTextPositioningElement.idl - svg/SVGTitleElement.idl - svg/SVGTransform.idl - svg/SVGTransformList.idl - svg/SVGUnitTypes.idl - svg/SVGUseElement.idl - svg/SVGViewElement.idl - svg/SVGViewSpec.idl - svg/SVGVKernElement.idl - svg/SVGZoomAndPan.idl - svg/SVGZoomEvent.idl - ) - - LIST(APPEND WebCore_IDL_FILES - ${SVG_IDL_FILES} - ) - LIST(APPEND WebCore_CSS_PROPERTY_NAMES ${WEBCORE_DIR}/css/SVGCSSPropertyNames.in ) - LIST(APPEND WebCore_CSS_VALUE_KEYWORDS ${WEBCORE_DIR}/css/SVGCSSValueKeywords.in ) ENDIF() -IF (ENABLE_VIDEO) - LIST(APPEND WebCore_SOURCES - html/HTMLAudioElement.cpp - html/HTMLMediaElement.cpp - html/HTMLSourceElement.cpp - html/HTMLVideoElement.cpp - html/MediaFragmentURIParser.cpp - html/TimeRanges.cpp - html/shadow/MediaControlElements.cpp - platform/graphics/MediaPlayer.cpp - rendering/RenderMedia.cpp - rendering/RenderVideo.cpp - ) -ENDIF() - -IF (ENABLE_WEB_SOCKETS) - LIST(APPEND WebCore_SOURCES - Modules/websockets/ThreadableWebSocketChannel.cpp - Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp - Modules/websockets/WebSocket.cpp - Modules/websockets/WebSocketChannel.cpp - Modules/websockets/WebSocketDeflater.cpp - Modules/websockets/WebSocketDeflateFramer.cpp - Modules/websockets/WebSocketExtensionDispatcher.cpp - Modules/websockets/WebSocketFrame.cpp - Modules/websockets/WebSocketHandshake.cpp - Modules/websockets/WebSocketHandshakeRequest.cpp - Modules/websockets/WebSocketHandshakeResponse.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/websockets/WebSocket.idl - ) -ENDIF () - IF (ENABLE_SMOOTH_SCROLLING) LIST(APPEND WebCore_SOURCES platform/ActivePlatformGestureAnimation.cpp @@ -2229,93 +2417,75 @@ IF (ENABLE_SMOOTH_SCROLLING) ) ENDIF () -IF (ENABLE_WEB_SOCKETS AND ENABLE_WORKERS) - LIST(APPEND WebCore_SOURCES - Modules/websockets/WorkerThreadableWebSocketChannel.cpp - ) -ENDIF () - -IF (ENABLE_WORKERS) - LIST(APPEND WebCore_SOURCES - loader/WorkerThreadableLoader.cpp - - page/WorkerNavigator.cpp - - workers/AbstractWorker.cpp - workers/DedicatedWorkerContext.cpp - workers/DedicatedWorkerThread.cpp - workers/Worker.cpp - workers/WorkerContext.cpp - workers/WorkerEventQueue.cpp - workers/WorkerLocation.cpp - workers/WorkerMessagingProxy.cpp - workers/WorkerRunLoop.cpp - workers/WorkerScriptLoader.cpp - workers/WorkerThread.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - page/WorkerNavigator.idl - - workers/AbstractWorker.idl - workers/DedicatedWorkerContext.idl - workers/Worker.idl - workers/WorkerContext.idl - workers/WorkerLocation.idl - ) -ENDIF () +IF (ENABLE_WEBGL) + SET(WTF_USE_3D_GRAPHICS 1) + ADD_DEFINITIONS(-DWTF_USE_3D_GRAPHICS=1) -IF (ENABLE_SHARED_WORKERS) LIST(APPEND WebCore_SOURCES - workers/DefaultSharedWorkerRepository.cpp - workers/SharedWorker.cpp - workers/SharedWorkerContext.cpp - workers/SharedWorkerThread.cpp + html/canvas/OESStandardDerivatives.cpp + html/canvas/OESTextureFloat.cpp + html/canvas/OESVertexArrayObject.cpp + html/canvas/WebGLBuffer.cpp + html/canvas/WebGLCompressedTextureS3TC.cpp + html/canvas/WebGLContextAttributes.cpp + html/canvas/WebGLContextEvent.cpp + html/canvas/WebGLContextGroup.cpp + html/canvas/WebGLContextObject.cpp + html/canvas/WebGLDebugRendererInfo.cpp + html/canvas/WebGLDebugShaders.cpp + html/canvas/WebGLDepthTexture.cpp + html/canvas/WebGLFramebuffer.cpp + html/canvas/WebGLGetInfo.cpp + html/canvas/WebGLLoseContext.cpp + html/canvas/WebGLObject.cpp + html/canvas/WebGLProgram.cpp + html/canvas/WebGLRenderbuffer.cpp + html/canvas/WebGLRenderingContext.cpp + html/canvas/WebGLShader.cpp + html/canvas/WebGLShaderPrecisionFormat.cpp + html/canvas/WebGLSharedObject.cpp + html/canvas/WebGLTexture.cpp + html/canvas/WebGLUniformLocation.cpp + html/canvas/WebGLVertexArrayObjectOES.cpp + html/canvas/WebGLExtension.cpp + html/canvas/EXTTextureFilterAnisotropic.cpp + html/canvas/OESStandardDerivatives.cpp + html/canvas/OESTextureFloat.cpp + html/canvas/OESVertexArrayObject.cpp ) - LIST(APPEND WebCore_IDL_FILES - workers/SharedWorker.idl - workers/SharedWorkerContext.idl - ) -ENDIF () - -IF (ENABLE_VIDEO_TRACK) - LIST(APPEND WebCore_SOURCES - html/HTMLTrackElement.cpp - html/track/LoadableTextTrack.cpp - html/track/TextTrack.cpp - html/track/TextTrackCue.cpp - html/track/TextTrackCueList.cpp - html/track/TextTrackList.cpp - html/track/TrackBase.cpp - html/track/TrackEvent.cpp - html/track/WebVTTParser.cpp - html/track/WebVTTTokenizer.cpp - loader/TextTrackLoader.cpp - loader/cache/CachedTextTrack.cpp - ) -ENDIF() - -IF (ENABLE_PROGRESS_TAG) - LIST(APPEND WebCore_SOURCES - accessibility/AccessibilityProgressIndicator.cpp + html/canvas/EXTTextureFilterAnisotropic.idl + html/canvas/OESStandardDerivatives.idl + html/canvas/OESTextureFloat.idl + html/canvas/OESVertexArrayObject.idl + html/canvas/WebGLActiveInfo.idl + html/canvas/WebGLBuffer.idl + html/canvas/WebGLCompressedTextureS3TC.idl + html/canvas/WebGLContextAttributes.idl + html/canvas/WebGLContextEvent.idl + html/canvas/WebGLDebugRendererInfo.idl + html/canvas/WebGLDebugShaders.idl + html/canvas/WebGLDepthTexture.idl + html/canvas/WebGLFramebuffer.idl + html/canvas/WebGLLoseContext.idl + html/canvas/WebGLProgram.idl + html/canvas/WebGLRenderbuffer.idl + html/canvas/WebGLRenderingContext.idl + html/canvas/WebGLShader.idl + html/canvas/WebGLShaderPrecisionFormat.idl + html/canvas/WebGLTexture.idl + html/canvas/WebGLUniformLocation.idl + html/canvas/WebGLVertexArrayObjectOES.idl ) ENDIF () -IF (ENABLE_MHTML) - LIST(APPEND WebCore_SOURCES - loader/archive/mhtml/MHTMLArchive.cpp - loader/archive/mhtml/MHTMLParser.cpp - ) -ENDIF () - -IF (ENABLE_WEBGL) - #ANGLE +IF (WTF_USE_3D_GRAPHICS) LIST(APPEND WebCore_INCLUDE_DIRECTORIES ${OPENGL_INCLUDE_DIR} - ${THIRDPARTY_DIR}/ANGLE/src - #${THIRDPARTY_DIR}/ANGLE/include #Defined as SYSTEM include in order to have less priority than actual system headers - ${THIRDPARTY_DIR}/ANGLE/include/GLSLANG + "${THIRDPARTY_DIR}/ANGLE/src" + "${THIRDPARTY_DIR}/ANGLE/include" + "${THIRDPARTY_DIR}/ANGLE/include/GLSLANG" + "${WEBCORE_DIR}/platform/graphics/gpu" ) LIST(APPEND WebCore_LIBRARIES ${OPENGL_gl_LIBRARY} @@ -2413,64 +2583,10 @@ IF (ENABLE_WEBGL) ) LIST(APPEND WebCore_SOURCES - html/canvas/OESStandardDerivatives.cpp - html/canvas/OESTextureFloat.cpp - html/canvas/OESVertexArrayObject.cpp - html/canvas/WebGLBuffer.cpp - html/canvas/WebGLCompressedTextureS3TC.cpp - html/canvas/WebGLContextAttributes.cpp - html/canvas/WebGLContextEvent.cpp - html/canvas/WebGLContextGroup.cpp - html/canvas/WebGLContextObject.cpp - html/canvas/WebGLDebugRendererInfo.cpp - html/canvas/WebGLDebugShaders.cpp - html/canvas/WebGLDepthTexture.cpp - html/canvas/WebGLFramebuffer.cpp - html/canvas/WebGLGetInfo.cpp - html/canvas/WebGLLoseContext.cpp - html/canvas/WebGLObject.cpp - html/canvas/WebGLProgram.cpp - html/canvas/WebGLRenderbuffer.cpp - html/canvas/WebGLRenderingContext.cpp - html/canvas/WebGLShader.cpp - html/canvas/WebGLShaderPrecisionFormat.cpp - html/canvas/WebGLSharedObject.cpp - html/canvas/WebGLTexture.cpp - html/canvas/WebGLUniformLocation.cpp - html/canvas/WebGLVertexArrayObjectOES.cpp - html/canvas/WebGLExtension.cpp - html/canvas/EXTTextureFilterAnisotropic.cpp - html/canvas/OESStandardDerivatives.cpp - html/canvas/OESTextureFloat.cpp - html/canvas/OESVertexArrayObject.cpp platform/graphics/ANGLEWebKitBridge.cpp platform/graphics/GraphicsContext3D.cpp platform/graphics/gpu/DrawingBuffer.cpp ) - LIST(APPEND WebCore_IDL_FILES - html/canvas/EXTTextureFilterAnisotropic.idl - html/canvas/OESStandardDerivatives.idl - html/canvas/OESTextureFloat.idl - html/canvas/OESVertexArrayObject.idl - html/canvas/WebGLActiveInfo.idl - html/canvas/WebGLBuffer.idl - html/canvas/WebGLCompressedTextureS3TC.idl - html/canvas/WebGLContextAttributes.idl - html/canvas/WebGLContextEvent.idl - html/canvas/WebGLDebugRendererInfo.idl - html/canvas/WebGLDebugShaders.idl - html/canvas/WebGLDepthTexture.idl - html/canvas/WebGLFramebuffer.idl - html/canvas/WebGLLoseContext.idl - html/canvas/WebGLProgram.idl - html/canvas/WebGLRenderbuffer.idl - html/canvas/WebGLRenderingContext.idl - html/canvas/WebGLShader.idl - html/canvas/WebGLShaderPrecisionFormat.idl - html/canvas/WebGLTexture.idl - html/canvas/WebGLUniformLocation.idl - html/canvas/WebGLVertexArrayObjectOES.idl - ) ENDIF () IF (ENABLE_REQUEST_ANIMATION_FRAME) @@ -2514,199 +2630,6 @@ SET(WebCoreTestSupport_SOURCES testing/InternalSettings.cpp ) -IF (ENABLE_BATTERY_STATUS) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - "${WEBCORE_DIR}/Modules/battery" - ) - LIST(APPEND WebCore_IDL_FILES - Modules/battery/NavigatorBattery.idl - Modules/battery/BatteryManager.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/battery/NavigatorBattery.cpp - Modules/battery/BatteryController.cpp - Modules/battery/BatteryManager.cpp - Modules/battery/BatteryStatus.cpp - ) -ENDIF () - -IF (ENABLE_GAMEPAD) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - "${WEBCORE_DIR}/Modules/gamepad" - ) - LIST(APPEND WebCore_IDL_FILES - Modules/gamepad/Gamepad.idl - Modules/gamepad/GamepadList.idl - Modules/gamepad/NavigatorGamepad.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/gamepad/Gamepad.cpp - Modules/gamepad/GamepadList.cpp - Modules/gamepad/NavigatorGamepad.cpp - ) -ENDIF () - -IF (ENABLE_MEDIA_STREAM) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - ${WEBCORE_DIR}/Modules/mediastream - ${WEBCORE_DIR}/platform/mediastream - ) - LIST(APPEND WebCore_IDL_FILES - Modules/mediastream/DeprecatedPeerConnection.idl - Modules/mediastream/DOMWindowMediaStream.idl - Modules/mediastream/IceCallback.idl - Modules/mediastream/IceCandidate.idl - Modules/mediastream/LocalMediaStream.idl - Modules/mediastream/MediaStream.idl - Modules/mediastream/MediaStreamEvent.idl - Modules/mediastream/MediaStreamList.idl - Modules/mediastream/MediaStreamTrack.idl - Modules/mediastream/MediaStreamTrackEvent.idl - Modules/mediastream/MediaStreamTrackList.idl - Modules/mediastream/NavigatorMediaStream.idl - Modules/mediastream/NavigatorUserMediaError.idl - Modules/mediastream/NavigatorUserMediaErrorCallback.idl - Modules/mediastream/NavigatorUserMediaSuccessCallback.idl - Modules/mediastream/PeerConnection00.idl - Modules/mediastream/SessionDescription.idl - Modules/mediastream/SignalingCallback.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/mediastream/DeprecatedPeerConnection.cpp - Modules/mediastream/IceCandidate.cpp - Modules/mediastream/LocalMediaStream.cpp - Modules/mediastream/MediaStream.cpp - Modules/mediastream/MediaStreamEvent.cpp - Modules/mediastream/MediaStreamList.cpp - Modules/mediastream/MediaStreamRegistry.cpp - Modules/mediastream/MediaStreamTrack.cpp - Modules/mediastream/MediaStreamTrackEvent.cpp - Modules/mediastream/MediaStreamTrackList.cpp - Modules/mediastream/NavigatorMediaStream.cpp - Modules/mediastream/PeerConnection00.cpp - Modules/mediastream/SessionDescription.cpp - Modules/mediastream/UserMediaController.cpp - Modules/mediastream/UserMediaRequest.cpp - - platform/mediastream/IceCandidateDescriptor.cpp - platform/mediastream/IceOptions.cpp - platform/mediastream/MediaHints.cpp - platform/mediastream/MediaStreamCenter.cpp - platform/mediastream/PeerConnection00Handler.cpp - platform/mediastream/SessionDescriptionDescriptor.cpp - ) -ENDIF () - -IF (ENABLE_WEB_AUDIO) - LIST(APPEND WebCore_SOURCES - Modules/webaudio/AsyncAudioDecoder.cpp - Modules/webaudio/AudioBasicInspectorNode.cpp - Modules/webaudio/AudioBasicProcessorNode.cpp - Modules/webaudio/AudioBuffer.cpp - Modules/webaudio/AudioBufferSourceNode.cpp - Modules/webaudio/AudioChannelMerger.cpp - Modules/webaudio/AudioChannelSplitter.cpp - Modules/webaudio/AudioContext.cpp - Modules/webaudio/AudioDestinationNode.cpp - Modules/webaudio/AudioGainNode.cpp - Modules/webaudio/AudioListener.cpp - Modules/webaudio/AudioNode.cpp - Modules/webaudio/AudioNodeInput.cpp - Modules/webaudio/AudioNodeOutput.cpp - Modules/webaudio/AudioPannerNode.cpp - Modules/webaudio/AudioParam.cpp - Modules/webaudio/AudioParamTimeline.cpp - Modules/webaudio/AudioProcessingEvent.cpp - Modules/webaudio/AudioScheduledSourceNode.cpp - Modules/webaudio/AudioSummingJunction.cpp - Modules/webaudio/BiquadDSPKernel.cpp - Modules/webaudio/BiquadFilterNode.cpp - Modules/webaudio/BiquadProcessor.cpp - Modules/webaudio/ConvolverNode.cpp - Modules/webaudio/DefaultAudioDestinationNode.cpp - Modules/webaudio/DelayDSPKernel.cpp - Modules/webaudio/DelayNode.cpp - Modules/webaudio/DelayProcessor.cpp - Modules/webaudio/DynamicsCompressorNode.cpp - Modules/webaudio/JavaScriptAudioNode.cpp - Modules/webaudio/MediaElementAudioSourceNode.cpp - Modules/webaudio/OfflineAudioCompletionEvent.cpp - Modules/webaudio/OfflineAudioDestinationNode.cpp - Modules/webaudio/Oscillator.cpp - Modules/webaudio/RealtimeAnalyser.cpp - Modules/webaudio/RealtimeAnalyserNode.cpp - Modules/webaudio/WaveShaperDSPKernel.cpp - Modules/webaudio/WaveShaperNode.cpp - Modules/webaudio/WaveShaperProcessor.cpp - Modules/webaudio/WaveTable.cpp - - platform/audio/AudioBus.cpp - platform/audio/AudioChannel.cpp - platform/audio/AudioDSPKernelProcessor.cpp - platform/audio/AudioFIFO.cpp - platform/audio/AudioPullFIFO.cpp - platform/audio/AudioResampler.cpp - platform/audio/AudioResamplerKernel.cpp - platform/audio/AudioUtilities.cpp - platform/audio/Biquad.cpp - platform/audio/Cone.cpp - platform/audio/DirectConvolver.cpp - platform/audio/Distance.cpp - platform/audio/DynamicsCompressor.cpp - platform/audio/DynamicsCompressorKernel.cpp - platform/audio/EqualPowerPanner.cpp - platform/audio/FFTConvolver.cpp - platform/audio/FFTFrame.cpp - platform/audio/FFTFrameStub.cpp - platform/audio/HRTFDatabase.cpp - platform/audio/HRTFDatabaseLoader.cpp - platform/audio/HRTFElevation.cpp - platform/audio/HRTFKernel.cpp - platform/audio/HRTFPanner.cpp - platform/audio/MultiChannelResampler.cpp - platform/audio/Panner.cpp - platform/audio/ReverbAccumulationBuffer.cpp - platform/audio/ReverbConvolver.cpp - platform/audio/ReverbConvolverStage.cpp - platform/audio/Reverb.cpp - platform/audio/ReverbInputBuffer.cpp - platform/audio/SincResampler.cpp - platform/audio/VectorMath.cpp - platform/audio/ZeroPole.cpp - ) -ENDIF () - -IF (ENABLE_WEB_INTENTS) - LIST(APPEND WebCore_IDL_FILES - Modules/intents/DeliveredIntent.idl - Modules/intents/DOMWindowIntents.idl - Modules/intents/Intent.idl - Modules/intents/IntentResultCallback.idl - Modules/intents/NavigatorIntents.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/intents/DeliveredIntent.cpp - Modules/intents/DOMWindowIntents.cpp - Modules/intents/Intent.cpp - Modules/intents/IntentRequest.cpp - Modules/intents/NavigatorIntents.cpp - ) -ENDIF () - -if (ENABLE_QUOTA) - LIST(APPEND WebCore_SOURCES - Modules/quota/DOMWindowQuota.cpp - Modules/quota/StorageInfo.cpp - ) - LIST(APPEND WebCore_IDL_FILES - Modules/quota/DOMWindowQuota.idl - Modules/quota/StorageInfo.idl - Modules/quota/StorageInfoErrorCallback.idl - Modules/quota/StorageInfoQuotaCallback.idl - Modules/quota/StorageInfoUsageCallback.idl - ) -ENDIF () - # Modules that the bindings generator scripts may use SET(SCRIPTS_RESOLVE_SUPPLEMENTAL ${WEBCORE_DIR}/bindings/scripts/IDLParser.pm diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 59922b16e..b14f60022 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,4329 @@ +2012-07-22 Kentaro Hara <haraken@chromium.org> + + [V8] CodeGeneratorV8.pm should support static attributes + https://bugs.webkit.org/show_bug.cgi?id=91764 + + Reviewed by Adam Barth. + + CodeGeneratorJS.pm already supports static attributes. + CodeGeneratorV8.pm should also support them. + + Tests: bindings/scripts/test/TestObj.idl + bindings/scripts/test/TestSupplemental.idl + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + + * bindings/scripts/test/TestObj.idl: Added defined(TESTING_V8). + * bindings/scripts/test/TestSupplemental.idl: Added test cases for static attributes in supplemental IDL files. + + * bindings/scripts/test/JS/JSTestInterface.cpp: Updated run-bindings-tests results. + (WebCore): + (WebCore::jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr): + The generated code is wrong since CodeGeneratorJS.pm does not support static attributes for + supplemental IDL files. I will fix it in a follow-up patch. + (WebCore::jsTestInterfaceConstructorSupplementalStaticAttr): + (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr): + * bindings/scripts/test/JS/JSTestInterface.h: + (WebCore): + * bindings/scripts/test/V8/V8TestInterface.cpp: Updated run-bindings-tests results. + (WebCore::TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttrGetter): + (TestInterfaceV8Internal): + (WebCore::TestInterfaceV8Internal::supplementalStaticAttrAttrGetter): + (WebCore::TestInterfaceV8Internal::supplementalStaticAttrAttrSetter): + (WebCore): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::staticReadOnlyIntAttrAttrGetter): + (TestObjV8Internal): + (WebCore::TestObjV8Internal::staticStringAttrAttrGetter): + (WebCore::TestObjV8Internal::staticStringAttrAttrSetter): + (WebCore): + +2012-07-22 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Missing *explicit* keyword in storage and workers. + https://bugs.webkit.org/show_bug.cgi?id=91934 + + Reviewed by Kentaro Hara. + + Some constructors missed to use *explicit* keyword. They need to be added + *explicit* keyword to contructor which has a parameter in order to avoid + implicit type conversion. + + No new tests. Convered by existing tests. + + * storage/StorageAreaImpl.h: + (StorageAreaImpl): + * storage/StorageMap.h: + (StorageMap): + * storage/StorageSyncManager.h: + (StorageSyncManager): + * storage/StorageTask.h: + (StorageTask): + * storage/StorageTracker.h: + (StorageTracker): + * workers/SharedWorker.h: + (SharedWorker): + * workers/Worker.h: + (Worker): + * workers/WorkerLocation.h: + (WebCore::WorkerLocation::WorkerLocation): + * workers/WorkerMessagingProxy.h: + (WorkerMessagingProxy): + +2012-07-23 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.make: + * GNUmakefile.am: + * accessibility/AXObjectCache.cpp: + (WebCore::createFromRenderer): + * accessibility/AccessibilityProgressIndicator.cpp: + * accessibility/AccessibilityProgressIndicator.h: + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkOneSelector): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/html.css: + * html/HTMLMeterElement.cpp: + * html/HTMLMeterElement.h: + * html/HTMLMeterElement.idl: + * html/HTMLProgressElement.cpp: + * html/HTMLProgressElement.h: + * html/HTMLProgressElement.idl: + * html/HTMLTagNames.in: + * html/shadow/MeterShadowElement.cpp: + * html/shadow/MeterShadowElement.h: Wrap with #if ENABLE(METER_ELEMENT). + * html/shadow/ProgressShadowElement.cpp: + * html/shadow/ProgressShadowElement.h: Wrap with #if ENABLE(PROGRESS_ELEMENT). + * page/DOMWindow.idl: + * platform/efl/RenderThemeEfl.cpp: + (WebCore::RenderThemeEfl::paintThemePart): + (WebCore::RenderThemeEfl::edjeGroupFromFormType): + (WebCore): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + * platform/gtk/RenderThemeGtk.cpp: + (WebCore): + * platform/gtk/RenderThemeGtk.h: + (RenderThemeGtk): + * platform/gtk/RenderThemeGtk2.cpp: + (WebCore): + * platform/gtk/RenderThemeGtk3.cpp: + (WebCore): + * platform/qt/RenderThemeQt.cpp: + (WebCore): + * platform/qt/RenderThemeQt.h: + (WebCore): + (RenderThemeQt): + * platform/qt/RenderThemeQtMobile.cpp: + (WebCore): + * platform/qt/RenderThemeQtMobile.h: + (RenderThemeQtMobile): + * rendering/RenderMeter.cpp: + * rendering/RenderMeter.h: + * rendering/RenderObject.h: + (RenderObject): + * rendering/RenderProgress.cpp: + * rendering/RenderProgress.h: + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::adjustStyle): + (WebCore::RenderTheme::paint): + (WebCore::RenderTheme::paintBorderOnly): + (WebCore::RenderTheme::paintDecorations): + (WebCore): + * rendering/RenderTheme.h: + (WebCore): + (RenderTheme): + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore): + * rendering/RenderThemeChromiumLinux.h: + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore): + * rendering/RenderThemeChromiumSkia.h: + (RenderThemeChromiumSkia): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore): + * rendering/RenderThemeChromiumWin.h: + (RenderThemeChromiumWin): + * rendering/RenderThemeMac.h: + (RenderThemeMac): + * rendering/RenderThemeMac.mm: + (WebCore): + +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91928 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.make: + * GNUmakefile.am: + * html/HTMLDetailsElement.cpp: + * html/HTMLDetailsElement.idl: + * html/HTMLSummaryElement.cpp: + * html/HTMLTagNames.in: + * html/shadow/DetailsMarkerControl.cpp: + * rendering/RenderDetailsMarker.cpp: + * rendering/RenderDetailsMarker.h: + * rendering/RenderObject.h: + (RenderObject): + * rendering/RenderTreeAsText.cpp: + (WebCore::RenderTreeAsText::writeRenderObject): + +2012-07-21 Dan Bernstein <mitz@apple.com> + + <rdar://problem/11928576> SVG-as-image (constrained) intrinsic size calculation is wrong in vertical writing modes + https://bugs.webkit.org/show_bug.cgi?id=91918 + + Reviewed by Anders Carlsson. + + Test: svg/as-image/svg-intrinsic-size-rectangular-vertical.html + + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): When there is a content + renderer, it returns a physical intrinsic size and aspect ratio. The code was already + accounting for this by taking the reciprocal of the aspect ratio in the vertical case. Made + it also transpose the size itself, turning it from physical to logical. Moved this code + after setting m_intrinsicSize, since that member variable is always physical. + +2012-07-21 Patrick Gansterer <paroga@webkit.org> + + Cleanup TextEncoding USE(XXX_UNICODE) macros + https://bugs.webkit.org/show_bug.cgi?id=91923 + + Reviewed by Andreas Kling. + + Replace PLATFORM(QT) with USE(QT4_UNICODE) and OS(WINCE) with USE(WINCE_UNICODE). + This gives us more flexibility in choosing the unicode backend for a port. + + * platform/text/TextEncoding.cpp: + (WebCore::TextEncoding::encode): + * platform/text/TextEncodingRegistry.cpp: + (WebCore::extendTextCodecMaps): + +2012-07-21 Patrick Gansterer <paroga@webkit.org> + + Remove unnecessary ICU header includes from SimpleFontDataWin.cpp + https://bugs.webkit.org/show_bug.cgi?id=91922 + + Reviewed by Kentaro Hara. + + This allows us to use SimpleFontDataWin with an other Unicode implementation too. + + * platform/graphics/win/SimpleFontDataWin.cpp: + +2012-07-21 Kwang Yul Seo <skyul@company100.net> + + A start tag whose tag name is "html" in the "in body" insertion mode is a parse error + https://bugs.webkit.org/show_bug.cgi?id=91916 + + Reviewed by Eric Seidel. + + According to the HTML5 spec, a start tag whose tag name is "html" in the "in body" + insertion mode is a parse error. + + Added HTMLTreeBuilder::processHtmlStartTagForInBody(AtomicHTMLToken&) to call parseError(token). + Removed "FIXME: parse error" from HTMLConstructionSite::insertHTMLHtmlStartTagInBody and + HTMLConstructionSite::insertHTMLBodyStartTagInBody because we already marked the call sites + of these two methods with parseError(token). + + No behavior change because parseError(token) is just a marker. + + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody): + (WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processStartTagForInBody): + (WebCore::HTMLTreeBuilder::processStartTag): + (WebCore::HTMLTreeBuilder::processHtmlStartTagForInBody): + (WebCore): + (WebCore::HTMLTreeBuilder::processStartTagForInHead): + * html/parser/HTMLTreeBuilder.h: + +2012-07-20 Czene Tamás <tczene@inf.u-szeged.hu> + + double data type shoud be changed to float in ColorMatrix + https://bugs.webkit.org/show_bug.cgi?id=91499 + + Reviewed by Nikolas Zimmermann. + + * platform/graphics/filters/FEColorMatrix.cpp: + (WebCore::matrix): + (WebCore::saturate): + (WebCore::huerotate): + (WebCore::luminance): + (WebCore::effectType): + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Take current transformation matrix into account when + deciding on resize algorithm for drawPattern. + https://bugs.webkit.org/show_bug.cgi?id=90624 + + Reviewed by Adrienne Walker. + + Since the pattern shader uses both the current transformation matrix + and the pattern matrix when transforming pixels, we need to + do the same when computing the resampling mode. Also removed the + resampling hint code, added in r60658, since it appears to be dead + (caller was removed in r76379). + + Covered by existing tests, such as + fast/borders/border-image-scale-transform.html. + + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::computeResamplingMode): + Pass in the matrix to be used for computing the destination width and + height (for awesome resampling). Remove the image resampling hint code. + (WebCore::paintSkBitmap): + Pass in the CTM to computeResamplingMode(). + (WebCore::Image::drawPattern): + Concatenate the CTM and the pattern matrix, and pass that to + computeResamplingMode() and TransformDimensions(). Invert the + CTM's scale and apply it to the pattern transform, so their + concatenation gives identity scale. + * platform/graphics/skia/PlatformContextSkia.cpp: + * platform/graphics/skia/PlatformContextSkia.h: + Remove the image resampling hint (dead code). + +2012-07-20 Kwang Yul Seo <skyul@company100.net> + + Anything else in the "in table" insertion mode is a parse error + https://bugs.webkit.org/show_bug.cgi?id=91915 + + Reviewed by Adam Barth. + + According to the HTML5 spec, anything else in the "in table" insertion mode is a parse error. + + No behavior change because parseError(token) is just a marker. + + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processEndTagForInTable): + +2012-07-20 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91846 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.make: + * GNUmakefile.am: + * css/html.css: + * html/HTMLDataListElement.cpp: + * html/HTMLDataListElement.h: + * html/HTMLDataListElement.idl: + * html/HTMLInputElement.cpp: + (WebCore): + (WebCore::HTMLInputElement::parseAttribute): + (WebCore::HTMLInputElement::insertedInto): + (WebCore::HTMLInputElement::removedFrom): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/HTMLInputElement.idl: + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::parseAttribute): + (WebCore::HTMLOptionElement::childrenChanged): + (WebCore): + * html/HTMLOptionElement.h: + (HTMLOptionElement): + * html/HTMLTagNames.in: + * html/InputType.cpp: + (WebCore): + * html/InputType.h: + (InputType): + * html/RangeInputType.cpp: + (WebCore): + * html/RangeInputType.h: + (RangeInputType): + * html/shadow/SliderThumbElement.cpp: + (WebCore::RenderSliderContainer::layout): + * page/DOMWindow.idl: + * platform/efl/RenderThemeEfl.cpp: + (WebCore): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + * platform/qt/RenderThemeQt.cpp: + (WebCore): + * platform/qt/RenderThemeQt.h: + (RenderThemeQt): + * rendering/RenderTheme.cpp: + (WebCore): + * rendering/RenderTheme.h: + (RenderTheme): + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore): + (WebCore::RenderThemeChromiumLinux::paintSliderTrack): + * rendering/RenderThemeChromiumLinux.h: + (RenderThemeChromiumLinux): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore): + (WebCore::RenderThemeChromiumWin::paintSliderTrack): + * rendering/RenderThemeChromiumWin.h: + (RenderThemeChromiumWin): + * rendering/RenderThemeMac.h: + (RenderThemeMac): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintSliderTrack): + (WebCore): + +2012-07-18 Ryosuke Niwa <rniwa@webkit.org> + + Unify HTMLCollection and DynamicNodeList + https://bugs.webkit.org/show_bug.cgi?id=91335 + + Reviewed by Anders Carlsson. + + This is the grand unification of HTMLCollection and DynamicNodeList. + + It merges implementations of item() and length() in ChildNodeList, DynamicNodeList, + and HTMLCollection. The unified implementation is based on the one used for HTMLCollection, + that has been improved over the last few days; see r122660 and r122672 for examples. + + There are five key changes: + 1. Made itemBeforeOrAfter aware of DynamicNodeList. + 2. itemBeforeOrAfter and related functions take and return Node* to support ChildNodeList. + 3. Renamed InvalidCollectionType to NodeListCollectionType since DynamicNodeLists need to be + identified itemBeforeOrAfter. + 4. Renamed itemAfter to virtualItemAfter in subclasses of HTMLCollection, and devirtualized + itemAfter used in common cases to avoid performance regressions. To make this intent clear, + SupportItemBefore and DoNotSupportItemBefore have been renamed to DoesNotOverrideItemAfter + and OverridesItemAfter. This change also help us detect a subclass of HTMLCollection that + passes in a wrong value to ItemBeforeSupportType by making forward iterations fail (hit an + assertion or doesn't iterate at all) as well as backward iterations. + 5. Restricted the use of elementsArrayOffset to subclasses that provide virtualItemAfter. + + This patch completes my effort to share code between HTMLCollection and DynamicNodeList. + + * dom/ChildNodeList.cpp: + (WebCore::ChildNodeList::ChildNodeList): + (WebCore): Removed length() and item(). + (WebCore::ChildNodeList::nodeMatches): + * dom/ChildNodeList.h: + (ChildNodeList): + * dom/ClassNodeList.cpp: + (WebCore::ClassNodeList::ClassNodeList): + * dom/Document.cpp: + (WebCore::Document::registerNodeListCache): + (WebCore::Document::unregisterNodeListCache): + * dom/DynamicNodeList.cpp: + (WebCore::DynamicNodeListCacheBase::invalidateCache): + (WebCore::DynamicNodeList::length): + (WebCore::DynamicNodeList::item): + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): Takes new boolean argument + shouldOnlyIncludeDirectChildren indicating whether the non-child descendents should be + included or not. This is necessary to identify ChildNodeList in itemBeforeOrAfter. + (WebCore::DynamicNodeListCacheBase::ownerNode): Moved from DynamicNodeListCacheBase and + HTMLCollectionCacheBase. + (WebCore::DynamicNodeListCacheBase::document): Moved from DynamicNodeListCacheBase. + (WebCore::DynamicNodeListCacheBase::rootNode): Ditto. + (WebCore::DynamicNodeListCacheBase::overridesItemAfter): Renamed from supportsItemBefore + and the return value has been negated. + (WebCore::DynamicNodeListCacheBase::shouldOnlyIncludeDirectChildren): Added. + (WebCore::DynamicNodeListCacheBase): + (WebCore::DynamicNodeList::DynamicNodeList): Takes NodeListType to determine the value of + shouldOnlyIncludeDirectChildren. + (DynamicNodeList): + (WebCore::DynamicSubtreeNodeList::~DynamicSubtreeNodeList): + (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList): + * dom/MicroDataItemList.cpp: + (WebCore::MicroDataItemList::MicroDataItemList): + * dom/NameNodeList.cpp: + (WebCore::NameNodeList::NameNodeList): + * dom/TagNodeList.cpp: + (WebCore::TagNodeList::TagNodeList): + * html/CollectionType.h: + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::HTMLAllCollection): + * html/HTMLCollection.cpp: + (WebCore::shouldOnlyIncludeDirectChildren): + (WebCore::rootTypeFromCollectionType): + (WebCore::invalidationTypeExcludingIdAndNameAttributes): + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::create): + (WebCore::HTMLCollection::~HTMLCollection): + (WebCore::isAcceptableElement): + (WebCore::firstNode): Extracted from itemBeforeOrAfter. + (WebCore::DynamicNodeListCacheBase::iterateForNextNode): Ditto. + (WebCore::DynamicNodeListCacheBase::itemBeforeOrAfter): Takes and returns Node*. + Special case ChildNodeList since there is no need to skip any node. When "this" is a + node list, call nodeMatches instead of isAcceptableElement. + (WebCore::DynamicNodeListCacheBase::itemBefore): No longer takes offsetInArray since + the use of elementsArrayOffset has been restricted to HTMLCollections that provides + virtualItemAfter. + (WebCore::DynamicNodeListCacheBase::itemAfter): Calls virtualItemAfter if necessary. + Otherwise assert offsetInArray is zero since we should never be using this variable + when virtualItemAfter is not provided. + (WebCore::DynamicNodeListCacheBase::isLastItemCloserThanLastOrCachedItem): + (WebCore::DynamicNodeListCacheBase::isFirstItemCloserThanCachedItem): + (WebCore::DynamicNodeListCacheBase::setItemCache): Updates m_cachedElementsArrayOffset + in HTMLCollection if and only if virtualItemAfter is provided. This is safe because + node lists never provide virtualItemAfter. + (WebCore::DynamicNodeListCacheBase::cachedElementsArrayOffset): Similarly, returns + m_cachedElementsArrayOffset if virtualItemAfter is provided. + (WebCore::DynamicNodeListCacheBase::lengthCommon): + (WebCore::DynamicNodeListCacheBase::itemCommon): Note that supportsItemBefore() is + equivalent to !overridesItemAfter() here. + (WebCore::DynamicNodeListCacheBase::itemBeforeOrAfterCachedItem): Uses Node* through + out the function. Since itemBefore never uses offsetInArray, always sets 0 for that. + Note that we never call itemBefore and virtualItemAfter on the same object. + (WebCore::HTMLCollection::virtualItemAfter): Added only to make the class "concrete". + (WebCore::HTMLCollection::namedItem): + (WebCore::HTMLCollection::updateNameCache): + (WebCore::HTMLCollection::tags): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollectionCacheBase): + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): + (WebCore::HTMLCollection::base): + (HTMLCollection): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::HTMLFormCollection): + (WebCore::HTMLFormCollection::virtualItemAfter): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::HTMLNameCollection): + (WebCore::HTMLNameCollection::virtualItemAfter): + * html/HTMLNameCollection.h: + (HTMLNameCollection): + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::HTMLOptionsCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + (WebCore::HTMLPropertiesCollection::virtualItemAfter): + (WebCore::HTMLPropertiesCollection::updateNameCache): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): + (WebCore::HTMLTableRowsCollection::virtualItemAfter): + * html/HTMLTableRowsCollection.h: + (HTMLTableRowsCollection): + * html/LabelsNodeList.cpp: + (WebCore::LabelsNodeList::LabelsNodeList): + * html/RadioNodeList.cpp: + (WebCore::RadioNodeList::RadioNodeList): + +2012-07-20 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Simplify backend interface classes + https://bugs.webkit.org/show_bug.cgi?id=91901 + + Reviewed by Tony Chang. + + The IDBTransactionBackendInterface included several methods only used by the + real implementation objects, not via the interfaces. Expose a static Impl::from(Interface) + method for transaction, and migrate all of the backend-internal uses from Interface to Impl. + + No new tests - no functional changes. + + * Modules/indexeddb/IDBCursorBackendImpl.cpp: + (WebCore::IDBCursorBackendImpl::IDBCursorBackendImpl): + * Modules/indexeddb/IDBCursorBackendImpl.h: + (WebCore): + (WebCore::IDBCursorBackendImpl::create): + (IDBCursorBackendImpl): + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::createObjectStore): + (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal): + (WebCore::IDBDatabaseBackendImpl::objectStore): + (WebCore::IDBDatabaseBackendImpl::deleteObjectStore): + (WebCore::IDBDatabaseBackendImpl::deleteObjectStoreInternal): + (WebCore::IDBDatabaseBackendImpl::setVersion): + (WebCore::IDBDatabaseBackendImpl::setVersionInternal): + (WebCore::IDBDatabaseBackendImpl::transactionStarted): + (WebCore::IDBDatabaseBackendImpl::transactionFinished): + (WebCore::IDBDatabaseBackendImpl::transaction): + * Modules/indexeddb/IDBDatabaseBackendImpl.h: + (WebCore): + (IDBDatabaseBackendImpl): + * Modules/indexeddb/IDBIndexBackendImpl.cpp: + (WebCore::IDBIndexBackendImpl::openCursorInternal): + (WebCore::IDBIndexBackendImpl::openCursor): + (WebCore::IDBIndexBackendImpl::openKeyCursor): + (WebCore::IDBIndexBackendImpl::countInternal): Drop unused transaction argument. + (WebCore::IDBIndexBackendImpl::count): + (WebCore::IDBIndexBackendImpl::get): + (WebCore::IDBIndexBackendImpl::getKey): + * Modules/indexeddb/IDBIndexBackendImpl.h: + (IDBIndexBackendImpl): + * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::get): + (WebCore::IDBObjectStoreBackendImpl::put): + (WebCore::IDBObjectStoreBackendImpl::putWithIndexKeys): + (WebCore): + (WebCore::IDBObjectStoreBackendImpl::putInternal): + (WebCore::IDBObjectStoreBackendImpl::deleteFunction): + (WebCore::IDBObjectStoreBackendImpl::clear): + (WebCore::IDBObjectStoreBackendImpl::createIndex): + (WebCore::IDBObjectStoreBackendImpl::createIndexInternal): + (WebCore::IDBObjectStoreBackendImpl::deleteIndex): + (WebCore::IDBObjectStoreBackendImpl::deleteIndexInternal): + (WebCore::IDBObjectStoreBackendImpl::openCursor): + (WebCore::IDBObjectStoreBackendImpl::openCursorInternal): + (WebCore::IDBObjectStoreBackendImpl::count): + (WebCore::IDBObjectStoreBackendImpl::countInternal): Drop unused transaction argument. + * Modules/indexeddb/IDBObjectStoreBackendImpl.h: + (WebCore): + (IDBObjectStoreBackendImpl): + * Modules/indexeddb/IDBTransactionBackendImpl.cpp: + (WebCore::IDBTransactionBackendImpl::objectStore): + * Modules/indexeddb/IDBTransactionBackendImpl.h: + (WebCore::IDBTransactionBackendImpl::from): + (IDBTransactionBackendImpl): + (WebCore::IDBTransactionBackendImpl::mode): + * Modules/indexeddb/IDBTransactionBackendInterface.h: + (IDBTransactionBackendInterface): + +2012-07-20 Joshua Bell <jsbell@chromium.org> + + IndexedDB: "ASSERTION FAILED: !m_requestFinished" hit in IDBRequest::dispatchEvent + https://bugs.webkit.org/show_bug.cgi?id=86911 + + Reviewed by Tony Chang. + + Clean up the IDBRequest/IDBCursor relationship and the IDBRequest lifecycle. + + The IDBRequest's m_cursor/setCursor() calls are renamed to m_pendingCursor/setPendingCursor() to + clarify that the request will move between two states - either there's a cursor request in-flight + c/o a continue() or advance() call, or the result has come in (cursor, null-for-done, or error). + Since they were only ever used together, resetReadyState() is merged into setResultCursor(). The + m_requestFinished flag becomes redundant and is dropped - the ASSERT reported in the bug + becomes an ASSERT(m_readyState == PENDING) and m_readyState tracking is already correct. + + Test: storage/indexeddb/request-continue-abort.html + + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::advance): Unreachable code path now dead and gone. + (WebCore::IDBCursor::continueFunction): Ditto. + * Modules/indexeddb/IDBRequest.cpp: Most functions just add state assertions. + (WebCore::IDBRequest::IDBRequest): + (WebCore::IDBRequest::abort): + (WebCore::IDBRequest::setCursorDetails): + (WebCore::IDBRequest::setPendingCursor): Merge with old resetReadyState(). + (WebCore): + (WebCore::IDBRequest::getResultCursor): Helper, since digging cursor out of IDBAny is pesky. + (WebCore::IDBRequest::setResultCursor): Just moved in the file to be with its friends. + (WebCore::IDBRequest::finishCursor): + (WebCore::IDBRequest::onError): Just assertions, re-ordering, re-naming. + (WebCore::IDBRequest::onSuccess): + (WebCore::IDBRequest::onSuccessWithContinuation): + (WebCore::IDBRequest::hasPendingActivity): + (WebCore::IDBRequest::dispatchEvent): Simplify! + (WebCore::IDBRequest::enqueueEvent): + * Modules/indexeddb/IDBRequest.h: + (IDBRequest): + +2012-07-20 Andrew Scherkus <scherkus@chromium.org> + + [chromium] Don't display fullscreen button for video elements not containing video + https://bugs.webkit.org/show_bug.cgi?id=91811 + + Reviewed by Eric Carlson. + + Covered by media/media-document-audio-repaint.html + + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlRootElementChromium::reset): + +2012-07-20 Dmitry Titov <dimich@chromium.org> + + [Chromium] Out of Memory is observed when a large object is passed to a Web Worker. + https://bugs.webkit.org/show_bug.cgi?id=91535. + + Reviewed by David Levin. + + No new tests because of no new behavior and lack of mechanism to monitor used memory. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::SerializedScriptValue): + (WebCore::SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext): + (WebCore): + (WebCore::SerializedScriptValue::~SerializedScriptValue): + * bindings/v8/SerializedScriptValue.h: + (SerializedScriptValue): + Added a method to SerializedScriptValue to add memory pressure on GC proportional to the size of memory allocated in serialized data. + + * dom/MessageEvent.cpp: + (WebCore::MessageEvent::MessageEvent): + (WebCore::MessageEvent::initMessageEvent): + Call the new method of SerializedScriptValue during creation of MessageEvent (presumably in the thread which contains the right V8 context). + +2012-07-20 David Grogan <dgrogan@chromium.org> + + IndexedDB: Include intVersion when converting between WebCore and WebKit IDBMetadata types + https://bugs.webkit.org/show_bug.cgi?id=91414 + + Reviewed by Adam Barth. + + No new tests because no new behavior. + + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::metadata): + No behavior change, this just needs a dummy parameter to match the + modified API. + + * Modules/indexeddb/IDBMetadata.h: + (WebCore::IDBDatabaseMetadata::IDBDatabaseMetadata): + (IDBDatabaseMetadata): + +2012-07-18 Gustavo Noronha Silva <gustavo.noronha@collabora.com> + + [Soup] Unnecessary RefPtr usage and null check + https://bugs.webkit.org/show_bug.cgi?id=91636 + + Reviewed by Martin Robinson. + + Small clean up of code that is not necessary; no change in functionality. + + * platform/network/soup/SocketStreamHandleSoup.cpp: + (WebCore::SocketStreamHandle::connected): + +2012-07-20 Mark Salisbury <mark.salisbury@hp.com> + + Typo in FontCacheWin.cpp causes return value from getCachedFontData() in getLastResortFallbackFont() to be ignored + https://bugs.webkit.org/show_bug.cgi?id=91506 + + Reviewed by Joseph Pecoraro. + + No new test. The "fallback fallback" code ends up creating a font, so you always + get a fallback font even with this code bug. A test would be buggy, being highly + platform dependent on what the "fallback fallback" font is on the particular + windows machine the test runs on. + + * platform/graphics/win/FontCacheWin.cpp: + (WebCore::FontCache::getLastResortFallbackFont): + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Clean up scratch texture usage in Chromium's implementation + of GPU-accelerated filters. + https://bugs.webkit.org/show_bug.cgi?id=83370 + + Reviewed by Adrienne Walker. + + There didn't used to be a safe way to allocate a scratch texture, and + hold into it beyond the lifetime of GrAutoScratchTexture. Now there is: + detach(). + + Covered by existing tests in css3/filters. + + * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp: + (WebCore::CCRenderSurfaceFilters::apply): + Use a GrAutoScratchTexture to allocate the destination texture, and + detach() to detach it from the cache before placing it in an + SkGrTexturePixelRef. This means we no longer need to do any lock/ + unlock trickery with the TextureCacheEntry, since the refcount is + enough to keep the texture away from the cache's prying hands. + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Clean up scratch texture usage in Chromium's implementation + of GPU-accelerated filters. + https://bugs.webkit.org/show_bug.cgi?id=83370 + + Reviewed by Adrienne Walker. + + There didn't used to be a safe way to allocate a scratch texture, and + hold into it beyond the lifetime of GrAutoScratchTexture. Now there is: + detach(). + + Covered by existing tests in css3/filters. + + * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp: + (WebCore::CCRenderSurfaceFilters::apply): + Use a GrAutoScratchTexture to allocate the destination texture, and + detach() to detach it from the cache before placing it in an + SkGrTexturePixelRef. This means we no longer need to do any lock/ + unlock trickery with the TextureCacheEntry, since the refcount is + enough to keep the texture away from the cache's prying hands. + +2012-07-19 Andrew Scherkus <scherkus@chromium.org> + + [chromium] CSS tweaks to media controls to prevent styles from being overridden + https://bugs.webkit.org/show_bug.cgi?id=91802 + + Reviewed by Eric Carlson. + + Having the buttons declared as inline caused them to not be included in the box layout, + resulting in styles set outside the media element to affect the position of the buttons. + + In a similar vein, it was also possible to override the font-style attribute for the time + display. + + Test: media/controls-styling-strict.html + + * css/mediaControlsChromium.css: + (audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button): + (audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button): + (audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display): + (audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button): + +2012-07-20 Han Shen <shenhan@google.com> + + [Chromium] Compilation fails under gcc 4.7 + https://bugs.webkit.org/show_bug.cgi?id=90227 + + Reviewed by Tony Chang. + + Disable warnings about c++0x compatibility in gcc newer than 4.6. + + * WebCore.gyp/WebCore.gyp: + +2012-07-20 Vincent Scheib <scheib@chromium.org> + + Unreviewed compile fix, r123247 included unintended changes to Document.cpp. + + See http://trac.webkit.org/changeset/123247. + + * dom/Document.cpp: + (WebCore::Document::webkitExitPointerLock): + +2012-07-20 Ryosuke Niwa <rniwa@webkit.org> + + REGRESSION(r122873): 15% regression on Dromaeo/dom-attr + https://bugs.webkit.org/show_bug.cgi?id=91827 + + Reviewed by Anders Carlsson. + + Move shouldInvalidateNodeListCaches from Document.cpp to Node.cpp since it's only called + in Node::invalidateNodeListCachesInAncestors. + + Test: PerformanceTests/Dromaeo/dom-attr.html. + + * dom/Document.cpp: + (WebCore): + * dom/Node.cpp: + (WebCore::shouldInvalidateNodeListCachesForAttr): Extracted from shouldInvalidateNodeListCaches + to unroll the loop in shouldInvalidateNodeListCaches. Apparently gcc wasn't doing the right thing. + (WebCore::Document::shouldInvalidateNodeListCaches): + (WebCore::Document::invalidateNodeListCaches): + (WebCore::Node::invalidateNodeListCachesInAncestors): + +2012-07-20 Nico Weber <thakis@chromium.org> + + Fix more -Wunused-private-field violations + https://bugs.webkit.org/show_bug.cgi?id=91876 + + Reviewed by Adam Barth. + + As of http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120716/061102.html + the warning finds more bugs. Fix them. + + * html/FTPDirectoryDocument.cpp: + (FTPDirectoryDocumentParser): + (WebCore::FTPDirectoryDocumentParser::FTPDirectoryDocumentParser): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + * html/parser/HTMLTreeBuilder.h: + (HTMLTreeBuilder): + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlRootElementChromium::MediaControlRootElementChromium): + * html/shadow/MediaControlRootElementChromium.h: + (MediaControlRootElementChromium): + * inspector/InspectorDOMStorageResource.cpp: + (WebCore::InspectorDOMStorageResource::InspectorDOMStorageResource): + * inspector/InspectorDOMStorageResource.h: + (InspectorDOMStorageResource): + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (Settings): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::CCThreadProxy): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + * rendering/svg/RenderSVGTextPath.cpp: + (WebCore::RenderSVGTextPath::RenderSVGTextPath): + * rendering/svg/RenderSVGTextPath.h: + +2012-07-20 Adam Klein <adamk@chromium.org> + + CodeGeneratorInspector.py is unnecessarily chatty + https://bugs.webkit.org/show_bug.cgi?id=91758 + + Reviewed by Vsevolod Vlasov. + + The code aded in r123091 included a "print" statement for each written + file. This makes for noisy build output, especially noticeable in the + Chromium ninja build (where build output takes up a single line of the + console). + + If this print statement is generally useful, it should be + hidden behind a --verbose commandline option, as we do for the binding + generators. + + * inspector/CodeGeneratorInspector.py: + (SmartOutput.close): Remove print statement. + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Enable GPU-accelerated skia implementation of + feDiffuseLighting, feSpecularLighting. + https://bugs.webkit.org/show_bug.cgi?id=91865 + + Reviewed by Dirk Schulze. + + Translate the light parameters into the appropriate + SkLightingImageFilter calls. This path is only enabled when + the filters are created with the Accelerated flag set. + + This will be covered by tests in svg/filters/* when they are + added to the virtual GPU tests. + + * WebCore.gypi: + * platform/graphics/filters/FELighting.h: + (FELighting): + * platform/graphics/filters/skia/FELightingSkia.cpp: Added. + (WebCore): + (WebCore::FELighting::platformApplySkia): + +2012-07-20 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: disable fake workers inspection. + https://bugs.webkit.org/show_bug.cgi?id=91867 + + Reviewed by Vsevolod Vlasov. + + 'Fake workers' is unreliable error-prone way to debug workers. There are a + lot of frameworks supporting it. Inspector should not do that since it has a more + powerful native worker inspection capabilities. Port owners should enable it + in case they want to provide workers debugging. + + * English.lproj/localizedStrings.js: + * WebCore.gypi: + * WebCore.order: + * WebCore.vcproj/WebCore.vcproj: + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::InjectedScriptHost): + * inspector/InjectedScriptHost.h: + (InjectedScriptHost): + * inspector/InjectedScriptHost.idl: + * inspector/Inspector.json: + * inspector/InspectorAgent.cpp: + (WebCore::InspectorAgent::didCommitLoad): + (WebCore::InspectorAgent::enable): + * inspector/InspectorAgent.h: + (WebCore): + (InspectorAgent): + * inspector/InspectorInstrumentation.cpp: + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + * inspector/front-end/InjectedFakeWorker.js: Removed. + * inspector/front-end/ScriptsPanel.js: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/WorkersSidebarPane.js: + (WebInspector.WorkersSidebarPane): + * inspector/front-end/externs.js: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + * workers/AbstractWorker.cpp: + (WebCore::AbstractWorker::contextDestroyed): + * workers/AbstractWorker.h: + (AbstractWorker): + * workers/SharedWorker.cpp: + (WebCore::SharedWorker::create): + * workers/Worker.cpp: + (WebCore::Worker::create): + +2012-07-20 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123182. + http://trac.webkit.org/changeset/123182 + https://bugs.webkit.org/show_bug.cgi?id=91863 + + Causing ASSERT crashes in tests accessibility/canvas.html and + accessibility/canvas-accessibilitynodeobject.html (Requested + by jernoble on #webkit). + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * accessibility/AXObjectCache.cpp: + (WebCore): + * accessibility/AXObjectCache.h: + (AXObjectCache): + * accessibility/AccessibilityARIAGrid.cpp: + (WebCore::AccessibilityARIAGrid::AccessibilityARIAGrid): + (WebCore::AccessibilityARIAGrid::~AccessibilityARIAGrid): + (WebCore): + (WebCore::AccessibilityARIAGrid::create): + * accessibility/AccessibilityARIAGrid.h: + (AccessibilityARIAGrid): + * accessibility/AccessibilityARIAGridCell.cpp: + (WebCore::AccessibilityARIAGridCell::create): + * accessibility/AccessibilityARIAGridRow.cpp: + (WebCore::AccessibilityARIAGridRow::create): + * accessibility/AccessibilityAllInOne.cpp: + * accessibility/AccessibilityList.cpp: + (WebCore::AccessibilityList::create): + * accessibility/AccessibilityListBox.cpp: + (WebCore::AccessibilityListBox::create): + * accessibility/AccessibilityMediaControls.cpp: + (WebCore::AccessibilityMediaControl::create): + (WebCore::AccessibilityMediaControlsContainer::create): + (WebCore::AccessibilityMediaTimeline::create): + (WebCore::AccessibilityMediaTimeDisplay::create): + * accessibility/AccessibilityMenuList.cpp: + * accessibility/AccessibilityMenuList.h: + (WebCore::AccessibilityMenuList::create): + * accessibility/AccessibilityNodeObject.cpp: Removed. + * accessibility/AccessibilityNodeObject.h: Removed. + * accessibility/AccessibilityObject.h: + (AccessibilityObject): + * accessibility/AccessibilityProgressIndicator.cpp: + (WebCore::AccessibilityProgressIndicator::create): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::AccessibilityRenderObject): + (WebCore::AccessibilityRenderObject::create): + (WebCore::AccessibilityRenderObject::detach): + (WebCore::AccessibilityRenderObject::remapAriaRoleDueToParent): + (WebCore): + (WebCore::AccessibilityRenderObject::determineAriaRoleAttribute): + (WebCore::AccessibilityRenderObject::ariaRoleAttribute): + (WebCore::AccessibilityRenderObject::updateAccessibilityRole): + (WebCore::AccessibilityRenderObject::canSetFocusAttribute): + (WebCore::AccessibilityRenderObject::childrenChanged): + (WebCore::AccessibilityRenderObject::canHaveChildren): + (WebCore::AccessibilityRenderObject::addChildren): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + (WebCore::AccessibilityRenderObject::setRenderer): + * accessibility/AccessibilitySlider.cpp: + (WebCore::AccessibilitySlider::create): + * accessibility/AccessibilityTable.cpp: + (WebCore::AccessibilityTable::AccessibilityTable): + (WebCore::AccessibilityTable::~AccessibilityTable): + (WebCore): + (WebCore::AccessibilityTable::create): + * accessibility/AccessibilityTable.h: + (AccessibilityTable): + * accessibility/AccessibilityTableCell.cpp: + (WebCore::AccessibilityTableCell::create): + * accessibility/AccessibilityTableRow.cpp: + (WebCore::AccessibilityTableRow::create): + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Proxy configuration should honor the no_proxy environment variable + https://bugs.webkit.org/show_bug.cgi?id=91747 + + Reviewed by Kenneth Rohde Christiansen. + + Implement a custom Proxy URI Resolver for libsoup + so that we can use it in EFL port. This custom + proxy resolver brings support for setting + exceptions so that the proxy is not used for the + specified hosts. + + By default, the proxy is not used for localhost and + 127.0.0.1. + + No new tests, no behavior change for layout tests. + + * PlatformEfl.cmake: + * platform/network/soup/ProxyResolverSoup.cpp: Added. + (soup_proxy_resolver_wk_init): + (soupProxyResolverWkFinalize): + (soupProxyResolverWkSetProperty): + (soupProxyResolverWkGetProperty): + (shouldBypassProxy): + (idle_return_proxy_uri): + (soupProxyResolverWkGetProxyURIAsync): + (soupProxyResolverWkGetProxyURISync): + (soup_proxy_resolver_wk_class_init): + (soup_proxy_resolver_wk_interface_init): + (soupProxyResolverWkNew): + * platform/network/soup/ProxyResolverSoup.h: Added. + +2012-07-20 Pierre Rossi <pierre.rossi@gmail.com> + + ColorChooserClient should expose the element's location + https://bugs.webkit.org/show_bug.cgi?id=91767 + + Reviewed by Kent Tamura. + + The rationale is that the chrome client could have an interest in placing the picker next to + the element for usability reasons. + + No new tests as there is not much logic here: Just exposing a geometry information to WebKit. + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::elementRectRelativeToWindow): + (WebCore): + * html/ColorInputType.h: + (ColorInputType): + * platform/ColorChooserClient.h: + (ColorChooserClient): + +2012-07-20 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [WK2] WebIntents doesn't build if mutation observers is disabled + https://bugs.webkit.org/show_bug.cgi?id=91839 + + Reviewed by Kenneth Rohde Christiansen. + + WebIntents was depending on a code protected by ENABLE(MUTATION_OBSERVERS). + Now the code is also enabled by ENABLE(WEB_INTENTS). + + * bindings/js/JSDictionary.cpp: + (WebCore): + * bindings/js/JSDictionary.h: + +2012-07-20 Mihnea Ovidenie <mihnea@adobe.com> + + [CSSRegions]Assert failure when layout positioned objects in regions + https://bugs.webkit.org/show_bug.cgi?id=90792 + + Reviewed by Andreas Kling. + + Before clamping the containing block (for an out-of-flow positioned element + inside a named flow) to the region, we have to test whether the region is not + null, which can happen when the named flow does not have attached regions. + + Tests: fast/regions/positioned-vrl-in-named-flow.html + fast/regions/positioned-vrl-in-parent-named-flow.html + fast/regions/positioned-with-vrl-parent-in-named-flow.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::containingBlockLogicalWidthForPositioned): + (WebCore::RenderBox::computePositionedLogicalWidth): + (WebCore::RenderBox::computePositionedLogicalHeight): + +2012-07-20 Stephen Chenney <schenney@chromium.org> + + SVG Filter Effect sub-region not applied for some filters + https://bugs.webkit.org/show_bug.cgi?id=89767 + + Reviewed by Dirk Schulze. + + The filter effect region for SVG feGaussian and feDropShadow filters + was incorrectly set, failing to account for the radius of the blur. + This patch fixes the problem and removes an unneccessary clip + operation when the filter result is blitted into the target. That clip + was clipping the shadow from webkit-shadow. + + Tests: svg/filters/feDropShadow-subregion.svg + svg/filters/feGaussianBlur-subregion.svg + + * platform/graphics/filters/FEDropShadow.cpp: + (WebCore::FEDropShadow::determineAbsolutePaintRect): Moved the code + that clips the paint rect by the filter effect subregion to come after + the paint is modified by the filter radius. + * platform/graphics/filters/FEGaussianBlur.cpp: + (WebCore::FEGaussianBlur::determineAbsolutePaintRect): + Moved the code that clips the paint rect by the filter effect subregion to + come after the paint is modified by the filter radius. + * rendering/svg/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::postApplyResource): + Removed a clip that is unnecessary and that was incorrectly clipping drop shadows. + +2012-07-19 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: Status bar icons are misaligned by 1px to the right + https://bugs.webkit.org/show_bug.cgi?id=91757 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/inspector.css: + (.glyph): + (.glyph.shadow): + +2012-07-20 Andrei Poenaru <poenaru@adobe.com> + + Web Inspector: Protocol Extension: add getNamedFlowCollection command + https://bugs.webkit.org/show_bug.cgi?id=91607 + + Reviewed by Pavel Feldman. + + Extended the protocol with "getNamedFlowCollection" command. + This command returns the CSS Named Flows from the document. + + Test: inspector/styles/protocol-getNamedFlowCollection-command.html + + * dom/WebKitNamedFlowCollection.cpp: + (WebCore::WebKitNamedFlowCollection::namedFlowsNames): + (WebCore): + * dom/WebKitNamedFlowCollection.h: + (WebKitNamedFlowCollection): + * inspector/Inspector.json: + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::getNamedFlowCollection): + (WebCore): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::assertDocument): + (WebCore): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync): + +2012-07-20 Eugene Klyuchnikov <eustas.big@gmail.com> + + Web Inspector: Timeline: forward compatibility for load. + https://bugs.webkit.org/show_bug.cgi?id=91714 + + Reviewed by Pavel Feldman. + + Accept records of unrecognized types and render them as "unknown". + + Test: inspector/timeline/timeline-load-incompatible.html + + * English.lproj/localizedStrings.js: Added UI string. + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.recordStyle): Add missing record + styles at runtime. + (WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails): + Add some common information for default case. + +2012-07-20 MORITA Hajime <morrita@google.com> + + Another unreviewed Mac build fix against r123184. + + * WebCore.exp.in: + +2012-07-20 Mihnea Ovidenie <mihnea@adobe.com> + + [CSSRegions]Crash when flowing a region into itself + https://bugs.webkit.org/show_bug.cgi?id=90289 + + Reviewed by Andreas Kling. + + If a region is designed to receive itself as content through a named flow, we avoid + a circular dependency by not attaching the region to the desired named flow. + In such occasions, the region's attached flow thread object is null and + we have to check this pointer before using it in RenderRegion::styleDidChange. + + Test: fast/regions/flow-region-into-itself-crash.html + + * rendering/RenderRegion.cpp: + (WebCore::RenderRegion::styleDidChange): + +2012-07-20 MORITA Hajime <morrita@google.com> + + Unreviewed Mac build fix against r123184. + + * WebCore.exp.in: + +2012-07-17 Kinuko Yasuda <kinuko@chromium.org> + + If value for responseType defined as type that not supported, it should not throw an exception in XHR 2 + https://bugs.webkit.org/show_bug.cgi?id=90976 + + Reviewed by Alexey Proskuryakov. + + http://www.w3.org/TR/XMLHttpRequest2/#the-responsetype-attribute + The spec does not say it should throw an exception when a non-supported + type is set, and other browsers do not throw it either. + + Test: fast/xmlhttprequest/xmlhttprequest-responsetype-set-type.html + + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::setResponseType): Stop throwing an exception when non-supported type is given. + +2012-07-20 Matt Falkenhagen <falken@chromium.org> + + Show or hide <dialog> depending on the open attribute + https://bugs.webkit.org/show_bug.cgi?id=90931 + + Reviewed by Kent Tamura. + + Test: fast/dom/HTMLDialogElement/dialog-open.html + + * css/html.css: Add CSS for dialog. This is copied verbatim from the HTML5 spec: http://www.whatwg.org/specs/web-apps/current-work/#flow-content-1 + (dialog:not([open])): + (dialog): + * html/HTMLDialogElement.cpp: + (WebCore::HTMLDialogElement::close): Set open to false, to hide the dialog. + (WebCore::HTMLDialogElement::show): Set open to true, to show the dialog. + (WebCore): + (WebCore::HTMLDialogElement::isPresentationAttribute): Make openAttr a presentation attribute, to work around bug 91058 + * html/HTMLDialogElement.h: + (HTMLDialogElement): + * html/HTMLDialogElement.idl: + +2012-07-20 Shinya Kawanaka <shinyak@chromium.org> + + Needs pseudo id to point the inner element of an img elemnet for styling + https://bugs.webkit.org/show_bug.cgi?id=91590 + + Reviewed by Hajime Morita. + + We introduce pseudo id to point the element in UserAgentShadowDOM. + This enables us to style the inner element of an img element shadow. + Please see also http://trac.webkit.org/wiki/ShadowDOMForReplacedElements + + Test: fast/dom/shadow/shadowdom-for-image-with-pseudo-id.html + + * html/shadow/ImageInnerElement.cpp: + (WebCore::ImageInnerElement::shadowPseudoId): + (WebCore): + * html/shadow/ImageInnerElement.h: + (ImageInnerElement): + +2012-07-20 Kent Tamura <tkent@chromium.org> + + REGRESSION(r121420): Performance regression of form state saving for pages with multiple forms + https://bugs.webkit.org/show_bug.cgi?id=91804 + + Reviewed by Hajime Morita. + + The complexity of FormKeyGenerator::formKey() was O(N) where N is the + number of form elements with an identical action URL, and formKey() is + called for every form. So, it's O(N^2). A page in www.reddit.com + contains hundreds of form elements with action="#". So FormController:: + formElementsState() took a few seconds on a slow machine. + + In order to avoid O(N^2) operation, storing a map from form signatures + to next index numbers, instead of storing existing formKey strings. + + No new tests. Just a performance improvement. + + * html/FormController.cpp: + (FormKeyGenerator): Remove m_existingKeys. Add a map from a form + signature string to the next index number. + (WebCore::formSignature): Returns a signature string for a form, without + an index number. This is like "actionURL [name1 name2 ]" + (WebCore::FormKeyGenerator::formKey): + Creates a formKey string by concatenating a formSignature and #n. N is + obtained from m_formSignatureToNextIndexMap in O(1). + (WebCore::FormKeyGenerator::willDeleteForm): + Remove the code for m_existingKeys. + +2012-07-20 Keishi Hattori <keishi@webkit.org> + + Fix crash in WebCore::HTMLInputElement::dataList + https://bugs.webkit.org/show_bug.cgi?id=91818 + + Reviewed by Kent Tamura. + + Fix crash that occurs when setting slider appearance on a regular node. + + Test: fast/forms/range/slider-appearance-crash.html + + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::paintSliderTicks): Check if node is an input element. + +2012-07-20 Kent Tamura <tkent@chromium.org> + + [Chromium] Fix an assertion failure in TextFieldDecorationElement::hostInput() + https://bugs.webkit.org/show_bug.cgi?id=91824 + + Reviewed by Hajime Morita. + + No new tests. This code is used only in Chromium browser. + + * html/shadow/TextFieldDecorationElement.cpp: + (WebCore::TextFieldDecorationElement::hostInput): + Use shadowHost(), and allow to return 0. + (WebCore::TextFieldDecorationElement::defaultEventHandler): + Check 0. + +2012-07-19 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Compile WebCore without QtWidgets + https://bugs.webkit.org/show_bug.cgi?id=91819 + + Reviewed by Kenneth Rohde Christiansen. + + * WebCore.pri: QT += opengl is not needed for Qt 5, given that QtGui has OpenGL + support built in with the QOpenGL* classes. + +2012-07-19 MORITA Hajime <morrita@google.com> + + [Refactoring] Replace Node's Document pointer with a TreeScope pointer + https://bugs.webkit.org/show_bug.cgi?id=59816 + + Reviewed by Ryosuke Niwa. + + Before this change, Node::treeScope() fetches the TreeScope object + from ElementRareData. This approach has several shortcomings: + + - rareData() call is slow due to a hashtable lookup. + - In shadow tree, each node has its tree scope in ElementRareData, + that means the rare-data is no longer rare in that case. + + This change gets rid of ElementRareData::m_treeScope by replacing + Node::m_document with Node::m_treeScope. And retrieves the + document of Node through m_treeScope. + + Note that Node::document() is a hot function and naive + replacemennt of m_document with m_treeScope can hurt the + speed. This change employs some tricks to address it. + + - This change introduces Node::InShadowTree flag, if the flag is off, + that means m_treeScope is actually a document an can be returned as the result. + this eliminates an extract dereference. + - Node::m_treeScope can be null. But we don't want to issue any extra + conditional statement. So this change represents a null + TreeScope as TreeScope::nullInstance(), which saves one conditional + statement. + + With these changes, the Node::document() slowdown is minimized to + unnoticeable size. + + No new tests. Covered by existing tests. + + * dom/Document.cpp: Took care of connectio betwen TreeScope. + (WebCore::Document::Document): + (WebCore::Document::~Document): + (WebCore::Document::suggestedMIMEType): + * dom/Document.h: + (WebCore::Node::treeScope): Now just return m_treeScope, taking care of nullInstance() case. + (WebCore): + (WebCore::Node::setTreeScope): Now just sets m_treeScope. + (WebCore::Node::documentInternal): Extracted from document() to have ASSERT-free version. + (WebCore::Node::document): Re-implemented over treeScope() and the flag. + (WebCore::Node::isDocumentNode): Re-implemented using treeScope() + (WebCore::Node::Node): + * dom/Node.cpp: + (WebCore::Node::~Node): + (WebCore::Node::reportMemoryUsage): + * dom/Node.h: + (Node): + (WebCore::Node::inDocument): + (WebCore::Node::isInShadowTree): Rewrote to use InShadowTree flag. + * dom/NodeRareData.h: + (WebCore::NodeRareData::NodeRareData): Eliminated m_treeScope. + (NodeRareData): + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::ShadowRoot): + * dom/TreeScope.cpp: + (WebCore::TreeScope::TreeScope): + (WebCore): + (WebCore::TreeScope::setParentTreeScope): Added. + (WebCore::TreeScope::isDocumentScope): Added. + (WebCore::TreeScope::nullInstance): Added. + * dom/TreeScope.h: Added m_parentTreeScope. + (WebCore): + (WebCore::TreeScope::rootDocument): Added. + (TreeScope): + * dom/TreeScopeAdopter.cpp: No longer calls setDocument() + (WebCore::TreeScopeAdopter::moveTreeToNewScope): + (WebCore::TreeScopeAdopter::moveNodeToNewDocument): + * editing/MoveSelectionCommand.cpp: Includes Document.h to find inlined Node functions + * editing/RemoveNodeCommand.cpp: Includes Document.h to find inlined Node functions + * editing/RemoveNodePreservingChildrenCommand.cpp: Includes Document.h to find inlined Node functions + * inspector/PageConsoleAgent.cpp: Includes Document.h to find inlined Node functions + +2012-07-19 David Hyatt <hyatt@apple.com> + + SVG not properly respecting max-width. + https://bugs.webkit.org/show_bug.cgi?id=91474 + + My previous checkin for 91474 accidentally inverted width and height in the division case for + the computation of height. When I fixed this inversion, I discovered that <object> elements + are in fact also broken with max-width handling, and that furthermore, trying to apply the same + max-width fix by calling RenderBox::computeReplacedLogicalWidth/Height failed because those methods + call intrinsicLogicalWidth()/Height(). Becuase m_intrinsicSize is out-of-date and does not reflect + the values we just obtained from the contentRenderer, we use the default 300x150 values for object + and fail to render. + + In order to both fix SVG/<object> with max-width constraints and to keep <object> rendering correctly + even when there are no max-width constraints, I was forced to update the m_intrinsicSize immediately + in order to make sure that the RenderBox methods returned the right values when computing the width/height + constrained to max/min-width/height values. + + Reviewed by Dan Bernstein. + + Added two new tests in svg/as-image. One test covers non-rectangular images to test for the inversion + mistake I made. The second test applies a max-width to <object> and shows that we have never gotten + this right before. An existing test in svg/as-image/ already covers basic <object> use (and tests that + the intrinsic size of 300x150 is not used when an explicit non-percentage size is specified on the SVG + itself). + + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): + Add a check to update m_intrinsicSize when we know it should apply, so that the calls to check against + min/max-width fetch this correct size. + + * rendering/RenderReplaced.h: + (RenderReplaced): + Make m_intrinsicSize mutable because of the mutation that occurs during the method above. It may be + that we should re-evaluate whether all of these methods should be const, but this would impact RenderBox + methods as well, so I chose to hold off going down that rabbit hole. + +2012-07-19 Dominic Mazzoni <dmazzoni@google.com> + + AX: Need AccessibilityObjects for nodes without renderers in canvas subtree + https://bugs.webkit.org/show_bug.cgi?id=87899 + + Reviewed by Chris Fleizach. + + Refactors AccessibilityRenderObject so that it inherits from a new class, + AccessibilityNodeObject, that can be constructed from a Node without a + renderer. Modifies AXObjectCache so that it automatically creates an + AccessibilityNodeObject for elements in a canvas subtree but not otherwise. + A new layout test verifies that this correctly exposes an accessibility + tree with appropriate roles for elements in a canvas subtree. + + This patch does not try to complete the implementation of + AccessibilityNodeObject. Most AX methods are still unimplemented and need + to be migrated from AccessibilityRenderObject to AccessibilityNodeObject + in a future patch. + + This patch also doesn't change anything outside of WebCore/accessibility, so + the rest of WebCore only calls AXObjectCache when there are changes to a + RenderObject, not to a Node. Accessible notifications on nodes without + renderers need to be implemented in a future patch. + + Test: accessibility/canvas-accessibilitynodeobject.html + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::get): + (WebCore): + (WebCore::createFromNode): + (WebCore::AXObjectCache::getOrCreate): + (WebCore::AXObjectCache::remove): + * accessibility/AXObjectCache.h: + (AXObjectCache): + (WebCore::AXObjectCache::get): + (WebCore::AXObjectCache::getOrCreate): + (WebCore::AXObjectCache::remove): + * accessibility/AccessibilityARIAGrid.cpp: + (WebCore::AccessibilityARIAGrid::AccessibilityARIAGrid): + (WebCore): + (WebCore::AccessibilityARIAGrid::~AccessibilityARIAGrid): + (WebCore::AccessibilityARIAGrid::init): + (WebCore::AccessibilityARIAGrid::create): + * accessibility/AccessibilityARIAGrid.h: + (AccessibilityARIAGrid): + * accessibility/AccessibilityARIAGridCell.cpp: + (WebCore::AccessibilityARIAGridCell::create): + * accessibility/AccessibilityARIAGridRow.cpp: + (WebCore::AccessibilityARIAGridRow::create): + * accessibility/AccessibilityAllInOne.cpp: + * accessibility/AccessibilityList.cpp: + (WebCore::AccessibilityList::create): + * accessibility/AccessibilityListBox.cpp: + (WebCore::AccessibilityListBox::create): + * accessibility/AccessibilityMediaControls.cpp: + (WebCore::AccessibilityMediaControl::create): + (WebCore::AccessibilityMediaControlsContainer::create): + (WebCore::AccessibilityMediaTimeline::create): + (WebCore::AccessibilityMediaTimeDisplay::create): + * accessibility/AccessibilityMenuList.cpp: + (WebCore::AccessibilityMenuList::create): + (WebCore): + * accessibility/AccessibilityMenuList.h: + (AccessibilityMenuList): + * accessibility/AccessibilityNodeObject.cpp: Added. + (WebCore): + (WebCore::AccessibilityNodeObject::AccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::~AccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::init): + (WebCore::AccessibilityNodeObject::create): + (WebCore::AccessibilityNodeObject::detach): + (WebCore::AccessibilityNodeObject::childrenChanged): + (WebCore::AccessibilityNodeObject::updateAccessibilityRole): + (WebCore::AccessibilityNodeObject::firstChild): + (WebCore::AccessibilityNodeObject::lastChild): + (WebCore::AccessibilityNodeObject::previousSibling): + (WebCore::AccessibilityNodeObject::nextSibling): + (WebCore::AccessibilityNodeObject::parentObjectIfExists): + (WebCore::AccessibilityNodeObject::parentObject): + (WebCore::AccessibilityNodeObject::elementRect): + (WebCore::AccessibilityNodeObject::setNode): + (WebCore::AccessibilityNodeObject::document): + (WebCore::AccessibilityNodeObject::determineAccessibilityRole): + (WebCore::AccessibilityNodeObject::addChildren): + (WebCore::AccessibilityNodeObject::accessibilityIsIgnored): + (WebCore::AccessibilityNodeObject::canSetFocusAttribute): + (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute): + (WebCore::AccessibilityNodeObject::ariaRoleAttribute): + (WebCore::AccessibilityNodeObject::remapAriaRoleDueToParent): + * accessibility/AccessibilityNodeObject.h: Added. + (WebCore): + (AccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::isAccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::node): + (WebCore::AccessibilityNodeObject::isDetached): + (WebCore::toAccessibilityNodeObject): + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::isAccessibilityNodeObject): + * accessibility/AccessibilityProgressIndicator.cpp: + (WebCore::AccessibilityProgressIndicator::create): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::AccessibilityRenderObject): + (WebCore::AccessibilityRenderObject::init): + (WebCore): + (WebCore::AccessibilityRenderObject::create): + (WebCore::AccessibilityRenderObject::detach): + (WebCore::AccessibilityRenderObject::setRenderer): + (WebCore::AccessibilityRenderObject::canHaveChildren): + (WebCore::AccessibilityRenderObject::addCanvasChildren): + (WebCore::AccessibilityRenderObject::addChildren): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + * accessibility/AccessibilitySlider.cpp: + (WebCore::AccessibilitySlider::create): + * accessibility/AccessibilityTable.cpp: + (WebCore::AccessibilityTable::AccessibilityTable): + (WebCore): + (WebCore::AccessibilityTable::~AccessibilityTable): + (WebCore::AccessibilityTable::init): + (WebCore::AccessibilityTable::create): + * accessibility/AccessibilityTable.h: + (AccessibilityTable): + * accessibility/AccessibilityTableCell.cpp: + (WebCore::AccessibilityTableCell::create): + * accessibility/AccessibilityTableRow.cpp: + (WebCore::AccessibilityTableRow::create): + +2012-07-19 Dan Bernstein <mitz@apple.com> + + The ATSUI-based complex text code is unused + https://bugs.webkit.org/show_bug.cgi?id=91816 + + Reviewed by Sam Weinig. + + * WebCore.gypi: Removed references to the files deleted in this change. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * platform/graphics/FontCache.h: + (FontCache): Replaced USE(CORE_TEXT) with PLATFORM(MAC) || PLATFORM(CHROMIUM) && OS(DARWIN). + * platform/graphics/SimpleFontData.h: + (SimpleFontData): Removed USE(ATSUI)-only code, replaced USE(CORE_TEXT) with + (PLATFORM(CHROMIUM) && OS(DARWIN)). + * platform/graphics/mac/ComplexTextController.cpp: Removed USE(ATSUI)-only code. Moved + collectComplexTextRunsForCharacters() and the ComplexTextRun constructor out of this file. + * platform/graphics/mac/ComplexTextController.h: Removed USE(ATSUI)-only code and removed + #if USE(CORE_TEXT) because anyone including this header is using Core Text. + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: Removed. + * platform/graphics/mac/ComplexTextControllerCoreText.mm: + (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moved from + ComplexTextController.cpp into this file and merged with createTextRunFromFontDataCoreText(). + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Moved from + ComplexTextController.cpp into this file and merged with + collectComplexTextRunsForCharactersCoreText(). + * platform/graphics/mac/SimpleFontDataATSUI.mm: Removed. + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformInit): Remove USE(ATSUI)-only code. + (WebCore::SimpleFontData::platformDestroy): Ditto. + * platform/text/mac/ShapeArabic.c: Removed. + * platform/text/mac/ShapeArabic.h: Removed. + +2012-07-19 Kent Tamura <tkent@chromium.org> + + Introduce Node::shadowHost() + https://bugs.webkit.org/show_bug.cgi?id=91814 + + Reviewed by Hajime Morita. + + Introduce Node::shadowHost(), which return the host element, or 0. + Node::shadowAncestorNode() is used to obtain a shadow host. However it + is confusing because it returns 'this' if this is not in a shadow tree. + + Replaces one callsite of shadowAncestorNode() with shadowHost(). + + No behavior change. + + * dom/Node.cpp: + (WebCore::Node::shadowHost): Added. + * dom/Node.h: + (Node): Declare shadowHost(), and add a comment to shadowAncestorNode(). + * html/shadow/CalendarPickerElement.cpp: + (WebCore::CalendarPickerElement::hostInput): + Replace shadowAncestorNode() with shaodwHost(). + +2012-07-19 Kent Tamura <tkent@chromium.org> + + Form state restore: Need to identify a form by its content + https://bugs.webkit.org/show_bug.cgi?id=91209 + + Reviewed by Hajime Morita. + + Add names of the first two controls of a form to its formKey + string. By this change, we can correctly restore states to + reordered forms like webkit.org/b/91209#c0. + + Tests: Added test cases to fast/forms/state-restore-per-form.html. + + * html/FormController.cpp: + (WebCore::recordFormStructure): + Append at most two name attribute values. + (WebCore::createKey): Insert a string built by recordFromStructure(). + (WebCore::formStateSignature): Bump the version. + +2012-07-19 Wei James <james.wei@intel.com> + + enable Web Audio for chromium android port + https://bugs.webkit.org/show_bug.cgi?id=89428 + + Reviewed by Kenneth Russell. + + * WebCore.gyp/WebCore.gyp: + * platform/audio/FFTFrameStub.cpp: + (WebCore::FFTFrame::doFFT): + +2012-07-19 David Hyatt <hyatt@apple.com> + + SVG images broken when max-width specified. + https://bugs.webkit.org/show_bug.cgi?id=91474 + + SVG images were computing intrinsic dimensions when width and height were auto that did not + respect min-max width/height. Normal images had code that applied these constraints properly. + Looking at the code before the check-in that broke things, these constraints used to be + applied to all images regardless of type via calcAspectRatioLogicalWidth/Height. + + This patch leaves the new function structure in place but converts the code to be more like + it was prior to the introduction of the regression. Instead of raw intrinsic sizes being + used in the SVG case, now all image types get the intrinsic sizes constrained when doing + width/height computations. + + Reviewed by Dan Bernstein. + + Test: svg/as-image/svg-intrinsic-size.html + + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): + Rename computeIntrinsicRatioInformationForRenderBox to computeAspectRatioInformationForRenderBox. + Also rename the intrinsicSize reference to constrainedSize to reflect the fact that the size + is not necessarily the intrinsic size any longer but instead a size where both axes have been + constrained based off the max-min values of the opposite axes. + + Move the constraining code out of RenderReplaced::computeIntrinsicRatioInformation into this + function so that the SVG code path appies the constraints as well. The movement of this code + is what fixes the bug. + + (WebCore::RenderReplaced::computeIntrinsicRatioInformation): + Changed to remove the code that constrains the returned size, since it is shifting to + computeAspectRatioInformationForRenderBox instead. + + (WebCore::RenderReplaced::computeReplacedLogicalWidth): + (WebCore::RenderReplaced::computeReplacedLogicalHeight): + * rendering/RenderReplaced.h: + (RenderReplaced): + Patch the name of the reference passed in to computeReplacedLogicalWidth/Height to be + constrainedSize instead of intrinsicSize, so that it is more obvious that the returned + result is not just the intrinsic size of the image. + +2012-07-19 Dmitry Titov <dimich@chromium.org> + + Unreviewed, reverting http://trac.webkit.org/changeset/123149. + It broke an IDB test on Chromium page cycler. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::SerializedScriptValue): + (WebCore): + * bindings/v8/SerializedScriptValue.h: + * dom/MessageEvent.cpp: + (WebCore::MessageEvent::MessageEvent): + (WebCore::MessageEvent::initMessageEvent): + +2012-07-19 Julien Chaffraix <jchaffraix@webkit.org> + + [CSS2.1] Anonymous tables should be inline/block-level based off their parent + https://bugs.webkit.org/show_bug.cgi?id=15365 + + Reviewed by Abhishek Arya. + + This change makes us match bullet 3 "Generate missing parents" of section 17.2.1 http://www.w3.org/TR/CSS2/tables.html#anonymous-boxes": + "If a table is contained by an inline element, then the anonymous tables should be inline-tables." + + Patch based on an earlier change by Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>. + + Tests: css2.1/20110323/inline-table-002b.html + fast/dynamic/insert-before-table-part-in-continuation.html + fast/table/inline-table-in-continuation.html + fast/table/inline-table-with-caption.html + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::createAnonymousWithParentRenderer): + Added a check to determine if we should be inline or block based on our parent to match CSS 2.1. + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::addChildIgnoringContinuation): + Changed the child addition logic to not wrap a table part in an inline context. This change works + as intended as we will call RenderObject::addChild which will create an anonymous inline table that + will be added under |this| instead of the table part. As the table is inline, it doesn't need to be + wrapped when we recursively call RenderInline::addChild. + +2012-07-19 Chris Fleizach <cfleizach@apple.com> + + WebKit should pass <title> element value as the default description for web views + https://bugs.webkit.org/show_bug.cgi?id=91763 + + Reviewed by Anders Carlsson. + + Update the logic for determining the description for the AXWebArea to include the document's title. + + Test: platform/mac/accessibility/document-title-used-for-description.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::webAreaAccessibilityDescription): + Move web area description handling into a separate method. + (WebCore::AccessibilityRenderObject::accessibilityDescription): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + +2012-07-19 Zeev Lieber <zlieber@chromium.org> + + [Chromium] Textures drawn during occlusion are incorrectly re-used when unoccluded. + https://bugs.webkit.org/show_bug.cgi?id=91537 + + Reviewed by Adrienne Walker. + + Detecting if any external occlusion occurs when drawing a + texture. If external occlusion happens, the texture is marked as + "incomplete" in LayerRendererChromium, and is not being considered + for re-use. + + Minor refactoring of CCQuadCuller - extracted interface + (CCQuadSink) and united append() and appendSurface() methods. + + Added unit tests to verify this fix; also added test to try + clipping instead of occlusion. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (LayerRendererChromium::CachedTexture): + (WebCore::LayerRendererChromium::CachedTexture::create): + (WebCore::LayerRendererChromium::CachedTexture::~CachedTexture): + (WebCore::LayerRendererChromium::CachedTexture::isComplete): + (WebCore::LayerRendererChromium::CachedTexture::setIsComplete): + (WebCore::LayerRendererChromium::CachedTexture::CachedTexture): + (WebCore): + (WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame): + (WebCore::LayerRendererChromium::haveCachedResourcesForRenderPassId): + (WebCore::LayerRendererChromium::drawRenderPassQuad): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h: + (CCIOSurfaceLayerImpl): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::appendDebugBorderQuad): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore): + (WebCore::CCLayerImpl::appendQuads): + (CCLayerImpl): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::::unoccludedContentRect): + (WebCore::::unoccludedContributingSurfaceContentRect): + (WebCore): + * platform/graphics/chromium/cc/CCOcclusionTracker.h: + (CCOcclusionTrackerBase): + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + (WebCore::CCQuadCuller::CCQuadCuller): + (WebCore::CCQuadCuller::append): + * platform/graphics/chromium/cc/CCQuadCuller.h: + (WebCore): + (CCQuadCuller): + (WebCore::CCQuadCuller::~CCQuadCuller): + (WebCore::CCQuadCuller::hasExternalOcclusion): + * platform/graphics/chromium/cc/CCQuadSink.h: + (WebKit): + (WebCore): + (CCQuadSink): + (WebCore::CCQuadSink::~CCQuadSink): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::CCRenderPass): + (WebCore::CCRenderPass::appendQuadsForLayer): + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::hasExternalOcclusion): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::CCRenderSurface): + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore): + (WebCore::CCRenderSurface::setHasExternalOcclusion): + (WebCore::CCRenderSurface::hasExternalOcclusion): + (CCRenderSurface): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp: + (WebCore::CCScrollbarLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h: + (CCScrollbarLayerImpl): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp: + (WebCore::CCSolidColorLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: + (CCSolidColorLayerImpl): + * platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: + (WebCore::CCTextureLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTextureLayerImpl.h: + (CCTextureLayerImpl): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + (CCVideoLayerImpl): + +2012-07-19 Simon Fraser <simon.fraser@apple.com> + + Keep overlap testing on for descendants of an animating element + https://bugs.webkit.org/show_bug.cgi?id=91787 + + Reviewed by Beth Dakin. + + RenderLayerCompositor::computeCompositingRequirements() would turn off + overlap testing for descendants of a layer that has a 3D transform, + or has an animating transform. This could cause compositing changes + inside an animating element when transitions start and stop, which + is undesirable. + + Instead, we can keep overlap testing on for descendants of that + animating element, but we have to turn it off for layers later + in z-order. + + Also enhance the "IndirectCompositingReason" flags so that in + the compositing log output, we can distinguish between layers that + were composited as a result of overlap testing from those compositing + for stacking reasons. + + Test: compositing/layer-creation/animation-overlap-with-children.html + + * rendering/RenderLayer.h: New IndirectCompositingReason value to + distinguish overlap from stacking. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + Use an IndirectCompositingReason enum rather than a bool to track whether + the layer starts as composited. + Remove the if (layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) + check that turned off overlap testing for descendants of this layer. + Use IndirectCompositingForStacking (somewhat arbitrarily) for reflection layers. + Turn overlap testing off for layers later in the z-order. + (WebCore::RenderLayerCompositor::requiresOwnBackingStore): Take IndirectCompositingForStacking into + account. + (WebCore::RenderLayerCompositor::reasonForCompositing): Improve the logging output. + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Added missing files to the Qt build. + + No new tests, WebGL is still disabled by default in the bots. + + * Target.pri: + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Added missing files to the Qt build. + + No new tests, WebGL is still disabled by default in the bots. + + * Target.pri: + +2012-07-19 Simon Fraser <simon.fraser@apple.com> + + Keep overlap testing on for descendants of an animating element + https://bugs.webkit.org/show_bug.cgi?id=91787 + + Reviewed by Beth Dakin. + + RenderLayerCompositor::computeCompositingRequirements() would turn off + overlap testing for descendants of a layer that has a 3D transform, + or has an animating transform. This could cause compositing changes + inside an animating element when transitions start and stop, which + is undesirable. + + Instead, we can keep overlap testing on for descendants of that + animating element, but we have to turn it off for layers later + in z-order. + + Also enhance the "IndirectCompositingReason" flags so that in + the compositing log output, we can distinguish between layers that + were composited as a result of overlap testing from those compositing + for stacking reasons. + + Test: compositing/layer-creation/animation-overlap-with-children.html + + * rendering/RenderLayer.h: New IndirectCompositingReason value to + distinguish overlap from stacking. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + Use an IndirectCompositingReason enum rather than a bool to track whether + the layer starts as composited. + Remove the if (layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) + check that turned off overlap testing for descendants of this layer. + Use IndirectCompositingForStacking (somewhat arbitrarily) for reflection layers. + Turn overlap testing off for layers later in the z-order. + (WebCore::RenderLayerCompositor::requiresOwnBackingStore): Take IndirectCompositingForStacking into + account. + (WebCore::RenderLayerCompositor::reasonForCompositing): Improve the logging output. + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Added missing files to the Qt build. + + No new tests, WebGL is still disabled by default in the bots. + + * Target.pri: + +2012-07-17 Dmitry Titov <dimich@chromium.org> + + [Chromium] Out of Memory is observed when a large object is passed to a Web Worker. + https://bugs.webkit.org/show_bug.cgi?id=91535. + + Reviewed by Dave Levin. + + No new tests because of no new behavior and lack of mechanism to monitor used memory. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::SerializedScriptValue): + (WebCore::SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext): + (WebCore): + (WebCore::SerializedScriptValue::~SerializedScriptValue): + * bindings/v8/SerializedScriptValue.h: + (SerializedScriptValue): + Added a method to SerializedScriptValue to add memory pressure on GC proportional to the size of memory allocated in serialized data. + + * dom/MessageEvent.cpp: + (WebCore::MessageEvent::MessageEvent): + (WebCore::MessageEvent::initMessageEvent): + Call the new method of SerializedScriptValue during creation of MessageEvent (presumably in the thread which contains the right V8 context). + +2012-07-19 Dan Bernstein <mitz@apple.com> + + In flipped blocks writing modes, no flipping occurs when mapping RenderText’s local coordinates to absolute + https://bugs.webkit.org/show_bug.cgi?id=91780 + + Reviewed by Anders Carlsson. + + Test: fast/writing-mode/flipped-blocks-text-map-local-to-container.html + + When RenderObject::mapLocalToContainer() was called on a RenderText with ApplyContainerFlip, + it would not flip (if the container was not a box) but it would always pass + DoNotApplyContainerFlip when recurring to the parent. This meant that no one applied the flip. + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::mapLocalToContainer): Made the setting of applyContainerFlip to + false unconditional on the container actually being flipped. + * rendering/RenderObject.cpp: + (WebCore::RenderObject::mapLocalToContainer): Rather than always passing + DoNotApplyContainerFlip when recurring to the parent, changed this function to pass through + the value of applyContainerFlip it was called with, unless it applied the flip itself. + +2012-07-19 Erik Arvidsson <arv@chromium.org> + + Window top should not be replaceable + https://bugs.webkit.org/show_bug.cgi?id=91755 + + Reviewed by Adam Barth. + + Window top is readonly and unforgable and should not be replaceable. + + http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-window-object + + This change brings JSC inline with all other browsers. + + No new tests. Modified existing tests. + + * page/DOMWindow.idl: + +2012-07-19 Max Feil <mfeil@rim.com> + + [BlackBerry] Only maintain the hole punch rect while html5 video is being renderered + https://bugs.webkit.org/show_bug.cgi?id=91689 + + Reviewed by Antonio Gomes. + + The hole punch rectangle needs to be present if and only if html5 + video content is being rendered. Otherwise unwanted content may + show through from behind the browser tab's window. + + I am not adding any new tests because the difficulty of testing + for this case outweighs the benefit. + + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::MediaPlayerPrivate::updateStates): + +2012-07-19 Bem Jones-Bey <bjonesbe@adobe.com> + + [CSS Exclusions] - Code cleanup: make shape parsing use isComma() instead of manual checks + https://bugs.webkit.org/show_bug.cgi?id=91760 + + Reviewed by Eric Seidel. + + Remove code duplication by making the rectangle, circle, and ellipse + methods use isComma() to detect a comma. + + No new tests needed: no new functionality added. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseExclusionShapeRectangle): + (WebCore::CSSParser::parseExclusionShapeCircle): + (WebCore::CSSParser::parseExclusionShapeEllipse): + +2012-07-19 Raymond Toy <rtoy@google.com> + + Limit maximum delay of DelayNode. + https://bugs.webkit.org/show_bug.cgi?id=91675 + + Reviewed by Kenneth Russell. + + Clip the maximum delay of a DelayNode to a reasonable maximum. + + Test: webaudio/delaynode-maxdelaylimit.html + + * Modules/webaudio/DelayNode.cpp: + (WebCore): Add maximumAllowedDelayTime. + (WebCore::DelayNode::DelayNode): Clip max delay. + +2012-07-14 Robert Hogan <robert@webkit.org> + + CSS 2.1 failure: text-indent-intrinsic-003 fails + https://bugs.webkit.org/show_bug.cgi?id=80576 + + Reviewed by Eric Seidel. + + Negative values of text-indent should be distributed across inline children until used up. + This fixes text-indent-intrinsic-003 and text-indent-intrinsic-004. + + Tests: css2.1/20110323/text-indent-intrinsic-001.htm + css2.1/20110323/text-indent-intrinsic-002.htm + css2.1/20110323/text-indent-intrinsic-003.htm + css2.1/20110323/text-indent-intrinsic-004.htm + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): If text-indent is negative, keep + applying it to inline children in the first formatted line until it's reduced to zero. This isn't + a consideration when text-indent is a positive value. + +2012-07-19 Douglas Stockwell <dstockwell@google.com> + + Crash in WebCore::StyleResolver::collectMatchingRulesForList + https://bugs.webkit.org/show_bug.cgi?id=90803 + + Reviewed by Andreas Kling. + + When a ProcessingInstruction was removed from the document the owner + was removed, but the style resolver was not guaranteed to be updated. + It was then possible for an inconsistent version of the stylesheet to + remain visible in the DOM. Fixed by removing an invalid condition and + mirroring the logic from StyleElement. + + Test: fast/css/xml-stylesheet-removed.xhtml + + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::removedFrom): Mirror the logic from + StyleElement -- always update the style resolver. + +2012-07-19 Bem Jones-Bey <bjonesbe@adobe.com> + + Shape-inside / shape-outside should support percent-based measurements + https://bugs.webkit.org/show_bug.cgi?id=90311 + + Reviewed by Andreas Kling. + + Update the CSS Parser to accept percentage length values for exclusion + shapes. + + Testing added to LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseExclusionShapeRectangle): + (WebCore::CSSParser::parseExclusionShapeCircle): + (WebCore::CSSParser::parseExclusionShapeEllipse): + (WebCore::CSSParser::parseExclusionShapePolygon): + +2012-07-19 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r123117. + http://trac.webkit.org/changeset/123117 + https://bugs.webkit.org/show_bug.cgi?id=91667 + + Breaks chromium-win compile. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gyp/scripts/rule_bison.py: + * bindings/scripts/preprocessor.pm: + (applyPreprocessor): + * make-hash-tools.pl: + +2012-07-19 James Simonsen <simonjam@chromium.org> + + Regression(120096): Protect the element used by ImageLoader until the end of notifyFinished(). + https://bugs.webkit.org/show_bug.cgi?id=90471 + + Reviewed by Brady Eidson. + + Test: http/tests/security/video-poster-cross-origin-crash.html + + * html/HTMLImageLoader.cpp: + (WebCore::HTMLImageLoader::notifyFinished): Hang on to the element until we're done. + * loader/ImageLoader.cpp: + (WebCore::ImageLoader::setImage): No behavior change. + (WebCore): + (WebCore::ImageLoader::setImageWithoutConsideringPendingLoadEvent): Split off from old setImage, minus calling updatedHasPendingLoadEvent(). + (WebCore::ImageLoader::notifyFinished): Invoke updatedHasPendingLoadEvent when done with cross origin errors. + * loader/ImageLoader.h: + (ImageLoader): + +2012-07-19 Scott Graham <scottmg@chromium.org> + + Use native (non-cygwin) binaries for perl, gperf, and bison in Chromium + https://bugs.webkit.org/show_bug.cgi?id=91667 + + Reviewed by Kentaro Hara. + + Using native tools instead of cygwin version improves build time + performance by roughly 50% (on top of previous cl-instead-of-gcc + change). + + No new tests. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gyp/scripts/rule_bison.py: + * bindings/scripts/preprocessor.pm: + (applyPreprocessor): + * make-hash-tools.pl: + +2012-07-19 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: CPU bars are not cleared along with the rest of the timeline panel + https://bugs.webkit.org/show_bug.cgi?id=91753 + + Reviewed by Pavel Feldman. + + - remove early bail-outs in refreshMainThreadBars; let it run to clear bars for the non-existent / invisible events; + + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._refreshMainThreadBars): + +2012-07-19 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Throw native TypeErrors per spec + https://bugs.webkit.org/show_bug.cgi?id=91679 + + Reviewed by Kentaro Hara. + + Per the IDB spec, the advance(), openCursor(), openKeyCursor() and transaction() + methods supposed to throw true native JavaScript TypeError objects as exceptions + rather than DOMException objects. Implement this by adding a special DOMException + code that is tested for in the binding layer. + + Tests: storage/indexeddb/cursor-advance.html + storage/indexeddb/index-basics.html + storage/indexeddb/index-basics-workers.html + storage/indexeddb/objectstore-cursor.html + storage/indexeddb/transaction-basics.html + + * Modules/indexeddb/IDBCursor.cpp: Use the new DOMException code. + (WebCore::IDBCursor::advance): + (WebCore::IDBCursor::stringToDirection): + (WebCore::IDBCursor::directionToString): + * Modules/indexeddb/IDBDatabase.cpp: Ditto. + (WebCore::IDBDatabase::setVersion): + * Modules/indexeddb/IDBDatabaseException.cpp: Remove temporary cruft/mark as legacy. + (WebCore): + * Modules/indexeddb/IDBDatabaseException.h: Ditto. + * Modules/indexeddb/IDBDatabaseException.idl: Ditto. + * Modules/indexeddb/IDBFactory.cpp: Use the new DOMException code. + (WebCore::IDBFactory::open): + (WebCore::IDBFactory::deleteDatabase): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::createIndex): Use the new DOMException code. + * Modules/indexeddb/IDBTransaction.cpp: Use the new DOMException code. + (WebCore::IDBTransaction::stringToMode): + (WebCore::IDBTransaction::modeToString): + * bindings/js/JSDOMBinding.cpp: + (WebCore::setDOMException): Intercept new DOMException code, throw native TypeError. + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::setDOMException): Ditto. + * dom/ExceptionCode.h: Add new DOMException code. + +2012-07-19 Joshua Bell <jsbell@chromium.org> + + Roll out r121610 and r122487 which may have been causing flaky crashes + https://bugs.webkit.org/show_bug.cgi?id=91637 + + Reviewed by Kentaro Hara. + + Flaky crashes started in random tests following r121610. It's not clear + that r121610 is to blame, but we'd like to prove or disprove it. + If this doesn't resolve the crashes, this patch should be rolled out. + + * WebCore.gypi: + * bindings/v8/NPObjectWrapper.cpp: Added. + (WebCore): + (NPProxyObject): + (WebCore::NPObjectWrapper::NPObjectWrapper): + (WebCore::NPObjectWrapper::create): + (WebCore::NPObjectWrapper::clear): + (WebCore::NPObjectWrapper::getWrapper): + (WebCore::NPObjectWrapper::getUnderlyingNPObject): + (WebCore::NPObjectWrapper::getObjectForCall): + (WebCore::NPObjectWrapper::NPAllocate): + (WebCore::NPObjectWrapper::NPDeallocate): + (WebCore::NPObjectWrapper::NPPInvalidate): + (WebCore::NPObjectWrapper::NPHasMethod): + (WebCore::NPObjectWrapper::NPInvoke): + (WebCore::NPObjectWrapper::NPInvokeDefault): + (WebCore::NPObjectWrapper::NPHasProperty): + (WebCore::NPObjectWrapper::NPGetProperty): + (WebCore::NPObjectWrapper::NPSetProperty): + (WebCore::NPObjectWrapper::NPRemoveProperty): + (WebCore::NPObjectWrapper::NPNEnumerate): + (WebCore::NPObjectWrapper::NPNConstruct): + (WebCore::NPObjectWrapper::NPInvokePrivate): + * bindings/v8/NPObjectWrapper.h: Added. + (WebCore): + (NPObjectWrapper): + * bindings/v8/NPV8Object.cpp: + (WebCore::freeV8NPObject): + (_NPN_Invoke): + (_NPN_InvokeDefault): + (_NPN_EvaluateHelper): + (_NPN_GetProperty): + (_NPN_SetProperty): + (_NPN_RemoveProperty): + (_NPN_HasProperty): + (_NPN_HasMethod): + (_NPN_Enumerate): + (_NPN_Construct): + * bindings/v8/NPV8Object.h: + (WebCore): + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::ScriptController): + (WebCore::ScriptController::clearScriptObjects): + (WebCore::ScriptController::windowScriptNPObject): + * bindings/v8/ScriptController.h: + (ScriptController): + +2012-07-19 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: minimize number of properties on WebInspector.TimelinePresentationModel.Record + https://bugs.webkit.org/show_bug.cgi?id=91744 + + Reviewed by Pavel Feldman. + + - replace most properties on TimelinePresentationModel.Record with getters; + + This reduces the amount of memory we use for timeline presentation model records almost by 2x. + + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.Record): + (WebInspector.TimelinePresentationModel.Record.prototype.get children): + (WebInspector.TimelinePresentationModel.Record.prototype.get category): + (WebInspector.TimelinePresentationModel.Record.prototype.get title): + (WebInspector.TimelinePresentationModel.Record.prototype.get startTime): + (WebInspector.TimelinePresentationModel.Record.prototype.get data): + (WebInspector.TimelinePresentationModel.Record.prototype.get type): + (WebInspector.TimelinePresentationModel.Record.prototype.get frameId): + (WebInspector.TimelinePresentationModel.Record.prototype.get endTime): + (WebInspector.TimelinePresentationModel.Record.prototype.get totalHeapSize): + (WebInspector.TimelinePresentationModel.Record.prototype.get usedHeapSize): + (WebInspector.TimelinePresentationModel.Record.prototype.get _selfTime): + (WebInspector.TimelinePresentationModel.Record.prototype.get stackTrace): + (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent): + (WebInspector.TimelinePresentationModel.Record.prototype.calculateAggregatedStats): + +2012-07-19 Dongwoo Im <dw.im@samsung.com> + + [EFL] Fix build break when WEB_AUDIO is enabled. + https://bugs.webkit.org/show_bug.cgi?id=91735 + + Unreviewed build fix. + + New files are added for the Web Audio fearure. + These files should be included into the CMakeLists.txt file. + + * CMakeLists.txt: Add the newly created files into the CMakeLists.txt + +2012-07-19 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Remove support for Qt versions before 4.8.0 + https://bugs.webkit.org/show_bug.cgi?id=91730 + + Reviewed by Kenneth Rohde Christiansen. + + Remove Qt version check #ifdefs for Qt versions before 4.8.0. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::clipBoundingRect): + * platform/qt/ThirdPartyCookiesQt.cpp: + (WebCore::urlsShareSameDomain): + (WebCore::thirdPartyCookiePolicyPermits): + +2012-07-19 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: CodeGeneratorInspector.py: fix output write logic to support incremental build + https://bugs.webkit.org/show_bug.cgi?id=90642 + + Reviewed by Yury Semikhatsky. + + A small intermediate writer is added. It handles comparing old and new source before actual writing. + + * inspector/CodeGeneratorInspector.py: + (flatten_list): + (SmartOutput): + (SmartOutput.__init__): + (SmartOutput.write): + (SmartOutput.close): + +2012-07-19 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] MHTML files not being loaded due to reported mime type not supported + https://bugs.webkit.org/show_bug.cgi?id=89978 + + Reviewed by Carlos Garcia Campos. + + Make 'message/rfc822' a supported MIME type for MHTML files in GTK. + + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::continueAfterContentPolicy): Add + 'message/rfc822' to the list of MIME types to be considered to + avoid them bypasing cross-domain security checks, only for GTK. + * loader/archive/ArchiveFactory.cpp: + (WebCore::archiveMIMETypes): Add 'message/rfc822' to the list of + supported MIME types when MHTML support is enabled in GTK. + +2012-07-19 Jan Keromnes <janx@linux.com> + + Web Inspector: Factor ExtensionView into separate file + https://bugs.webkit.org/show_bug.cgi?id=91699 + + Reviewed by Vsevolod Vlasov. + + The class ExtensionView was defined in ExtensionPanel.js but needed to + be in a separate file since it is going to be reused somewhere else. + + Current test coverage is enough since no behavior was changed. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/compile-front-end.py: + * inspector/front-end/ExtensionPanel.js: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2012-07-19 Shinya Kawanaka <shinyak@chromium.org> + + [Refactoring] Use userAgentShadowRoot() to take user agent shadow root. + https://bugs.webkit.org/show_bug.cgi?id=91716 + + Reviewed by Hajime Morita. + + We have introduced Element::userAgentShadowRoot in r123071 to take user agent shadow root. + We have used shadow()->oldestShadowRoot() to take the user agent shadow root, however its code intention was + not so clear. Using userAgentShadowRoot() will make it clearer. + + No new tests, simple refactoring. + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::createShadowSubtree): + (WebCore::ColorInputType::shadowColorSwatch): + * html/FileInputType.cpp: + (WebCore::FileInputType::createShadowSubtree): + (WebCore::FileInputType::multipleAttributeChanged): + * html/HTMLDetailsElement.cpp: + (WebCore::HTMLDetailsElement::findMainSummary): + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::willAddAuthorShadowRoot): + (WebCore::HTMLImageElement::imageElement): + (WebCore::HTMLImageElement::innerElement): + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::shadowSelect): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::innerTextElement): + (WebCore::HTMLTextAreaElement::updatePlaceholderText): + * html/InputType.cpp: + (WebCore::InputType::destroyShadowSubtree): + * html/RangeInputType.cpp: + (WebCore::RangeInputType::handleMouseDownEvent): + (WebCore::RangeInputType::createShadowSubtree): + * html/TextFieldInputType.cpp: + (WebCore::TextFieldInputType::createShadowSubtree): + (WebCore::TextFieldInputType::updatePlaceholderText): + * html/ValidationMessage.cpp: + (WebCore::ValidationMessage::deleteBubbleTree): + * html/shadow/SliderThumbElement.cpp: + (WebCore::sliderThumbElementOf): + (WebCore::trackLimiterElementOf): + +2012-07-19 Keishi Hattori <keishi@webkit.org> + + Redraw slider tick marks when datalist changes. + https://bugs.webkit.org/show_bug.cgi?id=89544 + + Reviewed by Kent Tamura. + + Updating the datalist should redraw the slider tick marks. This patch monitors + the id target element of the list attribute using ListAttributeTargetObserver + and notifies changes to the option element inside of a datalist element. + + Test: fast/forms/datalist/update-range-with-datalist.html + + * html/HTMLDataListElement.cpp: + (WebCore::HTMLDataListElement::optionElementChildrenChanged): Called when a child option element's value might have changed. + (WebCore): + * html/HTMLDataListElement.h: + (HTMLDataListElement): + * html/HTMLInputElement.cpp: + (ListAttributeTargetObserver): Inherits IdTargetObserver. + (WebCore): + (WebCore::HTMLInputElement::parseAttribute): Observe the form attribute target. + (WebCore::HTMLInputElement::insertedInto): Observe the form attribute id target. + (WebCore::HTMLInputElement::removedFrom): Remove the observer. + (WebCore::HTMLInputElement::resetListAttributeTargetObserver): + (WebCore::HTMLInputElement::listAttributeTargetChanged): + (WebCore::ListAttributeTargetObserver::create): + (WebCore::ListAttributeTargetObserver::ListAttributeTargetObserver): + (WebCore::ListAttributeTargetObserver::idTargetChanged): + * html/HTMLInputElement.h: + (WebCore): + (HTMLInputElement): + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::parseAttribute): If the value attribute changed, notify the owner datalist element. + (WebCore::HTMLOptionElement::childrenChanged): If the children changed, notify the owner datalist element. + (WebCore): + (WebCore::HTMLOptionElement::ownerDataListElement): The datalist that the option element is inside of. + * html/HTMLOptionElement.h: + (WebCore): + (HTMLOptionElement): + * html/InputType.cpp: + (WebCore): + (WebCore::InputType::listAttributeTargetChanged): + * html/InputType.h: + (InputType): + * html/RangeInputType.cpp: + (WebCore): + (WebCore::RangeInputType::listAttributeTargetChanged): + * html/RangeInputType.h: + (RangeInputType): + +2012-07-19 Dongwoo Im <dw.im@samsung.com> + + CodeGeneratorV8.pm : @enabledAtRuntime is not used in GenerateHeader. + https://bugs.webkit.org/show_bug.cgi?id=91715 + + Reviewed by Kentaro Hara. + + @enabledAtRuntime is not used in GenerateHeader. + We can remove it from GenerateHeader. + + No new tests as this has no functional changes. + + * bindings/scripts/CodeGeneratorV8.pm: Remove @enabledAtRuntime from GenerateHeader. + (GenerateHeader): + +2012-07-19 Abhishek Arya <inferno@chromium.org> + + Crash in FontCache::releaseFontData. + https://bugs.webkit.org/show_bug.cgi?id=91710 + + Reviewed by Tim Horton. + + Revert back change made to StyleResolver in r122896. The + maximum font size clamp is required there since transformed + sizes use that code path. + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + +2012-07-18 Ryosuke Niwa <rniwa@webkit.org> + + Another build fix after r123065. Don't list deleted file in gypi. + + * WebCore.gypi: + +2012-07-18 Keishi Hattori <keishi@webkit.org> + + Implement painting slider tick marks + https://bugs.webkit.org/show_bug.cgi?id=87844 + + Reviewed by Kent Tamura. + + This implements painting slider tick marks for <datalist> support for input type=range. + This does not support automatic update when list target changes, and it will be fixed + in a follow up patch (Bug 89544). + + Tests: fast/forms/datalist/input-appearance-range-with-datalist-rtl.html + fast/forms/datalist/input-appearance-range-with-datalist-zoomed.html + fast/forms/datalist/input-appearance-range-with-datalist.html + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::sliderThumbElement): + (WebCore): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/InputType.h: + (WebCore::InputType::sliderThumbElement): + * html/RangeInputType.cpp: + (WebCore::RangeInputType::typeMismatchFor): We need HTMLInputElement::isValidValue("foo") to return false. + (WebCore): + (WebCore::RangeInputType::sliderThumbElement): + * html/RangeInputType.h: + (RangeInputType): + * html/shadow/SliderThumbElement.cpp: + (WebCore::RenderSliderContainer::layout): Slider height needs to be increased for the tick marks. + * platform/efl/RenderThemeEfl.cpp: + (WebCore): + (WebCore::RenderThemeEfl::sliderTickSize): + (WebCore::RenderThemeEfl::sliderTickOffsetFromTrackCenter): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::sliderTickSize): + (WebCore): + (WebCore::RenderThemeQt::sliderTickOffsetFromTrackCenter): + * platform/qt/RenderThemeQt.h: + (RenderThemeQt): + * rendering/RenderTheme.cpp: + (WebCore): + (WebCore::RenderTheme::paintSliderTicks): + * rendering/RenderTheme.h: + (RenderTheme): + * rendering/RenderThemeChromiumCommon.cpp: + (WebCore::RenderThemeChromiumCommon::supportsDataListUI): + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore): + (WebCore::RenderThemeChromiumLinux::sliderTickSize): Tick size for horizontal slider. i.e. Width is length along the track. + (WebCore::RenderThemeChromiumLinux::sliderTickOffsetFromTrackCenter): Offset from + middle of draw rect to draw the ticks. Minus value means above the track. + (WebCore::RenderThemeChromiumLinux::paintSliderTrack): + * rendering/RenderThemeChromiumLinux.h: + (RenderThemeChromiumLinux): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore): + (WebCore::RenderThemeChromiumWin::sliderTickSize): + (WebCore::RenderThemeChromiumWin::sliderTickOffsetFromTrackCenter): + (WebCore::RenderThemeChromiumWin::paintSliderTrack): + (WebCore::RenderThemeChromiumWin::paintSliderThumb): + * rendering/RenderThemeChromiumWin.h: + (RenderThemeChromiumWin): + * rendering/RenderThemeMac.h: + (RenderThemeMac): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintSliderTrack): + (WebCore): + (WebCore::RenderThemeMac::sliderTickSize): + (WebCore::RenderThemeMac::sliderTickOffsetFromTrackCenter): + +2012-07-18 Shinya Kawanaka <shinyak@chromium.org> + + Element wants to have userAgentShadowRoot() + https://bugs.webkit.org/show_bug.cgi?id=91564 + + Reviewed by Eric Carlson. + + We introduce Element::userAgentShadowRoot() to return a UserAgentShadowRoot. + It returns the oldest shadow root if any, and checks the type of ShadowRoot in debug build. + + Previously, we have used elementShadow()->oldestShadowRoot() to get UserAgentShadowRoot. + The class implementor will know the oldest shadow root is UserAgentShadowRoot, but it is not + clear for the other people. This method will make the code intention clearer. + + We will introduce userAgentShadowRoot to the other elements (e.g. HTMLInputElement) after this patch. + + No new tests, simple refactoring. + + * dom/Element.cpp: + (WebCore::Element::userAgentShadowRoot): + (WebCore): + * dom/Element.h: + (Element): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::createShadowSubtree): + (WebCore::HTMLMediaElement::willAddAuthorShadowRoot): + (WebCore::HTMLMediaElement::mediaControls): + (WebCore::HTMLMediaElement::hasMediaControls): + (WebCore::HTMLMediaElement::createMediaControls): + +2012-07-18 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE] Remove duplicated #ifdef guard in CMakeLists.txt + https://bugs.webkit.org/show_bug.cgi?id=91575 + + Reviewed by Dirk Pranke. + + CMake files have used ENABLE_XXX macro. However, almost source and idl files are already protected by #ifdef. + So, we don't need to guard them in CMake files again. + + In SVG idl files case, blackberry port doesn't support it yet. So, SVG idl files are handled by WebCore_SVG_IDL_FILES macro. + + No new tests. This patch isn't for functionality. + + * CMakeLists.txt: + * PlatformBlackBerry.cmake: Change SVG_IDL_FILES with WebCore_SVG_IDL_FILES. + +2012-07-18 Hironori Bono <hbono@chromium.org> + + Move contents right when a vertical scrollbar is shown at the left side of an RTL element. + https://bugs.webkit.org/show_bug.cgi?id=85856 + + Reviewed by Hajime Morita. + + This change prevents the scrollWidth value from being cropped by the width of a + scrollbar when a vertical scrollbar is shown at the left side of an RTL element. + This change also increases the clientLeft value by this scrollbar width and move + contents right to improve compliance with CSSOM <http://www.w3.org/TR/cssom-view>. + + Tests: scrollbars/rtl/div-horizontal.html + scrollbars/rtl/div-vertical.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintObject): Move contents to the right. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::topLeftLocationOffset): Move the top-left corner to the right to prevent WebKit from cropping scrollWidth. + * rendering/RenderBox.h: + (WebCore::RenderBox::clientLeft): Increase clientLeft by the width of a scrollbar. + +2012-07-18 Kent Tamura <tkent@chromium.org> + + Form state restore: Classify form control sates by owners in internal and serialized representations + https://bugs.webkit.org/show_bug.cgi?id=91594 + + Reviewed by Hajime Morita. + + Before this change, the internal representation of form control states + was a map like: + + {name, type, formKey} -> [FormControlState, FormControlState, ...] + + Also, the serialized representation was: + + [name, type, formKey, FormControlState, + name, type, formKey, formControlState, + ...] + + This changes these represenations. The internal representation is + + A map owned by FormController: + formKey -> SavedFormState + SavedFormState owns a map like: + {name, type} -> [FormControlState, FormControlState, ...] + + The serialized representation is: + + [formKey, count, + name, type, FormControlState, + name, type, FormControlState, + name, type, FormControlState, + .... + formKey, count, + name, type, FormControlState, + name, type, FormControlState, + name, type, FormControlState, + ....] + + The serialized representation would be smaller in many cases because + each of items doesn't have formKey. + + Tests: Covered by fast/forms/state-restore-broken-state.html, + state-restore-per-form.html, and state-restore-skip-stateless.html. + + * html/FormController.cpp: + (FormElementKey): Remove formKey argument and m_formKey. + (WebCore::FormElementKey::FormElementKey): + (WebCore::FormElementKey::operator=): + (WebCore::FormElementKey::ref): + (WebCore::FormElementKey::deref): + (WebCore::operator==): + + (SavedFormState): + - The role of SavedFromState was changed. It represented all of control + states. Now it represent control states owned by a signle form. + - Make this non-copyable and fast-allocated. + - Add m_controlStateCount, a counter of FormControlState + (WebCore::SavedFormState::SavedFormState): + Initialize m_controlStateCount. + (WebCore::isNotFormControlTypeCharacter): + Moved from another place in this file. + (WebCore::SavedFormState::deserialize): + Added. Build a SavedFromState with the specified stateVector. + (WebCore::SavedFormState::serializeTo): + Added. m_controlStateCount is needed here. + (WebCore::SavedFormState::appendControlState): + - Remove formKey arguement. + - Update m_controlStateCount. + (WebCore::SavedFormState::takeControlState): ditto. + + (WebCore::formStateSignature): Bump the version. + (WebCore::FormController::createSavedFormStateMap): + Added. Build a SavedFormStateMap from the form control list. This is a + helper for formElementsState, and classifies controls in the document. + (WebCore::FormController::formElementsState): + Build a SavedFormStateMap with createSavedFormStateMap(), + then serializes it. + (WebCore::FormController::setStateForNewFormElements): + Deserialize SavedFormState, and build SavedFormStateMap. + (WebCore::FormController::takeStateForFormElement): + Finds the corresponding SavedFormState with a formKey, and uses it. + * html/FormController.h: + Declare createSavedFormStateMap(), and moved typedefs for it. + +2012-07-18 Antoine Labour <piman@chromium.org> + + [chromium] Introduce CCResourceProvider, replacing TextureAllocator and hiding textures from clients to allow transport + https://bugs.webkit.org/show_bug.cgi?id=91044 + + Reviewed by Adrienne Walker. + + This does several things: + - Add a CCResourceProvider class, that hides textures and the 3D context + from layers (except those that need it). Instead layers manage + "resources". In the future, resources are expected to be transportable + to a "parent" CCResourceProvider to allow flattening of nested + compositors. + - Replace texture ids by resource ids in DrawQuads (allowing them to be + serializable). + - Replace TextureAllocator uses by the CCResourceProvider class. + - Upload of data is done through the CCResourceProvider instead of + explicit GL calls. + - External textures are wrapped into a resource at draw time (see + caveat/FIXME in CCTextureLayerImpl). + - Rendering with the resources is done through an explicit + beginRenderFrom/endRenderFrom that exposes the texture only between that + pair. + - Merge all the LayerTextureSubImage instances (one per layer), into a + single instance on the CCResourceProvider. + + Added CCResourceProviderTest, the refactoring is covered by existing tests. + + * WebCore.gypi: + * platform/chromium/support/WebCompositorTextureQuad.cpp: + (WebKit::WebCompositorTextureQuad::create): + (WebKit::WebCompositorTextureQuad::WebCompositorTextureQuad): + * platform/chromium/support/WebCompositorTileQuad.cpp: + (WebKit::WebCompositorTileQuad::create): + (WebKit::WebCompositorTileQuad::WebCompositorTileQuad): + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapCanvasLayerTextureUpdater::Texture::updateRect): + (WebCore::BitmapCanvasLayerTextureUpdater::create): + (WebCore::BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater): + (WebCore::BitmapCanvasLayerTextureUpdater::prepareToUpdate): + (WebCore::BitmapCanvasLayerTextureUpdater::updateTextureRect): + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: + (WebCore): + (Texture): + (BitmapCanvasLayerTextureUpdater): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect): + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::create): + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: + (Texture): + (BitmapSkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::createAcceleratedCanvas): + (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect): + (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect): + * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h: + (Texture): + (FrameBufferSkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerTextureUpdater::create): + (WebCore::ImageLayerTextureUpdater::updateTextureRect): + (WebCore::ImageLayerTextureUpdater::ImageLayerTextureUpdater): + (ImageLayerTextureUpdater): + (WebCore::ImageLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::create): + (WebCore::LayerRendererChromium::LayerRendererChromium): + (WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame): + (WebCore::applyFilters): + (WebCore::LayerRendererChromium::drawBackgroundFilters): + (WebCore::LayerRendererChromium::drawRenderPassQuad): + (WebCore::LayerRendererChromium::drawTileQuad): + (WebCore::LayerRendererChromium::drawYUVVideoQuad): + (WebCore::LayerRendererChromium::drawTextureQuad): + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): + (WebCore::LayerRendererChromium::drawHeadsUpDisplay): + (WebCore::LayerRendererChromium::finishDrawingFrame): + (WebCore::LayerRendererChromium::getFramebufferTexture): + (WebCore::LayerRendererChromium::useRenderPass): + (WebCore::LayerRendererChromium::useScopedTexture): + (WebCore::LayerRendererChromium::bindFramebufferToTexture): + (WebCore::LayerRendererChromium::finishCurrentFramebuffer): + (WebCore): + (WebCore::LayerRendererChromium::initializeSharedObjects): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + (WebCore::LayerRendererChromium::resourceProvider): + * platform/graphics/chromium/LayerTextureSubImage.cpp: + (WebCore::LayerTextureSubImage::LayerTextureSubImage): + (WebCore::LayerTextureSubImage::upload): + (WebCore::LayerTextureSubImage::uploadWithTexSubImage): + (WebCore::LayerTextureSubImage::uploadWithMapTexSubImage): + * platform/graphics/chromium/LayerTextureSubImage.h: + (WebKit): + (LayerTextureSubImage): + * platform/graphics/chromium/LayerTextureUpdater.h: + (WebCore): + (Texture): + * platform/graphics/chromium/ManagedTexture.cpp: + (WebCore::ManagedTexture::ManagedTexture): + (WebCore::ManagedTexture::reserve): + (WebCore::ManagedTexture::allocate): + (WebCore::ManagedTexture::steal): + (WebCore::ManagedTexture::clear): + * platform/graphics/chromium/ManagedTexture.h: + (WebCore::ManagedTexture::resourceId): + (ManagedTexture): + * platform/graphics/chromium/ScrollbarLayerChromium.cpp: + (WebCore::ScrollbarLayerChromium::pushPropertiesTo): + (WebCore::ScrollbarLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/TextureCopier.cpp: + (WebCore::AcceleratedTextureCopier::copyTexture): + (WebCore): + (WebCore::AcceleratedTextureCopier::flush): + * platform/graphics/chromium/TextureCopier.h: + (TextureCopier): + (AcceleratedTextureCopier): + * platform/graphics/chromium/TextureManager.cpp: + (WebCore::TextureManager::TextureManager): + (WebCore::TextureManager::deleteEvictedTextures): + (WebCore::TextureManager::removeTexture): + (WebCore::TextureManager::allocateTexture): + (WebCore::TextureManager::requestTexture): + * platform/graphics/chromium/TextureManager.h: + (WebCore): + (WebCore::TextureManager::create): + (TextureManager): + (TextureInfo): + (EvictionEntry): + * platform/graphics/chromium/TextureUploader.h: + (TextureUploader): + * platform/graphics/chromium/ThrottledTextureUploader.cpp: + (WebCore::ThrottledTextureUploader::uploadTexture): + * platform/graphics/chromium/ThrottledTextureUploader.h: + (ThrottledTextureUploader): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::pushPropertiesTo): + * platform/graphics/chromium/TrackingTextureAllocator.cpp: Removed. + * platform/graphics/chromium/TrackingTextureAllocator.h: Removed. + * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: + (WebCore::CCHeadsUpDisplay::draw): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::willDraw): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h: + (CCIOSurfaceLayerImpl): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::willDraw): + (WebCore::CCLayerImpl::didDraw): + (WebCore::CCLayerImpl::contentsResourceId): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::initializeLayerRenderer): + (WebCore::CCLayerTreeHost::deleteContentsTexturesOnImplThread): + (WebCore::CCLayerTreeHost::beginCommitOnImplThread): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore): + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::CCLayerTreeHostImpl::releaseContentsTextures): + (WebCore::CCLayerTreeHostImpl::didDrawAllLayers): + (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (WebCore): + (WebCore::CCLayerTreeHostImpl::resourceProvider): + (CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + (WebCore::CCPrioritizedTexture::acquireBackingTexture): + (WebCore::CCPrioritizedTexture::resourceId): + (WebCore::CCPrioritizedTexture::upload): + (WebCore::CCPrioritizedTexture::beginRenderTo): + (WebCore::CCPrioritizedTexture::endRenderTo): + (WebCore): + * platform/graphics/chromium/cc/CCPrioritizedTexture.h: + (WebCore): + (CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::Backing::resourceId): + (WebCore::CCPrioritizedTexture::Backing::Backing): + (Backing): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + (WebCore::CCPrioritizedTextureManager::CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::~CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): + (WebCore::CCPrioritizedTextureManager::reduceMemory): + (WebCore::CCPrioritizedTextureManager::clearAllMemory): + (WebCore::CCPrioritizedTextureManager::allBackingTexturesWereDeleted): + (WebCore::CCPrioritizedTextureManager::createBacking): + (WebCore::CCPrioritizedTextureManager::destroyBacking): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: + (WebCore::CCPrioritizedTextureManager::create): + (CCPrioritizedTextureManager): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::maskResourceId): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderer.h: + (WebCore): + (CCRenderer): + * platform/graphics/chromium/cc/CCResourceProvider.cpp: Added. + (WebCore): + (WebCore::textureToStorageFormat): + (WebCore::isTextureFormatSupportedForStorage): + (WebCore::CCResourceProvider::create): + (WebCore::CCResourceProvider::~CCResourceProvider): + (WebCore::CCResourceProvider::graphicsContext3D): + (WebCore::CCResourceProvider::inUseByConsumer): + (WebCore::CCResourceProvider::createResource): + (WebCore::CCResourceProvider::createResourceFromExternalTexture): + (WebCore::CCResourceProvider::deleteResource): + (WebCore::CCResourceProvider::deleteOwnedResources): + (WebCore::CCResourceProvider::upload): + (WebCore::CCResourceProvider::beginRenderTo): + (WebCore::CCResourceProvider::endRenderTo): + (WebCore::CCResourceProvider::beginRenderFrom): + (WebCore::CCResourceProvider::endRenderFrom): + (WebCore::CCResourceProvider::CCResourceProvider): + (WebCore::CCResourceProvider::initialize): + * platform/graphics/chromium/cc/CCResourceProvider.h: Added. + (WebKit): + (WebCore): + (CCResourceProvider): + (WebCore::CCResourceProvider::maxTextureSize): + (WebCore::CCResourceProvider::numResources): + (Resource): + * platform/graphics/chromium/cc/CCScopedTexture.cpp: + (WebCore::CCScopedTexture::CCScopedTexture): + (WebCore::CCScopedTexture::allocate): + (WebCore::CCScopedTexture::free): + * platform/graphics/chromium/cc/CCScopedTexture.h: + (WebCore::CCScopedTexture::create): + (CCScopedTexture): + (WebCore::CCScopedTexture::beginRenderTo): + (WebCore::CCScopedTexture::endRenderTo): + (WebCore::CCScopedTexture::beginRenderFrom): + (WebCore::CCScopedTexture::endRenderFrom): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp: + (WebCore::CCScrollbarLayerImpl::CCScrollbarLayerImpl): + (WebCore): + (WebCore::CCScrollbarLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h: + (WebCore::CCScrollbarLayerImpl::setBackTrackResourceId): + (WebCore::CCScrollbarLayerImpl::setForeTrackResourceId): + (WebCore::CCScrollbarLayerImpl::setThumbResourceId): + (CCScrollbarLayerImpl): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::recreateContext): + (WebCore::CCSingleThreadProxy::doCommit): + (WebCore::CCSingleThreadProxy::stop): + * platform/graphics/chromium/cc/CCTexture.h: + (WebCore::CCTexture::id): + (WebCore::CCTexture::setId): + (CCTexture): + * platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: + (WebCore::CCTextureLayerImpl::CCTextureLayerImpl): + (WebCore::CCTextureLayerImpl::willDraw): + (WebCore): + (WebCore::CCTextureLayerImpl::appendQuads): + (WebCore::CCTextureLayerImpl::didDraw): + * platform/graphics/chromium/cc/CCTextureLayerImpl.h: + (CCTextureLayerImpl): + * platform/graphics/chromium/cc/CCTextureUpdater.cpp: + (WebCore::CCTextureUpdater::update): + * platform/graphics/chromium/cc/CCTextureUpdater.h: + (WebCore): + (CCTextureUpdater): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::scheduledActionUpdateMoreResources): + (WebCore::CCThreadProxy::layerTreeHostClosedOnImplThread): + (WebCore::CCThreadProxy::recreateContextOnImplThread): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::DrawableTile::resourceId): + (WebCore::DrawableTile::setResourceId): + (WebCore::DrawableTile::DrawableTile): + (DrawableTile): + (WebCore::CCTiledLayerImpl::contentsResourceId): + (WebCore::CCTiledLayerImpl::hasTextureIdForTileAt): + (WebCore::CCTiledLayerImpl::appendQuads): + (WebCore::CCTiledLayerImpl::pushTileProperties): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::CCVideoLayerImpl): + (WebCore::CCVideoLayerImpl::~CCVideoLayerImpl): + (WebCore::CCVideoLayerImpl::willDraw): + (WebCore::CCVideoLayerImpl::willDrawInternal): + (WebCore::CCVideoLayerImpl::appendQuads): + (WebCore::CCVideoLayerImpl::didDraw): + (WebCore::CCVideoLayerImpl::FramePlane::allocateData): + (WebCore::CCVideoLayerImpl::FramePlane::freeData): + (WebCore::CCVideoLayerImpl::allocatePlaneData): + (WebCore::CCVideoLayerImpl::copyPlaneData): + (WebCore::CCVideoLayerImpl::freePlaneData): + (WebCore::CCVideoLayerImpl::freeUnusedPlaneData): + (WebCore::CCVideoLayerImpl::didLoseContext): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + (CCVideoLayerImpl): + (FramePlane): + (WebCore::CCVideoLayerImpl::FramePlane::FramePlane): + +2012-07-18 Hayato Ito <hayato@chromium.org> + + [Shadow] A 'selectstart' event fired on distributed nodes should not be stopped at shadow boundary of the parent shadow host. + https://bugs.webkit.org/show_bug.cgi?id=90508 + + Reviewed by Dimitri Glazkov. + + We should not stop some kinds of events at the shadow boundary of a shadow host if the + event is fired on distributed nodes. + + See the spec for such kinds of events. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#events-that-are-always-stopped + + Test: fast/dom/shadow/events-stopped-at-shadow-boundary.html + + * dom/EventDispatcher.cpp: + (WebCore::EventDispatcher::ensureEventAncestors): + (WebCore::inTheSameScope): + (WebCore): + (WebCore::EventDispatcher::determineDispatchBehavior): + * dom/EventDispatcher.h: + (EventDispatcher): + +2012-07-18 Julien Chaffraix <jchaffraix@webkit.org> + + Crash in RenderTableSection::addCell. + http://webkit.org/b/89496 + + Reviewed by Abhishek Arya. + + The issue comes from RenderBox::splitAnonymousBoxesAroundChild that would move sections + across tables but didn't force the table to do a synchronous section recalc. This opened + the way for race conditions where we would query the table column structure while it's dirty + (this is not uncommon but as usually the table's column representation is always bigger or + more split than a section's, it's usually harmless). + + The fix is to force a synchronous section recalc. + + Test: fast/table/split-table-no-section-update-crash.html + + * rendering/RenderBox.cpp: + (WebCore::markBoxForRelayoutAfterSplit): + Changed to call forceSectionsRecalc ie force a section recalc. + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::recalcSections): + Added missing ASSERT for unneeded calls. + + * rendering/RenderTable.h: + (WebCore::RenderTable::forceSectionsRecalc): + Added this helper function. + +2012-07-18 Julien Chaffraix <jchaffraix@webkit.org> + + Avoid calling GraphicsContext drawing primitives for 0px borders + https://bugs.webkit.org/show_bug.cgi?id=90039 + + Reviewed by Eric Seidel. + + The current code would happily call GraphicsContext to draw empty (0px) borders. + There is no good use case for going all the way to GraphicsContext in this case as + 0px borders, regardless of the border-style, will not be painted. Thus this is a waste + of time on all platforms. On Chromium, this trigger some issues with pdf rendering as + Skia interprets 0px lines as very thin lines. + + This change adds 0-checks in the border painting code as well as ASSERTs for + performance and to catch future bad use. + + Test: fast/borders/0px-borders.html + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/openvg/GraphicsContextOpenVG.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/wx/GraphicsContextWx.cpp: + (WebCore::GraphicsContext::drawRect): + Added an ASSERT on all platforms to catch incorrect use. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::BorderEdge::shouldRender): + Changed to not render 0px borders, which should avoid unneeded work + in the patining code (context saving / restoring or transparency layer + push). + + (WebCore::RenderBoxModelObject::paintOneBorderSide): + Added an ASSERT here that the border side is not empty. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::drawLineForBoxSide): + Added an early return with a comment as to why it's not feasible to + ASSERT as would be best. + +2012-07-18 Elliott Sprehn <esprehn@gmail.com> + + REGRESSION (r89900): Assertion failure on null view() when destroying the document + https://bugs.webkit.org/show_bug.cgi?id=91547 + + Reviewed by Abhishek Arya. + + Check for document destruction during insertion to avoid crash on null RenderView when trying + to count the number of RenderQuote and RenderCounter objects. + + Test: fast/css-generated-content/bug91547.html + + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::appendChildNode): + (WebCore::RenderObjectChildList::insertChildNode): + +2012-07-18 Nat Duca <nduca@chromium.org> + + [chromium] Add histogram for tracking compositor-thread frame rate + https://bugs.webkit.org/show_bug.cgi?id=91692 + + Reviewed by Adrienne Walker. + + This patch tracks the interval between compositor thread frames + and pushes it into a platform histogram. This allows us to track + compositor-thread frame rate in the wild. + + * platform/graphics/chromium/cc/CCFrameRateCounter.cpp: + (WebCore::CCFrameRateCounter::markBeginningOfFrame): + +2012-07-18 Dan Bernstein <mitz@apple.com> + + Hit testing in the gap between pages returns incorrect results + https://bugs.webkit.org/show_bug.cgi?id=91695 + + Reviewed by Dave Hyatt. + + Test: fast/multicol/hit-test-gap-between-pages.html + + * rendering/RenderBlock.h: + (RenderBlock): Promoted adjustPointToColumnContents from private to protected. + * rendering/RenderView.cpp: + (WebCore::RenderView::updateHitTestResult): If we get here, and we make the document element + the inner node, adjust the local point for columns. + +2012-07-18 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Direction parameter ignored by some openCursor() overloads + https://bugs.webkit.org/show_bug.cgi?id=91687 + + Reviewed by Tony Chang. + + A few of the openCursor() and openKeyCursor() overloads were not passing along the + direction parameter, resulting in the default direction being used. Trivial fixes. + Also, added a whitespace fix to a relevant console warning. + + Test: storage/indexeddb/cursor-overloads.html + + * Modules/indexeddb/IDBIndex.cpp: + (WebCore::IDBIndex::openCursor): + (WebCore::IDBIndex::openKeyCursor): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::openCursor): + +2012-07-18 Erik Arvidsson <arv@chromium.org> + + [V8] Improve Replaceable extended attribute + https://bugs.webkit.org/show_bug.cgi?id=91668 + + Reviewed by Adam Barth. + + Replaceable is working by chance in the V8 bindings because V8 does not correctly handle + read only properties on the prototype chain. With this change we generate a setter that + uses ForceSet to replace the existing property when set. + + Test: fast/dom/Window/replaceable.html + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateReplaceableAttrSetter): + (GenerateFunctionCallback): + (GenerateSingleBatchedAttribute): + (GenerateImplementation): + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::replaceableAttribute): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + (webkit_dom_test_obj_get_replaceable_attribute): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + (WebCore::jsTestObjReplaceableAttribute): + (WebCore::setJSTestObjReplaceableAttribute): + * bindings/scripts/test/JS/JSTestObj.h: + (WebCore): + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj replaceableAttribute]): + (-[DOMTestObj setReplaceableAttribute:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::replaceableAttributeAttrGetter): + (TestObjV8Internal): + (WebCore::TestObjV8Internal::TestObjReplaceableAttrSetter): + (WebCore): + +2012-07-18 Erik Arvidsson <arv@chromium.org> + + [V8] Remove temporary flag override for es52_globals + https://bugs.webkit.org/show_bug.cgi?id=91681 + + Reviewed by Adam Barth. + + V8 has now changed their default value for the es52_globals so we no longer needs this override. + + No new tests. No change in functionality. + + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::initContextIfNeeded): + * bindings/v8/WorkerContextExecutionProxy.cpp: + (WebCore::WorkerContextExecutionProxy::initIsolate): + +2012-07-18 Alexandre Elias <aelias@google.com> + + [chromium] Ubercomp: add id to SharedQuadState + https://bugs.webkit.org/show_bug.cgi?id=91670 + + Reviewed by Adrienne Walker. + + This assigns an integer ID to SharedQuadState objects and a + corresponding ID to quads. This ID is unique only within a + RenderPass and currently is just set to the index in the shared quad + state list. This is redundant with the pointer and exists to + simplify serialization. + + I found out that pointer rewriting within a pickler is blocked by + pointers to memory being const there, so the reassignment will have to + be performed in the application layer anyway. In that case, it's + simplest to add some ID integers. + + No new tests (will introduce them when making use of the ID). + + * platform/chromium/support/WebCompositorQuad.cpp: + (WebKit::WebCompositorQuad::WebCompositorQuad): + (WebKit::WebCompositorQuad::setSharedQuadState): + (WebKit): + * platform/chromium/support/WebCompositorSharedQuadState.cpp: + (WebKit::WebCompositorSharedQuadState::WebCompositorSharedQuadState): + (WebKit::WebCompositorSharedQuadState::create): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::createSharedQuadState): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsForLayer): + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + (WebCore::CCRenderPass::appendQuadsToFillScreen): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::createSharedQuadState): + (WebCore::CCRenderSurface::createReplicaSharedQuadState): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + +2012-07-18 Alexandre Elias <aelias@google.com> + + [chromium] Ubercomp: clean up CCRenderer interface + https://bugs.webkit.org/show_bug.cgi?id=91555 + + Reviewed by Adrienne Walker. + + I replaced the one-by-one RenderPass calls with a new drawFrame() + method that directly takes a CCRenderPassList, and moved a small + amount of code from CCLayerTreeHostImpl to implement it. In ubercomp + mode, we will produce a frame bundle rather than a command-stream, so + the full list is easier to work with. + + Also, give empty default implementations for the methods that don't + need to do anything in a non-GL context, and make private + setScissorToRect. + + No new tests (no-op refactoring). + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawFrame): + (WebCore): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::drawLayers): + * platform/graphics/chromium/cc/CCRenderer.h: + (WebCore::CCRenderer::viewportChanged): + (WebCore::CCRenderer::decideRenderPassAllocationsForFrame): + (WebCore::CCRenderer::haveCachedResourcesForRenderPassId): + (CCRenderer): + (WebCore::CCRenderer::finishDrawingFrame): + (WebCore::CCRenderer::doNoOp): + (WebCore::CCRenderer::isContextLost): + +2012-07-18 Pravin D <pravind.2k4@gmail.com> + + Content size of child having percent height inside a fixed height container having overflow:auto is wrongly calculated + https://bugs.webkit.org/show_bug.cgi?id=11355 + + Reviewed by Julien Chaffraix. + + The content height of a child must be container height minus padding, border width and height of horizontal scrollbar(if any). + + Tests: fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html + fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computePercentageLogicalHeight): + (WebCore::RenderBox::computeReplacedLogicalHeightUsing): + Subtracting the height of the scrollbar from the client height when the client has percentage height. + +2012-07-18 Pravin D <pravind.2k4@gmail.com> + + Content size of child having percent height inside a fixed height container having overflow:auto is wrongly calculated + https://bugs.webkit.org/show_bug.cgi?id=11355 + + Reviewed by Julien Chaffraix. + + The content height of a child must be container height minus padding, border width and height of horizontal scrollbar(if any). + + Tests: fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html + fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computePercentageLogicalHeight): + (WebCore::RenderBox::computeReplacedLogicalHeightUsing): + Subtracting the height of the scrollbar from the client height when the client has percentage height. + +2012-07-18 Anantanarayanan G Iyengar <ananta@chromium.org> + + [chromium] Ensure that the compositor code which is aware of flipped status of video-textures + per platform sets the flipped bit to false on Windows. + https://bugs.webkit.org/show_bug.cgi?id=91562 + + Reviewed by Adrienne Walker. + + No new tests. (HW video decode is still only being tested manually for orientation) + + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): + +2012-07-18 Emil A Eklund <eae@chromium.org> + + Replace uses of RenderBox::x(), y() in rendering code with with point and size methods + https://bugs.webkit.org/show_bug.cgi?id=91549 + + Reviewed by Eric Seidel. + + Replaces uses of RenderBox::x() and RenderBox::y() with + RenderBox::location(), RenderBox::locationOffset() and + RenderBox::frameRect(). + + No new tests, no change in functionality. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::positionNewFloats): + Use child->frameRect() and child->location() instead of constructing a + rect and size from the x, y, width and height values. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::repaintDuringLayoutIfMoved): + Compare and copy m_frameRect directly instead of comparing and copying + the individual values. + + (WebCore::RenderBox::localCaretRect): + Use location() instead of x() and y(). + + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): + Use pixelSnappedIntSize and RenderBox::size() instead of computing and + snapping the width and height separately. + + * rendering/RenderImage.cpp: + (WebCore::RenderImage::nodeAtPoint): + USe locationOffset() instead of creating a new LayoutSize object from the + x() and y() values. + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::updateHitTestResult): + Move by Size instead of x and y value. + + (WebCore::RenderInline::addFocusRingRects): + Move by Size instead of x and y value. + + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::offsetFromContainer): + Shrink offset by size instead of using x and y values. + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::layoutRows): + (WebCore::RenderTableSection::setLogicalPositionForCell): + Use child->frameRect() and child->location() instead of constructing a + rect and size from the x, y, width and height values. + + * rendering/svg/SVGRenderTreeAsText.cpp: + (WebCore::writeRenderSVGTextBox): + Use location() instead of x() and y(). + +2012-07-18 Tony Chang <tony@chromium.org> + + [chromium] Unreviewed, try to fix the chromium-win build after r123014. + + * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp: + +2012-07-18 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Fix some coding style violations + https://bugs.webkit.org/show_bug.cgi?id=91565 + + Reviewed by Tony Chang. + + In declarations, put the * next to the type not the identifier. + Remove k as a prefix for various constants. + + No new tests - no functional changes. + + * Modules/indexeddb/IDBCursorBackendImpl.cpp: + (WebCore::IDBCursorBackendImpl::prefetchContinueInternal): + * Modules/indexeddb/IDBFactoryBackendImpl.cpp: + (WebCore::computeFileIdentifier): + * Modules/indexeddb/IDBKey.h: + (WebCore::IDBKey::IDBKey): + * Modules/indexeddb/IDBLevelDBBackingStore.cpp: + (WebCore::IDBLevelDBBackingStore::getDatabaseNames): + (WebCore::IDBLevelDBBackingStore::getIDBDatabaseMetaData): + (WebCore::IDBLevelDBBackingStore::createIDBDatabaseMetaData): + (WebCore::IDBLevelDBBackingStore::updateIDBDatabaseMetaData): + (WebCore::IDBLevelDBBackingStore::deleteDatabase): + (WebCore::IDBLevelDBBackingStore::getObjectStores): + (WebCore::getNewObjectStoreId): + (WebCore::IDBLevelDBBackingStore::createObjectStore): + (WebCore::IDBLevelDBBackingStore::deleteObjectStore): + (WebCore::getNewVersionNumber): + (WebCore::IDBLevelDBBackingStore::nextAutoIncrementNumber): + (WebCore::IDBLevelDBBackingStore::forEachObjectStoreRecord): + (WebCore::IDBLevelDBBackingStore::getIndexes): + (WebCore::getNewIndexId): + (WebCore::IDBLevelDBBackingStore::createIndex): + (WebCore::IDBLevelDBBackingStore::putIndexDataForRecord): + (WebCore): + * Modules/indexeddb/IDBLevelDBCoding.cpp: + (IDBLevelDBCoding): + (WebCore::IDBLevelDBCoding::maxIDBKey): + (WebCore::IDBLevelDBCoding::minIDBKey): + (WebCore::IDBLevelDBCoding::decodeVarInt): + (WebCore::IDBLevelDBCoding::encodeIDBKey): + (WebCore::IDBLevelDBCoding::decodeIDBKey): + (WebCore::IDBLevelDBCoding::extractEncodedIDBKey): + (WebCore::IDBLevelDBCoding::keyTypeByteToKeyType): + (WebCore::IDBLevelDBCoding::compareEncodedIDBKeys): + (WebCore::IDBLevelDBCoding::encodeIDBKeyPath): + (WebCore::IDBLevelDBCoding::decodeIDBKeyPath): + (WebCore::IDBLevelDBCoding::compare): + (WebCore::IDBLevelDBCoding::KeyPrefix::KeyPrefix): + (WebCore::IDBLevelDBCoding::KeyPrefix::encode): + (WebCore::IDBLevelDBCoding::KeyPrefix::compare): + (WebCore::IDBLevelDBCoding::KeyPrefix::type): + (WebCore::IDBLevelDBCoding::SchemaVersionKey::encode): + (WebCore::IDBLevelDBCoding::MaxDatabaseIdKey::encode): + (WebCore::IDBLevelDBCoding::DatabaseFreeListKey::decode): + (WebCore::IDBLevelDBCoding::DatabaseFreeListKey::encode): + (WebCore::IDBLevelDBCoding::DatabaseNameKey::decode): + (WebCore::IDBLevelDBCoding::DatabaseNameKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::encodeMaxKey): + (WebCore::IDBLevelDBCoding::IndexMetaDataKey::decode): + (WebCore::IDBLevelDBCoding::IndexMetaDataKey::encode): + (WebCore::IDBLevelDBCoding::IndexMetaDataKey::encodeMaxKey): + (WebCore::IDBLevelDBCoding::ObjectStoreFreeListKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreFreeListKey::encode): + (WebCore::IDBLevelDBCoding::IndexFreeListKey::decode): + (WebCore::IDBLevelDBCoding::IndexFreeListKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreNamesKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreNamesKey::encode): + (WebCore::IDBLevelDBCoding::IndexNamesKey::decode): + (WebCore::IDBLevelDBCoding::IndexNamesKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreDataKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreDataKey::encode): + (WebCore::IDBLevelDBCoding::ExistsEntryKey::decode): + (WebCore::IDBLevelDBCoding::ExistsEntryKey::encode): + (WebCore::IDBLevelDBCoding::IndexDataKey::decode): + * Modules/indexeddb/IDBLevelDBCoding.h: + (IDBLevelDBCoding): + (ObjectStoreDataKey): + (ExistsEntryKey): + +2012-07-18 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call SQLiteFileSystem-related functions directly + https://bugs.webkit.org/show_bug.cgi?id=91631 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * Modules/webdatabase/chromium/QuotaTracker.cpp: + (WebCore::QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin): + * platform/chromium/PlatformSupport.h: + (PlatformSupport): + * platform/sql/chromium/SQLiteFileSystemChromium.cpp: + (WebCore::SQLiteFileSystem::deleteDatabaseFile): + (WebCore::SQLiteFileSystem::getDatabaseFileSize): + * platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp: + * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp: + +2012-07-18 Oliver Hunt <oliver@apple.com> + + WebKit provides APIs that make it possible for JSC to attempt to initialise the heap without initialising threading + https://bugs.webkit.org/show_bug.cgi?id=91663 + + Reviewed by Filip Pizlo. + + Initialising a JSGlobalData now requires us to have initialised JSC's threading + logic, as that also initialises the JSC VM runtime options. WebKit provides a + number of routines that make use of commonJSGlobalData() that can be used before + webcore has called the appropriate initialisation routine. This patch makes the + minimal change of ensuring that commonJSGlobalData initialises threading before + attempting to create the common heap. + + * bindings/js/JSDOMWindowBase.cpp: + (WebCore::JSDOMWindowBase::commonJSGlobalData): + +2012-07-18 Michael Saboff <msaboff@apple.com> + + Make TextCodecUTF8 handle 8 bit data without converting to UChar's + https://bugs.webkit.org/show_bug.cgi?id=90320 + + Reviewed by Oliver Hunt. + + Change UTF8 Codec to produce 8-bit strings when data fits in 8-bit range. + First we try decoding the string as all 8-bit and then fall back to 16 bit + when we find the first character that doesn't fit in 8 bits. Then we take + the already decoded data and copy / convert it to a 16-bit buffer and then + continue process the rest of the stream as 16-bits. + + No new tests, no change in functionality. + + * platform/text/TextCodecUTF8.cpp: + (WebCore::TextCodecUTF8::handleError): + (WebCore::TextCodecUTF8::decode): + * platform/text/TextCodecUTF8.h: + (TextCodecUTF8): + +2012-07-18 Sailesh Agrawal <sail@chromium.org> + + Chromium Mac: Add TEXTURE_RECTANGLE_ARB support to CCVideoLayerImpl + https://bugs.webkit.org/show_bug.cgi?id=91169 + + Reviewed by Adrienne Walker. + + This extends CCVideoLayerImpl to support TEXTURE_RECTANGLE_ARB. This texture target is used by the Mac hardware accelerated video decoder. + + No new tests (HW video decode on Mac is being tested manually.). + + * platform/chromium/support/WebCompositorIOSurfaceQuad.cpp: + (WebKit::WebCompositorIOSurfaceQuad::create): Added an orientation argument. + (WebKit::WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad): Added an orientation argument. + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): Added support for non-flipped IOSurface textures. + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): Changed TextureIOSurfaceProgram to be non-flipped. To draw flipped textures drawIOSurfaceQuad sets a different value for texTransformLocation. + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::appendQuads): Updated call to CCIOSurfaceDrawQuad constructor. + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): Added support for drawing TEXTURE_RECTANGLE_ARB textures. + +2012-07-18 Michael Saboff <msaboff@apple.com> + + Make TextCodecLatin1 handle 8 bit data without converting to UChar's + https://bugs.webkit.org/show_bug.cgi?id=90319 + + Reviewed by Oliver Hunt. + + Updated codec to create 8 bit strings where possible. + We assume that the incoming stream can all be decoded as 8-bit values. + If we find a 16-bit value, we take the already decoded data and + copy / convert it to a 16-bit buffer and then continue process the rest + of the stream as 16-bits. + + No new tests, functionality covered with existing tests. + + * platform/text/TextCodecASCIIFastPath.h: + (WebCore::copyASCIIMachineWord): + * platform/text/TextCodecLatin1.cpp: + (WebCore::TextCodecLatin1::decode): + +2012-07-18 Dimitri Glazkov <dglazkov@chromium.org> + + Fix up old name in RuleSet::addRulesFromSheet + https://bugs.webkit.org/show_bug.cgi?id=91646 + + Reviewed by Andreas Kling. + + Simple parameter rename, no change in functionality. + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): Renamed styleSelector to resolver to reflect recent rename of the parameter type. + +2012-07-18 Vincent Scheib <scheib@chromium.org> + + Unify allowfullscreen logic in Document::webkitFullScreenEnabled and fullScreenIsAllowedForElement. + https://bugs.webkit.org/show_bug.cgi?id=91448 + + Reviewed by Adrienne Walker. + + Unifies redundant traversal logic and static cast previously used + to determine if an element or document can be made fullscreen. + This clean up prepares for pointer lock, which will use the same logic. + + Added a test to detect an edge case of an owning document with + fullscreen permision moving an iframe to fullscreen, while that iframe + does not have permision for its contents to be made fullscreen. + + Test: fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent.html + + * dom/Document.cpp: + (WebCore::isAttributeOnAllOwners): + (WebCore::Document::fullScreenIsAllowedForElement): + (WebCore::Document::webkitFullscreenEnabled): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Add central error management to EFL port + https://bugs.webkit.org/show_bug.cgi?id=91598 + + Reviewed by Kenneth Rohde Christiansen. + + Define possible error types in ErrorsEfl so + that we can reuse the header in both WebKit1 + and WebKit2. This is inspired from the GTK + port. + + No new tests, no behavior change. + + * PlatformEfl.cmake: + * platform/efl/ErrorsEfl.cpp: Added. + (WebCore): + (WebCore::cancelledError): + (WebCore::blockedError): + (WebCore::cannotShowURLError): + (WebCore::interruptedForPolicyChangeError): + (WebCore::cannotShowMIMETypeError): + (WebCore::fileDoesNotExistError): + (WebCore::pluginWillHandleLoadError): + (WebCore::downloadNetworkError): + (WebCore::downloadCancelledByUserError): + (WebCore::downloadDestinationError): + (WebCore::printError): + (WebCore::printerNotFoundError): + (WebCore::invalidPageRangeToPrint): + * platform/efl/ErrorsEfl.h: Added. + (WebCore): + +2012-07-18 Varun Jain <varunjain@chromium.org> + + [chromium] Fix crash in DragImageTest caused by r122996 + https://bugs.webkit.org/show_bug.cgi?id=91653 + + Reviewed by Tony Chang. + + Covered by existing DragImageTest. + + * platform/chromium/DragImageChromiumSkia.cpp: + (WebCore::deleteDragImage): + +2012-07-18 Varun Jain <varunjain@chromium.org> + + [chromium] Drag image for image elements should be scaled with device scale factor. + https://bugs.webkit.org/show_bug.cgi?id=89688 + + Reviewed by Adam Barth. + + Modified ManualTest: ManualTests/chromium/drag-image-accounts-for-device-scale.html + + * page/Frame.cpp: + (WebCore::Frame::nodeImage): + (WebCore::Frame::dragImageForSelection): + * platform/chromium/DragImageChromiumSkia.cpp: + (WebCore::dragImageSize): + (WebCore::deleteDragImage): + (WebCore::scaleDragImage): + (WebCore::dissolveDragImageToFraction): + (WebCore::createDragImageFromImage): + * platform/chromium/DragImageRef.h: + (DragImageChromium): + (WebCore): + * platform/graphics/skia/BitmapImageSingleFrameSkia.h: + (BitmapImageSingleFrameSkia): + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::ImageBuffer): + (WebCore::ImageBuffer::copyImage): + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia): + (WebCore::BitmapImageSingleFrameSkia::create): + * platform/graphics/skia/NativeImageSkia.cpp: + (WebCore::NativeImageSkia::NativeImageSkia): + * platform/graphics/skia/NativeImageSkia.h: + (NativeImageSkia): + (WebCore::NativeImageSkia::resolutionScale): + +2012-07-18 Yong Li <yoli@rim.com> + + [BlackBerry] Move about: URL handling out of WebCore + https://bugs.webkit.org/show_bug.cgi?id=91541 + + Reviewed by Rob Buis. + + Remove about URL handling from our NetworkJob. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::NetworkJob): + (WebCore::NetworkJob::initialize): + (WebCore::NetworkJob::cancelJob): + (WebCore::NetworkJob::sendResponseIfNeeded): + * platform/network/blackberry/NetworkJob.h: + (NetworkJob): + * platform/network/blackberry/NetworkManager.cpp: + (WebCore::NetworkManager::startJob): + +2012-07-18 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r122984. + http://trac.webkit.org/changeset/122984 + https://bugs.webkit.org/show_bug.cgi?id=91171 + + Broken the shared build, need to export a SkData in skia + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::setURLForRect): + +2012-07-18 Rob Buis <rbuis@rim.com> + + Alignment crash in MIMESniffer + https://bugs.webkit.org/show_bug.cgi?id=89787 + + Reviewed by Yong Li. + + PR 169064 + + Prevent ASSERT on unaligned data. Special-case handling of unaligned data + to maskedCompareSlowCase. + + No test, too hard to reproduce. + + * platform/network/MIMESniffing.cpp: + (std::maskedCompareSlowCase): + (std): + (std::maskedCompare): + +2012-07-18 Steve VanDeBogart <vandebo@chromium.org> + + Chrome/Skia: PDF print output does not have clickable links. + https://bugs.webkit.org/show_bug.cgi?id=91171 + + Reviewed by Stephen White. + + Connect GraphicsContext::setURLForRect to Skia's new API for annotations. + + Printing is not generally testable. + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::setURLForRect): + +2012-07-18 Philippe Normand <pnormand@igalia.com> + + [GStreamer] 0.11 build broken + https://bugs.webkit.org/show_bug.cgi?id=91629 + + Reviewed by Alexis Menard. + + * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: + (webkitVideoSinkProposeAllocation): Pass null GstStructure to + gst_query_add_allocation_meta(). Our propose-allocation method + is simple enough to not need to set it. + +2012-07-18 Chris Fleizach <cfleizach@apple.com> + + AX: <input type="submit"> unlabelled. + https://bugs.webkit.org/show_bug.cgi?id=91563 + + Reviewed by Adele Peterson. + + Make sure the default value is returned if there is no other value specified. + + Test: platform/mac/accessibility/submit-button-default-value.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::title): + +2012-07-17 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Remove awkward anchorPoint usage that implicity affects layer position + https://bugs.webkit.org/show_bug.cgi?id=91472 + + Reviewed by Adrienne Walker. + + Covered by existing layout tests and unit tests, several existing unit tests updated. + + In GraphicsLayerChromium, anchorPoint() implicity affects + position(). Therefore, unit tests needed to remember to set + anchorPoint correctly when trying to position layers for + testing. However, it's easy to forget that initialization, and + probably shouldn't be necessary anyway since conceptually + anchorPoint does not affect layer position. + + This patch removes the "actualPosition + anchorPoint" quirk in + GraphicsLayerChromium, so that this problem is avoided. + + * platform/graphics/chromium/GraphicsLayerChromium.cpp: + (WebCore::GraphicsLayerChromium::updateLayerPosition): No longer computes position + anchorPoint. Instead this is done in calcDrawTransformsInternal. + (WebCore::GraphicsLayerChromium::updateLayerSize): No longer affects computation of position. + (WebCore::GraphicsLayerChromium::updateAnchorPoint): No longer affects computation of position + (WebCore::GraphicsLayerChromium::updateLayerPreserves3D): Position is initialized to zero instead of relative to anchorPoint + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateDrawTransformsInternal): explicitly use position + anchorPoint in this code, for both layer and replica. + Note that replicaLayer now uses its own anchorPoint, which seems to be more consistent with Safari behavior. + +2012-07-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: [Regression] Save as file is missing in Network panel preview/response tabs. + https://bugs.webkit.org/show_bug.cgi?id=91625 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/HandlerRegistry.js: + * inspector/front-end/NetworkPanel.js: + +2012-07-18 Dirk Schulze <krit@webkit.org> + + SVG CSS property types with <number> don't support exponents + https://bugs.webkit.org/show_bug.cgi?id=52542 + + Reviewed by Nikolas Zimmermann. + + Parse numbers in SVG presentation attributes with SVG parser to support scientific notations. + The SVG parser is already well tested and has some extra checks for edge like protection from + overflow. + + The patch is based upon a patch of Bear Travis. + + Test: svg/css/scientific-numbers.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::lex): Use SVG parser to parse numbers of SVG attributes. + * svg/SVGParserUtilities.cpp: + (WebCore::parseSVGNumber): Added accessor to call from CSSParser with double value. + (WebCore): + * svg/SVGParserUtilities.h: + (WebCore): + + +2012-07-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: beautify the paused in debugger message, make it configurable from the front-end. + https://bugs.webkit.org/show_bug.cgi?id=91628 + + Reviewed by Vsevolod Vlasov. + + Made message smaller, using consistent font; + Made message configurable from the front-end. + + * English.lproj/localizedStrings.js: + * inspector/DOMNodeHighlighter.cpp: + (WebCore::InspectorOverlay::InspectorOverlay): + (WebCore::InspectorOverlay::setPausedInDebuggerMessage): + (WebCore::InspectorOverlay::update): + (WebCore::InspectorOverlay::drawPausedInDebugger): + * inspector/DOMNodeHighlighter.h: + (InspectorOverlay): + * inspector/Inspector.json: + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::setOverlayMessage): + (WebCore): + (WebCore::InspectorDebuggerAgent::clear): + * inspector/InspectorDebuggerAgent.h: + (InspectorDebuggerAgent): + * inspector/PageDebuggerAgent.cpp: + (WebCore::PageDebuggerAgent::setOverlayMessage): + * inspector/PageDebuggerAgent.h: + (PageDebuggerAgent): + * inspector/front-end/DebuggerModel.js: + (WebInspector.DebuggerModel.prototype._setDebuggerPausedDetails): + +2012-07-18 Douglas Stockwell <dstockwell@chromium.org> + + WebCore::StylePropertySet::addParsedProperties - crash + https://bugs.webkit.org/show_bug.cgi?id=91153 + + Reviewed by Andreas Kling. + + WebKitCSSKeyframeRule::style exposed an immutable StylePropertySet. + Modified to create a mutable copy on demand. + + Test: fast/css/css-keyframe-style-mutate-crash.html + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/WebKitCSSKeyframeRule.cpp: + (WebCore::StyleKeyframe::mutableProperties): Added, creates a mutable copy of properties as required. + (WebCore::WebKitCSSKeyframeRule::style): + * css/WebKitCSSKeyframeRule.h: + (WebCore::StyleKeyframe::properties): Made const, use mutableProperties to mutate. + +2012-07-18 Huang Dongsung <luxtella@company100.net> + + [Texmap] Make TextureMapperLayer clip m_state.needsDisplayRect with the layerRect. + https://bugs.webkit.org/show_bug.cgi?id=91595 + + Reviewed by Noam Rosenthal. + + Internal review by Kwang Yul Seo. + + Currently, TextureMapperLayer creates an ImageBuffer as big as + m_state.needsDisplayRect if m_state.needsDispaly is false. The size of + m_state.needsDisplayRect can be bigger than the size of the layerRect, so we may + consume more memory than the size of the layerRect. It even can cause crash if + m_state.needsDisplayRect is too big. + + No new tests, covered by existing tests. + + * platform/graphics/texmap/TextureMapperLayer.cpp: + (WebCore::TextureMapperLayer::updateBackingStore): + +2012-07-18 Jason Liu <jason.liu@torchmobile.com.cn> + + [BlackBerry] We should update the status in NetworkJob if there is a new one from libcurl. + https://bugs.webkit.org/show_bug.cgi?id=91475 + + Reviewed by Yong Li. + + Libcurl sometimes sends multiple status messages, we need to keep the last + one in NetworkJob. + We originally had the m_statusReceived check, then we found out that libcurl + sometimes sent additional 401 codes and added the 401 exception to the check, + and now we're removing the whole check(so we don't need the exception either). + + RIM PR# 163172 + Reviewed internally by Joe Mason. + + No new tests. This is caused by libcurl's multiple status messages. + So we don't need to write a test case for webkit. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::handleNotifyStatusReceived): + +2012-07-18 Kevin Ellis <kevers@chromium.org> + + TOUCH_ADJUSTMENT is too aggressive when snapping to large elements. + https://bugs.webkit.org/show_bug.cgi?id=91262 + + Reviewed by Antonio Gomes. + + Constrains the extent to which the touch point can be adjusted when + generating synthetic mouse events when TOUCH_ADJUSTEMNT is enabled. + Previously, the target position snapped to the center of the target + element, which can be far removed from the touch position when tapping + on or near a large element. The refined strategy is to leave the + adjusted position unchanged if tapping within the element or to snap + to the center of the overlap region if the touch point lies outside the + bounds of the element, but the touch area and element bounds overlap. + For non-rectilineary bounds, a point lying outside the element boundary + is pulled towards the center of the element, by an amount limited by + the radius of the touch area. + + Tests: touchadjustment/big-div.html + touchadjustment/rotated-node.html + + * page/TouchAdjustment.cpp: + (WebCore::TouchAdjustment::contentsToWindow): + (TouchAdjustment): + (WebCore::TouchAdjustment::snapTo): + (WebCore::TouchAdjustment::findNodeWithLowestDistanceMetric): + +2012-07-18 Sergey Rogulenko <rogulenko@google.com> + + Web Inspector: adding pause icon for JavaScript debugging + https://bugs.webkit.org/show_bug.cgi?id=90880 + + Reviewed by Pavel Feldman. + + Refactored DOMNodeHighlighter into InspectorOverlay class and added a feature to show a "pause" screen when + the Javascript debugger is paused. + + * inspector/DOMNodeHighlighter.cpp: + (WebCore::InspectorOverlay::InspectorOverlay): + (WebCore::InspectorOverlay::paint): + (WebCore::InspectorOverlay::drawOutline): + (WebCore::InspectorOverlay::getHighlight): + (WebCore::InspectorOverlay::setPausedInDebugger): + (WebCore::InspectorOverlay::hideHighlight): + (WebCore): + (WebCore::InspectorOverlay::highlightNode): + (WebCore::InspectorOverlay::setHighlightData): + (WebCore::InspectorOverlay::clearHighlightData): + (WebCore::InspectorOverlay::highlightedNode): + (WebCore::InspectorOverlay::update): + (WebCore::InspectorOverlay::drawHighlight): + (WebCore::InspectorOverlay::drawPausedInDebugger): + * inspector/DOMNodeHighlighter.h: + (WebCore): + (InspectorOverlay): + (WebCore::InspectorOverlay::create): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::drawHighlight): + (WebCore::InspectorController::getHighlight): + (WebCore::InspectorController::highlightedNode): + * inspector/InspectorController.h: + (WebCore): + (InspectorController): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::~InspectorDOMAgent): + (WebCore::InspectorDOMAgent::handleMousePress): + (WebCore::InspectorDOMAgent::mouseDidMoveOverElement): + (WebCore::InspectorDOMAgent::setSearchingForNode): + (WebCore::InspectorDOMAgent::setHighlightDataFromConfig): + (WebCore::InspectorDOMAgent::setInspectModeEnabled): + (WebCore::InspectorDOMAgent::highlightRect): + (WebCore::InspectorDOMAgent::highlightNode): + (WebCore::InspectorDOMAgent::highlightFrame): + (WebCore::InspectorDOMAgent::hideHighlight): + * inspector/InspectorDOMAgent.h: + (WebCore): + (WebCore::InspectorDOMAgent::create): + (InspectorDOMAgent): + * inspector/InspectorDebuggerAgent.h: + (InspectorDebuggerAgent): + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::create): + (WebCore::InspectorPageAgent::InspectorPageAgent): + (WebCore::InspectorPageAgent::didPaint): + * inspector/InspectorPageAgent.h: + (WebCore): + * inspector/PageDebuggerAgent.cpp: + (WebCore::PageDebuggerAgent::create): + (WebCore::PageDebuggerAgent::PageDebuggerAgent): + (WebCore::PageDebuggerAgent::disable): + (WebCore): + (WebCore::PageDebuggerAgent::didPause): + (WebCore::PageDebuggerAgent::didContinue): + * inspector/PageDebuggerAgent.h: + (WebCore): + (PageDebuggerAgent): + +2012-07-17 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: intern strings when processing timeline records + https://bugs.webkit.org/show_bug.cgi?id=91531 + + Reviewed by Pavel Feldman. + + - added StringPool that is capable of interning strings; + - used it in TimelineModel to process all incoming records; + + * inspector/front-end/TimelineModel.js: + (WebInspector.TimelineModel): + (WebInspector.TimelineModel.prototype._addRecord): + (WebInspector.TimelineModel.prototype.reset): + * inspector/front-end/utilities.js: + +2012-07-18 Scott Graham <scottmg@chromium.org> + + Use cl to preprocess IDL for Chromium Windows generate_supplemental_dependency + https://bugs.webkit.org/show_bug.cgi?id=91548 + + Reviewed by Kentaro Hara. + + Use cl.exe as preprocessor for IDL files rather than cygwin gcc. Cuts + two minute execution time on Windows by a bit better than 50%. + + No new tests. + + * WebCore.gyp/WebCore.gyp: + * bindings/scripts/preprocessor.pm: + (applyPreprocessor): + +2012-07-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: remove search replace from behind experiment, polish the behavior + https://bugs.webkit.org/show_bug.cgi?id=91519 + + Reviewed by Vsevolod Vlasov. + + - This change makes replace loop with no boundary, removes the loop parameter + from jumpToNext/Previous; + - Lays out replace as a second row + - Fixes replace all with no search matches + - Splits Search and Search and Replace + - Introduces explicit Next / Previous buttons in the search mode + - Introduces editRange on the TextEditor so that it was preserving the undo stack + (we'll need to fix editor so that it does not require it). + + * English.lproj/localizedStrings.js: + * inspector/front-end/ConsolePanel.js: + (WebInspector.ConsolePanel.prototype.performSearch): + (WebInspector.ConsolePanel.prototype.jumpToNextSearchResult): + (WebInspector.ConsolePanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.jumpToNextSearchResult): + (WebInspector.ElementsPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ExtensionPanel.js: + (WebInspector.ExtensionPanel.prototype.performSearch): + (WebInspector.ExtensionPanel.prototype.jumpToNextSearchResult): + (WebInspector.ExtensionPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/JavaScriptSourceFrame.js: + (WebInspector.JavaScriptSourceFrame.prototype.beforeTextChanged): + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkLogView.prototype.jumpToPreviousSearchResult): + (WebInspector.NetworkLogView.prototype.jumpToNextSearchResult): + (WebInspector.NetworkPanel.prototype.jumpToPreviousSearchResult): + (WebInspector.NetworkPanel.prototype.jumpToNextSearchResult): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.performSearch): + (WebInspector.Panel.prototype.jumpToNextSearchResult): + (WebInspector.Panel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype.jumpToNextSearchResult): + (WebInspector.ProfilesPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.jumpToNextSearchResult): + (WebInspector.ResourcesPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._editorClosed): + (WebInspector.ScriptsPanel.prototype._editorSelected): + (WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback): + (WebInspector.ScriptsPanel.prototype.performSearch): + (WebInspector.ScriptsPanel.prototype.jumpToNextSearchResult): + (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult): + (WebInspector.ScriptsPanel.prototype.replaceSelectionWith): + (WebInspector.ScriptsPanel.prototype.replaceAllWith): + * inspector/front-end/SearchController.js: + (WebInspector.SearchController): + (WebInspector.SearchController.prototype.cancelSearch): + (WebInspector.SearchController.prototype.resetSearch): + (WebInspector.SearchController.prototype.handleShortcut): + (WebInspector.SearchController.prototype._updateSearchNavigationButtonState): + (WebInspector.SearchController.prototype._updateReplaceVisibility): + (WebInspector.SearchController.prototype._onKeyDown): + (WebInspector.SearchController.prototype._onNextButtonSearch): + (WebInspector.SearchController.prototype._onPrevButtonSearch): + (WebInspector.SearchController.prototype._performSearch): + (WebInspector.SearchController.prototype._updateReplaceDetailsVisibility): + (WebInspector.SearchController.prototype._replace): + (WebInspector.SearchController.prototype._replaceAll): + * inspector/front-end/Settings.js: + (WebInspector.ExperimentsSettings): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype.beforeTextChanged): + (WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches): + (WebInspector.SourceFrame.prototype.performSearch): + (WebInspector.SourceFrame.prototype.replaceSearchMatchWith): + (WebInspector.SourceFrame.prototype.replaceAllWith): + (WebInspector.TextEditorDelegateForSourceFrame.prototype.beforeTextChanged): + * inspector/front-end/TextEditor.js: + (WebInspector.TextEditor.prototype.editRange): + * inspector/front-end/inspector.css: + (.toolbar-search-replace .search-replace): + (.toolbar-search): + (.toolbar-search-replace): + (.toolbar-search-close-button): + (.toolbar-search-close-button:hover): + (.toolbar-search-close-button:active): + (.toolbar-search input[type="checkbox"]): + (.toolbar-search-replace .toolbar-replace-control): + +2012-07-18 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] Divide ENABLE(WEBGL) into ENABLE(WEBGL) and USE(3D_GRAPHICS) in CMakeLists.txt + https://bugs.webkit.org/show_bug.cgi?id=91584 + + Reviewed by Noam Rosenthal. + + This patch is a subset of Efl's UI_SIDE_COMPOSITING implementation. + Modified CMakeLists.txt so that the basic 3D-graphics sources can be compiled even when WebGL is disabled. + + * CMakeLists.txt: + * PlatformEfl.cmake: + * platform/graphics/GraphicsContext3D.h: + (GraphicsContext3D): + * platform/graphics/efl/GraphicsContext3DEfl.cpp: + (WebCore::GraphicsContext3D::platformGraphicsContext3D): + +2012-07-18 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Modify the using of the QImage::Format enum to the appropriate functions from NativeImageQt + https://bugs.webkit.org/show_bug.cgi?id=91600 + + Reviewed by Andreas Kling. + + Use NativeImageQt::defaultFormatForAlphaEnabledImages() and NativeImageQt::defaultFormatForOpaqueImages() + instead of the direct imagetypes at the appropriate places. + + Covered by existing tests. + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::paintToCanvas): + * platform/graphics/qt/PathQt.cpp: + (WebCore::scratchContext): + * platform/graphics/texmap/TextureMapperGL.cpp: + (WebCore::TextureMapperGL::drawRepaintCounter): + * platform/graphics/texmap/TextureMapperImageBuffer.cpp: + (WebCore::BitmapTextureImageBuffer::updateContents): + +2012-07-18 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: create timeline detail records lazily + https://bugs.webkit.org/show_bug.cgi?id=91513 + + Reviewed by Pavel Feldman. + + - only create timeline record details when these are used; + + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelineRecordListRow.prototype.update): + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent): + (WebInspector.TimelinePresentationModel.Record.prototype._refreshDetails): + (WebInspector.TimelinePresentationModel.Record.prototype.details): + 2012-07-18 Simon Hausmann <simon.hausmann@nokia.com> [ANGLE] On QT, use Bison and Flex during ANGLE build diff --git a/Source/WebCore/Configurations/FeatureDefines.xcconfig b/Source/WebCore/Configurations/FeatureDefines.xcconfig index 7f95c3018..80259a75e 100644 --- a/Source/WebCore/Configurations/FeatureDefines.xcconfig +++ b/Source/WebCore/Configurations/FeatureDefines.xcconfig @@ -48,9 +48,9 @@ ENABLE_CSS_VARIABLES = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; -ENABLE_DATALIST = ; +ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; -ENABLE_DETAILS = ENABLE_DETAILS; +ENABLE_DETAILS_ELEMENT = ENABLE_DETAILS_ELEMENT; ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; @@ -97,7 +97,7 @@ ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; ENABLE_MEDIA_SOURCE = ; ENABLE_MEDIA_STATISTICS = ; -ENABLE_METER_TAG = ENABLE_METER_TAG; +ENABLE_METER_ELEMENT = ENABLE_METER_ELEMENT; ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; @@ -107,7 +107,7 @@ ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; -ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; @@ -134,4 +134,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index 767073e7d..ea60b26b7 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -815,24 +815,24 @@ WebKitFontFamilyNames.cpp WebKitFontFamilyNames.h : dom/make_names.pl css/WebKit # HTML tag and attribute names -ifeq ($(findstring ENABLE_DATALIST,$(FEATURE_DEFINES)), ENABLE_DATALIST) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST=1 +ifeq ($(findstring ENABLE_DATALIST_ELEMENT,$(FEATURE_DEFINES)), ENABLE_DATALIST_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST_ELEMENT=1 endif -ifeq ($(findstring ENABLE_DETAILS,$(FEATURE_DEFINES)), ENABLE_DETAILS) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_DETAILS=1 +ifeq ($(findstring ENABLE_DETAILS_ELEMENT,$(FEATURE_DEFINES)), ENABLE_DETAILS_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_DETAILS_ELEMENT=1 endif -ifeq ($(findstring ENABLE_METER_TAG,$(FEATURE_DEFINES)), ENABLE_METER_TAG) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_METER_TAG=1 +ifeq ($(findstring ENABLE_METER_ELEMENT,$(FEATURE_DEFINES)), ENABLE_METER_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_METER_ELEMENT=1 endif ifeq ($(findstring ENABLE_MICRODATA,$(FEATURE_DEFINES)), ENABLE_MICRODATA) HTML_FLAGS := $(HTML_FLAGS) ENABLE_MICRODATA=1 endif -ifeq ($(findstring ENABLE_PROGRESS_TAG,$(FEATURE_DEFINES)), ENABLE_PROGRESS_TAG) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_PROGRESS_TAG=1 +ifeq ($(findstring ENABLE_PROGRESS_ELEMENT,$(FEATURE_DEFINES)), ENABLE_PROGRESS_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_PROGRESS_ELEMENT=1 endif ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO) diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 9edc64141..70a18a05e 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -75,7 +75,6 @@ localizedStrings["Aggregated Time"] = "Aggregated Time"; localizedStrings["All Nodes"] = "All Nodes"; localizedStrings["All Panels"] = "All Panels"; localizedStrings["All"] = "All"; -localizedStrings["Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation"] = "Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation"; localizedStrings["Always enable"] = "Always enable"; localizedStrings["An error occurred trying to\nread the “%s” table."] = "An error occurred trying to\nread the “%s” table."; localizedStrings["An unexpected error %s occurred."] = "An unexpected error %s occurred."; @@ -215,6 +214,8 @@ localizedStrings["Font"] = "Font"; localizedStrings["Font scale factor:"] = "Font scale factor:"; localizedStrings["Fonts"] = "Fonts"; localizedStrings["Form Data"] = "Form Data"; +localizedStrings["Program"] = "Program"; +localizedStrings["Unknown: "] = "Unknown: %s"; localizedStrings["Function Call"] = "Function Call"; localizedStrings["Function"] = "Function"; localizedStrings["GC Event"] = "GC Event"; @@ -723,4 +724,5 @@ localizedStrings["Time End"] = "Time End"; localizedStrings["Find"] = "Find"; localizedStrings["Replace"] = "Replace"; localizedStrings["Replace All"] = "Replace All"; -localizedStrings["Skip"] = "Skip"; +localizedStrings["Previous"] = "Previous"; +localizedStrings["Paused in debugger"] = "Paused in debugger"; diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index aa102c8c1..5871c6bcb 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -169,26 +169,26 @@ endif # END TARGET_WIN32 # ---- # HTML Details Element # ---- -if ENABLE_DETAILS -FEATURE_DEFINES += ENABLE_DETAILS=1 -webcore_cppflags += -DENABLE_DETAILS=1 -endif # END ENABLE_DETAILS +if ENABLE_DETAILS_ELEMENT +FEATURE_DEFINES += ENABLE_DETAILS_ELEMENT=1 +webcore_cppflags += -DENABLE_DETAILS_ELEMENT=1 +endif # END ENABLE_DETAILS_ELEMENT # ---- # HTML Meter Element # ---- -if ENABLE_METER_TAG -FEATURE_DEFINES += ENABLE_METER_TAG=1 -webcore_cppflags += -DENABLE_METER_TAG=1 -endif # END ENABLE_METER_TAG +if ENABLE_METER_ELEMENT +FEATURE_DEFINES += ENABLE_METER_ELEMENT=1 +webcore_cppflags += -DENABLE_METER_ELEMENT=1 +endif # END ENABLE_METER_ELEMENT # ---- # HTML Progress Element # ---- -if ENABLE_PROGRESS_TAG -FEATURE_DEFINES += ENABLE_PROGRESS_TAG=1 -webcore_cppflags += -DENABLE_PROGRESS_TAG=1 -endif # END ENABLE_PROGRESS_TAG +if ENABLE_PROGRESS_ELEMENT +FEATURE_DEFINES += ENABLE_PROGRESS_ELEMENT=1 +webcore_cppflags += -DENABLE_PROGRESS_ELEMENT=1 +endif # END ENABLE_PROGRESS_ELEMENT # ---- # JavaScript Debugger/Profiler @@ -223,11 +223,11 @@ endif # END ENABLE_SQL_DATABASE # ---- # HTML5 datalist Support # ---- -if ENABLE_DATALIST -FEATURE_DEFINES += ENABLE_DATALIST=1 -HTML_FEATURES += ENABLE_DATALIST=1 -webcore_cppflags += -DENABLE_DATALIST=1 -endif # END ENABLE_DATALIST +if ENABLE_DATALIST_ELEMENT +FEATURE_DEFINES += ENABLE_DATALIST_ELEMENT=1 +HTML_FEATURES += ENABLE_DATALIST_ELEMENT=1 +webcore_cppflags += -DENABLE_DATALIST_ELEMENT=1 +endif # END ENABLE_DATALIST_ELEMENT # ---- # HTML5 data transfer items support diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp index 6e28691af..ef34cb8c7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp @@ -182,16 +182,11 @@ void IDBCursor::advance(unsigned long count, ExceptionCode& ec) } if (!count) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return; } - if (!m_request->resetReadyState(m_transaction.get())) { - ASSERT_NOT_REACHED(); - ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; - return; - } - m_request->setCursor(this); + m_request->setPendingCursor(this); m_gotValue = false; m_backend->advance(count, m_request, ec); } @@ -216,14 +211,9 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec) // FIXME: We're not using the context from when continue was called, which means the callback // will be on the original context openCursor was called on. Is this right? - if (m_request->resetReadyState(m_transaction.get())) { - m_request->setCursor(this); - m_gotValue = false; - m_backend->continueFunction(key, m_request, ec); - } else { - ASSERT_NOT_REACHED(); - ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; - } + m_request->setPendingCursor(this); + m_gotValue = false; + m_backend->continueFunction(key, m_request, ec); } PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionCode& ec) @@ -306,7 +296,7 @@ IDBCursor::Direction IDBCursor::stringToDirection(const String& directionString, if (directionString == IDBCursor::directionPrevUnique()) return IDBCursor::PREV_NO_DUPLICATE; - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBCursor::NEXT; } @@ -326,7 +316,7 @@ const AtomicString& IDBCursor::directionToString(unsigned short direction, Excep return IDBCursor::directionPrevUnique(); default: - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBCursor::directionNext(); } } diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp index fe58988e4..ae27af8a3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp @@ -37,12 +37,12 @@ #include "IDBObjectStoreBackendImpl.h" #include "IDBRequest.h" #include "IDBTracing.h" -#include "IDBTransactionBackendInterface.h" +#include "IDBTransactionBackendImpl.h" #include "SerializedScriptValue.h" namespace WebCore { -IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore) +IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendImpl* transaction, IDBObjectStoreBackendImpl* objectStore) : m_cursor(cursor) , m_direction(direction) , m_cursorType(cursorType) @@ -189,7 +189,7 @@ void IDBCursorBackendImpl::prefetchContinueInternal(ScriptExecutionContext*, Pas if (cursor->m_cursor) cursor->m_savedCursor = cursor->m_cursor->clone(); - const size_t kMaxSizeEstimate = 10 * 1024 * 1024; + const size_t maxSizeEstimate = 10 * 1024 * 1024; size_t sizeEstimate = 0; for (int i = 0; i < numberToFetch; ++i) { @@ -211,7 +211,7 @@ void IDBCursorBackendImpl::prefetchContinueInternal(ScriptExecutionContext*, Pas if (cursor->m_cursorType != IDBCursorBackendInterface::IndexKeyCursor) sizeEstimate += cursor->m_cursor->value().length() * sizeof(UChar); - if (sizeEstimate > kMaxSizeEstimate) + if (sizeEstimate > maxSizeEstimate) break; } diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h index 153016f12..043c40352 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h @@ -41,18 +41,19 @@ namespace WebCore { class IDBDatabaseBackendImpl; class IDBIndexBackendImpl; class IDBKeyRange; -class IDBObjectStoreBackendInterface; -class IDBTransactionBackendInterface; +class IDBObjectStoreBackendImpl; +class IDBTransactionBackendImpl; class SerializedScriptValue; class IDBCursorBackendImpl : public IDBCursorBackendInterface { public: - static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore) + static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendImpl* transaction, IDBObjectStoreBackendImpl* objectStore) { return adoptRef(new IDBCursorBackendImpl(cursor, direction, cursorType, transaction, objectStore)); } virtual ~IDBCursorBackendImpl(); + // IDBCursorBackendInterface virtual PassRefPtr<IDBKey> key() const; virtual PassRefPtr<IDBKey> primaryKey() const; virtual PassRefPtr<SerializedScriptValue> value() const; @@ -62,11 +63,12 @@ public: virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void prefetchReset(int usedPrefetches, int unusedPrefetches); - void close(); virtual void postSuccessHandlerCallback() { ASSERT_NOT_REACHED(); } + void close(); + private: - IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor>, IDBCursor::Direction, CursorType, IDBTransactionBackendInterface*, IDBObjectStoreBackendInterface*); + IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor>, IDBCursor::Direction, CursorType, IDBTransactionBackendImpl*, IDBObjectStoreBackendImpl*); static void advanceInternal(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl>, unsigned long, PassRefPtr<IDBCallbacks>); static void continueFunctionInternal(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl>, PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); @@ -76,9 +78,9 @@ private: RefPtr<IDBBackingStore::Cursor> m_savedCursor; IDBCursor::Direction m_direction; CursorType m_cursorType; - RefPtr<IDBTransactionBackendInterface> m_transaction; - RefPtr<IDBObjectStoreBackendInterface> m_objectStore; - + RefPtr<IDBTransactionBackendImpl> m_transaction; + RefPtr<IDBObjectStoreBackendImpl> m_objectStore; + bool m_closed; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp index 35b5ca1f0..2f9c8932e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp @@ -190,7 +190,7 @@ void IDBDatabase::deleteObjectStore(const String& name, ExceptionCode& ec) PassRefPtr<IDBVersionChangeRequest> IDBDatabase::setVersion(ScriptExecutionContext* context, const String& version, ExceptionCode& ec) { if (version.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp index 505ba757b..e45147d5c 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp @@ -136,7 +136,7 @@ PassRefPtr<IDBBackingStore> IDBDatabaseBackendImpl::backingStore() const IDBDatabaseMetadata IDBDatabaseBackendImpl::metadata() const { - IDBDatabaseMetadata metadata(m_name, m_version); + IDBDatabaseMetadata metadata(m_name, m_version, IDBDatabaseMetadata::NoIntVersion); for (ObjectStoreMap::const_iterator it = m_objectStores.begin(); it != m_objectStores.end(); ++it) metadata.objectStores.set(it->first, it->second->metadata()); return metadata; @@ -144,16 +144,18 @@ IDBDatabaseMetadata IDBDatabaseBackendImpl::metadata() const PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transactionPtr->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(!m_objectStores.contains(name)); RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(this, name, keyPath, autoIncrement); ASSERT(objectStore->name() == name); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + RefPtr<IDBDatabaseBackendImpl> database = this; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::createObjectStoreInternal, database, objectStore, transaction), - createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreFromMap, database, objectStore))) { + if (!transaction->scheduleTask( + createCallbackTask(&IDBDatabaseBackendImpl::createObjectStoreInternal, database, objectStore, transaction), + createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreFromMap, database, objectStore))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return 0; } @@ -162,7 +164,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectS return objectStore.release(); } -void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction) { int64_t objectStoreId; @@ -175,28 +177,30 @@ void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, transaction->didCompleteTaskEvents(); } -PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::objectStore(const String& name) +PassRefPtr<IDBObjectStoreBackendImpl> IDBDatabaseBackendImpl::objectStore(const String& name) { return m_objectStores.get(name); } void IDBDatabaseBackendImpl::deleteObjectStore(const String& name, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transactionPtr->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(m_objectStores.contains(name)); RefPtr<IDBDatabaseBackendImpl> database = this; RefPtr<IDBObjectStoreBackendImpl> objectStore = m_objectStores.get(name); - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::deleteObjectStoreInternal, database, objectStore, transaction), - createCallbackTask(&IDBDatabaseBackendImpl::addObjectStoreToMap, database, objectStore))) { + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + + if (!transaction->scheduleTask( + createCallbackTask(&IDBDatabaseBackendImpl::deleteObjectStoreInternal, database, objectStore, transaction), + createCallbackTask(&IDBDatabaseBackendImpl::addObjectStoreToMap, database, objectStore))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return; } m_objectStores.remove(name); } -void IDBDatabaseBackendImpl::deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBDatabaseBackendImpl::deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction) { database->m_backingStore->deleteObjectStore(database->id(), objectStore->id()); transaction->didCompleteTaskEvents(); @@ -230,18 +234,21 @@ void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCal } RefPtr<DOMStringList> objectStoreNames = DOMStringList::create(); - RefPtr<IDBTransactionBackendInterface> transaction = this->transaction(objectStoreNames.get(), IDBTransaction::VERSION_CHANGE, ec); + RefPtr<IDBTransactionBackendInterface> transactionInterface = this->transaction(objectStoreNames.get(), IDBTransaction::VERSION_CHANGE, ec); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionInterface.get()); ASSERT(!ec); RefPtr<IDBDatabaseBackendImpl> database = this; - if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::setVersionInternal, database, version, callbacks, transaction), - createCallbackTask(&IDBDatabaseBackendImpl::resetVersion, database, m_version))) { + if (!transaction->scheduleTask( + createCallbackTask(&IDBDatabaseBackendImpl::setVersionInternal, database, version, callbacks, transaction), + createCallbackTask(&IDBDatabaseBackendImpl::resetVersion, database, m_version))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } } -void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, const String& version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, const String& version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> prpTransaction) { + RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction; int64_t databaseId = database->id(); database->m_version = version; if (!database->m_backingStore->updateIDBDatabaseMetaData(databaseId, database->m_version)) { @@ -249,21 +256,21 @@ void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRef transaction->abort(); return; } - callbacks->onSuccess(transaction); + callbacks->onSuccess(PassRefPtr<IDBTransactionBackendInterface>(transaction)); } -void IDBDatabaseBackendImpl::transactionStarted(PassRefPtr<IDBTransactionBackendInterface> prpTransaction) +void IDBDatabaseBackendImpl::transactionStarted(PassRefPtr<IDBTransactionBackendImpl> prpTransaction) { - RefPtr<IDBTransactionBackendInterface> transaction = prpTransaction; + RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction; if (transaction->mode() == IDBTransaction::VERSION_CHANGE) { ASSERT(!m_runningVersionChangeTransaction); m_runningVersionChangeTransaction = transaction; } } -void IDBDatabaseBackendImpl::transactionFinished(PassRefPtr<IDBTransactionBackendInterface> prpTransaction) +void IDBDatabaseBackendImpl::transactionFinished(PassRefPtr<IDBTransactionBackendImpl> prpTransaction) { - RefPtr<IDBTransactionBackendInterface> transaction = prpTransaction; + RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction; ASSERT(m_transactions.contains(transaction.get())); m_transactions.remove(transaction.get()); if (transaction->mode() == IDBTransaction::VERSION_CHANGE) { @@ -338,7 +345,7 @@ PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(D } } - RefPtr<IDBTransactionBackendInterface> transaction = IDBTransactionBackendImpl::create(objectStoreNames, mode, this); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::create(objectStoreNames, mode, this); m_transactions.add(transaction.get()); return transaction.release(); } diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h index 21f4f93c1..805eb617f 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h @@ -41,6 +41,7 @@ class IDBBackingStore; class IDBDatabase; class IDBFactoryBackendImpl; class IDBObjectStoreBackendImpl; +class IDBTransactionBackendImpl; class IDBTransactionBackendInterface; class IDBTransactionCoordinator; @@ -58,18 +59,18 @@ public: void openConnection(PassRefPtr<IDBCallbacks>); void deleteDatabase(PassRefPtr<IDBCallbacks>); + // IDBDatabaseBackendInterface virtual IDBDatabaseMetadata metadata() const; - virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&); virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&); virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&); virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* objectStoreNames, unsigned short mode, ExceptionCode&); virtual void close(PassRefPtr<IDBDatabaseCallbacks>); - PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name); + PassRefPtr<IDBObjectStoreBackendImpl> objectStore(const String& name); IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); } - void transactionStarted(PassRefPtr<IDBTransactionBackendInterface>); - void transactionFinished(PassRefPtr<IDBTransactionBackendInterface>); + void transactionStarted(PassRefPtr<IDBTransactionBackendImpl>); + void transactionFinished(PassRefPtr<IDBTransactionBackendImpl>); private: IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier); @@ -79,9 +80,9 @@ private: int32_t connectionCount(); void processPendingCalls(); - static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); + static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>); // These are used as setVersion transaction abort tasks. static void removeObjectStoreFromMap(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>); @@ -101,9 +102,9 @@ private: ObjectStoreMap m_objectStores; RefPtr<IDBTransactionCoordinator> m_transactionCoordinator; - RefPtr<IDBTransactionBackendInterface> m_runningVersionChangeTransaction; + RefPtr<IDBTransactionBackendImpl> m_runningVersionChangeTransaction; - typedef HashSet<IDBTransactionBackendInterface*> TransactionSet; + typedef HashSet<IDBTransactionBackendImpl*> TransactionSet; TransactionSet m_transactions; class PendingSetVersionCall; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp index 803499055..fe850bb19 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp @@ -62,8 +62,7 @@ static const struct IDBDatabaseExceptionNameDescription { { "QuotaExceededError", "The operation failed because there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database.", QUOTA_EXCEEDED_ERR }, // FIXME: This isn't used yet { "SyntaxError", "The keypath argument contains an invalid key path.", SYNTAX_ERR }, { "DataCloneError", "The data being stored could not be cloned by the internal structured cloning algorithm.", DATA_CLONE_ERR }, - // FIXME: should be a JavaScript TypeError. See https://bugs.webkit.org/show_bug.cgi?id=85513 - { "TypeError", "This should be a TypeError", 0 }, + { 0, 0, 0 }, // FIXME: Previous/legacy value was IDB_TYPE_ERR. { 0, 0, 0 }, // FIXME: Previous/legacy value was IDB_NOT_SUPPORTED_ERR. }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h index 2890aecbf..3e44a68ce 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h @@ -65,7 +65,7 @@ public: IDB_QUOTA_EXCEEDED_ERR, IDB_SYNTAX_ERR, IDB_DATA_CLONE_ERR, - IDB_TYPE_ERR, // FIXME: Placeholder until bindings have been updated to throw a JS TypeError. See https://bugs.webkit.org/show_bug.cgi?id=85513 + LEGACY_IDB_TYPE_ERR, // FIXME: Placeholder. LEGACY_IDB_NOT_SUPPORTED_ERR, // FIXME: Placeholder. }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl index 984cab922..67d811c3e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl @@ -49,10 +49,6 @@ module storage { const unsigned short READ_ONLY_ERR = 9; const unsigned short VER_ERR = 12; - // FIXME: Placeholder until bindings have been updated to throw a JS TypeError. - // See https://bugs.webkit.org/show_bug.cgi?id=85513 - const unsigned short TYPE_ERR = 21; - const unsigned short NOT_FOUND_ERR = 8; const unsigned short ABORT_ERR = 20; const unsigned short TIMEOUT_ERR = 23; diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp index 7e10cb1a5..cf52cc1fe 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp @@ -108,7 +108,7 @@ PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext* cont PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { if (name.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } if (!isContextValid(context)) @@ -122,7 +122,7 @@ PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const S PassRefPtr<IDBVersionChangeRequest> IDBFactory::deleteDatabase(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { if (name.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } if (!isContextValid(context)) diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp index 3cce0c375..dfb1457a3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp @@ -44,8 +44,8 @@ namespace WebCore { static String computeFileIdentifier(SecurityOrigin* securityOrigin) { - static const char kLevelDBFileSuffix[] = "@1"; - return securityOrigin->databaseIdentifier() + kLevelDBFileSuffix; + static const char levelDBFileSuffix[] = "@1"; + return securityOrigin->databaseIdentifier() + levelDBFileSuffix; } static String computeUniqueIdentifier(const String& name, SecurityOrigin* securityOrigin) diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp index fec96804b..eae488400 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp @@ -100,7 +100,7 @@ PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, Pas RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openCursor(context, keyRange.release(), ec); + return openCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, unsigned short direction, ExceptionCode& ec) @@ -109,7 +109,7 @@ PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, Pas RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openCursor(context, keyRange.release(), ec); + return openCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) @@ -183,7 +183,7 @@ PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openKeyCursor(context, keyRange.release(), ec); + return openKeyCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, unsigned short direction, ExceptionCode& ec) @@ -192,7 +192,7 @@ PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openKeyCursor(context, keyRange.release(), ec); + return openKeyCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec) diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp index afdb7ec3c..9f5ff3baf 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp @@ -39,6 +39,7 @@ #include "IDBMetadata.h" #include "IDBObjectStoreBackendImpl.h" #include "IDBTracing.h" +#include "IDBTransactionBackendImpl.h" namespace WebCore { @@ -73,7 +74,7 @@ IDBIndexMetadata IDBIndexBackendImpl::metadata() const return IDBIndexMetadata(m_name, m_keyPath, m_unique, m_multiEntry); } -void IDBIndexBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, unsigned short untypedDirection, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBIndexBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, unsigned short untypedDirection, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction) { IDB_TRACE("IDBIndexBackendImpl::openCursorInternal"); IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(untypedDirection); @@ -108,8 +109,9 @@ void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsign RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexCursor, callbacks, transaction))) + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + if (!transaction->scheduleTask( + createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexCursor, callbacks, transaction))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -119,12 +121,13 @@ void IDBIndexBackendImpl::openKeyCursor(PassRefPtr<IDBKeyRange> prpKeyRange, uns RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexKeyCursor, callbacks, transaction))) + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + if (!transaction->scheduleTask( + createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexKeyCursor, callbacks, transaction))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } -void IDBIndexBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface>) +void IDBIndexBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks) { IDB_TRACE("IDBIndexBackendImpl::countInternal"); uint32_t count = 0; @@ -145,7 +148,8 @@ void IDBIndexBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBI void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { IDB_TRACE("IDBIndexBackendImpl::count"); - if (!transaction->scheduleTask(createCallbackTask(&countInternal, this, range, callbacks, transaction))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&countInternal, this, range, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -205,7 +209,8 @@ void IDBIndexBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<ID RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getInternal, index, keyRange, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&getInternal, index, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -215,7 +220,8 @@ void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getKeyInternal, index, keyRange, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&getKeyInternal, index, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h index f841a9583..e1174579d 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h @@ -61,15 +61,14 @@ public: void setId(int64_t id) { m_id = id; } bool hasValidId() const { return m_id != InvalidId; }; - // Implements IDBIndexBackendInterface. - virtual IDBIndexMetadata metadata() const; - + // IDBIndexBackendInterface virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void count(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void getKey(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); + IDBIndexMetadata metadata() const; const String& name() { return m_name; } const IDBKeyPath& keyPath() { return m_keyPath; } const bool& unique() { return m_unique; } @@ -79,8 +78,8 @@ private: IDBIndexBackendImpl(const IDBDatabaseBackendImpl*, IDBObjectStoreBackendImpl*, int64_t id, const String& name, const IDBKeyPath&, bool unique, bool multiEntry); IDBIndexBackendImpl(const IDBDatabaseBackendImpl*, IDBObjectStoreBackendImpl*, const String& name, const IDBKeyPath&, bool unique, bool multiEntry); - static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, IDBCursorBackendInterface::CursorType, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); - static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); + static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, IDBCursorBackendInterface::CursorType, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>); + static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void getKeyInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); diff --git a/Source/WebCore/Modules/indexeddb/IDBKey.h b/Source/WebCore/Modules/indexeddb/IDBKey.h index 7debf0d88..8598729d7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBKey.h +++ b/Source/WebCore/Modules/indexeddb/IDBKey.h @@ -148,10 +148,10 @@ public: using ThreadSafeRefCounted<IDBKey>::deref; private: - IDBKey() : m_type(InvalidType), m_number(0), m_sizeEstimate(kOverheadSize) { } - IDBKey(Type type, double number) : m_type(type), m_number(number), m_sizeEstimate(kOverheadSize + sizeof(double)) { } - explicit IDBKey(const String& value) : m_type(StringType), m_string(value), m_number(0), m_sizeEstimate(kOverheadSize + value.length() * sizeof(UChar)) { } - IDBKey(const KeyArray& keyArray, size_t arraySize) : m_type(ArrayType), m_array(keyArray), m_number(0), m_sizeEstimate(kOverheadSize + arraySize) { } + IDBKey() : m_type(InvalidType), m_number(0), m_sizeEstimate(OverheadSize) { } + IDBKey(Type type, double number) : m_type(type), m_number(number), m_sizeEstimate(OverheadSize + sizeof(double)) { } + explicit IDBKey(const String& value) : m_type(StringType), m_string(value), m_number(0), m_sizeEstimate(OverheadSize + value.length() * sizeof(UChar)) { } + IDBKey(const KeyArray& keyArray, size_t arraySize) : m_type(ArrayType), m_array(keyArray), m_number(0), m_sizeEstimate(OverheadSize + arraySize) { } const Type m_type; const KeyArray m_array; @@ -161,7 +161,7 @@ private: const size_t m_sizeEstimate; // Very rough estimate of minimum key size overhead. - enum { kOverheadSize = 16 }; + enum { OverheadSize = 16 }; }; } diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp index 832cd4c9d..32e2f6815 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp @@ -223,8 +223,8 @@ void IDBLevelDBBackingStore::getDatabaseNames(Vector<String>& foundNames) OwnPtr<LevelDBIterator> it = m_db->createIterator(); for (it->seek(startKey); it->isValid() && compareKeys(it->key(), stopKey) < 0; it->next()) { - const char *p = it->key().begin(); - const char *limit = it->key().end(); + const char* p = it->key().begin(); + const char* limit = it->key().end(); DatabaseNameKey databaseNameKey; p = DatabaseNameKey::decode(p, limit, &databaseNameKey); @@ -242,7 +242,7 @@ bool IDBLevelDBBackingStore::getIDBDatabaseMetaData(const String& name, String& if (!ok) return false; - ok = getString(m_db.get(), DatabaseMetaDataKey::encode(foundId, DatabaseMetaDataKey::kUserVersion), foundVersion); + ok = getString(m_db.get(), DatabaseMetaDataKey::encode(foundId, DatabaseMetaDataKey::UserVersion), foundVersion); if (!ok) return false; @@ -273,7 +273,7 @@ bool IDBLevelDBBackingStore::createIDBDatabaseMetaData(const String& name, const const Vector<char> key = DatabaseNameKey::encode(m_identifier, name); if (!putInt(m_db.get(), key, rowId)) return false; - if (!putString(m_db.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::kUserVersion), version)) + if (!putString(m_db.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::UserVersion), version)) return false; return true; } @@ -281,7 +281,7 @@ bool IDBLevelDBBackingStore::createIDBDatabaseMetaData(const String& name, const bool IDBLevelDBBackingStore::updateIDBDatabaseMetaData(int64_t rowId, const String& version) { ASSERT(m_currentTransaction); - if (!putString(m_currentTransaction.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::kUserVersion), version)) + if (!putString(m_currentTransaction.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::UserVersion), version)) return false; return true; @@ -310,8 +310,8 @@ bool IDBLevelDBBackingStore::deleteDatabase(const String& name) return true; } - const Vector<char> startKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::kOriginName); - const Vector<char> stopKey = DatabaseMetaDataKey::encode(databaseId + 1, DatabaseMetaDataKey::kOriginName); + const Vector<char> startKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::OriginName); + const Vector<char> stopKey = DatabaseMetaDataKey::encode(databaseId + 1, DatabaseMetaDataKey::OriginName); if (!deleteRange(transaction.get(), startKey, stopKey)) { transaction->rollback(); return false; @@ -351,13 +351,13 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> OwnPtr<LevelDBIterator> it = m_db->createIterator(); it->seek(startKey); while (it->isValid() && compareKeys(it->key(), stopKey) < 0) { - const char *p = it->key().begin(); - const char *limit = it->key().end(); + const char* p = it->key().begin(); + const char* limit = it->key().end(); ObjectStoreMetaDataKey metaDataKey; p = ObjectStoreMetaDataKey::decode(p, limit, &metaDataKey); ASSERT(p); - if (metaDataKey.metaDataType() != ObjectStoreMetaDataKey::kName) { + if (metaDataKey.metaDataType() != ObjectStoreMetaDataKey::Name) { LOG_ERROR("Internal Indexed DB error."); // Possible stale metadata, but don't fail the load. it->next(); @@ -370,39 +370,39 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> String objectStoreName = decodeString(it->value().begin(), it->value().end()); it->next(); - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kKeyPath)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::KeyPath)) { LOG_ERROR("Internal Indexed DB error."); return; } IDBKeyPath keyPath = decodeIDBKeyPath(it->value().begin(), it->value().end()); it->next(); - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kAutoIncrement)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::AutoIncrement)) { LOG_ERROR("Internal Indexed DB error."); return; } bool autoIncrement = decodeBool(it->value().begin(), it->value().end()); it->next(); // Is evicatble. - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kEvictable)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::Evictable)) { LOG_ERROR("Internal Indexed DB error."); return; } it->next(); // Last version. - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kLastVersion)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::LastVersion)) { LOG_ERROR("Internal Indexed DB error."); return; } it->next(); // Maximum index id allocated. - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kMaxIndexId)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId)) { LOG_ERROR("Internal Indexed DB error."); return; } it->next(); // [optional] has key path (is not null) - if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kHasKeyPath)) { + if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::HasKeyPath)) { bool hasKeyPath = decodeBool(it->value().begin(), it->value().end()); // This check accounts for two layers of legacy coding: // (1) Initially, hasKeyPath was added to distinguish null vs. string. @@ -418,7 +418,7 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> } int64_t keyGeneratorCurrentNumber = -1; - if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber)) { + if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber)) { keyGeneratorCurrentNumber = decodeInt(it->value().begin(), it->value().end()); // FIXME: Return keyGeneratorCurrentNumber, cache in object store, and write lazily to backing store. // For now, just assert that if it was written it was valid. @@ -436,7 +436,7 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> static int64_t getNewObjectStoreId(LevelDBTransaction* transaction, int64_t databaseId) { int64_t maxObjectStoreId = -1; - const Vector<char> maxObjectStoreIdKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::kMaxObjectStoreId); + const Vector<char> maxObjectStoreIdKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::MaxObjectStoreId); if (!getInt(transaction, maxObjectStoreIdKey, maxObjectStoreId)) maxObjectStoreId = 0; @@ -456,14 +456,14 @@ bool IDBLevelDBBackingStore::createObjectStore(int64_t databaseId, const String& if (objectStoreId < 0) return false; - const Vector<char> nameKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kName); - const Vector<char> keyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyPath); - const Vector<char> autoIncrementKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kAutoIncrement); - const Vector<char> evictableKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kEvictable); - const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kLastVersion); - const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kMaxIndexId); - const Vector<char> hasKeyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kHasKeyPath); - const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber); + const Vector<char> nameKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::Name); + const Vector<char> keyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyPath); + const Vector<char> autoIncrementKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::AutoIncrement); + const Vector<char> evictableKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::Evictable); + const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::LastVersion); + const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId); + const Vector<char> hasKeyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::HasKeyPath); + const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); const Vector<char> namesKey = ObjectStoreNamesKey::encode(databaseId, name); bool ok = putString(m_currentTransaction.get(), nameKey, name); @@ -496,7 +496,7 @@ bool IDBLevelDBBackingStore::createObjectStore(int64_t databaseId, const String& return false; } - ok = putInt(m_currentTransaction.get(), maxIndexIdKey, kMinimumIndexId); + ok = putInt(m_currentTransaction.get(), maxIndexIdKey, MinimumIndexId); if (!ok) { LOG_ERROR("Internal Indexed DB error."); return false; @@ -530,7 +530,7 @@ void IDBLevelDBBackingStore::deleteObjectStore(int64_t databaseId, int64_t objec ASSERT(m_currentTransaction); String objectStoreName; - getString(m_currentTransaction.get(), ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kName), objectStoreName); + getString(m_currentTransaction.get(), ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::Name), objectStoreName); if (!deleteRange(m_currentTransaction.get(), ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, 0), ObjectStoreMetaDataKey::encodeMaxKey(databaseId, objectStoreId))) return; // FIXME: Report error. @@ -586,7 +586,7 @@ private: static int64_t getNewVersionNumber(LevelDBTransaction* transaction, int64_t databaseId, int64_t objectStoreId) { - const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kLastVersion); + const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::LastVersion); int64_t lastVersion = -1; if (!getInt(transaction, lastVersionKey, lastVersion)) @@ -658,7 +658,7 @@ int64_t IDBLevelDBBackingStore::getKeyGeneratorCurrentNumber(int64_t databaseId, { ASSERT(m_currentTransaction); - const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber); + const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); int64_t keyGeneratorCurrentNumber = -1; Vector<char> data; @@ -706,7 +706,7 @@ bool IDBLevelDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber(int64_t databa return true; } - const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber); + const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); bool ok = putInt(m_currentTransaction.get(), keyGeneratorCurrentNumberKey, newNumber); if (!ok) { LOG_ERROR("Internal Indexed DB error."); @@ -742,8 +742,8 @@ bool IDBLevelDBBackingStore::forEachObjectStoreRecord(int64_t databaseId, int64_ OwnPtr<LevelDBIterator> it = m_currentTransaction->createIterator(); for (it->seek(startKey); it->isValid() && compareKeys(it->key(), stopKey) < 0; it->next()) { - const char *p = it->key().begin(); - const char *limit = it->key().end(); + const char* p = it->key().begin(); + const char* limit = it->key().end(); ObjectStoreDataKey dataKey; p = ObjectStoreDataKey::decode(p, limit, &dataKey); ASSERT(p); @@ -801,7 +801,7 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI IndexMetaDataKey metaDataKey; p = IndexMetaDataKey::decode(p, limit, &metaDataKey); ASSERT(p); - if (metaDataKey.metaDataType() != IndexMetaDataKey::kName) { + if (metaDataKey.metaDataType() != IndexMetaDataKey::Name) { LOG_ERROR("Internal Indexed DB error."); // Possible stale metadata due to http://webkit.org/b/85557 but don't fail the load. it->next(); @@ -813,14 +813,14 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI String indexName = decodeString(it->value().begin(), it->value().end()); it->next(); // unique flag - if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::kUnique)) { + if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::Unique)) { LOG_ERROR("Internal Indexed DB error."); return; } bool indexUnique = decodeBool(it->value().begin(), it->value().end()); it->next(); // keyPath - if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::kKeyPath)) { + if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::KeyPath)) { LOG_ERROR("Internal Indexed DB error."); return; } @@ -828,7 +828,7 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI it->next(); // [optional] multiEntry flag bool indexMultiEntry = false; - if (checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::kMultiEntry)) { + if (checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::MultiEntry)) { indexMultiEntry = decodeBool(it->value().begin(), it->value().end()); it->next(); } @@ -844,9 +844,9 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI static int64_t getNewIndexId(LevelDBTransaction* transaction, int64_t databaseId, int64_t objectStoreId) { int64_t maxIndexId = -1; - const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kMaxIndexId); + const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId); if (!getInt(transaction, maxIndexIdKey, maxIndexId)) - maxIndexId = kMinimumIndexId; + maxIndexId = MinimumIndexId; ASSERT(maxIndexId >= 0); @@ -864,10 +864,10 @@ bool IDBLevelDBBackingStore::createIndex(int64_t databaseId, int64_t objectStore if (indexId < 0) return false; - const Vector<char> nameKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kName); - const Vector<char> uniqueKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kUnique); - const Vector<char> keyPathKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kKeyPath); - const Vector<char> multiEntryKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kMultiEntry); + const Vector<char> nameKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::Name); + const Vector<char> uniqueKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::Unique); + const Vector<char> keyPathKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::KeyPath); + const Vector<char> multiEntryKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::MultiEntry); bool ok = putString(m_currentTransaction.get(), nameKey, name); if (!ok) { @@ -920,7 +920,7 @@ void IDBLevelDBBackingStore::deleteIndex(int64_t databaseId, int64_t objectStore bool IDBLevelDBBackingStore::putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const ObjectStoreRecordIdentifier* recordIdentifier) { ASSERT(key.isValid()); - ASSERT(indexId >= kMinimumIndexId); + ASSERT(indexId >= MinimumIndexId); const LevelDBRecordIdentifier* levelDBRecordIdentifier = static_cast<const LevelDBRecordIdentifier*>(recordIdentifier); ASSERT(m_currentTransaction); @@ -1422,16 +1422,16 @@ private: bool IndexCursorImpl::loadCurrentRow() { - const char *p = m_iterator->key().begin(); - const char *limit = m_iterator->key().end(); + const char* p = m_iterator->key().begin(); + const char* limit = m_iterator->key().end(); IndexDataKey indexDataKey; p = IndexDataKey::decode(p, limit, &indexDataKey); m_currentKey = indexDataKey.userKey(); - const char *q = m_iterator->value().begin(); - const char *valueLimit = m_iterator->value().end(); + const char* q = m_iterator->value().begin(); + const char* valueLimit = m_iterator->value().end(); int64_t indexDataVersion; q = decodeVarInt(q, valueLimit, indexDataVersion); diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp index 1ff45a2fd..3af454f0a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp @@ -137,33 +137,33 @@ namespace IDBLevelDBCoding { #define INT32_MAX 0x7fffffffL #endif -static const unsigned char kIDBKeyNullTypeByte = 0; -static const unsigned char kIDBKeyStringTypeByte = 1; -static const unsigned char kIDBKeyDateTypeByte = 2; -static const unsigned char kIDBKeyNumberTypeByte = 3; -static const unsigned char kIDBKeyArrayTypeByte = 4; -static const unsigned char kIDBKeyMinKeyTypeByte = 5; - -static const unsigned char kIDBKeyPathTypeCodedByte1 = 0; -static const unsigned char kIDBKeyPathTypeCodedByte2 = 0; - -static const unsigned char kObjectStoreDataIndexId = 1; -static const unsigned char kExistsEntryIndexId = 2; - -static const unsigned char kSchemaVersionTypeByte = 0; -static const unsigned char kMaxDatabaseIdTypeByte = 1; -static const unsigned char kDatabaseFreeListTypeByte = 100; -static const unsigned char kDatabaseNameTypeByte = 201; - -static const unsigned char kObjectStoreMetaDataTypeByte = 50; -static const unsigned char kIndexMetaDataTypeByte = 100; -static const unsigned char kObjectStoreFreeListTypeByte = 150; -static const unsigned char kIndexFreeListTypeByte = 151; -static const unsigned char kObjectStoreNamesTypeByte = 200; -static const unsigned char kIndexNamesKeyTypeByte = 201; - -static const int64_t kObjectMetaDataTypeMaximum = INT64_MAX; -static const unsigned char kIndexMetaDataTypeMaximum = 255; +static const unsigned char IDBKeyNullTypeByte = 0; +static const unsigned char IDBKeyStringTypeByte = 1; +static const unsigned char IDBKeyDateTypeByte = 2; +static const unsigned char IDBKeyNumberTypeByte = 3; +static const unsigned char IDBKeyArrayTypeByte = 4; +static const unsigned char IDBKeyMinKeyTypeByte = 5; + +static const unsigned char IDBKeyPathTypeCodedByte1 = 0; +static const unsigned char IDBKeyPathTypeCodedByte2 = 0; + +static const unsigned char ObjectStoreDataIndexId = 1; +static const unsigned char ExistsEntryIndexId = 2; + +static const unsigned char SchemaVersionTypeByte = 0; +static const unsigned char MaxDatabaseIdTypeByte = 1; +static const unsigned char DatabaseFreeListTypeByte = 100; +static const unsigned char DatabaseNameTypeByte = 201; + +static const unsigned char ObjectStoreMetaDataTypeByte = 50; +static const unsigned char IndexMetaDataTypeByte = 100; +static const unsigned char ObjectStoreFreeListTypeByte = 150; +static const unsigned char IndexFreeListTypeByte = 151; +static const unsigned char ObjectStoreNamesTypeByte = 200; +static const unsigned char IndexNamesKeyTypeByte = 201; + +static const int64_t ObjectMetaDataTypeMaximum = INT64_MAX; +static const unsigned char IndexMetaDataTypeMaximum = 255; Vector<char> encodeByte(unsigned char c) { @@ -174,12 +174,12 @@ Vector<char> encodeByte(unsigned char c) Vector<char> maxIDBKey() { - return encodeByte(kIDBKeyNullTypeByte); + return encodeByte(IDBKeyNullTypeByte); } Vector<char> minIDBKey() { - return encodeByte(kIDBKeyMinKeyTypeByte); + return encodeByte(IDBKeyMinKeyTypeByte); } Vector<char> encodeBool(bool b) @@ -255,7 +255,7 @@ Vector<char> encodeVarInt(int64_t nParam) return ret; } -const char* decodeVarInt(const char *p, const char* limit, int64_t& foundInt) +const char* decodeVarInt(const char* p, const char* limit, int64_t& foundInt) { ASSERT(limit >= p); foundInt = 0; @@ -396,10 +396,10 @@ void encodeIDBKey(const IDBKey& key, Vector<char>& into) case IDBKey::InvalidType: case IDBKey::MinType: ASSERT_NOT_REACHED(); - into.append(encodeByte(kIDBKeyNullTypeByte)); + into.append(encodeByte(IDBKeyNullTypeByte)); return; case IDBKey::ArrayType: { - into.append(encodeByte(kIDBKeyArrayTypeByte)); + into.append(encodeByte(IDBKeyArrayTypeByte)); size_t length = key.array().size(); into.append(encodeVarInt(length)); for (size_t i = 0; i < length; ++i) @@ -408,17 +408,17 @@ void encodeIDBKey(const IDBKey& key, Vector<char>& into) return; } case IDBKey::StringType: - into.append(encodeByte(kIDBKeyStringTypeByte)); + into.append(encodeByte(IDBKeyStringTypeByte)); into.append(encodeStringWithLength(key.string())); ASSERT_UNUSED(previousSize, into.size() > previousSize); return; case IDBKey::DateType: - into.append(encodeByte(kIDBKeyDateTypeByte)); + into.append(encodeByte(IDBKeyDateTypeByte)); into.append(encodeDouble(key.date())); ASSERT_UNUSED(previousSize, into.size() - previousSize == 9); return; case IDBKey::NumberType: - into.append(encodeByte(kIDBKeyNumberTypeByte)); + into.append(encodeByte(IDBKeyNumberTypeByte)); into.append(encodeDouble(key.number())); ASSERT_UNUSED(previousSize, into.size() - previousSize == 9); return; @@ -437,11 +437,11 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found unsigned char type = *p++; switch (type) { - case kIDBKeyNullTypeByte: + case IDBKeyNullTypeByte: foundKey = IDBKey::createInvalid(); return p; - case kIDBKeyArrayTypeByte: { + case IDBKeyArrayTypeByte: { int64_t length; p = decodeVarInt(p, limit, length); if (!p) @@ -459,7 +459,7 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found foundKey = IDBKey::createArray(array); return p; } - case kIDBKeyStringTypeByte: { + case IDBKeyStringTypeByte: { String s; p = decodeStringWithLength(p, limit, s); if (!p) @@ -467,7 +467,7 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found foundKey = IDBKey::createString(s); return p; } - case kIDBKeyDateTypeByte: { + case IDBKeyDateTypeByte: { double d; p = decodeDouble(p, limit, &d); if (!p) @@ -475,7 +475,7 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found foundKey = IDBKey::createDate(d); return p; } - case kIDBKeyNumberTypeByte: { + case IDBKeyNumberTypeByte: { double d; p = decodeDouble(p, limit, &d); if (!p) @@ -499,11 +499,11 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch unsigned char type = *p++; switch (type) { - case kIDBKeyNullTypeByte: - case kIDBKeyMinKeyTypeByte: + case IDBKeyNullTypeByte: + case IDBKeyMinKeyTypeByte: *result = encodeByte(type); return p; - case kIDBKeyArrayTypeByte: { + case IDBKeyArrayTypeByte: { int64_t length; p = decodeVarInt(p, limit, length); if (!p) @@ -521,7 +521,7 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch } return p; } - case kIDBKeyStringTypeByte: { + case IDBKeyStringTypeByte: { int64_t length; p = decodeVarInt(p, limit, length); if (!p) @@ -532,8 +532,8 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch result->append(start, p - start + length * 2); return p + length * 2; } - case kIDBKeyDateTypeByte: - case kIDBKeyNumberTypeByte: + case IDBKeyDateTypeByte: + case IDBKeyNumberTypeByte: if (p + sizeof(double) > limit) return 0; result->clear(); @@ -547,17 +547,17 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch static IDBKey::Type keyTypeByteToKeyType(unsigned char type) { switch (type) { - case kIDBKeyNullTypeByte: + case IDBKeyNullTypeByte: return IDBKey::InvalidType; - case kIDBKeyArrayTypeByte: + case IDBKeyArrayTypeByte: return IDBKey::ArrayType; - case kIDBKeyStringTypeByte: + case IDBKeyStringTypeByte: return IDBKey::StringType; - case kIDBKeyDateTypeByte: + case IDBKeyDateTypeByte: return IDBKey::DateType; - case kIDBKeyNumberTypeByte: + case IDBKeyNumberTypeByte: return IDBKey::NumberType; - case kIDBKeyMinKeyTypeByte: + case IDBKeyMinKeyTypeByte: return IDBKey::MinType; } @@ -577,11 +577,11 @@ int compareEncodedIDBKeys(const char*& p, const char* limitA, const char*& q, co return x; switch (typeA) { - case kIDBKeyNullTypeByte: - case kIDBKeyMinKeyTypeByte: + case IDBKeyNullTypeByte: + case IDBKeyMinKeyTypeByte: // Null type or max type; no payload to compare. return 0; - case kIDBKeyArrayTypeByte: { + case IDBKeyArrayTypeByte: { int64_t lengthA, lengthB; p = decodeVarInt(p, limitA, lengthA); if (!p) @@ -601,10 +601,10 @@ int compareEncodedIDBKeys(const char*& p, const char* limitA, const char*& q, co return 1; return 0; } - case kIDBKeyStringTypeByte: + case IDBKeyStringTypeByte: return compareEncodedStringsWithLength(p, limitA, q, limitB); - case kIDBKeyDateTypeByte: - case kIDBKeyNumberTypeByte: { + case IDBKeyDateTypeByte: + case IDBKeyNumberTypeByte: { double d, e; p = decodeDouble(p, limitA, &d); ASSERT(p); @@ -641,8 +641,8 @@ Vector<char> encodeIDBKeyPath(const IDBKeyPath& keyPath) // byte is used to identify typed coding. New records are // always written as typed. Vector<char> ret; - ret.append(kIDBKeyPathTypeCodedByte1); - ret.append(kIDBKeyPathTypeCodedByte2); + ret.append(IDBKeyPathTypeCodedByte1); + ret.append(IDBKeyPathTypeCodedByte2); ret.append(static_cast<char>(keyPath.type())); switch (keyPath.type()) { case IDBKeyPath::NullType: @@ -667,7 +667,7 @@ IDBKeyPath decodeIDBKeyPath(const char* p, const char* limit) // May be typed, or may be a raw string. An invalid leading // byte sequence is used to identify typed coding. New records are // always written as typed. - if (p == limit || (limit - p >= 2 && (*p != kIDBKeyPathTypeCodedByte1 || *(p + 1) != kIDBKeyPathTypeCodedByte2))) + if (p == limit || (limit - p >= 2 && (*p != IDBKeyPathTypeCodedByte1 || *(p + 1) != IDBKeyPathTypeCodedByte2))) return IDBKeyPath(decodeString(p, limit)); p += 2; @@ -737,7 +737,7 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) if (int x = prefixA.compare(prefixB)) return x; - if (prefixA.type() == KeyPrefix::kGlobalMetaData) { + if (prefixA.type() == KeyPrefix::GlobalMetaData) { ASSERT(ptrA != endA); ASSERT(ptrB != endB); @@ -749,13 +749,13 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) if (typeByteA <= 1) return 0; - if (typeByteA == kDatabaseFreeListTypeByte) + if (typeByteA == DatabaseFreeListTypeByte) return decodeAndCompare<DatabaseFreeListKey>(a, b); - if (typeByteA == kDatabaseNameTypeByte) + if (typeByteA == DatabaseNameTypeByte) return decodeAndCompare<DatabaseNameKey>(a, b); } - if (prefixA.type() == KeyPrefix::kDatabaseMetaData) { + if (prefixA.type() == KeyPrefix::DatabaseMetaData) { ASSERT(ptrA != endA); ASSERT(ptrB != endB); @@ -768,24 +768,24 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) if (typeByteA <= 3) return 0; - if (typeByteA == kObjectStoreMetaDataTypeByte) + if (typeByteA == ObjectStoreMetaDataTypeByte) return decodeAndCompare<ObjectStoreMetaDataKey>(a, b); - if (typeByteA == kIndexMetaDataTypeByte) + if (typeByteA == IndexMetaDataTypeByte) return decodeAndCompare<IndexMetaDataKey>(a, b); - if (typeByteA == kObjectStoreFreeListTypeByte) + if (typeByteA == ObjectStoreFreeListTypeByte) return decodeAndCompare<ObjectStoreFreeListKey>(a, b); - if (typeByteA == kIndexFreeListTypeByte) + if (typeByteA == IndexFreeListTypeByte) return decodeAndCompare<IndexFreeListKey>(a, b); - if (typeByteA == kObjectStoreNamesTypeByte) + if (typeByteA == ObjectStoreNamesTypeByte) return decodeAndCompare<ObjectStoreNamesKey>(a, b); - if (typeByteA == kIndexNamesKeyTypeByte) + if (typeByteA == IndexNamesKeyTypeByte) return decodeAndCompare<IndexNamesKey>(a, b); return 0; ASSERT_NOT_REACHED(); } - if (prefixA.type() == KeyPrefix::kObjectStoreData) { + if (prefixA.type() == KeyPrefix::ObjectStoreData) { if (ptrA == endA && ptrB == endB) return 0; if (ptrA == endA) @@ -795,7 +795,7 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) return decodeAndCompare<ObjectStoreDataKey>(a, b); } - if (prefixA.type() == KeyPrefix::kExistsEntry) { + if (prefixA.type() == KeyPrefix::ExistsEntry) { if (ptrA == endA && ptrB == endB) return 0; if (ptrA == endA) @@ -805,7 +805,7 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) return decodeAndCompare<ExistsEntryKey>(a, b); } - if (prefixA.type() == KeyPrefix::kIndexData) { + if (prefixA.type() == KeyPrefix::IndexData) { if (ptrA == endA && ptrB == endB) return 0; if (ptrA == endA) @@ -831,9 +831,9 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) KeyPrefix::KeyPrefix() - : m_databaseId(kInvalidType) - , m_objectStoreId(kInvalidType) - , m_indexId(kInvalidType) + : m_databaseId(InvalidType) + , m_objectStoreId(InvalidType) + , m_indexId(InvalidType) { } @@ -870,9 +870,9 @@ const char* KeyPrefix::decode(const char* start, const char* limit, KeyPrefix* r Vector<char> KeyPrefix::encode() const { - ASSERT(m_databaseId != kInvalidId); - ASSERT(m_objectStoreId != kInvalidId); - ASSERT(m_indexId != kInvalidId); + ASSERT(m_databaseId != InvalidId); + ASSERT(m_objectStoreId != InvalidId); + ASSERT(m_indexId != InvalidId); Vector<char> databaseIdString = encodeInt(m_databaseId); Vector<char> objectStoreIdString = encodeInt(m_objectStoreId); @@ -895,9 +895,9 @@ Vector<char> KeyPrefix::encode() const int KeyPrefix::compare(const KeyPrefix& other) const { - ASSERT(m_databaseId != kInvalidId); - ASSERT(m_objectStoreId != kInvalidId); - ASSERT(m_indexId != kInvalidId); + ASSERT(m_databaseId != InvalidId); + ASSERT(m_objectStoreId != InvalidId); + ASSERT(m_indexId != InvalidId); if (m_databaseId != other.m_databaseId) return compareInts(m_databaseId, other.m_databaseId); @@ -910,30 +910,30 @@ int KeyPrefix::compare(const KeyPrefix& other) const KeyPrefix::Type KeyPrefix::type() const { - ASSERT(m_databaseId != kInvalidId); - ASSERT(m_objectStoreId != kInvalidId); - ASSERT(m_indexId != kInvalidId); + ASSERT(m_databaseId != InvalidId); + ASSERT(m_objectStoreId != InvalidId); + ASSERT(m_indexId != InvalidId); if (!m_databaseId) - return kGlobalMetaData; + return GlobalMetaData; if (!m_objectStoreId) - return kDatabaseMetaData; - if (m_indexId == kObjectStoreDataIndexId) - return kObjectStoreData; - if (m_indexId == kExistsEntryIndexId) - return kExistsEntry; - if (m_indexId >= kMinimumIndexId) - return kIndexData; + return DatabaseMetaData; + if (m_indexId == ObjectStoreDataIndexId) + return ObjectStoreData; + if (m_indexId == ExistsEntryIndexId) + return ExistsEntry; + if (m_indexId >= MinimumIndexId) + return IndexData; ASSERT_NOT_REACHED(); - return kInvalidType; + return InvalidType; } Vector<char> SchemaVersionKey::encode() { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kSchemaVersionTypeByte)); + ret.append(encodeByte(SchemaVersionTypeByte)); return ret; } @@ -941,7 +941,7 @@ Vector<char> MaxDatabaseIdKey::encode() { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kMaxDatabaseIdTypeByte)); + ret.append(encodeByte(MaxDatabaseIdTypeByte)); return ret; } @@ -953,7 +953,7 @@ DatabaseFreeListKey::DatabaseFreeListKey() const char* DatabaseFreeListKey::decode(const char* start, const char* limit, DatabaseFreeListKey* result) { KeyPrefix prefix; - const char *p = KeyPrefix::decode(start, limit, &prefix); + const char* p = KeyPrefix::decode(start, limit, &prefix); if (!p) return 0; ASSERT(!prefix.m_databaseId); @@ -962,7 +962,7 @@ const char* DatabaseFreeListKey::decode(const char* start, const char* limit, Da if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kDatabaseFreeListTypeByte); + ASSERT_UNUSED(typeByte, typeByte == DatabaseFreeListTypeByte); if (p == limit) return 0; return decodeVarInt(p, limit, result->m_databaseId); @@ -972,7 +972,7 @@ Vector<char> DatabaseFreeListKey::encode(int64_t databaseId) { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kDatabaseFreeListTypeByte)); + ret.append(encodeByte(DatabaseFreeListTypeByte)); ret.append(encodeVarInt(databaseId)); return ret; } @@ -1006,7 +1006,7 @@ const char* DatabaseNameKey::decode(const char* start, const char* limit, Databa if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kDatabaseNameTypeByte); + ASSERT_UNUSED(typeByte, typeByte == DatabaseNameTypeByte); if (p == limit) return 0; p = decodeStringWithLength(p, limit, result->m_origin); @@ -1019,7 +1019,7 @@ Vector<char> DatabaseNameKey::encode(const String& origin, const String& databas { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kDatabaseNameTypeByte)); + ret.append(encodeByte(DatabaseNameTypeByte)); ret.append(encodeStringWithLength(origin)); ret.append(encodeStringWithLength(databaseName)); return ret; @@ -1069,7 +1069,7 @@ const char* ObjectStoreMetaDataKey::decode(const char* start, const char* limit, if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kObjectStoreMetaDataTypeByte); + ASSERT_UNUSED(typeByte, typeByte == ObjectStoreMetaDataTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1085,7 +1085,7 @@ Vector<char> ObjectStoreMetaDataKey::encode(int64_t databaseId, int64_t objectSt { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kObjectStoreMetaDataTypeByte)); + ret.append(encodeByte(ObjectStoreMetaDataTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeVarInt(metaDataType)); return ret; @@ -1093,12 +1093,12 @@ Vector<char> ObjectStoreMetaDataKey::encode(int64_t databaseId, int64_t objectSt Vector<char> ObjectStoreMetaDataKey::encodeMaxKey(int64_t databaseId) { - return encode(databaseId, INT64_MAX, kObjectMetaDataTypeMaximum); + return encode(databaseId, INT64_MAX, ObjectMetaDataTypeMaximum); } Vector<char> ObjectStoreMetaDataKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId) { - return encode(databaseId, objectStoreId, kObjectMetaDataTypeMaximum); + return encode(databaseId, objectStoreId, ObjectMetaDataTypeMaximum); } int64_t ObjectStoreMetaDataKey::objectStoreId() const @@ -1143,7 +1143,7 @@ const char* IndexMetaDataKey::decode(const char* start, const char* limit, Index if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kIndexMetaDataTypeByte); + ASSERT_UNUSED(typeByte, typeByte == IndexMetaDataTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1162,7 +1162,7 @@ Vector<char> IndexMetaDataKey::encode(int64_t databaseId, int64_t objectStoreId, { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kIndexMetaDataTypeByte)); + ret.append(encodeByte(IndexMetaDataTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeVarInt(indexId)); ret.append(encodeByte(metaDataType)); @@ -1171,12 +1171,12 @@ Vector<char> IndexMetaDataKey::encode(int64_t databaseId, int64_t objectStoreId, Vector<char> IndexMetaDataKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId) { - return encode(databaseId, objectStoreId, INT64_MAX, kIndexMetaDataTypeMaximum); + return encode(databaseId, objectStoreId, INT64_MAX, IndexMetaDataTypeMaximum); } Vector<char> IndexMetaDataKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId, int64_t indexId) { - return encode(databaseId, objectStoreId, indexId, kIndexMetaDataTypeMaximum); + return encode(databaseId, objectStoreId, indexId, IndexMetaDataTypeMaximum); } int IndexMetaDataKey::compare(const IndexMetaDataKey& other) @@ -1205,7 +1205,7 @@ ObjectStoreFreeListKey::ObjectStoreFreeListKey() const char* ObjectStoreFreeListKey::decode(const char* start, const char* limit, ObjectStoreFreeListKey* result) { KeyPrefix prefix; - const char *p = KeyPrefix::decode(start, limit, &prefix); + const char* p = KeyPrefix::decode(start, limit, &prefix); if (!p) return 0; ASSERT(prefix.m_databaseId); @@ -1214,7 +1214,7 @@ const char* ObjectStoreFreeListKey::decode(const char* start, const char* limit, if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kObjectStoreFreeListTypeByte); + ASSERT_UNUSED(typeByte, typeByte == ObjectStoreFreeListTypeByte); if (p == limit) return 0; return decodeVarInt(p, limit, result->m_objectStoreId); @@ -1224,7 +1224,7 @@ Vector<char> ObjectStoreFreeListKey::encode(int64_t databaseId, int64_t objectSt { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kObjectStoreFreeListTypeByte)); + ret.append(encodeByte(ObjectStoreFreeListTypeByte)); ret.append(encodeVarInt(objectStoreId)); return ret; } @@ -1267,7 +1267,7 @@ const char* IndexFreeListKey::decode(const char* start, const char* limit, Index if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kIndexFreeListTypeByte); + ASSERT_UNUSED(typeByte, typeByte == IndexFreeListTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1280,7 +1280,7 @@ Vector<char> IndexFreeListKey::encode(int64_t databaseId, int64_t objectStoreId, { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kIndexFreeListTypeByte)); + ret.append(encodeByte(IndexFreeListTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeVarInt(indexId)); return ret; @@ -1327,7 +1327,7 @@ const char* ObjectStoreNamesKey::decode(const char* start, const char* limit, Ob if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kObjectStoreNamesTypeByte); + ASSERT_UNUSED(typeByte, typeByte == ObjectStoreNamesTypeByte); return decodeStringWithLength(p, limit, result->m_objectStoreName); } @@ -1335,7 +1335,7 @@ Vector<char> ObjectStoreNamesKey::encode(int64_t databaseId, const String& objec { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kObjectStoreNamesTypeByte)); + ret.append(encodeByte(ObjectStoreNamesTypeByte)); ret.append(encodeStringWithLength(objectStoreName)); return ret; } @@ -1364,7 +1364,7 @@ const char* IndexNamesKey::decode(const char* start, const char* limit, IndexNam if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kIndexNamesKeyTypeByte); + ASSERT_UNUSED(typeByte, typeByte == IndexNamesKeyTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1377,7 +1377,7 @@ Vector<char> IndexNamesKey::encode(int64_t databaseId, int64_t objectStoreId, co { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kIndexNamesKeyTypeByte)); + ret.append(encodeByte(IndexNamesKeyTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeStringWithLength(indexName)); return ret; @@ -1399,7 +1399,7 @@ const char* ObjectStoreDataKey::decode(const char* start, const char* end, Objec return 0; ASSERT(prefix.m_databaseId); ASSERT(prefix.m_objectStoreId); - ASSERT(prefix.m_indexId == kSpecialIndexNumber); + ASSERT(prefix.m_indexId == SpecialIndexNumber); if (p == end) return 0; return extractEncodedIDBKey(p, end, &result->m_encodedUserKey); @@ -1407,7 +1407,7 @@ const char* ObjectStoreDataKey::decode(const char* start, const char* end, Objec Vector<char> ObjectStoreDataKey::encode(int64_t databaseId, int64_t objectStoreId, const Vector<char> encodedUserKey) { - KeyPrefix prefix(databaseId, objectStoreId, kSpecialIndexNumber); + KeyPrefix prefix(databaseId, objectStoreId, SpecialIndexNumber); Vector<char> ret = prefix.encode(); ret.append(encodedUserKey); @@ -1431,7 +1431,7 @@ PassRefPtr<IDBKey> ObjectStoreDataKey::userKey() const return key; } -const int64_t ObjectStoreDataKey::kSpecialIndexNumber = kObjectStoreDataIndexId; +const int64_t ObjectStoreDataKey::SpecialIndexNumber = ObjectStoreDataIndexId; const char* ExistsEntryKey::decode(const char* start, const char* end, ExistsEntryKey* result) { @@ -1441,7 +1441,7 @@ const char* ExistsEntryKey::decode(const char* start, const char* end, ExistsEnt return 0; ASSERT(prefix.m_databaseId); ASSERT(prefix.m_objectStoreId); - ASSERT(prefix.m_indexId == kSpecialIndexNumber); + ASSERT(prefix.m_indexId == SpecialIndexNumber); if (p == end) return 0; return extractEncodedIDBKey(p, end, &result->m_encodedUserKey); @@ -1449,7 +1449,7 @@ const char* ExistsEntryKey::decode(const char* start, const char* end, ExistsEnt Vector<char> ExistsEntryKey::encode(int64_t databaseId, int64_t objectStoreId, const Vector<char>& encodedKey) { - KeyPrefix prefix(databaseId, objectStoreId, kSpecialIndexNumber); + KeyPrefix prefix(databaseId, objectStoreId, SpecialIndexNumber); Vector<char> ret = prefix.encode(); ret.append(encodedKey); return ret; @@ -1472,7 +1472,7 @@ PassRefPtr<IDBKey> ExistsEntryKey::userKey() const return key; } -const int64_t ExistsEntryKey::kSpecialIndexNumber = kExistsEntryIndexId; +const int64_t ExistsEntryKey::SpecialIndexNumber = ExistsEntryIndexId; IndexDataKey::IndexDataKey() : m_databaseId(-1) @@ -1490,7 +1490,7 @@ const char* IndexDataKey::decode(const char* start, const char* limit, IndexData return 0; ASSERT(prefix.m_databaseId); ASSERT(prefix.m_objectStoreId); - ASSERT(prefix.m_indexId >= kMinimumIndexId); + ASSERT(prefix.m_indexId >= MinimumIndexId); result->m_databaseId = prefix.m_databaseId; result->m_objectStoreId = prefix.m_objectStoreId; result->m_indexId = prefix.m_indexId; diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h index a23a29274..3113e7d8a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h @@ -41,7 +41,7 @@ class LevelDBSlice; namespace IDBLevelDBCoding { -const unsigned char kMinimumIndexId = 30; +const unsigned char MinimumIndexId = 30; Vector<char> encodeByte(unsigned char); Vector<char> maxIDBKey(); @@ -51,7 +51,7 @@ bool decodeBool(const char* begin, const char* end); Vector<char> encodeInt(int64_t); int64_t decodeInt(const char* begin, const char* end); Vector<char> encodeVarInt(int64_t); -const char* decodeVarInt(const char *p, const char* limit, int64_t& foundInt); +const char* decodeVarInt(const char* p, const char* limit, int64_t& foundInt); Vector<char> encodeString(const String&); String decodeString(const char* p, const char* end); Vector<char> encodeStringWithLength(const String&); @@ -79,12 +79,12 @@ public: int compare(const KeyPrefix& other) const; enum Type { - kGlobalMetaData, - kDatabaseMetaData, - kObjectStoreData, - kExistsEntry, - kIndexData, - kInvalidType + GlobalMetaData, + DatabaseMetaData, + ObjectStoreData, + ExistsEntry, + IndexData, + InvalidType }; Type type() const; @@ -93,7 +93,7 @@ public: int64_t m_objectStoreId; int64_t m_indexId; - static const int64_t kInvalidId = -1; + static const int64_t InvalidId = -1; }; class SchemaVersionKey { @@ -137,10 +137,10 @@ private: class DatabaseMetaDataKey { public: enum MetaDataType { - kOriginName = 0, - kDatabaseName = 1, - kUserVersion = 2, - kMaxObjectStoreId = 3 + OriginName = 0, + DatabaseName = 1, + UserVersion = 2, + MaxObjectStoreId = 3 }; static Vector<char> encode(int64_t databaseId, MetaDataType); @@ -149,14 +149,14 @@ public: class ObjectStoreMetaDataKey { public: enum MetaDataType { - kName = 0, - kKeyPath = 1, - kAutoIncrement = 2, - kEvictable = 3, - kLastVersion = 4, - kMaxIndexId = 5, - kHasKeyPath = 6, - kKeyGeneratorCurrentNumber = 7 + Name = 0, + KeyPath = 1, + AutoIncrement = 2, + Evictable = 3, + LastVersion = 4, + MaxIndexId = 5, + HasKeyPath = 6, + KeyGeneratorCurrentNumber = 7 }; ObjectStoreMetaDataKey(); @@ -176,10 +176,10 @@ private: class IndexMetaDataKey { public: enum MetaDataType { - kName = 0, - kUnique = 1, - kKeyPath = 2, - kMultiEntry = 3 + Name = 0, + Unique = 1, + KeyPath = 2, + MultiEntry = 3 }; IndexMetaDataKey(); @@ -261,7 +261,7 @@ public: static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const IDBKey& userKey); int compare(const ObjectStoreDataKey& other); PassRefPtr<IDBKey> userKey() const; - static const int64_t kSpecialIndexNumber; + static const int64_t SpecialIndexNumber; private: Vector<char> m_encodedUserKey; @@ -275,7 +275,7 @@ public: int compare(const ExistsEntryKey& other); PassRefPtr<IDBKey> userKey() const; - static const int64_t kSpecialIndexNumber; + static const int64_t SpecialIndexNumber; private: Vector<char> m_encodedUserKey; diff --git a/Source/WebCore/Modules/indexeddb/IDBMetadata.h b/Source/WebCore/Modules/indexeddb/IDBMetadata.h index 247e84d0f..dd230620c 100644 --- a/Source/WebCore/Modules/indexeddb/IDBMetadata.h +++ b/Source/WebCore/Modules/indexeddb/IDBMetadata.h @@ -42,12 +42,24 @@ struct IDBObjectStoreMetadata; struct IDBIndexMetadata; struct IDBDatabaseMetadata { - IDBDatabaseMetadata() { } - IDBDatabaseMetadata(const String& name, const String& version) + enum { + NoIntVersion = -1 + }; + + IDBDatabaseMetadata() + : intVersion(NoIntVersion) + { + } + IDBDatabaseMetadata(const String& name, const String& version, int64_t intVersion) : name(name) - , version(version) { } + , version(version) + , intVersion(intVersion) + { + } + String name; String version; + int64_t intVersion; typedef HashMap<String, IDBObjectStoreMetadata> ObjectStoreMap; ObjectStoreMap objectStores; diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp index dae83c590..e27ca827b 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp @@ -272,7 +272,7 @@ PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const IDBKe return 0; } if (name.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } if (m_metadata.indexes.contains(name)) { @@ -389,7 +389,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* contex PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::openCursor"); - DEFINE_STATIC_LOCAL(String, consoleMessage, ("Numeric direction values are deprecated in IDBObjectStore.openCursor. Use\"next\", \"nextunique\", \"prev\", or \"prevunique\".")); + DEFINE_STATIC_LOCAL(String, consoleMessage, ("Numeric direction values are deprecated in IDBObjectStore.openCursor. Use \"next\", \"nextunique\", \"prev\", or \"prevunique\".")); context->addConsoleMessage(JSMessageSource, LogMessageType, WarningMessageLevel, consoleMessage); const String& directionString = IDBCursor::directionToString(direction, ec); if (ec) @@ -403,7 +403,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* contex RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openCursor(context, keyRange.release(), ec); + return openCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, unsigned short direction, ExceptionCode& ec) diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp index ccad88920..8d3b803cb 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp @@ -78,13 +78,15 @@ IDBObjectStoreMetadata IDBObjectStoreBackendImpl::metadata() const return metadata; } -void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::get"); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, keyRange, callbacks))) + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + if (!transaction->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -145,13 +147,12 @@ void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, IDB_TRACE("IDBObjectStoreBackendImpl::put"); IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); - ASSERT(transactionPtr->mode() != IDBTransaction::READ_ONLY); - RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<SerializedScriptValue> value = prpValue; RefPtr<IDBKey> key = prpKey; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); // Null pointers here signify that index keys should be generated as a part of this put. OwnPtr<Vector<String> > nullIndexNames; @@ -165,13 +166,12 @@ void IDBObjectStoreBackendImpl::putWithIndexKeys(PassRefPtr<SerializedScriptValu { IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); - ASSERT(transactionPtr->mode() != IDBTransaction::READ_ONLY); - RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<SerializedScriptValue> value = prpValue; RefPtr<IDBKey> key = prpKey; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); OwnPtr<Vector<String> > newIndexNames = adoptPtr(new Vector<String>(indexNames)); OwnPtr<Vector<IndexKeys> > newIndexKeys = adoptPtr(new Vector<IndexKeys>(indexKeys)); @@ -271,7 +271,7 @@ private: }; } -void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> > popIndexKeys) +void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> > popIndexKeys) { IDB_TRACE("IDBObjectStoreBackendImpl::putInternal"); ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); @@ -388,13 +388,14 @@ void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> prpKeyRan { IDB_TRACE("IDBObjectStoreBackendImpl::delete"); - ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); + ASSERT(IDBTransactionBackendImpl::from(transaction)->mode() != IDBTransaction::READ_ONLY); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::deleteInternal, objectStore, keyRange, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::deleteInternal, objectStore, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -431,12 +432,13 @@ void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDB { IDB_TRACE("IDBObjectStoreBackendImpl::clear"); - ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); + ASSERT(IDBTransactionBackendImpl::from(transaction)->mode() != IDBTransaction::READ_ONLY); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::clearInternal, objectStore, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::clearInternal, objectStore, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -484,21 +486,20 @@ bool IDBObjectStoreBackendImpl::populateIndex(IDBBackingStore& backingStore, int return true; } -PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(!m_indexes.contains(name)); RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(m_database, this, name, keyPath, unique, multiEntry); ASSERT(index->name() == name); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + RefPtr<IDBObjectStoreBackendImpl> objectStore = this; - RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction; if (!transaction->scheduleTask( - createCallbackTask(&IDBObjectStoreBackendImpl::createIndexInternal, - objectStore, index, transactionPtr), - createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexFromMap, - objectStore, index))) { + createCallbackTask(&IDBObjectStoreBackendImpl::createIndexInternal, objectStore, index, transaction), + createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexFromMap, objectStore, index))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return 0; } @@ -507,7 +508,7 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(cons return index.release(); } -void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction) { int64_t id; if (!objectStore->backingStore()->createIndex(objectStore->databaseId(), objectStore->id(), index->name(), index->keyPath(), index->unique(), index->multiEntry(), id)) { @@ -535,46 +536,44 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::index(const Stri return index.release(); } -void IDBObjectStoreBackendImpl::deleteIndex(const String& name, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +void IDBObjectStoreBackendImpl::deleteIndex(const String& name, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(m_indexes.contains(name)); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBIndexBackendImpl> index = m_indexes.get(name); - RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + if (!transaction->scheduleTask( - createCallbackTask(&IDBObjectStoreBackendImpl::deleteIndexInternal, - objectStore, index, transactionPtr), - createCallbackTask(&IDBObjectStoreBackendImpl::addIndexToMap, - objectStore, index))) { + createCallbackTask(&IDBObjectStoreBackendImpl::deleteIndexInternal, objectStore, index, transaction), + createCallbackTask(&IDBObjectStoreBackendImpl::addIndexToMap, objectStore, index))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return; } m_indexes.remove(name); } -void IDBObjectStoreBackendImpl::deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBObjectStoreBackendImpl::deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction) { objectStore->backingStore()->deleteIndex(objectStore->databaseId(), objectStore->id(), index->id()); transaction->didCompleteTaskEvents(); } -void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::openCursor"); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBKeyRange> range = prpRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); if (!transaction->scheduleTask( - createCallbackTask(&IDBObjectStoreBackendImpl::openCursorInternal, - objectStore, range, direction, callbacks, transactionPtr))) { + createCallbackTask(&IDBObjectStoreBackendImpl::openCursorInternal, objectStore, range, direction, callbacks, transaction))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } } -void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, unsigned short tmpDirection, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, unsigned short tmpDirection, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction) { IDB_TRACE("IDBObjectStoreBackendImpl::openCursorInternal"); IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(tmpDirection); @@ -592,11 +591,12 @@ void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, Pass void IDBObjectStoreBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::count"); - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::countInternal, this, range, callbacks, transaction))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::countInternal, this, range, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } -void IDBObjectStoreBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface>) +void IDBObjectStoreBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks) { IDB_TRACE("IDBObjectStoreBackendImpl::countInternal"); uint32_t count = 0; diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h index a37c67e7f..647bc2978 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h @@ -39,6 +39,7 @@ namespace WebCore { class IDBDatabaseBackendImpl; class IDBIndexBackendImpl; +class IDBTransactionBackendImpl; class IDBTransactionBackendInterface; class ScriptExecutionContext; struct IDBObjectStoreMetadata; @@ -63,8 +64,7 @@ public: } void setId(int64_t id) { m_id = id; } - virtual IDBObjectStoreMetadata metadata() const; - + // IDBObjectStoreBackendInterface virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void putWithIndexKeys(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, const Vector<String>&, const Vector<IndexKeys>&, ExceptionCode&); @@ -80,6 +80,7 @@ public: static bool populateIndex(IDBBackingStore&, int64_t databaseId, int64_t objectStoreId, PassRefPtr<IDBIndexBackendImpl>); + IDBObjectStoreMetadata metadata() const; const String& name() { return m_name; } const IDBKeyPath& keyPath() const { return m_keyPath; } const bool& autoIncrement() const { return m_autoIncrement; } @@ -93,13 +94,13 @@ private: void updateKeyGenerator(const IDBKey*, bool checkCurrent); static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); - static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> >); + static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> >); static void deleteInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void clearInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBCallbacks>); - static void createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); - static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); + static void createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>); + static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); // These are used as setVersion transaction abort tasks. static void removeIndexFromMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>); diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp index 54afe03a6..a1eaf2930 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp @@ -58,12 +58,11 @@ IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> sourc , m_transaction(transaction) , m_readyState(PENDING) , m_requestAborted(false) - , m_requestFinished(false) , m_cursorFinished(false) , m_contextStopped(false) , m_cursorType(IDBCursorBackendInterface::InvalidCursorType) , m_cursorDirection(IDBCursor::NEXT) - , m_cursor(0) + , m_pendingCursor(0) { if (m_transaction) { m_transaction->registerRequest(this); @@ -141,40 +140,14 @@ void IDBRequest::markEarlyDeath() m_transaction->unregisterRequest(this); } -bool IDBRequest::resetReadyState(IDBTransaction* transaction) -{ - ASSERT(!m_requestFinished); - ASSERT(scriptExecutionContext()); - ASSERT_UNUSED(transaction, transaction == m_transaction); - if (m_readyState != DONE) - return false; - - m_readyState = PENDING; - m_result.clear(); - m_errorCode = 0; - m_error.clear(); - m_errorMessage = String(); - ASSERT(m_transaction); - m_transaction->registerRequest(this); - - return true; -} - -IDBAny* IDBRequest::source() -{ - return m_source.get(); -} - void IDBRequest::abort() { + ASSERT(m_readyState == PENDING || m_readyState == DONE); ASSERT(!m_requestAborted); if (m_contextStopped || !scriptExecutionContext()) return; - - if (m_readyState != PENDING) { - ASSERT(m_readyState == DONE); + if (m_readyState == DONE) return; - } EventQueue* eventQueue = scriptExecutionContext()->eventQueue(); for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { @@ -193,34 +166,68 @@ void IDBRequest::abort() void IDBRequest::setCursorDetails(IDBCursorBackendInterface::CursorType cursorType, IDBCursor::Direction direction) { + ASSERT(m_readyState == PENDING); ASSERT(m_cursorType == IDBCursorBackendInterface::InvalidCursorType); m_cursorType = cursorType; m_cursorDirection = direction; } -void IDBRequest::setCursor(PassRefPtr<IDBCursor> cursor) +void IDBRequest::setPendingCursor(PassRefPtr<IDBCursor> cursor) { - ASSERT(!m_cursor); - m_cursor = cursor; + ASSERT(m_readyState == DONE); + ASSERT(scriptExecutionContext()); + ASSERT(m_transaction); + ASSERT(!m_pendingCursor); + ASSERT(cursor == getResultCursor()); + + m_pendingCursor = cursor; + m_result.clear(); + m_readyState = PENDING; + m_errorCode = 0; + m_error.clear(); + m_errorMessage = String(); + m_transaction->registerRequest(this); +} + +PassRefPtr<IDBCursor> IDBRequest::getResultCursor() +{ + if (!m_result) + return 0; + if (m_result->type() == IDBAny::IDBCursorType) + return m_result->idbCursor(); + if (m_result->type() == IDBAny::IDBCursorWithValueType) + return m_result->idbCursorWithValue(); + return 0; +} + +void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> prpCursor) +{ + ASSERT(m_readyState == PENDING); + if (m_cursorType == IDBCursorBackendInterface::IndexKeyCursor) { + m_result = IDBAny::create(prpCursor); + return; + } + + m_result = IDBAny::create(IDBCursorWithValue::fromCursor(prpCursor)); } void IDBRequest::finishCursor() { + ASSERT(m_readyState == PENDING || m_readyState == DONE); m_cursorFinished = true; - if (m_readyState != PENDING) - m_requestFinished = true; } void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error) { + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(m_readyState == PENDING); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_errorCode = error->code(); - ASSERT(!m_error); - m_error = DOMError::create(IDBDatabaseException::getErrorName(error->idbCode())); m_errorMessage = error->message(); - m_cursor.clear(); + m_error = DOMError::create(IDBDatabaseException::getErrorName(error->idbCode())); + m_pendingCursor.clear(); enqueueEvent(Event::create(eventNames().errorEvent, true, true)); } @@ -232,8 +239,10 @@ static PassRefPtr<Event> createSuccessEvent() void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList) { IDB_TRACE("IDBRequest::onSuccess(DOMStringList)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_result = IDBAny::create(domStringList); enqueueEvent(createSuccessEvent()); @@ -242,8 +251,10 @@ void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList) void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) { IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType); RefPtr<IDBCursor> cursor; @@ -251,7 +262,7 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) cursor = IDBCursor::create(backend, m_cursorDirection, this, m_source.get(), m_transaction.get()); else cursor = IDBCursorWithValue::create(backend, m_cursorDirection, this, m_source.get(), m_transaction.get()); - setResultCursor(cursor, m_cursorType); + setResultCursor(cursor); enqueueEvent(createSuccessEvent()); } @@ -259,8 +270,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) { IDB_TRACE("IDBRequest::onSuccess(IDBDatabase)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); if (m_contextStopped || !scriptExecutionContext()) return; @@ -275,8 +288,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) { IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); if (idbKey && idbKey->isValid()) m_result = IDBAny::create(idbKey); @@ -288,8 +303,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend) { IDB_TRACE("IDBRequest::onSuccess(IDBTransaction)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); RefPtr<IDBTransactionBackendInterface> backend = prpBackend; @@ -312,11 +329,13 @@ void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) { IDB_TRACE("IDBRequest::onSuccess(SerializedScriptValue)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_result = IDBAny::create(serializedScriptValue); - m_cursor.clear(); + m_pendingCursor.clear(); enqueueEvent(createSuccessEvent()); } @@ -324,8 +343,10 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScriptValue, PassRefPtr<IDBKey> prpPrimaryKey, const IDBKeyPath& keyPath) { LOG_ERROR("CHECKING: onSuccess(value, key, keypath)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); RefPtr<SerializedScriptValue> serializedScriptValue = prpSerializedScriptValue; #ifndef NDEBUG // FIXME: Assert until we can actually inject the right value. @@ -341,12 +362,12 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScript void IDBRequest::onSuccessWithContinuation() { IDB_TRACE("IDBRequest::onSuccessWithContinuation"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); - ASSERT(m_cursor); - setResultCursor(m_cursor, m_cursorType); - m_cursor.clear(); + ASSERT(m_pendingCursor); + setResultCursor(m_pendingCursor.release()); enqueueEvent(createSuccessEvent()); } @@ -355,7 +376,7 @@ bool IDBRequest::hasPendingActivity() const // FIXME: In an ideal world, we should return true as long as anyone has a or can // get a handle to us and we have event listeners. This is order to handle // user generated events properly. - return !m_requestFinished || ActiveDOMObject::hasPendingActivity(); + return m_readyState == PENDING || ActiveDOMObject::hasPendingActivity(); } void IDBRequest::stop() @@ -387,12 +408,13 @@ ScriptExecutionContext* IDBRequest::scriptExecutionContext() const bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) { IDB_TRACE("IDBRequest::dispatchEvent"); - ASSERT(!m_requestFinished); + ASSERT(m_readyState == PENDING); ASSERT(!m_contextStopped); ASSERT(m_enqueuedEvents.size()); ASSERT(scriptExecutionContext()); ASSERT(event->target() == this); ASSERT_WITH_MESSAGE(m_readyState < DONE, "m_readyState < DONE(%d), was %d", DONE, m_readyState); + if (event->type() != eventNames().blockedEvent) m_readyState = DONE; @@ -412,12 +434,10 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) targets.append(m_transaction->db()); } + // Cursor properties should not updated until the success event is being dispatched. RefPtr<IDBCursor> cursorToNotify; - if (m_result) { - if (m_result->type() == IDBAny::IDBCursorType) - cursorToNotify = m_result->idbCursor(); - else if (m_result->type() == IDBAny::IDBCursorWithValueType) - cursorToNotify = m_result->idbCursorWithValue(); + if (event->type() == eventNames().successEvent) { + cursorToNotify = getResultCursor(); if (cursorToNotify) cursorToNotify->setValueReady(); } @@ -432,15 +452,11 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) if (setTransactionActive) m_transaction->setActive(false); - // If the result was of type IDBCursor, or a onBlocked event, then we'll fire again. - if (event->type() != eventNames().blockedEvent && (!cursorToNotify || m_cursorFinished)) - m_requestFinished = true; - if (cursorToNotify) cursorToNotify->postSuccessHandlerCallback(); if (m_transaction) { - if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) { + if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) { m_transaction->setError(m_error); m_transaction->abort(); } @@ -465,12 +481,12 @@ void IDBRequest::uncaughtExceptionInEventHandler() void IDBRequest::enqueueEvent(PassRefPtr<Event> event) { - ASSERT(!m_requestFinished); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_contextStopped || !scriptExecutionContext()) return; - ASSERT(m_readyState < DONE); + ASSERT(m_readyState == PENDING); EventQueue* eventQueue = scriptExecutionContext()->eventQueue(); event->setTarget(this); @@ -489,16 +505,6 @@ EventTargetData* IDBRequest::ensureEventTargetData() return &m_eventTargetData; } -void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> prpCursor, IDBCursorBackendInterface::CursorType type) -{ - if (type == IDBCursorBackendInterface::IndexKeyCursor) { - m_result = IDBAny::create(prpCursor); - return; - } - - m_result = IDBAny::create(IDBCursorWithValue::fromCursor(prpCursor)); -} - } // namespace WebCore #endif diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index 06ca9db9a..aa9b3f58e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -73,11 +73,9 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(error); void markEarlyDeath(); - bool resetReadyState(IDBTransaction*); void setCursorDetails(IDBCursorBackendInterface::CursorType, IDBCursor::Direction); - void setCursor(PassRefPtr<IDBCursor>); + void setPendingCursor(PassRefPtr<IDBCursor>); void finishCursor(); - IDBAny* source(); void abort(); // IDBCallbacks @@ -122,14 +120,14 @@ private: virtual EventTargetData* eventTargetData(); virtual EventTargetData* ensureEventTargetData(); - void setResultCursor(PassRefPtr<IDBCursor>, IDBCursorBackendInterface::CursorType); + PassRefPtr<IDBCursor> getResultCursor(); + void setResultCursor(PassRefPtr<IDBCursor>); RefPtr<IDBAny> m_source; RefPtr<IDBTransaction> m_transaction; ReadyState m_readyState; bool m_requestAborted; // May be aborted by transaction then receive async onsuccess; ignore vs. assert. - bool m_requestFinished; // Is it possible that we'll fire any more events? If not, we're finished. bool m_cursorFinished; bool m_contextStopped; Vector<RefPtr<Event> > m_enqueuedEvents; @@ -137,7 +135,7 @@ private: // Only used if the result type will be a cursor. IDBCursorBackendInterface::CursorType m_cursorType; IDBCursor::Direction m_cursorDirection; - RefPtr<IDBCursor> m_cursor; + RefPtr<IDBCursor> m_pendingCursor; EventTargetData m_eventTargetData; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp index 5c2b0ecba..f5e761e6a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp @@ -318,7 +318,7 @@ IDBTransaction::Mode IDBTransaction::stringToMode(const String& modeString, Exce return IDBTransaction::READ_ONLY; if (modeString == IDBTransaction::modeReadWrite()) return IDBTransaction::READ_WRITE; - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBTransaction::READ_ONLY; } @@ -338,7 +338,7 @@ const AtomicString& IDBTransaction::modeToString(IDBTransaction::Mode mode, Exce break; default: - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBTransaction::modeReadOnly(); } } diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp index 94d30dc93..70f3367ab 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp @@ -32,6 +32,7 @@ #include "IDBCursorBackendImpl.h" #include "IDBDatabaseBackendImpl.h" #include "IDBDatabaseException.h" +#include "IDBObjectStoreBackendImpl.h" #include "IDBTracing.h" #include "IDBTransactionCoordinator.h" @@ -76,7 +77,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStor return 0; } - RefPtr<IDBObjectStoreBackendInterface> objectStore = m_database->objectStore(name); + RefPtr<IDBObjectStoreBackendImpl> objectStore = m_database->objectStore(name); // FIXME: This is only necessary right now beacuse a setVersion transaction could modify things // between its creation (where another check occurs) and the .objectStore call. // There's a bug to make this impossible in the spec. When we make it impossible here, we diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h index 4ea3bfd43..daa39e1c3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h @@ -44,19 +44,24 @@ class IDBDatabaseBackendImpl; class IDBTransactionBackendImpl : public IDBTransactionBackendInterface { public: static PassRefPtr<IDBTransactionBackendImpl> create(DOMStringList* objectStores, unsigned short mode, IDBDatabaseBackendImpl*); + static IDBTransactionBackendImpl* from(IDBTransactionBackendInterface* interface) + { + return static_cast<IDBTransactionBackendImpl*>(interface); + } virtual ~IDBTransactionBackendImpl(); + // IDBTransactionBackendInterface virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, ExceptionCode&); - virtual unsigned short mode() const { return m_mode; } - virtual bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask); virtual void didCompleteTaskEvents(); virtual void abort(); virtual void setCallbacks(IDBTransactionCallbacks* callbacks) { m_callbacks = callbacks; } - virtual void registerOpenCursor(IDBCursorBackendImpl*); - virtual void unregisterOpenCursor(IDBCursorBackendImpl*); - virtual void addPendingEvents(int); void run(); + unsigned short mode() const { return m_mode; } + bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr); + void registerOpenCursor(IDBCursorBackendImpl*); + void unregisterOpenCursor(IDBCursorBackendImpl*); + void addPendingEvents(int); private: IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, IDBDatabaseBackendImpl*); diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h index d8f48ab50..bdc52ffe3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h @@ -50,15 +50,10 @@ public: virtual ~IDBTransactionBackendInterface() { } virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, ExceptionCode&) = 0; - virtual unsigned short mode() const = 0; - virtual bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr) = 0; virtual void didCompleteTaskEvents() = 0; virtual void commit() = 0; virtual void abort() = 0; virtual void setCallbacks(IDBTransactionCallbacks*) = 0; - virtual void registerOpenCursor(IDBCursorBackendImpl*) = 0; - virtual void unregisterOpenCursor(IDBCursorBackendImpl*) = 0; - virtual void addPendingEvents(int) = 0; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/webaudio/DelayNode.cpp b/Source/WebCore/Modules/webaudio/DelayNode.cpp index 51cc71e8b..680c29f79 100644 --- a/Source/WebCore/Modules/webaudio/DelayNode.cpp +++ b/Source/WebCore/Modules/webaudio/DelayNode.cpp @@ -30,9 +30,13 @@ namespace WebCore { +// FIXME: What should be the maximum allowed delay? Arbitrarily set to 300 sec (5 minutes). +const double maximumAllowedDelayTime = 300; + DelayNode::DelayNode(AudioContext* context, float sampleRate, double maxDelayTime) : AudioBasicProcessorNode(context, sampleRate) { + maxDelayTime = std::max(std::min(maxDelayTime, maximumAllowedDelayTime), 0.0); m_processor = adoptPtr(new DelayProcessor(context, sampleRate, 1, maxDelayTime)); setNodeType(NodeTypeDelay); } diff --git a/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp b/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp index 10b08a2b7..0344ca8f6 100644 --- a/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp +++ b/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp @@ -30,10 +30,10 @@ #include "config.h" #include "QuotaTracker.h" -#include "PlatformSupport.h" #if ENABLE(SQL_DATABASE) +#include <public/Platform.h> #include <wtf/StdLibExtras.h> namespace WebCore { @@ -48,7 +48,7 @@ void QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin( const String& originIdentifier, const String& databaseName, unsigned long long* databaseSize, unsigned long long* spaceAvailable) { - // Extra scope to unlock prior to potentially calling PlatformSupport. + // Extra scope to unlock prior to potentially calling WebKit::Platform. { MutexLocker lockData(m_dataGuard); ASSERT(m_databaseSizes.contains(originIdentifier)); @@ -63,7 +63,7 @@ void QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin( } // The embedder hasn't pushed this value to us, so we pull it as needed. - *spaceAvailable = PlatformSupport::databaseGetSpaceAvailableForOrigin(originIdentifier); + *spaceAvailable = WebKit::Platform::current()->databaseGetSpaceAvailableForOrigin(originIdentifier); } void QuotaTracker::updateDatabaseSize( diff --git a/Source/WebCore/PlatformBlackBerry.cmake b/Source/WebCore/PlatformBlackBerry.cmake index 587ede3d0..20048510a 100644 --- a/Source/WebCore/PlatformBlackBerry.cmake +++ b/Source/WebCore/PlatformBlackBerry.cmake @@ -312,7 +312,7 @@ ENDFOREACH () # FIXME: We need to add the IDLs for SQL storage and Web Workers. See PR #123484. SET(WebCore_NO_CPP_IDL_FILES - ${SVG_IDL_FILES} + ${WebCore_SVG_IDL_FILES} dom/CustomEvent.idl dom/PopStateEvent.idl inspector/ScriptProfile.idl diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake index 32a31b606..a9a4f1122 100644 --- a/Source/WebCore/PlatformEfl.cmake +++ b/Source/WebCore/PlatformEfl.cmake @@ -33,6 +33,7 @@ LIST(APPEND WebCore_SOURCES platform/efl/DragImageEfl.cpp platform/efl/EflKeyboardUtilities.cpp platform/efl/EflScreenUtilities.cpp + platform/efl/ErrorsEfl.cpp platform/efl/EventLoopEfl.cpp platform/efl/FileSystemEfl.cpp platform/efl/GamepadsEfl.cpp @@ -84,6 +85,7 @@ LIST(APPEND WebCore_SOURCES platform/network/soup/CredentialStorageSoup.cpp platform/network/soup/DNSSoup.cpp platform/network/soup/GOwnPtrSoup.cpp + platform/network/soup/ProxyResolverSoup.cpp platform/network/soup/ProxyServerSoup.cpp platform/network/soup/ResourceHandleSoup.cpp platform/network/soup/ResourceRequestSoup.cpp @@ -263,24 +265,30 @@ IF (ENABLE_VIDEO) ) ENDIF () -IF (ENABLE_WEBGL) +IF (WTF_USE_3D_GRAPHICS) + SET(WTF_USE_OPENGL 1) + ADD_DEFINITIONS(-DWTF_USE_OPENGL=1) + LIST(APPEND WebCore_INCLUDE_DIRECTORIES - ${OPENGL_INCLUDE_DIR} "${WEBCORE_DIR}/platform/graphics/cairo" - "${WEBCORE_DIR}/platform/graphics/glx" "${WEBCORE_DIR}/platform/graphics/opengl" + "${WEBCORE_DIR}/platform/graphics/texmap" ) LIST(APPEND WebCore_LIBRARIES ${OPENGL_gl_LIBRARY} ) LIST(APPEND WebCore_SOURCES + platform/graphics/OpenGLShims.cpp platform/graphics/cairo/DrawingBufferCairo.cpp + platform/graphics/cairo/GLContext.cpp platform/graphics/cairo/GraphicsContext3DCairo.cpp - platform/graphics/glx/GraphicsContext3DPrivate.cpp - platform/graphics/OpenGLShims.cpp + platform/graphics/cairo/GraphicsContext3DPrivate.cpp platform/graphics/opengl/Extensions3DOpenGL.cpp + platform/graphics/opengl/Extensions3DOpenGLCommon.cpp platform/graphics/opengl/GraphicsContext3DOpenGL.cpp platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp + platform/graphics/texmap/TextureMapperGL.cpp + platform/graphics/texmap/TextureMapperShaderManager.cpp ) ENDIF () diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index 3244bbc04..23bc2d0e2 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -3679,6 +3679,8 @@ contains(DEFINES, WTF_USE_3D_GRAPHICS=1) { platform/graphics/Extensions3D.h \ platform/graphics/GraphicsContext3D.h \ platform/graphics/gpu/DrawingBuffer.h \ + platform/graphics/gpu/Texture.h \ + platform/graphics/gpu/TilingData.h \ platform/graphics/opengl/Extensions3DOpenGL.h \ platform/graphics/texmap/TextureMapperGL.h \ platform/graphics/texmap/TextureMapperShaderManager.h @@ -3688,6 +3690,8 @@ contains(DEFINES, WTF_USE_3D_GRAPHICS=1) { platform/graphics/GraphicsContext3D.cpp \ platform/graphics/gpu/DrawingBuffer.cpp \ platform/graphics/gpu/qt/DrawingBufferQt.cpp \ + platform/graphics/gpu/Texture.cpp \ + platform/graphics/gpu/TilingData.cpp \ platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp \ platform/graphics/opengl/Extensions3DOpenGLCommon.cpp \ platform/graphics/qt/GraphicsContext3DQt.cpp \ diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 9efb2c77a..98843d634 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -1029,6 +1029,7 @@ __ZN7WebCore9TimerBase4stopEv __ZN7WebCore9TimerBase5startEdd __ZN7WebCore9TimerBaseC2Ev __ZN7WebCore9TimerBaseD2Ev +__ZN7WebCore9TreeScope12nullInstanceEv __ZN7WebCore9closeFileERi __ZN7WebCore9endOfWordERKNS_15VisiblePositionENS_9EWordSideE __ZN7WebCore9fontCacheEv @@ -1273,7 +1274,6 @@ __ZNK7WebCore4Node20traversePreviousNodeEPKS0_ __ZNK7WebCore4Node27traverseNextAncestorSiblingEv __ZNK7WebCore4Node31numberOfScopedHTMLStyleChildrenEv __ZNK7WebCore4Node9nodeIndexEv -__ZNK7WebCore4Node9treeScopeEv __ZNK7WebCore4Page10pluginDataEv __ZNK7WebCore4Page14renderTreeSizeEv __ZNK7WebCore4Page15backForwardListEv diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index 2b4df7a61..70243cc54 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -283,7 +283,7 @@ 'cflags!': ['-g'], }, }], - ['os_posix==1 and OS!="mac" and gcc_version==46', { + ['os_posix==1 and OS!="mac" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such as nullptr) conflict # with upcoming c++0x types. @@ -511,6 +511,17 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp', ], + 'conditions': [ + ['OS=="win"', { + 'variables': { + # Using cl instead of cygwin gcc cuts the processing time from + # 1m58s to 0m52s. + 'preprocessor': '--preprocessor "cl.exe /nologo /EP /TP"', + }, + }, { + 'variables': { 'preprocessor': '', } + }], + ], 'action': [ 'perl', '-w', @@ -524,6 +535,7 @@ '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp', '--idlAttributesFile', '../bindings/scripts/IDLAttributes.txt', + '<@(preprocessor)', ], 'message': 'Resolving [Supplemental=XXX] dependencies in all IDL files', } @@ -1429,7 +1441,7 @@ ], }, }], - ['OS != "android" and "WTF_USE_WEBAUDIO_FFMPEG=1" in feature_defines', { + ['"WTF_USE_WEBAUDIO_FFMPEG=1" in feature_defines', { # This directory needs to be on the include path for multiple sub-targets of webcore. 'direct_dependent_settings': { 'include_dirs': [ diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 09d970f1f..a172d5e5b 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -2162,6 +2162,8 @@ 'bindings/v8/IsolatedWorld.h', 'bindings/v8/JavaScriptCallFrame.cpp', 'bindings/v8/JavaScriptCallFrame.h', + 'bindings/v8/NPObjectWrapper.cpp', + 'bindings/v8/NPObjectWrapper.h', 'bindings/v8/NPV8Object.cpp', 'bindings/v8/NPV8Object.h', 'bindings/v8/Dictionary.cpp', @@ -3723,6 +3725,7 @@ 'platform/graphics/filters/skia/FEColorMatrixSkia.cpp', 'platform/graphics/filters/skia/FEGaussianBlurSkia.cpp', 'platform/graphics/filters/skia/FEMorphologySkia.cpp', + 'platform/graphics/filters/skia/FELightingSkia.cpp', 'platform/graphics/freetype/FontCacheFreeType.cpp', 'platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp', 'platform/graphics/freetype/FontPlatformData.h', @@ -3786,7 +3789,6 @@ 'platform/graphics/mac/ColorMac.mm', 'platform/graphics/mac/ComplexTextController.cpp', 'platform/graphics/mac/ComplexTextController.h', - 'platform/graphics/mac/ComplexTextControllerATSUI.cpp', 'platform/graphics/mac/ComplexTextControllerCoreText.mm', 'platform/graphics/mac/FloatPointMac.mm', 'platform/graphics/mac/FloatRectMac.mm', @@ -3806,7 +3808,6 @@ 'platform/graphics/mac/IntSizeMac.mm', 'platform/graphics/mac/MediaPlayerPrivateQTKit.h', 'platform/graphics/mac/MediaPlayerPrivateQTKit.mm', - 'platform/graphics/mac/SimpleFontDataATSUI.mm', 'platform/graphics/mac/SimpleFontDataCoreText.cpp', 'platform/graphics/mac/SimpleFontDataMac.mm', 'platform/graphics/mac/WebGLLayer.h', @@ -4443,8 +4444,6 @@ 'platform/text/mac/LocaleMac.mm', 'platform/text/mac/LocalizedDateMac.cpp', 'platform/text/mac/LocalizedNumberMac.mm', - 'platform/text/mac/ShapeArabic.c', - 'platform/text/mac/ShapeArabic.h', 'platform/text/mac/StringImplMac.mm', 'platform/text/mac/StringMac.mm', 'platform/text/mac/TextBoundaries.mm', @@ -6295,6 +6294,7 @@ 'inspector/front-end/ExtensionPanel.js', 'inspector/front-end/ExtensionRegistryStub.js', 'inspector/front-end/ExtensionServer.js', + 'inspector/front-end/ExtensionView.js', 'inspector/front-end/FileManager.js', 'inspector/front-end/FileContentView.js', 'inspector/front-end/FileSystemModel.js', @@ -6320,7 +6320,6 @@ 'inspector/front-end/InspectorFrontendAPI.js', 'inspector/front-end/InspectorFrontendHostStub.js', 'inspector/front-end/InspectorView.js', - 'inspector/front-end/InjectedFakeWorker.js', 'inspector/front-end/inspector.js', 'inspector/front-end/JavaScriptContextManager.js', 'inspector/front-end/JavaScriptFormatter.js', @@ -8282,14 +8281,11 @@ 'platform/graphics/chromium/TextureCopier.h', 'platform/graphics/chromium/TextureLayerChromium.cpp', 'platform/graphics/chromium/TextureLayerChromium.h', - 'platform/graphics/chromium/TextureAllocator.h', 'platform/graphics/chromium/TextureUploader.h', 'platform/graphics/chromium/ThrottledTextureUploader.cpp', 'platform/graphics/chromium/ThrottledTextureUploader.h', 'platform/graphics/chromium/TiledLayerChromium.cpp', 'platform/graphics/chromium/TiledLayerChromium.h', - 'platform/graphics/chromium/TrackingTextureAllocator.cpp', - 'platform/graphics/chromium/TrackingTextureAllocator.h', 'platform/graphics/chromium/TreeSynchronizer.cpp', 'platform/graphics/chromium/TreeSynchronizer.h', 'platform/graphics/chromium/VideoLayerChromium.cpp', @@ -8360,6 +8356,7 @@ 'platform/graphics/chromium/cc/CCPriorityCalculator.h', 'platform/graphics/chromium/cc/CCProxy.cpp', 'platform/graphics/chromium/cc/CCProxy.h', + 'platform/graphics/chromium/cc/CCQuadSink.h', 'platform/graphics/chromium/cc/CCQuadCuller.cpp', 'platform/graphics/chromium/cc/CCQuadCuller.h', 'platform/graphics/chromium/cc/CCRenderPass.cpp', @@ -8371,6 +8368,8 @@ 'platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp', 'platform/graphics/chromium/cc/CCRenderSurfaceFilters.h', 'platform/graphics/chromium/cc/CCRenderingStats.h', + 'platform/graphics/chromium/cc/CCResourceProvider.cpp', + 'platform/graphics/chromium/cc/CCResourceProvider.h', 'platform/graphics/chromium/cc/CCScheduler.cpp', 'platform/graphics/chromium/cc/CCScheduler.h', 'platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index e1abbec66..357ea4624 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -18745,7 +18745,6 @@ __ZN7WebCore22WorkerScriptController28scheduleExecutionTerminationEv __ZN7WebCore15DatabaseTracker31interruptAllDatabasesForContextEPKNS_22ScriptExecutionContextE __ZN7WebCore14AbstractWorkerD2Ev __ZN7WebCore29WorkerThreadShutdownStartTask11performTaskEPNS_22ScriptExecutionContextE -__ZN7WebCore14AbstractWorker15onDestroyWorkerEv __ZN7WebCore24DatabaseTaskSynchronizerC1Ev __ZN7WebCore24DatabaseTaskSynchronizer13taskCompletedEv __ZN7WebCore13WorkerContext21notifyObserversOfStopEv @@ -27869,8 +27868,6 @@ __ZN7WebCore26InspectorBackendDispatcher17Debugger_stepOverElPNS_15InspectorObje __ZN7WebCore22InspectorDebuggerAgent8stepOverEPN3WTF6StringE __ZN7WebCore17ScriptDebugServer17stepOverStatementEv __ZSt4swapIN7WebCore22InspectorDebuggerAgent6ScriptEEvRT_S4_ -__ZN7WebCore24InspectorInstrumentation19didCreateWorkerImplEPNS_19InstrumentingAgentsElRKN3WTF6StringEb -__ZN7WebCore14InspectorAgent15didCreateWorkerElRKN3WTF6StringEb __ZN3WTF7HashMapIlNS_6RefPtrIN7WebCore23InspectorWorkerResourceEEENS_7IntHashImEENS_10HashTraitsIlEENS7_IS4_EEE3setERKlRKS4_ __ZN3WTF17HashMapTranslatorISt4pairIlNS_6RefPtrIN7WebCore23InspectorWorkerResourceEEEENS_14PairHashTraitsINS_10HashTraitsIlEENS8_IS5_EEEENS_7IntHashImEEE9translateERS6_RKlRKS5_ __ZN7WebCore26InspectorBackendDispatcher14DOM_removeNodeElPNS_15InspectorObjectE diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index 49522f304..513d261a4 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -193,8 +193,7 @@ contains(DEFINES, WTF_USE_3D_GRAPHICS=1) { contains(QT_CONFIG, opengles2): LIBS += -lEGL mac: LIBS += -framework IOSurface -framework CoreFoundation linux-*:contains(DEFINES, HAVE_XCOMPOSITE=1): LIBS += -lXcomposite - # Only WebKit1 needs the opengl module, so it's optional for Qt5. - haveQt(4)|contains(QT_CONFIG, opengl): QT *= opengl + haveQt(4): QT *= opengl } !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) { diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 19be056d1..14123fea1 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -75106,6 +75106,10 @@ > </File> <File + RelativePath="..\inspector\front-end\ExtensionView.js" + > + </File> + <File RelativePath="..\inspector\front-end\FileContentView.js" > </File> @@ -75206,10 +75210,6 @@ > </File> <File - RelativePath="..\inspector\front-end\InjectedFakeWorker.js" - > - </File> - <File RelativePath="..\inspector\front-end\inspector.css" > </File> diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 93be27504..67e6bc5d8 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -351,7 +351,6 @@ 15D17D21147231EB005EBCA6 /* InspectorFileSystemAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15D17D1E147231EB005EBCA6 /* InspectorFileSystemAgent.cpp */; }; 15D17D22147231EB005EBCA6 /* InspectorFileSystemAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 15D17D1F147231EB005EBCA6 /* InspectorFileSystemAgent.h */; }; 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */; }; - 163E8B13118B3ADD00ED9231 /* SimpleFontDataATSUI.mm in Sources */ = {isa = PBXBuildFile; fileRef = 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */; }; 185BCF280F3279CE000EA262 /* ThreadTimers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 185BCF260F3279CE000EA262 /* ThreadTimers.cpp */; }; 185BCF290F3279CE000EA262 /* ThreadTimers.h in Headers */ = {isa = PBXBuildFile; fileRef = 185BCF270F3279CE000EA262 /* ThreadTimers.h */; }; 188604B30F2E654A000B6443 /* DOMTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 188604B10F2E654A000B6443 /* DOMTimer.cpp */; }; @@ -992,7 +991,6 @@ 37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */; }; 37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */; }; 37C236111097EE7700EF9F72 /* ComplexTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */; }; - 37C238211098C84200EF9F72 /* ComplexTextControllerATSUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2381F1098C84200EF9F72 /* ComplexTextControllerATSUI.cpp */; }; 37C238221098C84200EF9F72 /* ComplexTextControllerCoreText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */; }; 37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */; }; @@ -4863,8 +4861,6 @@ B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */; }; B2AFFC800D00A5C10030074D /* FontMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC780D00A5C10030074D /* FontMac.mm */; }; B2AFFC830D00A5C10030074D /* GlyphPageTreeNodeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC7B0D00A5C10030074D /* GlyphPageTreeNodeMac.cpp */; }; - B2AFFC930D00A5DF0030074D /* ShapeArabic.c in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC880D00A5DF0030074D /* ShapeArabic.c */; }; - B2AFFC940D00A5DF0030074D /* ShapeArabic.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AFFC890D00A5DF0030074D /* ShapeArabic.h */; }; B2AFFC950D00A5DF0030074D /* StringImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8A0D00A5DF0030074D /* StringImplMac.mm */; }; B2AFFC960D00A5DF0030074D /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8B0D00A5DF0030074D /* StringMac.mm */; }; B2AFFC970D00A5DF0030074D /* TextBoundaries.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8C0D00A5DF0030074D /* TextBoundaries.mm */; }; @@ -7335,7 +7331,6 @@ 15D17D1E147231EB005EBCA6 /* InspectorFileSystemAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFileSystemAgent.cpp; sourceTree = "<group>"; }; 15D17D1F147231EB005EBCA6 /* InspectorFileSystemAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFileSystemAgent.h; sourceTree = "<group>"; }; 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontDataCoreText.cpp; sourceTree = "<group>"; }; - 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleFontDataATSUI.mm; sourceTree = "<group>"; }; 185BCF260F3279CE000EA262 /* ThreadTimers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadTimers.cpp; sourceTree = "<group>"; }; 185BCF270F3279CE000EA262 /* ThreadTimers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadTimers.h; sourceTree = "<group>"; }; 188604B10F2E654A000B6443 /* DOMTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMTimer.cpp; sourceTree = "<group>"; }; @@ -8034,7 +8029,6 @@ 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontComplexTextMac.cpp; sourceTree = "<group>"; }; 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; }; 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexTextController.h; sourceTree = "<group>"; }; - 37C2381F1098C84200EF9F72 /* ComplexTextControllerATSUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextControllerATSUI.cpp; sourceTree = "<group>"; }; 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ComplexTextControllerCoreText.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypesettingFeatures.h; sourceTree = "<group>"; }; 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringKeyedMRUCache.h; sourceTree = "<group>"; }; @@ -12061,8 +12055,6 @@ B2AFFC850D00A5DF0030074D /* character-sets.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "character-sets.txt"; sourceTree = "<group>"; }; B2AFFC860D00A5DF0030074D /* mac-encodings.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "mac-encodings.txt"; sourceTree = "<group>"; }; B2AFFC870D00A5DF0030074D /* make-charset-table.pl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.perl; path = "make-charset-table.pl"; sourceTree = "<group>"; }; - B2AFFC880D00A5DF0030074D /* ShapeArabic.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ShapeArabic.c; sourceTree = "<group>"; }; - B2AFFC890D00A5DF0030074D /* ShapeArabic.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ShapeArabic.h; sourceTree = "<group>"; }; B2AFFC8A0D00A5DF0030074D /* StringImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplMac.mm; sourceTree = "<group>"; }; B2AFFC8B0D00A5DF0030074D /* StringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringMac.mm; sourceTree = "<group>"; }; B2AFFC8C0D00A5DF0030074D /* TextBoundaries.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = TextBoundaries.mm; sourceTree = "<group>"; }; @@ -19574,7 +19566,6 @@ B275354A0B053814002CE64F /* ColorMac.mm */, 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */, 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */, - 37C2381F1098C84200EF9F72 /* ComplexTextControllerATSUI.cpp */, 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */, 49AF2D6B14435D210016A784 /* DisplayRefreshMonitorMac.cpp */, B275354B0B053814002CE64F /* FloatPointMac.mm */, @@ -19596,7 +19587,6 @@ E4B41E100CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.h */, E4B41E110CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.mm */, 0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */, - 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */, 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */, B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */, 49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */, @@ -19847,8 +19837,6 @@ F5CC42DB12F801CA00D5F7E3 /* LocalizedNumberMac.mm */, B2AFFC860D00A5DF0030074D /* mac-encodings.txt */, B2AFFC870D00A5DF0030074D /* make-charset-table.pl */, - B2AFFC880D00A5DF0030074D /* ShapeArabic.c */, - B2AFFC890D00A5DF0030074D /* ShapeArabic.h */, B2AFFC8A0D00A5DF0030074D /* StringImplMac.mm */, B2AFFC8B0D00A5DF0030074D /* StringMac.mm */, B2AFFC8C0D00A5DF0030074D /* TextBoundaries.mm */, @@ -24609,7 +24597,6 @@ BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */, A6D169641346B4C1000EB770 /* ShadowRoot.h in Headers */, A80E6CE80A1989CA007FB8C5 /* ShadowValue.h in Headers */, - B2AFFC940D00A5DF0030074D /* ShapeArabic.h in Headers */, 1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */, 97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */, 93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */, @@ -25761,7 +25748,6 @@ B27535770B053814002CE64F /* ColorMac.mm in Sources */, 6550B6A1099DF0270090D781 /* Comment.cpp in Sources */, 37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */, - 37C238211098C84200EF9F72 /* ComplexTextControllerATSUI.cpp in Sources */, 37C238221098C84200EF9F72 /* ComplexTextControllerCoreText.mm in Sources */, 4A6A0C5B15232F2400B09C6E /* ComposedShadowTreeWalker.cpp in Sources */, 316FE1150E6E1DA700BF6088 /* CompositeAnimation.cpp in Sources */, @@ -27791,7 +27777,6 @@ BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */, A6D169621346B49B000EB770 /* ShadowRoot.cpp in Sources */, A80E6CF40A1989CA007FB8C5 /* ShadowValue.cpp in Sources */, - B2AFFC930D00A5DF0030074D /* ShapeArabic.c in Sources */, 1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */, 512DD8E30D91E2B4000F89EE /* SharedBufferCF.cpp in Sources */, 97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */, @@ -27801,7 +27786,6 @@ 41D168E710226E89009BC827 /* SharedWorkerContext.cpp in Sources */, 41D168ED10226E89009BC827 /* SharedWorkerThread.cpp in Sources */, B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */, - 163E8B13118B3ADD00ED9231 /* SimpleFontDataATSUI.mm in Sources */, 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */, B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */, C5A1EA7C152BCF04004D00B6 /* SimplifyMarkupCommand.cpp in Sources */, diff --git a/Source/WebCore/accessibility/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp index 71a2214ea..04d3687cf 100644 --- a/Source/WebCore/accessibility/AXObjectCache.cpp +++ b/Source/WebCore/accessibility/AXObjectCache.cpp @@ -238,7 +238,7 @@ static PassRefPtr<AccessibilityObject> createFromRenderer(RenderObject* renderer if (cssBox->isTableCell()) return AccessibilityTableCell::create(toRenderTableCell(cssBox)); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // progress bar if (cssBox->isProgress()) return AccessibilityProgressIndicator::create(toRenderProgress(cssBox)); diff --git a/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp b/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp index c7202f09d..494d1c20b 100644 --- a/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp +++ b/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp @@ -19,11 +19,9 @@ */ #include "config.h" - -#if ENABLE(PROGRESS_TAG) - #include "AccessibilityProgressIndicator.h" +#if ENABLE(PROGRESS_ELEMENT) #include "FloatConversion.h" #include "HTMLNames.h" #include "HTMLProgressElement.h" @@ -75,4 +73,4 @@ HTMLProgressElement* AccessibilityProgressIndicator::element() const } // namespace WebCore -#endif // ENABLE(PROGRESS_TAG) +#endif // ENABLE(PROGRESS_ELEMENT) diff --git a/Source/WebCore/accessibility/AccessibilityProgressIndicator.h b/Source/WebCore/accessibility/AccessibilityProgressIndicator.h index b52a619ae..af8bc2086 100644 --- a/Source/WebCore/accessibility/AccessibilityProgressIndicator.h +++ b/Source/WebCore/accessibility/AccessibilityProgressIndicator.h @@ -21,8 +21,7 @@ #ifndef AccessibilityProgressIndicator_h #define AccessibilityProgressIndicator_h -#if ENABLE(PROGRESS_TAG) - +#if ENABLE(PROGRESS_ELEMENT) #include "AccessibilityRenderObject.h" namespace WebCore { @@ -52,6 +51,6 @@ private: } // namespace WebCore -#endif // ENABLE(PROGRESS_TAG) +#endif // ENABLE(PROGRESS_ELEMENT) #endif // AccessibilityProgressIndicator_h diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 74c2b03fa..31e64e7dc 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -1363,7 +1363,7 @@ String AccessibilityRenderObject::title() const if (isInputTag) { HTMLInputElement* input = static_cast<HTMLInputElement*>(node); if (input->isTextButton()) - return input->value(); + return input->valueWithDefault(); } if (isInputTag || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl()) { @@ -1413,6 +1413,53 @@ String AccessibilityRenderObject::ariaAccessibilityDescription() const return String(); } +String AccessibilityRenderObject::webAreaAccessibilityDescription() const +{ + // The WebArea description should follow this order: + // aria-label on the <html> + // title on the <html> + // <title> inside the <head> (of it was set through JS) + // name on the <html> + // For iframes: + // aria-label on the <iframe> + // title on the <iframe> + // name on the <iframe> + + if (!m_renderer) + return String(); + + Document* document = m_renderer->document(); + + // Check if the HTML element has an aria-label for the webpage. + if (Element* documentElement = document->documentElement()) { + const AtomicString& ariaLabel = documentElement->getAttribute(aria_labelAttr); + if (!ariaLabel.isEmpty()) + return ariaLabel; + } + + Node* owner = document->ownerElement(); + if (owner) { + if (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag)) { + const AtomicString& title = static_cast<HTMLFrameElementBase*>(owner)->getAttribute(titleAttr); + if (!title.isEmpty()) + return title; + return static_cast<HTMLFrameElementBase*>(owner)->getNameAttribute(); + } + if (owner->isHTMLElement()) + return toHTMLElement(owner)->getNameAttribute(); + } + + String documentTitle = document->title(); + if (!documentTitle.isEmpty()) + return documentTitle; + + owner = document->body(); + if (owner && owner->isHTMLElement()) + return toHTMLElement(owner)->getNameAttribute(); + + return String(); +} + String AccessibilityRenderObject::accessibilityDescription() const { if (!m_renderer) @@ -1441,33 +1488,9 @@ String AccessibilityRenderObject::accessibilityDescription() const return getAttribute(MathMLNames::alttextAttr); #endif - if (isWebArea()) { - Document* document = m_renderer->document(); - - // Check if the HTML element has an aria-label for the webpage. - Element* documentElement = document->documentElement(); - if (documentElement) { - const AtomicString& ariaLabel = documentElement->getAttribute(aria_labelAttr); - if (!ariaLabel.isEmpty()) - return ariaLabel; - } - - Node* owner = document->ownerElement(); - if (owner) { - if (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag)) { - const AtomicString& title = static_cast<HTMLFrameElementBase*>(owner)->getAttribute(titleAttr); - if (!title.isEmpty()) - return title; - return static_cast<HTMLFrameElementBase*>(owner)->getNameAttribute(); - } - if (owner->isHTMLElement()) - return toHTMLElement(owner)->getNameAttribute(); - } - owner = document->body(); - if (owner && owner->isHTMLElement()) - return toHTMLElement(owner)->getNameAttribute(); - } - + if (isWebArea()) + return webAreaAccessibilityDescription(); + return String(); } diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.h b/Source/WebCore/accessibility/AccessibilityRenderObject.h index 4d66e5596..a43b71d55 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.h +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.h @@ -318,7 +318,8 @@ private: String accessibilityDescriptionForElements(Vector<Element*> &elements) const; void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName&) const; String ariaAccessibilityDescription() const; - + String webAreaAccessibilityDescription() const; + virtual ESpeak speakProperty() const; virtual const AtomicString& ariaLiveRegionStatus() const; diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp index fc179907a..cf21aae66 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.cpp +++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp @@ -198,6 +198,11 @@ void setDOMException(ExecState* exec, ExceptionCode ec) if (!ec || exec->hadException()) return; + if (ec == NATIVE_TYPE_ERR) { + throwTypeError(exec); + return; + } + // FIXME: All callers to setDOMException need to pass in the right global object // for now, we're going to assume the lexicalGlobalObject. Which is wrong in cases like this: // frames[0].document.createElement(null, null); // throws an exception which should have the subframes prototypes. diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp index f18a05e3b..d4a06e563 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp @@ -32,6 +32,7 @@ #include "JSNode.h" #include "Logging.h" #include "Page.h" +#include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" #include "WebCoreJSClientData.h" @@ -208,6 +209,7 @@ JSGlobalData* JSDOMWindowBase::commonJSGlobalData() static JSGlobalData* globalData = 0; if (!globalData) { + ScriptController::initializeThreading(); globalData = JSGlobalData::createLeaked(ThreadStackTypeLarge, LargeHeap).leakRef(); globalData->timeoutChecker.setTimeoutInterval(10000); // 10 seconds #ifndef NDEBUG diff --git a/Source/WebCore/bindings/js/JSDictionary.cpp b/Source/WebCore/bindings/js/JSDictionary.cpp index 4967107df..938867ff8 100644 --- a/Source/WebCore/bindings/js/JSDictionary.cpp +++ b/Source/WebCore/bindings/js/JSDictionary.cpp @@ -163,7 +163,7 @@ void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<TrackBase>& re } #endif -#if ENABLE(MUTATION_OBSERVERS) +#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS) void JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicString>& result) { result.clear(); diff --git a/Source/WebCore/bindings/js/JSDictionary.h b/Source/WebCore/bindings/js/JSDictionary.h index bd1754dd8..3e7ee55b2 100644 --- a/Source/WebCore/bindings/js/JSDictionary.h +++ b/Source/WebCore/bindings/js/JSDictionary.h @@ -102,7 +102,7 @@ private: #if ENABLE(VIDEO_TRACK) static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<TrackBase>& result); #endif -#if ENABLE(MUTATION_OBSERVERS) +#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS) static void convertValue(JSC::ExecState*, JSC::JSValue, HashSet<AtomicString>& result); #endif diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 147c3d986..7ac3e562a 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -409,7 +409,6 @@ END END } - my @enabledAtRuntime; my @enabledPerContext; foreach my $function (@{$dataNode->functions}) { my $name = $function->signature->name; @@ -423,10 +422,6 @@ END END push(@headerContent, "#endif // ${conditionalString}\n") if $conditionalString; } - - if ($attrExt->{"V8EnabledAtRuntime"}) { - push(@enabledAtRuntime, $function); - } } if (IsConstructable($dataNode)) { @@ -457,10 +452,6 @@ END END push(@headerContent, "#endif // ${conditionalString}\n") if $conditionalString; } - if ($attrExt->{"V8EnabledAtRuntime"}) { - push(@enabledAtRuntime, $attribute); - } - if ($attrExt->{"V8EnabledPerContext"}) { push(@enabledPerContext, $attribute); } @@ -901,9 +892,11 @@ END return value; END } - push(@implContentDecls, <<END); + if (!$attribute->isStatic) { + push(@implContentDecls, <<END); ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END + } } # Generate security checks if necessary @@ -926,8 +919,10 @@ END if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; AddToImplIncludes("${implementedBy}.h"); - unshift(@arguments, "imp"); + unshift(@arguments, "imp") if !$attribute->isStatic; $functionName = "${implementedBy}::${functionName}"; + } elsif ($attribute->isStatic) { + $functionName = "${implClassName}::${functionName}"; } else { $functionName = "imp->${functionName}"; } @@ -1081,6 +1076,32 @@ END push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; } +sub GenerateReplaceableAttrSetter +{ + my $dataNode = shift; + my $implClassName = shift; + + push(@implContentDecls, <<END); +static void ${implClassName}ReplaceableAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.$implClassName.replaceable._set"); +END + + if ($implClassName eq "DOMWindow" || $dataNode->extendedAttributes->{"CheckSecurity"}) { + push(@implContentDecls, <<END); + ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); + if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) + return; +END + } + + push(@implContentDecls, <<END); + info.This()->ForceSet(name, value); +} + +END +} + sub GenerateNormalAttrSetter { my $attribute = shift; @@ -1152,9 +1173,11 @@ END # Skip the rest of the function! } - push(@implContentDecls, <<END); + if (!$attribute->isStatic) { + push(@implContentDecls, <<END); ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END + } } my $nativeType = GetNativeTypeFromSignature($attribute->signature, 0); @@ -1218,8 +1241,10 @@ END if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; AddToImplIncludes("${implementedBy}.h"); - unshift(@arguments, "imp"); + unshift(@arguments, "imp") if !$attribute->isStatic; $functionName = "${implementedBy}::${functionName}"; + } elsif ($attribute->isStatic) { + $functionName = "${interfaceName}::${functionName}"; } else { $functionName = "imp->${functionName}"; } @@ -1468,10 +1493,10 @@ END # Check domain security if needed if (($dataNode->extendedAttributes->{"CheckSecurity"} - || $interfaceName eq "DOMWindow") - && !$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) { - # We have not find real use cases yet. - push(@implContentDecls, <<END); + || $interfaceName eq "DOMWindow") + && !$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) { + # We have not find real use cases yet. + push(@implContentDecls, <<END); if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) return v8::Handle<v8::Value>(); END @@ -2113,14 +2138,16 @@ sub GenerateSingleBatchedAttribute $data = "&V8${constructorType}::info"; $getter = "${interfaceName}V8Internal::${interfaceName}ConstructorGetter"; } - $setter = "0"; - $propAttr = "v8::ReadOnly"; - + $setter = "${interfaceName}V8Internal::${interfaceName}ReplaceableAttrSetter"; } else { # Default Getter and Setter $getter = "${interfaceName}V8Internal::${attrName}AttrGetter"; $setter = "${interfaceName}V8Internal::${attrName}AttrSetter"; + if ($attrExt->{"Replaceable"}) { + $setter = "${interfaceName}V8Internal::${interfaceName}ReplaceableAttrSetter"; + } + # Custom Setter if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { $hasCustomSetter = 1; @@ -2133,17 +2160,6 @@ sub GenerateSingleBatchedAttribute } } - # Replaceable - if ($attrExt->{"Replaceable"} && !$hasCustomSetter) { - $setter = "0"; - # Handle the special case of window.top being marked as Replaceable. - # FIXME: Investigate whether we could treat window.top as replaceable - # and allow shadowing without it being a security hole. - if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) { - $propAttr .= " | v8::ReadOnly"; - } - } - # Read only attributes if ($attribute->type =~ /^readonly/ || $attrExt->{"V8ReadOnly"}) { $setter = "0"; @@ -2502,6 +2518,8 @@ sub GenerateImplementation push(@implContentDecls, "template <typename T> void V8_USE(T) { }\n\n"); my $hasConstructors = 0; + my $hasReplaceable = 0; + # Generate property accessors for attributes. for (my $index = 0; $index < @{$dataNode->attributes}; $index++) { my $attribute = @{$dataNode->attributes}[$index]; @@ -2537,9 +2555,11 @@ sub GenerateImplementation $attribute->signature->extendedAttributes->{"V8CustomGetter"})) { GenerateNormalAttrGetter($attribute, $dataNode, $implClassName, $interfaceName); } - if (!$attribute->signature->extendedAttributes->{"CustomSetter"} && + + if ($attribute->signature->extendedAttributes->{"Replaceable"}) { + $hasReplaceable = 1; + } elsif (!$attribute->signature->extendedAttributes->{"CustomSetter"} && !$attribute->signature->extendedAttributes->{"V8CustomSetter"} && - !$attribute->signature->extendedAttributes->{"Replaceable"} && $attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) { GenerateNormalAttrSetter($attribute, $dataNode, $implClassName, $interfaceName); @@ -2550,6 +2570,10 @@ sub GenerateImplementation GenerateConstructorGetter($dataNode, $implClassName); } + if ($hasConstructors || $hasReplaceable) { + GenerateReplaceableAttrSetter($dataNode, $implClassName); + } + if (NeedsToVisitDOMWrapper($dataNode)) { GenerateVisitDOMWrapper($dataNode, $implClassName); } diff --git a/Source/WebCore/bindings/scripts/preprocessor.pm b/Source/WebCore/bindings/scripts/preprocessor.pm index 86a7e382c..3b4cec191 100644 --- a/Source/WebCore/bindings/scripts/preprocessor.pm +++ b/Source/WebCore/bindings/scripts/preprocessor.pm @@ -23,6 +23,7 @@ use warnings; use Config; use IPC::Open2; +use IPC::Open3; BEGIN { use Exporter (); @@ -66,7 +67,10 @@ sub applyPreprocessor # This call can fail if Windows rebases cygwin, so retry a few times until it succeeds. for (my $tries = 0; !$pid && ($tries < 20); $tries++) { eval { - $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), @args, @macros, $fileName); + # Suppress STDERR so that if we're using cl.exe, the output + # name isn't needlessly echoed. + use Symbol 'gensym'; my $err = gensym; + $pid = open3(\*PP_IN, \*PP_OUT, $err, split(' ', $preprocessor), @args, @macros, $fileName); 1; } or do { sleep 1; diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index cb61197ed..013f9097f 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -645,6 +645,14 @@ WebDOMString WebDOMTestObj::hash() const return static_cast<const WTF::String&>(impl()->hash()); } +int WebDOMTestObj::replaceableAttribute() const +{ + if (!impl()) + return 0; + + return impl()->replaceableAttribute(); +} + void WebDOMTestObj::voidMethod() { if (!impl()) diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index a5cf99e59..fc7da9bca 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -142,6 +142,7 @@ public: int id() const; void setId(int); WebDOMString hash() const; + int replaceableAttribute() const; void voidMethod(); void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 34a807551..3b6253cbe 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -144,6 +144,7 @@ enum { PROP_DESCRIPTION, PROP_ID, PROP_HASH, + PROP_REPLACEABLE_ATTRIBUTE, }; static void webkit_dom_test_obj_finalize(GObject* object) @@ -517,6 +518,10 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint propertyId, g_value_take_string(value, convertToUTF8String(coreSelf->hash())); break; } + case PROP_REPLACEABLE_ATTRIBUTE: { + g_value_set_long(value, coreSelf->replaceableAttribute()); + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); break; @@ -885,6 +890,15 @@ G_MAXLONG, /* max */ "read-only gchar* TestObj.hash", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_REPLACEABLE_ATTRIBUTE, + g_param_spec_long("replaceable-attribute", /* name */ + "test_obj_replaceable-attribute", /* short description */ + "read-write glong TestObj.replaceable-attribute", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); } @@ -2383,3 +2397,13 @@ webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self) return result; } +glong +webkit_dom_test_obj_get_replaceable_attribute(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj* item = WebKit::core(self); + glong result = item->replaceableAttribute(); + return result; +} + diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index 9fa9aadee..727a534e5 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -1345,6 +1345,16 @@ webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value); WEBKIT_API gchar* webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self); +/** + * webkit_dom_test_obj_get_replaceable_attribute: + * @self: A #WebKitDOMTestObj + * + * Returns: + * +**/ +WEBKIT_API glong +webkit_dom_test_obj_get_replaceable_attribute(WebKitDOMTestObj* self); + G_END_DECLS #endif /* WebKitDOMTestObj_h */ diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index afdb3b1ff..c3c829c22 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -81,12 +81,18 @@ static const HashTableValue JSTestInterfaceConstructorTableValues[] = { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic }, #endif #if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalStaticReadOnlyAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr), (intptr_t)0, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalStaticAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorSupplementalStaticAttr), (intptr_t)setJSTestInterfaceConstructorSupplementalStaticAttr, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) { "supplementalMethod4", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfaceConstructorFunctionSupplementalMethod4), (intptr_t)0, NoIntrinsic }, #endif { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestInterfaceConstructorTable = { 4, 3, JSTestInterfaceConstructorTableValues, 0 }; +static const HashTable JSTestInterfaceConstructorTable = { 5, 3, JSTestInterfaceConstructorTableValues, 0 }; #if ENABLE(Condition11) || ENABLE(Condition12) COMPILE_ASSERT(1 == TestSupplemental::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants); @@ -236,6 +242,30 @@ bool JSTestInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec } #if ENABLE(Condition11) || ENABLE(Condition12) +JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* exec, JSValue, PropertyName) +{ + ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return jsUndefined(); + JSC::JSValue result = jsNumber(TestInterface::supplementalStaticReadOnlyAttr(scriptContext)); + return result; +} + +#endif + +#if ENABLE(Condition11) || ENABLE(Condition12) +JSValue jsTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSValue, PropertyName) +{ + ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return jsUndefined(); + JSC::JSValue result = jsString(exec, TestInterface::supplementalStaticAttr(scriptContext)); + return result; +} + +#endif + +#if ENABLE(Condition11) || ENABLE(Condition12) JSValue jsTestInterfaceSupplementalStr1(ExecState* exec, JSValue slotBase, PropertyName) { JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase)); @@ -296,6 +326,17 @@ void JSTestInterface::put(JSCell* cell, ExecState* exec, PropertyName propertyNa } #if ENABLE(Condition11) || ENABLE(Condition12) +void setJSTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSObject*, JSValue value) +{ + ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return; + TestInterface::setSupplementalStaticAttr(scriptContext, ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec))); +} + +#endif + +#if ENABLE(Condition11) || ENABLE(Condition12) void setJSTestInterfaceSupplementalStr2(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h index d7963a2e9..8baaa731d 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -170,6 +170,13 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionSupplemental // Attributes #if ENABLE(Condition11) || ENABLE(Condition12) +JSC::JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) +JSC::JSValue jsTestInterfaceConstructorSupplementalStaticAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +void setJSTestInterfaceConstructorSupplementalStaticAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) JSC::JSValue jsTestInterfaceSupplementalStr1(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); #endif #if ENABLE(Condition11) || ENABLE(Condition12) diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index ecb2174d4..e69da7ebb 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -142,11 +142,12 @@ static const HashTableValue JSTestObjTableValues[] = { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0, NoIntrinsic }, { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId, NoIntrinsic }, { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (intptr_t)0, NoIntrinsic }, + { "replaceableAttribute", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReplaceableAttribute), (intptr_t)setJSTestObjReplaceableAttribute, NoIntrinsic }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructor), (intptr_t)0, NoIntrinsic }, { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjTable = { 138, 127, JSTestObjTableValues, 0 }; +static const HashTable JSTestObjTable = { 139, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestObjConstructorTableValues[] = @@ -923,6 +924,16 @@ JSValue jsTestObjHash(ExecState* exec, JSValue slotBase, PropertyName) } +JSValue jsTestObjReplaceableAttribute(ExecState* exec, JSValue slotBase, PropertyName) +{ + JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(impl->replaceableAttribute()); + return result; +} + + JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* domObject = jsCast<JSTestObj*>(asObject(slotBase)); @@ -1360,6 +1371,14 @@ void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value) } +void setJSTestObjReplaceableAttribute(ExecState* exec, JSObject* thisObject, JSValue value) +{ + UNUSED_PARAM(exec); + // Shadowing a built-in object + jsCast<JSTestObj*>(thisObject)->putDirect(exec->globalData(), Identifier(exec, "replaceableAttribute"), value); +} + + JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestObjConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject)); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h index 13d72cbf0..306fad8f4 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -324,6 +324,8 @@ JSC::JSValue jsTestObjDescription(JSC::ExecState*, JSC::JSValue, JSC::PropertyNa JSC::JSValue jsTestObjId(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); void setJSTestObjId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjHash(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +JSC::JSValue jsTestObjReplaceableAttribute(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +void setJSTestObjReplaceableAttribute(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); // Constants diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 831a50fe9..1c42af006 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -167,6 +167,8 @@ enum { - (int)idName; - (void)setIdName:(int)newIdName; - (NSString *)hashName; +- (int)replaceableAttribute; +- (void)setReplaceableAttribute:(int)newReplaceableAttribute; - (void)voidMethod; - (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (int)intMethod; diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 53e459643..fc0937f84 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -707,6 +707,18 @@ return IMPL->hash(); } +- (int)replaceableAttribute +{ + WebCore::JSMainThreadNullState state; + return IMPL->replaceableAttribute(); +} + +- (void)setReplaceableAttribute:(int)newReplaceableAttribute +{ + WebCore::JSMainThreadNullState state; + IMPL->setReplaceableAttribute(newReplaceableAttribute); +} + - (void)voidMethod { WebCore::JSMainThreadNullState state; diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index 34265b2e2..c1ea6f564 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -38,7 +38,7 @@ module test { readonly attribute long readOnlyIntAttr; readonly attribute DOMString readOnlyStringAttr; readonly attribute TestObj readOnlyTestObjAttr; -#if defined(TESTING_JS) +#if defined(TESTING_JS) || defined(TESTING_V8) static readonly attribute long staticReadOnlyIntAttr; static attribute DOMString staticStringAttr; #endif @@ -251,5 +251,7 @@ module test { const unsigned short CONST_VALUE_13 = 0X20; const unsigned short CONST_VALUE_14 = 0x1abc; [Reflect=CONST_IMPL] const unsigned short CONST_JAVASCRIPT = 15; + + attribute [Replaceable] long replaceableAttribute; }; } diff --git a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl index 60514124b..524515bf0 100644 --- a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl +++ b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl @@ -33,6 +33,10 @@ module test { Conditional=Condition11|Condition12, Supplemental=TestInterface ] TestSupplemental { +#if defined(TESTING_JS) || defined(TESTING_V8) + static readonly attribute long supplementalStaticReadOnlyAttr; + static attribute DOMString supplementalStaticAttr; +#endif readonly attribute DOMString supplementalStr1; attribute DOMString supplementalStr2; attribute [CustomGetter, CustomSetter] DOMString supplementalStr3; diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index b828d54bc..1d7dcb534 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -50,6 +50,38 @@ template <typename T> void V8_USE(T) { } #if ENABLE(Condition11) || ENABLE(Condition12) +static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalStaticReadOnlyAttr._get"); + return v8Integer(TestSupplemental::supplementalStaticReadOnlyAttr(), info.GetIsolate()); +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + +static v8::Handle<v8::Value> supplementalStaticAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalStaticAttr._get"); + return v8String(TestSupplemental::supplementalStaticAttr(), info.GetIsolate()); +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + +static void supplementalStaticAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalStaticAttr._set"); + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value); + TestSupplemental::setSupplementalStaticAttr(v); + return; +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + static v8::Handle<v8::Value> supplementalStr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestInterface.supplementalStr1._get"); @@ -160,6 +192,14 @@ static v8::Handle<v8::Value> supplementalMethod4Callback(const v8::Arguments& ar static const BatchedAttribute TestInterfaceAttrs[] = { #if ENABLE(Condition11) || ENABLE(Condition12) + // Attribute 'supplementalStaticReadOnlyAttr' (Type: 'readonly attribute' ExtAttr: 'Conditional ImplementedBy') + {"supplementalStaticReadOnlyAttr", TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +#endif // ENABLE(Condition11) || ENABLE(Condition12) +#if ENABLE(Condition11) || ENABLE(Condition12) + // Attribute 'supplementalStaticAttr' (Type: 'attribute' ExtAttr: 'Conditional ImplementedBy') + {"supplementalStaticAttr", TestInterfaceV8Internal::supplementalStaticAttrAttrGetter, TestInterfaceV8Internal::supplementalStaticAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +#endif // ENABLE(Condition11) || ENABLE(Condition12) +#if ENABLE(Condition11) || ENABLE(Condition12) // Attribute 'supplementalStr1' (Type: 'readonly attribute' ExtAttr: 'Conditional ImplementedBy') {"supplementalStr1", TestInterfaceV8Internal::supplementalStr1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition11) || ENABLE(Condition12) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index adf5562d6..c47e6ae6c 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -109,6 +109,26 @@ static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> return wrapper; } +static v8::Handle<v8::Value> staticReadOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.staticReadOnlyIntAttr._get"); + return v8Integer(TestObj::staticReadOnlyIntAttr(), info.GetIsolate()); +} + +static v8::Handle<v8::Value> staticStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.staticStringAttr._get"); + return v8String(TestObj::staticStringAttr(), info.GetIsolate()); +} + +static void staticStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.staticStringAttr._set"); + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value); + TestObj::setStaticStringAttr(v); + return; +} + static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.shortAttr._get"); @@ -1010,6 +1030,13 @@ static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8 return v8String(imp->hash(), info.GetIsolate()); } +static v8::Handle<v8::Value> replaceableAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.replaceableAttribute._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8Integer(imp->replaceableAttribute(), info.GetIsolate()); +} + static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.constructors._get"); @@ -1018,6 +1045,12 @@ static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); return v8::Handle<v8::Value>();} +static void TestObjReplaceableAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.replaceable._set"); + info.This()->ForceSet(name, value); +} + static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.voidMethod"); @@ -1839,6 +1872,10 @@ static const BatchedAttribute TestObjAttrs[] = { {"readOnlyStringAttr", TestObjV8Internal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '') {"readOnlyTestObjAttr", TestObjV8Internal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'staticReadOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '') + {"staticReadOnlyIntAttr", TestObjV8Internal::staticReadOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'staticStringAttr' (Type: 'attribute' ExtAttr: '') + {"staticStringAttr", TestObjV8Internal::staticStringAttrAttrGetter, TestObjV8Internal::staticStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '') {"shortAttr", TestObjV8Internal::shortAttrAttrGetter, TestObjV8Internal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '') @@ -1915,15 +1952,15 @@ static const BatchedAttribute TestObjAttrs[] = { #endif // ENABLE(Condition1) || ENABLE(Condition2) #if ENABLE(Condition1) // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional') - {"conditionalAttr4", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */}, + {"conditionalAttr4", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition1) #if ENABLE(Condition1) && ENABLE(Condition2) // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional') - {"conditionalAttr5", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */}, + {"conditionalAttr5", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition1) && ENABLE(Condition2) #if ENABLE(Condition1) || ENABLE(Condition2) // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional') - {"conditionalAttr6", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */}, + {"conditionalAttr6", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition1) || ENABLE(Condition2) // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute') {"cachedAttribute1", TestObjV8Internal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, @@ -1949,6 +1986,8 @@ static const BatchedAttribute TestObjAttrs[] = { {"id", TestObjV8Internal::idAttrGetter, TestObjV8Internal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '') {"hash", TestObjV8Internal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'replaceableAttribute' (Type: 'attribute' ExtAttr: 'Replaceable') + {"replaceableAttribute", TestObjV8Internal::replaceableAttributeAttrGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, }; static const BatchedCallback TestObjCallbacks[] = { diff --git a/Source/WebCore/bindings/v8/NPObjectWrapper.cpp b/Source/WebCore/bindings/v8/NPObjectWrapper.cpp new file mode 100644 index 000000000..7c73b2f03 --- /dev/null +++ b/Source/WebCore/bindings/v8/NPObjectWrapper.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "NPObjectWrapper.h" + +namespace WebCore { + +struct NPProxyObject { + NPObject object; + NPObjectWrapper* wrapper; +}; + +NPClass NPObjectWrapper::m_npClassWrapper = { + NP_CLASS_STRUCT_VERSION, + NPObjectWrapper::NPAllocate, + NPObjectWrapper::NPDeallocate, + NPObjectWrapper::NPPInvalidate, + NPObjectWrapper::NPHasMethod, + NPObjectWrapper::NPInvoke, + NPObjectWrapper::NPInvokeDefault, + NPObjectWrapper::NPHasProperty, + NPObjectWrapper::NPGetProperty, + NPObjectWrapper::NPSetProperty, + NPObjectWrapper::NPRemoveProperty, + NPObjectWrapper::NPNEnumerate, + NPObjectWrapper::NPNConstruct +}; + +NPObjectWrapper::NPObjectWrapper(NPObject* obj) + : m_wrappedNPObject(obj) +{ +} + +NPObject* NPObjectWrapper::create(NPObject* object) +{ + ASSERT(object); + NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(_NPN_CreateObject(0, &m_npClassWrapper)); + proxyObject->wrapper = new NPObjectWrapper(object); + return reinterpret_cast<NPObject*>(proxyObject); +} + +void NPObjectWrapper::clear() +{ + m_wrappedNPObject = 0; +} + +NPObjectWrapper* NPObjectWrapper::getWrapper(NPObject* obj) +{ + if (&m_npClassWrapper == obj->_class) { + NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(obj); + return proxyObject->wrapper; + } + return 0; +} + +NPObject* NPObjectWrapper::getUnderlyingNPObject(NPObject* obj) +{ + NPObjectWrapper* wrapper = getWrapper(obj); + return wrapper ? wrapper->m_wrappedNPObject : 0; +} + +NPObject* NPObjectWrapper::getObjectForCall(NPObject* obj) +{ + NPObject* actualObject = getUnderlyingNPObject(obj); + return actualObject ? actualObject : 0; +} + +NPObject* NPObjectWrapper::NPAllocate(NPP, NPClass*) +{ + return reinterpret_cast<NPObject*>(new NPProxyObject); +} + +void NPObjectWrapper::NPDeallocate(NPObject* obj) +{ + NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(obj); + delete proxyObject->wrapper; + delete proxyObject; +} + +void NPObjectWrapper::NPPInvalidate(NPObject* obj) +{ + NPObject* actualObject = getObjectForCall(obj); + if (actualObject && actualObject->_class->invalidate) + actualObject->_class->invalidate(actualObject); +} + +bool NPObjectWrapper::NPHasMethod(NPObject* obj, NPIdentifier name) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_HasMethod(0, actualObject, name) : false; +} + +bool NPObjectWrapper::NPInvoke(NPObject* obj, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_Invoke(0, actualObject, name, args, argCount, result) : false; +} + +bool NPObjectWrapper::NPInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_InvokeDefault(0, actualObject, args, argCount, result) : false; +} + +bool NPObjectWrapper::NPHasProperty(NPObject* obj, NPIdentifier name) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_HasProperty(0, actualObject, name) : false; +} + +bool NPObjectWrapper::NPGetProperty(NPObject* obj, NPIdentifier name, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_GetProperty(0, actualObject, name, result) : false; +} + +bool NPObjectWrapper::NPSetProperty(NPObject* obj, NPIdentifier name, const NPVariant* value) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_SetProperty(0, actualObject, name, value) : false; +} + +bool NPObjectWrapper::NPRemoveProperty(NPObject* obj, NPIdentifier name) { + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_RemoveProperty(0, actualObject, name) : false; +} + +bool NPObjectWrapper::NPNEnumerate(NPObject* obj, NPIdentifier** value, uint32_t* count) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_Enumerate(0, actualObject, value, count) : false; +} + +bool NPObjectWrapper::NPNConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_Construct(0, actualObject, args, argCount, result) : false; +} + +bool NPObjectWrapper::NPInvokePrivate(NPP npp, NPObject* obj, bool isDefault, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + if (!actualObject) + return false; + + if (isDefault) { + return _NPN_InvokeDefault(0, actualObject, args, argCount, result); + } else { + return _NPN_Invoke(0, actualObject, name, args, argCount, result); + } +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/v8/NPObjectWrapper.h b/Source/WebCore/bindings/v8/NPObjectWrapper.h new file mode 100644 index 000000000..6fdf90b4a --- /dev/null +++ b/Source/WebCore/bindings/v8/NPObjectWrapper.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NPObjectWrapper_h +#define NPObjectWrapper_h + +#include "npruntime_impl.h" + +namespace WebCore { + +// This class wraps a NPObject and provides functionality for the wrapped +// object to be cleared out when this object is destroyed. This is to ensure +// that callers trying to access the underlying object don't crash while +// invoking methods on the NPObject. +class NPObjectWrapper { +public: + // Creates an instance of the NPObjectWrapper class and wraps the object + // passed in. + static NPObject* create(NPObject* object); + + // This method should be called to invalidate the underlying NPObject pointer. + void clear(); + + // Returns a pointer to NPObjectWrapper if the object passed in was wrapped by us. + static NPObjectWrapper* getWrapper(NPObject* obj); + + // Returns a pointer to the underlying raw NPObject pointer or 0 if the object + // passed in was not wrapped. + static NPObject* getUnderlyingNPObject(NPObject* obj); + + // NPObject functions implemented by the wrapper. + static NPObject* NPAllocate(NPP, NPClass*); + static void NPDeallocate(NPObject* obj); + static void NPPInvalidate(NPObject *obj); + static bool NPHasMethod(NPObject* obj, NPIdentifier name); + static bool NPInvoke(NPObject* obj, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result); + static bool NPInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result); + static bool NPHasProperty(NPObject* obj, NPIdentifier name); + static bool NPGetProperty(NPObject* obj, NPIdentifier name, NPVariant* result); + static bool NPSetProperty(NPObject* obj, NPIdentifier name, const NPVariant *value); + static bool NPRemoveProperty(NPObject* obj, NPIdentifier name); + static bool NPNEnumerate(NPObject* obj, NPIdentifier **value, uint32_t* count); + static bool NPNConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result); + static bool NPInvokePrivate(NPP npp, NPObject* obj,bool isDefault, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result); + +private: + NPObjectWrapper(NPObject* obj); + + // Returns the underlying NPObject if the object passed in was wrapped. Otherwise + // just returns the object passed in. + static NPObject* getObjectForCall(NPObject* obj); + + static NPClass m_npClassWrapper; + // Weak NPObject poointer. + NPObject* m_wrappedNPObject; +}; + +} // namespace WebCore + +#endif // NPObjectWrapper_h + diff --git a/Source/WebCore/bindings/v8/NPV8Object.cpp b/Source/WebCore/bindings/v8/NPV8Object.cpp index 6a76bfff5..a3790da00 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.cpp +++ b/Source/WebCore/bindings/v8/NPV8Object.cpp @@ -31,6 +31,7 @@ #include "PlatformSupport.h" #include "DOMWindow.h" #include "Frame.h" +#include "NPObjectWrapper.h" #include <wtf/OwnArrayPtr.h> #include "PlatformString.h" #include "ScriptSourceCode.h" @@ -75,7 +76,29 @@ static NPObject* allocV8NPObject(NPP, NPClass*) static void freeV8NPObject(NPObject* npObject) { V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - disposeUnderlyingV8Object(npObject); + if (int v8ObjectHash = v8NpObject->v8Object->GetIdentityHash()) { + V8NPObjectMap::iterator iter = staticV8NPObjectMap()->find(v8ObjectHash); + if (iter != staticV8NPObjectMap()->end()) { + V8NPObjectVector& objects = iter->second; + for (size_t index = 0; index < objects.size(); ++index) { + if (objects.at(index) == v8NpObject) { + objects.remove(index); + break; + } + } + if (objects.isEmpty()) + staticV8NPObjectMap()->remove(v8ObjectHash); + } else + ASSERT_NOT_REACHED(); + } else { + ASSERT(!v8::Context::InContext()); + staticV8NPObjectMap()->clear(); + } + +#ifndef NDEBUG + V8GCController::unregisterGlobalHandle(v8NpObject, v8NpObject->v8Object); +#endif + v8NpObject->v8Object.Dispose(); free(v8NpObject); } @@ -156,39 +179,6 @@ NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWind return reinterpret_cast<NPObject*>(v8npObject); } -void disposeUnderlyingV8Object(NPObject* npObject) -{ - ASSERT(npObject->_class == npScriptObjectClass); - V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return; - if (int v8ObjectHash = v8NpObject->v8Object->GetIdentityHash()) { - V8NPObjectMap::iterator iter = staticV8NPObjectMap()->find(v8ObjectHash); - if (iter != staticV8NPObjectMap()->end()) { - V8NPObjectVector& objects = iter->second; - for (size_t index = 0; index < objects.size(); ++index) { - if (objects.at(index) == v8NpObject) { - objects.remove(index); - break; - } - } - if (objects.isEmpty()) - staticV8NPObjectMap()->remove(v8ObjectHash); - } else - ASSERT_NOT_REACHED(); - } else { - ASSERT(!v8::Context::InContext()); - staticV8NPObjectMap()->clear(); - } - -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(v8NpObject, v8NpObject->v8Object); -#endif - v8NpObject->v8Object.Dispose(); - v8NpObject->v8Object.Clear(); - v8NpObject->rootObject = 0; -} - } // namespace WebCore bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) @@ -205,8 +195,6 @@ bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV } V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return false; PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(methodName); if (!identifier->isString) @@ -271,8 +259,6 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments, } V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return false; VOID_TO_NPVARIANT(*result); @@ -319,11 +305,13 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri if (!npObject) return false; - if (npObject->_class != npScriptObjectClass) - return false; - V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return false; + if (npObject->_class != npScriptObjectClass) { + // Check if the object passed in is wrapped. If yes, then we need to invoke on the underlying object. + NPObject* actualObject = NPObjectWrapper::getUnderlyingNPObject(npObject); + if (!actualObject) + return false; + npObject = actualObject; + } v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -361,8 +349,6 @@ bool _NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NP if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -398,8 +384,6 @@ bool _NPN_SetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, co if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -429,8 +413,6 @@ bool _NPN_RemoveProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName) return false; V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -452,8 +434,6 @@ bool _NPN_HasProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName) if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -478,8 +458,6 @@ bool _NPN_HasMethod(NPP npp, NPObject* npObject, NPIdentifier methodName) if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -524,8 +502,6 @@ bool _NPN_Enumerate(NPP npp, NPObject* npObject, NPIdentifier** identifier, uint if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -581,8 +557,6 @@ bool _NPN_Construct(NPP npp, NPObject* npObject, const NPVariant* arguments, uin if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); diff --git a/Source/WebCore/bindings/v8/NPV8Object.h b/Source/WebCore/bindings/v8/NPV8Object.h index b7e0464a1..f72ba8bd1 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.h +++ b/Source/WebCore/bindings/v8/NPV8Object.h @@ -54,9 +54,8 @@ WrapperTypeInfo* npObjectTypeInfo(); extern NPClass* npScriptObjectClass; -// A V8NPObject is a NPObject which carries additional V8-specific information. -// It is created with npCreateV8ScriptObject() and deallocated via the deallocate -// method in the same way as other NPObjects. +// A V8NPObject is a NPObject which carries additional V8-specific information. It is allocated and deallocated by +// AllocV8NPObject() and FreeV8NPObject() methods. struct V8NPObject { NPObject object; v8::Persistent<v8::Object> v8Object; @@ -75,8 +74,6 @@ NPObject* npCreateV8ScriptObject(NPP, v8::Handle<v8::Object>, DOMWindow*); NPObject* v8ObjectToNPObject(v8::Handle<v8::Object>); -void disposeUnderlyingV8Object(NPObject*); - } // namespace WebCore #endif // NPV8Object_h diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index 0a84a1cea..14c050a76 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -45,6 +45,7 @@ #include "FrameLoaderClient.h" #include "Node.h" #include "NotImplemented.h" +#include "NPObjectWrapper.h" #include "npruntime_impl.h" #include "npruntime_priv.h" #include "NPV8Object.h" @@ -105,7 +106,7 @@ ScriptController::ScriptController(Frame* frame) , m_paused(false) , m_proxy(adoptPtr(new V8Proxy(frame))) #if ENABLE(NETSCAPE_PLUGIN_API) - , m_windowScriptNPObject(0) + , m_wrappedWindowScriptNPObject(0) #endif { } @@ -124,14 +125,21 @@ void ScriptController::clearScriptObjects() m_pluginObjects.clear(); #if ENABLE(NETSCAPE_PLUGIN_API) - if (m_windowScriptNPObject) { - // Dispose of the underlying V8 object before releasing our reference - // to it, so that if the plugin fails to release it properly we will - // only leak the NPObject wrapper, not the object, its document, or - // anything else they reference. - disposeUnderlyingV8Object(m_windowScriptNPObject); - _NPN_ReleaseObject(m_windowScriptNPObject); - m_windowScriptNPObject = 0; + if (m_wrappedWindowScriptNPObject) { + NPObjectWrapper* windowScriptObjectWrapper = NPObjectWrapper::getWrapper(m_wrappedWindowScriptNPObject); + ASSERT(windowScriptObjectWrapper); + + NPObject* windowScriptNPObject = NPObjectWrapper::getUnderlyingNPObject(m_wrappedWindowScriptNPObject); + ASSERT(windowScriptNPObject); + // Call _NPN_DeallocateObject() instead of _NPN_ReleaseObject() so that we don't leak if a plugin fails to release the window + // script object properly. + // This shouldn't cause any problems for plugins since they should have already been stopped and destroyed at this point. + _NPN_DeallocateObject(windowScriptNPObject); + + // Clear out the wrapped window script object pointer held by the wrapper. + windowScriptObjectWrapper->clear(); + _NPN_ReleaseObject(m_wrappedWindowScriptNPObject); + m_wrappedWindowScriptNPObject = 0; } #endif } @@ -379,21 +387,24 @@ static NPObject* createScriptObject(Frame* frame) NPObject* ScriptController::windowScriptNPObject() { - if (m_windowScriptNPObject) - return m_windowScriptNPObject; + if (m_wrappedWindowScriptNPObject) + return m_wrappedWindowScriptNPObject; + NPObject* windowScriptNPObject = 0; if (canExecuteScripts(NotAboutToExecuteScript)) { // JavaScript is enabled, so there is a JavaScript window object. // Return an NPObject bound to the window object. - m_windowScriptNPObject = createScriptObject(m_frame); - _NPN_RegisterObject(m_windowScriptNPObject, 0); + windowScriptNPObject = createScriptObject(m_frame); + _NPN_RegisterObject(windowScriptNPObject, 0); } else { // JavaScript is not enabled, so we cannot bind the NPObject to the // JavaScript window object. Instead, we create an NPObject of a // different class, one which is not bound to a JavaScript object. - m_windowScriptNPObject = createNoScriptObject(); + windowScriptNPObject = createNoScriptObject(); } - return m_windowScriptNPObject; + + m_wrappedWindowScriptNPObject = NPObjectWrapper::create(windowScriptNPObject); + return m_wrappedWindowScriptNPObject; } NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement* plugin) diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index 32cb33513..622e833b5 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -191,9 +191,14 @@ private: // invalidate all sub-objects which are associated with that plugin. // The frame keeps a NPObject reference for each item on the list. PluginObjectMap m_pluginObjects; -#if ENABLE(NETSCAPE_PLUGIN_API) - NPObject* m_windowScriptNPObject; -#endif + // The window script object can get destroyed while there are outstanding + // references to it. Please refer to ScriptController::clearScriptObjects + // for more information as to why this is necessary. To avoid crashes due + // to calls on the destroyed window object, we return a proxy NPObject + // which wraps the underlying window object. The wrapped window object + // pointer in this object is cleared out when the window object is + // destroyed. + NPObject* m_wrappedWindowScriptNPObject; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp index 616107361..de22e29ee 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -2201,6 +2201,7 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValue::release() } SerializedScriptValue::SerializedScriptValue() + : m_externallyAllocatedMemory(0) { } @@ -2252,6 +2253,7 @@ SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow, v8::Isolate* isolate) + : m_externallyAllocatedMemory(0) { didThrow = false; Writer writer(isolate); @@ -2298,6 +2300,7 @@ SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, } SerializedScriptValue::SerializedScriptValue(const String& wireData) + : m_externallyAllocatedMemory(0) { m_data = wireData.isolatedCopy(); } @@ -2322,4 +2325,23 @@ ScriptValue SerializedScriptValue::deserializeForInspector(ScriptState* scriptSt } #endif +void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() +{ + if (m_externallyAllocatedMemory) + return; + m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(m_externallyAllocatedMemory); +} + +SerializedScriptValue::~SerializedScriptValue() +{ + // If the allocated memory was not registered before, then this class is likely + // used in a context other then Worker's onmessage environment and the presence of + // current v8 context is not guaranteed. Avoid calling v8 then. + if (m_externallyAllocatedMemory) { + ASSERT(v8::Isolate::GetCurrent()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemory); + } +} + } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.h b/Source/WebCore/bindings/v8/SerializedScriptValue.h index 84d122489..cb66384d4 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.h +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.h @@ -45,6 +45,8 @@ typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray; class SerializedScriptValue : public ThreadSafeRefCounted<SerializedScriptValue> { public: + virtual ~SerializedScriptValue(); + // If a serialization error occurs (e.g., cyclic input value) this // function returns an empty representation, schedules a V8 exception to // be thrown using v8::ThrowException(), and sets |didThrow|. In this case @@ -77,6 +79,12 @@ public: const Vector<String>& blobURLs() const { return m_blobURLs; } + // Informs the V8 about external memory allocated and owned by this object. Large values should contribute + // to GC counters to eventually trigger a GC, otherwise flood of postMessage() can cause OOM. + // Ok to invoke multiple times (only adds memory once). + // The memory registration is revoked automatically in destructor. + void registerMemoryAllocatedWithCurrentScriptContext(); + private: enum StringDataMode { StringValue, @@ -93,6 +101,7 @@ private: String m_data; OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; Vector<String> m_blobURLs; + intptr_t m_externallyAllocatedMemory; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index bdbe4e1c5..056239b4f 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -300,10 +300,6 @@ bool V8DOMWindowShell::initContextIfNeeded() #endif V8BindingPerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); - // FIXME: Remove the following 2 lines when V8 default has changed. - const char es52GlobalsFlag[] = "--es52_globals"; - v8::V8::SetFlagsFromString(es52GlobalsFlag, sizeof(es52GlobalsFlag)); - isV8Initialized = true; } diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp index ae039e3b6..e4079cdd1 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/bindings/v8/V8Proxy.cpp @@ -593,6 +593,11 @@ v8::Handle<v8::Value> V8Proxy::setDOMException(int ec, v8::Isolate* isolate) if (ec <= 0) return v8::Handle<v8::Value>(); + if (ec == NATIVE_TYPE_ERR) { + const char* message = 0; + return throwTypeError(message, isolate); + } + ExceptionCodeDescription description(ec); v8::Handle<v8::Value> exception; diff --git a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp index 139be5191..1f4848bad 100644 --- a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp @@ -122,10 +122,6 @@ void WorkerContextExecutionProxy::initIsolate() v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue); v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); - // FIXME: Remove the following 2 lines when V8 default has changed. - const char es52GlobalsFlag[] = "--es52_globals"; - v8::V8::SetFlagsFromString(es52GlobalsFlag, sizeof(es52GlobalsFlag)); - v8::ResourceConstraints resource_constraints; uint32_t here; resource_constraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uint32_t*)); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index bf7d52217..4bd9778ad 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -69,6 +69,7 @@ #include "Rect.h" #include "RenderTheme.h" #include "RuntimeEnabledFeatures.h" +#include "SVGParserUtilities.h" #include "Settings.h" #include "ShadowValue.h" #include "StylePropertySet.h" @@ -4464,7 +4465,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeRectangle(CSSParserValueL unsigned argumentNumber = 0; CSSParserValue* argument = args->current(); while (argument) { - if (!validUnit(argument, FLength)) + if (!validUnit(argument, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument); @@ -4491,7 +4492,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeRectangle(CSSParserValueL } argument = args->next(); if (argument) { - if (argument->unit != CSSParserValue::Operator || argument->iValue != ',') + if (!isComma(argument)) return 0; argument = args->next(); @@ -4517,7 +4518,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeCircle(CSSParserValueList unsigned argumentNumber = 0; CSSParserValue* argument = args->current(); while (argument) { - if (!validUnit(argument, FLength)) + if (!validUnit(argument, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument); @@ -4536,7 +4537,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeCircle(CSSParserValueList argument = args->next(); if (argument) { - if (argument->unit != CSSParserValue::Operator || argument->iValue != ',') + if (!isComma(argument)) return 0; argument = args->next(); } @@ -4560,7 +4561,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeEllipse(CSSParserValueLis unsigned argumentNumber = 0; CSSParserValue* argument = args->current(); while (argument) { - if (!validUnit(argument, FLength)) + if (!validUnit(argument, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument); @@ -4582,7 +4583,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeEllipse(CSSParserValueLis argument = args->next(); if (argument) { - if (argument->unit != CSSParserValue::Operator || argument->iValue != ',') + if (!isComma(argument)) return 0; argument = args->next(); } @@ -4621,11 +4622,11 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapePolygon(CSSParserValueLis CSSParserValue* argumentX = argument; while (argumentX) { - if (!validUnit(argumentX, FLength)) + if (!validUnit(argumentX, FLength | FPercent)) return 0; CSSParserValue* argumentY = args->next(); - if (!argumentY || !validUnit(argumentY, FLength)) + if (!argumentY || !validUnit(argumentY, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argumentX); @@ -8967,8 +8968,29 @@ restartAfterComment: break; } - yylval->number = charactersToDouble(m_tokenStart, m_currentCharacter - m_tokenStart); - +#if ENABLE(SVG) + // Use SVG parser for numbers on SVG presentation attributes. + if (m_context.mode == SVGAttributeMode) { + // We need to take care of units like 'em' or 'ex'. + UChar* currentCharacter = m_currentCharacter; + if (isASCIIAlphaCaselessEqual(*currentCharacter, 'e')) { + ASSERT(currentCharacter - m_tokenStart > 0); + ++currentCharacter; + if (*currentCharacter == '-' || *currentCharacter == '+' || isASCIIDigit(*currentCharacter)) { + ++currentCharacter; + while (isASCIIDigit(*currentCharacter)) + ++currentCharacter; + // Use FLOATTOKEN if the string contains exponents. + dotSeen = true; + m_currentCharacter = currentCharacter; + } + } + if (!parseSVGNumber(m_tokenStart, currentCharacter - m_tokenStart, yylval->number)) + break; + } else +#endif + yylval->number = charactersToDouble(m_tokenStart, m_currentCharacter - m_tokenStart); + // Type of the function. if (isIdentifierStart()) { UChar* type = m_currentCharacter; diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index a370112e0..97e0b63b1 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -465,12 +465,12 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) m_value.ident = CSSValueRatingLevelIndicator; break; case ProgressBarPart: -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) m_value.ident = CSSValueProgressBar; #endif break; case ProgressBarValuePart: -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) m_value.ident = CSSValueProgressBarValue; #endif break; diff --git a/Source/WebCore/css/SelectorChecker.cpp b/Source/WebCore/css/SelectorChecker.cpp index d959f6715..66dc5874b 100644 --- a/Source/WebCore/css/SelectorChecker.cpp +++ b/Source/WebCore/css/SelectorChecker.cpp @@ -1103,7 +1103,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P { if (!element) break; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) if (element->hasTagName(progressTag)) { HTMLProgressElement* progress = static_cast<HTMLProgressElement*>(element); if (progress && !progress->isDeterminate()) diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index b4cbd8a21..4ee464a4c 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -1420,7 +1420,7 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const return false; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) if (element->hasTagName(progressTag)) { if (!m_element->hasTagName(progressTag)) return false; @@ -1801,7 +1801,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(const RenderStyle* eleme loadPendingResources(); // Add all the animating properties to the keyframe. - if (StylePropertySet* styleDeclaration = keyframe->properties()) { + if (const StylePropertySet* styleDeclaration = keyframe->properties()) { unsigned propertyCount = styleDeclaration->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { CSSPropertyID property = styleDeclaration->propertyAt(i).id(); @@ -2607,17 +2607,17 @@ void RuleSet::addRegionRule(StyleRuleRegion* regionRule, bool hasDocumentSecurit m_regionSelectorsAndRuleSets.append(RuleSetSelectorPair(regionRule->selectorList().first(), regionRuleSet.release())); } -void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* styleSelector, const ContainerNode* scope) +void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver, const ContainerNode* scope) { ASSERT(sheet); const Vector<RefPtr<StyleRuleImport> >& importRules = sheet->importRules(); for (unsigned i = 0; i < importRules.size(); ++i) { StyleRuleImport* importRule = importRules[i].get(); - if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), styleSelector))) - addRulesFromSheet(importRule->styleSheet(), medium, styleSelector, scope); + if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), resolver))) + addRulesFromSheet(importRule->styleSheet(), medium, resolver, scope); } - bool hasDocumentSecurityOrigin = styleSelector && styleSelector->document()->securityOrigin()->canRequest(sheet->baseURL()); + bool hasDocumentSecurityOrigin = resolver && resolver->document()->securityOrigin()->canRequest(sheet->baseURL()); const Vector<RefPtr<StyleRuleBase> >& rules = sheet->childRules(); for (unsigned i = 0; i < rules.size(); ++i) { @@ -2631,7 +2631,7 @@ void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu else if (rule->isMediaRule()) { StyleRuleMedia* mediaRule = static_cast<StyleRuleMedia*>(rule); - if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), styleSelector))) { + if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), resolver))) { // Traverse child elements of the @media rule. const Vector<RefPtr<StyleRuleBase> >& childRules = mediaRule->childRules(); for (unsigned j = 0; j < childRules.size(); ++j) { @@ -2640,39 +2640,39 @@ void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu addStyleRule(static_cast<StyleRule*>(childRule), hasDocumentSecurityOrigin, !scope); else if (childRule->isPageRule()) addPageRule(static_cast<StyleRulePage*>(childRule)); - else if (childRule->isFontFaceRule() && styleSelector) { + else if (childRule->isFontFaceRule() && resolver) { // Add this font face to our set. // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment. if (scope) continue; const StyleRuleFontFace* fontFaceRule = static_cast<StyleRuleFontFace*>(childRule); - styleSelector->fontSelector()->addFontFaceRule(fontFaceRule); - styleSelector->invalidateMatchedPropertiesCache(); - } else if (childRule->isKeyframesRule() && styleSelector) { + resolver->fontSelector()->addFontFaceRule(fontFaceRule); + resolver->invalidateMatchedPropertiesCache(); + } else if (childRule->isKeyframesRule() && resolver) { // Add this keyframe rule to our set. // FIXME(BUG 72462): We don't add @keyframe rules of scoped style sheets for the moment. if (scope) continue; - styleSelector->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(childRule)); + resolver->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(childRule)); } } // for rules } // if rules - } else if (rule->isFontFaceRule() && styleSelector) { + } else if (rule->isFontFaceRule() && resolver) { // Add this font face to our set. // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment. if (scope) continue; const StyleRuleFontFace* fontFaceRule = static_cast<StyleRuleFontFace*>(rule); - styleSelector->fontSelector()->addFontFaceRule(fontFaceRule); - styleSelector->invalidateMatchedPropertiesCache(); - } else if (rule->isKeyframesRule() && styleSelector) { + resolver->fontSelector()->addFontFaceRule(fontFaceRule); + resolver->invalidateMatchedPropertiesCache(); + } else if (rule->isKeyframesRule() && resolver) { // FIXME (BUG 72462): We don't add @keyframe rules of scoped style sheets for the moment. if (scope) continue; - styleSelector->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(rule)); + resolver->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(rule)); } #if ENABLE(CSS_REGIONS) - else if (rule->isRegionRule() && styleSelector) { + else if (rule->isRegionRule() && resolver) { // FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment. if (scope) continue; @@ -4560,7 +4560,9 @@ float StyleResolver::getComputedSizeFromSpecifiedSize(Document* document, float if (useSmartMinimumForFontSize && zoomedSize < minLogicalSize && (specifiedSize >= minLogicalSize || !isAbsoluteSize)) zoomedSize = minLogicalSize; - return zoomedSize; + // Also clamp to a reasonable maximum to prevent insane font sizes from causing crashes on various + // platforms (I'm looking at you, Windows.) + return min(1000000.0f, zoomedSize); } const int fontSizeTableMax = 16; diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp index 7692086d0..0577b46f0 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp @@ -31,6 +31,13 @@ #include "WebKitCSSKeyframesRule.h" namespace WebCore { + +StylePropertySet* StyleKeyframe::mutableProperties() +{ + if (!m_properties->isMutable()) + m_properties = m_properties->copy(); + return m_properties.get(); +} void StyleKeyframe::setProperties(PassRefPtr<StylePropertySet> properties) { @@ -94,7 +101,7 @@ WebKitCSSKeyframeRule::~WebKitCSSKeyframeRule() CSSStyleDeclaration* WebKitCSSKeyframeRule::style() const { if (!m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->properties(), const_cast<WebKitCSSKeyframeRule*>(this)); + m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->mutableProperties(), const_cast<WebKitCSSKeyframeRule*>(this)); return m_propertiesCSSOMWrapper.get(); } diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.h b/Source/WebCore/css/WebKitCSSKeyframeRule.h index cfa2001e2..444b64820 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.h +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.h @@ -49,7 +49,8 @@ public: void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } - StylePropertySet* properties() const { return m_properties.get(); } + const StylePropertySet* properties() const { return m_properties.get(); } + StylePropertySet* mutableProperties(); void setProperties(PassRefPtr<StylePropertySet>); String cssText() const; diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index 5aab06fc7..9f61bafa2 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -140,6 +140,19 @@ map { display: inline } +#if defined(ENABLE_DIALOG_ELEMENT) && ENABLE_DIALOG_ELEMENT +dialog:not([open]) { display: none; } +dialog { + position: absolute; + left: 0; right: 0; + margin: auto; + border: solid; + padding: 1em; + background: white; + color: black; +} +#endif + /* heading elements */ h1 { @@ -452,7 +465,7 @@ input[type="search"]::-webkit-search-results-button { -webkit-box-flex: 0; } -#if defined(ENABLE_DATALIST) && ENABLE_DATALIST +#if defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT datalist { display: none; } @@ -645,7 +658,7 @@ input[type="color"]::-webkit-color-swatch { -webkit-box-flex: 1; } -#if defined(ENABLE_DATALIST) && ENABLE_DATALIST +#if defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT input[type="color"][list] { -webkit-appearance: menulist; @@ -662,7 +675,7 @@ input[type="color"][list]::-webkit-color-swatch { border-color: #000000; } -#endif // defined(ENABLE_DATALIST) && ENABLE_DATALIST +#endif // defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT #endif // defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR @@ -784,7 +797,7 @@ output { height: 16px; } -#if defined(ENABLE_METER_TAG) && ENABLE_METER_TAG +#if defined(ENABLE_METER_ELEMENT) && ENABLE_METER_ELEMENT /* meter */ meter { @@ -822,7 +835,7 @@ meter::-webkit-meter-even-less-good-value { } #endif -#if defined(ENABLE_PROGRESS_TAG) && ENABLE_PROGRESS_TAG +#if defined(ENABLE_PROGRESS_ELEMENT) && ENABLE_PROGRESS_ELEMENT /* progress */ progress { diff --git a/Source/WebCore/css/mediaControlsChromium.css b/Source/WebCore/css/mediaControlsChromium.css index 6290d3dc3..3a9f1455a 100644 --- a/Source/WebCore/css/mediaControlsChromium.css +++ b/Source/WebCore/css/mediaControlsChromium.css @@ -79,7 +79,7 @@ audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { -webkit-appearance: media-mute-button; - display: inline; + display: -webkit-box; border: none; box-sizing: border-box; width: 35px; @@ -91,7 +91,7 @@ audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-bu audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { -webkit-appearance: media-play-button; - display: inline; + display: -webkit-box; border: none; box-sizing: border-box; width: 30px; @@ -118,6 +118,7 @@ audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-contr font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; + font-style: normal; color: white; letter-spacing: normal; @@ -179,7 +180,7 @@ input[type="range"]::-webkit-media-slider-thumb { audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button { -webkit-appearance: media-enter-fullscreen-button; - display: inline; + display: -webkit-box; border: none; box-sizing: border-box; width: 30px; diff --git a/Source/WebCore/dom/ChildNodeList.cpp b/Source/WebCore/dom/ChildNodeList.cpp index 86fab6f30..fe55892b2 100644 --- a/Source/WebCore/dom/ChildNodeList.cpp +++ b/Source/WebCore/dom/ChildNodeList.cpp @@ -28,7 +28,7 @@ namespace WebCore { ChildNodeList::ChildNodeList(PassRefPtr<Node> node) - : DynamicNodeList(node, NodeListIsRootedAtNode, DoNotInvalidateOnAttributeChanges) + : DynamicNodeList(node, ChildNodeListType, NodeListIsRootedAtNode, DoNotInvalidateOnAttributeChanges) { } @@ -37,73 +37,9 @@ ChildNodeList::~ChildNodeList() ownerNode()->removeCachedChildNodeList(); } -unsigned ChildNodeList::length() const -{ - if (isLengthCacheValid()) - return cachedLength(); - - unsigned len = 0; - for (Node* n = rootNode()->firstChild(); n; n = n->nextSibling()) - len++; - - setLengthCache(len); - - return len; -} - -Node* ChildNodeList::item(unsigned index) const -{ - unsigned int pos = 0; - Node* n = rootNode()->firstChild(); - - if (isItemCacheValid()) { - if (index == cachedItemOffset()) - return cachedItem(); - - int diff = index - cachedItemOffset(); - unsigned dist = abs(diff); - if (dist < index) { - n = cachedItem(); - pos = cachedItemOffset(); - } - } - - if (isLengthCacheValid()) { - if (index >= cachedLength()) - return 0; - - int diff = index - pos; - unsigned dist = abs(diff); - if (dist > cachedLength() - 1 - index) { - n = rootNode()->lastChild(); - pos = cachedLength() - 1; - } - } - - if (pos <= index) { - while (n && pos < index) { - n = n->nextSibling(); - ++pos; - } - } else { - while (n && pos > index) { - n = n->previousSibling(); - --pos; - } - } - - if (n) { - setItemCache(n, pos); - return n; - } - - return 0; -} - bool ChildNodeList::nodeMatches(Element* testNode) const { - // Note: Due to the overrides of the length and item functions above, - // this function will be called only by DynamicNodeList::itemWithName, + // This function will be called only by DynamicNodeList::itemWithName, // for an element that was located with getElementById. return testNode->parentNode() == rootNode(); } diff --git a/Source/WebCore/dom/ChildNodeList.h b/Source/WebCore/dom/ChildNodeList.h index df3d67bfa..243e897d3 100644 --- a/Source/WebCore/dom/ChildNodeList.h +++ b/Source/WebCore/dom/ChildNodeList.h @@ -38,9 +38,6 @@ namespace WebCore { virtual ~ChildNodeList(); - virtual unsigned length() const; - virtual Node* item(unsigned index) const; - protected: ChildNodeList(PassRefPtr<Node> rootNode); diff --git a/Source/WebCore/dom/ClassNodeList.cpp b/Source/WebCore/dom/ClassNodeList.cpp index 14db32478..c0ce6d2e0 100644 --- a/Source/WebCore/dom/ClassNodeList.cpp +++ b/Source/WebCore/dom/ClassNodeList.cpp @@ -37,7 +37,7 @@ namespace WebCore { ClassNodeList::ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames) - : DynamicSubtreeNodeList(rootNode, InvalidateOnClassAttrChange) + : DynamicSubtreeNodeList(rootNode, ClassNodeListType, InvalidateOnClassAttrChange) , m_classNames(classNames, document()->inQuirksMode()) , m_originalClassNames(classNames) { diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index fc8e1b537..3449ff0ec 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -421,7 +421,7 @@ uint64_t Document::s_globalTreeVersion = 0; Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) : ContainerNode(0, CreateDocument) - , TreeScope(this) + , TreeScope(this, this) , m_guardRefCount(0) , m_contextFeatures(ContextFeatures::defaultSwitch()) , m_compatibilityMode(NoQuirksMode) @@ -493,7 +493,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) , m_didDispatchViewportPropertiesChanged(false) #endif { - m_document = this; + setTreeScope(this); m_pageGroupUserSheetCacheValid = false; @@ -585,6 +585,19 @@ static void histogramMutationEventUsage(const unsigned short& listenerTypes) HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARACTERDATAMODIFIED_LISTENER), 2); } +#if ENABLE(FULLSCREEN_API) +static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const HTMLFrameOwnerElement* owner) +{ + if (!owner) + return true; + do { + if (!owner->hasAttribute(attribute)) + return false; + } while ((owner = owner->document()->ownerElement())); + return true; +} +#endif + Document::~Document() { ASSERT(!renderer()); @@ -663,7 +676,7 @@ Document::~Document() for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_collections); i++) ASSERT(!m_collections[i]); - m_document = 0; + setTreeScope(0); InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); } @@ -1337,13 +1350,14 @@ void Document::setContent(const String& content) String Document::suggestedMIMEType() const { - if (m_document->isXHTMLDocument()) + Document* doc = document(); + if (doc->isXHTMLDocument()) return "application/xhtml+xml"; - if (m_document->isSVGDocument()) + if (doc->isSVGDocument()) return "image/svg+xml"; - if (m_document->xmlStandalone()) + if (doc->xmlStandalone()) return "text/xml"; - if (m_document->isHTMLDocument()) + if (doc->isHTMLDocument()) return "text/html"; if (DocumentLoader* documentLoader = loader()) @@ -3868,7 +3882,7 @@ void Document::setCSSTarget(Element* n) void Document::registerNodeListCache(DynamicNodeListCacheBase* list) { - if (list->type() != InvalidCollectionType) + if (list->type() != NodeListCollectionType) m_nodeListCounts[InvalidateOnIdNameAttrChange]++; m_nodeListCounts[list->invalidationType()]++; if (list->isRootedAtDocument()) @@ -3877,7 +3891,7 @@ void Document::registerNodeListCache(DynamicNodeListCacheBase* list) void Document::unregisterNodeListCache(DynamicNodeListCacheBase* list) { - if (list->type() != InvalidCollectionType) + if (list->type() != NodeListCollectionType) m_nodeListCounts[InvalidateOnIdNameAttrChange]--; m_nodeListCounts[list->invalidationType()]--; if (list->isRootedAtDocument()) { @@ -3886,31 +3900,6 @@ void Document::unregisterNodeListCache(DynamicNodeListCacheBase* list) } } -bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const -{ - if (attrName) { - for (int type = DoNotInvalidateOnAttributeChanges + 1; type < numNodeListInvalidationTypes; type++) { - if (m_nodeListCounts[type] && DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), *attrName)) - return true; - } - return false; - } - - for (int type = 0; type < numNodeListInvalidationTypes; type++) { - if (m_nodeListCounts[type]) - return true; - } - - return false; -} - -void Document::invalidateNodeListCaches(const QualifiedName* attrName) -{ - HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end(); - for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) - (*it)->invalidateCache(attrName); -} - void Document::attachNodeIterator(NodeIterator* ni) { m_nodeIterators.add(ni); @@ -5365,15 +5354,7 @@ MediaCanStartListener* Document::takeAnyMediaCanStartListener() bool Document::fullScreenIsAllowedForElement(Element* element) const { ASSERT(element); - while (HTMLFrameOwnerElement* ownerElement = element->document()->ownerElement()) { - if (!ownerElement->isFrameElementBase()) - continue; - - if (!static_cast<HTMLFrameElementBase*>(ownerElement)->allowFullScreen()) - return false; - element = ownerElement; - } - return true; + return isAttributeOnAllOwners(webkitallowfullscreenAttr, element->document()->ownerElement()); } void Document::requestFullScreenForElement(Element* element, unsigned short flags, FullScreenCheckType checkType) @@ -5582,19 +5563,7 @@ bool Document::webkitFullscreenEnabled() const // browsing context's documents have their fullscreen enabled flag set, or false otherwise. // Top-level browsing contexts are implied to have their allowFullScreen attribute set. - HTMLFrameOwnerElement* owner = ownerElement(); - if (!owner) - return true; - - do { - if (!owner->isFrameElementBase()) - continue; - - if (!static_cast<HTMLFrameElementBase*>(owner)->allowFullScreen()) - return false; - } while ((owner = owner->document()->ownerElement())); - - return true; + return isAttributeOnAllOwners(webkitallowfullscreenAttr, ownerElement()); } void Document::webkitWillEnterFullScreenForElement(Element* element) diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index b63618492..2014dcd84 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -1539,20 +1539,48 @@ private: // Put these methods here, because they require the Document definition, but we really want to inline them. +inline TreeScope* Node::treeScope() const +{ + return m_treeScope == TreeScope::nullInstance() ? 0 : m_treeScope; +} + +inline void Node::setTreeScope(TreeScope* scope) +{ + m_treeScope = scope ? scope : TreeScope::nullInstance(); + setFlag(!m_treeScope->isDocumentScope(), InShadowTree); +} + +inline Document* Node::documentInternal() const +{ + if (getFlag(InShadowTree)) + return m_treeScope->rootDocument(); + return static_cast<Document*>(m_treeScope); +} + +inline Document* Node::document() const +{ + Document* document = documentInternal(); + // FIXME: below ASSERT is useful, but prevents the use of document() in the constructor or destructor + // due to the virtual function call to nodeType(). + ASSERT(document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument())); + return document; +} + inline bool Node::isDocumentNode() const { - return this == m_document; + return this == documentInternal(); } inline Node::Node(Document* document, ConstructionType type) : m_nodeFlags(type) - , m_document(document) + , m_treeScope(0) , m_previous(0) , m_next(0) , m_renderer(0) { if (document) document->guardRef(); + setTreeScope(document); #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) trackForDebugging(); #endif diff --git a/Source/WebCore/dom/DynamicNodeList.cpp b/Source/WebCore/dom/DynamicNodeList.cpp index 25a4504e3..96e0082cf 100644 --- a/Source/WebCore/dom/DynamicNodeList.cpp +++ b/Source/WebCore/dom/DynamicNodeList.cpp @@ -36,7 +36,7 @@ void DynamicNodeListCacheBase::invalidateCache() const m_isLengthCacheValid = false; m_isItemCacheValid = false; m_isNameCacheValid = false; - if (type() == InvalidCollectionType) + if (type() == NodeListCollectionType) return; const HTMLCollectionCacheBase* cacheBase = static_cast<const HTMLCollectionCacheBase*>(this); @@ -51,72 +51,14 @@ void DynamicNodeListCacheBase::invalidateCache() const #endif } -unsigned DynamicSubtreeNodeList::length() const +unsigned DynamicNodeList::length() const { - if (isLengthCacheValid()) - return cachedLength(); - - unsigned length = 0; - Node* rootNode = this->rootNode(); - - for (Node* n = rootNode->firstChild(); n; n = n->traverseNextNode(rootNode)) - length += n->isElementNode() && nodeMatches(static_cast<Element*>(n)); - - setLengthCache(length); - - return length; + return lengthCommon(); } -Node* DynamicSubtreeNodeList::itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const +Node* DynamicNodeList::item(unsigned offset) const { - ASSERT(remainingOffset >= 0); - Node* rootNode = this->rootNode(); - for (Node* n = start; n; n = n->traverseNextNode(rootNode)) { - if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) { - if (!remainingOffset) { - setItemCache(n, offset); - return n; - } - --remainingOffset; - } - } - - return 0; // no matching node in this subtree -} - -Node* DynamicSubtreeNodeList::itemBackwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const -{ - ASSERT(remainingOffset < 0); - Node* rootNode = this->rootNode(); - for (Node* n = start; n; n = n->traversePreviousNode(rootNode)) { - if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) { - if (!remainingOffset) { - setItemCache(n, offset); - return n; - } - ++remainingOffset; - } - } - - return 0; // no matching node in this subtree -} - -Node* DynamicSubtreeNodeList::item(unsigned offset) const -{ - int remainingOffset = offset; - Node* start = rootNode()->firstChild(); - if (isItemCacheValid()) { - if (offset == cachedItemOffset()) - return cachedItem(); - if (offset > cachedItemOffset() || cachedItemOffset() - offset < offset) { - start = cachedItem(); - remainingOffset -= cachedItemOffset(); - } - } - - if (remainingOffset < 0) - return itemBackwardsFromCurrent(start, offset, remainingOffset); - return itemForwardsFromCurrent(start, offset, remainingOffset); + return itemCommon(offset); } Node* DynamicNodeList::itemWithName(const AtomicString& elementId) const diff --git a/Source/WebCore/dom/DynamicNodeList.h b/Source/WebCore/dom/DynamicNodeList.h index c1c05f4c5..a5cd269b1 100644 --- a/Source/WebCore/dom/DynamicNodeList.h +++ b/Source/WebCore/dom/DynamicNodeList.h @@ -43,31 +43,34 @@ enum NodeListRootType { class DynamicNodeListCacheBase { public: - enum ItemBeforeSupportType { - DoNotSupportItemBefore, - SupportItemBefore, + enum ItemAfterOverrideType { + OverridesItemAfter, + DoesNotOverrideItemAfter, }; - DynamicNodeListCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, - CollectionType collectionType = InvalidCollectionType, ItemBeforeSupportType itemBeforeSupportType = DoNotSupportItemBefore) - : m_cachedItem(0) + DynamicNodeListCacheBase(Node* ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType, + bool shouldOnlyIncludeDirectChildren, CollectionType collectionType, ItemAfterOverrideType itemAfterOverrideType) + : m_ownerNode(ownerNode) + , m_cachedItem(0) , m_isLengthCacheValid(false) , m_isItemCacheValid(false) , m_rootedAtDocument(rootType == NodeListIsRootedAtDocument) , m_invalidationType(invalidationType) + , m_shouldOnlyIncludeDirectChildren(shouldOnlyIncludeDirectChildren) , m_isNameCacheValid(false) , m_collectionType(collectionType) - , m_supportsItemBefore(itemBeforeSupportType == SupportItemBefore) + , m_overridesItemAfter(itemAfterOverrideType == OverridesItemAfter) { ASSERT(m_invalidationType == static_cast<unsigned>(invalidationType)); ASSERT(m_collectionType == static_cast<unsigned>(collectionType)); + ASSERT(!m_overridesItemAfter || m_collectionType != NodeListCollectionType); } public: ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootedAtDocument; } ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); } ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionType>(m_collectionType); } - + Node* ownerNode() const { return m_ownerNode.get(); } ALWAYS_INLINE void invalidateCache(const QualifiedName* attrName) const { if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attrName)) @@ -78,11 +81,19 @@ public: static bool shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType, const QualifiedName&); protected: - bool supportsItemBefore() const { return m_supportsItemBefore; } + Document* document() const { return m_ownerNode->document(); } + Node* rootNode() const + { + if (isRootedAtDocument() && m_ownerNode->inDocument()) + return m_ownerNode->document(); + return m_ownerNode.get(); + } + bool overridesItemAfter() const { return m_overridesItemAfter; } ALWAYS_INLINE bool isItemCacheValid() const { return m_isItemCacheValid; } ALWAYS_INLINE Node* cachedItem() const { return m_cachedItem; } ALWAYS_INLINE unsigned cachedItemOffset() const { return m_cachedItemOffset; } + unsigned cachedElementsArrayOffset() const; ALWAYS_INLINE bool isLengthCacheValid() const { return m_isLengthCacheValid; } ALWAYS_INLINE unsigned cachedLength() const { return m_cachedLength; } @@ -98,11 +109,25 @@ protected: m_cachedItemOffset = offset; m_isItemCacheValid = true; } + void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const; bool hasNameCache() const { return m_isNameCacheValid; } void setHasNameCache() const { m_isNameCacheValid = true; } + unsigned lengthCommon() const; + Node* itemCommon(unsigned offset) const; + Node* itemBeforeOrAfterCachedItem(unsigned offset) const; + Node* itemAfter(unsigned&, Node* previousItem) const; + private: + bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDirectChildren; } + bool isLastItemCloserThanLastOrCachedItem(unsigned offset) const; + bool isFirstItemCloserThanCachedItem(unsigned offset) const; + template <bool forward> Node* iterateForNextNode(Node* current) const; + template<bool forward> Node* itemBeforeOrAfter(Node* previousItem) const; + Node* itemBefore(Node* previousItem) const; + + RefPtr<Node> m_ownerNode; mutable Node* m_cachedItem; mutable unsigned m_cachedLength; mutable unsigned m_cachedItemOffset; @@ -110,11 +135,12 @@ private: mutable unsigned m_isItemCacheValid : 1; const unsigned m_rootedAtDocument : 1; const unsigned m_invalidationType : 4; + const unsigned m_shouldOnlyIncludeDirectChildren : 1; // From HTMLCollection mutable unsigned m_isNameCacheValid : 1; const unsigned m_collectionType : 5; - const unsigned m_supportsItemBefore : 1; + const unsigned m_overridesItemAfter : 1; }; ALWAYS_INLINE bool DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType type, const QualifiedName& attrName) @@ -156,33 +182,21 @@ public: LabelsNodeListType, MicroDataItemListType, }; - DynamicNodeList(PassRefPtr<Node> ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType) - : DynamicNodeListCacheBase(rootType, invalidationType) - , m_ownerNode(ownerNode) + DynamicNodeList(PassRefPtr<Node> ownerNode, NodeListType type, NodeListRootType rootType, NodeListInvalidationType invalidationType) + : DynamicNodeListCacheBase(ownerNode.get(), rootType, invalidationType, type == ChildNodeListType, NodeListCollectionType, DoesNotOverrideItemAfter) { } virtual ~DynamicNodeList() { } // DOM methods & attributes for NodeList - virtual unsigned length() const = 0; - virtual Node* item(unsigned index) const = 0; + virtual unsigned length() const OVERRIDE; + virtual Node* item(unsigned offset) const OVERRIDE; virtual Node* itemWithName(const AtomicString&) const; // Other methods (not part of DOM) - Node* ownerNode() const { return m_ownerNode.get(); } - -protected: - Node* rootNode() const - { - if (isRootedAtDocument() && m_ownerNode->inDocument()) - return m_ownerNode->document(); - return m_ownerNode.get(); - } - Document* document() const { return m_ownerNode->document(); } virtual bool nodeMatches(Element*) const = 0; private: virtual bool isDynamicNodeList() const OVERRIDE { return true; } - RefPtr<Node> m_ownerNode; }; class DynamicSubtreeNodeList : public DynamicNodeList { @@ -191,12 +205,10 @@ public: { document()->unregisterNodeListCache(this); } - virtual unsigned length() const OVERRIDE; - virtual Node* item(unsigned index) const OVERRIDE; protected: - DynamicSubtreeNodeList(PassRefPtr<Node> node, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) - : DynamicNodeList(node, rootType, invalidationType) + DynamicSubtreeNodeList(PassRefPtr<Node> node, NodeListType type, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) + : DynamicNodeList(node, type, rootType, invalidationType) { document()->registerNodeListCache(this); } diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 42b468f98..3499447ed 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -1185,6 +1185,18 @@ ElementShadow* Element::ensureShadow() return elementRareData()->m_shadow.get(); } +ShadowRoot* Element::userAgentShadowRoot() const +{ + if (ElementShadow* elementShadow = shadow()) { + if (ShadowRoot* shadowRoot = elementShadow->oldestShadowRoot()) { + ASSERT(shadowRoot->type() == ShadowRoot::UserAgentShadowRoot); + return shadowRoot; + } + } + + return 0; +} + ShadowRoot* Element::ensureShadowRoot() { if (ElementShadow* shadow = this->shadow()) diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 80a1b3cab..b5b22512f 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -270,6 +270,8 @@ public: ElementShadow* ensureShadow(); virtual void willAddAuthorShadowRoot() { } + ShadowRoot* userAgentShadowRoot() const; + // FIXME: Remove Element::ensureShadowRoot // https://bugs.webkit.org/show_bug.cgi?id=77608 ShadowRoot* ensureShadowRoot(); diff --git a/Source/WebCore/dom/EventDispatcher.cpp b/Source/WebCore/dom/EventDispatcher.cpp index 62541d8b5..a75aab0e3 100644 --- a/Source/WebCore/dom/EventDispatcher.cpp +++ b/Source/WebCore/dom/EventDispatcher.cpp @@ -228,7 +228,7 @@ void EventDispatcher::ensureEventAncestors(Event* event) last = node; if (!node->isShadowRoot()) continue; - if (determineDispatchBehavior(event, toShadowRoot(node)) == StayInsideShadowDOM) + if (determineDispatchBehavior(event, toShadowRoot(node), targetStack.last()) == StayInsideShadowDOM) return; if (!isSVGElement) { ASSERT(!targetStack.isEmpty()); @@ -347,7 +347,12 @@ const EventContext* EventDispatcher::topEventContext() return m_ancestors.isEmpty() ? 0 : &m_ancestors.last(); } -EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot) +static inline bool inTheSameScope(ShadowRoot* shadowRoot, EventTarget* target) +{ + return target->toNode() && target->toNode()->treeScope()->rootNode() == shadowRoot; +} + +EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target) { #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO) // Video-only full screen is a mode where we use the shadow DOM as an implementation @@ -366,13 +371,14 @@ EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, S // Changing this breaks existing sites. // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. const AtomicString eventType = event->type(); - if (eventType == eventNames().abortEvent + if (inTheSameScope(shadowRoot, target) + && (eventType == eventNames().abortEvent || eventType == eventNames().changeEvent || eventType == eventNames().resetEvent || eventType == eventNames().resizeEvent || eventType == eventNames().scrollEvent || eventType == eventNames().selectEvent - || eventType == eventNames().selectstartEvent) + || eventType == eventNames().selectstartEvent)) return StayInsideShadowDOM; return RetargetEvent; diff --git a/Source/WebCore/dom/EventDispatcher.h b/Source/WebCore/dom/EventDispatcher.h index a11301e5c..34c55e4db 100644 --- a/Source/WebCore/dom/EventDispatcher.h +++ b/Source/WebCore/dom/EventDispatcher.h @@ -75,7 +75,7 @@ public: private: EventDispatcher(Node*); - EventDispatchBehavior determineDispatchBehavior(Event*, ShadowRoot*); + EventDispatchBehavior determineDispatchBehavior(Event*, ShadowRoot*, EventTarget*); void ensureEventAncestors(Event*); const EventContext* topEventContext(); diff --git a/Source/WebCore/dom/ExceptionCode.h b/Source/WebCore/dom/ExceptionCode.h index 31d668045..51f8dc2d3 100644 --- a/Source/WebCore/dom/ExceptionCode.h +++ b/Source/WebCore/dom/ExceptionCode.h @@ -63,7 +63,10 @@ namespace WebCore { QUOTA_EXCEEDED_ERR = 22, TIMEOUT_ERR = 23, INVALID_NODE_TYPE_ERR = 24, - DATA_CLONE_ERR = 25 + DATA_CLONE_ERR = 25, + + // Converted to a native TypeError by the script binding layer: + NATIVE_TYPE_ERR = 99 }; } // namespace WebCore diff --git a/Source/WebCore/dom/MessageEvent.cpp b/Source/WebCore/dom/MessageEvent.cpp index 1252d2c64..24b52dd12 100644 --- a/Source/WebCore/dom/MessageEvent.cpp +++ b/Source/WebCore/dom/MessageEvent.cpp @@ -73,6 +73,10 @@ MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& , m_source(source) , m_ports(ports) { +#if USE(V8) + if (m_dataAsSerializedScriptValue) + m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptContext(); +#endif } MessageEvent::MessageEvent(const String& data) @@ -134,6 +138,11 @@ void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo m_lastEventId = lastEventId; m_source = source; m_ports = ports; + +#if USE(V8) + if (m_dataAsSerializedScriptValue) + m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptContext(); +#endif } // FIXME: Remove this when we have custom ObjC binding support. diff --git a/Source/WebCore/dom/MicroDataItemList.cpp b/Source/WebCore/dom/MicroDataItemList.cpp index 7b4863537..6fc53936e 100644 --- a/Source/WebCore/dom/MicroDataItemList.cpp +++ b/Source/WebCore/dom/MicroDataItemList.cpp @@ -45,7 +45,7 @@ const String& MicroDataItemList::undefinedItemType() } MicroDataItemList::MicroDataItemList(PassRefPtr<Node> rootNode, const String& typeNames) - : DynamicSubtreeNodeList(rootNode, InvalidateOnItemAttrChange) + : DynamicSubtreeNodeList(rootNode, MicroDataItemListType, InvalidateOnItemAttrChange) , m_typeNames(typeNames, document()->inQuirksMode()) , m_originalTypeNames(typeNames) { diff --git a/Source/WebCore/dom/NameNodeList.cpp b/Source/WebCore/dom/NameNodeList.cpp index 34d5a534c..0c9e08928 100644 --- a/Source/WebCore/dom/NameNodeList.cpp +++ b/Source/WebCore/dom/NameNodeList.cpp @@ -33,7 +33,7 @@ namespace WebCore { using namespace HTMLNames; NameNodeList::NameNodeList(PassRefPtr<Node> rootNode, const AtomicString& name) - : DynamicSubtreeNodeList(rootNode, InvalidateOnNameAttrChange) + : DynamicSubtreeNodeList(rootNode, NameNodeListType, InvalidateOnNameAttrChange) , m_name(name) { } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 8fd6d5c4f..6b622c764 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -406,7 +406,7 @@ Node::~Node() if (renderer()) detach(); - Document* doc = m_document; + Document* doc = documentInternal(); if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists()) doc->axObjectCache()->removeNodeForUse(this); @@ -421,41 +421,6 @@ Node::~Node() InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); } -void Node::setDocument(Document* document) -{ - ASSERT(!inDocument() || m_document == document); - if (inDocument() || m_document == document) - return; - - m_document = document; -} - -NodeRareData* Node::setTreeScope(TreeScope* scope) -{ - if (!scope) { - if (hasRareData()) { - NodeRareData* data = rareData(); - data->setTreeScope(0); - return data; - } - - return 0; - } - - NodeRareData* data = ensureRareData(); - data->setTreeScope(scope); - return data; -} - -TreeScope* Node::treeScope() const -{ - // FIXME: Using m_document directly is not good -> see comment with document() in the header file. - if (!hasRareData()) - return m_document; - TreeScope* scope = rareData()->treeScope(); - return scope ? scope : m_document; -} - NodeRareData* Node::rareData() const { ASSERT(hasRareData()); @@ -962,6 +927,40 @@ unsigned Node::nodeIndex() const return count; } +template<unsigned type> +bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], const QualifiedName& attrName) +{ + if (nodeListCounts[type] && DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName)) + return true; + return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName); +} + +template<> +bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const unsigned[], const QualifiedName&) +{ + return false; +} + +bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const +{ + if (attrName) + return shouldInvalidateNodeListCachesForAttr<DoNotInvalidateOnAttributeChanges + 1>(m_nodeListCounts, *attrName); + + for (int type = 0; type < numNodeListInvalidationTypes; type++) { + if (m_nodeListCounts[type]) + return true; + } + + return false; +} + +void Document::invalidateNodeListCaches(const QualifiedName* attrName) +{ + HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end(); + for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) + (*it)->invalidateCache(attrName); +} + void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement) { if (hasRareData() && (!attrName || isAttributeNode())) @@ -971,7 +970,7 @@ void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, El if (attrName && !attributeOwnerElement) return; - if (!document()->shouldInvalidateNodeListCaches()) + if (!document()->shouldInvalidateNodeListCaches(attrName)) return; document()->invalidateNodeListCaches(attrName); @@ -1394,6 +1393,12 @@ bool Node::canStartSelection() const return parentOrHostNode() ? parentOrHostNode()->canStartSelection() : true; } +Element* Node::shadowHost() const +{ + if (ShadowRoot* root = shadowRoot()) + return root->host(); + return 0; +} Node* Node::shadowAncestorNode() const { @@ -1435,11 +1440,6 @@ ContainerNode* Node::nonShadowBoundaryParentNode() const return parent && !parent->isShadowRoot() ? parent : 0; } -bool Node::isInShadowTree() const -{ - return treeScope() != document(); -} - Element* Node::parentOrHostElement() const { ContainerNode* parent = parentOrHostNode(); @@ -2756,7 +2756,7 @@ void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const MemoryClassInfo<Node> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); info.visitBaseClass<TreeShared<Node, ContainerNode> >(this); info.visitBaseClass<ScriptWrappable>(this); - info.addInstrumentedMember(m_document); + info.addInstrumentedMember(document()); info.addInstrumentedMember(m_next); info.addInstrumentedMember(m_previous); } diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index c9a28f49d..6252273ad 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -223,13 +223,18 @@ public: bool hasAttrList() const { return getFlag(HasAttrListFlag); } bool hasCustomCallbacks() const { return getFlag(HasCustomCallbacksFlag); } + // If this node is in a shadow tree, returns its shadow host. Otherwise, returns 0. + Element* shadowHost() const; + // If this node is in a shadow tree, returns its shadow host. Otherwise, returns this. + // Deprecated. Should use shadowHost() and check the return value. Node* shadowAncestorNode() const; ShadowRoot* shadowRoot() const; ShadowRoot* youngestShadowRoot() const; // Returns 0, a child of ShadowRoot, or a legacy shadow root. Node* nonBoundaryShadowTreeRootNode(); - bool isInShadowTree() const; + bool isInShadowTree() const { return getFlag(InShadowTree); } + // Node's parent, shadow tree host. ContainerNode* parentOrHostNode() const; Element* parentOrHostElement() const; @@ -407,14 +412,7 @@ public: // Returns the document associated with this node. This method never returns NULL, except in the case // of a DocumentType node that is not used with any Document yet. A Document node returns itself. - Document* document() const - { - ASSERT(this); - // FIXME: below ASSERT is useful, but prevents the use of document() in the constructor or destructor - // due to the virtual function call to nodeType(). - ASSERT(m_document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument())); - return m_document; - } + Document* document() const; TreeScope* treeScope() const; @@ -422,7 +420,7 @@ public: // node tree, false otherwise. bool inDocument() const { - ASSERT(m_document || !getFlag(InDocumentFlag)); + ASSERT(treeScope() || !getFlag(InDocumentFlag)); return getFlag(InDocumentFlag); } @@ -692,10 +690,12 @@ private: #endif InNamedFlowFlag = 1 << 26, HasAttrListFlag = 1 << 27, - HasCustomCallbacksFlag = 1 << 28 + HasCustomCallbacksFlag = 1 << 28, + InShadowTree = 1 << 29 + }; - // 4 bits remaining + // 3 bits remaining bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } @@ -731,16 +731,14 @@ protected: void setHasCustomCallbacks() { setFlag(true, HasCustomCallbacksFlag); } + void setTreeScope(TreeScope*); + Document* documentInternal() const; + private: friend class TreeShared<Node, ContainerNode>; void removedLastRef(); - // These API should be only used for a tree scope migration. - // setTreeScope() returns NodeRareData to save extra nodeRareData() invocations on the caller site. - NodeRareData* setTreeScope(TreeScope*); - void setDocument(Document*); - enum EditableLevel { Editable, RichlyEditable }; bool rendererIsEditable(EditableLevel) const; bool isEditableToAccessibility(EditableLevel) const; @@ -783,7 +781,7 @@ private: #endif mutable uint32_t m_nodeFlags; - Document* m_document; + TreeScope* m_treeScope; Node* m_previous; Node* m_next; RenderObject* m_renderer; diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h index 0bdc3e8ac..b84a4b09f 100644 --- a/Source/WebCore/dom/NodeRareData.h +++ b/Source/WebCore/dom/NodeRareData.h @@ -184,8 +184,7 @@ class NodeRareData { WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED; public: NodeRareData() - : m_treeScope(0) - , m_childNodeList(0) + : m_childNodeList(0) , m_tabIndex(0) , m_tabIndexWasSetExplicitly(false) , m_isFocused(false) @@ -213,9 +212,6 @@ public: return rareDataMap().get(node); } - TreeScope* treeScope() const { return m_treeScope; } - void setTreeScope(TreeScope* treeScope) { m_treeScope = treeScope; } - void clearNodeLists() { m_nodeLists.clear(); } void setNodeLists(PassOwnPtr<NodeListsNodeData> lists) { m_nodeLists = lists; } NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); } @@ -349,7 +345,6 @@ protected: private: - TreeScope* m_treeScope; OwnPtr<NodeListsNodeData> m_nodeLists; ChildNodeList* m_childNodeList; OwnPtr<EventTargetData> m_eventTargetData; diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp index 0943643d2..6bba56c0b 100644 --- a/Source/WebCore/dom/ProcessingInstruction.cpp +++ b/Source/WebCore/dom/ProcessingInstruction.cpp @@ -312,7 +312,8 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) m_sheet = 0; } - if (m_cachedSheet) + // If we're in document teardown, then we don't need to do any notification of our sheet's removal. + if (document()->renderer()) document()->styleResolverChanged(DeferRecalcStyle); } diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 67bb8618e..b586687c1 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -46,7 +46,7 @@ namespace WebCore { ShadowRoot::ShadowRoot(Document* document) : DocumentFragment(document, CreateShadowRoot) - , TreeScope(this) + , TreeScope(this, document) , m_prev(0) , m_next(0) , m_applyAuthorStyles(false) @@ -55,11 +55,9 @@ ShadowRoot::ShadowRoot(Document* document) { ASSERT(document); - // Assume document as parent scope. - setParentTreeScope(document); // Shadow tree scopes have the scope pointer point to themselves. // This way, direct children will receive the correct scope pointer. - ensureRareData()->setTreeScope(this); + setTreeScope(this); } ShadowRoot::~ShadowRoot() diff --git a/Source/WebCore/dom/TagNodeList.cpp b/Source/WebCore/dom/TagNodeList.cpp index 295a8d9b2..a832a6cb1 100644 --- a/Source/WebCore/dom/TagNodeList.cpp +++ b/Source/WebCore/dom/TagNodeList.cpp @@ -31,7 +31,7 @@ namespace WebCore { TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) - : DynamicSubtreeNodeList(rootNode, DoNotInvalidateOnAttributeChanges) + : DynamicSubtreeNodeList(rootNode, TagNodeListType, DoNotInvalidateOnAttributeChanges) , m_namespaceURI(namespaceURI) , m_localName(localName) { diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp index e88b13ab8..032edf126 100644 --- a/Source/WebCore/dom/TreeScope.cpp +++ b/Source/WebCore/dom/TreeScope.cpp @@ -52,14 +52,22 @@ namespace WebCore { using namespace HTMLNames; -TreeScope::TreeScope(ContainerNode* rootNode) +TreeScope::TreeScope(ContainerNode* rootNode, Document* rootDocument) : m_rootNode(rootNode) - , m_parentTreeScope(0) + , m_rootDocument(rootDocument) + , m_parentTreeScope(rootNode == rootDocument ? 0 : rootDocument) , m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { ASSERT(rootNode); } +TreeScope::TreeScope() + : m_rootNode(0) + , m_rootDocument(0) + , m_parentTreeScope(0) +{ +} + TreeScope::~TreeScope() { if (m_selection) { @@ -82,6 +90,7 @@ void TreeScope::setParentTreeScope(TreeScope* newParentScope) ASSERT(newParentScope); m_parentTreeScope = newParentScope; + m_rootDocument = newParentScope->rootDocument(); } Element* TreeScope::getElementById(const AtomicString& elementId) const @@ -248,6 +257,11 @@ Node* TreeScope::focusedNode() return 0; } +bool TreeScope::isDocumentScope() const +{ + return this == m_rootDocument; +} + static void listTreeScopes(Node* node, Vector<TreeScope*, 5>& treeScopes) { while (true) { @@ -281,5 +295,11 @@ TreeScope* commonTreeScope(Node* nodeA, Node* nodeB) return treeScopesA[indexA] == treeScopesB[indexB] ? treeScopesA[indexA] : 0; } +TreeScope* TreeScope::nullInstance() +{ + DEFINE_STATIC_LOCAL(TreeScope, instance, ()); + return &instance; +} + } // namespace WebCore diff --git a/Source/WebCore/dom/TreeScope.h b/Source/WebCore/dom/TreeScope.h index 841bbb6c1..f933c6f25 100644 --- a/Source/WebCore/dom/TreeScope.h +++ b/Source/WebCore/dom/TreeScope.h @@ -34,6 +34,7 @@ namespace WebCore { class ContainerNode; class DOMSelection; +class Document; class Element; class HTMLMapElement; class IdTargetObserverRegistry; @@ -78,17 +79,23 @@ public: void adoptIfNeeded(Node*); ContainerNode* rootNode() const { return m_rootNode; } - + Document* rootDocument() const { return m_rootDocument; } + bool isDocumentScope() const; IdTargetObserverRegistry& idTargetObserverRegistry() const { return *m_idTargetObserverRegistry.get(); } + static TreeScope* nullInstance(); + protected: - TreeScope(ContainerNode*); + TreeScope(ContainerNode*, Document*); virtual ~TreeScope(); void destroyTreeScopeData(); private: + TreeScope(); + ContainerNode* m_rootNode; + Document* m_rootDocument; TreeScope* m_parentTreeScope; DocumentOrderedMap m_elementsById; diff --git a/Source/WebCore/dom/TreeScopeAdopter.cpp b/Source/WebCore/dom/TreeScopeAdopter.cpp index 3601e0859..1dfb5cef5 100644 --- a/Source/WebCore/dom/TreeScopeAdopter.cpp +++ b/Source/WebCore/dom/TreeScopeAdopter.cpp @@ -49,7 +49,9 @@ void TreeScopeAdopter::moveTreeToNewScope(Node* root) const oldDocument->incDOMTreeVersion(); for (Node* node = root; node; node = node->traverseNextNode(root)) { - if (NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope)) { + node->setTreeScope(m_newScope); + if (node->hasRareData()) { + NodeRareData* rareData = node->rareData(); if (rareData->nodeLists()) rareData->nodeLists()->adoptTreeScope(oldDocument, newDocument); if (node->isElementNode()) @@ -96,8 +98,6 @@ inline void TreeScopeAdopter::moveNodeToNewDocument(Node* node, Document* oldDoc if (oldDocument) oldDocument->moveNodeIteratorsToNewDocument(node, newDocument); - node->setDocument(newDocument); - #ifndef NDEBUG didMoveToNewDocumentWasCalled = false; oldDocumentDidMoveToNewDocumentWasCalledWith = oldDocument; diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp index b0cff11b5..c50e0572f 100644 --- a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp @@ -43,6 +43,20 @@ WebKitNamedFlowCollection::WebKitNamedFlowCollection(Document* doc) { } +Vector<String> WebKitNamedFlowCollection::namedFlowsNames() +{ + Vector<String> namedFlows; + + for (NamedFlowSet::iterator it = m_namedFlows.begin(); it != m_namedFlows.end(); ++it) { + if ((*it)->flowState() == WebKitNamedFlow::FlowStateNull) + continue; + + namedFlows.append((*it)->name().string()); + } + + return namedFlows; +} + WebKitNamedFlow* WebKitNamedFlowCollection::flowByName(const String& flowName) { NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.h b/Source/WebCore/dom/WebKitNamedFlowCollection.h index 130c6c8fb..d952e8ed2 100644 --- a/Source/WebCore/dom/WebKitNamedFlowCollection.h +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.h @@ -34,6 +34,7 @@ #include <wtf/ListHashSet.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/Vector.h> namespace WebCore { @@ -44,6 +45,7 @@ class WebKitNamedFlowCollection : public RefCounted<WebKitNamedFlowCollection> { public: static PassRefPtr<WebKitNamedFlowCollection> create(Document* doc) { return adoptRef(new WebKitNamedFlowCollection(doc)); } + Vector<String> namedFlowsNames(); WebKitNamedFlow* flowByName(const String&); PassRefPtr<WebKitNamedFlow> ensureFlowWithName(const String&); diff --git a/Source/WebCore/editing/MoveSelectionCommand.cpp b/Source/WebCore/editing/MoveSelectionCommand.cpp index 5a2143c63..5bf545413 100644 --- a/Source/WebCore/editing/MoveSelectionCommand.cpp +++ b/Source/WebCore/editing/MoveSelectionCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "MoveSelectionCommand.h" +#include "Document.h" #include "DocumentFragment.h" #include "ReplaceSelectionCommand.h" diff --git a/Source/WebCore/editing/RemoveNodeCommand.cpp b/Source/WebCore/editing/RemoveNodeCommand.cpp index 19657ac0f..8be207061 100644 --- a/Source/WebCore/editing/RemoveNodeCommand.cpp +++ b/Source/WebCore/editing/RemoveNodeCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "RemoveNodeCommand.h" +#include "Document.h" #include "Node.h" #include <wtf/Assertions.h> diff --git a/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp b/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp index 1452f8803..281fdbdf3 100644 --- a/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp +++ b/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "RemoveNodePreservingChildrenCommand.h" +#include "Document.h" #include "Node.h" #include <wtf/Assertions.h> diff --git a/Source/WebCore/html/CollectionType.h b/Source/WebCore/html/CollectionType.h index 9cd70cea0..ab03ce646 100644 --- a/Source/WebCore/html/CollectionType.h +++ b/Source/WebCore/html/CollectionType.h @@ -61,7 +61,7 @@ enum CollectionType { #endif FormControls, - InvalidCollectionType + NodeListCollectionType }; static const CollectionType FirstUnnamedDocumentCachedType = DocImages; diff --git a/Source/WebCore/html/ColorInputType.cpp b/Source/WebCore/html/ColorInputType.cpp index 1ececc2b6..ea2151c1e 100644 --- a/Source/WebCore/html/ColorInputType.cpp +++ b/Source/WebCore/html/ColorInputType.cpp @@ -38,6 +38,8 @@ #include "HTMLDivElement.h" #include "HTMLInputElement.h" #include "MouseEvent.h" +#include "RenderObject.h" +#include "RenderView.h" #include "ScriptController.h" #include "ShadowRoot.h" @@ -117,7 +119,7 @@ void ColorInputType::createShadowSubtree() ExceptionCode ec = 0; wrapperElement->appendChild(colorSwatch.release(), ec); ASSERT(!ec); - element()->shadow()->oldestShadowRoot()->appendChild(wrapperElement.release(), ec); + element()->userAgentShadowRoot()->appendChild(wrapperElement.release(), ec); ASSERT(!ec); updateColorSwatch(); @@ -191,10 +193,17 @@ void ColorInputType::updateColorSwatch() HTMLElement* ColorInputType::shadowColorSwatch() const { - ShadowRoot* shadow = element()->shadow()->oldestShadowRoot(); + ShadowRoot* shadow = element()->userAgentShadowRoot(); return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0; } +IntRect ColorInputType::elementRectRelativeToWindow() const +{ + RenderObject* renderer = element()->renderer(); + ASSERT(renderer); + return pixelSnappedIntRect(renderer->view()->frameView()->contentsToWindow(renderer->absoluteBoundingBoxRect())); +} + } // namespace WebCore #endif // ENABLE(INPUT_TYPE_COLOR) diff --git a/Source/WebCore/html/ColorInputType.h b/Source/WebCore/html/ColorInputType.h index 779cd976e..e03cb2242 100644 --- a/Source/WebCore/html/ColorInputType.h +++ b/Source/WebCore/html/ColorInputType.h @@ -46,6 +46,7 @@ public: // ColorChooserClient implementation. virtual void didChooseColor(const Color&) OVERRIDE; virtual void didEndChooser() OVERRIDE; + virtual IntRect elementRectRelativeToWindow() const OVERRIDE; private: ColorInputType(HTMLInputElement* element) : BaseClickableWithKeyInputType(element) { } diff --git a/Source/WebCore/html/FTPDirectoryDocument.cpp b/Source/WebCore/html/FTPDirectoryDocument.cpp index 412a1fe65..18689c97f 100644 --- a/Source/WebCore/html/FTPDirectoryDocument.cpp +++ b/Source/WebCore/html/FTPDirectoryDocument.cpp @@ -88,7 +88,6 @@ private: RefPtr<HTMLTableElement> m_tableElement; bool m_skipLF; - bool m_parsedTemplate; int m_size; UChar* m_buffer; @@ -101,7 +100,6 @@ private: FTPDirectoryDocumentParser::FTPDirectoryDocumentParser(HTMLDocument* document) : HTMLDocumentParser(document, false) , m_skipLF(false) - , m_parsedTemplate(false) , m_size(254) , m_buffer(static_cast<UChar*>(fastMalloc(sizeof(UChar) * m_size))) , m_dest(m_buffer) diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp index f39733d15..7a75e13c1 100644 --- a/Source/WebCore/html/FileInputType.cpp +++ b/Source/WebCore/html/FileInputType.cpp @@ -297,13 +297,13 @@ void FileInputType::createShadowSubtree() { ASSERT(element()->shadow()); ExceptionCode ec = 0; - element()->shadow()->oldestShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()), ec); + element()->userAgentShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()), ec); } void FileInputType::multipleAttributeChanged() { ASSERT(element()->shadow()); - UploadButtonElement* button = static_cast<UploadButtonElement*>(element()->shadow()->oldestShadowRoot()->firstChild()); + UploadButtonElement* button = static_cast<UploadButtonElement*>(element()->userAgentShadowRoot()->firstChild()); if (button) button->setValue(element()->multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel()); } diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp index 46241be1a..5e39fe229 100644 --- a/Source/WebCore/html/FormController.cpp +++ b/Source/WebCore/html/FormController.cpp @@ -79,14 +79,13 @@ FormControlState FormControlState::deserialize(const Vector<String>& stateVector class FormElementKey { public: - FormElementKey(AtomicStringImpl* = 0, AtomicStringImpl* = 0, AtomicStringImpl* = 0); + FormElementKey(AtomicStringImpl* = 0, AtomicStringImpl* = 0); ~FormElementKey(); FormElementKey(const FormElementKey&); FormElementKey& operator=(const FormElementKey&); AtomicStringImpl* name() const { return m_name; } AtomicStringImpl* type() const { return m_type; } - AtomicStringImpl* formKey() const { return m_formKey; } // Hash table deleted values, which are only constructed and never copied or destroyed. FormElementKey(WTF::HashTableDeletedValueType) : m_name(hashTableDeletedValue()) { } @@ -100,13 +99,11 @@ private: AtomicStringImpl* m_name; AtomicStringImpl* m_type; - AtomicStringImpl* m_formKey; }; -FormElementKey::FormElementKey(AtomicStringImpl* name, AtomicStringImpl* type, AtomicStringImpl* formKey) +FormElementKey::FormElementKey(AtomicStringImpl* name, AtomicStringImpl* type) : m_name(name) , m_type(type) - , m_formKey(formKey) { ref(); } @@ -119,7 +116,6 @@ FormElementKey::~FormElementKey() FormElementKey::FormElementKey(const FormElementKey& other) : m_name(other.name()) , m_type(other.type()) - , m_formKey(other.formKey()) { ref(); } @@ -130,7 +126,6 @@ FormElementKey& FormElementKey::operator=(const FormElementKey& other) deref(); m_name = other.name(); m_type = other.type(); - m_formKey = other.formKey(); return *this; } @@ -140,8 +135,6 @@ void FormElementKey::ref() const name()->ref(); if (type()) type()->ref(); - if (formKey()) - formKey()->ref(); } void FormElementKey::deref() const @@ -150,13 +143,11 @@ void FormElementKey::deref() const name()->deref(); if (type()) type()->deref(); - if (formKey()) - formKey()->deref(); } inline bool operator==(const FormElementKey& a, const FormElementKey& b) { - return a.name() == b.name() && a.type() == b.type() && a.formKey() == b.formKey(); + return a.name() == b.name() && a.type() == b.type(); } struct FormElementKeyHash { @@ -178,17 +169,23 @@ struct FormElementKeyHashTraits : WTF::GenericHashTraits<FormElementKey> { // ---------------------------------------------------------------------------- class SavedFormState { + WTF_MAKE_NONCOPYABLE(SavedFormState); + WTF_MAKE_FAST_ALLOCATED; + public: static PassOwnPtr<SavedFormState> create(); + static PassOwnPtr<SavedFormState> deserialize(const Vector<String>&, size_t& index); + void serializeTo(Vector<String>&) const; bool isEmpty() const { return m_stateForNewFormElements.isEmpty(); } - void appendControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey, const FormControlState&); - FormControlState takeControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey); + void appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState&); + FormControlState takeControlState(const AtomicString& name, const AtomicString& type); private: - SavedFormState() { } + SavedFormState() : m_controlStateCount(0) { } typedef HashMap<FormElementKey, Deque<FormControlState>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap; FormElementStateMap m_stateForNewFormElements; + size_t m_controlStateCount; }; PassOwnPtr<SavedFormState> SavedFormState::create() @@ -196,9 +193,50 @@ PassOwnPtr<SavedFormState> SavedFormState::create() return adoptPtr(new SavedFormState); } -void SavedFormState::appendControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey, const FormControlState& state) +static bool isNotFormControlTypeCharacter(UChar ch) +{ + return ch != '-' && (ch > 'z' || ch < 'a'); +} + +PassOwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index) +{ + if (index >= stateVector.size()) + return nullptr; + // FIXME: We need String::toSizeT(). + size_t itemCount = stateVector[index++].toUInt(); + if (!itemCount) + return nullptr; + OwnPtr<SavedFormState> savedFormState = adoptPtr(new SavedFormState); + while (itemCount--) { + if (index + 1 >= stateVector.size()) + return nullptr; + String name = stateVector[index++]; + String type = stateVector[index++]; + FormControlState state = FormControlState::deserialize(stateVector, index); + if (type.isEmpty() || type.find(isNotFormControlTypeCharacter) != notFound || state.isFailure()) + return nullptr; + savedFormState->appendControlState(name, type, state); + } + return savedFormState.release(); +} + +void SavedFormState::serializeTo(Vector<String>& stateVector) const +{ + stateVector.append(String::number(m_controlStateCount)); + for (FormElementStateMap::const_iterator it = m_stateForNewFormElements.begin(); it != m_stateForNewFormElements.end(); ++it) { + const FormElementKey& key = it->first; + const Deque<FormControlState>& queue = it->second; + for (Deque<FormControlState>::const_iterator queIterator = queue.begin(); queIterator != queue.end(); ++queIterator) { + stateVector.append(key.name()); + stateVector.append(key.type()); + queIterator->serializeTo(stateVector); + } + } +} + +void SavedFormState::appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState& state) { - FormElementKey key(name.impl(), type.impl(), formKey.impl()); + FormElementKey key(name.impl(), type.impl()); FormElementStateMap::iterator it = m_stateForNewFormElements.find(key); if (it != m_stateForNewFormElements.end()) it->second.append(state); @@ -207,17 +245,19 @@ void SavedFormState::appendControlState(const AtomicString& name, const AtomicSt stateList.append(state); m_stateForNewFormElements.set(key, stateList); } + m_controlStateCount++; } -FormControlState SavedFormState::takeControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey) +FormControlState SavedFormState::takeControlState(const AtomicString& name, const AtomicString& type) { if (m_stateForNewFormElements.isEmpty()) return FormControlState(); - FormElementStateMap::iterator it = m_stateForNewFormElements.find(FormElementKey(name.impl(), type.impl(), formKey.impl())); + FormElementStateMap::iterator it = m_stateForNewFormElements.find(FormElementKey(name.impl(), type.impl())); if (it == m_stateForNewFormElements.end()) return FormControlState(); ASSERT(it->second.size()); FormControlState state = it->second.takeFirst(); + m_controlStateCount--; if (!it->second.size()) m_stateForNewFormElements.remove(it); return state; @@ -238,23 +278,45 @@ private: FormKeyGenerator() { } typedef HashMap<HTMLFormElement*, AtomicString> FormToKeyMap; + typedef HashMap<String, unsigned> FormSignatureToNextIndexMap; FormToKeyMap m_formToKeyMap; - HashSet<AtomicString> m_existingKeys; + FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; }; -static inline AtomicString createKey(HTMLFormElement* form, unsigned index) +static inline void recordFormStructure(const HTMLFormElement& form, StringBuilder& builder) { - ASSERT(form); - KURL actionURL = form->getURLAttribute(actionAttr); + // 2 is enough to distinguish forms in webkit.org/b/91209#c0 + const size_t namedControlsToBeRecorded = 2; + const Vector<FormAssociatedElement*>& controls = form.associatedElements(); + builder.append(" ["); + for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) { + if (!controls[i]->isFormControlElementWithState()) + continue; + HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(controls[i]); + if (!ownerFormForState(*control)) + continue; + AtomicString name = control->name(); + if (name.isEmpty()) + continue; + namedControls++; + builder.append(name); + builder.append(" "); + } + builder.append("]"); +} + +static inline String formSignature(const HTMLFormElement& form) +{ + KURL actionURL = form.getURLAttribute(actionAttr); // Remove the query part because it might contain volatile parameters such // as a session key. actionURL.setQuery(String()); StringBuilder builder; if (!actionURL.isEmpty()) builder.append(actionURL.string()); - builder.append(" #"); - builder.append(String::number(index)); - return builder.toAtomicString(); + + recordFormStructure(form, builder); + return builder.toString(); } AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control) @@ -268,13 +330,18 @@ AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& co if (it != m_formToKeyMap.end()) return it->second; - AtomicString candidateKey; - unsigned index = 0; - do { - candidateKey = createKey(form, index++); - } while (!m_existingKeys.add(candidateKey).isNewEntry); - m_formToKeyMap.add(form, candidateKey); - return candidateKey; + String signature = formSignature(*form); + ASSERT(!signature.isNull()); + FormSignatureToNextIndexMap::AddResult result = m_formSignatureToNextIndexMap.add(signature, 0); + unsigned nextIndex = result.iterator->second++; + + StringBuilder builder; + builder.append(signature); + builder.append(" #"); + builder.append(String::number(nextIndex)); + AtomicString formKey = builder.toAtomicString(); + m_formToKeyMap.add(form, formKey); + return formKey; } void FormKeyGenerator::willDeleteForm(HTMLFormElement* form) @@ -285,7 +352,6 @@ void FormKeyGenerator::willDeleteForm(HTMLFormElement* form) FormToKeyMap::iterator it = m_formToKeyMap.find(form); if (it == m_formToKeyMap.end()) return; - m_existingKeys.remove(it->second); m_formToKeyMap.remove(it); } @@ -304,26 +370,35 @@ static String formStateSignature() // In the legacy version of serialized state, the first item was a name // attribute value of a form control. The following string literal should // contain some characters which are rarely used for name attribute values. - DEFINE_STATIC_LOCAL(String, signature, ("\n\r?% WebKit serialized form state version 5 \n\r=&")); + DEFINE_STATIC_LOCAL(String, signature, ("\n\r?% WebKit serialized form state version 7 \n\r=&")); return signature; } -Vector<String> FormController::formElementsState() const +PassOwnPtr<FormController::SavedFormStateMap> FormController::createSavedFormStateMap(const FormElementListHashSet& controlList) { OwnPtr<FormKeyGenerator> keyGenerator = FormKeyGenerator::create(); + OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap); + for (FormElementListHashSet::const_iterator it = controlList.begin(); it != controlList.end(); ++it) { + HTMLFormControlElementWithState* control = *it; + if (!control->shouldSaveAndRestoreFormControlState()) + continue; + SavedFormStateMap::AddResult result = stateMap->add(keyGenerator->formKey(*control).impl(), nullptr); + if (result.isNewEntry) + result.iterator->second = SavedFormState::create(); + result.iterator->second->appendControlState(control->name(), control->type(), control->saveFormControlState()); + } + return stateMap.release(); +} + +Vector<String> FormController::formElementsState() const +{ + OwnPtr<SavedFormStateMap> stateMap = createSavedFormStateMap(m_formElementsWithState); Vector<String> stateVector; - stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 5 + 1); + stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 4); stateVector.append(formStateSignature()); - typedef FormElementListHashSet::const_iterator Iterator; - Iterator end = m_formElementsWithState.end(); - for (Iterator it = m_formElementsWithState.begin(); it != end; ++it) { - HTMLFormControlElementWithState* elementWithState = *it; - if (!elementWithState->shouldSaveAndRestoreFormControlState()) - continue; - stateVector.append(elementWithState->name().string()); - stateVector.append(elementWithState->formControlType().string()); - stateVector.append(keyGenerator->formKey(*elementWithState).string()); - elementWithState->saveFormControlState().serializeTo(stateVector); + for (SavedFormStateMap::const_iterator it = stateMap->begin(); it != stateMap->end(); ++it) { + stateVector.append(it->first.get()); + it->second->serializeTo(stateVector); } bool hasOnlySignature = stateVector.size() == 1; if (hasOnlySignature) @@ -331,11 +406,6 @@ Vector<String> FormController::formElementsState() const return stateVector; } -static bool isNotFormControlTypeCharacter(UChar ch) -{ - return ch != '-' && (ch > 'z' || ch < 'a'); -} - void FormController::setStateForNewFormElements(const Vector<String>& stateVector) { m_formElementsWithState.clear(); @@ -344,30 +414,31 @@ void FormController::setStateForNewFormElements(const Vector<String>& stateVecto if (stateVector.size() < 1 || stateVector[i++] != formStateSignature()) return; - while (i + 2 < stateVector.size()) { - AtomicString name = stateVector[i++]; - AtomicString type = stateVector[i++]; + while (i + 1 < stateVector.size()) { AtomicString formKey = stateVector[i++]; - FormControlState state = FormControlState::deserialize(stateVector, i); - if (type.isEmpty() || type.impl()->find(isNotFormControlTypeCharacter) != notFound || state.isFailure()) + OwnPtr<SavedFormState> state = SavedFormState::deserialize(stateVector, i); + if (!state) { + i = 0; break; - if (!m_savedFormState) - m_savedFormState = SavedFormState::create(); - m_savedFormState->appendControlState(name, type, formKey, state); + } + m_savedFormStateMap.add(formKey.impl(), state.release()); } if (i != stateVector.size()) - m_savedFormState.clear(); + m_savedFormStateMap.clear(); } FormControlState FormController::takeStateForFormElement(const HTMLFormControlElementWithState& control) { - if (!m_savedFormState) + if (m_savedFormStateMap.isEmpty()) return FormControlState(); if (!m_formKeyGenerator) m_formKeyGenerator = FormKeyGenerator::create(); - FormControlState state = m_savedFormState->takeControlState(control.name(), control.type(), m_formKeyGenerator->formKey(control)); - if (m_savedFormState->isEmpty()) - m_savedFormState.clear(); + SavedFormStateMap::iterator it = m_savedFormStateMap.find(m_formKeyGenerator->formKey(control).impl()); + if (it == m_savedFormStateMap.end()) + return FormControlState(); + FormControlState state = it->second->takeControlState(control.name(), control.type()); + if (it->second->isEmpty()) + m_savedFormStateMap.remove(it); return state; } diff --git a/Source/WebCore/html/FormController.h b/Source/WebCore/html/FormController.h index 2dd7b2202..5d3748d0e 100644 --- a/Source/WebCore/html/FormController.h +++ b/Source/WebCore/html/FormController.h @@ -93,15 +93,16 @@ public: void restoreControlStateIn(HTMLFormElement&); private: + typedef ListHashSet<HTMLFormControlElementWithState*, 64> FormElementListHashSet; + typedef HashMap<RefPtr<AtomicStringImpl>, OwnPtr<SavedFormState> > SavedFormStateMap; + FormController(); + static PassOwnPtr<SavedFormStateMap> createSavedFormStateMap(const FormElementListHashSet&); FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&); CheckedRadioButtons m_checkedRadioButtons; - - typedef ListHashSet<HTMLFormControlElementWithState*, 64> FormElementListHashSet; FormElementListHashSet m_formElementsWithState; - - OwnPtr<SavedFormState> m_savedFormState; + SavedFormStateMap m_savedFormStateMap; OwnPtr<FormKeyGenerator> m_formKeyGenerator; }; diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp index e769b2641..1dd5c15aa 100644 --- a/Source/WebCore/html/HTMLAllCollection.cpp +++ b/Source/WebCore/html/HTMLAllCollection.cpp @@ -36,7 +36,7 @@ PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document) } HTMLAllCollection::HTMLAllCollection(Document* document) - : HTMLCollection(document, DocAll, SupportItemBefore) + : HTMLCollection(document, DocAll, DoesNotOverrideItemAfter) { } diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp index 2b53edd98..57953ac98 100644 --- a/Source/WebCore/html/HTMLCollection.cpp +++ b/Source/WebCore/html/HTMLCollection.cpp @@ -69,7 +69,7 @@ static bool shouldOnlyIncludeDirectChildren(CollectionType type) case TSectionRows: case TableTBodies: return true; - case InvalidCollectionType: + case NodeListCollectionType: break; } ASSERT_NOT_REACHED(); @@ -104,7 +104,7 @@ static NodeListRootType rootTypeFromCollectionType(CollectionType type) case SelectedOptions: case DataListOptions: case MapAreas: - case InvalidCollectionType: + case NodeListCollectionType: return NodeListIsRootedAtNode; } ASSERT_NOT_REACHED(); @@ -144,7 +144,7 @@ static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col #endif case FormControls: return InvalidateForFormControls; - case InvalidCollectionType: + case NodeListCollectionType: break; } ASSERT_NOT_REACHED(); @@ -152,17 +152,16 @@ static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col } -HTMLCollection::HTMLCollection(Node* base, CollectionType type, ItemBeforeSupportType itemBeforeSupportType) - : HTMLCollectionCacheBase(rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), type, itemBeforeSupportType) - , m_base(base) +HTMLCollection::HTMLCollection(Node* ownerNode, CollectionType type, ItemAfterOverrideType itemAfterOverrideType) + : HTMLCollectionCacheBase(ownerNode, rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), + WebCore::shouldOnlyIncludeDirectChildren(type), type, itemAfterOverrideType) { - ASSERT(m_base); - m_base->document()->registerNodeListCache(this); + document()->registerNodeListCache(this); } PassRefPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type) { - return adoptRef(new HTMLCollection(base, type, SupportItemBefore)); + return adoptRef(new HTMLCollection(base, type, DoesNotOverrideItemAfter)); } HTMLCollection::~HTMLCollection() @@ -176,7 +175,7 @@ HTMLCollection::~HTMLCollection() } else // HTMLNameCollection removes cache by itself. ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems); - m_base->document()->unregisterNodeListCache(this); + document()->unregisterNodeListCache(this); } static inline bool isAcceptableElement(CollectionType type, Element* element) @@ -231,7 +230,7 @@ static inline bool isAcceptableElement(CollectionType type, Element* element) case DocumentNamedItems: case TableRows: case WindowNamedItems: - case InvalidCollectionType: + case NodeListCollectionType: ASSERT_NOT_REACHED(); } return false; @@ -254,41 +253,65 @@ static inline Node* lastDescendent(Node* node) return node; } -template<bool forward> -static Element* itemBeforeOrAfter(CollectionType type, Node* base, unsigned& offsetInArray, Node* previous) +static Node* firstNode(bool forward, Node* rootNode, bool onlyIncludeDirectChildren) { - ASSERT_UNUSED(offsetInArray, !offsetInArray); - bool onlyIncludeDirectChildren = shouldOnlyIncludeDirectChildren(type); - Node* rootNode = base; - Node* current; - if (previous) - current = nextNode<forward>(rootNode, previous, onlyIncludeDirectChildren); - else { - if (forward) - current = rootNode->firstChild(); - else - current = onlyIncludeDirectChildren ? rootNode->lastChild() : lastDescendent(rootNode); - } + if (forward) + return rootNode->firstChild(); + else + return onlyIncludeDirectChildren ? rootNode->lastChild() : lastDescendent(rootNode); +} +template <bool forward> +Node* DynamicNodeListCacheBase::iterateForNextNode(Node* current) const +{ + bool onlyIncludeDirectChildren = shouldOnlyIncludeDirectChildren(); + CollectionType collectionType = type(); + Node* rootNode = this->rootNode(); for (; current; current = nextNode<forward>(rootNode, current, onlyIncludeDirectChildren)) { - if (current->isElementNode() && isAcceptableElement(type, toElement(current))) - return toElement(current); + if (collectionType == NodeListCollectionType) { + if (current->isElementNode() && static_cast<const DynamicNodeList*>(this)->nodeMatches(toElement(current))) + return toElement(current); + } else { + if (current->isElementNode() && isAcceptableElement(collectionType, toElement(current))) + return toElement(current); + } } return 0; } -Element* HTMLCollection::itemBefore(unsigned& offsetInArray, Element* previous) const +// Without this ALWAYS_INLINE, length() and item() can be 100% slower. +template<bool forward> ALWAYS_INLINE +Node* DynamicNodeListCacheBase::itemBeforeOrAfter(Node* previous) const +{ + Node* current; + if (LIKELY(!!previous)) // Without this LIKELY, length() and item() can be 10% slower. + current = nextNode<forward>(rootNode(), previous, shouldOnlyIncludeDirectChildren()); + else + current = firstNode(forward, rootNode(), previous); + + if (type() == NodeListCollectionType && shouldOnlyIncludeDirectChildren()) // ChildNodeList + return current; + + return iterateForNextNode<forward>(current); +} + +// Without this ALWAYS_INLINE, length() and item() can be 100% slower. +ALWAYS_INLINE Node* DynamicNodeListCacheBase::itemBefore(Node* previous) const { - return itemBeforeOrAfter<false>(type(), base(), offsetInArray, previous); + return itemBeforeOrAfter<false>(previous); } -Element* HTMLCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +// Without this ALWAYS_INLINE, length() and item() can be 100% slower. +ALWAYS_INLINE Node* DynamicNodeListCacheBase::itemAfter(unsigned& offsetInArray, Node* previous) const { - return itemBeforeOrAfter<true>(type(), base(), offsetInArray, previous); + if (UNLIKELY(overridesItemAfter())) // Without this UNLIKELY, length() can be 100% slower. + return static_cast<const HTMLCollection*>(this)->virtualItemAfter(offsetInArray, toElement(previous)); + ASSERT(!offsetInArray); + return itemBeforeOrAfter<true>(previous); } -bool ALWAYS_INLINE HTMLCollection::isLastItemCloserThanLastOrCachedItem(unsigned offset) const +bool ALWAYS_INLINE DynamicNodeListCacheBase::isLastItemCloserThanLastOrCachedItem(unsigned offset) const { ASSERT(isLengthCacheValid()); unsigned distanceFromLastItem = cachedLength() - offset; @@ -298,7 +321,7 @@ bool ALWAYS_INLINE HTMLCollection::isLastItemCloserThanLastOrCachedItem(unsigned return cachedItemOffset() < offset && distanceFromLastItem < offset - cachedItemOffset(); } -bool ALWAYS_INLINE HTMLCollection::isFirstItemCloserThanCachedItem(unsigned offset) const +bool ALWAYS_INLINE DynamicNodeListCacheBase::isFirstItemCloserThanCachedItem(unsigned offset) const { ASSERT(isItemCacheValid()); if (cachedItemOffset() < offset) @@ -308,28 +331,33 @@ bool ALWAYS_INLINE HTMLCollection::isFirstItemCloserThanCachedItem(unsigned offs return offset < distanceFromCachedItem; } -unsigned HTMLCollection::length() const +ALWAYS_INLINE void DynamicNodeListCacheBase::setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const +{ + setItemCache(item, offset); + if (overridesItemAfter()) { + ASSERT(item->isElementNode()); + static_cast<const HTMLCollectionCacheBase*>(this)->m_cachedElementsArrayOffset = elementsArrayOffset; + } else + ASSERT(!elementsArrayOffset); +} + +ALWAYS_INLINE unsigned DynamicNodeListCacheBase::cachedElementsArrayOffset() const +{ + return overridesItemAfter() ? static_cast<const HTMLCollectionCacheBase*>(this)->m_cachedElementsArrayOffset : 0; +} + +unsigned DynamicNodeListCacheBase::lengthCommon() const { if (isLengthCacheValid()) return cachedLength(); - if (!isItemCacheValid() && !item(0)) { - ASSERT(isLengthCacheValid()); - return 0; - } - - ASSERT(isItemCacheValid()); - ASSERT(cachedItem()); - unsigned offset = cachedItemOffset(); - do { - offset++; - } while (itemBeforeOrAfterCachedItem(offset)); + itemCommon(UINT_MAX); ASSERT(isLengthCacheValid()); - - return offset; + + return cachedLength(); } -Node* HTMLCollection::item(unsigned offset) const +Node* DynamicNodeListCacheBase::itemCommon(unsigned offset) const { if (isItemCacheValid() && cachedItemOffset() == offset) return cachedItem(); @@ -342,14 +370,11 @@ Node* HTMLCollection::item(unsigned offset) const static_cast<const HTMLPropertiesCollection*>(this)->updateRefElements(); #endif - if (isLengthCacheValid() && supportsItemBefore() && isLastItemCloserThanLastOrCachedItem(offset)) { - // FIXME: Need to figure out the last offset in array for HTMLFormCollection and HTMLPropertiesCollection - unsigned unusedOffsetInArray = 0; - Node* lastItem = itemBefore(unusedOffsetInArray, 0); - ASSERT(!unusedOffsetInArray); + if (isLengthCacheValid() && !overridesItemAfter() && isLastItemCloserThanLastOrCachedItem(offset)) { + Node* lastItem = itemBefore(0); ASSERT(lastItem); setItemCache(lastItem, cachedLength() - 1, 0); - } else if (!isItemCacheValid() || isFirstItemCloserThanCachedItem(offset) || (!supportsItemBefore() && offset < cachedItemOffset())) { + } else if (!isItemCacheValid() || isFirstItemCloserThanCachedItem(offset) || (overridesItemAfter() && offset < cachedItemOffset())) { unsigned offsetInArray = 0; Node* firstItem = itemAfter(offsetInArray, 0); if (!firstItem) { @@ -366,22 +391,19 @@ Node* HTMLCollection::item(unsigned offset) const return itemBeforeOrAfterCachedItem(offset); } -Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const +Node* DynamicNodeListCacheBase::itemBeforeOrAfterCachedItem(unsigned offset) const { unsigned currentOffset = cachedItemOffset(); - ASSERT(cachedItem()->isElementNode()); - Element* currentItem = toElement(cachedItem()); + Node* currentItem = cachedItem(); ASSERT(currentOffset != offset); - unsigned offsetInArray = cachedElementsArrayOffset(); - if (offset < cachedItemOffset()) { - ASSERT(supportsItemBefore()); - while ((currentItem = itemBefore(offsetInArray, currentItem))) { + ASSERT(!overridesItemAfter()); + while ((currentItem = itemBefore(currentItem))) { ASSERT(currentOffset); currentOffset--; if (currentOffset == offset) { - setItemCache(currentItem, currentOffset, offsetInArray); + setItemCache(currentItem, currentOffset, 0); return currentItem; } } @@ -389,6 +411,7 @@ Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const return 0; } + unsigned offsetInArray = cachedElementsArrayOffset(); while ((currentItem = itemAfter(offsetInArray, currentItem))) { currentOffset++; if (currentOffset == offset) { @@ -403,6 +426,12 @@ Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const return 0; } +Element* HTMLCollection::virtualItemAfter(unsigned&, Element*) const +{ + ASSERT_NOT_REACHED(); + return 0; +} + static inline bool nameShouldBeVisibleInDocumentAll(HTMLElement* element) { // The document.all collection returns only certain types of elements by name, @@ -441,8 +470,8 @@ Node* HTMLCollection::namedItem(const AtomicString& name) const unsigned arrayOffset = 0; unsigned i = 0; - for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { - if (checkForNameMatch(e, /* checkName */ false, name)) { + for (Node* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { + if (checkForNameMatch(toElement(e), /* checkName */ false, name)) { setItemCache(e, i, arrayOffset); return e; } @@ -450,10 +479,10 @@ Node* HTMLCollection::namedItem(const AtomicString& name) const } i = 0; - for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { - if (checkForNameMatch(e, /* checkName */ true, name)) { + for (Node* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { + if (checkForNameMatch(toElement(e), /* checkName */ true, name)) { setItemCache(e, i, arrayOffset); - return e; + return toElement(e); } i++; } @@ -467,10 +496,10 @@ void HTMLCollection::updateNameCache() const return; unsigned arrayOffset = 0; - for (Element* element = itemAfter(arrayOffset, 0); element; element = itemAfter(arrayOffset, element)) { - if (!element->isHTMLElement()) + for (Node* node = itemAfter(arrayOffset, 0); node; node = itemAfter(arrayOffset, node)) { + if (!node->isHTMLElement()) continue; - HTMLElement* e = toHTMLElement(element); + HTMLElement* e = toHTMLElement(node); const AtomicString& idAttrVal = e->getIdAttribute(); const AtomicString& nameAttrVal = e->getNameAttribute(); if (!idAttrVal.isEmpty()) @@ -522,7 +551,7 @@ void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& PassRefPtr<NodeList> HTMLCollection::tags(const String& name) { - return m_base->getElementsByTagName(name); + return ownerNode()->getElementsByTagName(name); } void HTMLCollectionCacheBase::append(NodeCacheMap& map, const AtomicString& key, Element* element) diff --git a/Source/WebCore/html/HTMLCollection.h b/Source/WebCore/html/HTMLCollection.h index 6343e8edf..833618373 100644 --- a/Source/WebCore/html/HTMLCollection.h +++ b/Source/WebCore/html/HTMLCollection.h @@ -39,20 +39,13 @@ class NodeList; class HTMLCollectionCacheBase : public DynamicNodeListCacheBase { public: - HTMLCollectionCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, CollectionType collectionType, ItemBeforeSupportType itemBeforeSupportType) - : DynamicNodeListCacheBase(rootType, invalidationType, collectionType, itemBeforeSupportType) - , m_cachedElementsArrayOffset(0) + HTMLCollectionCacheBase(Node* ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType, + bool shouldOnlyIncludeDirectChildren, CollectionType collectionType, ItemAfterOverrideType itemAfterOverrideType) + : DynamicNodeListCacheBase(ownerNode, rootType, invalidationType, shouldOnlyIncludeDirectChildren, collectionType, itemAfterOverrideType) { } protected: - void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const - { - setItemCache(item, offset); - m_cachedElementsArrayOffset = elementsArrayOffset; - } - unsigned cachedElementsArrayOffset() const { return m_cachedElementsArrayOffset; } - typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap; Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache.get(name.impl()); } Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameCache.get(name.impl()); } @@ -63,13 +56,12 @@ protected: private: using DynamicNodeListCacheBase::isRootedAtDocument; - using DynamicNodeListCacheBase::setItemCache; mutable NodeCacheMap m_idCache; mutable NodeCacheMap m_nameCache; mutable unsigned m_cachedElementsArrayOffset; - friend void DynamicNodeListCacheBase::invalidateCache() const; + friend class DynamicNodeListCacheBase; }; class HTMLCollection : public RefCounted<HTMLCollection>, public HTMLCollectionCacheBase { @@ -78,8 +70,8 @@ public: virtual ~HTMLCollection(); // DOM API - unsigned length() const; - Node* item(unsigned index) const; + unsigned length() const { return lengthCommon(); } + Node* item(unsigned offset) const { return itemCommon(offset); } virtual Node* namedItem(const AtomicString& name) const; PassRefPtr<NodeList> tags(const String&); @@ -103,23 +95,16 @@ public: return item(0) && !item(1); } - Node* base() const { return m_base.get(); } + Node* base() const { return ownerNode(); } + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const; protected: - HTMLCollection(Node* base, CollectionType, ItemBeforeSupportType); + HTMLCollection(Node* base, CollectionType, ItemAfterOverrideType); virtual void updateNameCache() const; - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const; private: bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const; - - Element* itemBefore(unsigned& offsetInArray, Element*) const; - bool isLastItemCloserThanLastOrCachedItem(unsigned offset) const; - bool isFirstItemCloserThanCachedItem(unsigned offset) const; - Element* itemBeforeOrAfterCachedItem(unsigned offset) const; - - RefPtr<Node> m_base; }; } // namespace diff --git a/Source/WebCore/html/HTMLDataListElement.cpp b/Source/WebCore/html/HTMLDataListElement.cpp index ed842eecc..d6dcb28d7 100644 --- a/Source/WebCore/html/HTMLDataListElement.cpp +++ b/Source/WebCore/html/HTMLDataListElement.cpp @@ -30,10 +30,11 @@ */ #include "config.h" -#if ENABLE(DATALIST) #include "HTMLDataListElement.h" +#if ENABLE(DATALIST_ELEMENT) #include "HTMLNames.h" +#include "IdTargetObserverRegistry.h" namespace WebCore { @@ -52,5 +53,10 @@ PassRefPtr<HTMLCollection> HTMLDataListElement::options() return ensureCachedHTMLCollection(DataListOptions); } -} // namespace WebCore -#endif // ENABLE(DATALIST) +void HTMLDataListElement::optionElementChildrenChanged() +{ + treeScope()->idTargetObserverRegistry().notifyObservers(getIdAttribute()); +} + +} // namespace WebCore +#endif // ENABLE(DATALIST_ELEMENT) diff --git a/Source/WebCore/html/HTMLDataListElement.h b/Source/WebCore/html/HTMLDataListElement.h index 9129f295e..3572643cb 100644 --- a/Source/WebCore/html/HTMLDataListElement.h +++ b/Source/WebCore/html/HTMLDataListElement.h @@ -32,8 +32,7 @@ #ifndef HTMLDataListElement_h #define HTMLDataListElement_h -#if ENABLE(DATALIST) - +#if ENABLE(DATALIST_ELEMENT) #include "HTMLCollection.h" #include "HTMLElement.h" @@ -45,11 +44,13 @@ public: PassRefPtr<HTMLCollection> options(); + void optionElementChildrenChanged(); + private: HTMLDataListElement(const QualifiedName&, Document*); }; -} // namespace WebCore -#endif // ENABLE(DATALIST) +} // namespace WebCore +#endif // ENABLE(DATALIST_ELEMENT) -#endif // HTMLDataListElement_h +#endif // HTMLDataListElement_h diff --git a/Source/WebCore/html/HTMLDataListElement.idl b/Source/WebCore/html/HTMLDataListElement.idl index 1f38105f8..7e0d69c96 100644 --- a/Source/WebCore/html/HTMLDataListElement.idl +++ b/Source/WebCore/html/HTMLDataListElement.idl @@ -30,7 +30,7 @@ module html { interface [ - Conditional=DATALIST, + Conditional=DATALIST_ELEMENT, ] HTMLDataListElement : HTMLElement { readonly attribute HTMLCollection options; }; diff --git a/Source/WebCore/html/HTMLDetailsElement.cpp b/Source/WebCore/html/HTMLDetailsElement.cpp index 531bd3306..86a7b48ca 100644 --- a/Source/WebCore/html/HTMLDetailsElement.cpp +++ b/Source/WebCore/html/HTMLDetailsElement.cpp @@ -21,8 +21,7 @@ #include "config.h" #include "HTMLDetailsElement.h" -#if ENABLE(DETAILS) - +#if ENABLE(DETAILS_ELEMENT) #include "ElementShadow.h" #include "HTMLContentElement.h" #include "HTMLNames.h" @@ -124,7 +123,7 @@ Element* HTMLDetailsElement::findMainSummary() const return toElement(child); } - return static_cast<DetailsSummaryElement*>(shadow()->oldestShadowRoot()->firstChild())->fallbackSummary(); + return static_cast<DetailsSummaryElement*>(userAgentShadowRoot()->firstChild())->fallbackSummary(); } void HTMLDetailsElement::parseAttribute(const Attribute& attribute) diff --git a/Source/WebCore/html/HTMLDetailsElement.idl b/Source/WebCore/html/HTMLDetailsElement.idl index 5ad9508c9..087f083ff 100644 --- a/Source/WebCore/html/HTMLDetailsElement.idl +++ b/Source/WebCore/html/HTMLDetailsElement.idl @@ -18,8 +18,9 @@ */ module html { - - interface HTMLDetailsElement : HTMLElement { + interface [ + Conditional=DETAILS_ELEMENT + ] HTMLDetailsElement : HTMLElement { attribute [Reflect] boolean open; }; diff --git a/Source/WebCore/html/HTMLDialogElement.cpp b/Source/WebCore/html/HTMLDialogElement.cpp index bd630ef67..4510d8143 100644 --- a/Source/WebCore/html/HTMLDialogElement.cpp +++ b/Source/WebCore/html/HTMLDialogElement.cpp @@ -28,6 +28,8 @@ #if ENABLE(DIALOG_ELEMENT) +#include "ExceptionCode.h" + namespace WebCore { using namespace HTMLNames; @@ -43,14 +45,30 @@ PassRefPtr<HTMLDialogElement> HTMLDialogElement::create(const QualifiedName& tag return adoptRef(new HTMLDialogElement(tagName, document)); } -void HTMLDialogElement::close() +void HTMLDialogElement::close(ExceptionCode& ec) { - // FIXME: Implement. + if (!fastHasAttribute(openAttr)) { + ec = INVALID_STATE_ERR; + return; + } + setBooleanAttribute(openAttr, false); } void HTMLDialogElement::show() { - // FIXME: Implement. + if (fastHasAttribute(openAttr)) + return; + setBooleanAttribute(openAttr, true); +} + +bool HTMLDialogElement::isPresentationAttribute(const QualifiedName& name) const +{ + // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>: modifying an attribute for which there is an attribute selector + // in html.css sometimes does not trigger a style recalc. + if (name == openAttr) + return true; + + return HTMLElement::isPresentationAttribute(name); } } diff --git a/Source/WebCore/html/HTMLDialogElement.h b/Source/WebCore/html/HTMLDialogElement.h index cc5c2db0b..d1dd77689 100644 --- a/Source/WebCore/html/HTMLDialogElement.h +++ b/Source/WebCore/html/HTMLDialogElement.h @@ -39,11 +39,13 @@ class HTMLDialogElement : public HTMLElement { public: static PassRefPtr<HTMLDialogElement> create(const QualifiedName&, Document*); - void close(); + void close(ExceptionCode&); void show(); private: HTMLDialogElement(const QualifiedName&, Document*); + + virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLDialogElement.idl b/Source/WebCore/html/HTMLDialogElement.idl index e5d6479ba..442f93fd8 100644 --- a/Source/WebCore/html/HTMLDialogElement.idl +++ b/Source/WebCore/html/HTMLDialogElement.idl @@ -29,7 +29,7 @@ module html { Conditional=DIALOG_ELEMENT ] HTMLDialogElement : HTMLElement { attribute [Reflect] boolean open; - void close(); + void close() raises(DOMException); void show(); }; diff --git a/Source/WebCore/html/HTMLFormCollection.cpp b/Source/WebCore/html/HTMLFormCollection.cpp index b845f0c6f..a5cc6ac4a 100644 --- a/Source/WebCore/html/HTMLFormCollection.cpp +++ b/Source/WebCore/html/HTMLFormCollection.cpp @@ -37,7 +37,7 @@ using namespace HTMLNames; // calculation every time if anything has changed. HTMLFormCollection::HTMLFormCollection(Element* base) - : HTMLCollection(base, FormControls, DoNotSupportItemBefore) + : HTMLCollection(base, FormControls, OverridesItemAfter) { ASSERT(base->hasTagName(formTag) || base->hasTagName(fieldsetTag)); } @@ -67,7 +67,7 @@ const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const return static_cast<HTMLFormElement*>(base())->imageElements(); } -Element* HTMLFormCollection::itemAfter(unsigned& offset, Element* previousItem) const +Element* HTMLFormCollection::virtualItemAfter(unsigned& offset, Element* previousItem) const { const Vector<FormAssociatedElement*>& elementsArray = formControlElements(); if (previousItem) diff --git a/Source/WebCore/html/HTMLFormCollection.h b/Source/WebCore/html/HTMLFormCollection.h index 82cbfed15..978a26f8f 100644 --- a/Source/WebCore/html/HTMLFormCollection.h +++ b/Source/WebCore/html/HTMLFormCollection.h @@ -49,7 +49,7 @@ private: const Vector<FormAssociatedElement*>& formControlElements() const; const Vector<HTMLImageElement*>& formImageElements() const; - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp index 16cf36051..d12e7b434 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.cpp +++ b/Source/WebCore/html/HTMLFrameElementBase.cpp @@ -246,11 +246,4 @@ int HTMLFrameElementBase::height() return renderBox()->height(); } -#if ENABLE(FULLSCREEN_API) -bool HTMLFrameElementBase::allowFullScreen() const -{ - return hasAttribute(webkitallowfullscreenAttr); -} -#endif - } // namespace WebCore diff --git a/Source/WebCore/html/HTMLFrameElementBase.h b/Source/WebCore/html/HTMLFrameElementBase.h index 11dc94d3d..0f84df36e 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.h +++ b/Source/WebCore/html/HTMLFrameElementBase.h @@ -42,10 +42,6 @@ public: int width(); int height(); -#if ENABLE(FULLSCREEN_API) - virtual bool allowFullScreen() const; -#endif - virtual bool canContainRangeEndPoint() const { return false; } protected: diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp index 2992b6a17..e3138e6e0 100644 --- a/Source/WebCore/html/HTMLImageElement.cpp +++ b/Source/WebCore/html/HTMLImageElement.cpp @@ -96,7 +96,7 @@ HTMLImageElement::~HTMLImageElement() void HTMLImageElement::willAddAuthorShadowRoot() { - if (shadow()->oldestShadowRoot()) + if (userAgentShadowRoot()) return; createShadowSubtree(); @@ -112,9 +112,9 @@ void HTMLImageElement::createShadowSubtree() Element* HTMLImageElement::imageElement() { - if (ElementShadow* elementShadow = shadow()) { - ASSERT(elementShadow->oldestShadowRoot()->firstChild()->hasTagName(webkitInnerImageTag)); - return toElement(elementShadow->oldestShadowRoot()->firstChild()); + if (ShadowRoot* root = userAgentShadowRoot()) { + ASSERT(root->firstChild()->hasTagName(webkitInnerImageTag)); + return toElement(root->firstChild()); } return this; @@ -409,8 +409,8 @@ void HTMLImageElement::setItemValueText(const String& value, ExceptionCode&) inline ImageInnerElement* HTMLImageElement::innerElement() const { - ASSERT(shadow()); - return toImageInnerElement(shadow()->oldestShadowRoot()->firstChild()); + ASSERT(userAgentShadowRoot()); + return toImageInnerElement(userAgentShadowRoot()->firstChild()); } } diff --git a/Source/WebCore/html/HTMLImageLoader.cpp b/Source/WebCore/html/HTMLImageLoader.cpp index e69c3e091..46a652780 100644 --- a/Source/WebCore/html/HTMLImageLoader.cpp +++ b/Source/WebCore/html/HTMLImageLoader.cpp @@ -74,13 +74,13 @@ void HTMLImageLoader::notifyFinished(CachedResource*) { CachedImage* cachedImage = image(); - Element* elem = client()->sourceElement(); + RefPtr<Element> element = client()->sourceElement(); ImageLoader::notifyFinished(cachedImage); bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400; #if USE(JSC) if (!loadError) { - if (!elem->inDocument()) { + if (!element->inDocument()) { JSC::JSGlobalData* globalData = JSDOMWindowBase::commonJSGlobalData(); JSC::JSLockHolder lock(globalData); globalData->heap.reportExtraMemoryCost(cachedImage->encodedSize()); @@ -88,8 +88,8 @@ void HTMLImageLoader::notifyFinished(CachedResource*) } #endif - if (loadError && elem->hasTagName(HTMLNames::objectTag)) - static_cast<HTMLObjectElement*>(elem)->renderFallbackContent(); + if (loadError && element->hasTagName(HTMLNames::objectTag)) + static_cast<HTMLObjectElement*>(element.get())->renderFallbackContent(); } } diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 77ea42567..407c1233b 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -45,6 +45,7 @@ #include "HTMLNames.h" #include "HTMLOptionElement.h" #include "HTMLParserIdioms.h" +#include "IdTargetObserver.h" #include "InputType.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" @@ -77,6 +78,19 @@ namespace WebCore { using namespace HTMLNames; +#if ENABLE(DATALIST_ELEMENT) +class ListAttributeTargetObserver : IdTargetObserver { +public: + static PassOwnPtr<ListAttributeTargetObserver> create(const AtomicString& id, HTMLInputElement*); + virtual void idTargetChanged() OVERRIDE; + +private: + ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); + + HTMLInputElement* m_element; +}; +#endif + // FIXME: According to HTML4, the length attribute's value can be arbitrarily // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things // get rather sluggish when a text field has a larger number of characters than @@ -183,6 +197,11 @@ HTMLElement* HTMLInputElement::speechButtonElement() const } #endif +HTMLElement* HTMLInputElement::sliderThumbElement() const +{ + return m_inputType->sliderThumbElement(); +} + HTMLElement* HTMLInputElement::placeholderElement() const { return m_inputType->placeholderElement(); @@ -678,10 +697,14 @@ void HTMLInputElement::parseAttribute(const Attribute& attribute) HTMLTextFormControlElement::parseAttribute(attribute); m_inputType->readonlyAttributeChanged(); } -#if ENABLE(DATALIST) - else if (attribute.name() == listAttr) +#if ENABLE(DATALIST_ELEMENT) + else if (attribute.name() == listAttr) { m_hasNonEmptyList = !attribute.isEmpty(); - // FIXME: we need to tell this change to a renderer if the attribute affects the appearance. + if (m_hasNonEmptyList) { + resetListAttributeTargetObserver(); + listAttributeTargetChanged(); + } + } #endif #if ENABLE(INPUT_SPEECH) else if (attribute.name() == webkitspeechAttr) { @@ -1412,6 +1435,9 @@ Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode* HTMLTextFormControlElement::insertedInto(insertionPoint); if (insertionPoint->inDocument() && !form()) addToRadioButtonGroup(); +#if ENABLE(DATALIST_ELEMENT) + resetListAttributeTargetObserver(); +#endif return InsertionDone; } @@ -1420,6 +1446,10 @@ void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) if (insertionPoint->inDocument() && !form()) removeFromRadioButtonGroup(); HTMLTextFormControlElement::removedFrom(insertionPoint); + ASSERT(!inDocument()); +#if ENABLE(DATALIST_ELEMENT) + resetListAttributeTargetObserver(); +#endif } void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) @@ -1468,8 +1498,7 @@ void HTMLInputElement::selectColorInColorChooser(const Color& color) } #endif -#if ENABLE(DATALIST) - +#if ENABLE(DATALIST_ELEMENT) HTMLElement* HTMLInputElement::list() const { return dataList(); @@ -1492,7 +1521,19 @@ HTMLDataListElement* HTMLInputElement::dataList() const return static_cast<HTMLDataListElement*>(element); } -#endif // ENABLE(DATALIST) +void HTMLInputElement::resetListAttributeTargetObserver() +{ + if (inDocument()) + m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fastGetAttribute(listAttr), this); + else + m_listAttributeTargetObserver = nullptr; +} + +void HTMLInputElement::listAttributeTargetChanged() +{ + m_inputType->listAttributeTargetChanged(); +} +#endif // ENABLE(DATALIST_ELEMENT) bool HTMLInputElement::isSteppable() const { @@ -1760,4 +1801,22 @@ void HTMLInputElement::setWidth(unsigned width) setAttribute(widthAttr, String::number(width)); } +#if ENABLE(DATALIST_ELEMENT) +PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(const AtomicString& id, HTMLInputElement* element) +{ + return adoptPtr(new ListAttributeTargetObserver(id, element)); +} + +ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement* element) + : IdTargetObserver(element->treeScope()->idTargetObserverRegistry(), id) + , m_element(element) +{ +} + +void ListAttributeTargetObserver::idTargetChanged() +{ + m_element->listAttributeTargetChanged(); +} +#endif + } // namespace diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 2fd43d863..3fd66c9e4 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -39,6 +39,7 @@ class HTMLOptionElement; class Icon; class InputType; class KURL; +class ListAttributeTargetObserver; class HTMLInputElement : public HTMLTextFormControlElement, public ImageLoaderClientBase<HTMLInputElement> { public: @@ -122,6 +123,7 @@ public: #if ENABLE(INPUT_SPEECH) HTMLElement* speechButtonElement() const; #endif + HTMLElement* sliderThumbElement() const; virtual HTMLElement* placeholderElement() const; bool checked() const { return m_isChecked; } @@ -232,8 +234,9 @@ public: void addSearchResult(); void onSearch(); -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) HTMLElement* list() const; + void listAttributeTargetChanged(); #endif HTMLInputElement* checkedRadioButtonForGroup() const; @@ -359,9 +362,9 @@ private: virtual void subtreeHasChanged(); - -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) HTMLDataListElement* dataList() const; + void resetListAttributeTargetObserver(); #endif void parseMaxLengthAttribute(const Attribute&); void updateValueIfNeeded(); @@ -384,7 +387,7 @@ private: bool m_isActivatedSubmit : 1; unsigned m_autocomplete : 2; // AutoCompleteSetting bool m_isAutofilled : 1; -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) bool m_hasNonEmptyList : 1; #endif bool m_stateRestored : 1; @@ -394,6 +397,9 @@ private: bool m_canReceiveDroppedFiles : 1; bool m_hasTouchEventHandler: 1; OwnPtr<InputType> m_inputType; +#if ENABLE(DATALIST_ELEMENT) + OwnPtr<ListAttributeTargetObserver> m_listAttributeTargetObserver; +#endif }; } //namespace diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index e326ce7be..879a34f57 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -39,7 +39,7 @@ module html { attribute [Reflect] DOMString formTarget; attribute unsigned long height; attribute boolean indeterminate; - readonly attribute [Conditional=DATALIST] HTMLElement list; + readonly attribute [Conditional=DATALIST_ELEMENT] HTMLElement list; attribute [Reflect] DOMString max; attribute long maxLength setter raises(DOMException); attribute [Reflect] DOMString min; diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index a1b032e06..cfe2d8e49 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -136,7 +136,7 @@ bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const HTMLSelectElement* HTMLKeygenElement::shadowSelect() const { - ShadowRoot* root = this->shadow()->oldestShadowRoot(); + ShadowRoot* root = userAgentShadowRoot(); return root ? toHTMLSelectElement(root->firstChild()) : 0; } diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 705a05c5f..f16271bcd 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -1862,20 +1862,14 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) void HTMLMediaElement::createShadowSubtree() { - ASSERT(!shadow() || !shadow()->oldestShadowRoot()); - + ASSERT(!userAgentShadowRoot()); ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot); } void HTMLMediaElement::willAddAuthorShadowRoot() { - ASSERT(shadow()); - if (shadow()->oldestShadowRoot()) { - ASSERT(shadow()->oldestShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot); - return; - } - - createShadowSubtree(); + if (!userAgentShadowRoot()) + createShadowSubtree(); } void HTMLMediaElement::rewind(float timeDelta) @@ -4180,17 +4174,18 @@ void HTMLMediaElement::privateBrowsingStateDidChange() MediaControls* HTMLMediaElement::mediaControls() const { - return toMediaControls(shadow()->oldestShadowRoot()->firstChild()); + return toMediaControls(userAgentShadowRoot()->firstChild()); } bool HTMLMediaElement::hasMediaControls() const { - ElementShadow* elementShadow = shadow(); - if (!elementShadow) - return false; + if (ShadowRoot* userAgent = userAgentShadowRoot()) { + Node* node = userAgent->firstChild(); + ASSERT(!node || node->isMediaControls()); + return node; + } - Node* node = elementShadow->oldestShadowRoot()->firstChild(); - return node && node->isMediaControls(); + return false; } bool HTMLMediaElement::createMediaControls() @@ -4211,8 +4206,8 @@ bool HTMLMediaElement::createMediaControls() if (!shadow()) createShadowSubtree(); - ASSERT(shadow()->oldestShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot); - shadow()->oldestShadowRoot()->appendChild(controls, ec); + ASSERT(userAgentShadowRoot()); + userAgentShadowRoot()->appendChild(controls, ec); return true; } diff --git a/Source/WebCore/html/HTMLMeterElement.cpp b/Source/WebCore/html/HTMLMeterElement.cpp index 13dea1513..290de5b07 100644 --- a/Source/WebCore/html/HTMLMeterElement.cpp +++ b/Source/WebCore/html/HTMLMeterElement.cpp @@ -19,9 +19,9 @@ */ #include "config.h" -#if ENABLE(METER_TAG) #include "HTMLMeterElement.h" +#if ENABLE(METER_ELEMENT) #include "Attribute.h" #include "EventNames.h" #include "ExceptionCode.h" diff --git a/Source/WebCore/html/HTMLMeterElement.h b/Source/WebCore/html/HTMLMeterElement.h index bca0be6e6..188309157 100644 --- a/Source/WebCore/html/HTMLMeterElement.h +++ b/Source/WebCore/html/HTMLMeterElement.h @@ -21,7 +21,7 @@ #ifndef HTMLMeterElement_h #define HTMLMeterElement_h -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "LabelableElement.h" namespace WebCore { diff --git a/Source/WebCore/html/HTMLMeterElement.idl b/Source/WebCore/html/HTMLMeterElement.idl index 7c11fe4ce..8d3e1074c 100644 --- a/Source/WebCore/html/HTMLMeterElement.idl +++ b/Source/WebCore/html/HTMLMeterElement.idl @@ -19,7 +19,7 @@ module html { interface [ - Conditional=METER_TAG + Conditional=METER_ELEMENT ] HTMLMeterElement : HTMLElement { attribute double value setter raises(DOMException); diff --git a/Source/WebCore/html/HTMLNameCollection.cpp b/Source/WebCore/html/HTMLNameCollection.cpp index 246235d07..36c7350a4 100644 --- a/Source/WebCore/html/HTMLNameCollection.cpp +++ b/Source/WebCore/html/HTMLNameCollection.cpp @@ -33,7 +33,7 @@ namespace WebCore { using namespace HTMLNames; HTMLNameCollection::HTMLNameCollection(Document* document, CollectionType type, const AtomicString& name) - : HTMLCollection(document, type, DoNotSupportItemBefore) + : HTMLCollection(document, type, OverridesItemAfter) , m_name(name) { } @@ -49,7 +49,7 @@ HTMLNameCollection::~HTMLNameCollection() static_cast<Document*>(base())->removeDocumentNamedItemCache(this, m_name); } -Element* HTMLNameCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +Element* HTMLNameCollection::virtualItemAfter(unsigned& offsetInArray, Element* previous) const { ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(previous != base()); diff --git a/Source/WebCore/html/HTMLNameCollection.h b/Source/WebCore/html/HTMLNameCollection.h index dd9d45d9d..4a7afebb7 100644 --- a/Source/WebCore/html/HTMLNameCollection.h +++ b/Source/WebCore/html/HTMLNameCollection.h @@ -43,7 +43,7 @@ public: private: HTMLNameCollection(Document*, CollectionType, const AtomicString& name); - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; AtomicString m_name; }; diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index 3691e8241..bb68a9d32 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -30,6 +30,7 @@ #include "Attribute.h" #include "Document.h" #include "ExceptionCode.h" +#include "HTMLDataListElement.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" #include "HTMLSelectElement.h" @@ -187,6 +188,12 @@ int HTMLOptionElement::index() const void HTMLOptionElement::parseAttribute(const Attribute& attribute) { +#if ENABLE(DATALIST_ELEMENT) + if (attribute.name() == valueAttr) { + if (HTMLDataListElement* dataList = ownerDataListElement()) + dataList->optionElementChildrenChanged(); + } else +#endif if (attribute.name() == disabledAttr) { bool oldDisabled = m_disabled; m_disabled = !attribute.isNull(); @@ -252,11 +259,27 @@ void HTMLOptionElement::setSelectedState(bool selected) void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { +#if ENABLE(DATALIST_ELEMENT) + if (HTMLDataListElement* dataList = ownerDataListElement()) + dataList->optionElementChildrenChanged(); + else +#endif if (HTMLSelectElement* select = ownerSelectElement()) select->optionElementChildrenChanged(); HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } +#if ENABLE(DATALIST_ELEMENT) +HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const +{ + for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) { + if (parent->hasTagName(datalistTag)) + return static_cast<HTMLDataListElement*>(parent); + } + return 0; +} +#endif + HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const { ContainerNode* select = parentNode(); diff --git a/Source/WebCore/html/HTMLOptionElement.h b/Source/WebCore/html/HTMLOptionElement.h index 247b6c1a9..24cdcdb5e 100644 --- a/Source/WebCore/html/HTMLOptionElement.h +++ b/Source/WebCore/html/HTMLOptionElement.h @@ -29,6 +29,7 @@ namespace WebCore { +class HTMLDataListElement; class HTMLSelectElement; class HTMLOptionElement : public HTMLElement { @@ -49,6 +50,9 @@ public: bool selected(); void setSelected(bool); +#if ENABLE(DATALIST_ELEMENT) + HTMLDataListElement* ownerDataListElement() const; +#endif HTMLSelectElement* ownerSelectElement() const; String label() const; diff --git a/Source/WebCore/html/HTMLOptionsCollection.cpp b/Source/WebCore/html/HTMLOptionsCollection.cpp index 960fc8995..8d2aff9e0 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.cpp +++ b/Source/WebCore/html/HTMLOptionsCollection.cpp @@ -28,7 +28,7 @@ namespace WebCore { HTMLOptionsCollection::HTMLOptionsCollection(Element* select) - : HTMLCollection(select, SelectOptions, SupportItemBefore) + : HTMLCollection(select, SelectOptions, DoesNotOverrideItemAfter) { ASSERT(select->hasTagName(HTMLNames::selectTag)); } diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp index 4030ee238..742b09ffa 100644 --- a/Source/WebCore/html/HTMLProgressElement.cpp +++ b/Source/WebCore/html/HTMLProgressElement.cpp @@ -19,9 +19,9 @@ */ #include "config.h" -#if ENABLE(PROGRESS_TAG) #include "HTMLProgressElement.h" +#if ENABLE(PROGRESS_ELEMENT) #include "Attribute.h" #include "EventNames.h" #include "ExceptionCode.h" diff --git a/Source/WebCore/html/HTMLProgressElement.h b/Source/WebCore/html/HTMLProgressElement.h index e2e8a270d..72180b93d 100644 --- a/Source/WebCore/html/HTMLProgressElement.h +++ b/Source/WebCore/html/HTMLProgressElement.h @@ -21,7 +21,7 @@ #ifndef HTMLProgressElement_h #define HTMLProgressElement_h -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "LabelableElement.h" namespace WebCore { diff --git a/Source/WebCore/html/HTMLProgressElement.idl b/Source/WebCore/html/HTMLProgressElement.idl index ace4def83..6ad1ab53e 100644 --- a/Source/WebCore/html/HTMLProgressElement.idl +++ b/Source/WebCore/html/HTMLProgressElement.idl @@ -19,7 +19,7 @@ module html { interface [ - Conditional=PROGRESS_TAG + Conditional=PROGRESS_ELEMENT ] HTMLProgressElement : HTMLElement { attribute double value setter raises(DOMException); diff --git a/Source/WebCore/html/HTMLPropertiesCollection.cpp b/Source/WebCore/html/HTMLPropertiesCollection.cpp index c17e7c696..d86bf6c65 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.cpp +++ b/Source/WebCore/html/HTMLPropertiesCollection.cpp @@ -51,7 +51,7 @@ PassRefPtr<HTMLPropertiesCollection> HTMLPropertiesCollection::create(Node* item } HTMLPropertiesCollection::HTMLPropertiesCollection(Node* itemNode) - : HTMLCollection(itemNode, ItemProperties, DoNotSupportItemBefore) + : HTMLCollection(itemNode, ItemProperties, OverridesItemAfter) , m_hasPropertyNameCache(false) , m_hasItemRefElements(false) { @@ -112,10 +112,10 @@ static Node* nextNodeWithProperty(Node* base, Node* node) ? node->traverseNextNode(base) : node->traverseNextSibling(base); } -Element* HTMLPropertiesCollection::itemAfter(unsigned& offsetInArray, Element* previousItem) const +Element* HTMLPropertiesCollection::virtualItemAfter(unsigned& offsetInArray, Element* previousItem) const { while (offsetInArray < m_itemRefElements.size()) { - if (Element* next = itemAfter(m_itemRefElements[offsetInArray], previousItem)) + if (Element* next = virtualItemAfter(m_itemRefElements[offsetInArray], previousItem)) return next; offsetInArray++; previousItem = 0; @@ -123,7 +123,7 @@ Element* HTMLPropertiesCollection::itemAfter(unsigned& offsetInArray, Element* p return 0; } -HTMLElement* HTMLPropertiesCollection::itemAfter(HTMLElement* base, Element* previous) const +HTMLElement* HTMLPropertiesCollection::virtualItemAfter(HTMLElement* base, Element* previous) const { Node* current; current = previous ? nextNodeWithProperty(base, previous) : base; @@ -149,7 +149,7 @@ void HTMLPropertiesCollection::updateNameCache() const for (unsigned i = 0; i < m_itemRefElements.size(); ++i) { HTMLElement* refElement = m_itemRefElements[i]; - for (HTMLElement* element = itemAfter(refElement, 0); element; element = itemAfter(refElement, element)) { + for (HTMLElement* element = virtualItemAfter(refElement, 0); element; element = virtualItemAfter(refElement, element)) { DOMSettableTokenList* itemProperty = element->itemProp(); for (unsigned propertyIndex = 0; propertyIndex < itemProperty->length(); ++propertyIndex) updatePropertyCache(element, itemProperty->item(propertyIndex)); diff --git a/Source/WebCore/html/HTMLPropertiesCollection.h b/Source/WebCore/html/HTMLPropertiesCollection.h index dba91cac1..29a84ed71 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.h +++ b/Source/WebCore/html/HTMLPropertiesCollection.h @@ -65,8 +65,8 @@ private: Node* findRefElements(Node* previous) const; - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; - HTMLElement* itemAfter(HTMLElement* base, Element* previous) const; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + HTMLElement* virtualItemAfter(HTMLElement* base, Element* previous) const; void updateNameCache() const; diff --git a/Source/WebCore/html/HTMLSummaryElement.cpp b/Source/WebCore/html/HTMLSummaryElement.cpp index 800a0efc2..daf126cfb 100644 --- a/Source/WebCore/html/HTMLSummaryElement.cpp +++ b/Source/WebCore/html/HTMLSummaryElement.cpp @@ -21,8 +21,7 @@ #include "config.h" #include "HTMLSummaryElement.h" -#if ENABLE(DETAILS) - +#if ENABLE(DETAILS_ELEMENT) #include "DetailsMarkerControl.h" #include "ElementShadow.h" #include "HTMLContentElement.h" diff --git a/Source/WebCore/html/HTMLTableRowsCollection.cpp b/Source/WebCore/html/HTMLTableRowsCollection.cpp index 206864ec2..2619f94f1 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.cpp +++ b/Source/WebCore/html/HTMLTableRowsCollection.cpp @@ -152,7 +152,7 @@ HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement* table) // table to get at the collection cache. Order of argument evaluation is undefined and can // differ between compilers. HTMLTableRowsCollection::HTMLTableRowsCollection(Element* table) - : HTMLCollection(table, TableRows, DoNotSupportItemBefore) + : HTMLCollection(table, TableRows, OverridesItemAfter) { ASSERT(table->hasTagName(tableTag)); } @@ -162,7 +162,7 @@ PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(Element* tab return adoptRef(new HTMLTableRowsCollection(table)); } -Element* HTMLTableRowsCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +Element* HTMLTableRowsCollection::virtualItemAfter(unsigned& offsetInArray, Element* previous) const { ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(!previous || (previous->isHTMLElement() && toHTMLElement(previous)->hasLocalName(trTag))); diff --git a/Source/WebCore/html/HTMLTableRowsCollection.h b/Source/WebCore/html/HTMLTableRowsCollection.h index 817b14373..c5068dbac 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.h +++ b/Source/WebCore/html/HTMLTableRowsCollection.h @@ -46,7 +46,7 @@ public: private: HTMLTableRowsCollection(Element*); - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in index 4119ba9b6..c40672863 100644 --- a/Source/WebCore/html/HTMLTagNames.in +++ b/Source/WebCore/html/HTMLTagNames.in @@ -33,10 +33,10 @@ colgroup interfaceName=HTMLTableColElement command interfaceName=HTMLElement content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, contextConditional=shadowDOM webkitShadowContent interfaceName=HTMLElement, noConstructor -datalist interfaceName=HTMLDataListElement, conditional=DATALIST +datalist interfaceName=HTMLDataListElement, conditional=DATALIST_ELEMENT dd interfaceName=HTMLElement del interfaceName=HTMLModElement -details conditional=DETAILS +details conditional=DETAILS_ELEMENT dfn interfaceName=HTMLElement dir interfaceName=HTMLDirectoryElement dialog conditional=DIALOG_ELEMENT, contextConditional=dialogElement @@ -86,7 +86,7 @@ mark interfaceName=HTMLElement marquee menu meta -meter interfaceName=HTMLMeterElement, conditional=METER_TAG +meter interfaceName=HTMLMeterElement, conditional=METER_ELEMENT nav interfaceName=HTMLElement nobr interfaceName=HTMLElement noembed interfaceName=HTMLElement @@ -102,7 +102,7 @@ p interfaceName=HTMLParagraphElement param plaintext interfaceName=HTMLElement pre -progress interfaceName=HTMLProgressElement, conditional=PROGRESS_TAG +progress interfaceName=HTMLProgressElement, conditional=PROGRESS_ELEMENT q interfaceName=HTMLQuoteElement rp interfaceName=HTMLElement rt interfaceName=HTMLElement @@ -119,7 +119,7 @@ strike interfaceName=HTMLElement strong interfaceName=HTMLElement style constructorNeedsCreatedByParser sub interfaceName=HTMLElement -summary interfaceName=HTMLSummaryElement, JSInterfaceName=HTMLElement, conditional=DETAILS +summary interfaceName=HTMLSummaryElement, JSInterfaceName=HTMLElement, conditional=DETAILS_ELEMENT sup interfaceName=HTMLElement table tbody interfaceName=HTMLTableSectionElement diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index d07a972c6..bad8571d3 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -294,7 +294,7 @@ String HTMLTextAreaElement::sanitizeUserInputValue(const String& proposedValue, HTMLElement* HTMLTextAreaElement::innerTextElement() const { - Node* node = shadow()->oldestShadowRoot()->firstChild(); + Node* node = userAgentShadowRoot()->firstChild(); ASSERT(!node || node->hasTagName(divTag)); return toHTMLElement(node); } @@ -505,7 +505,7 @@ void HTMLTextAreaElement::updatePlaceholderText() String placeholderText = strippedPlaceholder(); if (placeholderText.isEmpty()) { if (m_placeholder) { - shadow()->oldestShadowRoot()->removeChild(m_placeholder.get(), ec); + userAgentShadowRoot()->removeChild(m_placeholder.get(), ec); ASSERT(!ec); m_placeholder.clear(); } @@ -514,7 +514,7 @@ void HTMLTextAreaElement::updatePlaceholderText() if (!m_placeholder) { m_placeholder = HTMLDivElement::create(document()); m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); - shadow()->oldestShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ec); + userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ec); ASSERT(!ec); } m_placeholder->setInnerText(placeholderText, ec); diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 4c4586523..d9097c4de 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -453,12 +453,10 @@ void InputType::createShadowSubtree() void InputType::destroyShadowSubtree() { - ElementShadow* shadow = element()->shadow(); - if (!shadow) + ShadowRoot* root = element()->userAgentShadowRoot(); + if (!root) return; - ShadowRoot* root = shadow->oldestShadowRoot(); - ASSERT(root->type() == ShadowRoot::UserAgentShadowRoot); root->removeAllChildren(); // It's ok to clear contents of all other ShadowRoots because they must have @@ -897,6 +895,12 @@ String InputType::defaultToolTip() const return String(); } +#if ENABLE(DATALIST_ELEMENT) +void InputType::listAttributeTargetChanged() +{ +} +#endif + bool InputType::supportsIndeterminateAppearance() const { return false; diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 6c6659a7c..348148b10 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -226,6 +226,7 @@ public: #if ENABLE(INPUT_SPEECH) virtual HTMLElement* speechButtonElement() const { return 0; } #endif + virtual HTMLElement* sliderThumbElement() const { return 0; } virtual HTMLElement* placeholderElement() const; // Miscellaneous functions @@ -275,6 +276,9 @@ public: virtual void disabledAttributeChanged(); virtual void readonlyAttributeChanged(); virtual String defaultToolTip() const; +#if ENABLE(DATALIST_ELEMENT) + virtual void listAttributeTargetChanged(); +#endif // Parses the specified string for the type, and return // the Decimal value for the parsing result if the parsing diff --git a/Source/WebCore/html/LabelsNodeList.cpp b/Source/WebCore/html/LabelsNodeList.cpp index d3a4ba162..3b2b8d3ef 100644 --- a/Source/WebCore/html/LabelsNodeList.cpp +++ b/Source/WebCore/html/LabelsNodeList.cpp @@ -34,7 +34,7 @@ namespace WebCore { using namespace HTMLNames; LabelsNodeList::LabelsNodeList(Node* forNode) - : DynamicSubtreeNodeList(forNode, InvalidateOnForAttrChange, NodeListIsRootedAtDocument) + : DynamicSubtreeNodeList(forNode, LabelsNodeListType, InvalidateOnForAttrChange, NodeListIsRootedAtDocument) { } diff --git a/Source/WebCore/html/RadioNodeList.cpp b/Source/WebCore/html/RadioNodeList.cpp index bd3cc87b5..944f7b40d 100644 --- a/Source/WebCore/html/RadioNodeList.cpp +++ b/Source/WebCore/html/RadioNodeList.cpp @@ -38,7 +38,7 @@ namespace WebCore { using namespace HTMLNames; RadioNodeList::RadioNodeList(Node* rootNode, const AtomicString& name) - : DynamicSubtreeNodeList(rootNode, InvalidateForFormControls, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) + : DynamicSubtreeNodeList(rootNode, RadioNodeListType, InvalidateForFormControls, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) , m_name(name) { } diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp index 10c7576bf..901a9acc1 100644 --- a/Source/WebCore/html/RangeInputType.cpp +++ b/Source/WebCore/html/RangeInputType.cpp @@ -96,6 +96,11 @@ void RangeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBe element()->setValue(serialize(newValue), eventBehavior); } +bool RangeInputType::typeMismatchFor(const String& value) const +{ + return !value.isEmpty() && !isfinite(parseToDoubleForNumberType(value)); +} + bool RangeInputType::supportsRequired() const { return false; @@ -132,7 +137,7 @@ void RangeInputType::handleMouseDownEvent(MouseEvent* event) if (event->button() != LeftButton || !targetNode) return; ASSERT(element()->shadow()); - if (targetNode != element() && !targetNode->isDescendantOf(element()->shadow()->oldestShadowRoot())) + if (targetNode != element() && !targetNode->isDescendantOf(element()->userAgentShadowRoot())) return; SliderThumbElement* thumb = sliderThumbElementOf(element()); if (targetNode == thumb) @@ -239,7 +244,7 @@ void RangeInputType::createShadowSubtree() RefPtr<HTMLElement> container = SliderContainerElement::create(document); container->appendChild(track.release(), ec); container->appendChild(TrackLimiterElement::create(document), ec); - element()->shadow()->oldestShadowRoot()->appendChild(container.release(), ec); + element()->userAgentShadowRoot()->appendChild(container.release(), ec); } RenderObject* RangeInputType::createRenderer(RenderArena* arena, RenderStyle*) const @@ -306,4 +311,16 @@ bool RangeInputType::shouldRespectListAttribute() return InputType::themeSupportsDataListUI(this); } +HTMLElement* RangeInputType::sliderThumbElement() const +{ + return sliderThumbElementOf(element()); +} + +#if ENABLE(DATALIST_ELEMENT) +void RangeInputType::listAttributeTargetChanged() +{ + element()->setNeedsStyleRecalc(); +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h index 0983b3d57..69d2ec7c6 100644 --- a/Source/WebCore/html/RangeInputType.h +++ b/Source/WebCore/html/RangeInputType.h @@ -47,6 +47,7 @@ private: virtual const AtomicString& formControlType() const OVERRIDE; virtual double valueAsDouble() const OVERRIDE; virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE; + virtual bool typeMismatchFor(const String&) const OVERRIDE; virtual bool supportsRequired() const OVERRIDE; virtual StepRange createStepRange(AnyStepHandling) const OVERRIDE; virtual bool isSteppable() const OVERRIDE; @@ -68,6 +69,10 @@ private: virtual String fallbackValue() const OVERRIDE; virtual String sanitizeValue(const String& proposedValue) const OVERRIDE; virtual bool shouldRespectListAttribute() OVERRIDE; + virtual HTMLElement* sliderThumbElement() const OVERRIDE; +#if ENABLE(DATALIST_ELEMENT) + virtual void listAttributeTargetChanged() OVERRIDE; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp index 632816be7..10ed8fb0a 100644 --- a/Source/WebCore/html/TextFieldInputType.cpp +++ b/Source/WebCore/html/TextFieldInputType.cpp @@ -246,11 +246,11 @@ void TextFieldInputType::createShadowSubtree() ExceptionCode ec = 0; m_innerText = TextControlInnerTextElement::create(document); if (!createsContainer) { - element()->shadow()->oldestShadowRoot()->appendChild(m_innerText, ec); + element()->userAgentShadowRoot()->appendChild(m_innerText, ec); return; } - ShadowRoot* shadowRoot = element()->shadow()->oldestShadowRoot(); + ShadowRoot* shadowRoot = element()->userAgentShadowRoot(); m_container = HTMLDivElement::create(document); m_container->setShadowPseudoId("-webkit-textfield-decoration-container"); shadowRoot->appendChild(m_container, ec); @@ -417,7 +417,7 @@ void TextFieldInputType::updatePlaceholderText() if (!m_placeholder) { m_placeholder = HTMLDivElement::create(element()->document()); m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); - element()->shadow()->oldestShadowRoot()->insertBefore(m_placeholder, m_container ? m_container->nextSibling() : innerTextElement()->nextSibling(), ec); + element()->userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container->nextSibling() : innerTextElement()->nextSibling(), ec); ASSERT(!ec); } m_placeholder->setInnerText(placeholderText, ec); diff --git a/Source/WebCore/html/ValidationMessage.cpp b/Source/WebCore/html/ValidationMessage.cpp index b63d8837d..1901f46ce 100644 --- a/Source/WebCore/html/ValidationMessage.cpp +++ b/Source/WebCore/html/ValidationMessage.cpp @@ -196,7 +196,7 @@ void ValidationMessage::deleteBubbleTree(Timer<ValidationMessage>*) m_messageBody = 0; HTMLElement* host = toHTMLElement(m_element); ExceptionCode ec; - host->shadow()->oldestShadowRoot()->removeChild(m_bubble.get(), ec); + host->userAgentShadowRoot()->removeChild(m_bubble.get(), ec); m_bubble = 0; } m_message = String(); diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp index 4da7a7ae9..9454f5fd9 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp +++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp @@ -220,8 +220,6 @@ void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken& void HTMLConstructionSite::insertHTMLHtmlStartTagInBody(AtomicHTMLToken& token) { - // FIXME: parse error - // Fragments do not have a root HTML element, so any additional HTML elements // encountered during fragment parsing should be ignored. if (m_isParsingFragment) @@ -232,7 +230,6 @@ void HTMLConstructionSite::insertHTMLHtmlStartTagInBody(AtomicHTMLToken& token) void HTMLConstructionSite::insertHTMLBodyStartTagInBody(AtomicHTMLToken& token) { - // FIXME: parse error mergeAttributesFromTokenIntoElement(token, m_openElements.bodyElement()); } diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 803b0e7d3..6a2b0e770 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -346,11 +346,10 @@ private: }; -HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, HTMLDocument* document, bool reportErrors, bool usePreHTML5ParserQuirks, unsigned maximumDOMTreeDepth) +HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, HTMLDocument* document, bool, bool usePreHTML5ParserQuirks, unsigned maximumDOMTreeDepth) : m_framesetOk(true) , m_document(document) , m_tree(document, maximumDOMTreeDepth) - , m_reportErrors(reportErrors) , m_insertionMode(InitialMode) , m_originalInsertionMode(InitialMode) , m_shouldSkipLeadingNewline(false) @@ -367,7 +366,6 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, DocumentFragment* f , m_fragmentContext(fragment, contextElement, scriptingPermission) , m_document(fragment->document()) , m_tree(fragment, scriptingPermission, maximumDOMTreeDepth) - , m_reportErrors(false) // FIXME: Why not report errors in fragments? , m_insertionMode(InitialMode) , m_originalInsertionMode(InitialMode) , m_shouldSkipLeadingNewline(false) @@ -729,7 +727,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken& token) { ASSERT(token.type() == HTMLTokenTypes::StartTag); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == baseTag @@ -1142,7 +1140,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case BeforeHeadMode: ASSERT(insertionMode() == BeforeHeadMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == headTag) { @@ -1161,7 +1159,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case AfterHeadMode: ASSERT(insertionMode() == AfterHeadMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == bodyTag) { @@ -1224,7 +1222,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InColumnGroupMode: ASSERT(insertionMode() == InColumnGroupMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == colTag) { @@ -1311,7 +1309,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case AfterAfterBodyMode: ASSERT(insertionMode() == AfterBodyMode || insertionMode() == AfterAfterBodyMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } setInsertionMode(InBodyMode); @@ -1320,7 +1318,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InHeadNoscriptMode: ASSERT(insertionMode() == InHeadNoscriptMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == basefontTag @@ -1343,7 +1341,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InFramesetMode: ASSERT(insertionMode() == InFramesetMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == framesetTag) { @@ -1364,7 +1362,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case AfterAfterFramesetMode: ASSERT(insertionMode() == AfterFramesetMode || insertionMode() == AfterAfterFramesetMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == noframesTag) { @@ -1390,7 +1388,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InSelectMode: ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == optionTag) { @@ -1448,6 +1446,12 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) } } +void HTMLTreeBuilder::processHtmlStartTagForInBody(AtomicHTMLToken& token) +{ + parseError(token); + m_tree.insertHTMLHtmlStartTagInBody(token); +} + bool HTMLTreeBuilder::processBodyEndTagForInBody(AtomicHTMLToken& token) { ASSERT(token.type() == HTMLTokenTypes::EndTag); @@ -1964,6 +1968,7 @@ void HTMLTreeBuilder::processEndTagForInTable(AtomicHTMLToken& token) parseError(token); return; } + parseError(token); // Is this redirection necessary here? HTMLConstructionSite::RedirectToFosterParentGuard redirecter(m_tree); processEndTagForInBody(token); @@ -2558,7 +2563,7 @@ bool HTMLTreeBuilder::processStartTagForInHead(AtomicHTMLToken& token) { ASSERT(token.type() == HTMLTokenTypes::StartTag); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return true; } if (token.name() == baseTag diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.h b/Source/WebCore/html/parser/HTMLTreeBuilder.h index e7c689084..192884e5b 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.h +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.h @@ -137,6 +137,7 @@ private: void processEndTagForInCell(AtomicHTMLToken&); void processIsindexStartTagForInBody(AtomicHTMLToken&); + void processHtmlStartTagForInBody(AtomicHTMLToken&); bool processBodyEndTagForInBody(AtomicHTMLToken&); bool processTableEndTagForInTable(); bool processCaptionEndTagForInCaption(); @@ -213,8 +214,6 @@ private: Document* m_document; HTMLConstructionSite m_tree; - bool m_reportErrors; - // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#insertion-mode InsertionMode m_insertionMode; diff --git a/Source/WebCore/html/shadow/CalendarPickerElement.cpp b/Source/WebCore/html/shadow/CalendarPickerElement.cpp index b4176b296..ea9fbb7b3 100644 --- a/Source/WebCore/html/shadow/CalendarPickerElement.cpp +++ b/Source/WebCore/html/shadow/CalendarPickerElement.cpp @@ -81,9 +81,11 @@ RenderObject* CalendarPickerElement::createRenderer(RenderArena* arena, RenderSt inline HTMLInputElement* CalendarPickerElement::hostInput() { - ASSERT(shadowAncestorNode()); - ASSERT(shadowAncestorNode()->hasTagName(inputTag)); - return static_cast<HTMLInputElement*>(shadowAncestorNode()); + // JavaScript code can't create CalendarPickerElement objects. This is + // always in shadow of <input>. + ASSERT(shadowHost()); + ASSERT(shadowHost()->hasTagName(inputTag)); + return static_cast<HTMLInputElement*>(shadowHost()); } void CalendarPickerElement::defaultEventHandler(Event* event) diff --git a/Source/WebCore/html/shadow/DetailsMarkerControl.cpp b/Source/WebCore/html/shadow/DetailsMarkerControl.cpp index d4fddd30f..b3be3c45c 100644 --- a/Source/WebCore/html/shadow/DetailsMarkerControl.cpp +++ b/Source/WebCore/html/shadow/DetailsMarkerControl.cpp @@ -31,8 +31,7 @@ #include "config.h" #include "DetailsMarkerControl.h" -#if ENABLE(DETAILS) - +#if ENABLE(DETAILS_ELEMENT) #include "HTMLNames.h" #include "HTMLSummaryElement.h" #include "RenderDetailsMarker.h" diff --git a/Source/WebCore/html/shadow/ImageInnerElement.cpp b/Source/WebCore/html/shadow/ImageInnerElement.cpp index 4ca44e9c1..b23d6b1a5 100644 --- a/Source/WebCore/html/shadow/ImageInnerElement.cpp +++ b/Source/WebCore/html/shadow/ImageInnerElement.cpp @@ -68,4 +68,10 @@ RenderObject* ImageInnerElement::createRenderer(RenderArena* arena, RenderStyle* return createRendererForImage(this, arena); } +const AtomicString& ImageInnerElement::shadowPseudoId() const +{ + DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-image-inner-element")); + return pseudoId; +} + } diff --git a/Source/WebCore/html/shadow/ImageInnerElement.h b/Source/WebCore/html/shadow/ImageInnerElement.h index 2586306e5..3d61b239e 100644 --- a/Source/WebCore/html/shadow/ImageInnerElement.h +++ b/Source/WebCore/html/shadow/ImageInnerElement.h @@ -53,6 +53,8 @@ private: virtual void attach() OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; + + virtual const AtomicString& shadowPseudoId() const OVERRIDE; }; inline PassRefPtr<ImageInnerElement> ImageInnerElement::create(Document* document) diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp index 9edbd8ad3..9f0e8c62e 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp @@ -80,7 +80,6 @@ MediaControlRootElementChromium::MediaControlRootElementChromium(Document* docum #if ENABLE(VIDEO_TRACK) , m_textDisplayContainer(0) #endif - , m_opaque(true) , m_hideFullscreenControlsTimer(this, &MediaControlRootElementChromium::hideFullscreenControlsTimerFired) , m_isMouseOverControls(false) , m_isFullscreen(false) @@ -245,7 +244,7 @@ void MediaControlRootElementChromium::reset() } } - if (m_mediaController->supportsFullscreen()) + if (m_mediaController->supportsFullscreen() && m_mediaController->hasVideo()) m_fullscreenButton->show(); else m_fullscreenButton->hide(); diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h index f86bc615a..2fb4c3cfe 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h @@ -149,7 +149,6 @@ private: MediaControlTextTrackContainerElement* m_textDisplayContainer; #endif - bool m_opaque; Timer<MediaControlRootElementChromium> m_hideFullscreenControlsTimer; bool m_isMouseOverControls; bool m_isFullscreen; diff --git a/Source/WebCore/html/shadow/MeterShadowElement.cpp b/Source/WebCore/html/shadow/MeterShadowElement.cpp index bc5ea6295..2d4d84481 100644 --- a/Source/WebCore/html/shadow/MeterShadowElement.cpp +++ b/Source/WebCore/html/shadow/MeterShadowElement.cpp @@ -29,9 +29,9 @@ */ #include "config.h" -#if ENABLE(METER_TAG) #include "MeterShadowElement.h" +#if ENABLE(METER_ELEMENT) #include "CSSPropertyNames.h" #include "HTMLMeterElement.h" #include "HTMLNames.h" diff --git a/Source/WebCore/html/shadow/MeterShadowElement.h b/Source/WebCore/html/shadow/MeterShadowElement.h index c36b01b24..6b8bf62ae 100644 --- a/Source/WebCore/html/shadow/MeterShadowElement.h +++ b/Source/WebCore/html/shadow/MeterShadowElement.h @@ -31,6 +31,7 @@ #ifndef MeterShadowElement_h #define MeterShadowElement_h +#if ENABLE(METER_ELEMENT) #include "HTMLDivElement.h" #include <wtf/Forward.h> @@ -82,5 +83,5 @@ inline PassRefPtr<MeterValueElement> MeterValueElement::create(Document* documen } } - -#endif +#endif // ENABLE(METER_ELEMENT) +#endif // MeterShadowElement_h diff --git a/Source/WebCore/html/shadow/ProgressShadowElement.cpp b/Source/WebCore/html/shadow/ProgressShadowElement.cpp index 548571302..780815212 100644 --- a/Source/WebCore/html/shadow/ProgressShadowElement.cpp +++ b/Source/WebCore/html/shadow/ProgressShadowElement.cpp @@ -29,9 +29,9 @@ */ #include "config.h" -#if ENABLE(PROGRESS_TAG) #include "ProgressShadowElement.h" +#if ENABLE(PROGRESS_ELEMENT) #include "HTMLNames.h" #include "HTMLProgressElement.h" #include "RenderObject.h" @@ -78,4 +78,3 @@ void ProgressValueElement::setWidthPercentage(double width) } #endif - diff --git a/Source/WebCore/html/shadow/ProgressShadowElement.h b/Source/WebCore/html/shadow/ProgressShadowElement.h index e135c71da..aff94fba3 100644 --- a/Source/WebCore/html/shadow/ProgressShadowElement.h +++ b/Source/WebCore/html/shadow/ProgressShadowElement.h @@ -32,6 +32,7 @@ #ifndef ProgressShadowElement_h #define ProgressShadowElement_h +#if ENABLE(PROGRESS_ELEMENT) #include "HTMLDivElement.h" #include <wtf/Forward.h> @@ -83,5 +84,5 @@ inline PassRefPtr<ProgressValueElement> ProgressValueElement::create(Document* d } } - -#endif +#endif // ENABLE(PROGRESS_ELEMENT) +#endif // ProgressShadowElement_h diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index 0186fa57d..bb5948690 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -74,7 +74,7 @@ inline static bool hasVerticalAppearance(HTMLInputElement* input) SliderThumbElement* sliderThumbElementOf(Node* node) { ASSERT(node); - ShadowRoot* shadow = node->toInputElement()->shadow()->oldestShadowRoot(); + ShadowRoot* shadow = node->toInputElement()->userAgentShadowRoot(); ASSERT(shadow); Node* thumb = shadow->firstChild()->firstChild()->firstChild(); ASSERT(thumb); @@ -148,19 +148,38 @@ void RenderSliderContainer::layout() // Sets the concrete height if the height of the <input> is not fixed or a // percentage value because a percentage height value of this box won't be // based on the <input> height in such case. - Length inputHeight = input->renderer()->style()->height(); - RenderObject* trackRenderer = node()->firstChild()->renderer(); - if (!isVertical && input->renderer()->isSlider() && !inputHeight.isFixed() && !inputHeight.isPercent()) { - RenderObject* thumbRenderer = input->shadow()->oldestShadowRoot()->firstChild()->firstChild()->firstChild()->renderer(); - if (thumbRenderer) { - style()->setHeight(thumbRenderer->style()->height()); - if (trackRenderer) - trackRenderer->style()->setHeight(thumbRenderer->style()->height()); + if (input->renderer()->isSlider()) { + if (!isVertical) { + RenderObject* trackRenderer = node()->firstChild()->renderer(); + Length inputHeight = input->renderer()->style()->height(); + if (!inputHeight.isSpecified()) { + RenderObject* thumbRenderer = input->sliderThumbElement()->renderer(); + if (thumbRenderer) { + Length height = thumbRenderer->style()->height(); +#if ENABLE(DATALIST_ELEMENT) + if (input && input->list()) { + int offsetFromCenter = theme()->sliderTickOffsetFromTrackCenter(); + int trackHeight = 0; + if (offsetFromCenter < 0) + trackHeight = -2 * offsetFromCenter; + else { + int tickLength = theme()->sliderTickSize().height(); + trackHeight = 2 * (offsetFromCenter + tickLength); + } + float zoomFactor = style()->effectiveZoom(); + if (zoomFactor != 1.0) + trackHeight *= zoomFactor; + height = Length(trackHeight, Fixed); + } +#endif + style()->setHeight(height); + } + } else { + style()->setHeight(Length(100, Percent)); + if (trackRenderer) + trackRenderer->style()->setHeight(Length()); + } } - } else { - style()->setHeight(Length(100, Percent)); - if (trackRenderer) - trackRenderer->style()->setHeight(Length()); } RenderDeprecatedFlexibleBox::layout(); @@ -405,8 +424,7 @@ const AtomicString& TrackLimiterElement::shadowPseudoId() const TrackLimiterElement* trackLimiterElementOf(Node* node) { ASSERT(node); - ASSERT(node->toInputElement()->shadow()); - ShadowRoot* shadow = node->toInputElement()->shadow()->oldestShadowRoot(); + ShadowRoot* shadow = node->toInputElement()->userAgentShadowRoot(); ASSERT(shadow); Node* limiter = shadow->firstChild()->lastChild(); ASSERT(limiter); diff --git a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp index 9423aa8d2..09cc7b1d4 100644 --- a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp +++ b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp @@ -116,9 +116,10 @@ void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible) inline HTMLInputElement* TextFieldDecorationElement::hostInput() { - ASSERT(shadowAncestorNode()); - ASSERT(shadowAncestorNode()->hasTagName(inputTag)); - return static_cast<HTMLInputElement*>(shadowAncestorNode()); + // TextFieldDecorationElement is created only by C++ code, and it is always + // in <input> shadow. + ASSERT(!shadowHost() || shadowHost()->hasTagName(inputTag)); + return static_cast<HTMLInputElement*>(shadowHost()); } bool TextFieldDecorationElement::isTextFieldDecoration() const @@ -181,7 +182,7 @@ bool TextFieldDecorationElement::isMouseFocusable() const void TextFieldDecorationElement::defaultEventHandler(Event* event) { RefPtr<HTMLInputElement> input(hostInput()); - if (input->disabled() || input->readOnly() || !event->isMouseEvent()) { + if (!input || input->disabled() || input->readOnly() || !event->isMouseEvent()) { if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); return; diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index b3a5f4151..ec3812b16 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -2953,18 +2953,45 @@ def flatten_list(input): return res +# A writer that only updates file if it actually changed to better support incremental build. +class SmartOutput: + def __init__(self, file_name): + self.file_name_ = file_name + self.output_ = "" + + def write(self, text): + self.output_ += text + + def close(self): + text_changed = True + + try: + read_file = open(self.file_name_, "r") + old_text = read_file.read() + read_file.close() + text_changed = old_text != self.output_ + except: + # Ignore, just overwrite by default + pass + + if text_changed: + out_file = open(self.file_name_, "w") + out_file.write(self.output_) + out_file.close() + + Generator.go() -backend_h_file = open(output_header_dirname + "/InspectorBackendDispatcher.h", "w") -backend_cpp_file = open(output_cpp_dirname + "/InspectorBackendDispatcher.cpp", "w") +backend_h_file = SmartOutput(output_header_dirname + "/InspectorBackendDispatcher.h") +backend_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorBackendDispatcher.cpp") -frontend_h_file = open(output_header_dirname + "/InspectorFrontend.h", "w") -frontend_cpp_file = open(output_cpp_dirname + "/InspectorFrontend.cpp", "w") +frontend_h_file = SmartOutput(output_header_dirname + "/InspectorFrontend.h") +frontend_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorFrontend.cpp") -typebuilder_h_file = open(output_header_dirname + "/InspectorTypeBuilder.h", "w") -typebuilder_cpp_file = open(output_cpp_dirname + "/InspectorTypeBuilder.cpp", "w") +typebuilder_h_file = SmartOutput(output_header_dirname + "/InspectorTypeBuilder.h") +typebuilder_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorTypeBuilder.cpp") -backend_js_file = open(output_cpp_dirname + "/InspectorBackendCommands.js", "w") +backend_js_file = SmartOutput(output_cpp_dirname + "/InspectorBackendCommands.js") backend_h_file.write(Templates.backend_h.substitute(None, @@ -3007,4 +3034,7 @@ backend_cpp_file.close() frontend_h_file.close() frontend_cpp_file.close() +typebuilder_h_file.close() +typebuilder_cpp_file.close() + backend_js_file.close() diff --git a/Source/WebCore/inspector/DOMNodeHighlighter.cpp b/Source/WebCore/inspector/DOMNodeHighlighter.cpp index e4c7100d6..46c99cf3d 100644 --- a/Source/WebCore/inspector/DOMNodeHighlighter.cpp +++ b/Source/WebCore/inspector/DOMNodeHighlighter.cpp @@ -39,6 +39,7 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "GraphicsTypes.h" +#include "InspectorClient.h" #include "Node.h" #include "Page.h" #include "Range.h" @@ -462,9 +463,9 @@ static void getOrDrawNodeHighlight(GraphicsContext* context, HighlightData* high drawElementTitle(*context, node, renderer, pixelSnappedIntRect(boundingBox), pixelSnappedIntRect(titleAnchorBox), visibleRect, containingFrame->settings()); } -static void getOrDrawRectHighlight(GraphicsContext* context, Document* document, HighlightData* highlightData, Highlight *highlight) +static void getOrDrawRectHighlight(GraphicsContext* context, Page* page, HighlightData* highlightData, Highlight *highlight) { - if (!document) + if (!page) return; FloatRect highlightRect(*(highlightData->rect)); @@ -473,7 +474,7 @@ static void getOrDrawRectHighlight(GraphicsContext* context, Document* document, highlight->quads.append(highlightRect); if (context) { - FrameView* view = document->frame()->view(); + FrameView* view = page->mainFrame()->view(); if (!view->delegatesScrolling()) { FloatRect visibleRect = view->visibleContentRect(); context->translate(-visibleRect.x(), -visibleRect.y()); @@ -485,44 +486,132 @@ static void getOrDrawRectHighlight(GraphicsContext* context, Document* document, } // anonymous namespace -namespace DOMNodeHighlighter { +InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client) + : m_page(page) + , m_client(client) +{ +} -void drawHighlight(GraphicsContext& context, Document* document, HighlightData* highlightData) +void InspectorOverlay::paint(GraphicsContext& context) { - if (!highlightData) - return; + drawPausedInDebugger(context); + drawHighlight(context); +} - Highlight highlight; - if (highlightData->node) - getOrDrawNodeHighlight(&context, highlightData, &highlight); - else if (highlightData->rect) - getOrDrawRectHighlight(&context, document, highlightData, &highlight); +void InspectorOverlay::drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color) +{ + FloatRect outlineRect = rect; + drawOutlinedQuad(context, outlineRect, Color(), color); } -void getHighlight(Document* document, HighlightData* highlightData, Highlight* highlight) +void InspectorOverlay::getHighlight(Highlight* highlight) const { - if (!highlightData) + if (!m_highlightData) return; - highlight->contentColor = highlightData->content; - highlight->paddingColor = highlightData->padding; - highlight->borderColor = highlightData->border; - highlight->marginColor = highlightData->margin; + highlight->contentColor = m_highlightData->content; + highlight->paddingColor = m_highlightData->padding; + highlight->borderColor = m_highlightData->border; + highlight->marginColor = m_highlightData->margin; highlight->type = HighlightTypeRects; - if (highlightData->node) - getOrDrawNodeHighlight(0, highlightData, highlight); - else if (highlightData->rect) - getOrDrawRectHighlight(0, document, highlightData, highlight); + if (m_highlightData->node) + getOrDrawNodeHighlight(0, m_highlightData.get(), highlight); + else if (m_highlightData->rect) + getOrDrawRectHighlight(0, m_page, m_highlightData.get(), highlight); } -void drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color) +void InspectorOverlay::setPausedInDebuggerMessage(const String* message) { - FloatRect outlineRect = rect; - drawOutlinedQuad(context, outlineRect, Color(), color); + m_pausedInDebuggerMessage = message ? *message : String(); + update(); } -} // namespace DOMNodeHighlighter +void InspectorOverlay::hideHighlight() +{ + if (m_highlightData) { + // FIXME: Clear entire highlight data here, store config upon setInspectModeEnabled + m_highlightData->rect.clear(); + m_highlightData->node.clear(); + } + update(); +} + +void InspectorOverlay::highlightNode(Node* node) +{ + if (m_highlightData) + m_highlightData->node = node; + update(); +} + +void InspectorOverlay::setHighlightData(PassOwnPtr<HighlightData> highlightData) +{ + m_highlightData = highlightData; + update(); +} + +void InspectorOverlay::clearHighlightData() +{ + m_highlightData.clear(); + update(); +} + +Node* InspectorOverlay::highlightedNode() const +{ + return m_highlightData ? m_highlightData->node.get() : 0; +} + +void InspectorOverlay::update() +{ + if (m_highlightData || !m_pausedInDebuggerMessage.isNull()) + m_client->highlight(); + else + m_client->hideHighlight(); +} + +void InspectorOverlay::drawHighlight(GraphicsContext& context) +{ + if (!m_highlightData || (!m_highlightData->rect && !m_highlightData->node)) + return; + + Highlight highlight; + if (m_highlightData->node) + getOrDrawNodeHighlight(&context, m_highlightData.get(), &highlight); + else if (m_highlightData->rect) + getOrDrawRectHighlight(&context, m_page, m_highlightData.get(), &highlight); +} + +void InspectorOverlay::drawPausedInDebugger(GraphicsContext& context) +{ + if (m_pausedInDebuggerMessage.isNull()) + return; + + DEFINE_STATIC_LOCAL(Color, backgroundColor, (0, 0, 0, 31)); + DEFINE_STATIC_LOCAL(Color, textBackgroundColor, (255, 255, 194)); + DEFINE_STATIC_LOCAL(Color, borderColor, (128, 128, 128)); + + Frame* frame = m_page->mainFrame(); + Settings* settings = frame->settings(); + IntRect visibleRect = frame->view()->visibleContentRect(); + + context.setFillColor(backgroundColor, ColorSpaceDeviceRGB); + context.fillRect(visibleRect); + + FontDescription desc; + setUpFontDescription(desc, settings); + Font font = Font(desc, 0, 0); + font.update(0); + + TextRun textRun(m_pausedInDebuggerMessage); + IntRect titleRect = enclosingIntRect(font.selectionRectForText(textRun, IntPoint(), fontHeightPx)); + titleRect.inflate(rectInflatePx); + titleRect.setLocation(IntPoint(visibleRect.width() / 2 - titleRect.width() / 2, 0)); + + context.setFillColor(textBackgroundColor, ColorSpaceDeviceRGB); + context.setStrokeColor(borderColor, ColorSpaceDeviceRGB); + context.drawRect(titleRect); + drawSubstring(textRun, 0, m_pausedInDebuggerMessage.length(), Color::black, font, context, titleRect); +} } // namespace WebCore diff --git a/Source/WebCore/inspector/DOMNodeHighlighter.h b/Source/WebCore/inspector/DOMNodeHighlighter.h index f7b6f00f4..a200ccc9b 100644 --- a/Source/WebCore/inspector/DOMNodeHighlighter.h +++ b/Source/WebCore/inspector/DOMNodeHighlighter.h @@ -32,18 +32,21 @@ #include "Color.h" #include "FloatQuad.h" #include "LayoutTypes.h" +#include "Node.h" #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> namespace WebCore { class Color; -class Document; -class FrameView; class GraphicsContext; +class InspectorClient; +class IntRect; class Node; +class Page; struct HighlightData { Color content; @@ -75,13 +78,38 @@ struct Highlight { Vector<FloatQuad> quads; }; -namespace DOMNodeHighlighter { +class InspectorOverlay { +public: + static PassOwnPtr<InspectorOverlay> create(Page* page, InspectorClient* client) + { + return adoptPtr(new InspectorOverlay(page, client)); + } -void drawHighlight(GraphicsContext&, Document*, HighlightData*); -void getHighlight(Document*, HighlightData*, Highlight*); -void drawOutline(GraphicsContext&, const LayoutRect&, const Color&); + void paint(GraphicsContext&); + void drawOutline(GraphicsContext&, const LayoutRect&, const Color&); + void getHighlight(Highlight*) const; -} // namespace DOMNodeHighlighter + void setPausedInDebuggerMessage(const String*); + + void hideHighlight(); + void highlightNode(Node*); + void setHighlightData(PassOwnPtr<HighlightData>); + void clearHighlightData(); + + Node* highlightedNode() const; + +private: + InspectorOverlay(Page*, InspectorClient*); + + void update(); + void drawHighlight(GraphicsContext&); + void drawPausedInDebugger(GraphicsContext&); + + Page* m_page; + InspectorClient* m_client; + String m_pausedInDebuggerMessage; + OwnPtr<HighlightData> m_highlightData; +}; } // namespace WebCore diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp index 59858d977..e49f993d3 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.cpp +++ b/Source/WebCore/inspector/InjectedScriptHost.cpp @@ -77,7 +77,6 @@ InjectedScriptHost::InjectedScriptHost() #endif , m_domStorageAgent(0) , m_domAgent(0) - , m_lastWorkerId(1 << 31) // Distinguish ids of fake workers from real ones, to minimize the chances they overlap. { m_defaultInspectableObject = adoptPtr(new InspectableObject()); } @@ -164,25 +163,6 @@ String InjectedScriptHost::storageIdImpl(Storage* storage) return String(); } -#if ENABLE(WORKERS) -long InjectedScriptHost::nextWorkerId() -{ - return ++m_lastWorkerId; -} - -void InjectedScriptHost::didCreateWorker(long id, const String& url, bool isSharedWorker) -{ - if (m_inspectorAgent) - m_inspectorAgent->didCreateWorker(static_cast<int>(id), url, isSharedWorker); -} - -void InjectedScriptHost::didDestroyWorker(long id) -{ - if (m_inspectorAgent) - m_inspectorAgent->didDestroyWorker(static_cast<int>(id)); -} -#endif // ENABLE(WORKERS) - #if ENABLE(JAVASCRIPT_DEBUGGER) ScriptDebugServer& InjectedScriptHost::scriptDebugServer() { diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h index 4e9a82102..ab50fb939 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.h +++ b/Source/WebCore/inspector/InjectedScriptHost.h @@ -109,11 +109,6 @@ public: String databaseIdImpl(Database*); #endif String storageIdImpl(Storage*); -#if ENABLE(WORKERS) - long nextWorkerId(); - void didCreateWorker(long id, const String& url, bool isSharedWorker); - void didDestroyWorker(long id); -#endif #if ENABLE(JAVASCRIPT_DEBUGGER) ScriptDebugServer& scriptDebugServer(); @@ -132,7 +127,6 @@ private: #if ENABLE(JAVASCRIPT_DEBUGGER) InspectorDebuggerAgent* m_debuggerAgent; #endif - long m_lastWorkerId; Vector<OwnPtr<InspectableObject> > m_inspectedObjects; OwnPtr<InspectableObject> m_defaultInspectableObject; }; diff --git a/Source/WebCore/inspector/InjectedScriptHost.idl b/Source/WebCore/inspector/InjectedScriptHost.idl index 54f080f2c..71b88b137 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.idl +++ b/Source/WebCore/inspector/InjectedScriptHost.idl @@ -47,11 +47,6 @@ module core { [Custom] DOMString databaseId(in DOMObject database); [Custom] DOMString storageId(in DOMObject storage); - -#if defined(ENABLE_WORKERS) && ENABLE_WORKERS - void didCreateWorker(in long id, in DOMString url, in boolean isFakeWorker); - void didDestroyWorker(in long id); - long nextWorkerId(); -#endif }; } + diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index d178d9d2d..7176abb8c 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -28,20 +28,6 @@ { "name": "object", "$ref": "Runtime.RemoteObject" }, { "name": "hints", "type": "object" } ] - }, - { - "name": "didCreateWorker", - "parameters": [ - { "name": "id", "type": "integer" }, - { "name": "url", "type": "string" }, - { "name": "isShared", "type": "boolean" } - ] - }, - { - "name": "didDestroyWorker", - "parameters": [ - { "name": "id", "type": "integer" } - ] } ] }, @@ -2287,6 +2273,17 @@ "returns": [ { "name": "profile", "$ref": "SelectorProfile" } ] + }, + { + "name": "getNamedFlowCollection", + "parameters": [ + { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id for which to get the Named Flow Collection."} + ], + "returns": [ + { "name": "namedFlows", "type": "array", "items": { "type": "string" }, "description": "An array containing the Named Flows in the document." } + ], + "description": "Returns the Named Flows from the document.", + "hidden": true } ], "events": [ @@ -2630,6 +2627,14 @@ { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the script run." } ], "description": "Runs script with given id in a given context." + }, + { + "name": "setOverlayMessage", + "parameters": [ + { "name": "message", "type": "string", "optional": true, "description": "Overlay message to display when paused in debugger." } + ], + "hidden": true, + "description": "Sets overlay message." } ], "events": [ diff --git a/Source/WebCore/inspector/InspectorAgent.cpp b/Source/WebCore/inspector/InspectorAgent.cpp index b3aa3bcf6..5c28ca778 100644 --- a/Source/WebCore/inspector/InspectorAgent.cpp +++ b/Source/WebCore/inspector/InspectorAgent.cpp @@ -45,7 +45,6 @@ #include "InspectorInstrumentation.h" #include "InspectorState.h" #include "InspectorValues.h" -#include "InspectorWorkerResource.h" #include "InstrumentingAgents.h" #include "Page.h" #include "ResourceRequest.h" @@ -113,23 +112,12 @@ void InspectorAgent::didCommitLoad() { m_didCommitLoadFired = true; m_injectedScriptManager->discardInjectedScripts(); -#if ENABLE(WORKERS) - m_workers.clear(); -#endif } void InspectorAgent::enable(ErrorString*) { m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, true); -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS) - WorkersMap::iterator workersEnd = m_workers.end(); - for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) { - InspectorWorkerResource* worker = it->second.get(); - m_frontend->inspector()->didCreateWorker(static_cast<int>(worker->id()), worker->url(), worker->isSharedWorker()); - } -#endif - if (m_pendingInspectData.first) inspect(m_pendingInspectData.first, m_pendingInspectData.second); @@ -153,36 +141,6 @@ bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& re return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL(); } -#if ENABLE(WORKERS) -void InspectorAgent::didCreateWorker(intptr_t id, const String& url, bool isSharedWorker) -{ - if (!developerExtrasEnabled()) - return; - - RefPtr<InspectorWorkerResource> workerResource(InspectorWorkerResource::create(id, url, isSharedWorker)); - m_workers.set(id, workerResource); -#if ENABLE(JAVASCRIPT_DEBUGGER) - if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) - m_frontend->inspector()->didCreateWorker(static_cast<int>(id), url, isSharedWorker); -#endif -} - -void InspectorAgent::didDestroyWorker(intptr_t id) -{ - if (!developerExtrasEnabled()) - return; - - WorkersMap::iterator workerResource = m_workers.find(id); - if (workerResource == m_workers.end()) - return; -#if ENABLE(JAVASCRIPT_DEBUGGER) - if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) - m_frontend->inspector()->didDestroyWorker(static_cast<int>(id)); -#endif - m_workers.remove(workerResource); -} -#endif // ENABLE(WORKERS) - void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script) { if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) diff --git a/Source/WebCore/inspector/InspectorAgent.h b/Source/WebCore/inspector/InspectorAgent.h index 52f31e2c8..d510a4db9 100644 --- a/Source/WebCore/inspector/InspectorAgent.h +++ b/Source/WebCore/inspector/InspectorAgent.h @@ -45,7 +45,6 @@ class Frame; class InjectedScriptManager; class InspectorFrontend; class InspectorObject; -class InspectorWorkerResource; class InstrumentingAgents; class KURL; class Page; @@ -82,11 +81,6 @@ public: void domContentLoadedEventFired(); bool didCommitLoadFired() { return m_didCommitLoadFired; } -#if ENABLE(WORKERS) - void didCreateWorker(intptr_t, const String& url, bool isSharedWorker); - void didDestroyWorker(intptr_t); -#endif - bool hasFrontend() const { return m_frontend; } // Generic code called from custom implementations. @@ -115,10 +109,6 @@ private: pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject> > m_pendingInspectData; typedef HashMap<String, String> InjectedScriptForOriginMap; InjectedScriptForOriginMap m_injectedScriptForOrigin; -#if ENABLE(WORKERS) - typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap; - WorkersMap m_workers; -#endif bool m_didCommitLoadFired; }; diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp index a54d8c9c7..b2ec10cdc 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.cpp +++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp @@ -51,6 +51,7 @@ #include "StyleResolver.h" #include "StyleRule.h" #include "StyleSheetList.h" +#include "WebKitNamedFlowCollection.h" #include <wtf/CurrentTime.h> #include <wtf/HashSet.h> @@ -787,6 +788,21 @@ void InspectorCSSAgent::getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuild cssProperties = properties.release(); } +void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int nodeId, RefPtr<TypeBuilder::Array<String> >& result) +{ + Document* document = m_domAgent->assertDocument(errorString, nodeId); + if (!document) + return; + + Vector<String> namedFlowsVector = document->namedFlows()->namedFlowsNames(); + RefPtr<TypeBuilder::Array<String> > namedFlows = TypeBuilder::Array<String>::create(); + + for (Vector<String>::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it) + namedFlows->addItem(*it); + + result = namedFlows.release(); +} + void InspectorCSSAgent::startSelectorProfiler(ErrorString*) { m_currentSelectorProfile = adoptPtr(new SelectorProfile()); diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h index 791a7bf18..9ceaf3b24 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.h +++ b/Source/WebCore/inspector/InspectorCSSAgent.h @@ -110,6 +110,7 @@ public: virtual void setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result); virtual void addRule(ErrorString*, int contextNodeId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result); virtual void getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<String> >& result); + virtual void getNamedFlowCollection(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<String> >& result); virtual void startSelectorProfiler(ErrorString*); virtual void stopSelectorProfiler(ErrorString*, RefPtr<TypeBuilder::CSS::SelectorProfile>&); diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index 912bbaad6..c3f9f08b3 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -34,6 +34,7 @@ #include "InspectorController.h" +#include "DOMNodeHighlighter.h" #include "Frame.h" #include "GraphicsContext.h" #include "IdentifiersFactory.h" @@ -78,6 +79,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC : m_instrumentingAgents(adoptPtr(new InstrumentingAgents())) , m_injectedScriptManager(InjectedScriptManager::createForPage()) , m_state(adoptPtr(new InspectorState(inspectorClient))) + , m_overlay(InspectorOverlay::create(page, inspectorClient)) , m_page(page) , m_inspectorClient(inspectorClient) { @@ -85,12 +87,12 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC m_inspectorAgent = inspectorAgentPtr.get(); m_agents.append(inspectorAgentPtr.release()); - OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), inspectorClient)); + OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), inspectorClient, m_overlay.get())); InspectorPageAgent* pageAgent = pageAgentPtr.get(); m_pageAgent = pageAgentPtr.get(); m_agents.append(pageAgentPtr.release()); - OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get(), m_injectedScriptManager.get())); + OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), m_injectedScriptManager.get(), m_overlay.get())); m_domAgent = domAgentPtr.get(); m_agents.append(domAgentPtr.release()); @@ -130,7 +132,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC m_agents.append(consoleAgentPtr.release()); #if ENABLE(JAVASCRIPT_DEBUGGER) - OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get())); + OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get(), m_overlay.get())); m_debuggerAgent = debuggerAgentPtr.get(); m_agents.append(debuggerAgentPtr.release()); @@ -297,12 +299,12 @@ void InspectorController::evaluateForTestInFrontend(long callId, const String& s void InspectorController::drawHighlight(GraphicsContext& context) const { - m_domAgent->drawHighlight(context); + m_overlay->paint(context); } void InspectorController::getHighlight(Highlight* highlight) const { - m_domAgent->getHighlight(highlight); + m_overlay->getHighlight(highlight); } void InspectorController::inspect(Node* node) @@ -344,7 +346,7 @@ void InspectorController::hideHighlight() Node* InspectorController::highlightedNode() const { - return m_domAgent->highlightedNode(); + return m_overlay->highlightedNode(); } #if ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h index b7e1cbfd8..90996e5e9 100644 --- a/Source/WebCore/inspector/InspectorController.h +++ b/Source/WebCore/inspector/InspectorController.h @@ -52,6 +52,7 @@ class InspectorDebuggerAgent; class InspectorFrontend; class InspectorFrontendChannel; class InspectorFrontendClient; +class InspectorOverlay; class InspectorPageAgent; class InspectorProfilerAgent; class InspectorResourceAgent; @@ -120,6 +121,7 @@ private: OwnPtr<InstrumentingAgents> m_instrumentingAgents; OwnPtr<InjectedScriptManager> m_injectedScriptManager; OwnPtr<InspectorState> m_state; + OwnPtr<InspectorOverlay> m_overlay; InspectorAgent* m_inspectorAgent; InspectorDOMAgent* m_domAgent; diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index 9079589e5..91a38310f 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -66,7 +66,6 @@ #include "HitTestResult.h" #include "IdentifiersFactory.h" #include "InjectedScriptManager.h" -#include "InspectorClient.h" #include "InspectorFrontend.h" #include "InspectorHistory.h" #include "InspectorPageAgent.h" @@ -194,11 +193,11 @@ String InspectorDOMAgent::toErrorString(const ExceptionCode& ec) return ""; } -InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager) +InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) : InspectorBaseAgent<InspectorDOMAgent>("DOM", instrumentingAgents, inspectorState) , m_pageAgent(pageAgent) - , m_client(client) , m_injectedScriptManager(injectedScriptManager) + , m_overlay(overlay) , m_frontend(0) , m_domListener(0) , m_lastNodeId(1) @@ -210,7 +209,6 @@ InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, I InspectorDOMAgent::~InspectorDOMAgent() { reset(); - ASSERT(!m_highlightData || (!m_highlightData->node && !m_highlightData->rect)); ASSERT(!m_searchingForNode); } @@ -270,11 +268,6 @@ Vector<Document*> InspectorDOMAgent::documents() return result; } -Node* InspectorDOMAgent::highlightedNode() const -{ - return m_highlightData ? m_highlightData->node.get() : 0; -} - void InspectorDOMAgent::reset() { if (m_history) @@ -375,6 +368,19 @@ Node* InspectorDOMAgent::assertNode(ErrorString* errorString, int nodeId) return node; } +Document* InspectorDOMAgent::assertDocument(ErrorString* errorString, int nodeId) +{ + Node* node = assertNode(errorString, nodeId); + if (!node) + return 0; + + if (!(node->isDocumentNode())) { + *errorString = "Document is not available"; + return 0; + } + return static_cast<Document*>(node); +} + Element* InspectorDOMAgent::assertElement(ErrorString* errorString, int nodeId) { Node* node = assertNode(errorString, nodeId); @@ -938,11 +944,11 @@ bool InspectorDOMAgent::handleMousePress() if (!m_searchingForNode) return false; - if (m_highlightData && m_highlightData->node) { - RefPtr<Node> node = m_highlightData->node; - inspect(node.get()); + if (Node* node = m_overlay->highlightedNode()) { + inspect(node); + return true; } - return true; + return false; } void InspectorDOMAgent::inspect(Node* node) @@ -982,16 +988,14 @@ void InspectorDOMAgent::focusNode() void InspectorDOMAgent::mouseDidMoveOverElement(const HitTestResult& result, unsigned) { - if (!m_searchingForNode || !m_highlightData) + if (!m_searchingForNode) return; Node* node = result.innerNode(); while (node && node->nodeType() == Node::TEXT_NODE) node = node->parentNode(); - if (node) { - m_highlightData->node = node; - highlight(); - } + if (node) + m_overlay->highlightNode(node); } void InspectorDOMAgent::setSearchingForNode(bool enabled, InspectorObject* highlightConfig) @@ -1004,48 +1008,42 @@ void InspectorDOMAgent::setSearchingForNode(bool enabled, InspectorObject* highl else { ErrorString error; hideHighlight(&error); - m_highlightData.clear(); + m_overlay->clearHighlightData(); } } -void InspectorDOMAgent::setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig) -{ - setSearchingForNode(enabled, highlightConfig ? highlightConfig->get() : 0); -} - bool InspectorDOMAgent::setHighlightDataFromConfig(InspectorObject* highlightConfig) { if (!highlightConfig) { - m_highlightData.clear(); + m_overlay->clearHighlightData(); return false; } - m_highlightData = adoptPtr(new HighlightData()); + OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); bool showInfo = false; // Default: false (do not show a tooltip). highlightConfig->getBoolean("showInfo", &showInfo); - m_highlightData->showInfo = showInfo; - m_highlightData->content = parseConfigColor("contentColor", highlightConfig); - m_highlightData->contentOutline = parseConfigColor("contentOutlineColor", highlightConfig); - m_highlightData->padding = parseConfigColor("paddingColor", highlightConfig); - m_highlightData->border = parseConfigColor("borderColor", highlightConfig); - m_highlightData->margin = parseConfigColor("marginColor", highlightConfig); + highlightData->showInfo = showInfo; + highlightData->content = parseConfigColor("contentColor", highlightConfig); + highlightData->contentOutline = parseConfigColor("contentOutlineColor", highlightConfig); + highlightData->padding = parseConfigColor("paddingColor", highlightConfig); + highlightData->border = parseConfigColor("borderColor", highlightConfig); + highlightData->margin = parseConfigColor("marginColor", highlightConfig); + m_overlay->setHighlightData(highlightData.release()); return true; } -void InspectorDOMAgent::highlight() +void InspectorDOMAgent::setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig) { - // This method requires m_highlightData to have been filled in by its client. - ASSERT(m_highlightData); - m_client->highlight(); + setSearchingForNode(enabled, highlightConfig ? highlightConfig->get() : 0); } void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor) { - m_highlightData = adoptPtr(new HighlightData()); - m_highlightData->rect = adoptPtr(new IntRect(x, y, width, height)); - m_highlightData->content = parseColor(color); - m_highlightData->contentOutline = parseColor(outlineColor); - m_client->highlight(); + OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); + highlightData->rect = adoptPtr(new IntRect(x, y, width, height)); + highlightData->content = parseColor(color); + highlightData->contentOutline = parseColor(outlineColor); + m_overlay->setHighlightData(highlightData.release()); } void InspectorDOMAgent::highlightNode( @@ -1053,12 +1051,9 @@ void InspectorDOMAgent::highlightNode( int nodeId, const RefPtr<InspectorObject>& highlightConfig) { - if (Node* node = nodeForId(nodeId)) { - if (setHighlightDataFromConfig(highlightConfig.get())) { - m_highlightData->node = node; - highlight(); - } - } + if (Node* node = nodeForId(nodeId)) + if (setHighlightDataFromConfig(highlightConfig.get())) + m_overlay->highlightNode(node); } void InspectorDOMAgent::highlightFrame( @@ -1069,22 +1064,18 @@ void InspectorDOMAgent::highlightFrame( { Frame* frame = m_pageAgent->frameForId(frameId); if (frame && frame->ownerElement()) { - m_highlightData = adoptPtr(new HighlightData()); - m_highlightData->node = frame->ownerElement(); - m_highlightData->showInfo = true; // Always show tooltips for frames. - m_highlightData->content = parseColor(color); - m_highlightData->contentOutline = parseColor(outlineColor); - highlight(); + OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); + highlightData->node = frame->ownerElement(); + highlightData->showInfo = true; // Always show tooltips for frames. + highlightData->content = parseColor(color); + highlightData->contentOutline = parseColor(outlineColor); + m_overlay->setHighlightData(highlightData.release()); } } void InspectorDOMAgent::hideHighlight(ErrorString*) { - if (m_highlightData) { - m_highlightData->node.clear(); - m_highlightData->rect.clear(); - } - m_client->hideHighlight(); + m_overlay->hideHighlight(); } void InspectorDOMAgent::moveTo(ErrorString* errorString, int nodeId, int targetElementId, const int* const anchorNodeId, int* newNodeId) @@ -1599,22 +1590,6 @@ PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(No return injectedScript.wrapNode(node, objectGroup); } -void InspectorDOMAgent::drawHighlight(GraphicsContext& context) const -{ - if (!m_highlightData) - return; - - DOMNodeHighlighter::drawHighlight(context, m_highlightData->node ? m_highlightData->node->document() : m_document.get(), m_highlightData.get()); -} - -void InspectorDOMAgent::getHighlight(Highlight* highlight) const -{ - if (!m_highlightData) - return; - - DOMNodeHighlighter::getHighlight(m_highlightData->node ? m_highlightData->node->document() : m_document.get(), m_highlightData.get(), highlight); -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h index b05ab570d..ac478cce0 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/InspectorDOMAgent.h @@ -55,12 +55,10 @@ class DOMEditor; class Document; class Element; class Event; -class GraphicsContext; -class InspectorClient; class InspectorFrontend; class InspectorHistory; +class InspectorOverlay; class InspectorPageAgent; -class IntRect; class HitTestResult; class HTMLElement; class InspectorState; @@ -71,9 +69,6 @@ class RevalidateStyleAttributeTask; class ScriptValue; class ShadowRoot; -struct Highlight; -struct HighlightData; - typedef String ErrorString; #if ENABLE(INSPECTOR) @@ -103,9 +98,9 @@ public: virtual void didModifyDOMAttr(Element*) = 0; }; - static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager) + static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) { - return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, client, inspectorState, injectedScriptManager)); + return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, inspectorState, injectedScriptManager, overlay)); } static String toErrorString(const ExceptionCode&); @@ -151,8 +146,6 @@ public: virtual void redo(ErrorString*); virtual void markUndoableState(ErrorString*); - Node* highlightedNode() const; - void getEventListeners(Node*, Vector<EventListenerInfo>& listenersArray, bool includeAncestors); // Methods called from the InspectorInstrumentation. @@ -185,9 +178,6 @@ public: void inspect(Node*); void focusNode(); - void drawHighlight(GraphicsContext&) const; - void getHighlight(Highlight*) const; - InspectorHistory* history() { return m_history.get(); } // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. @@ -200,16 +190,16 @@ public: static bool isWhitespace(Node*); Node* assertNode(ErrorString*, int nodeId); + Document* assertDocument(ErrorString*, int nodeId); // Methods called from other agents. InspectorPageAgent* pageAgent() { return m_pageAgent; } private: - InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorClient*, InspectorState*, InjectedScriptManager*); + InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*, InjectedScriptManager*, InspectorOverlay*); void setSearchingForNode(bool enabled, InspectorObject* highlightConfig); bool setHighlightDataFromConfig(InspectorObject* highlightConfig); - void highlight(); // Node-related methods. typedef HashMap<RefPtr<Node>, int> NodeToIdMap; @@ -241,8 +231,8 @@ private: #endif InspectorPageAgent* m_pageAgent; - InspectorClient* m_client; InjectedScriptManager* m_injectedScriptManager; + InspectorOverlay* m_overlay; InspectorFrontend::DOM* m_frontend; DOMListener* m_domListener; NodeToIdMap m_documentNodeToIdMap; @@ -256,7 +246,6 @@ private: typedef HashMap<String, Vector<RefPtr<Node> > > SearchResults; SearchResults m_searchResults; OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask; - OwnPtr<HighlightData> m_highlightData; RefPtr<Node> m_nodeToFocus; bool m_searchingForNode; OwnPtr<InspectorHistory> m_history; diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp index 4c727bcc2..0ae120773 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp +++ b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp @@ -57,7 +57,6 @@ InspectorDOMStorageResource::InspectorDOMStorageResource(StorageArea* storageAre , m_frame(frame) , m_frontend(0) , m_id(String::number(s_nextUnusedId++)) - , m_reportingChangesToFrontend(false) { } diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.h b/Source/WebCore/inspector/InspectorDOMStorageResource.h index 332ef2819..9256949d5 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageResource.h +++ b/Source/WebCore/inspector/InspectorDOMStorageResource.h @@ -66,7 +66,6 @@ private: RefPtr<Frame> m_frame; InspectorFrontend::DOMStorage* m_frontend; String m_id; - bool m_reportingChangesToFrontend; static int s_nextUnusedId; }; diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp index 11807a3f9..d6e44d91a 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -570,6 +570,10 @@ void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& } } +void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*) +{ +} + PassRefPtr<Array<TypeBuilder::Debugger::CallFrame> > InspectorDebuggerAgent::currentCallFrames() { if (!m_pausedScriptState) @@ -690,6 +694,8 @@ void InspectorDebuggerAgent::clear() m_continueToLocationBreakpointId = String(); clearBreakDetails(); m_javaScriptPauseScheduled = false; + ErrorString error; + setOverlayMessage(&error, 0); } bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString) diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.h b/Source/WebCore/inspector/InspectorDebuggerAgent.h index 09c97d195..cd5b703db 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.h +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.h @@ -112,6 +112,7 @@ public: TypeBuilder::OptOutput<bool>* wasThrown); void compileScript(ErrorString*, const String& expression, const String& sourceURL, TypeBuilder::OptOutput<TypeBuilder::Debugger::ScriptId>*, TypeBuilder::OptOutput<String>* syntaxErrorMessage); void runScript(ErrorString*, const TypeBuilder::Debugger::ScriptId&, const int* executionContextId, const String* objectGroup, const bool* doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown); + virtual void setOverlayMessage(ErrorString*, const String*); class Listener { public: @@ -133,17 +134,18 @@ protected: InjectedScriptManager* injectedScriptManager() { return m_injectedScriptManager; } virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0; + virtual void disable(); + virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); + virtual void didContinue(); + private: void enable(); - void disable(); bool enabled(); PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > currentCallFrames(); virtual void didParseSource(const String& scriptId, const Script&); virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); - virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); - virtual void didContinue(); void setPauseOnExceptionsImpl(ErrorString*, int); diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index 325a4c48f..296165fd7 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -973,18 +973,6 @@ void InspectorInstrumentation::didStartWorkerContextImpl(InstrumentingAgents* in workerAgent->didStartWorkerContext(workerContextProxy, url); } -void InspectorInstrumentation::didCreateWorkerImpl(InstrumentingAgents* instrumentingAgents, intptr_t id, const String& url, bool isSharedWorker) -{ - if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent()) - inspectorAgent->didCreateWorker(id, url, isSharedWorker); -} - -void InspectorInstrumentation::didDestroyWorkerImpl(InstrumentingAgents* instrumentingAgents, intptr_t id) -{ - if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent()) - inspectorAgent->didDestroyWorker(id); -} - void InspectorInstrumentation::willEvaluateWorkerScript(WorkerContext* workerContext, int workerThreadStartMode) { if (workerThreadStartMode != PauseWorkerContextOnStart) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 4350e9ccd..fd38b44e2 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -223,8 +223,6 @@ public: #if ENABLE(WORKERS) static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*); static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, const KURL&); - static void didCreateWorker(ScriptExecutionContext*, intptr_t id, const String& url, bool isSharedWorker); - static void didDestroyWorker(ScriptExecutionContext*, intptr_t id); static void workerContextTerminated(ScriptExecutionContext*, WorkerContextProxy*); static void willEvaluateWorkerScript(WorkerContext*, int workerThreadStartMode); #endif @@ -389,8 +387,6 @@ private: #if ENABLE(WORKERS) static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*); static void didStartWorkerContextImpl(InstrumentingAgents*, WorkerContextProxy*, const KURL&); - static void didCreateWorkerImpl(InstrumentingAgents*, intptr_t id, const String& url, bool isSharedWorker); - static void didDestroyWorkerImpl(InstrumentingAgents*, intptr_t id); static void workerContextTerminatedImpl(InstrumentingAgents*, WorkerContextProxy*); #endif @@ -1250,24 +1246,6 @@ inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionConte #endif } -inline void InspectorInstrumentation::didCreateWorker(ScriptExecutionContext* context, intptr_t id, const String& url, bool isSharedWorker) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didCreateWorkerImpl(instrumentingAgents, id, url, isSharedWorker); -#endif -} - -inline void InspectorInstrumentation::didDestroyWorker(ScriptExecutionContext* context, intptr_t id) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didDestroyWorkerImpl(instrumentingAgents, id); -#endif -} - inline void InspectorInstrumentation::workerContextTerminated(ScriptExecutionContext* context, WorkerContextProxy* proxy) { #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp index ef34537f0..9676d138e 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/InspectorPageAgent.cpp @@ -223,9 +223,9 @@ bool InspectorPageAgent::sharedBufferContent(PassRefPtr<SharedBuffer> buffer, co return decodeSharedBuffer(buffer, textEncodingName, result); } -PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorClient* client) +PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) { - return adoptPtr(new InspectorPageAgent(instrumentingAgents, page, inspectorAgent, state, injectedScriptManager, client)); + return adoptPtr(new InspectorPageAgent(instrumentingAgents, page, inspectorAgent, state, injectedScriptManager, client, overlay)); } // static @@ -308,13 +308,14 @@ TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::cachedResourceTypeJson return resourceTypeJson(cachedResourceType(cachedResource)); } -InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorClient* client) +InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) : InspectorBaseAgent<InspectorPageAgent>("Page", instrumentingAgents, inspectorState) , m_page(page) , m_inspectorAgent(inspectorAgent) , m_injectedScriptManager(injectedScriptManager) , m_client(client) , m_frontend(0) + , m_overlay(overlay) , m_lastScriptIdentifier(0) , m_lastPaintContext(0) , m_didLoadEventFire(false) @@ -885,7 +886,7 @@ void InspectorPageAgent::didPaint() Color(0, 0, 0xFF, 0x3F), }; - DOMNodeHighlighter::drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]); + m_overlay->drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]); m_lastPaintContext = 0; } diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index 964bc85fc..c3b9a6d2f 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -53,6 +53,7 @@ class InspectorAgent; class InspectorArray; class InspectorClient; class InspectorObject; +class InspectorOverlay; class InspectorState; class InstrumentingAgents; class KURL; @@ -77,7 +78,7 @@ public: OtherResource }; - static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*); + static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*); static bool cachedResourceContent(CachedResource*, String* result, bool* base64Encoded); static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& textEncodingName, bool withBase64Encode, String* result); @@ -137,7 +138,7 @@ public: static DocumentLoader* assertDocumentLoader(ErrorString*, Frame*); private: - InspectorPageAgent(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*); + InspectorPageAgent(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*); void updateViewMetrics(int, int, double, bool); PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(Frame*); @@ -147,6 +148,7 @@ private: InjectedScriptManager* m_injectedScriptManager; InspectorClient* m_client; InspectorFrontend::Page* m_frontend; + InspectorOverlay* m_overlay; long m_lastScriptIdentifier; String m_pendingScriptToEvaluateOnLoadOnce; String m_scriptToEvaluateOnLoadOnce; diff --git a/Source/WebCore/inspector/PageConsoleAgent.cpp b/Source/WebCore/inspector/PageConsoleAgent.cpp index f55dda58f..b0d527541 100644 --- a/Source/WebCore/inspector/PageConsoleAgent.cpp +++ b/Source/WebCore/inspector/PageConsoleAgent.cpp @@ -35,6 +35,7 @@ #include "PageConsoleAgent.h" #include "DOMWindow.h" +#include "Document.h" #include "InjectedScriptHost.h" #include "InjectedScriptManager.h" #include "InspectorAgent.h" diff --git a/Source/WebCore/inspector/PageDebuggerAgent.cpp b/Source/WebCore/inspector/PageDebuggerAgent.cpp index a586edf3f..b646af193 100644 --- a/Source/WebCore/inspector/PageDebuggerAgent.cpp +++ b/Source/WebCore/inspector/PageDebuggerAgent.cpp @@ -35,19 +35,21 @@ #include "PageDebuggerAgent.h" #include "Console.h" +#include "DOMNodeHighlighter.h" #include "Page.h" #include "PageScriptDebugServer.h" namespace WebCore { -PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager) +PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) { - return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager)); + return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager, overlay)); } -PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager) +PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager) , m_inspectedPage(inspectedPage) + , m_overlay(overlay) { } @@ -92,6 +94,10 @@ InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString return injectedScript; } +void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message) +{ + m_overlay->setPausedInDebuggerMessage(message); +} } // namespace WebCore diff --git a/Source/WebCore/inspector/PageDebuggerAgent.h b/Source/WebCore/inspector/PageDebuggerAgent.h index 9dbd513f9..810052ea3 100644 --- a/Source/WebCore/inspector/PageDebuggerAgent.h +++ b/Source/WebCore/inspector/PageDebuggerAgent.h @@ -37,6 +37,7 @@ namespace WebCore { +class InspectorOverlay; class Page; class PageScriptDebugServer; @@ -44,7 +45,7 @@ class PageDebuggerAgent : public InspectorDebuggerAgent { WTF_MAKE_NONCOPYABLE(PageDebuggerAgent); WTF_MAKE_FAST_ALLOCATED; public: - static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*); + static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorOverlay*); virtual ~PageDebuggerAgent(); private: @@ -55,9 +56,11 @@ private: virtual void unmuteConsole(); virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId); + virtual void setOverlayMessage(ErrorString*, const String*); - PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*); + PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorOverlay*); Page* const m_inspectedPage; + InspectorOverlay* m_overlay; }; } // namespace WebCore diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index 97a61717f..37583f78a 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -283,6 +283,7 @@ modules = [ "ExtensionPanel.js", "ExtensionRegistryStub.js", "ExtensionServer.js", + "ExtensionView.js", ] }, { diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js index aaf792a12..4102d94cb 100644 --- a/Source/WebCore/inspector/front-end/CSSStyleModel.js +++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js @@ -160,6 +160,28 @@ WebInspector.CSSStyleModel.prototype = { }, /** + * @param {DOMAgent.NodeId} nodeId + * @param {function(?Array.<string>)} userCallback + */ + getNamedFlowCollectionAsync: function(nodeId, userCallback) + { + /** + * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback + * @param {?Protocol.Error} error + * @param {?Array.<string>=} namedFlowPayload + */ + function callback(userCallback, error, namedFlowPayload) + { + if (error || !namedFlowPayload) + userCallback(null); + else + userCallback(namedFlowPayload); + } + + CSSAgent.getNamedFlowCollection(nodeId, callback.bind(null, userCallback)); + }, + + /** * @param {CSSAgent.CSSRuleId} ruleId * @param {DOMAgent.NodeId} nodeId * @param {string} newSelector diff --git a/Source/WebCore/inspector/front-end/ConsolePanel.js b/Source/WebCore/inspector/front-end/ConsolePanel.js index 54ef63d68..b7af2a951 100644 --- a/Source/WebCore/inspector/front-end/ConsolePanel.js +++ b/Source/WebCore/inspector/front-end/ConsolePanel.js @@ -78,9 +78,8 @@ WebInspector.ConsolePanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { WebInspector.searchController.updateSearchMatchesCount(0, this); this.searchCanceled(); @@ -100,34 +99,20 @@ WebInspector.ConsolePanel.prototype = { this._jumpToSearchResult(0); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._searchResults || !this._searchResults.length) - return false; - if (!loop && this._currentSearchResultIndex + 1 >= this._searchResults.length) - return false; + return; this._jumpToSearchResult((this._currentSearchResultIndex + 1) % this._searchResults.length); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._searchResults || !this._searchResults.length) - return false; + return; var index = this._currentSearchResultIndex - 1; - if (index === -1) { - if (!loop) - return false; + if (index === -1) index = this._searchResults.length - 1; - } this._jumpToSearchResult(index); return true; }, diff --git a/Source/WebCore/inspector/front-end/DebuggerModel.js b/Source/WebCore/inspector/front-end/DebuggerModel.js index 23470a443..df95843ba 100644 --- a/Source/WebCore/inspector/front-end/DebuggerModel.js +++ b/Source/WebCore/inspector/front-end/DebuggerModel.js @@ -298,10 +298,13 @@ WebInspector.DebuggerModel.prototype = { this._debuggerPausedDetails = debuggerPausedDetails; if (this._debuggerPausedDetails) this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPausedDetails); - if (debuggerPausedDetails) + if (debuggerPausedDetails) { this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]); - else + DebuggerAgent.setOverlayMessage(WebInspector.UIString("Paused in debugger")); + } else { this.setSelectedCallFrame(null); + DebuggerAgent.setOverlayMessage(); + } }, /** diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js index 740185e9a..7f2f86be0 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanel.js +++ b/Source/WebCore/inspector/front-end/ElementsPanel.js @@ -294,9 +294,8 @@ WebInspector.ElementsPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { // Call searchCanceled since it will reset everything we need before doing a new search. this.searchCanceled(); @@ -493,41 +492,26 @@ WebInspector.ElementsPanel.prototype = { } }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._searchResults) - return false; + return; this._hideSearchHighlights(); - if (++this._currentSearchResultIndex >= this._searchResults.length) { - if (!loop) - return false; + if (++this._currentSearchResultIndex >= this._searchResults.length) this._currentSearchResultIndex = 0; - } - + this._highlightCurrentSearchResult(); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._searchResults) - return false; + return; this._hideSearchHighlights(); - if (--this._currentSearchResultIndex < 0) { - if (!loop) - return false; + if (--this._currentSearchResultIndex < 0) this._currentSearchResultIndex = (this._searchResults.length - 1); - } this._highlightCurrentSearchResult(); return true; diff --git a/Source/WebCore/inspector/front-end/ExtensionPanel.js b/Source/WebCore/inspector/front-end/ExtensionPanel.js index d828d336e..4cdc81c99 100644 --- a/Source/WebCore/inspector/front-end/ExtensionPanel.js +++ b/Source/WebCore/inspector/front-end/ExtensionPanel.js @@ -30,81 +30,10 @@ /** * @constructor - * @extends {WebInspector.View} - * @param {string} id - * @param {Element} parent - * @param {string} src - * @param {string} className - */ -WebInspector.ExtensionView = function(id, parent, src, className) -{ - WebInspector.View.call(this); - this.element.className = "fill"; - - this._id = id; - this._iframe = document.createElement("iframe"); - this._iframe.addEventListener("load", this._onLoad.bind(this), false); - this._iframe.src = src; - this._iframe.className = className; - - this.element.appendChild(this._iframe); - this.show(parent); -} - -WebInspector.ExtensionView.prototype = { - wasShown: function() - { - if (typeof this._frameIndex === "number") - WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); - }, - - willHide: function() - { - if (typeof this._frameIndex === "number") - WebInspector.extensionServer.notifyViewHidden(this._id); - }, - - _onLoad: function() - { - this._frameIndex = Array.prototype.indexOf.call(window.frames, this._iframe.contentWindow); - if (this.isShowing()) - WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); - } -} - -WebInspector.ExtensionView.prototype.__proto__ = WebInspector.View.prototype; - -/** - * @constructor - * @extends {WebInspector.View} - * @param {string} id - */ -WebInspector.ExtensionNotifierView = function(id) -{ - WebInspector.View.call(this); - - this._id = id; -} - -WebInspector.ExtensionNotifierView.prototype = { - wasShown: function() - { - WebInspector.extensionServer.notifyViewShown(this._id); - }, - - willHide: function() - { - WebInspector.extensionServer.notifyViewHidden(this._id); - } -} - -WebInspector.ExtensionNotifierView.prototype.__proto__ = WebInspector.View.prototype; - -/** - * @constructor * @extends {WebInspector.Panel} * @param {string} id * @param {string} label + * @param {string} pageURL * @param {string} iconURL */ WebInspector.ExtensionPanel = function(id, label, pageURL, iconURL) @@ -153,34 +82,23 @@ WebInspector.ExtensionPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PerformSearch, query); WebInspector.Panel.prototype.performSearch.apply(this, arguments); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.NextSearchResult); - WebInspector.Panel.prototype.jumpToNextSearchResult.call(this, loop); - return true; + WebInspector.Panel.prototype.jumpToNextSearchResult.call(this); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PreviousSearchResult); - WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this, loop); - return true; + WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this); }, _addStyleRule: function(selector, body) diff --git a/Source/WebCore/inspector/front-end/ExtensionView.js b/Source/WebCore/inspector/front-end/ExtensionView.js new file mode 100644 index 000000000..d79251882 --- /dev/null +++ b/Source/WebCore/inspector/front-end/ExtensionView.js @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @constructor + * @extends {WebInspector.View} + * @param {string} id + * @param {Element} parent + * @param {string} src + * @param {string} className + */ +WebInspector.ExtensionView = function(id, parent, src, className) +{ + WebInspector.View.call(this); + this.element.className = "fill"; + + this._id = id; + this._iframe = document.createElement("iframe"); + this._iframe.addEventListener("load", this._onLoad.bind(this), false); + this._iframe.src = src; + this._iframe.className = className; + + this.element.appendChild(this._iframe); + this.show(parent); +} + +WebInspector.ExtensionView.prototype = { + wasShown: function() + { + if (typeof this._frameIndex === "number") + WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); + }, + + willHide: function() + { + if (typeof this._frameIndex === "number") + WebInspector.extensionServer.notifyViewHidden(this._id); + }, + + _onLoad: function() + { + this._frameIndex = Array.prototype.indexOf.call(window.frames, this._iframe.contentWindow); + if (this.isShowing()) + WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); + } +} + +WebInspector.ExtensionView.prototype.__proto__ = WebInspector.View.prototype; + +/** + * @constructor + * @extends {WebInspector.View} + * @param {string} id + */ +WebInspector.ExtensionNotifierView = function(id) +{ + WebInspector.View.call(this); + + this._id = id; +} + +WebInspector.ExtensionNotifierView.prototype = { + wasShown: function() + { + WebInspector.extensionServer.notifyViewShown(this._id); + }, + + willHide: function() + { + WebInspector.extensionServer.notifyViewHidden(this._id); + } +} + +WebInspector.ExtensionNotifierView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/HandlerRegistry.js b/Source/WebCore/inspector/front-end/HandlerRegistry.js index 42d6e681d..3a7758756 100644 --- a/Source/WebCore/inspector/front-end/HandlerRegistry.js +++ b/Source/WebCore/inspector/front-end/HandlerRegistry.js @@ -96,7 +96,7 @@ WebInspector.HandlerRegistry.prototype = { */ appendApplicableItems: function(contextMenu, target) { - if (!(target instanceof WebInspector.UISourceCode || target instanceof WebInspector.Resource)) + if (!(target instanceof WebInspector.UISourceCode || target instanceof WebInspector.Resource || target instanceof WebInspector.NetworkRequest)) return; var contentProvider = /** @type {WebInspector.ContentProvider} */ target; if (!contentProvider.contentURL()) diff --git a/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png b/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png Binary files differindex 74eec1d3b..d270e277f 100644 --- a/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png +++ b/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png diff --git a/Source/WebCore/inspector/front-end/InjectedFakeWorker.js b/Source/WebCore/inspector/front-end/InjectedFakeWorker.js deleted file mode 100644 index d65b20840..000000000 --- a/Source/WebCore/inspector/front-end/InjectedFakeWorker.js +++ /dev/null @@ -1,345 +0,0 @@ -/* - * 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. - */ - -var InjectedFakeWorker = function(InjectedScriptHost, inspectedWindow, injectedScriptId) -{ - -Worker = function(url) -{ - var impl = new FakeWorker(this, url); - if (impl === null) - return null; - - this.isFake = true; - this.postMessage = bind(impl.postMessage, impl); - this.terminate = bind(impl.terminate, impl); - - function onmessageGetter() - { - return impl.channel.port1.onmessage; - } - function onmessageSetter(callback) - { - impl.channel.port1.onmessage = callback; - } - this.__defineGetter__("onmessage", onmessageGetter); - this.__defineSetter__("onmessage", onmessageSetter); - this.addEventListener = bind(impl.channel.port1.addEventListener, impl.channel.port1); - this.removeEventListener = bind(impl.channel.port1.removeEventListener, impl.channel.port1); - this.dispatchEvent = bind(impl.channel.port1.dispatchEvent, impl.channel.port1); -} - -function FakeWorker(worker, url) -{ - var scriptURL = this._expandURLAndCheckOrigin(document.baseURI, location.href, url); - - this._worker = worker; - this._id = InjectedScriptHost.nextWorkerId(); - this.channel = new MessageChannel(); - this._listeners = []; - this._buildWorker(scriptURL); - - InjectedScriptHost.didCreateWorker(this._id, scriptURL.url, false); -} - -FakeWorker.prototype = { - postMessage: function(msg, opt_ports) - { - if (this._frame != null) - this.channel.port1.postMessage.apply(this.channel.port1, arguments); - else if (this._pendingMessages) - this._pendingMessages.push(arguments) - else - this._pendingMessages = [ arguments ]; - }, - - terminate: function() - { - InjectedScriptHost.didDestroyWorker(this._id); - - this.channel.port1.close(); - this.channel.port2.close(); - if (this._frame != null) - this._frame.frameElement.parentNode.removeChild(this._frame.frameElement); - this._frame = null; - this._worker = null; // Break reference loop. - }, - - _buildWorker: function(url) - { - var code = this._loadScript(url.url); - var iframeElement = document.createElement("iframe"); - iframeElement.style.display = "none"; - - this._document = document; - iframeElement.onload = bind(this._onWorkerFrameLoaded, this, iframeElement, url, code); - - if (document.body) - this._attachWorkerFrameToDocument(iframeElement, url, code); - else - window.addEventListener("load", bind(this._attachWorkerFrameToDocument, this, iframeElement), false); - }, - - _attachWorkerFrameToDocument: function(iframeElement) - { - document.body.appendChild(iframeElement); - }, - - _onWorkerFrameLoaded: function(iframeElement, url, code) - { - var frame = iframeElement.contentWindow; - this._frame = frame; - this._setupWorkerContext(frame, url); - - var frameContents = '(function() { var location = __devtools.location; var window; ' + code + '})();\n' + '//@ sourceURL=' + url.url; - - frame.eval(frameContents); - if (this._pendingMessages) { - for (var msg = 0; msg < this._pendingMessages.length; ++msg) - this.postMessage.apply(this, this._pendingMessages[msg]); - delete this._pendingMessages; - } - }, - - _setupWorkerContext: function(workerFrame, url) - { - workerFrame.__devtools = { - handleException: bind(this._handleException, this), - location: url.mockLocation() - }; - - var self = this; - - function onmessageGetter() - { - return self.channel.port2.onmessage ? self.channel.port2.onmessage.originalCallback : null; - } - - function onmessageSetter(callback) - { - var wrappedCallback = bind(self._callbackWrapper, self, callback); - wrappedCallback.originalCallback = callback; - self.channel.port2.onmessage = wrappedCallback; - } - - workerFrame.__defineGetter__("onmessage", onmessageGetter); - workerFrame.__defineSetter__("onmessage", onmessageSetter); - workerFrame.addEventListener = bind(this._addEventListener, this); - workerFrame.removeEventListener = bind(this._removeEventListener, this); - workerFrame.dispatchEvent = bind(this.channel.port2.dispatchEvent, this.channel.port2); - workerFrame.postMessage = bind(this.channel.port2.postMessage, this.channel.port2); - workerFrame.importScripts = bind(this._importScripts, this, workerFrame); - workerFrame.close = bind(this.terminate, this); - }, - - _addEventListener: function(type, callback, useCapture) - { - var wrappedCallback = bind(this._callbackWrapper, this, callback); - wrappedCallback.originalCallback = callback; - wrappedCallback.type = type; - wrappedCallback.useCapture = Boolean(useCapture); - - this.channel.port2.addEventListener(type, wrappedCallback, useCapture); - this._listeners.push(wrappedCallback); - }, - - _removeEventListener: function(type, callback, useCapture) - { - var listeners = this._listeners; - for (var i = 0; i < listeners.length; ++i) { - if (listeners[i].originalCallback === callback && - listeners[i].type === type && - listeners[i].useCapture === Boolean(useCapture)) { - this.channel.port2.removeEventListener(type, listeners[i], useCapture); - listeners[i] = listeners[listeners.length - 1]; - listeners.pop(); - break; - } - } - }, - - _callbackWrapper: function(callback, msg) - { - // Shortcut -- if no exception handlers installed, avoid try/catch so as not to obscure line number. - if (!this._frame.onerror && !this._worker.onerror) { - callback(msg); - return; - } - - try { - callback(msg); - } catch (e) { - this._handleException(e, this._frame.onerror, this._worker.onerror); - } - }, - - _handleException: function(e) - { - // NB: it should be an ErrorEvent, but creating it from script is not - // currently supported, so emulate it on top of plain vanilla Event. - var errorEvent = this._document.createEvent("Event"); - errorEvent.initEvent("Event", false, false); - errorEvent.message = "Uncaught exception"; - - for (var i = 1; i < arguments.length; ++i) { - if (arguments[i] && arguments[i](errorEvent)) - return; - } - - throw e; - }, - - _importScripts: function(targetFrame) - { - for (var i = 1; i < arguments.length; ++i) { - var workerOrigin = targetFrame.__devtools.location.href; - var url = this._expandURLAndCheckOrigin(workerOrigin, workerOrigin, arguments[i]); - targetFrame.eval(this._loadScript(url.url) + "\n//@ sourceURL= " + url.url); - } - }, - - _loadScript: function(url) - { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, false); - xhr.send(null); - - var text = xhr.responseText; - if (xhr.status != 0 && xhr.status/100 !== 2) { // We're getting status === 0 when using file://. - console.error("Failed to load worker: " + url + "[" + xhr.status + "]"); - text = ""; // We've got error message, not worker code. - } - return text; - }, - - _expandURLAndCheckOrigin: function(baseURL, origin, url) - { - var scriptURL = new URL(baseURL).completeWith(url); - - if (!scriptURL.sameOrigin(origin)) - throw new DOMCoreException("SECURITY_ERR",18); - return scriptURL; - } -}; - -function URL(url) -{ - this.url = url; - this.split(); -} - -URL.prototype = { - urlRegEx: (/^(http[s]?|file):\/\/([^\/:]*)(:[\d]+)?(?:(\/[^#?]*)(\?[^#]*)?(?:#(.*))?)?$/i), - - split: function() - { - function emptyIfNull(str) - { - return str == null ? "" : str; - } - var parts = this.urlRegEx.exec(this.url); - - this.schema = parts[1]; - this.host = parts[2]; - this.port = emptyIfNull(parts[3]); - this.path = emptyIfNull(parts[4]); - this.query = emptyIfNull(parts[5]); - this.fragment = emptyIfNull(parts[6]); - }, - - mockLocation: function() - { - var host = this.host.replace(/^[^@]*@/, ""); - - return { - href: this.url, - protocol: this.schema + ":", - host: host, - hostname: host, - port: this.port, - pathname: this.path, - search: this.query, - hash: this.fragment - }; - }, - - completeWith: function(url) - { - if (url === "" || /^[^/]*:/.exec(url)) // If given absolute url, return as is now. - return new URL(url); - - var relParts = /^([^#?]*)(.*)$/.exec(url); // => [ url, path, query-andor-fragment ] - - var path = (relParts[1].slice(0, 1) === "/" ? "" : this.path.replace(/[^/]*$/, "")) + relParts[1]; - path = path.replace(/(\/\.)+(\/|$)/g, "/").replace(/[^/]*\/\.\.(\/|$)/g, ""); - - return new URL(this.schema + "://" + this.host + this.port + path + relParts[2]); - }, - - sameOrigin: function(url) - { - function normalizePort(schema, port) - { - var portNo = port.slice(1); - return (schema === "https" && portNo == 443 || schema === "http" && portNo == 80) ? "" : port; - } - - var other = new URL(url); - - return this.schema === other.schema && - this.host === other.host && - normalizePort(this.schema, this.port) === normalizePort(other.schema, other.port); - } -}; - -function DOMCoreException(name, code) -{ - function formatError() - { - return "Error: " + this.message; - } - - this.name = name; - this.message = name + ": DOM Exception " + code; - this.code = code; - this.toString = bind(formatError, this); -} - -function bind(func, thisObject) -{ - var args = Array.prototype.slice.call(arguments, 2); - return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); }; -} - -function noop() -{ -} - -} diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js index ade0491fa..54fa1a096 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js @@ -154,9 +154,9 @@ WebInspector.JavaScriptSourceFrame.prototype = { this._restoreBreakpointsAfterEditing(); }, - beforeTextChanged: function(userInput) + beforeTextChanged: function() { - WebInspector.SourceFrame.prototype.beforeTextChanged.call(this, userInput); + WebInspector.SourceFrame.prototype.beforeTextChanged.call(this); this._removeBreakpointsBeforeEditing(); }, diff --git a/Source/WebCore/inspector/front-end/NetworkItemView.js b/Source/WebCore/inspector/front-end/NetworkItemView.js index 1fe90248a..45cdfaba4 100644 --- a/Source/WebCore/inspector/front-end/NetworkItemView.js +++ b/Source/WebCore/inspector/front-end/NetworkItemView.js @@ -63,7 +63,7 @@ WebInspector.NetworkItemView = function(request) var timingView = new WebInspector.RequestTimingView(request); this.appendTab("timing", WebInspector.UIString("Timing"), timingView); } - + this._request = request; } WebInspector.NetworkItemView.prototype = { @@ -92,6 +92,14 @@ WebInspector.NetworkItemView.prototype = { { if (event.data.isUserGesture) WebInspector.settings.resourceViewTab.set(event.data.tabId); + }, + + /** + * @return {WebInspector.NetworkRequest} + */ + request: function() + { + return this._request; } } diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 0bfa3bb0c..a82a56168 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -1166,32 +1166,18 @@ WebInspector.NetworkLogView.prototype = { this._highlightNthMatchedRequest(newMatchedRequestIndex, false); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._matchedRequests.length) - return false; - if (!loop && this._currentMatchedRequestIndex <= 0) - return false; + return; this._highlightNthMatchedRequest((this._currentMatchedRequestIndex + this._matchedRequests.length - 1) % this._matchedRequests.length, true); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._matchedRequests.length) - return false; - if (!loop && this._currentMatchedRequestIndex + 1 >= this._matchedRequests.length) - return false; + return; this._highlightNthMatchedRequest((this._currentMatchedRequestIndex + 1) % this._matchedRequests.length, true); - return true; }, searchCanceled: function() @@ -1438,20 +1424,14 @@ WebInspector.NetworkPanel.prototype = { this._networkLogView.performSearch(searchQuery); }, - /** - * @param {boolean} loop - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { - this._networkLogView.jumpToPreviousSearchResult(loop); + this._networkLogView.jumpToPreviousSearchResult(); }, - /** - * @param {boolean} loop - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { - this._networkLogView.jumpToNextSearchResult(loop); + this._networkLogView.jumpToNextSearchResult(); }, searchCanceled: function() @@ -1467,6 +1447,8 @@ WebInspector.NetworkPanel.prototype = { { if (!(target instanceof WebInspector.NetworkRequest)) return; + if (this.visibleView && this.visibleView.isShowing() && this.visibleView.request() === target) + return; function reveal() { diff --git a/Source/WebCore/inspector/front-end/Panel.js b/Source/WebCore/inspector/front-end/Panel.js index a14641c8a..7891a0b5f 100644 --- a/Source/WebCore/inspector/front-end/Panel.js +++ b/Source/WebCore/inspector/front-end/Panel.js @@ -108,30 +108,19 @@ WebInspector.Panel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { // Call searchCanceled since it will reset everything we need before doing a new search. this.searchCanceled(); }, - /** - * @param {boolean} loop - * @return {boolean} true iff operation is successful - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { - return false; }, - /** - * @param {boolean} loop - * @return {boolean} true iff operation is successful - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { - return false; }, /** diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index 17c6e5300..ce1229620 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -739,9 +739,8 @@ WebInspector.ProfilesPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { this.searchCanceled(); @@ -816,14 +815,10 @@ WebInspector.ProfilesPanel.prototype = { this._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this.showView || !this._searchResults || !this._searchResults.length) - return false; + return; var showFirstResult = false; @@ -853,17 +848,12 @@ WebInspector.ProfilesPanel.prototype = { currentView.jumpToFirstSearchResult(); else currentView.jumpToNextSearchResult(); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this.showView || !this._searchResults || !this._searchResults.length) - return false; + return; var showLastResult = false; @@ -893,7 +883,6 @@ WebInspector.ProfilesPanel.prototype = { currentView.jumpToLastSearchResult(); else currentView.jumpToPreviousSearchResult(); - return true; }, _searchableViews: function() diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js index 71ff0a56d..113b95be9 100644 --- a/Source/WebCore/inspector/front-end/ResourcesPanel.js +++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js @@ -637,9 +637,8 @@ WebInspector.ResourcesPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { this._resetSearchResults(); var regex = WebInspector.SourceFrame.createSearchRegex(query); @@ -749,32 +748,22 @@ WebInspector.ResourcesPanel.prototype = { this._forAllResourceTreeElements(callback); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this.currentSearchMatches) - return false; + return; var currentTreeElement = this.sidebarTree.selectedTreeElement; var nextSearchResult = this._searchController.nextSearchResult(currentTreeElement); this._showSearchResult(nextSearchResult); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this.currentSearchMatches) - return false; + return; var currentTreeElement = this.sidebarTree.selectedTreeElement; var previousSearchResult = this._searchController.previousSearchResult(currentTreeElement); this._showSearchResult(previousSearchResult); - return true; }, _forAllResourceTreeElements: function(callback) diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index c2d8c0000..61758f666 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -103,9 +103,8 @@ WebInspector.ScriptsPanel = function(workspaceForTest) if (Preferences.exposeWorkersInspection && !WebInspector.WorkerManager.isWorkerFrontend()) { WorkerAgent.setWorkerInspectionEnabled(true); - this.sidebarPanes.workerList = new WebInspector.WorkerListSidebarPane(WebInspector.workerManager); - } else - this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane(); + this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebInspector.workerManager); + } this._debugSidebarContentsElement = document.createElement("div"); this._debugSidebarContentsElement.id = "scripts-debug-sidebar-contents"; @@ -364,8 +363,6 @@ WebInspector.ScriptsPanel.prototype = { this._updateScriptViewStatusBarItems(); this.sidebarPanes.jsBreakpoints.reset(); this.sidebarPanes.watchExpressions.reset(); - if (!preserveItems && this.sidebarPanes.workers) - this.sidebarPanes.workers.reset(); var uiSourceCodes = this._workspace.uiSourceCodes(); for (var i = 0; i < uiSourceCodes.length; ++i) @@ -573,6 +570,7 @@ WebInspector.ScriptsPanel.prototype = { // ScriptsNavigator does not need to update on EditorClosed. this._updateScriptViewStatusBarItems(); + WebInspector.searchController.resetSearch(); }, _editorSelected: function(event) @@ -581,6 +579,7 @@ WebInspector.ScriptsPanel.prototype = { var sourceFrame = this._showFile(uiSourceCode); this._navigatorController.hideNavigatorOverlay(); sourceFrame.focus(); + WebInspector.searchController.resetSearch(); }, _scriptSelected: function(event) @@ -878,9 +877,8 @@ WebInspector.ScriptsPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { WebInspector.searchController.updateSearchMatchesCount(0, this); @@ -899,57 +897,46 @@ WebInspector.ScriptsPanel.prototype = { return; WebInspector.searchController.updateSearchMatchesCount(searchMatches, this); - view.jumpToNextSearchResult(loop); + view.jumpToNextSearchResult(); WebInspector.searchController.updateCurrentMatchIndex(view.currentSearchResultIndex, this); } this._searchView.performSearch(query, finishedCallback.bind(this)); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._searchView) - return false; + return; if (this._searchView !== this.visibleView) { - this.performSearch(this._searchQuery, loop); - return false; + this.performSearch(this._searchQuery); + return; } - if (this._searchView.showingLastSearchResult()) { - if (!loop) - return false; + if (this._searchView.showingLastSearchResult()) this._searchView.jumpToFirstSearchResult(); - } else + else this._searchView.jumpToNextSearchResult(); WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this); return true; }, - /** - * @param {boolean} loop - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._searchView) return false; if (this._searchView !== this.visibleView) { - this.performSearch(this._searchQuery, loop); + this.performSearch(this._searchQuery); if (this._searchView) this._searchView.jumpToLastSearchResult(); return; } - if (this._searchView.showingFirstSearchResult()) { - if (!loop) - return false; + if (this._searchView.showingFirstSearchResult()) this._searchView.jumpToLastSearchResult(); - } else + else this._searchView.jumpToPreviousSearchResult(); WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this); }, @@ -968,7 +955,7 @@ WebInspector.ScriptsPanel.prototype = { */ replaceSelectionWith: function(text) { - var view = /** @type {WebInspector.SourceFrame} */ this._searchView; + var view = /** @type {WebInspector.SourceFrame} */ this.visibleView; view.replaceSearchMatchWith(text); }, @@ -978,7 +965,7 @@ WebInspector.ScriptsPanel.prototype = { */ replaceAllWith: function(query, text) { - var view = /** @type {WebInspector.SourceFrame} */ this._searchView; + var view = /** @type {WebInspector.SourceFrame} */ this.visibleView; view.replaceAllWith(query, text); }, diff --git a/Source/WebCore/inspector/front-end/SearchController.js b/Source/WebCore/inspector/front-end/SearchController.js index 6f4ec797c..d18e280e1 100644 --- a/Source/WebCore/inspector/front-end/SearchController.js +++ b/Source/WebCore/inspector/front-end/SearchController.js @@ -34,16 +34,18 @@ */ WebInspector.SearchController = function() { - this._element = document.createElement("div"); + this._element = document.createElement("table"); this._element.className = "toolbar-search"; + this._element.cellSpacing = 0; - var labelElement = this._element.createChild("span"); - labelElement.textContent = WebInspector.UIString("Find"); - - this._searchControlElement = this._element.createChild("div", "toolbar-search-control"); + this._firstRowElement = this._element.createChild("tr"); + this._secondRowElement = this._element.createChild("tr", "hidden"); + // Column 1 + this._searchControlElement = this._firstRowElement.createChild("td").createChild("span", "toolbar-search-control"); this._searchInputElement = this._searchControlElement.createChild("input", "search-replace"); this._searchInputElement.id = "search-input-field"; + this._searchInputElement.placeholder = WebInspector.UIString("Find"); this._matchesElement = this._searchControlElement.createChild("label", "search-results-matches"); this._matchesElement.setAttribute("for", "search-input-field"); @@ -62,38 +64,50 @@ WebInspector.SearchController = function() this._searchInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true); this._searchInputElement.addEventListener("input", this._onInput.bind(this), false); - this._replaceElement = this._element.createChild("span"); - - this._replaceCheckboxElement = this._replaceElement.createChild("input"); - this._replaceCheckboxElement.type = "checkbox"; - this._replaceCheckboxElement.id = "search-replace-trigger"; - this._replaceCheckboxElement.tabIndex = -1; - this._replaceCheckboxElement.addEventListener("click", this._toggleReplaceVisibility.bind(this), false); - - this._replaceLabelElement = this._replaceElement.createChild("label"); - this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); - this._replaceLabelElement.setAttribute("for", "search-replace-trigger"); - - this._replaceDetailsElement = this._replaceElement.createChild("span", "hidden"); - - this._replaceInputElement = this._replaceDetailsElement.createChild("input", "search-replace toolbar-replace-control"); + this._replaceInputElement = this._secondRowElement.createChild("td").createChild("input", "search-replace toolbar-replace-control"); this._replaceInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true); + this._replaceInputElement.placeholder = WebInspector.UIString("Replace"); + + // Column 2 + this._findButtonElement = this._firstRowElement.createChild("td").createChild("button", "hidden"); + this._findButtonElement.textContent = WebInspector.UIString("Find"); + this._findButtonElement.tabIndex = -1; + this._findButtonElement.addEventListener("click", this._onNextButtonSearch.bind(this), false); - this._replaceButtonElement = this._replaceDetailsElement.createChild("button"); + this._replaceButtonElement = this._secondRowElement.createChild("td").createChild("button"); this._replaceButtonElement.textContent = WebInspector.UIString("Replace"); + this._replaceButtonElement.disabled = true; + this._replaceButtonElement.tabIndex = -1; this._replaceButtonElement.addEventListener("click", this._replace.bind(this), false); - this._skipButtonElement = this._replaceDetailsElement.createChild("button"); - this._skipButtonElement.textContent = WebInspector.UIString("Skip"); - this._skipButtonElement.addEventListener("click", this._onNextButtonSearch.bind(this), false); + // Column 3 + this._prevButtonElement = this._firstRowElement.createChild("td").createChild("button", "hidden"); + this._prevButtonElement.textContent = WebInspector.UIString("Previous"); + this._prevButtonElement.disabled = true; + this._prevButtonElement.tabIndex = -1; + this._prevButtonElement.addEventListener("click", this._onPrevButtonSearch.bind(this), false); - this._replaceAllButtonElement = this._replaceDetailsElement.createChild("button"); + this._replaceAllButtonElement = this._secondRowElement.createChild("td").createChild("button"); this._replaceAllButtonElement.textContent = WebInspector.UIString("Replace All"); this._replaceAllButtonElement.addEventListener("click", this._replaceAll.bind(this), false); - var closeButtonElement = this._element.createChild("span", "drawer-header-close-button"); - closeButtonElement.textContent = WebInspector.UIString("\u00D7"); - closeButtonElement.addEventListener("click", this.cancelSearch.bind(this), false); + // Column 4 + this._replaceElement = this._firstRowElement.createChild("td").createChild("span"); + + this._replaceCheckboxElement = this._replaceElement.createChild("input"); + this._replaceCheckboxElement.type = "checkbox"; + this._replaceCheckboxElement.id = "search-replace-trigger"; + this._replaceCheckboxElement.addEventListener("click", this._updateSecondRowVisibility.bind(this), false); + + this._replaceLabelElement = this._replaceElement.createChild("label"); + this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); + this._replaceLabelElement.setAttribute("for", "search-replace-trigger"); + + // Column 5 + var cancelButtonElement = this._firstRowElement.createChild("td").createChild("button"); + cancelButtonElement.textContent = WebInspector.UIString("Cancel"); + cancelButtonElement.tabIndex = -1; + cancelButtonElement.addEventListener("click", this.cancelSearch.bind(this), false); } WebInspector.SearchController.prototype = { @@ -119,15 +133,20 @@ WebInspector.SearchController.prototype = { if (!this._searchIsVisible) return; delete this._searchIsVisible; - this._performSearch("", false, false, false); WebInspector.inspectorView.setFooterElement(null); - this._replaceCheckboxElement.checked = false; - this._toggleReplaceVisibility(); + this.resetSearch(); + }, + + resetSearch: function() + { + this._performSearch("", false, false); + this._updateReplaceVisibility(); + this._matchesElement.textContent = ""; }, disableSearchUntilExplicitAction: function(event) { - this._performSearch("", false, false, false); + this._performSearch("", false, false); }, /** @@ -163,10 +182,9 @@ WebInspector.SearchController.prototype = { var currentPanel = WebInspector.inspectorView.currentPanel(); if (isMac && event.metaKey && !event.ctrlKey && !event.altKey) { - if (event.shiftKey) { - if (currentPanel.jumpToPreviousSearchResult) - currentPanel.jumpToPreviousSearchResult(); - } else if (currentPanel.jumpToNextSearchResult) + if (event.shiftKey) + currentPanel.jumpToPreviousSearchResult(); + else currentPanel.jumpToNextSearchResult(); event.consume(true); return true; @@ -178,6 +196,8 @@ WebInspector.SearchController.prototype = { _updateSearchNavigationButtonState: function(enabled) { + this._replaceButtonElement.disabled = !enabled; + this._prevButtonElement.disabled = !enabled; var panel = WebInspector.inspectorView.currentPanel(); if (enabled) { this._searchNavigationPrevElement.addStyleClass("enabled"); @@ -211,10 +231,13 @@ WebInspector.SearchController.prototype = { _updateReplaceVisibility: function() { var panel = WebInspector.inspectorView.currentPanel(); - if (WebInspector.experimentsSettings.searchReplace.isEnabled() && panel.canSearchAndReplace()) + if (panel && panel.canSearchAndReplace()) this._replaceElement.removeStyleClass("hidden"); - else + else { this._replaceElement.addStyleClass("hidden"); + this._replaceCheckboxElement.checked = false; + this._updateSecondRowVisibility(); + } }, _onSearchFieldManualFocus: function(event) @@ -236,7 +259,7 @@ WebInspector.SearchController.prototype = { if (isEnterKey(event)) { if (event.target === this._searchInputElement) - this._performSearch(event.target.value, true, event.shiftKey, true); + this._performSearch(event.target.value, true, event.shiftKey); else if (event.target === this._replaceInputElement) this._replace(); } @@ -244,20 +267,22 @@ WebInspector.SearchController.prototype = { _onInput: function(event) { - this._performSearch(event.target.value, false, false, true); + this._performSearch(event.target.value, false, false); }, _onNextButtonSearch: function(event) { // Simulate next search on search-navigation-button click. - this._performSearch(this._searchInputElement.value, true, false, true); + this._performSearch(this._searchInputElement.value, true, false); this._searchInputElement.focus(); }, _onPrevButtonSearch: function(event) { + if (!this._searchNavigationPrevElement.hasStyleClass("enabled")) + return; // Simulate previous search on search-navigation-button click. - this._performSearch(this._searchInputElement.value, true, true, true); + this._performSearch(this._searchInputElement.value, true, true); this._searchInputElement.focus(); }, @@ -265,9 +290,8 @@ WebInspector.SearchController.prototype = { * @param {string} query * @param {boolean} forceSearch * @param {boolean} isBackwardSearch - * @param {boolean} loop */ - _performSearch: function(query, forceSearch, isBackwardSearch, loop) + _performSearch: function(query, forceSearch, isBackwardSearch) { if (!query || !query.length) { delete this._currentQuery; @@ -276,7 +300,7 @@ WebInspector.SearchController.prototype = { var panel = WebInspector.panels[panelName]; var hadCurrentQuery = !!panel.currentQuery; delete panel.currentQuery; - if (hadCurrentQuery && panel.searchCanceled) + if (hadCurrentQuery) panel.searchCanceled(); } this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); @@ -289,9 +313,9 @@ WebInspector.SearchController.prototype = { // search result for a good user experience. if (forceSearch) { if (!isBackwardSearch) - currentPanel.jumpToNextSearchResult(loop); + currentPanel.jumpToNextSearchResult(); else if (isBackwardSearch) - currentPanel.jumpToPreviousSearchResult(loop); + currentPanel.jumpToPreviousSearchResult(); } return; } @@ -302,16 +326,29 @@ WebInspector.SearchController.prototype = { this._currentQuery = query; currentPanel.currentQuery = query; - currentPanel.performSearch(query, loop); + currentPanel.performSearch(query); }, - _toggleReplaceVisibility: function() + _updateSecondRowVisibility: function() { + if (!this._searchIsVisible) + return; if (this._replaceCheckboxElement.checked) { - this._replaceDetailsElement.removeStyleClass("hidden"); + this._element.addStyleClass("toolbar-search-replace"); + this._secondRowElement.removeStyleClass("hidden"); + this._prevButtonElement.removeStyleClass("hidden"); + this._findButtonElement.removeStyleClass("hidden"); + this._replaceCheckboxElement.tabIndex = -1; this._replaceInputElement.focus(); - } else - this._replaceDetailsElement.addStyleClass("hidden"); + } else { + this._element.removeStyleClass("toolbar-search-replace"); + this._secondRowElement.addStyleClass("hidden"); + this._prevButtonElement.addStyleClass("hidden"); + this._findButtonElement.addStyleClass("hidden"); + this._replaceCheckboxElement.tabIndex = 0; + this._searchInputElement.focus(); + } + WebInspector.inspectorView.setFooterElement(this._element); }, _replace: function() @@ -320,13 +357,13 @@ WebInspector.SearchController.prototype = { currentPanel.replaceSelectionWith(this._replaceInputElement.value); var query = this._currentQuery; delete this._currentQuery; - this._performSearch(query, true, false, false); + this._performSearch(query, true, false); }, _replaceAll: function() { var currentPanel = WebInspector.inspectorView.currentPanel(); - currentPanel.replaceAllWith(this._currentQuery, this._replaceInputElement.value); + currentPanel.replaceAllWith(this._searchInputElement.value, this._replaceInputElement.value); } } diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index ba0b266a2..963d1f0ea 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -188,7 +188,6 @@ WebInspector.ExperimentsSettings = function() this.liveNativeMemoryChart = this._createExperiment("liveNativeMemoryChart", "Live native memory chart"); this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection"); this.mainThreadMonitoring = this._createExperiment("mainThreadMonitoring", "Show CPU activity in Timeline"); - this.searchReplace = this._createExperiment("searchReplace", "Search / Replace"); this._cleanUpSetting(); } diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index a8994f9d7..203718612 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -270,12 +270,9 @@ WebInspector.SourceFrame.prototype = { this._innerSetSelectionIfNeeded(); }, - /** - * @param {boolean} userInput - */ - beforeTextChanged: function(userInput) + beforeTextChanged: function() { - if (userInput) + if (!this._isReplacing) WebInspector.searchController.cancelSearch(); this.clearMessages(); }, @@ -355,7 +352,7 @@ WebInspector.SourceFrame.prototype = { if (shiftToIndex) this._searchResults = this._searchResults.rotate(shiftToIndex); - + callback(this, this._searchResults.length); } @@ -431,17 +428,16 @@ WebInspector.SourceFrame.prototype = { */ replaceSearchMatchWith: function(text) { - this.beforeTextChanged(false); - var range = this._searchResults[this._currentSearchResultIndex]; if (!range) return; this._textEditor.markAndRevealRange(null); - var newRange = this._textModel.editRange(range, text); - this.afterTextChanged(range, newRange); - // Collapse current match so that we don't replace things twice. - this._textEditor.markAndRevealRange(newRange.collapseToEnd()); + this._isReplacing = true; + var newRange = this._textEditor.editRange(range, text); + delete this._isReplacing; + + this._textEditor.setSelection(newRange.collapseToEnd()); }, /** @@ -450,12 +446,15 @@ WebInspector.SourceFrame.prototype = { */ replaceAllWith: function(query, replacement) { - this.beforeTextChanged(false); + this._textEditor.markAndRevealRange(null); + var text = this._textModel.text(); var range = this._textModel.range(); text = text.replace(WebInspector.SourceFrame.createSearchRegex(query, "g"), replacement); - var newRange = this._textModel.editRange(range, text); - this.afterTextChanged(range, newRange); + + this._isReplacing = true; + this._textEditor.editRange(range, text); + delete this._isReplacing; }, _collectRegexMatches: function(regexObject) @@ -645,7 +644,7 @@ WebInspector.TextEditorDelegateForSourceFrame = function(sourceFrame) WebInspector.TextEditorDelegateForSourceFrame.prototype = { beforeTextChanged: function() { - this._sourceFrame.beforeTextChanged(true); + this._sourceFrame.beforeTextChanged(); }, afterTextChanged: function(oldRange, newRange) diff --git a/Source/WebCore/inspector/front-end/TextEditor.js b/Source/WebCore/inspector/front-end/TextEditor.js index 9ca824d1e..fa6f4d209 100644 --- a/Source/WebCore/inspector/front-end/TextEditor.js +++ b/Source/WebCore/inspector/front-end/TextEditor.js @@ -232,6 +232,20 @@ WebInspector.TextEditor.prototype = { this._updatePanelOffsets(); }, + /** + * @param {WebInspector.TextRange} range + * @param {string} text + * @return {WebInspector.TextRange} + */ + editRange: function(range, text) + { + this._enterInternalTextChangeMode(); + this._textModel.markUndoableState(); + var newRange = this._textModel.editRange(range, text); + this._exitInternalTextChangeMode(range, newRange); + return newRange; + }, + _enterInternalTextChangeMode: function() { this._internalTextChangeMode = true; diff --git a/Source/WebCore/inspector/front-end/TimelineModel.js b/Source/WebCore/inspector/front-end/TimelineModel.js index b3b6a6617..a9c49e59a 100644 --- a/Source/WebCore/inspector/front-end/TimelineModel.js +++ b/Source/WebCore/inspector/front-end/TimelineModel.js @@ -35,6 +35,7 @@ WebInspector.TimelineModel = function() { this._records = []; + this._stringPool = new StringPool(); this._minimumRecordTime = -1; this._maximumRecordTime = -1; this._collectionEnabled = false; @@ -152,6 +153,7 @@ WebInspector.TimelineModel.prototype = { _addRecord: function(record) { + this._stringPool.internObjectStrings(record); this._records.push(record); this._updateBoundaries(record); this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordAdded, record); @@ -214,6 +216,7 @@ WebInspector.TimelineModel.prototype = { reset: function() { this._records = []; + this._stringPool.reset(); this._minimumRecordTime = -1; this._maximumRecordTime = -1; this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordsCleared); diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 360ac113b..baf6ab7e4 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -785,8 +785,6 @@ WebInspector.TimelinePanel.prototype = { var endTime = startTime + width * scale; var tasks = this._mainThreadTasks; - if (!tasks.length) - return; function compareEndTime(value, task) { @@ -794,8 +792,6 @@ WebInspector.TimelinePanel.prototype = { } var taskIndex = insertionIndexForObjectInListSortedByFunction(startTime, tasks, compareEndTime); - if (taskIndex === tasks.length) - return; var container = this._cpuBarsElement; var element = container.firstChild.nextSibling; @@ -1048,14 +1044,15 @@ WebInspector.TimelineRecordListRow.prototype = { if (this._dataElement.firstChild) this._dataElement.removeChildren(); - if (record.details) { + var details = record.details(); + if (details) { var detailsContainer = document.createElement("span"); - if (typeof record.details === "object") { + if (typeof details === "object") { detailsContainer.appendChild(document.createTextNode("(")); - detailsContainer.appendChild(record.details); + detailsContainer.appendChild(details); detailsContainer.appendChild(document.createTextNode(")")); } else - detailsContainer.textContent = "(" + record.details + ")"; + detailsContainer.textContent = "(" + details + ")"; this._dataElement.appendChild(detailsContainer); } }, diff --git a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js index 02ad99051..50a9cae75 100644 --- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +++ b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js @@ -57,12 +57,12 @@ WebInspector.TimelinePresentationModel.categories = function() }; /** - * @param {Object} record + * @return {!Object.<string, {title: string, category}>} */ -WebInspector.TimelinePresentationModel.recordStyle = function(record) +WebInspector.TimelinePresentationModel.initRecordStyles_ = function() { if (WebInspector.TimelinePresentationModel._recordStylesMap) - return WebInspector.TimelinePresentationModel._recordStylesMap[record.type]; + return WebInspector.TimelinePresentationModel._recordStylesMap; var recordTypes = WebInspector.TimelineModel.RecordType; var categories = WebInspector.TimelinePresentationModel.categories(); @@ -100,7 +100,24 @@ WebInspector.TimelinePresentationModel.recordStyle = function(record) recordStyles[recordTypes.FireAnimationFrame] = { title: WebInspector.UIString("Animation Frame Fired"), category: categories["scripting"] }; WebInspector.TimelinePresentationModel._recordStylesMap = recordStyles; - return recordStyles[record.type]; + return recordStyles; +} + +/** + * @param {Object} record + */ +WebInspector.TimelinePresentationModel.recordStyle = function(record) +{ + var recordStyles = WebInspector.TimelinePresentationModel.initRecordStyles_(); + var result = recordStyles[record.type]; + if (!result) { + result = { + title: WebInspector.UIString("Unknown: %s", record.type), + category: WebInspector.TimelinePresentationModel.categories()["program"] + }; + recordStyles[record.type] = result; + } + return result; } WebInspector.TimelinePresentationModel.categoryForRecord = function(record) @@ -385,31 +402,18 @@ WebInspector.TimelinePresentationModel.prototype.__proto__ = WebInspector.Object */ WebInspector.TimelinePresentationModel.Record = function(presentationModel, record, parentRecord, scriptDetails) { - this._presentationModel = presentationModel; - this._linkifier = this._presentationModel._linkifier; + this._linkifier = presentationModel._linkifier; this._aggregatedStats = []; - var recordTypes = WebInspector.TimelineModel.RecordType; - var style = WebInspector.TimelinePresentationModel.recordStyle(record); + this._record = record; + this._children = []; this.parent = parentRecord; if (parentRecord) parentRecord.children.push(this); - this.category = style.category; - this.title = record.type === recordTypes.TimeStamp ? record.data["message"] : style.title; - this.startTime = WebInspector.TimelineModel.startTimeInSeconds(record); - this.data = record.data; - this.type = record.type; - this.frameId = record.frameId; - this.endTime = WebInspector.TimelineModel.endTimeInSeconds(record); + this._selfTime = this.endTime - this.startTime; this._lastChildEndTime = this.endTime; - this._initiatorOffset = (parentRecord && parentRecord !== presentationModel._rootRecord) ? - parentRecord._initiatorOffset + this.startTime - parentRecord.startTime : 0; this._startTimeOffset = this.startTime - presentationModel._minimumRecordTime; - if (record.stackTrace && record.stackTrace.length) - this.stackTrace = record.stackTrace; - this.totalHeapSize = record.totalHeapSize; - this.usedHeapSize = record.usedHeapSize; if (record.data && record.data["url"]) this.url = record.data["url"]; if (scriptDetails) { @@ -417,6 +421,7 @@ WebInspector.TimelinePresentationModel.Record = function(presentationModel, reco this.scriptLine = scriptDetails.scriptLine; } + var recordTypes = WebInspector.TimelineModel.RecordType; switch (record.type) { case recordTypes.ResourceSendRequest: // Make resource receive record last since request was sent; make finish record last since response received. @@ -483,7 +488,6 @@ WebInspector.TimelinePresentationModel.Record = function(presentationModel, reco } break; } - this._refreshDetails(); } WebInspector.TimelinePresentationModel.Record.prototype = { @@ -517,23 +521,113 @@ WebInspector.TimelinePresentationModel.Record.prototype = { return (this._lastChildEndTime - this.startTime) > WebInspector.TimelinePresentationModel.shortRecordThreshold; }, + /** + * @return {Array.<WebInspector.TimelinePresentationModel.Record>} + */ get children() { - if (!this._children) - this._children = []; return this._children; }, + /** + * @return {number} + */ get visibleChildrenCount() { return this._visibleChildrenCount || 0; }, + /** + * @return {number} + */ get invisibleChildrenCount() { return this._invisibleChildrenCount || 0; }, + /** + * @return {WebInspector.TimelineCategory} + */ + get category() + { + return WebInspector.TimelinePresentationModel.recordStyle(this._record).category + }, + + /** + * @return {string} + */ + get title() + { + return this.type === WebInspector.TimelineModel.RecordType.TimeStamp ? this._record.data["message"] : + WebInspector.TimelinePresentationModel.recordStyle(this._record).title; + }, + + /** + * @return {number} + */ + get startTime() + { + return WebInspector.TimelineModel.startTimeInSeconds(this._record); + }, + + /** + * @return {number} + */ + get endTime() + { + return WebInspector.TimelineModel.endTimeInSeconds(this._record); + }, + + /** + * @return {Object} + */ + get data() + { + return this._record.data; + }, + + /** + * @return {string} + */ + get type() + { + return this._record.type; + }, + + /** + * @return {string} + */ + get frameId() + { + return this._record.frameId; + }, + + /** + * @return {number} + */ + get totalHeapSize() + { + return this._record.totalHeapSize; + }, + + /** + * @return {number} + */ + get usedHeapSize() + { + return this._record.usedHeapSize; + }, + + /** + * @return {Array.<DebuggerAgent.CallFrame>?} + */ + get stackTrace() + { + if (this._record.stackTrace && this._record.stackTrace.length) + return this._record.stackTrace; + return null; + }, + containsTime: function(time) { return this.startTime <= time && time <= this.endTime; @@ -547,7 +641,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = { Number.secondsToString(this._startTimeOffset)); contentHelper._appendTextRow(WebInspector.UIString("Duration"), text); - if (this._children && this._children.length) { + if (this._children.length) { contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime, true)); contentHelper._appendTextRow(WebInspector.UIString("CPU Time"), Number.secondsToString(this._cpuTime, true)); contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"), @@ -605,8 +699,8 @@ WebInspector.TimelinePresentationModel.Record.prototype = { contentHelper._appendTextRow(WebInspector.UIString("Interval Duration"), Number.secondsToString(this.intervalDuration, true)); break; default: - if (this.details) - contentHelper._appendTextRow(WebInspector.UIString("Details"), this.details); + if (this.details()) + contentHelper._appendTextRow(WebInspector.UIString("Details"), this.details()); break; } @@ -627,7 +721,17 @@ WebInspector.TimelinePresentationModel.Record.prototype = { _refreshDetails: function() { - this.details = this._getRecordDetails(); + delete this._details; + }, + + /** + * @return {Object?|string} + */ + details: function() + { + if (!this._details) + this._details = this._getRecordDetails(); + return this._details; }, _getRecordDetails: function() @@ -667,7 +771,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = { case WebInspector.TimelineModel.RecordType.TimeStamp: return this.data["message"]; default: - return null; + return this._linkifyScriptLocation() || this._linkifyTopCallFrame() || null; } }, @@ -712,15 +816,13 @@ WebInspector.TimelinePresentationModel.Record.prototype = { this._aggregatedStats[category] = 0; this._cpuTime = this._selfTime; - if (this._children) { - for (var index = this._children.length; index; --index) { - var child = this._children[index - 1]; - for (var category in categories) - this._aggregatedStats[category] += child._aggregatedStats[category]; - } - for (var category in this._aggregatedStats) - this._cpuTime += this._aggregatedStats[category]; + for (var index = this._children.length; index; --index) { + var child = this._children[index - 1]; + for (var category in categories) + this._aggregatedStats[category] += child._aggregatedStats[category]; } + for (var category in this._aggregatedStats) + this._cpuTime += this._aggregatedStats[category]; this._aggregatedStats[this.category.name] += this._selfTime; }, diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index b4fc85fd5..0f137fcfc 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -57,6 +57,7 @@ <file>ExtensionPanel.js</file> <file>ExtensionRegistryStub.js</file> <file>ExtensionServer.js</file> + <file>ExtensionView.js</file> <file>FileContentView.js</file> <file>FileManager.js</file> <file>FileSystemModel.js</file> @@ -78,7 +79,6 @@ <file>ImageView.js</file> <file>IndexedDBModel.js</file> <file>IndexedDBViews.js</file> - <file>InjectedFakeWorker.js</file> <file>inspector.js</file> <file>InspectorBackend.js</file> <file>InspectorFrontendAPI.js</file> diff --git a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js index 34826b52c..efa592161 100644 --- a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js +++ b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js @@ -30,86 +30,6 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} - */ -WebInspector.WorkersSidebarPane = function() -{ - WebInspector.SidebarPane.call(this, WebInspector.UIString("Workers")); - - this._workers = {}; - - this._enableWorkersCheckbox = new WebInspector.Checkbox( - WebInspector.UIString("Debug"), - "sidebar-pane-subtitle", - WebInspector.UIString("Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation")); - this.titleElement.insertBefore(this._enableWorkersCheckbox.element, this.titleElement.firstChild); - - this._enableWorkersCheckbox.addEventListener(this._onTriggerInstrument.bind(this)); - this._enableWorkersCheckbox.checked = false; - - this._listElement = document.createElement("ol"); - this._listElement.className = "workers-list"; - - this.bodyElement.appendChild(this._listElement); - this._treeOutline = new TreeOutline(this._listElement); -} - -WebInspector.WorkersSidebarPane.prototype = { - addWorker: function(id, url, isShared) - { - if (id in this._workers) - return; - var worker = new WebInspector.Worker(id, url, isShared); - this._workers[id] = worker; - - var title = WebInspector.linkifyURLAsNode(url, WebInspector.displayNameForURL(url), "worker-item", true, url); - this._treeOutline.appendChild(new TreeElement(title, worker, false)); - }, - - removeWorker: function(id) - { - if (id in this._workers) { - this._treeOutline.removeChild(this._treeOutline.getCachedTreeElement(this._workers[id])); - delete this._workers[id]; - } - }, - - _setInstrumentation: function(enabled) - { - if (!enabled === !this._fakeWorkersScriptIdentifier) - return; - - if (enabled) { - this._enableWorkersCheckbox.disabled = true; - function callback(error, identifier) - { - this._fakeWorkersScriptIdentifier = identifier; - this._enableWorkersCheckbox.disabled = false; - } - PageAgent.addScriptToEvaluateOnLoad("(" + InjectedFakeWorker + ")", callback.bind(this)); - } else { - PageAgent.removeScriptToEvaluateOnLoad(this._fakeWorkersScriptIdentifier); - this._fakeWorkersScriptIdentifier = null; - } - }, - - reset: function() - { - this._setInstrumentation(this._enableWorkersCheckbox.checked); - this._treeOutline.removeChildren(); - this._workers = {}; - }, - - _onTriggerInstrument: function(event) - { - this._setInstrumentation(this._enableWorkersCheckbox.checked); - } -}; - -WebInspector.WorkersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; - -/** - * @constructor */ WebInspector.Worker = function(id, url, shared) { @@ -122,7 +42,7 @@ WebInspector.Worker = function(id, url, shared) * @constructor * @extends {WebInspector.SidebarPane} */ -WebInspector.WorkerListSidebarPane = function(workerManager) +WebInspector.WorkersSidebarPane = function(workerManager) { WebInspector.SidebarPane.call(this, WebInspector.UIString("Workers")); @@ -159,7 +79,7 @@ WebInspector.WorkerListSidebarPane = function(workerManager) workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkersCleared, this._workersCleared, this); } -WebInspector.WorkerListSidebarPane.prototype = { +WebInspector.WorkersSidebarPane.prototype = { _workerAdded: function(event) { this._addWorker(event.data.workerId, event.data.url, event.data.inspectorConnected); @@ -201,4 +121,4 @@ WebInspector.WorkerListSidebarPane.prototype = { } } -WebInspector.WorkerListSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; +WebInspector.WorkersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js index cbc827153..3f179751d 100644 --- a/Source/WebCore/inspector/front-end/externs.js +++ b/Source/WebCore/inspector/front-end/externs.js @@ -155,8 +155,6 @@ WebInspector.showConsole = function() {} */ WebInspector.evaluateInConsole = function(expression, showResultOnly) {} -var InjectedFakeWorker = function() {} - WebInspector.queryParamsObject = {} WebInspector.Events = { diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index f8faae15b..fdebbb998 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -269,14 +269,20 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { padding: 0 2px; margin: 0; width: 165px; - position: relative; - top: 1px; } .search-replace:focus { outline: none; } +.toolbar-search { + border-spacing: 1px; +} + +.toolbar-search td { + padding: 0 5px 0 0; +} + .toolbar-search-navigation-controls { position: absolute; top: 0; @@ -299,11 +305,6 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { opacity: 1.0; } -.toolbar-search { - line-height: 19px; - height: 22px; -} - .toolbar-search input[type="checkbox"] { position: relative; margin-top: -1px; @@ -314,9 +315,10 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { .toolbar-search button { border: 1px solid rgb(163, 163, 163); border-radius: 12px; - margin: 0 0 0 6px; + margin: 0 6px; font-size: 11px; background-image: -webkit-linear-gradient(rgb(241, 241, 241), rgb(220, 220, 220)); + width: 100%; } .toolbar-search button:active { @@ -328,17 +330,16 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { position: relative; background-color: white; border: 1px solid rgb(163, 163, 163); - margin: 1px 2px 1px 5px; height: 20px; border-radius: 2px; - padding-right: 36px; + padding-top: 1px; } .toolbar-replace-control { border: 1px solid rgb(163, 163, 163); height: 20px; border-radius: 2px; - margin-left: 5px; + width: 100%; } .toolbar-search-navigation.enabled:active { @@ -561,15 +562,16 @@ body.drawer-visible #main-panels { .glyph { position: absolute; top: -1px; + bottom: 1px; left: 0; right: 0; - bottom: 0; background-color: rgba(0, 0, 0, 0.75); z-index: 1; } .glyph.shadow { - top: 1px; + top: 0; + bottom: 0; background-color: white !important; z-index: 0; } @@ -594,6 +596,10 @@ button.status-bar-item { border-right: 1px solid rgb(202, 202, 202); } +.status-bar button.status-bar-item .glyph { + margin: 0 -1px; +} + .status-bar select.status-bar-item:active, .status-bar button.status-bar-item:active { background-color: rgb(163,163,163); @@ -624,7 +630,7 @@ button.status-bar-item.extension { background-image: url(Images/disclosureTriangleSmallDown.png); background-repeat: no-repeat; background-position-x: right; - background-position-y: 6px; + background-position-y: 5px; padding-right: 10px; border-right: 5px solid transparent; } @@ -641,6 +647,7 @@ select.status-bar-item { margin-right: -15px; position: relative; top: -1px; + height: 23px; } select.status-bar-item, select.status-bar-item:hover { @@ -2866,5 +2873,4 @@ body.platform-mac #drawer-status-bar .search-status-bar-progress { right: 0; font-size: 11px; height: auto; - padding-left: 5px; } diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html index 0f165d3e3..159798baa 100644 --- a/Source/WebCore/inspector/front-end/inspector.html +++ b/Source/WebCore/inspector/front-end/inspector.html @@ -119,7 +119,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="StatusBarButton.js"></script> <script type="text/javascript" src="ElementsPanel.js"></script> <script type="text/javascript" src="NetworkPanel.js"></script> - <script type="text/javascript" src="InjectedFakeWorker.js"></script> <script type="text/javascript" src="TextEditor.js"></script> <script type="text/javascript" src="SourceFrame.js"></script> <script type="text/javascript" src="ResourceView.js"></script> @@ -136,6 +135,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="ExtensionAPI.js"></script> <script type="text/javascript" src="ExtensionAuditCategory.js"></script> <script type="text/javascript" src="ExtensionServer.js"></script> + <script type="text/javascript" src="ExtensionView.js"></script> <script type="text/javascript" src="ExtensionPanel.js"></script> <script type="text/javascript" src="AuditsPanel.js"></script> <script type="text/javascript" src="AuditResultView.js"></script> diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 1e6a01294..6db92866a 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -882,20 +882,6 @@ WebInspector.bringToFront = function() InspectorFrontendHost.bringToFront(); } -WebInspector.didCreateWorker = function() -{ - var workersPane = WebInspector.panels.scripts.sidebarPanes.workers; - if (workersPane) - workersPane.addWorker.apply(workersPane, arguments); -} - -WebInspector.didDestroyWorker = function() -{ - var workersPane = WebInspector.panels.scripts.sidebarPanes.workers; - if (workersPane) - workersPane.removeWorker.apply(workersPane, arguments); -} - /** * @param {string=} messageLevel * @param {boolean=} showConsole diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js index 01ed7e86c..35e0620e9 100644 --- a/Source/WebCore/inspector/front-end/utilities.js +++ b/Source/WebCore/inspector/front-end/utilities.js @@ -709,3 +709,59 @@ Map.prototype = { this._map = {}; } }; + + +/** + * @constructor + */ +function StringPool() +{ + this.reset(); +} + +StringPool.prototype = { + /** + * @param {string} string + * @return {string} + */ + intern: function(string) + { + // Do not mess with setting __proto__ to anything but null, just handle it explicitly. + if (string === "__proto__") + return "__proto__"; + var result = this._strings[string]; + if (result === undefined) { + this._strings[string] = string; + result = string; + } + return result; + }, + + reset: function() + { + this._strings = Object.create(null); + }, + + /** + * @param {Object} obj + * @param {number=} depthLimit + */ + internObjectStrings: function(obj, depthLimit) + { + if (typeof depthLimit !== "number") + depthLimit = 100; + else if (--depthLimit < 0) + throw "recursion depth limit reached in StringPool.deepIntern(), perhaps attempting to traverse cyclical references?"; + + for (var field in obj) { + switch (typeof obj[field]) { + case "string": + obj[field] = this.intern(obj[field]); + break; + case "object": + this.internObjectStrings(obj[field], depthLimit); + break; + } + } + } +} diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp index f4d1209f0..e897f8a4e 100644 --- a/Source/WebCore/loader/ImageLoader.cpp +++ b/Source/WebCore/loader/ImageLoader.cpp @@ -125,6 +125,15 @@ inline Document* ImageLoader::document() void ImageLoader::setImage(CachedImage* newImage) { + setImageWithoutConsideringPendingLoadEvent(newImage); + + // Only consider updating the protection ref-count of the Element immediately before returning + // from this function as doing so might result in the destruction of this ImageLoader. + updatedHasPendingLoadEvent(); +} + +void ImageLoader::setImageWithoutConsideringPendingLoadEvent(CachedImage* newImage) +{ ASSERT(m_failedLoadURL.isEmpty()); CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { @@ -150,10 +159,6 @@ void ImageLoader::setImage(CachedImage* newImage) if (RenderImageResource* imageResource = renderImageResource()) imageResource->resetAnimation(); - - // Only consider updating the protection ref-count of the Element immediately before returning - // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); } void ImageLoader::updateFromElement() @@ -263,7 +268,7 @@ void ImageLoader::notifyFinished(CachedResource* resource) && !document()->securityOrigin()->canRequest(image()->response().url()) && !resource->passesAccessControlCheck(document()->securityOrigin())) { - setImage(0); + setImageWithoutConsideringPendingLoadEvent(0); m_hasPendingErrorEvent = true; errorEventSender().dispatchEventSoon(this); @@ -272,6 +277,10 @@ void ImageLoader::notifyFinished(CachedResource* resource) document()->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage); ASSERT(!m_hasPendingLoadEvent); + + // Only consider updating the protection ref-count of the Element immediately before returning + // from this function as doing so might result in the destruction of this ImageLoader. + updatedHasPendingLoadEvent(); return; } diff --git a/Source/WebCore/loader/ImageLoader.h b/Source/WebCore/loader/ImageLoader.h index 269fa67be..178807198 100644 --- a/Source/WebCore/loader/ImageLoader.h +++ b/Source/WebCore/loader/ImageLoader.h @@ -91,6 +91,8 @@ private: RenderImageResource* renderImageResource(); void updateRenderer(); + void setImageWithoutConsideringPendingLoadEvent(CachedImage*); + ImageLoaderClient* m_client; CachedResourceHandle<CachedImage> m_image; AtomicString m_failedLoadURL; diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 6093652d0..fe7d1f9f2 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -266,7 +266,11 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, switch (contentPolicy) { case PolicyUse: { // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255). - bool isRemoteWebArchive = (equalIgnoringCase("application/x-webarchive", mimeType) || equalIgnoringCase("multipart/related", mimeType)) + bool isRemoteWebArchive = (equalIgnoringCase("application/x-webarchive", mimeType) +#if PLATFORM(GTK) + || equalIgnoringCase("message/rfc822", mimeType) +#endif + || equalIgnoringCase("multipart/related", mimeType)) && !m_substituteData.isValid() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()); if (!frameLoader()->client()->canShowMIMEType(mimeType) || isRemoteWebArchive) { frameLoader()->policyChecker()->cannotShowMIMEType(r); diff --git a/Source/WebCore/loader/archive/ArchiveFactory.cpp b/Source/WebCore/loader/archive/ArchiveFactory.cpp index 521deb1d7..f6970aa53 100644 --- a/Source/WebCore/loader/archive/ArchiveFactory.cpp +++ b/Source/WebCore/loader/archive/ArchiveFactory.cpp @@ -68,6 +68,9 @@ static ArchiveMIMETypesMap& archiveMIMETypes() #endif #if ENABLE(MHTML) mimeTypes.set("multipart/related", archiveFactoryCreate<MHTMLArchive>); +#if PLATFORM(GTK) + mimeTypes.set("message/rfc822", archiveFactoryCreate<MHTMLArchive>); +#endif #endif initialized = true; diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 986cbd882..3f4749f27 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -135,7 +135,7 @@ module window { attribute [Replaceable, DoNotCheckSecurityOnGetter, V8CustomSetter] DOMWindow opener; attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow parent; - attribute [Replaceable, DoNotCheckSecurityOnGetter, V8Unforgeable, V8ReadOnly] DOMWindow top; + readonly attribute [DoNotCheckSecurityOnGetter, V8Unforgeable] DOMWindow top; // DOM Level 2 AbstractView Interface readonly attribute Document document; @@ -406,7 +406,7 @@ module window { attribute HTMLButtonElementConstructor HTMLButtonElement; attribute HTMLCanvasElementConstructor HTMLCanvasElement; attribute HTMLDListElementConstructor HTMLDListElement; - attribute [Conditional=DATALIST] HTMLDataListElementConstructor HTMLDataListElement; + attribute [Conditional=DATALIST_ELEMENT] HTMLDataListElementConstructor HTMLDataListElement; attribute [Conditional=DIALOG_ELEMENT, V8EnabledPerContext=dialogElement] HTMLDialogElementConstructor HTMLDialogElement; attribute HTMLDirectoryElementConstructor HTMLDirectoryElement; attribute HTMLDivElementConstructor HTMLDivElement; @@ -432,7 +432,7 @@ module window { attribute HTMLMarqueeElementConstructor HTMLMarqueeElement; attribute HTMLMenuElementConstructor HTMLMenuElement; attribute HTMLMetaElementConstructor HTMLMetaElement; -#if defined(ENABLE_METER_TAG) && ENABLE_METER_TAG +#if defined(ENABLE_METER_ELEMENT) && ENABLE_METER_ELEMENT attribute HTMLMeterElementConstructor HTMLMeterElement; #endif attribute HTMLModElementConstructor HTMLModElement; @@ -444,7 +444,7 @@ module window { attribute HTMLParagraphElementConstructor HTMLParagraphElement; attribute HTMLParamElementConstructor HTMLParamElement; attribute HTMLPreElementConstructor HTMLPreElement; -#if defined(ENABLE_PROGRESS_TAG) && ENABLE_PROGRESS_TAG +#if defined(ENABLE_PROGRESS_ELEMENT) && ENABLE_PROGRESS_ELEMENT attribute HTMLProgressElementConstructor HTMLProgressElement; #endif attribute HTMLQuoteElementConstructor HTMLQuoteElement; diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index fc3ec9e8a..5146e735f 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -1108,10 +1108,9 @@ DragImageRef Frame::nodeImage(Node* node) paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); - OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), 1, ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB)); if (!buffer) return 0; - buffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY())); @@ -1138,10 +1137,9 @@ DragImageRef Frame::dragImageForSelection() paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); - OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), 1, ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB)); if (!buffer) return 0; - buffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY())); diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 6c3d37337..d8823bd95 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -185,7 +185,9 @@ Settings::Settings(Page* page) , m_needsSiteSpecificQuirks(false) , m_fontRenderingMode(0) , m_frameFlatteningEnabled(false) +#if ENABLE(WEB_ARCHIVE) , m_webArchiveDebugModeEnabled(false) +#endif , m_localFileContentSniffingEnabled(false) , m_inApplicationChromeMode(false) , m_offlineWebApplicationCacheEnabled(false) diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 3b23d625b..5be49dff1 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -680,7 +680,9 @@ namespace WebCore { bool m_needsSiteSpecificQuirks : 1; unsigned m_fontRenderingMode : 1; bool m_frameFlatteningEnabled : 1; +#if ENABLE(WEB_ARCHIVE) bool m_webArchiveDebugModeEnabled : 1; +#endif bool m_localFileContentSniffingEnabled : 1; bool m_inApplicationChromeMode : 1; bool m_offlineWebApplicationCacheEnabled : 1; diff --git a/Source/WebCore/page/TouchAdjustment.cpp b/Source/WebCore/page/TouchAdjustment.cpp index cd460c0b7..cf4ba1bb3 100644 --- a/Source/WebCore/page/TouchAdjustment.cpp +++ b/Source/WebCore/page/TouchAdjustment.cpp @@ -239,6 +239,76 @@ float zoomableIntersectionQuotient(const IntPoint& touchHotspot, const IntRect& return rect.size().area() / (float)intersection.size().area(); } +FloatPoint contentsToWindow(FrameView *view, FloatPoint pt) +{ + int x = static_cast<int>(pt.x() + 0.5f); + int y = static_cast<int>(pt.y() + 0.5f); + IntPoint adjusted = view->contentsToWindow(IntPoint(x, y)); + return FloatPoint(adjusted.x(), adjusted.y()); +} + +bool snapTo(const SubtargetGeometry& geom, const IntPoint& touchPoint, const IntRect& touchArea, IntPoint& adjustedPoint) +{ + FrameView* view = geom.node()->document()->view(); + FloatQuad quad = geom.quad(); + + if (quad.isRectilinear()) { + IntRect contentBounds = geom.boundingBox(); + // Convert from frame coordinates to window coordinates. + IntRect bounds = view->contentsToWindow(contentBounds); + if (bounds.contains(touchPoint)) { + adjustedPoint = touchPoint; + return true; + } + if (bounds.intersects(touchArea)) { + bounds.intersect(touchArea); + adjustedPoint = bounds.center(); + return true; + } + return false; + } + + // Non-rectilinear element. + // Convert quad from content to window coordinates. + FloatPoint p1 = contentsToWindow(view, quad.p1()); + FloatPoint p2 = contentsToWindow(view, quad.p2()); + FloatPoint p3 = contentsToWindow(view, quad.p3()); + FloatPoint p4 = contentsToWindow(view, quad.p4()); + quad = FloatQuad(p1, p2, p3, p4); + + if (quad.containsPoint(touchPoint)) { + adjustedPoint = touchPoint; + return true; + } + + // Pull point towards the center of the element. + float cx = 0.25 * (p1.x() + p2.x() + p3.x() + p4.x()); + float cy = 0.25 * (p1.y() + p2.y() + p3.y() + p4.y()); + FloatPoint center = FloatPoint(cx, cy); + + FloatSize pullDirection = center - touchPoint; + float distanceToCenter = pullDirection.diagonalLength(); + + // Use distance from center to corner of touch area to limit adjustment distance. + float dx = 0.5f * touchArea.width(); + float dy = 0.5f * touchArea.height(); + float touchRadius = sqrt(dx * dx + dy * dy); + + float scaleFactor = touchRadius / distanceToCenter; + if (scaleFactor > 1) + scaleFactor = 1; + pullDirection.scale(scaleFactor); + + int x = static_cast<int>(touchPoint.x() + pullDirection.width()); + int y = static_cast<int>(touchPoint.y() + pullDirection.height()); + IntPoint point(x, y); + + if (quad.containsPoint(point)) { + adjustedPoint = point; + return true; + } + return false; +} // A generic function for finding the target node with the lowest distance metric. A distance metric here is the result // of a distance-like function, that computes how well the touch hits the node. @@ -249,17 +319,21 @@ bool findNodeWithLowestDistanceMetric(Node*& targetNode, IntPoint& targetPoint, float bestDistanceMetric = std::numeric_limits<float>::infinity(); SubtargetGeometryList::const_iterator it = subtargets.begin(); const SubtargetGeometryList::const_iterator end = subtargets.end(); + IntPoint adjustedPoint; for (; it != end; ++it) { Node* node = it->node(); float distanceMetric = distanceFunction(touchHotspot, touchArea, *it); if (distanceMetric < bestDistanceMetric) { - targetPoint = roundedIntPoint(it->quad().center()); - targetArea = it->boundingBox(); - targetNode = node; - bestDistanceMetric = distanceMetric; + if (snapTo(*it, touchHotspot, touchArea, adjustedPoint)) { + targetPoint = adjustedPoint; + targetArea = it->boundingBox(); + targetNode = node; + bestDistanceMetric = distanceMetric; + } } else if (distanceMetric == bestDistanceMetric) { // Try to always return the inner-most element. - if (node->isDescendantOf(targetNode)) { + if (node->isDescendantOf(targetNode) && snapTo(*it, touchHotspot, touchArea, adjustedPoint)) { + targetPoint = adjustedPoint; targetNode = node; targetArea = it->boundingBox(); } @@ -267,9 +341,7 @@ bool findNodeWithLowestDistanceMetric(Node*& targetNode, IntPoint& targetPoint, } if (targetNode) { targetArea = targetNode->document()->view()->contentsToWindow(targetArea); - targetPoint = targetNode->document()->view()->contentsToWindow(targetPoint); } - return (targetNode); } diff --git a/Source/WebCore/platform/ColorChooserClient.h b/Source/WebCore/platform/ColorChooserClient.h index 54fa5cc01..b39c037ce 100644 --- a/Source/WebCore/platform/ColorChooserClient.h +++ b/Source/WebCore/platform/ColorChooserClient.h @@ -4,6 +4,7 @@ #if ENABLE(INPUT_TYPE_COLOR) #include "ColorChooser.h" +#include "IntRect.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -17,6 +18,7 @@ public: virtual void didChooseColor(const Color&) = 0; virtual void didEndChooser() = 0; + virtual IntRect elementRectRelativeToWindow() const = 0; }; } // namespace WebCore diff --git a/Source/WebCore/platform/audio/FFTFrameStub.cpp b/Source/WebCore/platform/audio/FFTFrameStub.cpp index 19a800d35..6a27be5f6 100644 --- a/Source/WebCore/platform/audio/FFTFrameStub.cpp +++ b/Source/WebCore/platform/audio/FFTFrameStub.cpp @@ -69,7 +69,7 @@ void FFTFrame::multiply(const FFTFrame& frame) ASSERT_NOT_REACHED(); } -void FFTFrame::doFFT(float* data) +void FFTFrame::doFFT(const float* data) { ASSERT_NOT_REACHED(); } diff --git a/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp b/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp index 40f8925a5..dd8ace385 100644 --- a/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp +++ b/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp @@ -47,11 +47,13 @@ IntSize dragImageSize(DragImageRef image) if (!image) return IntSize(); - return IntSize(image->width(), image->height()); + return IntSize(image->bitmap->width(), image->bitmap->height()); } void deleteDragImage(DragImageRef image) { + if (image) + delete image->bitmap; delete image; } @@ -60,13 +62,14 @@ DragImageRef scaleDragImage(DragImageRef image, FloatSize scale) if (!image) return 0; - int imageWidth = scale.width() * image->width(); - int imageHeight = scale.height() * image->height(); - DragImageRef scaledImage = new SkBitmap( - skia::ImageOperations::Resize(*image, skia::ImageOperations::RESIZE_LANCZOS3, + int imageWidth = scale.width() * image->bitmap->width(); + int imageHeight = scale.height() * image->bitmap->height(); + SkBitmap* scaledImage = new SkBitmap( + skia::ImageOperations::Resize(*image->bitmap, skia::ImageOperations::RESIZE_LANCZOS3, imageWidth, imageHeight)); - delete image; - return scaledImage; + delete image->bitmap; + image->bitmap = scaledImage; + return image; } DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) @@ -74,12 +77,12 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) if (!image) return 0; - image->setIsOpaque(false); - image->lockPixels(); + image->bitmap->setIsOpaque(false); + image->bitmap->lockPixels(); - for (int row = 0; row < image->height(); ++row) { - for (int column = 0; column < image->width(); ++column) { - uint32_t* pixel = image->getAddr32(column, row); + for (int row = 0; row < image->bitmap->height(); ++row) { + for (int column = 0; column < image->bitmap->width(); ++column) { + uint32_t* pixel = image->bitmap->getAddr32(column, row); *pixel = SkPreMultiplyARGB(SkColorGetA(*pixel) * fraction, SkColorGetR(*pixel), SkColorGetG(*pixel), @@ -87,7 +90,7 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) } } - image->unlockPixels(); + image->bitmap->unlockPixels(); return image; } @@ -103,7 +106,10 @@ DragImageRef createDragImageFromImage(Image* image, RespectImageOrientationEnum) SkBitmap* dragImage = new SkBitmap(); bitmap->bitmap().copyTo(dragImage, SkBitmap::kARGB_8888_Config); - return dragImage; + DragImageChromium* dragImageChromium = new DragImageChromium; + dragImageChromium->bitmap = dragImage; + dragImageChromium->resolutionScale = bitmap->resolutionScale(); + return dragImageChromium; } DragImageRef createDragImageIconForCachedImage(CachedImage*) diff --git a/Source/WebCore/platform/chromium/DragImageRef.h b/Source/WebCore/platform/chromium/DragImageRef.h index 7a6aca889..0d03262ff 100644 --- a/Source/WebCore/platform/chromium/DragImageRef.h +++ b/Source/WebCore/platform/chromium/DragImageRef.h @@ -33,7 +33,12 @@ class SkBitmap; namespace WebCore { -typedef SkBitmap* DragImageRef; +struct DragImageChromium { + SkBitmap* bitmap; + float resolutionScale; +}; + +typedef DragImageChromium* DragImageRef; } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/PlatformSupport.h b/Source/WebCore/platform/chromium/PlatformSupport.h index f4e5ce519..c113f8ffd 100644 --- a/Source/WebCore/platform/chromium/PlatformSupport.h +++ b/Source/WebCore/platform/chromium/PlatformSupport.h @@ -117,18 +117,6 @@ public: // Forms -------------------------------------------------------------- static void notifyFormStateChanged(const Document*); - // Databases ---------------------------------------------------------- - // Returns a handle to the DB file and ooptionally a handle to its containing directory - static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags); - // Returns a SQLite code (SQLITE_OK = 0, on success) - static int databaseDeleteFile(const String& vfsFileName, bool syncDir = false); - // Returns the attributes of the DB file - static long databaseGetFileAttributes(const String& vfsFileName); - // Returns the size of the DB file - static long long databaseGetFileSize(const String& vfsFileName); - // Returns the space available for the origin - static long long databaseGetSpaceAvailableForOrigin(const String& originIdentifier); - // IndexedDB ---------------------------------------------------------- static PassRefPtr<IDBFactoryBackendInterface> idbFactory(); // Extracts keyPath from values and returns the corresponding keys. diff --git a/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp index 63a29314d..2b5eabd05 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp @@ -31,15 +31,16 @@ using namespace WebCore; namespace WebKit { -PassOwnPtr<WebCompositorIOSurfaceQuad> WebCompositorIOSurfaceQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) +PassOwnPtr<WebCompositorIOSurfaceQuad> WebCompositorIOSurfaceQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) { - return adoptPtr(new WebCompositorIOSurfaceQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId)); + return adoptPtr(new WebCompositorIOSurfaceQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId, orientation)); } -WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) +WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::IOSurfaceContent, quadRect) , m_ioSurfaceSize(ioSurfaceSize) , m_ioSurfaceTextureId(ioSurfaceTextureId) + , m_orientation(orientation) { } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp index 7a02ca0ea..6d617cd84 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp @@ -41,6 +41,7 @@ namespace WebKit { WebCompositorQuad::WebCompositorQuad(const WebCompositorSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) : m_sharedQuadState(sharedQuadState) + , m_sharedQuadStateId(sharedQuadState->id) , m_material(material) , m_quadRect(quadRect) , m_quadVisibleRect(quadRect) @@ -94,4 +95,10 @@ unsigned WebCompositorQuad::size() const return sizeof(WebCompositorQuad); } +void WebCompositorQuad::setSharedQuadState(const WebCompositorSharedQuadState* sharedQuadState) +{ + m_sharedQuadState = sharedQuadState; + m_sharedQuadStateId = sharedQuadState->id; +} + } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp index 313564c00..91ef3eaf9 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp @@ -36,18 +36,20 @@ using WebCore::IntRect; namespace WebKit { WebCompositorSharedQuadState::WebCompositorSharedQuadState() - : opacity(0) + : id(0) + , opacity(0) , opaque(false) { } -PassOwnPtr<WebCompositorSharedQuadState> WebCompositorSharedQuadState::create(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) +PassOwnPtr<WebCompositorSharedQuadState> WebCompositorSharedQuadState::create(int id, const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) { - return adoptPtr(new WebCompositorSharedQuadState(quadTransform, visibleContentRect, scissorRect, opacity, opaque)); + return adoptPtr(new WebCompositorSharedQuadState(id, quadTransform, visibleContentRect, scissorRect, opacity, opaque)); } -WebCompositorSharedQuadState::WebCompositorSharedQuadState(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) - : quadTransform(quadTransform) +WebCompositorSharedQuadState::WebCompositorSharedQuadState(int id, const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) + : id(id) + , quadTransform(quadTransform) , visibleContentRect(visibleContentRect) , scissorRect(scissorRect) , opacity(opacity) diff --git a/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp index e5f45fdc4..dd0b67a41 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp @@ -31,14 +31,14 @@ using namespace WebCore; namespace WebKit { -PassOwnPtr<WebCompositorTextureQuad> WebCompositorTextureQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +PassOwnPtr<WebCompositorTextureQuad> WebCompositorTextureQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) { - return adoptPtr(new WebCompositorTextureQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped)); + return adoptPtr(new WebCompositorTextureQuad(sharedQuadState, quadRect, resourceId, premultipliedAlpha, uvRect, flipped)); } -WebCompositorTextureQuad::WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +WebCompositorTextureQuad::WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TextureContent, quadRect) - , m_textureId(textureId) + , m_resourceId(resourceId) , m_premultipliedAlpha(premultipliedAlpha) , m_uvRect(uvRect) , m_flipped(flipped) diff --git a/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp index 27aa77508..de0e81dfc 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp @@ -31,14 +31,14 @@ using namespace WebCore; namespace WebKit { -PassOwnPtr<WebCompositorTileQuad> WebCompositorTileQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +PassOwnPtr<WebCompositorTileQuad> WebCompositorTileQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) { - return adoptPtr(new WebCompositorTileQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + return adoptPtr(new WebCompositorTileQuad(sharedQuadState, quadRect, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } -WebCompositorTileQuad::WebCompositorTileQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +WebCompositorTileQuad::WebCompositorTileQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TiledContent, quadRect) - , m_textureId(textureId) + , m_resourceId(resourceId) , m_textureOffset(textureOffset) , m_textureSize(textureSize) , m_textureFilter(textureFilter) diff --git a/Source/WebCore/platform/efl/ErrorsEfl.cpp b/Source/WebCore/platform/efl/ErrorsEfl.cpp new file mode 100644 index 000000000..106f8776e --- /dev/null +++ b/Source/WebCore/platform/efl/ErrorsEfl.cpp @@ -0,0 +1,109 @@ +/* + * 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 "ErrorsEfl.h" + +#include "DocumentLoader.h" +#include "Frame.h" +#include "PrintContext.h" +#include "ResourceError.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" + +namespace WebCore { + +ResourceError cancelledError(const ResourceRequest& request) +{ + return ResourceError(errorDomainNetwork, NetworkErrorCancelled, request.url().string(), "Load request cancelled"); +} + +ResourceError blockedError(const ResourceRequest& request) +{ + return ResourceError(errorDomainPolicy, PolicyErrorCannotUseRestrictedPort, request.url().string(), "Not allowed to use restricted network port"); +} + +ResourceError cannotShowURLError(const ResourceRequest& request) +{ + return ResourceError(errorDomainPolicy, PolicyErrorCannotShowURL, request.url().string(), "URL cannot be shown"); +} + +ResourceError interruptedForPolicyChangeError(const ResourceRequest& request) +{ + return ResourceError(errorDomainPolicy, PolicyErrorFrameLoadInterruptedByPolicyChange, request.url().string(), "Frame load was interrupted"); +} + +ResourceError cannotShowMIMETypeError(const ResourceResponse& response) +{ + return ResourceError(errorDomainPolicy, PolicyErrorCannotShowMimeType, response.url().string(), "Content with the specified MIME type cannot be shown"); +} + +ResourceError fileDoesNotExistError(const ResourceResponse& response) +{ + return ResourceError(errorDomainNetwork, NetworkErrorFileDoesNotExist, response.url().string(), "File does not exist"); +} + +ResourceError pluginWillHandleLoadError(const ResourceResponse& response) +{ + return ResourceError(errorDomainPlugin, PluginErrorWillHandleLoad, response.url().string(), "Plugin will handle load"); +} + +ResourceError downloadNetworkError(const ResourceError& networkError) +{ + return ResourceError(errorDomainDownload, DownloadErrorNetwork, networkError.failingURL(), networkError.localizedDescription()); +} + +ResourceError downloadCancelledByUserError(const ResourceResponse& response) +{ + return ResourceError(errorDomainDownload, DownloadErrorCancelledByUser, response.url().string(), "User cancelled the download"); +} + +ResourceError downloadDestinationError(const ResourceResponse& response, const String& errorMessage) +{ + return ResourceError(errorDomainDownload, DownloadErrorDestination, response.url().string(), errorMessage); +} + +ResourceError printError(const PrintContext* printContext, const String& errorMessage) +{ + DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader(); + + return ResourceError(errorDomainPrint, PrintErrorGeneral, documentLoader ? documentLoader->url() : KURL(), errorMessage); +} + +ResourceError printerNotFoundError(const PrintContext* printContext) +{ + DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader(); + + return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, documentLoader ? documentLoader->url() : KURL(), "Printer not found"); +} + +ResourceError invalidPageRangeToPrint(const PrintContext* printContext) +{ + DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader(); + + return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, documentLoader ? documentLoader->url() : KURL(), "Invalid page range"); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/efl/ErrorsEfl.h b/Source/WebCore/platform/efl/ErrorsEfl.h new file mode 100644 index 000000000..9372afe9c --- /dev/null +++ b/Source/WebCore/platform/efl/ErrorsEfl.h @@ -0,0 +1,99 @@ +/* + * 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 ErrorsEfl_h +#define ErrorsEfl_h + +#include "PlatformString.h" + +namespace WebCore { + +class PrintContext; +class ResourceError; +class ResourceRequest; +class ResourceResponse; + +static const char errorDomainNetwork[] = "WebKitNetworkError"; +static const char errorDomainPolicy[] = "WebKitPolicyError"; +static const char errorDomainPlugin[] = "WebKitPluginError"; +static const char errorDomainDownload[] = "WebKitDownloadError"; +static const char errorDomainPrint[] = "WebKitPrintError"; + +enum NetworkError { + NetworkErrorFailed = 399, + NetworkErrorTransport = 300, + NetworkErrorUnknownProtocol = 301, + NetworkErrorCancelled = 302, + NetworkErrorFileDoesNotExist = 303 +}; + +// Sync'd with Mac's WebKit Errors at: +// Source/WebKit/mac/Misc/WebKitErrors[Private].h +enum PolicyError { + PolicyErrorFailed = 199, + PolicyErrorCannotShowMimeType = 100, + PolicyErrorCannotShowURL = 101, + PolicyErrorFrameLoadInterruptedByPolicyChange = 102, + PolicyErrorCannotUseRestrictedPort = 103 +}; + +enum PluginError { + PluginErrorFailed = 299, + PluginErrorCannotFindPlugin = 200, + PluginErrorCannotLoadPlugin = 201, + PluginErrorJavaUnavailable = 202, + PluginErrorConnectionCancelled = 203, + PluginErrorWillHandleLoad = 204 +}; + +enum DownloadError { + DownloadErrorNetwork = 499, + DownloadErrorCancelledByUser = 400, + DownloadErrorDestination = 401 +}; + +enum PrintError { + PrintErrorGeneral = 599, + PrintErrorPrinterNotFound = 500, + PrintErrorInvalidPageRange = 501 +}; + +ResourceError cancelledError(const ResourceRequest&); +ResourceError blockedError(const ResourceRequest&); +ResourceError cannotShowURLError(const ResourceRequest&); +ResourceError interruptedForPolicyChangeError(const ResourceRequest&); +ResourceError cannotShowMIMETypeError(const ResourceResponse&); +ResourceError fileDoesNotExistError(const ResourceResponse&); +ResourceError pluginWillHandleLoadError(const ResourceResponse&); +ResourceError downloadNetworkError(const ResourceError&); +ResourceError downloadCancelledByUserError(const ResourceResponse&); +ResourceError downloadDestinationError(const ResourceResponse&, const String& errorMessage); +ResourceError printError(const PrintContext*, const String& errorMessage); +ResourceError printerNotFoundError(const PrintContext*); +ResourceError invalidPageRangeToPrint(const PrintContext*); + +} + +#endif // ErrorsEfl_h diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.cpp b/Source/WebCore/platform/efl/RenderThemeEfl.cpp index 902341aaa..e5784af03 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/Source/WebCore/platform/efl/RenderThemeEfl.cpp @@ -339,7 +339,7 @@ bool RenderThemeEfl::paintThemePart(RenderObject* object, FormType type, const P msg->val[0] = 0; msg->val[1] = 0.1; edje_object_message_send(entry->o, EDJE_MESSAGE_FLOAT_SET, 0, msg); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) } else if (type == ProgressBar) { RenderProgress* renderProgress = toRenderProgress(object); Edje_Message_Float_Set* msg; @@ -566,7 +566,7 @@ const char* RenderThemeEfl::edjeGroupFromFormType(FormType type) const W("entry"), W("checkbox"), W("combo"), -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) W("progressbar"), #endif W("search/field"), @@ -786,6 +786,20 @@ void RenderThemeEfl::adjustSliderThumbSize(RenderStyle* style, Element*) const #endif } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeEfl::sliderTickSize() const +{ + // FIXME: We need to set this to the size of one tick mark. + return IntSize(0, 0); +} + +int RenderThemeEfl::sliderTickOffsetFromTrackCenter() const +{ + // FIXME: We need to set this to the position of the tick marks. + return 0; +} +#endif + bool RenderThemeEfl::paintSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect) { // We've already painted it in paintSliderTrack(), no need to do anything here. @@ -1020,7 +1034,7 @@ void RenderThemeEfl::systemFont(int propId, FontDescription& fontDescription) co fontDescription.setItalic(false); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) void RenderThemeEfl::adjustProgressBarStyle(StyleResolver*, RenderStyle* style, Element*) const { style->setBoxShadow(nullptr); diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.h b/Source/WebCore/platform/efl/RenderThemeEfl.h index bbcb4e314..594377ab8 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.h +++ b/Source/WebCore/platform/efl/RenderThemeEfl.h @@ -48,7 +48,7 @@ enum FormType { // KEEP IN SYNC WITH edjeGroupFromFormType() TextField, CheckBox, ComboBox, -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) ProgressBar, #endif SearchField, @@ -161,6 +161,11 @@ public: virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const; @@ -168,7 +173,7 @@ public: static void setDefaultFontSize(int fontsize); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; diff --git a/Source/WebCore/platform/graphics/FontCache.h b/Source/WebCore/platform/graphics/FontCache.h index 9063ca7a2..c71e41fe3 100644 --- a/Source/WebCore/platform/graphics/FontCache.h +++ b/Source/WebCore/platform/graphics/FontCache.h @@ -130,7 +130,7 @@ private: // Don't purge if this count is > 0; int m_purgePreventCount; -#if USE(CORE_TEXT) || OS(ANDROID) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || OS(ANDROID) friend class ComplexTextController; #endif friend class SimpleFontData; // For getCachedFontData(const FontPlatformData*) diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index c2feec293..7433df626 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -510,7 +510,7 @@ public: PlatformLayer* platformLayer() const; #endif #elif PLATFORM(EFL) - PlatformGraphicsContext3D platformGraphicsContext3D() const; + PlatformGraphicsContext3D platformGraphicsContext3D(); Platform3DObject platformTexture() const { return m_texture; } #if USE(ACCELERATED_COMPOSITING) PlatformLayer* platformLayer() const; diff --git a/Source/WebCore/platform/graphics/SimpleFontData.h b/Source/WebCore/platform/graphics/SimpleFontData.h index 6fc918a43..425cf7302 100644 --- a/Source/WebCore/platform/graphics/SimpleFontData.h +++ b/Source/WebCore/platform/graphics/SimpleFontData.h @@ -36,11 +36,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/text/StringHash.h> -#if USE(ATSUI) -typedef struct OpaqueATSUStyle* ATSUStyle; -#endif - -#if PLATFORM(MAC) || USE(CORE_TEXT) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) #include <wtf/RetainPtr.h> #endif @@ -176,24 +172,11 @@ public: NSFont* getNSFont() const { return m_platformData.nsFont(); } #endif -#if PLATFORM(MAC) || USE(CORE_TEXT) - CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; -#endif - #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) + CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; #endif -#if USE(ATSUI) - void checkShapesArabic() const; - bool shapesArabic() const - { - if (!m_checkedShapesArabic) - checkShapesArabic(); - return m_shapesArabic; - } -#endif - #if PLATFORM(QT) #if !HAVE(QRAWFONT) QFont getQtFont() const { return m_platformData.font(); } @@ -290,22 +273,8 @@ private: float m_syntheticBoldOffset; #endif - -#if USE(ATSUI) -public: - mutable HashMap<unsigned, ATSUStyle> m_ATSUStyleMap; - mutable bool m_ATSUMirrors; - mutable bool m_checkedShapesArabic; - mutable bool m_shapesArabic; - -private: -#endif - -#if PLATFORM(MAC) || USE(CORE_TEXT) - mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; -#endif - #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) + mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport; #endif diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp index 781dfc5c8..27fdf6491 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp @@ -509,6 +509,11 @@ void MediaPlayerPrivate::updateStates() #if USE(ACCELERATED_COMPOSITING) setBuffering(false); m_mediaIsBuffering = false; + // Remove media player from platform layer (remove hole punch rect). + if (m_platformLayer) { + static_cast<VideoLayerWebKitThread*>(m_platformLayer.get())->setMediaPlayer(0); + m_platformLayer.clear(); + } #endif if (isFullscreen()) element->exitFullscreen(); @@ -517,6 +522,9 @@ void MediaPlayerPrivate::updateStates() #if USE(ACCELERATED_COMPOSITING) m_showBufferingImage = false; m_mediaIsBuffering = false; + // Create platform layer for video (create hole punch rect). + if (!m_platformLayer) + m_platformLayer = VideoLayerWebKitThread::create(m_webCorePlayer); #endif break; case MMRPlayer::MP_STATE_UNSUPPORTED: @@ -529,14 +537,8 @@ void MediaPlayerPrivate::updateStates() m_readyState = MediaPlayer::HaveEnoughData; } - if (m_readyState != oldReadyState) { + if (m_readyState != oldReadyState) m_webCorePlayer->readyStateChanged(); -#if USE(ACCELERATED_COMPOSITING) - // Create platform layer for video. - if (!m_platformLayer) - m_platformLayer = VideoLayerWebKitThread::create(m_webCorePlayer); -#endif - } if (m_networkState != oldNetworkState) m_webCorePlayer->networkStateChanged(); } diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index fdaa5274c..bd1c9bab9 100644 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -232,6 +232,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + cairo_t* cr = platformContext()->cr(); cairo_save(cr); diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 2657d5412..cca3de0af 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -378,6 +378,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + CGContextRef context = platformContext(); CGContextFillRect(context, rect); diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp index d75cf054d..d244de674 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp @@ -33,8 +33,6 @@ #include "LayerPainterChromium.h" #include "PlatformColor.h" #include "PlatformContextSkia.h" -#include "TextureAllocator.h" -#include "cc/CCGraphicsContext.h" #include "skia/ext/platform_canvas.h" namespace WebCore { @@ -49,20 +47,19 @@ BitmapCanvasLayerTextureUpdater::Texture::~Texture() { } -void BitmapCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) +void BitmapCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) { - textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect); + textureUpdater()->updateTextureRect(resourceProvider, texture(), sourceRect, destRect); } -PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) { - return adoptRef(new BitmapCanvasLayerTextureUpdater(painter, useMapTexSubImage)); + return adoptRef(new BitmapCanvasLayerTextureUpdater(painter)); } -BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) : CanvasLayerTextureUpdater(painter) , m_opaque(false) - , m_texSubImage(useMapTexSubImage) { } @@ -84,8 +81,6 @@ LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampled void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) { - m_texSubImage.setSubImageSize(tileSize); - if (m_canvasSize != contentRect.size()) { m_canvasSize = contentRect.size(); m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_canvasSize.height(), m_opaque)); @@ -94,13 +89,12 @@ void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect); } -void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) +void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) { const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false); bitmap.lockPixels(); - texture->bindTexture(context, allocator); - m_texSubImage.upload(static_cast<const uint8_t*>(bitmap.getPixels()), contentRect(), sourceRect, destRect, texture->format(), context); + texture->upload(resourceProvider, static_cast<const uint8_t*>(bitmap.getPixels()), contentRect(), sourceRect, destRect); bitmap.unlockPixels(); } diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h index 276e2b391..a7f11fa53 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h @@ -30,15 +30,12 @@ #if USE(ACCELERATED_COMPOSITING) #include "CanvasLayerTextureUpdater.h" -#include "LayerTextureSubImage.h" class SkCanvas; namespace WebCore { class LayerPainterChromium; -class CCGraphicsContext; -class TextureAllocator; // This class rasterizes the contentRect into a skia bitmap canvas. It then updates // textures by copying from the canvas into the texture, using MapSubImage if @@ -50,7 +47,7 @@ public: Texture(BitmapCanvasLayerTextureUpdater*, PassOwnPtr<CCPrioritizedTexture>); virtual ~Texture(); - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; private: BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -58,23 +55,22 @@ public: BitmapCanvasLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); + static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); virtual ~BitmapCanvasLayerTextureUpdater(); virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*); virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) OVERRIDE; - void updateTextureRect(CCGraphicsContext*, TextureAllocator*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); + void updateTextureRect(CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); virtual void setOpaque(bool) OVERRIDE; private: - BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); + explicit BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); OwnPtr<SkCanvas> m_canvas; IntSize m_canvasSize; bool m_opaque; - LayerTextureSubImage m_texSubImage; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp index 86fb2c8c3..285924253 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp @@ -34,8 +34,6 @@ #include "PlatformColor.h" #include "SkCanvas.h" #include "SkDevice.h" -#include "TextureAllocator.h" -#include "cc/CCGraphicsContext.h" namespace WebCore { @@ -55,24 +53,21 @@ void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRec textureUpdater()->paintContentsRect(&canvas, sourceRect); } -void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) +void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) { - texture()->bindTexture(context, allocator); - m_bitmap.lockPixels(); - textureUpdater()->updateTextureRect(context, texture()->format(), destRect, static_cast<uint8_t*>(m_bitmap.getPixels())); + texture()->upload(resourceProvider, static_cast<uint8_t*>(m_bitmap.getPixels()), destRect, destRect, destRect); m_bitmap.unlockPixels(); m_bitmap.reset(); } -PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) { - return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter, useMapTexSubImage)); + return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter)); } -BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) : SkPictureCanvasLayerTextureUpdater(painter) - , m_texSubImage(useMapTexSubImage) { } @@ -92,12 +87,6 @@ LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } -void BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) -{ - m_texSubImage.setSubImageSize(tileSize); - SkPictureCanvasLayerTextureUpdater::prepareToUpdate(contentRect, tileSize, contentsWidthScale, contentsHeightScale, resultingOpaqueRect); -} - void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect) { // Translate the origin of contentRect to that of sourceRect. @@ -106,10 +95,5 @@ void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canva drawPicture(canvas); } -void BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, GC3Denum format, const IntRect& destRect, const uint8_t* pixels) -{ - m_texSubImage.upload(pixels, destRect, destRect, destRect, format, context); -} - } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h index 9f1388827..855d40585 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h @@ -28,14 +28,11 @@ #define BitmapSkPictureCanvasLayerTextureUpdater_h #if USE(ACCELERATED_COMPOSITING) -#include "LayerTextureSubImage.h" #include "SkBitmap.h" #include "SkPictureCanvasLayerTextureUpdater.h" namespace WebCore { -class TextureAllocator; - // This class records the contentRect into an SkPicture, then software rasterizes // the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting. class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { @@ -45,7 +42,7 @@ public: Texture(BitmapSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<CCPrioritizedTexture>); virtual void prepareRect(const IntRect& sourceRect) OVERRIDE; - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; private: BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -54,19 +51,15 @@ public: BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); + static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); virtual ~BitmapSkPictureCanvasLayerTextureUpdater(); virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) OVERRIDE; void paintContentsRect(SkCanvas*, const IntRect& sourceRect); - void updateTextureRect(CCGraphicsContext*, GC3Denum format, const IntRect& destRect, const uint8_t* pixels); private: - BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); - - LayerTextureSubImage m_texSubImage; + explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); }; } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 9f40f7fe1..719f9d899 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -122,9 +122,9 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() if (layerTreeHost()->settings().acceleratePainting) m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); else if (CCSettings::perTilePaintingEnabled()) - m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); else - m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); m_textureUpdater->setOpaque(opaque()); GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; diff --git a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp index 7e9ac0a6c..436f346d4 100644 --- a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp @@ -39,20 +39,16 @@ namespace WebCore { static PassOwnPtr<SkCanvas> createAcceleratedCanvas(GraphicsContext3D* context, - TextureAllocator* allocator, - CCPrioritizedTexture* texture) + IntSize canvasSize, + unsigned textureId) { - // Allocate so that we have a valid texture id. - texture->acquireBackingTexture(allocator); - GrContext* grContext = context->grContext(); - IntSize canvasSize = texture->size(); GrPlatformTextureDesc textureDesc; textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag; textureDesc.fWidth = canvasSize.width(); textureDesc.fHeight = canvasSize.height(); textureDesc.fConfig = kSkia8888_PM_GrPixelConfig; - textureDesc.fTextureHandle = texture->textureId(); + textureDesc.fTextureHandle = textureId; SkAutoTUnref<GrTexture> target(grContext->createPlatformTexture(textureDesc)); SkAutoTUnref<SkDevice> device(new SkGpuDevice(grContext, target.get())); return adoptPtr(new SkCanvas(device.get())); @@ -68,12 +64,12 @@ FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::~Texture() { } -void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext*, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) +void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) { RefPtr<GraphicsContext3D> sharedContext = CCProxy::hasImplThread() ? SharedGraphicsContext3D::getForImplThread() : SharedGraphicsContext3D::get(); if (!sharedContext) return; - textureUpdater()->updateTextureRect(sharedContext.release(), allocator, texture(), sourceRect, destRect); + textureUpdater()->updateTextureRect(sharedContext.release(), resourceProvider, texture(), sourceRect, destRect); } PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) @@ -101,15 +97,17 @@ LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUp return LayerTextureUpdater::SampledTexelFormatRGBA; } -void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(PassRefPtr<GraphicsContext3D> prpContext, TextureAllocator* allocator, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) +void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(PassRefPtr<GraphicsContext3D> prpContext, CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) { RefPtr<GraphicsContext3D> context(prpContext); // Make sure ganesh uses the correct GL context. context->makeContextCurrent(); + texture->acquireBackingTexture(resourceProvider); + CCScopedLockResourceForWrite lock(resourceProvider, texture->resourceId()); // Create an accelerated canvas to draw on. - OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context.get(), allocator, texture); + OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context.get(), texture->size(), lock.textureId()); // The compositor expects the textures to be upside-down so it can flip // the final composited image. Ganesh renders the image upright so we diff --git a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h index 8f630a922..44649e473 100644 --- a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h @@ -43,7 +43,7 @@ public: Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<CCPrioritizedTexture>); virtual ~Texture(); - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; private: FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -56,7 +56,7 @@ public: virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; - void updateTextureRect(PassRefPtr<GraphicsContext3D>, TextureAllocator*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); + void updateTextureRect(PassRefPtr<GraphicsContext3D>, CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); private: explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); diff --git a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp index c21726e9f..1eb237c4c 100644 --- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp @@ -663,11 +663,7 @@ void GraphicsLayerChromium::updateChildList() void GraphicsLayerChromium::updateLayerPosition() { - // Position is offset on the layer by the layer anchor point. - FloatPoint layerPosition(m_position.x() + m_anchorPoint.x() * m_size.width(), - m_position.y() + m_anchorPoint.y() * m_size.height()); - - primaryLayer().setPosition(layerPosition); + primaryLayer().setPosition(m_position); } void GraphicsLayerChromium::updateLayerSize() @@ -675,26 +671,18 @@ void GraphicsLayerChromium::updateLayerSize() IntSize layerSize(m_size.width(), m_size.height()); if (!m_transformLayer.isNull()) { m_transformLayer.setBounds(layerSize); - // The anchor of the contents layer is always at 0.5, 0.5, so the position is center-relative. - FloatPoint centerPoint(m_size.width() / 2, m_size.height() / 2); - m_layer.setPosition(centerPoint); + m_layer.setPosition(FloatPoint()); } m_layer.setBounds(layerSize); // Note that we don't resize m_contentsLayer. It's up the caller to do that. - - // If we've changed the bounds, we need to recalculate the position - // of the layer, taking anchor point into account. - updateLayerPosition(); } void GraphicsLayerChromium::updateAnchorPoint() { primaryLayer().setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y())); primaryLayer().setAnchorPointZ(m_anchorPoint.z()); - - updateLayerPosition(); } void GraphicsLayerChromium::updateTransform() @@ -729,7 +717,7 @@ void GraphicsLayerChromium::updateLayerPreserves3D() updateTransform(); updateChildrenTransform(); - m_layer.setPosition(FloatPoint(m_size.width() / 2.0f, m_size.height() / 2.0f)); + m_layer.setPosition(FloatPoint::zero()); m_layer.setAnchorPoint(FloatPoint(0.5f, 0.5f)); m_layer.setTransform(SkMatrix44()); diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index 696563acf..ba6094379 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -34,7 +34,6 @@ #include "ImageLayerChromium.h" -#include "LayerTextureSubImage.h" #include "LayerTextureUpdater.h" #include "PlatformColor.h" #include "cc/CCLayerTreeHost.h" @@ -51,9 +50,9 @@ public: { } - virtual void updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE + virtual void updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE { - textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect); + textureUpdater()->updateTextureRect(resourceProvider, texture(), sourceRect, destRect); } private: @@ -62,9 +61,9 @@ public: ImageLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<ImageLayerTextureUpdater> create(bool useMapTexSubImage) + static PassRefPtr<ImageLayerTextureUpdater> create() { - return adoptRef(new ImageLayerTextureUpdater(useMapTexSubImage)); + return adoptRef(new ImageLayerTextureUpdater()); } virtual ~ImageLayerTextureUpdater() { } @@ -80,10 +79,8 @@ public: LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } - void updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) + void updateTextureRect(CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) { - texture->bindTexture(context, allocator); - // Source rect should never go outside the image pixels, even if this // is requested because the texture extends outside the image. IntRect clippedSourceRect = sourceRect; @@ -95,7 +92,7 @@ public: clippedDestRect.setSize(clippedSourceRect.size()); SkAutoLockPixels lock(m_bitmap); - m_texSubImage.upload(static_cast<const uint8_t*>(m_bitmap.getPixels()), imageRect, clippedSourceRect, clippedDestRect, texture->format(), context); + texture->upload(resourceProvider, static_cast<const uint8_t*>(m_bitmap.getPixels()), imageRect, clippedSourceRect, clippedDestRect); } void setBitmap(const SkBitmap& bitmap) @@ -104,13 +101,9 @@ public: } private: - explicit ImageLayerTextureUpdater(bool useMapTexSubImage) - : m_texSubImage(useMapTexSubImage) - { - } + ImageLayerTextureUpdater() { } SkBitmap m_bitmap; - LayerTextureSubImage m_texSubImage; }; PassRefPtr<ImageLayerChromium> ImageLayerChromium::create() @@ -166,7 +159,7 @@ void ImageLayerChromium::createTextureUpdaterIfNeeded() if (m_textureUpdater) return; - m_textureUpdater = ImageLayerTextureUpdater::create(layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = ImageLayerTextureUpdater::create(); GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index a72674140..e5637a0fc 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -45,7 +45,7 @@ #include "SkColor.h" #include "ThrottledTextureUploader.h" #include "TraceEvent.h" -#include "TrackingTextureAllocator.h" +#include "cc/CCDamageTracker.h" #include "cc/CCLayerQuad.h" #include "cc/CCMathUtil.h" #include "cc/CCProxy.h" @@ -125,7 +125,7 @@ public: virtual bool isBusy() OVERRIDE { return false; } virtual void beginUploads() OVERRIDE { } virtual void endUploads() OVERRIDE { } - virtual void uploadTexture(CCGraphicsContext* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect) OVERRIDE { texture->updateRect(context, allocator, sourceRect, destRect); } + virtual void uploadTexture(LayerTextureUpdater::Texture* texture, CCResourceProvider* resourceProvider, const IntRect sourceRect, const IntRect destRect) OVERRIDE { texture->updateRect(resourceProvider, sourceRect, destRect); } protected: UnthrottledTextureUploader() { } @@ -133,9 +133,29 @@ protected: } // anonymous namespace -PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, WebGraphicsContext3D* context, TextureUploaderOption textureUploaderSetting) +class LayerRendererChromium::CachedTexture : public CCScopedTexture { + WTF_MAKE_NONCOPYABLE(CachedTexture); +public: + static PassOwnPtr<CachedTexture> create(CCResourceProvider* resourceProvider) { return adoptPtr(new CachedTexture(resourceProvider)); } + virtual ~CachedTexture() { } + + bool isComplete() const { return m_isComplete; } + void setIsComplete(bool isComplete) { m_isComplete = isComplete; } + +protected: + explicit CachedTexture(CCResourceProvider* resourceProvider) + : CCScopedTexture(resourceProvider) + , m_isComplete(false) + { + } + +private: + bool m_isComplete; +}; + +PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) { - OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, context, textureUploaderSetting))); + OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, resourceProvider, textureUploaderSetting))); if (!layerRenderer->initialize()) return nullptr; @@ -143,14 +163,15 @@ PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient } LayerRendererChromium::LayerRendererChromium(CCRendererClient* client, - WebGraphicsContext3D* context, + CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) : CCRenderer(client) , m_currentRenderPass(0) , m_currentTexture(0) , m_offscreenFramebufferId(0) , m_sharedGeometryQuad(FloatRect(-0.5f, -0.5f, 1.0f, 1.0f)) - , m_context(context) + , m_resourceProvider(resourceProvider) + , m_context(resourceProvider->graphicsContext3D()) , m_defaultRenderPass(0) , m_isViewportChanged(false) , m_isFramebufferDiscarded(false) @@ -318,7 +339,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]); Vector<int> passesToDelete; - HashMap<int, OwnPtr<CCScopedTexture> >::const_iterator passIterator; + HashMap<int, OwnPtr<CachedTexture> >::const_iterator passIterator; for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPassTextures.end(); ++passIterator) { const CCRenderPass* renderPassInFrame = passesInFrame.get(passIterator->first); if (!renderPassInFrame) { @@ -328,7 +349,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); - CCScopedTexture* texture = passIterator->second.get(); + CachedTexture* texture = passIterator->second.get(); ASSERT(texture); if (texture->id() && (texture->size() != requiredSize || texture->format() != requiredFormat)) @@ -341,7 +362,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id())) { - OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(m_implTextureAllocator.get()); + OwnPtr<CachedTexture> texture = CachedTexture::create(m_resourceProvider); m_renderPassTextures.set(renderPassesInDrawOrder[i]->id(), texture.release()); } } @@ -349,8 +370,21 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa bool LayerRendererChromium::haveCachedResourcesForRenderPassId(int id) const { - CCScopedTexture* texture = m_renderPassTextures.get(id); - return texture && texture->id(); + CachedTexture* texture = m_renderPassTextures.get(id); + return texture && texture->id() && texture->isComplete(); +} + +void LayerRendererChromium::drawFrame(const CCRenderPassList& renderPasses, const FloatRect& rootScissorRect) +{ + const CCRenderPass* rootRenderPass = renderPasses.last(); + beginDrawingFrame(rootRenderPass); + + for (size_t i = 0; i < renderPasses.size(); ++i) { + const CCRenderPass* renderPass = renderPasses[i]; + + FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(rootScissorRect); + drawRenderPass(renderPass, rootScissorRectInCurrentSurface); + } } void LayerRendererChromium::beginDrawingFrame(const CCRenderPass* rootRenderPass) @@ -515,7 +549,9 @@ static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const layerRenderer->context()->flush(); - return CCRenderSurfaceFilters::apply(filters, sourceTexture->id(), sourceTexture->size(), filterContext.get()); + CCScopedLockResourceForWrite lock(layerRenderer->resourceProvider(), sourceTexture->id()); + SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext.get()); + return source; } PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* quad, const WebTransformationMatrix& contentsDeviceTransform) @@ -555,7 +591,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C deviceRect.intersect(m_currentRenderPass->framebufferOutputRect()); - OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_implTextureAllocator.get()); + OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_resourceProvider); if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) return nullptr; @@ -566,8 +602,8 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.getTexture()); int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); - OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_implTextureAllocator.get()); - if (!backgroundTexture->allocate(quad->quadRect().size(), GraphicsContext3D::RGBA)) + OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resourceProvider); + if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer)) return nullptr; const CCRenderPass* targetRenderPass = m_currentRenderPass; @@ -594,7 +630,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) { - CCScopedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); + CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); if (!contentsTexture || !contentsTexture->id()) return; @@ -612,16 +648,21 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. // Apply filters to the contents texture. SkBitmap filterBitmap = applyFilters(this, quad->filters(), contentsTexture); - int contentsTextureId = contentsTexture->id(); + OwnPtr<CCScopedLockResourceForRead> contentsResourceLock; + unsigned contentsTextureId = 0; if (filterBitmap.getTexture()) { GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTexture()); contentsTextureId = texture->getTextureHandle(); + } else { + contentsResourceLock = adoptPtr(new CCScopedLockResourceForRead(m_resourceProvider, contentsTexture->id())); + contentsTextureId = contentsResourceLock->textureId(); } // Draw the background texture if there is one. if (backgroundTexture) { ASSERT(backgroundTexture->size() == quad->quadRect().size()); - copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->drawTransform()); + CCScopedLockResourceForRead lock(m_resourceProvider, backgroundTexture->id()); + copyTextureToFramebuffer(lock.textureId(), quad->quadRect().size(), quad->drawTransform()); } bool clipped = false; @@ -637,7 +678,12 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) deviceLayerEdges.inflateAntiAliasingDistance(); } - bool useMask = quad->maskTextureId(); + OwnPtr<CCScopedLockResourceForRead> maskResourceLock; + unsigned maskTextureId = 0; + if (quad->maskResourceId()) { + maskResourceLock = adoptPtr(new CCScopedLockResourceForRead(m_resourceProvider, quad->maskResourceId())); + maskTextureId = maskResourceLock->textureId(); + } // FIXME: use the backgroundTexture and blend the background in with this draw instead of having a separate copy of the background texture. @@ -649,7 +695,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) int shaderMaskSamplerLocation = -1; int shaderMatrixLocation = -1; int shaderAlphaLocation = -1; - if (useAA && useMask) { + if (useAA && maskTextureId) { const RenderPassMaskProgramAA* program = renderPassMaskProgramAA(); GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -659,7 +705,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) shaderMaskSamplerLocation = program->fragmentShader().maskSamplerLocation(); shaderMatrixLocation = program->vertexShader().matrixLocation(); shaderAlphaLocation = program->fragmentShader().alphaLocation(); - } else if (!useAA && useMask) { + } else if (!useAA && maskTextureId) { const RenderPassMaskProgram* program = renderPassMaskProgram(); GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -667,7 +713,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) shaderMaskSamplerLocation = program->fragmentShader().maskSamplerLocation(); shaderMatrixLocation = program->vertexShader().matrixLocation(); shaderAlphaLocation = program->fragmentShader().alphaLocation(); - } else if (useAA && !useMask) { + } else if (useAA && !maskTextureId) { const RenderPassProgramAA* program = renderPassProgramAA(); GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -688,7 +734,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) if (shaderMaskSamplerLocation != -1) { GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); - context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->maskTextureId()); + context()->bindTexture(GraphicsContext3D::TEXTURE_2D, maskTextureId); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); } @@ -823,7 +869,8 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) GLC(context(), context()->useProgram(uniforms.program)); GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->textureId())); + CCScopedLockResourceForRead quadResourceLock(m_resourceProvider, quad->resourceId()); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId())); GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, quad->textureFilter())); GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, quad->textureFilter())); @@ -917,12 +964,15 @@ void LayerRendererChromium::drawYUVVideoQuad(const CCYUVVideoDrawQuad* quad) const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane(); const CCVideoLayerImpl::FramePlane& vPlane = quad->vPlane(); + CCScopedLockResourceForRead yPlaneLock(m_resourceProvider, yPlane.resourceId); + CCScopedLockResourceForRead uPlaneLock(m_resourceProvider, uPlane.resourceId); + CCScopedLockResourceForRead vPlaneLock(m_resourceProvider, vPlane.resourceId); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yPlane.textureId)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yPlaneLock.textureId())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE2)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, uPlane.textureId)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, uPlaneLock.textureId())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE3)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, vPlane.textureId)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, vPlaneLock.textureId())); GLC(context(), context()->useProgram(program->program())); @@ -1033,7 +1083,8 @@ void LayerRendererChromium::drawTextureQuad(const CCTextureDrawQuad* quad) GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x(), uvRect.y(), uvRect.width(), uvRect.height())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->textureId())); + CCScopedLockResourceForRead quadResourceLock(m_resourceProvider, quad->resourceId()); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId())); // FIXME: setting the texture parameters every time is redundant. Move this code somewhere // where it will only happen once per texture. @@ -1072,18 +1123,14 @@ void LayerRendererChromium::drawIOSurfaceQuad(const CCIOSurfaceDrawQuad* quad) GLC(context(), context()->useProgram(binding.programId)); GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); - GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0, quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); + if (quad->orientation() == CCIOSurfaceDrawQuad::Flipped) + GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, quad->ioSurfaceSize().height(), quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height() * -1.0)); + else + GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0, quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, quad->ioSurfaceTextureId())); - // FIXME: setting the texture parameters every time is redundant. Move this code somewhere - // where it will only happen once per texture. - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - WebTransformationMatrix quadTransform = quad->quadTransform(); IntRect quadRect = quad->quadRect(); quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); @@ -1105,7 +1152,8 @@ void LayerRendererChromium::drawHeadsUpDisplay(const CCScopedTexture* hudTexture const HeadsUpDisplayProgram* program = headsUpDisplayProgram(); ASSERT(program && program->initialized()); GLC(m_context, m_context->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, hudTexture->id())); + CCScopedLockResourceForRead lock(m_resourceProvider, hudTexture->id()); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId())); GLC(m_context, m_context->useProgram(program->program())); GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -1119,6 +1167,7 @@ void LayerRendererChromium::drawHeadsUpDisplay(const CCScopedTexture* hudTexture void LayerRendererChromium::finishDrawingFrame() { + m_currentFramebufferLock.clear(); GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); } @@ -1353,10 +1402,11 @@ bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, cons { ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); - if (!texture->id() && !texture->allocate(deviceRect.size(), GraphicsContext3D::RGB)) + if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny)) return false; - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, texture->id())); + CCScopedLockResourceForWrite lock(m_resourceProvider, texture->id()); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId())); GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, texture->format(), deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0)); return true; @@ -1373,15 +1423,18 @@ bool LayerRendererChromium::useRenderPass(const CCRenderPass* renderPass) m_currentTexture = 0; if (renderPass == m_defaultRenderPass) { + m_currentFramebufferLock.clear(); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); setDrawFramebufferRect(renderPass->framebufferOutputRect(), true); return true; } - CCScopedTexture* texture = m_renderPassTextures.get(renderPass->id()); + CachedTexture* texture = m_renderPassTextures.get(renderPass->id()); ASSERT(texture); - if (!texture->id() && !texture->allocate(renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass))) + texture->setIsComplete(!renderPass->hasOcclusionFromOutsideTargetSurface()); + + if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass), CCResourceProvider::TextureUsageFramebuffer)) return false; return bindFramebufferToTexture(texture, renderPass->framebufferOutputRect()); @@ -1390,7 +1443,6 @@ bool LayerRendererChromium::useRenderPass(const CCRenderPass* renderPass) bool LayerRendererChromium::useScopedTexture(const CCScopedTexture* texture, const IntRect& viewportRect) { ASSERT(texture->id()); - m_currentRenderPass = 0; m_currentTexture = texture; @@ -1402,7 +1454,8 @@ bool LayerRendererChromium::bindFramebufferToTexture(const CCScopedTexture* text ASSERT(texture->id()); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId)); - GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, texture->id(), 0)); + m_currentFramebufferLock = adoptPtr(new CCScopedLockResourceForWrite(m_resourceProvider, texture->id())); + GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_currentFramebufferLock->textureId(), 0)); #if !defined ( NDEBUG ) if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { @@ -1479,14 +1532,6 @@ bool LayerRendererChromium::initializeSharedObjects() m_textureUploader = ThrottledTextureUploader::create(m_context); else m_textureUploader = UnthrottledTextureUploader::create(); - m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context, m_capabilities.maxTextureSize); - m_implTextureAllocator = TrackingTextureAllocator::create(m_context, m_capabilities.maxTextureSize); - if (m_capabilities.usingTextureUsageHint) - m_implTextureAllocator->setTextureUsageHint(TrackingTextureAllocator::FramebufferAttachment); - if (m_capabilities.usingTextureStorageExtension) { - m_contentsTextureAllocator->setUseTextureStorageExt(true); - m_implTextureAllocator->setUseTextureStorageExt(true); - } return true; } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 415520d7f..198aef9a3 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -36,7 +36,6 @@ #include "Extensions3DChromium.h" #include "TextureCopier.h" -#include "TrackingTextureAllocator.h" #include "cc/CCCheckerboardDrawQuad.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCIOSurfaceDrawQuad.h" @@ -66,7 +65,7 @@ class LayerRendererChromium : public CCRenderer, public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { WTF_MAKE_NONCOPYABLE(LayerRendererChromium); public: - static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, WebKit::WebGraphicsContext3D*, TextureUploaderOption); + static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); virtual ~LayerRendererChromium(); @@ -81,8 +80,7 @@ public: virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) OVERRIDE; virtual bool haveCachedResourcesForRenderPassId(int id) const OVERRIDE; - virtual void beginDrawingFrame(const CCRenderPass* defaultRenderPass) OVERRIDE; - virtual void drawRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect) OVERRIDE; + virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) OVERRIDE; virtual void finishDrawingFrame() OVERRIDE; virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) OVERRIDE; @@ -103,10 +101,6 @@ public: virtual TextureCopier* textureCopier() const OVERRIDE { return m_textureCopier.get(); } virtual TextureUploader* textureUploader() const OVERRIDE { return m_textureUploader.get(); } - virtual TextureAllocator* implTextureAllocator() const OVERRIDE { return m_implTextureAllocator.get(); } - virtual TextureAllocator* contentsTextureAllocator() const OVERRIDE { return m_contentsTextureAllocator.get(); } - - virtual void setScissorToRect(const IntRect&) OVERRIDE; virtual bool isContextLost() OVERRIDE; @@ -116,9 +110,11 @@ public: float width, float height, float opacity, const FloatQuad&, int matrixLocation, int alphaLocation, int quadLocation); void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebKit::WebTransformationMatrix& drawMatrix); + CCResourceProvider* resourceProvider() const { return m_resourceProvider; } protected: - LayerRendererChromium(CCRendererClient*, WebKit::WebGraphicsContext3D*, TextureUploaderOption); + LayerRendererChromium(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); + bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } bool initialize(); @@ -128,6 +124,9 @@ protected: private: static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); + void beginDrawingFrame(const CCRenderPass* rootRenderPass); + void drawRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect); + void drawQuad(const CCDrawQuad*); void drawCheckerboardQuad(const CCCheckerboardDrawQuad*); void drawDebugBorderQuad(const CCDebugBorderDrawQuad*); @@ -140,6 +139,8 @@ private: void drawTileQuad(const CCTileDrawQuad*); void drawYUVVideoQuad(const CCYUVVideoDrawQuad*); + void setScissorToRect(const IntRect&); + void setDrawFramebufferRect(const IntRect&, bool flipY); // The current drawing target is either a RenderPass or ScopedTexture. Use these functions to switch to a new drawing target. @@ -175,11 +176,14 @@ private: const CCRenderPass* m_currentRenderPass; const CCScopedTexture* m_currentTexture; + OwnPtr<CCScopedLockResourceForWrite> m_currentFramebufferLock; unsigned m_offscreenFramebufferId; OwnPtr<GeometryBinding> m_sharedGeometry; FloatQuad m_sharedGeometryQuad; + class CachedTexture; + // This block of bindings defines all of the programs used by the compositor itself. // Tiled layer shaders. @@ -200,7 +204,7 @@ private: // Texture shaders. typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexAlpha> TextureProgram; typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexFlipAlpha> TextureProgramFlip; - typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectFlipAlpha> TextureIOSurfaceProgram; + typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectAlpha> TextureIOSurfaceProgram; // Video shaders. typedef ProgramBinding<VertexShaderVideoTransform, FragmentShaderOESImageExternal> VideoStreamTextureProgram; @@ -260,12 +264,11 @@ private: OwnPtr<SolidColorProgram> m_solidColorProgram; OwnPtr<HeadsUpDisplayProgram> m_headsUpDisplayProgram; + CCResourceProvider* m_resourceProvider; OwnPtr<AcceleratedTextureCopier> m_textureCopier; OwnPtr<TextureUploader> m_textureUploader; - OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator; - OwnPtr<TrackingTextureAllocator> m_implTextureAllocator; - HashMap<int, OwnPtr<CCScopedTexture> > m_renderPassTextures; + HashMap<int, OwnPtr<CachedTexture> > m_renderPassTextures; WebKit::WebGraphicsContext3D* m_context; diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp index b87b43d94..b66d79e04 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp @@ -32,12 +32,15 @@ #include "Extensions3DChromium.h" #include "LayerRendererChromium.h" // For GLC() macro #include "TraceEvent.h" -#include "cc/CCGraphicsContext.h" +#include <public/WebGraphicsContext3D.h> + +using WebKit::WebGraphicsContext3D; namespace WebCore { LayerTextureSubImage::LayerTextureSubImage(bool useMapTexSubImage) : m_useMapTexSubImage(useMapTexSubImage) + , m_subImageSize(0) { } @@ -45,18 +48,9 @@ LayerTextureSubImage::~LayerTextureSubImage() { } -void LayerTextureSubImage::setSubImageSize(const IntSize& subImageSize) -{ - if (subImageSize == m_subImageSize) - return; - - m_subImageSize = subImageSize; - m_subImage.clear(); -} - void LayerTextureSubImage::upload(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext* context) + GC3Denum format, WebGraphicsContext3D* context) { if (m_useMapTexSubImage) uploadWithMapTexSubImage(image, imageRect, sourceRect, destRect, format, context); @@ -66,11 +60,9 @@ void LayerTextureSubImage::upload(const uint8_t* image, const IntRect& imageRect void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext* context) + GC3Denum format, WebGraphicsContext3D* context) { TRACE_EVENT0("cc", "LayerTextureSubImage::uploadWithTexSubImage"); - if (!m_subImage) - m_subImage = adoptArrayPtr(new uint8_t[m_subImageSize.width() * m_subImageSize.height() * 4]); // Offset from image-rect to source-rect. IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y()); @@ -79,6 +71,11 @@ void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const Int if (imageRect.width() == sourceRect.width() && !offset.x()) pixelSource = &image[4 * offset.y() * imageRect.width()]; else { + size_t neededSize = 4 * destRect.width() * destRect.height(); + if (m_subImageSize < neededSize) { + m_subImage = adoptArrayPtr(new uint8_t[neededSize]); + m_subImageSize = neededSize; + } // Strides not equal, so do a row-by-row memcpy from the // paint results into a temp buffer for uploading. for (int row = 0; row < destRect.height(); ++row) @@ -89,30 +86,19 @@ void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const Int pixelSource = &m_subImage[0]; } - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - GLC(context3d, context3d->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); + GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); } void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext* context) + GC3Denum format, WebGraphicsContext3D* context) { TRACE_EVENT0("cc", "LayerTextureSubImage::uploadWithMapTexSubImage"); - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - // Offset from image-rect to source-rect. IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y()); // Upload tile data via a mapped transfer buffer - uint8_t* pixelDest = static_cast<uint8_t*>(context3d->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); + uint8_t* pixelDest = static_cast<uint8_t*>(context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); if (!pixelDest) { uploadWithTexSubImage(image, imageRect, sourceRect, destRect, format, context); @@ -136,7 +122,7 @@ void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const &image[4 * (offset.x() + (offset.y() + row) * imageRect.width())], destRect.width() * componentsPerPixel * bytesPerComponent); } - GLC(context3d, context3d->unmapTexSubImage2DCHROMIUM(pixelDest)); + GLC(context, context->unmapTexSubImage2DCHROMIUM(pixelDest)); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h index 4f1c41521..357b64134 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h @@ -34,30 +34,31 @@ #include "IntSize.h" #include <wtf/OwnArrayPtr.h> -namespace WebCore { +namespace WebKit { +class WebGraphicsContext3D; +} -class CCGraphicsContext; +namespace WebCore { class LayerTextureSubImage { public: explicit LayerTextureSubImage(bool useMapSubForUpload); ~LayerTextureSubImage(); - void setSubImageSize(const IntSize&); void upload(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext*); + GC3Denum format, WebKit::WebGraphicsContext3D*); private: void uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext*); + GC3Denum format, WebKit::WebGraphicsContext3D*); void uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext*); + GC3Denum format, WebKit::WebGraphicsContext3D*); bool m_useMapTexSubImage; - IntSize m_subImageSize; + size_t m_subImageSize; OwnArrayPtr<uint8_t> m_subImage; }; diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h index fd8ed883c..189942e25 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h @@ -30,16 +30,13 @@ #if USE(ACCELERATED_COMPOSITING) #include "GraphicsTypes3D.h" -#include "cc/CCGraphicsContext.h" #include "cc/CCPrioritizedTexture.h" #include <wtf/RefCounted.h> namespace WebCore { -class CCGraphicsContext; class IntRect; class IntSize; -class TextureAllocator; class TextureManager; class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> { @@ -52,7 +49,7 @@ public: CCPrioritizedTexture* texture() { return m_texture.get(); } void swapTextureWith(OwnPtr<CCPrioritizedTexture>& texture) { m_texture.swap(texture); } virtual void prepareRect(const IntRect& /* sourceRect */) { } - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) = 0; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) = 0; protected: explicit Texture(PassOwnPtr<CCPrioritizedTexture> texture) : m_texture(texture) { } diff --git a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp index e00a26e39..4988b327f 100644 --- a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp @@ -77,19 +77,19 @@ void ScrollbarLayerChromium::pushPropertiesTo(CCLayerImpl* layer) scrollbarLayer->setScrollbarOverlayStyle(m_scrollbarOverlayStyle); if (m_backTrack && m_backTrack->texture()->haveBackingTexture()) - scrollbarLayer->setBackTrackTextureId(m_backTrack->texture()->textureId()); + scrollbarLayer->setBackTrackResourceId(m_backTrack->texture()->resourceId()); else - scrollbarLayer->setBackTrackTextureId(0); + scrollbarLayer->setBackTrackResourceId(0); if (m_foreTrack && m_foreTrack->texture()->haveBackingTexture()) - scrollbarLayer->setForeTrackTextureId(m_foreTrack->texture()->textureId()); + scrollbarLayer->setForeTrackResourceId(m_foreTrack->texture()->resourceId()); else - scrollbarLayer->setForeTrackTextureId(0); + scrollbarLayer->setForeTrackResourceId(0); if (m_thumb && m_thumb->texture()->haveBackingTexture()) - scrollbarLayer->setThumbTextureId(m_thumb->texture()->textureId()); + scrollbarLayer->setThumbResourceId(m_thumb->texture()->resourceId()); else - scrollbarLayer->setThumbTextureId(0); + scrollbarLayer->setThumbResourceId(0); Vector<IntRect> tickmarks; m_scrollbar->getTickmarks(tickmarks); @@ -205,24 +205,23 @@ void ScrollbarLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() { - bool useMapSubImage = layerTreeHost()->layerRendererCapabilities().usingMapSub; m_textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; if (!m_backTrackUpdater) - m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), BackTrackPart), useMapSubImage); + m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), BackTrackPart)); if (!m_backTrack) m_backTrack = m_backTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); // Only create two-part track if we think the two parts could be different in appearance. if (m_scrollbar->isCustomScrollbar()) { if (!m_foreTrackUpdater) - m_foreTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), ForwardTrackPart), useMapSubImage); + m_foreTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), ForwardTrackPart)); if (!m_foreTrack) m_foreTrack = m_foreTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } if (!m_thumbUpdater) - m_thumbUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarThumbPainter::create(m_scrollbar.get(), theme()), useMapSubImage); + m_thumbUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarThumbPainter::create(m_scrollbar.get(), theme())); if (!m_thumb) m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } diff --git a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp index 33243c855..0b59597a5 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp @@ -66,55 +66,54 @@ AcceleratedTextureCopier::~AcceleratedTextureCopier() GLC(m_context, m_context->deleteFramebuffer(m_fbo)); } -void AcceleratedTextureCopier::copyTexture(CCGraphicsContext* ccContext, unsigned sourceTextureId, unsigned destTextureId, const IntSize& size) +void AcceleratedTextureCopier::copyTexture(unsigned sourceTextureId, unsigned destTextureId, const IntSize& size) { TRACE_EVENT0("cc", "TextureCopier::copyTexture"); - WebKit::WebGraphicsContext3D* context = ccContext->context3D(); - if (!context) { - // FIXME: Implement this path for software compositing. - return; - } - // Note: this code does not restore the viewport, bound program, 2D texture, framebuffer, buffer or blend enable. - GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo)); - GLC(context, context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, destTextureId, 0)); + GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo)); + GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, destTextureId, 0)); #if OS(ANDROID) // Clear destination to improve performance on tiling GPUs. // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. - GLC(context, context->clear(GraphicsContext3D::COLOR_BUFFER_BIT)); + GLC(m_context, m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT)); #endif - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, sourceTextureId)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, sourceTextureId)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); if (!m_blitProgram->initialized()) - m_blitProgram->initialize(context, m_usingBindUniforms); + m_blitProgram->initialize(m_context, m_usingBindUniforms); // TODO: Use EXT_framebuffer_blit if available. - GLC(context, context->useProgram(m_blitProgram->program())); + GLC(m_context, m_context->useProgram(m_blitProgram->program())); const int kPositionAttribute = 0; - GLC(context, context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_positionBuffer)); - GLC(context, context->vertexAttribPointer(kPositionAttribute, 4, GraphicsContext3D::FLOAT, false, 0, 0)); - GLC(context, context->enableVertexAttribArray(kPositionAttribute)); - GLC(context, context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0)); + GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_positionBuffer)); + GLC(m_context, m_context->vertexAttribPointer(kPositionAttribute, 4, GraphicsContext3D::FLOAT, false, 0, 0)); + GLC(m_context, m_context->enableVertexAttribArray(kPositionAttribute)); + GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0)); - GLC(context, context->viewport(0, 0, size.width(), size.height())); - GLC(context, context->disable(GraphicsContext3D::BLEND)); - GLC(context, context->drawArrays(GraphicsContext3D::TRIANGLE_FAN, 0, 4)); + GLC(m_context, m_context->viewport(0, 0, size.width(), size.height())); + GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); + GLC(m_context, m_context->drawArrays(GraphicsContext3D::TRIANGLE_FAN, 0, 4)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - GLC(context, context->disableVertexAttribArray(kPositionAttribute)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + GLC(m_context, m_context->disableVertexAttribArray(kPositionAttribute)); - GLC(context, context->useProgram(0)); + GLC(m_context, m_context->useProgram(0)); - GLC(context, context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, 0, 0)); - GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); + GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, 0, 0)); + GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); +} + +void AcceleratedTextureCopier::flush() +{ + GLC(m_context, m_context->flush()); } } diff --git a/Source/WebCore/platform/graphics/chromium/TextureCopier.h b/Source/WebCore/platform/graphics/chromium/TextureCopier.h index c2bcd427c..b385f45e5 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureCopier.h +++ b/Source/WebCore/platform/graphics/chromium/TextureCopier.h @@ -28,7 +28,6 @@ #include "GraphicsContext3D.h" #include "ProgramBinding.h" #include "ShaderChromium.h" -#include "cc/CCGraphicsContext.h" namespace WebKit { class WebGraphicsContext3D; @@ -42,7 +41,8 @@ public: // Copy the base level contents of |sourceTextureId| to |destTextureId|. Both texture objects // must be complete and have a base level of |size| dimensions. The color formats do not need // to match, but |destTextureId| must have a renderable format. - virtual void copyTexture(CCGraphicsContext*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&) = 0; + virtual void copyTexture(unsigned sourceTextureId, unsigned destTextureId, const IntSize&) = 0; + virtual void flush() = 0; protected: virtual ~TextureCopier() { } @@ -59,7 +59,8 @@ public: } virtual ~AcceleratedTextureCopier(); - virtual void copyTexture(CCGraphicsContext*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&); + virtual void copyTexture(unsigned sourceTextureId, unsigned destTextureId, const IntSize&); + virtual void flush(); protected: AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUniforms); diff --git a/Source/WebCore/platform/graphics/chromium/TextureUploader.h b/Source/WebCore/platform/graphics/chromium/TextureUploader.h index 0eae2e65d..92870cb5a 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureUploader.h +++ b/Source/WebCore/platform/graphics/chromium/TextureUploader.h @@ -36,7 +36,7 @@ public: virtual bool isBusy() = 0; virtual void beginUploads() = 0; virtual void endUploads() = 0; - virtual void uploadTexture(CCGraphicsContext*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) = 0; + virtual void uploadTexture(LayerTextureUpdater::Texture*, CCResourceProvider*, const IntRect sourceRect, const IntRect destRect) = 0; }; } diff --git a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp index a8253d065..281e08ff0 100644 --- a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp +++ b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp @@ -120,9 +120,9 @@ void ThrottledTextureUploader::endUploads() m_pendingQueries.append(m_availableQueries.takeFirst()); } -void ThrottledTextureUploader::uploadTexture(CCGraphicsContext* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect) +void ThrottledTextureUploader::uploadTexture(LayerTextureUpdater::Texture* texture, CCResourceProvider* resourceProvider, const IntRect sourceRect, const IntRect destRect) { - texture->updateRect(context, allocator, sourceRect, destRect); + texture->updateRect(resourceProvider, sourceRect, destRect); } void ThrottledTextureUploader::processQueries() diff --git a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h index ae5b7491f..f8c43dc2d 100644 --- a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h +++ b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h @@ -51,7 +51,7 @@ public: virtual bool isBusy() OVERRIDE; virtual void beginUploads() OVERRIDE; virtual void endUploads() OVERRIDE; - virtual void uploadTexture(CCGraphicsContext*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) OVERRIDE; + virtual void uploadTexture(LayerTextureUpdater::Texture*, CCResourceProvider*, const IntRect sourceRect, const IntRect destRect) OVERRIDE; private: class Query { diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index eed5cfc9a..8e489195e 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -226,7 +226,7 @@ void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) if (tile->isDirtyForCurrentFrame()) continue; - tiledLayer->pushTileProperties(i, j, tile->managedTexture()->textureId(), tile->opaqueRect()); + tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(), tile->opaqueRect()); tile->isInUseOnImpl = true; } for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); iter != invalidTiles.end(); ++iter) diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp deleted file mode 100644 index 7ae29f912..000000000 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2011, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 "TrackingTextureAllocator.h" - -#include "Extensions3DChromium.h" -#include "GraphicsContext3D.h" -#include "IntRect.h" -#include "LayerRendererChromium.h" // For the GLC() macro - -namespace WebCore { - -TrackingTextureAllocator::TrackingTextureAllocator(WebKit::WebGraphicsContext3D* context, int maxTextureSize) - : m_context(context) - , m_maxTextureSize(maxTextureSize) - , m_currentMemoryUseBytes(0) - , m_textureUsageHint(Any) - , m_useTextureStorageExt(false) -{ - ASSERT(m_context); -} - -TrackingTextureAllocator::~TrackingTextureAllocator() -{ - ASSERT(!m_currentMemoryUseBytes); -} - -static GC3Denum textureToStorageFormat(GC3Denum textureFormat) -{ - GC3Denum storageFormat = Extensions3D::RGBA8_OES; - switch (textureFormat) { - case GraphicsContext3D::RGBA: - break; - case Extensions3D::BGRA_EXT: - storageFormat = Extensions3DChromium::BGRA8_EXT; - break; - default: - ASSERT_NOT_REACHED(); - break; - } - - return storageFormat; -} - -static bool isTextureFormatSupportedForStorage(GC3Denum format) -{ - return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EXT); -} - -unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum format) -{ - if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) - return 0; - - m_currentMemoryUseBytes += CCTexture::memorySizeBytes(size, format); - - unsigned textureId = 0; - GLC(m_context, textureId = m_context->createTexture()); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - // Do basic linear filtering on resize. - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE. - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - - if (m_textureUsageHint == FramebufferAttachment) - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); - if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { - GC3Denum storageFormat = textureToStorageFormat(format); - m_context->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height()); - } else - GLC(m_context, m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0)); - m_allocatedTextureIds.add(textureId); - return textureId; -} - -void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format) -{ - m_currentMemoryUseBytes -= CCTexture::memorySizeBytes(size, format); - GLC(m_context, m_context->deleteTexture(textureId)); - GLC(m_context, m_context->deleteTexture(textureId)); - ASSERT(m_allocatedTextureIds.contains(textureId)); - m_allocatedTextureIds.remove(textureId); -} - -void TrackingTextureAllocator::deleteAllTextures() -{ - for (HashSet<unsigned>::const_iterator it = m_allocatedTextureIds.begin(); it != m_allocatedTextureIds.end(); ++it) - GLC(m_context, m_context->deleteTexture(*it)); - m_currentMemoryUseBytes = 0; - m_allocatedTextureIds.clear(); -} - -} - diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h deleted file mode 100644 index 38f7ca043..000000000 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2011, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 TrackingTextureAllocator_h -#define TrackingTextureAllocator_h - -#include "TextureAllocator.h" -#include <wtf/HashSet.h> -#include <wtf/PassRefPtr.h> - -namespace WebKit { -class WebGraphicsContext3D; -} - -namespace WebCore { - -class TrackingTextureAllocator : public TextureAllocator { - WTF_MAKE_NONCOPYABLE(TrackingTextureAllocator); -public: - static PassOwnPtr<TrackingTextureAllocator> create(WebKit::WebGraphicsContext3D* context, int maxTextureSize) - { - return adoptPtr(new TrackingTextureAllocator(context, maxTextureSize)); - } - virtual ~TrackingTextureAllocator(); - - virtual unsigned createTexture(const IntSize&, GC3Denum format) OVERRIDE; - virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum format) OVERRIDE; - virtual void deleteAllTextures() OVERRIDE; - - size_t currentMemoryUseBytes() const { return m_currentMemoryUseBytes; } - - enum TextureUsageHint { Any, FramebufferAttachment }; - - void setTextureUsageHint(TextureUsageHint hint) { m_textureUsageHint = hint; } - void setUseTextureStorageExt(bool useStorageExt) { m_useTextureStorageExt = useStorageExt; } - -protected: - TrackingTextureAllocator(WebKit::WebGraphicsContext3D*, int maxTextureSize); - - WebKit::WebGraphicsContext3D* m_context; - int m_maxTextureSize; - size_t m_currentMemoryUseBytes; - TextureUsageHint m_textureUsageHint; - bool m_useTextureStorageExt; - HashSet<unsigned> m_allocatedTextureIds; -}; - -} - -#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp index d6dff06ab..d5a7d4295 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp @@ -28,6 +28,7 @@ #include "CCFrameRateCounter.h" #include "CCProxy.h" +#include <public/Platform.h> #include <wtf/CurrentTime.h> namespace WebCore { @@ -57,6 +58,14 @@ CCFrameRateCounter::CCFrameRateCounter() void CCFrameRateCounter::markBeginningOfFrame(double timestamp) { + if (CCProxy::hasImplThread() && m_currentFrameNumber > 0) { + double lastFrameTimestamp = frameIndex(m_currentFrameNumber - 1); + double drawDelaySeconds = timestamp - lastFrameTimestamp; + double drawDelayMs = drawDelaySeconds * 1000.0; + + WebKit::Platform::current()->histogramCustomCounts("Renderer4.CompositorThreadImplDrawDelay", static_cast<int>(drawDelayMs), 1, 120, 60); + } + m_timeStampHistory[frameIndex(m_currentFrameNumber)] = timestamp; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp index be19983ef..0f6f6ee0e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp @@ -34,7 +34,6 @@ #include "cc/CCDebugRectHistory.h" #include "cc/CCFrameRateCounter.h" #include "cc/CCLayerTreeHostImpl.h" -#include <public/WebGraphicsContext3D.h> #include <wtf/text/WTFString.h> namespace WebCore { @@ -68,13 +67,8 @@ bool CCHeadsUpDisplay::showDebugRects(const CCLayerTreeSettings& settings) const void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) { CCRenderer* layerRenderer = layerTreeHostImpl->layerRenderer(); - WebKit::WebGraphicsContext3D* context = layerTreeHostImpl->context()->context3D(); - if (!context) { - // FIXME: Implement this path for software compositing. - return; - } if (!m_hudTexture) - m_hudTexture = CCScopedTexture::create(layerRenderer->implTextureAllocator()); + m_hudTexture = CCScopedTexture::create(layerTreeHostImpl->resourceProvider()); const CCLayerTreeSettings& settings = layerTreeHostImpl->settings(); // Use a fullscreen texture only if we need to... @@ -87,7 +81,7 @@ void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) hudSize.setHeight(128); } - if (!m_hudTexture->id() && !m_hudTexture->allocate(hudSize, GraphicsContext3D::RGBA)) + if (!m_hudTexture->id() && !m_hudTexture->allocate(CCRenderer::ImplPool, hudSize, GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) return; // Render pixels into the texture. @@ -102,22 +96,8 @@ void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) // Upload to GL. { PlatformCanvas::AutoLocker locker(&canvas); - - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_hudTexture->id())); - bool uploadedViaMap = false; - if (layerRenderer->capabilities().usingMapSub) { - uint8_t* pixelDest = static_cast<uint8_t*>(context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); - - if (pixelDest) { - uploadedViaMap = true; - memcpy(pixelDest, locker.pixels(), hudSize.width() * hudSize.height() * 4); - context->unmapTexSubImage2DCHROMIUM(pixelDest); - } - } - - if (!uploadedViaMap) { - GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); - } + IntRect rect(IntPoint(0, 0), hudSize); + layerTreeHostImpl->resourceProvider()->upload(m_hudTexture->id(), locker.pixels(), rect, rect, rect); } layerRenderer->drawHeadsUpDisplay(m_hudTexture.get(), hudSize); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp index d1157ed03..473de259b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp @@ -35,7 +35,7 @@ #include "cc/CCGraphicsContext.h" #include "cc/CCIOSurfaceDrawQuad.h" #include "cc/CCLayerTreeHostImpl.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include <public/WebGraphicsContext3D.h> namespace WebCore { @@ -60,12 +60,12 @@ CCIOSurfaceLayerImpl::~CCIOSurfaceLayerImpl() context3d->deleteTexture(m_ioSurfaceTextureId); } -void CCIOSurfaceLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context) +void CCIOSurfaceLayerImpl::willDraw(CCResourceProvider* resourceProvider) { - CCLayerImpl::willDraw(layerRenderer, context); + CCLayerImpl::willDraw(resourceProvider); if (m_ioSurfaceChanged) { - WebKit::WebGraphicsContext3D* context3d = context->context3D(); + WebKit::WebGraphicsContext3D* context3d = resourceProvider->graphicsContext3D(); if (!context3d) { // FIXME: Implement this path for software compositing. return; @@ -96,10 +96,10 @@ void CCIOSurfaceLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext } } -void CCIOSurfaceLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCIOSurfaceLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId)); + quadList.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, CCIOSurfaceDrawQuad::Flipped)); } void CCIOSurfaceLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h index 28a35cd0f..018804e18 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h @@ -41,9 +41,9 @@ public: void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; - virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE; + virtual void willDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 9434dc59c..717d96d10 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -35,7 +35,7 @@ #include "cc/CCLayerSorter.h" #include "cc/CCMathUtil.h" #include "cc/CCProxy.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include <wtf/text/WTFString.h> using WebKit::WebTransformationMatrix; @@ -145,7 +145,7 @@ bool CCLayerImpl::descendantDrawsContent() return false; } -PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const +PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState(int id) const { WebTransformationMatrix quadTransformation = drawTransform(); if (!contentBounds().isEmpty() && !bounds().isEmpty()) { @@ -154,10 +154,10 @@ PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const quadTransformation.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0); } - return CCSharedQuadState::create(quadTransformation, m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); + return CCSharedQuadState::create(id, quadTransformation, m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); } -void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*) +void CCLayerImpl::willDraw(CCResourceProvider*) { #ifndef NDEBUG // willDraw/didDraw must be matched. @@ -166,7 +166,7 @@ void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*) #endif } -void CCLayerImpl::didDraw() +void CCLayerImpl::didDraw(CCResourceProvider*) { #ifndef NDEBUG ASSERT(m_betweenWillDrawAndDidDraw); @@ -174,7 +174,7 @@ void CCLayerImpl::didDraw() #endif } -void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState) const +void CCLayerImpl::appendDebugBorderQuad(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState) const { if (!hasDebugBorders()) return; @@ -183,7 +183,7 @@ void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth())); } -unsigned CCLayerImpl::contentsTextureId() const +CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const { ASSERT_NOT_REACHED(); return 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index a5cacd64b..6196c2c4d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -34,6 +34,7 @@ #include "cc/CCInputHandler.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCRenderSurface.h" +#include "cc/CCResourceProvider.h" #include "cc/CCSharedQuadState.h" #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> @@ -44,11 +45,10 @@ namespace WebCore { -class CCGraphicsContext; class CCLayerSorter; class CCLayerTreeHostImpl; -class CCQuadCuller; class CCRenderer; +class CCQuadSink; class LayerChromium; class CCLayerImpl : public CCLayerAnimationControllerClient { @@ -87,17 +87,17 @@ public: CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; } - PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; + PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; // willDraw must be called before appendQuads. If willDraw is called, // didDraw is guaranteed to be called before another willDraw or before // the layer is destroyed. To enforce this, any class that overrides // willDraw/didDraw must call the base class version. - virtual void willDraw(CCRenderer*, CCGraphicsContext*); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) { } - virtual void didDraw(); - void appendDebugBorderQuad(CCQuadCuller&, const CCSharedQuadState*) const; + virtual void willDraw(CCResourceProvider*); + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) { } + virtual void didDraw(CCResourceProvider*); + void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*) const; - virtual unsigned contentsTextureId() const; + virtual CCResourceProvider::ResourceId contentsResourceId() const; // Returns true if this layer has content to draw. void setDrawsContent(bool); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 1f51f19d4..377f74d54 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -151,7 +151,7 @@ void CCLayerTreeHost::initializeLayerRenderer() // Update m_settings based on partial update capability. m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); - m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize); + m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize, CCRenderer::ContentPool); m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA); m_layerRendererInitialized = true; @@ -197,11 +197,11 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() return RecreateFailedAndGaveUp; } -void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* allocator) +void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); if (m_layerRendererInitialized) - m_contentsTextureManager->clearAllMemory(allocator); + m_contentsTextureManager->clearAllMemory(resourceProvider); } void CCLayerTreeHost::acquireLayerTextures() @@ -230,7 +230,7 @@ void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) ASSERT(CCProxy::isImplThread()); TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); - m_contentsTextureManager->reduceMemory(hostImpl->contentsTextureAllocator()); + m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); } // This function commits the CCLayerTreeHost to an impl tree. When modifying diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index bd65650f4..839785905 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -52,7 +52,6 @@ class CCLayerTreeHostImpl; class CCLayerTreeHostImplClient; class CCTextureUpdater; class Region; -class TextureAllocator; class CCPrioritizedTextureManager; struct CCRenderingStats; struct CCScrollAndScaleSet; @@ -182,7 +181,7 @@ public: void willCommit() { m_client->willCommit(); } void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } - void deleteContentsTexturesOnImplThread(TextureAllocator*); + void deleteContentsTexturesOnImplThread(CCResourceProvider*); virtual void acquireLayerTextures(); // Returns false if we should abort this frame due to initialization failure. bool initializeLayerRendererIfNeeded(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp index c75d548f8..3946c23dc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp @@ -414,15 +414,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // the transform to the anchor point is specified in "pixel layer space", where the bounds // of the layer map to [bounds.width(), bounds.height()]. // - // 3. The value of layer->position() is actually the position of the anchor point with respect to the position - // of the layer's origin. That is: - // layer->position() = positionOfLayerOrigin + anchorPoint (in pixel units) - // - // Or, equivalently, - // positionOfLayerOrigin.x = layer->position.x - (layer->anchorPoint.x * bounds.width) - // positionOfLayerOrigin.y = layer->position.y - (layer->anchorPoint.y * bounds.height) - // - // 4. Definition of various transforms used: + // 3. Definition of various transforms used: // M[parent] is the parent matrix, with respect to the nearest render surface, passed down recursively. // M[root] is the full hierarchy, with respect to the root, passed down recursively. // Tr[origin] is the translation matrix from the parent's origin to this layer's origin. @@ -433,7 +425,6 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // Tr[anchor2center] is the translation offset from the anchor point and the center of the layer // // Some shortcuts and substitutions are used in the code to reduce matrix multiplications: - // Translating by the value of layer->position(), Tr[layer->position()] = Tr[origin] * Tr[origin2anchor] // Tr[anchor2center] = Tr[origin2anchor].inverse() * Tr[origin2center] // // Some composite transforms can help in understanding the sequence of transforms: @@ -443,7 +434,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // In words, the layer transform is applied about the anchor point, and the sublayer transform is // applied about the center of the layer. // - // 5. When a layer (or render surface) is drawn, it is drawn into a "target render surface". Therefore the draw + // 4. When a layer (or render surface) is drawn, it is drawn into a "target render surface". Therefore the draw // transform does not necessarily transform from screen space to local layer space. Instead, the draw transform // is the transform between the "target render surface space" and local layer space. Note that render surfaces, // except for the root, also draw themselves into a different target render surface, and so their draw @@ -487,11 +478,11 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // M[surface2root] = M[owningLayer->screenspace] * S[contentsScale].inverse() // // The replica draw transform is: - // M[replicaDraw] = M[surfaceOrigin] * S[contentsScale] * Tr[replica->position()] * Tr[replica] * Tr[anchor2center] * S[contentsScale].inverse() - // = M[owningLayer->draw] * Tr[origin2center].inverse() * S[contentsScale] * Tr[replica->position()] * Tr[replica] * Tr[anchor2clippedCenter] * S[contentsScale].inverse() + // M[replicaDraw] = M[surfaceOrigin] * S[contentsScale] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[anchor2center] * S[contentsScale].inverse() + // = M[owningLayer->draw] * Tr[origin2center].inverse() * S[contentsScale] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[anchor2clippedCenter] * S[contentsScale].inverse() // // The replica origin transform to its target surface origin is: - // M[replicaOrigin] = S[contentsScale] * M[surfaceOrigin] * Tr[replica->position()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].invers() + // M[replicaOrigin] = S[contentsScale] * M[surfaceOrigin] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].invers() // // The replica origin transform to the root (screen space) origin is: // M[replica2root] = M[surface2root] * Tr[replica->position()] * Tr[replica] * Tr[origin2anchor].inverse() @@ -516,13 +507,13 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay float centerOffsetY = (0.5 - anchorPoint.y()) * bounds.height(); WebTransformationMatrix layerLocalTransform; - // LT = Tr[origin] * S[pageScaleDelta] + // LT = S[pageScaleDelta] layerLocalTransform.scale(layer->pageScaleDelta()); - // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] - layerLocalTransform.translate3d(position.x(), position.y(), layer->anchorPointZ()); - // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] * M[layer] + // LT = S[pageScaleDelta] * Tr[origin] * Tr[origin2anchor] + layerLocalTransform.translate3d(position.x() + anchorPoint.x() * bounds.width(), position.y() + anchorPoint.y() * bounds.height(), layer->anchorPointZ()); + // LT = S[pageScaleDelta] * Tr[origin] * Tr[origin2anchor] * M[layer] layerLocalTransform.multiply(layer->transform()); - // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] * M[layer] * Tr[anchor2center] + // LT = S[pageScaleDelta] * Tr[origin] * Tr[origin2anchor] * M[layer] * Tr[anchor2center] layerLocalTransform.translate3d(centerOffsetX, centerOffsetY, -layer->anchorPointZ()); // The combinedTransform that gets computed below is effectively the layer's drawTransform, unless @@ -781,20 +772,22 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay WebTransformationMatrix replicaDrawTransform = renderSurface->originTransform(); replicaDrawTransform.scale(contentsScale); - replicaDrawTransform.translate(layer->replicaLayer()->position().x(), layer->replicaLayer()->position().y()); + replicaDrawTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), + layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); replicaDrawTransform.multiply(layer->replicaLayer()->transform()); FloatPoint layerSpaceSurfaceCenter = surfaceCenter; layerSpaceSurfaceCenter.scale(1 / contentsScale, 1 / contentsScale); - replicaDrawTransform.translate(layerSpaceSurfaceCenter.x() - anchorPoint.x() * bounds.width(), layerSpaceSurfaceCenter.y() - anchorPoint.y() * bounds.height()); + replicaDrawTransform.translate(layerSpaceSurfaceCenter.x() - layer->replicaLayer()->anchorPoint().x() * bounds.width(), layerSpaceSurfaceCenter.y() - layer->replicaLayer()->anchorPoint().y() * bounds.height()); replicaDrawTransform.scale(1 / contentsScale); renderSurface->setReplicaDrawTransform(replicaDrawTransform); WebTransformationMatrix surfaceOriginToReplicaOriginTransform; surfaceOriginToReplicaOriginTransform.scale(contentsScale); - surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x(), layer->replicaLayer()->position().y()); + surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), + layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer()->transform()); - surfaceOriginToReplicaOriginTransform.translate(-anchorPoint.x() * bounds.width(), -anchorPoint.y() * bounds.height()); + surfaceOriginToReplicaOriginTransform.translate(-layer->replicaLayer()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y() * bounds.height()); surfaceOriginToReplicaOriginTransform.scale(1 / contentsScale); // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 04bb78671..7f1240432 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -29,7 +29,6 @@ #include "LayerRendererChromium.h" #include "TextStream.h" #include "TraceEvent.h" -#include "TrackingTextureAllocator.h" #include "cc/CCActiveGestureAnimation.h" #include "cc/CCDamageTracker.h" #include "cc/CCDebugRectHistory.h" @@ -329,11 +328,16 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) if (it.representsContributingRenderSurface() && !it->renderSurface()->scissorRect().isEmpty()) { CCRenderPass* contributingRenderPass = surfacePassMap.get(it->renderSurface()); pass->appendQuadsForRenderSurfaceLayer(*it, contributingRenderPass, &occlusionTracker); - } else if (it.representsItself() && !occlusionTracker.occluded(*it, it->visibleContentRect()) && !it->visibleContentRect().isEmpty() && !it->scissorRect().isEmpty()) { - it->willDraw(m_layerRenderer.get(), context()); - frame.willDrawLayers.append(*it); - - pass->appendQuadsForLayer(*it, &occlusionTracker, hadMissingTiles); + } else if (it.representsItself() && !it->visibleContentRect().isEmpty() && !it->scissorRect().isEmpty()) { + bool hasOcclusionFromOutsideTargetSurface; + if (occlusionTracker.occluded(*it, it->visibleContentRect(), &hasOcclusionFromOutsideTargetSurface)) { + if (hasOcclusionFromOutsideTargetSurface) + pass->setHasOcclusionFromOutsideTargetSurface(hasOcclusionFromOutsideTargetSurface); + } else { + it->willDraw(m_resourceProvider.get()); + frame.willDrawLayers.append(*it); + pass->appendQuadsForLayer(*it, &occlusionTracker, hadMissingTiles); + } } if (hadMissingTiles) { @@ -523,7 +527,7 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) void CCLayerTreeHostImpl::releaseContentsTextures() { - contentsTextureAllocator()->deleteAllTextures(); + m_resourceProvider->deleteOwnedResources(CCRenderer::ContentPool); m_contentsTexturesWerePurgedSinceLastCommit = true; m_client->setNeedsCommitOnImplThread(); } @@ -547,30 +551,19 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) // FIXME: use the frame begin time from the overall compositor scheduler. // This value is currently inaccessible because it is up in Chromium's // RenderWidget. - - // The root RenderPass is the last one to be drawn. - const CCRenderPass* rootRenderPass = frame.renderPasses.last(); - m_fpsCounter->markBeginningOfFrame(currentTime()); - m_layerRenderer->beginDrawingFrame(rootRenderPass); - - for (size_t i = 0; i < frame.renderPasses.size(); ++i) { - const CCRenderPass* renderPass = frame.renderPasses[i]; - FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(m_rootScissorRect); - m_layerRenderer->drawRenderPass(renderPass, rootScissorRectInCurrentSurface); + m_layerRenderer->drawFrame(frame.renderPasses, m_rootScissorRect); + if (m_headsUpDisplay->enabled(settings())) + m_headsUpDisplay->draw(this); + m_layerRenderer->finishDrawingFrame(); - renderPass->targetSurface()->damageTracker()->didDrawDamagedArea(); - } + for (unsigned int i = 0; i < frame.renderPasses.size(); i++) + frame.renderPasses[i]->targetSurface()->damageTracker()->didDrawDamagedArea(); if (m_debugRectHistory->enabled(settings())) m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, settings()); - if (m_headsUpDisplay->enabled(settings())) - m_headsUpDisplay->draw(this); - - m_layerRenderer->finishDrawingFrame(); - ++m_sourceAnimationFrameNumber; // The next frame should start by assuming nothing has changed, and changes are noted as they occur. @@ -580,7 +573,7 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) void CCLayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) { for (size_t i = 0; i < frame.willDrawLayers.size(); ++i) - frame.willDrawLayers[i]->didDraw(); + frame.willDrawLayers[i]->didDraw(m_resourceProvider.get()); } void CCLayerTreeHostImpl::finishAllRendering() @@ -599,11 +592,6 @@ const LayerRendererCapabilities& CCLayerTreeHostImpl::layerRendererCapabilities( return m_layerRenderer->capabilities(); } -TextureAllocator* CCLayerTreeHostImpl::contentsTextureAllocator() const -{ - return m_layerRenderer ? m_layerRenderer->contentsTextureAllocator() : 0; -} - bool CCLayerTreeHostImpl::swapBuffers() { ASSERT(m_layerRenderer); @@ -709,8 +697,11 @@ bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> return false; } + OwnPtr<CCGraphicsContext> contextRef(context); + OwnPtr<CCResourceProvider> resourceProvider = CCResourceProvider::create(contextRef.get()); OwnPtr<LayerRendererChromium> layerRenderer; - layerRenderer = LayerRendererChromium::create(this, context3d, textureUploader); + if (resourceProvider.get()) + layerRenderer = LayerRendererChromium::create(this, resourceProvider.get(), textureUploader); // Since we now have a new context/layerRenderer, we cannot continue to use the old // resources (i.e. renderSurfaces and texture IDs). @@ -720,8 +711,9 @@ bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> } m_layerRenderer = layerRenderer.release(); + m_resourceProvider = resourceProvider.release(); if (m_layerRenderer) - m_context = context; + m_context = contextRef.release(); if (!m_visible && m_layerRenderer) m_layerRenderer->setVisible(m_visible); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index 753aa384a..f936e34dd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -46,8 +46,8 @@ class CCLayerImpl; class CCLayerTreeHostImplTimeSourceAdapter; class CCPageScaleAnimation; class CCRenderPassDrawQuad; +class CCResourceProvider; class LayerRendererChromium; -class TextureAllocator; struct LayerRendererCapabilities; // CCLayerTreeHost->CCProxy callback interface. @@ -127,7 +127,6 @@ public: bool isContextLost(); CCRenderer* layerRenderer() { return m_layerRenderer.get(); } const LayerRendererCapabilities& layerRendererCapabilities() const; - TextureAllocator* contentsTextureAllocator() const; bool swapBuffers(); @@ -177,6 +176,7 @@ public: CCFrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } CCDebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); } + CCResourceProvider* resourceProvider() const { return m_resourceProvider.get(); } class CullRenderPassesWithCachedTextures { public: @@ -252,6 +252,7 @@ private: void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const; OwnPtr<CCGraphicsContext> m_context; + OwnPtr<CCResourceProvider> m_resourceProvider; OwnPtr<CCRenderer> m_layerRenderer; OwnPtr<CCLayerImpl> m_rootLayerImpl; CCLayerImpl* m_rootScrollLayerImpl; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp index 0d01593cf..0083ad1dd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp @@ -377,8 +377,11 @@ static inline bool testContentRectOccluded(const IntRect& contentRect, const Web } template<typename LayerType, typename RenderSurfaceType> -bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* layer, const IntRect& contentRect) const +bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = false; + ASSERT(!m_stack.isEmpty()); if (m_stack.isEmpty()) return false; @@ -387,10 +390,15 @@ bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerT ASSERT(layer->renderTarget() == m_stack.last().target); - if (layerTransformsToScreenKnown(layer) && testContentRectOccluded(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen)) - return true; if (layerTransformsToTargetKnown(layer) && testContentRectOccluded(contentRect, contentToTargetSurfaceTransform<LayerType>(layer), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget)) return true; + + if (layerTransformsToScreenKnown(layer) && testContentRectOccluded(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen)) { + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = true; + return true; + } + return false; } @@ -417,7 +425,7 @@ static inline IntRect computeUnoccludedContentRect(const IntRect& contentRect, c } template<typename LayerType, typename RenderSurfaceType> -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* layer, const IntRect& contentRect) const +IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { ASSERT(!m_stack.isEmpty()); if (m_stack.isEmpty()) @@ -434,18 +442,18 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentR if (layerTransformsToScreenKnown(layer)) unoccludedInScreen = computeUnoccludedContentRect(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen); - if (unoccludedInScreen.isEmpty()) - return unoccludedInScreen; - IntRect unoccludedInTarget = contentRect; if (layerTransformsToTargetKnown(layer)) unoccludedInTarget = computeUnoccludedContentRect(contentRect, contentToTargetSurfaceTransform<LayerType>(layer), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget); + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = (intersection(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget); + return intersection(unoccludedInScreen, unoccludedInTarget); } template<typename LayerType, typename RenderSurfaceType> -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect) const +IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { ASSERT(!m_stack.isEmpty()); // The layer is a contributing renderTarget so it should have a surface. @@ -484,9 +492,6 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, Region()); } - if (unoccludedInScreen.isEmpty()) - return unoccludedInScreen; - IntRect unoccludedInTarget = contentRect; if (surfaceTransformsToTargetKnown(surface)) { if (hasOcclusion) { @@ -496,6 +501,9 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, Region()); } + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = (intersection(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget); + return intersection(unoccludedInScreen, unoccludedInTarget); } @@ -517,9 +525,9 @@ template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::ente template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::finishedRenderTarget(const LayerChromium* finishedTarget); template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::leaveToRenderTarget(const LayerChromium* newTarget); template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::markOccludedBehindLayer(const LayerChromium*); -template bool CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::occluded(const LayerChromium*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContentRect(const LayerChromium*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContributingSurfaceContentRect(const LayerChromium*, bool forReplica, const IntRect& contentRect) const; +template bool CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::occluded(const LayerChromium*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContentRect(const LayerChromium*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContributingSurfaceContentRect(const LayerChromium*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::layerScissorRectInTargetSurface(const LayerChromium*) const; template CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::CCOcclusionTrackerBase(IntRect scissorRectInScreenSpace, bool recordMetricsForFrame); @@ -529,9 +537,9 @@ template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::enterRenderT template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::finishedRenderTarget(const CCLayerImpl* finishedTarget); template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::leaveToRenderTarget(const CCLayerImpl* newTarget); template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::markOccludedBehindLayer(const CCLayerImpl*); -template bool CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::occluded(const CCLayerImpl*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContentRect(const CCLayerImpl*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContributingSurfaceContentRect(const CCLayerImpl*, bool forReplica, const IntRect& contentRect) const; +template bool CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::occluded(const CCLayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContentRect(const CCLayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContributingSurfaceContentRect(const CCLayerImpl*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::layerScissorRectInTargetSurface(const CCLayerImpl*) const; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h index ae85751ea..a601b6d39 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h @@ -54,13 +54,13 @@ public: void leaveLayer(const CCLayerIteratorPosition<LayerType>&); // Returns true if the given rect in content space for the layer is fully occluded in either screen space or the layer's target surface. - bool occluded(const LayerType*, const IntRect& contentRect) const; + bool occluded(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; // Gives an unoccluded sub-rect of |contentRect| in the content space of the layer. Used when considering occlusion for a layer that paints/draws something. - IntRect unoccludedContentRect(const LayerType*, const IntRect& contentRect) const; + IntRect unoccludedContentRect(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; // Gives an unoccluded sub-rect of |contentRect| in the content space of the renderTarget owned by the layer. // Used when considering occlusion for a contributing surface that is rendering into another target. - IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect) const; + IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; // Report operations for recording overdraw metrics. CCOverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp index 1df771386..60cf1a1e2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp @@ -29,7 +29,6 @@ #include "CCPrioritizedTextureManager.h" #include "CCPriorityCalculator.h" #include "LayerRendererChromium.h" -#include "TextureAllocator.h" #include <algorithm> using namespace std; @@ -90,46 +89,29 @@ bool CCPrioritizedTexture::requestLate() return m_manager->requestLate(this); } -void CCPrioritizedTexture::acquireBackingTexture(TextureAllocator* allocator) +void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourceProvider) { ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) - m_manager->acquireBackingTextureIfNeeded(this, allocator); + m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); } -unsigned CCPrioritizedTexture::textureId() +CCResourceProvider::ResourceId CCPrioritizedTexture::resourceId() const { if (m_backing) return m_backing->id(); return 0; } -void CCPrioritizedTexture::bindTexture(CCGraphicsContext* context, TextureAllocator* allocator) +void CCPrioritizedTexture::upload(CCResourceProvider* resourceProvider, + const uint8_t* image, const IntRect& imageRect, + const IntRect& sourceRect, const IntRect& destRect) { ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) - acquireBackingTexture(allocator); + acquireBackingTexture(resourceProvider); ASSERT(m_backing); - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId()); -} - -void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, TextureAllocator* allocator) -{ - ASSERT(m_isAbovePriorityCutoff); - if (m_isAbovePriorityCutoff) - acquireBackingTexture(allocator); - ASSERT(m_backing); - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - context3d->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId(), 0); + resourceProvider->upload(resourceId(), image, imageRect, sourceRect, destRect); } void CCPrioritizedTexture::link(Backing* backing) @@ -159,4 +141,3 @@ void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) } } // namespace WebCore - diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h index 46073c5f3..764cbeced 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h @@ -25,18 +25,16 @@ #ifndef CCPrioritizedTexture_h #define CCPrioritizedTexture_h -#include "CCPriorityCalculator.h" -#include "CCTexture.h" #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" +#include "cc/CCPriorityCalculator.h" +#include "cc/CCResourceProvider.h" +#include "cc/CCTexture.h" namespace WebCore { class CCPrioritizedTextureManager; -class CCPriorityCalculator; -class CCGraphicsContext; -class TextureAllocator; class CCPrioritizedTexture { WTF_MAKE_NONCOPYABLE(CCPrioritizedTexture); @@ -76,7 +74,7 @@ public: // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire // a backing texture for use. Call this whenever the texture is actually needed. - void acquireBackingTexture(TextureAllocator*); + void acquireBackingTexture(CCResourceProvider*); // FIXME: Request late is really a hack for when we are totally out of memory // (all textures are visible) but we can still squeeze into the limit @@ -87,11 +85,10 @@ public: // regress OOMs situations. bool requestLate(); - // These functions will acquire the texture if possible. If neither haveBackingTexture() - // nor canAcquireBackingTexture() is true, an ID of zero will be used/returned. - void bindTexture(CCGraphicsContext*, TextureAllocator*); - void framebufferTexture2D(CCGraphicsContext*, TextureAllocator*); - unsigned textureId(); + // Uploads pixels into the backing resource. This functions will aquire the backing if needed. + void upload(CCResourceProvider*, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect); + + CCResourceProvider::ResourceId resourceId() const; // Self-managed textures are accounted for when prioritizing other textures, // but they are not allocated/recycled/deleted, so this needs to be done diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp index d19e5aa19..4a24179c5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp @@ -36,11 +36,12 @@ using namespace std; namespace WebCore { -CCPrioritizedTextureManager::CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int) +CCPrioritizedTextureManager::CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int, int pool) : m_maxMemoryLimitBytes(maxMemoryLimitBytes) , m_memoryUseBytes(0) , m_memoryAboveCutoffBytes(0) , m_memoryAvailableBytes(0) + , m_pool(pool) { } @@ -49,7 +50,7 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager() while (m_textures.size() > 0) unregisterTexture(*m_textures.begin()); - // Each remaining backing is a leaked opengl texture. We don't have the allocator + // Each remaining backing is a leaked opengl texture. We don't have the resourceProvider // to delete the textures at this time so clearMemory() needs to be called before this. while (m_backings.size() > 0) destroyBacking(*m_backings.begin(), 0); @@ -168,7 +169,7 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) return true; } -void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, TextureAllocator* allocator) +void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, CCResourceProvider* resourceProvider) { ASSERT(!texture->isSelfManaged()); ASSERT(texture->isAbovePriorityCutoff()); @@ -190,8 +191,8 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex // Otherwise reduce memory and just allocate a new backing texures. if (!backing) { - reduceMemory(m_memoryAvailableBytes - texture->bytes(), allocator); - backing = createBacking(texture->size(), texture->format(), allocator); + reduceMemory(m_memoryAvailableBytes - texture->bytes(), resourceProvider); + backing = createBacking(texture->size(), texture->format(), resourceProvider); } // Move the used backing texture to the end of the eviction list. @@ -202,7 +203,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex m_backings.add(backing); } -void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, TextureAllocator* allocator) +void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, CCResourceProvider* resourceProvider) { if (memoryUseBytes() <= limitBytes) return; @@ -212,13 +213,13 @@ void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, TextureAllocat BackingSet::iterator it = m_backings.begin(); if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) break; - destroyBacking((*it), allocator); + destroyBacking((*it), resourceProvider); } } -void CCPrioritizedTextureManager::reduceMemory(TextureAllocator* allocator) +void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvider) { - reduceMemory(m_memoryAvailableBytes, allocator); + reduceMemory(m_memoryAvailableBytes, resourceProvider); ASSERT(memoryUseBytes() <= maxMemoryLimitBytes()); // We currently collect backings from deleted textures for later recycling. @@ -235,17 +236,17 @@ void CCPrioritizedTextureManager::reduceMemory(TextureAllocator* allocator) size_t tenPercentOfMemory = m_memoryAvailableBytes / 10; if (wastedMemory <= tenPercentOfMemory) return; - reduceMemory(memoryUseBytes() - (wastedMemory - tenPercentOfMemory), allocator); + reduceMemory(memoryUseBytes() - (wastedMemory - tenPercentOfMemory), resourceProvider); } -void CCPrioritizedTextureManager::clearAllMemory(TextureAllocator* allocator) +void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourceProvider) { // Unlink and destroy all backing textures. while (m_backings.size() > 0) { BackingSet::iterator it = m_backings.begin(); if ((*it)->owner()) (*it)->owner()->unlink(); - destroyBacking((*it), allocator); + destroyBacking((*it), resourceProvider); } } @@ -253,7 +254,7 @@ void CCPrioritizedTextureManager::allBackingTexturesWereDeleted() { // Same as clearAllMemory, except all our textures were already // deleted externally, so we don't delete them. Passing no - // allocator results in leaking the (now invalid) texture ids. + // resourceProvider results in leaking the (now invalid) texture ids. clearAllMemory(0); } @@ -291,26 +292,27 @@ void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* tex } } -CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, TextureAllocator* allocator) +CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, CCResourceProvider* resourceProvider) { - ASSERT(allocator); + ASSERT(resourceProvider); - CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(allocator->createTexture(size, format), size, format); + CCResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, CCResourceProvider::TextureUsageAny); + CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(resourceId, size, format); m_memoryUseBytes += backing->bytes(); // Put backing texture at the front for eviction, since it isn't in use yet. m_backings.insertBefore(m_backings.begin(), backing); return backing; } -void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, TextureAllocator* allocator) +void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, CCResourceProvider* resourceProvider) { ASSERT(backing); ASSERT(!backing->owner() || !backing->owner()->isAbovePriorityCutoff()); ASSERT(!backing->owner() || !backing->owner()->isSelfManaged()); ASSERT(m_backings.find(backing) != m_backings.end()); - if (allocator) - allocator->deleteTexture(backing->id(), backing->size(), backing->format()); + if (resourceProvider) + resourceProvider->deleteResource(backing->id()); if (backing->owner()) backing->owner()->unlink(); m_memoryUseBytes -= backing->bytes(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h index 019c45cf4..b16ec1034 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h @@ -40,9 +40,9 @@ class CCPriorityCalculator; class CCPrioritizedTextureManager { WTF_MAKE_NONCOPYABLE(CCPrioritizedTextureManager); public: - static PassOwnPtr<CCPrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize) + static PassOwnPtr<CCPrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool) { - return adoptPtr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize)); + return adoptPtr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool)); } PassOwnPtr<CCPrioritizedTexture> createTexture(IntSize size, GC3Denum format) { @@ -73,11 +73,11 @@ public: bool requestLate(CCPrioritizedTexture*); - void reduceMemory(TextureAllocator*); - void clearAllMemory(TextureAllocator*); + void reduceMemory(CCResourceProvider*); + void clearAllMemory(CCResourceProvider*); void allBackingTexturesWereDeleted(); - void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, TextureAllocator*); + void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*); void registerTexture(CCPrioritizedTexture*); void unregisterTexture(CCPrioritizedTexture*); @@ -105,18 +105,19 @@ private: return CCPriorityCalculator::priorityIsLower(priorityA, priorityB); } - CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize); + CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool); - void reduceMemory(size_t limit, TextureAllocator*); + void reduceMemory(size_t limit, CCResourceProvider*); - CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, TextureAllocator*); - void destroyBacking(CCPrioritizedTexture::Backing*, TextureAllocator*); + CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*); + void destroyBacking(CCPrioritizedTexture::Backing*, CCResourceProvider*); size_t m_maxMemoryLimitBytes; unsigned m_priorityCutoff; size_t m_memoryUseBytes; size_t m_memoryAboveCutoffBytes; size_t m_memoryAvailableBytes; + int m_pool; typedef HashSet<CCPrioritizedTexture*> TextureSet; typedef ListHashSet<CCPrioritizedTexture::Backing*> BackingSet; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp index 65f78788e..0684f3ee5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -33,7 +33,9 @@ #include "SkColor.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" +#include "cc/CCOcclusionTracker.h" #include "cc/CCOverdrawMetrics.h" +#include "cc/CCRenderPass.h" #include <public/WebTransformationMatrix.h> using namespace std; @@ -46,11 +48,13 @@ static const int debugTileBorderColorRed = 160; static const int debugTileBorderColorGreen = 100; static const int debugTileBorderColorBlue = 0; -CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads) +CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) : m_quadList(quadList) , m_layer(layer) , m_occlusionTracker(occlusionTracker) , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) + , m_forSurface(forSurface) + , m_hasOcclusionFromOutsideTargetSurface(false) { } @@ -78,13 +82,15 @@ static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad) { - IntRect culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDrawQuad->quadRect()); - return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads); -} + IntRect culledRect; + bool hasOcclusionFromOutsideTargetSurface; + + if (m_forSurface) + culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, false, passDrawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurface); + else + culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDrawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurface); + m_hasOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface; -bool CCQuadCuller::appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad) -{ - IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, false, passDrawQuad->quadRect()); return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h index 2999b6ad5..7f0802782 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h @@ -26,27 +26,33 @@ #ifndef CCQuadCuller_h #define CCQuadCuller_h -#include "cc/CCRenderPass.h" +#include "CCQuadSink.h" namespace WebCore { class CCLayerImpl; -class CCOverdrawMetrics; +class CCRenderSurface; +class CCQuadList; +template<typename LayerType, typename SurfaceType> +class CCOcclusionTrackerBase; -class CCQuadCuller { +class CCQuadCuller : public CCQuadSink { public: - // Passing 0 for CCOverdrawCounts* is valid, and disable the extra computation - // done to estimate over draw statistics. - CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerImpl*, bool showCullingWithDebugBorderQuads); + CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface); + + virtual ~CCQuadCuller() { } // Returns true if the quad is added to the list, and false if the quad is entirely culled. - virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad); - virtual bool appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad); + virtual bool append(PassOwnPtr<WebKit::WebCompositorQuad> passDrawQuad) OVERRIDE; + + bool hasOcclusionFromOutsideTargetSurface() { return m_hasOcclusionFromOutsideTargetSurface; } private: CCQuadList& m_quadList; CCLayerImpl* m_layer; - const CCOcclusionTrackerImpl* m_occlusionTracker; + const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>* m_occlusionTracker; bool m_showCullingWithDebugBorderQuads; + bool m_forSurface; + bool m_hasOcclusionFromOutsideTargetSurface; }; } diff --git a/Source/WebCore/platform/graphics/chromium/TextureAllocator.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h index 58de11522..f2a9c62ae 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureAllocator.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h @@ -1,49 +1,46 @@ /* - * Copyright (C) 2012, Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 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 + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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 CCQuadSink_h +#define CCQuadSink_h -#ifndef TextureAllocator_h -#define TextureAllocator_h +#include <wtf/PassOwnPtr.h> -#include "GraphicsContext3D.h" -#include "IntRect.h" -#include "IntSize.h" +namespace WebKit { +class WebCompositorQuad; +} namespace WebCore { -class TextureAllocator { +class CCQuadSink { public: - virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0; - virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0; - virtual void deleteAllTextures() = 0; + virtual ~CCQuadSink() { } -protected: - virtual ~TextureAllocator() { } + // Returns true if the quad is added to the list, and false if the quad is entirely culled. + virtual bool append(PassOwnPtr<WebKit::WebCompositorQuad> passDrawQuad) = 0; }; } - -#endif - - +#endif // CCQuadCuller_h diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 532665fbe..75b4e2d67 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -29,6 +29,7 @@ #include "cc/CCLayerImpl.h" #include "cc/CCMathUtil.h" +#include "cc/CCOcclusionTracker.h" #include "cc/CCQuadCuller.h" #include "cc/CCSharedQuadState.h" #include "cc/CCSolidColorDrawQuad.h" @@ -47,6 +48,7 @@ CCRenderPass::CCRenderPass(CCRenderSurface* targetSurface, int id) , m_targetSurface(targetSurface) , m_framebufferOutputRect(targetSurface->contentRect()) , m_hasTransparentBackground(true) + , m_hasOcclusionFromOutsideTargetSurface(false) { ASSERT(targetSurface); ASSERT(id > 0); @@ -54,35 +56,43 @@ CCRenderPass::CCRenderPass(CCRenderSurface* targetSurface, int id) void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImpl* occlusionTracker, bool& hadMissingTiles) { - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders()); + const bool forSurface = false; + CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(m_sharedQuadStateList.size()); layer->appendDebugBorderQuad(quadCuller, sharedQuadState.get()); layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); m_sharedQuadStateList.append(sharedQuadState.release()); + + m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl* occlusionTracker) { // FIXME: render surface layers should be a CCLayerImpl-derived class and // not be handled specially here. - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders()); + const bool forSurface = true; + CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); CCRenderSurface* surface = layer->renderSurface(); - OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(m_sharedQuadStateList.size()); bool isReplica = false; surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(sharedQuadState.release()); + m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); + if (!layer->hasReplica()) return; // Add replica after the surface so that it appears below the surface. - OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(); + OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(m_sharedQuadStateList.size()); isReplica = true; surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(replicaSharedQuadState.release()); + + m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroundColor, const CCOcclusionTrackerImpl& occlusionTracker) @@ -96,7 +106,7 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree // Manually create the quad state for the gutter quads, as the root layer // doesn't have any bounds and so can't generate this itself. - OwnPtr<CCSharedQuadState> sharedQuadState = rootLayer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = rootLayer->createSharedQuadState(m_sharedQuadStateList.size()); WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 010a7674b..816481c97 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -71,6 +71,8 @@ public: bool hasTransparentBackground() const { return m_hasTransparentBackground; } void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; } + bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; } + void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; } protected: CCRenderPass(CCRenderSurface*, int id); @@ -80,6 +82,7 @@ protected: IntRect m_framebufferOutputRect; Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList; bool m_hasTransparentBackground; + bool m_hasOcclusionFromOutsideTargetSurface; }; typedef Vector<CCRenderPass*> CCRenderPassList; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp index 59abfbbcc..2d74a2278 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp @@ -31,19 +31,19 @@ using WebKit::WebCompositorQuad; namespace WebCore { -PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) +PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) { - return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); + return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame)); } -CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) +CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::RenderPass, quadRect) , m_renderPassId(renderPassId) , m_isReplica(isReplica) , m_drawTransform(drawTransform) , m_filters(filters) , m_backgroundFilters(backgroundFilters) - , m_maskTextureId(maskTextureId) + , m_maskResourceId(maskResourceId) , m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame) { ASSERT(m_renderPassId > 0); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h index a12f204ca..6f399be67 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h @@ -26,6 +26,7 @@ #ifndef CCRenderPassDrawQuad_h #define CCRenderPassDrawQuad_h +#include "cc/CCResourceProvider.h" #include <public/WebCompositorQuad.h> #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> @@ -38,11 +39,11 @@ class CCRenderPass; class CCRenderPassDrawQuad : public WebKit::WebCompositorQuad { WTF_MAKE_NONCOPYABLE(CCRenderPassDrawQuad); public: - static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); + static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); int renderPassId() const { return m_renderPassId; } bool isReplica() const { return m_isReplica; } - unsigned maskTextureId() const { return m_maskTextureId; } + CCResourceProvider::ResourceId maskResourceId() const { return m_maskResourceId; } const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; } // FIXME: This should be removed and we should draw the RenderPass with the quadTransform. @@ -53,14 +54,14 @@ public: static const CCRenderPassDrawQuad* materialCast(const WebKit::WebCompositorQuad*); private: - CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); + CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); int m_renderPassId; bool m_isReplica; WebKit::WebTransformationMatrix m_drawTransform; WebKit::WebFilterOperations m_filters; WebKit::WebFilterOperations m_backgroundFilters; - unsigned m_maskTextureId; + CCResourceProvider::ResourceId m_maskResourceId; IntRect m_contentsChangedSinceLastFrame; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index e7260966a..22434c203 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -36,7 +36,7 @@ #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" #include "cc/CCMathUtil.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCRenderPassDrawQuad.h" #include "cc/CCSharedQuadState.h" #include <public/WebTransformationMatrix.h> @@ -163,16 +163,16 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const return m_surfacePropertyChanged && !m_owningLayer->layerPropertyChanged(); } -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState() const +PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState(int id) const { bool isOpaque = false; - return CCSharedQuadState::create(m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); + return CCSharedQuadState::create(id, m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState() const +PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState(int id) const { bool isOpaque = false; - return CCSharedQuadState::create(m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); + return CCSharedQuadState::create(id, m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const @@ -181,7 +181,7 @@ FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRec return CCMathUtil::projectClippedRect(inverseScreenSpaceTransform, rootScissorRect); } -void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) +void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) { ASSERT(!forReplica || m_owningLayer->hasReplica()); @@ -190,7 +190,7 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBorderColorGreen; int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorderColorBlue; SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue); - quadList.appendSurface(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); + quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); } // FIXME: By using the same RenderSurface for both the content and its reflection, @@ -209,14 +209,14 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha maskLayer = 0; } - int maskTextureId = maskLayer ? maskLayer->contentsTextureId() : 0; + CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0; WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); const WebKit::WebFilterOperations& filters = m_owningLayer->filters(); const WebKit::WebFilterOperations& backgroundFilters = m_owningLayer->backgroundFilters(); - quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); + quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame)); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index 9f7d876ee..79fdac4ec 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -39,7 +39,7 @@ namespace WebCore { class CCDamageTracker; -class CCQuadCuller; +class CCQuadSink; class CCRenderPass; class CCLayerImpl; class LayerRendererChromium; @@ -114,10 +114,10 @@ public: CCDamageTracker* damageTracker() const { return m_damageTracker.get(); } - PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; - PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState() const; + PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; + PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState(int id) const; - void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, int renderPassId); + void appendQuads(CCQuadSink&, CCSharedQuadState*, bool forReplica, int renderPassId); FloatRect computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const; @@ -157,6 +157,7 @@ private: // For CCLayerIteratorActions int m_targetRenderSurfaceLayerIndexHistory; int m_currentLayerIndexHistory; + friend struct CCLayerIteratorActions; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp index 2f031bf21..9b62946bd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp @@ -193,12 +193,7 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter source.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); source.setPixelRef(new SkGrTexturePixelRef(texture.get()))->unref(); - GrContext::TextureCacheEntry dest; - for (unsigned i = 0; i < filters.size(); ++i) { - // Save the previous texture cache destination (if any), and keep it - // locked during draw to prevent it be re-used as destination. - GrContext::TextureCacheEntry sourceEntry = dest; const WebKit::WebFilterOperation& op = filters.at(i); // Allocate a destination texture. GrTextureDesc desc; @@ -208,10 +203,11 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter desc.fHeight = size.height(); desc.fConfig = kSkia8888_PM_GrPixelConfig; // FIXME: could we use approximate match, and fix texcoords on draw - dest = gr->lockScratchTexture(desc, GrContext::kExact_ScratchTexMatch); - if (!dest.texture()) + GrAutoScratchTexture scratchTexture(gr, desc, GrContext::kExact_ScratchTexMatch); + SkAutoTUnref<GrTexture> destination(scratchTexture.detach()); + if (!destination.get()) return SkBitmap(); - SkGpuDevice device(gr, dest.texture()); + SkGpuDevice device(gr, destination.get()); SkCanvas canvas(&device); canvas.clear(0x0); switch (op.type()) { @@ -289,13 +285,8 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter break; } // Dest texture from this filter becomes source bitmap for next filter. - source.setPixelRef(new SkGrTexturePixelRef(dest.texture()))->unref(); - // Unlock the previous texture cache entry. - if (sourceEntry.texture()) - gr->unlockTexture(sourceEntry); + source.setPixelRef(new SkGrTexturePixelRef(destination.get()))->unref(); } - if (dest.texture()) - gr->unlockTexture(dest); context3D->flush(); return source; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h index ded0efdc3..d931022dc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h @@ -36,9 +36,7 @@ namespace WebCore { class CCScopedTexture; -class TextureAllocator; class TextureCopier; -class TextureManager; class TextureUploader; enum TextureUploaderOption { ThrottledUploader, UnthrottledUploader }; @@ -57,6 +55,13 @@ public: class CCRenderer { WTF_MAKE_NONCOPYABLE(CCRenderer); public: + // This enum defines the various resource pools for the CCResourceProvider + // where textures get allocated. + enum ResourcePool { + ImplPool = 1, // This pool is for textures that get allocated on the impl thread (e.g. RenderSurfaces). + ContentPool // This pool is for textures that get allocated on the main thread (e.g. tiles). + }; + virtual ~CCRenderer() { } virtual const LayerRendererCapabilities& capabilities() const = 0; @@ -67,24 +72,23 @@ public: int viewportWidth() { return viewportSize().width(); } int viewportHeight() { return viewportSize().height(); } - virtual void viewportChanged() = 0; + virtual void viewportChanged() { } const WebKit::WebTransformationMatrix& projectionMatrix() const { return m_projectionMatrix; } const WebKit::WebTransformationMatrix& windowMatrix() const { return m_windowMatrix; } - virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) = 0; - virtual bool haveCachedResourcesForRenderPassId(int) const = 0; + virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) { } + virtual bool haveCachedResourcesForRenderPassId(int) const { return false; } - virtual void beginDrawingFrame(const CCRenderPass* defaultRenderPass) = 0; - virtual void drawRenderPass(const CCRenderPass*, const FloatRect& rootScissorRectInCurrentPass) = 0; - virtual void finishDrawingFrame() = 0; + virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) = 0; + virtual void finishDrawingFrame() { } virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) = 0; // waits for rendering to finish virtual void finish() = 0; - virtual void doNoOp() = 0; + virtual void doNoOp() { } // puts backbuffer onscreen virtual bool swapBuffers(const IntRect& subBuffer) = 0; @@ -92,12 +96,8 @@ public: virtual TextureCopier* textureCopier() const = 0; virtual TextureUploader* textureUploader() const = 0; - virtual TextureAllocator* implTextureAllocator() const = 0; - virtual TextureAllocator* contentsTextureAllocator() const = 0; - - virtual void setScissorToRect(const IntRect&) = 0; - virtual bool isContextLost() = 0; + virtual bool isContextLost() { return false; } virtual void setVisible(bool) = 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp new file mode 100644 index 000000000..ef82bf22a --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp @@ -0,0 +1,250 @@ +/* + * Copyright (C) 2012, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "cc/CCResourceProvider.h" + +#include "Extensions3DChromium.h" +#include "IntRect.h" +#include "LayerRendererChromium.h" // For the GLC() macro +#include "LayerTextureSubImage.h" +#include "cc/CCGraphicsContext.h" +#include "cc/CCProxy.h" +#include <public/WebGraphicsContext3D.h> + +using WebKit::WebGraphicsContext3D; + +namespace WebCore { + +static GC3Denum textureToStorageFormat(GC3Denum textureFormat) +{ + GC3Denum storageFormat = Extensions3D::RGBA8_OES; + switch (textureFormat) { + case GraphicsContext3D::RGBA: + break; + case Extensions3D::BGRA_EXT: + storageFormat = Extensions3DChromium::BGRA8_EXT; + break; + default: + ASSERT_NOT_REACHED(); + break; + } + + return storageFormat; +} + +static bool isTextureFormatSupportedForStorage(GC3Denum format) +{ + return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EXT); +} + +PassOwnPtr<CCResourceProvider> CCResourceProvider::create(CCGraphicsContext* context) +{ + OwnPtr<CCResourceProvider> resourceProvider(adoptPtr(new CCResourceProvider(context))); + if (!resourceProvider->initialize()) + return nullptr; + return resourceProvider.release(); +} + +CCResourceProvider::~CCResourceProvider() +{ +} + +WebGraphicsContext3D* CCResourceProvider::graphicsContext3D() +{ + ASSERT(CCProxy::isImplThread()); + return m_context->context3D(); +} + +bool CCResourceProvider::inUseByConsumer(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end()); + return !!it->second.lockForReadCount; +} + +CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, const IntSize& size, GC3Denum format, TextureUsageHint hint) +{ + ASSERT(CCProxy::isImplThread()); + unsigned textureId = 0; + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return 0; + } + GLC(context3d, textureId = context3d->createTexture()); + GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); + + if (m_useTextureUsageHint && hint == TextureUsageFramebuffer) + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); + if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { + GC3Denum storageFormat = textureToStorageFormat(format); + GLC(context3d, context3d->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height())); + } else + GLC(context3d, context3d->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0)); + ResourceId id = m_nextId++; + Resource resource = {textureId, pool, 0, false, false, size, format}; + m_resources.add(id, resource); + return id; +} + +CCResourceProvider::ResourceId CCResourceProvider::createResourceFromExternalTexture(unsigned textureId) +{ + ASSERT(CCProxy::isImplThread()); + ResourceId id = m_nextId++; + Resource resource = {textureId, 0, 0, false, true, IntSize(), 0}; + m_resources.add(id, resource); + return id; +} + +void CCResourceProvider::deleteResource(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return; + } + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount); + if (!it->second.external) + GLC(context3d, context3d->deleteTexture(it->second.glId)); + m_resources.remove(it); +} + +void CCResourceProvider::deleteOwnedResources(int pool) +{ + ASSERT(CCProxy::isImplThread()); + Vector<ResourceId> toDelete; + for (ResourceMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) { + if (it->second.pool == pool && !it->second.external) + toDelete.append(it->first); + } + for (Vector<ResourceId>::iterator it = toDelete.begin(); it != toDelete.end(); ++it) + deleteResource(*it); +} + +void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect) +{ + ASSERT(CCProxy::isImplThread()); + ASSERT(m_texSubImage.get()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return; + } + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount && !it->second.external); + + context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, it->second.glId); + m_texSubImage->upload(image, imageRect, sourceRect, destRect, it->second.format, context3d); +} + +unsigned CCResourceProvider::lockForWrite(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount && !it->second.external); + it->second.lockedForWrite = true; + return it->second.glId; +} + +void CCResourceProvider::unlockForWrite(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && it->second.lockedForWrite && !it->second.external); + it->second.lockedForWrite = false; +} + +void CCResourceProvider::flush() +{ + ASSERT(CCProxy::isImplThread()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return; + } + context3d->flush(); +} + +unsigned CCResourceProvider::lockForRead(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite); + ++(it->second.lockForReadCount); + return it->second.glId; +} + +void CCResourceProvider::unlockForRead(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && it->second.lockForReadCount > 0); + --(it->second.lockForReadCount); +} + +CCResourceProvider::CCResourceProvider(CCGraphicsContext* context) + : m_context(context) + , m_nextId(1) + , m_useTextureStorageExt(false) + , m_useTextureUsageHint(false) + , m_maxTextureSize(0) +{ +} + +bool CCResourceProvider::initialize() +{ + ASSERT(CCProxy::isImplThread()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d || !context3d->makeContextCurrent()) { + // FIXME: Implement this path for software compositing. + return false; + } + String extensionsString = context3d->getString(GraphicsContext3D::EXTENSIONS); + Vector<String> extensions; + extensionsString.split(' ', extensions); + bool useMapSub = false; + for (size_t i = 0; i < extensions.size(); ++i) { + if (extensions[i] == "GL_EXT_texture_storage") + m_useTextureStorageExt = true; + else if (extensions[i] == "GL_ANGLE_texture_usage") + m_useTextureUsageHint = true; + else if (extensions[i] == "GL_CHROMIUM_map_sub") + useMapSub = true; + } + + m_texSubImage = adoptPtr(new LayerTextureSubImage(useMapSub)); + GLC(context3d, context3d->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSize)); + return true; +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h new file mode 100644 index 000000000..0476f0e88 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef CCResourceProvider_h +#define CCResourceProvider_h + +#include "GraphicsContext3D.h" +#include "IntSize.h" +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { +class WebGraphicsContext3D; +} + +namespace WebCore { + +class CCGraphicsContext; +class CCScopedLockResourceForRead; +class CCScopedLockResourceForWrite; +class LayerTextureSubImage; + +// Thread-safety notes: this class is not thread-safe and can only be called +// from the thread it was created on (in practice, the compositor thread). +class CCResourceProvider { + WTF_MAKE_NONCOPYABLE(CCResourceProvider); +public: + typedef unsigned ResourceId; + enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; + + static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*); + + virtual ~CCResourceProvider(); + + WebKit::WebGraphicsContext3D* graphicsContext3D(); + int maxTextureSize() const { return m_maxTextureSize; } + unsigned numResources() const { return m_resources.size(); } + + // Checks whether a resource is in use by a consumer. + bool inUseByConsumer(ResourceId); + + + // Producer interface. + + // Creates a resource of the given size/format, into the given pool. + ResourceId createResource(int pool, const IntSize&, GC3Denum format, TextureUsageHint); + + // Wraps an external texture into a resource. + ResourceId createResourceFromExternalTexture(unsigned textureId); + void deleteResource(ResourceId); + + // Deletes all resources owned by a given pool. + void deleteOwnedResources(int pool); + + // Upload data from image, copying sourceRect (in image) into destRect (in the resource). + void upload(ResourceId, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect); + + // Flush all context operations, kicking uploads and ensuring ordering with + // respect to other contexts. + void flush(); + +private: + friend class CCScopedLockResourceForRead; + friend class CCScopedLockResourceForWrite; + + struct Resource { + unsigned glId; + int pool; + int lockForReadCount; + bool lockedForWrite; + bool external; + IntSize size; + GC3Denum format; + }; + typedef HashMap<ResourceId, Resource> ResourceMap; + + explicit CCResourceProvider(CCGraphicsContext*); + bool initialize(); + + // Gets a GL texture id representing the resource, that can be rendered into. + unsigned lockForWrite(ResourceId); + void unlockForWrite(ResourceId); + + // Gets a GL texture id representing the resource, that can be rendered with. + unsigned lockForRead(ResourceId); + void unlockForRead(ResourceId); + + CCGraphicsContext* m_context; + ResourceId m_nextId; + ResourceMap m_resources; + + bool m_useTextureStorageExt; + bool m_useTextureUsageHint; + OwnPtr<LayerTextureSubImage> m_texSubImage; + int m_maxTextureSize; +}; + +class CCScopedLockResourceForRead { + WTF_MAKE_NONCOPYABLE(CCScopedLockResourceForRead); +public: + CCScopedLockResourceForRead(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) + : m_resourceProvider(resourceProvider) + , m_resourceId(resourceId) + , m_textureId(resourceProvider->lockForRead(resourceId)) { } + + ~CCScopedLockResourceForRead() + { + m_resourceProvider->unlockForRead(m_resourceId); + } + + unsigned textureId() const { return m_textureId; } + +private: + CCResourceProvider* m_resourceProvider; + CCResourceProvider::ResourceId m_resourceId; + unsigned m_textureId; +}; + +class CCScopedLockResourceForWrite { + WTF_MAKE_NONCOPYABLE(CCScopedLockResourceForWrite); +public: + CCScopedLockResourceForWrite(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) + : m_resourceProvider(resourceProvider) + , m_resourceId(resourceId) + , m_textureId(resourceProvider->lockForWrite(resourceId)) { } + + ~CCScopedLockResourceForWrite() + { + m_resourceProvider->unlockForWrite(m_resourceId); + } + + unsigned textureId() const { return m_textureId; } + +private: + CCResourceProvider* m_resourceProvider; + CCResourceProvider::ResourceId m_resourceId; + unsigned m_textureId; +}; + +} + +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp index b9f75d184..21ef99a65 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp @@ -26,14 +26,12 @@ #include "config.h" #include "cc/CCScopedTexture.h" -#include "TextureAllocator.h" - namespace WebCore { -CCScopedTexture::CCScopedTexture(TextureAllocator* allocator) - : m_allocator(allocator) +CCScopedTexture::CCScopedTexture(CCResourceProvider* resourceProvider) + : m_resourceProvider(resourceProvider) { - ASSERT(m_allocator); + ASSERT(m_resourceProvider); } CCScopedTexture::~CCScopedTexture() @@ -41,13 +39,13 @@ CCScopedTexture::~CCScopedTexture() free(); } -bool CCScopedTexture::allocate(const IntSize& size, GC3Denum format) +bool CCScopedTexture::allocate(int pool, const IntSize& size, GC3Denum format, CCResourceProvider::TextureUsageHint hint) { ASSERT(!id()); ASSERT(!size.isEmpty()); setDimensions(size, format); - setId(m_allocator->createTexture(size, format)); + setId(m_resourceProvider->createResource(pool, size, format, hint)); #if !ASSERT_DISABLED m_allocateThreadIdentifier = WTF::currentThread(); @@ -60,7 +58,7 @@ void CCScopedTexture::free() { if (id()) { ASSERT(m_allocateThreadIdentifier == WTF::currentThread()); - m_allocator->deleteTexture(id(), size(), format()); + m_resourceProvider->deleteResource(id()); } setId(0); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h index 9f7241f51..734420e90 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h @@ -26,7 +26,6 @@ #ifndef CCScopedTexture_h #define CCScopedTexture_h -#include "TextureAllocator.h" #include "cc/CCTexture.h" #if !ASSERT_DISABLED @@ -35,11 +34,10 @@ namespace WebCore { - class CCScopedTexture : protected CCTexture { WTF_MAKE_NONCOPYABLE(CCScopedTexture); public: - static PassOwnPtr<CCScopedTexture> create(TextureAllocator* allocator) { return adoptPtr(new CCScopedTexture(allocator)); } + static PassOwnPtr<CCScopedTexture> create(CCResourceProvider* resourceProvider) { return adoptPtr(new CCScopedTexture(resourceProvider)); } virtual ~CCScopedTexture(); using CCTexture::id; @@ -47,15 +45,15 @@ public: using CCTexture::format; using CCTexture::bytes; - bool allocate(const IntSize&, GC3Denum format); + bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider::TextureUsageHint); void free(); void leak(); protected: - explicit CCScopedTexture(TextureAllocator*); + explicit CCScopedTexture(CCResourceProvider*); private: - TextureAllocator* m_allocator; + CCResourceProvider* m_resourceProvider; #if !ASSERT_DISABLED ThreadIdentifier m_allocateThreadIdentifier; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp index f38fbda01..1fcd1da8b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp @@ -31,7 +31,7 @@ #include "ScrollbarTheme.h" #include "ScrollbarThemeComposite.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCTextureDrawQuad.h" namespace WebCore { @@ -45,9 +45,9 @@ CCScrollbarLayerImpl::CCScrollbarLayerImpl(int id) : CCLayerImpl(id) , m_scrollLayer(0) , m_scrollbar(this) - , m_backTrackTextureId(0) - , m_foreTrackTextureId(0) - , m_thumbTextureId(0) + , m_backTrackResourceId(0) + , m_foreTrackResourceId(0) + , m_thumbResourceId(0) { } @@ -62,7 +62,7 @@ FloatRect toUVRect(const IntRect& r, const IntRect& bounds) } -void CCScrollbarLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { ScrollbarThemeComposite* theme = static_cast<ScrollbarThemeComposite*>(ScrollbarTheme::theme()); if (!theme) @@ -76,23 +76,23 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQua IntRect thumbRect, backTrackRect, foreTrackRect; theme->splitTrack(&m_scrollbar, theme->trackRect(&m_scrollbar), backTrackRect, thumbRect, foreTrackRect); - if (m_thumbTextureId && theme->hasThumb(&m_scrollbar) && !thumbRect.isEmpty()) { - OwnPtr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadState, thumbRect, m_thumbTextureId, premultipledAlpha, uvRect, flipped); + if (m_thumbResourceId && theme->hasThumb(&m_scrollbar) && !thumbRect.isEmpty()) { + OwnPtr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadState, thumbRect, m_thumbResourceId, premultipledAlpha, uvRect, flipped); quad->setNeedsBlending(); quadList.append(quad.release()); } - if (!m_backTrackTextureId) + if (!m_backTrackResourceId) return; // We only paint the track in two parts if we were given a texture for the forward track part. - if (m_foreTrackTextureId && !foreTrackRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, foreTrackRect, m_foreTrackTextureId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); + if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) + quadList.append(CCTextureDrawQuad::create(sharedQuadState, foreTrackRect, m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); // Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and // fore track quads. The back track texture contains (and displays) the buttons. if (!boundsRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, boundsRect, m_backTrackTextureId, premultipledAlpha, uvRect, flipped)); + quadList.append(CCTextureDrawQuad::create(sharedQuadState, boundsRect, m_backTrackResourceId, premultipledAlpha, uvRect, flipped)); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h index ece2b9571..faa3361ba 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h @@ -53,14 +53,14 @@ public: void setEnabled(bool enabled) { m_enabled = enabled; } - void setBackTrackTextureId(unsigned id) { m_backTrackTextureId = id; } - void setForeTrackTextureId(unsigned id) { m_foreTrackTextureId = id; } - void setThumbTextureId(unsigned id) { m_thumbTextureId = id; } + void setBackTrackResourceId(CCResourceProvider::ResourceId id) { m_backTrackResourceId = id; } + void setForeTrackResourceId(CCResourceProvider::ResourceId id) { m_foreTrackResourceId = id; } + void setThumbResourceId(CCResourceProvider::ResourceId id) { m_thumbResourceId = id; } CCLayerImpl* scrollLayer() const { return m_scrollLayer; } void setScrollLayer(CCLayerImpl* scrollLayer) { m_scrollLayer = scrollLayer; } - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; protected: explicit CCScrollbarLayerImpl(int id); @@ -124,9 +124,9 @@ private: }; CCScrollbar m_scrollbar; - unsigned m_backTrackTextureId; - unsigned m_foreTrackTextureId; - unsigned m_thumbTextureId; + CCResourceProvider::ResourceId m_backTrackResourceId; + CCResourceProvider::ResourceId m_foreTrackResourceId; + CCResourceProvider::ResourceId m_thumbResourceId; ScrollbarOverlayStyle m_scrollbarOverlayStyle; Vector<IntRect> m_tickmarks; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp index 678efdff0..002c7a7bf 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp @@ -158,7 +158,7 @@ bool CCSingleThreadProxy::recreateContext() bool initialized; { DebugScopedSetImplThread impl; - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); initialized = m_layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); if (initialized) { m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); @@ -213,7 +213,7 @@ void CCSingleThreadProxy::doCommit(CCTextureUpdater& updater) // here as the throttled uploader isn't used in single thread mode. // For correctness, loop until no more updates are pending. while (updater.hasMoreUpdates()) - updater.update(m_layerTreeHostImpl->context(), m_layerTreeHostImpl->contentsTextureAllocator(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), maxPartialTextureUpdates()); + updater.update(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), maxPartialTextureUpdates()); m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); @@ -262,7 +262,7 @@ void CCSingleThreadProxy::stop() DebugScopedSetImplThread impl; if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit()) - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); m_layerTreeHostImpl.clear(); } m_layerTreeHost = 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp index 4d52c15dd..f52c797c0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp @@ -29,7 +29,7 @@ #include "cc/CCSolidColorLayerImpl.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCSolidColorDrawQuad.h" #include <wtf/MathExtras.h> #include <wtf/text/WTFString.h> @@ -49,7 +49,7 @@ CCSolidColorLayerImpl::~CCSolidColorLayerImpl() { } -void CCSolidColorLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { // We create a series of smaller quads instead of just one large one so that the // culler can reduce the total pixels drawn. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h index e3005845e..7153f21ab 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h @@ -41,7 +41,7 @@ public: } virtual ~CCSolidColorLayerImpl(); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; protected: explicit CCSolidColorLayerImpl(int id); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h index 0d5d9f768..d3e4b8f7e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h @@ -28,6 +28,7 @@ #include "GraphicsContext3D.h" #include "IntSize.h" +#include "cc/CCResourceProvider.h" #include "cc/CCTexture.h" namespace WebCore { @@ -40,11 +41,11 @@ public: , m_size(size) , m_format(format) { } - unsigned id() const { return m_id; } + CCResourceProvider::ResourceId id() const { return m_id; } const IntSize& size() const { return m_size; } GC3Denum format() const { return m_format; } - void setId(unsigned id) { m_id = id; } + void setId(CCResourceProvider::ResourceId id) { m_id = id; } void setDimensions(const IntSize&, GC3Denum format); size_t bytes() const; @@ -52,7 +53,7 @@ public: static size_t memorySizeBytes(const IntSize&, GC3Denum format); private: - unsigned m_id; + CCResourceProvider::ResourceId m_id; IntSize m_size; GC3Denum m_format; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp index 6df2fb6bd..7cbbece16 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp @@ -30,7 +30,8 @@ #include "cc/CCTextureLayerImpl.h" #include "TextStream.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" +#include "cc/CCRenderer.h" #include "cc/CCTextureDrawQuad.h" namespace WebCore { @@ -38,6 +39,7 @@ namespace WebCore { CCTextureLayerImpl::CCTextureLayerImpl(int id) : CCLayerImpl(id) , m_textureId(0) + , m_externalTextureResource(0) , m_premultipliedAlpha(true) , m_flipped(true) , m_uvRect(0, 0, 1, 1) @@ -48,10 +50,28 @@ CCTextureLayerImpl::~CCTextureLayerImpl() { } -void CCTextureLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) { + ASSERT(!m_externalTextureResource); + m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId); +} + +void CCTextureLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +{ + ASSERT(m_externalTextureResource); IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_textureId, m_premultipliedAlpha, m_uvRect, m_flipped)); + quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped)); +} + +void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) +{ + ASSERT(m_externalTextureResource); + // FIXME: the following assert will not be true when sending resources to a + // parent compositor. A synchronization scheme (double-buffering or + // pipelining of updates) for the client will need to exist to solve this. + ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource)); + resourceProvider->deleteResource(m_externalTextureResource); + m_externalTextureResource = 0; } void CCTextureLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h index 4abdb51ff..e5453148d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h @@ -38,7 +38,9 @@ public: } virtual ~CCTextureLayerImpl(); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void willDraw(CCResourceProvider*) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; @@ -56,6 +58,7 @@ private: virtual const char* layerTypeAsString() const OVERRIDE { return "TextureLayer"; } unsigned m_textureId; + CCResourceProvider::ResourceId m_externalTextureResource; bool m_premultipliedAlpha; bool m_flipped; FloatRect m_uvRect; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp index bc1ed75af..967ad5e3f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp @@ -85,7 +85,7 @@ bool CCTextureUpdater::hasMoreUpdates() const return m_fullEntries.size() || m_partialEntries.size() || m_copyEntries.size(); } -void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allocator, TextureCopier* copier, TextureUploader* uploader, size_t count) +void CCTextureUpdater::update(CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader, size_t count) { size_t index; @@ -99,15 +99,15 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo size_t maxIndex = min(m_entryIndex + count, m_fullEntries.size()); for (index = m_entryIndex; index < maxIndex; ++index) { UpdateEntry& entry = m_fullEntries[index]; - uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect); + uploader->uploadTexture(entry.texture, resourceProvider, entry.sourceRect, entry.destRect); fullUploadCount++; if (!(fullUploadCount % kUploadFlushPeriod)) - context->flush(); + resourceProvider->flush(); } // Make sure there are no dangling uploads without a flush. if (fullUploadCount % kUploadFlushPeriod) - context->flush(); + resourceProvider->flush(); bool moreUploads = maxIndex < m_fullEntries.size(); @@ -125,34 +125,30 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo for (index = 0; index < m_partialEntries.size(); ++index) { UpdateEntry& entry = m_partialEntries[index]; - uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect); + uploader->uploadTexture(entry.texture, resourceProvider, entry.sourceRect, entry.destRect); if (!((index+1) % kUploadFlushPeriod)) - context->flush(); + resourceProvider->flush(); } // Make sure there are no dangling partial uploads without a flush. // Note: We don't need to use (index+1) in this case because index was // incremented at the end of the for loop. if (index % kUploadFlushPeriod) - context->flush(); + resourceProvider->flush(); uploader->endUploads(); } for (index = 0; index < m_copyEntries.size(); ++index) { CopyEntry& copyEntry = m_copyEntries[index]; - copier->copyTexture(context, copyEntry.sourceTexture, copyEntry.destTexture, copyEntry.size); + copier->copyTexture(copyEntry.sourceTexture, copyEntry.destTexture, copyEntry.size); } // If we've performed any texture copies, we need to insert a flush here into the compositor context // before letting the main thread proceed as it may make draw calls to the source texture of one of // our copy operations. - if (m_copyEntries.size()) { - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (context3d) - context3d->flush(); - // FIXME: Implement this path for software compositing. - } + if (m_copyEntries.size()) + copier->flush(); // If no entries left to process, auto-clear. clear(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h index 8a437942b..972a1c0ec 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h @@ -32,7 +32,7 @@ namespace WebCore { -class TextureAllocator; +class CCResourceProvider; class TextureCopier; class TextureUploader; @@ -48,7 +48,7 @@ public: bool hasMoreUpdates() const; // Update some textures. - void update(CCGraphicsContext*, TextureAllocator*, TextureCopier*, TextureUploader*, size_t count); + void update(CCResourceProvider*, TextureCopier*, TextureUploader*, size_t count); void clear(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp index 9973a974b..9b6dfe3ac 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp @@ -75,7 +75,6 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) : m_animateRequested(false) , m_commitRequested(false) , m_forcedCommitRequested(false) - , m_contextLost(false) , m_layerTreeHost(layerTreeHost) , m_compositorIdentifier(-1) , m_layerRendererInitialized(false) @@ -600,7 +599,7 @@ void CCThreadProxy::scheduledActionUpdateMoreResources() { TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); ASSERT(m_currentTextureUpdaterOnImplThread); - m_currentTextureUpdaterOnImplThread->update(m_layerTreeHostImpl->context(), m_layerTreeHostImpl->contentsTextureAllocator(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), textureUpdatesPerFrame); + m_currentTextureUpdaterOnImplThread->update(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), textureUpdatesPerFrame); } void CCThreadProxy::scheduledActionCommit() @@ -849,7 +848,7 @@ void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); ASSERT(isImplThread()); if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit()) - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); m_inputHandlerOnImplThread.clear(); m_layerTreeHostImpl.clear(); m_schedulerOnImplThread.clear(); @@ -884,7 +883,7 @@ void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, C { TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); ASSERT(isImplThread()); - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptPtr(contextPtr), textureUploader); if (*recreateSucceeded) { *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h index e10c3dcb0..0f8a35404 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h @@ -152,7 +152,6 @@ private: bool m_animateRequested; bool m_commitRequested; bool m_forcedCommitRequested; - bool m_contextLost; OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer; CCLayerTreeHost* m_layerTreeHost; int m_compositorIdentifier; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index da9a10a99..ee4965187 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -35,7 +35,7 @@ #include "cc/CCCheckerboardDrawQuad.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerTilingData.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCSolidColorDrawQuad.h" #include "cc/CCTileDrawQuad.h" #include <wtf/text/WTFString.h> @@ -59,13 +59,13 @@ class DrawableTile : public CCLayerTilingData::Tile { public: static PassOwnPtr<DrawableTile> create() { return adoptPtr(new DrawableTile()); } - Platform3DObject textureId() const { return m_textureId; } - void setTextureId(Platform3DObject textureId) { m_textureId = textureId; } + CCResourceProvider::ResourceId resourceId() const { return m_resourceId; } + void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId = resourceId; } private: - DrawableTile() : m_textureId(0) { } + DrawableTile() : m_resourceId(0) { } - Platform3DObject m_textureId; + CCResourceProvider::ResourceId m_resourceId; }; CCTiledLayerImpl::CCTiledLayerImpl(int id) @@ -79,7 +79,7 @@ CCTiledLayerImpl::~CCTiledLayerImpl() { } -unsigned CCTiledLayerImpl::contentsTextureId() const +CCResourceProvider::ResourceId CCTiledLayerImpl::contentsResourceId() const { // This function is only valid for single texture layers, e.g. masks. ASSERT(m_tiler); @@ -87,10 +87,10 @@ unsigned CCTiledLayerImpl::contentsTextureId() const ASSERT(m_tiler->numTilesY() == 1); DrawableTile* tile = tileAt(0, 0); - Platform3DObject textureId = tile ? tile->textureId() : 0; - ASSERT(textureId); + CCResourceProvider::ResourceId resourceId = tile ? tile->resourceId() : 0; + ASSERT(resourceId); - return textureId; + return resourceId; } void CCTiledLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const @@ -107,7 +107,7 @@ bool CCTiledLayerImpl::hasTileAt(int i, int j) const bool CCTiledLayerImpl::hasTextureIdForTileAt(int i, int j) const { - return hasTileAt(i, j) && tileAt(i, j)->textureId(); + return hasTileAt(i, j) && tileAt(i, j)->resourceId(); } DrawableTile* CCTiledLayerImpl::tileAt(int i, int j) const @@ -123,7 +123,7 @@ DrawableTile* CCTiledLayerImpl::createTile(int i, int j) return addedTile; } -void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) +void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) { const IntRect& contentRect = visibleContentRect(); @@ -140,7 +140,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta IntRect tileRect = m_tiler->tileBounds(i, j); SkColor borderColor; - if (m_skipsDraw || !tile || !tile->textureId()) + if (m_skipsDraw || !tile || !tile->resourceId()) borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderMissingTileColorRed, debugTileBorderMissingTileColorGreen, debugTileBorderMissingTileColorBlue); else borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); @@ -163,7 +163,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta if (tileRect.isEmpty()) continue; - if (!tile || !tile->textureId()) { + if (!tile || !tile->resourceId()) { if (drawCheckerboardForMissingTiles()) hadMissingTiles |= quadList.append(CCCheckerboardDrawQuad::create(sharedQuadState, tileRect)); else @@ -190,7 +190,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; - quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->textureId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } } } @@ -204,12 +204,12 @@ void CCTiledLayerImpl::setTilingData(const CCLayerTilingData& tiler) *m_tiler = tiler; } -void CCTiledLayerImpl::pushTileProperties(int i, int j, unsigned textureId, const IntRect& opaqueRect) +void CCTiledLayerImpl::pushTileProperties(int i, int j, CCResourceProvider::ResourceId resourceId, const IntRect& opaqueRect) { DrawableTile* tile = tileAt(i, j); if (!tile) tile = createTile(i, j); - tile->setTextureId(textureId); + tile->setResourceId(resourceId); tile->setOpaqueRect(opaqueRect); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h index 4052fe97c..015fdc306 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h @@ -42,15 +42,15 @@ public: } virtual ~CCTiledLayerImpl(); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; - virtual unsigned contentsTextureId() const OVERRIDE; + virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; } void setTilingData(const CCLayerTilingData& tiler); - void pushTileProperties(int, int, unsigned textureId, const IntRect& opaqueRect); + void pushTileProperties(int, int, CCResourceProvider::ResourceId, const IntRect& opaqueRect); void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; } bool contentsSwizzled() const { return m_contentsSwizzled; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index b524596f0..fa201d112 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -31,15 +31,13 @@ #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" // For GLC macro -#include "LayerTextureSubImage.h" #include "NotImplemented.h" #include "TextStream.h" -#include "TextureAllocator.h" -#include "cc/CCGraphicsContext.h" +#include "cc/CCIOSurfaceDrawQuad.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCProxy.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" +#include "cc/CCResourceProvider.h" #include "cc/CCStreamVideoDrawQuad.h" #include "cc/CCTextureDrawQuad.h" #include "cc/CCYUVVideoDrawQuad.h" @@ -52,6 +50,7 @@ CCVideoLayerImpl::CCVideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provid : CCLayerImpl(id) , m_provider(provider) , m_frame(0) + , m_externalTextureResource(0) { // This matrix is the default transformation for stream textures, and flips on the Y axis. m_streamTextureMatrix = WebKit::WebTransformationMatrix( @@ -76,11 +75,12 @@ CCVideoLayerImpl::~CCVideoLayerImpl() m_provider->setVideoFrameProviderClient(0); m_provider = 0; } - freePlaneData(layerTreeHostImpl()->context()); + freePlaneData(layerTreeHostImpl()->resourceProvider()); #if !ASSERT_DISABLED for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i) - ASSERT(!m_framePlanes[i].textureId); + ASSERT(!m_framePlanes[i].resourceId); + ASSERT(!m_externalTextureResource); #endif } @@ -111,10 +111,10 @@ static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) return GraphicsContext3D::INVALID_VALUE; } -void CCVideoLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context) +void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); - CCLayerImpl::willDraw(layerRenderer, context); + CCLayerImpl::willDraw(resourceProvider); // Explicitly lock and unlock the provider mutex so it can be held from // willDraw to didDraw. Since the compositor thread is in the middle of @@ -125,16 +125,17 @@ void CCVideoLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* co // lock should not cause a deadlock. m_providerMutex.lock(); - willDrawInternal(layerRenderer, context); - freeUnusedPlaneData(context); + willDrawInternal(resourceProvider); + freeUnusedPlaneData(resourceProvider); if (!m_frame) m_providerMutex.unlock(); } -void CCVideoLayerImpl::willDrawInternal(CCRenderer* layerRenderer, CCGraphicsContext* context) +void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); + ASSERT(!m_externalTextureResource); if (!m_provider) { m_frame = 0; @@ -160,20 +161,23 @@ void CCVideoLayerImpl::willDrawInternal(CCRenderer* layerRenderer, CCGraphicsCon return; } - if (!allocatePlaneData(layerRenderer, context)) { + if (!allocatePlaneData(resourceProvider)) { m_provider->putCurrentFrame(m_frame); m_frame = 0; return; } - if (!copyPlaneData(layerRenderer, context)) { + if (!copyPlaneData(resourceProvider)) { m_provider->putCurrentFrame(m_frame); m_frame = 0; return; } + + if (m_format == GraphicsContext3D::TEXTURE_2D) + m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_frame->textureId()); } -void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { ASSERT(CCProxy::isImplThread()); @@ -203,7 +207,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta bool premultipliedAlpha = true; FloatRect uvRect(0, 0, widthScaleFactor, 1); bool flipped = false; - OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, plane.textureId, premultipliedAlpha, uvRect, flipped); + OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); quadList.append(textureQuad.release()); break; } @@ -214,14 +218,20 @@ void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta #if defined(OS_CHROMEOS) && defined(__ARMEL__) bool flipped = true; // Under the covers, implemented by OpenMAX IL. #elif OS(WINDOWS) - bool flipped = true; // Under the covers, implemented by DXVA. + bool flipped = false; // Under the covers, implemented by DXVA. #else bool flipped = false; // LibVA (cros/intel), MacOS. #endif - OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), premultipliedAlpha, uvRect, flipped); + OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped); quadList.append(textureQuad.release()); break; } + case Extensions3D::TEXTURE_RECTANGLE_ARB: { + IntSize textureSize(m_frame->width(), m_frame->height()); + OwnPtr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDrawQuad::Unflipped); + quadList.append(ioSurfaceQuad.release()); + break; + } case Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES: { // StreamTexture hardware decoder. OwnPtr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); @@ -233,14 +243,24 @@ void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta } } -void CCVideoLayerImpl::didDraw() +void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); - CCLayerImpl::didDraw(); + CCLayerImpl::didDraw(resourceProvider); if (!m_frame) return; + if (m_format == GraphicsContext3D::TEXTURE_2D) { + ASSERT(m_externalTextureResource); + // FIXME: the following assert will not be true when sending resources to a + // parent compositor. We will probably need to hold on to m_frame for + // longer, and have several "current frames" in the pipeline. + ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource)); + resourceProvider->deleteResource(m_externalTextureResource); + m_externalTextureResource = 0; + } + m_provider->putCurrentFrame(m_frame); m_frame = 0; @@ -283,45 +303,27 @@ IntSize CCVideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame, return IntSize(visibleWidth, visibleHeight); } -bool CCVideoLayerImpl::FramePlane::allocateData(CCGraphicsContext* context) +bool CCVideoLayerImpl::FramePlane::allocateData(CCResourceProvider* resourceProvider) { - if (textureId) + if (resourceId) return true; - WebKit::WebGraphicsContext3D* context3D = context->context3D(); - if (!context3D) - return false; - - GLC(context3D, textureId = context3D->createTexture()); - GLC(context3D, context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - // Do basic linear filtering on resize. - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE. - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - - GLC(context3D, context3D->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0)); - - return textureId; + resourceId = resourceProvider->createResource(CCRenderer::ImplPool, size, format, CCResourceProvider::TextureUsageAny); + return resourceId; } -void CCVideoLayerImpl::FramePlane::freeData(CCGraphicsContext* context) +void CCVideoLayerImpl::FramePlane::freeData(CCResourceProvider* resourceProvider) { - if (!textureId) - return; - - WebKit::WebGraphicsContext3D* context3D = context->context3D(); - if (!context3D) + if (!resourceId) return; - GLC(context3D, context3D->deleteTexture(textureId)); - textureId = 0; + resourceProvider->deleteResource(resourceId); + resourceId = 0; } -bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsContext* context) +bool CCVideoLayerImpl::allocatePlaneData(CCResourceProvider* resourceProvider) { - int maxTextureSize = layerRenderer->capabilities().maxTextureSize; + int maxTextureSize = resourceProvider->maxTextureSize(); for (unsigned planeIndex = 0; planeIndex < m_frame->planes(); ++planeIndex) { CCVideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; @@ -331,13 +333,13 @@ bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsCo return false; if (plane.size != requiredTextureSize || plane.format != m_format) { - plane.freeData(context); + plane.freeData(resourceProvider); plane.size = requiredTextureSize; plane.format = m_format; } - if (!plane.textureId) { - if (!plane.allocateData(context)) + if (!plane.resourceId) { + if (!plane.allocateData(resourceProvider)) return false; plane.visibleSize = computeVisibleSize(*m_frame, planeIndex); } @@ -345,42 +347,32 @@ bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsCo return true; } -bool CCVideoLayerImpl::copyPlaneData(CCRenderer* layerRenderer, CCGraphicsContext* context) +bool CCVideoLayerImpl::copyPlaneData(CCResourceProvider* resourceProvider) { size_t softwarePlaneCount = m_frame->planes(); if (!softwarePlaneCount) return true; - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return false; - } - - LayerTextureSubImage uploader(true); for (size_t softwarePlaneIndex = 0; softwarePlaneIndex < softwarePlaneCount; ++softwarePlaneIndex) { CCVideoLayerImpl::FramePlane& plane = m_framePlanes[softwarePlaneIndex]; const uint8_t* softwarePlanePixels = static_cast<const uint8_t*>(m_frame->data(softwarePlaneIndex)); IntRect planeRect(IntPoint(), plane.size); - - context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, plane.textureId); - uploader.setSubImageSize(plane.size); - uploader.upload(softwarePlanePixels, planeRect, planeRect, planeRect, plane.format, context); + resourceProvider->upload(plane.resourceId, softwarePlanePixels, planeRect, planeRect, planeRect); } return true; } -void CCVideoLayerImpl::freePlaneData(CCGraphicsContext* context) +void CCVideoLayerImpl::freePlaneData(CCResourceProvider* resourceProvider) { for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i) - m_framePlanes[i].freeData(context); + m_framePlanes[i].freeData(resourceProvider); } -void CCVideoLayerImpl::freeUnusedPlaneData(CCGraphicsContext* context) +void CCVideoLayerImpl::freeUnusedPlaneData(CCResourceProvider* resourceProvider) { unsigned firstUnusedPlane = m_frame ? m_frame->planes() : 0; for (unsigned i = firstUnusedPlane; i < WebKit::WebVideoFrame::maxPlanes; ++i) - m_framePlanes[i].freeData(context); + m_framePlanes[i].freeData(resourceProvider); } void CCVideoLayerImpl::didReceiveFrame() @@ -400,7 +392,7 @@ void CCVideoLayerImpl::didUpdateMatrix(const float matrix[16]) void CCVideoLayerImpl::didLoseContext() { - freePlaneData(layerTreeHostImpl()->context()); + freePlaneData(layerTreeHostImpl()->resourceProvider()); } void CCVideoLayerImpl::setNeedsRedraw() diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index cd5db09bc..414ca68e3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -50,9 +50,9 @@ public: } virtual ~CCVideoLayerImpl(); - virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE; - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; - virtual void didDraw() OVERRIDE; + virtual void willDraw(CCResourceProvider*) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; @@ -68,15 +68,15 @@ public: void setNeedsRedraw(); struct FramePlane { - unsigned textureId; + CCResourceProvider::ResourceId resourceId; IntSize size; GC3Denum format; IntSize visibleSize; - FramePlane() : textureId(0) { } + FramePlane() : resourceId(0) { } - bool allocateData(CCGraphicsContext*); - void freeData(CCGraphicsContext*); + bool allocateData(CCResourceProvider*); + void freeData(CCResourceProvider*); }; private: @@ -85,11 +85,11 @@ private: static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane); virtual const char* layerTypeAsString() const OVERRIDE { return "VideoLayer"; } - void willDrawInternal(CCRenderer*, CCGraphicsContext*); - bool allocatePlaneData(CCRenderer*, CCGraphicsContext*); - bool copyPlaneData(CCRenderer*, CCGraphicsContext*); - void freePlaneData(CCGraphicsContext*); - void freeUnusedPlaneData(CCGraphicsContext*); + void willDrawInternal(CCResourceProvider*); + bool allocatePlaneData(CCResourceProvider*); + bool copyPlaneData(CCResourceProvider*); + void freePlaneData(CCResourceProvider*); + void freeUnusedPlaneData(CCResourceProvider*); // Guards the destruction of m_provider and the frame that it provides Mutex m_providerMutex; @@ -99,6 +99,7 @@ private: WebKit::WebVideoFrame* m_frame; GC3Denum m_format; + CCResourceProvider::ResourceId m_externalTextureResource; // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes]; diff --git a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp index 2f5c96ae9..efe1a12e2 100644 --- a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp +++ b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp @@ -51,7 +51,7 @@ GraphicsContext3D::~GraphicsContext3D() { } -PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const +PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() { return m_private->platformGraphicsContext3D(); } diff --git a/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp index bd4212d0b..25b087e54 100644 --- a/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -73,12 +73,12 @@ bool FEColorMatrix::setValues(const Vector<float> &values) return true; } -inline void matrix(double& red, double& green, double& blue, double& alpha, const Vector<float>& values) +inline void matrix(float& red, float& green, float& blue, float& alpha, const Vector<float>& values) { - double r = values[0] * red + values[1] * green + values[2] * blue + values[3] * alpha + values[4] * 255; - double g = values[5] * red + values[6] * green + values[7] * blue + values[8] * alpha + values[9] * 255; - double b = values[10] * red + values[11] * green + values[12] * blue + values[13] * alpha + values[14] * 255; - double a = values[15] * red + values[16] * green + values[17] * blue + values[18] * alpha + values[19] * 255; + float r = values[0] * red + values[1] * green + values[2] * blue + values[3] * alpha + values[4] * 255; + float g = values[5] * red + values[6] * green + values[7] * blue + values[8] * alpha + values[9] * 255; + float b = values[10] * red + values[11] * green + values[12] * blue + values[13] * alpha + values[14] * 255; + float a = values[15] * red + values[16] * green + values[17] * blue + values[18] * alpha + values[19] * 255; red = r; green = g; @@ -86,28 +86,28 @@ inline void matrix(double& red, double& green, double& blue, double& alpha, cons alpha = a; } -inline void saturate(double& red, double& green, double& blue, const float& s) +inline void saturate(float& red, float& green, float& blue, const float& s) { - double r = (0.213 + 0.787 * s) * red + (0.715 - 0.715 * s) * green + (0.072 - 0.072 * s) * blue; - double g = (0.213 - 0.213 * s) * red + (0.715 + 0.285 * s) * green + (0.072 - 0.072 * s) * blue; - double b = (0.213 - 0.213 * s) * red + (0.715 - 0.715 * s) * green + (0.072 + 0.928 * s) * blue; + float r = (0.213 + 0.787 * s) * red + (0.715 - 0.715 * s) * green + (0.072 - 0.072 * s) * blue; + float g = (0.213 - 0.213 * s) * red + (0.715 + 0.285 * s) * green + (0.072 - 0.072 * s) * blue; + float b = (0.213 - 0.213 * s) * red + (0.715 - 0.715 * s) * green + (0.072 + 0.928 * s) * blue; red = r; green = g; blue = b; } -inline void huerotate(double& red, double& green, double& blue, const float& hue) +inline void huerotate(float& red, float& green, float& blue, const float& hue) { - double cosHue = cos(hue * piDouble / 180); - double sinHue = sin(hue * piDouble / 180); - double r = red * (0.213 + cosHue * 0.787 - sinHue * 0.213) + + float cosHue = cos(hue * piDouble / 180); + float sinHue = sin(hue * piDouble / 180); + float r = red * (0.213 + cosHue * 0.787 - sinHue * 0.213) + green * (0.715 - cosHue * 0.715 - sinHue * 0.715) + blue * (0.072 - cosHue * 0.072 + sinHue * 0.928); - double g = red * (0.213 - cosHue * 0.213 + sinHue * 0.143) + + float g = red * (0.213 - cosHue * 0.213 + sinHue * 0.143) + green * (0.715 + cosHue * 0.285 + sinHue * 0.140) + blue * (0.072 - cosHue * 0.072 - sinHue * 0.283); - double b = red * (0.213 - cosHue * 0.213 - sinHue * 0.787) + + float b = red * (0.213 - cosHue * 0.213 - sinHue * 0.787) + green * (0.715 - cosHue * 0.715 + sinHue * 0.715) + blue * (0.072 + cosHue * 0.928 + sinHue * 0.072); @@ -116,7 +116,7 @@ inline void huerotate(double& red, double& green, double& blue, const float& hue blue = b; } -inline void luminance(double& red, double& green, double& blue, double& alpha) +inline void luminance(float& red, float& green, float& blue, float& alpha) { alpha = 0.2125 * red + 0.7154 * green + 0.0721 * blue; red = 0; @@ -129,10 +129,10 @@ void effectType(Uint8ClampedArray* pixelArray, const Vector<float>& values) { unsigned pixelArrayLength = pixelArray->length(); for (unsigned pixelByteOffset = 0; pixelByteOffset < pixelArrayLength; pixelByteOffset += 4) { - double red = pixelArray->item(pixelByteOffset); - double green = pixelArray->item(pixelByteOffset + 1); - double blue = pixelArray->item(pixelByteOffset + 2); - double alpha = pixelArray->item(pixelByteOffset + 3); + float red = pixelArray->item(pixelByteOffset); + float green = pixelArray->item(pixelByteOffset + 1); + float blue = pixelArray->item(pixelByteOffset + 2); + float alpha = pixelArray->item(pixelByteOffset + 3); switch (filterType) { case FECOLORMATRIX_TYPE_MATRIX: diff --git a/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp b/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp index 34997f613..c1efa2ade 100644 --- a/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp +++ b/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp @@ -61,10 +61,6 @@ void FEDropShadow::determineAbsolutePaintRect() FloatRect absoluteOffsetPaintRect(absolutePaintRect); absoluteOffsetPaintRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy)); absolutePaintRect.unite(absoluteOffsetPaintRect); - if (clipsToBounds()) - absolutePaintRect.intersect(maxEffectRect()); - else - absolutePaintRect.unite(maxEffectRect()); unsigned kernelSizeX = 0; unsigned kernelSizeY = 0; @@ -73,6 +69,12 @@ void FEDropShadow::determineAbsolutePaintRect() // We take the half kernel size and multiply it with three, because we run box blur three times. absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f); absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f); + + if (clipsToBounds()) + absolutePaintRect.intersect(maxEffectRect()); + else + absolutePaintRect.unite(maxEffectRect()); + setAbsolutePaintRect(enclosingIntRect(absolutePaintRect)); } diff --git a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp index 1950ee9e3..43731f70d 100644 --- a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp +++ b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp @@ -260,19 +260,21 @@ void FEGaussianBlur::calculateKernelSize(Filter* filter, unsigned& kernelSizeX, void FEGaussianBlur::determineAbsolutePaintRect() { - FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect(); - if (clipsToBounds()) - absolutePaintRect.intersect(maxEffectRect()); - else - absolutePaintRect.unite(maxEffectRect()); - unsigned kernelSizeX = 0; unsigned kernelSizeY = 0; calculateKernelSize(filter(), kernelSizeX, kernelSizeY, m_stdX, m_stdY); + FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect(); + // We take the half kernel size and multiply it with three, because we run box blur three times. absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f); absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f); + + if (clipsToBounds()) + absolutePaintRect.intersect(maxEffectRect()); + else + absolutePaintRect.unite(maxEffectRect()); + setAbsolutePaintRect(enclosingIntRect(absolutePaintRect)); } diff --git a/Source/WebCore/platform/graphics/filters/FELighting.h b/Source/WebCore/platform/graphics/filters/FELighting.h index d0d2b3685..4487835e8 100644 --- a/Source/WebCore/platform/graphics/filters/FELighting.h +++ b/Source/WebCore/platform/graphics/filters/FELighting.h @@ -46,6 +46,9 @@ struct FELightingPaintingDataForNeon; class FELighting : public FilterEffect { public: virtual void platformApplySoftware(); +#if USE(SKIA) + virtual bool platformApplySkia(); +#endif virtual void determineAbsolutePaintRect() { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } diff --git a/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp b/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp new file mode 100644 index 000000000..1a6a2d70e --- /dev/null +++ b/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#if USE(SKIA) +#include "FELighting.h" + +#include "DistantLightSource.h" +#include "NativeImageSkia.h" +#include "PointLightSource.h" +#include "SkLightingImageFilter.h" +#include "SpotLightSource.h" + +namespace WebCore { + +bool FELighting::platformApplySkia() +{ + // For now, only use the skia implementation for accelerated rendering. + if (filter()->renderingMode() != Accelerated) + return false; + + ImageBuffer* resultImage = createImageBufferResult(); + if (!resultImage) + return false; + + FilterEffect* in = inputEffect(0); + + IntRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect()); + + setIsAlphaImage(in->isAlphaImage()); + + RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore); + NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame(); + + GraphicsContext* dstContext = resultImage->context(); + + SkPaint paint; + switch (m_lightSource->type()) { + case LS_DISTANT: { + DistantLightSource* distantLightSource = static_cast<DistantLightSource*>(m_lightSource.get()); + float azimuthRad = deg2rad(distantLightSource->azimuth()); + float elevationRad = deg2rad(distantLightSource->elevation()); + SkPoint3 direction(cosf(azimuthRad) * cosf(elevationRad), + sinf(azimuthRad) * cosf(elevationRad), + sinf(elevationRad)); + if (m_specularConstant > 0) + paint.setImageFilter(SkLightingImageFilter::CreateDistantLitSpecular(direction, m_lightingColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent))->unref(); + else + paint.setImageFilter(SkLightingImageFilter::CreateDistantLitDiffuse(direction, m_lightingColor.rgb(), m_surfaceScale, m_diffuseConstant))->unref(); + break; + } + case LS_POINT: { + PointLightSource* pointLightSource = static_cast<PointLightSource*>(m_lightSource.get()); + FloatPoint3D position = pointLightSource->position(); + SkPoint3 skPosition(position.x(), position.y(), position.z()); + if (m_specularConstant > 0) + paint.setImageFilter(SkLightingImageFilter::CreatePointLitSpecular(skPosition, m_lightingColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent))->unref(); + else + paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(skPosition, m_lightingColor.rgb(), m_surfaceScale, m_diffuseConstant))->unref(); + break; + } + case LS_SPOT: { + SpotLightSource* spotLightSource = static_cast<SpotLightSource*>(m_lightSource.get()); + SkPoint3 location(spotLightSource->position().x(), spotLightSource->position().y(), spotLightSource->position().z()); + SkPoint3 target(spotLightSource->direction().x(), spotLightSource->direction().y(), spotLightSource->direction().z()); + float specularExponent = spotLightSource->specularExponent(); + float limitingConeAngle = spotLightSource->limitingConeAngle(); + if (!limitingConeAngle || limitingConeAngle > 90 || limitingConeAngle < -90) + limitingConeAngle = 90; + if (m_specularConstant > 0) + paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(location, target, specularExponent, limitingConeAngle, m_lightingColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent))->unref(); + else + paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(location, target, specularExponent, limitingConeAngle, m_lightingColor.rgb(), m_surfaceScale, m_diffuseConstant))->unref(); + break; + } + default: + ASSERT_NOT_REACHED(); + return false; + } + dstContext->platformContext()->canvas()->drawBitmap(nativeImage->bitmap(), drawingRegion.location().x(), drawingRegion.location().y(), &paint); + return true; +} + +}; +#endif diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp index 456e400c0..06edd32fb 100644 --- a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp @@ -355,8 +355,8 @@ static gboolean webkitVideoSinkProposeAllocation(GstBaseSink* baseSink, GstQuery if (!gst_video_info_from_caps(&sink->priv->info, caps)) return FALSE; - gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE); - gst_query_add_allocation_meta(query, GST_VIDEO_CROP_META_API_TYPE); + gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, 0); + gst_query_add_allocation_meta(query, GST_VIDEO_CROP_META_API_TYPE, 0); return TRUE; } #endif diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp index f09cb1303..83d6ee467 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -33,11 +33,6 @@ #include <wtf/StdLibExtras.h> #include <wtf/unicode/CharacterNames.h> -#if (PLATFORM(MAC) || PLATFORM(CHROMIUM)) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 -// Undefined when compiling agains the 10.5 SDK. -#define kCTVersionNumber10_6 0x00030000 -#endif - using namespace std; namespace WebCore { @@ -316,68 +311,9 @@ void ComplexTextController::collectComplexTextRuns() m_complexTextRuns.reverse(); } -#if USE(CORE_TEXT) && USE(ATSUI) -static inline bool shouldUseATSUIAPI() -{ - enum TypeRenderingAPIToUse { UnInitialized, UseATSUI, UseCoreText }; - static TypeRenderingAPIToUse apiToUse = UnInitialized; - - if (UNLIKELY(apiToUse == UnInitialized)) { - if (&CTGetCoreTextVersion != 0 && CTGetCoreTextVersion() >= kCTVersionNumber10_6) - apiToUse = UseCoreText; - else - apiToUse = UseATSUI; - } - - return apiToUse == UseATSUI; -} -#endif - CFIndex ComplexTextController::ComplexTextRun::indexAt(size_t i) const { -#if USE(CORE_TEXT) && USE(ATSUI) - return shouldUseATSUIAPI() ? m_atsuiIndices[i] : m_coreTextIndices[i]; -#elif USE(ATSUI) - return m_atsuiIndices[i]; -#elif USE(CORE_TEXT) return m_coreTextIndices[i]; -#endif -} - -void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) -{ - if (!fontData) { - // Create a run of missing glyphs from the primary font. - m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr())); - return; - } - -#if USE(CORE_TEXT) && USE(ATSUI) - if (shouldUseATSUIAPI()) - return collectComplexTextRunsForCharactersATSUI(cp, length, stringLocation, fontData); - return collectComplexTextRunsForCharactersCoreText(cp, length, stringLocation, fontData); -#elif USE(ATSUI) - return collectComplexTextRunsForCharactersATSUI(cp, length, stringLocation, fontData); -#elif USE(CORE_TEXT) - return collectComplexTextRunsForCharactersCoreText(cp, length, stringLocation, fontData); -#endif -} - -ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) - : m_fontData(fontData) - , m_characters(characters) - , m_stringLocation(stringLocation) - , m_stringLength(stringLength) - , m_indexEnd(stringLength) - , m_isMonotonic(true) -{ -#if USE(CORE_TEXT) && USE(ATSUI) - shouldUseATSUIAPI() ? createTextRunFromFontDataATSUI(ltr) : createTextRunFromFontDataCoreText(ltr); -#elif USE(ATSUI) - createTextRunFromFontDataATSUI(ltr); -#elif USE(CORE_TEXT) - createTextRunFromFontDataCoreText(ltr); -#endif } void ComplexTextController::ComplexTextRun::setIsNonMonotonic() diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.h b/Source/WebCore/platform/graphics/mac/ComplexTextController.h index 356135fcf..7c00dcbb4 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.h +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.h @@ -35,16 +35,8 @@ typedef unsigned short CGGlyph; -#if USE(CORE_TEXT) typedef const struct __CTRun * CTRunRef; typedef const struct __CTLine * CTLineRef; -#endif -#if USE(ATSUI) -typedef struct OpaqueATSUTextLayout* ATSUTextLayout; -typedef struct ATSGlyphVector* ATSULineRef; -typedef UInt32 ATSULayoutOperationSelector; -typedef UInt32 ATSULayoutOperationCallbackStatus; -#endif namespace WebCore { @@ -54,9 +46,6 @@ class TextRun; // ComplexTextController is responsible for rendering and measuring glyphs for // complex scripts on OS X. -// The underlying API can be selected at compile time based on USE(ATSUI) and -// USE(CORE_TEXT). If both are defined then the Core Text APIs are used for -// OS Versions >= 10.6, ATSUI is used otherwise. class ComplexTextController { public: ComplexTextController(const Font*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool forTextEmphasis = false); @@ -84,18 +73,11 @@ private: class ComplexTextRun : public RefCounted<ComplexTextRun> { public: -#if USE(CORE_TEXT) static PassRefPtr<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) { return adoptRef(new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength, runRange)); } -#endif -#if USE(ATSUI) - static PassRefPtr<ComplexTextRun> create(ATSUTextLayout atsuTextLayout, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride) - { - return adoptRef(new ComplexTextRun(atsuTextLayout, fontData, characters, stringLocation, stringLength, ltr, directionalOverride)); - } -#endif + static PassRefPtr<ComplexTextRun> create(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) { return adoptRef(new ComplexTextRun(fontData, characters, stringLocation, stringLength, ltr)); @@ -115,51 +97,28 @@ private: void setIsNonMonotonic(); private: -#if USE(CORE_TEXT) ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange); - void createTextRunFromFontDataCoreText(bool ltr); -#endif -#if USE(ATSUI) - ComplexTextRun(ATSUTextLayout, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride); - void createTextRunFromFontDataATSUI(bool ltr); -#endif ComplexTextRun(const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr); -#if USE(ATSUI) - static OSStatus overrideLayoutOperation(ATSULayoutOperationSelector, ATSULineRef, URefCon, void*, ATSULayoutOperationCallbackStatus*); -#endif - unsigned m_glyphCount; const SimpleFontData* m_fontData; const UChar* m_characters; unsigned m_stringLocation; size_t m_stringLength; -#if USE(CORE_TEXT) Vector<CFIndex, 64> m_coreTextIndicesVector; const CFIndex* m_coreTextIndices; -#endif -#if USE(ATSUI) - Vector<CFIndex, 64> m_atsuiIndices; -#endif CFIndex m_indexEnd; Vector<CFIndex, 64> m_glyphEndOffsets; Vector<CGGlyph, 64> m_glyphsVector; const CGGlyph* m_glyphs; Vector<CGSize, 64> m_advancesVector; const CGSize* m_advances; -#if USE(ATSUI) - bool m_directionalOverride; -#endif bool m_isMonotonic; }; void collectComplexTextRuns(); - // collectComplexTextRunsForCharacters() is a stub function that calls through to the ATSUI or Core Text variants based - // on the API in use. void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*); - void collectComplexTextRunsForCharactersATSUI(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*); - void collectComplexTextRunsForCharactersCoreText(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*); void adjustGlyphsAndAdvances(); const Font& m_font; @@ -169,10 +128,8 @@ private: Vector<UChar, 256> m_smallCapsBuffer; -#if USE(CORE_TEXT) // Retain lines rather than their runs for better performance. Vector<RetainPtr<CTLineRef> > m_coreTextLines; -#endif Vector<RefPtr<ComplexTextRun>, 16> m_complexTextRuns; Vector<CGSize, 256> m_adjustedAdvances; Vector<CGGlyph, 256> m_adjustedGlyphs; diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp deleted file mode 100644 index be9f74104..000000000 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * 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 "ComplexTextController.h" - -#if USE(ATSUI) - -#include "Font.h" -#include "ShapeArabic.h" -#include "TextRun.h" -#include <ApplicationServices/ApplicationServices.h> -#include <wtf/unicode/CharacterNames.h> - -#ifdef __LP64__ -// ATSUTextInserted() is SPI in 64-bit. -extern "C" { -OSStatus ATSUTextInserted(ATSUTextLayout iTextLayout, UniCharArrayOffset iInsertionLocation, UniCharCount iInsertionLength); -} -#endif - -using namespace WTF::Unicode; - -namespace WebCore { - -OSStatus ComplexTextController::ComplexTextRun::overrideLayoutOperation(ATSULayoutOperationSelector, ATSULineRef atsuLineRef, URefCon refCon, void*, ATSULayoutOperationCallbackStatus* callbackStatus) -{ - ComplexTextRun* complexTextRun = reinterpret_cast<ComplexTextRun*>(refCon); - OSStatus status; - ItemCount count; - ATSLayoutRecord* layoutRecords; - - status = ATSUDirectGetLayoutDataArrayPtrFromLineRef(atsuLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, true, reinterpret_cast<void**>(&layoutRecords), &count); - if (status != noErr) { - *callbackStatus = kATSULayoutOperationCallbackStatusContinue; - return status; - } - - count--; - ItemCount j = 0; - CFIndex indexOffset = 0; - - if (complexTextRun->m_directionalOverride) { - j++; - count -= 2; - indexOffset = -1; - } - - complexTextRun->m_glyphCount = count; - complexTextRun->m_glyphsVector.reserveCapacity(count); - complexTextRun->m_advancesVector.reserveCapacity(count); - complexTextRun->m_atsuiIndices.reserveCapacity(count); - - bool atBeginning = true; - CGFloat lastX = 0; - - for (ItemCount i = 0; i < count; ++i, ++j) { - if (layoutRecords[j].glyphID == kATSDeletedGlyphcode) { - complexTextRun->m_glyphCount--; - continue; - } - complexTextRun->m_glyphsVector.uncheckedAppend(layoutRecords[j].glyphID); - complexTextRun->m_atsuiIndices.uncheckedAppend(layoutRecords[j].originalOffset / 2 + indexOffset); - CGFloat x = FixedToFloat(layoutRecords[j].realPos); - if (!atBeginning) - complexTextRun->m_advancesVector.uncheckedAppend(CGSizeMake(x - lastX, 0)); - lastX = x; - atBeginning = false; - } - - complexTextRun->m_advancesVector.uncheckedAppend(CGSizeMake(FixedToFloat(layoutRecords[j].realPos) - lastX, 0)); - - complexTextRun->m_glyphs = complexTextRun->m_glyphsVector.data(); - complexTextRun->m_advances = complexTextRun->m_advancesVector.data(); - - status = ATSUDirectReleaseLayoutDataArrayPtr(atsuLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, reinterpret_cast<void**>(&layoutRecords)); - *callbackStatus = kATSULayoutOperationCallbackStatusContinue; - return noErr; -} - -static inline bool isArabicLamWithAlefLigature(UChar c) -{ - return c >= 0xfef5 && c <= 0xfefc; -} - -static void shapeArabic(const UChar* source, UChar* dest, unsigned totalLength) -{ - unsigned shapingStart = 0; - while (shapingStart < totalLength) { - unsigned shapingEnd; - // We do not want to pass a Lam with Alef ligature followed by a space to the shaper, - // since we want to be able to identify this sequence as the result of shaping a Lam - // followed by an Alef and padding with a space. - bool foundLigatureSpace = false; - for (shapingEnd = shapingStart; !foundLigatureSpace && shapingEnd < totalLength - 1; ++shapingEnd) - foundLigatureSpace = isArabicLamWithAlefLigature(source[shapingEnd]) && source[shapingEnd + 1] == ' '; - shapingEnd++; - - UErrorCode shapingError = U_ZERO_ERROR; - unsigned charsWritten = shapeArabic(source + shapingStart, shapingEnd - shapingStart, dest + shapingStart, shapingEnd - shapingStart, U_SHAPE_LETTERS_SHAPE | U_SHAPE_LENGTH_FIXED_SPACES_NEAR, &shapingError); - - if (U_SUCCESS(shapingError) && charsWritten == shapingEnd - shapingStart) { - for (unsigned j = shapingStart; j < shapingEnd - 1; ++j) { - if (isArabicLamWithAlefLigature(dest[j]) && dest[j + 1] == ' ') - dest[++j] = zeroWidthSpace; - } - if (foundLigatureSpace) { - dest[shapingEnd] = ' '; - shapingEnd++; - } else if (isArabicLamWithAlefLigature(dest[shapingEnd - 1])) { - // u_shapeArabic quirk: if the last two characters in the source string are a Lam and an Alef, - // the space is put at the beginning of the string, despite U_SHAPE_LENGTH_FIXED_SPACES_NEAR. - ASSERT(dest[shapingStart] == ' '); - dest[shapingStart] = zeroWidthSpace; - } - } else { - // Something went wrong. Abandon shaping and just copy the rest of the buffer. - LOG_ERROR("u_shapeArabic failed(%d)", shapingError); - shapingEnd = totalLength; - memcpy(dest + shapingStart, source + shapingStart, (shapingEnd - shapingStart) * sizeof(UChar)); - } - shapingStart = shapingEnd; - } -} - -ComplexTextController::ComplexTextRun::ComplexTextRun(ATSUTextLayout atsuTextLayout, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride) - : m_fontData(fontData) - , m_characters(characters) - , m_stringLocation(stringLocation) - , m_stringLength(stringLength) - , m_indexEnd(stringLength) - , m_directionalOverride(directionalOverride) - , m_isMonotonic(true) -{ - OSStatus status; - - status = ATSUSetTextLayoutRefCon(atsuTextLayout, reinterpret_cast<URefCon>(this)); - - ATSLineLayoutOptions lineLayoutOptions = kATSLineKeepSpacesOutOfMargin | kATSLineHasNoHangers; - - Boolean rtl = !ltr; - - Vector<UChar, 256> substituteCharacters; - bool shouldCheckForMirroring = !ltr && !fontData->m_ATSUMirrors; - bool shouldCheckForArabic = !fontData->shapesArabic(); - bool shouldShapeArabic = false; - - bool mirrored = false; - for (size_t i = 0; i < stringLength; ++i) { - if (shouldCheckForMirroring) { - UChar mirroredChar = u_charMirror(characters[i]); - if (mirroredChar != characters[i]) { - if (!mirrored) { - mirrored = true; - substituteCharacters.grow(stringLength); - memcpy(substituteCharacters.data(), characters, stringLength * sizeof(UChar)); - ATSUTextMoved(atsuTextLayout, substituteCharacters.data()); - } - substituteCharacters[i] = mirroredChar; - } - } - if (shouldCheckForArabic && isArabicChar(characters[i])) { - shouldCheckForArabic = false; - shouldShapeArabic = true; - } - } - - if (shouldShapeArabic) { - Vector<UChar, 256> shapedArabic(stringLength); - shapeArabic(substituteCharacters.isEmpty() ? characters : substituteCharacters.data(), shapedArabic.data(), stringLength); - substituteCharacters.swap(shapedArabic); - ATSUTextMoved(atsuTextLayout, substituteCharacters.data()); - } - - if (directionalOverride) { - UChar override = ltr ? leftToRightOverride : rightToLeftOverride; - if (substituteCharacters.isEmpty()) { - substituteCharacters.grow(stringLength + 2); - substituteCharacters[0] = override; - memcpy(substituteCharacters.data() + 1, characters, stringLength * sizeof(UChar)); - substituteCharacters[stringLength + 1] = popDirectionalFormatting; - ATSUTextMoved(atsuTextLayout, substituteCharacters.data()); - } else { - substituteCharacters.prepend(override); - substituteCharacters.append(popDirectionalFormatting); - } - ATSUTextInserted(atsuTextLayout, 0, 2); - } - - ATSULayoutOperationOverrideSpecifier overrideSpecifier; - overrideSpecifier.operationSelector = kATSULayoutOperationPostLayoutAdjustment; - overrideSpecifier.overrideUPP = overrideLayoutOperation; - - ATSUAttributeTag tags[] = { kATSULineLayoutOptionsTag, kATSULineDirectionTag, kATSULayoutOperationOverrideTag }; - ByteCount sizes[] = { sizeof(ATSLineLayoutOptions), sizeof(Boolean), sizeof(ATSULayoutOperationOverrideSpecifier) }; - ATSUAttributeValuePtr values[] = { &lineLayoutOptions, &rtl, &overrideSpecifier }; - - status = ATSUSetLayoutControls(atsuTextLayout, 3, tags, sizes, values); - - ItemCount boundsCount; - status = ATSUGetGlyphBounds(atsuTextLayout, 0, 0, 0, m_stringLength, kATSUseFractionalOrigins, 0, 0, &boundsCount); - - status = ATSUDisposeTextLayout(atsuTextLayout); -} - -void ComplexTextController::ComplexTextRun::createTextRunFromFontDataATSUI(bool ltr) -{ - m_atsuiIndices.reserveCapacity(m_stringLength); - unsigned r = 0; - while (r < m_stringLength) { - m_atsuiIndices.uncheckedAppend(r); - if (U_IS_SURROGATE(m_characters[r])) { - ASSERT(r + 1 < m_stringLength); - ASSERT(U_IS_SURROGATE_LEAD(m_characters[r])); - ASSERT(U_IS_TRAIL(m_characters[r + 1])); - r += 2; - } else - r++; - } - m_glyphCount = m_atsuiIndices.size(); - if (!ltr) { - for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end) - std::swap(m_atsuiIndices[r], m_atsuiIndices[end]); - } - - m_glyphsVector.fill(0, m_glyphCount); - m_glyphs = m_glyphsVector.data(); - m_advancesVector.fill(CGSizeMake(m_fontData->widthForGlyph(0), 0), m_glyphCount); - m_advances = m_advancesVector.data(); -} - -static bool fontHasMirroringInfo(ATSUFontID fontID) -{ - ByteCount propTableSize; - OSStatus status = ATSFontGetTable(fontID, 'prop', 0, 0, 0, &propTableSize); - if (status == noErr) // naively assume that if a 'prop' table exists then it contains mirroring info - return true; - else if (status != kATSInvalidFontTableAccess) // anything other than a missing table is logged as an error - LOG_ERROR("ATSFontGetTable failed (%d)", static_cast<int>(status)); - - return false; -} - -static void disableLigatures(const SimpleFontData* fontData, ATSUStyle atsuStyle, TypesettingFeatures typesettingFeatures) -{ - // Don't be too aggressive: if the font doesn't contain 'a', then assume that any ligatures it contains are - // in characters that always go through ATSUI, and therefore allow them. Geeza Pro is an example. - // See bugzilla 5166. - if ((typesettingFeatures & Ligatures) || (fontData->platformData().orientation() == Horizontal && fontData->platformData().allowsLigatures())) - return; - - ATSUFontFeatureType featureTypes[] = { kLigaturesType }; - ATSUFontFeatureSelector featureSelectors[] = { kCommonLigaturesOffSelector }; - OSStatus status = ATSUSetFontFeatures(atsuStyle, 1, featureTypes, featureSelectors); - if (status != noErr) - LOG_ERROR("ATSUSetFontFeatures failed (%d) -- ligatures remain enabled", static_cast<int>(status)); -} - -static ATSUStyle initializeATSUStyle(const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures) -{ - unsigned key = typesettingFeatures + 1; - HashMap<unsigned, ATSUStyle>::AddResult addResult = fontData->m_ATSUStyleMap.add(key, 0); - ATSUStyle& atsuStyle = addResult.iterator->second; - if (!addResult.isNewEntry) - return atsuStyle; - - ATSUFontID fontID = fontData->platformData().ctFont() ? CTFontGetPlatformFont(fontData->platformData().ctFont(), 0) : 0; - if (!fontID) { - LOG_ERROR("unable to get ATSUFontID for %p", fontData->platformData().font()); - fontData->m_ATSUStyleMap.remove(addResult.isNewEntry); - return 0; - } - - OSStatus status = ATSUCreateStyle(&atsuStyle); - if (status != noErr) - LOG_ERROR("ATSUCreateStyle failed (%d)", static_cast<int>(status)); - - Fixed fontSize = FloatToFixed(fontData->platformData().m_size); - Fract kerningInhibitFactor = FloatToFract(1); - static CGAffineTransform verticalFlip = CGAffineTransformMakeScale(1, -1); - - ByteCount styleSizes[4] = { sizeof(fontSize), sizeof(fontID), sizeof(verticalFlip), sizeof(kerningInhibitFactor) }; - ATSUAttributeTag styleTags[4] = { kATSUSizeTag, kATSUFontTag, kATSUFontMatrixTag, kATSUKerningInhibitFactorTag }; - ATSUAttributeValuePtr styleValues[4] = { &fontSize, &fontID, &verticalFlip, &kerningInhibitFactor }; - - bool allowKerning = typesettingFeatures & Kerning; - status = ATSUSetAttributes(atsuStyle, allowKerning ? 3 : 4, styleTags, styleSizes, styleValues); - if (status != noErr) - LOG_ERROR("ATSUSetAttributes failed (%d)", static_cast<int>(status)); - - fontData->m_ATSUMirrors = fontHasMirroringInfo(fontID); - - disableLigatures(fontData, atsuStyle, typesettingFeatures); - return atsuStyle; -} - -void ComplexTextController::collectComplexTextRunsForCharactersATSUI(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) -{ - ASSERT_ARG(fontData, fontData); - - if (fontData == systemFallbackFontData()) - fontData = m_font.primaryFont(); - - if (m_fallbackFonts && fontData != m_font.primaryFont()) - m_fallbackFonts->add(fontData); - - ATSUStyle atsuStyle = initializeATSUStyle(fontData, m_font.typesettingFeatures()); - - OSStatus status; - ATSUTextLayout atsuTextLayout; - UniCharCount runLength = length; - - status = ATSUCreateTextLayoutWithTextPtr(cp, 0, length, length, 1, &runLength, &atsuStyle, &atsuTextLayout); - if (status != noErr) { - LOG_ERROR("ATSUCreateTextLayoutWithTextPtr failed with error %d", static_cast<int>(status)); - return; - } - m_complexTextRuns.append(ComplexTextRun::create(atsuTextLayout, fontData, cp, stringLocation, length, m_run.ltr(), m_run.directionalOverride())); -} - -} // namespace WebCore - -#endif // USE(ATSUI) diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm index 83173db61..a993b7772 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm +++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm @@ -24,8 +24,6 @@ #include "config.h" -#if USE(CORE_TEXT) - #include "ComplexTextController.h" #include "Font.h" @@ -135,7 +133,13 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp // Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path. -void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bool ltr) +ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) + : m_fontData(fontData) + , m_characters(characters) + , m_stringLocation(stringLocation) + , m_stringLength(stringLength) + , m_indexEnd(stringLength) + , m_isMonotonic(true) { m_coreTextIndicesVector.reserveInitialCapacity(m_stringLength); unsigned r = 0; @@ -180,9 +184,13 @@ static const UniChar* provideStringAndAttributes(CFIndex stringIndex, CFIndex* c return info->cp + stringIndex; } -void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) +void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) { - ASSERT_ARG(fontData, fontData); + if (!fontData) { + // Create a run of missing glyphs from the primary font. + m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr())); + return; + } bool isSystemFallback = false; @@ -295,5 +303,3 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC } } // namespace WebCore - -#endif // USE(CORE_TEXT) diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm deleted file mode 100644 index 4b2e7b211..000000000 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "config.h" -#import "SimpleFontData.h" - -#if USE(ATSUI) - -#import "Font.h" -#import "FontCache.h" -#import "FontDescription.h" -#import <ApplicationServices/ApplicationServices.h> -#import <AppKit/AppKit.h> -#import <wtf/Assertions.h> - -using namespace std; - -namespace WebCore { - -void SimpleFontData::checkShapesArabic() const -{ - ASSERT(!m_checkedShapesArabic); - - m_checkedShapesArabic = true; - - ATSUFontID fontID = m_platformData.ctFont() ? CTFontGetPlatformFont(m_platformData.ctFont(), 0) : 0; - if (!fontID) { - LOG_ERROR("unable to get ATSUFontID for %@", m_platformData.font()); - return; - } - - // This function is called only on fonts that contain Arabic glyphs. Our - // heuristic is that if such a font has a glyph metamorphosis table, then - // it includes shaping information for Arabic. - FourCharCode tables[] = { 'morx', 'mort' }; - for (size_t i = 0; i < WTF_ARRAY_LENGTH(tables); ++i) { - ByteCount tableSize; - OSStatus status = ATSFontGetTable(fontID, tables[i], 0, 0, 0, &tableSize); - if (status == noErr) { - m_shapesArabic = true; - return; - } - - if (status != kATSInvalidFontTableAccess) - LOG_ERROR("ATSFontGetTable failed (%d)", status); - } -} - -} // namespace WebCore - -#endif diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index 487591a74..587b9dd81 100644 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -142,12 +142,6 @@ const SimpleFontData* SimpleFontData::getCompositeFontReferenceFontData(NSFont * void SimpleFontData::platformInit() { -#if USE(ATSUI) - m_ATSUMirrors = false; - m_checkedShapesArabic = false; - m_shapesArabic = false; -#endif - m_syntheticBoldOffset = m_platformData.m_syntheticBold ? 1.0f : 0.f; bool failedSetup = false; @@ -319,12 +313,6 @@ void SimpleFontData::platformDestroy() if (m_derivedFontData->emphasisMark) fontCache()->releaseFontData(m_derivedFontData->emphasisMark.leakPtr()); } - -#if USE(ATSUI) - HashMap<unsigned, ATSUStyle>::iterator end = m_ATSUStyleMap.end(); - for (HashMap<unsigned, ATSUStyle>::iterator it = m_ATSUStyleMap.begin(); it != end; ++it) - ATSUDisposeStyle(it->second); -#endif } PassOwnPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const diff --git a/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp index 74c94f3d4..b7dfc2fbe 100644 --- a/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp +++ b/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp @@ -96,6 +96,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + m_data->drawRect(rect); } diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 1136fb8d1..895f76688 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -29,6 +29,7 @@ #include "HostWindow.h" #include "ImageBuffer.h" #include "ImageData.h" +#include "NativeImageQt.h" #include "NotImplemented.h" #include "OpenGLShims.h" #include "QWebPageClient.h" @@ -468,7 +469,7 @@ bool GraphicsContext3D::makeContextCurrent() void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, QPainter* context) { - QImage image(imagePixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied); + QImage image(imagePixels, imageWidth, imageHeight, NativeImageQt::defaultFormatForAlphaEnabledImages()); context->save(); context->translate(0, imageHeight); context->scale(1, -1); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 611efc6a2..6a3effacb 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -211,11 +211,7 @@ public: QRectF clipBoundingRect() const { -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) return p()->clipBoundingRect(); -#else - return p()->clipRegion().boundingRect(); -#endif } void takeOwnershipOfPlatformContext() { platformContextIsOwned = true; } @@ -327,6 +323,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); diff --git a/Source/WebCore/platform/graphics/qt/PathQt.cpp b/Source/WebCore/platform/graphics/qt/PathQt.cpp index 3b0ca1b62..2eaaff8f4 100644 --- a/Source/WebCore/platform/graphics/qt/PathQt.cpp +++ b/Source/WebCore/platform/graphics/qt/PathQt.cpp @@ -35,6 +35,7 @@ #include "FloatRect.h" #include "GraphicsContext.h" #include "ImageBuffer.h" +#include "NativeImageQt.h" #include "PlatformString.h" #include "StrokeStyleApplier.h" #include <QPainterPath> @@ -118,7 +119,7 @@ bool Path::contains(const FloatPoint& point, WindRule rule) const static GraphicsContext* scratchContext() { - static QImage image(1, 1, QImage::Format_ARGB32_Premultiplied); + static QImage image(1, 1, NativeImageQt::defaultFormatForAlphaEnabledImages()); static QPainter painter(&image); static GraphicsContext* context = new GraphicsContext(&painter); return context; diff --git a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h index f5203ec8a..f0d1192a3 100644 --- a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h +++ b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h @@ -49,7 +49,7 @@ public: // Creates a new Image from the given SkBitmap. If "copyPixels" is true, a // deep copy is done. Otherwise, a shallow copy is done (pixel data is // ref'ed). - static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&, bool copyPixels); + static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&, bool copyPixels, float resolutionScale = 1); virtual bool isBitmapImage() const; @@ -76,7 +76,7 @@ private: NativeImageSkia m_nativeImage; // Creates a new Image from the given SkBitmap, using a shallow copy. - explicit BitmapImageSingleFrameSkia(const SkBitmap&); + BitmapImageSingleFrameSkia(const SkBitmap&, float resolutionScale); }; FloatRect normalizeRect(const FloatRect&); diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index a15757172..26aba108a 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -658,6 +658,10 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + if (rect.isEmpty()) + return; + platformContext()->drawRect(rect); } diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index b5490c656..860ff1b78 100644 --- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -108,11 +108,11 @@ static SkCanvas* createNonPlatformCanvas(const IntSize& size) return canvas; } -ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode renderingMode, DeferralMode deferralMode, bool& success) +ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace, RenderingMode renderingMode, DeferralMode deferralMode, bool& success) : m_data(size) , m_size(size) , m_logicalSize(size) - , m_resolutionScale(1) + , m_resolutionScale(resolutionScale) { OwnPtr<SkCanvas> canvas; @@ -133,6 +133,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, Color m_data.m_platformContext.setCanvas(m_data.m_canvas.get()); m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext)); m_context->platformContext()->setDrawingToImageBuffer(true); + m_context->scale(FloatSize(m_resolutionScale, m_resolutionScale)); // Make the background transparent. It would be nice if this wasn't // required, but the canvas is currently filled with the magic transparency @@ -160,7 +161,7 @@ GraphicsContext* ImageBuffer::context() const PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior) const { - return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), copyBehavior == CopyBackingStore); + return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), copyBehavior == CopyBackingStore, m_resolutionScale); } PlatformLayer* ImageBuffer::platformLayer() const diff --git a/Source/WebCore/platform/graphics/skia/ImageSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageSkia.cpp index 6a4bcb0a3..929879dcf 100644 --- a/Source/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -70,18 +70,8 @@ enum ResamplingMode { RESAMPLE_AWESOME, }; -static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext, const NativeImageSkia& bitmap, int srcWidth, int srcHeight, float destWidth, float destHeight) +static ResamplingMode computeResamplingMode(const SkMatrix& matrix, const NativeImageSkia& bitmap, int srcWidth, int srcHeight, float destWidth, float destHeight) { - if (platformContext->hasImageResamplingHint()) { - IntSize srcSize; - FloatSize dstSize; - platformContext->getImageResamplingHint(&srcSize, &dstSize); - srcWidth = srcSize.width(); - srcHeight = srcSize.height(); - destWidth = dstSize.width(); - destHeight = dstSize.height(); - } - int destIWidth = static_cast<int>(destWidth); int destIHeight = static_cast<int>(destHeight); @@ -147,7 +137,7 @@ static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext // Everything else gets resampled. // High quality interpolation only enabled for scaling and translation. - if (!(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask))) + if (!(matrix.getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask))) return RESAMPLE_AWESOME; return RESAMPLE_LINEAR; @@ -259,7 +249,7 @@ static void paintSkBitmap(PlatformContextSkia* platformContext, const NativeImag if (!(canvas->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask))) canvas->getTotalMatrix().mapRect(&destRectTarget, destRect); - resampling = computeResamplingMode(platformContext, bitmap, srcRect.width(), srcRect.height(), + resampling = computeResamplingMode(canvas->getTotalMatrix(), bitmap, srcRect.width(), srcRect.height(), SkScalarToFloat(destRectTarget.width()), SkScalarToFloat(destRectTarget.height())); } @@ -353,12 +343,15 @@ void Image::drawPattern(GraphicsContext* context, return; SkIRect srcRect = enclosingIntRect(normSrcRect); + SkMatrix ctm = context->platformContext()->canvas()->getTotalMatrix(); + SkMatrix totalMatrix; + totalMatrix.setConcat(ctm, patternTransform); // Figure out what size the bitmap will be in the destination. The // destination rect is the bounds of the pattern, we need to use the // matrix to see how big it will be. float destBitmapWidth, destBitmapHeight; - TransformDimensions(patternTransform, srcRect.width(), srcRect.height(), + TransformDimensions(totalMatrix, srcRect.width(), srcRect.height(), &destBitmapWidth, &destBitmapHeight); // Compute the resampling mode. @@ -366,7 +359,7 @@ void Image::drawPattern(GraphicsContext* context, if (context->platformContext()->isAccelerated() || context->platformContext()->printing()) resampling = RESAMPLE_LINEAR; else - resampling = computeResamplingMode(context->platformContext(), *bitmap, srcRect.width(), srcRect.height(), destBitmapWidth, destBitmapHeight); + resampling = computeResamplingMode(totalMatrix, *bitmap, srcRect.width(), srcRect.height(), destBitmapWidth, destBitmapHeight); resampling = limitResamplingMode(context->platformContext(), resampling); // Load the transform WebKit requested. @@ -380,10 +373,14 @@ void Image::drawPattern(GraphicsContext* context, SkBitmap resampled = bitmap->resizedBitmap(srcRect, width, height); shader = SkShader::CreateBitmapShader(resampled, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); - // Since we just resized the bitmap, we need to undo the scale set in - // the image transform. - matrix.setScaleX(SkIntToScalar(1)); - matrix.setScaleY(SkIntToScalar(1)); + // Since we just resized the bitmap, we need to remove the scale + // applied to the pixels in the bitmap shader. This means we need + // CTM * patternTransform to have identity scale. Since we + // can't modify CTM (or the rectangle will be drawn in the wrong + // place), we must set patternTransform's scale to the inverse of + // CTM scale. + matrix.setScaleX(ctm.getScaleX() ? 1 / ctm.getScaleX() : 1); + matrix.setScaleY(ctm.getScaleY() ? 1 / ctm.getScaleY() : 1); } else { // No need to do nice resampling. SkBitmap srcSubset; @@ -496,20 +493,20 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt, observer->didDraw(this); } -BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia(const SkBitmap& bitmap) - : m_nativeImage(bitmap) +BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia(const SkBitmap& bitmap, float resolutionScale) + : m_nativeImage(bitmap, resolutionScale) { } -PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap, bool copyPixels) +PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap, bool copyPixels, float resolutionScale) { if (copyPixels) { SkBitmap temp; if (!bitmap.deepCopyTo(&temp, bitmap.config())) bitmap.copyTo(&temp, bitmap.config()); - return adoptRef(new BitmapImageSingleFrameSkia(temp)); + return adoptRef(new BitmapImageSingleFrameSkia(temp, resolutionScale)); } - return adoptRef(new BitmapImageSingleFrameSkia(bitmap)); + return adoptRef(new BitmapImageSingleFrameSkia(bitmap, resolutionScale)); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp b/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp index 425f56578..7cc23c4f4 100644 --- a/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp @@ -43,12 +43,14 @@ namespace WebCore { NativeImageSkia::NativeImageSkia() - : m_resizeRequests(0) + : m_resolutionScale(1), + m_resizeRequests(0) { } -NativeImageSkia::NativeImageSkia(const SkBitmap& other) +NativeImageSkia::NativeImageSkia(const SkBitmap& other, float resolutionScale) : m_image(other), + m_resolutionScale(resolutionScale), m_resizeRequests(0) { } diff --git a/Source/WebCore/platform/graphics/skia/NativeImageSkia.h b/Source/WebCore/platform/graphics/skia/NativeImageSkia.h index ccfd0aa0c..2a52e68ee 100644 --- a/Source/WebCore/platform/graphics/skia/NativeImageSkia.h +++ b/Source/WebCore/platform/graphics/skia/NativeImageSkia.h @@ -48,7 +48,7 @@ public: // This constructor does a shallow copy of the passed-in SkBitmap (ie., it // references the same pixel data and bumps the refcount). Use only when // you want sharing semantics. - explicit NativeImageSkia(const SkBitmap&); + NativeImageSkia(const SkBitmap&, float resolutionScale); // Returns the number of bytes of image data. This includes the cached // resized version if there is one. @@ -67,6 +67,8 @@ public: const SkBitmap& bitmap() const { return m_image; } SkBitmap& bitmap() { return m_image; } + float resolutionScale() const { return m_resolutionScale; } + // We can keep a resized version of the bitmap cached on this object. // This function will return true if there is a cached version of the // given image subset with the given dimensions and subsets. @@ -123,6 +125,7 @@ private: // The original image. SkBitmap m_image; + float m_resolutionScale; // The cached bitmap. This will be empty() if there is no cached image. mutable SkBitmap m_resizedImage; diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index 74a4f38cf..4784c3789 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -217,8 +217,6 @@ bool PlatformContextSkia::isDrawingToImageBuffer() const void PlatformContextSkia::save() { - ASSERT(!hasImageResamplingHint()); - m_stateStack.append(m_state->cloneInheritedProperties()); m_state = &m_stateStack.last(); @@ -606,29 +604,6 @@ bool PlatformContextSkia::isNativeFontRenderingAllowed() #endif } -void PlatformContextSkia::getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const -{ - *srcSize = m_imageResamplingHintSrcSize; - *dstSize = m_imageResamplingHintDstSize; -} - -void PlatformContextSkia::setImageResamplingHint(const IntSize& srcSize, const FloatSize& dstSize) -{ - m_imageResamplingHintSrcSize = srcSize; - m_imageResamplingHintDstSize = dstSize; -} - -void PlatformContextSkia::clearImageResamplingHint() -{ - m_imageResamplingHintSrcSize = IntSize(); - m_imageResamplingHintDstSize = FloatSize(); -} - -bool PlatformContextSkia::hasImageResamplingHint() const -{ - return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty(); -} - void PlatformContextSkia::applyClipFromImage(const SkRect& rect, const SkBitmap& imageBuffer) { // NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h index b9fcb7b42..9da1fbaaf 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -178,11 +178,6 @@ public: // if USE(SKIA_TEXT) is enabled, this always returns false bool isNativeFontRenderingAllowed(); - void getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const; - void setImageResamplingHint(const IntSize& srcSize, const FloatSize& dstSize); - void clearImageResamplingHint(); - bool hasImageResamplingHint() const; - bool isAccelerated() const { return m_accelerated; } void setAccelerated(bool accelerated) { m_accelerated = accelerated; } @@ -235,10 +230,6 @@ private: OpaqueRegionSkia m_opaqueRegion; bool m_trackOpaqueRegion; - // Stores image sizes for a hint to compute image resampling modes. - // Values are used in ImageSkia.cpp - IntSize m_imageResamplingHintSrcSize; - FloatSize m_imageResamplingHintDstSize; bool m_printing; bool m_accelerated; bool m_deferred; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp index cca2e27ec..688e26f4e 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp @@ -38,6 +38,7 @@ #endif #if PLATFORM(QT) +#include "NativeImageQt.h" #if HAVE(QT5) #include <QOpenGLContext> #else @@ -377,7 +378,7 @@ void TextureMapperGL::drawRepaintCounter(int value, int pointSize, const FloatPo IntRect sourceRect(IntPoint::zero(), size); IntRect targetRect(roundedIntPoint(targetPoint), size); - QImage image(size, QImage::Format_ARGB32_Premultiplied); + QImage image(size, NativeImageQt::defaultFormatForAlphaEnabledImages()); QPainter painter(&image); painter.fillRect(sourceRect, Qt::blue); // Since we won't swap R+B for speed, this will paint red. painter.setFont(font); diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp index d5019e6a6..9b0c9a56f 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp @@ -21,6 +21,10 @@ #include "TextureMapperImageBuffer.h" #include "FilterEffectRenderer.h" +#if PLATFORM(QT) +#include "NativeImageQt.h" +#endif + #if USE(TEXTURE_MAPPER) namespace WebCore { @@ -28,7 +32,7 @@ namespace WebCore { void BitmapTextureImageBuffer::updateContents(const void* data, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine) { #if PLATFORM(QT) - QImage image(reinterpret_cast<const uchar*>(data), targetRect.width(), targetRect.height(), bytesPerLine, QImage::Format_ARGB32_Premultiplied); + QImage image(reinterpret_cast<const uchar*>(data), targetRect.width(), targetRect.height(), bytesPerLine, NativeImageQt::defaultFormatForAlphaEnabledImages()); QPainter* painter = m_image->context()->platformContext(); painter->save(); diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp index cdd495201..cf88009be 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp @@ -108,7 +108,9 @@ void TextureMapperLayer::updateBackingStore(TextureMapper* textureMapper, Graphi return; } - IntRect dirtyRect = enclosingIntRect(m_state.needsDisplay ? layerRect() : m_state.needsDisplayRect); + IntRect dirtyRect = enclosingIntRect(layerRect()); + if (!m_state.needsDisplay) + dirtyRect.intersect(enclosingIntRect(m_state.needsDisplayRect)); if (dirtyRect.isEmpty()) return; diff --git a/Source/WebCore/platform/graphics/win/FontCacheWin.cpp b/Source/WebCore/platform/graphics/win/FontCacheWin.cpp index 4d1b2cfd3..f54897a9b 100644 --- a/Source/WebCore/platform/graphics/win/FontCacheWin.cpp +++ b/Source/WebCore/platform/graphics/win/FontCacheWin.cpp @@ -331,7 +331,7 @@ SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& font }; SimpleFontData* simpleFont; for (size_t i = 0; i < WTF_ARRAY_LENGTH(fallbackFonts); ++i) { - if (simpleFont = getCachedFontData(fontDescription, fallbackFonts[i]), false, shouldRetain) { + if (simpleFont = getCachedFontData(fontDescription, fallbackFonts[i], false, shouldRetain)) { fallbackFontName = fallbackFonts[i]; return simpleFont; } diff --git a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp index 983c1bf92..53af06d64 100644 --- a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp +++ b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp @@ -35,8 +35,6 @@ #include "FontDescription.h" #include "HWndDC.h" #include <mlang.h> -#include <unicode/uchar.h> -#include <unicode/unorm.h> #include <winsock2.h> #include <wtf/MathExtras.h> diff --git a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 3cbe13658..78e608993 100644 --- a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -222,6 +222,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + save(); m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle()))); m_data->context->DrawRectangle(rect.x(), rect.y(), rect.width(), rect.height()); diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp index 2eb4f2bad..a77077a05 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -48,7 +48,7 @@ #include <gtk/gtk.h> #include <wtf/text/CString.h> -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderProgress.h" #endif @@ -641,7 +641,7 @@ bool RenderThemeGtk::paintMediaCurrentTime(RenderObject* renderObject, const Pai } #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) void RenderThemeGtk::adjustProgressBarStyle(StyleResolver*, RenderStyle* style, Element*) const { style->setBoxShadow(nullptr); diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.h b/Source/WebCore/platform/gtk/RenderThemeGtk.h index 133f588e9..add959d9f 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.h +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.h @@ -168,7 +168,7 @@ protected: virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const IntRect&); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; @@ -191,7 +191,7 @@ private: bool paintMediaButton(RenderObject*, GraphicsContext*, const IntRect&, const char* iconName); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) static IntRect calculateProgressRect(RenderObject*, const IntRect&); #endif diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp index 4cc3a29fa..7012d3d26 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp @@ -551,7 +551,7 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderStyle* style, Element*) const style->setHeight(Length(length, Fixed)); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { GtkWidget* widget = gtkProgressBar(); diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp index fed4e7e62..774939151 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp @@ -730,7 +730,7 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderStyle* style, Element*) const style->setHeight(Length(sliderLength, Fixed)); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { if (!renderObject->isProgress()) diff --git a/Source/WebCore/platform/network/MIMESniffing.cpp b/Source/WebCore/platform/network/MIMESniffing.cpp index 5efd17f13..c019702fc 100644 --- a/Source/WebCore/platform/network/MIMESniffing.cpp +++ b/Source/WebCore/platform/network/MIMESniffing.cpp @@ -233,11 +233,28 @@ static inline size_t dataSizeNeededForImageSniffing() return result; } +static inline bool maskedCompareSlowCase(const MagicNumbers& info, const char* data) +{ + const char* pattern = reinterpret_cast<const char*>(info.pattern); + const char* mask = reinterpret_cast<const char*>(info.mask); + + size_t count = info.size; + + for (size_t i = 0; i < count; ++i) { + if ((*data++ & *mask++) != *pattern++) + return false; + } + return true; +} + static inline bool maskedCompare(const MagicNumbers& info, const char* data, size_t dataSize) { if (dataSize < info.size) return false; + if (!isPointerTypeAlignmentOkay(static_cast<const uint32_t*>(static_cast<const void*>(data)))) + return maskedCompareSlowCase(info, data); + const uint32_t* pattern32 = reinterpret_cast_ptr<const uint32_t*>(info.pattern); const uint32_t* mask32 = reinterpret_cast_ptr<const uint32_t*>(info.mask); const uint32_t* data32 = reinterpret_cast_ptr<const uint32_t*>(data); diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index 56b8760ba..e01bdc155 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -19,8 +19,6 @@ #include "config.h" #include "NetworkJob.h" -#include "AboutData.h" -#include "AboutTemplate.html.cpp" #include "Chrome.h" #include "ChromeClient.h" #include "CookieManager.h" @@ -39,8 +37,6 @@ #include <BlackBerryPlatformClient.h> #include <BlackBerryPlatformLog.h> -#include <BlackBerryPlatformWebKitCredits.h> -#include <BuildInformation.h> #include <LocalizeResource.h> #include <network/MultipartStream.h> #include <network/NetworkStreamFactory.h> @@ -66,11 +62,9 @@ inline static bool isUnauthorized(int statusCode) NetworkJob::NetworkJob() : m_playerId(0) - , m_loadAboutTimer(this, &NetworkJob::fireLoadAboutTimer) , m_deleteJobTimer(this, &NetworkJob::fireDeleteJobTimer) , m_streamFactory(0) , m_isFile(false) - , m_isAbout(false) , m_isFTP(false) , m_isFTPDir(true) #ifndef NDEBUG @@ -107,7 +101,6 @@ bool NetworkJob::initialize(int playerId, m_response.setURL(url); m_isFile = url.protocolIs("file") || url.protocolIs("local"); - m_isAbout = url.protocolIs("about"); m_isFTP = url.protocolIs("ftp"); m_handle = handle; @@ -132,10 +125,6 @@ bool NetworkJob::initialize(int playerId, m_isOverrideContentType = true; } - // No need to create the streams for about. - if (m_isAbout) - return true; - if (!request.getSuggestedSaveName().empty()) { m_contentDisposition = "filename="; m_contentDisposition += request.getSuggestedSaveName().c_str(); @@ -149,24 +138,10 @@ bool NetworkJob::initialize(int playerId, return true; } -void NetworkJob::loadAboutURL() -{ - m_loadAboutTimer.startOneShot(0); -} - int NetworkJob::cancelJob() { m_cancelled = true; - // Cancel jobs loading local data by killing the timer, and jobs - // getting data from the network by calling the inherited URLStream::cancel. - - if (m_loadAboutTimer.isActive()) { - m_loadAboutTimer.stop(); - notifyClose(BlackBerry::Platform::FilterStream::StatusCancelled); - return 0; - } - return streamCancel(); } @@ -192,7 +167,7 @@ void NetworkJob::notifyStatusReceived(int status, const char* message) void NetworkJob::handleNotifyStatusReceived(int status, const String& message) { // Check for messages out of order or after cancel. - if ((m_statusReceived && m_extendedStatusCode != 401) || m_responseSent || m_cancelled) + if (m_responseSent || m_cancelled) return; if (isInfo(status)) @@ -610,7 +585,7 @@ void NetworkJob::sendResponseIfNeeded() return; String urlFilename; - if (!m_response.url().protocolIsData() && !m_response.url().protocolIs("about")) + if (!m_response.url().protocolIsData()) urlFilename = m_response.url().lastPathComponent(); // Get the MIME type that was set by the content sniffer @@ -638,32 +613,23 @@ void NetworkJob::sendResponseIfNeeded() if (!contentLength.isNull()) m_response.setExpectedContentLength(contentLength.toInt64()); - // Set suggested filename for downloads from the Content-Disposition header; if this fails, - // fill it in from the url and sniffed mime type;Skip this for about URLs, - // because they have no Content-Disposition header and the format is wrong to be a filename. - if (!m_isAbout) { - String suggestedFilename = filenameFromHTTPContentDisposition(m_contentDisposition); - if (suggestedFilename.isEmpty()) { - // Check and see if an extension already exists. - String mimeExtension = MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType); - if (urlFilename.isEmpty()) { - if (mimeExtension.isEmpty()) // No extension found for the mimeType. - suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)); - else - suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)) + "." + mimeExtension; - } else { - if (urlFilename.reverseFind('.') == notFound && !mimeExtension.isEmpty()) - suggestedFilename = urlFilename + '.' + mimeExtension; - else - suggestedFilename = urlFilename; - } + String suggestedFilename = filenameFromHTTPContentDisposition(m_contentDisposition); + if (suggestedFilename.isEmpty()) { + // Check and see if an extension already exists. + String mimeExtension = MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType); + if (urlFilename.isEmpty()) { + if (mimeExtension.isEmpty()) // No extension found for the mimeType. + suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)); + else + suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)) + "." + mimeExtension; + } else { + if (urlFilename.reverseFind('.') == notFound && !mimeExtension.isEmpty()) + suggestedFilename = urlFilename + '.' + mimeExtension; + else + suggestedFilename = urlFilename; } - m_response.setSuggestedFilename(suggestedFilename); } - - // Don't cache resources for "about:" - if (m_isAbout) - m_response.setHTTPHeaderField("Cache-Control", "no-cache"); + m_response.setSuggestedFilename(suggestedFilename); if (isClientAvailable()) { RecursionGuard guard(m_callingClient); @@ -828,100 +794,4 @@ void NetworkJob::fireDeleteJobTimer(Timer<NetworkJob>*) NetworkManager::instance()->deleteJob(this); } -void NetworkJob::handleAbout() -{ - // First 6 chars are "about:". - String aboutWhat(m_response.url().string().substring(6)); - - String result; - - bool handled = false; - if (equalIgnoringCase(aboutWhat, "blank")) { - handled = true; - } else if (equalIgnoringCase(aboutWhat, "credits")) { - result.append(writeHeader("Credits")); - result.append(String("<style> .about {padding:14px;} </style>")); - result.append(String(BlackBerry::Platform::WEBKITCREDITS)); - result.append(String("</body></html>")); - handled = true; - } else if (aboutWhat.startsWith("cache?query=", false)) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - std::string key(aboutWhat.substring(12, aboutWhat.length() - 12).utf8().data()); // 12 is length of "cache?query=". - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); - result.append(String(key.data())); - result.append(String("<hr>")); - result.append(String(client->generateHtmlFragmentForCacheHeaders(key).data())); - result.append(String("</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "cache")) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); - result.append(String(client->generateHtmlFragmentForCacheKeys().data())); - result.append(String("</body></html>")); - handled = true; -#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD - } else if (equalIgnoringCase(aboutWhat, "cache/disable")) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - client->setDiskCacheEnabled(false); - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is disabled.</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "cache/enable")) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - client->setDiskCacheEnabled(true); - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is enabled.</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "cookie")) { - result.append(String("<html><head><title>BlackBerry Browser cookie information</title></head><body>")); - result.append(cookieManager().generateHtmlFragmentForCookies()); - result.append(String("</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "version")) { - result.append(writeHeader("Version")); - result.append(String("<div class='box'><div class='box-title'>Build Time</div><br>")); - result.append(String(BlackBerry::Platform::BUILDTIME)); - result.append(String("</div><br><div style='font-size:10px;text-align:center;'>Also see the <A href='about:build'>build information</A>.</body></html>")); - handled = true; - } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "config")) { - result = configPage(); - handled = true; - } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "build")) { - result.append(writeHeader("Build")); - result.append(String("<div class='box'><div class='box-title'>Basic</div><table>")); - result.append(String("<tr><td>Built On: </td><td>")); - result.append(String(BlackBerry::Platform::BUILDCOMPUTER)); - result.append(String("</td></tr>")); - result.append(String("<tr><td>Build User: </td><td>")); - result.append(String(BlackBerry::Platform::BUILDUSER)); - result.append(String("</td></tr>")); - result.append(String("<tr><td>Build Time: </td><td>")); - result.append(String(BlackBerry::Platform::BUILDTIME)); - result.append(String("</table></div><br>")); - result.append(String(BlackBerry::Platform::BUILDINFO_WEBKIT)); - result.append(String(BlackBerry::Platform::BUILDINFO_PLATFORM)); - result.append(String(BlackBerry::Platform::BUILDINFO_LIBWEBVIEW)); - result.append(String("</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "memory")) { - result = memoryPage(); - handled = true; -#endif - } - if (handled) { - CString resultString = result.utf8(); - notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusSuccess, 0); - notifyStringHeaderReceived("Content-Length", String::number(resultString.length())); - notifyStringHeaderReceived("Content-Type", "text/html"); - notifyDataReceivedPlain(resultString.data(), resultString.length()); - notifyClose(BlackBerry::Platform::FilterStream::StatusSuccess); - } else { - // If we can not handle it, we take it as an error of invalid URL. - notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl, 0); - notifyClose(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl); - } -} - } // namespace WebCore diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h index 8fceffc1a..b48c1ecc0 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.h +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h @@ -60,7 +60,6 @@ public: bool isRunning() const { return m_isRunning; } #endif bool isCancelled() const { return m_cancelled; } - void loadAboutURL(); int cancelJob(); bool isDeferringLoading() const { return m_deferLoadingCount > 0; } void updateDeferLoadingCount(int delta); @@ -115,15 +114,8 @@ private: void sendResponseIfNeeded(); void sendMultipartResponseIfNeeded(); - void fireLoadAboutTimer(Timer<NetworkJob>*) - { - handleAbout(); - } - void fireDeleteJobTimer(Timer<NetworkJob>*); - void handleAbout(); - bool handleFTPHeader(const String& header); // The server needs authentication credentials. Search in the CredentialStorage @@ -144,7 +136,6 @@ private: String m_pageGroupName; RefPtr<ResourceHandle> m_handle; ResourceResponse m_response; - Timer<NetworkJob> m_loadAboutTimer; OwnPtr<ResourceResponse> m_multipartResponse; Timer<NetworkJob> m_deleteJobTimer; String m_contentType; @@ -152,7 +143,6 @@ private: String m_contentDisposition; BlackBerry::Platform::NetworkStreamFactory* m_streamFactory; bool m_isFile; - bool m_isAbout; bool m_isFTP; bool m_isFTPDir; #ifndef NDEBUG diff --git a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp index 89d619c8b..b92a0a45c 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp @@ -136,12 +136,6 @@ bool NetworkManager::startJob(int playerId, const String& pageGroupName, PassRef m_jobs.append(networkJob); - if (url.protocolIs("about")) { - // If the protocol matches "about", loadAboutURL should recognize and handle it. - networkJob->loadAboutURL(); - return true; - } - int result = networkJob->streamOpen(); if (result) return false; diff --git a/Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp b/Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp new file mode 100644 index 000000000..48406f367 --- /dev/null +++ b/Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp @@ -0,0 +1,210 @@ +/* + * 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 "ProxyResolverSoup.h" + +#include <libsoup/soup.h> +#include <string.h> +#include <wtf/Vector.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +static const char defaultNoProxyValue[] = "localhost,127.0.0.1"; + +typedef struct { + SoupURI* proxyURI; + CString noProxy; + Vector<String> proxyExceptions; +} SoupProxyResolverWkPrivate; + +#define SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWkPrivate)) + +static void soup_proxy_resolver_wk_interface_init(SoupProxyURIResolverInterface* proxyResolverInterface); + +G_DEFINE_TYPE_EXTENDED(SoupProxyResolverWk, soup_proxy_resolver_wk, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE(SOUP_TYPE_SESSION_FEATURE, 0) + G_IMPLEMENT_INTERFACE(SOUP_TYPE_PROXY_URI_RESOLVER, soup_proxy_resolver_wk_interface_init)) + +enum { + PROP_0, + PROP_PROXY_URI, + PROP_NO_PROXY, + LAST_PROP +}; + +static void soup_proxy_resolver_wk_init(SoupProxyResolverWk* resolverWk) +{ +} + +static void soupProxyResolverWkFinalize(GObject* object) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(object); + + g_clear_pointer(&priv->proxyURI, soup_uri_free); + + G_OBJECT_CLASS(soup_proxy_resolver_wk_parent_class)->finalize(object); +} + +static void soupProxyResolverWkSetProperty(GObject* object, uint propID, const GValue* value, GParamSpec* pspec) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(object); + + switch (propID) { + case PROP_PROXY_URI: { + SoupURI* uri = static_cast<SoupURI*>(g_value_get_boxed(value)); + if (priv->proxyURI) + soup_uri_free(priv->proxyURI); + + priv->proxyURI = uri ? soup_uri_copy(uri) : 0; + break; + } + case PROP_NO_PROXY: + priv->noProxy = g_value_get_string(value); + priv->proxyExceptions.clear(); + String::fromUTF8(priv->noProxy.data()).replace(' ', "").split(',', priv->proxyExceptions); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec); + break; + } +} + +static void soupProxyResolverWkGetProperty(GObject* object, uint propID, GValue* value, GParamSpec* pspec) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(object); + + switch (propID) { + case PROP_PROXY_URI: + g_value_set_boxed(value, priv->proxyURI); + break; + case PROP_NO_PROXY: + g_value_set_string(value, priv->noProxy.data()); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec); + break; + } +} + +static bool shouldBypassProxy(SoupProxyResolverWkPrivate* priv, SoupURI* uri) +{ + const size_t exceptionCount = priv->proxyExceptions.size(); + for (size_t i = 0; i < exceptionCount; ++i) { + if (String::fromUTF8(uri->host).endsWith(priv->proxyExceptions[i], false)) + return true; + } + + return false; +} + +typedef struct { + SoupProxyURIResolver* proxyResolver; + SoupURI* uri; + SoupProxyURIResolverCallback callback; + void* userData; +} SoupWkAsyncData; + +static gboolean idle_return_proxy_uri(void* data) +{ + SoupWkAsyncData* ssad = static_cast<SoupWkAsyncData*>(data); + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(ssad->proxyResolver); + + SoupURI* proxyURI = 0; + if (!shouldBypassProxy(priv, ssad->uri)) + proxyURI = priv->proxyURI; + + ssad->callback(ssad->proxyResolver, SOUP_STATUS_OK, proxyURI, ssad->userData); + g_object_unref(ssad->proxyResolver); + soup_uri_free(ssad->uri); + g_slice_free(SoupWkAsyncData, ssad); + + return false; +} + +static void soupProxyResolverWkGetProxyURIAsync(SoupProxyURIResolver* proxyResolver, SoupURI* uri, GMainContext* asyncContext, GCancellable* cancellable, SoupProxyURIResolverCallback callback, void* userData) +{ + SoupWkAsyncData* ssad; + + ssad = g_slice_new0(SoupWkAsyncData); + ssad->proxyResolver = SOUP_PROXY_URI_RESOLVER(g_object_ref(proxyResolver)); + ssad->uri = soup_uri_copy(uri); + ssad->callback = callback; + ssad->userData = userData; + soup_add_completion(asyncContext, idle_return_proxy_uri, ssad); +} + +static uint soupProxyResolverWkGetProxyURISync(SoupProxyURIResolver* proxyResolver, SoupURI* uri, GCancellable* cancellable, SoupURI** proxyURI) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(proxyResolver); + + if (!shouldBypassProxy(priv, uri)) + *proxyURI = soup_uri_copy(priv->proxyURI); + + return SOUP_STATUS_OK; +} + +static void soup_proxy_resolver_wk_class_init(SoupProxyResolverWkClass* wkClass) +{ + GObjectClass* object_class = G_OBJECT_CLASS(wkClass); + + g_type_class_add_private(wkClass, sizeof(SoupProxyResolverWkPrivate)); + + object_class->set_property = soupProxyResolverWkSetProperty; + object_class->get_property = soupProxyResolverWkGetProperty; + object_class->finalize = soupProxyResolverWkFinalize; + + g_object_class_install_property(object_class, PROP_PROXY_URI, + g_param_spec_boxed(SOUP_PROXY_RESOLVER_WK_PROXY_URI, + "Proxy URI", + "The HTTP Proxy to use", + SOUP_TYPE_URI, + static_cast<GParamFlags>(G_PARAM_READWRITE))); + + g_object_class_install_property(object_class, PROP_NO_PROXY, + g_param_spec_string(SOUP_PROXY_RESOLVER_WK_NO_PROXY, + "Proxy exceptions", + "Comma-separated proxy exceptions", + defaultNoProxyValue, + static_cast<GParamFlags>(G_PARAM_READWRITE))); +} + +static void soup_proxy_resolver_wk_interface_init(SoupProxyURIResolverInterface* proxy_uri_resolver_interface) +{ + proxy_uri_resolver_interface->get_proxy_uri_async = soupProxyResolverWkGetProxyURIAsync; + proxy_uri_resolver_interface->get_proxy_uri_sync = soupProxyResolverWkGetProxyURISync; +} + +SoupProxyURIResolver* soupProxyResolverWkNew(const char* httpProxy, const char* noProxy) +{ + SoupURI* proxyURI = soup_uri_new(httpProxy); + SoupProxyURIResolver* resolver = SOUP_PROXY_URI_RESOLVER(g_object_new(SOUP_TYPE_PROXY_RESOLVER_WK, + SOUP_PROXY_RESOLVER_WK_PROXY_URI, proxyURI, + SOUP_PROXY_RESOLVER_WK_NO_PROXY, noProxy ? noProxy : defaultNoProxyValue, + 0)); + soup_uri_free(proxyURI); + + return resolver; +} diff --git a/Source/WebCore/platform/network/soup/ProxyResolverSoup.h b/Source/WebCore/platform/network/soup/ProxyResolverSoup.h new file mode 100644 index 000000000..60bd1ba98 --- /dev/null +++ b/Source/WebCore/platform/network/soup/ProxyResolverSoup.h @@ -0,0 +1,58 @@ +/* + * 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 ProxyResolverSoup_h +#define ProxyResolverSoup_h + +#include <libsoup/soup-proxy-uri-resolver.h> +#include <libsoup/soup-uri.h> + +G_BEGIN_DECLS + +#define SOUP_TYPE_PROXY_RESOLVER_WK (soup_proxy_resolver_wk_get_type ()) +#define SOUP_PROXY_RESOLVER_WK(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWk)) +#define SOUP_PROXY_RESOLVER_WK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWkClass)) +#define SOUP_IS_PROXY_RESOLVER_WK(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SOUP_TYPE_PROXY_RESOLVER_WK)) +#define SOUP_IS_PROXY_RESOLVER_WK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_PROXY_RESOLVER_WK)) +#define SOUP_PROXY_RESOLVER_WK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWkClass)) + +static const char SOUP_PROXY_RESOLVER_WK_PROXY_URI[] = "proxy-uri"; +static const char SOUP_PROXY_RESOLVER_WK_NO_PROXY[] = "no-proxy"; + +typedef struct { + GObject parent; +} SoupProxyResolverWk; + +typedef struct { + GObjectClass parent_class; +} SoupProxyResolverWkClass; + +GType soup_proxy_resolver_wk_get_type(void); + +SoupProxyURIResolver* soupProxyResolverWkNew(const char* httpProxy, const char* noProxy); + +G_END_DECLS + +#endif // ProxyResolverSoup_h diff --git a/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp b/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp index a8c2baa70..7aa6cccb8 100644 --- a/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp +++ b/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp @@ -116,12 +116,8 @@ void SocketStreamHandle::connected(GSocketConnection* socketConnection, GError* g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0, reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id); - // The client can close the handle, potentially removing the last reference. - RefPtr<SocketStreamHandle> protect(this); m_state = Open; m_client->didOpenSocketStream(this); - if (!m_socketConnection) // Client closed the connection. - return; } void SocketStreamHandle::readBytes(signed long bytesRead, GError* error) diff --git a/Source/WebCore/platform/qt/RenderThemeQt.cpp b/Source/WebCore/platform/qt/RenderThemeQt.cpp index 0f00ffca3..3badb6fcc 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQt.cpp @@ -50,7 +50,7 @@ #include "PaintInfo.h" #include "QWebPageClient.h" #include "RenderBox.h" -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderProgress.h" #endif #include "RenderTheme.h" @@ -372,7 +372,7 @@ void RenderThemeQt::adjustMenuListButtonStyle(StyleResolver*, RenderStyle* style setPopupPadding(style); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) double RenderThemeQt::animationRepeatIntervalForProgressBar(RenderProgress* renderProgress) const { if (renderProgress->position() >= 0) @@ -400,6 +400,20 @@ void RenderThemeQt::adjustSliderThumbStyle(StyleResolver* styleResolver, RenderS style->setBoxShadow(nullptr); } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeQt::sliderTickSize() const +{ + // FIXME: We need to set this to the size of one tick mark. + return IntSize(0, 0); +} + +int RenderThemeQt::sliderTickOffsetFromTrackCenter() const +{ + // FIXME: We need to set this to the position of the tick marks. + return 0; +} +#endif + bool RenderThemeQt::paintSearchField(RenderObject* o, const PaintInfo& pi, const IntRect& r) { diff --git a/Source/WebCore/platform/qt/RenderThemeQt.h b/Source/WebCore/platform/qt/RenderThemeQt.h index 122edc75e..a7379140a 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.h +++ b/Source/WebCore/platform/qt/RenderThemeQt.h @@ -34,7 +34,7 @@ QT_END_NAMESPACE namespace WebCore { -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) class RenderProgress; #endif class RenderStyle; @@ -82,6 +82,11 @@ public: virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif + virtual double caretBlinkInterval() const; virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color&) const; @@ -108,7 +113,7 @@ protected: virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; // Returns the repeat interval of the animation for the progress bar. virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp index 3d1f94245..ac0847832 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp @@ -36,7 +36,7 @@ #include "PaintInfo.h" #include "QWebPageClient.h" #include "RenderBox.h" -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderProgress.h" #endif #include "StyleResolver.h" @@ -69,7 +69,7 @@ static const float menuListPadding = 9; static const float textFieldPadding = 10; static const float radiusFactor = 0.36; static const float progressBarChunkPercentage = 0.2; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) static const int progressAnimationGranularity = 2; #endif static const float sliderGrooveBorderRatio = 0.2; @@ -822,7 +822,7 @@ bool RenderThemeQtMobile::paintMenuListButton(RenderObject* o, const PaintInfo& return false; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) double RenderThemeQtMobile::animationDurationForProgressBar(RenderProgress* renderProgress) const { if (renderProgress->isDeterminate()) diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.h b/Source/WebCore/platform/qt/RenderThemeQtMobile.h index 2d1e53dad..739e706ae 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.h +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.h @@ -71,7 +71,7 @@ protected: virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // Returns the duration of the animation for the progress bar. virtual double animationDurationForProgressBar(RenderProgress*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); diff --git a/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp b/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp index 3d49abe17..3f2f572ad 100644 --- a/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp +++ b/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp @@ -31,7 +31,6 @@ namespace WebCore { -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) inline void removeTopLevelDomain(QString* domain, const QString& topLevelDomain) { domain->remove(domain->length() - topLevelDomain.length(), topLevelDomain.length()); @@ -57,11 +56,9 @@ static bool urlsShareSameDomain(const QUrl& url, const QUrl& firstPartyUrl) return false; } -#endif bool thirdPartyCookiePolicyPermits(NetworkingContext* context, const QUrl& url, const QUrl& firstPartyUrl) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) if (!context) return true; @@ -79,9 +76,6 @@ bool thirdPartyCookiePolicyPermits(NetworkingContext* context, const QUrl& url, return true; return context->thirdPartyCookiePolicyPermission(url); -#else - return true; -#endif } } diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp index 1363cfe60..4837cfb92 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp @@ -31,8 +31,8 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "PlatformSupport.h" #include "SQLiteDatabase.h" +#include <public/Platform.h> #include <sqlite3.h> #include <wtf/text/CString.h> @@ -92,12 +92,12 @@ bool SQLiteFileSystem::deleteEmptyDatabaseDirectory(const String&) bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName) { - return (PlatformSupport::databaseDeleteFile(fileName) == SQLITE_OK); + return (WebKit::Platform::current()->databaseDeleteFile(fileName, false) == SQLITE_OK); } long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName) { - return PlatformSupport::databaseGetFileSize(fileName); + return WebKit::Platform::current()->databaseGetFileSize(fileName); } } // namespace WebCore diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp index bdd7f2613..b7b11535f 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "PlatformSupport.h" +#include <public/Platform.h> #include <sqlite3.h> #include <fcntl.h> @@ -69,10 +69,10 @@ int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, return result; if (fd < 0) { - fd = PlatformSupport::databaseOpenFile(fileName, desiredFlags); + fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags); if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) { int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY; - fd = PlatformSupport::databaseOpenFile(fileName, newFlags); + fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), newFlags); } } if (fd < 0) { @@ -103,7 +103,7 @@ int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, // should be synched after the file is deleted. int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) { - return PlatformSupport::databaseDeleteFile(fileName, syncDir); + return WebKit::Platform::current()->databaseDeleteFile(String(fileName), syncDir); } // Check the existance and status of the given file. @@ -114,7 +114,7 @@ int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) // res - the result. int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) { - int attr = static_cast<int>(PlatformSupport::databaseGetFileAttributes(fileName)); + int attr = static_cast<int>(WebKit::Platform::current()->databaseGetFileAttributes(String(fileName))); if (attr < 0) { *res = 0; return SQLITE_OK; diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp index 3c0166ac8..f95061cbe 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "PlatformSupport.h" +#include <public/Platform.h> #include <sqlite3.h> #include <windows.h> @@ -55,7 +55,7 @@ namespace { int chromiumOpen(sqlite3_vfs*, const char* fileName, sqlite3_file* id, int desiredFlags, int* usedFlags) { - HANDLE h = PlatformSupport::databaseOpenFile(fileName, desiredFlags); + HANDLE h = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags); if (h == INVALID_HANDLE_VALUE) { if (desiredFlags & SQLITE_OPEN_READWRITE) { int newFlags = (desiredFlags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE; @@ -82,7 +82,7 @@ int chromiumOpen(sqlite3_vfs*, const char* fileName, // should be synched after the file is deleted. int chromiumDelete(sqlite3_vfs*, const char* fileName, int) { - return PlatformSupport::databaseDeleteFile(fileName); + return WebKit::Platform::current()->databaseDeleteFile(String(fileName), false); } // Check the existance and status of the given file. @@ -93,7 +93,7 @@ int chromiumDelete(sqlite3_vfs*, const char* fileName, int) // res - the result. int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) { - DWORD attr = PlatformSupport::databaseGetFileAttributes(fileName); + DWORD attr = WebKit::Platform::current()->databaseGetFileAttributes(String(fileName)); switch (flag) { case SQLITE_ACCESS_READ: case SQLITE_ACCESS_EXISTS: diff --git a/Source/WebCore/platform/text/TextCodecASCIIFastPath.h b/Source/WebCore/platform/text/TextCodecASCIIFastPath.h index 4ed99836a..7d57677fc 100644 --- a/Source/WebCore/platform/text/TextCodecASCIIFastPath.h +++ b/Source/WebCore/platform/text/TextCodecASCIIFastPath.h @@ -33,6 +33,11 @@ namespace WebCore { template<size_t size> struct UCharByteFiller; template<> struct UCharByteFiller<4> { + static void copy(LChar* destination, const uint8_t* source) + { + memcpy(destination, source, 4); + } + static void copy(UChar* destination, const uint8_t* source) { destination[0] = source[0]; @@ -42,6 +47,11 @@ template<> struct UCharByteFiller<4> { } }; template<> struct UCharByteFiller<8> { + static void copy(LChar* destination, const uint8_t* source) + { + memcpy(destination, source, 8); + } + static void copy(UChar* destination, const uint8_t* source) { destination[0] = source[0]; @@ -55,6 +65,11 @@ template<> struct UCharByteFiller<8> { } }; +inline void copyASCIIMachineWord(LChar* destination, const uint8_t* source) +{ + UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); +} + inline void copyASCIIMachineWord(UChar* destination, const uint8_t* source) { UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); diff --git a/Source/WebCore/platform/text/TextCodecLatin1.cpp b/Source/WebCore/platform/text/TextCodecLatin1.cpp index 9ac9aeba1..d3a202773 100644 --- a/Source/WebCore/platform/text/TextCodecLatin1.cpp +++ b/Source/WebCore/platform/text/TextCodecLatin1.cpp @@ -120,13 +120,15 @@ void TextCodecLatin1::registerCodecs(TextCodecRegistrar registrar) String TextCodecLatin1::decode(const char* bytes, size_t length, bool, bool, bool&) { - UChar* characters; + LChar* characters; + if (!length) + return emptyString(); String result = String::createUninitialized(length, characters); const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); const uint8_t* end = reinterpret_cast<const uint8_t*>(bytes + length); const uint8_t* alignedEnd = alignToMachineWord(end); - UChar* destination = characters; + LChar* destination = characters; while (source < end) { if (isASCII(*source)) { @@ -149,6 +151,9 @@ String TextCodecLatin1::decode(const char* bytes, size_t length, bool, bool, boo *destination = *source; } else { useLookupTable: + if (table[*source] > 0xff) + goto upConvertTo16Bit; + *destination = table[*source]; } @@ -157,6 +162,54 @@ useLookupTable: } return result; + +upConvertTo16Bit: + UChar* characters16; + String result16 = String::createUninitialized(length, characters16); + + UChar* destination16 = characters16; + + // Zero extend and copy already processed 8 bit data + LChar* ptr8 = characters; + LChar* endPtr8 = destination; + + while (ptr8 < endPtr8) + *destination16++ = *ptr8++; + + // Handle the character that triggered the 16 bit path + *destination16 = table[*source]; + ++source; + ++destination16; + + while (source < end) { + if (isASCII(*source)) { + // Fast path for ASCII. Most Latin-1 text will be ASCII. + if (isAlignedToMachineWord(source)) { + while (source < alignedEnd) { + MachineWord chunk = *reinterpret_cast_ptr<const MachineWord*>(source); + + if (!isAllASCII<LChar>(chunk)) + goto useLookupTable16; + + copyASCIIMachineWord(destination16, source); + source += sizeof(MachineWord); + destination16 += sizeof(MachineWord); + } + + if (source == end) + break; + } + *destination16 = *source; + } else { +useLookupTable16: + *destination16 = table[*source]; + } + + ++source; + ++destination16; + } + + return result16; } static CString encodeComplexWindowsLatin1(const UChar* characters, size_t length, UnencodableHandling handling) diff --git a/Source/WebCore/platform/text/TextCodecUTF8.cpp b/Source/WebCore/platform/text/TextCodecUTF8.cpp index 206f25f08..f7376acac 100644 --- a/Source/WebCore/platform/text/TextCodecUTF8.cpp +++ b/Source/WebCore/platform/text/TextCodecUTF8.cpp @@ -167,7 +167,51 @@ void TextCodecUTF8::handleError(UChar*& destination, bool stopOnError, bool& saw consumePartialSequenceByte(); } -void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError) +template <> +bool TextCodecUTF8::handlePartialSequence<LChar>(LChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool, bool&) +{ + ASSERT(m_partialSequenceSize); + do { + if (isASCII(m_partialSequence[0])) { + *destination++ = m_partialSequence[0]; + consumePartialSequenceByte(); + continue; + } + int count = nonASCIISequenceLength(m_partialSequence[0]); + if (!count) + return true; + + if (count > m_partialSequenceSize) { + if (count - m_partialSequenceSize > end - source) { + if (!flush) { + // The new data is not enough to complete the sequence, so + // add it to the existing partial sequence. + memcpy(m_partialSequence + m_partialSequenceSize, source, end - source); + m_partialSequenceSize += end - source; + return false; + } + // An incomplete partial sequence at the end is an error, but it will create + // a 16 bit string due to the replacementCharacter. Let the 16 bit path handle + // the error. + return true; + } + memcpy(m_partialSequence + m_partialSequenceSize, source, count - m_partialSequenceSize); + source += count - m_partialSequenceSize; + m_partialSequenceSize = count; + } + int character = decodeNonASCIISequence(m_partialSequence, count); + if ((character == nonCharacter) || (character > 0xff)) + return true; + + m_partialSequenceSize -= count; + *destination++ = character; + } while (m_partialSequenceSize); + + return false; +} + +template <> +bool TextCodecUTF8::handlePartialSequence<UChar>(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError) { ASSERT(m_partialSequenceSize); do { @@ -180,7 +224,7 @@ void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& s if (!count) { handleError(destination, stopOnError, sawError); if (stopOnError) - return; + return false; continue; } if (count > m_partialSequenceSize) { @@ -190,12 +234,12 @@ void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& s // add it to the existing partial sequence. memcpy(m_partialSequence + m_partialSequenceSize, source, end - source); m_partialSequenceSize += end - source; - return; + return false; } // An incomplete partial sequence at the end is an error. handleError(destination, stopOnError, sawError); if (stopOnError) - return; + return false; continue; } memcpy(m_partialSequence + m_partialSequenceSize, source, count - m_partialSequenceSize); @@ -206,34 +250,40 @@ void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& s if (character == nonCharacter) { handleError(destination, stopOnError, sawError); if (stopOnError) - return; + return false; continue; } + m_partialSequenceSize -= count; destination = appendCharacter(destination, character); } while (m_partialSequenceSize); -} + return false; +} + String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool stopOnError, bool& sawError) { // Each input byte might turn into a character. // That includes all bytes in the partial-sequence buffer because // each byte in an invalid sequence will turn into a replacement character. - StringBuffer<UChar> buffer(m_partialSequenceSize + length); + StringBuffer<LChar> buffer(m_partialSequenceSize + length); const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); const uint8_t* end = source + length; const uint8_t* alignedEnd = alignToMachineWord(end); - UChar* destination = buffer.characters(); + LChar* destination = buffer.characters(); do { if (m_partialSequenceSize) { // Explicitly copy destination and source pointers to avoid taking pointers to the // local variables, which may harm code generation by disabling some optimizations // in some compilers. - UChar* destinationForHandlePartialSequence = destination; + LChar* destinationForHandlePartialSequence = destination; const uint8_t* sourceForHandlePartialSequence = source; - handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush, stopOnError, sawError); + if (handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush, stopOnError, sawError)) { + source = sourceForHandlePartialSequence; + goto upConvertTo16Bit; + } destination = destinationForHandlePartialSequence; source = sourceForHandlePartialSequence; if (m_partialSequenceSize) @@ -279,19 +329,96 @@ String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool sawError = true; if (stopOnError) break; - // Each error generates a replacement character and consumes one byte. - *destination++ = replacementCharacter; - ++source; - continue; + + goto upConvertTo16Bit; } + if (character > 0xff) + goto upConvertTo16Bit; + source += count; - destination = appendCharacter(destination, character); + *destination++ = character; } } while (flush && m_partialSequenceSize); buffer.shrink(destination - buffer.characters()); return String::adopt(buffer); + +upConvertTo16Bit: + StringBuffer<UChar> buffer16(m_partialSequenceSize + length); + + UChar* destination16 = buffer16.characters(); + + // Copy the already converted characters + for (LChar* converted8 = buffer.characters(); converted8 < destination;) + *destination16++ = *converted8++; + + do { + if (m_partialSequenceSize) { + // Explicitly copy destination and source pointers to avoid taking pointers to the + // local variables, which may harm code generation by disabling some optimizations + // in some compilers. + UChar* destinationForHandlePartialSequence = destination16; + const uint8_t* sourceForHandlePartialSequence = source; + handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush, stopOnError, sawError); + destination16 = destinationForHandlePartialSequence; + source = sourceForHandlePartialSequence; + if (m_partialSequenceSize) + break; + } + + while (source < end) { + if (isASCII(*source)) { + // Fast path for ASCII. Most UTF-8 text will be ASCII. + if (isAlignedToMachineWord(source)) { + while (source < alignedEnd) { + MachineWord chunk = *reinterpret_cast_ptr<const MachineWord*>(source); + if (!isAllASCII<LChar>(chunk)) + break; + copyASCIIMachineWord(destination16, source); + source += sizeof(MachineWord); + destination16 += sizeof(MachineWord); + } + if (source == end) + break; + if (!isASCII(*source)) + continue; + } + *destination16++ = *source++; + continue; + } + int count = nonASCIISequenceLength(*source); + int character; + if (!count) + character = nonCharacter; + else { + if (count > end - source) { + ASSERT(end - source < static_cast<ptrdiff_t>(sizeof(m_partialSequence))); + ASSERT(!m_partialSequenceSize); + m_partialSequenceSize = end - source; + memcpy(m_partialSequence, source, m_partialSequenceSize); + source = end; + break; + } + character = decodeNonASCIISequence(source, count); + } + if (character == nonCharacter) { + sawError = true; + if (stopOnError) + break; + // Each error generates a replacement character and consumes one byte. + *destination16++ = replacementCharacter; + ++source; + continue; + } + source += count; + destination16 = appendCharacter(destination16, character); + } + } while (flush && m_partialSequenceSize); + + buffer16.shrink(destination16 - buffer16.characters()); + + return String::adopt(buffer16); } CString TextCodecUTF8::encode(const UChar* characters, size_t length, UnencodableHandling) diff --git a/Source/WebCore/platform/text/TextCodecUTF8.h b/Source/WebCore/platform/text/TextCodecUTF8.h index 39fd75361..270cf298f 100644 --- a/Source/WebCore/platform/text/TextCodecUTF8.h +++ b/Source/WebCore/platform/text/TextCodecUTF8.h @@ -42,7 +42,8 @@ private: virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError); virtual CString encode(const UChar*, size_t length, UnencodableHandling); - void handlePartialSequence(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError); + template <typename CharType> + bool handlePartialSequence(CharType*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError); void handleError(UChar*& destination, bool stopOnError, bool& sawError); void consumePartialSequenceByte(); diff --git a/Source/WebCore/platform/text/TextEncoding.cpp b/Source/WebCore/platform/text/TextEncoding.cpp index 26ab82a5c..e3d372a1e 100644 --- a/Source/WebCore/platform/text/TextEncoding.cpp +++ b/Source/WebCore/platform/text/TextEncoding.cpp @@ -125,7 +125,7 @@ CString TextEncoding::encode(const UChar* characters, size_t length, Unencodable UTF16Normalized.set(g_utf8_to_utf16(UTF8Normalized.get(), -1, 0, &UTF16Length, 0)); return newTextCodec(*this)->encode(UTF16Normalized.get(), UTF16Length, handling); -#elif OS(WINCE) +#elif USE(WINCE_UNICODE) // normalization will be done by Windows CE API OwnPtr<TextCodec> textCodec = newTextCodec(*this); return textCodec.get() ? textCodec->encode(characters, length, handling) : CString(); diff --git a/Source/WebCore/platform/text/TextEncodingRegistry.cpp b/Source/WebCore/platform/text/TextEncodingRegistry.cpp index 05150052f..8281538bf 100644 --- a/Source/WebCore/platform/text/TextEncodingRegistry.cpp +++ b/Source/WebCore/platform/text/TextEncodingRegistry.cpp @@ -45,13 +45,13 @@ #if PLATFORM(MAC) #include "TextCodecMac.h" #endif -#if PLATFORM(QT) +#if USE(QT4_UNICODE) #include "qt/TextCodecQt.h" #endif #if USE(GLIB_UNICODE) #include "gtk/TextCodecGtk.h" #endif -#if OS(WINCE) && !PLATFORM(QT) +#if USE(WINCE_UNICODE) #include "TextCodecWinCE.h" #endif @@ -311,7 +311,7 @@ static void extendTextCodecMaps() TextCodecGtk::registerExtendedCodecs(addToTextCodecMap); #endif -#if OS(WINCE) && !PLATFORM(QT) +#if USE(WINCE_UNICODE) TextCodecWinCE::registerExtendedEncodingNames(addToTextEncodingNameMap); TextCodecWinCE::registerExtendedCodecs(addToTextCodecMap); #endif diff --git a/Source/WebCore/platform/text/mac/ShapeArabic.c b/Source/WebCore/platform/text/mac/ShapeArabic.c deleted file mode 100644 index dd61ce596..000000000 --- a/Source/WebCore/platform/text/mac/ShapeArabic.c +++ /dev/null @@ -1,556 +0,0 @@ -/* -****************************************************************************** -* -* Copyright (C) 2000-2004, International Business Machines -* Corporation and others. All Rights Reserved. -* Copyright (C) 2007 Apple Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this -* software and associated documentation files (the "Software"), to deal in the Software -* without restriction, including without limitation the rights to use, copy, modify, -* merge, publish, distribute, and/or sell copies of the Software, and to permit persons -* to whom the Software is furnished to do so, provided that the above copyright notice(s) -* and this permission notice appear in all copies of the Software and that both the above -* copyright notice(s) and this permission notice appear in supporting documentation. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -* PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER -* OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -* CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -* -* Except as contained in this notice, the name of a copyright holder shall not be used in -* advertising or otherwise to promote the sale, use or other dealings in this Software -* without prior written authorization of the copyright holder. -* -****************************************************************************** -* -* Arabic letter shaping implemented by Ayman Roshdy -*/ - -#include "config.h" - -#if USE(ATSUI) - -#include "ShapeArabic.h" - -#include <stdbool.h> -#include <string.h> -#include <unicode/utypes.h> -#include <unicode/uchar.h> -#include <unicode/ustring.h> -#include <unicode/ushape.h> -#include <wtf/Assertions.h> - -/* - * ### TODO in general for letter shaping: - * - the letter shaping code is UTF-16-unaware; needs update - * + especially invertBuffer()?! - * - needs to handle the "Arabic Tail" that is used in some legacy codepages - * as a glyph fragment of wide-glyph letters - * + IBM Unicode conversion tables map it to U+200B (ZWSP) - * + IBM Egypt has proposed to encode the tail in Unicode among Arabic Presentation Forms - */ - -/* definitions for Arabic letter shaping ------------------------------------ */ - -#define IRRELEVANT 4 -#define LAMTYPE 16 -#define ALEFTYPE 32 -#define LINKR 1 -#define LINKL 2 - -static const UChar IrrelevantPos[] = { - 0x0, 0x2, 0x4, 0x6, - 0x8, 0xA, 0xC, 0xE, -}; - -static const UChar araLink[178]= -{ - 1 + 32 + 256 * 0x11,/*0x0622*/ - 1 + 32 + 256 * 0x13,/*0x0623*/ - 1 + 256 * 0x15,/*0x0624*/ - 1 + 32 + 256 * 0x17,/*0x0625*/ - 1 + 2 + 256 * 0x19,/*0x0626*/ - 1 + 32 + 256 * 0x1D,/*0x0627*/ - 1 + 2 + 256 * 0x1F,/*0x0628*/ - 1 + 256 * 0x23,/*0x0629*/ - 1 + 2 + 256 * 0x25,/*0x062A*/ - 1 + 2 + 256 * 0x29,/*0x062B*/ - 1 + 2 + 256 * 0x2D,/*0x062C*/ - 1 + 2 + 256 * 0x31,/*0x062D*/ - 1 + 2 + 256 * 0x35,/*0x062E*/ - 1 + 256 * 0x39,/*0x062F*/ - 1 + 256 * 0x3B,/*0x0630*/ - 1 + 256 * 0x3D,/*0x0631*/ - 1 + 256 * 0x3F,/*0x0632*/ - 1 + 2 + 256 * 0x41,/*0x0633*/ - 1 + 2 + 256 * 0x45,/*0x0634*/ - 1 + 2 + 256 * 0x49,/*0x0635*/ - 1 + 2 + 256 * 0x4D,/*0x0636*/ - 1 + 2 + 256 * 0x51,/*0x0637*/ - 1 + 2 + 256 * 0x55,/*0x0638*/ - 1 + 2 + 256 * 0x59,/*0x0639*/ - 1 + 2 + 256 * 0x5D,/*0x063A*/ - 0, 0, 0, 0, 0, /*0x063B-0x063F*/ - 1 + 2, /*0x0640*/ - 1 + 2 + 256 * 0x61,/*0x0641*/ - 1 + 2 + 256 * 0x65,/*0x0642*/ - 1 + 2 + 256 * 0x69,/*0x0643*/ - 1 + 2 + 16 + 256 * 0x6D,/*0x0644*/ - 1 + 2 + 256 * 0x71,/*0x0645*/ - 1 + 2 + 256 * 0x75,/*0x0646*/ - 1 + 2 + 256 * 0x79,/*0x0647*/ - 1 + 256 * 0x7D,/*0x0648*/ - 1 + 256 * 0x7F,/*0x0649*/ - 1 + 2 + 256 * 0x81,/*0x064A*/ - 4, 4, 4, 4, /*0x064B-0x064E*/ - 4, 4, 4, 4, /*0x064F-0x0652*/ - 4, 4, 4, 0, 0, /*0x0653-0x0657*/ - 0, 0, 0, 0, /*0x0658-0x065B*/ - 1 + 256 * 0x85,/*0x065C*/ - 1 + 256 * 0x87,/*0x065D*/ - 1 + 256 * 0x89,/*0x065E*/ - 1 + 256 * 0x8B,/*0x065F*/ - 0, 0, 0, 0, 0, /*0x0660-0x0664*/ - 0, 0, 0, 0, 0, /*0x0665-0x0669*/ - 0, 0, 0, 0, 0, 0, /*0x066A-0x066F*/ - 4, /*0x0670*/ - 0, /*0x0671*/ - 1 + 32, /*0x0672*/ - 1 + 32, /*0x0673*/ - 0, /*0x0674*/ - 1 + 32, /*0x0675*/ - 1, 1, /*0x0676-0x0677*/ - 1+2, /*0x0678*/ - 1+2 + 256 * 0x16,/*0x0679*/ - 1+2 + 256 * 0x0E,/*0x067A*/ - 1+2 + 256 * 0x02,/*0x067B*/ - 1+2, 1+2, /*0x067C-0x067D*/ - 1+2 + 256 * 0x06,/*0x067E*/ - 1+2 + 256 * 0x12,/*0x067F*/ - 1+2 + 256 * 0x0A,/*0x0680*/ - 1+2, 1+2, /*0x0681-0x0682*/ - 1+2 + 256 * 0x26,/*0x0683*/ - 1+2 + 256 * 0x22,/*0x0684*/ - 1+2, /*0x0685*/ - 1+2 + 256 * 0x2A,/*0x0686*/ - 1+2 + 256 * 0x2E,/*0x0687*/ - 1 + 256 * 0x38,/*0x0688*/ - 1, 1, 1, /*0x0689-0x068B*/ - 1 + 256 * 0x34,/*0x068C*/ - 1 + 256 * 0x32,/*0x068D*/ - 1 + 256 * 0x36,/*0x068E*/ - 1, 1, /*0x068F-0x0690*/ - 1 + 256 * 0x3C,/*0x0691*/ - 1, 1, 1, 1, 1, 1, /*0x0692-0x0697*/ - 1 + 256 * 0x3A,/*0x0698*/ - 1, /*0x0699*/ - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, /*0x069A-0x069F*/ - 1+2, 1+2, 1+2, 1+2, /*0x06A0-0x06A3*/ - 1+2 + 256 * 0x2E,/*0x06A4*/ - 1+2, /*0x06A5*/ - 1+2 + 256 * 0x1E,/*0x06A6*/ - 1+2, 1+2, /*0x06A7-0x06A8*/ - 1+2 + 256 * 0x3E,/*0x06A9*/ - 1+2, 1+2, 1+2, /*0x06AA-0x06AC*/ - 1+2 + 256 * 0x83,/*0x06AD*/ - 1+2, /*0x06AE*/ - 1+2 + 256 * 0x42,/*0x06AF*/ - 1+2, /*0x06B0*/ - 1+2 + 256 * 0x4A,/*0x06B1*/ - 1+2, /*0x06B2*/ - 1+2 + 256 * 0x46,/*0x06B3*/ - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, /*0x06B4-0x06B9*/ - 1+2, /*0x06BA*/ // FIXME: Seems to have a final form - 1+2 + 256 * 0x50,/*0x06BB*/ - 1+2, 1+2, /*0x06BC-0x06BD*/ - 1+2 + 256 * 0x5A,/*0x06BE*/ - 1+2, /*0x06BF*/ - 1, /*0x06C0*/ - 1+2 + 256 * 0x56,/*0x06C1*/ - 1+2, /*0x06C2*/ - 1, 1, /*0x06C3-0x06C4*/ - 1 + 256 * 0x90,/*0x06C5*/ - 1 + 256 * 0x89,/*0x06C6*/ - 1 + 256 * 0x87,/*0x06C7*/ - 1 + 256 * 0x8B,/*0x06C8*/ - 1 + 256 * 0x92,/*0x06C9*/ - 1, /*0x06CA*/ - 1 + 256 * 0x8E,/*0x06CB*/ - 1+2 + 256 * 0xAC,/*0x06CC*/ - 1, /*0x06CD*/ - 1+2, /*0x06CE*/ - 1, /*0x06CF*/ - 1+2 + 256 * 0x94,/*0x06D0*/ - 1+2, /*0x06D1*/ - 1 + 256 * 0x5E,/*0x06D2*/ - 1 + 256 * 0x60 /*0x06D3*/ -}; - -static const UChar presLink[141]= -{ - 1 + 2, /*0xFE70*/ - 1 + 2, /*0xFE71*/ - 1 + 2, 0, 1+ 2, 0, 1+ 2, /*0xFE72-0xFE76*/ - 1 + 2, /*0xFE77*/ - 1+ 2, 1 + 2, 1+2, 1 + 2, /*0xFE78-0xFE81*/ - 1+ 2, 1 + 2, 1+2, 1 + 2, /*0xFE82-0xFE85*/ - 0, 0 + 32, 1 + 32, 0 + 32, /*0xFE86-0xFE89*/ - 1 + 32, 0, 1, 0 + 32, /*0xFE8A-0xFE8D*/ - 1 + 32, 0, 2, 1 + 2, /*0xFE8E-0xFE91*/ - 1, 0 + 32, 1 + 32, 0, /*0xFE92-0xFE95*/ - 2, 1 + 2, 1, 0, /*0xFE96-0xFE99*/ - 1, 0, 2, 1 + 2, /*0xFE9A-0xFE9D*/ - 1, 0, 2, 1 + 2, /*0xFE9E-0xFEA1*/ - 1, 0, 2, 1 + 2, /*0xFEA2-0xFEA5*/ - 1, 0, 2, 1 + 2, /*0xFEA6-0xFEA9*/ - 1, 0, 2, 1 + 2, /*0xFEAA-0xFEAD*/ - 1, 0, 1, 0, /*0xFEAE-0xFEB1*/ - 1, 0, 1, 0, /*0xFEB2-0xFEB5*/ - 1, 0, 2, 1+2, /*0xFEB6-0xFEB9*/ - 1, 0, 2, 1+2, /*0xFEBA-0xFEBD*/ - 1, 0, 2, 1+2, /*0xFEBE-0xFEC1*/ - 1, 0, 2, 1+2, /*0xFEC2-0xFEC5*/ - 1, 0, 2, 1+2, /*0xFEC6-0xFEC9*/ - 1, 0, 2, 1+2, /*0xFECA-0xFECD*/ - 1, 0, 2, 1+2, /*0xFECE-0xFED1*/ - 1, 0, 2, 1+2, /*0xFED2-0xFED5*/ - 1, 0, 2, 1+2, /*0xFED6-0xFED9*/ - 1, 0, 2, 1+2, /*0xFEDA-0xFEDD*/ - 1, 0, 2, 1+2, /*0xFEDE-0xFEE1*/ - 1, 0 + 16, 2 + 16, 1 + 2 +16, /*0xFEE2-0xFEE5*/ - 1 + 16, 0, 2, 1+2, /*0xFEE6-0xFEE9*/ - 1, 0, 2, 1+2, /*0xFEEA-0xFEED*/ - 1, 0, 2, 1+2, /*0xFEEE-0xFEF1*/ - 1, 0, 1, 0, /*0xFEF2-0xFEF5*/ - 1, 0, 2, 1+2, /*0xFEF6-0xFEF9*/ - 1, 0, 1, 0, /*0xFEFA-0xFEFD*/ - 1, 0, 1, 0, - 1 -}; - -static const UChar convertFEto06[] = -{ -/***********0******1******2******3******4******5******6******7******8******9******A******B******C******D******E******F***/ -/*FE7*/ 0x64B, 0x64B, 0x64C, 0x64C, 0x64D, 0x64D, 0x64E, 0x64E, 0x64F, 0x64F, 0x650, 0x650, 0x651, 0x651, 0x652, 0x652, -/*FE8*/ 0x621, 0x622, 0x622, 0x623, 0x623, 0x624, 0x624, 0x625, 0x625, 0x626, 0x626, 0x626, 0x626, 0x627, 0x627, 0x628, -/*FE9*/ 0x628, 0x628, 0x628, 0x629, 0x629, 0x62A, 0x62A, 0x62A, 0x62A, 0x62B, 0x62B, 0x62B, 0x62B, 0x62C, 0x62C, 0x62C, -/*FEA*/ 0x62C, 0x62D, 0x62D, 0x62D, 0x62D, 0x62E, 0x62E, 0x62E, 0x62E, 0x62F, 0x62F, 0x630, 0x630, 0x631, 0x631, 0x632, -/*FEB*/ 0x632, 0x633, 0x633, 0x633, 0x633, 0x634, 0x634, 0x634, 0x634, 0x635, 0x635, 0x635, 0x635, 0x636, 0x636, 0x636, -/*FEC*/ 0x636, 0x637, 0x637, 0x637, 0x637, 0x638, 0x638, 0x638, 0x638, 0x639, 0x639, 0x639, 0x639, 0x63A, 0x63A, 0x63A, -/*FED*/ 0x63A, 0x641, 0x641, 0x641, 0x641, 0x642, 0x642, 0x642, 0x642, 0x643, 0x643, 0x643, 0x643, 0x644, 0x644, 0x644, -/*FEE*/ 0x644, 0x645, 0x645, 0x645, 0x645, 0x646, 0x646, 0x646, 0x646, 0x647, 0x647, 0x647, 0x647, 0x648, 0x648, 0x649, -/*FEF*/ 0x649, 0x64A, 0x64A, 0x64A, 0x64A, 0x65C, 0x65C, 0x65D, 0x65D, 0x65E, 0x65E, 0x65F, 0x65F -}; - -static const UChar shapeTable[4][4][4]= -{ - { {0,0,0,0}, {0,0,0,0}, {0,1,0,3}, {0,1,0,1} }, - { {0,0,2,2}, {0,0,1,2}, {0,1,1,2}, {0,1,1,3} }, - { {0,0,0,0}, {0,0,0,0}, {0,1,0,3}, {0,1,0,3} }, - { {0,0,1,2}, {0,0,1,2}, {0,1,1,2}, {0,1,1,3} } -}; - -/* - *Name : changeLamAlef - *Function : Converts the Alef characters into an equivalent - * LamAlef location in the 0x06xx Range, this is an - * intermediate stage in the operation of the program - * later it'll be converted into the 0xFExx LamAlefs - * in the shaping function. - */ -static UChar -changeLamAlef(UChar ch) { - - switch(ch) { - case 0x0622 : - return(0x065C); - break; - case 0x0623 : - return(0x065D); - break; - case 0x0625 : - return(0x065E); - break; - case 0x0627 : - return(0x065F); - break; - default : - return(0); - break; - } -} - -/* - *Name : specialChar - *Function : Special Arabic characters need special handling in the shapeUnicode - * function, this function returns 1 or 2 for these special characters - */ -static int32_t -specialChar(UChar ch) { - - if( (ch>0x0621 && ch<0x0626)||(ch==0x0627)||(ch>0x062e && ch<0x0633)|| - (ch>0x0647 && ch<0x064a)||(ch==0x0629) ) { - return (1); - } - else - if( ch>=0x064B && ch<= 0x0652 ) - return (2); - else - if( (ch>=0x0653 && ch<= 0x0655) || ch == 0x0670 || - (ch>=0xFE70 && ch<= 0xFE7F) ) - return (3); - else - return (0); -} - -/* - *Name : getLink - *Function : Resolves the link between the characters as - * Arabic characters have four forms : - * Isolated, Initial, Middle and Final Form - */ -static UChar -getLink(UChar ch) { - - if(ch >= 0x0622 && ch <= 0x06D3) { - return(araLink[ch-0x0622]); - } else if(ch == 0x200D) { - return(3); - } else if(ch >= 0x206D && ch <= 0x206F) { - return(4); - } else if(ch >= 0xFE70 && ch <= 0xFEFC) { - return(presLink[ch-0xFE70]); - } else { - return(0); - } -} - -/* - *Name : isTashkeelChar - *Function : Returns 1 for Tashkeel characters else return 0 - */ -static int32_t -isTashkeelChar(UChar ch) { - - if( ch>=0x064B && ch<= 0x0652 ) - return (1); - else - return (0); -} - -/* - *Name : shapeUnicode - *Function : Converts an Arabic Unicode buffer in 06xx Range into a shaped - * arabic Unicode buffer in FExx Range - */ -static int32_t -shapeUnicode(UChar *dest, int32_t sourceLength, - int32_t destSize, - int tashkeelFlag) { - - int32_t i, iend; - int32_t prevPos, lastPos,Nx, Nw; - unsigned int Shape; - int32_t flag; - int32_t lamalef_found = 0; - UChar prevLink = 0, lastLink = 0, currLink, nextLink = 0; - UChar wLamalef; - - /* - * Converts the input buffer from FExx Range into 06xx Range - * to make sure that all characters are in the 06xx range - * even the lamalef is converted to the special region in - * the 06xx range - */ - for (i = 0; i < sourceLength; i++) { - UChar inputChar = dest[i]; - if ( (inputChar >= 0xFE70) && (inputChar <= 0xFEFC)) { - dest[i] = convertFEto06 [ (inputChar - 0xFE70) ] ; - } - } - - /* sets the index to the end of the buffer, together with the step point to -1 */ - i = 0; - iend = sourceLength; - - /* - * This function resolves the link between the characters . - * Arabic characters have four forms : - * Isolated Form, Initial Form, Middle Form and Final Form - */ - currLink = getLink(dest[i]); - - prevPos = i; - lastPos = i; - Nx = sourceLength + 2, Nw = 0; - - while (i != iend) { - /* If high byte of currLink > 0 then more than one shape */ - if ((currLink & 0xFF00) > 0 || isTashkeelChar(dest[i])) { - Nw = i + 1; - while (Nx >= sourceLength) { /* we need to know about next char */ - if(Nw == iend) { - nextLink = 0; - Nx = -1; - } else { - nextLink = getLink(dest[Nw]); - if((nextLink & IRRELEVANT) == 0) { - Nx = Nw; - } else { - Nw = Nw + 1; - } - } - } - - if ( ((currLink & ALEFTYPE) > 0) && ((lastLink & LAMTYPE) > 0) ) { - lamalef_found = 1; - wLamalef = changeLamAlef(dest[i]); /*get from 0x065C-0x065f */ - if ( wLamalef != 0) { - dest[i] = ' '; /* The default case is to drop the Alef and replace */ - dest[lastPos] =wLamalef; /* it by a space. */ - i=lastPos; - } - lastLink = prevLink; - currLink = getLink(wLamalef); - } - /* - * get the proper shape according to link ability of neighbors - * and of character; depends on the order of the shapes - * (isolated, initial, middle, final) in the compatibility area - */ - flag = specialChar(dest[i]); - - Shape = shapeTable[nextLink & (LINKR + LINKL)] - [lastLink & (LINKR + LINKL)] - [currLink & (LINKR + LINKL)]; - - if (flag == 1) { - Shape = (Shape == 1 || Shape == 3) ? 1 : 0; - } - else - if(flag == 2) { - if( (lastLink & LINKL) && (nextLink & LINKR) && (tashkeelFlag == 1) && - dest[i] != 0x064C && dest[i] != 0x064D ) { - Shape = 1; - if( (nextLink&ALEFTYPE) == ALEFTYPE && (lastLink&LAMTYPE) == LAMTYPE ) - Shape = 0; - } - else { - Shape = 0; - } - } - - if(flag == 2) { - dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + Shape; - } - else - dest[i] = (UChar)((dest[i] < 0x0670 ? 0xFE70 : 0xFB50) + (currLink >> 8) + Shape); - } - - /* move one notch forward */ - if ((currLink & IRRELEVANT) == 0) { - prevLink = lastLink; - lastLink = currLink; - prevPos = lastPos; - lastPos = i; - } - - i++; - if (i == Nx) { - currLink = nextLink; - Nx = sourceLength + 2; - } - else if(i != iend) { - currLink = getLink(dest[i]); - } - } - - destSize = sourceLength; - - return destSize; -} - -int32_t shapeArabic(const UChar *source, int32_t sourceLength, UChar *dest, int32_t destCapacity, uint32_t options, UErrorCode *pErrorCode) { - int32_t destLength; - - /* usual error checking */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return 0; - } - - /* make sure that no reserved options values are used; allow dest==NULL only for preflighting */ - if( source==NULL || sourceLength<-1 || - (dest==NULL && destCapacity!=0) || destCapacity<0 || - options>=U_SHAPE_DIGIT_TYPE_RESERVED || - (options&U_SHAPE_DIGITS_MASK)>=U_SHAPE_DIGITS_RESERVED - ) { - *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - - /* determine the source length */ - if(sourceLength==-1) { - sourceLength=u_strlen(source); - } - if(sourceLength==0) { - return 0; - } - - /* check that source and destination do not overlap */ - if( dest!=NULL && - ((source<=dest && dest<source+sourceLength) || - (dest<=source && source<dest+destCapacity)) - ) { - *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - - if((options&U_SHAPE_LETTERS_MASK)!=U_SHAPE_LETTERS_NOOP) { - int32_t outputSize = sourceLength; - - /* calculate destination size */ - /* TODO: do we ever need to do this pure preflighting? */ - ASSERT((options&U_SHAPE_LENGTH_MASK) != U_SHAPE_LENGTH_GROW_SHRINK); - - if(outputSize>destCapacity) { - *pErrorCode=U_BUFFER_OVERFLOW_ERROR; - return outputSize; - } - - /* Start of Arabic letter shaping part */ - memcpy(dest, source, sourceLength*U_SIZEOF_UCHAR); - - ASSERT((options&U_SHAPE_TEXT_DIRECTION_MASK) == U_SHAPE_TEXT_DIRECTION_LOGICAL); - - switch(options&U_SHAPE_LETTERS_MASK) { - case U_SHAPE_LETTERS_SHAPE : - /* Call the shaping function with tashkeel flag == 1 */ - destLength = shapeUnicode(dest,sourceLength,destCapacity,1); - break; - case U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED : - /* Call the shaping function with tashkeel flag == 0 */ - destLength = shapeUnicode(dest,sourceLength,destCapacity,0); - break; - case U_SHAPE_LETTERS_UNSHAPE : - ASSERT_NOT_REACHED(); - break; - default : - /* will never occur because of validity checks above */ - destLength = 0; - break; - } - - /* End of Arabic letter shaping part */ - } else - ASSERT_NOT_REACHED(); - - ASSERT((options & U_SHAPE_DIGITS_MASK) == U_SHAPE_DIGITS_NOOP); - - return sourceLength; -} - -#endif // USE(ATSUI) diff --git a/Source/WebCore/platform/text/mac/ShapeArabic.h b/Source/WebCore/platform/text/mac/ShapeArabic.h deleted file mode 100644 index 8aa577d52..000000000 --- a/Source/WebCore/platform/text/mac/ShapeArabic.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2007 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 ShapeArabic_h -#define ShapeArabic_h - -#if USE(ATSUI) - -#include <unicode/ushape.h> - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t shapeArabic(const UChar *source, int32_t sourceLength, UChar *dest, int32_t destCapacity, uint32_t options, UErrorCode *pErrorCode); - -#ifdef __cplusplus -} -#endif - -#endif // USE(ATSUI) -#endif // ShapeArabic_h diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 94cd749c1..f8eaedfda 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2383,7 +2383,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo, estimateWithoutPagination); // Cache our old rect so that we can dirty the proper repaint rects if the child moves. - LayoutRect oldRect(child->x(), child->y() , child->width(), child->height()); + LayoutRect oldRect = child->frameRect(); LayoutUnit oldLogicalTop = logicalTopForChild(child); #if !ASSERT_DISABLED @@ -2478,7 +2478,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay if (childRenderBlock && childRenderBlock->containsFloats()) maxFloatLogicalBottom = max(maxFloatLogicalBottom, addOverhangingFloats(toRenderBlock(child), !childNeededLayout)); - LayoutSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y()); + LayoutSize childOffset = child->location() - oldRect.location(); if (childOffset.width() || childOffset.height()) { view()->addLayoutDelta(childOffset); @@ -2967,8 +2967,11 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs // Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div). LayoutPoint scrolledOffset = paintOffset; - if (hasOverflowClip()) + if (hasOverflowClip()) { scrolledOffset.move(-scrolledContentOffset()); + if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + scrolledOffset.move(verticalScrollbarWidth(), 0); + } // 2. paint contents if (paintPhase != PaintPhaseSelfOutline) { @@ -3835,7 +3838,7 @@ bool RenderBlock::positionNewFloats() RenderBox* childBox = floatingObject->renderer(); LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ? marginStartForChild(childBox) : marginEndForChild(childBox); - LayoutRect oldRect(childBox->x(), childBox->y() , childBox->width(), childBox->height()); + LayoutRect oldRect = childBox->frameRect(); if (childBox->style()->clear() & CLEFT) logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatLeft), logicalTop); @@ -5616,6 +5619,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths() InlineMinMaxIterator childIterator(this); bool addedTextIndent = false; // Only gets added in once. + LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw, view()); RenderObject* prevFloat = 0; while (RenderObject* child = childIterator.next()) { autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : @@ -5719,14 +5723,18 @@ void RenderBlock::computeInlinePreferredLogicalWidths() // Add in text-indent. This is added in only once. LayoutUnit ti = 0; if (!addedTextIndent) { - addedTextIndent = true; - ti = minimumValueForLength(styleToUse->textIndent(), cw, view()); + ti = textIndent; childMin += ti; childMax += ti; + + if (childMin < 0) + textIndent = childMin; + else + addedTextIndent = true; } // Add our width to the max. - inlineMax += childMax; + inlineMax += max<float>(0, childMax); if (!autoWrap || !canBreakReplacedElement) { if (child->isFloating()) @@ -5790,10 +5798,14 @@ void RenderBlock::computeInlinePreferredLogicalWidths() // Add in text-indent. This is added in only once. LayoutUnit ti = 0; if (!addedTextIndent) { - addedTextIndent = true; - ti = minimumValueForLength(styleToUse->textIndent(), cw, view()); + ti = textIndent; childMin+=ti; beginMin += ti; childMax+=ti; beginMax += ti; + + if (childMin < 0) + textIndent = childMin; + else + addedTextIndent = true; } // If we have no breakable characters at all, @@ -5831,8 +5843,9 @@ void RenderBlock::computeInlinePreferredLogicalWidths() updatePreferredWidth(m_maxPreferredLogicalWidth, inlineMax); updatePreferredWidth(m_maxPreferredLogicalWidth, childMax); inlineMax = endMax; + addedTextIndent = true; } else - inlineMax += childMax; + inlineMax += max<float>(0, childMax); } // Ignore spaces after a list marker. @@ -5844,6 +5857,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths() inlineMin = inlineMax = 0; stripFrontSpaces = true; trailingSpaceChild = 0; + addedTextIndent = true; } oldAutoWrap = autoWrap; diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 71416a103..6951c2624 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -806,7 +806,6 @@ private: virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0); - void adjustPointToColumnContents(LayoutPoint&) const; void adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const; // Helper function for borderFitAdjust void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBottom, RootInlineBox* highest = 0); @@ -964,6 +963,8 @@ protected: void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset); // Computes a deltaOffset value that put a line at the top of the next page if it doesn't fit on the current page. LayoutUnit adjustBlockChildForPagination(LayoutUnit logicalTopAfterClear, LayoutUnit estimateWithoutPagination, RenderBox* child, bool atBeforeSideOfBlock); + void adjustPointToColumnContents(LayoutPoint&) const; + // This function is called to test a line box that has moved in the block direction to see if it has ended up in a new // region/page/column that has a different available line width than the old one. Used to know when you have to dirty a // line, i.e., that it can't be re-used. diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 131ebcaf6..d2de4b8a9 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -1604,19 +1604,16 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La o->computeRectForRepaint(repaintContainer, rect, fixed); } -void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& rect) +void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& oldRect) { - LayoutUnit newX = x(); - LayoutUnit newY = y(); - LayoutUnit newWidth = width(); - LayoutUnit newHeight = height(); - if (rect.x() != newX || rect.y() != newY) { + if (oldRect.location() != m_frameRect.location()) { + LayoutRect newRect = m_frameRect; // The child moved. Invalidate the object's old and new positions. We have to do this // since the object may not have gotten a layout. - m_frameRect = rect; + m_frameRect = oldRect; repaint(); repaintOverhangingFloats(true); - m_frameRect = LayoutRect(newX, newY, newWidth, newHeight); + m_frameRect = newRect; repaint(); repaintOverhangingFloats(true); } @@ -2126,12 +2123,11 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) result = cb->overrideLogicalContentHeight(); includeBorderPadding = true; } - } - // Otherwise we only use our percentage height if our containing block had a specified - // height. - else if (cbstyle->logicalHeight().isFixed()) - result = cb->computeContentBoxLogicalHeight(cbstyle->logicalHeight().value()); - else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { + } else if (cbstyle->logicalHeight().isFixed()) { + // Otherwise we only use our percentage height if our containing block had a specified height. + LayoutUnit contentBoxHeightWithScrollbar = cb->computeContentBoxLogicalHeight(cbstyle->logicalHeight().value()); + result = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); + } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { // We need to recur and compute the percentage height for our containing block. result = cb->computePercentageLogicalHeight(cbstyle->logicalHeight()); if (result != -1) @@ -2268,7 +2264,10 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType sizeType, Lengt cb = cb->containingBlock(); } } - return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight)); + availableHeight = computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight)); + if (cb->style()->logicalHeight().isFixed()) + availableHeight = max<LayoutUnit>(0, availableHeight - toRenderBox(cb)->scrollbarLogicalHeight()); + return availableHeight; } case ViewportPercentageWidth: case ViewportPercentageHeight: @@ -2366,8 +2365,10 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo if (isWritingModeRoot()) { LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop(); RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); - cbRegion = cb->clampToStartAndEndRegions(cbRegion); - boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + if (cbRegion) { + cbRegion = cb->clampToStartAndEndRegions(cbRegion); + boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + } } } else if (region && enclosingRenderFlowThread()->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode()) { RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region); @@ -2629,11 +2630,13 @@ void RenderBox::computePositionedLogicalWidth(RenderRegion* region, LayoutUnit o const RenderBlock* cb = toRenderBlock(containerBlock); LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop(); RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); - cbRegion = cb->clampToStartAndEndRegions(cbRegion); - RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); - if (boxInfo) { - logicalLeftPos += boxInfo->logicalLeft(); - setLogicalLeft(logicalLeftPos); + if (cbRegion) { + cbRegion = cb->clampToStartAndEndRegions(cbRegion); + RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + if (boxInfo) { + logicalLeftPos += boxInfo->logicalLeft(); + setLogicalLeft(logicalLeftPos); + } } } } @@ -2951,11 +2954,13 @@ void RenderBox::computePositionedLogicalHeight() const RenderBlock* cb = toRenderBlock(containerBlock); LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage() - logicalLeft(); RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); - cbRegion = cb->clampToStartAndEndRegions(cbRegion); - RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); - if (boxInfo) { - logicalTopPos += boxInfo->logicalLeft(); - setLogicalTop(logicalTopPos); + if (cbRegion) { + cbRegion = cb->clampToStartAndEndRegions(cbRegion); + RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + if (boxInfo) { + logicalTopPos += boxInfo->logicalLeft(); + setLogicalTop(logicalTopPos); + } } } } @@ -3412,7 +3417,7 @@ LayoutRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit // FIXME: Paint the carets inside empty blocks differently than the carets before/after elements. // FIXME: What about border and padding? - LayoutRect rect(x(), y(), caretWidth, height()); + LayoutRect rect(location(), LayoutSize(caretWidth, height())); bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection(); if ((!caretOffset) ^ ltr) @@ -3939,6 +3944,8 @@ LayoutSize RenderBox::topLeftLocationOffset() const return locationOffset(); LayoutRect rect(frameRect()); + if (containerBlock->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + rect.move(containerBlock->verticalScrollbarWidth(), 0); containerBlock->flipForWritingMode(rect); // FIXME: This is wrong if we are an absolutely positioned object enclosed by a relative-positioned inline. return LayoutSize(rect.x(), rect.y()); } @@ -3961,9 +3968,11 @@ static void markBoxForRelayoutAfterSplit(RenderBox* box) { // FIXME: The table code should handle that automatically. If not, // we should fix it and remove the table part checks. - if (box->isTable()) - toRenderTable(box)->setNeedsSectionRecalc(); - else if (box->isTableSection()) + if (box->isTable()) { + // Because we may have added some sections with already computed column structures, we need to + // sync the table structure with them now. This avoids crashes when adding new cells to the table. + toRenderTable(box)->forceSectionsRecalc(); + } else if (box->isTableSection()) toRenderTableSection(box)->setNeedsCellRecalc(); box->setNeedsLayoutAndPrefWidthsRecalc(); diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 488c58405..43a8ebc50 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -197,7 +197,7 @@ public: // More IE extensions. clientWidth and clientHeight represent the interior of an object // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth. - LayoutUnit clientLeft() const { return borderLeft(); } + LayoutUnit clientLeft() const { return borderLeft() + (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0); } LayoutUnit clientTop() const { return borderTop(); } LayoutUnit clientWidth() const; LayoutUnit clientHeight() const; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index 8f9b9a622..5eef3ccac 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -1171,13 +1171,11 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil // its margins. Since those were added in already, we have to factor them out when computing // the background positioning area. if (isRoot()) { - positioningAreaSize = IntSize(snapSizeToPixel(toRenderBox(this)->width() - left - right, toRenderBox(this)->x()), - snapSizeToPixel(toRenderBox(this)->height() - top - bottom, toRenderBox(this)->y())); + positioningAreaSize = pixelSnappedIntSize(toRenderBox(this)->size() - LayoutSize(left + right, top + bottom), toRenderBox(this)->location()); left += marginLeft(); top += marginTop(); } else - positioningAreaSize = IntSize(snapSizeToPixel(paintRect.width() - left - right, paintRect.x()), - snapSizeToPixel(paintRect.height() - top - bottom, paintRect.y())); + positioningAreaSize = pixelSnappedIntSize(paintRect.size() - LayoutSize(left + right, top + bottom), paintRect.location()); } else { geometry.setDestRect(pixelSnappedIntRect(viewRect())); positioningAreaSize = geometry.destRect().size(); @@ -1410,7 +1408,7 @@ public: } bool hasVisibleColorAndStyle() const { return style > BHIDDEN && !isTransparent; } - bool shouldRender() const { return isPresent && hasVisibleColorAndStyle(); } + bool shouldRender() const { return isPresent && width && hasVisibleColorAndStyle(); } bool presentButInvisible() const { return usedWidth() && !hasVisibleColorAndStyle(); } bool obscuresBackgroundEdge(float scale) const { @@ -1648,6 +1646,7 @@ void RenderBoxModelObject::paintOneBorderSide(GraphicsContext* graphicsContext, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor) { const BorderEdge& edgeToRender = edges[side]; + ASSERT(edgeToRender.width); const BorderEdge& adjacentEdge1 = edges[adjacentSide1]; const BorderEdge& adjacentEdge2 = edges[adjacentSide2]; diff --git a/Source/WebCore/rendering/RenderDetailsMarker.cpp b/Source/WebCore/rendering/RenderDetailsMarker.cpp index c36cdd588..01b234876 100644 --- a/Source/WebCore/rendering/RenderDetailsMarker.cpp +++ b/Source/WebCore/rendering/RenderDetailsMarker.cpp @@ -21,8 +21,7 @@ #include "config.h" #include "RenderDetailsMarker.h" -#if ENABLE(DETAILS) || ENABLE(CALENDAR_PICKER) - +#if ENABLE(DETAILS_ELEMENT) || ENABLE(CALENDAR_PICKER) #include "Element.h" #include "GraphicsContext.h" #include "HTMLNames.h" diff --git a/Source/WebCore/rendering/RenderDetailsMarker.h b/Source/WebCore/rendering/RenderDetailsMarker.h index 76e2b28e4..ac93be868 100644 --- a/Source/WebCore/rendering/RenderDetailsMarker.h +++ b/Source/WebCore/rendering/RenderDetailsMarker.h @@ -21,8 +21,7 @@ #ifndef RenderDetailsMarker_h #define RenderDetailsMarker_h -#if ENABLE(DETAILS) || ENABLE(CALENDAR_PICKER) - +#if ENABLE(DETAILS_ELEMENT) || ENABLE(CALENDAR_PICKER) #include "RenderBlock.h" namespace WebCore { diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp index 3feb57c54..48ea05470 100644 --- a/Source/WebCore/rendering/RenderImage.cpp +++ b/Source/WebCore/rendering/RenderImage.cpp @@ -507,7 +507,7 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu if (HTMLMapElement* map = imageMap()) { LayoutRect contentBox = contentBoxRect(); float scaleFactor = 1 / style()->effectiveZoom(); - LayoutPoint mapLocation = pointInContainer.point() - toLayoutSize(accumulatedOffset) - LayoutSize(this->x(), this->y()) - toLayoutSize(contentBox.location()); + LayoutPoint mapLocation = pointInContainer.point() - toLayoutSize(accumulatedOffset) - locationOffset() - toLayoutSize(contentBox.location()); mapLocation.scale(scaleFactor, scaleFactor); if (map->mapMouseEvent(mapLocation, contentBox.size(), tempResult)) diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 104c56f5d..7985268c5 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -302,7 +302,8 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb if (!beforeChild && isAfterContent(lastChild())) beforeChild = lastChild(); - if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) { + // We don't split table parts as they will be wrapped in an anonymous inline table. + if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned() && !newChild->isTablePart()) { // We are placing a block inside an inline. We have to perform a split of this // inline into continuations. This involves creating an anonymous block box to hold // |newChild|. We then make that block box a continuation of this inline. We take all of @@ -1135,9 +1136,11 @@ void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b if (!o) return; - if (applyContainerFlip && o->isBox() && o->style()->isFlippedBlocksWritingMode()) { - IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); - transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(centerPoint) - centerPoint); + if (applyContainerFlip && o->isBox()) { + if (o->style()->isFlippedBlocksWritingMode()) { + IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); + transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(centerPoint) - centerPoint); + } applyContainerFlip = DoNotApplyContainerFlip; } @@ -1228,7 +1231,7 @@ void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint& // Get our containing block. RenderBox* block = containingBlock(); - localPoint.move(block->x() - firstBlock->x(), block->y() - firstBlock->y()); + localPoint.moveBy(block->location() - firstBlock->locationOffset()); } result.setInnerNode(n); @@ -1366,7 +1369,7 @@ void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& if (curr->hasLayer()) pos = curr->localToAbsolute(); else if (curr->isBox()) - pos.move(toRenderBox(curr)->x(), toRenderBox(curr)->y()); + pos.move(toRenderBox(curr)->locationOffset()); curr->addFocusRingRects(rects, flooredIntPoint(pos)); } } diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index b9dc5d7c7..a863a4c90 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -845,6 +845,7 @@ private: enum IndirectCompositingReason { NoIndirectCompositingReason, + IndirectCompositingForStacking, IndirectCompositingForOverlap, IndirectCompositingForBackgroundLayer, IndirectCompositingForGraphicalEffect, // opacity, mask, filter, transform etc. diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 47450191a..b2940d050 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -730,7 +730,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor // Clear the flag layer->setHasCompositingDescendant(false); - bool mustOverlapCompositedLayers = compositingState.m_subtreeIsCompositing; + RenderLayer::IndirectCompositingReason compositingReason = compositingState.m_subtreeIsCompositing ? RenderLayer::IndirectCompositingForStacking : RenderLayer::NoIndirectCompositingReason; bool haveComputedBounds = false; IntRect absBounds; @@ -742,10 +742,10 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor if (absBounds.isEmpty()) absBounds.setSize(IntSize(1, 1)); haveComputedBounds = true; - mustOverlapCompositedLayers = overlapMap->overlapsLayers(absBounds); + compositingReason = overlapMap->overlapsLayers(absBounds) ? RenderLayer::IndirectCompositingForOverlap : RenderLayer::NoIndirectCompositingReason; } - layer->setIndirectCompositingReason(mustOverlapCompositedLayers ? RenderLayer::IndirectCompositingForOverlap : RenderLayer::NoIndirectCompositingReason); + layer->setIndirectCompositingReason(compositingReason); // The children of this layer don't need to composite, unless there is // a compositing layer among them, so start by inheriting the compositing @@ -762,11 +762,6 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor if (overlapMap) overlapMap->pushCompositingContainer(); - - if (layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) { - // If we have a 3D transform, or are animating transform, then turn overlap testing off. - childState.m_testingOverlap = false; - } } #if ENABLE(VIDEO) @@ -852,15 +847,15 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ASSERT(willBeComposited == needsToBeComposited(layer)); if (layer->reflectionLayer()) { // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another renderer? - layer->reflectionLayer()->setIndirectCompositingReason(willBeComposited ? RenderLayer::IndirectCompositingForOverlap : RenderLayer::NoIndirectCompositingReason); + layer->reflectionLayer()->setIndirectCompositingReason(willBeComposited ? RenderLayer::IndirectCompositingForStacking : RenderLayer::NoIndirectCompositingReason); } // Subsequent layers in the parent stacking context also need to composite. if (childState.m_subtreeIsCompositing) compositingState.m_subtreeIsCompositing = true; - // We have to keep overlap testing disabled for later layers. - if (!childState.m_testingOverlap) + // Turn overlap testing off for later layers if it's already off, or if we have a 3D transform or an animating transform. + if (!childState.m_testingOverlap || layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) compositingState.m_testingOverlap = false; // Set the flag to say that this SC has compositing children. @@ -1488,6 +1483,7 @@ bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co if (layer->mustCompositeForIndirectReasons()) { RenderLayer::IndirectCompositingReason reason = layer->indirectCompositingReason(); return reason == RenderLayer::IndirectCompositingForOverlap + || reason == RenderLayer::IndirectCompositingForStacking || reason == RenderLayer::IndirectCompositingForBackgroundLayer || reason == RenderLayer::IndirectCompositingForGraphicalEffect || reason == RenderLayer::IndirectCompositingForPreserve3D; // preserve-3d has to create backing store to ensure that 3d-transformed elements intersect. @@ -1534,9 +1530,11 @@ const char* RenderLayerCompositor::reasonForCompositing(const RenderLayer* layer if (requiresCompositingForPosition(renderer, layer)) return "position: fixed"; - // This includes layers made composited by requiresCompositingWhenDescendantsAreCompositing(). + if (layer->indirectCompositingReason() == RenderLayer::IndirectCompositingForStacking) + return "stacking"; + if (layer->indirectCompositingReason() == RenderLayer::IndirectCompositingForOverlap) - return "overlap/stacking"; + return "overlap"; if (layer->indirectCompositingReason() == RenderLayer::IndirectCompositingForBackgroundLayer) return "negative z-index children"; diff --git a/Source/WebCore/rendering/RenderMeter.cpp b/Source/WebCore/rendering/RenderMeter.cpp index 5540a1942..93b01720f 100644 --- a/Source/WebCore/rendering/RenderMeter.cpp +++ b/Source/WebCore/rendering/RenderMeter.cpp @@ -19,11 +19,9 @@ */ #include "config.h" - -#if ENABLE(METER_TAG) - #include "RenderMeter.h" +#if ENABLE(METER_ELEMENT) #include "HTMLMeterElement.h" #include "HTMLNames.h" #include "RenderTheme.h" diff --git a/Source/WebCore/rendering/RenderMeter.h b/Source/WebCore/rendering/RenderMeter.h index c4deb12b2..7306caea4 100644 --- a/Source/WebCore/rendering/RenderMeter.h +++ b/Source/WebCore/rendering/RenderMeter.h @@ -21,7 +21,7 @@ #ifndef RenderMeter_h #define RenderMeter_h -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "RenderBlock.h" #include "RenderWidget.h" diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 6cdb4b2f9..893e45159 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -836,6 +836,11 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, { int width = (side == BSTop || side == BSBottom ? y2 - y1 : x2 - x1); + // FIXME: We really would like this check to be an ASSERT as we don't want to draw 0px borders. However + // nothing guarantees that the following recursive calls to drawLineForBoxSide will have non-null width. + if (!width) + return; + if (style == DOUBLE && width < 3) style = SOLID; @@ -1988,7 +1993,7 @@ FloatPoint RenderObject::absoluteToLocal(const FloatPoint& containerPoint, bool return transformState.lastPlanarPoint(); } -void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const +void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot applyContainerFlip, bool* wasFixed) const { if (repaintContainer == this) return; @@ -1999,8 +2004,11 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b // FIXME: this should call offsetFromContainer to share code, but I'm not sure it's ever called. LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); - if (o->isBox() && o->style()->isFlippedBlocksWritingMode()) - transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); + if (applyContainerFlip && o->isBox()) { + if (o->style()->isFlippedBlocksWritingMode()) + transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); + applyContainerFlip = DoNotApplyContainerFlip; + } LayoutSize columnOffset; o->adjustForColumns(columnOffset, roundedLayoutPoint(transformState.mappedPoint())); @@ -2010,7 +2018,7 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b if (o->hasOverflowClip()) transformState.move(-toRenderBox(o)->scrolledContentOffset()); - o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed); + o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, applyContainerFlip, wasFixed); } const RenderObject* RenderObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index 60c56909c..7b894feab 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -303,7 +303,7 @@ public: virtual bool isCounter() const { return false; } virtual bool isQuote() const { return false; } -#if ENABLE(DETAILS) +#if ENABLE(DETAILS_ELEMENT) virtual bool isDetailsMarker() const { return false; } #endif virtual bool isEmbeddedObject() const { return false; } @@ -318,10 +318,10 @@ public: virtual bool isListMarker() const { return false; } virtual bool isMedia() const { return false; } virtual bool isMenuList() const { return false; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual bool isMeter() const { return false; } #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual bool isProgress() const { return false; } #endif virtual bool isRenderBlock() const { return false; } diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp index aa1ab8fdc..da98088e2 100644 --- a/Source/WebCore/rendering/RenderObjectChildList.cpp +++ b/Source/WebCore/rendering/RenderObjectChildList.cpp @@ -214,8 +214,10 @@ void RenderObjectChildList::appendChildNode(RenderObject* owner, RenderObject* n containerFlowThread->addFlowChild(newChild); } - RenderCounter::rendererSubtreeAttached(newChild); - RenderQuote::rendererSubtreeAttached(newChild); + if (!owner->documentBeingDestroyed()) { + RenderCounter::rendererSubtreeAttached(newChild); + RenderQuote::rendererSubtreeAttached(newChild); + } newChild->setNeedsLayoutAndPrefWidthsRecalc(); // Goes up the containing block hierarchy. if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. @@ -281,8 +283,10 @@ void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* c containerFlowThread->addFlowChild(child, beforeChild); } - RenderCounter::rendererSubtreeAttached(child); - RenderQuote::rendererSubtreeAttached(child); + if (!owner->documentBeingDestroyed()) { + RenderCounter::rendererSubtreeAttached(child); + RenderQuote::rendererSubtreeAttached(child); + } child->setNeedsLayoutAndPrefWidthsRecalc(); if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. diff --git a/Source/WebCore/rendering/RenderProgress.cpp b/Source/WebCore/rendering/RenderProgress.cpp index 498141a97..d004506a3 100644 --- a/Source/WebCore/rendering/RenderProgress.cpp +++ b/Source/WebCore/rendering/RenderProgress.cpp @@ -19,11 +19,9 @@ */ #include "config.h" - -#if ENABLE(PROGRESS_TAG) - #include "RenderProgress.h" +#if ENABLE(PROGRESS_ELEMENT) #include "HTMLNames.h" #include "HTMLProgressElement.h" #include "PaintInfo.h" diff --git a/Source/WebCore/rendering/RenderProgress.h b/Source/WebCore/rendering/RenderProgress.h index fa92bb20b..96921bdb4 100644 --- a/Source/WebCore/rendering/RenderProgress.h +++ b/Source/WebCore/rendering/RenderProgress.h @@ -21,7 +21,7 @@ #ifndef RenderProgress_h #define RenderProgress_h -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderBlock.h" namespace WebCore { diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp index 9938dffb0..11b2b0f77 100644 --- a/Source/WebCore/rendering/RenderRegion.cpp +++ b/Source/WebCore/rendering/RenderRegion.cpp @@ -144,13 +144,22 @@ bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& res void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderReplaced::styleDidChange(diff, oldStyle); + + // If the region is not attached to any thread, there is no need to check + // whether the region has region styling since no content will be displayed + // into the region. + if (!m_flowThread) { + setHasCustomRegionStyle(false); + return; + } + bool customRegionStyle = false; if (node()) { Element* regionElement = static_cast<Element*>(node()); customRegionStyle = view()->document()->styleResolver()->checkRegionStyle(regionElement); } setHasCustomRegionStyle(customRegionStyle); - flowThread()->checkRegionsWithStyling(); + m_flowThread->checkRegionsWithStyling(); } void RenderRegion::layout() diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp index 2e0d7473b..18cdfc17e 100644 --- a/Source/WebCore/rendering/RenderReplaced.cpp +++ b/Source/WebCore/rendering/RenderReplaced.cpp @@ -269,8 +269,9 @@ static inline bool rendererHasAspectRatio(const RenderObject* renderer) return renderer->isImage() || renderer->isCanvas() || renderer->isVideo(); } -void RenderReplaced::computeIntrinsicRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const +void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const { + FloatSize intrinsicSize; if (contentRenderer) { contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); if (intrinsicRatio) @@ -280,16 +281,39 @@ void RenderReplaced::computeIntrinsicRatioInformationForRenderBox(RenderBox* con if (!isPercentageIntrinsicSize) intrinsicSize.scale(style()->effectiveZoom()); - if (intrinsicRatio && !isHorizontalWritingMode()) - intrinsicRatio = 1 / intrinsicRatio; - if (rendererHasAspectRatio(this) && isPercentageIntrinsicSize) intrinsicRatio = 1; - return; + + // Update our intrinsic size to match what the content renderer has computed, so that when we + // constrain the size below, the correct intrinsic size will be obtained for comparison against + // min and max widths. + if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmpty()) + m_intrinsicSize = flooredIntSize(intrinsicSize); // FIXME: This introduces precision errors. We should convert m_intrinsicSize to be a float. + + if (!isHorizontalWritingMode()) { + if (intrinsicRatio) + intrinsicRatio = 1 / intrinsicRatio; + intrinsicSize = intrinsicSize.transposedSize(); + } + } else { + computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); + if (intrinsicRatio) + ASSERT(!isPercentageIntrinsicSize); + } + + // Now constrain the intrinsic size along each axis according to minimum and maximum width/heights along the + // opposite axis. So for example a maximum width that shrinks our width will result in the height we compute here + // having to shrink in order to preserve the aspect ratio. Because we compute these values independently along + // each axis, the final returned size may in fact not preserve the aspect ratio. + // FIXME: In the long term, it might be better to just return this code more to the way it used to be before this + // function was added, since all it has done is make the code more unclear. + constrainedSize = intrinsicSize; + if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmpty() && style()->logicalWidth().isAuto() && style()->logicalHeight().isAuto()) { + // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests, like fast/images/zoomed-img-size.html, which + // can only be fixed once subpixel precision is available for things like intrinsicWidth/Height - which include zoom! + constrainedSize.setWidth(RenderBox::computeReplacedLogicalHeight() * intrinsicSize.width() / intrinsicSize.height()); + constrainedSize.setHeight(RenderBox::computeReplacedLogicalWidth() * intrinsicSize.height() / intrinsicSize.width()); } - computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); - if (intrinsicRatio) - ASSERT(!isPercentageIntrinsicSize); } void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const @@ -304,12 +328,6 @@ void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, return; intrinsicRatio = intrinsicSize.width() / intrinsicSize.height(); - if (style()->logicalWidth().isAuto() && style()->logicalHeight().isAuto()) { - // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests, like fast/images/zoomed-img-size.html, which - // can only be fixed once subpixel precision is available for things like intrinsicWidth/Height - which include zoom! - intrinsicSize.setWidth(RenderBox::computeReplacedLogicalHeight() * intrinsicLogicalWidth() / intrinsicLogicalHeight()); - intrinsicSize.setHeight(RenderBox::computeReplacedLogicalWidth() * intrinsicLogicalHeight() / intrinsicLogicalWidth()); - } } LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) const @@ -322,19 +340,19 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) con // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width bool isPercentageIntrinsicSize = false; double intrinsicRatio = 0; - FloatSize intrinsicSize; - computeIntrinsicRatioInformationForRenderBox(contentRenderer, intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); + FloatSize constrainedSize; + computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio, isPercentageIntrinsicSize); // FIXME: Remove unnecessary round/roundToInt calls from this method when layout is off ints: webkit.org/b/63656 if (style()->logicalWidth().isAuto()) { bool heightIsAuto = style()->logicalHeight().isAuto(); - bool hasIntrinsicWidth = !isPercentageIntrinsicSize && intrinsicSize.width() > 0; + bool hasIntrinsicWidth = !isPercentageIntrinsicSize && constrainedSize.width() > 0; // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'. if (heightIsAuto && hasIntrinsicWidth) - return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(intrinsicSize.width()), includeMaxWidth); + return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(constrainedSize.width()), includeMaxWidth); - bool hasIntrinsicHeight = !isPercentageIntrinsicSize && intrinsicSize.height() > 0; + bool hasIntrinsicHeight = !isPercentageIntrinsicSize && constrainedSize.height() > 0; if (intrinsicRatio || isPercentageIntrinsicSize) { // If 'height' and 'width' both have computed values of 'auto' and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio; // or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value @@ -361,14 +379,14 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) con LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), logicalWidth); logicalWidth = max(ZERO_LAYOUT_UNIT, logicalWidth - (marginStart + marginEnd + (width() - clientWidth()))); if (isPercentageIntrinsicSize) - logicalWidth = roundToInt(logicalWidth * intrinsicSize.width() / 100); + logicalWidth = roundToInt(logicalWidth * constrainedSize.width() / 100); return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, includeMaxWidth); } } // Otherwise, if 'width' has a computed value of 'auto', and the element has an intrinsic width, then that intrinsic width is the used value of 'width'. if (hasIntrinsicWidth) - return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(intrinsicSize.width()), includeMaxWidth); + return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(constrainedSize.width()), includeMaxWidth); // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too // wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead. @@ -391,16 +409,16 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height bool isPercentageIntrinsicSize = false; double intrinsicRatio = 0; - FloatSize intrinsicSize; - computeIntrinsicRatioInformationForRenderBox(contentRenderer, intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); + FloatSize constrainedSize; + computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio, isPercentageIntrinsicSize); // FIXME: Remove unnecessary round/roundToInt calls from this method when layout is off ints: webkit.org/b/63656 bool widthIsAuto = style()->logicalWidth().isAuto(); - bool hasIntrinsicHeight = !isPercentageIntrinsicSize && intrinsicSize.height() > 0; + bool hasIntrinsicHeight = !isPercentageIntrinsicSize && constrainedSize.height() > 0; // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'. if (widthIsAuto && hasIntrinsicHeight) - return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(intrinsicSize.height())); + return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(constrainedSize.height())); // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is: // (used width) / (intrinsic ratio) @@ -409,7 +427,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'. if (hasIntrinsicHeight) - return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(intrinsicSize.height())); + return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(constrainedSize.height())); // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width. diff --git a/Source/WebCore/rendering/RenderReplaced.h b/Source/WebCore/rendering/RenderReplaced.h index 9ebc634b0..9d7814394 100644 --- a/Source/WebCore/rendering/RenderReplaced.h +++ b/Source/WebCore/rendering/RenderReplaced.h @@ -77,9 +77,9 @@ private: virtual bool canBeSelectionLeaf() const { return true; } virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); - void computeIntrinsicRatioInformationForRenderBox(RenderBox*, FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const; + void computeAspectRatioInformationForRenderBox(RenderBox*, FloatSize& constrainedSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const; - IntSize m_intrinsicSize; + mutable IntSize m_intrinsicSize; }; } diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 3eac69200..9c115a037 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -768,6 +768,8 @@ RenderTableCol* RenderTable::colElement(unsigned col, bool* startEdge, bool* end void RenderTable::recalcSections() const { + ASSERT(m_needsSectionRecalc); + m_head = 0; m_foot = 0; m_firstBody = 0; @@ -1294,7 +1296,9 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu RenderTable* RenderTable::createAnonymousWithParentRenderer(const RenderObject* parent) { - RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), TABLE); + // CSS 2.1, section 17.2.1: "If a proper table child's parent is an 'inline' box, then the generated anonymous table must be an 'inline-table' box". + EDisplay tableDisplay = parent->isInline() ? INLINE_TABLE : TABLE; + RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), tableDisplay); RenderTable* newTable = new (parent->renderArena()) RenderTable(parent->document() /* is anonymous */); newTable->setStyle(newStyle.release()); return newTable; diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h index b6d25069f..87418f068 100644 --- a/Source/WebCore/rendering/RenderTable.h +++ b/Source/WebCore/rendering/RenderTable.h @@ -135,6 +135,12 @@ public: unsigned span; }; + void forceSectionsRecalc() + { + setNeedsSectionRecalc(); + recalcSections(); + } + Vector<ColumnStruct>& columns() { return m_columns; } Vector<int>& columnPositions() { return m_columnPos; } RenderTableSection* header() const { return m_head; } diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp index 159b54b3b..3f304e284 100644 --- a/Source/WebCore/rendering/RenderTableCell.cpp +++ b/Source/WebCore/rendering/RenderTableCell.cpp @@ -245,7 +245,7 @@ LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoi LayoutSize offset = RenderBlock::offsetFromContainer(o, point, offsetDependsOnPoint); if (parent()) - offset.expand(-parentBox()->x(), -parentBox()->y()); + offset -= parentBox()->locationOffset(); return offset; } diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 70161c779..955ef9ade 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -657,7 +657,7 @@ void RenderTableSection::layoutRows() cell->setIntrinsicPaddingBefore(intrinsicPaddingBefore); cell->setIntrinsicPaddingAfter(intrinsicPaddingAfter); - LayoutRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height()); + LayoutRect oldCellRect = cell->frameRect(); setLogicalPositionForCell(cell, c); @@ -1469,7 +1469,7 @@ RenderTableSection* RenderTableSection::createAnonymousWithParentRenderer(const void RenderTableSection::setLogicalPositionForCell(RenderTableCell* cell, unsigned effectiveColumn) const { - LayoutPoint oldCellLocation(cell->x(), cell->y()); + LayoutPoint oldCellLocation = cell->location(); LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]); int horizontalBorderSpacing = table()->hBorderSpacing(); diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp index e68b893eb..f89673237 100644 --- a/Source/WebCore/rendering/RenderTheme.cpp +++ b/Source/WebCore/rendering/RenderTheme.cpp @@ -44,7 +44,7 @@ #include "StringTruncator.h" #include "TextControlInnerElements.h" -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "HTMLMeterElement.h" #include "RenderMeter.h" #endif @@ -53,6 +53,14 @@ #include "RenderInputSpeech.h" #endif +#if ENABLE(DATALIST_ELEMENT) +#include "ElementShadow.h" +#include "HTMLCollection.h" +#include "HTMLDataListElement.h" +#include "HTMLOptionElement.h" +#include "HTMLParserIdioms.h" +#endif + // The methods in this file are shared by all themes on every platform. namespace WebCore { @@ -229,11 +237,11 @@ void RenderTheme::adjustStyle(StyleResolver* styleResolver, RenderStyle* style, return adjustSearchFieldResultsDecorationStyle(styleResolver, style, e); case SearchFieldResultsButtonPart: return adjustSearchFieldResultsButtonStyle(styleResolver, style, e); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: return adjustProgressBarStyle(styleResolver, style, e); #endif -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: @@ -298,7 +306,7 @@ bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe #endif case MenulistPart: return paintMenuList(o, paintInfo, r); -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: @@ -306,7 +314,7 @@ bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe case RatingLevelIndicatorPart: return paintMeter(o, paintInfo, r); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: return paintProgressBar(o, paintInfo, r); #endif @@ -403,14 +411,14 @@ bool RenderTheme::paintBorderOnly(RenderObject* o, const PaintInfo& paintInfo, c case DefaultButtonPart: case ButtonPart: case MenulistPart: -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: case DiscreteCapacityLevelIndicatorPart: case RatingLevelIndicatorPart: #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: #endif case SliderHorizontalPart: @@ -450,14 +458,14 @@ bool RenderTheme::paintDecorations(RenderObject* o, const PaintInfo& paintInfo, case DefaultButtonPart: case ButtonPart: case MenulistPart: -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: case DiscreteCapacityLevelIndicatorPart: case RatingLevelIndicatorPart: #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: #endif case SliderHorizontalPart: @@ -929,7 +937,7 @@ bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, const PaintI } #endif -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) void RenderTheme::adjustMeterStyle(StyleResolver*, RenderStyle* style, Element*) const { style->setBoxShadow(nullptr); @@ -952,7 +960,81 @@ bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&) #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(DATALIST_ELEMENT) +void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect) +{ + Node* node = o->node(); + if (!node) + return; + + HTMLInputElement* input = node->toInputElement(); + if (!input) + return; + + HTMLDataListElement* dataList = static_cast<HTMLDataListElement*>(input->list()); + if (!dataList) + return; + + double min = input->minimum(); + double max = input->maximum(); + ControlPart part = o->style()->appearance(); + // We don't support ticks on alternate sliders like MediaVolumeSliders. + if (part != SliderHorizontalPart && part != SliderVerticalPart) + return; + bool isHorizontal = part == SliderHorizontalPart; + + IntSize thumbSize; + RenderObject* thumbRenderer = input->sliderThumbElement()->renderer(); + if (thumbRenderer) { + RenderStyle* thumbStyle = thumbRenderer->style(); + int thumbWidth = thumbStyle->width().intValue(); + int thumbHeight = thumbStyle->height().intValue(); + thumbSize.setWidth(isHorizontal ? thumbWidth : thumbHeight); + thumbSize.setHeight(isHorizontal ? thumbHeight : thumbWidth); + } + + IntSize tickSize = sliderTickSize(); + float zoomFactor = o->style()->effectiveZoom(); + FloatRect tickRect; + int tickRegionMargin = (thumbSize.width() - tickSize.width()) / 2.0; + int tickRegionSideMargin = 0; + int tickRegionWidth = 0; + if (isHorizontal) { + tickRect.setWidth(floor(tickSize.width() * zoomFactor)); + tickRect.setHeight(floor(tickSize.height() * zoomFactor)); + tickRect.setY(floor(rect.y() + rect.height() / 2.0 + sliderTickOffsetFromTrackCenter() * zoomFactor)); + tickRegionSideMargin = rect.x() + tickRegionMargin; + tickRegionWidth = rect.width() - tickRegionMargin * 2 - tickSize.width() * zoomFactor; + } else { + tickRect.setWidth(floor(tickSize.height() * zoomFactor)); + tickRect.setHeight(floor(tickSize.width() * zoomFactor)); + tickRect.setX(floor(rect.x() + rect.width() / 2.0 + sliderTickOffsetFromTrackCenter() * zoomFactor)); + tickRegionSideMargin = rect.y() + tickRegionMargin; + tickRegionWidth = rect.height() - tickRegionMargin * 2 - tickSize.width() * zoomFactor; + } + RefPtr<HTMLCollection> options = dataList->options(); + GraphicsContextStateSaver stateSaver(*paintInfo.context); + paintInfo.context->setFillColor(o->style()->visitedDependentColor(CSSPropertyColor), ColorSpaceDeviceRGB); + for (unsigned i = 0; Node* node = options->item(i); i++) { + ASSERT(node->hasTagName(optionTag)); + HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(node); + String value = optionElement->value(); + if (!input->isValidValue(value)) + continue; + double parsedValue = parseToDoubleForNumberType(input->sanitizeValue(value)); + double tickPosition = (parsedValue - min) / (max - min); + if (!o->style()->isLeftToRightDirection()) + tickPosition = 1.0 - tickPosition; + if (isHorizontal) + tickRect.setX(floor(tickRegionSideMargin + tickRegionWidth * tickPosition)); + else + tickRect.setY(floor(tickRegionSideMargin + tickRegionWidth * tickPosition)); + paintInfo.context->fillRect(tickRect); + } +} +#endif + +#if ENABLE(PROGRESS_ELEMENT) double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const { return 0; diff --git a/Source/WebCore/rendering/RenderTheme.h b/Source/WebCore/rendering/RenderTheme.h index 5e56b6df5..629834bc8 100644 --- a/Source/WebCore/rendering/RenderTheme.h +++ b/Source/WebCore/rendering/RenderTheme.h @@ -40,10 +40,10 @@ class FileList; class HTMLInputElement; class PopupMenu; class RenderMenuList; -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) class RenderMeter; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) class RenderProgress; #endif class CSSStyleSheet; @@ -185,7 +185,7 @@ public: // Method for painting the caps lock indicator virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; }; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // Returns the repeat interval of the animation for the progress bar. virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; // Returns the duration of the animation for the progress bar. @@ -209,11 +209,20 @@ public: virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const; #endif -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; virtual bool supportsMeter(ControlPart) const; #endif - + +#if ENABLE(DATALIST_ELEMENT) + // Returns size of one slider tick mark for a horizontal track. + // For vertical tracks we rotate it and use it. i.e. Width is always length along the track. + virtual IntSize sliderTickSize() const = 0; + // Returns the distance of slider tick origin from the slider track center. + virtual int sliderTickOffsetFromTrackCenter() const = 0; + void paintSliderTicks(RenderObject*, const PaintInfo&, const IntRect&); +#endif + virtual bool shouldShowPlaceholderWhenFocused() const { return false; } virtual bool shouldHaveSpinButton(HTMLInputElement*) const; @@ -270,12 +279,12 @@ protected: virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual void adjustMeterStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&) { return true; } #endif diff --git a/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp b/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp index 5739c50b4..368c2b566 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp @@ -32,9 +32,10 @@ namespace WebCore { bool RenderThemeChromiumCommon::supportsDataListUI(const AtomicString& type) { - // FIXME: We still need to support email, datetime, date, month, week, time, datetime-local, range, color. + // FIXME: We still need to support datetime, date, month, week, time, datetime-local, color. return type == InputTypeNames::text() || type == InputTypeNames::search() || type == InputTypeNames::url() - || type == InputTypeNames::telephone() || type == InputTypeNames::email() || type == InputTypeNames::number(); + || type == InputTypeNames::telephone() || type == InputTypeNames::email() || type == InputTypeNames::number() + || type == InputTypeNames::range(); } } diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp index 6b7f158ee..f25d4903a 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp @@ -146,6 +146,18 @@ Color RenderThemeChromiumLinux::platformInactiveSelectionForegroundColor() const return m_inactiveSelectionForegroundColor; } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeChromiumLinux::sliderTickSize() const +{ + return IntSize(1, 6); +} + +int RenderThemeChromiumLinux::sliderTickOffsetFromTrackCenter() const +{ + return -16; +} +#endif + void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderStyle* style, Element* element) const { IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartSliderThumb); @@ -292,6 +304,11 @@ bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart; PlatformSupport::paintThemePart(i.context, PlatformSupport::PartSliderTrack, getWebThemeState(this, o), rect, &extraParams); + +#if ENABLE(DATALIST_ELEMENT) + paintSliderTicks(o, i, rect); +#endif + return false; } @@ -323,7 +340,7 @@ bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const Paint return false; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect) { diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.h b/Source/WebCore/rendering/RenderThemeChromiumLinux.h index d75408251..3e23f5b83 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.h +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.h @@ -54,6 +54,10 @@ namespace WebCore { virtual Color platformActiveSelectionForegroundColor() const; virtual Color platformInactiveSelectionForegroundColor() const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; static void setCaretBlinkInterval(double interval); @@ -76,7 +80,7 @@ namespace WebCore { virtual bool popsMenuBySpaceOrReturn() const OVERRIDE { return true; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp index c88066616..3f0e907e2 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -588,7 +588,7 @@ bool RenderThemeChromiumSkia::shouldShowPlaceholderWhenFocused() const return true; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // // Following values are come from default of GTK+ diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.h b/Source/WebCore/rendering/RenderThemeChromiumSkia.h index 745873052..ca1c2ed2e 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.h @@ -116,7 +116,7 @@ class RenderThemeChromiumSkia : public RenderTheme { virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; #endif @@ -154,7 +154,7 @@ class RenderThemeChromiumSkia : public RenderTheme { static void setSizeIfAuto(RenderStyle*, const IntSize&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect progressValueRectFor(RenderProgress*, const IntRect&) const; diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp index e2c41d9dd..c00e46e06 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -391,6 +391,18 @@ Color RenderThemeChromiumWin::systemColor(int cssValueId) const return Color(GetRValue(color), GetGValue(color), GetBValue(color)); } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeChromiumWin::sliderTickSize() const +{ + return IntSize(1, 3); +} + +int RenderThemeChromiumWin::sliderTickOffsetFromTrackCenter() const +{ + return 11; +} +#endif + void RenderThemeChromiumWin::adjustSliderThumbSize(RenderStyle* style, Element* element) const { // These sizes match what WinXP draws for various menus. @@ -443,12 +455,26 @@ bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const PaintInfo& themeData.m_state, themeData.m_classicState, painter.drawRect()); + +#if ENABLE(DATALIST_ELEMENT) + paintSliderTicks(o, i, r); +#endif + return false; } bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r) { - return paintSliderTrack(o, i, r); + const ThemeData& themeData = getThemeData(o); + + ThemePainter painter(i.context, r); + PlatformSupport::paintTrackbar(painter.context(), + themeData.m_part, + themeData.m_state, + themeData.m_classicState, + painter.drawRect()); + + return false; } static int menuListButtonWidth() @@ -742,7 +768,7 @@ bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const Pa return false; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // MSDN says that update intervals for the bar is 30ms. // http://msdn.microsoft.com/en-us/library/bb760842(v=VS.85).aspx diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.h b/Source/WebCore/rendering/RenderThemeChromiumWin.h index ad9eace89..14134c560 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.h +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.h @@ -61,6 +61,10 @@ namespace WebCore { virtual void systemFont(int propId, FontDescription&) const; virtual Color systemColor(int cssValueId) const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; // Various paint functions. @@ -89,7 +93,7 @@ namespace WebCore { virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; diff --git a/Source/WebCore/rendering/RenderThemeMac.h b/Source/WebCore/rendering/RenderThemeMac.h index 2f5f80e8c..7ad49bd34 100644 --- a/Source/WebCore/rendering/RenderThemeMac.h +++ b/Source/WebCore/rendering/RenderThemeMac.h @@ -68,7 +68,12 @@ public: virtual int minimumMenuListSize(RenderStyle*) const; virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; - + +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif + virtual int popupInternalPaddingLeft(RenderStyle*) const; virtual int popupInternalPaddingRight(RenderStyle*) const; virtual int popupInternalPaddingTop(RenderStyle*) const; @@ -78,13 +83,13 @@ public: virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const OVERRIDE; virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); virtual bool supportsMeter(ControlPart) const; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // Returns the repeat interval of the animation for the progress bar. virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; // Returns the duration of the animation for the progress bar. @@ -114,7 +119,7 @@ protected: virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif @@ -221,12 +226,12 @@ private: NSSliderCell* sliderThumbVertical() const; NSTextFieldCell* textField() const; -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const; NSLevelIndicatorCell* levelIndicatorFor(const RenderMeter*) const; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) int minimumProgressBarHeight(RenderStyle*) const; const IntSize* progressBarSizes() const; const int* progressBarMargins(NSControlSize) const; diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index 6ed4abdef..9de2b1252 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -58,7 +58,7 @@ #import "RenderProgress.h" -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "RenderMeter.h" #include "HTMLMeterElement.h" #endif @@ -857,7 +857,7 @@ bool RenderThemeMac::paintMenuList(RenderObject* o, const PaintInfo& paintInfo, return false; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const { @@ -961,7 +961,7 @@ NSLevelIndicatorCell* RenderThemeMac::levelIndicatorFor(const RenderMeter* rende #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) const IntSize* RenderThemeMac::progressBarSizes() const { static const IntSize sizes[3] = { IntSize(0, 20), IntSize(0, 12), IntSize(0, 12) }; @@ -1372,6 +1372,10 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf CGContextRef context = localContext.cgContext(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); +#if ENABLE(DATALIST_ELEMENT) + paintSliderTicks(o, paintInfo, r); +#endif + GraphicsContextStateSaver stateSaver(*paintInfo.context); CGContextClipToRect(context, bounds); @@ -1742,6 +1746,18 @@ static int mediaControllerTheme() } #endif +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeMac::sliderTickSize() const +{ + return IntSize(1, 3); +} + +int RenderThemeMac::sliderTickOffsetFromTrackCenter() const +{ + return -9; +} +#endif + const int sliderThumbWidth = 15; const int sliderThumbHeight = 15; const int mediaSliderThumbWidth = 13; diff --git a/Source/WebCore/rendering/RenderTreeAsText.cpp b/Source/WebCore/rendering/RenderTreeAsText.cpp index 59ceebd68..8af6a2765 100644 --- a/Source/WebCore/rendering/RenderTreeAsText.cpp +++ b/Source/WebCore/rendering/RenderTreeAsText.cpp @@ -398,7 +398,7 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o, ts << " [r=" << c.rowIndex() << " c=" << c.col() << " rs=" << c.rowSpan() << " cs=" << c.colSpan() << "]"; } -#if ENABLE(DETAILS) +#if ENABLE(DETAILS_ELEMENT) if (o.isDetailsMarker()) { ts << ": "; switch (toRenderDetailsMarker(&o)->orientation()) { diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index a3486f61c..ebae66e68 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -852,7 +852,11 @@ void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p result.setInnerNode(node); if (!result.innerNonSharedNode()) result.setInnerNonSharedNode(node); - result.setLocalPoint(point); + + LayoutPoint adjustedPoint = point; + adjustPointToColumnContents(adjustedPoint); + + result.setLocalPoint(adjustedPoint); } } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp index e6f755c98..0f91610e6 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp @@ -316,7 +316,6 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo context->concatCTM(filterData->shearFreeAbsoluteTransform.inverse()); context->scale(FloatSize(1 / filterData->filter->filterResolution().width(), 1 / filterData->filter->filterResolution().height())); - context->clip(lastEffect->maxEffectRect()); context->drawImageBuffer(resultImage, object->style()->colorSpace(), lastEffect->absolutePaintRect()); context->scale(filterData->filter->filterResolution()); diff --git a/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp b/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp index 3ed63ddd6..15b48f590 100644 --- a/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp @@ -36,8 +36,6 @@ namespace WebCore { RenderSVGTextPath::RenderSVGTextPath(Node* n) : RenderSVGInline(n) - , m_exactAlignment(true) - , m_stretchMethod(false) { } diff --git a/Source/WebCore/rendering/svg/RenderSVGTextPath.h b/Source/WebCore/rendering/svg/RenderSVGTextPath.h index be156ba48..2758a0692 100644 --- a/Source/WebCore/rendering/svg/RenderSVGTextPath.h +++ b/Source/WebCore/rendering/svg/RenderSVGTextPath.h @@ -40,9 +40,6 @@ public: private: virtual const char* renderName() const { return "RenderSVGTextPath"; } - bool m_exactAlignment : 1; - bool m_stretchMethod : 1; - Path m_layoutPath; }; diff --git a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp index 966dd46b1..e3fd833a2 100755 --- a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp @@ -387,7 +387,7 @@ static void writeRenderSVGTextBox(TextStream& ts, const RenderSVGText& text) if (!box) return; - ts << " " << enclosingIntRect(FloatRect(text.x(), text.y(), box->logicalWidth(), box->logicalHeight())); + ts << " " << enclosingIntRect(FloatRect(text.location(), FloatSize(box->logicalWidth(), box->logicalHeight()))); // FIXME: Remove this hack, once the new text layout engine is completly landed. We want to preserve the old layout test results for now. ts << " contains 1 chunk(s)"; diff --git a/Source/WebCore/storage/StorageAreaImpl.h b/Source/WebCore/storage/StorageAreaImpl.h index be0451c85..4c90e5bc0 100644 --- a/Source/WebCore/storage/StorageAreaImpl.h +++ b/Source/WebCore/storage/StorageAreaImpl.h @@ -70,7 +70,7 @@ namespace WebCore { private: StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota); - StorageAreaImpl(StorageAreaImpl*); + explicit StorageAreaImpl(StorageAreaImpl*); void blockUntilImportComplete() const; void closeDatabaseTimerFired(Timer<StorageAreaImpl>*); diff --git a/Source/WebCore/storage/StorageMap.h b/Source/WebCore/storage/StorageMap.h index 1fc17b077..147df6402 100644 --- a/Source/WebCore/storage/StorageMap.h +++ b/Source/WebCore/storage/StorageMap.h @@ -54,7 +54,7 @@ namespace WebCore { static const unsigned noQuota = UINT_MAX; private: - StorageMap(unsigned quota); + explicit StorageMap(unsigned quota); PassRefPtr<StorageMap> copy(); void invalidateIterator(); void setIteratorToIndex(unsigned); diff --git a/Source/WebCore/storage/StorageSyncManager.h b/Source/WebCore/storage/StorageSyncManager.h index e27833787..fa5c16dcc 100644 --- a/Source/WebCore/storage/StorageSyncManager.h +++ b/Source/WebCore/storage/StorageSyncManager.h @@ -50,7 +50,7 @@ namespace WebCore { void close(); private: - StorageSyncManager(const String& path); + explicit StorageSyncManager(const String& path); OwnPtr<StorageThread> m_thread; diff --git a/Source/WebCore/storage/StorageTask.h b/Source/WebCore/storage/StorageTask.h index 7d0523fd1..b14e9fe5f 100644 --- a/Source/WebCore/storage/StorageTask.h +++ b/Source/WebCore/storage/StorageTask.h @@ -58,7 +58,7 @@ namespace WebCore { StorageTask(Type, StorageThread*); StorageTask(Type, const String& originIdentifier); StorageTask(Type, const String& originIdentifier, const String& databaseFilename); - StorageTask(Type); + explicit StorageTask(Type); Type m_type; StorageAreaSync* m_area; diff --git a/Source/WebCore/storage/StorageTracker.h b/Source/WebCore/storage/StorageTracker.h index 9ee23f5ff..ea3a38fde 100644 --- a/Source/WebCore/storage/StorageTracker.h +++ b/Source/WebCore/storage/StorageTracker.h @@ -78,7 +78,7 @@ public: void setStorageDatabaseIdleInterval(double interval) { m_StorageDatabaseIdleInterval = interval; } private: - StorageTracker(const String& storagePath); + explicit StorageTracker(const String& storagePath); static void scheduleTask(void*); void internalInitialize(); diff --git a/Source/WebCore/svg/SVGParserUtilities.cpp b/Source/WebCore/svg/SVGParserUtilities.cpp index be0c2199b..71e2a39e2 100644 --- a/Source/WebCore/svg/SVGParserUtilities.cpp +++ b/Source/WebCore/svg/SVGParserUtilities.cpp @@ -142,6 +142,13 @@ template <typename FloatType> static bool genericParseNumber(const UChar*& ptr, return true; } +bool parseSVGNumber(UChar*& begin, size_t length, double& number) +{ + const UChar* ptr = begin; + const UChar* end = ptr + length; + return genericParseNumber(ptr, end, number, false); +} + bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip) { return genericParseNumber(ptr, end, number, skip); diff --git a/Source/WebCore/svg/SVGParserUtilities.h b/Source/WebCore/svg/SVGParserUtilities.h index ad35a07ba..e1ba0c8c9 100644 --- a/Source/WebCore/svg/SVGParserUtilities.h +++ b/Source/WebCore/svg/SVGParserUtilities.h @@ -33,6 +33,7 @@ namespace WebCore { class FloatRect; class SVGPointList; +bool parseSVGNumber(UChar*& ptr, size_t length, double& number); bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true); bool parseNumberFromString(const String&, float& number, bool skip = true); bool parseNumberOptionalNumber(const String& s, float& h, float& v); diff --git a/Source/WebCore/workers/AbstractWorker.cpp b/Source/WebCore/workers/AbstractWorker.cpp index 07cf73fa9..0ad995b22 100644 --- a/Source/WebCore/workers/AbstractWorker.cpp +++ b/Source/WebCore/workers/AbstractWorker.cpp @@ -55,14 +55,8 @@ AbstractWorker::~AbstractWorker() { } -void AbstractWorker::onDestroyWorker() -{ - InspectorInstrumentation::didDestroyWorker(scriptExecutionContext(), asID()); -} - void AbstractWorker::contextDestroyed() { - onDestroyWorker(); ActiveDOMObject::contextDestroyed(); } diff --git a/Source/WebCore/workers/AbstractWorker.h b/Source/WebCore/workers/AbstractWorker.h index f4cc50bd2..49754f290 100644 --- a/Source/WebCore/workers/AbstractWorker.h +++ b/Source/WebCore/workers/AbstractWorker.h @@ -71,7 +71,6 @@ namespace WebCore { virtual void derefEventTarget() { deref(); } virtual EventTargetData* eventTargetData(); virtual EventTargetData* ensureEventTargetData(); - void onDestroyWorker(); EventTargetData m_eventTargetData; }; diff --git a/Source/WebCore/workers/SharedWorker.cpp b/Source/WebCore/workers/SharedWorker.cpp index 9e94ee50f..571827d66 100644 --- a/Source/WebCore/workers/SharedWorker.cpp +++ b/Source/WebCore/workers/SharedWorker.cpp @@ -66,8 +66,6 @@ PassRefPtr<SharedWorker> SharedWorker::create(ScriptExecutionContext* context, c SharedWorkerRepository::connect(worker.get(), remotePort.release(), scriptURL, name, ec); - InspectorInstrumentation::didCreateWorker(context, worker->asID(), scriptURL.string(), true); - return worker.release(); } diff --git a/Source/WebCore/workers/SharedWorker.h b/Source/WebCore/workers/SharedWorker.h index 00362ba25..845aed9c3 100644 --- a/Source/WebCore/workers/SharedWorker.h +++ b/Source/WebCore/workers/SharedWorker.h @@ -48,7 +48,7 @@ namespace WebCore { virtual const AtomicString& interfaceName() const; private: - SharedWorker(ScriptExecutionContext*); + explicit SharedWorker(ScriptExecutionContext*); virtual SharedWorker* toSharedWorker() { return this; } diff --git a/Source/WebCore/workers/Worker.cpp b/Source/WebCore/workers/Worker.cpp index 34298f188..456185768 100644 --- a/Source/WebCore/workers/Worker.cpp +++ b/Source/WebCore/workers/Worker.cpp @@ -75,8 +75,6 @@ PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String& #endif worker->m_scriptLoader->loadAsynchronously(context, scriptURL, DenyCrossOriginRequests, worker.get()); - InspectorInstrumentation::didCreateWorker(context, worker->asID(), scriptURL.string(), false); - return worker.release(); } diff --git a/Source/WebCore/workers/Worker.h b/Source/WebCore/workers/Worker.h index cea1a640e..c7a1f8d99 100644 --- a/Source/WebCore/workers/Worker.h +++ b/Source/WebCore/workers/Worker.h @@ -70,7 +70,7 @@ namespace WebCore { DEFINE_ATTRIBUTE_EVENT_LISTENER(message); private: - Worker(ScriptExecutionContext*); + explicit Worker(ScriptExecutionContext*); // WorkerScriptLoaderClient callbacks virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&); diff --git a/Source/WebCore/workers/WorkerLocation.h b/Source/WebCore/workers/WorkerLocation.h index 692c0e3c5..4bd359189 100644 --- a/Source/WebCore/workers/WorkerLocation.h +++ b/Source/WebCore/workers/WorkerLocation.h @@ -60,7 +60,7 @@ namespace WebCore { String toString() const { return href(); } private: - WorkerLocation(const KURL& url) : m_url(url) { } + explicit WorkerLocation(const KURL& url) : m_url(url) { } KURL m_url; }; diff --git a/Source/WebCore/workers/WorkerMessagingProxy.h b/Source/WebCore/workers/WorkerMessagingProxy.h index b7cbe526f..77bcab2b6 100644 --- a/Source/WebCore/workers/WorkerMessagingProxy.h +++ b/Source/WebCore/workers/WorkerMessagingProxy.h @@ -49,7 +49,7 @@ namespace WebCore { class WorkerMessagingProxy : public WorkerContextProxy, public WorkerObjectProxy, public WorkerLoaderProxy { WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); WTF_MAKE_FAST_ALLOCATED; public: - WorkerMessagingProxy(Worker*); + explicit WorkerMessagingProxy(Worker*); // Implementations of WorkerContextProxy. // (Only use these methods in the worker object thread.) diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp index f16b8653b..768a019cd 100644 --- a/Source/WebCore/xml/XMLHttpRequest.cpp +++ b/Source/WebCore/xml/XMLHttpRequest.cpp @@ -354,7 +354,7 @@ void XMLHttpRequest::setResponseType(const String& responseType, ExceptionCode& else if (responseType == "arraybuffer") m_responseTypeCode = ResponseTypeArrayBuffer; else - ec = SYNTAX_ERR; + logConsoleError(scriptExecutionContext(), "XMLHttpRequest.responseType \"" + responseType + "\" is not supported."); } String XMLHttpRequest::responseType() diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index eee8a48f6..9a2adea37 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,36 @@ +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * PlatformEfl.cmake: + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Proxy configuration should honor the no_proxy environment variable + https://bugs.webkit.org/show_bug.cgi?id=91747 + + Reviewed by Kenneth Rohde Christiansen. + + Add WebCore/platform/network/soup to INCLUDE paths. + + * PlatformEfl.cmake: + +2012-07-18 Yong Li <yoli@rim.com> + + [BlackBerry] Move about: URL handling out of WebCore + https://bugs.webkit.org/show_bug.cgi?id=91541 + + Reviewed by Rob Buis. + + AboutData.cpp is moved from WebCoreSupport to WebKitSupport. + + * PlatformBlackBerry.cmake: + 2012-07-18 Thiago Marcos P. Santos <thiago.santos@intel.com> [CMake] Make gtest a shared library diff --git a/Source/WebKit/PlatformBlackBerry.cmake b/Source/WebKit/PlatformBlackBerry.cmake index 0c2f18336..05aaed8a9 100644 --- a/Source/WebKit/PlatformBlackBerry.cmake +++ b/Source/WebKit/PlatformBlackBerry.cmake @@ -68,7 +68,6 @@ LIST(APPEND WebKit_SOURCES blackberry/Api/WebSettings.cpp blackberry/Api/WebString.cpp blackberry/Api/WebViewportArguments.cpp - blackberry/WebCoreSupport/AboutData.cpp blackberry/WebCoreSupport/AutofillManager.cpp blackberry/WebCoreSupport/CacheClientBlackBerry.cpp blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -92,6 +91,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/PagePopupBlackBerry.cpp blackberry/WebCoreSupport/SelectPopupClient.cpp blackberry/WebCoreSupport/DatePickerClient.cpp + blackberry/WebKitSupport/AboutData.cpp blackberry/WebKitSupport/BackingStoreCompositingSurface.cpp blackberry/WebKitSupport/BackingStoreTile.cpp blackberry/WebKitSupport/BackingStoreClient.cpp diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake index c6243da30..6cdc9b775 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -13,6 +13,7 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/efl" "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBCORE_DIR}/platform/graphics/efl" + "${WEBCORE_DIR}/platform/network/soup" ${CAIRO_INCLUDE_DIRS} ${ECORE_X_INCLUDE_DIRS} ${EDJE_INCLUDE_DIRS} @@ -171,8 +172,8 @@ LIST(APPEND WebKit_LIBRARIES ) SET(WebKit_THEME_DEFINITION "") -IF (ENABLE_PROGRESS_TAG) - LIST(APPEND WebKit_THEME_DEFINITION "-DENABLE_PROGRESS_TAG") +IF (ENABLE_PROGRESS_ELEMENT) + LIST(APPEND WebKit_THEME_DEFINITION "-DENABLE_PROGRESS_ELEMENT") ENDIF () FILE(MAKE_DIRECTORY ${THEME_BINARY_DIR}) diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 61fddfa16..78102c179 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -196,8 +196,9 @@ Platform::IntSize BackingStoreGeometry::backingStoreSize() const } BackingStorePrivate::BackingStorePrivate() - : m_suspendScreenUpdates(false) - , m_suspendBackingStoreUpdates(false) + : m_suspendScreenUpdates(0) + , m_suspendBackingStoreUpdates(0) + , m_resumeOperation(BackingStore::None) , m_suspendRenderJobs(false) , m_suspendRegularRenderJobs(false) , m_isScrollingOrZooming(false) @@ -279,12 +280,18 @@ bool BackingStorePrivate::isOpenGLCompositing() const void BackingStorePrivate::suspendScreenAndBackingStoreUpdates() { - m_suspendBackingStoreUpdates = true; + if (m_suspendScreenUpdates) { + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, + "Screen and backingstore already suspended, increasing suspend counter."); + } + + ++m_suspendBackingStoreUpdates; // Make sure the user interface thread gets the message before we proceed // because blitContents can be called from this thread and it must honor // this flag. - m_suspendScreenUpdates = true; + ++m_suspendScreenUpdates; + BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); #if USE(ACCELERATED_COMPOSITING) @@ -294,14 +301,42 @@ void BackingStorePrivate::suspendScreenAndBackingStoreUpdates() void BackingStorePrivate::resumeScreenAndBackingStoreUpdates(BackingStore::ResumeUpdateOperation op) { - m_suspendBackingStoreUpdates = false; + ASSERT(m_suspendScreenUpdates); + ASSERT(m_suspendBackingStoreUpdates); + + // Both variables are similar except for the timing of setting them. + ASSERT(m_suspendScreenUpdates == m_suspendBackingStoreUpdates); + + if (!m_suspendScreenUpdates || !m_suspendBackingStoreUpdates) { + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, + "Call mismatch: Screen and backingstore haven't been suspended, therefore won't resume!"); + return; + } + + // Out of all nested resume calls, resume with the maximum-impact operation. + if (op == BackingStore::RenderAndBlit + || (m_resumeOperation == BackingStore::None && op == BackingStore::Blit)) + m_resumeOperation = op; + + if (m_suspendScreenUpdates >= 2 && m_suspendBackingStoreUpdates >= 2) { // we're still suspended + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, + "Screen and backingstore still suspended, decreasing suspend counter."); + --m_suspendBackingStoreUpdates; + --m_suspendScreenUpdates; + return; + } + + --m_suspendBackingStoreUpdates; + + op = m_resumeOperation; + m_resumeOperation = BackingStore::None; #if USE(ACCELERATED_COMPOSITING) if (op != BackingStore::None) { if (isOpenGLCompositing() && !isActive()) { m_webPage->d->setCompositorDrawsRootLayer(true); m_webPage->d->setNeedsOneShotDrawingSynchronization(); - m_suspendScreenUpdates = false; + --m_suspendScreenUpdates; BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); return; } @@ -322,7 +357,7 @@ void BackingStorePrivate::resumeScreenAndBackingStoreUpdates(BackingStore::Resum // Make sure the user interface thread gets the message before we proceed // because blitContents can be called from the user interface thread and // it must honor this flag. - m_suspendScreenUpdates = false; + --m_suspendScreenUpdates; BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); // Do some blitting if necessary. @@ -1567,7 +1602,7 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, for (unsigned int i = 0; i < blittedTiles.size(); ++i) blittedTiles[i]->setBlitGeneration(m_blitGeneration); - clock_gettime(CLOCK_REALTIME, &m_currentBlitEnd); + clock_gettime(CLOCK_MONOTONIC, &m_currentBlitEnd); m_currentBlitEnd.tv_nsec += 30 * 1000 * 1000; if (m_currentBlitEnd.tv_nsec >= 1000000000L) { m_currentBlitEnd.tv_sec += 1; @@ -2179,6 +2214,10 @@ void BackingStorePrivate::createSurfaces() swapState(); createVisibleTileBufferForWebPage(m_webPage->d); + + // Don't try to blit to screen unless we have a buffer. + if (!buffer()) + suspendScreenAndBackingStoreUpdates(); } void BackingStorePrivate::createVisibleTileBuffer() diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index e140064e2..50feb041c 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -336,8 +336,9 @@ public: static WebPage* s_currentBackingStoreOwner; - bool m_suspendScreenUpdates; - bool m_suspendBackingStoreUpdates; + unsigned m_suspendScreenUpdates; + unsigned m_suspendBackingStoreUpdates; + BackingStore::ResumeUpdateOperation m_resumeOperation; bool m_suspendRenderJobs; bool m_suspendRegularRenderJobs; diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 2e5098d37..b5686707f 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -19,6 +19,8 @@ #include "config.h" #include "WebPage.h" +#include "AboutData.h" +#include "AboutTemplate.html.cpp" #include "ApplicationCacheStorage.h" #include "AutofillManager.h" #include "BackForwardController.h" @@ -155,6 +157,8 @@ #include <BlackBerryPlatformMouseEvent.h> #include <BlackBerryPlatformScreen.h> #include <BlackBerryPlatformSettings.h> +#include <BlackBerryPlatformWebKitCredits.h> +#include <BuildInformation.h> #include <JavaScriptCore/APICast.h> #include <JavaScriptCore/JSContextRef.h> #include <JavaScriptCore/JSStringRef.h> @@ -615,6 +619,84 @@ private: } }; +bool WebPagePrivate::loadAbout(const char* aboutURL) +{ + if (strncasecmp(aboutURL, "about:", 6)) + return false; + + // First 6 chars are "about:". + String aboutWhat(aboutURL + 6); + + String result; + + if (equalIgnoringCase(aboutWhat, "credits")) { + result.append(writeHeader("Credits")); + result.append(String("<style> .about {padding:14px;} </style>")); + result.append(String(BlackBerry::Platform::WEBKITCREDITS)); + result.append(String("</body></html>")); + } else if (aboutWhat.startsWith("cache?query=", false)) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + std::string key(aboutWhat.substring(12, aboutWhat.length() - 12).utf8().data()); // 12 is length of "cache?query=". + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); + result.append(String(key.data())); + result.append(String("<hr>")); + result.append(String(client->generateHtmlFragmentForCacheHeaders(key).data())); + result.append(String("</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "cache")) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); + result.append(String(client->generateHtmlFragmentForCacheKeys().data())); + result.append(String("</body></html>")); +#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD + } else if (equalIgnoringCase(aboutWhat, "cache/disable")) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + client->setDiskCacheEnabled(false); + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is disabled.</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "cache/enable")) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + client->setDiskCacheEnabled(true); + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is enabled.</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "cookie")) { + result.append(String("<html><head><title>BlackBerry Browser cookie information</title></head><body>")); + result.append(cookieManager().generateHtmlFragmentForCookies()); + result.append(String("</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "version")) { + result.append(writeHeader("Version")); + result.append(String("<div class='box'><div class='box-title'>Build Time</div><br>")); + result.append(String(BlackBerry::Platform::BUILDTIME)); + result.append(String("</div><br><div style='font-size:10px;text-align:center;'>Also see the <A href='about:build'>build information</A>.</body></html>")); + } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "config")) { + result = configPage(); + } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "build")) { + result.append(writeHeader("Build")); + result.append(String("<div class='box'><div class='box-title'>Basic</div><table>")); + result.append(String("<tr><td>Built On: </td><td>")); + result.append(String(BlackBerry::Platform::BUILDCOMPUTER)); + result.append(String("</td></tr>")); + result.append(String("<tr><td>Build User: </td><td>")); + result.append(String(BlackBerry::Platform::BUILDUSER)); + result.append(String("</td></tr>")); + result.append(String("<tr><td>Build Time: </td><td>")); + result.append(String(BlackBerry::Platform::BUILDTIME)); + result.append(String("</table></div><br>")); + result.append(String(BlackBerry::Platform::BUILDINFO_WEBKIT)); + result.append(String(BlackBerry::Platform::BUILDINFO_PLATFORM)); + result.append(String(BlackBerry::Platform::BUILDINFO_LIBWEBVIEW)); + result.append(String("</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "memory")) { + result = memoryPage(); +#endif + } else + return false; + + loadString(result.latin1().data(), aboutURL, "text/html"); + return true; +} + void WebPagePrivate::load(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool forceDownload, const char* overrideContentType, const char* suggestedSaveName) { stopCurrentLoad(); @@ -665,6 +747,8 @@ void WebPagePrivate::load(const char* url, const char* networkToken, const char* void WebPage::load(const char* url, const char* networkToken, bool isInitial) { + if (d->loadAbout(url)) + return; d->load(url, networkToken, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, isInitial, false); } @@ -1174,8 +1258,6 @@ bool WebPagePrivate::shouldZoomAboutPoint(double scale, const FloatPoint&, bool *clampedScale = scale; if (currentScale() == scale) { - // Make sure backingstore updates resume from pinch zoom in the case where the final zoom level doesn't change. - m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::None); m_client->zoomChanged(m_webPage->isMinZoomed(), m_webPage->isMaxZoomed(), !shouldZoomOnEscape(), currentScale()); return false; } @@ -1367,6 +1449,7 @@ void WebPagePrivate::unscheduleZoomAboutPoint() void WebPagePrivate::zoomAboutPointTimerFired(Timer<WebPagePrivate>*) { zoomAboutPoint(m_delayedZoomArguments.scale, m_delayedZoomArguments.anchor, m_delayedZoomArguments.enforceScaleClamping, m_delayedZoomArguments.forceRendering); + m_backingStore->d->resumeScreenAndBackingStoreUpdates(m_delayedZoomArguments.forceRendering ? BackingStore::RenderAndBlit : BackingStore::None); } void WebPagePrivate::setNeedsLayout() @@ -3076,20 +3159,25 @@ IntRect WebPagePrivate::blockZoomRectForNode(Node* node) clipToTransformedContentsRect(blockRect); #if DEBUG_BLOCK_ZOOM - // Re-paint the backingstore to screen to erase other annotations. - m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::Blit); - - // Render a black square over the calculated block and a gray square over the original block for visual inspection. - originalRect = mapToTransformed(originalRect); - clipToTransformedContentsRect(originalRect); - IntRect renderRect = mapFromTransformedContentsToTransformedViewport(blockRect); - IntRect originalRenderRect = mapFromTransformedContentsToTransformedViewport(originalRect); - IntSize viewportSize = transformedViewportSize(); - renderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); - originalRenderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); - m_backingStore->d->clearWindow(renderRect, 0, 0, 0); - m_backingStore->d->clearWindow(originalRenderRect, 120, 120, 120); - m_backingStore->d->invalidateWindow(renderRect); + if (!m_backingStore->d->isSuspended()) { + // Re-paint the backingstore to screen to erase other annotations. + if (m_backingStore->d->shouldDirectRenderingToWindow()) + m_backingStore->d->renderVisibleContents(); + else + m_backingStore->d->blitVisibleContents(); + + // Render a black square over the calculated block and a gray square over the original block for visual inspection. + originalRect = mapToTransformed(originalRect); + clipToTransformedContentsRect(originalRect); + IntRect renderRect = mapFromTransformedContentsToTransformedViewport(blockRect); + IntRect originalRenderRect = mapFromTransformedContentsToTransformedViewport(originalRect); + IntSize viewportSize = transformedViewportSize(); + renderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); + originalRenderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); + m_backingStore->d->clearWindow(renderRect, 0, 0, 0); + m_backingStore->d->clearWindow(originalRenderRect, 120, 120, 120); + m_backingStore->d->invalidateWindow(renderRect); + } #endif return blockRect; @@ -5865,21 +5953,33 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit { using namespace BlackBerry::Platform; + // We depend on the current thread being the WebKit thread when it's not the Compositing thread. + // That seems extremely likely to be the case, but let's assert just to make sure. + ASSERT(webKitThreadMessageClient()->isCurrentThread()); + + if (m_backingStore->d->buffer()) + m_backingStore->d->suspendScreenAndBackingStoreUpdates(); + + // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), + // and the compositing context must be set on the WebKit thread. How convenient! + if (compositingContext != EGL_NO_CONTEXT) + BlackBerry::Platform::Graphics::setCompositingContext(compositingContext); + // The m_compositor member has to be modified during a sync call for thread // safe access to m_compositor and its refcount. - if (!userInterfaceThreadMessageClient()->isCurrentThread()) { - // We depend on the current thread being the WebKit thread when it's not the Compositing thread. - // That seems extremely likely to be the case, but let's assert just to make sure. - ASSERT(webKitThreadMessageClient()->isCurrentThread()); + userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositorHelper, this, compositor, compositingContext)); - // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), - // and the compositing context must be set on the WebKit thread. How convenient! - if (compositingContext != EGL_NO_CONTEXT) - BlackBerry::Platform::Graphics::setCompositingContext(compositingContext); + if (m_backingStore->d->buffer()) // the new compositor, if one was set + m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); +} - userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor, compositingContext)); - return; - } +void WebPagePrivate::setCompositorHelper(PassRefPtr<WebPageCompositorPrivate> compositor, EGLContext compositingContext) +{ + using namespace BlackBerry::Platform; + + // The m_compositor member has to be modified during a sync call for thread + // safe access to m_compositor and its refcount. + ASSERT(userInterfaceThreadMessageClient()->isCurrentThread()); m_compositor = compositor; if (m_compositor) { diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index 005631e1b..b4ca9175b 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -97,6 +97,7 @@ public: bool handleMouseEvent(WebCore::PlatformMouseEvent&); bool handleWheelEvent(WebCore::PlatformWheelEvent&); + bool loadAbout(const char* aboutURL); void load(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally = false, bool forceDownload = false, const char* overrideContentType = "", const char* suggestedSaveName = ""); void loadString(const char* string, const char* baseURL, const char* mimeType, const char* failingURL = 0); bool executeJavaScript(const char* script, JavaScriptDataType& returnType, WebString& returnValue); @@ -406,6 +407,7 @@ public: bool isAcceleratedCompositingActive() const { return m_compositor; } WebPageCompositorPrivate* compositor() const { return m_compositor.get(); } void setCompositor(PassRefPtr<WebPageCompositorPrivate>, EGLContext compositingContext); + void setCompositorHelper(PassRefPtr<WebPageCompositorPrivate>, EGLContext compositingContext); void setCompositorBackgroundColor(const WebCore::Color&); bool createCompositor(); void destroyCompositor(); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 351354a16..6d340d8e2 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,178 @@ +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * WebCoreSupport/AboutDataEnableFeatures.in: + +2012-07-20 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] clock_gettime() in BackingStore.cpp should use CLOCK_MONOTONIC + https://bugs.webkit.org/show_bug.cgi?id=91898 + + Reviewed by Yong Li. + + PR: 181043 + Use CLOCK_MONOTONIC when we do expect a monotonic timer. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::blitContents): + +2012-07-20 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Add Cancel button for Select popup + https://bugs.webkit.org/show_bug.cgi?id=91887 + + Reviewed by Yong Li. + + PR 177706 + + * WebCoreSupport/SelectPopupClient.cpp: + (WebCore::SelectPopupClient::generateHTML): + (WebCore::SelectPopupClient::setValueAndClosePopup): + +2012-07-19 Mary Wu <mary.wu@torchmobile.com.cn> + + [BlackBerry] Make sure to send favicon when go back/forward + https://bugs.webkit.org/show_bug.cgi?id=91808 + + Reviewed by George Staikos. + + When go back/forward, if the page was in page cache, it would have no chance + to send favicon. So we'll send it in commitLoad right after send the blank + icon. + RIM PR# 177495 + + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDidCommitLoad): + +2012-07-19 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Suspend when there's no target buffer until an external compositor is set + https://bugs.webkit.org/show_bug.cgi?id=91686 + RIM PR 174365 + + Reviewed by Antonio Gomes. + + If we don't have a client window (i.e. rendering to + GL directly) and a WebPageCompositor is only set + after a rendering operation, then we'll try to render + to BackingStorePrivate::buffer() which doesn't exist + at this point. That's bad, and gets us various + assertions and possibly worse. + + Fix it by starting in a screen-suspended state and only + resuming screen and backingstore once a compositor is + actually set. + + So, in effect, with this patch applied, the sequence + of events will look like this: + + 1) WebPage & BackingStore are initialize, neither window + nor compositor exists, therefore buffer() returns 0. + createSurface() therefore suspends screen and + backingstore. + 2) loadURL() or loadData() is called, web page is + fully loaded, however we don't try to render because + we're still suspended, still have no target buffer. + 3) A WebPageCompositor is being set from outside. + At the beginning of WebPage::setCompositor() we still + don't have a buffer() so there's nothing to suspend, + however, after the sync call to setCompositorHelper() + the compositor is set so buffer() will return a + nonzero value, causing us to resume at this point. + + Using the existence of a target buffer to determine + whether or not to enable rendering or keep it suspended + seems like a good idea, and the implementation (while + not quite perfect yet) is a step forward from before. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::createSurfaces): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setCompositor): + (BlackBerry::WebKit::WebPagePrivate::setCompositorHelper): + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-07-19 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Allow nested suspend/resume screen & backingstore calls. + https://bugs.webkit.org/show_bug.cgi?id=91644 + RIM PR 174365 + + Reviewed by Adam Treat and Antonio Gomes. + + We expose suspendScreenAndBackingStoreUpdates() to the + outside API, but also use it internally when reacting + to a number of happenings, i.e. zooming, viewport resize, + resetting view state on Committed state or when restoring + it from previous pages, etc. + + These two can clash. For instance, if we get a suspend + call from outside that suspends us for app inactivity, + or we are told to suspend because the main target surface + is not available at the time, and while being suspended + we try to rotate, finish loading a page, the we'll end up + resuming operations even though we shouldn't. + + This patch changes the suspend flag to be a counter + instead, allowing nested suspend/resume calls and making + suspend/resume more robust this way. It also changes + several call sites to make sure suspend/resume calls are + paired up correctly. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate): + (BlackBerry::WebKit::BackingStorePrivate::suspendScreenAndBackingStoreUpdates): + (BlackBerry::WebKit::BackingStorePrivate::resumeScreenAndBackingStoreUpdates): + * Api/BackingStore_p.h: + (BackingStorePrivate): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::shouldZoomAboutPoint): + (BlackBerry::WebKit::WebPagePrivate::zoomAboutPointTimerFired): + (BlackBerry::WebKit::WebPagePrivate::blockZoomRectForNode): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::restoreViewState): + +2012-07-18 Yong Li <yoli@rim.com> + + [BlackBerry] Move about: URL handling out of WebCore + https://bugs.webkit.org/show_bug.cgi?id=91541 + + Reviewed by Rob Buis. + + Move about URL handling code to WebKit/blackberry. Now when WebPage is asked to load an about URL, + it directly calls loadString() with the generated source. + + Also move AboutData.h/cpp from WebCoreSupport to WebKitSupport and change their namespace from WebCore + to BlackBerry::WebKit. + + The change is very mechanical except "procss total memory usage" in about:memory now only accounts used + bytes and ignore free spaces in malloc. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::loadAbout): + (WebKit): + (BlackBerry::WebKit::WebPage::load): + * Api/WebPage_p.h: + (WebPagePrivate): + * WebKitSupport/AboutData.cpp: Renamed from Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp. + (WebKit): + (BlackBerry::WebKit::writeFeatures): + (BlackBerry::WebKit::numberToHTMLTr): + (BlackBerry::WebKit::bool): + (BlackBerry::WebKit::configPage): + (BlackBerry::WebKit::cacheTypeStatisticToHTMLTr): + (BlackBerry::WebKit::dumpJSCTypeCountSetToTableHTML): + (BlackBerry::WebKit::memoryPage): + * WebKitSupport/AboutData.h: Renamed from Source/WebKit/blackberry/WebCoreSupport/AboutData.h. + (WebKit): + 2012-07-17 Jakob Petsovits <jpetsovits@rim.com> [BlackBerry] Remove unnecessary clearWindow() calls and the method itself diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 250c3f959..012bf0600 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -72,7 +72,7 @@ MEDIA_STATISTICS MEDIA_STREAM MEMORY_SAMPLER META_ALLOCATOR_PROFILE -METER_TAG +METER_ELEMENT MHTML MICRODATA MUTATION_OBSERVERS @@ -93,7 +93,7 @@ PLUGIN_PACKAGE_SIMPLE_HASH PLUGIN_PROCESS PLUGIN_PROXY_FOR_VIDEO POINTER_LOCK -PROGRESS_TAG +PROGRESS_ELEMENT PURGEABLE_MEMORY QUOTA REGEXP_TRACING diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index 9080272d7..982b13c3e 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -530,6 +530,9 @@ void FrameLoaderClientBlackBerry::dispatchDidCommitLoad() m_webPagePrivate->m_client->notifyLoadCommitted( originalUrl.characters(), originalUrl.length(), url.characters(), url.length(), token.characters(), token.length()); + HistoryItem* currentItem = m_frame->loader()->history()->currentItem(); + if (currentItem && currentItem->isInPageCache()) + dispatchDidReceiveIcon(); } } @@ -1067,12 +1070,12 @@ void FrameLoaderClientBlackBerry::restoreViewState() m_webPagePrivate->m_shouldReflowBlock = viewState.shouldReflowBlock; - // Will restore updates to backingstore guaranteed! - if (!m_webPagePrivate->zoomAboutPoint(scale, m_frame->view()->scrollPosition(), true /* enforceScaleClamping */, true /*forceRendering*/, true /*isRestoringZoomLevel*/)) { - // If we're already at that scale, then we should still force rendering since - // our scroll position changed. - m_webPagePrivate->m_backingStore->d->renderVisibleContents(); + bool didZoom = m_webPagePrivate->zoomAboutPoint(scale, m_frame->view()->scrollPosition(), true /* enforceScaleClamping */, true /*forceRendering*/, true /*isRestoringZoomLevel*/); + // If we're already at that scale, then we should still force rendering + // since our scroll position changed. + m_webPagePrivate->m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); + if (!didZoom) { // We need to notify the client of the scroll position and content size change(s) above even if we didn't scale. m_webPagePrivate->notifyTransformedContentsSizeChanged(); m_webPagePrivate->notifyTransformedScrollChanged(); diff --git a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp index f068f1fda..ab362c492 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp @@ -115,6 +115,7 @@ void SelectPopupClient::generateHTML(bool multiple, int size, const ScopeArray<B source.append(", "); } source.append("] "); + source.append(", 'Cancel'"); // If multi-select, add OK button for confirm. if (m_multiple) source.append(", 'OK'"); @@ -145,7 +146,12 @@ String SelectPopupClient::htmlSource() void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue) { ASSERT(m_element); - ASSERT(m_size == stringValue.length()); + + static const char* cancelValue = "-1"; + if (stringValue == cancelValue) { + closePopup(); + return; + } if (m_size > 0) { bool selecteds[m_size]; diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp index 34499ba07..745157513 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp @@ -18,8 +18,8 @@ #include "config.h" #include "AboutData.h" -#include "AboutTemplate.html.cpp" +#include "AboutTemplate.html.cpp" #include "CString.h" #include "JSDOMWindow.h" #include "MemoryCache.h" @@ -27,14 +27,17 @@ #include "SurfacePool.h" #include "WebKitVersion.h" -#include <process.h> #include <BlackBerryPlatformSettings.h> #include <heap/Heap.h> +#include <process.h> #include <runtime/JSGlobalData.h> #include <sys/stat.h> #include <sys/utsname.h> -namespace WebCore { +using namespace WebCore; + +namespace BlackBerry { +namespace WebKit { static String writeFeatures(const Vector<String>& trueList, const Vector<String>& falseList) { @@ -61,7 +64,7 @@ String configPage() { String page; #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD - page = writeHeader("Configuration"); + page = writeHeader("Configuration") + "<div class=\"box\"><div class=\"box-title\">Compiler Information</div><table class='fixed-table'><col width=75%><col width=25%>" #if COMPILER(MSVC) + "<tr><td>Microsoft Visual C++</td><td>MSVC</td></tr>" @@ -246,7 +249,7 @@ String memoryPage() page += "<div class='box'><div class='box-title'>Process memory usage summary</div><table class='fixed-table'><col width=75%><col width=25%>"; - page += numberToHTMLTr("Total memory usage (malloc + JSC)", mallocInfo.arena + jscMemoryStat.stackBytes + jscMemoryStat.JITBytes + mainHeap.capacity()); + page += numberToHTMLTr("Total memory usage (malloc + JSC)", mallocInfo.usmblks + mallocInfo.uordblks + jscMemoryStat.stackBytes + jscMemoryStat.JITBytes + mainHeap.capacity()); struct stat processInfo; if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) @@ -296,4 +299,5 @@ String memoryPage() return page; } -} +} // namespace WebKit +} // namespace BlackBerry diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutData.h b/Source/WebKit/blackberry/WebKitSupport/AboutData.h index ed977abb6..805054fd5 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutData.h +++ b/Source/WebKit/blackberry/WebKitSupport/AboutData.h @@ -21,11 +21,13 @@ #include "PlatformString.h" -namespace WebCore { +namespace BlackBerry { +namespace WebKit { String configPage(); String memoryPage(); -} // namespace WebCore +} // namespace WebKit +} // namespace BlackBerry #endif // AboutData_h diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 1654cc675..a94bbd7b7 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,637 @@ +2012-07-22 Kent Tamura <tkent@chromium.org> + + [Chromium-Mac] Fix a build error. + + * DEPS: Add third_party/GTM. + +2012-07-23 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * features.gypi: + +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91928 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * features.gypi: + +2012-07-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-20 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91846 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * features.gypi: + * src/WebInputElement.cpp: + (WebKit::WebInputElement::dataListOptions): + +2012-07-20 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Simplify backend interface classes + https://bugs.webkit.org/show_bug.cgi?id=91901 + + Reviewed by Tony Chang. + + Remove unnecessary method stubs from proxy class. + + * src/IDBTransactionBackendProxy.cpp: + * src/IDBTransactionBackendProxy.h: + (IDBTransactionBackendProxy): + +2012-07-20 Scott Graham <scottmg@chromium.org> + + Add windows native versions of bison, flex and gperf. + + Reviewed by Tony Chang. + + * DEPS: + +2012-07-20 David Grogan <dgrogan@chromium.org> + + IndexedDB: Include intVersion when converting between WebCore and WebKit IDBMetadata types + https://bugs.webkit.org/show_bug.cgi?id=91414 + + Reviewed by Adam Barth. + + * src/AssertMatchingEnums.cpp: + * src/WebIDBMetadata.cpp: + (WebKit::WebIDBMetadata::WebIDBMetadata): + (WebKit::WebIDBMetadata::operator IDBDatabaseMetadata): + +2012-07-20 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] Switch the MACOSX_DEPLOYMENT_TARGET to 10.6 + https://bugs.webkit.org/show_bug.cgi?id=91752 + + Reviewed by Eric Seidel. + + Use 10.6 NSScreen/NSColorSpace APIs to determine if the screen is + monochrome rather than comparing against deprecated colorspace names. + + * src/mac/WebScreenInfoFactory.mm: + (WebKit::WebScreenInfoFactory::screenInfo): + +2012-07-20 Daniel Murphy <dmurph@chromium.org> + + Introduce WebViewBenchmarkSupport for performance experiments on a real WebView + https://bugs.webkit.org/show_bug.cgi?id=88271 + + Reviewed by Darin Fisher. + + * WebKit.gyp: + * public/WebView.h: + (WebKit): + (WebView): + (WebKit::WebView::benchmarkSupport): + * public/WebViewBenchmarkSupport.h: Added. + (WebKit): + (WebViewBenchmarkSupport): + (PaintClient): + (WebKit::WebViewBenchmarkSupport::PaintClient::willPaint): + (WebKit::WebViewBenchmarkSupport::PaintClient::didPaint): + (WebKit::WebViewBenchmarkSupport::PaintClient::~PaintClient): + (WebKit::WebViewBenchmarkSupport::~WebViewBenchmarkSupport): + * src/WebViewBenchmarkSupportImpl.cpp: Added. + (WebKit): + (WebKit::WebViewBenchmarkSupportImpl::paintLayer): + (WebKit::WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped): + (WebKit::WebViewBenchmarkSupportImpl::softwarePaint): + (WebKit::WebViewBenchmarkSupportImpl::paint): + * src/WebViewBenchmarkSupportImpl.h: Added. + (WebCore): + (WebKit): + (WebViewBenchmarkSupportImpl): + (WebKit::WebViewBenchmarkSupportImpl::WebViewBenchmarkSupportImpl): + (WebKit::WebViewBenchmarkSupportImpl::~WebViewBenchmarkSupportImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::benchmarkSupport): + (WebKit): + (WebKit::WebViewImpl::rootGraphicsLayer): + * src/WebViewImpl.h: + (WebKit): + (WebViewImpl): + +2012-07-20 Han Shen <shenhan@google.com> + + [Chromium] Compilation fails under gcc 4.7 + https://bugs.webkit.org/show_bug.cgi?id=90227 + + Reviewed by Tony Chang. + + Disable warnings about c++0x compatibility in gcc newer than 4.6. + + * WebKit.gyp: + * WebKitUnitTests.gyp: + +2012-07-20 Adam Barth <abarth@webkit.org> + + [Chromium] Add WebView::zoomToFindInPageRect for Android + https://bugs.webkit.org/show_bug.cgi?id=91801 + + Reviewed by Tony Chang. + + On Android, when you find in page, we scale the viewport to reveal what + you've found (because the screen is small). This function instructs the + WebView to zoom to display a given rect. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::animateZoomAroundPoint): + - This function is a bit more general than necessary for this patch + because it is also used in other cases for animating a zoom + around a given point (e.g., double-tap to zoom). These uses will + be upstreamed in later patches. + (WebKit::WebViewImpl::zoomToFindInPageRect): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-19 Luke Macpherson <macpherson@chromium.org> + + Enable CSS variables compile time flag in Chrome. + https://bugs.webkit.org/show_bug.cgi?id=91708 + + Reviewed by Dimitri Glazkov. + + Flips the ENABLE_CSS_VARIABLES compile flag on for Chrome. There is also a run-time flag that is off by default, + so this should not have a user visible effect other than making the variables runtime flag visible at chrome://flags/ + + * features.gypi: + +2012-07-19 Wei James <james.wei@intel.com> + + enable Web Audio for chromium android port + https://bugs.webkit.org/show_bug.cgi?id=89428 + + Reviewed by Kenneth Russell. + + * features.gypi: + +2012-07-19 Adam Barth <abarth@webkit.org> + + [Chromium] Support external autofill popups + https://bugs.webkit.org/show_bug.cgi?id=91651 + + Reviewed by Darin Fisher. + + This looks like the last piece needed to support external autofill + popups. This function just lets the embedder select an index + (presumably because the user picked an index from the external autofill + popup). + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::selectAutofillSuggestionAtIndex): + (WebKit): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-19 Zeev Lieber <zlieber@chromium.org> + + [Chromium] Textures drawn during occlusion are incorrectly re-used when unoccluded. + https://bugs.webkit.org/show_bug.cgi?id=91537 + + Reviewed by Adrienne Walker. + + Added unit tests to test texture caching with clipping and + occlusion. Removed some minor code duplication when initializing + layers for various scenarios. + + MockCCQuadCuller can now implement CCQuadSink. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCQuadCullerTest.cpp: + * tests/MockCCQuadCuller.h: + (WebCore::MockCCQuadCuller::MockCCQuadCuller): + +2012-07-19 Adam Barth <abarth@webkit.org> + + [Chromium] WebView is missing isSelectionEditable and backgroundColor which are used by chromium-android + https://bugs.webkit.org/show_bug.cgi?id=91671 + + Reviewed by Darin Fisher. + + I haven't studied what these APIs are used for downstream, but they + seem harmless enough. + + * public/WebView.h: + (WebView): + * public/WebWidget.h: + (WebWidget): + (WebKit::WebWidget::backgroundColor): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::isSelectionEditable): + (WebKit): + (WebKit::WebViewImpl::backgroundColor): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-19 Andrew Scherkus <scherkus@chromium.org> + + [chromium] Move WebAudioSourceProvider destructor from public to protected + https://bugs.webkit.org/show_bug.cgi?id=91669 + + Reviewed by Darin Fisher. + + The lifetime of a WebAudioSourceProvider is managed by the implementor + and should never be deallocted by WebKit. + + * public/WebAudioSourceProvider.h: + (WebAudioSourceProvider): + +2012-07-19 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r123036. + http://trac.webkit.org/changeset/123036 + https://bugs.webkit.org/show_bug.cgi?id=91555 + + Triggers some DCHECKs in Chromium browser_tests + + * public/WebTextInputType.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::textInputType): + +2012-07-19 Joshua Bell <jsbell@chromium.org> + + Roll out r121610 and r122487 which may have been causing flaky crashes + https://bugs.webkit.org/show_bug.cgi?id=91637 + + Reviewed by Kentaro Hara. + + Flaky crashes started in random tests following r121610. It's not clear + that r121610 is to blame, but we'd like to prove or disprove it. + If this doesn't resolve the crashes, this patch should be rolled out. + + * src/WebBindings.cpp: + (WebKit::getRangeImpl): + (WebKit::getElementImpl): + (WebKit::getArrayBufferImpl): + (WebKit::getArrayBufferViewImpl): + (WebKit::WebBindings::toV8Value): + +2012-07-19 Sami Kyostila <skyostil@chromium.org> + + [chromium] Remove duplicate mock CCLayerTreeHostClient + https://bugs.webkit.org/show_bug.cgi?id=89457 + + Reviewed by Adrienne Walker. + + This test can reuse the existing CCFakeLayerTreeHostClient. + + * tests/GraphicsLayerChromiumTest.cpp: + (WebKitTests::MockLayerTreeHost::create): + +2012-07-19 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-18 Ryosuke Niwa <rniwa@webkit.org> + + Chromium build fix attempt. Don't use anonymous namespace. + + * tests/TextureCopierTest.cpp: + +2012-07-18 Antoine Labour <piman@chromium.org> + + [chromium] Introduce CCResourceProvider, replacing TextureAllocator and hiding textures from clients to allow transport + https://bugs.webkit.org/show_bug.cgi?id=91044 + + Reviewed by Adrienne Walker. + + This does several things: + - Add a CCResourceProvider class, that hides textures and the 3D context + from layers (except those that need it). Instead layers manage + "resources". In the future, resources are expected to be transportable + to a "parent" CCResourceProvider to allow flattening of nested + compositors. + - Replace texture ids by resource ids in DrawQuads (allowing them to be + serializable). + - Replace TextureAllocator uses by the CCResourceProvider class. + - Upload of data is done through the CCResourceProvider instead of + explicit GL calls. + - External textures are wrapped into a resource at draw time (see + caveat/FIXME in CCTextureLayerImpl). + - Rendering with the resources is done through an explicit + beginRenderFrom/endRenderFrom that exposes the texture only between that + pair. + - Merge all the LayerTextureSubImage instances (one per layer), into a + single instance on the CCResourceProvider. + + Added CCResourceProviderTest, the refactoring is covered by existing tests. + + * WebKit.gypi: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCPrioritizedTextureTest.cpp: + (WTF::CCPrioritizedTextureTest::CCPrioritizedTextureTest): + (WTF::CCPrioritizedTextureTest::createManager): + (WTF::CCPrioritizedTextureTest::validateTexture): + (WTF::CCPrioritizedTextureTest::resourceProvider): + (CCPrioritizedTextureTest): + (WTF::TEST_F): + * tests/CCQuadCullerTest.cpp: + * tests/CCResourceProviderTest.cpp: Added. + (WebKit): + (ResourceProviderContext): + (WebKit::ResourceProviderContext::create): + (WebKit::ResourceProviderContext::bindTexture): + (WebKit::ResourceProviderContext::createTexture): + (WebKit::ResourceProviderContext::deleteTexture): + (WebKit::ResourceProviderContext::texStorage2DEXT): + (WebKit::ResourceProviderContext::texImage2D): + (WebKit::ResourceProviderContext::texSubImage2D): + (WebKit::ResourceProviderContext::getPixels): + (WebKit::ResourceProviderContext::textureCount): + (WebKit::ResourceProviderContext::textureSize): + (WebKit::ResourceProviderContext::ResourceProviderContext): + (WebKit::ResourceProviderContext::Texture::Texture): + (Texture): + (WebKit::ResourceProviderContext::allocateTexture): + (WebKit::ResourceProviderContext::setPixels): + (CCResourceProviderTest): + (WebKit::CCResourceProviderTest::CCResourceProviderTest): + (WebKit::CCResourceProviderTest::context): + (WebKit::CCResourceProviderTest::getResourcePixels): + (WebKit::TEST_F): + * tests/CCScopedTextureTest.cpp: + (WebKitTests::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::createLayer): + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::Texture::updateRect): + * tests/CCTiledLayerTestCommon.h: + (Texture): + (WebKitTests::FakeTextureCopier::copyTexture): + (WebKitTests::FakeTextureCopier::flush): + (WebKitTests::FakeTextureUploader::uploadTexture): + * tests/ContentLayerChromiumTest.cpp: + (WebKit::TEST): + * tests/FakeCCGraphicsContext.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCTexture.h. + (WebKit): + (WebKit::createFakeCCGraphicsContext): + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (LayerRendererChromiumTest::context): + (LayerRendererChromiumTest): + (TEST_F): + (TEST): + * tests/TextureCopierTest.cpp: + * tests/TextureManagerTest.cpp: + (WTF::TextureManagerTest::TextureManagerTest): + (WTF::TextureManagerTest::createTextureManager): + (WTF::TextureManagerTest::requestTexture): + (TextureManagerTest): + * tests/TiledLayerChromiumTest.cpp: + +2012-07-18 David Grogan <dgrogan@chromium.org> + + IndexedDB: Add intVersion to chromium/public/WebIDBMetadata.h + https://bugs.webkit.org/show_bug.cgi?id=91408 + + Reviewed by Adam Barth. + + This is in support of the new upgradeneeded versioning api. + intVersion will eventually replace the WebString version member. + + * public/WebIDBMetadata.h: + (WebKit::WebIDBMetadata::WebIDBMetadata): + The spec uses unsigned long long for version numbers but we use signed + long long so that we can use -1 as a sentinel. It indicates that a + database still uses a string version. + +2012-07-18 Adam Barth <abarth@webkit.org> + + Disable printing on chromium-android + https://bugs.webkit.org/show_bug.cgi?id=91550 + + Reviewed by Tony Chang. + + We don't implement printing on Android. + + * features.gypi: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::printPage): + +2012-07-18 Alexandre Elias <aelias@google.com> + + [chromium] Ubercomp: add id to SharedQuadState + https://bugs.webkit.org/show_bug.cgi?id=91670 + + Reviewed by Adrienne Walker. + + This assigns an integer ID to SharedQuadState objects and a + corresponding ID to quads. This ID is unique only within a + RenderPass and currently is just set to the index in the shared quad + state list. This is redundant with the pointer and exists to + simplify serialization. + + I found out that pointer rewriting within a pickler is blocked by + pointers to memory being const there, so the reassignment will have to + be performed in the application layer anyway. In that case, it's + simplest to add some ID integers. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + +2012-07-18 Nate Chapin <japhet@chromium.org> + + Add WebTextInputType enum values for text areas and + content-editable. + https://bugs.webkit.org/show_bug.cgi?id=91654 + + Reviewed by Adam Barth. + + No new tests, no behavior change without corresponding chromium.org changes. + + * public/WebTextInputType.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::textInputType): + +2012-07-18 Alexandre Elias <aelias@google.com> + + [chromium] Ubercomp: clean up CCRenderer interface + https://bugs.webkit.org/show_bug.cgi?id=91555 + + Reviewed by Adrienne Walker. + + I replaced the one-by-one RenderPass calls with a new drawFrame() + method that directly takes a CCRenderPassList, and moved a small + amount of code from CCLayerTreeHostImpl to implement it. In ubercomp + mode, we will produce a frame bundle rather than a command-stream, so + the full list is easier to work with. + + Also, give empty default implementations for the methods that don't + need to do anything in a non-GL context, and make private + setScissorToRect. + + * tests/LayerRendererChromiumTest.cpp: + (FakeCCRendererClient::FakeCCRendererClient): + (FakeCCRendererClient::renderPasses): + (FakeCCRendererClient): + (TEST_F): + (TEST): + +2012-07-18 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Fix some coding style violations + https://bugs.webkit.org/show_bug.cgi?id=91565 + + Reviewed by Tony Chang. + + * tests/IDBLevelDBCodingTest.cpp: + (IDBLevelDBCoding::TEST): + +2012-07-18 Tony Chang <tony@chromium.org> + + [chromium] Unreviewed, fix some MSVC compile warnings. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::TEST_F): + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-18 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call SQLiteFileSystem-related functions directly + https://bugs.webkit.org/show_bug.cgi?id=91631 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * public/platform/WebKitPlatformSupport.h: + (WebKitPlatformSupport): + * src/PlatformSupport.cpp: + (WebCore): + +2012-07-18 Tony Chang <tony@chromium.org> + + [chromium] Unreviewed, more compile fixes on Chromium Win. + + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + +2012-07-18 Tony Chang <tony@chromium.org> + + [chromium] Fix compile on Windows. + + 148>tests\LayerChromiumTest.cpp(510): warning C4305: 'argument' : truncation from 'double' to 'float' + + * tests/LayerChromiumTest.cpp: + +2012-07-18 Alec Flett <alecflett@chromium.org> + + Implement putIndexKeys in WebIDBObjectStoreImpl + https://bugs.webkit.org/show_bug.cgi?id=91546 + + Reviewed by Darin Fisher. + + Implement putIndexKeys in the chromium API, so it is callable + from chromium. + + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::putWithIndexKeys): + (WebKit): + * src/WebIDBObjectStoreImpl.h: + (WebIDBObjectStoreImpl): + +2012-07-18 Tony Chang <tony@chromium.org> + + [chromium] Unreviewed compile fix for Android. + + More sqrt fixes. + + * tests/CCLayerTreeHostCommonTest.cpp: + +2012-07-18 Tony Chang <tony@chromium.org> + + [chromium] Unreviewed compile fix for Android. + + Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp: In member function 'virtual void<unnamed>::CCDamageTrackerTest_verifyDamageForTransformedLayer_Test::TestBody()': + Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp:332: error: call of overloaded 'sqrt(int)' is ambiguous + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::TEST_F): + +2012-07-18 Varun Jain <varunjain@chromium.org> + + [chromium] Drag image for image elements should be scaled with device scale factor. + https://bugs.webkit.org/show_bug.cgi?id=89688 + + Reviewed by Adam Barth. + + * src/DragClientImpl.cpp: + (WebKit::DragClientImpl::startDrag): + * tests/DragImageTest.cpp: + (WebCore::TEST): + +2012-07-18 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Fix style for numeric literals in chromium unit test code + https://bugs.webkit.org/show_bug.cgi?id=91635 + + Reviewed by Adrienne Walker. + + Where possible, removed ".0" and "f" suffixes on numeric literals, + to be more consistent with WebKit style rules. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::TEST_F): + * tests/CCLayerQuadTest.cpp: + (WebCore::TEST): + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCQuadCullerTest.cpp: + * tests/LayerChromiumTest.cpp: + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + +2012-07-17 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Remove awkward anchorPoint usage that implicity affects layer position + https://bugs.webkit.org/show_bug.cgi?id=91472 + + Reviewed by Adrienne Walker. + + Unit tests were updated to account for the fact that anchorPoint + and position are now separated. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::TEST_F): + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + 2012-07-18 Yoshifumi Inoue <yosin@chromium.org> Decimal::toString should not round integer value. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 6194e131a..90b7caed8 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': '146999' + 'chromium_rev': '147759' } deps = { @@ -143,12 +143,18 @@ deps = { deps_os = { 'win': { + 'third_party/bison': + From('chromium_deps', 'src/third_party/bison'), 'third_party/cygwin': From('chromium_deps', 'src/third_party/cygwin'), + 'third_party/gperf': + From('chromium_deps', 'src/third_party/gperf'), 'third_party/lighttpd': From('chromium_deps', 'src/third_party/lighttpd'), 'third_party/nss': From('chromium_deps', 'src/third_party/nss'), + 'third_party/perl': + From('chromium_deps', 'src/third_party/perl'), # Dependencies used by libjpeg-turbo 'third_party/yasm/binaries': From('chromium_deps', 'src/third_party/yasm/binaries'), @@ -156,6 +162,8 @@ deps_os = { 'mac': { 'third_party/nss': From('chromium_deps', 'src/third_party/nss'), + 'third_party/GTM': + From('chromium_deps', 'src/third_party/GTM'), }, 'unix': { # Linux, actually. diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index f6868201c..45b949866 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -279,6 +279,7 @@ 'public/WebUserMediaClient.h', 'public/WebUserMediaRequest.h', 'public/WebView.h', + 'public/WebViewBenchmarkSupport.h', 'public/WebViewClient.h', 'public/WebWidget.h', 'public/WebWidgetClient.h', @@ -661,6 +662,8 @@ 'src/WebTextFieldDecoratorClient.cpp', 'src/WebUserMediaRequest.cpp', 'src/WebVideoLayer.cpp', + 'src/WebViewBenchmarkSupportImpl.cpp', + 'src/WebViewBenchmarkSupportImpl.h', 'src/WebViewImpl.cpp', 'src/WebViewImpl.h', 'src/WebWorkerBase.cpp', @@ -1048,7 +1051,7 @@ }, ], # targets 'conditions': [ - ['os_posix==1 and OS!="mac" and gcc_version==46', { + ['os_posix==1 and OS!="mac" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such # as nullptr) conflict with upcoming c++0x types. diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 40b23be49..831241de4 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -78,6 +78,7 @@ 'tests/CCOcclusionTrackerTestCommon.h', 'tests/CCQuadCullerTest.cpp', 'tests/CCRenderSurfaceTest.cpp', + 'tests/CCResourceProviderTest.cpp', 'tests/CCSchedulerStateMachineTest.cpp', 'tests/CCSchedulerTestCommon.h', 'tests/CCSchedulerTest.cpp', diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index 051c13524..81be90a0d 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -126,7 +126,7 @@ } ], # targets 'conditions': [ - ['os_posix==1 and OS!="mac" and gcc_version==46', { + ['os_posix==1 and OS!="mac" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such # as nullptr) conflict with upcoming c++0x types. diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 35f86cf24..8df09639c 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -46,12 +46,12 @@ 'ENABLE_CSS_IMAGE_RESOLUTION=0', 'ENABLE_CSS_REGIONS=1', 'ENABLE_CSS_SHADERS=1', - 'ENABLE_CSS_VARIABLES=0', + 'ENABLE_CSS_VARIABLES=1', 'ENABLE_CUSTOM_SCHEME_HANDLER=0', - 'ENABLE_DATALIST=1', + 'ENABLE_DATALIST_ELEMENT=1', 'ENABLE_DASHBOARD_SUPPORT=0', 'ENABLE_DATA_TRANSFER_ITEMS=1', - 'ENABLE_DETAILS=1', + 'ENABLE_DETAILS_ELEMENT=1', 'ENABLE_DEVICE_ORIENTATION=1', 'ENABLE_DIALOG_ELEMENT=1', 'ENABLE_DIRECTORY_UPLOAD=1', @@ -75,13 +75,13 @@ 'ENABLE_LINK_PRERENDER=1', 'ENABLE_MEDIA_SOURCE=1', 'ENABLE_MEDIA_STATISTICS=1', - 'ENABLE_METER_TAG=1', + 'ENABLE_METER_ELEMENT=1', 'ENABLE_MHTML=1', 'ENABLE_MICRODATA=0', 'ENABLE_MUTATION_OBSERVERS=<(enable_mutation_observers)', 'ENABLE_PAGE_VISIBILITY_API=1', 'ENABLE_POINTER_LOCK=1', - 'ENABLE_PROGRESS_TAG=1', + 'ENABLE_PROGRESS_ELEMENT=1', 'ENABLE_QUOTA=1', 'ENABLE_REGISTER_PROTOCOL_HANDLER=1', 'ENABLE_REQUEST_ANIMATION_FRAME=1', @@ -155,6 +155,7 @@ 'ENABLE_ORIENTATION_EVENTS=1', 'ENABLE_OVERFLOW_SCROLLING=1', 'ENABLE_PAGE_POPUP=0', + 'ENABLE_PRINTING=0', # FIXME: Disable once the linking error has been resolved. # https://bugs.webkit.org/show_bug.cgi?id=88636 'ENABLE_SHARED_WORKERS=1', @@ -175,6 +176,7 @@ 'ENABLE_ORIENTATION_EVENTS=0', 'ENABLE_OVERFLOW_SCROLLING=0', 'ENABLE_PAGE_POPUP=1', + 'ENABLE_PRINTING=1', 'ENABLE_SHARED_WORKERS=1', 'ENABLE_WEB_AUDIO=1', ], @@ -187,7 +189,7 @@ ], }], # Mac OS X uses Accelerate.framework FFT by default instead of FFmpeg. - ['OS!="mac"', { + ['OS!="mac" and OS!="android"', { 'feature_defines': [ 'WTF_USE_WEBAUDIO_FFMPEG=1', ], diff --git a/Source/WebKit/chromium/public/WebAudioSourceProvider.h b/Source/WebKit/chromium/public/WebAudioSourceProvider.h index c0010f806..98c762284 100644 --- a/Source/WebKit/chromium/public/WebAudioSourceProvider.h +++ b/Source/WebKit/chromium/public/WebAudioSourceProvider.h @@ -40,6 +40,7 @@ public: // If a client is set, we call it back when the audio format is available. virtual void setClient(WebAudioSourceProviderClient*) { }; +protected: virtual ~WebAudioSourceProvider() { } }; diff --git a/Source/WebKit/chromium/public/WebIDBMetadata.h b/Source/WebKit/chromium/public/WebIDBMetadata.h index 1c33d1b08..1f2e9ead4 100644 --- a/Source/WebKit/chromium/public/WebIDBMetadata.h +++ b/Source/WebKit/chromium/public/WebIDBMetadata.h @@ -38,13 +38,21 @@ struct IDBDatabaseMetadata; namespace WebKit { struct WebIDBMetadata { + enum { + NoIntVersion = -1 + }; struct Index; struct ObjectStore; WebString name; + // FIXME: Both version members need to be present while we support both the + // old setVersion and new upgradeneeded API. Once we no longer support + // setVersion, WebString version can be removed. WebString version; + long long intVersion; WebVector<ObjectStore> objectStores; - WebIDBMetadata() { } + WebIDBMetadata() + : intVersion(NoIntVersion) { } struct ObjectStore { WebString name; diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index 3ba5da24f..0085ba51a 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -52,6 +52,7 @@ class WebNode; class WebPageOverlay; class WebPermissionClient; class WebPrerendererClient; +class WebViewBenchmarkSupport; class WebRange; class WebSettings; class WebSpellCheckClient; @@ -196,6 +197,9 @@ public: // previous element in the tab sequence (if reverse is true). virtual void advanceFocus(bool reverse) { } + // Animate a scale into the specified find-in-page rect. + virtual void zoomToFindInPageRect(const WebRect&) = 0; + // Zoom ---------------------------------------------------------------- @@ -382,6 +386,8 @@ public: // Hides any popup (suggestions, selects...) that might be showing. virtual void hidePopups() = 0; + virtual void selectAutofillSuggestionAtIndex(unsigned listIndex) = 0; + // Context menu -------------------------------------------------------- @@ -446,10 +452,16 @@ public: virtual bool setEditableSelectionOffsets(int start, int end) = 0; + virtual bool isSelectionEditable() const = 0; + // Fills in a WebRenderingStats struct containing information about the state of the compositor. // This call is relatively expensive in threaded mode as it blocks on the compositor thread. virtual void renderingStats(WebRenderingStats&) const { } + // Benchmarking support -------------------------------------------- + + virtual WebViewBenchmarkSupport* benchmarkSupport() { return 0; } + // Visibility ----------------------------------------------------------- // Sets the visibility of the WebView. diff --git a/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h b/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h new file mode 100644 index 000000000..c8ace3622 --- /dev/null +++ b/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef WebViewBenchmarkSupport_h +#define WebViewBenchmarkSupport_h + +#include "platform/WebCanvas.h" +#include "platform/WebSize.h" + +namespace WebKit { + +// Support for benchmarks accessing the WebView. +class WebViewBenchmarkSupport { +public: + enum PaintMode { + // Paint the entire page. + PaintModeEverything + }; + + // Client for creating canvases where multiple canvases + // may be used for layered rendering and sizes defined by the benchmark. + // Also contains reporting methods called by the WebViewBenchmarkSupport + // when painting is about to occur and when painting is complete. + class PaintClient { + public: + virtual WebCanvas* createCanvas(const WebSize&) = 0; + + // Called by the WebViewBenchmarkSupport when painting is about to + // occur. + virtual void willPaint(const WebCanvas&) { } + + // Called by the WebViewBenchmarkSupport when painting is complete. + virtual void didPaint(const WebCanvas&) { } + protected: + virtual ~PaintClient() { } + }; + + // Paints the web view on canvases created from the client, using the given + // paint mode. + virtual void paint(PaintClient*, PaintMode) = 0; + +protected: + virtual ~WebViewBenchmarkSupport() { } +}; +} // namespace WebKit + +#endif // WebViewBenchmarkSupport_h diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h index 08b2cd05a..600c523f8 100644 --- a/Source/WebKit/chromium/public/WebWidget.h +++ b/Source/WebKit/chromium/public/WebWidget.h @@ -221,6 +221,10 @@ public: // following the call to instrumentBeginFrame(). virtual void instrumentCancelFrame() { } + // The page background color. Can be used for filling in areas without + // content. + virtual WebColor backgroundColor() const { return 0xFFFFFFFF; /* SK_ColorWHITE */ } + protected: ~WebWidget() { } }; diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 3bb7ebeb4..70ad85228 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -57,31 +57,6 @@ class WebSharedWorkerRepository; // FIXME: Does this belong in platform? // FIXME: Eventually all these API will need to move to WebKit::Platform. class WebKitPlatformSupport : public Platform { public: - // HTML5 Database ------------------------------------------------------ - -#ifdef WIN32 - typedef HANDLE FileHandle; -#else - typedef int FileHandle; -#endif - - // Opens a database file; dirHandle should be 0 if the caller does not need - // a handle to the directory containing this file - virtual FileHandle databaseOpenFile( - const WebString& vfsFileName, int desiredFlags) { return FileHandle(); } - - // Deletes a database file and returns the error code - virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; } - - // Returns the attributes of the given database file - virtual long databaseGetFileAttributes(const WebString& vfsFileName) { return 0; } - - // Returns the size of the given database file - virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; } - - // Returns the space available for the given origin - virtual long long databaseGetSpaceAvailableForOrigin(const WebKit::WebString& originIdentifier) { return 0; } - // Indexed Database ---------------------------------------------------- virtual WebIDBFactory* idbFactory() { return 0; } diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 0f8442a76..789d1b623 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -53,6 +53,7 @@ #include "IDBFactoryBackendInterface.h" #include "IDBKey.h" #include "IDBKeyPath.h" +#include "IDBMetadata.h" #include "IceOptions.h" #include "IconURL.h" #include "MediaPlayer.h" @@ -87,6 +88,7 @@ #include "WebIDBFactory.h" #include "WebIDBKey.h" #include "WebIDBKeyPath.h" +#include "WebIDBMetadata.h" #include "WebIconURL.h" #include "WebInputElement.h" #include "WebMediaPlayer.h" @@ -461,6 +463,8 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::NullType, IDBKeyPath::NullType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::StringType, IDBKeyPath::StringType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::ArrayType, IDBKeyPath::ArrayType); + +COMPILE_ASSERT_MATCHING_ENUM(WebIDBMetadata::NoIntVersion, IDBDatabaseMetadata::NoIntVersion); #endif #if ENABLE(FILE_SYSTEM) diff --git a/Source/WebKit/chromium/src/DragClientImpl.cpp b/Source/WebKit/chromium/src/DragClientImpl.cpp index a6fb0bd33..3974e7ad3 100644 --- a/Source/WebKit/chromium/src/DragClientImpl.cpp +++ b/Source/WebKit/chromium/src/DragClientImpl.cpp @@ -87,7 +87,13 @@ void DragClientImpl::startDrag(DragImageRef dragImage, IntSize offsetSize(eventPos - dragImageOrigin); WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); - m_webView->startDragging(frame, dragData, static_cast<WebDragOperationsMask>(dragOperationMask), dragImage ? WebImage(*dragImage) : WebImage(), offsetPoint); + + if (dragImage && dragImage->bitmap && m_webView->deviceScaleFactor() != dragImage->resolutionScale) { + ASSERT(dragImage->resolutionScale > 0); + float scale = m_webView->deviceScaleFactor() / dragImage->resolutionScale; + dragImage = scaleDragImage(dragImage, WebCore::FloatSize(scale, scale)); + } + m_webView->startDragging(frame, dragData, static_cast<WebDragOperationsMask>(dragOperationMask), (dragImage && dragImage->bitmap) ? WebImage(*dragImage->bitmap) : WebImage(), offsetPoint); } void DragClientImpl::dragControllerDestroyed() diff --git a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp index 3a21a781b..88f9852ac 100644 --- a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp @@ -72,24 +72,6 @@ void IDBTransactionBackendProxy::abort() m_webIDBTransaction->abort(); } -void IDBTransactionBackendProxy::registerOpenCursor(WebCore::IDBCursorBackendImpl*) -{ - ASSERT_NOT_REACHED(); -} - -void IDBTransactionBackendProxy::unregisterOpenCursor(WebCore::IDBCursorBackendImpl*) -{ - ASSERT_NOT_REACHED(); -} - -bool IDBTransactionBackendProxy::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>, PassOwnPtr<ScriptExecutionContext::Task>) -{ - // This should never be reached as it's the impl objects who get to - // execute tasks in the browser process. - ASSERT_NOT_REACHED(); - return false; -} - void IDBTransactionBackendProxy::didCompleteTaskEvents() { m_webIDBTransaction->didCompleteTaskEvents(); diff --git a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h index 58918f68c..7e7486bd7 100644 --- a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h @@ -42,19 +42,10 @@ public: virtual ~IDBTransactionBackendProxy(); virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> objectStore(const String& name, WebCore::ExceptionCode&); - virtual unsigned short mode() const - { - ASSERT_NOT_REACHED(); - return 0; - } virtual void commit(); virtual void abort(); - virtual bool scheduleTask(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, PassOwnPtr<WebCore::ScriptExecutionContext::Task>); virtual void didCompleteTaskEvents(); virtual void setCallbacks(WebCore::IDBTransactionCallbacks*); - virtual void registerOpenCursor(WebCore::IDBCursorBackendImpl*); - virtual void unregisterOpenCursor(WebCore::IDBCursorBackendImpl*); - virtual void addPendingEvents(int) { ASSERT_NOT_REACHED(); } WebIDBTransaction* getWebIDBTransaction() const { return m_webIDBTransaction.get(); } diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 193b68b3a..0afb807e0 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -276,33 +276,6 @@ void PlatformSupport::getRenderStyleForStrike(const char* font, int sizeAndStyle } #endif -// Databases ------------------------------------------------------------------ - -PlatformFileHandle PlatformSupport::databaseOpenFile(const String& vfsFileName, int desiredFlags) -{ - return webKitPlatformSupport()->databaseOpenFile(WebString(vfsFileName), desiredFlags); -} - -int PlatformSupport::databaseDeleteFile(const String& vfsFileName, bool syncDir) -{ - return webKitPlatformSupport()->databaseDeleteFile(WebString(vfsFileName), syncDir); -} - -long PlatformSupport::databaseGetFileAttributes(const String& vfsFileName) -{ - return webKitPlatformSupport()->databaseGetFileAttributes(WebString(vfsFileName)); -} - -long long PlatformSupport::databaseGetFileSize(const String& vfsFileName) -{ - return webKitPlatformSupport()->databaseGetFileSize(WebString(vfsFileName)); -} - -long long PlatformSupport::databaseGetSpaceAvailableForOrigin(const String& originIdentifier) -{ - return webKitPlatformSupport()->databaseGetSpaceAvailableForOrigin(originIdentifier); -} - // Indexed Database ----------------------------------------------------------- PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory() diff --git a/Source/WebKit/chromium/src/WebBindings.cpp b/Source/WebKit/chromium/src/WebBindings.cpp index b9bbd5d37..926db3b11 100644 --- a/Source/WebKit/chromium/src/WebBindings.cpp +++ b/Source/WebKit/chromium/src/WebBindings.cpp @@ -210,8 +210,6 @@ static bool getRangeImpl(NPObject* object, WebRange* webRange) V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; if (!V8Range::info.equals(V8DOMWrapper::domWrapperType(v8Object))) return false; @@ -245,8 +243,6 @@ static bool getElementImpl(NPObject* object, WebElement* webElement) V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; Element* native = V8Element::HasInstance(v8Object) ? V8Element::toNative(v8Object) : 0; if (!native) return false; @@ -262,8 +258,6 @@ static bool getArrayBufferImpl(NPObject* object, WebArrayBuffer* arrayBuffer) V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; ArrayBuffer* native = V8ArrayBuffer::HasInstance(v8Object) ? V8ArrayBuffer::toNative(v8Object) : 0; if (!native) return false; @@ -279,8 +273,6 @@ static bool getArrayBufferViewImpl(NPObject* object, WebArrayBufferView* arrayBu V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; ArrayBufferView* native = V8ArrayBufferView::HasInstance(v8Object) ? V8ArrayBufferView::toNative(v8Object) : 0; if (!native) return false; @@ -406,8 +398,6 @@ v8::Handle<v8::Value> WebBindings::toV8Value(const NPVariant* variant) if (object->_class != npScriptObjectClass) return v8::Undefined(); V8NPObject* v8Object = reinterpret_cast<V8NPObject*>(object); - if (v8Object->v8Object.IsEmpty()) - return v8::Undefined(); return convertNPVariantToV8Object(variant, v8Object->rootObject->frame()->script()->windowScriptNPObject()); } // Safe to pass 0 since we have checked the script object class to make sure the diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 89189eea2..0cfbac209 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1529,6 +1529,7 @@ float WebFrameImpl::getPrintPageShrink(int page) float WebFrameImpl::printPage(int page, WebCanvas* canvas) { +#if ENABLE(PRINTING) // Ensure correct state. if (!m_printContext || page < 0 || !frame() || !frame()->document()) { ASSERT_NOT_REACHED(); @@ -1540,6 +1541,9 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) gc.platformContext()->setPrinting(true); return m_printContext->spoolPage(gc, page); +#else + return 0; +#endif } void WebFrameImpl::printEnd() diff --git a/Source/WebKit/chromium/src/WebIDBMetadata.cpp b/Source/WebKit/chromium/src/WebIDBMetadata.cpp index 735063ef0..01d878a0a 100644 --- a/Source/WebKit/chromium/src/WebIDBMetadata.cpp +++ b/Source/WebKit/chromium/src/WebIDBMetadata.cpp @@ -41,6 +41,7 @@ WebIDBMetadata::WebIDBMetadata(const WebCore::IDBDatabaseMetadata& metadata) { name = metadata.name; version = metadata.version; + intVersion = metadata.intVersion; objectStores = WebVector<ObjectStore>(static_cast<size_t>(metadata.objectStores.size())); size_t i = 0; @@ -68,7 +69,7 @@ WebIDBMetadata::WebIDBMetadata(const WebCore::IDBDatabaseMetadata& metadata) WebIDBMetadata::operator IDBDatabaseMetadata() const { - IDBDatabaseMetadata db(name, version); + IDBDatabaseMetadata db(name, version, intVersion); for (size_t i = 0; i < objectStores.size(); ++i) { const ObjectStore webObjectStore = objectStores[i]; IDBObjectStoreMetadata objectStore(webObjectStore.name, webObjectStore.keyPath, webObjectStore.autoIncrement); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 9bac6d3c3..53d140f42 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -63,6 +63,23 @@ void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const Web m_objectStore->put(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); } +void WebIDBObjectStoreImpl::putWithIndexKeys(const WebSerializedScriptValue& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, const WebVector<WebString>& webIndexNames, const WebVector<WebIndexKeys>& webIndexKeys, WebExceptionCode& ec) +{ + ASSERT(webIndexNames.size() == webIndexKeys.size()); + Vector<String> indexNames(webIndexNames.size()); + Vector<IDBObjectStoreBackendInterface::IndexKeys> indexKeys(webIndexKeys.size()); + + for (size_t i = 0; i < webIndexNames.size(); ++i) { + indexNames[i] = webIndexNames[i]; + Vector<RefPtr<IDBKey> > indexKeyList(webIndexKeys[i].size()); + for (size_t j = 0; j < webIndexKeys[i].size(); ++j) + indexKeyList[j] = webIndexKeys[i][j]; + indexKeys[i] = indexKeyList; + } + + m_objectStore->putWithIndexKeys(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), indexNames, indexKeys, ec); +} + void WebIDBObjectStoreImpl::deleteFunction(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) { m_objectStore->deleteFunction(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 5a881b592..e6dc88f54 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -47,6 +47,7 @@ public: void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); + void putWithIndexKeys(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, const WebVector<WebString>& indexNames, const WebVector<WebIndexKeys>&, WebExceptionCode&); void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index c1453de66..791b2ebff 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -175,7 +175,7 @@ bool WebInputElement::isMultiple() const WebNodeCollection WebInputElement::dataListOptions() const { -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) HTMLDataListElement* dataList = static_cast<HTMLDataListElement*>(constUnwrap<HTMLInputElement>()->list()); if (dataList) return WebNodeCollection(dataList->options()); diff --git a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp new file mode 100644 index 000000000..2b11f6eb6 --- /dev/null +++ b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * 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 "WebViewBenchmarkSupportImpl.h" + +#include "FloatSize.h" +#include "FrameView.h" +#include "GraphicsLayer.h" +#include "IntRect.h" +#include "IntSize.h" +#include "WebViewImpl.h" +#include "painting/GraphicsContextBuilder.h" + +#include <public/WebCanvas.h> +#include <wtf/CurrentTime.h> +#include <wtf/OwnPtr.h> +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsLayer& layer, const IntRect& clip) +{ + WebSize canvasSize(clip.width(), clip.height()); + OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); + GraphicsContextBuilder builder(canvas.get()); + + paintClient->willPaint(*canvas.get()); + layer.paintGraphicsLayerContents(builder.context(), clip); + paintClient->didPaint(*canvas.get()); +} + +void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintClient, GraphicsLayer& layer) +{ + FloatSize layerSize = layer.size(); + IntRect clip(0, 0, layerSize.width(), layerSize.height()); + + paintLayer(paintClient, layer, clip); + + const Vector<GraphicsLayer*>& children = layer.children(); + Vector<GraphicsLayer*>::const_iterator it; + for (it = children.begin(); it != children.end(); ++it) + acceleratedPaintUnclipped(paintClient, **it); +} + +void WebViewBenchmarkSupportImpl::softwarePaint(PaintClient* paintClient, PaintMode paintMode) +{ + WebSize size = m_webViewImpl->size(); + WebRect paintSize; + switch (paintMode) { + case PaintModeEverything: + if (m_webViewImpl->page() && m_webViewImpl->page()->mainFrame()) { + FrameView* view = m_webViewImpl->page()->mainFrame()->view(); + IntSize contentsSize = view->contentsSize(); + paintSize = WebRect(0, 0, contentsSize.width(), contentsSize.height()); + } else + paintSize = WebRect(0, 0, size.width, size.height); + break; + } + + WebSize canvasSize(paintSize.width, paintSize.height); + OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); + paintClient->willPaint(*canvas.get()); + m_webViewImpl->paint(canvas.get(), paintSize); + paintClient->didPaint(*canvas.get()); +} + +void WebViewBenchmarkSupportImpl::paint(PaintClient* paintClient, PaintMode paintMode) +{ + m_webViewImpl->layout(); + if (!m_webViewImpl->isAcceleratedCompositingActive()) + return softwarePaint(paintClient, paintMode); + GraphicsLayer* layer = m_webViewImpl->rootGraphicsLayer(); + switch (paintMode) { + case PaintModeEverything: + acceleratedPaintUnclipped(paintClient, *layer); + break; + } +} +} diff --git a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h new file mode 100644 index 000000000..9a612cd64 --- /dev/null +++ b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebViewBenchmarkSupportImpl_h +#define WebViewBenchmarkSupportImpl_h + +#include "WebViewBenchmarkSupport.h" + +namespace WebCore { +class IntRect; +class GraphicsLayer; +} + +namespace WebKit { +class WebViewImpl; + +class WebViewBenchmarkSupportImpl : public WebViewBenchmarkSupport { +public: + explicit WebViewBenchmarkSupportImpl(WebViewImpl* webViewImpl) : m_webViewImpl(webViewImpl) { } + virtual ~WebViewBenchmarkSupportImpl() { } + + // Paints the WebViewImpl onto canvases created from the PaintClient. + // If we're in accelerated mode, a new canvas is created for each graphics + // layer. Layout() will be called on the web view prior to painting. + virtual void paint(PaintClient*, PaintMode) OVERRIDE; + +private: + void paintLayer(PaintClient*, WebCore::GraphicsLayer&, const WebCore::IntRect& clip); + + // Paints the given graphics layer hierarchy to canvases created by the + // canvas factory. + void acceleratedPaintUnclipped(PaintClient*, WebCore::GraphicsLayer&); + void softwarePaint(PaintClient*, PaintMode); + + WebViewImpl* m_webViewImpl; +}; +} + +#endif // WebViewBenchmarkSupportImpl_h diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index e349151fa..0d5f25a51 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -195,6 +195,8 @@ static const int touchPointPadding = 32; static const float minScaleDifference = 0.01f; static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; +static const double doubleTabZoomAnimationDurationInSeconds = 0.25; + namespace WebKit { @@ -405,6 +407,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_tabsToLinks(false) , m_dragScrollTimer(adoptPtr(new DragScrollTimer)) , m_isCancelingFullScreen(false) + , m_benchmarkSupport(this) #if USE(ACCELERATED_COMPOSITING) , m_rootGraphicsLayer(0) , m_isAcceleratedCompositingActive(false) @@ -745,13 +748,18 @@ void WebViewImpl::renderingStats(WebRenderingStats& stats) const m_layerTreeView.renderingStats(stats); } -void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) +void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationInSeconds) { if (!m_layerTreeView.isNull()) - m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationSec); + m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationInSeconds); } #endif +WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport() +{ + return &m_benchmarkSupport; +} + bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) { ASSERT((event.type == WebInputEvent::RawKeyDown) @@ -1073,6 +1081,27 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo } #endif +void WebViewImpl::animateZoomAroundPoint(const IntPoint& point, AutoZoomType zoomType) +{ +#if ENABLE(GESTURE_EVENTS) + if (!mainFrameImpl()) + return; + + float scale; + WebPoint scroll; + computeScaleAndScrollForHitRect(WebRect(point.x(), point.y(), 0, 0), zoomType, scale, scroll); + + bool isDoubleTap = (zoomType == DoubleTap); + double durationInSeconds = isDoubleTap ? doubleTabZoomAnimationDurationInSeconds : 0; + startPageScaleAnimation(scroll, isDoubleTap, scale, durationInSeconds); +#endif +} + +void WebViewImpl::zoomToFindInPageRect(const WebRect& rect) +{ + animateZoomAroundPoint(IntRect(rect).center(), FindInPage); +} + void WebViewImpl::numberOfWheelEventHandlersChanged(unsigned numberOfWheelHandlers) { if (m_client) @@ -2148,6 +2177,25 @@ bool WebViewImpl::setEditableSelectionOffsets(int start, int end) return editor->setSelectionOffsets(start, end); } +bool WebViewImpl::isSelectionEditable() const +{ + const Frame* frame = focusedWebCoreFrame(); + if (!frame) + return false; + return frame->selection()->isContentEditable(); +} + +WebColor WebViewImpl::backgroundColor() const +{ + if (!m_page) + return Color::white; + FrameView* view = m_page->mainFrame()->view(); + Color backgroundColor = view->documentBackgroundColor(); + if (!backgroundColor.isValid()) + return Color::white; + return backgroundColor.rgb(); +} + bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) { const Frame* focused = focusedWebCoreFrame(); @@ -3459,6 +3507,11 @@ void WebViewImpl::setBackgroundColor(const WebCore::Color& color) m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor); } +WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() +{ + return m_rootGraphicsLayer; +} + #if ENABLE(REQUEST_ANIMATION_FRAME) void WebViewImpl::scheduleAnimation() { @@ -3697,6 +3750,12 @@ WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D() return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get().get()); } +void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) +{ + if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestionsCount()) + m_autofillPopupClient->valueChanged(listIndex); +} + void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, bool isInitialState) { if (!page()) diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 8f6bdf40b..c2f36bf45 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -56,6 +56,7 @@ #include "PageWidgetDelegate.h" #include "PlatformGestureCurveTarget.h" #include "UserMediaClientImpl.h" +#include "WebViewBenchmarkSupportImpl.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -106,6 +107,7 @@ class WebFrameImpl; class WebGestureEvent; class WebPagePopupImpl; class WebPrerendererClient; +class WebViewBenchmarkSupport; class WebImage; class WebKeyboardEvent; class WebMouseEvent; @@ -159,6 +161,8 @@ public: virtual WebTextInputInfo textInputInfo(); virtual WebTextInputType textInputType(); virtual bool setEditableSelectionOffsets(int start, int end); + virtual bool isSelectionEditable() const; + virtual WebColor backgroundColor() const; virtual bool selectionBounds(WebRect& start, WebRect& end) const; virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const; virtual bool caretOrSelectionRange(size_t* location, size_t* length); @@ -203,6 +207,7 @@ public: virtual void clearFocusedNode(); virtual void scrollFocusedNodeIntoView(); virtual void scrollFocusedNodeIntoRect(const WebRect&); + virtual void zoomToFindInPageRect(const WebRect&); virtual void advanceFocus(bool reverse); virtual double zoomLevel(); virtual double setZoomLevel(bool textOnly, double zoomLevel); @@ -276,6 +281,7 @@ public: const WebVector<int>& itemIDs, int separatorIndex); virtual void hidePopups(); + virtual void selectAutofillSuggestionAtIndex(unsigned listIndex); virtual void setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor); @@ -291,6 +297,7 @@ public: #endif virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); virtual void renderingStats(WebRenderingStats&) const; + virtual WebViewBenchmarkSupport* benchmarkSupport(); // WebLayerTreeViewClient virtual void willBeginFrame(); @@ -373,7 +380,7 @@ public: // Event related methods: void mouseContextMenu(const WebMouseEvent&); void mouseDoubleClick(const WebMouseEvent&); - void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationSec); + void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds); void numberOfWheelEventHandlersChanged(unsigned); void numberOfTouchEventHandlersChanged(unsigned); @@ -503,6 +510,7 @@ public: return m_currentInputEvent; } + WebCore::GraphicsLayer* rootGraphicsLayer(); #if USE(ACCELERATED_COMPOSITING) bool allowsAcceleratedCompositing(); void setRootGraphicsLayer(WebCore::GraphicsLayer*); @@ -544,6 +552,7 @@ public: #if ENABLE(GESTURE_EVENTS) void computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType, float& scale, WebPoint& scroll); #endif + void animateZoomAroundPoint(const WebCore::IntPoint&, AutoZoomType); void loseCompositorContext(int numTimes); @@ -784,6 +793,8 @@ private: RefPtr<WebCore::Frame> m_fullScreenFrame; bool m_isCancelingFullScreen; + WebViewBenchmarkSupportImpl m_benchmarkSupport; + #if USE(ACCELERATED_COMPOSITING) WebCore::IntRect m_rootLayerScrollDamage; OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; diff --git a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm index 88c3b72e5..f246bcf2c 100644 --- a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm @@ -91,7 +91,7 @@ static float deviceScaleFactor(NSView* view) WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view) { - NSString *colorSpace = NSColorSpaceFromDepth([[NSScreen deepestScreen] depth]); + NSScreen* screen = [NSScreen deepestScreen]; WebScreenInfo results; @@ -99,14 +99,10 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view) results.horizontalDPI = deviceDPI; results.verticalDPI = deviceDPI; - results.depth = - NSBitsPerPixelFromDepth([[NSScreen deepestScreen] depth]); - results.depthPerComponent = - NSBitsPerSampleFromDepth([[NSScreen deepestScreen] depth]); - results.isMonochrome = colorSpace == NSCalibratedWhiteColorSpace - || colorSpace == NSCalibratedBlackColorSpace - || colorSpace == NSDeviceWhiteColorSpace - || colorSpace == NSDeviceBlackColorSpace; + results.depth = NSBitsPerPixelFromDepth([screen depth]); + results.depthPerComponent = NSBitsPerSampleFromDepth([screen depth]); + results.isMonochrome = + [[screen colorSpace] colorSpaceModel] == NSGrayColorSpaceModel; results.rect = convertRect([screenForWindow([view window]) frame], [view window]); results.availableRect = convertRect([screenForWindow([view window]) visibleFrame], [view window]); diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index 9433d89da..9aa412090 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -311,11 +311,9 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) WebTransformationMatrix rotation; rotation.rotate(45); - // Note carefully, the anchor is actually part of layer->position(). By setting anchor - // to (0.5, 0.5), the layer's position (100, 100) now refers to the center of the - // layer, not the corner. This means the layer has actually changed position. clearDamageForAllSurfaces(root.get()); child->setAnchorPoint(FloatPoint(0.5, 0.5)); + child->setPosition(FloatPoint(85, 85)); emulateDrawingOneFrame(root.get()); // Sanity check that the layer actually moved to (85, 85), damaging its old location and new location. @@ -331,8 +329,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) // Since the child layer is square, rotation by 45 degrees about the center should // increase the size of the expected rect by sqrt(2), centered around (100, 100). The // old exposed region should be fully contained in the new region. - double expectedWidth = 30.0 * sqrt(2.0); - double expectedPosition = 100.0 - 0.5 * expectedWidth; + double expectedWidth = 30 * sqrt(2.0); + double expectedPosition = 100 - 0.5 * expectedWidth; FloatRect expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth); rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect(); EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect); @@ -828,7 +826,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; - reflection.scale3d(-1.0, 1.0, 1.0); + reflection.scale3d(-1, 1, 1); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); } @@ -848,7 +846,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // areas to be damaged on the target. clearDamageForAllSurfaces(root.get()); IntRect oldContentRect = child1->renderSurface()->contentRect(); - grandChild1->setPosition(FloatPoint(195.0, 205.0)); + grandChild1->setPosition(FloatPoint(195, 205)); emulateDrawingOneFrame(root.get()); ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width()); ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height()); @@ -904,7 +902,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) child->setOpacity(0.5); { OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(4); - grandChild->setPosition(FloatPoint(2.0, 2.0)); + grandChild->setPosition(FloatPoint(2, 2)); grandChild->setAnchorPoint(FloatPoint::zero()); grandChild->setBounds(IntSize(2, 2)); grandChild->setDrawsContent(true); @@ -979,7 +977,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; - reflection.scale3d(-1.0, 1.0, 1.0); + reflection.scale3d(-1, 1, 1); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); } @@ -1030,20 +1028,17 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) CCLayerImpl* child1 = root->children()[0].get(); CCLayerImpl* grandChild1 = child1->children()[0].get(); - // Verify that the correct replicaOriginTransform is used for the replicaMask; the - // incorrect old code incorrectly accounted for the anchor for the replica. A - // non-zero anchor point should not affect the replica reflection. - + // Verify that the correct replicaOriginTransform is used for the replicaMask; clearDamageForAllSurfaces(root.get()); - grandChild1->setAnchorPoint(FloatPoint(1.0, 0.0)); // This is the anchor being tested. + grandChild1->setAnchorPoint(FloatPoint(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point. { OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); - grandChild1Replica->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. + grandChild1Replica->setAnchorPoint(FloatPoint(1, 0)); // This is the anchor being tested. WebTransformationMatrix reflection; - reflection.scale3d(-1.0, 1.0, 1.0); + reflection.scale3d(-1, 1, 1); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); } @@ -1071,7 +1066,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) emulateDrawingOneFrame(root.get()); FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect(); - EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect); + EXPECT_FLOAT_RECT_EQ(FloatRect(206, 200, 6, 8), childDamageRect); } TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage) diff --git a/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp b/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp index 2ab4ec4bc..ece2420e4 100644 --- a/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp @@ -57,7 +57,7 @@ TEST(CCLayerQuadTest, Inflate) FloatQuad quad(p1, p2, p3, p4); CCLayerQuad layerQuad(quad); - quad.scale(2.0, 2.0); + quad.scale(2, 2); layerQuad.inflate(0.5); EXPECT_TRUE(layerQuad.floatQuad() == quad); } diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 0fa742548..26ae6ca47 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -154,9 +154,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) child->addChild(grandChild); WebTransformationMatrix identityMatrix; - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false); executeCalculateDrawTransformsAndVisibility(parent.get()); @@ -170,19 +170,14 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) { - // NOTE CAREFULLY: - // LayerChromium::position is actually the sum of anchorPoint (in pixel space) and actual position. Because of this, the - // value of LayerChromium::position() changes if the anchor changes, even though the layer is not actually located in a - // different position. When we initialize layers for testing here, we need to initialize that unintutive position value. - WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> layer = LayerChromium::create(); layer->createRenderSurface(); // Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform. WebTransformationMatrix arbitraryTranslation; - arbitraryTranslation.translate(10.0, 20.0); - setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); + arbitraryTranslation.translate(10, 20); + setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); @@ -190,22 +185,22 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 2: setting the bounds of the layer should result in a draw transform that translates to half the width and height. // The screen-space transform should remain as the identity, because it does not deal with transforming to/from the center of the layer. WebTransformationMatrix translationToCenter; - translationToCenter.translate(5.0, 6.0); - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); + translationToCenter.translate(5, 6); + setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 3: The anchor point by itself (without a layer transform) should have no effect on the transforms. - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); + setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); - // Case 4: A change in "actual" position affects both the draw transform and screen space transform. + // Case 4: A change in actual position affects both the draw transform and screen space transform. WebTransformationMatrix positionTransform; - positionTransform.translate(0.0, 1.2); - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); + positionTransform.translate(0, 1.2); + setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform * translationToCenter, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransform()); @@ -213,17 +208,17 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 5: In the correct sequence of transforms, the layer transform should pre-multiply the translationToCenter. This is easily tested by // using a scale transform, because scale and translation are not commutative. WebTransformationMatrix layerTransform; - layerTransform.scale3d(2.0, 2.0, 1.0); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); + layerTransform.scale3d(2, 2, 1); + setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform * translationToCenter, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform()); // Case 6: The layer transform should occur with respect to the anchor point. WebTransformationMatrix translationToAnchor; - translationToAnchor.translate(5.0, 0.0); + translationToAnchor.translate(5, 0); WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5f, 0.0f), FloatPoint(5.0f, 0.0f), IntSize(10, 12), false); + setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); @@ -232,7 +227,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // The current implementation of calculateDrawTransforms does this implicitly, but it is // still worth testing to detect accidental regressions. expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse(); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5f, 0.0f), FloatPoint(5.0f, 1.2f), IntSize(10, 12), false); + setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); @@ -250,11 +245,11 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // Case 1: parent's anchorPoint should not affect child or grandChild. WebTransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; - childTranslationToCenter.translate(8.0, 9.0); - grandChildTranslationToCenter.translate(38.0, 39.0); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); + childTranslationToCenter.translate(8, 9); + grandChildTranslationToCenter.translate(38, 39); + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(childTranslationToCenter, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform()); @@ -263,10 +258,10 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // Case 2: parent's position affects child and grandChild. WebTransformationMatrix parentPositionTransform; - parentPositionTransform.translate(0.0, 1.2); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); + parentPositionTransform.translate(0, 1.2); + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform * childTranslationToCenter, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->screenSpaceTransform()); @@ -275,13 +270,13 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // Case 3: parent's local transform affects child and grandchild WebTransformationMatrix parentLayerTransform; - parentLayerTransform.scale3d(2.0, 2.0, 1.0); + parentLayerTransform.scale3d(2, 2, 1); WebTransformationMatrix parentTranslationToAnchor; - parentTranslationToAnchor.translate(2.5, 3.0); + parentTranslationToAnchor.translate(2.5, 3); WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse(); - setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); + setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); @@ -293,16 +288,16 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // Note that preserves3D is false, but the sublayer matrix should retain its 3D properties when given to child. // But then, the child also does not preserve3D. When it gives its hierarchy to the grandChild, it should be flattened to 2D. WebTransformationMatrix parentSublayerMatrix; - parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); + parentSublayerMatrix.scale3d(10, 10, 3.3); WebTransformationMatrix parentTranslationToCenter; - parentTranslationToCenter.translate(5.0, 6.0); + parentTranslationToCenter.translate(5, 6); // Sublayer matrix is applied to the center of the parent layer. parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); WebTransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform); - setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); + setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); @@ -311,9 +306,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // Case 5: same as Case 4, except that child does preserve 3D, so the grandChild should receive the non-flattened composite transform. // - setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), true); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); + setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), true); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); @@ -331,28 +326,28 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) child->addChild(grandChild); // Child is set up so that a new render surface should be created. - child->setOpacity(0.5f); + child->setOpacity(0.5); WebTransformationMatrix identityMatrix; WebTransformationMatrix parentLayerTransform; - parentLayerTransform.scale3d(2.0, 2.0, 1.0); + parentLayerTransform.scale3d(2, 2, 1); WebTransformationMatrix parentTranslationToAnchor; - parentTranslationToAnchor.translate(2.5, 3.0); + parentTranslationToAnchor.translate(2.5, 3); WebTransformationMatrix parentSublayerMatrix; - parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); + parentSublayerMatrix.scale3d(10, 10, 3.3); WebTransformationMatrix parentTranslationToCenter; - parentTranslationToCenter.translate(5.0, 6.0); + parentTranslationToCenter.translate(5, 6); WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); WebTransformationMatrix childTranslationToCenter; - childTranslationToCenter.translate(8.0, 9.0); + childTranslationToCenter.translate(8, 9); // Child's render surface should not exist yet. ASSERT_FALSE(child->renderSurface()); - setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(-0.5f, -0.5f), IntSize(1, 1), false); + setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-0.5, -0.5), IntSize(1, 1), false); executeCalculateDrawTransformsAndVisibility(parent.get()); // Render surface should have been created now. @@ -411,7 +406,7 @@ TEST(CCLayerTreeHostCommonTest, scissorRectNoClip) child->setAnchorPoint(FloatPoint(0, 0)); child->setPosition(FloatPoint(childRect.x(), childRect.y())); - child->setOpacity(0.5f); + child->setOpacity(0.5); child->setBounds(IntSize(childRect.width(), childRect.height())); child->setDrawsContent(true); @@ -590,7 +585,7 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) child->setAnchorPoint(FloatPoint(0, 0)); child->setPosition(FloatPoint(childRect.x(), childRect.y())); - child->setOpacity(0.5f); + child->setOpacity(0.5); child->setBounds(IntSize(childRect.width(), childRect.height())); child->setDrawsContent(true); @@ -772,19 +767,19 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) child->setAnchorPoint(FloatPoint(0, 0)); child->setPosition(FloatPoint(childRect.x(), childRect.y())); - child->setOpacity(0.5f); + child->setOpacity(0.5); child->setBounds(IntSize(childRect.width(), childRect.height())); child->setDrawsContent(true); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); - grandChild->setOpacity(0.5f); + grandChild->setOpacity(0.5); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); grandChild->setDrawsContent(true); grandChild2->setAnchorPoint(FloatPoint(0, 0)); grandChild2->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); - grandChild2->setOpacity(0.5f); + grandChild2->setOpacity(0.5); grandChild2->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); grandChild2->setDrawsContent(true); @@ -936,32 +931,32 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) child->setReplicaLayer(childReplica.get()); // Child is set up so that a new render surface should be created. - child->setOpacity(0.5f); + child->setOpacity(0.5); WebTransformationMatrix identityMatrix; WebTransformationMatrix parentLayerTransform; - parentLayerTransform.scale3d(2.0, 2.0, 1.0); + parentLayerTransform.scale3d(2, 2, 1); WebTransformationMatrix parentTranslationToAnchor; - parentTranslationToAnchor.translate(2.5, 3.0); + parentTranslationToAnchor.translate(2.5, 3); WebTransformationMatrix parentSublayerMatrix; - parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); + parentSublayerMatrix.scale3d(10, 10, 3.3); WebTransformationMatrix parentTranslationToCenter; - parentTranslationToCenter.translate(5.0, 6.0); + parentTranslationToCenter.translate(5, 6); WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); WebTransformationMatrix childTranslationToCenter; - childTranslationToCenter.translate(8.0, 9.0); + childTranslationToCenter.translate(8, 9); WebTransformationMatrix replicaLayerTransform; - replicaLayerTransform.scale3d(3.0, 3.0, 1.0); + replicaLayerTransform.scale3d(3, 3, 1); WebTransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform; // Child's render surface should not exist yet. ASSERT_FALSE(child->renderSurface()); - setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); - setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); - setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(-0.5f, -0.5f), IntSize(1, 1), false); - setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); + setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-0.5, -0.5), IntSize(1, 1), false); + setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false); executeCalculateDrawTransformsAndVisibility(parent.get()); // Render surface should have been created now. @@ -1005,42 +1000,42 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) renderSurface2->setReplicaLayer(replicaOfRS2.get()); // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface. - renderSurface1->setOpacity(0.5f); + renderSurface1->setOpacity(0.5); renderSurface2->setOpacity(0.33f); - // All layers in the tree are initialized with an anchor at 2.5 and a size of (10,10). + // All layers in the tree are initialized with an anchor at .25 and a size of (10,10). // matrix "A" is the composite layer transform used in all layers, centered about the anchor point // matrix "B" is the sublayer transform used in all layers, centered about the center position of the layer. // matrix "R" is the composite replica transform used in all replica layers. // // x component tests that layerTransform and sublayerTransform are done in the right order (translation and scale are noncommutative). - // y component has a translation by 1.0 for every ancestor, which indicates the "depth" of the layer in the hierarchy. + // y component has a translation by 1 for every ancestor, which indicates the "depth" of the layer in the hierarchy. WebTransformationMatrix translationToAnchor; - translationToAnchor.translate(2.5, 0.0); + translationToAnchor.translate(2.5, 0); WebTransformationMatrix translationToCenter; - translationToCenter.translate(5.0, 5.0); + translationToCenter.translate(5, 5); WebTransformationMatrix layerTransform; - layerTransform.translate(1.0, 1.0); + layerTransform.translate(1, 1); WebTransformationMatrix sublayerTransform; - sublayerTransform.scale3d(10.0, 1.0, 1.0); + sublayerTransform.scale3d(10, 1, 1); WebTransformationMatrix replicaLayerTransform; - replicaLayerTransform.scale3d(-2.0, 5.0, 1.0); + replicaLayerTransform.scale3d(-2, 5, 1); WebTransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); - setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, sublayerTransform, FloatPoint(), FloatPoint(2.5f, 0.0f), IntSize(), false); - setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, sublayerTransform, FloatPoint(), FloatPoint(2.5f, 0.0f), IntSize(), false); + setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(), false); + setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(), false); executeCalculateDrawTransformsAndVisibility(parent.get()); @@ -1118,17 +1113,17 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // Sanity check. If these fail there is probably a bug in the test itself. // It is expected that we correctly set up transforms so that the y-component of the screen-space transform // encodes the "depth" of the layer in the tree. - EXPECT_FLOAT_EQ(1.0, parent->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(2.0, childOfRoot->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(3.0, grandChildOfRoot->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(1, parent->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(2, childOfRoot->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(3, grandChildOfRoot->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(2.0, renderSurface1->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(3.0, childOfRS1->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(4.0, grandChildOfRS1->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(2, renderSurface1->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(3, childOfRS1->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(4, grandChildOfRS1->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(3.0, renderSurface2->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(4.0, childOfRS2->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(5.0, grandChildOfRS2->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(3, renderSurface2->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(4, childOfRS2->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42()); } TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) @@ -1860,7 +1855,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) child->setMasksToBounds(true); child->setOpacity(0.4f); - grandChild->setOpacity(0.5f); + grandChild->setOpacity(0.5); greatGrandChild->setOpacity(0.4f); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; @@ -1913,7 +1908,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro) child->setMasksToBounds(true); child->setOpacity(0.4f); - grandChild->setOpacity(0.5f); + grandChild->setOpacity(0.5); greatGrandChild->setOpacity(0.4f); // Contaminate the grandChild and greatGrandChild's clipRect to reproduce the crash @@ -2053,10 +2048,10 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) // Force everyone to be a render surface. child->setOpacity(0.4f); - grandChild1->setOpacity(0.5f); - grandChild2->setOpacity(0.5f); - grandChild3->setOpacity(0.5f); - grandChild4->setOpacity(0.5f); + grandChild1->setOpacity(0.5); + grandChild2->setOpacity(0.5); + grandChild3->setOpacity(0.5); + grandChild4->setOpacity(0.5); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; @@ -2128,10 +2123,10 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) // Force everyone to be a render surface. child->setOpacity(0.4f); - grandChild1->setOpacity(0.5f); - grandChild2->setOpacity(0.5f); - grandChild3->setOpacity(0.5f); - grandChild4->setOpacity(0.5f); + grandChild1->setOpacity(0.5); + grandChild2->setOpacity(0.5); + grandChild3->setOpacity(0.5); + grandChild4->setOpacity(0.5); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; @@ -2194,9 +2189,9 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false); WebTransformationMatrix layerTransform; - layerTransform.translate(1.0, 1.0); + layerTransform.translate(1, 1); WebTransformationMatrix sublayerTransform; - sublayerTransform.scale3d(10.0, 1.0, 1.0); + sublayerTransform.scale3d(10, 1, 1); // Put a transform animation on the render surface. addAnimatedTransformToController(*renderSurface2->layerAnimationController(), 10, 30, 0); @@ -2205,15 +2200,15 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) addAnimatedTransformToController(*grandChildOfRoot->layerAnimationController(), 10, 30, 0); addAnimatedTransformToController(*grandChildOfRS2->layerAnimationController(), 10, 30, 0); - setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); - setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); + setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); + setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false); executeCalculateDrawTransformsAndVisibility(parent.get()); @@ -2291,17 +2286,17 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) // Sanity check. If these fail there is probably a bug in the test itself. // It is expected that we correctly set up transforms so that the y-component of the screen-space transform // encodes the "depth" of the layer in the tree. - EXPECT_FLOAT_EQ(1.0, parent->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(2.0, childOfRoot->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(3.0, grandChildOfRoot->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(1, parent->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(2, childOfRoot->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(3, grandChildOfRoot->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(2.0, renderSurface1->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(3.0, childOfRS1->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(4.0, grandChildOfRS1->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(2, renderSurface1->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(3, childOfRS1->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(4, grandChildOfRS1->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(3.0, renderSurface2->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(4.0, childOfRS2->screenSpaceTransform().m42()); - EXPECT_FLOAT_EQ(5.0, grandChildOfRS2->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(3, renderSurface2->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(4, childOfRS2->screenSpaceTransform().m42()); + EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42()); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) @@ -2424,7 +2419,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) // Case 2: Orthographic projection of a layer rotated about y-axis by 45 degrees, but // shifted to the side so only the right-half the layer would be visible on // the surface. - double halfWidthOfRotatedLayer = (100.0 / sqrt(2.0)) * 0.5; // 100.0 is the un-rotated layer width; divided by sqrt(2.0) is the rotated width. + double halfWidthOfRotatedLayer = (100 / sqrt(2.0)) * 0.5; // 100 is the un-rotated layer width; divided by sqrt(2) is the rotated width. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.translate(-halfWidthOfRotatedLayer, 0); layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer @@ -2605,8 +2600,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) backfaceMatrix.translate(-50, -50); // Having a descendant and opacity will force these to have render surfaces. - frontFacingSurface->setOpacity(0.5f); - backFacingSurface->setOpacity(0.5f); + frontFacingSurface->setOpacity(0.5); + backFacingSurface->setOpacity(0.5); // Nothing preserves 3d. According to current W3C CSS Transforms spec, these layers // should blindly use their own local transforms to determine back-face culling. diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index e9b9f0281..dd525fcbf 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -28,6 +28,7 @@ #include "CCAnimationTestCommon.h" #include "CCLayerTestCommon.h" +#include "CCLayerTreeTestCommon.h" #include "CCTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "LayerRendererChromium.h" @@ -134,6 +135,8 @@ public: root->setScrollable(true); root->setScrollPosition(IntPoint(0, 0)); root->setMaxScrollPosition(contentSize); + root->setBounds(contentSize); + root->setContentBounds(contentSize); OwnPtr<CCLayerImpl> contents = CCLayerImpl::create(2); contents->setDrawsContent(true); contents->setBounds(contentSize); @@ -598,12 +601,12 @@ class DidDrawCheckLayer : public CCTiledLayerImpl { public: static PassOwnPtr<DidDrawCheckLayer> create(int id) { return adoptPtr(new DidDrawCheckLayer(id)); } - virtual void didDraw() + virtual void didDraw(CCResourceProvider*) OVERRIDE { m_didDrawCalled = true; } - virtual void willDraw(CCRenderer*, CCGraphicsContext*) + virtual void willDraw(CCResourceProvider*) OVERRIDE { m_willDrawCalled = true; } @@ -753,18 +756,20 @@ TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) class MissingTextureAnimatingLayer : public DidDrawCheckLayer { public: - static PassOwnPtr<MissingTextureAnimatingLayer> create(int id, bool tileMissing, bool skipsDraw, bool animating) { return adoptPtr(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating)); } + static PassOwnPtr<MissingTextureAnimatingLayer> create(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) { return adoptPtr(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating, resourceProvider)); } private: - explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating) + explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) : DidDrawCheckLayer(id) { OwnPtr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels); tilingData->setBounds(bounds()); setTilingData(*tilingData.get()); setSkipsDraw(skipsDraw); - if (!tileMissing) - pushTileProperties(0, 0, 1, IntRect()); + if (!tileMissing) { + CCResourceProvider::ResourceId resource = resourceProvider->createResource(CCRenderer::ContentPool, IntSize(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + pushTileProperties(0, 0, resource, IntRect()); + } if (animating) addAnimatedTransformToLayer(*this, 10, 3, 0); } @@ -775,7 +780,7 @@ TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) // When the texture is not missing, we draw as usual. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(2, false, false, true)); + root->addChild(MissingTextureAnimatingLayer::create(2, false, false, true, m_hostImpl->resourceProvider())); CCLayerTreeHostImpl::FrameData frame; @@ -786,7 +791,7 @@ TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) // When a texture is missing and we're not animating, we draw as usual with checkerboarding. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(2, true, false, false)); + root->addChild(MissingTextureAnimatingLayer::create(2, true, false, false, m_hostImpl->resourceProvider())); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); @@ -795,7 +800,7 @@ TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) // When a texture is missing and we're animating, we don't want to draw anything. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(2, true, false, true)); + root->addChild(MissingTextureAnimatingLayer::create(2, true, false, true, m_hostImpl->resourceProvider())); EXPECT_FALSE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); @@ -804,7 +809,7 @@ TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) // When the layer skips draw and we're animating, we still draw the frame. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - root->addChild(MissingTextureAnimatingLayer::create(2, false, true, true)); + root->addChild(MissingTextureAnimatingLayer::create(2, false, true, true, m_hostImpl->resourceProvider())); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); @@ -857,7 +862,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) { IntSize surfaceSize(10, 10); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - root->addChild(createScrollableLayer(2, FloatPoint(5, 5), surfaceSize)); + root->addChild(createScrollableLayer(2, FloatPoint(0, 0), surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize); initializeLayerRendererAndDrawFrame(); @@ -873,7 +878,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesChild) { IntSize surfaceSize(10, 10); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - root->addChild(createScrollableLayer(2, FloatPoint(5, 5), surfaceSize)); + root->addChild(createScrollableLayer(2, FloatPoint(0, 0), surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize); initializeLayerRendererAndDrawFrame(); @@ -888,7 +893,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) { IntSize surfaceSize(10, 10); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); m_hostImpl->setViewportSize(surfaceSize); WebTransformationMatrix matrix; @@ -910,11 +915,11 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) TEST_F(CCLayerTreeHostImplTest, scrollBlockedByContentLayer) { IntSize surfaceSize(10, 10); - OwnPtr<CCLayerImpl> contentLayer = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> contentLayer = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); contentLayer->setShouldScrollOnMainThread(true); contentLayer->setScrollable(false); - OwnPtr<CCLayerImpl> scrollLayer = createScrollableLayer(2, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> scrollLayer = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); scrollLayer->addChild(contentLayer.release()); m_hostImpl->setRootLayer(scrollLayer.release()); @@ -929,7 +934,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize); initializeLayerRendererAndDrawFrame(); @@ -960,7 +965,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize); m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); @@ -1000,7 +1005,7 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) CCLayerImpl* root = m_hostImpl->rootLayer(); CCLayerImpl* child = root->children()[0].get(); - OwnPtr<CCLayerImpl> scrollableChild = createScrollableLayer(3, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> scrollableChild = createScrollableLayer(3, FloatPoint(0, 0), surfaceSize); child->addChild(scrollableChild.release()); CCLayerImpl* grandChild = child->children()[0].get(); @@ -1023,6 +1028,7 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) WebTransformationMatrix pageScaleTransform; pageScaleTransform.scale(newPageScale); + pageScaleTransform.translate(0.5 * surfaceSize.width(), 0.5 * surfaceSize.height()); EXPECT_EQ(root->drawTransform(), pageScaleTransform); EXPECT_EQ(child->drawTransform(), pageScaleTransform); EXPECT_EQ(grandChild->drawTransform(), pageScaleTransform); @@ -1035,7 +1041,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) // Also mark the root scrollable so it becomes the root scroll layer. root->setScrollable(true); int scrollLayerId = 2; - root->addChild(createScrollableLayer(scrollLayerId, FloatPoint(5, 5), surfaceSize)); + root->addChild(createScrollableLayer(scrollLayerId, FloatPoint(0, 0), surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize); initializeLayerRendererAndDrawFrame(); @@ -1070,12 +1076,12 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildBeyondLimit) // parent layer is scrolled on the axis on which the child was unable to // scroll. IntSize surfaceSize(10, 10); - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); - OwnPtr<CCLayerImpl> grandChild = createScrollableLayer(3, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> grandChild = createScrollableLayer(3, FloatPoint(0, 0), surfaceSize); grandChild->setScrollPosition(IntPoint(0, 5)); - OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); child->setScrollPosition(IntPoint(3, 0)); child->addChild(grandChild.release()); @@ -1106,8 +1112,8 @@ TEST_F(CCLayerTreeHostImplTest, scrollEventBubbling) // When we try to scroll a non-scrollable child layer, the scroll delta // should be applied to one of its ancestors if possible. IntSize surfaceSize(10, 10); - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize); - OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(5, 5), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); child->setScrollable(false); root->addChild(child.release()); @@ -1132,13 +1138,13 @@ TEST_F(CCLayerTreeHostImplTest, scrollEventBubbling) TEST_F(CCLayerTreeHostImplTest, scrollBeforeRedraw) { IntSize surfaceSize(10, 10); - m_hostImpl->setRootLayer(createScrollableLayer(1, FloatPoint(5, 5), surfaceSize)); + m_hostImpl->setRootLayer(createScrollableLayer(1, FloatPoint(0, 0), surfaceSize)); m_hostImpl->setViewportSize(surfaceSize); // Draw one frame and then immediately rebuild the layer tree to mimic a tree synchronization. initializeLayerRendererAndDrawFrame(); m_hostImpl->detachLayerTree(); - m_hostImpl->setRootLayer(createScrollableLayer(2, FloatPoint(5, 5), surfaceSize)); + m_hostImpl->setRootLayer(createScrollableLayer(2, FloatPoint(0, 0), surfaceSize)); // Scrolling should still work even though we did not draw yet. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); @@ -1168,9 +1174,9 @@ private: class BlendStateCheckLayer : public CCLayerImpl { public: - static PassOwnPtr<BlendStateCheckLayer> create(int id) { return adoptPtr(new BlendStateCheckLayer(id)); } + static PassOwnPtr<BlendStateCheckLayer> create(int id, CCResourceProvider* resourceProvider) { return adoptPtr(new BlendStateCheckLayer(id, resourceProvider)); } - virtual void appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE + virtual void appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE { m_quadsAppended = true; @@ -1179,7 +1185,7 @@ public: opaqueRect = m_quadRect; else opaqueRect = m_opaqueContentRect; - OwnPtr<CCDrawQuad> testBlendingDrawQuad = CCTileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, 0, IntPoint(), IntSize(1, 1), 0, false, false, false, false, false); + OwnPtr<CCDrawQuad> testBlendingDrawQuad = CCTileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, m_resourceId, IntPoint(), IntSize(1, 1), 0, false, false, false, false, false); testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect); EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending()); EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); @@ -1201,7 +1207,7 @@ public: void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect; } private: - explicit BlendStateCheckLayer(int id) + explicit BlendStateCheckLayer(int id, CCResourceProvider* resourceProvider) : CCLayerImpl(id) , m_blend(false) , m_hasRenderSurface(false) @@ -1209,6 +1215,7 @@ private: , m_opaqueContents(false) , m_quadRect(5, 5, 5, 5) , m_quadVisibleRect(5, 5, 5, 5) + , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool, IntSize(1, 1), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) { setAnchorPoint(FloatPoint(0, 0)); setBounds(IntSize(10, 10)); @@ -1223,6 +1230,7 @@ private: IntRect m_quadRect; IntRect m_opaqueContentRect; IntRect m_quadVisibleRect; + CCResourceProvider::ResourceId m_resourceId; }; TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) @@ -1237,7 +1245,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) } CCLayerImpl* root = m_hostImpl->rootLayer(); - root->addChild(BlendStateCheckLayer::create(2)); + root->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider())); BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0].get()); layer1->setPosition(FloatPoint(2, 2)); @@ -1290,7 +1298,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) EXPECT_TRUE(layer1->quadsAppended()); m_hostImpl->didDrawAllLayers(frame); - layer1->addChild(BlendStateCheckLayer::create(3)); + layer1->addChild(BlendStateCheckLayer::create(3, m_hostImpl->resourceProvider())); BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0].get()); layer2->setPosition(FloatPoint(4, 4)); @@ -1451,7 +1459,7 @@ TEST_F(CCLayerTreeHostImplTest, viewportCovered) IntSize viewportSize(1000, 1000); m_hostImpl->setViewportSize(viewportSize); - m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1)); + m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourceProvider())); BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer()); root->setExpectation(false, true); root->setOpaque(true); @@ -1695,10 +1703,10 @@ class FakeLayerWithQuads : public CCLayerImpl { public: static PassOwnPtr<FakeLayerWithQuads> create(int id) { return adoptPtr(new FakeLayerWithQuads(id)); } - virtual void appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE + virtual void appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE { SkColor gray = SkColorSetRGB(100, 100, 100); - IntRect quadRect(0, 0, 5, 5); + IntRect quadRect(IntPoint(0, 0), contentBounds()); OwnPtr<CCDrawQuad> myQuad = CCSolidColorDrawQuad::create(sharedQuadState, quadRect, gray); quadList.append(myQuad.release()); } @@ -2469,6 +2477,21 @@ TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground) Mock::VerifyAndClearExpectations(&mockContext); } +static void addDrawingLayerTo(CCLayerImpl* parent, int id, const IntRect& layerRect, CCLayerImpl** result) +{ + OwnPtr<CCLayerImpl> layer = FakeLayerWithQuads::create(id); + CCLayerImpl* layerPtr = layer.get(); + layerPtr->setAnchorPoint(FloatPoint(0, 0)); + layerPtr->setPosition(FloatPoint(layerRect.location())); + layerPtr->setBounds(layerRect.size()); + layerPtr->setContentBounds(layerRect.size()); + layerPtr->setDrawsContent(true); // only children draw content + layerPtr->setOpaque(true); + parent->addChild(layer.release()); + if (result) + *result = layerPtr; +} + static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) { OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); @@ -2483,50 +2506,20 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, root->setPosition(FloatPoint(0, 0)); root->setBounds(rootSize); root->setContentBounds(rootSize); - root->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); root->setDrawsContent(true); layerTreeHostImpl->setRootLayer(root.release()); - // Intermediate layer does not own a surface, and does not draw content. - OwnPtr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(2); - intermediateLayerPtr = intermediateLayer.get(); - - intermediateLayerPtr->setAnchorPoint(FloatPoint(0, 0)); - intermediateLayerPtr->setPosition(FloatPoint(10, 10)); - intermediateLayerPtr->setBounds(rootSize); - intermediateLayerPtr->setContentBounds(rootSize); - intermediateLayerPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); + addDrawingLayerTo(rootPtr, 2, IntRect(10, 10, rootSize.width(), rootSize.height()), &intermediateLayerPtr); intermediateLayerPtr->setDrawsContent(false); // only children draw content - rootPtr->addChild(intermediateLayer.release()); - - OwnPtr<CCLayerImpl> surfaceLayer = CCLayerImpl::create(3); - surfaceLayerPtr = surfaceLayer.get(); // Surface layer is the layer that changes its opacity // It will contain other layers that draw content. - IntSize surfaceSize(rootSize.width(), rootSize.height()); - surfaceLayerPtr->setAnchorPoint(FloatPoint(0, 0)); - surfaceLayerPtr->setPosition(FloatPoint(10, 10)); - surfaceLayerPtr->setBounds(surfaceSize); - surfaceLayerPtr->setContentBounds(surfaceSize); - surfaceLayerPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), surfaceSize)); + addDrawingLayerTo(intermediateLayerPtr, 3, IntRect(10, 10, rootSize.width(), rootSize.height()), &surfaceLayerPtr); surfaceLayerPtr->setDrawsContent(false); // only children draw content surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface - intermediateLayerPtr->addChild(surfaceLayer.release()); // Child of the surface layer will produce some quads - OwnPtr<FakeLayerWithQuads> child = FakeLayerWithQuads::create(4); - childPtr = child.get(); - - IntSize childSize(rootSize.width(), rootSize.height()); - childPtr->setAnchorPoint(FloatPoint(0, 0)); - childPtr->setPosition(FloatPoint(5, 5)); - childPtr->setBounds(childSize); - childPtr->setContentBounds(childSize); - childPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), childSize)); - childPtr->setDrawsContent(true); - - surfaceLayerPtr->addChild(child.release()); + addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(5, 5, rootSize.width(), rootSize.height()), &childPtr); } class LayerRendererChromiumWithReleaseTextures : public LayerRendererChromium { @@ -2534,6 +2527,612 @@ public: using LayerRendererChromium::releaseRenderPassTextures; }; +TEST_F(CCLayerTreeHostImplTest, textureCachingWithClipping) +{ + CCSettings::setPartialSwapEnabled(true); + + CCLayerTreeSettings settings; + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + + CCLayerImpl* rootPtr; + CCLayerImpl* surfaceLayerPtr; + + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); + + IntSize rootSize(100, 100); + + myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height())); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + rootPtr = root.get(); + + root->setAnchorPoint(FloatPoint(0, 0)); + root->setPosition(FloatPoint(0, 0)); + root->setBounds(rootSize); + root->setContentBounds(rootSize); + root->setDrawsContent(true); + root->setMasksToBounds(true); + myHostImpl->setRootLayer(root.release()); + + addDrawingLayerTo(rootPtr, 3, IntRect(0, 0, rootSize.width(), rootSize.height()), &surfaceLayerPtr); + surfaceLayerPtr->setDrawsContent(false); + + // Surface layer is the layer that changes its opacity + // It will contain other layers that draw content. + surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface + + addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(0, 0, 100, 3), 0); + addDrawingLayerTo(surfaceLayerPtr, 5, IntRect(0, 97, 100, 3), 0); + + // Rotation will put part of the child ouside the bounds of the root layer. + // Nevertheless, the child layers should be drawn. + WebTransformationMatrix transform = surfaceLayerPtr->transform(); + transform.translate(50, 50); + transform.rotate(35); + transform.translate(-50, -50); + surfaceLayerPtr->setTransform(transform); + + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive two render passes, each with one quad + ASSERT_EQ(2U, frame.renderPasses.size()); + EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); + ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size()); + + // Verify that the child layers have been drawn entirely. + IntRect quadVisibleRect = frame.renderPasses[0]->quadList()[0]->quadVisibleRect(); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 3), quadVisibleRect); + + quadVisibleRect = frame.renderPasses[0]->quadList()[1]->quadVisibleRect(); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 3), quadVisibleRect); + + EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); + EXPECT_FALSE(quad->contentsChangedSinceLastFrame().isEmpty()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + transform = surfaceLayerPtr->transform(); + transform.translate(50, 50); + transform.rotate(-35); + transform.translate(-50, -50); + surfaceLayerPtr->setTransform(transform); + + // The surface is now aligned again, and the clipped parts are exposed. + // That should be OK, as we've already verified that the quads are drawn in full. + // Verify that the render pass is removed. + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive a single render pass using a cached texture. + ASSERT_EQ(1U, frame.renderPasses.size()); + EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } +} + +TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusion) +{ + CCSettings::setPartialSwapEnabled(false); + + CCLayerTreeSettings settings; + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + + // Layers are structure as follows: + // + // R +-- S1 +- L10 (owning) + // | +- L11 + // | +- L12 + // | + // +-- S2 +- L20 (owning) + // +- L21 + // + // Occlusion: + // L12 occludes L11 (internal) + // L20 occludes L10 (external) + // L21 occludes L20 (internal) + + CCLayerImpl* rootPtr; + CCLayerImpl* layerS1Ptr; + CCLayerImpl* layerS2Ptr; + + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); + + IntSize rootSize(1000, 1000); + + myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height())); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + rootPtr = root.get(); + + root->setAnchorPoint(FloatPoint(0, 0)); + root->setPosition(FloatPoint(0, 0)); + root->setBounds(rootSize); + root->setContentBounds(rootSize); + root->setDrawsContent(true); + root->setMasksToBounds(true); + myHostImpl->setRootLayer(root.release()); + + addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr); + layerS1Ptr->setForceRenderSurface(true); + + addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11 + addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12 + + addDrawingLayerTo(rootPtr, 5, IntRect(550, 250, 300, 400), &layerS2Ptr); + layerS2Ptr->setForceRenderSurface(true); + + addDrawingLayerTo(layerS2Ptr, 6, IntRect(20, 20, 5, 5), 0); // L21 + + // Initial draw - must receive all quads + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 3 render passes. + // For Root, there are 2 quads; for S1, there are 3 quads; for S2, there is 1 quad. + ASSERT_EQ(3U, frame.renderPasses.size()); + + EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); + EXPECT_EQ(3U, frame.renderPasses[1]->quadList().size()); + EXPECT_EQ(2U, frame.renderPasses[2]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // "Unocclude" surface S1 and repeat draw. + // Must remove S2's render pass since it's cached; + // Must keep S1 quads because texture contained external occlusion. + WebTransformationMatrix transform = layerS2Ptr->transform(); + transform.translate(150, 150); + layerS2Ptr->setTransform(transform); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 2 render passes. + // For Root, there are 2 quads + // For S1, the number of quads depends on what got unoccluded, so not asserted beyond being positive. + // For S2, there is no render pass + ASSERT_EQ(2U, frame.renderPasses.size()); + + EXPECT_GT(frame.renderPasses[0]->quadList().size(), 0U); + EXPECT_EQ(2U, frame.renderPasses[1]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // "Re-occlude" surface S1 and repeat draw. + // Must remove S1's render pass since it is now available in full. + // S2 has no change so must also be removed. + transform = layerS2Ptr->transform(); + transform.translate(-15, -15); + layerS2Ptr->setTransform(transform); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 1 render pass - for the root. + ASSERT_EQ(1U, frame.renderPasses.size()); + + EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + +} + +TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) +{ + CCSettings::setPartialSwapEnabled(false); + + CCLayerTreeSettings settings; + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + + // Layers are structure as follows: + // + // R +-- S1 +- L10 (owning, non drawing) + // | +- L11 (corner, unoccluded) + // | +- L12 (corner, unoccluded) + // | +- L13 (corner, unoccluded) + // | +- L14 (corner, entirely occluded) + // | + // +-- S2 +- L20 (owning, drawing) + // + + CCLayerImpl* rootPtr; + CCLayerImpl* layerS1Ptr; + CCLayerImpl* layerS2Ptr; + + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); + + IntSize rootSize(1000, 1000); + + myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height())); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + rootPtr = root.get(); + + root->setAnchorPoint(FloatPoint(0, 0)); + root->setPosition(FloatPoint(0, 0)); + root->setBounds(rootSize); + root->setContentBounds(rootSize); + root->setDrawsContent(true); + root->setMasksToBounds(true); + myHostImpl->setRootLayer(root.release()); + + addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 800, 800), &layerS1Ptr); + layerS1Ptr->setForceRenderSurface(true); + layerS1Ptr->setDrawsContent(false); + + addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11 + addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 500, 300, 300), 0); // L12 + addDrawingLayerTo(layerS1Ptr, 5, IntRect(500, 0, 300, 300), 0); // L13 + addDrawingLayerTo(layerS1Ptr, 6, IntRect(500, 500, 300, 300), 0); // L14 + addDrawingLayerTo(layerS1Ptr, 9, IntRect(500, 500, 300, 300), 0); // L14 + + addDrawingLayerTo(rootPtr, 7, IntRect(450, 450, 450, 450), &layerS2Ptr); + layerS2Ptr->setForceRenderSurface(true); + + // Initial draw - must receive all quads + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 3 render passes. + // For Root, there are 2 quads; for S1, there are 3 quads; for S2, there is 1 quad. + ASSERT_EQ(3U, frame.renderPasses.size()); + + EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); + + // L14 is culled, so only 3 quads. + EXPECT_EQ(3U, frame.renderPasses[1]->quadList().size()); + EXPECT_EQ(2U, frame.renderPasses[2]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // "Unocclude" surface S1 and repeat draw. + // Must remove S2's render pass since it's cached; + // Must keep S1 quads because texture contained external occlusion. + WebTransformationMatrix transform = layerS2Ptr->transform(); + transform.translate(100, 100); + layerS2Ptr->setTransform(transform); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 2 render passes. + // For Root, there are 2 quads + // For S1, the number of quads depends on what got unoccluded, so not asserted beyond being positive. + // For S2, there is no render pass + ASSERT_EQ(2U, frame.renderPasses.size()); + + EXPECT_GT(frame.renderPasses[0]->quadList().size(), 0U); + EXPECT_EQ(2U, frame.renderPasses[1]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // "Re-occlude" surface S1 and repeat draw. + // Must remove S1's render pass since it is now available in full. + // S2 has no change so must also be removed. + transform = layerS2Ptr->transform(); + transform.translate(-15, -15); + layerS2Ptr->setTransform(transform); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 1 render pass - for the root. + ASSERT_EQ(1U, frame.renderPasses.size()); + + EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } +} + +TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) +{ + CCSettings::setPartialSwapEnabled(false); + + CCLayerTreeSettings settings; + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + + // Layers are structured as follows: + // + // R +-- S1 +- L10 (owning, drawing) + // | +- L11 (corner, occluded by L12) + // | +- L12 (opposite corner) + // | + // +-- S2 +- L20 (owning, drawing) + // + + CCLayerImpl* rootPtr; + CCLayerImpl* layerS1Ptr; + CCLayerImpl* layerS2Ptr; + + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); + + IntSize rootSize(1000, 1000); + + myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height())); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + rootPtr = root.get(); + + root->setAnchorPoint(FloatPoint(0, 0)); + root->setPosition(FloatPoint(0, 0)); + root->setBounds(rootSize); + root->setContentBounds(rootSize); + root->setDrawsContent(true); + root->setMasksToBounds(true); + myHostImpl->setRootLayer(root.release()); + + addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr); + layerS1Ptr->setForceRenderSurface(true); + + addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11 + addDrawingLayerTo(layerS1Ptr, 4, IntRect(100, 0, 300, 300), 0); // L12 + + addDrawingLayerTo(rootPtr, 7, IntRect(200, 0, 300, 300), &layerS2Ptr); + layerS2Ptr->setForceRenderSurface(true); + + // Initial draw - must receive all quads + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 3 render passes. + // For Root, there are 2 quads; for S1, there are 3 quads; for S2, there is 1 quad. + ASSERT_EQ(3U, frame.renderPasses.size()); + + EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); + EXPECT_EQ(3U, frame.renderPasses[1]->quadList().size()); + EXPECT_EQ(2U, frame.renderPasses[2]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // "Unocclude" surface S1 and repeat draw. + // Must remove S2's render pass since it's cached; + // Must keep S1 quads because texture contained external occlusion. + WebTransformationMatrix transform = layerS2Ptr->transform(); + transform.translate(300, 0); + layerS2Ptr->setTransform(transform); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 2 render passes. + // For Root, there are 2 quads + // For S1, the number of quads depends on what got unoccluded, so not asserted beyond being positive. + // For S2, there is no render pass + ASSERT_EQ(2U, frame.renderPasses.size()); + + EXPECT_GT(frame.renderPasses[0]->quadList().size(), 0U); + EXPECT_EQ(2U, frame.renderPasses[1]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } +} + +TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) +{ + CCSettings::setPartialSwapEnabled(false); + + CCLayerTreeSettings settings; + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + + // Layers are structured as follows: + // + // R +-- S1 +- L10 (rotated, drawing) + // +- L11 (occupies half surface) + + CCLayerImpl* rootPtr; + CCLayerImpl* layerS1Ptr; + + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); + + IntSize rootSize(1000, 1000); + + myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height())); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + rootPtr = root.get(); + + root->setAnchorPoint(FloatPoint(0, 0)); + root->setPosition(FloatPoint(0, 0)); + root->setBounds(rootSize); + root->setContentBounds(rootSize); + root->setDrawsContent(true); + root->setMasksToBounds(true); + myHostImpl->setRootLayer(root.release()); + + addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr); + layerS1Ptr->setForceRenderSurface(true); + WebTransformationMatrix transform = layerS1Ptr->transform(); + transform.translate(200, 200); + transform.rotate(45); + transform.translate(-200, -200); + layerS1Ptr->setTransform(transform); + + addDrawingLayerTo(layerS1Ptr, 3, IntRect(200, 0, 200, 400), 0); // L11 + + // Initial draw - must receive all quads + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 2 render passes. + ASSERT_EQ(2U, frame.renderPasses.size()); + + EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); + EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // Change opacity and draw. Verify we used cached texture. + layerS1Ptr->setOpacity(0.2f); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // One render pass must be gone due to cached texture. + ASSERT_EQ(1U, frame.renderPasses.size()); + + EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } +} + +TEST_F(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) +{ + CCSettings::setPartialSwapEnabled(true); + + CCLayerTreeSettings settings; + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + + // Layers are structure as follows: + // + // R +-- S1 +- L10 (owning) + // | +- L11 + // | +- L12 + // | + // +-- S2 +- L20 (owning) + // +- L21 + // + // Occlusion: + // L12 occludes L11 (internal) + // L20 occludes L10 (external) + // L21 occludes L20 (internal) + + CCLayerImpl* rootPtr; + CCLayerImpl* layerS1Ptr; + CCLayerImpl* layerS2Ptr; + + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); + + IntSize rootSize(1000, 1000); + + myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height())); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + rootPtr = root.get(); + + root->setAnchorPoint(FloatPoint(0, 0)); + root->setPosition(FloatPoint(0, 0)); + root->setBounds(rootSize); + root->setContentBounds(rootSize); + root->setDrawsContent(true); + root->setMasksToBounds(true); + myHostImpl->setRootLayer(root.release()); + + addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr); + layerS1Ptr->setForceRenderSurface(true); + + addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11 + addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12 + + addDrawingLayerTo(rootPtr, 5, IntRect(550, 250, 300, 400), &layerS2Ptr); + layerS2Ptr->setForceRenderSurface(true); + + addDrawingLayerTo(layerS2Ptr, 6, IntRect(20, 20, 5, 5), 0); // L21 + + // Initial draw - must receive all quads + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 3 render passes. + // For Root, there are 2 quads; for S1, there are 3 quads; for S2, there is 1 quad. + ASSERT_EQ(3U, frame.renderPasses.size()); + + EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); + EXPECT_EQ(3U, frame.renderPasses[1]->quadList().size()); + EXPECT_EQ(2U, frame.renderPasses[2]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // "Unocclude" surface S1 and repeat draw. + // Must remove S2's render pass since it's cached; + // Must keep S1 quads because texture contained external occlusion. + WebTransformationMatrix transform = layerS2Ptr->transform(); + transform.translate(150, 150); + layerS2Ptr->setTransform(transform); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive 2 render passes. + // For Root, there are 2 quads + // For S1, the number of quads depends on what got unoccluded, so not asserted beyond being positive. + // For S2, there is no render pass + ASSERT_EQ(2U, frame.renderPasses.size()); + + EXPECT_GT(frame.renderPasses[0]->quadList().size(), 0U); + EXPECT_EQ(2U, frame.renderPasses[1]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // "Re-occlude" surface S1 and repeat draw. + // Must remove S1's render pass since it is now available in full. + // S2 has no change so must also be removed. + // FIXME: Due to partial swap, the scissor rect will cause OcclusionTracker + // to think there is an external occlusion in the previous step. Therefore, + // S1's render pass will not be removed. + transform = layerS2Ptr->transform(); + transform.translate(-15, -15); + layerS2Ptr->setTransform(transform); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // 2 Render passes - Root and S1. + ASSERT_EQ(2U, frame.renderPasses.size()); + + // Render pass for S1 contains no quads as the scissor rect is now occluded. + EXPECT_EQ(0U, frame.renderPasses[0]->quadList().size()); + + // Root contains S2 only, as S1 doesn't have any damage. + EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + +} + TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) { CCSettings::setPartialSwapEnabled(true); @@ -2969,9 +3568,9 @@ protected: class CCTestRenderer : public LayerRendererChromium, public CCRendererClient { public: - static PassOwnPtr<CCTestRenderer> create(WebKit::WebGraphicsContext3D* context) + static PassOwnPtr<CCTestRenderer> create(CCResourceProvider* resourceProvider) { - OwnPtr<CCTestRenderer> renderer(adoptPtr(new CCTestRenderer(context))); + OwnPtr<CCTestRenderer> renderer(adoptPtr(new CCTestRenderer(resourceProvider))); if (!renderer->initialize()) return nullptr; @@ -2993,7 +3592,7 @@ public: virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE { } protected: - CCTestRenderer(WebKit::WebGraphicsContext3D* context) : LayerRendererChromium(this, context, UnthrottledUploader) { } + CCTestRenderer(CCResourceProvider* resourceProvider) : LayerRendererChromium(this, resourceProvider, UnthrottledUploader) { } private: CCLayerTreeSettings m_settings; @@ -3017,7 +3616,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova renderer->clearCachedTextures(); // One shared state for all quads - we don't need the correct details - testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); + testData.sharedQuadState = CCSharedQuadState::create(0, WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); const char* currentChar = testScript; @@ -3276,9 +3875,10 @@ static void verifyRenderPassTestData(TestCase& testCase, RenderPassRemovalTestDa TEST_F(CCLayerTreeHostImplTest, testRemoveRenderPasses) { OwnPtr<CCGraphicsContext> context(createContext()); - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - ASSERT_TRUE(context3d); - OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(context3d)); + ASSERT_TRUE(context->context3D()); + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + + OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get())); int testCaseIndex = 0; while (removeRenderPassesCases[testCaseIndex].name) { diff --git a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp index 21e0a717c..97027095e 100644 --- a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp @@ -27,7 +27,9 @@ #include "cc/CCPrioritizedTexture.h" #include "CCTiledLayerTestCommon.h" +#include "FakeCCGraphicsContext.h" #include "cc/CCPrioritizedTextureManager.h" +#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include "cc/CCTexture.h" #include <gtest/gtest.h> @@ -42,11 +44,16 @@ public: CCPrioritizedTextureTest() : m_textureSize(256, 256) , m_textureFormat(GraphicsContext3D::RGBA) + , m_context(WebKit::createFakeCCGraphicsContext()) { + DebugScopedSetImplThread implThread; + m_resourceProvider = CCResourceProvider::create(m_context.get()); } virtual ~CCPrioritizedTextureTest() { + DebugScopedSetImplThread implThread; + m_resourceProvider.clear(); } size_t texturesMemorySize(size_t textureCount) @@ -56,11 +63,12 @@ public: PassOwnPtr<CCPrioritizedTextureManager> createManager(size_t maxTextures) { - return CCPrioritizedTextureManager::create(texturesMemorySize(maxTextures), 1024); + return CCPrioritizedTextureManager::create(texturesMemorySize(maxTextures), 1024, 0); } bool validateTexture(OwnPtr<CCPrioritizedTexture>& texture, bool requestLate) { + DebugScopedSetImplThread implThread; #if !ASSERT_DISABLED texture->textureManager()->assertInvariants(); #endif @@ -68,19 +76,20 @@ public: texture->requestLate(); bool success = texture->canAcquireBackingTexture(); if (success) - texture->acquireBackingTexture(allocator()); + texture->acquireBackingTexture(resourceProvider()); return success; } - FakeTextureAllocator* allocator() + CCResourceProvider* resourceProvider() { - return &m_fakeTextureAllocator; + return m_resourceProvider.get(); } protected: - FakeTextureAllocator m_fakeTextureAllocator; const IntSize m_textureSize; const GC3Denum m_textureFormat; + OwnPtr<CCGraphicsContext> m_context; + OwnPtr<CCResourceProvider> m_resourceProvider; }; TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) @@ -119,7 +128,8 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - textureManager->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); } TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) @@ -138,7 +148,10 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) validateTexture(textures[i], false); - textureManager->reduceMemory(allocator()); + { + DebugScopedSetImplThread implThread; + textureManager->reduceMemory(resourceProvider()); + } EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); @@ -148,7 +161,10 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 5); - textureManager->reduceMemory(allocator()); + { + DebugScopedSetImplThread implThread; + textureManager->reduceMemory(resourceProvider()); + } EXPECT_EQ(texturesMemorySize(5), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); @@ -158,12 +174,16 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 4); - textureManager->reduceMemory(allocator()); + { + DebugScopedSetImplThread implThread; + textureManager->reduceMemory(resourceProvider()); + } EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - textureManager->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); } TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) @@ -222,7 +242,8 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) EXPECT_FALSE(textures[2]->haveBackingTexture()); EXPECT_FALSE(textures[3]->haveBackingTexture()); - textureManager->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); } TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) @@ -261,7 +282,8 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - textureManager->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); } TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) @@ -279,7 +301,10 @@ TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_TRUE(texture->canAcquireBackingTexture()); EXPECT_TRUE(texture->haveBackingTexture()); - textureManager->clearAllMemory(allocator()); + { + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); + } textureManager.clear(); EXPECT_FALSE(texture->canAcquireBackingTexture()); @@ -304,7 +329,10 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) texture->setTextureManager(0); - textureManagerOne->clearAllMemory(allocator()); + { + DebugScopedSetImplThread implThread; + textureManagerOne->clearAllMemory(resourceProvider()); + } textureManagerOne.clear(); EXPECT_FALSE(texture->canAcquireBackingTexture()); @@ -318,7 +346,8 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) EXPECT_TRUE(texture->canAcquireBackingTexture()); EXPECT_TRUE(texture->haveBackingTexture()); - textureManagerTwo->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManagerTwo->clearAllMemory(resourceProvider()); } TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSurface) @@ -363,7 +392,8 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - textureManager->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); } TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate) @@ -399,7 +429,8 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - textureManager->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); } TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvailable) @@ -438,7 +469,8 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - textureManager->clearAllMemory(allocator()); + DebugScopedSetImplThread implThread; + textureManager->clearAllMemory(resourceProvider()); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index e1d9fb367..526ab4e59 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -75,11 +75,11 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We layer->setBounds(layerRect.size()); layer->setContentBounds(layerRect.size()); - int textureId = 1; + CCResourceProvider::ResourceId resourceId = 1; for (int i = 0; i < tiler->numTilesX(); ++i) for (int j = 0; j < tiler->numTilesY(); ++j) { IntRect tileOpaqueRect = opaque ? tiler->tileBounds(i, j) : intersection(tiler->tileBounds(i, j), layerOpaqueRect); - layer->pushTileProperties(i, j, static_cast<Platform3DObject>(textureId++), tileOpaqueRect); + layer->pushTileProperties(i, j, resourceId++, tileOpaqueRect); } if (!parent) { @@ -97,8 +97,8 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> >& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker) { occlusionTracker.enterLayer(it); - CCQuadCuller quadCuller(quadList, layer, &occlusionTracker, false); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + CCQuadCuller quadCuller(quadList, layer, &occlusionTracker, false, false); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); sharedStateList.append(sharedQuadState.release()); @@ -121,8 +121,8 @@ TEST(CCQuadCullerTest, verifyNoCulling) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -138,8 +138,8 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -172,8 +172,8 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -191,8 +191,8 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -234,8 +234,8 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) rootRect = childRect = IntRect(0, 0, 100, 100); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -262,8 +262,8 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) rootRect = childRect = IntRect(0, 0, 100, 100); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -282,8 +282,8 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) childTransform.translate(100, 100); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -301,9 +301,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegion) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -321,9 +321,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2) childTransform.translate(50, 10); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -341,9 +341,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) childTransform.translate(50, 49); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -362,8 +362,8 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) // Use a small rotation so as to not disturb the geometry significantly. childTransform.rotate(1); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -388,8 +388,8 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) WebTransformationMatrix parentTransform; parentTransform.rotate(1); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -405,8 +405,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -422,8 +422,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -439,8 +439,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -456,8 +456,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -473,8 +473,8 @@ TEST(CCQuadCullerTest, verifyWithoutMetrics) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index e9e041749..a989cd602 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -112,7 +112,7 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) renderSurface->setScissorRect(clipRect); renderSurface->setDrawOpacity(1); - OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState(0); EXPECT_EQ(30, sharedQuadState->quadTransform.m41()); EXPECT_EQ(40, sharedQuadState->quadTransform.m42()); diff --git a/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp b/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp new file mode 100644 index 000000000..57165e6ca --- /dev/null +++ b/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp @@ -0,0 +1,306 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "cc/CCResourceProvider.h" + +#include "CompositorFakeWebGraphicsContext3D.h" +#include "Extensions3DChromium.h" +#include "cc/CCGraphicsContext.h" +#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread +#include <gtest/gtest.h> +#include <public/WebGraphicsContext3D.h> +#include <wtf/HashMap.h> +#include <wtf/OwnArrayPtr.h> +#include <wtf/OwnPtr.h> + +using namespace WebCore; +using namespace WebKit; + +namespace { + +class ResourceProviderContext : public CompositorFakeWebGraphicsContext3D { +public: + static PassOwnPtr<ResourceProviderContext> create() { return adoptPtr(new ResourceProviderContext(Attributes())); } + + virtual void bindTexture(WGC3Denum target, WebGLId texture) + { + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(!texture || m_textures.find(texture) != m_textures.end()); + m_currentTexture = texture; + } + + virtual WebGLId createTexture() + { + WebGLId id = CompositorFakeWebGraphicsContext3D::createTexture(); + m_textures.add(id, nullptr); + return id; + } + + virtual void deleteTexture(WebGLId id) + { + TextureMap::iterator it = m_textures.find(id); + ASSERT(it != m_textures.end()); + m_textures.remove(it); + if (m_currentTexture == id) + m_currentTexture = 0; + } + + virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, + WGC3Dint width, WGC3Dint height) + { + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(levels == 1); + WGC3Denum format = GraphicsContext3D::RGBA; + switch (internalformat) { + case Extensions3D::RGBA8_OES: + break; + case Extensions3DChromium::BGRA8_EXT: + format = Extensions3D::BGRA_EXT; + break; + default: + ASSERT_NOT_REACHED(); + } + allocateTexture(IntSize(width, height), format); + } + + virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) + { + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(!level); + ASSERT(internalformat == format); + ASSERT(!border); + ASSERT(type == GraphicsContext3D::UNSIGNED_BYTE); + allocateTexture(IntSize(width, height), format); + if (pixels) + setPixels(0, 0, width, height, pixels); + } + + virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) + { + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(!level); + ASSERT(m_textures.get(m_currentTexture)); + ASSERT(m_textures.get(m_currentTexture)->format == format); + ASSERT(type == GraphicsContext3D::UNSIGNED_BYTE); + ASSERT(pixels); + setPixels(xoffset, yoffset, width, height, pixels); + } + + void getPixels(const IntSize& size, WGC3Denum format, uint8_t* pixels) + { + ASSERT(m_currentTexture); + Texture* texture = m_textures.get(m_currentTexture); + ASSERT(texture); + ASSERT(texture->size == size); + ASSERT(texture->format == format); + memcpy(pixels, texture->data.get(), textureSize(size, format)); + } + + int textureCount() + { + return m_textures.size(); + } + + static size_t textureSize(const IntSize& size, WGC3Denum format) + { + unsigned int componentsPerPixel = 4; + unsigned int bytesPerComponent = 1; + GraphicsContext3D::computeFormatAndTypeParameters(format, GraphicsContext3D::UNSIGNED_BYTE, &componentsPerPixel, &bytesPerComponent); + return size.width() * size.height() * componentsPerPixel * bytesPerComponent; + } + +protected: + explicit ResourceProviderContext(const Attributes& attrs) + : CompositorFakeWebGraphicsContext3D(attrs) + , m_currentTexture(0) + { } + +private: + struct Texture { + Texture(const IntSize& size_, WGC3Denum format_) + : size(size_) + , format(format_) + , data(adoptArrayPtr(new uint8_t[textureSize(size, format)])) + { + } + + IntSize size; + WGC3Denum format; + OwnArrayPtr<uint8_t> data; + }; + + void allocateTexture(const IntSize& size, WGC3Denum format) + { + ASSERT(m_currentTexture); + m_textures.set(m_currentTexture, adoptPtr(new Texture(size, format))); + } + + void setPixels(int xoffset, int yoffset, int width, int height, const void* pixels) + { + ASSERT(m_currentTexture); + Texture* texture = m_textures.get(m_currentTexture); + ASSERT(texture); + ASSERT(xoffset >= 0 && xoffset+width <= texture->size.width()); + ASSERT(yoffset >= 0 && yoffset+height <= texture->size.height()); + ASSERT(pixels); + size_t inPitch = textureSize(IntSize(width, 1), texture->format); + size_t outPitch = textureSize(IntSize(texture->size.width(), 1), texture->format); + uint8_t* dest = texture->data.get() + yoffset * outPitch + textureSize(IntSize(xoffset, 1), texture->format); + const uint8_t* src = static_cast<const uint8_t*>(pixels); + for (int i = 0; i < height; ++i) { + memcpy(dest, src, inPitch); + dest += outPitch; + src += inPitch; + } + } + + typedef HashMap<WebGLId, OwnPtr<Texture> > TextureMap; + WebGLId m_currentTexture; + TextureMap m_textures; +}; + +class CCResourceProviderTest : public testing::Test { +public: + CCResourceProviderTest() + : m_context(CCGraphicsContext::create3D(ResourceProviderContext::create())) + , m_resourceProvider(CCResourceProvider::create(m_context.get())) + { + } + + ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_context->context3D()); } + + void getResourcePixels(CCResourceProvider::ResourceId id, const IntSize& size, WGC3Denum format, uint8_t* pixels) + { + CCScopedLockResourceForRead lock(m_resourceProvider.get(), id); + ASSERT_NE(0U, lock.textureId()); + context()->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()); + context()->getPixels(size, format, pixels); + } + +protected: + DebugScopedSetImplThread implThread; + OwnPtr<CCGraphicsContext> m_context; + OwnPtr<CCResourceProvider> m_resourceProvider; +}; + +TEST_F(CCResourceProviderTest, Basic) +{ + IntSize size(1, 1); + WGC3Denum format = GraphicsContext3D::RGBA; + int pool = 1; + size_t pixelSize = ResourceProviderContext::textureSize(size, format); + ASSERT_EQ(4U, pixelSize); + + CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + EXPECT_EQ(1, context()->textureCount()); + + uint8_t data[4] = {1, 2, 3, 4}; + IntRect rect(IntPoint(), size); + m_resourceProvider->upload(id, data, rect, rect, rect); + + uint8_t result[4] = {0}; + getResourcePixels(id, size, format, result); + EXPECT_EQ(0, memcmp(data, result, pixelSize)); + + m_resourceProvider->deleteResource(id); + EXPECT_EQ(0, context()->textureCount()); +} + +TEST_F(CCResourceProviderTest, DeleteOwnedResources) +{ + IntSize size(1, 1); + WGC3Denum format = GraphicsContext3D::RGBA; + int pool = 1; + + const int count = 3; + CCResourceProvider::ResourceId ids[count] = {0}; + for (int i = 0; i < count; ++i) + ids[i] = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + EXPECT_EQ(3, context()->textureCount()); + + m_resourceProvider->deleteOwnedResources(pool+1); + EXPECT_EQ(3, context()->textureCount()); + + m_resourceProvider->deleteOwnedResources(pool); + EXPECT_EQ(0, context()->textureCount()); +} + +TEST_F(CCResourceProviderTest, Upload) +{ + IntSize size(2, 2); + WGC3Denum format = GraphicsContext3D::RGBA; + int pool = 1; + size_t pixelSize = ResourceProviderContext::textureSize(size, format); + ASSERT_EQ(16U, pixelSize); + + CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + + uint8_t image[16] = {0}; + IntRect imageRect(IntPoint(), size); + m_resourceProvider->upload(id, image, imageRect, imageRect, imageRect); + + for (uint8_t i = 0 ; i < pixelSize; ++i) + image[i] = i; + + uint8_t result[16] = {0}; + { + IntRect sourceRect(0, 0, 1, 1); + IntRect destRect(0, 0, 1, 1); + m_resourceProvider->upload(id, image, imageRect, sourceRect, destRect); + + uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0}; + getResourcePixels(id, size, format, result); + EXPECT_EQ(0, memcmp(expected, result, pixelSize)); + } + { + IntRect sourceRect(0, 0, 1, 1); + IntRect destRect(1, 1, 1, 1); + m_resourceProvider->upload(id, image, imageRect, sourceRect, destRect); + + uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 3}; + getResourcePixels(id, size, format, result); + EXPECT_EQ(0, memcmp(expected, result, pixelSize)); + } + { + IntRect sourceRect(1, 0, 1, 1); + IntRect destRect(0, 1, 1, 1); + m_resourceProvider->upload(id, image, imageRect, sourceRect, destRect); + + uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0, + 4, 5, 6, 7, 0, 1, 2, 3}; + getResourcePixels(id, size, format, result); + EXPECT_EQ(0, memcmp(expected, result, pixelSize)); + } + + m_resourceProvider->deleteResource(id); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp b/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp index 4d464ea51..505ae9625 100644 --- a/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp @@ -27,7 +27,10 @@ #include "cc/CCScopedTexture.h" #include "CCTiledLayerTestCommon.h" +#include "FakeCCGraphicsContext.h" #include "GraphicsContext3D.h" +#include "cc/CCRenderer.h" +#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include <gtest/gtest.h> @@ -39,8 +42,10 @@ namespace { TEST(CCScopedTextureTest, NewScopedTexture) { - FakeTextureAllocator allocator; - OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(&allocator); + OwnPtr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + DebugScopedSetImplThread implThread; + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); // New scoped textures do not hold a texture yet. EXPECT_EQ(0u, texture->id()); @@ -52,9 +57,11 @@ TEST(CCScopedTextureTest, NewScopedTexture) TEST(CCScopedTextureTest, CreateScopedTexture) { - FakeTextureAllocator allocator; - OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(&allocator); - texture->allocate(IntSize(30, 30), GraphicsContext3D::RGBA); + OwnPtr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + DebugScopedSetImplThread implThread; + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); // The texture has an allocated byte-size now. size_t expectedBytes = 30 * 30 * 4; @@ -65,95 +72,58 @@ TEST(CCScopedTextureTest, CreateScopedTexture) EXPECT_EQ(IntSize(30, 30), texture->size()); } -// Fake TextureAllocator that tracks the number of textures in use. -class TrackingTextureAllocator : public TextureAllocator { -public: - TrackingTextureAllocator() - : m_nextTextureId(1) - , m_numTextures(0) - { } - - virtual unsigned createTexture(const WebCore::IntSize&, GC3Denum) OVERRIDE - { - unsigned id = m_nextTextureId; - ++m_nextTextureId; - - m_textures.set(id, true); - ++m_numTextures; - return id; - } - - virtual void deleteTexture(unsigned id, const WebCore::IntSize&, GC3Denum) OVERRIDE - { - if (!m_textures.get(id)) - return; - - m_textures.set(id, false); - --m_numTextures; - } - - virtual void deleteAllTextures() OVERRIDE - { - m_textures.clear(); - m_numTextures = 0; - } - - unsigned numTextures() const { return m_numTextures; } - -private: - unsigned m_nextTextureId; - HashMap<unsigned, bool> m_textures; - unsigned m_numTextures; -}; - TEST(CCScopedTextureTest, ScopedTextureIsDeleted) { - TrackingTextureAllocator allocator; + OwnPtr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + DebugScopedSetImplThread implThread; + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); { - OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(&allocator); + OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); - EXPECT_EQ(0u, allocator.numTextures()); - texture->allocate(IntSize(30, 30), GraphicsContext3D::RGBA); + EXPECT_EQ(0u, resourceProvider->numResources()); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); - EXPECT_EQ(1u, allocator.numTextures()); + EXPECT_EQ(1u, resourceProvider->numResources()); } - EXPECT_EQ(0u, allocator.numTextures()); + EXPECT_EQ(0u, resourceProvider->numResources()); { - OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(&allocator); - EXPECT_EQ(0u, allocator.numTextures()); - texture->allocate(IntSize(30, 30), GraphicsContext3D::RGBA); + OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); + EXPECT_EQ(0u, resourceProvider->numResources()); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); - EXPECT_EQ(1u, allocator.numTextures()); + EXPECT_EQ(1u, resourceProvider->numResources()); texture->free(); - EXPECT_EQ(0u, allocator.numTextures()); + EXPECT_EQ(0u, resourceProvider->numResources()); } } TEST(CCScopedTextureTest, LeakScopedTexture) { - TrackingTextureAllocator allocator; + OwnPtr<CCGraphicsContext> context(createFakeCCGraphicsContext()); + DebugScopedSetImplThread implThread; + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); { - OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(&allocator); + OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); - EXPECT_EQ(0u, allocator.numTextures()); - texture->allocate(IntSize(30, 30), GraphicsContext3D::RGBA); + EXPECT_EQ(0u, resourceProvider->numResources()); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); - EXPECT_EQ(1u, allocator.numTextures()); + EXPECT_EQ(1u, resourceProvider->numResources()); texture->leak(); EXPECT_EQ(0u, texture->id()); - EXPECT_EQ(1u, allocator.numTextures()); + EXPECT_EQ(1u, resourceProvider->numResources()); texture->free(); EXPECT_EQ(0u, texture->id()); - EXPECT_EQ(1u, allocator.numTextures()); + EXPECT_EQ(1u, resourceProvider->numResources()); } - EXPECT_EQ(1u, allocator.numTextures()); + EXPECT_EQ(1u, resourceProvider->numResources()); } } diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index f9a9292b7..1754a5b12 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -52,7 +52,7 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) layer->setBounds(layerSize); layer->setContentBounds(layerSize); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); @@ -75,7 +75,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) layer->setContentBounds(layerSize); layer->setBackgroundColor(testColor); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); @@ -99,7 +99,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) layer->setContentBounds(layerSize); layer->setDrawOpacity(opacity); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); diff --git a/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp index d0bbd36f4..b7a26df2f 100644 --- a/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp +++ b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp @@ -30,6 +30,7 @@ #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "WebCompositor.h" +#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include "platform/WebThread.h" #include <gtest/gtest.h> @@ -63,13 +64,12 @@ class TextureUploaderForUploadTest : public FakeTextureUploader { public: TextureUploaderForUploadTest(CCTextureUpdaterTest *test) : m_test(test) { } - virtual void beginUploads(); - virtual void endUploads(); - virtual void uploadTexture(WebCore::CCGraphicsContext*, - WebCore::LayerTextureUpdater::Texture*, - WebCore::TextureAllocator*, + virtual void beginUploads() OVERRIDE; + virtual void endUploads() OVERRIDE; + virtual void uploadTexture(WebCore::LayerTextureUpdater::Texture*, + WebCore::CCResourceProvider*, const WebCore::IntRect sourceRect, - const WebCore::IntRect destRect); + const WebCore::IntRect destRect) OVERRIDE; private: CCTextureUpdaterTest* m_test; @@ -79,7 +79,7 @@ private: class TextureForUploadTest : public LayerTextureUpdater::Texture { public: TextureForUploadTest() : LayerTextureUpdater::Texture(adoptPtr<CCPrioritizedTexture>(0)) { } - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) { } + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) { } }; @@ -165,6 +165,8 @@ protected: m_context = CCGraphicsContext::create3D( adoptPtr(new WebGraphicsContext3DForUploadTest(this))); + DebugScopedSetImplThread implThread; + m_resourceProvider = CCResourceProvider::create(m_context.get()); } virtual void TearDown() @@ -200,9 +202,9 @@ protected: protected: // Classes required to interact and test the CCTextureUpdater OwnPtr<CCGraphicsContext> m_context; + OwnPtr<CCResourceProvider> m_resourceProvider; CCTextureUpdater m_updater; TextureForUploadTest m_texture; - FakeTextureAllocator m_allocator; FakeTextureCopier m_copier; TextureUploaderForUploadTest m_uploader; @@ -239,11 +241,10 @@ void TextureUploaderForUploadTest::endUploads() m_test->onEndUploads(); } -void TextureUploaderForUploadTest::uploadTexture(WebCore::CCGraphicsContext* context, - WebCore::LayerTextureUpdater::Texture* texture, - WebCore::TextureAllocator* allocator, - const WebCore::IntRect sourceRect, - const WebCore::IntRect destRect) +void TextureUploaderForUploadTest::uploadTexture(WebCore::LayerTextureUpdater::Texture* texture, + WebCore::CCResourceProvider*, + const WebCore::IntRect sourceRect, + const WebCore::IntRect destRect) { m_test->onUpload(); } @@ -254,7 +255,7 @@ TEST_F(CCTextureUpdaterTest, ZeroUploads) { appendFullUploadsToUpdater(0); appendPartialUploadsToUpdater(0); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(0, m_numBeginUploads); EXPECT_EQ(0, m_numEndUploads); @@ -268,7 +269,8 @@ TEST_F(CCTextureUpdaterTest, OneFullUpload) { appendFullUploadsToUpdater(1); appendPartialUploadsToUpdater(0); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -280,7 +282,8 @@ TEST_F(CCTextureUpdaterTest, OnePartialUpload) { appendFullUploadsToUpdater(0); appendPartialUploadsToUpdater(1); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -292,7 +295,8 @@ TEST_F(CCTextureUpdaterTest, OneFullOnePartialUpload) { appendFullUploadsToUpdater(1); appendPartialUploadsToUpdater(1); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); // We expect the full uploads to be followed by a flush // before the partial uploads begin. @@ -315,7 +319,8 @@ TEST_F(CCTextureUpdaterTest, ManyFullUploadsNoRemainder) { appendFullUploadsToUpdater(fullNoRemainderCount); appendPartialUploadsToUpdater(0); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -327,7 +332,8 @@ TEST_F(CCTextureUpdaterTest, ManyPartialUploadsNoRemainder) { appendFullUploadsToUpdater(0); appendPartialUploadsToUpdater(partialNoRemainderCount); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -339,7 +345,8 @@ TEST_F(CCTextureUpdaterTest, ManyFullManyPartialUploadsNoRemainder) { appendFullUploadsToUpdater(fullNoRemainderCount); appendPartialUploadsToUpdater(partialNoRemainderCount); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -361,7 +368,8 @@ TEST_F(CCTextureUpdaterTest, ManyFullAndPartialMinRemainder) { appendFullUploadsToUpdater(fullMinRemainderCount); appendPartialUploadsToUpdater(partialMinRemainderCount); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -373,7 +381,8 @@ TEST_F(CCTextureUpdaterTest, ManyFullAndPartialUploadsMaxRemainder) { appendFullUploadsToUpdater(fullMaxRemainderCount); appendPartialUploadsToUpdater(partialMaxRemainderCount); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -385,7 +394,8 @@ TEST_F(CCTextureUpdaterTest, ManyFullMinRemainderManyPartialMaxRemainder) { appendFullUploadsToUpdater(fullMinRemainderCount); appendPartialUploadsToUpdater(partialMaxRemainderCount); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -397,7 +407,8 @@ TEST_F(CCTextureUpdaterTest, ManyFullMaxRemainderManyPartialMinRemainder) { appendFullUploadsToUpdater(fullMaxRemainderCount); appendPartialUploadsToUpdater(partialMinRemainderCount); - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, m_totalUploadCountExpected); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -429,7 +440,8 @@ TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateFullAndPartial) appendPartialUploadsToUpdater(kPartialUploads); // First update (40 full) - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, kMaxUploadsPerUpdate); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -441,7 +453,7 @@ TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateFullAndPartial) EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); // Second update (40 full) - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, kMaxUploadsPerUpdate); EXPECT_EQ(2, m_numBeginUploads); EXPECT_EQ(2, m_numEndUploads); @@ -453,7 +465,7 @@ TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateFullAndPartial) EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); // Third update (20 full, 20 partial) - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, kMaxUploadsPerUpdate); EXPECT_EQ(3, m_numBeginUploads); EXPECT_EQ(3, m_numEndUploads); @@ -483,7 +495,8 @@ TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateAllPartial) appendPartialUploadsToUpdater(kPartialUploads); // First update (40 full) - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + DebugScopedSetImplThread implThread; + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, kMaxUploadsPerUpdate); EXPECT_EQ(1, m_numBeginUploads); EXPECT_EQ(1, m_numEndUploads); @@ -495,7 +508,7 @@ TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateAllPartial) EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); // Second update (30 full, optionally 10 partial) - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, kMaxUploadsPerUpdate); EXPECT_EQ(2, m_numBeginUploads); EXPECT_EQ(2, m_numEndUploads); @@ -505,7 +518,7 @@ TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateAllPartial) // onFlush(), onUpload(), and onEndUpload() will do basic flush checks for us anyway. // Third update (30 partial OR 20 partial if 10 partial uploaded in second update) - m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, kMaxUploadsPerUpdate); EXPECT_EQ(3, m_numBeginUploads); EXPECT_EQ(3, m_numEndUploads); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index 00d38a7ec..a0850b251 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -53,10 +53,10 @@ static PassOwnPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I layer->setBounds(layerSize); layer->setContentBounds(layerSize); - int textureId = 1; + CCResourceProvider::ResourceId resourceId = 1; for (int i = 0; i < tiler->numTilesX(); ++i) for (int j = 0; j < tiler->numTilesY(); ++j) - layer->pushTileProperties(i, j, static_cast<Platform3DObject>(textureId++), IntRect(0, 0, 1, 1)); + layer->pushTileProperties(i, j, resourceId++, IntRect(0, 0, 1, 1)); return layer.release(); } @@ -74,7 +74,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); const unsigned numTiles = numTilesX * numTilesY; @@ -87,7 +87,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setVisibleContentRect(IntRect()); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 0u); @@ -101,7 +101,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setVisibleContentRect(outsideBounds); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 0u); @@ -113,7 +113,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setSkipsDraw(true); MockCCQuadCuller quadCuller; - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 0u); @@ -130,7 +130,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY); OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); // No checkerboarding { @@ -146,7 +146,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) for (int i = 0; i < numTilesX; ++i) for (int j = 0; j < numTilesY; ++j) - layer->pushTileProperties(i, j, static_cast<Platform3DObject>(0), IntRect()); + layer->pushTileProperties(i, j, 0, IntRect()); // All checkerboarding { @@ -167,7 +167,7 @@ static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSiz layer->setBounds(layerSize); MockCCQuadCuller quadCuller(quads); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(0); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); return sharedQuadState.release(); // The shared data must be owned as long as the quad list exists. @@ -240,7 +240,7 @@ TEST(CCTiledLayerImplTest, textureInfoForLayerNoBorders) ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; CCTileDrawQuad* quad = static_cast<CCTileDrawQuad*>(quads[i].get()); - EXPECT_NE(quad->textureId(), 0u) << quadString << i; + EXPECT_NE(quad->resourceId(), 0u) << quadString << i; EXPECT_EQ(quad->textureOffset(), IntPoint()) << quadString << i; EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i; EXPECT_EQ(IntRect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 26ffd9079..7778549b6 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -40,10 +40,9 @@ FakeLayerTextureUpdater::Texture::~Texture() { } -void FakeLayerTextureUpdater::Texture::updateRect(CCGraphicsContext*, TextureAllocator* allocator, const IntRect&, const IntRect&) +void FakeLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect&, const IntRect&) { - if (allocator) - texture()->acquireBackingTexture(allocator); + texture()->acquireBackingTexture(resourceProvider); m_layer->updateRect(); } diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index 9501caba9..be681d71c 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -29,12 +29,12 @@ #include "IntSize.h" #include "LayerTextureUpdater.h" #include "Region.h" -#include "TextureAllocator.h" #include "TextureCopier.h" #include "TextureUploader.h" #include "TiledLayerChromium.h" #include "cc/CCGraphicsContext.h" #include "cc/CCPrioritizedTexture.h" +#include "cc/CCResourceProvider.h" #include "cc/CCTextureUpdater.h" #include "cc/CCTiledLayerImpl.h" @@ -49,7 +49,7 @@ public: Texture(FakeLayerTextureUpdater*, PassOwnPtr<WebCore::CCPrioritizedTexture>); virtual ~Texture(); - virtual void updateRect(WebCore::CCGraphicsContext*, WebCore::TextureAllocator* , const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE; + virtual void updateRect(WebCore::CCResourceProvider* , const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE; virtual void prepareRect(const WebCore::IntRect&) OVERRIDE; private: @@ -151,17 +151,10 @@ protected: WebCore::IntSize m_forcedContentBounds; }; -class FakeTextureAllocator : public WebCore::TextureAllocator { -public: - virtual unsigned createTexture(const WebCore::IntSize&, GC3Denum) OVERRIDE { return 1; } - virtual void deleteTexture(unsigned, const WebCore::IntSize&, GC3Denum) OVERRIDE { } - virtual void deleteAllTextures() OVERRIDE { } -}; - class FakeTextureCopier : public WebCore::TextureCopier { public: - virtual void copyTexture(WebCore::CCGraphicsContext*, unsigned, unsigned, const WebCore::IntSize&) { } - virtual void copyToTexture(WebCore::CCGraphicsContext*, const void*, unsigned, const WebCore::IntSize&, GC3Denum) { } + virtual void copyTexture(unsigned, unsigned, const WebCore::IntSize&) { } + virtual void flush() { } }; class FakeTextureUploader : public WebCore::TextureUploader { @@ -169,7 +162,7 @@ public: virtual bool isBusy() { return false; } virtual void beginUploads() { } virtual void endUploads() { } - virtual void uploadTexture(WebCore::CCGraphicsContext* context, WebCore::LayerTextureUpdater::Texture* texture, WebCore::TextureAllocator* allocator, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); } + virtual void uploadTexture(WebCore::LayerTextureUpdater::Texture* texture, WebCore::CCResourceProvider* resourceProvider, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(resourceProvider, sourceRect, destRect); } }; } diff --git a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp index 750418535..fcfcce114 100644 --- a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp @@ -99,7 +99,7 @@ TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale) OpaqueRectDrawingGraphicsContextPainter painter(opaqueRectInLayerSpace, contentRect); OpaqueRectTrackingContentLayerDelegate opaqueRectTrackingContentLayerDelegate(&painter); MockContentLayerDelegate delegate(&opaqueRectTrackingContentLayerDelegate); - RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&delegate), false); + RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&delegate)); IntRect resultingOpaqueRect; updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect); diff --git a/Source/WebKit/chromium/tests/DragImageTest.cpp b/Source/WebKit/chromium/tests/DragImageTest.cpp index 080607cd7..f75e85c6f 100644 --- a/Source/WebKit/chromium/tests/DragImageTest.cpp +++ b/Source/WebKit/chromium/tests/DragImageTest.cpp @@ -139,8 +139,8 @@ TEST(DragImageTest, CreateDragImage) RefPtr<TestImage> testImage(TestImage::create(IntSize(1, 1))); DragImageRef dragImage = createDragImageFromImage(testImage.get()); ASSERT_TRUE(dragImage); - SkAutoLockPixels lock1(*dragImage), lock2(testImage->nativeImageForCurrentFrame()->bitmap()); - EXPECT_NE(dragImage->getPixels(), testImage->nativeImageForCurrentFrame()->bitmap().getPixels()); + SkAutoLockPixels lock1(*dragImage->bitmap), lock2(testImage->nativeImageForCurrentFrame()->bitmap()); + EXPECT_NE(dragImage->bitmap->getPixels(), testImage->nativeImageForCurrentFrame()->bitmap().getPixels()); } } diff --git a/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h b/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h new file mode 100644 index 000000000..beb4ef366 --- /dev/null +++ b/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FakeCCGraphicsContext_h +#define FakeCCGraphicsContext_h + +#include "CompositorFakeWebGraphicsContext3D.h" +#include "cc/CCGraphicsContext.h" + +namespace WebKit { + +static inline PassOwnPtr<WebCore::CCGraphicsContext> createFakeCCGraphicsContext() +{ + return WebCore::CCGraphicsContext::create3D(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes())); +} + +} // namespace WebKit + +#endif // FakeCCGraphicsContext_h diff --git a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp index 4fb15d1eb..91aeb7ca5 100644 --- a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp @@ -28,6 +28,7 @@ #include "CCAnimationTestCommon.h" #include "CompositorFakeWebGraphicsContext3D.h" +#include "FakeCCLayerTreeHostClient.h" #include "GraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "GraphicsLayer.h" @@ -61,31 +62,12 @@ class MockGraphicsLayerClient : public GraphicsLayerClient { virtual float deviceScaleFactor() const OVERRIDE { return 2; } }; -class MockLayerTreeHostClient : public CCLayerTreeHostClient { -public: - virtual void willBeginFrame() OVERRIDE { } - virtual void didBeginFrame() OVERRIDE { } - virtual void updateAnimations(double frameBeginTime) OVERRIDE { } - virtual void layout() OVERRIDE { } - virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { } - virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE - { - return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()); - } - virtual void didRecreateContext(bool success) OVERRIDE { } - virtual void willCommit() OVERRIDE { } - virtual void didCommit() OVERRIDE { } - virtual void didCommitAndDrawFrame() OVERRIDE { } - virtual void didCompleteSwapBuffers() OVERRIDE { } - virtual void scheduleComposite() OVERRIDE { } -}; - class MockLayerTreeHost : public CCLayerTreeHost { public: static PassOwnPtr<MockLayerTreeHost> create() { CCLayerTreeSettings settings; - OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(new MockLayerTreeHostClient(), settings))); + OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(new FakeCCLayerTreeHostClient(), settings))); bool success = layerTreeHost->initialize(); EXPECT_TRUE(success); layerTreeHost->setRootLayer(LayerChromium::create()); diff --git a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp index a34b436bd..137699c30 100644 --- a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp +++ b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp @@ -630,7 +630,7 @@ TEST(IDBLevelDBCodingTest, ComparisonTest) keys.append(DatabaseNameKey::encode("", "")); keys.append(DatabaseNameKey::encode("", "a")); keys.append(DatabaseNameKey::encode("a", "a")); - keys.append(DatabaseMetaDataKey::encode(1, DatabaseMetaDataKey::kOriginName)); + keys.append(DatabaseMetaDataKey::encode(1, DatabaseMetaDataKey::OriginName)); keys.append(ObjectStoreMetaDataKey::encode(1, 1, 0)); keys.append(ObjectStoreMetaDataKey::encode(1, 1, 1)); keys.append(ObjectStoreMetaDataKey::encodeMaxKey(1, 1)); @@ -645,9 +645,9 @@ TEST(IDBLevelDBCodingTest, ComparisonTest) keys.append(IndexMetaDataKey::encodeMaxKey(1, 2)); keys.append(ObjectStoreFreeListKey::encode(1, 1)); keys.append(ObjectStoreFreeListKey::encodeMaxKey(1)); - keys.append(IndexFreeListKey::encode(1, 1, kMinimumIndexId)); + keys.append(IndexFreeListKey::encode(1, 1, MinimumIndexId)); keys.append(IndexFreeListKey::encodeMaxKey(1, 1)); - keys.append(IndexFreeListKey::encode(1, 2, kMinimumIndexId)); + keys.append(IndexFreeListKey::encode(1, 2, MinimumIndexId)); keys.append(IndexFreeListKey::encodeMaxKey(1, 2)); keys.append(ObjectStoreNamesKey::encode(1, "")); keys.append(ObjectStoreNamesKey::encode(1, "a")); diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index a794a2846..004022b66 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -440,10 +440,10 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior) IntSize testBounds = IntSize(501, 508); - FloatRect dirty1 = FloatRect(10.0f, 15.0f, 1.0f, 2.0f); - FloatRect dirty2 = FloatRect(20.0f, 25.0f, 3.0f, 4.0f); - FloatRect emptyDirtyRect = FloatRect(40.0f, 45.0f, 0, 0); - FloatRect outOfBoundsDirtyRect = FloatRect(400.0f, 405.0f, 500.0f, 502.0f); + FloatRect dirty1 = FloatRect(10, 15, 1, 2); + FloatRect dirty2 = FloatRect(20, 25, 3, 4); + FloatRect emptyDirtyRect = FloatRect(40, 45, 0, 0); + FloatRect outOfBoundsDirtyRect = FloatRect(400, 405, 500, 502); // Before anything, testLayer should not be dirty. EXPECT_FALSE(testLayer->needsDisplay()); @@ -497,7 +497,7 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(IntRect(0, 0, 40, 50))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUsesLayerClipping(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setIsNonCompositedContent(true)); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5f)); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setClipRect(IntRect(3, 3, 8, 8))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setRenderTarget(0)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix())); @@ -512,9 +512,9 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(SK_ColorLTGRAY)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMasksToBounds(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMaskLayer(dummyLayer.get())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpacity(0.5f)); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpacity(0.5)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpaque(true)); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4.0f, 9.0f))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4, 9))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true)); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 7cdba809c..1b6b8028b 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -81,6 +81,7 @@ public: { m_rootLayer->createRenderSurface(); m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); + m_renderPasses.append(m_rootRenderPass.get()); } // CCRendererClient methods. @@ -96,6 +97,7 @@ public: int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; } CCRenderPass* rootRenderPass() { return m_rootRenderPass.get(); } + const CCRenderPassList& renderPasses() { return m_renderPasses; } size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; } @@ -104,12 +106,13 @@ private: DebugScopedSetImplThread m_implThread; OwnPtr<CCLayerImpl> m_rootLayer; OwnPtr<CCRenderPass> m_rootRenderPass; + CCRenderPassList m_renderPasses; size_t m_memoryAllocationLimitBytes; }; class FakeLayerRendererChromium : public LayerRendererChromium { public: - FakeLayerRendererChromium(CCRendererClient* client, WebGraphicsContext3D* context) : LayerRendererChromium(client, context, UnthrottledUploader) { } + FakeLayerRendererChromium(CCRendererClient* client, CCResourceProvider* resourceProvider) : LayerRendererChromium(client, resourceProvider, UnthrottledUploader) { } // LayerRendererChromium methods. @@ -123,8 +126,9 @@ protected: LayerRendererChromiumTest() : m_suggestHaveBackbufferYes(1, true) , m_suggestHaveBackbufferNo(1, false) - , m_context(adoptPtr(new FrameCountingMemoryAllocationSettingContext)) - , m_layerRendererChromium(&m_mockClient, m_context.get()) + , m_context(CCGraphicsContext::create3D(adoptPtr(new FrameCountingMemoryAllocationSettingContext()))) + , m_resourceProvider(CCResourceProvider::create(m_context.get())) + , m_layerRendererChromium(&m_mockClient, m_resourceProvider.get()) { } @@ -144,11 +148,14 @@ protected: m_layerRendererChromium.swapBuffers(IntRect()); } + FrameCountingMemoryAllocationSettingContext* context() { return static_cast<FrameCountingMemoryAllocationSettingContext*>(m_context->context3D()); } + WebGraphicsMemoryAllocation m_suggestHaveBackbufferYes; WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo; - OwnPtr<FrameCountingMemoryAllocationSettingContext> m_context; + OwnPtr<CCGraphicsContext> m_context; FakeCCRendererClient m_mockClient; + OwnPtr<CCResourceProvider> m_resourceProvider; FakeLayerRendererChromium m_layerRendererChromium; CCScopedSettings m_scopedSettings; }; @@ -158,12 +165,12 @@ protected: // Expected: it does nothing. TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) { - m_context->setMemoryAllocation(m_suggestHaveBackbufferYes); + context()->setMemoryAllocation(m_suggestHaveBackbufferYes); EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); swapBuffers(); - EXPECT_EQ(1, m_context->frameCount()); + EXPECT_EQ(1, context()->frameCount()); } // Test LayerRendererChromium discardFramebuffer functionality: @@ -172,7 +179,7 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldD TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible) { m_layerRendererChromium.setVisible(false); - m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); + context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); } @@ -183,7 +190,7 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndD TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoDoNothingWhenVisible) { m_layerRendererChromium.setVisible(true); - m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); + context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); } @@ -195,11 +202,11 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoDoNothingWhenVisible) TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing) { m_layerRendererChromium.setVisible(false); - m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); + context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); - m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); + context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); } @@ -210,27 +217,27 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNo TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration) { m_layerRendererChromium.setVisible(false); - m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); + context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); m_layerRendererChromium.setVisible(true); - m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootRenderPass()); + m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); swapBuffers(); - EXPECT_EQ(1, m_context->frameCount()); + EXPECT_EQ(1, context()->frameCount()); } TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisible) { m_layerRendererChromium.setVisible(false); - m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); + context()->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); char pixels[4]; - m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootRenderPass()); + m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); m_layerRendererChromium.getFramebufferPixels(pixels, IntRect(0, 0, 1, 1)); @@ -309,8 +316,9 @@ TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; - OwnPtr<WebGraphicsContext3D> context(adoptPtr(new ForbidSynchronousCallContext)); - FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); + OwnPtr<CCGraphicsContext> context(CCGraphicsContext::create3D(adoptPtr(new ForbidSynchronousCallContext))); + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); EXPECT_TRUE(layerRendererChromium.initialize()); } @@ -352,8 +360,9 @@ TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAsse { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; - OwnPtr<WebGraphicsContext3D> context(adoptPtr(new LoseContextOnFirstGetContext)); - FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); + OwnPtr<CCGraphicsContext> context(CCGraphicsContext::create3D(adoptPtr(new LoseContextOnFirstGetContext))); + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); layerRendererChromium.initialize(); } @@ -373,8 +382,9 @@ public: TEST(LayerRendererChromiumTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { FakeCCRendererClient mockClient; - OwnPtr<WebGraphicsContext3D> context(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions)); - FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); + OwnPtr<CCGraphicsContext> context(CCGraphicsContext::create3D(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions))); + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); + FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); layerRendererChromium.initialize(); @@ -399,15 +409,16 @@ private: TEST(LayerRendererChromiumTest2, opaqueBackground) { FakeCCRendererClient mockClient; - OwnPtr<ClearCountingContext> context(adoptPtr(new ClearCountingContext)); - FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); + OwnPtr<CCGraphicsContext> ccContext(CCGraphicsContext::create3D(adoptPtr(new ClearCountingContext))); + ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); + FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); mockClient.rootRenderPass()->setHasTransparentBackground(false); EXPECT_TRUE(layerRendererChromium.initialize()); - layerRendererChromium.beginDrawingFrame(mockClient.rootRenderPass()); - layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect()); + layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect()); layerRendererChromium.finishDrawingFrame(); // On DEBUG builds, render passes with opaque background clear to blue to @@ -422,15 +433,16 @@ TEST(LayerRendererChromiumTest2, opaqueBackground) TEST(LayerRendererChromiumTest2, transparentBackground) { FakeCCRendererClient mockClient; - OwnPtr<ClearCountingContext> context(adoptPtr(new ClearCountingContext)); - FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); + OwnPtr<CCGraphicsContext> ccContext(CCGraphicsContext::create3D(adoptPtr(new ClearCountingContext))); + ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); + OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); + FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); mockClient.rootRenderPass()->setHasTransparentBackground(true); EXPECT_TRUE(layerRendererChromium.initialize()); - layerRendererChromium.beginDrawingFrame(mockClient.rootRenderPass()); - layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect()); + layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect()); layerRendererChromium.finishDrawingFrame(); EXPECT_EQ(1, context->clearCount()); diff --git a/Source/WebKit/chromium/tests/MockCCQuadCuller.h b/Source/WebKit/chromium/tests/MockCCQuadCuller.h index 385507e2c..15cb19d6c 100644 --- a/Source/WebKit/chromium/tests/MockCCQuadCuller.h +++ b/Source/WebKit/chromium/tests/MockCCQuadCuller.h @@ -27,21 +27,19 @@ #include "IntRect.h" #include "cc/CCDrawQuad.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include <wtf/PassOwnPtr.h> namespace WebCore { -class MockCCQuadCuller : public WebCore::CCQuadCuller { +class MockCCQuadCuller : public WebCore::CCQuadSink { public: MockCCQuadCuller() - : CCQuadCuller(m_quadListStorage, 0, 0, false) - , m_activeQuadList(m_quadListStorage) + : m_activeQuadList(m_quadListStorage) { } explicit MockCCQuadCuller(CCQuadList& externalQuadList) - : CCQuadCuller(externalQuadList, 0, 0, false) - , m_activeQuadList(externalQuadList) + : m_activeQuadList(externalQuadList) { } virtual bool append(WTF::PassOwnPtr<WebCore::CCDrawQuad> newQuad) diff --git a/Source/WebKit/chromium/tests/TextureCopierTest.cpp b/Source/WebKit/chromium/tests/TextureCopierTest.cpp index b3ef4c2eb..776e23bfd 100644 --- a/Source/WebKit/chromium/tests/TextureCopierTest.cpp +++ b/Source/WebKit/chromium/tests/TextureCopierTest.cpp @@ -39,8 +39,6 @@ using testing::InSequence; using testing::Test; using testing::_; -namespace { - class MockContext : public FakeWebGraphicsContext3D { public: MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId)); @@ -52,34 +50,31 @@ public: TEST(TextureCopierTest, testDrawArraysCopy) { GraphicsContext3D::Attributes attrs; - OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new MockContext)); - MockContext& mockContext = *static_cast<MockContext*>(ccContext->context3D()); + OwnPtr<MockContext> mockContext = adoptPtr(new MockContext); { InSequence sequence; // Here we check just some essential properties of copyTexture() to avoid mirroring the full implementation. - EXPECT_CALL(mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, _)); + EXPECT_CALL(*mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, _)); // Make sure linear filtering is disabled during the copy. - EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); - EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); + EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); + EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); - EXPECT_CALL(mockContext, drawArrays(_, _, _)); + EXPECT_CALL(*mockContext, drawArrays(_, _, _)); // Linear filtering should be restored. - EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); + EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); // Default framebuffer should be restored - EXPECT_CALL(mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); + EXPECT_CALL(*mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); } int sourceTextureId = 1; int destTextureId = 2; IntSize size(256, 128); - OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(ccContext->context3D(), false)); - copier->copyTexture(ccContext.get(), sourceTextureId, destTextureId, size); + OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(mockContext.get(), false)); + copier->copyTexture(sourceTextureId, destTextureId, size); } - -} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index f152ab4fb..11bf115b5 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -30,6 +30,7 @@ #include "CCAnimationTestCommon.h" #include "CCLayerTreeTestCommon.h" #include "CCTiledLayerTestCommon.h" +#include "FakeCCGraphicsContext.h" #include "FakeCCLayerTreeHostClient.h" #include "LayerPainterChromium.h" #include "WebCompositor.h" @@ -72,29 +73,37 @@ private: class TiledLayerChromiumTest : public testing::Test { public: - TiledLayerChromiumTest() : ccContext(CCGraphicsContext::create3D(WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes()))) { } - virtual ~TiledLayerChromiumTest() { } + TiledLayerChromiumTest() + : m_context(WebKit::createFakeCCGraphicsContext()) + { + DebugScopedSetImplThread implThread; + m_resourceProvider = CCResourceProvider::create(m_context.get()); + } + + virtual ~TiledLayerChromiumTest() + { + DebugScopedSetImplThread implThread; + m_resourceProvider.clear(); + } void updateTextures(int count = 500) { - updater.update(ccContext.get(), &allocator, &copier, &uploader, count); + m_updater.update(m_resourceProvider.get(), &m_copier, &m_uploader, count); } public: - // FIXME: Rename these to add "m_". - OwnPtr<CCGraphicsContext> ccContext; - CCTextureUpdater updater; - FakeTextureAllocator allocator; - FakeTextureCopier copier; - FakeTextureUploader uploader; - CCPriorityCalculator priorityCalculator; + OwnPtr<CCGraphicsContext> m_context; + OwnPtr<CCResourceProvider> m_resourceProvider; + CCTextureUpdater m_updater; + FakeTextureCopier m_copier; + FakeTextureUploader m_uploader; + CCPriorityCalculator m_priorityCalculator; }; TEST_F(TiledLayerChromiumTest, pushDirtyTiles) { - CCPriorityCalculator priorityCalculator; - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -104,10 +113,10 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -118,9 +127,9 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) // Invalidates both tiles... layer->invalidateContentRect(IntRect(0, 0, 100, 200)); // ....but then only update one of them. - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); layer->pushPropertiesTo(layerImpl.get()); // We should only have the first tile since the other tile was invalidated but not painted. @@ -130,8 +139,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) { - CCPriorityCalculator priorityCalculator; - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -143,10 +151,10 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -162,7 +170,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // ....but the area is occluded. occluded.setOcclusion(IntRect(0, 0, 50, 50)); - layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -177,7 +185,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) TEST_F(TiledLayerChromiumTest, pushDeletedTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -187,10 +195,10 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -199,7 +207,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); textureManager->clearPriorities(); - textureManager->clearAllMemory(&allocator); + textureManager->clearAllMemory(m_resourceProvider.get()); textureManager->setMaxMemoryLimitBytes(4*1024*1024); // This should drop the tiles on the impl thread. @@ -210,9 +218,9 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); // This should recreate and update the deleted textures. - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -223,7 +231,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -238,10 +246,10 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) layer->setVisibleContentRect(visibleRect); layer->invalidateContentRect(contentRect); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0); updateTextures(); // We should need idle-painting for 3x3 tiles in the center. @@ -254,10 +262,10 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) // For the next four updates, we should detect we still need idle painting. for (int i = 0; i < 4; i++) { - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0); EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -281,7 +289,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) { // Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(2*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(2*1024*1024, 1024, CCRenderer::ContentPool); DebugScopedSetImplThread implThread; RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -305,11 +313,11 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) layer1->invalidateContentRect(layerRect); // Paint a single tile in layer2 so that it will idle paint. - layer2->setTexturePriorities(priorityCalculator); - layer1->setTexturePriorities(priorityCalculator); + layer2->setTexturePriorities(m_priorityCalculator); + layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer1->updateContentRect(updater, layerRect, 0); - layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); + layer1->updateContentRect(m_updater, layerRect, 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); // We should need idle-painting for both remaining tiles in layer2. EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect)); @@ -323,10 +331,10 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) textureManager->setMaxMemoryLimitBytes(1024 * 1024); // Now idle paint layer2. We are going to run out of memory though! - layer2->setTexturePriorities(priorityCalculator); - layer1->setTexturePriorities(priorityCalculator); + layer2->setTexturePriorities(m_priorityCalculator); + layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); // Oh well, commit the frame and push. updateTextures(); @@ -343,11 +351,11 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) EXPECT_FALSE(layerImpl2->hasTileAt(0, 2)); // Now if layer2 becomes fully visible, we should be able to paint it and push valid textures. - layer2->setTexturePriorities(priorityCalculator); - layer1->setTexturePriorities(priorityCalculator); + layer2->setTexturePriorities(m_priorityCalculator); + layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer2->updateContentRect(updater, layer2Rect, 0); - layer1->updateContentRect(updater, layerRect, 0); + layer2->updateContentRect(m_updater, layer2Rect, 0); + layer1->updateContentRect(m_updater, layerRect, 0); updateTextures(); layer1->pushPropertiesTo(layerImpl1.get()); @@ -363,7 +371,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -377,9 +385,9 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); layer->invalidateContentRect(IntRect(0, 0, 100, 100)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -389,7 +397,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -402,9 +410,9 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get()); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -415,7 +423,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; @@ -430,15 +438,15 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer1->setTexturePriorities(priorityCalculator); - layer2->setTexturePriorities(priorityCalculator); + layer1->setTexturePriorities(m_priorityCalculator); + layer2->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); // Invalidate a tile on layer1 layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); - layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); @@ -453,7 +461,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; @@ -468,14 +476,14 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer1->setTexturePriorities(priorityCalculator); - layer2->setTexturePriorities(priorityCalculator); + layer1->setTexturePriorities(m_priorityCalculator); + layer2->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); // Invalidate a tile on layer2 layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); - layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); - layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); layer2->pushPropertiesTo(layer2Impl.get()); @@ -497,7 +505,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel. - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(memoryLimit, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(memoryLimit, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -507,9 +515,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) layer->setVisibleContentRect(visibleRect); layer->invalidateContentRect(contentRect); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0); // Idle-painting should see no more priority tiles for painting. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -520,9 +528,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) // We should have one tile on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0); // We shouldn't signal we need another idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -530,7 +538,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -547,11 +555,11 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) layer->setVisibleContentRect(contentRect); layer->invalidateContentRect(contentRect); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); // Empty layers don't paint or idle-paint. - layer->updateContentRect(updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0); // Empty layers don't have tiles. EXPECT_EQ(0u, layer->numPaintedTiles()); @@ -571,7 +579,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) IntSize contentBounds(100, 100); IntRect contentRect(IntPoint::zero(), contentBounds); - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -585,9 +593,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) for (int i = 0; i < 2; i++) { // Paint / idle-paint. - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0); // Non-visible layers don't need idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -611,7 +619,7 @@ static void testHaveOuterTiles(FakeCCTiledLayerImpl* layerImpl, int width, int h TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(8000*8000*8, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(8000*8000*8, 1024, CCRenderer::ContentPool); DebugScopedSetImplThread implThread; int tileWidth = FakeTiledLayerChromium::tileSize().width(); @@ -635,7 +643,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) layer->setVisibleContentRect(visibleRect); layer->invalidateContentRect(contentRect); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); // If idlePaintRect gives back a non-empty result then we should paint it. Otherwise, @@ -647,10 +655,10 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) // If the layer is to be prepainted at all, then after four updates we should have the outer row/columns painted. for (int k = 0; k < 4; ++k) { - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -660,10 +668,10 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) // We don't currently idle paint past the outermost tiles. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); for (int k = 0; k < 4; ++k) { - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -675,24 +683,19 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - FakeTextureAllocator fakeAllocator; - FakeTextureCopier fakeCopier; - FakeTextureUploader fakeUploader; - OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes())); - // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); - updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + updateTextures(1000); layer->pushPropertiesTo(layerImpl.get()); // We should have both tiles on the impl side. @@ -702,21 +705,21 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) layer->fakeLayerTextureUpdater()->clearPrepareCount(); // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on // the LayerTextureUpdater. - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); - updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + updateTextures(1000); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect. layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); - updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + updateTextures(1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); // The layer should still be invalid as updateContentRect invoked invalidate. - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); - updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + updateTextures(1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -725,8 +728,9 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) // The updateRect (that indicates what was actually painted) should be in // layer space, not the content space. - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get())); + DebugScopedSetImplThread implThread; IntRect layerBounds(0, 0, 300, 200); IntRect contentBounds(0, 0, 200, 250); @@ -739,32 +743,32 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) // However, it should still be in layer space, not content space. layer->invalidateContentRect(contentBounds); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); updateTextures(); // After the tiles are updated once, another invalidate only needs to update the bounds of the layer. - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); updateTextures(); // Partial re-paint should also be represented by the updateRect in layer space, not content space. IntRect partialDamage(30, 100, 10, 10); layer->invalidateContentRect(partialDamage); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -778,9 +782,9 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); // Push the tiles to the impl side and check that there is exactly one. - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -795,9 +799,9 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); // The impl side should get 2x2 tiles now. - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 200, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 200, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -808,8 +812,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Invalidate the entire layer again, but do not paint. All tiles should be gone now from the // impl side. layer->setNeedsDisplay(); - layer->setTexturePriorities(priorityCalculator); - layer->updateContentRect(updater, IntRect(1, 0, 0, 1), 0); + layer->setTexturePriorities(m_priorityCalculator); + layer->updateContentRect(m_updater, IntRect(1, 0, 0, 1), 0); textureManager->prioritizeTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -840,17 +844,17 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) rootLayer->setBounds(contentBounds); rootLayer->setVisibleContentRect(contentRect); - rootLayer->setPosition(FloatPoint(150, 150)); + rootLayer->setPosition(FloatPoint(0, 0)); childLayer->setBounds(contentBounds); childLayer->setVisibleContentRect(contentRect); - childLayer->setPosition(FloatPoint(150, 150)); + childLayer->setPosition(FloatPoint(0, 0)); rootLayer->invalidateContentRect(contentRect); childLayer->invalidateContentRect(contentRect); ccLayerTreeHost->setRootLayer(rootLayer); ccLayerTreeHost->setViewportSize(IntSize(300, 300)); - ccLayerTreeHost->updateLayers(updater, memoryLimit); + ccLayerTreeHost->updateLayers(m_updater, memoryLimit); // We'll skip the root layer. EXPECT_TRUE(rootLayer->skipsDraw()); @@ -861,10 +865,10 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) // Remove the child layer. rootLayer->removeAllChildren(); - ccLayerTreeHost->updateLayers(updater, memoryLimit); + ccLayerTreeHost->updateLayers(m_updater, memoryLimit); EXPECT_FALSE(rootLayer->skipsDraw()); - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(&allocator); + ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); WebKit::WebCompositor::shutdown(); @@ -872,16 +876,16 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) TEST_F(TiledLayerChromiumTest, resizeToSmaller) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); layer->setBounds(IntSize(700, 700)); layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); layer->invalidateContentRect(IntRect(0, 0, 700, 700)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0); layer->setBounds(IntSize(200, 200)); layer->invalidateContentRect(IntRect(0, 0, 200, 200)); @@ -889,7 +893,7 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); int size = 1 << 30; @@ -898,9 +902,9 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) layer->invalidateContentRect(IntRect(0, 0, size, size)); // Ensure no crash for bounds where size * size would overflow an int. - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0); } TEST_F(TiledLayerChromiumTest, partialUpdates) @@ -921,7 +925,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); layer->setBounds(contentBounds); - layer->setPosition(FloatPoint(150, 150)); + layer->setPosition(FloatPoint(0, 0)); layer->setVisibleContentRect(contentRect); layer->invalidateContentRect(contentRect); @@ -929,17 +933,17 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->setViewportSize(IntSize(300, 200)); // Full update of all 6 tiles. - ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); + ccLayerTreeHost->updateLayers(m_updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_TRUE(updater.hasMoreUpdates()); + EXPECT_TRUE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); updateTextures(4); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); layer->pushPropertiesTo(layerImpl.get()); } @@ -947,17 +951,17 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) // Full update of 3 tiles and partial update of 3 tiles. layer->invalidateContentRect(IntRect(0, 0, 300, 150)); - ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); + ccLayerTreeHost->updateLayers(m_updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); updateTextures(4); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_TRUE(updater.hasMoreUpdates()); + EXPECT_TRUE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); updateTextures(4); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); layer->pushPropertiesTo(layerImpl.get()); } @@ -968,14 +972,14 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); + ccLayerTreeHost->updateLayers(m_updater, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_TRUE(updater.hasMoreUpdates()); + EXPECT_TRUE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); layer->pushPropertiesTo(layerImpl.get()); } @@ -995,14 +999,14 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); + ccLayerTreeHost->updateLayers(m_updater, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_TRUE(updater.hasMoreUpdates()); + EXPECT_TRUE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); updateTextures(4); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); layer->pushPropertiesTo(layerImpl.get()); } @@ -1013,16 +1017,19 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); + ccLayerTreeHost->updateLayers(m_updater, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); layer->pushPropertiesTo(layerImpl.get()); } ccLayerTreeHost->commitComplete(); - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(&allocator); + { + DebugScopedSetImplThread implThread; + ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); + } ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); WebKit::WebCompositor::shutdown(); @@ -1030,7 +1037,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); // The tile size is 100x100, so this invalidates and then paints two tiles. @@ -1038,15 +1045,15 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); } TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); TestCCOcclusionTracker occluded; @@ -1059,9 +1066,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1072,7 +1079,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) occluded.setOcclusion(IntRect(250, 200, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1083,7 +1090,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) occluded.setOcclusion(IntRect(250, 250, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1093,7 +1100,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); TestCCOcclusionTracker occluded; @@ -1107,9 +1114,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->setVisibleContentRect(IntRect(0, 0, 600, 360)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 360), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 360), &occluded); EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1122,9 +1129,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) occluded.setOcclusion(IntRect(200, 200, 300, 150)); layer->setVisibleContentRect(IntRect(0, 0, 600, 350)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 350), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 350), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1137,9 +1144,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) occluded.setOcclusion(IntRect(200, 200, 300, 150)); layer->setVisibleContentRect(IntRect(0, 0, 600, 340)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 340), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 340), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1150,7 +1157,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); TestCCOcclusionTracker occluded; @@ -1162,11 +1169,14 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); - updateTextures(); + { + DebugScopedSetImplThread implThread; + updateTextures(); + } EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1); @@ -1175,7 +1185,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1185,7 +1195,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); TestCCOcclusionTracker occluded; @@ -1202,9 +1212,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) occluded.setOcclusion(IntRect(100, 100, 150, 50)); layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1214,7 +1224,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); TestCCOcclusionTracker occluded; @@ -1230,9 +1240,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); // The content is half the size of the layer (so the number of tiles is fewer). // In this case, the content is 300x300, and since the tile size is 100, the // number of tiles 3x3. @@ -1250,9 +1260,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) occluded.setOcclusion(IntRect(200, 200, 300, 200)); layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1270,9 +1280,9 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) occluded.setOcclusion(IntRect(100, 100, 150, 100)); layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1282,9 +1292,10 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); TestCCOcclusionTracker occluded; + DebugScopedSetImplThread implThread; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1299,13 +1310,13 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1318,7 +1329,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) opaquePaintRect = IntRect(10, 10, 90, 190); layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1331,7 +1342,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->updateContentRect(updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1346,7 +1357,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); - layer->updateContentRect(updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1361,7 +1372,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(10, 10, 1, 1)); - layer->updateContentRect(updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); @@ -1375,9 +1386,10 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); TestCCOcclusionTracker occluded; + DebugScopedSetImplThread implThread; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1392,13 +1404,13 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); - layer->setTexturePriorities(priorityCalculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); // Invalidates and paints the whole layer. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1413,7 +1425,7 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); layer->invalidateContentRect(IntRect(50, 200, 10, 10)); - layer->updateContentRect(updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1474,14 +1486,14 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); + ccLayerTreeHost->updateLayers(m_updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(3, child->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(3, child2->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); root->fakeLayerTextureUpdater()->clearUpdateCount(); child->fakeLayerTextureUpdater()->clearUpdateCount(); @@ -1509,14 +1521,14 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - ccLayerTreeHost->updateLayers(updater, (3 * 2 + 3 * 1) * (100 * 100) * 4); + ccLayerTreeHost->updateLayers(m_updater, (3 * 2 + 3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child2->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); root->fakeLayerTextureUpdater()->clearUpdateCount(); child->fakeLayerTextureUpdater()->clearUpdateCount(); @@ -1545,14 +1557,14 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - ccLayerTreeHost->updateLayers(updater, (3 * 1) * (100 * 100) * 4); + ccLayerTreeHost->updateLayers(m_updater, (3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(0, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child2->fakeLayerTextureUpdater()->updateCount()); - EXPECT_FALSE(updater.hasMoreUpdates()); + EXPECT_FALSE(m_updater.hasMoreUpdates()); root->fakeLayerTextureUpdater()->clearUpdateCount(); child->fakeLayerTextureUpdater()->clearUpdateCount(); @@ -1574,7 +1586,10 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca } ccLayerTreeHost->commitComplete(); - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(&allocator); + { + DebugScopedSetImplThread implThread; + ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); + } ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); WebKit::WebCompositor::shutdown(); @@ -1605,7 +1620,7 @@ public: { OwnPtr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::create()); m_trackingLayerPainter = trackingLayerPainter.get(); - m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(trackingLayerPainter.release(), false); + m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(trackingLayerPainter.release()); } virtual ~UpdateTrackingTiledLayerChromium() { } @@ -1621,8 +1636,7 @@ private: TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) { - OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000)); - CCPriorityCalculator calculator; + OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000, CCRenderer::ContentPool)); RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(textureManager.get())); @@ -1635,53 +1649,58 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) EXPECT_EQ(contentRect.size(), layer->contentBounds()); layer->setVisibleContentRect(contentRect); - layer->setTexturePriorities(calculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); - updateTextures(); + { + DebugScopedSetImplThread implThread; + updateTextures(); + } // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. layer->invalidateContentRect(contentRect); - layer->updateContentRect(updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) { - OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000)); - CCPriorityCalculator calculator; + OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000, CCRenderer::ContentPool)); RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(textureManager.get())); IntRect layerRect(0, 0, 30, 31); layer->setPosition(layerRect.location()); layer->setBounds(layerRect.size()); - layer->setContentsScale(1.3); + layer->setContentsScale(1.3f); IntRect contentRect(IntPoint(), layer->contentBounds()); layer->setVisibleContentRect(contentRect); - layer->setTexturePriorities(calculator); + layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); - updateTextures(); + { + DebugScopedSetImplThread implThread; + updateTextures(); + } // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); - layer->updateContentRect(updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } diff --git a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp index 937cee202..eb442f4e3 100644 --- a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp @@ -200,10 +200,10 @@ TEST(WebTransformationMatrixTest, verifyMatrixInversion) EXPECT_TRUE(scale.isInvertible()); WebTransformationMatrix inverseScale = scale.inverse(); - EXPECT_ROW1_EQ(0.25, 0, 0, 0, inverseScale); - EXPECT_ROW2_EQ(0, 0.1, 0, 0, inverseScale); - EXPECT_ROW3_EQ(0, 0, 0.01, 0, inverseScale); - EXPECT_ROW4_EQ(0, 0, 0, 1, inverseScale); + EXPECT_ROW1_EQ(0.25, 0, 0, 0, inverseScale); + EXPECT_ROW2_EQ(0, .1f, 0, 0, inverseScale); + EXPECT_ROW3_EQ(0, 0, .01f, 0, inverseScale); + EXPECT_ROW4_EQ(0, 0, 0, 1, inverseScale); // Try to invert a matrix that is not invertible. // The inverse() function should simply return an identity matrix. @@ -979,7 +979,7 @@ TEST(WebTransformationMatrixTest, verifyIsIntegerTranslation) EXPECT_TRUE(A.isIntegerTranslation()); A.makeIdentity(); - A.translate(2.0, 3.0); + A.translate(2, 3); EXPECT_TRUE(A.isIntegerTranslation()); A.makeIdentity(); @@ -1183,7 +1183,7 @@ TEST(WebTransformationMatrixTest, verifyBlendForRotationAboutX) EXPECT_ROW3_NEAR(0, sin(expectedRotationAngle), cos(expectedRotationAngle), 0, to, ERROR_THRESHOLD); EXPECT_ROW4_EQ(0, 0, 0, 1, to); - expectedRotationAngle = 45.0 * piDouble / 180.0; + expectedRotationAngle = 45 * piDouble / 180.0; to.makeIdentity(); to.rotate3d(1, 0, 0, 90); to.blend(from, 0.5); @@ -1222,7 +1222,7 @@ TEST(WebTransformationMatrixTest, verifyBlendForRotationAboutY) EXPECT_ROW3_NEAR(-sin(expectedRotationAngle), 0, cos(expectedRotationAngle), 0, to, ERROR_THRESHOLD); EXPECT_ROW4_EQ(0, 0, 0, 1, to); - expectedRotationAngle = 45.0 * piDouble / 180.0; + expectedRotationAngle = 45 * piDouble / 180.0; to.makeIdentity(); to.rotate3d(0, 1, 0, 90); to.blend(from, 0.5); @@ -1261,7 +1261,7 @@ TEST(WebTransformationMatrixTest, verifyBlendForRotationAboutZ) EXPECT_ROW3_NEAR(0, 0, 1, 0, to, ERROR_THRESHOLD); EXPECT_ROW4_EQ(0, 0, 0, 1, to); - expectedRotationAngle = 45.0 * piDouble / 180.0; + expectedRotationAngle = 45 * piDouble / 180.0; to.makeIdentity(); to.rotate3d(0, 0, 1, 90); to.blend(from, 0.5); diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 7d313e348..a6fb4a584 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,124 @@ +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * DefaultTheme/default.edc: + +2012-07-20 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Remove unused headers from ewk_security_origin + https://bugs.webkit.org/show_bug.cgi?id=91914 + + Reviewed by Noam Rosenthal. + + There are some unused header in the ewk_security_origin.h/cpp + We need to remove them. + + * ewk/ewk_security_origin.cpp: + * ewk/ewk_security_origin.h: + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Proxy configuration should honor the no_proxy environment variable + https://bugs.webkit.org/show_bug.cgi?id=91747 + + Reviewed by Kenneth Rohde Christiansen. + + Use the new custom proxy resolver from WebCore in + WebKit1-EFL's ewk_network_proxy_uri_set() / get(), + instead of the less flexible SOUP_SESSION_PROXY_URI + SoupSession property. + + * ewk/ewk_network.cpp: + (ewk_network_proxy_uri_set): + (ewk_network_proxy_uri_get): + +2012-07-20 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] Fix build when protocol handler and custom scheme is disabled + https://bugs.webkit.org/show_bug.cgi?id=91840 + + Reviewed by Kenneth Rohde Christiansen. + + Fixed namespace closing bracket positioning. + + * WebCoreSupport/RegisterProtocolHandlerClientEfl.cpp: + (WebCore): + +2012-07-20 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Check parameters of ewk APIs in ewk_security_origin + https://bugs.webkit.org/show_bug.cgi?id=91833 + + Reviewed by Kentaro Hara. + + For preventing crash, check parameters of ewk APIs in the ewk_security_origin.cpp. + + * ewk/ewk_security_origin.cpp: + (ewk_security_origin_port_get): + (ewk_security_origin_web_database_usage_get): + (ewk_security_origin_web_database_quota_get): + (ewk_security_origin_web_database_quota_set): + (ewk_security_origin_application_cache_quota_set): + (ewk_security_origin_application_cache_clear): + (ewk_security_origin_web_database_get_all): + (ewk_security_origin_free): + * ewk/ewk_security_origin.h: + +2012-07-19 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Enable interactive form validation + https://bugs.webkit.org/show_bug.cgi?id=91711 + + Reviewed by Ryosuke Niwa. + + Enable interactive form validation on the Efl. + This makes we can validate data at form elements. + In addition, it is already enabled in the DRT. + + * ewk/ewk_view.cpp: + (_ewk_view_priv_new): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Add central error management to EFL port + https://bugs.webkit.org/show_bug.cgi?id=91598 + + Reviewed by Kenneth Rohde Christiansen. + + Make use of ErrorsEfl header from WebCore in + EFL's FrameLoaderClient now that we have + a central place for errors. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::cancelledError): + (WebCore::FrameLoaderClientEfl::blockedError): + (WebCore::FrameLoaderClientEfl::cannotShowURLError): + (WebCore::FrameLoaderClientEfl::interruptedForPolicyChangeError): + (WebCore::FrameLoaderClientEfl::cannotShowMIMETypeError): + (WebCore::FrameLoaderClientEfl::fileDoesNotExistError): + (WebCore::FrameLoaderClientEfl::pluginWillHandleLoadError): + (WebCore::FrameLoaderClientEfl::shouldFallBack): + +2012-07-18 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL][DRT] Add support for Web Inspector in WebKit-EFL DRT + https://bugs.webkit.org/show_bug.cgi?id=87935 + + Reviewed by Andreas Kling. + + Add implementation of DumpRenderTreeSupportEfl::evaluateInWebInspector(). + Some scripts for test should be evaluated in frontend. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::evaluateInWebInspector): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + 2012-07-17 Christophe Dumez <christophe.dumez@intel.com> [EFL] Replace 0 by NULL in public headers documentation diff --git a/Source/WebKit/efl/DefaultTheme/default.edc b/Source/WebKit/efl/DefaultTheme/default.edc index 5715e289d..1ecd0442b 100644 --- a/Source/WebKit/efl/DefaultTheme/default.edc +++ b/Source/WebKit/efl/DefaultTheme/default.edc @@ -48,7 +48,7 @@ collections { #include "widget/check/check.edc" #include "widget/entry/entry.edc" #include "widget/combo/combo.edc" -#ifdef ENABLE_PROGRESS_TAG +#ifdef ENABLE_PROGRESS_ELEMENT #include "widget/progressbar/progressbar.edc" #endif #include "widget/file/file.edc" diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index 485db7f09..bc0dc61be 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -520,6 +520,18 @@ bool DumpRenderTreeSupportEfl::isTargetItem(const Ewk_History_Item* ewkHistoryIt return historyItem->isTargetItem(); } +void DumpRenderTreeSupportEfl::evaluateInWebInspector(const Evas_Object* ewkView, long callId, const String& script) +{ +#if ENABLE(INSPECTOR) + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page) + return; + + if (page->inspectorController()) + page->inspectorController()->evaluateForTestInFrontend(callId, script); +#endif +} + void DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld(const Evas_Object* ewkFrame, int worldID, JSObjectRef globalObject, const String& script) { WebCore::Frame* coreFrame = EWKPrivate::coreFrame(ewkFrame); diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h index 611f3c85f..eaf11d328 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h @@ -94,6 +94,7 @@ public: static HistoryItemChildrenVector childHistoryItems(const Ewk_History_Item*); static String historyItemTarget(const Ewk_History_Item*); static bool isTargetItem(const Ewk_History_Item*); + static void evaluateInWebInspector(const Evas_Object* ewkView, long callId, const String& script); static void evaluateScriptInIsolatedWorld(const Evas_Object* ewkFrame, int worldID, JSObjectRef globalObject, const String& script); static JSGlobalContextRef globalContextRefForFrame(const Evas_Object* ewkFrame); diff --git a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp index 5072de236..d26961b16 100644 --- a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp @@ -38,6 +38,7 @@ #include "APICast.h" #include "DocumentLoader.h" +#include "ErrorsEfl.h" #include "FormState.h" #include "FrameLoader.h" #include "FrameNetworkingContextEfl.h" @@ -867,69 +868,44 @@ void FrameLoaderClientEfl::download(ResourceHandle*, const ResourceRequest& requ ewk_view_download_request(m_view, &download); } -// copied from WebKit/Misc/WebKitErrors[Private].h -enum { - WebKitErrorCannotShowMIMEType = 100, - WebKitErrorCannotShowURL = 101, - WebKitErrorFrameLoadInterruptedByPolicyChange = 102, - WebKitErrorCannotUseRestrictedPort = 103, - WebKitErrorCannotFindPlugIn = 200, - WebKitErrorCannotLoadPlugIn = 201, - WebKitErrorJavaUnavailable = 202, - WebKitErrorPluginWillHandleLoad = 204 -}; - -// Domains used for ResourceError -const char* const NSURLErrorDomain = "NSURLErrorDomain"; -const char* const WebKitErrorDomain = "WebKitErrorDomain"; - ResourceError FrameLoaderClientEfl::cancelledError(const ResourceRequest& request) { - ResourceError error(NSURLErrorDomain, -999, request.url().string(), - "Request cancelled"); - error.setIsCancellation(true); - return error; + return WebCore::cancelledError(request); } ResourceError FrameLoaderClientEfl::blockedError(const ResourceRequest& request) { - return ResourceError(WebKitErrorDomain, WebKitErrorCannotUseRestrictedPort, request.url().string(), - "Request blocked"); + return WebCore::blockedError(request); } ResourceError FrameLoaderClientEfl::cannotShowURLError(const ResourceRequest& request) { - return ResourceError(WebKitErrorDomain, WebKitErrorCannotShowURL, request.url().string(), - "Cannot show URL"); + return WebCore::cannotShowURLError(request); } ResourceError FrameLoaderClientEfl::interruptedForPolicyChangeError(const ResourceRequest& request) { - return ResourceError(WebKitErrorDomain, WebKitErrorFrameLoadInterruptedByPolicyChange, - request.url().string(), "Frame load interrupted by policy change"); + return WebCore::interruptedForPolicyChangeError(request); } ResourceError FrameLoaderClientEfl::cannotShowMIMETypeError(const ResourceResponse& response) { - return ResourceError(NSURLErrorDomain, WebKitErrorCannotShowMIMEType, response.url().string(), - "Cannot show mimetype"); + return WebCore::cannotShowMIMETypeError(response); } ResourceError FrameLoaderClientEfl::fileDoesNotExistError(const ResourceResponse& response) { - return ResourceError(NSURLErrorDomain, -998 /* ### */, response.url().string(), - "File does not exist"); + return WebCore::fileDoesNotExistError(response); } ResourceError FrameLoaderClientEfl::pluginWillHandleLoadError(const ResourceResponse& response) { - return ResourceError(WebKitErrorDomain, WebKitErrorPluginWillHandleLoad, response.url().string(), - "Plugin will handle load"); + return WebCore::pluginWillHandleLoadError(response); } bool FrameLoaderClientEfl::shouldFallBack(const ResourceError& error) { - return !(error.isCancellation() || error.errorCode() == WebKitErrorFrameLoadInterruptedByPolicyChange || error.errorCode() == WebKitErrorPluginWillHandleLoad); + return !(error.isCancellation() || error.errorCode() == PolicyErrorFrameLoadInterruptedByPolicyChange || error.errorCode() == PluginErrorWillHandleLoad); } bool FrameLoaderClientEfl::canCachePage() const diff --git a/Source/WebKit/efl/WebCoreSupport/RegisterProtocolHandlerClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/RegisterProtocolHandlerClientEfl.cpp index 5127e72bf..8f30850f6 100644 --- a/Source/WebKit/efl/WebCoreSupport/RegisterProtocolHandlerClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/RegisterProtocolHandlerClientEfl.cpp @@ -87,5 +87,6 @@ void RegisterProtocolHandlerClientEfl::unregisterProtocolHandler(const String& s } #endif -#endif // ENABLE(REGISTER_PROTOCOL_HANDLER) || ENABLE(CUSTOM_SCHEME_HANDLER) } + +#endif // ENABLE(REGISTER_PROTOCOL_HANDLER) || ENABLE(CUSTOM_SCHEME_HANDLER) diff --git a/Source/WebKit/efl/ewk/ewk_network.cpp b/Source/WebKit/efl/ewk/ewk_network.cpp index 8ad3c4927..781e945ab 100644 --- a/Source/WebKit/efl/ewk/ewk_network.cpp +++ b/Source/WebKit/efl/ewk/ewk_network.cpp @@ -21,6 +21,7 @@ #include "ewk_network.h" #include "NetworkStateNotifier.h" +#include "ProxyResolverSoup.h" #include "ResourceHandle.h" #include "ewk_private.h" #include <Eina.h> @@ -37,18 +38,20 @@ void ewk_network_proxy_uri_set(const char* proxy) return; } - SoupURI* uri = soup_uri_new(proxy); - EINA_SAFETY_ON_NULL_RETURN(uri); - - g_object_set(session, SOUP_SESSION_PROXY_URI, uri, NULL); - soup_uri_free(uri); + SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(proxy, 0); + soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl)); + g_object_unref(resolverEfl); } const char* ewk_network_proxy_uri_get(void) { SoupURI* uri; SoupSession* session = WebCore::ResourceHandle::defaultSession(); - g_object_get(session, SOUP_SESSION_PROXY_URI, &uri, NULL); + SoupProxyURIResolver* resolver = SOUP_PROXY_URI_RESOLVER(soup_session_get_feature(session, SOUP_TYPE_PROXY_RESOLVER)); + if (!resolver) + return 0; + + g_object_get(resolver, SOUP_PROXY_RESOLVER_WK_PROXY_URI, &uri, NULL); if (!uri) { ERR("no proxy uri"); diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.cpp b/Source/WebKit/efl/ewk/ewk_security_origin.cpp index 8b87bc3bf..1b6884e8c 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.cpp +++ b/Source/WebKit/efl/ewk/ewk_security_origin.cpp @@ -24,11 +24,9 @@ #include "ApplicationCacheStorage.h" #include "DatabaseTracker.h" #include "SecurityOrigin.h" -#include "ewk_private.h" #include "ewk_security_origin_private.h" #include "ewk_web_database.h" #include "ewk_web_database_private.h" -#include <Eina.h> #include <wtf/RefPtr.h> #include <wtf/UnusedParam.h> #include <wtf/text/CString.h> @@ -60,11 +58,14 @@ const char* ewk_security_origin_string_get(const Ewk_Security_Origin* origin) uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin* origin) { + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); return origin->securityOrigin->port(); } uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin* origin) { + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); + #if ENABLE(SQL_DATABASE) return WebCore::DatabaseTracker::tracker().usageForOrigin(origin->securityOrigin.get()); #else @@ -74,6 +75,8 @@ uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin* o uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin* origin) { + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); + #if ENABLE(SQL_DATABASE) return WebCore::DatabaseTracker::tracker().quotaForOrigin(origin->securityOrigin.get()); #else @@ -83,6 +86,8 @@ uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin* o void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin* origin, uint64_t quota) { + EINA_SAFETY_ON_NULL_RETURN(origin); + #if ENABLE(SQL_DATABASE) WebCore::DatabaseTracker::tracker().setQuota(origin->securityOrigin.get(), quota); #endif @@ -90,16 +95,20 @@ void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin* origi void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin* origin, int64_t quota) { + EINA_SAFETY_ON_NULL_RETURN(origin); WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin->securityOrigin.get(), quota); } void ewk_security_origin_application_cache_clear(const Ewk_Security_Origin* origin) { + EINA_SAFETY_ON_NULL_RETURN(origin); WebCore::ApplicationCache::deleteCacheForOrigin(origin->securityOrigin.get()); } Eina_List* ewk_security_origin_web_database_get_all(const Ewk_Security_Origin* origin) { + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); + Eina_List* databases = 0; #if ENABLE(SQL_DATABASE) Vector<WTF::String> names; @@ -119,6 +128,8 @@ Eina_List* ewk_security_origin_web_database_get_all(const Ewk_Security_Origin* o void ewk_security_origin_free(Ewk_Security_Origin* origin) { + EINA_SAFETY_ON_NULL_RETURN(origin); + origin->securityOrigin = 0; eina_stringshare_del(origin->host); eina_stringshare_del(origin->protocol); diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.h b/Source/WebKit/efl/ewk/ewk_security_origin.h index 0fddcc0ff..9996972d7 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.h +++ b/Source/WebKit/efl/ewk/ewk_security_origin.h @@ -33,7 +33,7 @@ #ifndef ewk_security_origin_h #define ewk_security_origin_h -#include <Evas.h> +#include <Eina.h> #ifdef __cplusplus extern "C" { @@ -81,7 +81,7 @@ EAPI const char *ewk_security_origin_string_get(const Ewk_Security_Orig * * @param o security origin object * - * @return the port + * @return the port or @c 0 if there is not a proper security origin scheme */ EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); @@ -91,7 +91,7 @@ EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin * This function won't work if Web SQL Database was not enabled when * building WebKit and will just return 0. * - * @param o security origin object + * @param o security origin object or @c 0 if there is not a proper security origin scheme * * @return the usage in bytes */ @@ -105,7 +105,7 @@ EAPI uint64_t ewk_security_origin_web_database_usage_get(const Ewk_S * * @param o security origin object * - * @return the quota in bytes + * @return the quota in bytes or @c 0 if there is not a proper security origin scheme */ EAPI uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin *o); @@ -146,7 +146,7 @@ EAPI void ewk_security_origin_application_cache_clear(const Ewk_ * * @param o security origin object * - * @return list of web databases in the security origin + * @return list of web databases in the security origin or @c NULL if there is not a proper security origin scheme * * @see ewk_web_database_free() * @see ewk_web_database_list_free() diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index f0859dfee..dc8ac88ba 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -797,6 +797,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) #if ENABLE(FULLSCREEN_API) priv->pageSettings->setFullScreenEnabled(true); #endif + priv->pageSettings->setInteractiveFormValidationEnabled(true); url = priv->pageSettings->userStyleSheetLocation(); priv->settings.userStylesheet = eina_stringshare_add(url.string().utf8().data()); diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index b994b7000..60d697325 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,70 @@ +2012-07-23 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91928 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-20 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91846 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-18 Benjamin Poulain <bpoulain@apple.com> + + [Mac] Make WebDataSourcePrivate lighter + https://bugs.webkit.org/show_bug.cgi?id=91511 + + Reviewed by Anders Carlsson. + + Make WebDataSourcePrivate a simple C++ class and use smart pointers for memory management. + + Since the "loader" attribute is only set on initialization, all the assertions spread in + various function are removed in favor of assertions on initialization. + + * WebView/WebDataSource.h: + * WebView/WebDataSource.mm: + (WebDataSourcePrivate): + (WebDataSourcePrivate::WebDataSourcePrivate): + (WebDataSourcePrivate::~WebDataSourcePrivate): + Use a class instead of a Objective-C object for WebDataSourcePrivate. + Use smart pointers instead of ref counting manually. + + (-[WebDataSource _setRepresentation:]): + (-[WebDataSource _addSubframeArchives:]): + (-[WebDataSource _transferApplicationCache:]): + (-[WebDataSource _setDeferMainResourceDataLoad:]): + (-[WebDataSource _documentFragmentWithArchive:]): + (-[WebDataSource _initWithDocumentLoader:]): + + (+[WebDataSource initialize]): + (-[WebDataSource dealloc]): + (-[WebDataSource finalize]): + WebDataSource takes the special initialization and destruction that was done in WebDataSourcePrivate. + + (-[WebDataSource representation]): + 2012-07-17 Vivek Galatage <vivekgalatage@gmail.com> Web Inspector: refactor InspectorController::connectFrontend() to accept InspectorFrontendChannel. diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 1fc82597c..dedcb83f2 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -49,9 +49,9 @@ ENABLE_CSS_VARIABLES = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; -ENABLE_DATALIST = ; +ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; -ENABLE_DETAILS = ENABLE_DETAILS; +ENABLE_DETAILS_ELEMENT = ENABLE_DETAILS_ELEMENT; ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; @@ -98,7 +98,7 @@ ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; ENABLE_MEDIA_SOURCE = ; ENABLE_MEDIA_STATISTICS = ; -ENABLE_METER_TAG = ENABLE_METER_TAG; +ENABLE_METER_ELEMENT = ENABLE_METER_ELEMENT; ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; @@ -108,7 +108,7 @@ ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; -ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; @@ -135,4 +135,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/WebView/WebDataSource.h b/Source/WebKit/mac/WebView/WebDataSource.h index 1ffd3398a..c742f1efb 100644 --- a/Source/WebKit/mac/WebView/WebDataSource.h +++ b/Source/WebKit/mac/WebView/WebDataSource.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2012 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,7 +35,6 @@ @class NSURLRequest; @class NSURLResponse; @class WebArchive; -@class WebDataSourcePrivate; @class WebFrame; @class WebResource; @@ -49,7 +48,7 @@ @interface WebDataSource : NSObject { @private - WebDataSourcePrivate *_private; + void *_private; } /*! diff --git a/Source/WebKit/mac/WebView/WebDataSource.mm b/Source/WebKit/mac/WebView/WebDataSource.mm index d9125f70f..52048e714 100644 --- a/Source/WebKit/mac/WebView/WebDataSource.mm +++ b/Source/WebKit/mac/WebView/WebDataSource.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 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 @@ -62,63 +62,38 @@ #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> #import <wtf/MainThread.h> +#import <wtf/RefPtr.h> +#import <wtf/RetainPtr.h> using namespace WebCore; -@interface WebDataSourcePrivate : NSObject { -@public - WebDocumentLoaderMac* loader; - - id <WebDocumentRepresentation> representation; - - BOOL representationFinishedLoading; - BOOL includedInWebKitStatistics; -} -@end - -@implementation WebDataSourcePrivate - -+ (void)initialize -{ - JSC::initializeThreading(); - WTF::initializeMainThreadToProcessMainThread(); - WebCore::RunLoop::initializeMainRunLoop(); - WebCoreObjCFinalizeOnMainThread(self); -} - -- (void)dealloc +class WebDataSourcePrivate { - if (WebCoreObjCScheduleDeallocateOnMainThread([WebDataSourcePrivate class], self)) - return; - - ASSERT(loader); - if (loader) { - ASSERT(!loader->isLoading()); - loader->detachDataSource(); - loader->deref(); +public: + WebDataSourcePrivate(PassRefPtr<WebDocumentLoaderMac> loader) + : loader(loader) + { + ASSERT(this->loader); + } + ~WebDataSourcePrivate() + { + if (loader) { + ASSERT(!loader->isLoading()); + loader->detachDataSource(); + } } - - [representation release]; - [super dealloc]; -} + RefPtr<WebDocumentLoaderMac> loader; + RetainPtr<id<WebDocumentRepresentation> > representation; + BOOL representationFinishedLoading; + BOOL includedInWebKitStatistics; +}; -- (void)finalize +static inline WebDataSourcePrivate* toPrivate(void* privateAttribute) { - ASSERT_MAIN_THREAD(); - - ASSERT(loader); - if (loader) { - ASSERT(!loader->isLoading()); - loader->detachDataSource(); - loader->deref(); - } - - [super finalize]; + return reinterpret_cast<WebDataSourcePrivate*>(privateAttribute); } -@end - @interface WebDataSource (WebFileInternal) @end @@ -126,9 +101,8 @@ using namespace WebCore; - (void)_setRepresentation:(id<WebDocumentRepresentation>)representation { - [_private->representation release]; - _private->representation = [representation retain]; - _private->representationFinishedLoading = NO; + toPrivate(_private)->representation = representation; + toPrivate(_private)->representationFinishedLoading = NO; } static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCClass, NSArray *supportTypes) @@ -152,21 +126,28 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl @implementation WebDataSource (WebPrivate) ++ (void)initialize +{ + if (self == [WebDataSource class]) { + JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); + WebCoreObjCFinalizeOnMainThread(self); + } +} + - (NSError *)_mainDocumentError { - return _private->loader->mainDocumentError(); + return toPrivate(_private)->loader->mainDocumentError(); } - (void)_addSubframeArchives:(NSArray *)subframeArchives { // FIXME: This SPI is poor, poor design. Can we come up with another solution for those who need it? - DocumentLoader* loader = [self _documentLoader]; - ASSERT(loader); - NSEnumerator *enumerator = [subframeArchives objectEnumerator]; WebArchive *archive; while ((archive = [enumerator nextObject]) != nil) - loader->addAllArchiveResources([archive _coreLegacyWebArchive]); + toPrivate(_private)->loader->addAllArchiveResources([archive _coreLegacyWebArchive]); } - (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL @@ -197,24 +178,20 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (BOOL)_transferApplicationCache:(NSString*)destinationBundleIdentifier { - DocumentLoader* loader = [self _documentLoader]; - - if (!loader) + if (!toPrivate(_private)->loader) return NO; NSString *cacheDir = [NSString _webkit_localCacheDirectoryWithBundleIdentifier:destinationBundleIdentifier]; - return ApplicationCacheStorage::storeCopyOfCache(cacheDir, loader->applicationCacheHost()); + return ApplicationCacheStorage::storeCopyOfCache(cacheDir, toPrivate(_private)->loader->applicationCacheHost()); } - (void)_setDeferMainResourceDataLoad:(BOOL)flag { - DocumentLoader* loader = [self _documentLoader]; - - if (!loader) + if (!toPrivate(_private)->loader) return; - loader->setDeferMainResourceDataLoad(flag); + toPrivate(_private)->loader->setDeferMainResourceDataLoad(flag); } @end @@ -223,7 +200,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (void)_finishedLoading { - _private->representationFinishedLoading = YES; + toPrivate(_private)->representationFinishedLoading = YES; [[self representation] finishedLoadingWithDataSource:self]; } @@ -238,8 +215,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (void)_setMainDocumentError:(NSError *)error { - if (!_private->representationFinishedLoading) { - _private->representationFinishedLoading = YES; + if (!toPrivate(_private)->representationFinishedLoading) { + toPrivate(_private)->representationFinishedLoading = YES; [[self representation] receivedError:error withDataSource:self]; } } @@ -289,8 +266,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl if ([WebView canShowMIMETypeAsHTML:MIMEType]) { NSString *markupString = [[NSString alloc] initWithData:[mainResource data] encoding:NSUTF8StringEncoding]; // FIXME: seems poor form to do this as a side effect of getting a document fragment - if (DocumentLoader* loader = [self _documentLoader]) - loader->addAllArchiveResources([archive _coreLegacyWebArchive]); + if (toPrivate(_private)->loader) + toPrivate(_private)->loader->addAllArchiveResources([archive _coreLegacyWebArchive]); DOMDocumentFragment *fragment = [[self webFrame] _documentFragmentWithMarkupString:markupString baseURLString:[[mainResource URL] _web_originalDataAsString]]; [markupString release]; @@ -332,7 +309,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl // May return nil if not initialized with a URL. - (NSURL *)_URL { - const KURL& url = _private->loader->url(); + const KURL& url = toPrivate(_private)->loader->url(); if (url.isEmpty()) return nil; return url; @@ -360,12 +337,13 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl [newRep release]; } - [_private->representation setDataSource:self]; + id<WebDocumentRepresentation> representation = toPrivate(_private)->representation.get(); + [representation setDataSource:self]; } - (DocumentLoader*)_documentLoader { - return _private->loader; + return toPrivate(_private)->loader.get(); } - (id)_initWithDocumentLoader:(PassRefPtr<WebDocumentLoaderMac>)loader @@ -373,14 +351,13 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl self = [super init]; if (!self) return nil; - - _private = [[WebDataSourcePrivate alloc] init]; - - _private->loader = loader.leakRef(); + + ASSERT(loader); + _private = static_cast<void*>(new WebDataSourcePrivate(loader)); - LOG(Loading, "creating datasource for %@", static_cast<NSURL *>(_private->loader->request().url())); + LOG(Loading, "creating datasource for %@", static_cast<NSURL *>(toPrivate(_private)->loader->request().url())); - if ((_private->includedInWebKitStatistics = [[self webFrame] _isIncludedInWebKitStatistics])) + if ((toPrivate(_private)->includedInWebKitStatistics = [[self webFrame] _isIncludedInWebKitStatistics])) ++WebDataSourceCount; return self; @@ -397,25 +374,32 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (void)dealloc { - if (_private && _private->includedInWebKitStatistics) + if (WebCoreObjCScheduleDeallocateOnMainThread([WebDataSource class], self)) + return; + + if (toPrivate(_private) && toPrivate(_private)->includedInWebKitStatistics) --WebDataSourceCount; - [_private release]; + delete toPrivate(_private); [super dealloc]; } - (void)finalize { - if (_private && _private->includedInWebKitStatistics) + ASSERT_MAIN_THREAD(); + + if (toPrivate(_private) && toPrivate(_private)->includedInWebKitStatistics) --WebDataSourceCount; + delete toPrivate(_private); + [super finalize]; } - (NSData *)data { - RefPtr<SharedBuffer> mainResourceData = _private->loader->mainResourceData(); + RefPtr<SharedBuffer> mainResourceData = toPrivate(_private)->loader->mainResourceData(); if (!mainResourceData) return nil; return [mainResourceData->createNSData() autorelease]; @@ -423,12 +407,12 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (id <WebDocumentRepresentation>)representation { - return _private->representation; + return toPrivate(_private)->representation.get(); } - (WebFrame *)webFrame { - FrameLoader* frameLoader = _private->loader->frameLoader(); + FrameLoader* frameLoader = toPrivate(_private)->loader->frameLoader(); if (!frameLoader) return nil; return static_cast<WebFrameLoaderClient*>(frameLoader->client())->webFrame(); @@ -436,27 +420,27 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (NSURLRequest *)initialRequest { - return _private->loader->originalRequest().nsURLRequest(); + return toPrivate(_private)->loader->originalRequest().nsURLRequest(); } - (NSMutableURLRequest *)request { - FrameLoader* frameLoader = _private->loader->frameLoader(); + FrameLoader* frameLoader = toPrivate(_private)->loader->frameLoader(); if (!frameLoader || !frameLoader->frameHasLoaded()) return nil; // FIXME: this cast is dubious - return (NSMutableURLRequest *)_private->loader->request().nsURLRequest(); + return (NSMutableURLRequest *)toPrivate(_private)->loader->request().nsURLRequest(); } - (NSURLResponse *)response { - return _private->loader->response().nsURLResponse(); + return toPrivate(_private)->loader->response().nsURLResponse(); } - (NSString *)textEncodingName { - NSString *textEncodingName = _private->loader->overrideEncoding(); + NSString *textEncodingName = toPrivate(_private)->loader->overrideEncoding(); if (!textEncodingName) textEncodingName = [[self response] textEncodingName]; return textEncodingName; @@ -464,7 +448,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (BOOL)isLoading { - return _private->loader->isLoadingInAPISense(); + return toPrivate(_private)->loader->isLoadingInAPISense(); } // Returns nil or the page title. @@ -475,7 +459,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (NSURL *)unreachableURL { - const KURL& unreachableURL = _private->loader->unreachableURL(); + const KURL& unreachableURL = toPrivate(_private)->loader->unreachableURL(); if (unreachableURL.isEmpty()) return nil; return unreachableURL; @@ -484,7 +468,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (WebArchive *)webArchive { // it makes no sense to grab a WebArchive from an uncommitted document. - if (!_private->loader->isCommitted()) + if (!toPrivate(_private)->loader->isCommitted()) return nil; return [[[WebArchive alloc] _initWithCoreLegacyWebArchive:LegacyWebArchive::create(core([self webFrame]))] autorelease]; @@ -492,14 +476,14 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (WebResource *)mainResource { - RefPtr<ArchiveResource> coreResource = _private->loader->mainResource(); + RefPtr<ArchiveResource> coreResource = toPrivate(_private)->loader->mainResource(); return [[[WebResource alloc] _initWithCoreResource:coreResource.release()] autorelease]; } - (NSArray *)subresources { Vector<PassRefPtr<ArchiveResource> > coreSubresources; - _private->loader->getSubresources(coreSubresources); + toPrivate(_private)->loader->getSubresources(coreSubresources); NSMutableArray *subresources = [[NSMutableArray alloc] initWithCapacity:coreSubresources.size()]; for (unsigned i = 0; i < coreSubresources.size(); ++i) { @@ -515,14 +499,14 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (WebResource *)subresourceForURL:(NSURL *)URL { - RefPtr<ArchiveResource> subresource = _private->loader->subresource(URL); + RefPtr<ArchiveResource> subresource = toPrivate(_private)->loader->subresource(URL); return subresource ? [[[WebResource alloc] _initWithCoreResource:subresource.get()] autorelease] : nil; } - (void)addSubresource:(WebResource *)subresource { - _private->loader->addArchiveResource([subresource _coreResource]); + toPrivate(_private)->loader->addArchiveResource([subresource _coreResource]); } @end diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index caf95058f..588dcf7aa 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -82,9 +82,7 @@ public: QString localStoragePath; QString offlineWebApplicationCachePath; qint64 offlineStorageDefaultQuota; -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) QWebSettings::ThirdPartyCookiePolicy thirdPartyCookiePolicy; -#endif void apply(); WebCore::Settings* settings; }; @@ -164,6 +162,10 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::WebGLEnabled)); settings->setWebGLEnabled(value); +#if ENABLE(CSS_SHADERS) + // For now, enable CSS shaders when WebGL is enabled. + settings->setCSSCustomFilterEnabled(value); +#endif #if USE(ACCELERATED_COMPOSITING) settings->setAcceleratedCompositingForCanvasEnabled(value); #endif @@ -365,7 +367,6 @@ QWebSettings* QWebSettings::globalSettings() \value DefaultFixedFontSize The default font size for fixed-pitch text. */ -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) /*! \enum QWebSettings::ThirdPartyCookiePolicy @@ -380,7 +381,6 @@ QWebSettings* QWebSettings::globalSettings() \since QtWebKit 2,3 */ -#endif /*! \enum QWebSettings::WebGraphic @@ -530,9 +530,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::SiteSpecificQuirksEnabled, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; d->defaultTextEncoding = QLatin1String("iso-8859-1"); -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) d->thirdPartyCookiePolicy = AlwaysAllowThirdPartyCookies; -#endif } /*! @@ -869,7 +867,6 @@ void QWebSettings::setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheM qMax(0, totalCapacity)); } -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) /*! Sets the third-party cookie policy, the default is AlwaysAllowThirdPartyCookies. */ @@ -885,7 +882,6 @@ QWebSettings::ThirdPartyCookiePolicy QWebSettings::thirdPartyCookiePolicy() cons { return d->thirdPartyCookiePolicy; } -#endif /*! Sets the actual font family to \a family for the specified generic family, diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h index 2e07356f2..835a72e24 100644 --- a/Source/WebKit/qt/Api/qwebsettings.h +++ b/Source/WebKit/qt/Api/qwebsettings.h @@ -97,13 +97,11 @@ public: DefaultFontSize, DefaultFixedFontSize }; -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) enum ThirdPartyCookiePolicy { AlwaysAllowThirdPartyCookies, AlwaysBlockThirdPartyCookies, AllowThirdPartyWithExistingCookies }; -#endif static QWebSettings *globalSettings(); @@ -156,10 +154,8 @@ public: static void enablePersistentStorage(const QString& path = QString()); -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) void setThirdPartyCookiePolicy(ThirdPartyCookiePolicy); QWebSettings::ThirdPartyCookiePolicy thirdPartyCookiePolicy() const; -#endif inline QWebSettingsPrivate* handle() const { return d; } diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index dabbee48e..d75294502 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,54 @@ +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * WebCoreSupport/RenderThemeQStyle.cpp: + (WebCore): + * WebCoreSupport/RenderThemeQStyle.h: + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Enable CSS Shaders in settings when WebGL is enabled. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + +2012-07-19 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Remove support for Qt versions before 4.8.0 + https://bugs.webkit.org/show_bug.cgi?id=91730 + + Reviewed by Kenneth Rohde Christiansen. + + Remove Qt version check #ifdefs for Qt versions before 4.8.0. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate): + (QWebSettings::QWebSettings): + (QWebSettings::thirdPartyCookiePolicy): + * Api/qwebsettings.h: + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * tests/qdeclarativewebview/tst_qdeclarativewebview.cpp: + (tst_QDeclarativeWebView): + (tst_QDeclarativeWebView::backgroundColor): + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::render): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage): + (tst_QWebPage::thirdPartyCookiePolicy): + 2012-07-17 Gabor Ballabas <gaborb@inf.u-szeged.hu> [Qt][V8] Remove the V8 related codepaths and configuration diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index d6fa62722..c02e66e66 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -984,13 +984,11 @@ void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPage* page, double int corePage->settings()->setMinDOMTimerInterval(interval); } -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPage *page, const QUrl& url, const QUrl& firstPartyUrl) { Page* corePage = QWebPagePrivate::core(page); return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader()->networkingContext(), url, firstPartyUrl); } -#endif QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId) { diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index e0c868081..0184ee4da 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -211,9 +211,7 @@ public: static void setDefersLoading(QWebPage*, bool flag); static void goBack(QWebPage*); -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) static bool thirdPartyCookiePolicyAllows(QWebPage*, const QUrl&, const QUrl& firstPartyUrl); -#endif static QImage paintPagesWithBoundaries(QWebFrame*); }; diff --git a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp index 6c734710b..7cfdabfc2 100644 --- a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp +++ b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp @@ -47,7 +47,7 @@ #include "PaintInfo.h" #include "QWebPageClient.h" #include "RenderBox.h" -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderProgress.h" #endif #include "RenderSlider.h" @@ -70,7 +70,7 @@ #include <QStyleFactory> #include <QStyleOptionButton> #include <QStyleOptionFrameV2> -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include <QStyleOptionProgressBarV2> #endif #include <QStyleOptionSlider> @@ -492,7 +492,7 @@ bool RenderThemeQStyle::paintMenuListButton(RenderObject* o, const PaintInfo& i, return false; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) double RenderThemeQStyle::animationDurationForProgressBar(RenderProgress* renderProgress) const { if (renderProgress->position() >= 0) diff --git a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h index fa160366a..7e8c26e91 100644 --- a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h +++ b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h @@ -64,7 +64,7 @@ protected: virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // Returns the duration of the animation for the progress bar. virtual double animationDurationForProgressBar(RenderProgress*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp index b1722a6fb..3623c6a3f 100644 --- a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -40,9 +40,7 @@ private slots: void renderingEnabled(); void setHtml(); void settings(); -#if QT_VERSION >= 0x040704 void backgroundColor(); -#endif private: void checkNoErrors(const QDeclarativeComponent&); @@ -505,7 +503,6 @@ void tst_QDeclarativeWebView::settings() } } -#if QT_VERSION >= 0x040704 void tst_QDeclarativeWebView::backgroundColor() { // We test here the rendering of the background. @@ -533,7 +530,6 @@ void tst_QDeclarativeWebView::backgroundColor() wv->setProperty("backgroundColor", Qt::green); QCOMPARE(spyColorChanged.count(), 1); } -#endif void tst_QDeclarativeWebView::checkNoErrors(const QDeclarativeComponent& component) { diff --git a/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp index fb47e4b61..9a208bc47 100644 --- a/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp +++ b/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp @@ -1062,11 +1062,7 @@ void tst_QWebElement::render() QPainter painter(&chunk); painter.fillRect(chunkRect, Qt::white); QRect chunkPaintRect(x, 0, chunkWidth, chunkHeight); -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) tables[0].render(&painter, chunkPaintRect); -#else - tables[0].render(&painter); -#endif painter.end(); // The first chunk in this test is passing, but the others are failing diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index b6f0aeee3..13e7a9f17 100644 --- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -90,9 +90,7 @@ public slots: private slots: void initTestCase(); void cleanupTestCase(); -#if QT_VERSION >= 0x040800 void thirdPartyCookiePolicy(); -#endif void contextMenuCopy(); void contextMenuPopulatedOnce(); void acceptNavigationRequest(); @@ -3042,7 +3040,6 @@ void tst_QWebPage::navigatorCookieEnabled() QVERIFY(m_page->mainFrame()->evaluateJavaScript("navigator.cookieEnabled").toBool()); } -#if QT_VERSION >= 0x040800 void tst_QWebPage::thirdPartyCookiePolicy() { QWebSettings::globalSettings()->setThirdPartyCookiePolicy(QWebSettings::AlwaysBlockThirdPartyCookies); @@ -3081,7 +3078,6 @@ void tst_QWebPage::thirdPartyCookiePolicy() QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page, QUrl("http://anotherexample.co.uk"), QUrl("http://example.co.uk"))); } -#endif #ifdef Q_OS_MAC void tst_QWebPage::macCopyUnicodeToClipboard() diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index c8d1c35fc..04cc719ee 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -298,6 +298,7 @@ SET(WebKit2_SOURCES UIProcess/API/C/WKKeyValueStorageManager.cpp UIProcess/API/C/WKMediaCacheManager.cpp UIProcess/API/C/WKNavigationData.cpp + UIProcess/API/C/WKNetworkInfo.cpp UIProcess/API/C/WKNetworkInfoManager.cpp UIProcess/API/C/WKNotification.cpp UIProcess/API/C/WKNotificationManager.cpp diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 42222d87c..e1855a33c 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,592 @@ +2012-07-23 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91928 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-20 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91846 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + +2012-07-20 Rafael Brandao <rafael.lobo@openbossa.org> + + QtNetworkAccessManager should not rely on signal sslErrors when QT_NO_SSL is defined + https://bugs.webkit.org/show_bug.cgi?id=91866 + + Reviewed by Noam Rosenthal. + + * WebProcess/qt/QtNetworkAccessManager.cpp: + (WebKit::QtNetworkAccessManager::QtNetworkAccessManager): QNAM's signal is only defined when + that flag is undefined. Removed the connection when we have the flag set. + (WebKit::QtNetworkAccessManager::onSslErrors): When the flag is set, this slot becomes unused. + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Proxy configuration should honor the no_proxy environment variable + https://bugs.webkit.org/show_bug.cgi?id=91747 + + Reviewed by Kenneth Rohde Christiansen. + + Use the new custom proxy resolver from WebCore in + WebKit2-EFL so that it is possible for the client + to set proxy exceptions via the "no_proxy" + environment variable. + + By default, the proxy set in the "http_proxy" + environment variable will not be used for requests + to localhost or 127.0.0.1. + + * WebProcess/efl/WebProcessMainEfl.cpp: + (WebKit::WebProcessMainEfl): + +2012-06-01 Dinu Jacob <dinu.jacob@nokia.com> + + [Qt][WK2] Add support for multi-select list + https://bugs.webkit.org/show_bug.cgi?id=85527 + + Reviewed by Kenneth Rohde Christiansen. + + Added support for multi-select list: + - Added multi-selection flag to PlatformPopupMenuData to indicate whether to accept multiple selections or not. + - Added selected state to WebPopupItem. + - Modified WebPopupMenuQt to support multiple selections. + + * Shared/PlatformPopupMenuData.cpp: + (WebKit::PlatformPopupMenuData::PlatformPopupMenuData): + (WebKit::PlatformPopupMenuData::encode): + (WebKit::PlatformPopupMenuData::decode): + * Shared/PlatformPopupMenuData.h: + (PlatformPopupMenuData): + * Shared/WebPopupItem.cpp: + (WebKit::WebPopupItem::WebPopupItem): + (WebKit::WebPopupItem::encode): + (WebKit::WebPopupItem::decode): + * Shared/WebPopupItem.h: + * UIProcess/API/qt/tests/qmltests/WebView/tst_multiSelect.qml: Added. + * UIProcess/API/qt/tests/qmltests/common/multiselect.html: Added. + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPopupMenuProxy.h: + (Client): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::changeSelectedIndex): + (WebKit): + (WebKit::WebPageProxy::closePopupMenu): + * UIProcess/qt/WebPopupMenuProxyQt.cpp: + (WebKit::PopupMenuItemModel::multiple): + (PopupMenuItemModel): + (WebKit::PopupMenuItemModel::Item::Item): + (ItemSelectorContextObject): + (WebKit::ItemSelectorContextObject::allowMultiSelect): + (WebKit::ItemSelectorContextObject::reject): + (WebKit::ItemSelectorContextObject::dismiss): + (WebKit::ItemSelectorContextObject::ItemSelectorContextObject): + (WebKit): + (WebKit::ItemSelectorContextObject::onIndexUpdate): + (WebKit::ItemSelectorContextObject::accept): + (WebKit::PopupMenuItemModel::PopupMenuItemModel): + (WebKit::PopupMenuItemModel::select): + (WebKit::PopupMenuItemModel::toggleItem): + (WebKit::PopupMenuItemModel::buildItems): + (WebKit::WebPopupMenuProxyQt::showPopupMenu): + (WebKit::WebPopupMenuProxyQt::hidePopupMenu): + (WebKit::WebPopupMenuProxyQt::selectIndex): + (WebKit::WebPopupMenuProxyQt::createItem): + * UIProcess/qt/WebPopupMenuProxyQt.h: + (WebPopupMenuProxyQt): + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::didChangeSelectedIndex): + (WebKit::WebPopupMenu::populateItems): + * WebProcess/WebCoreSupport/WebPopupMenu.h: + (WebPopupMenu): + * WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didChangeSelectedIndexForActivePopupMenu): + (WebKit): + (WebKit::WebPage::changeSelectedIndex): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::selectedIndex): + (WebKit): + (WebKit::WebPage::hidePopupMenu): + +2012-07-20 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed, rolling out r123085. + http://trac.webkit.org/changeset/123085 + https://bugs.webkit.org/show_bug.cgi?id=91719 + + r123085 causes crashes on EFL layout test bot. + + * UIProcess/efl/WebContextEfl.cpp: + (WebKit::WebContext::applicationCacheDirectory): + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Use "load,finished" signal in EWK2UnitTestBase::loadUrlSync() instead of "load,progress" + https://bugs.webkit.org/show_bug.cgi?id=91721 + + Reviewed by Kenneth Rohde Christiansen. + + The purpose of EWK2UnitTestBase::loadUrlSync() is to load + a URL in the view and wait synchronously for the load to finish. + The current implementation uses the "load,progress" signal to + detect when the load is finished, which is inefficient because + it gets emitted several times. + + It is better to wait for the "load,finished" signal which gets + emitted only once when the load is complete. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: + (EWK2UnitTest::onLoadFinished): + (EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase): + (EWK2UnitTest::EWK2UnitTestBase::loadUrlSync): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: + (EWK2UnitTestBase): + +2012-07-19 MORITA Hajime <morrita@google.com> + + [Refactoring] Replace Node's Document pointer with a TreeScope pointer + https://bugs.webkit.org/show_bug.cgi?id=59816 + + Reviewed by Ryosuke Niwa. + + * win/WebKit2.def: Added newly exported symbols. + * win/WebKit2CFLite.def: Ditto. + +2012-07-19 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] [WK2] Add methods to get/set a custom text encoding + https://bugs.webkit.org/show_bug.cgi?id=90604 + + Reviewed by Kenneth Rohde Christiansen. + + Add methods to get/set custom character encoding. + + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_ewk_view_priv_del): + (ewk_view_setting_encoding_custom_get): + (ewk_view_setting_encoding_custom_set): + * UIProcess/API/efl/ewk_view.h: + +2012-07-19 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed. Fix build break because of changing parameter type of + vibration virtual function on EFL port. + + * WebProcess/WebCoreSupport/WebVibrationClient.cpp: + (WebKit::WebVibrationClient::vibrate): + * WebProcess/WebCoreSupport/WebVibrationClient.h: + (WebVibrationClient): + +2012-07-19 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [WK2] Add Vibration API integration to WebContext and WebPage + https://bugs.webkit.org/show_bug.cgi?id=91081 + + Reviewed by Anders Carlsson. + + Integrate Vibration API to WebPage, WebContext and properly route + messages to the WebVibrationProxy. + + * UIProcess/API/C/WKContext.cpp: + (WKContextGetVibration): + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::~WebContext): + (WebKit::WebContext::disconnectProcess): + (WebKit::WebContext::didReceiveMessage): + * UIProcess/WebContext.h: + (WebKit): + (WebContext): + (WebKit::WebContext::vibrationProxy): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Add CSSCustomFilterEnabled to QWebPreferences. It's disabled by default. + + * UIProcess/API/qt/qwebpreferences.cpp: + (QWebPreferencesPrivate::testAttribute): + (QWebPreferencesPrivate::setAttribute): + * UIProcess/API/qt/qwebpreferences_p_p.h: + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Add CSSCustomFilterEnabled to QWebPreferences. It's disabled by default. + + * UIProcess/API/qt/qwebpreferences.cpp: + (QWebPreferencesPrivate::testAttribute): + (QWebPreferencesPrivate::setAttribute): + * UIProcess/API/qt/qwebpreferences_p_p.h: + +2012-07-19 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt][WK2] Map the elementRect exposed in QML to the view for popup menu + https://bugs.webkit.org/show_bug.cgi?id=91645 + + Reviewed by Simon Hausmann. + + This way the geometry of the QML item is still sensible even if we panned + and zoomed. + + * UIProcess/qt/WebPopupMenuProxyQt.cpp: + (ItemSelectorContextObject): + (WebKit::ItemSelectorContextObject::elementRect): + (WebKit::ItemSelectorContextObject::ItemSelectorContextObject): + (WebKit::WebPopupMenuProxyQt::showPopupMenu): + +2012-07-19 Zoltan Nyul <zoltan.nyul@intel.com> + + [EFL][WK2] Using different cache directory for each WTR process + https://bugs.webkit.org/show_bug.cgi?id=91719 + + Reviewed by Kenneth Rohde Christiansen. + + Make sure we return a valid application cache directory in + WebContextEfl. + + * UIProcess/efl/WebContextEfl.cpp: + (WebKit::WebContext::applicationCacheDirectory): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] EFL should use DownloadSoup instead of defining DownloadEfl + https://bugs.webkit.org/show_bug.cgi?id=91602 + + Reviewed by Kenneth Rohde Christiansen. + + Reuse WebProcess/Downloads/soup/DownloadSoup.cpp in EFL port + instead of redefining our own DownloadEfl.cpp. The EFL port + is also using libsoup so it is best to avoid code duplication. + + * GNUmakefile.am: + * GNUmakefile.list.am: + * PlatformEfl.cmake: + * WebProcess/Downloads/Download.h: + (WebKit): + (Download): + * WebProcess/Downloads/efl/DownloadEfl.cpp: Removed. + * WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp: Added. + (WebKit): + (WebKit::platformDownloadNetworkError): + (WebKit::platformDownloadDestinationError): + * WebProcess/Downloads/efl/FileDownloaderEfl.cpp: Removed. + * WebProcess/Downloads/efl/FileDownloaderEfl.h: Removed. + * WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp: Added. + (WebKit): + (WebKit::platformDownloadNetworkError): + (WebKit::platformDownloadDestinationError): + * WebProcess/Downloads/soup/DownloadSoup.cpp: Make the code + compile for other ports than GTK. + (WebKit::DownloadClient::didReceiveResponse): + (WebKit::DownloadClient::didReceiveData): + (WebKit::DownloadClient::didFail): + (WebKit::Download::continueWithoutCredential): + (WebKit): + (WebKit::Download::useCredential): + (WebKit::Download::cancelAuthenticationChallenge): + * WebProcess/Downloads/soup/DownloadSoupErrors.h: Added. + (WebKit): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [WK2] Add C API for Network Information API + https://bugs.webkit.org/show_bug.cgi?id=90762 + + Reviewed by Kenneth Rohde Christiansen. + + Add C API for WKNetworkInfo and WKNetworkInfoManager + so that they can be used by the client. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * UIProcess/API/C/WKContext.cpp: + (WKContextGetNetworkInfoManager): + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKNetworkInfo.cpp: Copied from Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp. + (WKNetworkInfoGetTypeID): + (WKNetworkInfoCreate): + * UIProcess/API/C/WKNetworkInfo.h: Copied from Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp. + * UIProcess/API/C/WKNetworkInfoManager.cpp: + (WKNetworkInfoManagerSetProvider): + (WKNetworkInfoManagerProviderDidChangeNetworkInformation): + * UIProcess/API/C/WKNetworkInfoManager.h: + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] ewk_cookie_manager_persistent_storage_set is not exported + https://bugs.webkit.org/show_bug.cgi?id=91647 + + Reviewed by Gustavo Noronha Silva. + + Properly export ewk_cookie_manager_persistent_storage_set in + ewk_cookie_manager.h by using EAPI. + + * UIProcess/API/efl/ewk_cookie_manager.h: + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Add central error management to EFL port + https://bugs.webkit.org/show_bug.cgi?id=91598 + + Reviewed by Kenneth Rohde Christiansen. + + Make use of ErrorsEfl header from WebCore in + WebKit2, for Ewk_Web_Error and WebErrorsEfl. + + * UIProcess/API/efl/ewk_web_error.cpp: + (ewk_web_error_type_get): + * UIProcess/API/efl/ewk_web_error.h: + * WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp: + (WebKit::cancelledError): + (WebKit::blockedError): + (WebKit::cannotShowURLError): + (WebKit::interruptedForPolicyChangeError): + (WebKit::cannotShowMIMETypeError): + (WebKit::fileDoesNotExistError): + (WebKit::pluginWillHandleLoadError): + +2012-07-18 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] Set a theme for EFL WebKit2 unit test fixture + https://bugs.webkit.org/show_bug.cgi?id=91618 + + Reviewed by Kenneth Rohde Christiansen. + + The test fixture should load the theme generated by the build + instead of trying to load the system theme. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: + (EWK2UnitTest::EWK2UnitTestBase::SetUp): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp: + (EWK2UnitTest::EWK2UnitTestEnvironment::defaultTheme): + (EWK2UnitTest): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h: + (EWK2UnitTestEnvironment): + +2012-07-18 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] QQuickWebView shouldn't recieve mouse events while dialogs are active + https://bugs.webkit.org/show_bug.cgi?id=91634 + + Reviewed by Alexis Menard. + + One side-effect of reimplementing childMouseEventFilter() in r122438 is that it can end up + bypassing the mouseArea mechanism used in QML dialogs and still forward some mouse events + over to the web process. We can rely on the same m_dialogActive mechanism already used for + touch events in there as well. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebView::childMouseEventFilter): ignore events and return early if a dialog is active. + +2012-07-18 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Build fix for ENABLE_TOUCH_EVENTS=0 + + Rubber-stamped by No'am Rosenthal. + + Add the appropriate ENABLE(TOUCH_EVENTS) where they're needed. + + * UIProcess/API/qt/raw/qrawwebview.cpp: + * UIProcess/API/qt/raw/qrawwebview_p.h: include Platform.h so we can use the ENABLE macro. + * UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp: Also add the missing QFile include. + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::deactivateTapHighlight): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add Ewk class for cookie manager + https://bugs.webkit.org/show_bug.cgi?id=91053 + + Reviewed by Gustavo Noronha Silva. + + Add new Ewk_Cookie_Manager class to allow the client + to set/get the cookie acceptance policy, support + persistent cookie storage and clear cookies. + + The Ewk_Cookie_Manager instance can be retrieved + from the Ewk_Context API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_context.cpp: + (_Ewk_Context): + (_Ewk_Context::_Ewk_Context): + (_Ewk_Context::~_Ewk_Context): + (ewk_context_cookie_manager_get): + * UIProcess/API/efl/ewk_context.h: + * UIProcess/API/efl/ewk_cookie_manager.cpp: Added. + (_Ewk_Cookie_Manager): + (_Ewk_Cookie_Manager::_Ewk_Cookie_Manager): + (ewk_cookie_manager_persistent_storage_set): + (ewk_cookie_manager_accept_policy_set): + (Get_Policy_Async_Data): + (getAcceptPolicyCallback): + (ewk_cookie_manager_async_accept_policy_get): + (Get_Hostnames_Async_Data): + (getHostnamesWithCookiesCallback): + (ewk_cookie_manager_async_hostnames_with_cookies_get): + (ewk_cookie_manager_hostname_cookies_clear): + (ewk_cookie_manager_cookies_clear): + (ewk_cookie_manager_free): + (ewk_cookie_manager_new): + * UIProcess/API/efl/ewk_cookie_manager.h: Added. + * UIProcess/API/efl/ewk_cookie_manager_private.h: Added. + +2012-07-18 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add WebKitWebView::submit-form signal to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=91605 + + Reviewed by Gustavo Noronha Silva. + + The signal is emitted when a form is about to submitted, with a + form submission request that can be used to get the text fields + and to continue the form submission wheh done. + + * GNUmakefile.list.am: Add new files to compilation. + * UIProcess/API/gtk/WebKitFormClient.cpp: Added. + (willSubmitForm): Create a WebKitFormSubmissionRequest and call + webkitWebViewSubmitFormRequest() with the request. + (attachFormClientToView): Add impementation for willSubmitForm + callback. + * UIProcess/API/gtk/WebKitFormClient.h: Added. + * UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp: Added. + (webkit_form_submission_request_init): + (webkitFormSubmissionRequestFinalize): + (webkit_form_submission_request_class_init): + (webkitFormSubmissionRequestCreate): Create a new + WebKitFormSubmissionRequest for the given values dictionary and + submission listener. + (webkit_form_submission_request_get_text_fields): Create a + GHashTable with the text fields values and return it. + (webkit_form_submission_request_submit): Continue the form + submission. + * UIProcess/API/gtk/WebKitFormSubmissionRequest.h: Added. + * UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h: Added. + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewConstructed): Attach web view to form client. + (webkit_web_view_class_init): Add WebKitWebView::submit-form + signal. + (webkitWebViewSubmitFormRequest): Emit WebKitWebView::submit-form + signal. + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/WebKitWebViewPrivate.h: + * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for + WebKitFormSubmissionRequest. + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols. + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewSubmitForm): + (beforeAll): + * UIProcess/API/gtk/webkit2.h: Include + WebKitFormSubmissionRequest.h. + +2012-07-18 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] No main resource in WebView when page has been loaded from history cache + https://bugs.webkit.org/show_bug.cgi?id=91478 + + Reviewed by Gustavo Noronha Silva. + + We are assuming that a resource loaded for the main frame that is + provisionally loading is the main resource of the web view. However + that's not true for pages loaded from history cache, so when you + go back/forward webkit_web_view_get_main_resource() always returns + NULL. We can assume that the first resource loaded for the main + frame is the main resource of the web view when + pageIsProvisionallyLoading is false. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewResourceLoadStarted): Make sure we always have a + main resource for the web view. + * UIProcess/API/gtk/tests/TestResources.cpp: + (testWebViewResourcesHistoryCache): Test we always have a main + resource even after going back/forward. + (beforeAll): Add new test case. + +2012-07-18 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL] Rename WebInspectorEfl.cpp as WebInspectorProxyEfl.cpp + https://bugs.webkit.org/show_bug.cgi?id=91585 + + Reviewed by Andreas Kling. + + Rename WebInspectorEfl.cpp as WebInspectorProxyEfl.cpp + since it implements the platform specific methods of WebInspectorProxy. + + * PlatformEfl.cmake: + * UIProcess/efl/WebInspectorProxyEfl.cpp: Renamed from Source/WebKit2/UIProcess/efl/WebInspectorEfl.cpp. + (WebKit): + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + (WebKit::WebInspectorProxy::platformOpen): + (WebKit::WebInspectorProxy::platformDidClose): + (WebKit::WebInspectorProxy::platformBringToFront): + (WebKit::WebInspectorProxy::platformIsFront): + (WebKit::WebInspectorProxy::platformInspectedURLChanged): + (WebKit::WebInspectorProxy::inspectorPageURL): + (WebKit::WebInspectorProxy::inspectorBaseURL): + (WebKit::WebInspectorProxy::platformInspectedWindowHeight): + (WebKit::WebInspectorProxy::platformAttach): + (WebKit::WebInspectorProxy::platformDetach): + (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight): + +2012-07-18 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Modify the using of the QImage::Format enum to the appropriate functions from NativeImageQt + https://bugs.webkit.org/show_bug.cgi?id=91600 + + Reviewed by Andreas Kling. + + Use NativeImageQt::defaultFormatForAlphaEnabledImages() and NativeImageQt::defaultFormatForOpaqueImages() + instead of the direct imagetypes at the appropriate places. + + * Shared/qt/ShareableBitmapQt.cpp: + (WebKit::ShareableBitmap::createQImage): + 2012-07-18 Zeno Albisser <zeno@webkit.org> [Qt][WK2] Caching of ShareableSurfaces breaks tiling. diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index 1fc82597c..dedcb83f2 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -49,9 +49,9 @@ ENABLE_CSS_VARIABLES = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; -ENABLE_DATALIST = ; +ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; -ENABLE_DETAILS = ENABLE_DETAILS; +ENABLE_DETAILS_ELEMENT = ENABLE_DETAILS_ELEMENT; ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; @@ -98,7 +98,7 @@ ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; ENABLE_MEDIA_SOURCE = ; ENABLE_MEDIA_STATISTICS = ; -ENABLE_METER_TAG = ENABLE_METER_TAG; +ENABLE_METER_ELEMENT = ENABLE_METER_ELEMENT; ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; @@ -108,7 +108,7 @@ ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; -ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; @@ -135,4 +135,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index 3e2ecaee4..9108bb4c9 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -63,6 +63,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP -I$(srcdir)/Source/WebKit2/WebProcess/Battery \ -I$(srcdir)/Source/WebKit2/WebProcess/Cookies \ -I$(srcdir)/Source/WebKit2/WebProcess/Downloads \ + -I$(srcdir)/Source/WebKit2/WebProcess/Downloads/soup \ -I$(srcdir)/Source/WebKit2/WebProcess/FullScreen \ -I$(srcdir)/Source/WebKit2/WebProcess/Geolocation \ -I$(srcdir)/Source/WebKit2/WebProcess/gtk \ diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index e9348dee9..cfae2d707 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -71,6 +71,7 @@ webkit2_h_api += \ $(WebKit2)/UIProcess/API/C/WKMediaCacheManager.h \ $(WebKit2)/UIProcess/API/C/WKNativeEvent.h \ $(WebKit2)/UIProcess/API/C/WKNavigationData.h \ + $(WebKit2)/UIProcess/API/C/WKNetworkInfo.h \ $(WebKit2)/UIProcess/API/C/WKNetworkInfoManager.h \ $(WebKit2)/UIProcess/API/C/WKNotification.h \ $(WebKit2)/UIProcess/API/C/WKNotificationManager.h \ @@ -104,6 +105,7 @@ webkit2gtk_h_api += \ $(WebKit2)/UIProcess/API/gtk/WebKitError.h \ $(WebKit2)/UIProcess/API/gtk/WebKitFileChooserRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitFindController.h \ + $(WebKit2)/UIProcess/API/gtk/WebKitFormSubmissionRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitHitTestResult.h \ $(WebKit2)/UIProcess/API/gtk/WebKitJavascriptResult.h \ @@ -571,6 +573,8 @@ webkit2_sources += \ Source/WebKit2/UIProcess/API/C/WKNativeEvent.h \ Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp \ Source/WebKit2/UIProcess/API/C/WKNavigationData.h \ + Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp \ + Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h \ Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp \ Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h \ Source/WebKit2/UIProcess/API/C/WKNotification.cpp \ @@ -637,6 +641,11 @@ webkit2_sources += \ Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.h \ Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequestPrivate.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h \ Source/WebKit2/UIProcess/API/gtk/WebKitFullscreenClient.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitFullscreenClient.h \ Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp \ @@ -920,7 +929,9 @@ webkit2_sources += \ Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h \ Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp \ Source/WebKit2/WebProcess/Downloads/DownloadManager.h \ + Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp \ Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp \ + Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h \ Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp \ Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h \ Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp \ diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index db0e45914..97f7095a6 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -37,6 +37,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/API/efl/BatteryProvider.cpp UIProcess/API/efl/PageClientImpl.cpp UIProcess/API/efl/ewk_context.cpp + UIProcess/API/efl/ewk_cookie_manager.cpp UIProcess/API/efl/ewk_intent.cpp UIProcess/API/efl/ewk_intent_service.cpp UIProcess/API/efl/ewk_navigation_policy_decision.cpp @@ -54,7 +55,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/efl/TextCheckerEfl.cpp UIProcess/efl/WebContextEfl.cpp UIProcess/efl/WebFullScreenManagerProxyEfl.cpp - UIProcess/efl/WebInspectorEfl.cpp + UIProcess/efl/WebInspectorProxyEfl.cpp UIProcess/efl/WebPageProxyEfl.cpp UIProcess/efl/WebPreferencesEfl.cpp @@ -70,8 +71,8 @@ LIST(APPEND WebKit2_SOURCES WebProcess/Cookies/soup/WebCookieManagerSoup.cpp WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp - WebProcess/Downloads/efl/DownloadEfl.cpp - WebProcess/Downloads/efl/FileDownloaderEfl.cpp + WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp + WebProcess/Downloads/soup/DownloadSoup.cpp WebProcess/efl/WebProcessEfl.cpp WebProcess/efl/WebProcessMainEfl.cpp @@ -108,7 +109,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES "${WEBKIT2_DIR}/UIProcess/API/C/soup" "${WEBKIT2_DIR}/UIProcess/API/efl" "${WEBKIT2_DIR}/UIProcess/soup" - "${WEBKIT2_DIR}/WebProcess/Downloads/efl" + "${WEBKIT2_DIR}/WebProcess/Downloads/soup" "${WEBKIT2_DIR}/WebProcess/efl" "${WEBKIT2_DIR}/WebProcess/soup" "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl" @@ -172,6 +173,7 @@ CONFIGURE_FILE(efl/ewebkit2.pc.in ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc @O SET (EWebKit2_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/EWebKit2.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_context.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_cookie_manager.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent_service.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h" @@ -209,6 +211,7 @@ SET(WEBKIT2_EFL_TEST_DIR "${WEBKIT2_DIR}/UIProcess/API/efl/tests") SET(TEST_RESOURCES_DIR ${WEBKIT2_EFL_TEST_DIR}/resources) ADD_DEFINITIONS(-DTEST_RESOURCES_DIR=\"${TEST_RESOURCES_DIR}\" + -DTEST_THEME_DIR=\"${THEME_BINARY_DIR}\" -DGTEST_LINKED_AS_SHARED_LIBRARY=1 ) diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp index 6c4d20e64..b627afe24 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp @@ -38,6 +38,8 @@ PlatformPopupMenuData::PlatformPopupMenuData() , m_clientInsetRight(0) , m_popupWidth(0) , m_itemHeight(0) +#elif PLATFORM(QT) + : multipleSelections(false) #endif { } @@ -62,6 +64,8 @@ void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder* encoder) const #elif PLATFORM(MAC) encoder->encode(fontInfo); encoder->encode(shouldPopOver); +#elif PLATFORM(QT) + encoder->encode(multipleSelections); #endif } @@ -95,6 +99,9 @@ bool PlatformPopupMenuData::decode(CoreIPC::ArgumentDecoder* decoder, PlatformPo return false; if (!decoder->decode(data.shouldPopOver)) return false; +#elif PLATFORM(QT) + if (!decoder->decode(data.multipleSelections)) + return false; #endif return true; diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.h b/Source/WebKit2/Shared/PlatformPopupMenuData.h index f85008a8d..21abde4ff 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.h +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.h @@ -55,6 +55,8 @@ struct PlatformPopupMenuData { #elif PLATFORM(MAC) FontInfo fontInfo; bool shouldPopOver; +#elif PLATFORM(QT) + bool multipleSelections; #endif }; diff --git a/Source/WebKit2/Shared/WebPopupItem.cpp b/Source/WebKit2/Shared/WebPopupItem.cpp index a9ac03225..c215f3568 100644 --- a/Source/WebKit2/Shared/WebPopupItem.cpp +++ b/Source/WebKit2/Shared/WebPopupItem.cpp @@ -39,6 +39,7 @@ WebPopupItem::WebPopupItem() , m_textDirection(LTR) , m_hasTextDirectionOverride(false) , m_isEnabled(true) + , m_isSelected(false) { } @@ -48,10 +49,11 @@ WebPopupItem::WebPopupItem(Type type) , m_hasTextDirectionOverride(false) , m_isEnabled(true) , m_isLabel(false) + , m_isSelected(false) { } -WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel) +WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel, bool isSelected) : m_type(type) , m_text(text) , m_textDirection(textDirection) @@ -60,12 +62,14 @@ WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDire , m_accessibilityText(accessibilityText) , m_isEnabled(isEnabled) , m_isLabel(isLabel) + , m_isSelected(isSelected) { } 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)); } bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) @@ -78,10 +82,15 @@ bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) String accessibilityText; bool isEnabled; bool isLabel; + bool isSelected; + if (!decoder->decode(CoreIPC::Out(type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel))) return false; - item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel); + if (!decoder->decode(CoreIPC::Out(isSelected))) + return false; + + item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel, isSelected); return true; } diff --git a/Source/WebKit2/Shared/WebPopupItem.h b/Source/WebKit2/Shared/WebPopupItem.h index 3dc61d77e..d8584bea5 100644 --- a/Source/WebKit2/Shared/WebPopupItem.h +++ b/Source/WebKit2/Shared/WebPopupItem.h @@ -44,7 +44,7 @@ struct WebPopupItem { WebPopupItem(); WebPopupItem(Type); - WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel); + WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel, bool isSelected); void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPopupItem&); @@ -57,6 +57,7 @@ struct WebPopupItem { String m_accessibilityText; bool m_isEnabled; bool m_isLabel; + bool m_isSelected; }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp index b6ceb3e15..88e4d3aec 100644 --- a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp +++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "ShareableBitmap.h" +#include "NativeImageQt.h" #include <QImage> #include <QPainter> #include <QtGlobal> @@ -41,7 +42,7 @@ QImage ShareableBitmap::createQImage() { ref(); // Balanced by deref in releaseSharedMemoryData return QImage(reinterpret_cast<uchar*>(data()), m_size.width(), m_size.height(), m_size.width() * 4, - m_flags & SupportsAlpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32, + m_flags & SupportsAlpha ? NativeImageQt::defaultFormatForAlphaEnabledImages() : NativeImageQt::defaultFormatForOpaqueImages(), releaseSharedMemoryData, this); } diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri index 25d894f7e..80e5a651c 100644 --- a/Source/WebKit2/Target.pri +++ b/Source/WebKit2/Target.pri @@ -167,6 +167,7 @@ HEADERS += \ UIProcess/API/C/WKOpenPanelParameters.h \ UIProcess/API/C/WKOpenPanelResultListener.h \ UIProcess/API/C/WKNavigationData.h \ + UIProcess/API/C/WKNetworkInfo.h \ UIProcess/API/C/WKNetworkInfoManager.h \ UIProcess/API/C/WKNotification.h \ UIProcess/API/C/WKNotificationManager.h \ @@ -547,6 +548,7 @@ SOURCES += \ UIProcess/API/C/WKOpenPanelParameters.cpp \ UIProcess/API/C/WKOpenPanelResultListener.cpp \ UIProcess/API/C/WKNavigationData.cpp \ + UIProcess/API/C/WKNetworkInfo.cpp \ UIProcess/API/C/WKNetworkInfoManager.cpp \ UIProcess/API/C/WKPage.cpp \ UIProcess/API/C/WKPageGroup.cpp \ diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index 7bfc04aed..d168363e8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -189,6 +189,15 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) return toAPI(toImpl(contextRef)->geolocationManagerProxy()); } +WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef contextRef) +{ +#if ENABLE(NETWORK_INFO) + return toAPI(toImpl(contextRef)->networkInfoManagerProxy()); +#else + return 0; +#endif +} + WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->iconDatabase()); @@ -219,6 +228,15 @@ WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef contextR return toAPI(toImpl(contextRef)->resourceCacheManagerProxy()); } +WKVibrationRef WKContextGetVibration(WKContextRef contextRef) +{ +#if ENABLE(VIBRATION) + return toAPI(toImpl(contextRef)->vibrationProxy()); +#else + return 0; +#endif +} + void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) { toImpl(contextRef)->startMemorySampler(toImpl(interval)->value()); diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index 85e4c157c..412227de7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -155,9 +155,11 @@ WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef co WK_EXPORT WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef context); WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context); WK_EXPORT WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef context); +WK_EXPORT WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef context); WK_EXPORT WKNotificationManagerRef WKContextGetNotificationManager(WKContextRef context); WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context); WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context); +WK_EXPORT WKVibrationRef WKContextGetVibration(WKContextRef context); typedef void (*WKContextGetStatisticsFunction)(WKDictionaryRef statistics, WKErrorRef error, void* functionContext); WK_EXPORT void WKContextGetStatistics(WKContextRef context, void* functionContext, WKContextGetStatisticsFunction function); diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp new file mode 100644 index 000000000..a9bfd3cb1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp @@ -0,0 +1,53 @@ +/* + * 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 "WKNetworkInfo.h" + +#if ENABLE(NETWORK_INFO) +#include "WKAPICast.h" +#include "WebNetworkInfo.h" + +using namespace WebKit; +#endif + +WKTypeID WKNetworkInfoGetTypeID() +{ +#if ENABLE(NETWORK_INFO) + return toAPI(WebNetworkInfo::APIType); +#else + return 0; +#endif +} + +WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered) +{ +#if ENABLE(NETWORK_INFO) + RefPtr<WebNetworkInfo> networkInfo = WebNetworkInfo::create(bandwidth, isMetered); + return toAPI(networkInfo.release().leakRef()); +#else + return 0; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h new file mode 100644 index 000000000..cff864a75 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h @@ -0,0 +1,43 @@ +/* + * 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 WKNetworkInfo_h +#define WKNetworkInfo_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKNetworkInfoGetTypeID(); + +WK_EXPORT WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered); + +#ifdef __cplusplus +} +#endif + +#endif // WKNetworkInfo_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp index 1e0733ac2..85620ad61 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp @@ -39,3 +39,17 @@ WKTypeID WKNetworkInfoManagerGetTypeID() return 0; #endif } + +void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider) +{ +#if ENABLE(NETWORK_INFO) + toImpl(networkInfoManager)->initializeProvider(provider); +#endif +} + +void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo) +{ +#if ENABLE(NETWORK_INFO) + toImpl(networkInfoManager)->providerDidChangeNetworkInformation(AtomicString(toImpl(eventType)->string()), toImpl(networkInfo)); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h index efecf4ef8..dd92eb868 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h @@ -52,6 +52,10 @@ enum { kWKNetworkInfoProviderCurrentVersion = 0 }; WK_EXPORT WKTypeID WKNetworkInfoManagerGetTypeID(); +WK_EXPORT void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider); + +WK_EXPORT void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h index 8fa90aeb9..d7d796368 100644 --- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h +++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h @@ -28,6 +28,7 @@ #define EWebKit2_h #include "ewk_context.h" +#include "ewk_cookie_manager.h" #include "ewk_intent.h" #include "ewk_intent_service.h" #include "ewk_navigation_policy_decision.h" diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp index e1ccff23b..21c157c22 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp @@ -25,20 +25,40 @@ #include "WKAPICast.h" #include "WKRetainPtr.h" #include "ewk_context_private.h" +#include "ewk_cookie_manager_private.h" using namespace WebKit; struct _Ewk_Context { WKRetainPtr<WKContextRef> context; + + Ewk_Cookie_Manager* cookieManager; #if ENABLE(BATTERY_STATUS) RefPtr<BatteryProvider> batteryProvider; #endif _Ewk_Context(WKContextRef contextRef) : context(contextRef) + , cookieManager(0) { } + + ~_Ewk_Context() + { + if (cookieManager) + ewk_cookie_manager_free(cookieManager); + } }; +Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* ewkContext) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0); + + if (!ewkContext->cookieManager) + const_cast<Ewk_Context*>(ewkContext)->cookieManager = ewk_cookie_manager_new(WKContextGetCookieManager(ewkContext->context.get())); + + return ewkContext->cookieManager; +} + WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext) { return ewkContext->context.get(); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.h b/Source/WebKit2/UIProcess/API/efl/ewk_context.h index 794d05204..e89037766 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.h @@ -29,6 +29,7 @@ #ifndef ewk_context_h #define ewk_context_h +#include "ewk_cookie_manager.h" #include <Evas.h> #ifdef __cplusplus @@ -45,6 +46,15 @@ typedef struct _Ewk_Context Ewk_Context; */ EAPI Ewk_Context *ewk_context_default_get(); +/** + * Gets the cookie manager instance for this @a context. + * + * @param context context object to query. + * + * @return Ewk_Cookie_Manager object instance or @c NULL in case of failure. + */ +EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *context); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp new file mode 100644 index 000000000..02f1fbd76 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp @@ -0,0 +1,197 @@ +/* + * 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 "ewk_cookie_manager.h" + +#include "SoupCookiePersistentStorageType.h" +#include "WKAPICast.h" +#include "WKArray.h" +#include "WKCookieManager.h" +#include "WKRetainPtr.h" +#include "WKString.h" +#include "WebCookieManagerProxy.h" +#include "ewk_private.h" +#include "ewk_web_error_private.h" +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +/** + * \struct _Ewk_Cookie_Manager + * @brief Contains the cookie manager data. + */ +struct _Ewk_Cookie_Manager { + WKRetainPtr<WKCookieManagerRef> wkCookieManager; + + _Ewk_Cookie_Manager(WKCookieManagerRef cookieManagerRef) + : wkCookieManager(cookieManagerRef) + { } +}; + +#define EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager_, ...) \ + if (!(manager)) { \ + EINA_LOG_CRIT("manager is NULL."); \ + return __VA_ARGS__; \ + } \ + if (!(manager)->wkCookieManager) { \ + EINA_LOG_CRIT("manager->wkCookieManager is NULL."); \ + return __VA_ARGS__; \ + } \ + WKCookieManagerRef wkManager_ = (manager)->wkCookieManager.get() + +// Ewk_Cookie_Accept_Policy enum validation +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, kWKHTTPCookieAcceptPolicyAlways); +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_ACCEPT_POLICY_NEVER, kWKHTTPCookieAcceptPolicyNever); +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY, kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain); + +// Ewk_Cookie_Persistent_Storage enum validation +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText); +COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite); + +void ewk_cookie_manager_persistent_storage_set(Ewk_Cookie_Manager* manager, const char* filename, Ewk_Cookie_Persistent_Storage storage) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(filename); + + toImpl(wkManager)->setCookiePersistentStorage(String::fromUTF8(filename), storage); +} + +void ewk_cookie_manager_accept_policy_set(Ewk_Cookie_Manager* manager, Ewk_Cookie_Accept_Policy policy) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + + WKCookieManagerSetHTTPCookieAcceptPolicy(wkManager, static_cast<WKHTTPCookieAcceptPolicy>(policy)); +} + +struct Get_Policy_Async_Data { + Ewk_Cookie_Manager_Async_Policy_Get_Cb callback; + void* userData; +}; + +static void getAcceptPolicyCallback(WKHTTPCookieAcceptPolicy policy, WKErrorRef wkError, void* data) +{ + Get_Policy_Async_Data* callbackData = static_cast<Get_Policy_Async_Data*>(data); + Ewk_Web_Error* ewkError = wkError ? ewk_web_error_new(wkError) : 0; + + callbackData->callback(static_cast<Ewk_Cookie_Accept_Policy>(policy), ewkError, callbackData->userData); + + if (ewkError) + ewk_web_error_free(ewkError); + delete callbackData; +} + +void ewk_cookie_manager_async_accept_policy_get(const Ewk_Cookie_Manager* manager, Ewk_Cookie_Manager_Async_Policy_Get_Cb callback, void* data) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(callback); + + Get_Policy_Async_Data* callbackData = new Get_Policy_Async_Data; + callbackData->callback = callback; + callbackData->userData = data; + + WKCookieManagerGetHTTPCookieAcceptPolicy(wkManager, callbackData, getAcceptPolicyCallback); +} + +struct Get_Hostnames_Async_Data { + Ewk_Cookie_Manager_Async_Hostnames_Get_Cb callback; + void* userData; +}; + +static void getHostnamesWithCookiesCallback(WKArrayRef wkHostnames, WKErrorRef wkError, void* context) +{ + Eina_List* hostnames = 0; + Get_Hostnames_Async_Data* callbackData = static_cast<Get_Hostnames_Async_Data*>(context); + Ewk_Web_Error* ewkError = wkError ? ewk_web_error_new(wkError) : 0; + + const size_t hostnameCount = WKArrayGetSize(wkHostnames); + for (size_t i = 0; i < hostnameCount; ++i) { + WKStringRef wkHostname = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkHostnames, i)); + String hostname = toImpl(wkHostname)->string(); + if (hostname.isEmpty()) + continue; + hostnames = eina_list_append(hostnames, eina_stringshare_add(hostname.utf8().data())); + } + + callbackData->callback(hostnames, ewkError, callbackData->userData); + + void* item; + EINA_LIST_FREE(hostnames, item) + eina_stringshare_del(static_cast<Eina_Stringshare*>(item)); + if (ewkError) + ewk_web_error_free(ewkError); + delete callbackData; +} + +void ewk_cookie_manager_async_hostnames_with_cookies_get(const Ewk_Cookie_Manager* manager, Ewk_Cookie_Manager_Async_Hostnames_Get_Cb callback, void* data) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(callback); + + Get_Hostnames_Async_Data* callbackData = new Get_Hostnames_Async_Data; + callbackData->callback = callback; + callbackData->userData = data; + + WKCookieManagerGetHostnamesWithCookies(wkManager, callbackData, getHostnamesWithCookiesCallback); +} + +void ewk_cookie_manager_hostname_cookies_clear(Ewk_Cookie_Manager* manager, const char* hostName) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + EINA_SAFETY_ON_NULL_RETURN(hostName); + + WKRetainPtr<WKStringRef> wkHostName(AdoptWK, WKStringCreateWithUTF8CString(hostName)); + WKCookieManagerDeleteCookiesForHostname(wkManager, wkHostName.get()); +} + +void ewk_cookie_manager_cookies_clear(Ewk_Cookie_Manager* manager) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + + WKCookieManagerDeleteAllCookies(wkManager); +} + +/** + * @internal + * Frees a Ewk_Cookie_Manager object. + */ +void ewk_cookie_manager_free(Ewk_Cookie_Manager* manager) +{ + EINA_SAFETY_ON_NULL_RETURN(manager); + + delete manager; +} + +/** + * @internal + * Constructs a Ewk_Cookie_Manager from a WKCookieManagerRef. + */ +Ewk_Cookie_Manager* ewk_cookie_manager_new(WKCookieManagerRef wkCookieManager) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wkCookieManager, 0); + + return new Ewk_Cookie_Manager(wkCookieManager); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h new file mode 100644 index 000000000..442c4f7ca --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h @@ -0,0 +1,157 @@ +/* + * 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. + */ + +/** + * @file ewk_cookie_manager.h + * @brief Describes the Ewk Cookie Manager API. + */ + +#ifndef ewk_cookie_manager_h +#define ewk_cookie_manager_h + +#include "ewk_web_error.h" +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Cookie_Manager */ +typedef struct _Ewk_Cookie_Manager Ewk_Cookie_Manager; + +/** + * \enum _Ewk_Cookie_Accept_Policy + * + * @brief Contains accept policies for the cookies. + */ +enum _Ewk_Cookie_Accept_Policy { + /// Accepts every cookie sent from any page. + EWK_COOKIE_ACCEPT_POLICY_ALWAYS, + /// Rejects all cookies. + EWK_COOKIE_ACCEPT_POLICY_NEVER, + /// Accepts cookies only from the main page. + EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY +}; + +/// Creates a type name for the _Ewk_Cookie_Accept_Policy. +typedef enum _Ewk_Cookie_Accept_Policy Ewk_Cookie_Accept_Policy; + +/** + * \enum _Ewk_Cookie_Persistent_Storage + * + * @brief Enum values to denote cookies persistent storage type. + */ +enum _Ewk_Cookie_Persistent_Storage { + /// Cookies are stored in a text file in the Mozilla "cookies.txt" format. + EWK_COOKIE_PERSISTENT_STORAGE_TEXT, + /// Cookies are stored in a SQLite file in the current Mozilla format. + EWK_COOKIE_PERSISTENT_STORAGE_SQLITE +}; + +/// Creates a type name for the _Ewk_Cookie_Persistent_Storage. +typedef enum _Ewk_Cookie_Persistent_Storage Ewk_Cookie_Persistent_Storage; + +/** + * @typedef Ewk_Cookie_Manager_Async_Policy_Get_Cb Ewk_Cookie_Manager_Async_Policy_Get_Cb + * @brief Callback type for use with ewk_cookie_manager_async_accept_policy_get + */ +typedef void (*Ewk_Cookie_Manager_Async_Policy_Get_Cb)(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *error, void *event_info); + +/** + * @typedef Ewk_Cookie_Manager_Async_Hostnames_Get_Cb Ewk_Cookie_Manager_Async_Hostnames_Get_Cb + * @brief Callback type for use with ewk_cookie_manager_async_hostnames_with_cookies_get + * + * @note The @a hostnames list items are guaranteed to be eina_stringshare. Whenever possible + * save yourself some cpu cycles and use eina_stringshare_ref() instead of eina_stringshare_add() + * or strdup(). + */ +typedef void (*Ewk_Cookie_Manager_Async_Hostnames_Get_Cb)(Eina_List* hostnames, Ewk_Web_Error *error, void *event_info); + +/** + * Set the @a filename where non-session cookies are stored persistently using @a storage as the format to read/write the cookies. + * + * Cookies are initially read from @filename to create an initial set of cookies. + * Then, non-session cookies will be written to @filename. + * + * By default, @a manager doesn't store the cookies persistenly, so you need to call this + * method to keep cookies saved across sessions. + * + * @param cookie_manager The cookie manager to update. + * @param filename the filename to read to/write from. + * @param storage the type of storage. + */ +EAPI void ewk_cookie_manager_persistent_storage_set(Ewk_Cookie_Manager *manager, const char *filename, Ewk_Cookie_Persistent_Storage storage); + +/** + * Set @a policy as the cookie acceptance policy for @a manager. + * + * By default, cookies are always accepted. + * + * @param manager The cookie manager to update. + * @param policy a #Ewk_Cookie_Accept_Policy + */ + +EAPI void ewk_cookie_manager_accept_policy_set(Ewk_Cookie_Manager *manager, Ewk_Cookie_Accept_Policy policy); + +/** + * Asynchronously get the cookie acceptance policy of @a manager. + * + * By default, cookies are always accepted. + * + * @param manager The cookie manager to query. + * @param callback The function to call when the policy is received or an error occured. + * @param data User data (may be @c NULL). + */ +EAPI void ewk_cookie_manager_async_accept_policy_get(const Ewk_Cookie_Manager *manager, Ewk_Cookie_Manager_Async_Policy_Get_Cb callback, void *data); + +/** + * Asynchronously get the list of host names for which @a manager contains cookies. + * + * @param manager The cookie manager to query. + * @param callback The function to call when the host names have been received. + * @param data User data (may be @c NULL). + */ +EAPI void ewk_cookie_manager_async_hostnames_with_cookies_get(const Ewk_Cookie_Manager *manager, Ewk_Cookie_Manager_Async_Hostnames_Get_Cb callback, void *data); + +/** + * Remove all cookies of @a manager for the given @a hostname. + * + * @param manager The cookie manager to update. + * @param hostname A host name. + */ +EAPI void ewk_cookie_manager_hostname_cookies_clear(Ewk_Cookie_Manager *manager, const char *hostname); + +/** + * Delete all cookies of @a manager. + * + * @param manager The cookie manager to update. + */ +EAPI void ewk_cookie_manager_cookies_clear(Ewk_Cookie_Manager *manager); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_cookie_manager_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h new file mode 100644 index 000000000..64285c981 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h @@ -0,0 +1,36 @@ +/* + * 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_cookie_manager_private_h +#define ewk_cookie_manager_private_h + +#include <WebKit2/WKBase.h> + +typedef struct _Ewk_Cookie_Manager Ewk_Cookie_Manager; + +Ewk_Cookie_Manager* ewk_cookie_manager_new(WKCookieManagerRef wkCookieManager); +void ewk_cookie_manager_free(Ewk_Cookie_Manager* manager); + +#endif // ewk_cookie_manager_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 8b7132b48..3f80aa11d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -27,6 +27,7 @@ #include "PageClientImpl.h" #include "WKAPICast.h" #include "WKRetainPtr.h" +#include "WKString.h" #include "WKURL.h" #include "ewk_context.h" #include "ewk_context_private.h" @@ -50,12 +51,14 @@ struct _Ewk_View_Private_Data { const char* uri; const char* title; const char* theme; + const char* customEncoding; LoadingResourcesMap loadingResourcesMap; _Ewk_View_Private_Data() : uri(0) , title(0) , theme(0) + , customEncoding(0) { } ~_Ewk_View_Private_Data() @@ -63,6 +66,7 @@ struct _Ewk_View_Private_Data { eina_stringshare_del(uri); eina_stringshare_del(title); eina_stringshare_del(theme); + eina_stringshare_del(customEncoding); } }; @@ -960,3 +964,27 @@ WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView) return priv->pageClient->page(); } + +const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + + WKRetainPtr<WKStringRef> wkEncodingName(AdoptWK, WKPageCopyCustomTextEncodingName(toAPI(priv->pageClient->page()))); + if (WKStringIsEmpty(wkEncodingName.get())) + return 0; + + eina_stringshare_replace(&priv->customEncoding, toImpl(wkEncodingName.get())->string().utf8().data()); + return priv->customEncoding; +} + +Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* encoding) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + WKRetainPtr<WKStringRef> wkEncodingName = encoding ? adoptWK(WKStringCreateWithUTF8CString(encoding)) : 0; + if (eina_stringshare_replace(&priv->customEncoding, encoding)) + WKPageSetCustomTextEncodingName(toAPI(priv->pageClient->page()), wkEncodingName.get()); + return true; +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index fe3f10675..6a8e74f82 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -420,6 +420,26 @@ EAPI void ewk_view_theme_set(Evas_Object *o, const char *path); */ EAPI const char *ewk_view_theme_get(const Evas_Object *o); +/** + * Gets the current custom character encoding name. + * + * @param o view object to get the current encoding + * + * @return @c eina_strinshare containing the current encoding, or + * @c NULL if it's not set + */ +EAPI const char *ewk_view_setting_encoding_custom_get(const Evas_Object *o); + +/** + * Sets the custom character encoding and reloads the page. + * + * @param o view to set the encoding + * @param encoding the new encoding to set or @c NULL to restore the default one + * + * @return @c EINA_TRUE on success @c EINA_FALSE otherwise + */ +EAPI Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object *o, const char *encoding); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp index f16fb2cc3..e6e3eb891 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "ewk_web_error.h" +#include "ErrorsEfl.h" #include "WKString.h" #include "WKURL.h" #include "ewk_web_error_private.h" @@ -34,11 +35,9 @@ #include <WKRetainPtr.h> #include <wtf/text/CString.h> +using namespace WebCore; using namespace WebKit; -// Copied from ErrorsGtk.h which is used by DownloadSoup.cpp. -static const char errorDomainDownload[] = "WebKitDownloadError"; - struct _Ewk_Web_Error { WKRetainPtr<WKErrorRef> wkError; @@ -83,12 +82,16 @@ Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error) WKRetainPtr<WKStringRef> wkDomain(AdoptWK, WKErrorCopyDomain(wkError)); WTF::String errorDomain = toWTFString(wkDomain.get()); - if (errorDomain == String(g_quark_to_string(SOUP_HTTP_ERROR))) - return EWK_WEB_ERROR_TYPE_HTTP; - if (errorDomain == String(g_quark_to_string(G_IO_ERROR))) - return EWK_WEB_ERROR_TYPE_IO; + if (errorDomain == errorDomainNetwork) + return EWK_WEB_ERROR_TYPE_NETWORK; + if (errorDomain == errorDomainPolicy) + return EWK_WEB_ERROR_TYPE_POLICY; + if (errorDomain == errorDomainPlugin) + return EWK_WEB_ERROR_TYPE_PLUGIN; if (errorDomain == errorDomainDownload) return EWK_WEB_ERROR_TYPE_DOWNLOAD; + if (errorDomain == errorDomainPrint) + return EWK_WEB_ERROR_TYPE_PRINT; return EWK_WEB_ERROR_TYPE_INTERNAL; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h index 2d9666581..4ba0c7acd 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h @@ -44,9 +44,11 @@ typedef struct _Ewk_Web_Error Ewk_Web_Error; typedef enum { EWK_WEB_ERROR_TYPE_NONE, EWK_WEB_ERROR_TYPE_INTERNAL, - EWK_WEB_ERROR_TYPE_HTTP, - EWK_WEB_ERROR_TYPE_IO, - EWK_WEB_ERROR_TYPE_DOWNLOAD + EWK_WEB_ERROR_TYPE_NETWORK, + EWK_WEB_ERROR_TYPE_POLICY, + EWK_WEB_ERROR_TYPE_PLUGIN, + EWK_WEB_ERROR_TYPE_DOWNLOAD, + EWK_WEB_ERROR_TYPE_PRINT } Ewk_Web_Error_Type; /** diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp index b96643049..05168e26d 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp @@ -29,19 +29,17 @@ extern EWK2UnitTest::EWK2UnitTestEnvironment* environment; namespace EWK2UnitTest { -static void onLoadProgress(void* userData, Evas_Object* webView, void* eventInfo) +static void onLoadFinished(void* userData, Evas_Object* webView, void* eventInfo) { UNUSED_PARAM(webView); + UNUSED_PARAM(eventInfo); - EWK2UnitTestBase* test = static_cast<EWK2UnitTestBase*>(userData); - double progress = *static_cast<double*>(eventInfo); - - test->setLoadProgress(progress); + bool* loadFinished = static_cast<bool*>(userData); + *loadFinished = true; } EWK2UnitTestBase::EWK2UnitTestBase() - : m_loadProgress(0) - , m_ecoreEvas(0) + : m_ecoreEvas(0) , m_webView(0) { } @@ -62,6 +60,8 @@ void EWK2UnitTestBase::SetUp() Evas* evas = ecore_evas_get(m_ecoreEvas); m_webView = ewk_view_add(evas); + ewk_view_theme_set(m_webView, environment->defaultTheme()); + evas_object_resize(m_webView, width, height); evas_object_show(m_webView); evas_object_focus_set(m_webView, true); @@ -76,15 +76,15 @@ void EWK2UnitTestBase::TearDown() void EWK2UnitTestBase::loadUrlSync(const char* url) { - m_loadProgress = 0; + bool loadFinished = false; - evas_object_smart_callback_add(m_webView, "load,progress", onLoadProgress, this); + evas_object_smart_callback_add(m_webView, "load,finished", onLoadFinished, &loadFinished); ewk_view_uri_set(m_webView, url); - while (m_loadProgress != 1) + while (!loadFinished) ecore_main_loop_iterate(); - evas_object_smart_callback_del(m_webView, "load,progress", onLoadProgress); + evas_object_smart_callback_del(m_webView, "load,finished", onLoadFinished); } } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h index 794688140..8fa1b5021 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h @@ -28,7 +28,6 @@ namespace EWK2UnitTest { class EWK2UnitTestBase : public ::testing::Test { public: - void setLoadProgress(float progress) { m_loadProgress = progress; } Evas_Object* webView() { return m_webView; } protected: @@ -42,8 +41,6 @@ protected: private: Evas_Object* m_webView; Ecore_Evas* m_ecoreEvas; - - float m_loadProgress; }; } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp index 61cb53e0f..e7bc0d621 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp @@ -34,4 +34,9 @@ const char* EWK2UnitTestEnvironment::defaultTestPageUrl() const return "file://"TEST_RESOURCES_DIR"/default_test_page.html"; } +const char* EWK2UnitTestEnvironment::defaultTheme() const +{ + return TEST_THEME_DIR"/default.edj"; +} + } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h index 9e076bea0..fac0f5988 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h @@ -29,6 +29,7 @@ public: bool useX11Window() const { return m_useX11Window; } const char* defaultTestPageUrl() const; + const char* defaultTheme() const; virtual unsigned int defaultWidth() const { return m_defaultWidth; } virtual unsigned int defaultHeight() const { return m_defaultHeight; } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp new file mode 100644 index 000000000..fd5be3daf --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebKitFormClient.h" + +#include "WebKitFormSubmissionRequestPrivate.h" +#include "WebKitPrivate.h" +#include "WebKitWebViewBasePrivate.h" +#include "WebKitWebViewPrivate.h" +#include <wtf/gobject/GRefPtr.h> + +using namespace WebKit; + +static void willSubmitForm(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo) +{ + GRefPtr<WebKitFormSubmissionRequest> request = adoptGRef(webkitFormSubmissionRequestCreate(values, listener)); + webkitWebViewSubmitFormRequest(WEBKIT_WEB_VIEW(clientInfo), request.get()); +} + +void attachFormClientToView(WebKitWebView* webView) +{ + WKPageFormClient wkFormClient = { + kWKPageFormClientCurrentVersion, + webView, // clientInfo + willSubmitForm + }; + WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); + WKPageSetPageFormClient(wkPage, &wkFormClient); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h new file mode 100644 index 000000000..a37022731 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebKitFormClient_h +#define WebKitFormClient_h + +#include "WebKitWebView.h" + +void attachFormClientToView(WebKitWebView*); + +#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp new file mode 100644 index 000000000..40e2d17f1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebKitFormSubmissionRequest.h" + +#include "WebKitFormSubmissionRequestPrivate.h" +#include <wtf/gobject/GRefPtr.h> +#include <wtf/text/CString.h> + +using namespace WebKit; + +G_DEFINE_TYPE(WebKitFormSubmissionRequest, webkit_form_submission_request, G_TYPE_OBJECT) + +struct _WebKitFormSubmissionRequestPrivate { + WKRetainPtr<WKDictionaryRef> wkValues; + WKRetainPtr<WKFormSubmissionListenerRef> wkListener; + GRefPtr<GHashTable> values; + bool handledRequest; +}; + +static void webkit_form_submission_request_init(WebKitFormSubmissionRequest* request) +{ + WebKitFormSubmissionRequestPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(request, WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequestPrivate); + request->priv = priv; + new (priv) WebKitFormSubmissionRequestPrivate(); +} + +static void webkitFormSubmissionRequestFinalize(GObject* object) +{ + WebKitFormSubmissionRequest* request = WEBKIT_FORM_SUBMISSION_REQUEST(object); + + // Make sure the request is always handled before finalizing. + if (!request->priv->handledRequest) + webkit_form_submission_request_submit(request); + + request->priv->~WebKitFormSubmissionRequestPrivate(); + G_OBJECT_CLASS(webkit_form_submission_request_parent_class)->finalize(object); +} + +static void webkit_form_submission_request_class_init(WebKitFormSubmissionRequestClass* requestClass) +{ + GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); + objectClass->finalize = webkitFormSubmissionRequestFinalize; + g_type_class_add_private(requestClass, sizeof(WebKitFormSubmissionRequestPrivate)); +} + +WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(WKDictionaryRef wkValues, WKFormSubmissionListenerRef wkListener) +{ + WebKitFormSubmissionRequest* request = WEBKIT_FORM_SUBMISSION_REQUEST(g_object_new(WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, NULL)); + request->priv->wkValues = wkValues; + request->priv->wkListener = wkListener; + return request; +} + +/** + * webkit_form_submission_request_get_text_fields: + * @request: a #WebKitFormSubmissionRequest + * + * Get a #GHashTable with the values of the text fields contained in the form + * associated to @request. + * + * Returns: (transfer none): a #GHashTable with the form text fields, or %NULL if the + * form doesn't contain text fields. + */ +GHashTable* webkit_form_submission_request_get_text_fields(WebKitFormSubmissionRequest* request) +{ + g_return_val_if_fail(WEBKIT_IS_FORM_SUBMISSION_REQUEST(request), 0); + + if (request->priv->values) + return request->priv->values.get(); + + if (!WKDictionaryGetSize(request->priv->wkValues.get())) + return 0; + + request->priv->values = adoptGRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free)); + + WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(request->priv->wkValues.get())); + for (size_t i = 0; i < WKArrayGetSize(wkKeys.get()); ++i) { + WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i)); + WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(request->priv->wkValues.get(), wkKey)); + g_hash_table_insert(request->priv->values.get(), g_strdup(toImpl(wkKey)->string().utf8().data()), g_strdup(toImpl(wkValue)->string().utf8().data())); + } + + request->priv->wkValues = 0; + + return request->priv->values.get(); +} + +/** + * webkit_form_submission_request_submit: + * @request: a #WebKitFormSubmissionRequest + * + * Continue the form submission. + */ +void webkit_form_submission_request_submit(WebKitFormSubmissionRequest* request) +{ + g_return_if_fail(WEBKIT_IS_FORM_SUBMISSION_REQUEST(request)); + + WKFormSubmissionListenerContinue(request->priv->wkListener.get()); + request->priv->handledRequest = true; +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h new file mode 100644 index 000000000..910a81c6d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) +#error "Only <webkit2/webkit2.h> can be included directly." +#endif + +#ifndef WebKitFormSubmissionRequest_h +#define WebKitFormSubmissionRequest_h + +#include <glib-object.h> +#include <webkit2/WebKitDefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_FORM_SUBMISSION_REQUEST (webkit_form_submission_request_get_type()) +#define WEBKIT_FORM_SUBMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequest)) +#define WEBKIT_IS_FORM_SUBMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST)) +#define WEBKIT_FORM_SUBMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequestClass)) +#define WEBKIT_IS_FORM_SUBMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST)) +#define WEBKIT_FORM_SUBMISSION_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, WebKitFormSubmissionRequestClass)) + +typedef struct _WebKitFormSubmissionRequest WebKitFormSubmissionRequest; +typedef struct _WebKitFormSubmissionRequestClass WebKitFormSubmissionRequestClass; +typedef struct _WebKitFormSubmissionRequestPrivate WebKitFormSubmissionRequestPrivate; + +struct _WebKitFormSubmissionRequest { + GObject parent; + + /*< private >*/ + WebKitFormSubmissionRequestPrivate *priv; +}; + +struct _WebKitFormSubmissionRequestClass { + GObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_form_submission_request_get_type (void); + +WEBKIT_API GHashTable * +webkit_form_submission_request_get_text_fields (WebKitFormSubmissionRequest *request); + +WEBKIT_API void +webkit_form_submission_request_submit (WebKitFormSubmissionRequest *request); + +G_END_DECLS + +#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h new file mode 100644 index 000000000..ad4a6190b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebKitFormSubmissionRequestPrivate_h +#define WebKitFormSubmissionRequestPrivate_h + +#include "WebKitFormSubmissionRequest.h" +#include "WebKitPrivate.h" + +WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(WKDictionaryRef, WKFormSubmissionListenerRef); + +#endif // WebKitFormSubmissionRequestPrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 8bfabeec6..8bf4d8fe0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -29,6 +29,7 @@ #include "WebKitContextMenuPrivate.h" #include "WebKitEnumTypes.h" #include "WebKitError.h" +#include "WebKitFormClient.h" #include "WebKitFullscreenClient.h" #include "WebKitHitTestResultPrivate.h" #include "WebKitJavascriptResultPrivate.h" @@ -90,6 +91,8 @@ enum { CONTEXT_MENU, CONTEXT_MENU_DISMISSED, + SUBMIT_FORM, + LAST_SIGNAL }; @@ -325,6 +328,7 @@ static void webkitWebViewConstructed(GObject* object) attachResourceLoadClientToView(webView); attachFullScreenClientToView(webView); attachContextMenuClientToView(webView); + attachFormClientToView(webView); WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase); priv->backForwardList = adoptGRef(webkitBackForwardListCreate(WKPageGetBackForwardList(toAPI(page)))); @@ -1060,6 +1064,33 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) 0, 0, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + /** + * WebKitWebView::submit-form: + * @web_view: the #WebKitWebView on which the signal is emitted + * @request: a #WebKitFormSubmissionRequest + * + * This signal is emitted when a form is about to be submitted. The @request + * argument passed contains information about the text fields of the form. This + * is typically used to store login information that can be used later to + * pre-fill the form. + * The form will not be submitted until webkit_form_submission_request_submit() is called. + * + * It is possible to handle the form submission request asynchronously, by + * simply calling g_object_ref() on the @request argument and calling + * webkit_form_submission_request_submit() when done to continue with the form submission. + * If the last reference is removed on a #WebKitFormSubmissionRequest and the + * form has not been submitted, webkit_form_submission_request_submit() will be called. + */ + signals[SUBMIT_FORM] = + g_signal_new("submit-form", + G_TYPE_FROM_CLASS(webViewClass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(WebKitWebViewClass, submit_form), + 0, 0, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + WEBKIT_TYPE_FORM_SUBMISSION_REQUEST); } static bool updateReplaceContentStatus(WebKitWebView* webView, WebKitLoadEvent loadEvent) @@ -1250,7 +1281,7 @@ void webkitWebViewResourceLoadStarted(WebKitWebView* webView, WKFrameRef wkFrame WebKitWebViewPrivate* priv = webView->priv; WebKitWebResource* resource = webkitWebResourceCreate(wkFrame, request, isMainResource); - if (WKFrameIsMainFrame(wkFrame) && isMainResource) + if (WKFrameIsMainFrame(wkFrame) && (isMainResource || !priv->mainResource)) priv->mainResource = resource; priv->loadingResourcesMap.set(resourceIdentifier, adoptGRef(resource)); g_signal_emit(webView, signals[RESOURCE_LOAD_STARTED], 0, resource, request); @@ -1388,6 +1419,11 @@ void webkitWebViewPopulateContextMenu(WebKitWebView* webView, WKArrayRef wkPropo webkit_context_menu_remove_all(contextMenu.get()); } +void webkitWebViewSubmitFormRequest(WebKitWebView* webView, WebKitFormSubmissionRequest* request) +{ + g_signal_emit(webView, signals[SUBMIT_FORM], 0, request); +} + /** * webkit_web_view_new: * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index bac32a78e..2553b1840 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -33,6 +33,7 @@ #include <webkit2/WebKitDefines.h> #include <webkit2/WebKitFileChooserRequest.h> #include <webkit2/WebKitFindController.h> +#include <webkit2/WebKitFormSubmissionRequest.h> #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> #include <webkit2/WebKitPermissionRequest.h> @@ -127,43 +128,45 @@ struct _WebKitWebView { struct _WebKitWebViewClass { WebKitWebViewBaseClass parent; - void (* load_changed) (WebKitWebView *web_view, - WebKitLoadEvent load_event); - gboolean (* load_failed) (WebKitWebView *web_view, - WebKitLoadEvent load_event, - const gchar *failing_uri, - GError *error); - - GtkWidget *(* create) (WebKitWebView *web_view); - void (* ready_to_show) (WebKitWebView *web_view); - void (* run_as_modal) (WebKitWebView *web_view); - void (* close) (WebKitWebView *web_view); - - gboolean (* script_dialog) (WebKitWebView *web_view, - WebKitScriptDialog *dialog); - - gboolean (* decide_policy) (WebKitWebView *web_view, - WebKitPolicyDecision *decision, - WebKitPolicyDecisionType type); - gboolean (* permission_request) (WebKitWebView *web_view, - WebKitPermissionRequest *permission_request); - void (* mouse_target_changed) (WebKitWebView *web_view, - WebKitHitTestResult *hit_test_result, - guint modifiers); - gboolean (* print_requested) (WebKitWebView *web_view, - WebKitPrintOperation *print_operation); - void (* resource_load_started) (WebKitWebView *web_view, - WebKitWebResource *resource, - WebKitURIRequest *request); - gboolean (* enter_fullscreen) (WebKitWebView *web_view); - gboolean (* leave_fullscreen) (WebKitWebView *web_view); - gboolean (* run_file_chooser) (WebKitWebView *web_view, - WebKitFileChooserRequest *request); - gboolean (* context_menu) (WebKitWebView *web_view, - WebKitContextMenu *context_menu, - GdkEvent *event, - WebKitHitTestResult *hit_test_result); - void (* context_menu_dismissed) (WebKitWebView *web_view); + void (* load_changed) (WebKitWebView *web_view, + WebKitLoadEvent load_event); + gboolean (* load_failed) (WebKitWebView *web_view, + WebKitLoadEvent load_event, + const gchar *failing_uri, + GError *error); + + GtkWidget *(* create) (WebKitWebView *web_view); + void (* ready_to_show) (WebKitWebView *web_view); + void (* run_as_modal) (WebKitWebView *web_view); + void (* close) (WebKitWebView *web_view); + + gboolean (* script_dialog) (WebKitWebView *web_view, + WebKitScriptDialog *dialog); + + gboolean (* decide_policy) (WebKitWebView *web_view, + WebKitPolicyDecision *decision, + WebKitPolicyDecisionType type); + gboolean (* permission_request) (WebKitWebView *web_view, + WebKitPermissionRequest *permission_request); + void (* mouse_target_changed) (WebKitWebView *web_view, + WebKitHitTestResult *hit_test_result, + guint modifiers); + gboolean (* print_requested) (WebKitWebView *web_view, + WebKitPrintOperation *print_operation); + void (* resource_load_started) (WebKitWebView *web_view, + WebKitWebResource *resource, + WebKitURIRequest *request); + gboolean (* enter_fullscreen) (WebKitWebView *web_view); + gboolean (* leave_fullscreen) (WebKitWebView *web_view); + gboolean (* run_file_chooser) (WebKitWebView *web_view, + WebKitFileChooserRequest *request); + gboolean (* context_menu) (WebKitWebView *web_view, + WebKitContextMenu *context_menu, + GdkEvent *event, + WebKitHitTestResult *hit_test_result); + void (* context_menu_dismissed) (WebKitWebView *web_view); + void (* submit_form) (WebKitWebView *web_view, + WebKitFormSubmissionRequest *request); /* Padding for future expansion */ void (*_webkit_reserved0) (void); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h index b602f4fe0..1833fb111 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h @@ -55,5 +55,6 @@ WebKitWebResource* webkitWebViewResourceLoadFinished(WebKitWebView*, uint64_t re bool webkitWebViewEnterFullScreen(WebKitWebView*); bool webkitWebViewLeaveFullScreen(WebKitWebView*); void webkitWebViewPopulateContextMenu(WebKitWebView*, WKArrayRef proposedMenu, WKHitTestResultRef); +void webkitWebViewSubmitFormRequest(WebKitWebView*, WebKitFormSubmissionRequest*); #endif // WebKitWebViewPrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml index 6b62d6f69..6aac7c843 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml @@ -39,6 +39,7 @@ <xi:include href="xml/WebKitVersion.xml"/> <xi:include href="xml/WebKitContextMenu.xml"/> <xi:include href="xml/WebKitContextMenuItem.xml"/> + <xi:include href="xml/WebKitFormSubmissionRequest.xml"/> </chapter> <index id="index-all"> diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index f5c84753c..3164177cc 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -814,3 +814,23 @@ WEBKIT_CONTEXT_MENU_ITEM_GET_CLASS WebKitContextMenuItemPrivate webkit_context_menu_item_get_type </SECTION> + +<SECTION> +<FILE>WebKitFormSubmissionRequest</FILE> +WebKitFormSubmissionRequest +webkit_form_submission_request_get_text_fields +webkit_form_submission_request_submit + +<SUBSECTION Standard> +WebKitFormSubmissionRequestClass +WEBKIT_TYPE_FORM_SUBMISSION_REQUEST +WEBKIT_FORM_SUBMISSION_REQUEST +WEBKIT_IS_FORM_SUBMISSION_REQUEST +WEBKIT_FORM_SUBMISSION_REQUEST_CLASS +WEBKIT_IS_FORM_SUBMISSION_REQUEST_CLASS +WEBKIT_FORM_SUBMISSION_REQUEST_GET_CLASS + +<SUBSECTION Private> +WebKitFormSubmissionRequestPrivate +webkit_form_submission_request_get_type +</SECTION> diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp index 43f59e1e7..dc7a518dd 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp @@ -520,6 +520,25 @@ static void testWebViewResourcesReplacedContent(ResourcesTest* test, gconstpoint g_assert(!webkit_web_view_get_subresources(test->m_webView)); } +static void testWebViewResourcesHistoryCache(SingleResourceLoadTest* test, gconstpointer) +{ + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); + + test->loadURI(kServer->getURIForPath("/javascript.html").data()); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); + + test->goBack(); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); + + test->goForward(); + test->waitUntilResourceLoadFinished(); + g_assert(webkit_web_view_get_main_resource(test->m_webView)); +} + static void addCacheHTTPHeadersToResponse(SoupMessage* message) { // The actual date doesn't really matter. @@ -604,6 +623,7 @@ void beforeAll() ResourceURITrackingTest::add("WebKitWebResource", "active-uri", testWebResourceActiveURI); ResourcesTest::add("WebKitWebResource", "get-data", testWebResourceGetData); ResourcesTest::add("WebKitWebView", "replaced-content", testWebViewResourcesReplacedContent); + SingleResourceLoadTest::add("WebKitWebView", "history-cache", testWebViewResourcesHistoryCache); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index 3e194a179..eec6fc786 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -865,6 +865,87 @@ static void testWebViewCanShowMIMEType(WebViewTest* test, gconstpointer) g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/octet-stream")); } +class FormClientTest: public WebViewTest { +public: + MAKE_GLIB_TEST_FIXTURE(FormClientTest); + + static void submitFormCallback(WebKitWebView*, WebKitFormSubmissionRequest* request, FormClientTest* test) + { + test->submitForm(request); + } + + FormClientTest() + : m_submitPositionX(0) + , m_submitPositionY(0) + { + g_signal_connect(m_webView, "submit-form", G_CALLBACK(submitFormCallback), this); + } + + ~FormClientTest() + { + g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + } + + void submitForm(WebKitFormSubmissionRequest* request) + { + assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request)); + m_request = request; + webkit_form_submission_request_submit(request); + quitMainLoop(); + } + + GHashTable* waitUntilFormSubmittedAndGetTextFields() + { + g_main_loop_run(m_mainLoop); + return webkit_form_submission_request_get_text_fields(m_request.get()); + } + + static gboolean doClickIdleCallback(FormClientTest* test) + { + test->clickMouseButton(test->m_submitPositionX, test->m_submitPositionY, 1); + return FALSE; + } + + void submitFormAtPosition(int x, int y) + { + m_submitPositionX = x; + m_submitPositionY = y; + g_idle_add(reinterpret_cast<GSourceFunc>(doClickIdleCallback), this); + } + + int m_submitPositionX; + int m_submitPositionY; + GRefPtr<WebKitFormSubmissionRequest> m_request; +}; + +static void testWebViewSubmitForm(FormClientTest* test, gconstpointer) +{ + test->showInWindowAndWaitUntilMapped(); + + const char* formHTML = + "<html><body>" + " <form action='#'>" + " <input type='text' name='text1' value='value1'>" + " <input type='text' name='text2' value='value2'>" + " <input type='password' name='password' value='secret'>" + " <textarea cols='5' rows='5' name='textarea'>Text</textarea>" + " <input type='hidden' name='hidden1' value='hidden1'>" + " <input type='submit' value='Submit' style='position:absolute; left:1; top:1' size='10'>" + " </form>" + "</body></html>"; + + test->loadHtml(formHTML, "file:///"); + test->waitUntilLoadFinished(); + + test->submitFormAtPosition(5, 5); + GHashTable* values = test->waitUntilFormSubmittedAndGetTextFields(); + g_assert(values); + g_assert_cmpuint(g_hash_table_size(values), ==, 3); + g_assert_cmpstr(static_cast<char*>(g_hash_table_lookup(values, "text1")), ==, "value1"); + g_assert_cmpstr(static_cast<char*>(g_hash_table_lookup(values, "text2")), ==, "value2"); + g_assert_cmpstr(static_cast<char*>(g_hash_table_lookup(values, "password")), ==, "secret"); +} + void beforeAll() { WebViewTest::add("WebKitWebView", "default-context", testWebViewDefaultContext); @@ -883,6 +964,7 @@ void beforeAll() FileChooserTest::add("WebKitWebView", "file-chooser-request", testWebViewFileChooserRequest); FullScreenClientTest::add("WebKitWebView", "fullscreen", testWebViewFullScreen); WebViewTest::add("WebKitWebView", "can-show-mime-type", testWebViewCanShowMIMEType); + FormClientTest::add("WebKitWebView", "submit-form", testWebViewSubmitForm); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index 58ac2b7e9..116dafc2d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -36,6 +36,7 @@ #include <webkit2/WebKitError.h> #include <webkit2/WebKitFileChooserRequest.h> #include <webkit2/WebKitFindController.h> +#include <webkit2/WebKitFormSubmissionRequest.h> #include <webkit2/WebKitGeolocationPermissionRequest.h> #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 25bf2e7df..1ba028f23 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -1660,6 +1660,12 @@ bool QQuickWebView::childMouseEventFilter(QQuickItem* item, QEvent* event) if (!isVisible() || !isEnabled() || !s_flickableViewportEnabled) return QQuickFlickable::childMouseEventFilter(item, event); + Q_D(QQuickWebView); + if (d->m_dialogActive) { + event->ignore(); + return false; + } + // This function is used by MultiPointTouchArea and PinchArea to filter // touch events, thus to hinder the canvas from sending synthesized // mouse events to the Flickable implementation we need to reimplement diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp index 9a30e1fd6..e66f368c5 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp @@ -66,6 +66,10 @@ bool QWebPreferencesPrivate::testAttribute(QWebPreferencesPrivate::WebAttribute #if ENABLE(WEBGL) case WebGLEnabled: return WKPreferencesGetWebGLEnabled(preferencesRef()); +#if ENABLE(CSS_SHADERS) + case CSSCustomFilterEnabled: + return WKPreferencesGetCSSCustomFilterEnabled(preferencesRef()); +#endif #endif default: ASSERT_NOT_REACHED(); @@ -114,6 +118,11 @@ void QWebPreferencesPrivate::setAttribute(QWebPreferencesPrivate::WebAttribute a case WebGLEnabled: WKPreferencesSetWebGLEnabled(preferencesRef(), enable); break; +#if ENABLE(CSS_SHADERS) + case CSSCustomFilterEnabled: + WKPreferencesSetCSSCustomFilterEnabled(preferencesRef(), enable); + break; +#endif #endif default: ASSERT_NOT_REACHED(); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h index 7c1c9bd4f..004500c90 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h @@ -39,7 +39,8 @@ public: PrivateBrowsingEnabled, DnsPrefetchEnabled, DeveloperExtrasEnabled, - WebGLEnabled + WebGLEnabled, + CSSCustomFilterEnabled }; enum FontFamily { diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index 16bb567ba..121f90d88 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -25,7 +25,9 @@ #include "LayerTreeCoordinatorProxy.h" #include "NativeWebKeyboardEvent.h" #include "NativeWebMouseEvent.h" +#if ENABLE(TOUCH_EVENTS) #include "NativeWebTouchEvent.h" +#endif #include "NativeWebWheelEvent.h" #include "NotImplemented.h" #include "WebContext.h" @@ -378,7 +380,9 @@ void QRawWebView::sendWheelEvent(QWheelEvent* event) d->m_webPageProxy->handleWheelEvent(WebKit::NativeWebWheelEvent(event, QTransform())); } +#if ENABLE(TOUCH_EVENTS) void QRawWebView::sendTouchEvent(QTouchEvent* event) { d->m_webPageProxy->handleTouchEvent(WebKit::NativeWebTouchEvent(event, QTransform())); } +#endif diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h index b8cba692d..a4bef5dd2 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h @@ -30,6 +30,7 @@ #include <WebKit2/WKContext.h> #include <WebKit2/WKPage.h> #include <WebKit2/WKPageGroup.h> +#include <wtf/Platform.h> class QRect; class QRectF; @@ -92,7 +93,9 @@ public: void sendKeyEvent(QKeyEvent*); void sendMouseEvent(QMouseEvent*, int clickCount = 0); void sendWheelEvent(QWheelEvent*); +#if ENABLE(TOUCH_EVENTS) void sendTouchEvent(QTouchEvent*); +#endif private: QRawWebViewPrivate* d; diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp index 55eef25ac..8de0f932d 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp +++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp @@ -25,6 +25,7 @@ #include "WebInspectorProxy.h" #include "WebPageProxy.h" +#include <QFile> #include <WebCore/MIMETypeRegistry.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index 381a25603..c9c0b94df 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -78,6 +78,10 @@ #include "WebSoupRequestManagerProxy.h" #endif +#if ENABLE(VIBRATION) +#include "WebVibrationProxy.h" +#endif + #ifndef NDEBUG #include <wtf/RefCountedLeakCounter.h> #endif @@ -156,6 +160,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa #if USE(SOUP) , m_soupRequestManagerProxy(WebSoupRequestManagerProxy::create(this)) #endif +#if ENABLE(VIBRATION) + , m_vibrationProxy(WebVibrationProxy::create(this)) +#endif #if PLATFORM(WIN) , m_shouldPaintNativeControls(true) , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways) @@ -237,6 +244,11 @@ WebContext::~WebContext() m_soupRequestManagerProxy->clearContext(); #endif +#if ENABLE(VIBRATION) + m_vibrationProxy->invalidate(); + m_vibrationProxy->clearContext(); +#endif + invalidateCallbackMap(m_dictionaryCallbacks); platformInvalidateContext(); @@ -438,6 +450,9 @@ void WebContext::disconnectProcess(WebProcessProxy* process) #if USE(SOUP) m_soupRequestManagerProxy->invalidate(); #endif +#if ENABLE(VIBRATION) + m_vibrationProxy->invalidate(); +#endif // When out of process plug-ins are enabled, we don't want to invalidate the plug-in site data // manager just because the web process crashes since it's not involved. @@ -822,6 +837,13 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes } #endif +#if ENABLE(VIBRATION) + if (messageID.is<CoreIPC::MessageClassWebVibrationProxy>()) { + m_vibrationProxy->didReceiveMessage(connection, messageID, arguments); + return; + } +#endif + switch (messageID.get<WebContextLegacyMessage::Kind>()) { case WebContextLegacyMessage::PostMessage: { String messageName; diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index f01561031..c748f22f2 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -67,6 +67,9 @@ class WebResourceCacheManagerProxy; #if USE(SOUP) class WebSoupRequestManagerProxy; #endif +#if ENABLE(VIBRATION) +class WebVibrationProxy; +#endif struct StatisticsData; struct WebProcessCreationParameters; @@ -178,6 +181,9 @@ public: #if USE(SOUP) WebSoupRequestManagerProxy* soupRequestManagerProxy() const { return m_soupRequestManagerProxy.get(); } #endif +#if ENABLE(VIBRATION) + WebVibrationProxy* vibrationProxy() const { return m_vibrationProxy.get(); } +#endif struct Statistics { unsigned wkViewCount; @@ -329,6 +335,9 @@ private: #if USE(SOUP) RefPtr<WebSoupRequestManagerProxy> m_soupRequestManagerProxy; #endif +#if ENABLE(VIBRATION) + RefPtr<WebVibrationProxy> m_vibrationProxy; +#endif #if PLATFORM(WIN) bool m_shouldPaintNativeControls; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 29a6c65c5..e70036645 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -719,7 +719,11 @@ private: virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index); #if PLATFORM(GTK) virtual void failedToShowPopupMenu(); -#endif +#endif +#if PLATFORM(QT) + virtual void changeSelectedIndex(int32_t newSelectedIndex); + virtual void closePopupMenu(); +#endif // Implemented in generated WebPageProxyMessageReceiver.cpp void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h index 3cefc0d67..d5bfa4c5c 100644 --- a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h +++ b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h @@ -55,7 +55,11 @@ public: virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent() = 0; #if PLATFORM(GTK) virtual void failedToShowPopupMenu() = 0; -#endif +#endif +#if PLATFORM(QT) + virtual void changeSelectedIndex(int32_t newSelectedIndex) = 0; + virtual void closePopupMenu() = 0; +#endif }; virtual ~WebPopupMenuProxy() diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index 54e0ec39b..e3cdc8809 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -328,6 +328,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC #if USE(SOUP) || messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>() #endif +#if ENABLE(VIBRATION) + || messageID.is<CoreIPC::MessageClassWebVibrationProxy>() +#endif || messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) { m_context->didReceiveMessage(connection, messageID, arguments); return; diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp index a2683ba2e..b2b68bccc 100644 --- a/Source/WebKit2/UIProcess/efl/WebInspectorEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2012 Samsung Electronics * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 2236d37ee..ea595951b 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -246,12 +246,14 @@ void QtWebPageEventHandler::activateTapHighlight(const QTouchEvent::TouchPoint& void QtWebPageEventHandler::deactivateTapHighlight() { +#if ENABLE(TOUCH_EVENTS) if (!m_isTapHighlightActive) return; // An empty point deactivates the highlighting. m_webPageProxy->handlePotentialActivation(IntPoint(), IntSize()); m_isTapHighlightActive = false; +#endif } void QtWebPageEventHandler::handleSingleTapEvent(const QTouchEvent::TouchPoint& point) diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index 5cafad59c..fa2c74f1f 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -119,4 +119,14 @@ void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frame } #endif +void WebPageProxy::changeSelectedIndex(int32_t selectedIndex) +{ + process()->send(Messages::WebPage::SelectedIndex(selectedIndex), m_pageID); +} + +void WebPageProxy::closePopupMenu() +{ + process()->send(Messages::WebPage::HidePopupMenu(), m_pageID); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp index 2f92098ca..7512892bb 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -52,23 +52,28 @@ public: IsSeparatorRole = Qt::UserRole + 3 }; - PopupMenuItemModel(const Vector<WebPopupItem>&, int selectedOriginalIndex); + PopupMenuItemModel(const Vector<WebPopupItem>&, bool multiple); virtual int rowCount(const QModelIndex& parent = QModelIndex()) const { return m_items.size(); } virtual QVariant data(const QModelIndex&, int role = Qt::DisplayRole) const; Q_INVOKABLE void select(int); int selectedOriginalIndex() const; + bool multiple() const { return m_allowMultiples; } + void toggleItem(int); + +Q_SIGNALS: + void indexUpdated(); private: struct Item { - Item(const WebPopupItem& webPopupItem, const QString& group, int originalIndex, bool selected) + Item(const WebPopupItem& webPopupItem, const QString& group, int originalIndex) : text(webPopupItem.m_text) , toolTip(webPopupItem.m_toolTip) , group(group) , originalIndex(originalIndex) , enabled(webPopupItem.m_isEnabled) - , selected(selected) + , selected(webPopupItem.m_isSelected) , isSeparator(webPopupItem.m_type == WebPopupItem::Separator) { } @@ -82,47 +87,68 @@ private: bool isSeparator; }; - void buildItems(const Vector<WebPopupItem>& webPopupItems, int selectedOriginalIndex); + void buildItems(const Vector<WebPopupItem>& webPopupItems); Vector<Item> m_items; int m_selectedModelIndex; + bool m_allowMultiples; }; class ItemSelectorContextObject : public QObject { Q_OBJECT - Q_PROPERTY(QRect elementRect READ elementRect CONSTANT FINAL) + Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL) Q_PROPERTY(QObject* items READ items CONSTANT FINAL) + Q_PROPERTY(bool allowMultiSelect READ allowMultiSelect CONSTANT FINAL) public: - ItemSelectorContextObject(const IntRect& elementRect, const Vector<WebPopupItem>&, int selectedIndex); + ItemSelectorContextObject(const QRectF& elementRect, const Vector<WebPopupItem>&, bool multiple); - QRect elementRect() const { return m_elementRect; } + QRectF elementRect() const { return m_elementRect; } PopupMenuItemModel* items() { return &m_items; } + bool allowMultiSelect() { return m_items.multiple(); } Q_INVOKABLE void accept(int index = -1); - Q_INVOKABLE void reject() { emit rejected(); } + Q_INVOKABLE void reject() { emit done(); } + Q_INVOKABLE void dismiss() { emit done(); } Q_SIGNALS: void acceptedWithOriginalIndex(int); - void rejected(); + void done(); + +private Q_SLOTS: + void onIndexUpdate(); private: - QRect m_elementRect; + QRectF m_elementRect; PopupMenuItemModel m_items; }; -ItemSelectorContextObject::ItemSelectorContextObject(const IntRect& elementRect, const Vector<WebPopupItem>& webPopupItems, int selectedIndex) +ItemSelectorContextObject::ItemSelectorContextObject(const QRectF& elementRect, const Vector<WebPopupItem>& webPopupItems, bool multiple) : m_elementRect(elementRect) - , m_items(webPopupItems, selectedIndex) + , m_items(webPopupItems, multiple) { + connect(&m_items, SIGNAL(indexUpdated()), SLOT(onIndexUpdate())); } +void ItemSelectorContextObject::onIndexUpdate() +{ + // Send the update for multi-select list. + if (m_items.multiple()) + emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); +} + + void ItemSelectorContextObject::accept(int index) { - if (index != -1) - m_items.select(index); - int originalIndex = m_items.selectedOriginalIndex(); - emit acceptedWithOriginalIndex(originalIndex); + // If the index is not valid for multi-select lists, just hide the pop up as the selected indices have + // already been sent. + if ((index == -1) && m_items.multiple()) + emit done(); + else { + if (index != -1) + m_items.toggleItem(index); + emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); + } } static QHash<int, QByteArray> createRoleNamesHash() @@ -137,12 +163,13 @@ static QHash<int, QByteArray> createRoleNamesHash() return roles; } -PopupMenuItemModel::PopupMenuItemModel(const Vector<WebPopupItem>& webPopupItems, int selectedOriginalIndex) +PopupMenuItemModel::PopupMenuItemModel(const Vector<WebPopupItem>& webPopupItems, bool multiple) : m_selectedModelIndex(-1) + , m_allowMultiples(multiple) { static QHash<int, QByteArray> roles = createRoleNamesHash(); setRoleNames(roles); - buildItems(webPopupItems, selectedOriginalIndex); + buildItems(webPopupItems); } QVariant PopupMenuItemModel::data(const QModelIndex& index, int role) const @@ -177,22 +204,31 @@ QVariant PopupMenuItemModel::data(const QModelIndex& index, int role) const void PopupMenuItemModel::select(int index) { + toggleItem(index); + emit indexUpdated(); +} + +void PopupMenuItemModel::toggleItem(int index) +{ int oldIndex = m_selectedModelIndex; - if (index == oldIndex) - return; if (index < 0 || index >= m_items.size()) return; Item& item = m_items[index]; if (!item.enabled) return; - item.selected = true; m_selectedModelIndex = index; - - if (oldIndex != -1) { - Item& oldItem = m_items[oldIndex]; - oldItem.selected = false; - emit dataChanged(this->index(oldIndex), this->index(oldIndex)); + if (m_allowMultiples) + item.selected = !item.selected; + else { + if (index == oldIndex) + return; + item.selected = true; + if (oldIndex != -1) { + Item& oldItem = m_items[oldIndex]; + oldItem.selected = false; + emit dataChanged(this->index(oldIndex), this->index(oldIndex)); + } } emit dataChanged(this->index(index), this->index(index)); @@ -205,7 +241,7 @@ int PopupMenuItemModel::selectedOriginalIndex() const return m_items[m_selectedModelIndex].originalIndex; } -void PopupMenuItemModel::buildItems(const Vector<WebPopupItem>& webPopupItems, int selectedOriginalIndex) +void PopupMenuItemModel::buildItems(const Vector<WebPopupItem>& webPopupItems) { QString currentGroup; m_items.reserveInitialCapacity(webPopupItems.size()); @@ -215,10 +251,9 @@ void PopupMenuItemModel::buildItems(const Vector<WebPopupItem>& webPopupItems, i currentGroup = webPopupItem.m_text; continue; } - const bool selected = i == selectedOriginalIndex; - if (selected) + if (webPopupItem.m_isSelected && !m_allowMultiples) m_selectedModelIndex = m_items.size(); - m_items.append(Item(webPopupItem, currentGroup, i, selected)); + m_items.append(Item(webPopupItem, currentGroup, i)); } } @@ -232,14 +267,15 @@ WebPopupMenuProxyQt::~WebPopupMenuProxyQt() { } -void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) +void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t) { - m_selectedIndex = selectedIndex; + m_selectionType = (data.multipleSelections) ? WebPopupMenuProxyQt::MultipleSelection : WebPopupMenuProxyQt::SingleSelection; - ItemSelectorContextObject* contextObject = new ItemSelectorContextObject(rect, items, m_selectedIndex); + const QRectF mappedRect= m_webView->mapRectFromWebContent(QRect(rect)); + ItemSelectorContextObject* contextObject = new ItemSelectorContextObject(mappedRect, items, (m_selectionType == WebPopupMenuProxyQt::MultipleSelection)); createItem(contextObject); if (!m_itemSelector) { - notifyValueChanged(); + hidePopupMenu(); return; } QQuickWebViewPrivate::get(m_webView)->setDialogActive(true); @@ -250,12 +286,16 @@ void WebPopupMenuProxyQt::hidePopupMenu() m_itemSelector.clear(); QQuickWebViewPrivate::get(m_webView)->setDialogActive(false); m_context.clear(); - notifyValueChanged(); + + if (m_client) { + m_client->closePopupMenu(); + invalidate(); + } } void WebPopupMenuProxyQt::selectIndex(int index) { - m_selectedIndex = index; + m_client->changeSelectedIndex(index); } void WebPopupMenuProxyQt::createItem(QObject* contextObject) @@ -268,23 +308,19 @@ void WebPopupMenuProxyQt::createItem(QObject* contextObject) createContext(component, contextObject); QObject* object = component->beginCreate(m_context.get()); - if (!object) { - m_context.clear(); + if (!object) return; - } m_itemSelector = adoptPtr(qobject_cast<QQuickItem*>(object)); - if (!m_itemSelector) { - m_context.clear(); - m_itemSelector.clear(); + if (!m_itemSelector) return; - } connect(contextObject, SIGNAL(acceptedWithOriginalIndex(int)), SLOT(selectIndex(int))); // We enqueue these because they are triggered by m_itemSelector and will lead to its destruction. - connect(contextObject, SIGNAL(acceptedWithOriginalIndex(int)), SLOT(hidePopupMenu()), Qt::QueuedConnection); - connect(contextObject, SIGNAL(rejected()), SLOT(hidePopupMenu()), Qt::QueuedConnection); + connect(contextObject, SIGNAL(done()), SLOT(hidePopupMenu()), Qt::QueuedConnection); + if (m_selectionType == WebPopupMenuProxyQt::SingleSelection) + connect(contextObject, SIGNAL(acceptedWithOriginalIndex(int)), SLOT(hidePopupMenu()), Qt::QueuedConnection); QQuickWebViewPrivate::get(m_webView)->addAttachedPropertyTo(m_itemSelector.get()); m_itemSelector->setParentItem(m_webView); @@ -307,14 +343,6 @@ void WebPopupMenuProxyQt::createContext(QQmlComponent* component, QObject* conte m_context->setContextObject(contextObject); } -void WebPopupMenuProxyQt::notifyValueChanged() -{ - if (m_client) { - m_client->valueChangedForPopupMenu(this, m_selectedIndex); - invalidate(); - } -} - } // namespace WebKit // Since we define QObjects in WebPopupMenuProxyQt.cpp, this will trigger moc to run on .cpp. diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h index 21eec5d1d..3eb544d61 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h @@ -42,6 +42,11 @@ class WebPopupMenuProxyQt : public QObject, public WebPopupMenuProxy { Q_OBJECT public: + enum SelectionType { + SingleSelection, + MultipleSelection + }; + static PassRefPtr<WebPopupMenuProxyQt> create(WebPopupMenuProxy::Client* client, QQuickWebView* webView) { return adoptRef(new WebPopupMenuProxyQt(client, webView)); @@ -61,13 +66,11 @@ private: void createItem(QObject*); void createContext(QQmlComponent*, QObject*); - void notifyValueChanged(); - OwnPtr<QQmlContext> m_context; OwnPtr<QQuickItem> m_itemSelector; QQuickWebView* m_webView; - int32_t m_selectedIndex; + SelectionType m_selectionType; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h index 2688b72d1..d751087a1 100644 --- a/Source/WebKit2/WebProcess/Downloads/Download.h +++ b/Source/WebKit2/WebProcess/Downloads/Download.h @@ -38,7 +38,7 @@ OBJC_CLASS NSURLDownload; OBJC_CLASS WKDownloadAsDelegate; #endif -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(EFL) #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceHandleClient.h> #endif @@ -47,10 +47,6 @@ OBJC_CLASS WKDownloadAsDelegate; #include <CFNetwork/CFURLDownloadPriv.h> #endif -#if PLATFORM(EFL) -#include <FileDownloaderEfl.h> -#endif - namespace CoreIPC { class DataReference; } @@ -73,10 +69,6 @@ class WebPage; class QtFileDownloader; #endif -#if PLATFORM(EFL) -class FileDownloaderEfl; -#endif - class Download : public CoreIPC::MessageSender<Download> { WTF_MAKE_NONCOPYABLE(Download); public: @@ -150,13 +142,10 @@ private: #if PLATFORM(QT) QtFileDownloader* m_qtDownloader; #endif -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(EFL) OwnPtr<WebCore::ResourceHandleClient> m_downloadClient; RefPtr<WebCore::ResourceHandle> m_resourceHandle; #endif -#if PLATFORM(EFL) - OwnPtr<FileDownloaderEfl> m_fileDownloader; -#endif }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp deleted file mode 100755 index 9828c2b0c..000000000 --- a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "Download.h" - -#include "FileDownloaderEfl.h" -#include <WebCore/NotImplemented.h> - -using namespace WebCore; - -namespace WebKit { - -void Download::start(WebPage* initiatingWebPage) -{ - m_fileDownloader = FileDownloaderEfl::create(this); - m_fileDownloader->start(initiatingWebPage, m_request); -} - -void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceResponse& response) -{ - notImplemented(); -} - -void Download::cancel() -{ - notImplemented(); -} - -void Download::platformInvalidate() -{ - notImplemented(); -} - -void Download::didDecideDestination(const String& destination, bool allowOverwrite) -{ - notImplemented(); -} - -void Download::platformDidFinish() -{ - notImplemented(); -} - -void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential) -{ - notImplemented(); -} - -void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -void Download::useCredential(const WebCore::AuthenticationChallenge& authenticationChallenge, const WebCore::Credential& credential) -{ - notImplemented(); -} - -void Download::continueWithoutCredential(const WebCore::AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -void Download::cancelAuthenticationChallenge(const WebCore::AuthenticationChallenge& authenticationChallenge) -{ - notImplemented(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp new file mode 100644 index 000000000..d1ba587f3 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp @@ -0,0 +1,45 @@ +/* + * 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 "DownloadSoupErrors.h" + +#include <WebCore/ErrorsEfl.h> + +using namespace WebCore; + +namespace WebKit { + +ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription) +{ + return downloadNetworkError(ResourceError(errorDomainDownload, errorCode, failingURL, localizedDescription)); +} + +ResourceError platformDownloadDestinationError(const ResourceResponse& response, const String& message) +{ + return downloadDestinationError(response, message); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp deleted file mode 100644 index 8f17840e1..000000000 --- a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "FileDownloaderEfl.h" - -#include <WebCore/NotImplemented.h> - -using namespace WebCore; - -namespace WebKit { - -PassOwnPtr<FileDownloaderEfl> FileDownloaderEfl::create(Download* download) -{ - return adoptPtr(new FileDownloaderEfl(download)); -} - -FileDownloaderEfl::FileDownloaderEfl(Download* download) - : m_download(download) -{ - ASSERT(download); -} - -FileDownloaderEfl::~FileDownloaderEfl() -{ -} - -void FileDownloaderEfl::start(WebPage*, ResourceRequest&) -{ - notImplemented(); -} - -void FileDownloaderEfl::didReceiveResponse(ResourceHandle*, const ResourceResponse&) -{ - notImplemented(); -} - -void FileDownloaderEfl::didReceiveData(ResourceHandle*, const char*, int, int) -{ - notImplemented(); -} - -void FileDownloaderEfl::didFinishLoading(ResourceHandle*, double) -{ - notImplemented(); -} - -void FileDownloaderEfl::didFail(ResourceHandle*, const ResourceError&) -{ - notImplemented(); -} - -bool FileDownloaderEfl::shouldUseCredentialStorage(ResourceHandle*) -{ - return false; -} - -void FileDownloaderEfl::didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) -{ - notImplemented(); -} - -void FileDownloaderEfl::didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) -{ - notImplemented(); -} - -void FileDownloaderEfl::receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) -{ - notImplemented(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h deleted file mode 100644 index d8f998be9..000000000 --- a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef FileDownloaderEfl_h -#define FileDownloaderEfl_h - -#include <WebCore/ResourceError.h> -#include <WebCore/ResourceHandle.h> -#include <WebCore/ResourceHandleClient.h> -#include <WebCore/ResourceRequest.h> -#include <WebCore/ResourceResponse.h> -#include <wtf/PassOwnPtr.h> - -namespace WebCore { -class AuthenticationChallenge; -class ResourceError; -class ResourceHandle; -class ResourceHandleClient; -class ResourceRequest; -class ResourceResponse; -} - -namespace WebKit { - -class Download; -class WebPage; - -class FileDownloaderEfl : public WebCore::ResourceHandleClient { -public: - static PassOwnPtr<FileDownloaderEfl> create(Download*); - virtual ~FileDownloaderEfl(); - - void start(WebPage*, WebCore::ResourceRequest&); - - // callbacks for ResourceHandleClient, which are called by ResourceHandle - virtual void didReceiveResponse(WebCore::ResourceHandle*, const WebCore::ResourceResponse&) OVERRIDE; - virtual void didReceiveData(WebCore::ResourceHandle*, const char* data, int length, int encodedDataLength) OVERRIDE; - virtual void didFinishLoading(WebCore::ResourceHandle*, double finishTime) OVERRIDE; - virtual void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) OVERRIDE; - virtual bool shouldUseCredentialStorage(WebCore::ResourceHandle*) OVERRIDE; - virtual void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; - virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; - virtual void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; - -private: - FileDownloaderEfl(Download*); - - Download* m_download; -}; - -} // namespace WebKit - -#endif // FileDownloaderEfl_h diff --git a/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp b/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp new file mode 100644 index 000000000..0d23e6e64 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp @@ -0,0 +1,45 @@ +/* + * 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 "DownloadSoupErrors.h" + +#include <WebCore/ErrorsGtk.h> + +using namespace WebCore; + +namespace WebKit { + +ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription) +{ + return downloadNetworkError(ResourceError(errorDomainDownload, errorCode, failingURL, localizedDescription)); +} + +ResourceError platformDownloadDestinationError(const ResourceResponse& response, const String& message) +{ + return downloadDestinationError(response, message); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp index 5c96eba48..bb295e09b 100644 --- a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp +++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp @@ -28,15 +28,18 @@ #include "Download.h" #include "DataReference.h" -#include <WebCore/ErrorsGtk.h> +#include "DownloadSoupErrors.h" #include <WebCore/NotImplemented.h> #include <WebCore/ResourceHandleInternal.h> #include <gio/gio.h> -#include <glib/gi18n-lib.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> #include <wtf/text/CString.h> +#if PLATFORM(GTK) +#include <glib/gi18n-lib.h> +#endif + using namespace WebCore; namespace WebKit { @@ -60,8 +63,7 @@ public: m_download->didReceiveResponse(response); if (response.httpStatusCode() >= 400) { - downloadFailed(downloadNetworkError(ResourceError(errorDomainDownload, response.httpStatusCode(), - response.url().string(), response.httpStatusText()))); + downloadFailed(platformDownloadNetworkError(response.httpStatusCode(), response.url().string(), response.httpStatusText())); return; } @@ -76,9 +78,13 @@ public: bool overwrite; String destinationURI = m_download->decideDestinationWithSuggestedFilename(suggestedFilename.utf8().data(), overwrite); if (destinationURI.isEmpty()) { - GOwnPtr<char> errorMessage(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"), - suggestedFilename.utf8().data())); - downloadFailed(downloadDestinationError(response, errorMessage.get())); +#if PLATFORM(GTK) + GOwnPtr<char> buffer(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"), suggestedFilename.utf8().data())); + String errorMessage = String::fromUTF8(buffer.get()); +#else + String errorMessage = makeString("Cannot determine destination URI for download with suggested filename ", suggestedFilename); +#endif + downloadFailed(platformDownloadDestinationError(response, errorMessage)); return; } @@ -86,7 +92,7 @@ public: GOwnPtr<GError> error; m_outputStream = adoptGRef(g_file_replace(file.get(), 0, TRUE, G_FILE_CREATE_NONE, 0, &error.outPtr())); if (!m_outputStream) { - downloadFailed(downloadDestinationError(response, error->message)); + downloadFailed(platformDownloadDestinationError(response, error->message)); return; } @@ -99,7 +105,7 @@ public: GOwnPtr<GError> error; g_output_stream_write_all(G_OUTPUT_STREAM(m_outputStream.get()), data, length, &bytesWritten, 0, &error.outPtr()); if (error) { - downloadFailed(downloadDestinationError(ResourceResponse(m_response.get()), error->message)); + downloadFailed(platformDownloadDestinationError(ResourceResponse(m_response.get()), error->message)); return; } m_download->didReceiveData(bytesWritten); @@ -113,7 +119,7 @@ public: void didFail(ResourceHandle*, const ResourceError& error) { - downloadFailed(downloadNetworkError(error)); + downloadFailed(platformDownloadNetworkError(error.errorCode(), error.failingURL(), error.localizedDescription())); } void wasBlocked(ResourceHandle*) @@ -198,4 +204,19 @@ void Download::receivedCancellation(const AuthenticationChallenge& authenticatio notImplemented(); } +void Download::continueWithoutCredential(const AuthenticationChallenge &) +{ + notImplemented(); +} + +void Download::useCredential(const AuthenticationChallenge&, const Credential&) +{ + notImplemented(); +} + +void Download::cancelAuthenticationChallenge(const AuthenticationChallenge&) +{ + notImplemented(); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h new file mode 100644 index 000000000..89e23e083 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h @@ -0,0 +1,39 @@ +/* + * 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 DownloadSoupErrors_h +#define DownloadSoupErrors_h + +#include <WebCore/ResourceHandle.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +WebCore::ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription); +WebCore::ResourceError platformDownloadDestinationError(const WebCore::ResourceResponse&, const String& message); + +} // namespace WebKit + +#endif // DownloadSoupErrors_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp index 940cb95d8..4c309dcaf 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp @@ -59,9 +59,14 @@ void WebPopupMenu::didChangeSelectedIndex(int newIndex) if (!m_popupClient) return; +#if PLATFORM(QT) + if (newIndex >= 0) + m_popupClient->listBoxSelectItem(newIndex, m_popupClient->multiple(), false); +#else m_popupClient->popupDidHide(); if (newIndex >= 0) m_popupClient->valueChanged(newIndex); +#endif } void WebPopupMenu::setTextForIndex(int index) @@ -87,7 +92,7 @@ Vector<WebPopupItem> WebPopupMenu::populateItems() // FIXME: Add support for styling the foreground and background colors. // FIXME: Find a way to customize text color when an item is highlighted. PopupMenuStyle itemStyle = m_popupClient->itemStyle(i); - items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), itemStyle.textDirection(), itemStyle.hasTextDirectionOverride(), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i))); + items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), itemStyle.textDirection(), itemStyle.hasTextDirectionOverride(), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i), m_popupClient->itemIsSelected(i))); } } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h index 8e6625018..6319b9d55 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h @@ -48,7 +48,7 @@ public: void disconnectFromPage() { m_page = 0; } void didChangeSelectedIndex(int newIndex); void setTextForIndex(int newIndex); -#if PLATFORM(GTK) +#if PLATFORM(GTK) || PLATFORM(QT) WebCore::PopupMenuClient* client() const { return m_popupClient; } #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp index f635df45f..8a891753b 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp @@ -36,7 +36,7 @@ using namespace WebCore; namespace WebKit { -void WebVibrationClient::vibrate(const uint64_t& vibrationTime) +void WebVibrationClient::vibrate(const unsigned long& vibrationTime) { WebProcess::shared().connection()->send(Messages::WebVibrationProxy::Vibrate(vibrationTime), m_page->pageID()); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h index e71db2895..a06b4f9e1 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h @@ -44,7 +44,7 @@ public: virtual ~WebVibrationClient() { } private: - virtual void vibrate(const uint64_t& vibrationTime) OVERRIDE; + virtual void vibrate(const unsigned long& vibrationTime) OVERRIDE; virtual void cancelVibration() OVERRIDE; virtual void vibrationDestroyed() OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp index dda93722a..9d8dfda0d 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp @@ -26,8 +26,7 @@ #include "config.h" #include "WebErrors.h" -#include "WKError.h" -#include "WebError.h" +#include <WebCore/ErrorsEfl.h> #include <WebCore/ResourceError.h> #include <WebCore/ResourceRequest.h> #include <WebCore/ResourceResponse.h> @@ -36,47 +35,39 @@ using namespace WebCore; namespace WebKit { -// FIXME: Export following error codes so that application can understand. -// We should establish Efl port's error system because application cannot understand those local define. -// See https://bugs.webkit.org/show_bug.cgi?id=90783 for detail. -enum { - kWKErrorCodeCancelled = 300, - kWKErrorCodeFileDoesNotExist = 301, -}; - ResourceError cancelledError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCancelled, request.url().string(), "Request cancelled"); + return WebCore::cancelledError(request); } ResourceError blockedError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url().string(), "Request blocked"); + return WebCore::blockedError(request); } ResourceError cannotShowURLError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url().string(), "Cannot show URL"); + return WebCore::cannotShowURLError(request); } ResourceError interruptedForPolicyChangeError(const ResourceRequest& request) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url().string(), "Frame load interrupted by policy change"); + return WebCore::interruptedForPolicyChangeError(request); } ResourceError cannotShowMIMETypeError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url().string(), "Cannot show mimetype"); + return WebCore::cannotShowMIMETypeError(response); } ResourceError fileDoesNotExistError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFileDoesNotExist, response.url().string(), "File does not exist"); + return WebCore::fileDoesNotExistError(response); } ResourceError pluginWillHandleLoadError(const ResourceResponse& response) { - return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url().string(), "Plugin will handle load"); + return WebCore::pluginWillHandleLoadError(response); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp index b21f06ccf..f0a8f7763 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp @@ -27,13 +27,15 @@ #include "WebPopupMenu.h" #include "PlatformPopupMenuData.h" +#include <WebCore/PopupMenuClient.h> using namespace WebCore; namespace WebKit { -void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData&) +void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData& data) { + data.multipleSelections = m_popupClient->multiple(); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 77987f26c..9571ffbaa 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -138,6 +138,10 @@ #include "IntentData.h" #endif +#if ENABLE(VIBRATION) +#include "WebVibrationClient.h" +#endif + #if PLATFORM(MAC) #include "BuiltInPDFView.h" #endif @@ -288,6 +292,9 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters) #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) WebCore::provideNotification(m_page.get(), new WebNotificationClient(this)); #endif +#if ENABLE(VIBRATION) + WebCore::provideVibrationTo(m_page.get(), new WebVibrationClient(this)); +#endif // Qt does not yet call setIsInWindow. Until it does, just leave // this line out so plug-ins and video will work. Eventually all platforms @@ -2394,11 +2401,16 @@ void WebPage::countStringMatches(const String& string, uint32_t options, uint32_ void WebPage::didChangeSelectedIndexForActivePopupMenu(int32_t newIndex) { + changeSelectedIndex(newIndex); + m_activePopupMenu = 0; +} + +void WebPage::changeSelectedIndex(int32_t index) +{ if (!m_activePopupMenu) return; - m_activePopupMenu->didChangeSelectedIndex(newIndex); - m_activePopupMenu = 0; + m_activePopupMenu->didChangeSelectedIndex(index); } void WebPage::didChooseFilesForOpenPanel(const Vector<String>& files) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 4d20421e0..1b7708a4c 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -697,6 +697,10 @@ private: #if PLATFORM(GTK) void failedToShowPopupMenu(); #endif +#if PLATFORM(QT) + void hidePopupMenu(); + void selectedIndex(int32_t newIndex); +#endif void didChooseFilesForOpenPanel(const Vector<String>&); void didCancelForOpenPanel(); @@ -724,6 +728,7 @@ private: void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&); #endif + void changeSelectedIndex(int32_t index); void setCanStartMediaTimerFired(); static bool platformCanHandleRequest(const WebCore::ResourceRequest&); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 4c260eb90..39c8114b5 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -166,7 +166,11 @@ messages -> WebPage { SetTextForActivePopupMenu(int32_t index); #if PLATFORM(GTK) FailedToShowPopupMenu(); -#endif +#endif +#if PLATFORM(QT) + HidePopupMenu(); + SelectedIndex(int32_t newIndex); +#endif #if ENABLE(CONTEXT_MENUS) # Context menu. diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp index 2e90a7360..18e4f948a 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -28,9 +28,11 @@ #include "WebPage.h" #include "NotImplemented.h" +#include "PopupMenuClient.h" #include "WebEditorClient.h" #include "WebEvent.h" #include "WebPageProxyMessages.h" +#include "WebPopupMenu.h" #include "WebProcess.h" #include <WebCore/DOMWrapperWorld.h> #include <WebCore/FocusController.h> @@ -422,4 +424,18 @@ void WebPage::setUserScripts(const Vector<String>& scripts) pageGroup->addUserScriptToWorld(mainThreadNormalWorld(), scripts.at(i), KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInTopFrameOnly); } +void WebPage::selectedIndex(int32_t newIndex) +{ + changeSelectedIndex(newIndex); +} + +void WebPage::hidePopupMenu() +{ + if (!m_activePopupMenu) + return; + + m_activePopupMenu->client()->popupDidHide(); + m_activePopupMenu = 0; +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp index 92d3516a5..16278a38e 100644 --- a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp +++ b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WebProcessMainEfl.h" +#include "ProxyResolverSoup.h" #include "WKBase.h" #include <Ecore.h> #include <WebCore/ResourceHandle.h> @@ -67,11 +68,12 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[]) RunLoop::initializeMainRunLoop(); SoupSession* session = WebCore::ResourceHandle::defaultSession(); - const char* httpProxy = g_getenv("http_proxy"); + const char* httpProxy = getenv("http_proxy"); if (httpProxy) { - SoupURI* proxyUri = soup_uri_new(httpProxy); - g_object_set(session, SOUP_SESSION_PROXY_URI, proxyUri, NULL); - soup_uri_free(proxyUri); + const char* noProxy = getenv("no_proxy"); + SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(httpProxy, noProxy); + soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl)); + g_object_unref(resolverEfl); } int socket = atoi(argv[1]); diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp index ce46be854..2251c2ed1 100644 --- a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp +++ b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp @@ -45,7 +45,9 @@ QtNetworkAccessManager::QtNetworkAccessManager(WebProcess* webProcess) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(onAuthenticationRequired(QNetworkReply*, QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); +#ifndef QT_NO_SSL connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), SLOT(onSslErrors(QNetworkReply*, QList<QSslError>))); +#endif } WebPage* QtNetworkAccessManager::obtainOriginatingWebPage(const QNetworkRequest& request) @@ -126,6 +128,7 @@ void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAut void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& qSslErrors) { +#ifndef QT_NO_SSL WebPage* webPage = obtainOriginatingWebPage(reply->request()); // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512. @@ -138,15 +141,10 @@ void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslE if (webPage->sendSync( Messages::WebPageProxy::CertificateVerificationRequest(hostname), Messages::WebPageProxy::CertificateVerificationRequest::Reply(ignoreErrors))) { - if (ignoreErrors) { -#ifndef QT_NO_OPENSSL + if (ignoreErrors) reply->ignoreSslErrors(qSslErrors); -#else - Q_UNUSED(qSslErrors); - reply->ignoreSslErrors(); -#endif - } } +#endif } } diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 563758064..d8e0a6f52 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -253,6 +253,7 @@ EXPORTS ??1ContextDestructionObserver@WebCore@@MAE@XZ ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z + ?nullInstance@TreeScope@WebCore@@SAPAV12@XZ ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z ?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z ?webkitWillEnterFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 0e5d1b2c7..32f4e8748 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -246,6 +246,7 @@ EXPORTS ?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@@WTF@@XZ ?utf8@String@WTF@@QBE?AVCString@2@_N@Z ?view@Document@WebCore@@QBEPAVFrameView@2@XZ + ?nullInstance@TreeScope@WebCore@@SAPAV12@XZ ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z ?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z ?restrictScaleFactorToInitialScaleIfNotUserScalable@WebCore@@YAXAAUViewportAttributes@1@@Z diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter index 5def47471..08b2664a0 100644 --- a/Source/autotools/symbols.filter +++ b/Source/autotools/symbols.filter @@ -167,6 +167,7 @@ _ZNK7WebCore14InsertionPoint8isActiveEv; _ZN7WebCore26ContextDestructionObserverD2Ev; _ZN7WebCore26ContextDestructionObserverC2EPNS_22ScriptExecutionContextE; _ZN7WebCore26ContextDestructionObserver16contextDestroyedEv; +_ZN7WebCore9TreeScope12nullInstanceEv; local: _Z*; cti*; diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake index 889f22e64..1bf71f811 100644 --- a/Source/cmake/OptionsEfl.cmake +++ b/Source/cmake/OptionsEfl.cmake @@ -35,7 +35,7 @@ FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(Glib 2.31.8 REQUIRED) FIND_PACKAGE(Gthread REQUIRED) -FIND_PACKAGE(LibSoup2 2.37.92 REQUIRED) +FIND_PACKAGE(LibSoup2 2.39.4.1 REQUIRED) SET(ENABLE_GLIB_SUPPORT ON) SET(WTF_USE_SOUP 1) @@ -73,7 +73,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_VARIABLES ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER ON) -WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST_ELEMENT ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FAST_MOBILE_SCROLLING ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS ON) diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake index eb2631597..efba1344e 100644 --- a/Source/cmake/WebKitFeatures.cmake +++ b/Source/cmake/WebKitFeatures.cmake @@ -31,9 +31,9 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_CSS_SHADERS "Toggle CSS Shaders (within CSS Filters) support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CSS_VARIABLES "Toggle CSS Variables support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CUSTOM_SCHEME_HANDLER "Toggle Custom Scheme Handler support" OFF) - WEBKIT_OPTION_DEFINE(ENABLE_DATALIST "Toggle HTML5 datalist support" OFF) + WEBKIT_OPTION_DEFINE(ENABLE_DATALIST_ELEMENT "Toggle HTML5 datalist support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_DATA_TRANSFER_ITEMS "Toggle HTML5 data transfer items support" OFF) - WEBKIT_OPTION_DEFINE(ENABLE_DETAILS "Toggle HTML5 details support" ON) + WEBKIT_OPTION_DEFINE(ENABLE_DETAILS_ELEMENT "Toggle HTML5 details support" ON) WEBKIT_OPTION_DEFINE(ENABLE_DEVICE_ORIENTATION "Toggle DeviceOrientation support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_DIALOG_ELEMENT "Toggle Dialog Element support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_DIRECTORY_UPLOAD "Toggle Directory upload support" OFF) @@ -72,7 +72,7 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SOURCE "Toggle Media Source support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STATISTICS "Toggle Media Statistics support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STREAM "Toggle Media Stream API support" OFF) - WEBKIT_OPTION_DEFINE(ENABLE_METER_TAG "Toggle Meter Tag support" ON) + WEBKIT_OPTION_DEFINE(ENABLE_METER_ELEMENT "Toggle Meter Tag support" ON) WEBKIT_OPTION_DEFINE(ENABLE_MHTML "Toggle MHTML support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MICRODATA "Toggle Microdata support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MUTATION_OBSERVERS "Toggle DOM mutation observer support" ON) @@ -81,7 +81,7 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_NOTIFICATIONS "Toggle Desktop Notifications Support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_ORIENTATION_EVENTS "Toggle Orientation Events support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_PAGE_VISIBILITY_API "Toggle Page Visibility API support" OFF) - WEBKIT_OPTION_DEFINE(ENABLE_PROGRESS_TAG "Toggle Progress Tag support" ON) + WEBKIT_OPTION_DEFINE(ENABLE_PROGRESS_ELEMENT "Toggle Progress Tag support" ON) WEBKIT_OPTION_DEFINE(ENABLE_PLUGIN_PROXY_FOR_VIDEO "Toggle Plugin Proxy for Video support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_QUOTA "Toggle Quota support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_REGISTER_PROTOCOL_HANDLER "Toggle Register Protocol Handler support" OFF) diff --git a/Source/cmakeconfig.h.cmake b/Source/cmakeconfig.h.cmake index a12e43a24..b9a39eb24 100644 --- a/Source/cmakeconfig.h.cmake +++ b/Source/cmakeconfig.h.cmake @@ -24,9 +24,9 @@ #cmakedefine01 ENABLE_CSS_REGIONS #cmakedefine01 ENABLE_CSS_VARIABLES #cmakedefine01 ENABLE_CUSTOM_SCHEME_HANDLER -#cmakedefine01 ENABLE_DATALIST +#cmakedefine01 ENABLE_DATALIST_ELEMENT #cmakedefine01 ENABLE_DATA_TRANSFER_ITEMS -#cmakedefine01 ENABLE_DETAILS +#cmakedefine01 ENABLE_DETAILS_ELEMENT #cmakedefine01 ENABLE_DEVICE_ORIENTATION #cmakedefine01 ENABLE_DIALOG_ELEMENT #cmakedefine01 ENABLE_DOWNLOAD_ATTRIBUTE @@ -61,7 +61,7 @@ #cmakedefine01 ENABLE_LEGACY_WEBKIT_BLOB_BUILDER #cmakedefine01 ENABLE_MATHML #cmakedefine01 ENABLE_MEDIA_STREAM -#cmakedefine01 ENABLE_METER_TAG +#cmakedefine01 ENABLE_METER_ELEMENT #cmakedefine01 ENABLE_MICRODATA #cmakedefine01 ENABLE_MUTATION_OBSERVERS #cmakedefine01 ENABLE_NETSCAPE_PLUGIN_API @@ -71,7 +71,7 @@ #cmakedefine01 ENABLE_OVERFLOW_SCROLLING #cmakedefine01 ENABLE_PAGE_POPUP #cmakedefine01 ENABLE_PAGE_VISIBILITY_API -#cmakedefine01 ENABLE_PROGRESS_TAG +#cmakedefine01 ENABLE_PROGRESS_ELEMENT #cmakedefine01 ENABLE_REGISTER_PROTOCOL_HANDLER #cmakedefine01 ENABLE_REQUEST_ANIMATION_FRAME #cmakedefine01 ENABLE_SHADOW_DOM |