diff options
950 files changed, 23265 insertions, 9605 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 90ff03ab7..8071d61f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,13 @@ INCLUDE(OptionsCommon) INCLUDE(Options${PORT}) # ----------------------------------------------------------------------------- +# Enable API unit tests and create a target for the test runner +# ----------------------------------------------------------------------------- +IF (ENABLE_API_TESTS) + ENABLE_TESTING() +ENDIF () + +# ----------------------------------------------------------------------------- # Install JavaScript shell # ----------------------------------------------------------------------------- OPTION(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell") @@ -1,3 +1,51 @@ +2012-07-12 Josh Hawn <jhawn@apple.com> + + Fix for WebContext::getWebCoreStatistics() causes crash if no m_process + https://bugs.webkit.org/show_bug.cgi?id=91116 + + Reviewed by Simon Fraser. + + * Source/WebKit2/UIProcess/WebContext.cpp: + WebContext::getWebCoreStatistics(): + Now invalidates callback if no m_process. + +2012-07-13 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [CMake] Proper handling of ENABLE_API_TESTS build option + https://bugs.webkit.org/show_bug.cgi?id=91221 + + Reviewed by Rob Buis. + + Make the flag reusable across the ports using CMake. We are about to enable the WTF, + WebCore and WebKit 2 API's at Tools/TestWebKitAPI and other ports using CMake can get + it almost for free. + + * CMakeLists.txt: + * Source/cmake/OptionsEfl.cmake: + * Source/cmake/WebKitFeatures.cmake: + * Source/cmakeconfig.h.cmake: + +2012-07-11 Matt Falkenhagen <falken@chromium.org> + + Add dialog element feature toggle to InternalSettings + https://bugs.webkit.org/show_bug.cgi?id=90934 + + Reviewed by Hajime Morita. + + * Source/autotools/symbols.filter: Added newly exported symbol. + +2012-07-11 Arnaud Renevier <a.renevier@sisa.samsung.com> + + [Gtk] allow building with css-filters + https://bugs.webkit.org/show_bug.cgi?id=90908 + + Add support for css-filters in Source/WebCore/GNUmakefile.am + configure.ac + + Reviewed by Eric Seidel. + + * configure.ac: + 2012-07-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> [CMAKE] Add missing feature macros diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index 412be293f..4b030ca40 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -56,6 +56,7 @@ SET(JavaScriptCore_SOURCES bytecode/PutByIdStatus.cpp bytecode/ResolveGlobalStatus.cpp bytecode/SamplingTool.cpp + bytecode/StructureStubClearingWatchpoint.cpp bytecode/StructureStubInfo.cpp bytecode/Watchpoint.cpp @@ -143,6 +144,7 @@ SET(JavaScriptCore_SOURCES jit/JITPropertyAccess.cpp jit/JITStubRoutine.cpp jit/JITStubs.cpp + jit/JumpReplacementWatchpoint.cpp jit/ThunkGenerators.cpp parser/Lexer.cpp diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index f0e93b012..2697bbb8f 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,20 +1,479 @@ -2012-06-13 Patrick Gansterer <paroga@webkit.org> +2012-07-13 Mark Lam <mark.lam@apple.com> - [WIN] Remove dependency on pthread from MachineStackMarker - https://bugs.webkit.org/show_bug.cgi?id=68429 + OfflineASM Pretty printing and commenting enhancements. + https://bugs.webkit.org/show_bug.cgi?id=91281 - Reviewed by NOBODY (OOPS!). + Reviewed by Filip Pizlo. - Implement pthread TLS functionality with native windows functions. + Added some minor pretty printing in the OfflineASM. + Also added infrastruture for adding multiple types of comments and + annotations with the ability to enable/disable them in the generated + output as desired. - * 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: + * GNUmakefile.list.am: add new file config.rb. + * llint/LLIntOfflineAsmConfig.h: + Added OFFLINE_ASM_BEGIN, OFFLINE_ASM_END, and OFFLINE_ASM_LOCAL_LABEL macros. + This will allow us to redefine these for other backends later. + * llint/LowLevelInterpreter32_64.asm: + Add a small example of instruction annotations for now. + * llint/LowLevelInterpreter64.asm: + Add a small example of instruction annotations for now. + * offlineasm/armv7.rb: Added handling of annotations. + * offlineasm/asm.rb: + Added machinery to dump the new comments and annotations. + Also added some indentations to make the output a little prettier. + * offlineasm/ast.rb: Added annotation field in class Instruction. + * offlineasm/backends.rb: + * offlineasm/config.rb: Added. + Currently only contains commenting options. This file is meant to be + a centralized place for build config values much like config.h for + JavaScriptCore. + * offlineasm/generate_offset_extractor.rb: + * offlineasm/instructions.rb: + * offlineasm/offsets.rb: + * offlineasm/opt.rb: + * offlineasm/parser.rb: Parse and record annotations. + * offlineasm/registers.rb: + * offlineasm/self_hash.rb: + * offlineasm/settings.rb: + * offlineasm/transform.rb: + * offlineasm/x86.rb: Added handling of annotations. + +2012-07-13 Filip Pizlo <fpizlo@apple.com> + + ASSERTION FAILED: use.useKind() != DoubleUse + https://bugs.webkit.org/show_bug.cgi?id=91082 + + Reviewed by Geoffrey Garen. + + The implementation of Branch() was unwisely relying on register allocation state + to decide what speculations to perform. That's never correct. + + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-07-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122640. + http://trac.webkit.org/changeset/122640 + https://bugs.webkit.org/show_bug.cgi?id=91298 + + LLInt apparently does not expect to mark these (Requested by + olliej on #webkit). + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::visitStructures): + (JSC::CodeBlock::stronglyVisitStrongReferences): + +2012-07-13 Oliver Hunt <oliver@apple.com> + + LLInt fails to mark structures stored in the bytecode + https://bugs.webkit.org/show_bug.cgi?id=91296 + + Reviewed by Geoffrey Garen. + + LLInt stores structures in the bytecode, so we need to visit the appropriate + instructions as we would if we were running in the classic interpreter. + This requires adding additional checks for the LLInt specific opcodes, and + the lint specific variants of operand ordering. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::visitStructures): + (JSC::CodeBlock::stronglyVisitStrongReferences): + +2012-07-13 Yong Li <yoli@rim.com> + + [BlackBerry] Implement GCActivityCallback with platform timer + https://bugs.webkit.org/show_bug.cgi?id=90175 + + Reviewed by Rob Buis. + + Implement GCActivityCallback and HeapTimer for BlackBerry port. + + * heap/HeapTimer.cpp: + (JSC): + (JSC::HeapTimer::HeapTimer): + (JSC::HeapTimer::~HeapTimer): + (JSC::HeapTimer::timerDidFire): + (JSC::HeapTimer::synchronize): + (JSC::HeapTimer::invalidate): + (JSC::HeapTimer::didStartVMShutdown): + * heap/HeapTimer.h: + (HeapTimer): + * runtime/GCActivityCallbackBlackBerry.cpp: + (JSC): + (JSC::DefaultGCActivityCallback::doWork): + (JSC::DefaultGCActivityCallback::didAllocate): + (JSC::DefaultGCActivityCallback::willCollect): + (JSC::DefaultGCActivityCallback::cancel): + +2012-07-13 Patrick Gansterer <paroga@webkit.org> + + [WIN] Fix compilation of DFGRepatch.cpp + https://bugs.webkit.org/show_bug.cgi?id=91241 + + Reviewed by Geoffrey Garen. + + Use intptr_t instead of uintptr_t when calling CodeLocationCommon::dataLabelPtrAtOffset(int) + to fix MSVC "unary minus operator applied to unsigned type, result still unsigned" warning. + + * dfg/DFGRepatch.cpp: + (JSC::DFG::dfgResetGetByID): + (JSC::DFG::dfgResetPutByID): + +2012-07-13 Patrick Gansterer <paroga@webkit.org> + + Fix ARM_TRADITIONAL JIT for COMPILER(MSVC) and COMPILER(RVCT) after r121885 + https://bugs.webkit.org/show_bug.cgi?id=91238 + + Reviewed by Zoltan Herczeg. + + r121885 changed the assembler instruction only for COMPILER(GCC). + Use the same instructions for the other compilers too. + + * jit/JITStubs.cpp: + (JSC::ctiTrampoline): + (JSC::ctiTrampolineEnd): + (JSC::ctiVMThrowTrampoline): + +2012-07-12 Filip Pizlo <fpizlo@apple.com> + + DFG property access stubs should use structure transition watchpoints + https://bugs.webkit.org/show_bug.cgi?id=91135 + + Reviewed by Geoffrey Garen. + + This adds a Watchpoint subclass that will clear a structure stub (i.e. + a property access stub) when fired. The DFG stub generation code now + uses this optimization. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * Target.pri: + * bytecode/CodeBlock.cpp: + (JSC): + (JSC::CodeBlock::finalizeUnconditionally): + (JSC::CodeBlock::resetStub): + (JSC::CodeBlock::resetStubInternal): + * bytecode/CodeBlock.h: + (JSC): + (CodeBlock): + * bytecode/StructureStubClearingWatchpoint.cpp: Added. + (JSC): + (JSC::StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint): + (JSC::StructureStubClearingWatchpoint::push): + (JSC::StructureStubClearingWatchpoint::fireInternal): + (JSC::WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo): + (JSC::WatchpointsOnStructureStubInfo::addWatchpoint): + (JSC::WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint): + * bytecode/StructureStubClearingWatchpoint.h: Added. + (JSC): + (StructureStubClearingWatchpoint): + (JSC::StructureStubClearingWatchpoint::StructureStubClearingWatchpoint): + (WatchpointsOnStructureStubInfo): + (JSC::WatchpointsOnStructureStubInfo::WatchpointsOnStructureStubInfo): + (JSC::WatchpointsOnStructureStubInfo::codeBlock): + (JSC::WatchpointsOnStructureStubInfo::stubInfo): + * bytecode/StructureStubInfo.h: + (JSC::StructureStubInfo::reset): + (JSC::StructureStubInfo::addWatchpoint): + (StructureStubInfo): + * dfg/DFGRepatch.cpp: + (JSC::DFG::addStructureTransitionCheck): + (DFG): + (JSC::DFG::generateProtoChainAccessStub): + (JSC::DFG::emitPutTransitionStub): + * jit/JumpReplacementWatchpoint.h: + +2012-07-12 Filip Pizlo <fpizlo@apple.com> + + DFG CFA may get overzealous in loops that have code that must exit + https://bugs.webkit.org/show_bug.cgi?id=91188 + + Reviewed by Gavin Barraclough. + + Ensure that if the CFA assumes that an operation must exit, then it will always exit + no matter what happens after. That's necessary to preserve soundness. + + Remove a broken fixup done by the DFG simplifier, where it was trying to say that the + variable-at-head was the first access in the second block in the merge, if the first + block did not read the variable. That's totally wrong, if the first block was in fact + doing a phantom read. I removed that fixup and instead hardened the rest of the + compiler. + + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::endBasicBlock): + * dfg/DFGBasicBlock.h: + (JSC::DFG::BasicBlock::BasicBlock): + (BasicBlock): + * dfg/DFGCFAPhase.cpp: + (JSC::DFG::CFAPhase::performBlockCFA): + * dfg/DFGCFGSimplificationPhase.cpp: + (JSC::DFG::CFGSimplificationPhase::mergeBlocks): + * dfg/DFGConstantFoldingPhase.cpp: + (JSC::DFG::ConstantFoldingPhase::ConstantFoldingPhase): + (JSC::DFG::ConstantFoldingPhase::run): + (ConstantFoldingPhase): + (JSC::DFG::ConstantFoldingPhase::foldConstants): + (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode): + * dfg/DFGVariableEventStream.cpp: + (JSC::DFG::VariableEventStream::reconstruct): + +2012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] Implement MemoryUsageSupport + https://bugs.webkit.org/show_bug.cgi?id=91094 + + Reviewed by Adam Barth. + + Compile in MemoryStatistics so we can make use of the interface. + + * Target.pri: + +2012-07-12 Csaba Osztrogonác <ossy@webkit.org> + + Remove dead code after r122392. + https://bugs.webkit.org/show_bug.cgi?id=91049 + + Reviewed by Filip Pizlo. + + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::emitCall): + +2012-07-11 Adenilson Cavalcanti <cavalcantii@gmail.com> + + Build fix + remove dead code + https://bugs.webkit.org/show_bug.cgi?id=91039 + + Reviewed by Filip Pizlo. + + An unused variable was breaking compilation (thanks to warnings being treated as errors). + + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::emitCall): + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + +2012-07-11 Filip Pizlo <fpizlo@apple.com> + + DFG should have fast virtual calls + https://bugs.webkit.org/show_bug.cgi?id=90924 + + Reviewed by Gavin Barraclough. + + Implements virtual call support in the style of the old JIT, with the + caveat that we still use the same slow path for both InternalFunction + calls and JSFunction calls. Also rationalized the way that our + CodeOrigin indices tie into exception checks (previously it was a + strange one-to-one mapping with fairly limited assertions; now it's a + one-to-many mapping for CodeOrigins to exception checks, respectively). + I also took the opportunity to clean up + CallLinkInfo::callReturnLocation, which previously was either a Call or + a NearCall. Now it's just a NearCall. As well, exceptions during slow + path call resolution are now handled by returning an exception throwing + thunk rather than returning null. And finally, I made a few things + public that were previously private-with-lots-of-friends, because I + truly despise the thought of listing each thunk generating function as + a friend of JSValue and friends. + + * bytecode/CallLinkInfo.cpp: + (JSC::CallLinkInfo::unlink): + * bytecode/CallLinkInfo.h: + (CallLinkInfo): + * bytecode/CodeOrigin.h: + (JSC::CodeOrigin::CodeOrigin): + (JSC::CodeOrigin::isSet): + * dfg/DFGAssemblyHelpers.h: + (JSC::DFG::AssemblyHelpers::AssemblyHelpers): + * dfg/DFGCCallHelpers.h: + (JSC::DFG::CCallHelpers::CCallHelpers): + * dfg/DFGGPRInfo.h: + (GPRInfo): + * dfg/DFGJITCompiler.cpp: + (JSC::DFG::JITCompiler::link): + (JSC::DFG::JITCompiler::compileFunction): + * dfg/DFGJITCompiler.h: + (JSC::DFG::CallBeginToken::CallBeginToken): + (JSC::DFG::CallBeginToken::~CallBeginToken): + (CallBeginToken): + (JSC::DFG::CallBeginToken::set): + (JSC::DFG::CallBeginToken::registerWithExceptionCheck): + (JSC::DFG::CallBeginToken::codeOrigin): + (JSC::DFG::CallExceptionRecord::CallExceptionRecord): + (CallExceptionRecord): + (JSC::DFG::JITCompiler::currentCodeOriginIndex): + (JITCompiler): + (JSC::DFG::JITCompiler::beginCall): + (JSC::DFG::JITCompiler::notifyCall): + (JSC::DFG::JITCompiler::prepareForExceptionCheck): + (JSC::DFG::JITCompiler::addExceptionCheck): + (JSC::DFG::JITCompiler::addFastExceptionCheck): + * dfg/DFGOperations.cpp: + * dfg/DFGRepatch.cpp: + (JSC::DFG::dfgLinkFor): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheck): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::emitCall): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::emitCall): + * dfg/DFGThunks.cpp: + (JSC::DFG::emitPointerValidation): + (DFG): + (JSC::DFG::throwExceptionFromCallSlowPathGenerator): + (JSC::DFG::slowPathFor): + (JSC::DFG::linkForThunkGenerator): + (JSC::DFG::linkCallThunkGenerator): + (JSC::DFG::linkConstructThunkGenerator): + (JSC::DFG::virtualForThunkGenerator): + (JSC::DFG::virtualCallThunkGenerator): + (JSC::DFG::virtualConstructThunkGenerator): + * dfg/DFGThunks.h: + (DFG): + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + (JSC::JIT::linkFor): + * runtime/Executable.h: + (ExecutableBase): + (JSC::ExecutableBase::offsetOfJITCodeFor): + (JSC::ExecutableBase::offsetOfNumParametersFor): + * runtime/JSValue.h: + (JSValue): + +2012-07-11 Filip Pizlo <fpizlo@apple.com> + + Accidentally used the wrong license (3-clause instead of 2-clause) in some + files I just committed. + + Rubber stamped by Oliver Hunt. + + * bytecode/Watchpoint.cpp: + * bytecode/Watchpoint.h: + * jit/JumpReplacementWatchpoint.cpp: + * jit/JumpReplacementWatchpoint.h: + +2012-07-11 Filip Pizlo <fpizlo@apple.com> + + Watchpoints and jump replacement should be decoupled + https://bugs.webkit.org/show_bug.cgi?id=91016 + + Reviewed by Oliver Hunt. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * Target.pri: + * assembler/AbstractMacroAssembler.h: + (JSC): + (Label): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::appendWatchpoint): + (JSC::CodeBlock::watchpoint): + (DFGData): + * bytecode/Watchpoint.cpp: + (JSC): + * bytecode/Watchpoint.h: + (JSC::Watchpoint::Watchpoint): + (Watchpoint): + (JSC::Watchpoint::fire): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::speculationWatchpoint): + * jit/JumpReplacementWatchpoint.cpp: Added. + (JSC): + (JSC::JumpReplacementWatchpoint::correctLabels): + (JSC::JumpReplacementWatchpoint::fireInternal): + * jit/JumpReplacementWatchpoint.h: Added. + (JSC): + (JumpReplacementWatchpoint): + (JSC::JumpReplacementWatchpoint::JumpReplacementWatchpoint): + (JSC::JumpReplacementWatchpoint::setDestination): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Don't try to build udis86_itab.c since it's included by + another file. + + * wscript: + +2012-07-11 Chao-ying Fu <fu@mips.com> + + Add MIPS convertibleLoadPtr and other functions + https://bugs.webkit.org/show_bug.cgi?id=90714 + + Reviewed by Oliver Hunt. + + * assembler/MIPSAssembler.h: + (JSC::MIPSAssembler::labelIgnoringWatchpoints): + (MIPSAssembler): + (JSC::MIPSAssembler::replaceWithLoad): + (JSC::MIPSAssembler::replaceWithAddressComputation): + * assembler/MacroAssemblerMIPS.h: + (JSC::MacroAssemblerMIPS::convertibleLoadPtr): + (MacroAssemblerMIPS): + +2012-07-11 Anders Carlsson <andersca@apple.com> + + Add -Wtautological-compare and -Wsign-compare warning flags + https://bugs.webkit.org/show_bug.cgi?id=90994 + + Reviewed by Mark Rowe. + + * Configurations/Base.xcconfig: + +2012-07-11 Benjamin Poulain <bpoulain@apple.com> + + Simplify the copying of JSC ARMv7's LinkRecord + https://bugs.webkit.org/show_bug.cgi?id=90930 + + Reviewed by Filip Pizlo. + + The class LinkRecord is used by value everywhere in ARMv7Assembler. The compiler uses + memmove() to move the objects. + + The problem is memmove() is overkill for this object, moving the value can be done with + 3 load-store. This patch adds an operator= to the class doing more efficient copying. + This reduces the link time by 19%. + + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::LinkRecord::LinkRecord): + (JSC::ARMv7Assembler::LinkRecord::operator=): + (JSC::ARMv7Assembler::LinkRecord::from): + (JSC::ARMv7Assembler::LinkRecord::setFrom): + (JSC::ARMv7Assembler::LinkRecord::to): + (JSC::ARMv7Assembler::LinkRecord::type): + (JSC::ARMv7Assembler::LinkRecord::linkType): + (JSC::ARMv7Assembler::LinkRecord::setLinkType): + (JSC::ARMv7Assembler::LinkRecord::condition): + +2012-07-11 Andy Wingo <wingo@igalia.com> + + jsc: Parse options before creating global data + https://bugs.webkit.org/show_bug.cgi?id=90975 + + Reviewed by Filip Pizlo. + + This patch moves the options parsing in "jsc" before the creation + of the JSGlobalData, so that --useJIT=no has a chance to take + effect. + + * jsc.cpp: + (CommandLine::parseArguments): Refactor to be a class, and take + argc and argv as constructor arguments. + (jscmain): Move arg parsing before JSGlobalData creation. 2012-07-10 Filip Pizlo <fpizlo@apple.com> diff --git a/Source/JavaScriptCore/Configurations/Base.xcconfig b/Source/JavaScriptCore/Configurations/Base.xcconfig index 96e9a356f..47c8f7382 100644 --- a/Source/JavaScriptCore/Configurations/Base.xcconfig +++ b/Source/JavaScriptCore/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors; +COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; @@ -54,6 +54,7 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_SIGN_COMPARE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); @@ -126,18 +127,15 @@ DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT)); SECTORDER_FLAGS = -Wl,-order_file,JavaScriptCore.order; -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; // HAVE_DTRACE is disabled on Leopard due to <rdar://problem/5628149> diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index 7e6056e97..751d5657a 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -134,6 +134,8 @@ javascriptcore_sources += \ Source/JavaScriptCore/bytecode/StructureSet.h \ Source/JavaScriptCore/bytecode/StructureStubInfo.cpp \ Source/JavaScriptCore/bytecode/StructureStubInfo.h \ + Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp \ + Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h \ Source/JavaScriptCore/bytecode/ValueProfile.h \ Source/JavaScriptCore/bytecode/ValueRecovery.h \ Source/JavaScriptCore/bytecode/VirtualRegister.h \ @@ -383,6 +385,8 @@ javascriptcore_sources += \ Source/JavaScriptCore/jit/JITStubs.h \ Source/JavaScriptCore/jit/JITWriteBarrier.h \ Source/JavaScriptCore/jit/JSInterfaceJIT.h \ + Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp \ + Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h \ Source/JavaScriptCore/jit/SpecializedThunkJIT.h \ Source/JavaScriptCore/jit/ThunkGenerators.cpp \ Source/JavaScriptCore/jit/ThunkGenerators.h \ @@ -680,6 +684,7 @@ offlineasm_nosources += \ Source/JavaScriptCore/offlineasm/asm.rb \ Source/JavaScriptCore/offlineasm/ast.rb \ Source/JavaScriptCore/offlineasm/backends.rb \ + Source/JavaScriptCore/offlineasm/config.rb \ Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb \ Source/JavaScriptCore/offlineasm/instructions.rb \ Source/JavaScriptCore/offlineasm/offsets.rb \ 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 c50013ac1..dfa38aafb 100755 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -72,6 +72,9 @@ EXPORTS ?append@StringBuilder@WTF@@QAEXPB_WI@Z ?ascii@UString@JSC@@QBE?AVCString@WTF@@XZ ?attach@Debugger@JSC@@QAEXPAVJSGlobalObject@2@@Z + ?base64Decode@WTF@@YA_NABVString@1@AAV?$Vector@D$0A@@1@W4Base64DecodePolicy@1@@Z + ?base64Encode@WTF@@YA?AVString@1@PBDIW4Base64EncodePolicy@1@@Z + ?base64Encode@WTF@@YAXPBDIAAV?$Vector@D$0A@@1@W4Base64EncodePolicy@1@@Z ?broadcast@ThreadCondition@WTF@@QAEXXZ ?bufferLengthForStringDecimal@DecimalNumber@WTF@@QBEIXZ ?bufferLengthForStringExponential@DecimalNumber@WTF@@QBEIXZ diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index 92749eb75..2efa84059 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -1682,6 +1682,14 @@ > </File> <File + RelativePath="..\..\bytecode\StructureStubClearingWatchpoint.cpp" + > + </File> + <File + RelativePath="..\..\bytecode\StructureStubClearingWatchpoint.h" + > + </File> + <File RelativePath="..\..\bytecode\StructureStubInfo.cpp" > </File> @@ -1942,6 +1950,14 @@ > </File> <File + RelativePath="..\..\jit\JumpReplacementWatchpoint.cpp" + > + </File> + <File + RelativePath="..\..\jit\JumpReplacementWatchpoint.h" + > + </File> + <File RelativePath="..\..\jit\JSInterfaceJIT.h" > </File> diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index 188c1ffe7..f9548f184 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -146,6 +146,10 @@ 0F766D2F15A8DCE0008F363E /* GCAwareJITStubRoutine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F766D2D15A8DCDD008F363E /* GCAwareJITStubRoutine.cpp */; }; 0F766D3015A8DCE2008F363E /* GCAwareJITStubRoutine.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F766D2E15A8DCDD008F363E /* GCAwareJITStubRoutine.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F766D3115AA8112008F363E /* JITStubRoutine.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F766D1C15A5028D008F363E /* JITStubRoutine.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 0F766D3415AE2538008F363E /* JumpReplacementWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F766D3215AE2535008F363E /* JumpReplacementWatchpoint.cpp */; }; + 0F766D3515AE253B008F363E /* JumpReplacementWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F766D3315AE2535008F363E /* JumpReplacementWatchpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 0F766D3815AE4A1C008F363E /* StructureStubClearingWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F766D3615AE4A1A008F363E /* StructureStubClearingWatchpoint.cpp */; }; + 0F766D3915AE4A1F008F363E /* StructureStubClearingWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F766D3715AE4A1A008F363E /* StructureStubClearingWatchpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F7700921402FF3C0078EB39 /* SamplingCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F7700911402FF280078EB39 /* SamplingCounter.cpp */; }; 0F7B294A14C3CD29007C3DB1 /* DFGCCallHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7B294814C3CD23007C3DB1 /* DFGCCallHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F7B294B14C3CD2F007C3DB1 /* DFGCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82E1F14172C2F00179C94 /* DFGCapabilities.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -887,6 +891,10 @@ 0F766D2A15A8CC34008F363E /* JITStubRoutineSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubRoutineSet.h; sourceTree = "<group>"; }; 0F766D2D15A8DCDD008F363E /* GCAwareJITStubRoutine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GCAwareJITStubRoutine.cpp; sourceTree = "<group>"; }; 0F766D2E15A8DCDD008F363E /* GCAwareJITStubRoutine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCAwareJITStubRoutine.h; sourceTree = "<group>"; }; + 0F766D3215AE2535008F363E /* JumpReplacementWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JumpReplacementWatchpoint.cpp; sourceTree = "<group>"; }; + 0F766D3315AE2535008F363E /* JumpReplacementWatchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpReplacementWatchpoint.h; sourceTree = "<group>"; }; + 0F766D3615AE4A1A008F363E /* StructureStubClearingWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructureStubClearingWatchpoint.cpp; sourceTree = "<group>"; }; + 0F766D3715AE4A1A008F363E /* StructureStubClearingWatchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureStubClearingWatchpoint.h; sourceTree = "<group>"; }; 0F77008E1402FDD60078EB39 /* SamplingCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SamplingCounter.h; sourceTree = "<group>"; }; 0F7700911402FF280078EB39 /* SamplingCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SamplingCounter.cpp; sourceTree = "<group>"; }; 0F7B294814C3CD23007C3DB1 /* DFGCCallHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCCallHelpers.h; path = dfg/DFGCCallHelpers.h; sourceTree = "<group>"; }; @@ -1731,6 +1739,8 @@ 14A6581A0F4E36F4000150FD /* JITStubs.h */, A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */, A76C51741182748D00715B05 /* JSInterfaceJIT.h */, + 0F766D3215AE2535008F363E /* JumpReplacementWatchpoint.cpp */, + 0F766D3315AE2535008F363E /* JumpReplacementWatchpoint.h */, A7386551118697B400540279 /* SpecializedThunkJIT.h */, A7386552118697B400540279 /* ThunkGenerators.cpp */, A7386553118697B400540279 /* ThunkGenerators.h */, @@ -2433,6 +2443,8 @@ 0FD82E4F141DAEA100179C94 /* SpeculatedType.h */, 1429D8830ED21C3D00B89619 /* SamplingTool.cpp */, 1429D8840ED21C3D00B89619 /* SamplingTool.h */, + 0F766D3615AE4A1A008F363E /* StructureStubClearingWatchpoint.cpp */, + 0F766D3715AE4A1A008F363E /* StructureStubClearingWatchpoint.h */, BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */, BCCF0D070EF0AAB900413C8F /* StructureStubInfo.h */, 0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */, @@ -2836,6 +2848,8 @@ 0F766D2C15A8CC3A008F363E /* JITStubRoutineSet.h in Headers */, 0F766D3015A8DCE2008F363E /* GCAwareJITStubRoutine.h in Headers */, 0F766D3115AA8112008F363E /* JITStubRoutine.h in Headers */, + 0F766D3515AE253B008F363E /* JumpReplacementWatchpoint.h in Headers */, + 0F766D3915AE4A1F008F363E /* StructureStubClearingWatchpoint.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3431,6 +3445,8 @@ 0F766D2815A8CC1E008F363E /* JITStubRoutine.cpp in Sources */, 0F766D2B15A8CC38008F363E /* JITStubRoutineSet.cpp in Sources */, 0F766D2F15A8DCE0008F363E /* GCAwareJITStubRoutine.cpp in Sources */, + 0F766D3415AE2538008F363E /* JumpReplacementWatchpoint.cpp in Sources */, + 0F766D3815AE4A1C008F363E /* StructureStubClearingWatchpoint.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/JavaScriptCore/Target.pri b/Source/JavaScriptCore/Target.pri index b019e417e..035656f0c 100644 --- a/Source/JavaScriptCore/Target.pri +++ b/Source/JavaScriptCore/Target.pri @@ -67,6 +67,7 @@ SOURCES += \ bytecode/ResolveGlobalStatus.cpp \ bytecode/SamplingTool.cpp \ bytecode/SpeculatedType.cpp \ + bytecode/StructureStubClearingWatchpoint.cpp \ bytecode/StructureStubInfo.cpp \ bytecode/Watchpoint.cpp \ bytecompiler/BytecodeGenerator.cpp \ @@ -151,6 +152,7 @@ SOURCES += \ jit/JITPropertyAccess32_64.cpp \ jit/JITStubRoutine.cpp \ jit/JITStubs.cpp \ + jit/JumpReplacementWatchpoint.cpp \ jit/ThunkGenerators.cpp \ parser/Lexer.cpp \ parser/Nodes.cpp \ @@ -217,6 +219,7 @@ SOURCES += \ runtime/LiteralParser.cpp \ runtime/Lookup.cpp \ runtime/MathObject.cpp \ + runtime/MemoryStatistics.cpp \ runtime/NameConstructor.cpp \ runtime/NameInstance.cpp \ runtime/NamePrototype.cpp \ diff --git a/Source/JavaScriptCore/assembler/ARMv7Assembler.h b/Source/JavaScriptCore/assembler/ARMv7Assembler.h index eef0ba8a7..96c4f096c 100644 --- a/Source/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/Source/JavaScriptCore/assembler/ARMv7Assembler.h @@ -462,28 +462,42 @@ public: class LinkRecord { public: LinkRecord(intptr_t from, intptr_t to, JumpType type, Condition condition) - : m_from(from) - , m_to(to) - , m_type(type) - , m_linkType(LinkInvalid) - , m_condition(condition) { + data.realTypes.m_from = from; + data.realTypes.m_to = to; + data.realTypes.m_type = type; + data.realTypes.m_linkType = LinkInvalid; + data.realTypes.m_condition = condition; } - intptr_t from() const { return m_from; } - void setFrom(intptr_t from) { m_from = from; } - intptr_t to() const { return m_to; } - JumpType type() const { return m_type; } - JumpLinkType linkType() const { return m_linkType; } - void setLinkType(JumpLinkType linkType) { ASSERT(m_linkType == LinkInvalid); m_linkType = linkType; } - Condition condition() const { return m_condition; } + void operator=(const LinkRecord& other) + { + data.copyTypes.content[0] = other.data.copyTypes.content[0]; + data.copyTypes.content[1] = other.data.copyTypes.content[1]; + data.copyTypes.content[2] = other.data.copyTypes.content[2]; + } + intptr_t from() const { return data.realTypes.m_from; } + void setFrom(intptr_t from) { data.realTypes.m_from = from; } + intptr_t to() const { return data.realTypes.m_to; } + JumpType type() const { return data.realTypes.m_type; } + JumpLinkType linkType() const { return data.realTypes.m_linkType; } + void setLinkType(JumpLinkType linkType) { ASSERT(data.realTypes.m_linkType == LinkInvalid); data.realTypes.m_linkType = linkType; } + Condition condition() const { return data.realTypes.m_condition; } private: - intptr_t m_from : 31; - intptr_t m_to : 31; - JumpType m_type : 8; - JumpLinkType m_linkType : 8; - Condition m_condition : 16; + union { + struct RealTypes { + intptr_t m_from : 31; + intptr_t m_to : 31; + JumpType m_type : 8; + JumpLinkType m_linkType : 8; + Condition m_condition : 16; + } realTypes; + struct CopyTypes { + uint32_t content[3]; + } copyTypes; + COMPILE_ASSERT(sizeof(RealTypes) == sizeof(CopyTypes), LinkRecordCopyStructSizeEqualsRealStruct); + } data; }; - + ARMv7Assembler() : m_indexOfLastWatchpoint(INT_MIN) , m_indexOfTailOfLastWatchpoint(INT_MIN) diff --git a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h index a24f7573a..ef1808ffb 100644 --- a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -46,6 +46,7 @@ namespace JSC { +class JumpReplacementWatchpoint; class LinkBuffer; class RepatchBuffer; class Watchpoint; @@ -277,6 +278,7 @@ public: friend class AbstractMacroAssembler; friend class DFG::CorrectableJumpPoint; friend class Jump; + friend class JumpReplacementWatchpoint; friend class MacroAssemblerCodeRef; friend class LinkBuffer; friend class Watchpoint; diff --git a/Source/JavaScriptCore/assembler/MIPSAssembler.h b/Source/JavaScriptCore/assembler/MIPSAssembler.h index 7212a182c..65307d950 100644 --- a/Source/JavaScriptCore/assembler/MIPSAssembler.h +++ b/Source/JavaScriptCore/assembler/MIPSAssembler.h @@ -616,6 +616,11 @@ public: // General helpers + AssemblerLabel labelIgnoringWatchpoints() + { + return m_buffer.label(); + } + AssemblerLabel label() { return m_buffer.label(); @@ -809,6 +814,28 @@ public: #endif } + static void replaceWithLoad(void* instructionStart) + { + MIPSWord* insn = reinterpret_cast<MIPSWord*>(instructionStart); + ASSERT((*insn & 0xffe00000) == 0x3c000000); // lui + insn++; + ASSERT((*insn & 0xfc0007ff) == 0x00000021); // addu + insn++; + *insn = 0x8c000000 | ((*insn) & 0x3ffffff); // lw + cacheFlush(insn, 4); + } + + static void replaceWithAddressComputation(void* instructionStart) + { + MIPSWord* insn = reinterpret_cast<MIPSWord*>(instructionStart); + ASSERT((*insn & 0xffe00000) == 0x3c000000); // lui + insn++; + ASSERT((*insn & 0xfc0007ff) == 0x00000021); // addu + insn++; + *insn = 0x24000000 | ((*insn) & 0x3ffffff); // addiu + cacheFlush(insn, 4); + } + private: /* Update each jump in the buffer of newBase. */ void relocateJumps(void* oldBase, void* newBase) diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h index 5adcf9b4e..bc280acec 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h @@ -496,6 +496,20 @@ public: ASSERT_NOT_REACHED(); } + ConvertibleLoadLabel convertibleLoadPtr(Address address, RegisterID dest) + { + ConvertibleLoadLabel result(this); + /* + lui addrTemp, (offset + 0x8000) >> 16 + addu addrTemp, addrTemp, base + lw dest, (offset & 0xffff)(addrTemp) + */ + m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16); + m_assembler.addu(addrTempRegister, addrTempRegister, address.base); + m_assembler.lw(dest, addrTempRegister, address.offset); + return result; + } + // Memory access operations: // // Loads are of the form load(address, destination) and stores of the form diff --git a/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp b/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp index 4c108ecf1..4933a494c 100644 --- a/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp +++ b/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp @@ -27,6 +27,7 @@ #include "CallLinkInfo.h" #include "DFGOperations.h" +#include "DFGThunks.h" #include "RepatchBuffer.h" #if ENABLE(JIT) @@ -38,12 +39,12 @@ void CallLinkInfo::unlink(JSGlobalData& globalData, RepatchBuffer& repatchBuffer if (isDFG) { #if ENABLE(DFG_JIT) - repatchBuffer.relink(CodeLocationCall(callReturnLocation), callType == Construct ? DFG::operationLinkConstruct : DFG::operationLinkCall); + repatchBuffer.relink(callReturnLocation, (callType == Construct ? globalData.getCTIStub(DFG::linkConstructThunkGenerator) : globalData.getCTIStub(DFG::linkCallThunkGenerator)).code()); #else ASSERT_NOT_REACHED(); #endif } else - repatchBuffer.relink(CodeLocationNearCall(callReturnLocation), callType == Construct ? globalData.jitStubs->ctiVirtualConstructLink() : globalData.jitStubs->ctiVirtualCallLink()); + repatchBuffer.relink(callReturnLocation, callType == Construct ? globalData.jitStubs->ctiVirtualConstructLink() : globalData.jitStubs->ctiVirtualCallLink()); hasSeenShouldRepatch = false; callee.clear(); diff --git a/Source/JavaScriptCore/bytecode/CallLinkInfo.h b/Source/JavaScriptCore/bytecode/CallLinkInfo.h index 44d50a971..4a78e5d02 100644 --- a/Source/JavaScriptCore/bytecode/CallLinkInfo.h +++ b/Source/JavaScriptCore/bytecode/CallLinkInfo.h @@ -65,7 +65,7 @@ struct CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> { remove(); } - CodeLocationLabel callReturnLocation; // it's a near call in the old JIT, or a normal call in DFG + CodeLocationNearCall callReturnLocation; CodeLocationDataLabelPtr hotPathBegin; CodeLocationNearCall hotPathOther; JITWriteBarrier<JSFunction> callee; diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 48d0fe728..d417a5fbd 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -2026,16 +2026,16 @@ void CodeBlock::visitWeakReferences(SlotVisitor& visitor) performTracingFixpointIteration(visitor); } -void CodeBlock::finalizeUnconditionally() -{ #if ENABLE(JIT) #if ENABLE(JIT_VERBOSE_OSR) - static const bool verboseUnlinking = true; +static const bool verboseUnlinking = true; #else - static const bool verboseUnlinking = false; +static const bool verboseUnlinking = false; #endif #endif // ENABLE(JIT) +void CodeBlock::finalizeUnconditionally() +{ #if ENABLE(LLINT) Interpreter* interpreter = m_globalData->interpreter; // interpreter->classicEnabled() returns true if the old C++ interpreter is enabled. If that's enabled @@ -2141,28 +2141,10 @@ void CodeBlock::finalizeUnconditionally() for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i) { StructureStubInfo& stubInfo = m_structureStubInfos[i]; - AccessType accessType = static_cast<AccessType>(stubInfo.accessType); - if (stubInfo.visitWeakReferences()) continue; - if (verboseUnlinking) - dataLog("Clearing structure cache (kind %d) in %p.\n", stubInfo.accessType, this); - - if (isGetByIdAccess(accessType)) { - if (getJITCode().jitType() == JITCode::DFGJIT) - DFG::dfgResetGetByID(repatchBuffer, stubInfo); - else - JIT::resetPatchGetById(repatchBuffer, &stubInfo); - } else { - ASSERT(isPutByIdAccess(accessType)); - if (getJITCode().jitType() == JITCode::DFGJIT) - DFG::dfgResetPutByID(repatchBuffer, stubInfo); - else - JIT::resetPatchPutById(repatchBuffer, &stubInfo); - } - - stubInfo.reset(); + resetStubInternal(repatchBuffer, stubInfo); } for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) { @@ -2198,6 +2180,40 @@ void CodeBlock::finalizeUnconditionally() #endif } +#if ENABLE(JIT) +void CodeBlock::resetStub(StructureStubInfo& stubInfo) +{ + if (stubInfo.accessType == access_unset) + return; + + RepatchBuffer repatchBuffer(this); + resetStubInternal(repatchBuffer, stubInfo); +} + +void CodeBlock::resetStubInternal(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo) +{ + AccessType accessType = static_cast<AccessType>(stubInfo.accessType); + + if (verboseUnlinking) + dataLog("Clearing structure cache (kind %d) in %p.\n", stubInfo.accessType, this); + + if (isGetByIdAccess(accessType)) { + if (getJITCode().jitType() == JITCode::DFGJIT) + DFG::dfgResetGetByID(repatchBuffer, stubInfo); + else + JIT::resetPatchGetById(repatchBuffer, &stubInfo); + } else { + ASSERT(isPutByIdAccess(accessType)); + if (getJITCode().jitType() == JITCode::DFGJIT) + DFG::dfgResetPutByID(repatchBuffer, stubInfo); + else + JIT::resetPatchPutById(repatchBuffer, &stubInfo); + } + + stubInfo.reset(); +} +#endif + void CodeBlock::stronglyVisitStrongReferences(SlotVisitor& visitor) { visitor.append(&m_globalObject); diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index ed072f832..56ede595a 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -55,6 +55,7 @@ #include "JITCode.h" #include "JITWriteBarrier.h" #include "JSGlobalObject.h" +#include "JumpReplacementWatchpoint.h" #include "JumpTable.h" #include "LLIntCallLinkInfo.h" #include "LazyOperandValueProfile.h" @@ -103,6 +104,7 @@ namespace JSC { class DFGCodeBlocks; class ExecState; class LLIntOffsetsExtractor; + class RepatchBuffer; inline int unmodifiedArgumentsRegister(int argumentsRegister) { return argumentsRegister - 1; } @@ -204,6 +206,8 @@ namespace JSC { { return *(binarySearch<StructureStubInfo, unsigned, getStructureStubInfoBytecodeIndex>(m_structureStubInfos.begin(), m_structureStubInfos.size(), bytecodeIndex)); } + + void resetStub(StructureStubInfo&); CallLinkInfo& getCallLinkInfo(ReturnAddressPtr returnAddress) { @@ -328,7 +332,7 @@ namespace JSC { return result; } - unsigned appendWatchpoint(const Watchpoint& watchpoint) + unsigned appendWatchpoint(const JumpReplacementWatchpoint& watchpoint) { createDFGDataIfNecessary(); unsigned result = m_dfgData->watchpoints.size(); @@ -367,7 +371,7 @@ namespace JSC { return m_dfgData->speculationRecovery[index]; } - Watchpoint& watchpoint(unsigned index) + JumpReplacementWatchpoint& watchpoint(unsigned index) { return m_dfgData->watchpoints[index]; } @@ -1232,6 +1236,10 @@ namespace JSC { if (!m_rareData) m_rareData = adoptPtr(new RareData); } + +#if ENABLE(JIT) + void resetStubInternal(RepatchBuffer&, StructureStubInfo&); +#endif int m_numParameters; @@ -1299,7 +1307,7 @@ namespace JSC { Vector<DFG::OSREntryData> osrEntry; SegmentedVector<DFG::OSRExit, 8> osrExit; Vector<DFG::SpeculationRecovery> speculationRecovery; - SegmentedVector<Watchpoint, 1, 0> watchpoints; + SegmentedVector<JumpReplacementWatchpoint, 1, 0> watchpoints; Vector<WeakReferenceTransition> transitions; Vector<WriteBarrier<JSCell> > weakReferences; DFG::VariableEventStream variableEventStream; diff --git a/Source/JavaScriptCore/bytecode/CodeOrigin.h b/Source/JavaScriptCore/bytecode/CodeOrigin.h index 034e48f3f..c9c0f7005 100644 --- a/Source/JavaScriptCore/bytecode/CodeOrigin.h +++ b/Source/JavaScriptCore/bytecode/CodeOrigin.h @@ -39,6 +39,8 @@ class ExecutableBase; class JSFunction; struct CodeOrigin { + static const unsigned maximumBytecodeIndex = (1u << 29) - 1; + // Bytecode offset that you'd use to re-execute this instruction. unsigned bytecodeIndex : 29; // Bytecode offset corresponding to the opcode that gives the result (needed to handle @@ -48,7 +50,7 @@ struct CodeOrigin { InlineCallFrame* inlineCallFrame; CodeOrigin() - : bytecodeIndex(std::numeric_limits<uint32_t>::max()) + : bytecodeIndex(maximumBytecodeIndex) , valueProfileOffset(0) , inlineCallFrame(0) { @@ -59,11 +61,11 @@ struct CodeOrigin { , valueProfileOffset(valueProfileOffset) , inlineCallFrame(inlineCallFrame) { - ASSERT(bytecodeIndex < (1u << 29)); + ASSERT(bytecodeIndex <= maximumBytecodeIndex); ASSERT(valueProfileOffset < (1u << 3)); } - bool isSet() const { return bytecodeIndex != std::numeric_limits<uint32_t>::max(); } + bool isSet() const { return bytecodeIndex != maximumBytecodeIndex; } unsigned bytecodeIndexForValueProfile() const { diff --git a/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp new file mode 100644 index 000000000..5cfb3d1e8 --- /dev/null +++ b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "StructureStubClearingWatchpoint.h" + +#if ENABLE(JIT) + +#include "CodeBlock.h" +#include "StructureStubInfo.h" + +namespace JSC { + +StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint() { } + +StructureStubClearingWatchpoint* StructureStubClearingWatchpoint::push( + WatchpointsOnStructureStubInfo& holder, + OwnPtr<StructureStubClearingWatchpoint>& head) +{ + head = adoptPtr(new StructureStubClearingWatchpoint(holder, head.release())); + return head.get(); +} + +void StructureStubClearingWatchpoint::fireInternal() +{ + // This will implicitly cause my own demise: stub reset removes all watchpoints. + // That works, because deleting a watchpoint removes it from the set's list, and + // the set's list traversal for firing is robust against the set changing. + m_holder.codeBlock()->resetStub(*m_holder.stubInfo()); +} + +WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo() +{ +} + +StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::addWatchpoint() +{ + return StructureStubClearingWatchpoint::push(*this, m_head); +} + +StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint( + RefPtr<WatchpointsOnStructureStubInfo>& holderRef, CodeBlock* codeBlock, + StructureStubInfo* stubInfo) +{ + if (!holderRef) + holderRef = adoptRef(new WatchpointsOnStructureStubInfo(codeBlock, stubInfo)); + else { + ASSERT(holderRef->m_codeBlock == codeBlock); + ASSERT(holderRef->m_stubInfo == stubInfo); + } + + return holderRef->addWatchpoint(); +} + +} // namespace JSC + +#endif // ENABLE(JIT) + diff --git a/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h new file mode 100644 index 000000000..827e816ee --- /dev/null +++ b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef StructureStubClearingWatchpoint_h +#define StructureStubClearingWatchpoint_h + +#include "Watchpoint.h" +#include <wtf/Platform.h> + +#if ENABLE(JIT) + +#include <wtf/FastAllocBase.h> +#include <wtf/Noncopyable.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +namespace JSC { + +class CodeBlock; +class WatchpointsOnStructureStubInfo; +struct StructureStubInfo; + +class StructureStubClearingWatchpoint : public Watchpoint { + WTF_MAKE_NONCOPYABLE(StructureStubClearingWatchpoint); + WTF_MAKE_FAST_ALLOCATED; +public: + StructureStubClearingWatchpoint( + WatchpointsOnStructureStubInfo& holder) + : m_holder(holder) + { + } + + StructureStubClearingWatchpoint( + WatchpointsOnStructureStubInfo& holder, + PassOwnPtr<StructureStubClearingWatchpoint> next) + : m_holder(holder) + , m_next(next) + { + } + + virtual ~StructureStubClearingWatchpoint(); + + static StructureStubClearingWatchpoint* push( + WatchpointsOnStructureStubInfo& holder, + OwnPtr<StructureStubClearingWatchpoint>& head); + +protected: + void fireInternal(); + +private: + WatchpointsOnStructureStubInfo& m_holder; + OwnPtr<StructureStubClearingWatchpoint> m_next; +}; + +class WatchpointsOnStructureStubInfo : public RefCounted<WatchpointsOnStructureStubInfo> { +public: + WatchpointsOnStructureStubInfo(CodeBlock* codeBlock, StructureStubInfo* stubInfo) + : m_codeBlock(codeBlock) + , m_stubInfo(stubInfo) + { + } + + ~WatchpointsOnStructureStubInfo(); + + StructureStubClearingWatchpoint* addWatchpoint(); + + static StructureStubClearingWatchpoint* ensureReferenceAndAddWatchpoint( + RefPtr<WatchpointsOnStructureStubInfo>& holderRef, + CodeBlock*, StructureStubInfo*); + + CodeBlock* codeBlock() const { return m_codeBlock; } + StructureStubInfo* stubInfo() const { return m_stubInfo; } + +private: + CodeBlock* m_codeBlock; + StructureStubInfo* m_stubInfo; + OwnPtr<StructureStubClearingWatchpoint> m_head; +}; + +} // namespace JSC + +#endif // ENABLE(JIT) + +#endif // StructureStubClearingWatchpoint_h + diff --git a/Source/JavaScriptCore/bytecode/StructureStubInfo.h b/Source/JavaScriptCore/bytecode/StructureStubInfo.h index 807966cf3..737ea88c2 100644 --- a/Source/JavaScriptCore/bytecode/StructureStubInfo.h +++ b/Source/JavaScriptCore/bytecode/StructureStubInfo.h @@ -36,6 +36,8 @@ #include "MacroAssembler.h" #include "Opcode.h" #include "Structure.h" +#include "StructureStubClearingWatchpoint.h" +#include <wtf/OwnPtr.h> namespace JSC { @@ -170,6 +172,7 @@ namespace JSC { deref(); accessType = access_unset; stubRoutine.clear(); + watchpoints.clear(); } void deref(); @@ -186,6 +189,12 @@ namespace JSC { seen = true; } + StructureStubClearingWatchpoint* addWatchpoint(CodeBlock* codeBlock) + { + return WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint( + watchpoints, codeBlock, this); + } + unsigned bytecodeIndex; int8_t accessType; @@ -290,6 +299,7 @@ namespace JSC { RefPtr<JITStubRoutine> stubRoutine; CodeLocationCall callReturnLocation; CodeLocationLabel hotPathBegin; + RefPtr<WatchpointsOnStructureStubInfo> watchpoints; }; inline void* getStructureStubInfoReturnLocation(StructureStubInfo* structureStubInfo) diff --git a/Source/JavaScriptCore/bytecode/Watchpoint.cpp b/Source/JavaScriptCore/bytecode/Watchpoint.cpp index 1dd633f52..6f80dfa5e 100644 --- a/Source/JavaScriptCore/bytecode/Watchpoint.cpp +++ b/Source/JavaScriptCore/bytecode/Watchpoint.cpp @@ -4,26 +4,23 @@ * 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. * - * 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. + * 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. */ #include "config.h" @@ -39,30 +36,6 @@ Watchpoint::~Watchpoint() remove(); } -#if ENABLE(JIT) -void Watchpoint::correctLabels(LinkBuffer& linkBuffer) -{ - MacroAssembler::Label label; - label.m_label.m_offset = m_source; - m_source = bitwise_cast<uintptr_t>(linkBuffer.locationOf(label).dataLocation()); - label.m_label.m_offset = m_destination; - m_destination = bitwise_cast<uintptr_t>(linkBuffer.locationOf(label).dataLocation()); -} -#endif - -void Watchpoint::fire() -{ -#if ENABLE(JIT) - MacroAssembler::replaceWithJump( - CodeLocationLabel(bitwise_cast<void*>(m_source)), - CodeLocationLabel(bitwise_cast<void*>(m_destination))); - if (isOnList()) - remove(); -#else - UNREACHABLE_FOR_PLATFORM(); -#endif -} - WatchpointSet::WatchpointSet(InitialWatchpointSetMode mode) : m_isWatched(mode == InitializedWatching) , m_isInvalidated(false) diff --git a/Source/JavaScriptCore/bytecode/Watchpoint.h b/Source/JavaScriptCore/bytecode/Watchpoint.h index 0055bf607..8e0526c0f 100644 --- a/Source/JavaScriptCore/bytecode/Watchpoint.h +++ b/Source/JavaScriptCore/bytecode/Watchpoint.h @@ -4,33 +4,28 @@ * 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. * - * 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. + * 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 Watchpoint_h #define Watchpoint_h -#include "CodeLocation.h" -#include "MacroAssembler.h" #include <wtf/RefCounted.h> #include <wtf/SentinelLinkedList.h> @@ -39,33 +34,15 @@ namespace JSC { class Watchpoint : public BasicRawSentinelNode<Watchpoint> { public: Watchpoint() - : m_source(std::numeric_limits<uintptr_t>::max()) - , m_destination(std::numeric_limits<uintptr_t>::max()) - { - } - -#if ENABLE(JIT) - Watchpoint(MacroAssembler::Label source) - : m_source(source.m_label.m_offset) - , m_destination(std::numeric_limits<uintptr_t>::max()) { } - void setDestination(MacroAssembler::Label destination) - { - m_destination = destination.m_label.m_offset; - } - - void correctLabels(LinkBuffer&); -#endif - - ~Watchpoint(); - - void fire(); + virtual ~Watchpoint(); + + void fire() { fireInternal(); } -private: - uintptr_t m_source; - uintptr_t m_destination; +protected: + virtual void fireInternal() = 0; }; enum InitialWatchpointSetMode { InitializedWatching, InitializedBlind }; diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index 4cd31f2a8..95f44c092 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -52,6 +52,10 @@ void AbstractState::beginBasicBlock(BasicBlock* basicBlock) ASSERT(basicBlock->variablesAtTail.numberOfLocals() == basicBlock->valuesAtTail.numberOfLocals()); ASSERT(basicBlock->variablesAtHead.numberOfLocals() == basicBlock->variablesAtTail.numberOfLocals()); + // This is usually a no-op, but it is possible that the graph has grown since the + // abstract state was last used. + m_nodes.resize(m_graph.size()); + for (size_t i = 0; i < basicBlock->size(); i++) m_nodes[basicBlock->at(i)].clear(); @@ -164,6 +168,7 @@ bool AbstractState::endBasicBlock(MergeMode mergeMode, BranchDirection* branchDi BasicBlock* block = m_block; // Save the block for successor merging. block->cfaFoundConstants = m_foundConstants; + block->cfaDidFinish = m_isValid; if (!m_isValid) { reset(); diff --git a/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h b/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h index 4bea292f3..57f758c9c 100644 --- a/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h +++ b/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h @@ -46,12 +46,13 @@ public: AssemblyHelpers(JSGlobalData* globalData, CodeBlock* codeBlock) : m_globalData(globalData) , m_codeBlock(codeBlock) - , m_baselineCodeBlock(codeBlock->baselineVersion()) + , m_baselineCodeBlock(codeBlock ? codeBlock->baselineVersion() : 0) { - ASSERT(m_codeBlock); - ASSERT(m_baselineCodeBlock); - ASSERT(!m_baselineCodeBlock->alternative()); - ASSERT(m_baselineCodeBlock->getJITType() == JITCode::BaselineJIT); + if (m_codeBlock) { + ASSERT(m_baselineCodeBlock); + ASSERT(!m_baselineCodeBlock->alternative()); + ASSERT(m_baselineCodeBlock->getJITType() == JITCode::BaselineJIT); + } } CodeBlock* codeBlock() { return m_codeBlock; } diff --git a/Source/JavaScriptCore/dfg/DFGBasicBlock.h b/Source/JavaScriptCore/dfg/DFGBasicBlock.h index 9128f0882..441e2e75e 100644 --- a/Source/JavaScriptCore/dfg/DFGBasicBlock.h +++ b/Source/JavaScriptCore/dfg/DFGBasicBlock.h @@ -45,6 +45,7 @@ struct BasicBlock : Vector<NodeIndex, 8> { , cfaHasVisited(false) , cfaShouldRevisit(false) , cfaFoundConstants(false) + , cfaDidFinish(true) #if !ASSERT_DISABLED , isLinked(false) #endif @@ -103,6 +104,7 @@ struct BasicBlock : Vector<NodeIndex, 8> { bool cfaHasVisited; bool cfaShouldRevisit; bool cfaFoundConstants; + bool cfaDidFinish; #if !ASSERT_DISABLED bool isLinked; #endif diff --git a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h index 9c1718bdb..5985b251e 100644 --- a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h +++ b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h @@ -37,7 +37,7 @@ namespace JSC { namespace DFG { class CCallHelpers : public AssemblyHelpers { public: - CCallHelpers(JSGlobalData* globalData, CodeBlock* codeBlock) + CCallHelpers(JSGlobalData* globalData, CodeBlock* codeBlock = 0) : AssemblyHelpers(globalData, codeBlock) { } diff --git a/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp b/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp index c52349645..24ea0b36f 100644 --- a/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp @@ -95,8 +95,12 @@ private: m_state.dump(WTF::dataFile()); dataLog("\n"); #endif - if (!m_state.execute(i)) + if (!m_state.execute(i)) { +#if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) + dataLog(" Expect OSR exit.\n"); +#endif break; + } } #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) dataLog(" tail regs: "); diff --git a/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp b/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp index c234e6e4e..dc1632dc4 100644 --- a/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp @@ -643,18 +643,6 @@ private: NodeIndex atFirstIndex = firstBlock->variablesAtTail.operand(node.local()); m_graph.changeEdge(node.children.child1(), Edge(skipGetLocal(atFirstIndex)), node.shouldGenerate()); childrenAlreadyFixed = true; - - if (node.op() != GetLocal) - break; - - NodeIndex atFirstHeadIndex = firstBlock->variablesAtHead.operand(node.local()); - if (atFirstHeadIndex == NoNode) - break; - - if (m_graph[atFirstHeadIndex].op() != Phi) - break; - - firstBlock->variablesAtHead.operand(node.local()) = nodeIndex; break; } diff --git a/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp b/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp index d3029b39a..a8eb9ee5c 100644 --- a/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp @@ -40,6 +40,7 @@ class ConstantFoldingPhase : public Phase { public: ConstantFoldingPhase(Graph& graph) : Phase(graph, "constant folding") + , m_state(graph) { } @@ -47,114 +48,192 @@ public: { bool changed = false; - AbstractState state(m_graph); - InsertionSet<NodeIndex> insertionSet; - for (BlockIndex blockIndex = 0; blockIndex < m_graph.m_blocks.size(); ++blockIndex) { BasicBlock* block = m_graph.m_blocks[blockIndex].get(); if (!block) continue; - if (!block->cfaFoundConstants) - continue; + if (!block->cfaDidFinish) + changed |= paintUnreachableCode(blockIndex); + if (block->cfaFoundConstants) + changed |= foldConstants(blockIndex); + } + + return changed; + } + +private: + bool foldConstants(BlockIndex blockIndex) + { #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) - dataLog("Constant folding considering Block #%u.\n", blockIndex); + dataLog("Constant folding considering Block #%u.\n", blockIndex); #endif - state.beginBasicBlock(block); - for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { - if (!state.isValid()) - break; - NodeIndex nodeIndex = block->at(indexInBlock); - Node& node = m_graph[nodeIndex]; + BasicBlock* block = m_graph.m_blocks[blockIndex].get(); + bool changed = false; + m_state.beginBasicBlock(block); + for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { + NodeIndex nodeIndex = block->at(indexInBlock); + Node& node = m_graph[nodeIndex]; - bool eliminated = false; + if (!m_state.isValid()) + break; + + bool eliminated = false; - switch (node.op()) { - case CheckArgumentsNotCreated: { - if (!isEmptySpeculation( - state.variables().operand( - m_graph.argumentsRegisterFor(node.codeOrigin)).m_type)) - break; - ASSERT(node.refCount() == 1); - node.setOpAndDefaultFlags(Phantom); - eliminated = true; + switch (node.op()) { + case CheckArgumentsNotCreated: { + if (!isEmptySpeculation( + m_state.variables().operand( + m_graph.argumentsRegisterFor(node.codeOrigin)).m_type)) break; - } + ASSERT(node.refCount() == 1); + node.setOpAndDefaultFlags(Phantom); + eliminated = true; + break; + } // FIXME: This would be a great place to remove CheckStructure's. - default: - break; - } + default: + break; + } - if (eliminated) { - changed = true; - continue; - } + if (eliminated) { + changed = true; + continue; + } - state.execute(indexInBlock); - if (!node.shouldGenerate() - || state.didClobber() - || node.hasConstant()) - continue; - JSValue value = state.forNode(nodeIndex).value(); - if (!value) - continue; + m_state.execute(indexInBlock); + if (!node.shouldGenerate() + || m_state.didClobber() + || node.hasConstant()) + continue; + JSValue value = m_state.forNode(nodeIndex).value(); + if (!value) + continue; - Node phantom(Phantom, node.codeOrigin); + Node phantom(Phantom, node.codeOrigin); - if (node.op() == GetLocal) { - NodeIndex previousLocalAccess = NoNode; - if (block->variablesAtHead.operand(node.local()) == nodeIndex - && m_graph[node.child1()].op() == Phi) { - // We expect this to be the common case. - ASSERT(block->isInPhis(node.child1().index())); - previousLocalAccess = node.child1().index(); - block->variablesAtHead.operand(node.local()) = previousLocalAccess; - } else { - ASSERT(indexInBlock > 0); - // Must search for the previous access to this local. - for (BlockIndex subIndexInBlock = indexInBlock; subIndexInBlock--;) { - NodeIndex subNodeIndex = block->at(subIndexInBlock); - Node& subNode = m_graph[subNodeIndex]; - if (!subNode.shouldGenerate()) - continue; - if (!subNode.hasVariableAccessData()) + if (node.op() == GetLocal) { + NodeIndex previousLocalAccess = NoNode; + if (block->variablesAtHead.operand(node.local()) == nodeIndex + && m_graph[node.child1()].op() == Phi) { + // We expect this to be the common case. + ASSERT(block->isInPhis(node.child1().index())); + previousLocalAccess = node.child1().index(); + block->variablesAtHead.operand(node.local()) = previousLocalAccess; + } else { + ASSERT(indexInBlock > 0); + // Must search for the previous access to this local. + for (BlockIndex subIndexInBlock = indexInBlock; subIndexInBlock--;) { + NodeIndex subNodeIndex = block->at(subIndexInBlock); + Node& subNode = m_graph[subNodeIndex]; + if (!subNode.shouldGenerate()) + continue; + if (!subNode.hasVariableAccessData()) + continue; + if (subNode.local() != node.local()) + continue; + // The two must have been unified. + ASSERT(subNode.variableAccessData() == node.variableAccessData()); + previousLocalAccess = subNodeIndex; + break; + } + if (previousLocalAccess == NoNode) { + // The previous access must have been a Phi. + for (BlockIndex phiIndexInBlock = block->phis.size(); phiIndexInBlock--;) { + NodeIndex phiNodeIndex = block->phis[phiIndexInBlock]; + Node& phiNode = m_graph[phiNodeIndex]; + if (!phiNode.shouldGenerate()) continue; - if (subNode.local() != node.local()) + if (phiNode.local() != node.local()) continue; // The two must have been unified. - ASSERT(subNode.variableAccessData() == node.variableAccessData()); - previousLocalAccess = subNodeIndex; + ASSERT(phiNode.variableAccessData() == node.variableAccessData()); + previousLocalAccess = phiNodeIndex; break; } ASSERT(previousLocalAccess != NoNode); } + } - NodeIndex tailNodeIndex = block->variablesAtTail.operand(node.local()); - if (tailNodeIndex == nodeIndex) - block->variablesAtTail.operand(node.local()) = previousLocalAccess; - else { - ASSERT(m_graph[tailNodeIndex].op() == Flush - || m_graph[tailNodeIndex].op() == SetLocal); - } + ASSERT(previousLocalAccess != NoNode); + + NodeIndex tailNodeIndex = block->variablesAtTail.operand(node.local()); + if (tailNodeIndex == nodeIndex) + block->variablesAtTail.operand(node.local()) = previousLocalAccess; + else { + ASSERT(m_graph[tailNodeIndex].op() == Flush + || m_graph[tailNodeIndex].op() == SetLocal); } + } - phantom.children = node.children; - phantom.ref(); + phantom.children = node.children; + phantom.ref(); + + m_graph.convertToConstant(nodeIndex, value); + NodeIndex phantomNodeIndex = m_graph.size(); + m_graph.append(phantom); + m_insertionSet.append(indexInBlock, phantomNodeIndex); - m_graph.convertToConstant(nodeIndex, value); - NodeIndex phantomNodeIndex = m_graph.size(); - m_graph.append(phantom); - insertionSet.append(indexInBlock, phantomNodeIndex); + changed = true; + } + m_state.reset(); + m_insertionSet.execute(*block); + + return changed; + } + + // This is necessary because the CFA may reach conclusions about constants based on its + // assumption that certain code must exit, but then those constants may lead future + // reexecutions of the CFA to believe that the same code will now no longer exit. Thus + // to ensure soundness, we must paint unreachable code as such, by inserting an + // unconditional ForceOSRExit wherever we find that a node would have always exited. + // This will only happen in cases where we are making static speculations, or we're + // making totally wrong speculations due to imprecision on the prediction propagator. + bool paintUnreachableCode(BlockIndex blockIndex) + { + bool changed = false; + +#if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) + dataLog("Painting unreachable code in Block #%u.\n", blockIndex); +#endif + BasicBlock* block = m_graph.m_blocks[blockIndex].get(); + m_state.beginBasicBlock(block); + + for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { + m_state.execute(indexInBlock); + if (m_state.isValid()) + continue; + + NodeIndex nodeIndex = block->at(indexInBlock); + Node& node = m_graph[nodeIndex]; + switch (node.op()) { + case Return: + case Throw: + case ThrowReferenceError: + case ForceOSRExit: + // Do nothing. These nodes will already do the right thing. + break; + default: + Node forceOSRExit(ForceOSRExit, node.codeOrigin); + forceOSRExit.ref(); + NodeIndex forceOSRExitIndex = m_graph.size(); + m_graph.append(forceOSRExit); + m_insertionSet.append(indexInBlock, forceOSRExitIndex); changed = true; + break; } - insertionSet.execute(*block); - state.reset(); + break; } + m_state.reset(); + m_insertionSet.execute(*block); return changed; } + + AbstractState m_state; + InsertionSet<NodeIndex> m_insertionSet; }; bool performConstantFolding(Graph& graph) diff --git a/Source/JavaScriptCore/dfg/DFGGPRInfo.h b/Source/JavaScriptCore/dfg/DFGGPRInfo.h index 89faef94b..23f1697a6 100644 --- a/Source/JavaScriptCore/dfg/DFGGPRInfo.h +++ b/Source/JavaScriptCore/dfg/DFGGPRInfo.h @@ -273,6 +273,7 @@ public: static const GPRReg argumentGPR1 = X86Registers::edx; // regT1 static const GPRReg nonArgGPR0 = X86Registers::eax; // regT0 static const GPRReg nonArgGPR1 = X86Registers::ebx; // regT3 + static const GPRReg nonArgGPR2 = X86Registers::esi; // regT4 static const GPRReg returnValueGPR = X86Registers::eax; // regT0 static const GPRReg returnValueGPR2 = X86Registers::edx; // regT1 static const GPRReg nonPreservedNonReturnGPR = X86Registers::ecx; @@ -344,6 +345,7 @@ public: static const GPRReg argumentGPR5 = X86Registers::r9; // regT7 static const GPRReg nonArgGPR0 = X86Registers::eax; // regT0 static const GPRReg nonArgGPR1 = X86Registers::ebx; // regT3 + static const GPRReg nonArgGPR2 = X86Registers::r10; // regT8 static const GPRReg returnValueGPR = X86Registers::eax; // regT0 static const GPRReg returnValueGPR2 = X86Registers::edx; // regT1 static const GPRReg nonPreservedNonReturnGPR = X86Registers::esi; @@ -416,6 +418,7 @@ public: static const GPRReg argumentGPR3 = ARMRegisters::r3; // FIXME! static const GPRReg nonArgGPR0 = ARMRegisters::r4; // regT3 static const GPRReg nonArgGPR1 = ARMRegisters::r8; // regT4 + static const GPRReg nonArgGPR2 = ARMRegisters::r9; // regT5 static const GPRReg returnValueGPR = ARMRegisters::r0; // regT0 static const GPRReg returnValueGPR2 = ARMRegisters::r1; // regT1 static const GPRReg nonPreservedNonReturnGPR = ARMRegisters::r2; diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp index 497fc346f..2ebee13c1 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp @@ -153,7 +153,6 @@ void JITCompiler::link(LinkBuffer& linkBuffer) unsigned returnAddressOffset = linkBuffer.returnAddressOffset(m_exceptionChecks[i].m_call); codeOrigins[i].codeOrigin = record.m_codeOrigin; codeOrigins[i].callReturnOffset = returnAddressOffset; - record.m_token.assertCodeOriginIndex(i); } m_codeBlock->setNumberOfStructureStubInfos(m_propertyAccesses.size()); @@ -189,7 +188,8 @@ void JITCompiler::link(LinkBuffer& linkBuffer) CallLinkInfo& info = m_codeBlock->callLinkInfo(i); info.callType = m_jsCalls[i].m_callType; info.isDFG = true; - info.callReturnLocation = CodeLocationLabel(linkBuffer.locationOf(m_jsCalls[i].m_slowCall)); + 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); info.hotPathOther = linkBuffer.locationOfNearCall(m_jsCalls[i].m_fastCall); } @@ -280,7 +280,8 @@ bool JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWi move(stackPointerRegister, GPRInfo::argumentGPR0); poke(GPRInfo::callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*)); - CallBeginToken token = beginCall(); + CallBeginToken token; + beginCall(CodeOrigin(0), token); Call callRegisterFileCheck = call(); notifyCall(callRegisterFileCheck, CodeOrigin(0), token); jump(fromRegisterFileCheck); @@ -297,7 +298,7 @@ bool JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWi branch32(AboveOrEqual, GPRInfo::regT1, TrustedImm32(m_codeBlock->numParameters())).linkTo(fromArityCheck, this); move(stackPointerRegister, GPRInfo::argumentGPR0); poke(GPRInfo::callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*)); - token = beginCall(); + beginCall(CodeOrigin(0), token); Call callArityCheck = call(); notifyCall(callArityCheck, CodeOrigin(0), token); move(GPRInfo::regT0, GPRInfo::callFrameRegister); diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.h b/Source/JavaScriptCore/dfg/DFGJITCompiler.h index 24dbbdcd0..d6374b790 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.h +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.h @@ -76,28 +76,58 @@ class CallBeginToken { public: CallBeginToken() #if !ASSERT_DISABLED - : m_codeOriginIndex(UINT_MAX) + : m_registered(false) + , m_exceptionCheckIndex(std::numeric_limits<unsigned>::max()) #endif { } - explicit CallBeginToken(unsigned codeOriginIndex) + ~CallBeginToken() + { + ASSERT(m_registered || !m_codeOrigin.isSet()); + ASSERT(m_codeOrigin.isSet() == (m_exceptionCheckIndex != std::numeric_limits<unsigned>::max())); + } + + void set(CodeOrigin codeOrigin, unsigned index) + { #if !ASSERT_DISABLED - : m_codeOriginIndex(codeOriginIndex) + ASSERT(m_registered || !m_codeOrigin.isSet()); + ASSERT(m_codeOrigin.isSet() == (m_exceptionCheckIndex != std::numeric_limits<unsigned>::max())); + m_codeOrigin = codeOrigin; + m_registered = false; + m_exceptionCheckIndex = index; +#else + UNUSED_PARAM(codeOrigin); + UNUSED_PARAM(index); #endif - { - UNUSED_PARAM(codeOriginIndex); } - void assertCodeOriginIndex(unsigned codeOriginIndex) const + void registerWithExceptionCheck(CodeOrigin codeOrigin, unsigned index) { - ASSERT_UNUSED(codeOriginIndex, codeOriginIndex < UINT_MAX); - ASSERT_UNUSED(codeOriginIndex, codeOriginIndex == m_codeOriginIndex); +#if !ASSERT_DISABLED + ASSERT(m_codeOrigin == codeOrigin); + if (m_registered) + return; + ASSERT(m_exceptionCheckIndex == index); + m_registered = true; +#else + UNUSED_PARAM(codeOrigin); + UNUSED_PARAM(index); +#endif } +#if !ASSERT_DISABLED + const CodeOrigin& codeOrigin() const + { + return m_codeOrigin; + } +#endif + private: #if !ASSERT_DISABLED - unsigned m_codeOriginIndex; + CodeOrigin m_codeOrigin; + bool m_registered; + unsigned m_exceptionCheckIndex; #endif }; @@ -107,25 +137,22 @@ private: // Calls that might throw an exception also record the Jump taken on exception // (unset if not present) and code origin used to recover handler/source info. struct CallExceptionRecord { - CallExceptionRecord(MacroAssembler::Call call, CodeOrigin codeOrigin, CallBeginToken token) + CallExceptionRecord(MacroAssembler::Call call, CodeOrigin codeOrigin) : m_call(call) , m_codeOrigin(codeOrigin) - , m_token(token) { } - CallExceptionRecord(MacroAssembler::Call call, MacroAssembler::Jump exceptionCheck, CodeOrigin codeOrigin, CallBeginToken token) + CallExceptionRecord(MacroAssembler::Call call, MacroAssembler::Jump exceptionCheck, CodeOrigin codeOrigin) : m_call(call) , m_exceptionCheck(exceptionCheck) , m_codeOrigin(codeOrigin) - , m_token(token) { } MacroAssembler::Call m_call; MacroAssembler::Jump m_exceptionCheck; CodeOrigin m_codeOrigin; - CallBeginToken m_token; }; struct PropertyAccessRecord { @@ -257,19 +284,27 @@ public: m_disassembler->setEndOfCode(labelIgnoringWatchpoints()); } + unsigned currentCodeOriginIndex() const + { + return m_currentCodeOriginIndex; + } + // Get a token for beginning a call, and set the current code origin index in - // the call frame. - CallBeginToken beginCall() + // the call frame. For each beginCall() there must be at least one exception + // check, and all of the exception checks must have the same CodeOrigin as the + // beginCall(). + void beginCall(CodeOrigin codeOrigin, CallBeginToken& token) { - unsigned codeOriginIndex = m_currentCodeOriginIndex++; - store32(TrustedImm32(codeOriginIndex), tagFor(static_cast<VirtualRegister>(RegisterFile::ArgumentCount))); - return CallBeginToken(codeOriginIndex); + unsigned index = m_exceptionChecks.size(); + store32(TrustedImm32(index), tagFor(static_cast<VirtualRegister>(RegisterFile::ArgumentCount))); + token.set(codeOrigin, index); } // Notify the JIT of a call that does not require linking. - void notifyCall(Call functionCall, CodeOrigin codeOrigin, CallBeginToken token) + void notifyCall(Call functionCall, CodeOrigin codeOrigin, CallBeginToken& token) { - m_exceptionChecks.append(CallExceptionRecord(functionCall, codeOrigin, token)); + token.registerWithExceptionCheck(codeOrigin, m_exceptionChecks.size()); + m_exceptionChecks.append(CallExceptionRecord(functionCall, codeOrigin)); } // Add a call out from JIT code, without an exception check. @@ -279,20 +314,27 @@ public: m_calls.append(CallLinkRecord(functionCall, function)); return functionCall; } + + void prepareForExceptionCheck() + { + move(TrustedImm32(m_exceptionChecks.size()), GPRInfo::nonPreservedNonReturnGPR); + } // Add a call out from JIT code, with an exception check. - void addExceptionCheck(Call functionCall, CodeOrigin codeOrigin, CallBeginToken token) + void addExceptionCheck(Call functionCall, CodeOrigin codeOrigin, CallBeginToken& token) { - move(TrustedImm32(m_exceptionChecks.size()), GPRInfo::nonPreservedNonReturnGPR); - m_exceptionChecks.append(CallExceptionRecord(functionCall, emitExceptionCheck(), codeOrigin, token)); + prepareForExceptionCheck(); + token.registerWithExceptionCheck(codeOrigin, m_exceptionChecks.size()); + m_exceptionChecks.append(CallExceptionRecord(functionCall, emitExceptionCheck(), codeOrigin)); } // Add a call out from JIT code, with a fast exception check that tests if the return value is zero. - void addFastExceptionCheck(Call functionCall, CodeOrigin codeOrigin, CallBeginToken token) + void addFastExceptionCheck(Call functionCall, CodeOrigin codeOrigin, CallBeginToken& token) { - move(TrustedImm32(m_exceptionChecks.size()), GPRInfo::nonPreservedNonReturnGPR); + prepareForExceptionCheck(); Jump exceptionCheck = branchTestPtr(Zero, GPRInfo::returnValueGPR); - m_exceptionChecks.append(CallExceptionRecord(functionCall, exceptionCheck, codeOrigin, token)); + token.registerWithExceptionCheck(codeOrigin, m_exceptionChecks.size()); + m_exceptionChecks.append(CallExceptionRecord(functionCall, exceptionCheck, codeOrigin)); } // Helper methods to get predictions diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index 5d6575a6f..bbe55d351 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -30,6 +30,7 @@ #include "CodeBlock.h" #include "DFGOSRExit.h" #include "DFGRepatch.h" +#include "DFGThunks.h" #include "HostCallReturnValue.h" #include "GetterSetter.h" #include "Interpreter.h" @@ -849,7 +850,6 @@ static void* handleHostCall(ExecState* execCallee, JSValue callee, CodeSpecializ execCallee->setScopeChain(exec->scopeChain()); execCallee->setCodeBlock(0); - execCallee->clearReturnPC(); if (kind == CodeForCall) { CallData callData; @@ -862,14 +862,14 @@ static void* handleHostCall(ExecState* execCallee, JSValue callee, CodeSpecializ execCallee->setCallee(asObject(callee)); globalData->hostCallReturnValue = JSValue::decode(callData.native.function(execCallee)); if (globalData->exception) - return 0; + return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); return reinterpret_cast<void*>(getHostCallReturnValue); } ASSERT(callType == CallTypeNone); exec->globalData().exception = createNotAFunctionError(exec, callee); - return 0; + return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); } ASSERT(kind == CodeForConstruct); @@ -884,17 +884,17 @@ static void* handleHostCall(ExecState* execCallee, JSValue callee, CodeSpecializ execCallee->setCallee(asObject(callee)); globalData->hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee)); if (globalData->exception) - return 0; + return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); return reinterpret_cast<void*>(getHostCallReturnValue); } ASSERT(constructType == ConstructTypeNone); exec->globalData().exception = createNotAConstructorError(exec, callee); - return 0; + return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); } -inline void* linkFor(ExecState* execCallee, ReturnAddressPtr returnAddress, CodeSpecializationKind kind) +inline void* linkFor(ExecState* execCallee, CodeSpecializationKind kind) { ExecState* exec = execCallee->callerFrame(); JSGlobalData* globalData = &exec->globalData(); @@ -918,7 +918,7 @@ inline void* linkFor(ExecState* execCallee, ReturnAddressPtr returnAddress, Code JSObject* error = functionExecutable->compileFor(execCallee, callee->scope(), kind); if (error) { globalData->exception = createStackOverflowError(exec); - return 0; + return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); } codeBlock = &functionExecutable->generatedBytecodeFor(kind); if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters())) @@ -926,7 +926,7 @@ inline void* linkFor(ExecState* execCallee, ReturnAddressPtr returnAddress, Code else codePtr = functionExecutable->generatedJITCodeFor(kind).addressForCall(); } - CallLinkInfo& callLinkInfo = exec->codeBlock()->getCallLinkInfo(returnAddress); + CallLinkInfo& callLinkInfo = exec->codeBlock()->getCallLinkInfo(execCallee->returnPC()); if (!callLinkInfo.seenOnce()) callLinkInfo.setSeen(); else @@ -934,16 +934,14 @@ inline void* linkFor(ExecState* execCallee, ReturnAddressPtr returnAddress, Code return codePtr.executableAddress(); } -P_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(operationLinkCall); -void* DFG_OPERATION operationLinkCallWithReturnAddress(ExecState* execCallee, ReturnAddressPtr returnAddress) +void* DFG_OPERATION operationLinkCall(ExecState* execCallee) { - return linkFor(execCallee, returnAddress, CodeForCall); + return linkFor(execCallee, CodeForCall); } -P_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(operationLinkConstruct); -void* DFG_OPERATION operationLinkConstructWithReturnAddress(ExecState* execCallee, ReturnAddressPtr returnAddress) +void* DFG_OPERATION operationLinkConstruct(ExecState* execCallee) { - return linkFor(execCallee, returnAddress, CodeForConstruct); + return linkFor(execCallee, CodeForConstruct); } inline void* virtualFor(ExecState* execCallee, CodeSpecializationKind kind) @@ -965,7 +963,7 @@ inline void* virtualFor(ExecState* execCallee, CodeSpecializationKind kind) JSObject* error = functionExecutable->compileFor(execCallee, function->scope(), kind); if (error) { exec->globalData().exception = error; - return 0; + return globalData->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(); } } return executable->generatedJITCodeWithArityCheckFor(kind).executableAddress(); diff --git a/Source/JavaScriptCore/dfg/DFGRepatch.cpp b/Source/JavaScriptCore/dfg/DFGRepatch.cpp index 752316f9c..e25c6aa27 100644 --- a/Source/JavaScriptCore/dfg/DFGRepatch.cpp +++ b/Source/JavaScriptCore/dfg/DFGRepatch.cpp @@ -30,6 +30,7 @@ #include "DFGCCallHelpers.h" #include "DFGSpeculativeJIT.h" +#include "DFGThunks.h" #include "GCAwareJITStubRoutine.h" #include "LinkBuffer.h" #include "Operations.h" @@ -70,6 +71,48 @@ static void dfgRepatchByIdSelfAccess(CodeBlock* codeBlock, StructureStubInfo& st #endif } +static void addStructureTransitionCheck( + JSCell* object, Structure* structure, CodeBlock* codeBlock, StructureStubInfo& stubInfo, + MacroAssembler& jit, MacroAssembler::JumpList& failureCases, GPRReg scratchGPR) +{ + if (object->structure() == structure && structure->transitionWatchpointSetIsStillValid()) { + structure->addTransitionWatchpoint(stubInfo.addWatchpoint(codeBlock)); +#if DFG_ENABLE(JIT_ASSERT) + // If we execute this code, the object must have the structure we expect. Assert + // this in debug modes. + jit.move(MacroAssembler::TrustedImmPtr(object), scratchGPR); + MacroAssembler::Jump ok = jit.branchPtr( + MacroAssembler::Equal, + MacroAssembler::Address(scratchGPR, JSCell::structureOffset()), + MacroAssembler::TrustedImmPtr(structure)); + jit.breakpoint(); + ok.link(&jit); +#endif + return; + } + + jit.move(MacroAssembler::TrustedImmPtr(object), scratchGPR); + failureCases.append( + jit.branchPtr( + MacroAssembler::NotEqual, + MacroAssembler::Address(scratchGPR, JSCell::structureOffset()), + MacroAssembler::TrustedImmPtr(structure))); +} + +static void addStructureTransitionCheck( + JSValue prototype, CodeBlock* codeBlock, StructureStubInfo& stubInfo, + MacroAssembler& jit, MacroAssembler::JumpList& failureCases, GPRReg scratchGPR) +{ + if (prototype.isNull()) + return; + + ASSERT(prototype.isCell()); + + addStructureTransitionCheck( + prototype.asCell(), prototype.asCell()->structure(), codeBlock, stubInfo, jit, + failureCases, scratchGPR); +} + static void emitRestoreScratch(MacroAssembler& stubJit, bool needToRestoreScratch, GPRReg scratchGPR, MacroAssembler::Jump& success, MacroAssembler::Jump& fail, MacroAssembler::JumpList failureCases) { if (needToRestoreScratch) { @@ -136,8 +179,9 @@ static void generateProtoChainAccessStub(ExecState* exec, StructureStubInfo& stu JSObject* protoObject = 0; for (unsigned i = 0; i < count; ++i, ++it) { protoObject = asObject(currStructure->prototypeForLookup(exec)); - stubJit.move(MacroAssembler::TrustedImmPtr(protoObject), scratchGPR); - failureCases.append(stubJit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(scratchGPR, JSCell::structureOffset()), MacroAssembler::TrustedImmPtr(protoObject->structure()))); + addStructureTransitionCheck( + protoObject, protoObject->structure(), exec->codeBlock(), stubInfo, stubJit, + failureCases, scratchGPR); currStructure = it->get(); } @@ -568,17 +612,6 @@ static V_DFGOperation_EJCI appropriateListBuildingPutByIdFunction(const PutPrope return operationPutByIdNonStrictBuildList; } -static void testPrototype(MacroAssembler &stubJit, GPRReg scratchGPR, JSValue prototype, MacroAssembler::JumpList& failureCases) -{ - if (prototype.isNull()) - return; - - ASSERT(prototype.isCell()); - - stubJit.move(MacroAssembler::TrustedImmPtr(prototype.asCell()), scratchGPR); - failureCases.append(stubJit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(scratchGPR, JSCell::structureOffset()), MacroAssembler::TrustedImmPtr(prototype.asCell()->structure()))); -} - static void emitPutReplaceStub( ExecState* exec, JSValue, @@ -707,12 +740,17 @@ static void emitPutTransitionStub( ASSERT(oldStructure->transitionWatchpointSetHasBeenInvalidated()); failureCases.append(stubJit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR, JSCell::structureOffset()), MacroAssembler::TrustedImmPtr(oldStructure))); - - testPrototype(stubJit, scratchGPR, oldStructure->storedPrototype(), failureCases); + + addStructureTransitionCheck( + oldStructure->storedPrototype(), exec->codeBlock(), stubInfo, stubJit, failureCases, + scratchGPR); if (putKind == NotDirect) { - for (WriteBarrier<Structure>* it = prototypeChain->head(); *it; ++it) - testPrototype(stubJit, scratchGPR, (*it)->storedPrototype(), failureCases); + for (WriteBarrier<Structure>* it = prototypeChain->head(); *it; ++it) { + addStructureTransitionCheck( + (*it)->storedPrototype(), exec->codeBlock(), stubInfo, stubJit, failureCases, + scratchGPR); + } } #if ENABLE(GGC) || ENABLE(WRITE_BARRIER_PROFILING) @@ -916,6 +954,7 @@ void dfgBuildPutByIdList(ExecState* exec, JSValue baseValue, const Identifier& p void dfgLinkFor(ExecState* exec, CallLinkInfo& callLinkInfo, CodeBlock* calleeCodeBlock, JSFunction* callee, MacroAssemblerCodePtr codePtr, CodeSpecializationKind kind) { CodeBlock* callerCodeBlock = exec->callerFrame()->codeBlock(); + JSGlobalData* globalData = callerCodeBlock->globalData(); RepatchBuffer repatchBuffer(callerCodeBlock); @@ -928,17 +967,17 @@ void dfgLinkFor(ExecState* exec, CallLinkInfo& callLinkInfo, CodeBlock* calleeCo calleeCodeBlock->linkIncomingCall(&callLinkInfo); if (kind == CodeForCall) { - repatchBuffer.relink(CodeLocationCall(callLinkInfo.callReturnLocation), operationVirtualCall); + repatchBuffer.relink(callLinkInfo.callReturnLocation, globalData->getCTIStub(virtualCallThunkGenerator).code()); return; } ASSERT(kind == CodeForConstruct); - repatchBuffer.relink(CodeLocationCall(callLinkInfo.callReturnLocation), operationVirtualConstruct); + repatchBuffer.relink(callLinkInfo.callReturnLocation, globalData->getCTIStub(virtualConstructThunkGenerator).code()); } void dfgResetGetByID(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo) { repatchBuffer.relink(stubInfo.callReturnLocation, operationGetByIdOptimize); - repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelPtrAtOffset(-(uintptr_t)stubInfo.patch.dfg.deltaCheckImmToCall), reinterpret_cast<void*>(-1)); + repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelPtrAtOffset(-(intptr_t)stubInfo.patch.dfg.deltaCheckImmToCall), reinterpret_cast<void*>(-1)); #if USE(JSVALUE64) repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.dfg.deltaCallToLoadOrStore), 0); #else @@ -963,7 +1002,7 @@ void dfgResetPutByID(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo) optimizedFunction = operationPutByIdDirectNonStrictOptimize; } repatchBuffer.relink(stubInfo.callReturnLocation, optimizedFunction); - repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelPtrAtOffset(-(uintptr_t)stubInfo.patch.dfg.deltaCheckImmToCall), reinterpret_cast<void*>(-1)); + repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelPtrAtOffset(-(intptr_t)stubInfo.patch.dfg.deltaCheckImmToCall), reinterpret_cast<void*>(-1)); #if USE(JSVALUE64) repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.dfg.deltaCallToLoadOrStore), 0); #else diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index 57bc84a12..28d8033cb 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -1738,7 +1738,8 @@ public: { prepareForExternalCall(); CodeOrigin codeOrigin = at(m_compileIndex).codeOrigin; - CallBeginToken token = m_jit.beginCall(); + CallBeginToken token; + m_jit.beginCall(codeOrigin, token); JITCompiler::Call call = m_jit.appendCall(function); m_jit.addExceptionCheck(call, codeOrigin, token); return call; @@ -2165,7 +2166,7 @@ public: // must register the returned Watchpoint with something relevant. In general, this should // be used with extreme care. Use speculationCheck() unless you've got an amazing reason // not to. - Watchpoint* speculationWatchpoint(ExitKind kind, JSValueSource jsValueSource, NodeIndex nodeIndex) + JumpReplacementWatchpoint* speculationWatchpoint(ExitKind kind, JSValueSource jsValueSource, NodeIndex nodeIndex) { if (!m_compileOkay) return 0; @@ -2176,13 +2177,13 @@ public: m_jit.graph().methodOfGettingAValueProfileFor(nodeIndex), JITCompiler::Jump(), this, m_stream->size()))); exit.m_watchpointIndex = m_jit.codeBlock()->appendWatchpoint( - Watchpoint(m_jit.watchpointLabel())); + JumpReplacementWatchpoint(m_jit.watchpointLabel())); return &m_jit.codeBlock()->watchpoint(exit.m_watchpointIndex); } // The default for speculation watchpoints is that they're uncounted, because the // act of firing a watchpoint invalidates it. So, future recompilations will not // attempt to set this watchpoint again. - Watchpoint* speculationWatchpoint() + JumpReplacementWatchpoint* speculationWatchpoint() { return speculationWatchpoint(UncountableWatchpoint, JSValueSource(), NoNode); } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index bbbf3c40c..ec2377389 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -956,14 +956,9 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq(Node& node, bool invert) void SpeculativeJIT::emitCall(Node& node) { - P_DFGOperation_E slowCallFunction; - if (node.op() == Call) - slowCallFunction = operationLinkCall; - else { + if (node.op() != Call) ASSERT(node.op() == Construct); - slowCallFunction = operationLinkConstruct; - } // For constructors, the this argument is not passed but we have to make space // for it. @@ -1007,16 +1002,18 @@ void SpeculativeJIT::emitCall(Node& node) JITCompiler::DataLabelPtr targetToCheck; JITCompiler::JumpList slowPath; + CallBeginToken token; + m_jit.beginCall(node.codeOrigin, token); + + m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister); + slowPath.append(m_jit.branchPtrWithPatch(MacroAssembler::NotEqual, calleePayloadGPR, targetToCheck)); slowPath.append(m_jit.branch32(MacroAssembler::NotEqual, calleeTagGPR, TrustedImm32(JSValue::CellTag))); m_jit.loadPtr(MacroAssembler::Address(calleePayloadGPR, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), resultPayloadGPR); - m_jit.storePtr(resultPayloadGPR, callFramePayloadSlot(RegisterFile::ScopeChain)); - m_jit.store32(MacroAssembler::TrustedImm32(JSValue::CellTag), callFrameTagSlot(RegisterFile::ScopeChain)); - - m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister); + m_jit.storePtr(resultPayloadGPR, MacroAssembler::Address(GPRInfo::callFrameRegister, static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ScopeChain + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload))); + m_jit.store32(MacroAssembler::TrustedImm32(JSValue::CellTag), MacroAssembler::Address(GPRInfo::callFrameRegister, static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ScopeChain + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag))); CodeOrigin codeOrigin = at(m_compileIndex).codeOrigin; - CallBeginToken token = m_jit.beginCall(); JITCompiler::Call fastCall = m_jit.nearCall(); m_jit.notifyCall(fastCall, codeOrigin, token); @@ -1024,15 +1021,20 @@ void SpeculativeJIT::emitCall(Node& node) slowPath.link(&m_jit); - m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); - m_jit.poke(GPRInfo::argumentGPR0); - token = m_jit.beginCall(); - JITCompiler::Call slowCall = m_jit.appendCall(slowCallFunction); - m_jit.addFastExceptionCheck(slowCall, codeOrigin, token); - m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister); - token = m_jit.beginCall(); - JITCompiler::Call theCall = m_jit.call(GPRInfo::returnValueGPR); - m_jit.notifyCall(theCall, codeOrigin, token); + if (calleeTagGPR == GPRInfo::nonArgGPR0) { + if (calleePayloadGPR == GPRInfo::nonArgGPR1) + m_jit.swap(GPRInfo::nonArgGPR1, GPRInfo::nonArgGPR0); + else { + m_jit.move(calleeTagGPR, GPRInfo::nonArgGPR1); + m_jit.move(calleePayloadGPR, GPRInfo::nonArgGPR0); + } + } else { + m_jit.move(calleePayloadGPR, GPRInfo::nonArgGPR0); + m_jit.move(calleeTagGPR, GPRInfo::nonArgGPR1); + } + m_jit.prepareForExceptionCheck(); + JITCompiler::Call slowCall = m_jit.nearCall(); + m_jit.notifyCall(slowCall, codeOrigin, token); done.link(&m_jit); @@ -2863,7 +2865,7 @@ void SpeculativeJIT::compile(Node& node) } case Branch: - if (isStrictInt32(node.child1().index()) || at(node.child1()).shouldSpeculateInteger()) { + if (at(node.child1()).shouldSpeculateInteger()) { SpeculateIntegerOperand op(this, node.child1()); BlockIndex taken = node.takenBlockIndex(); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index 27eb28fa7..b5058e35a 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -953,14 +953,8 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq(Node& node, bool invert) void SpeculativeJIT::emitCall(Node& node) { - P_DFGOperation_E slowCallFunction; - - if (node.op() == Call) - slowCallFunction = operationLinkCall; - else { + if (node.op() != Call) ASSERT(node.op() == Construct); - slowCallFunction = operationLinkConstruct; - } // For constructors, the this argument is not passed but we have to make space // for it. @@ -998,14 +992,16 @@ void SpeculativeJIT::emitCall(Node& node) JITCompiler::DataLabelPtr targetToCheck; JITCompiler::Jump slowPath; + CallBeginToken token; + m_jit.beginCall(node.codeOrigin, token); + + m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister); + slowPath = m_jit.branchPtrWithPatch(MacroAssembler::NotEqual, calleeGPR, targetToCheck, MacroAssembler::TrustedImmPtr(JSValue::encode(JSValue()))); m_jit.loadPtr(MacroAssembler::Address(calleeGPR, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), resultGPR); - m_jit.storePtr(resultGPR, callFrameSlot(RegisterFile::ScopeChain)); + m_jit.storePtr(resultGPR, MacroAssembler::Address(GPRInfo::callFrameRegister, static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ScopeChain)); - m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister); - CodeOrigin codeOrigin = at(m_compileIndex).codeOrigin; - CallBeginToken token = m_jit.beginCall(); JITCompiler::Call fastCall = m_jit.nearCall(); m_jit.notifyCall(fastCall, codeOrigin, token); @@ -1013,14 +1009,10 @@ void SpeculativeJIT::emitCall(Node& node) slowPath.link(&m_jit); - m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); - token = m_jit.beginCall(); - JITCompiler::Call slowCall = m_jit.appendCall(slowCallFunction); - m_jit.addFastExceptionCheck(slowCall, codeOrigin, token); - m_jit.addPtr(TrustedImm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister); - token = m_jit.beginCall(); - JITCompiler::Call theCall = m_jit.call(GPRInfo::returnValueGPR); - m_jit.notifyCall(theCall, codeOrigin, token); + m_jit.move(calleeGPR, GPRInfo::nonArgGPR0); + m_jit.prepareForExceptionCheck(); + JITCompiler::Call slowCall = m_jit.nearCall(); + m_jit.notifyCall(slowCall, codeOrigin, token); done.link(&m_jit); @@ -2947,7 +2939,7 @@ void SpeculativeJIT::compile(Node& node) } case Branch: - if (isStrictInt32(node.child1().index()) || at(node.child1()).shouldSpeculateInteger()) { + if (at(node.child1()).shouldSpeculateInteger()) { SpeculateIntegerOperand op(this, node.child1()); BlockIndex taken = node.takenBlockIndex(); diff --git a/Source/JavaScriptCore/dfg/DFGThunks.cpp b/Source/JavaScriptCore/dfg/DFGThunks.cpp index 08ca6eaa1..b056de79c 100644 --- a/Source/JavaScriptCore/dfg/DFGThunks.cpp +++ b/Source/JavaScriptCore/dfg/DFGThunks.cpp @@ -28,6 +28,7 @@ #if ENABLE(DFG_JIT) +#include "DFGCCallHelpers.h" #include "DFGFPRInfo.h" #include "DFGGPRInfo.h" #include "DFGOSRExitCompiler.h" @@ -82,6 +83,217 @@ MacroAssemblerCodeRef osrExitGenerationThunkGenerator(JSGlobalData* globalData) return FINALIZE_CODE(patchBuffer, ("DFG OSR exit generation thunk")); } +inline void emitPointerValidation(CCallHelpers& jit, GPRReg pointerGPR) +{ +#if !ASSERT_DISABLED + CCallHelpers::Jump isNonZero = jit.branchTestPtr(CCallHelpers::NonZero, pointerGPR); + jit.breakpoint(); + isNonZero.link(&jit); + jit.push(pointerGPR); + jit.load8(pointerGPR, pointerGPR); + jit.pop(pointerGPR); +#else + UNUSED_PARAM(jit); + UNUSED_PARAM(pointerGPR); +#endif +} + +MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(JSGlobalData* globalData) +{ + CCallHelpers jit(globalData); + + // We will jump to here if the JIT code thinks it's making a call, but the + // linking helper (C++ code) decided to throw an exception instead. We will + // have saved the callReturnIndex in the first arguments of JITStackFrame. + // Note that the return address will be on the stack at this point, so we + // need to remove it and drop it on the floor, since we don't care about it. + // Finally note that the call frame register points at the callee frame, so + // we need to pop it. + jit.preserveReturnAddressAfterCall(GPRInfo::nonPreservedNonReturnGPR); + jit.loadPtr( + CCallHelpers::Address( + GPRInfo::callFrameRegister, + static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::CallerFrame), + GPRInfo::callFrameRegister); + jit.peek(GPRInfo::nonPreservedNonReturnGPR, JITSTACKFRAME_ARGS_INDEX); + jit.setupArgumentsWithExecState(GPRInfo::nonPreservedNonReturnGPR); + jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(lookupExceptionHandler)), GPRInfo::nonArgGPR0); + emitPointerValidation(jit, GPRInfo::nonArgGPR0); + jit.call(GPRInfo::nonArgGPR0); + emitPointerValidation(jit, GPRInfo::returnValueGPR2); + jit.jump(GPRInfo::returnValueGPR2); + + LinkBuffer patchBuffer(*globalData, &jit, GLOBAL_THUNK_ID); + return FINALIZE_CODE(patchBuffer, ("DFG throw exception from call slow path thunk")); +} + +static void slowPathFor( + CCallHelpers& jit, JSGlobalData* globalData, P_DFGOperation_E slowPathFunction) +{ + jit.preserveReturnAddressAfterCall(GPRInfo::nonArgGPR2); + emitPointerValidation(jit, GPRInfo::nonArgGPR2); + jit.storePtr( + GPRInfo::nonArgGPR2, + CCallHelpers::Address( + GPRInfo::callFrameRegister, + static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ReturnPC)); + jit.storePtr(GPRInfo::callFrameRegister, &globalData->topCallFrame); + jit.poke(GPRInfo::nonPreservedNonReturnGPR, JITSTACKFRAME_ARGS_INDEX); + jit.setupArgumentsExecState(); + jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(slowPathFunction)), GPRInfo::nonArgGPR0); + emitPointerValidation(jit, GPRInfo::nonArgGPR0); + jit.call(GPRInfo::nonArgGPR0); + + // This slow call will return the address of one of the following: + // 1) Exception throwing thunk. + // 2) Host call return value returner thingy. + // 3) The function to call. + jit.loadPtr( + CCallHelpers::Address( + GPRInfo::callFrameRegister, + static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ReturnPC), + GPRInfo::nonPreservedNonReturnGPR); + jit.storePtr( + CCallHelpers::TrustedImmPtr(0), + CCallHelpers::Address( + GPRInfo::callFrameRegister, + static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ReturnPC)); + emitPointerValidation(jit, GPRInfo::nonPreservedNonReturnGPR); + jit.restoreReturnAddressBeforeReturn(GPRInfo::nonPreservedNonReturnGPR); + emitPointerValidation(jit, GPRInfo::returnValueGPR); + jit.jump(GPRInfo::returnValueGPR); +} + +static MacroAssemblerCodeRef linkForThunkGenerator( + JSGlobalData* globalData, CodeSpecializationKind kind) +{ + // The return address is on the stack or in the link register. We will hence + // save the return address to the call frame while we make a C++ function call + // to perform linking and lazy compilation if necessary. We expect the callee + // to be in nonArgGPR0/nonArgGPR1 (payload/tag), the call frame to have already + // been adjusted, nonPreservedNonReturnGPR holds the exception handler index, + // and all other registers to be available for use. We use JITStackFrame::args + // to save important information across calls. + + CCallHelpers jit(globalData); + + slowPathFor(jit, globalData, kind == CodeForCall ? operationLinkCall : operationLinkConstruct); + + LinkBuffer patchBuffer(*globalData, &jit, GLOBAL_THUNK_ID); + return FINALIZE_CODE( + patchBuffer, + ("DFG link %s slow path thunk", kind == CodeForCall ? "call" : "construct")); +} + +MacroAssemblerCodeRef linkCallThunkGenerator(JSGlobalData* globalData) +{ + return linkForThunkGenerator(globalData, CodeForCall); +} + +MacroAssemblerCodeRef linkConstructThunkGenerator(JSGlobalData* globalData) +{ + return linkForThunkGenerator(globalData, CodeForConstruct); +} + +static MacroAssemblerCodeRef virtualForThunkGenerator( + JSGlobalData* globalData, CodeSpecializationKind kind) +{ + // The return address is on the stack, or in the link register. We will hence + // jump to the callee, or save the return address to the call frame while we + // make a C++ function call to the appropriate DFG operation. + + CCallHelpers jit(globalData); + + CCallHelpers::JumpList slowCase; + + // FIXME: we should have a story for eliminating these checks. In many cases, + // the DFG knows that the value is definitely a cell, or definitely a function. + +#if USE(JSVALUE64) + slowCase.append( + jit.branchTestPtr( + CCallHelpers::NonZero, GPRInfo::nonArgGPR0, GPRInfo::tagMaskRegister)); +#else + slowCase.append( + jit.branch32( + CCallHelpers::NotEqual, GPRInfo::nonArgGPR1, + CCallHelpers::TrustedImm32(JSValue::CellTag))); +#endif + slowCase.append( + jit.branchPtr( + CCallHelpers::NotEqual, + CCallHelpers::Address(GPRInfo::nonArgGPR0, JSCell::classInfoOffset()), + CCallHelpers::TrustedImmPtr(&JSFunction::s_info))); + + // Now we know we have a JSFunction. + + jit.loadPtr( + CCallHelpers::Address(GPRInfo::nonArgGPR0, JSFunction::offsetOfExecutable()), + GPRInfo::nonArgGPR2); + slowCase.append( + jit.branch32( + CCallHelpers::LessThan, + CCallHelpers::Address( + GPRInfo::nonArgGPR2, ExecutableBase::offsetOfNumParametersFor(kind)), + CCallHelpers::TrustedImm32(0))); + + // Now we know that we have a CodeBlock, and we're committed to making a fast + // call. + + jit.loadPtr( + CCallHelpers::Address(GPRInfo::nonArgGPR0, JSFunction::offsetOfScopeChain()), + GPRInfo::nonArgGPR1); +#if USE(JSVALUE64) + jit.storePtr( + GPRInfo::nonArgGPR1, + CCallHelpers::Address( + GPRInfo::callFrameRegister, + static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ScopeChain)); +#else + jit.storePtr( + GPRInfo::nonArgGPR1, + CCallHelpers::Address( + GPRInfo::callFrameRegister, + static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ScopeChain + + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload))); + jit.store32( + CCallHelpers::TrustedImm32(JSValue::CellTag), + CCallHelpers::Address( + GPRInfo::callFrameRegister, + static_cast<ptrdiff_t>(sizeof(Register)) * RegisterFile::ScopeChain + + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag))); +#endif + + jit.loadPtr( + CCallHelpers::Address(GPRInfo::nonArgGPR2, ExecutableBase::offsetOfJITCodeWithArityCheckFor(kind)), + GPRInfo::regT0); + + // Make a tail call. This will return back to DFG code. + emitPointerValidation(jit, GPRInfo::regT0); + jit.jump(GPRInfo::regT0); + + slowCase.link(&jit); + + // Here we don't know anything, so revert to the full slow path. + + slowPathFor(jit, globalData, kind == CodeForCall ? operationVirtualCall : operationVirtualConstruct); + + LinkBuffer patchBuffer(*globalData, &jit, GLOBAL_THUNK_ID); + return FINALIZE_CODE( + patchBuffer, + ("DFG virtual %s slow path thunk", kind == CodeForCall ? "call" : "construct")); +} + +MacroAssemblerCodeRef virtualCallThunkGenerator(JSGlobalData* globalData) +{ + return virtualForThunkGenerator(globalData, CodeForCall); +} + +MacroAssemblerCodeRef virtualConstructThunkGenerator(JSGlobalData* globalData) +{ + return virtualForThunkGenerator(globalData, CodeForConstruct); +} + } } // namespace JSC::DFG #endif // ENABLE(DFG_JIT) diff --git a/Source/JavaScriptCore/dfg/DFGThunks.h b/Source/JavaScriptCore/dfg/DFGThunks.h index 3db62442a..11a06d107 100644 --- a/Source/JavaScriptCore/dfg/DFGThunks.h +++ b/Source/JavaScriptCore/dfg/DFGThunks.h @@ -40,6 +40,14 @@ namespace DFG { MacroAssemblerCodeRef osrExitGenerationThunkGenerator(JSGlobalData*); +MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(JSGlobalData*); + +MacroAssemblerCodeRef linkCallThunkGenerator(JSGlobalData*); +MacroAssemblerCodeRef linkConstructThunkGenerator(JSGlobalData*); + +MacroAssemblerCodeRef virtualCallThunkGenerator(JSGlobalData*); +MacroAssemblerCodeRef virtualConstructThunkGenerator(JSGlobalData*); + } } // namespace JSC::DFG #endif // ENABLE(DFG_JIT) diff --git a/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp b/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp index 5d548a755..a1152bc2b 100644 --- a/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp +++ b/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp @@ -102,6 +102,10 @@ void VariableEventStream::reconstruct( while (at(startIndex).kind() != Reset) startIndex--; +#if DFG_ENABLE(DEBUG_VERBOSE) + dataLog("Computing OSR exit recoveries starting at seq#%u.\n", startIndex); +#endif + // Step 2: Create a mock-up of the DFG's state and execute the events. Operands<ValueSource> operandSources(codeBlock->numParameters(), numVariables); Vector<MinifiedGenerationInfo, 32> generationInfos(graph.originalGraphSize()); diff --git a/Source/JavaScriptCore/heap/HeapTimer.cpp b/Source/JavaScriptCore/heap/HeapTimer.cpp index ae66f9e26..fa979781e 100644 --- a/Source/JavaScriptCore/heap/HeapTimer.cpp +++ b/Source/JavaScriptCore/heap/HeapTimer.cpp @@ -98,8 +98,38 @@ void HeapTimer::timerDidFire(CFRunLoopTimerRef, void* info) agent->m_shutdownMutex.unlock(); } +#elif PLATFORM(BLACKBERRY) + +HeapTimer::HeapTimer(JSGlobalData* globalData) + : m_globalData(globalData) + , m_timer(this, &HeapTimer::timerDidFire) +{ +} + +HeapTimer::~HeapTimer() +{ +} + +void HeapTimer::timerDidFire() +{ + doWork(); +} + +void HeapTimer::synchronize() +{ +} + +void HeapTimer::invalidate() +{ +} + +void HeapTimer::didStartVMShutdown() +{ + delete this; +} + #else - + HeapTimer::HeapTimer(JSGlobalData* globalData) : m_globalData(globalData) { diff --git a/Source/JavaScriptCore/heap/HeapTimer.h b/Source/JavaScriptCore/heap/HeapTimer.h index 9255e0648..88715098a 100644 --- a/Source/JavaScriptCore/heap/HeapTimer.h +++ b/Source/JavaScriptCore/heap/HeapTimer.h @@ -31,6 +31,8 @@ #if USE(CF) #include <CoreFoundation/CoreFoundation.h> +#elif PLATFORM(BLACKBERRY) +#include <BlackBerryPlatformTimer.h> #endif namespace JSC { @@ -63,6 +65,10 @@ protected: CFRunLoopTimerContext m_context; Mutex m_shutdownMutex; +#elif PLATFORM(BLACKBERRY) + void timerDidFire(); + + BlackBerry::Platform::Timer<HeapTimer> m_timer; #endif private: 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/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp index 285355f1b..52a7158e6 100644 --- a/Source/JavaScriptCore/jit/JIT.cpp +++ b/Source/JavaScriptCore/jit/JIT.cpp @@ -739,7 +739,7 @@ JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck, JITCompilationEffo CallLinkInfo& info = m_codeBlock->callLinkInfo(i); info.callType = m_callStructureStubCompilationInfo[i].callType; info.bytecodeIndex = m_callStructureStubCompilationInfo[i].bytecodeIndex; - info.callReturnLocation = CodeLocationLabel(patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].callReturnLocation)); + info.callReturnLocation = patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].callReturnLocation); info.hotPathBegin = patchBuffer.locationOf(m_callStructureStubCompilationInfo[i].hotPathBegin); info.hotPathOther = patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].hotPathOther); } @@ -802,12 +802,12 @@ void JIT::linkFor(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* cal // Patch the slow patch so we do not continue to try to link. if (kind == CodeForCall) { - repatchBuffer.relink(CodeLocationNearCall(callLinkInfo->callReturnLocation), globalData->jitStubs->ctiVirtualCall()); + repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs->ctiVirtualCall()); return; } ASSERT(kind == CodeForConstruct); - repatchBuffer.relink(CodeLocationNearCall(callLinkInfo->callReturnLocation), globalData->jitStubs->ctiVirtualConstruct()); + repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs->ctiVirtualConstruct()); } } // namespace JSC diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index 2273f0f38..bfc4709bc 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -740,17 +740,20 @@ __asm EncodedJSValue ctiTrampoline(void*, RegisterFile*, CallFrame*, void* /*unu { ARM stmdb sp!, {r1-r3} - stmdb sp!, {r4-r8, lr} + stmdb sp!, {r4-r6, r8-r11, lr} sub sp, sp, # PRESERVEDR4_OFFSET - mov r4, r2 - mov r5, #512 + mov r5, r2 + mov r6, #512 mov lr, pc bx r0 add sp, sp, # PRESERVEDR4_OFFSET - ldmia sp!, {r4-r8, lr} + ldmia sp!, {r4-r6, r8-r11, lr} add sp, sp, #12 bx lr } +__asm void ctiTrampolineEnd() +{ +} __asm void ctiVMThrowTrampoline() { @@ -759,7 +762,7 @@ __asm void ctiVMThrowTrampoline() mov r0, sp bl cti_vm_throw add sp, sp, # PRESERVEDR4_OFFSET - ldmia sp!, {r4-r8, lr} + ldmia sp!, {r4-r6, r8-r11, lr} add sp, sp, #12 bx lr } @@ -1212,31 +1215,32 @@ RVCT() MSVC_BEGIN( AREA Trampoline, CODE) MSVC_BEGIN() MSVC_BEGIN( EXPORT ctiTrampoline) +MSVC_BEGIN( EXPORT ctiTrampolineEnd) MSVC_BEGIN( EXPORT ctiVMThrowTrampoline) MSVC_BEGIN( EXPORT ctiOpThrowNotCaught) MSVC_BEGIN() MSVC_BEGIN(ctiTrampoline PROC) MSVC_BEGIN( stmdb sp!, {r1-r3}) -MSVC_BEGIN( stmdb sp!, {r4-r8, lr}) +MSVC_BEGIN( stmdb sp!, {r4-r6, r8-r11, lr}) MSVC_BEGIN( sub sp, sp, #68 ; sync with PRESERVEDR4_OFFSET) -MSVC_BEGIN( mov r4, r2) -MSVC_BEGIN( mov r5, #512) +MSVC_BEGIN( mov r5, r2) +MSVC_BEGIN( mov r6, #512) MSVC_BEGIN( ; r0 contains the code) MSVC_BEGIN( mov lr, pc) MSVC_BEGIN( bx r0) MSVC_BEGIN( add sp, sp, #68 ; sync with PRESERVEDR4_OFFSET) -MSVC_BEGIN( ldmia sp!, {r4-r8, lr}) +MSVC_BEGIN( ldmia sp!, {r4-r6, r8-r11, lr}) MSVC_BEGIN( add sp, sp, #12) MSVC_BEGIN( bx lr) +MSVC_BEGIN(ctiTrampolineEnd) MSVC_BEGIN(ctiTrampoline ENDP) MSVC_BEGIN() MSVC_BEGIN(ctiVMThrowTrampoline PROC) MSVC_BEGIN( mov r0, sp) -MSVC_BEGIN( mov lr, pc) MSVC_BEGIN( bl cti_vm_throw) MSVC_BEGIN(ctiOpThrowNotCaught) MSVC_BEGIN( add sp, sp, #68 ; sync with PRESERVEDR4_OFFSET) -MSVC_BEGIN( ldmia sp!, {r4-r8, lr}) +MSVC_BEGIN( ldmia sp!, {r4-r6, r8-r11, lr}) MSVC_BEGIN( add sp, sp, #12) MSVC_BEGIN( bx lr) MSVC_BEGIN(ctiVMThrowTrampoline ENDP) diff --git a/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp new file mode 100644 index 000000000..725108dd5 --- /dev/null +++ b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JumpReplacementWatchpoint.h" + +#if ENABLE(JIT) + +#include "LinkBuffer.h" + +namespace JSC { + +void JumpReplacementWatchpoint::correctLabels(LinkBuffer& linkBuffer) +{ + MacroAssembler::Label label; + label.m_label.m_offset = m_source; + m_source = bitwise_cast<uintptr_t>(linkBuffer.locationOf(label).dataLocation()); + label.m_label.m_offset = m_destination; + m_destination = bitwise_cast<uintptr_t>(linkBuffer.locationOf(label).dataLocation()); +} + +void JumpReplacementWatchpoint::fireInternal() +{ + MacroAssembler::replaceWithJump( + CodeLocationLabel(bitwise_cast<void*>(m_source)), + CodeLocationLabel(bitwise_cast<void*>(m_destination))); + if (isOnList()) + remove(); +} + +} // namespace JSC + +#endif // ENABLE(JIT) + diff --git a/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h new file mode 100644 index 000000000..b4f35c724 --- /dev/null +++ b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JumpReplacementWatchpoint_h +#define JumpReplacementWatchpoint_h + +#include "Watchpoint.h" +#include <wtf/Platform.h> + +#if ENABLE(JIT) + +#include "CodeLocation.h" +#include "MacroAssembler.h" + +namespace JSC { + +class JumpReplacementWatchpoint : public Watchpoint { +public: + JumpReplacementWatchpoint() + : m_source(std::numeric_limits<uintptr_t>::max()) + , m_destination(std::numeric_limits<uintptr_t>::max()) + { + } + + JumpReplacementWatchpoint(MacroAssembler::Label source) + : m_source(source.m_label.m_offset) + , m_destination(std::numeric_limits<uintptr_t>::max()) + { + } + + void setDestination(MacroAssembler::Label destination) + { + m_destination = destination.m_label.m_offset; + } + + void correctLabels(LinkBuffer&); + +protected: + void fireInternal(); + +private: + uintptr_t m_source; + uintptr_t m_destination; +}; + +} // namespace JSC + +#endif // ENABLE(JIT) + +#endif // JumpReplacementWatchpoint_h + diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index 43337e4ee..5f3dbdb99 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -113,19 +113,23 @@ struct Script { } }; -struct CommandLine { - CommandLine() - : interactive(false) - , dump(false) - , exitCode(false) +class CommandLine { +public: + CommandLine(int argc, char** argv) + : m_interactive(false) + , m_dump(false) + , m_exitCode(false) { + parseArguments(argc, argv); } - bool interactive; - bool dump; - bool exitCode; - Vector<Script> scripts; - Vector<UString> arguments; + bool m_interactive; + bool m_dump; + bool m_exitCode; + Vector<Script> m_scripts; + Vector<UString> m_arguments; + + void parseArguments(int, char**); }; static const char interactivePrompt[] = "> "; @@ -623,7 +627,7 @@ static NO_RETURN void printUsageStatement(bool help = false) exit(help ? EXIT_SUCCESS : EXIT_FAILURE); } -static void parseArguments(int argc, char** argv, CommandLine& options) +void CommandLine::parseArguments(int argc, char** argv) { int i = 1; bool needToDumpOptions = false; @@ -634,21 +638,21 @@ static void parseArguments(int argc, char** argv, CommandLine& options) if (!strcmp(arg, "-f")) { if (++i == argc) printUsageStatement(); - options.scripts.append(Script(true, argv[i])); + m_scripts.append(Script(true, argv[i])); continue; } if (!strcmp(arg, "-e")) { if (++i == argc) printUsageStatement(); - options.scripts.append(Script(false, argv[i])); + m_scripts.append(Script(false, argv[i])); continue; } if (!strcmp(arg, "-i")) { - options.interactive = true; + m_interactive = true; continue; } if (!strcmp(arg, "-d")) { - options.dump = true; + m_dump = true; continue; } if (!strcmp(arg, "-s")) { @@ -661,7 +665,7 @@ static void parseArguments(int argc, char** argv, CommandLine& options) continue; } if (!strcmp(arg, "-x")) { - options.exitCode = true; + m_exitCode = true; continue; } if (!strcmp(arg, "--")) { @@ -690,14 +694,14 @@ static void parseArguments(int argc, char** argv, CommandLine& options) // This arg is not recognized by the VM nor by jsc. Pass it on to the // script. - options.scripts.append(Script(true, argv[i])); + m_scripts.append(Script(true, argv[i])); } - if (options.scripts.isEmpty()) - options.interactive = true; + if (m_scripts.isEmpty()) + m_interactive = true; for (; i < argc; ++i) - options.arguments.append(argv[i]); + m_arguments.append(argv[i]); if (needToDumpOptions) JSC::Options::dumpAllOptions(stderr); @@ -707,21 +711,21 @@ static void parseArguments(int argc, char** argv, CommandLine& options) int jscmain(int argc, char** argv) { + // Note that the options parsing can affect JSGlobalData creation, and thus + // comes first. + CommandLine options(argc, argv); RefPtr<JSGlobalData> globalData = JSGlobalData::create(ThreadStackTypeLarge, LargeHeap); JSLockHolder lock(globalData.get()); int result; - CommandLine options; - parseArguments(argc, argv, options); - - GlobalObject* globalObject = GlobalObject::create(*globalData, GlobalObject::createStructure(*globalData, jsNull()), options.arguments); - bool success = runWithScripts(globalObject, options.scripts, options.dump); - if (options.interactive && success) + GlobalObject* globalObject = GlobalObject::create(*globalData, GlobalObject::createStructure(*globalData, jsNull()), options.m_arguments); + bool success = runWithScripts(globalObject, options.m_scripts, options.m_dump); + if (options.m_interactive && success) runInteractive(globalObject); result = success ? 0 : 3; - if (options.exitCode) + if (options.m_exitCode) printf("jsc exiting %d\n", result); return result; diff --git a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h index 7720f5ec2..9a1539576 100644 --- a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h +++ b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h @@ -91,6 +91,10 @@ #define OFFLINE_ASM_VALUE_PROFILER 0 #endif +// These are for building an interpreter from generated assembly code: +#define OFFLINE_ASM_BEGIN asm ( +#define OFFLINE_ASM_END ); + #if CPU(ARM_THUMB2) #define OFFLINE_ASM_GLOBAL_LABEL(label) \ ".globl " SYMBOL_STRING(label) "\n" \ @@ -105,4 +109,6 @@ SYMBOL_STRING(label) ":\n" #endif +#define OFFLINE_ASM_LOCAL_LABEL(label) LOCAL_LABEL_STRING(label) ":\n" + #endif // LLIntOfflineAsmConfig_h diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm index 9d6304de7..513b742ee 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm @@ -301,8 +301,8 @@ end _llint_op_enter: traceExecution() - loadp CodeBlock[cfr], t2 - loadi CodeBlock::m_numVars[t2], t2 + loadp CodeBlock[cfr], t2 // t2<CodeBlock> = cfr.CodeBlock + loadi CodeBlock::m_numVars[t2], t2 // t2<size_t> = t2<CodeBlock>.m_numVars btiz t2, .opEnterDone move UndefinedTag, t0 move 0, t1 diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm index a7a2ce88f..b976421f0 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm @@ -182,8 +182,8 @@ end _llint_op_enter: traceExecution() - loadp CodeBlock[cfr], t2 - loadi CodeBlock::m_numVars[t2], t2 + loadp CodeBlock[cfr], t2 // t2<CodeBlock> = cfr.CodeBlock + loadi CodeBlock::m_numVars[t2], t2 // t2<size_t> = t2<CodeBlock>.m_numVars btiz t2, .opEnterDone move ValueUndefined, t0 .opEnterLoop: diff --git a/Source/JavaScriptCore/offlineasm/armv7.rb b/Source/JavaScriptCore/offlineasm/armv7.rb index 69df51a45..18538120b 100644 --- a/Source/JavaScriptCore/offlineasm/armv7.rb +++ b/Source/JavaScriptCore/offlineasm/armv7.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "ast" require "opt" @@ -147,6 +148,7 @@ def armV7LowerBranchOps(list) list.each { | node | if node.is_a? Instruction + annotation = node.annotation case node.opcode when /^b(addi|subi|ori|addp)/ op = $1 @@ -161,17 +163,17 @@ def armV7LowerBranchOps(list) op = "oris" end - newList << Instruction.new(node.codeOrigin, op, node.operands[0..-2]) + newList << Instruction.new(node.codeOrigin, op, node.operands[0..-2], annotation) newList << Instruction.new(node.codeOrigin, branch, [node.operands[-1]]) when "bmulio" tmp1 = Tmp.new(node.codeOrigin, :gpr) tmp2 = Tmp.new(node.codeOrigin, :gpr) - newList << Instruction.new(node.codeOrigin, "smulli", [node.operands[0], node.operands[1], node.operands[1], tmp1]) + newList << Instruction.new(node.codeOrigin, "smulli", [node.operands[0], node.operands[1], node.operands[1], tmp1], annotation) newList << Instruction.new(node.codeOrigin, "rshifti", [node.operands[-2], Immediate.new(node.codeOrigin, 31), tmp2]) newList << Instruction.new(node.codeOrigin, "bineq", [tmp1, tmp2, node.operands[-1]]) when /^bmuli/ condition = $~.post_match - newList << Instruction.new(node.codeOrigin, "muli", node.operands[0..-2]) + newList << Instruction.new(node.codeOrigin, "muli", node.operands[0..-2], annotation) newList << Instruction.new(node.codeOrigin, "bti" + condition, [node.operands[-2], node.operands[-1]]) else newList << node @@ -210,9 +212,9 @@ def armV7LowerShiftOps(list) case node.opcode when "lshifti", "rshifti", "urshifti", "lshiftp", "rshiftp", "urshiftp" if node.operands.size == 2 - newList << Instruction.new(node.codeOrigin, node.opcode, [armV7SanitizeShift(node.operands[0], newList), node.operands[1]]) + newList << Instruction.new(node.codeOrigin, node.opcode, [armV7SanitizeShift(node.operands[0], newList), node.operands[1]], node.annotation) else - newList << Instruction.new(node.codeOrigin, node.opcode, [node.operands[0], armV7SanitizeShift(node.operands[1], newList), node.operands[2]]) + newList << Instruction.new(node.codeOrigin, node.opcode, [node.operands[0], armV7SanitizeShift(node.operands[1], newList), node.operands[2]], node.annotation) raise "Wrong number of operands for shift at #{node.codeOriginString}" unless node.operands.size == 3 end else @@ -321,9 +323,9 @@ def armV7LowerMalformedAddressesDouble(list) if node.is_a? Instruction case node.opcode when "loadd" - newList << Instruction.new(node.codeOrigin, "loadd", [node.operands[0].armV7DoubleAddress(newList), node.operands[1]]) + newList << Instruction.new(node.codeOrigin, "loadd", [node.operands[0].armV7DoubleAddress(newList), node.operands[1]], node.annotation) when "stored" - newList << Instruction.new(node.codeOrigin, "stored", [node.operands[0], node.operands[1].armV7DoubleAddress(newList)]) + newList << Instruction.new(node.codeOrigin, "stored", [node.operands[0], node.operands[1].armV7DoubleAddress(newList)], node.annotation) else newList << node end @@ -364,7 +366,7 @@ def armV7LowerMisplacedImmediates(list) newOperands << operand end } - newList << Instruction.new(node.codeOrigin, node.opcode, newOperands) + newList << Instruction.new(node.codeOrigin, node.opcode, newOperands, node.annotation) else newList << node end @@ -431,6 +433,7 @@ def armV7LowerMalformedImmediates(list) list.each { | node | if node.is_a? Instruction + annotation = node.annotation case node.opcode when "move" newList << node @@ -445,14 +448,15 @@ def armV7LowerMalformedImmediates(list) newOpcode = "add" + node.opcode[-1..-1] end newList << Instruction.new(node.codeOrigin, newOpcode, - [Immediate.new(-node.operands[0].value)] + node.operands[1..-1]) + [Immediate.new(-node.operands[0].value)] + node.operands[1..-1], + annotation) else newList << node.armV7LowerMalformedImmediatesRecurse(newList) end when "muli", "mulp" if node.operands[0].is_a? Immediate tmp = Tmp.new(codeOrigin, :gpr) - newList << Instruction.new(node.codeOrigin, "move", [node.operands[0], tmp]) + newList << Instruction.new(node.codeOrigin, "move", [node.operands[0], tmp], annotation) newList << Instruction.new(node.codeOrigin, "muli", [tmp] + node.operands[1..-1]) else newList << node.armV7LowerMalformedImmediatesRecurse(newList) @@ -514,30 +518,36 @@ def armV7LowerMisplacedAddresses(list) | node | if node.is_a? Instruction postInstructions = [] + annotation = node.annotation case node.opcode when "addi", "addp", "addis", "andi", "andp", "lshifti", "lshiftp", "muli", "mulp", "negi", "negp", "noti", "ori", "oris", "orp", "rshifti", "urshifti", "rshiftp", "urshiftp", "subi", "subp", "subis", "xori", "xorp", /^bi/, /^bp/, /^bti/, /^btp/, /^ci/, /^cp/, /^ti/ newList << Instruction.new(node.codeOrigin, node.opcode, - armV7AsRegisters(newList, postInstructions, node.operands, "i")) + armV7AsRegisters(newList, postInstructions, node.operands, "i"), + annotation) when "bbeq", "bbneq", "bba", "bbaeq", "bbb", "bbbeq", "btbo", "btbz", "btbnz", "tbz", "tbnz", "tbo", "cbeq", "cbneq", "cba", "cbaeq", "cbb", "cbbeq" newList << Instruction.new(node.codeOrigin, node.opcode, - armV7AsRegisters(newList, postInstructions, node.operands, "b")) + armV7AsRegisters(newList, postInstructions, node.operands, "b"), + annotation) when "bbgt", "bbgteq", "bblt", "bblteq", "btbs", "tbs", "cbgt", "cbgteq", "cblt", "cblteq" newList << Instruction.new(node.codeOrigin, node.opcode, - armV7AsRegisters(newList, postInstructions, node.operands, "bs")) + armV7AsRegisters(newList, postInstructions, node.operands, "bs"), + annotation) when "addd", "divd", "subd", "muld", "sqrtd", /^bd/ newList << Instruction.new(node.codeOrigin, node.opcode, - armV7AsRegisters(newList, postInstructions, node.operands, "d")) + armV7AsRegisters(newList, postInstructions, node.operands, "d"), + annotation) when "jmp", "call" newList << Instruction.new(node.codeOrigin, node.opcode, - [armV7AsRegister(newList, postInstructions, node.operands[0], "p", false)]) + [armV7AsRegister(newList, postInstructions, node.operands[0], "p", false)], + annotation) else newList << node end @@ -565,6 +575,7 @@ def armV7LowerRegisterReuse(list) list.each { | node | if node.is_a? Instruction + annotation = node.annotation case node.opcode when "cieq", "cineq", "cia", "ciaeq", "cib", "cibeq", "cigt", "cigteq", "cilt", "cilteq", "cpeq", "cpneq", "cpa", "cpaeq", "cpb", "cpbeq", "cpgt", "cpgteq", "cplt", "cplteq", @@ -573,7 +584,7 @@ def armV7LowerRegisterReuse(list) if node.operands.size == 2 if node.operands[0] == node.operands[1] tmp = Tmp.new(node.codeOrigin, :gpr) - newList << Instruction.new(node.codeOrigin, "move", [node.operands[0], tmp]) + newList << Instruction.new(node.codeOrigin, "move", [node.operands[0], tmp], annotation) newList << Instruction.new(node.codeOrigin, node.opcode, [tmp, node.operands[1]]) else newList << node @@ -582,11 +593,11 @@ def armV7LowerRegisterReuse(list) raise "Wrong number of arguments at #{node.codeOriginString}" unless node.operands.size == 3 if node.operands[0] == node.operands[2] tmp = Tmp.new(node.codeOrigin, :gpr) - newList << Instruction.new(node.codeOrigin, "move", [node.operands[0], tmp]) + newList << Instruction.new(node.codeOrigin, "move", [node.operands[0], tmp], annotation) newList << Instruction.new(node.codeOrigin, node.opcode, [tmp, node.operands[1], node.operands[2]]) elsif node.operands[1] == node.operands[2] tmp = Tmp.new(node.codeOrigin, :gpr) - newList << Instruction.new(node.codeOrigin, "move", [node.operands[1], tmp]) + newList << Instruction.new(node.codeOrigin, "move", [node.operands[1], tmp], annotation) newList << Instruction.new(node.codeOrigin, node.opcode, [node.operands[0], tmp, node.operands[2]]) else newList << node @@ -732,7 +743,9 @@ end class Instruction def lowerARMv7 - $asm.comment codeOriginString + $asm.codeOrigin codeOriginString + $asm.annotation annotation + case opcode when "addi", "addp", "addis" if opcode == "addis" diff --git a/Source/JavaScriptCore/offlineasm/asm.rb b/Source/JavaScriptCore/offlineasm/asm.rb index 50f9bc886..0cf6320af 100644 --- a/Source/JavaScriptCore/offlineasm/asm.rb +++ b/Source/JavaScriptCore/offlineasm/asm.rb @@ -25,6 +25,7 @@ $: << File.dirname(__FILE__) +require "config" require "backends" require "digest/sha1" require "offsets" @@ -39,16 +40,21 @@ class Assembler @state = :cpp @commentState = :none @comment = nil + @internalComment = nil + @annotation = nil + @codeOrigin = nil + @numLocalLabels = 0 + @numGlobalLabels = 0 end def enterAsm - @outp.puts "asm (" + @outp.puts "OFFLINE_ASM_BEGIN" @state = :asm end def leaveAsm putsLastComment - @outp.puts ");" + @outp.puts "OFFLINE_ASM_END" @state = :cpp end @@ -58,17 +64,35 @@ class Assembler leaveAsm end + # Concatenates all the various components of the comment to dump. def lastComment - if @comment - result = "// #{@comment}" - else - result = "" + result = "" + result = " #{@comment} ." if @comment + result += " #{@annotation} ." if @annotation and $enableTrailingInstrAnnotations + result += " #{@internalComment} ." if @internalComment + result += " #{@codeOrigin} ." if @codeOrigin and $enableCodeOriginComments + if 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 result end + # Dumps the current instruction annotation in interlaced mode if appropriate. + def putInterlacedAnnotation() + raise unless @state == :asm + if $enableInterlacedInstrAnnotations + @outp.puts(" // #{@annotation}") if @annotation + @annotation = nil + end + end + def putsLastComment comment = lastComment unless comment.empty? @@ -78,7 +102,8 @@ class Assembler def puts(*line) raise unless @state == :asm - @outp.puts("\"\\t" + line.join('') + "\\n\" #{lastComment}") + putInterlacedAnnotation + @outp.puts(" \"\\t" + line.join('') + "\\n\"#{lastComment}") end def print(line) @@ -88,12 +113,18 @@ class Assembler def putsLabel(labelName) raise unless @state == :asm - @outp.puts("OFFLINE_ASM_GLOBAL_LABEL(#{labelName}) #{lastComment}") + @numGlobalLabels += 1 + @outp.puts("\n") + @internalComment = $enableLabelCountComments ? "Global Label #{@numGlobalLabels}" : nil + @outp.puts("OFFLINE_ASM_GLOBAL_LABEL(#{labelName})#{lastComment}") end def putsLocalLabel(labelName) raise unless @state == :asm - @outp.puts("LOCAL_LABEL_STRING(#{labelName}) \":\\n\" #{lastComment}") + @numLocalLabels += 1 + @outp.puts("\n") + @internalComment = $enableLabelCountComments ? "Local Label #{@numLocalLabels}" : nil + @outp.puts("OFFLINE_ASM_LOCAL_LABEL(#{labelName})#{lastComment}") end def self.labelReference(labelName) @@ -104,22 +135,31 @@ class Assembler "\" LOCAL_LABEL_STRING(#{labelName}) \"" end - def comment(text) + def codeOrigin(text) case @commentState when :none - @comment = text + @codeOrigin = text @commentState = :one when :one - @outp.puts "// #{@comment}" - @outp.puts "// #{text}" - @comment = nil + if $enableCodeOriginComments + @outp.puts " // #{@codeOrigin}" + @outp.puts " // #{text}" + end + @codeOrigin = nil @commentState = :many when :many - @outp.puts "// #{text}" + @outp.puts "// #{text}" if $enableCodeOriginComments else raise end end + + def comment(text) + @comment = text + end + def annotation(text) + @annotation = text + end end asmFile = ARGV.shift diff --git a/Source/JavaScriptCore/offlineasm/ast.rb b/Source/JavaScriptCore/offlineasm/ast.rb index e555b5d98..86ad6bcb2 100644 --- a/Source/JavaScriptCore/offlineasm/ast.rb +++ b/Source/JavaScriptCore/offlineasm/ast.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. +require "config" + # # Base utility types for the AST. # @@ -784,12 +786,13 @@ class AbsoluteAddress < NoChildren end class Instruction < Node - attr_reader :opcode, :operands + attr_reader :opcode, :operands, :annotation - def initialize(codeOrigin, opcode, operands) + def initialize(codeOrigin, opcode, operands, annotation=nil) super(codeOrigin) @opcode = opcode @operands = operands + @annotation = annotation end def children @@ -797,7 +800,7 @@ class Instruction < Node end def mapChildren(&proc) - Instruction.new(codeOrigin, @opcode, @operands.map(&proc)) + Instruction.new(codeOrigin, @opcode, @operands.map(&proc), @annotation) end def dump diff --git a/Source/JavaScriptCore/offlineasm/backends.rb b/Source/JavaScriptCore/offlineasm/backends.rb index db7a1e218..e33a2a083 100644 --- a/Source/JavaScriptCore/offlineasm/backends.rb +++ b/Source/JavaScriptCore/offlineasm/backends.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "armv7" require "ast" require "x86" diff --git a/Source/JavaScriptCore/offlineasm/config.rb b/Source/JavaScriptCore/offlineasm/config.rb new file mode 100644 index 000000000..ce1898170 --- /dev/null +++ b/Source/JavaScriptCore/offlineasm/config.rb @@ -0,0 +1,76 @@ +# Copyright (C) 2012 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + + +# Turns on dumping of the count of labels. +# For example, the output will look like this: +# +# ... +# OFFLINE_ASM_LOCAL_LABEL(_offlineasm_4_functionArityCheck__continue) // Local Label 24 . +# ... +# OFFLINE_ASM_GLOBAL_LABEL(llint_op_enter) // Global Label 8 . +# ... +# +$enableLabelCountComments = false + +# Turns on dumping of source file and line numbers in the output file. +# For example, the output will look like this: +# +# ... +# "\tmovq -8(%r13), %rcx\n" // JavaScriptCore/llint/LowLevelInterpreter64.asm:185 +# "\tmovl 52(%rcx), %ecx\n" // JavaScriptCore/llint/LowLevelInterpreter64.asm:186 +# ... +# +$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: +# +# ... +# // @ t2<CodeBlock> = cfr.CodeBlock +# "\tmovq -8(%r13), %rcx\n" +# // @ t2<size_t> = t2<CodeBlock>.m_numVars +# "\tmovl 52(%rcx), %ecx\n" +# ... +# +# $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) diff --git a/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb b/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb index b2a8c2c83..fefbb1290 100644 --- a/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb +++ b/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb @@ -25,6 +25,7 @@ $: << File.dirname(__FILE__) +require "config" require "backends" require "digest/sha1" require "offsets" diff --git a/Source/JavaScriptCore/offlineasm/instructions.rb b/Source/JavaScriptCore/offlineasm/instructions.rb index 67cec6d96..aa1a32393 100644 --- a/Source/JavaScriptCore/offlineasm/instructions.rb +++ b/Source/JavaScriptCore/offlineasm/instructions.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. +require "config" + # Interesting invariant, which we take advantage of: branching instructions # always begin with "b", and no non-branching instructions begin with "b". # Terminal instructions are "jmp" and "ret". diff --git a/Source/JavaScriptCore/offlineasm/offsets.rb b/Source/JavaScriptCore/offlineasm/offsets.rb index 4f2734f86..8a064a216 100644 --- a/Source/JavaScriptCore/offlineasm/offsets.rb +++ b/Source/JavaScriptCore/offlineasm/offsets.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "ast" def to32Bit(value) diff --git a/Source/JavaScriptCore/offlineasm/opt.rb b/Source/JavaScriptCore/offlineasm/opt.rb index 3170d3ae1..c721758f7 100644 --- a/Source/JavaScriptCore/offlineasm/opt.rb +++ b/Source/JavaScriptCore/offlineasm/opt.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "ast" # diff --git a/Source/JavaScriptCore/offlineasm/parser.rb b/Source/JavaScriptCore/offlineasm/parser.rb index 11863c724..8696a61a9 100644 --- a/Source/JavaScriptCore/offlineasm/parser.rb +++ b/Source/JavaScriptCore/offlineasm/parser.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "ast" require "instructions" require "pathname" @@ -81,11 +82,20 @@ def lex(str, fileName) fileName = Pathname.new(fileName) result = [] lineNumber = 1 + annotation = nil while not str.empty? case str when /\A\#([^\n]*)/ # comment, ignore + when /\A\/\/([^\n]*)/ + # annotation + annotation = $1 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) + annotation = nil + end result << Token.new(CodeOrigin.new(fileName, lineNumber), $&) lineNumber += 1 when /\A[a-zA-Z]([a-zA-Z0-9_]*)/ @@ -136,6 +146,10 @@ 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 @@ -535,6 +549,10 @@ class Parser # Zero operand instruction, and it's the last one. list << Instruction.new(codeOrigin, name, []) break + elsif isAnnotation @tokens[@idx] + annotation = @tokens[@idx].string + list << Instruction.new(codeOrigin, name, [], annotation) + @idx += 2 # Consume the newline as well. elsif @tokens[@idx] == "\n" # Zero operand instruction. list << Instruction.new(codeOrigin, name, []) @@ -543,6 +561,7 @@ class Parser # 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) @@ -552,6 +571,10 @@ class Parser elsif @tokens[@idx] == "," # Has another operand. @idx += 1 + elsif isAnnotation @tokens[@idx] + annotation = @tokens[@idx].string + @idx += 2 # Consume the newline as well. + break elsif @tokens[@idx] == "\n" # The end of the instruction. @idx += 1 @@ -560,7 +583,7 @@ class Parser parseError("Expected a comma, newline, or #{final} after #{operands.last.dump}") end } - list << Instruction.new(codeOrigin, name, operands) + list << Instruction.new(codeOrigin, name, operands, annotation) if endOfSequence break end diff --git a/Source/JavaScriptCore/offlineasm/registers.rb b/Source/JavaScriptCore/offlineasm/registers.rb index 2c5a4ebf6..f062ae6a5 100644 --- a/Source/JavaScriptCore/offlineasm/registers.rb +++ b/Source/JavaScriptCore/offlineasm/registers.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. +require "config" + GPRS = [ "t0", diff --git a/Source/JavaScriptCore/offlineasm/self_hash.rb b/Source/JavaScriptCore/offlineasm/self_hash.rb index 2c300fccc..b91057391 100644 --- a/Source/JavaScriptCore/offlineasm/self_hash.rb +++ b/Source/JavaScriptCore/offlineasm/self_hash.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "digest/sha1" require "pathname" diff --git a/Source/JavaScriptCore/offlineasm/settings.rb b/Source/JavaScriptCore/offlineasm/settings.rb index b7daa7492..601934f99 100644 --- a/Source/JavaScriptCore/offlineasm/settings.rb +++ b/Source/JavaScriptCore/offlineasm/settings.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "ast" require "backends" require "parser" diff --git a/Source/JavaScriptCore/offlineasm/transform.rb b/Source/JavaScriptCore/offlineasm/transform.rb index 86c72be67..a47ea0ad6 100644 --- a/Source/JavaScriptCore/offlineasm/transform.rb +++ b/Source/JavaScriptCore/offlineasm/transform.rb @@ -21,6 +21,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. +require "config" require "ast" # diff --git a/Source/JavaScriptCore/offlineasm/x86.rb b/Source/JavaScriptCore/offlineasm/x86.rb index 383526b25..470318a09 100644 --- a/Source/JavaScriptCore/offlineasm/x86.rb +++ b/Source/JavaScriptCore/offlineasm/x86.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. +require "config" + def isX64 case $activeBackend when "X86" @@ -353,7 +355,7 @@ class Sequence operand end } - newNode = Instruction.new(node.codeOrigin, node.opcode, newOperands) + newNode = Instruction.new(node.codeOrigin, node.opcode, newOperands, node.annotation) end else unless node.is_a? Label or @@ -622,7 +624,9 @@ class Instruction end def lowerX86Common - $asm.comment codeOriginString + $asm.codeOrigin codeOriginString + $asm.annotation annotation + case opcode when "addi" handleX86Add(:int) diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h index e5f6de438..2f6c6a253 100644 --- a/Source/JavaScriptCore/runtime/Executable.h +++ b/Source/JavaScriptCore/runtime/Executable.h @@ -176,6 +176,30 @@ namespace JSC { return intrinsic(); return NoIntrinsic; } + + static ptrdiff_t offsetOfJITCodeFor(CodeSpecializationKind kind) + { + if (kind == CodeForCall) + return OBJECT_OFFSETOF(ExecutableBase, m_jitCodeForCall); + ASSERT(kind == CodeForConstruct); + return OBJECT_OFFSETOF(ExecutableBase, m_jitCodeForConstruct); + } + + static ptrdiff_t offsetOfJITCodeWithArityCheckFor(CodeSpecializationKind kind) + { + if (kind == CodeForCall) + return OBJECT_OFFSETOF(ExecutableBase, m_jitCodeForCallWithArityCheck); + ASSERT(kind == CodeForConstruct); + return OBJECT_OFFSETOF(ExecutableBase, m_jitCodeForConstructWithArityCheck); + } + + static ptrdiff_t offsetOfNumParametersFor(CodeSpecializationKind kind) + { + if (kind == CodeForCall) + return OBJECT_OFFSETOF(ExecutableBase, m_numParametersForCall); + ASSERT(kind == CodeForConstruct); + return OBJECT_OFFSETOF(ExecutableBase, m_numParametersForConstruct); + } #endif protected: diff --git a/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp b/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp index 3b0b5a751..d9f96fa1e 100644 --- a/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp +++ b/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp @@ -20,39 +20,40 @@ #include "GCActivityCallback.h" #include "Heap.h" +#include "JSGlobalData.h" #include <BlackBerryPlatformMemory.h> namespace JSC { +static const size_t bytesWorthGC = 4 * 1024 * 1024; + DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap) : GCActivityCallback(heap->globalData()) { } -DefaultGCActivityCallback::doWork() +void DefaultGCActivityCallback::doWork() { + m_globalData->heap.collect(Heap::DoNotSweep); } void DefaultGCActivityCallback::didAllocate(size_t bytesAllocated) { - if (!BlackBerry::Platform::isMemoryLow()) - return; - - if (bytesAllocated < 1 * 1024 * 1024) + if (bytesAllocated < bytesWorthGC || m_timer.started()) return; - if (m_globalData->heap.isBusy() || !m_globalData->heap.isSafeToCollect()) - return; - - m_globalData->heap.collect(Heap::DoNotSweep); + // Try using ~5% CPU time. + m_timer.start(m_globalData->heap.lastGCLength() * 20); } void DefaultGCActivityCallback::willCollect() { + cancel(); } void DefaultGCActivityCallback::cancel() { + m_timer.stop(); } } diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index f74bfad90..6f98bd6f7 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -124,6 +124,18 @@ namespace JSC { friend class LLInt::Data; public: +#if USE(JSVALUE32_64) + enum { Int32Tag = 0xffffffff }; + enum { BooleanTag = 0xfffffffe }; + enum { NullTag = 0xfffffffd }; + enum { UndefinedTag = 0xfffffffc }; + enum { CellTag = 0xfffffffb }; + enum { EmptyValueTag = 0xfffffffa }; + enum { DeletedValueTag = 0xfffffff9 }; + + enum { LowestTag = DeletedValueTag }; +#endif + static EncodedJSValue encode(JSValue); static JSValue decode(EncodedJSValue); @@ -278,16 +290,6 @@ namespace JSC { * cell, integer and bool values the lower 32 bits (the 'payload') contain the pointer * integer or boolean value; in the case of all other tags the payload is 0. */ - enum { Int32Tag = 0xffffffff }; - enum { BooleanTag = 0xfffffffe }; - enum { NullTag = 0xfffffffd }; - enum { UndefinedTag = 0xfffffffc }; - enum { CellTag = 0xfffffffb }; - enum { EmptyValueTag = 0xfffffffa }; - enum { DeletedValueTag = 0xfffffff9 }; - - enum { LowestTag = DeletedValueTag }; - uint32_t tag() const; int32_t payload() const; #elif USE(JSVALUE64) diff --git a/Source/JavaScriptCore/wscript b/Source/JavaScriptCore/wscript index 4afb4d26a..2270455c8 100644 --- a/Source/JavaScriptCore/wscript +++ b/Source/JavaScriptCore/wscript @@ -33,7 +33,7 @@ def build(bld): import Options - jscore_excludes = ['jsc.cpp', 'ExecutableAllocatorPosix.cpp', 'LLIntOffsetsExtractor.cpp'] + jscore_excludes = ['jsc.cpp', 'ExecutableAllocatorPosix.cpp', 'LLIntOffsetsExtractor.cpp', 'udis86_itab.c'] jscore_exclude_patterns = get_port_excludes(Options.options.port) jscore_exclude_patterns.append('*None.cpp') @@ -46,9 +46,6 @@ def build(bld): else: jscore_excludes.append('JSStringRefBSTR.cpp') - if sys.platform.startswith('darwin'): - jscore_excludes.append('GCActivityCallback.cpp') # this is an empty impl. - bld.env.LIBDIR = output_dir full_dirs = get_dirs_for_features(jscore_dir, features=[Options.options.port.lower()], dirs=jscore_dirs) abs_dirs = [] diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index 28bcd5662..1fe99b13d 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,87 @@ +2012-07-13 Tony Payne <tpayne@chromium.org> + + Remove Widget from screenColorProfile + https://bugs.webkit.org/show_bug.cgi?id=91300 + + Reviewed by Adam Barth. + + * chromium/public/Platform.h: + (Platform): Updated comment to reflect that we no longer have a type param. + +2012-07-11 Alexandre Elias <aelias@google.com> + + [chromium] Move compositor quads to Platform/chromium/public + https://bugs.webkit.org/show_bug.cgi?id=90582 + + Reviewed by Adrienne Walker. + + This moves CCSharedQuadState, CCDrawQuad, and all but two CC*DrawQuad + classes to the WebKit namespace, as a first step to pushing them + across the process boundary for the ubercompositor. + + - The intent is to serialize the class hierarchy using the same + mechanism as WebInputEvent. In order to do this, there are three + requirements: pure POD data, a method returning size, and a packing + pragma. + + - Private data members are fine with this kind of serializer, and a + default constructor is not needed. Because of that, we can maintain + the same encapsulation and convenient APIs (behind + WEBKIT_IMPLEMENTATION) as the original classes. To ease the + transition, the original WebCore headers still exist and typedef to + the new classes. + + - However, SharedQuadState will be serialized using the normal + IPC_STRUCT_TRAITS macro, so I made its members public. A custom + serializer (on quad lists) will maintain the pointers from quads to + SharedQuadStates. + + - I converted the Material casting mechanism to materialCast() methods + living in the derived classes. That way, the WebCompositorQuad header + doesn't need to know about all its derived classes. + + - Quad classes not yet transitioned can still be used in + non-ubercompositor mode. CCRenderPassDrawQuad and CCYUVVideoDrawQuad + are currently non-POD and I left them in their original files. + + This approach is the best I've found so far, since it preserves all + WebCore-facing APIs and avoids unnecessary code duplication (new quad + types or members can be added by modifying only one place). There + also should not be an unreasonable amount of custom serializer code + required. + + * Platform.gypi: + * chromium/public/WebCompositorQuad.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h. + (WebKit): + (WebCompositorQuad): + (WebKit::WebCompositorQuad::quadRect): + (WebKit::WebCompositorQuad::quadTransform): + (WebKit::WebCompositorQuad::layerTransform): + (WebKit::WebCompositorQuad::layerRect): + (WebKit::WebCompositorQuad::scissorRect): + (WebKit::WebCompositorQuad::opacity): + (WebKit::WebCompositorQuad::needsBlending): + (WebKit::WebCompositorQuad::isLayerAxisAlignedIntRect): + (WebKit::WebCompositorQuad::quadVisibleRect): + (WebKit::WebCompositorQuad::isDebugQuad): + (WebKit::WebCompositorQuad::material): + (WebKit::WebCompositorQuad::sharedQuadState): + (WebKit::WebCompositorQuad::setSharedQuadState): + * chromium/public/WebCompositorSharedQuadState.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h. + (WebKit): + (WebCompositorSharedQuadState): + * chromium/public/WebCompositorSolidColorQuad.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h. + (WebKit): + (WebCompositorSolidColorQuad): + (WebKit::WebCompositorSolidColorQuad::color): + * chromium/public/WebCompositorTextureQuad.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h. + (WebKit): + (WebCompositorTextureQuad): + (WebKit::WebCompositorTextureQuad::uvRect): + (WebKit::WebCompositorTextureQuad::textureId): + (WebKit::WebCompositorTextureQuad::premultipliedAlpha): + (WebKit::WebCompositorTextureQuad::flipped): + 2012-07-05 Ian Vollick <vollick@chromium.org> [chromium] Create a WebKit::Web* wrapper for the cc animation classes diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi index a6b35fd93..465dc312c 100644 --- a/Source/Platform/Platform.gypi +++ b/Source/Platform/Platform.gypi @@ -43,6 +43,15 @@ 'chromium/public/WebClipboard.h', 'chromium/public/WebColor.h', 'chromium/public/WebCommon.h', + 'chromium/public/WebCompositorCheckerboardQuad.h', + 'chromium/public/WebCompositorDebugBorderQuad.h', + 'chromium/public/WebCompositorIOSurfaceQuad.h', + 'chromium/public/WebCompositorQuad.h', + 'chromium/public/WebCompositorSharedQuadState.h', + 'chromium/public/WebCompositorSolidColorQuad.h', + 'chromium/public/WebCompositorStreamVideoQuad.h', + 'chromium/public/WebCompositorTextureQuad.h', + 'chromium/public/WebCompositorTileQuad.h', 'chromium/public/WebContentLayer.h', 'chromium/public/WebContentLayerClient.h', 'chromium/public/WebCookie.h', diff --git a/Source/Platform/chromium/public/Platform.h b/Source/Platform/chromium/public/Platform.h index 4b745ab11..7e4320ba8 100644 --- a/Source/Platform/chromium/public/Platform.h +++ b/Source/Platform/chromium/public/Platform.h @@ -242,7 +242,7 @@ public: // Screen ------------------------------------------------------------- - // Supplies the system monitor color profile ("monitor") or a named ICC profile. + // Supplies the system monitor color profile. virtual void screenColorProfile(WebVector<char>* profile) { } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp b/Source/Platform/chromium/public/WebCompositorCheckerboardQuad.h index 6a1ba2992..e7e02bbff 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp +++ b/Source/Platform/chromium/public/WebCompositorCheckerboardQuad.h @@ -23,22 +23,33 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef WebCompositorCheckerboardQuad_h +#define WebCompositorCheckerboardQuad_h -#include "cc/CCStreamVideoDrawQuad.h" +#include "WebCompositorQuad.h" +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassOwnPtr.h> +#endif -namespace WebCore { +namespace WebKit { -PassOwnPtr<CCStreamVideoDrawQuad> CCStreamVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) -{ - return adoptPtr(new CCStreamVideoDrawQuad(sharedQuadState, quadRect, textureId, matrix)); -} +#pragma pack(push, 4) -CCStreamVideoDrawQuad::CCStreamVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) - : CCDrawQuad(sharedQuadState, CCDrawQuad::StreamVideoContent, quadRect) - , m_textureId(textureId) - , m_matrix(matrix) -{ -} +class WebCompositorCheckerboardQuad : public WebCompositorQuad { +public: +#if WEBKIT_IMPLEMENTATION + static PassOwnPtr<WebCompositorCheckerboardQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&); +#endif + + static const WebCompositorCheckerboardQuad* materialCast(const WebCompositorQuad*); +private: +#if WEBKIT_IMPLEMENTATION + WebCompositorCheckerboardQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect&); +#endif +}; + +#pragma pack(pop) } + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorDebugBorderQuad.h b/Source/Platform/chromium/public/WebCompositorDebugBorderQuad.h new file mode 100644 index 000000000..1fcfd4b65 --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorDebugBorderQuad.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 WebCompositorDebugBorderQuad_h +#define WebCompositorDebugBorderQuad_h + +#include "SkColor.h" +#include "WebCompositorQuad.h" +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassOwnPtr.h> +#endif + +namespace WebKit { + +#pragma pack(push, 4) + +class WebCompositorDebugBorderQuad : public WebCompositorQuad { +public: +#if WEBKIT_IMPLEMENTATION + static PassOwnPtr<WebCompositorDebugBorderQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, SkColor, int width); +#endif + + SkColor color() const { return m_color; }; + int width() const { return m_width; } + + static const WebCompositorDebugBorderQuad* materialCast(const WebCompositorQuad*); +private: +#if WEBKIT_IMPLEMENTATION + WebCompositorDebugBorderQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect&, SkColor, int width); +#endif + + SkColor m_color; + int m_width; +}; + +#pragma pack(pop) + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorIOSurfaceQuad.h b/Source/Platform/chromium/public/WebCompositorIOSurfaceQuad.h new file mode 100644 index 000000000..5d7eb1cbd --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorIOSurfaceQuad.h @@ -0,0 +1,60 @@ +/* + * 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 WebCompositorIOSurfaceQuad_h +#define WebCompositorIOSurfaceQuad_h + +#include "WebCompositorQuad.h" +#include "WebSize.h" +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +#pragma pack(push, 4) + +class WebCompositorIOSurfaceQuad : public WebCompositorQuad { +public: +#if WEBKIT_IMPLEMENTATION + static PassOwnPtr<WebCompositorIOSurfaceQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, const WebCore::IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); + + WebCore::IntSize ioSurfaceSize() const { return m_ioSurfaceSize; } + unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; } +#endif + + static const WebCompositorIOSurfaceQuad* materialCast(const WebCompositorQuad*); +private: +#if WEBKIT_IMPLEMENTATION + WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect&, const WebCore::IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); +#endif + + WebSize m_ioSurfaceSize; + unsigned m_ioSurfaceTextureId; +}; + +#pragma pack(pop) + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorQuad.h b/Source/Platform/chromium/public/WebCompositorQuad.h new file mode 100644 index 000000000..e2ad0adab --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorQuad.h @@ -0,0 +1,119 @@ +/* + * 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 WebCompositorQuad_h +#define WebCompositorQuad_h + +#include "WebCommon.h" +#include "WebCompositorSharedQuadState.h" + +namespace WebKit { + +// WARNING! All WebCompositorXYZQuad classes must remain PODs (plain old data). +// They are intended to be "serializable" by copying their raw bytes, so they +// must not contain any non-bit-copyable member variables! +// +// Furthermore, the class members need to be packed so they are aligned +// properly and don't have paddings/gaps, otherwise memory check tools +// like Valgrind will complain about uninitialized memory usage when +// transferring these classes over the wire. +#pragma pack(push, 4) + +// WebCompositorQuad is a bag of data used for drawing a quad. Because different +// materials need different bits of per-quad data to render, classes that derive +// from WebCompositorQuad store additional data in their derived instance. The Material +// enum is used to "safely" downcast to the derived class. +class WebCompositorQuad { +public: + enum Material { + Invalid, + Checkerboard, + DebugBorder, + IOSurfaceContent, + RenderPass, + TextureContent, + SolidColor, + TiledContent, + YUVVideoContent, + StreamVideoContent, + }; + +#if WEBKIT_IMPLEMENTATION + WebCore::IntRect quadRect() const { return m_quadRect; } + const WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform; } + WebCore::IntRect visibleContentRect() const { return m_sharedQuadState->visibleContentRect; } + WebCore::IntRect scissorRect() const { return m_sharedQuadState->scissorRect; } + float opacity() const { return m_sharedQuadState->opacity; } + // For the purposes of blending, what part of the contents of this quad are opaque? + WebCore::IntRect opaqueRect() const; + bool needsBlending() const { return m_needsBlending || !opaqueRect().contains(m_quadVisibleRect); } + bool isLayerAxisAlignedIntRect() const { return m_sharedQuadState->isLayerAxisAlignedIntRect(); } + + // Allows changing the rect that gets drawn to make it smaller. Parameter passed + // in will be clipped to quadRect(). + void setQuadVisibleRect(const WebCore::IntRect&); + WebCore::IntRect quadVisibleRect() const { return m_quadVisibleRect; } + bool isDebugQuad() const { return m_material == DebugBorder; } +#endif + + Material material() const { return m_material; } + + // Returns transfer size of this object based on the derived class (by + // looking at the material type). + unsigned size() const; + + const WebCompositorSharedQuadState* sharedQuadState() const { return m_sharedQuadState; } + void setSharedQuadState(const WebCompositorSharedQuadState* sharedQuadState) { m_sharedQuadState = sharedQuadState; } + +protected: +#if WEBKIT_IMPLEMENTATION + WebCompositorQuad(const WebCompositorSharedQuadState*, Material, const WebCore::IntRect&); +#endif + + // Stores state common to a large bundle of quads; kept separate for memory + // efficiency. There is special treatment to reconstruct these pointers + // during serialization. + const WebCompositorSharedQuadState* m_sharedQuadState; + + Material m_material; + WebRect m_quadRect; + WebRect m_quadVisibleRect; + + // By default, the shared quad state determines whether or not this quad is + // opaque or needs blending. Derived classes can override with these + // variables. + bool m_quadOpaque; + bool m_needsBlending; + + // Be default, this rect is empty. It is used when the shared quad state and above + // variables determine that the quad is not fully opaque but may be partially opaque. + WebRect m_opaqueRect; +}; + +#pragma pack(pop) + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorSharedQuadState.h b/Source/Platform/chromium/public/WebCompositorSharedQuadState.h new file mode 100644 index 000000000..37c6d18aa --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorSharedQuadState.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 WebCompositorSharedQuadState_h +#define WebCompositorSharedQuadState_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntRect.h" +#include <wtf/PassOwnPtr.h> +#endif +#include "WebRect.h" +#include "WebTransformationMatrix.h" + +namespace WebKit { + +class WebCompositorSharedQuadState { +public: + // 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. + WebRect visibleContentRect; + // This rect lives in the quad's target content space. + WebRect scissorRect; + float opacity; + bool opaque; + + 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); + bool isLayerAxisAlignedIntRect() const; +#endif +}; + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorSolidColorQuad.h b/Source/Platform/chromium/public/WebCompositorSolidColorQuad.h new file mode 100644 index 000000000..f31210e35 --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorSolidColorQuad.h @@ -0,0 +1,60 @@ +/* + * 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 WebCompositorSolidColorQuad_h +#define WebCompositorSolidColorQuad_h + +#include "SkColor.h" +#include "WebCompositorQuad.h" +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassOwnPtr.h> +#endif + +namespace WebKit { + +#pragma pack(push, 4) + +class WebCompositorSolidColorQuad : public WebCompositorQuad { +public: +#if WEBKIT_IMPLEMENTATION + static PassOwnPtr<WebCompositorSolidColorQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, SkColor); +#endif + + SkColor color() const { return m_color; }; + + static const WebCompositorSolidColorQuad* materialCast(const WebCompositorQuad*); +private: +#if WEBKIT_IMPLEMENTATION + WebCompositorSolidColorQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect&, SkColor); +#endif + + SkColor m_color; +}; + +#pragma pack(pop) + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorStreamVideoQuad.h b/Source/Platform/chromium/public/WebCompositorStreamVideoQuad.h new file mode 100644 index 000000000..36a3ceab4 --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorStreamVideoQuad.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 WebCompositorStreamVideoQuad_h +#define WebCompositorStreamVideoQuad_h + +#include "WebCompositorQuad.h" +#include <public/WebTransformationMatrix.h> +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassOwnPtr.h> +#endif + +namespace WebKit { + +#pragma pack(push, 4) + +class WebCompositorStreamVideoQuad : public WebCompositorQuad { +public: +#if WEBKIT_IMPLEMENTATION + static PassOwnPtr<WebCompositorStreamVideoQuad> create(const WebCompositorSharedQuadState*, const WebCore::IntRect&, unsigned textureId, const WebTransformationMatrix&); +#endif + + unsigned textureId() const { return m_textureId; } + const WebTransformationMatrix& matrix() const { return m_matrix; } + + static const WebCompositorStreamVideoQuad* materialCast(const WebCompositorQuad*); +private: +#if WEBKIT_IMPLEMENTATION + WebCompositorStreamVideoQuad(const WebCompositorSharedQuadState*, const WebCore::IntRect&, unsigned textureId, const WebTransformationMatrix&); +#endif + + unsigned m_textureId; + WebTransformationMatrix m_matrix; +}; + +#pragma pack(pop) + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorTextureQuad.h b/Source/Platform/chromium/public/WebCompositorTextureQuad.h new file mode 100644 index 000000000..9be6fd3e6 --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorTextureQuad.h @@ -0,0 +1,72 @@ +/* + * 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 WebCompositorTextureQuad_h +#define WebCompositorTextureQuad_h + +#if WEBKIT_IMPLEMENTATION +#include "FloatRect.h" +#endif +#include "WebCommon.h" +#include "WebCompositorQuad.h" +#include "WebFloatRect.h" +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassOwnPtr.h> +#endif + +namespace WebKit { + +#pragma pack(push, 4) + +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); + WebCore::FloatRect uvRect() const { return m_uvRect; } +#endif + + unsigned textureId() const { return m_textureId; } + bool premultipliedAlpha() const { return m_premultipliedAlpha; } + bool flipped() const { return m_flipped; } + + void setNeedsBlending(); + + 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); +#endif + + unsigned m_textureId; + bool m_premultipliedAlpha; + WebFloatRect m_uvRect; + bool m_flipped; +}; + +#pragma pack(pop) + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorTileQuad.h b/Source/Platform/chromium/public/WebCompositorTileQuad.h new file mode 100644 index 000000000..e0a255bb2 --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorTileQuad.h @@ -0,0 +1,79 @@ +/* + * 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 WebCompositorTileQuad_h +#define WebCompositorTileQuad_h + +#include "GraphicsTypes3D.h" +#include "WebCompositorQuad.h" +#include "WebPoint.h" +#include "WebSize.h" +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +#pragma pack(push, 4) + +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); + + Platform3DObject textureId() const { return m_textureId; } + WebCore::IntPoint textureOffset() const { return m_textureOffset; } + WebCore::IntSize textureSize() const { return m_textureSize; } + GC3Dint textureFilter() const { return m_textureFilter; } + bool swizzleContents() const { return m_swizzleContents; } + + bool leftEdgeAA() const { return m_leftEdgeAA; } + bool topEdgeAA() const { return m_topEdgeAA; } + bool rightEdgeAA() const { return m_rightEdgeAA; } + bool bottomEdgeAA() const { return m_bottomEdgeAA; } + + bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdgeAA() || bottomEdgeAA(); } +#endif + + 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); +#endif + + Platform3DObject m_textureId; + WebPoint m_textureOffset; + WebSize m_textureSize; + GC3Dint m_textureFilter; + bool m_swizzleContents; + bool m_leftEdgeAA; + bool m_topEdgeAA; + bool m_rightEdgeAA; + bool m_bottomEdgeAA; +}; + +#pragma pack(pop) + +} + +#endif diff --git a/Source/ThirdParty/ANGLE/ChangeLog b/Source/ThirdParty/ANGLE/ChangeLog index 47a8da7f4..863605261 100644 --- a/Source/ThirdParty/ANGLE/ChangeLog +++ b/Source/ThirdParty/ANGLE/ChangeLog @@ -1,3 +1,14 @@ +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + 2012-06-22 Joshua Netterfield <jnetterfield@rim.com> [BlackBerry] Sanitize GLSL code using ANGLE. diff --git a/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig b/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig index 505a57dc2..f67724cc0 100644 --- a/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig +++ b/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig @@ -38,15 +38,12 @@ REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Source/ThirdParty/gtest/xcode/Config/General.xcconfig b/Source/ThirdParty/gtest/xcode/Config/General.xcconfig index 1718ac9d7..47332f628 100644 --- a/Source/ThirdParty/gtest/xcode/Config/General.xcconfig +++ b/Source/ThirdParty/gtest/xcode/Config/General.xcconfig @@ -52,24 +52,15 @@ REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); -// If the target Mac OS X version does not match the current Mac OS X version, -// then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1050_1040 = macosx10.4; -SDKROOT_1060_1040 = macosx10.4; -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1040 = macosx10.4; -SDKROOT_1080_1040 = macosx10.4; -SDKROOT_1090_1040 = macosx10.4; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; // VERSIONING BUILD SETTINGS (used in Info.plist) GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 066f975d9..f73f5142b 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,118 @@ +2012-07-14 Filip Pizlo <fpizlo@apple.com> + + Unreviewed, build fix. + + * wtf/Assertions.cpp: + * wtf/Platform.h: + * wtf/unicode/icu/CollatorICU.cpp: + (WTF::Collator::userDefault): + +2012-07-13 Xianzhu Wang <wangxianzhu@chromium.org> + + Move WebCore/platform/text/Base64 to WTF/wtf/text + https://bugs.webkit.org/show_bug.cgi?id=91162 + + Reviewed by Adam Barth. + + * GNUmakefile.list.am: + * WTF.gypi: + * WTF.pro: + * WTF.vcproj/WTF.vcproj: + * WTF.xcodeproj/project.pbxproj: + * wtf/CMakeLists.txt: + * wtf/text/Base64.cpp: Renamed from Source/WebCore/platform/text/Base64.cpp. + (WTF): + (WTF::base64Encode): + (WTF::base64Decode): + (WTF::base64DecodeInternal): + * wtf/text/Base64.h: Renamed from Source/WebCore/platform/text/Base64.h. + (WTF): + (WTF::base64Encode): + +2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add API to get HTTPS status to WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=91100 + + Reviewed by Martin Robinson. + + Add support for GByteArray. + + * wtf/gobject/GRefPtr.cpp: + (WTF::refGPtr): + (WTF): + (WTF::derefGPtr): + * wtf/gobject/GRefPtr.h: + (WTF): + * wtf/gobject/GTypedefs.h: + +2012-07-12 Maciej Stachowiak <mjs@apple.com> + + Document ListHashSet iteration guarantees + https://bugs.webkit.org/show_bug.cgi?id=91106 + + Reviewed by Eric Seidel. + + * wtf/ListHashSet.h: + (WTF): Expand class comment to document this. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Replace definitions of BUILDING_ON / TARGETING macros with macros that will error when used. + + Part of <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros. + + Reviewed by Anders Carlsson. + + * wtf/Platform.h: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Switch a few cases that care about the SDK over to checking __MAC_OS_X_VERSION_MAX_ALLOWED so that things build. + + Part of <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + Reviewed by Filip Pizlo. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): The SDK we're building against determines how many elements + the structure is declared as having. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * wtf/Assertions.cpp: + * wtf/FastMalloc.cpp: + * wtf/Platform.h: + * wtf/ThreadingPthreads.cpp: + * wtf/unicode/icu/CollatorICU.cpp: + +2012-07-11 Anders Carlsson <andersca@apple.com> + + Add -Wtautological-compare and -Wsign-compare warning flags + https://bugs.webkit.org/show_bug.cgi?id=90994 + + Reviewed by Mark Rowe. + + * Configurations/Base.xcconfig: + 2012-07-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Re-enable __declspec(dl{import,export}) for MinGW when using EXPORT_MACROS diff --git a/Source/WTF/Configurations/Base.xcconfig b/Source/WTF/Configurations/Base.xcconfig index e93b48311..0d7b7da49 100644 --- a/Source/WTF/Configurations/Base.xcconfig +++ b/Source/WTF/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors; +COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; @@ -54,6 +54,7 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_SIGN_COMPARE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); @@ -107,16 +108,12 @@ DEAD_CODE_STRIPPING_debug = NO; DEAD_CODE_STRIPPING_normal = YES; DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT)); -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Source/WTF/GNUmakefile.list.am b/Source/WTF/GNUmakefile.list.am index c5f48a6ce..5f0ddd695 100644 --- a/Source/WTF/GNUmakefile.list.am +++ b/Source/WTF/GNUmakefile.list.am @@ -199,6 +199,8 @@ wtf_sources += \ Source/WTF/wtf/text/AtomicString.h \ Source/WTF/wtf/text/AtomicStringHash.h \ Source/WTF/wtf/text/AtomicStringImpl.h \ + Source/WTF/wtf/text/Base64.cpp \ + Source/WTF/wtf/text/Base64.h \ Source/WTF/wtf/text/CString.cpp \ Source/WTF/wtf/text/CString.h \ Source/WTF/wtf/text/StringBuffer.h \ diff --git a/Source/WTF/WTF.gypi b/Source/WTF/WTF.gypi index 867585506..eb280703a 100644 --- a/Source/WTF/WTF.gypi +++ b/Source/WTF/WTF.gypi @@ -109,6 +109,7 @@ 'wtf/text/AtomicString.h', 'wtf/text/AtomicStringHash.h', 'wtf/text/AtomicStringImpl.h', + 'wtf/text/Base64.h', 'wtf/text/CString.h', 'wtf/text/StringBuffer.h', 'wtf/text/StringBuilder.h', @@ -215,6 +216,7 @@ 'wtf/qt/MainThreadQt.cpp', 'wtf/qt/StringQt.cpp', 'wtf/text/AtomicString.cpp', + 'wtf/text/Base64.cpp', 'wtf/text/CString.cpp', 'wtf/text/StringBuilder.cpp', 'wtf/text/StringImpl.cpp', diff --git a/Source/WTF/WTF.pro b/Source/WTF/WTF.pro index 0962ef0b5..4bcb0ff0a 100644 --- a/Source/WTF/WTF.pro +++ b/Source/WTF/WTF.pro @@ -131,6 +131,7 @@ HEADERS += \ text/AtomicString.h \ text/AtomicStringHash.h \ text/AtomicStringImpl.h \ + text/Base64.h \ text/CString.h \ text/StringBuffer.h \ text/StringBuilder.h \ @@ -211,6 +212,7 @@ SOURCES += \ TypeTraits.cpp \ WTFThreadData.cpp \ text/AtomicString.cpp \ + text/Base64.cpp \ text/CString.cpp \ text/StringBuilder.cpp \ text/StringImpl.cpp \ diff --git a/Source/WTF/WTF.vcproj/WTF.vcproj b/Source/WTF/WTF.vcproj/WTF.vcproj index 2190dae1e..d1a295c87 100644 --- a/Source/WTF/WTF.vcproj/WTF.vcproj +++ b/Source/WTF/WTF.vcproj/WTF.vcproj @@ -408,6 +408,14 @@ > </File> <File + RelativePath="..\wtf\text\Base64.cpp" + > + </File> + <File + RelativePath="..\wtf\text\Base64.h" + > + </File> + <File RelativePath="..\wtf\text\CString.cpp" > </File> diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj index 7720461e2..c47ec1946 100644 --- a/Source/WTF/WTF.xcodeproj/project.pbxproj +++ b/Source/WTF/WTF.xcodeproj/project.pbxproj @@ -12,6 +12,8 @@ 0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD81AC4154FB22E00983E72 /* FastBitVector.h */; settings = {ATTRIBUTES = (); }; }; 4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4330F38E15745B0500AAFA8F /* URLString.cpp */; }; 4F0321BC156AA8D1006EBAF6 /* BitArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F0321BB156AA8D1006EBAF6 /* BitArray.h */; }; + 8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; }; + 8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; }; A876DBD8151816E500DADB95 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A876DBD7151816E500DADB95 /* Platform.h */; }; A8A4737F151A825B004123FF /* Alignment.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47254151A825A004123FF /* Alignment.h */; }; A8A47380151A825B004123FF /* AlwaysInline.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47255151A825A004123FF /* AlwaysInline.h */; }; @@ -256,6 +258,8 @@ 5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; }; 5D247B7314689C4700E78B76 /* WTF.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WTF.xcconfig; sourceTree = "<group>"; }; 5D247EB11468B01500E78B76 /* HeaderDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HeaderDetection.h; path = DerivedSources/WTF/HeaderDetection.h; sourceTree = BUILT_PRODUCTS_DIR; }; + 8134013615B092FD001FF0B8 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; }; + 8134013715B092FD001FF0B8 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; }; A876DBD7151816E500DADB95 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; }; A8A47254151A825A004123FF /* Alignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alignment.h; sourceTree = "<group>"; }; A8A47255151A825A004123FF /* AlwaysInline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlwaysInline.h; sourceTree = "<group>"; }; @@ -763,6 +767,8 @@ A8A4731B151A825B004123FF /* text */ = { isa = PBXGroup; children = ( + 8134013615B092FD001FF0B8 /* Base64.cpp */, + 8134013715B092FD001FF0B8 /* Base64.h */, A8A4731C151A825B004123FF /* ASCIIFastPath.h */, A8A4731D151A825B004123FF /* AtomicString.cpp */, A8A4731E151A825B004123FF /* AtomicString.h */, @@ -1041,6 +1047,7 @@ A8A4748C151A8264004123FF /* config.h in Headers */, 143F61201565F0F900DB514A /* RAMSize.h in Headers */, 0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */, + 8134013915B092FD001FF0B8 /* Base64.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1188,6 +1195,7 @@ A8A4747B151A825B004123FF /* URLSegments.cpp in Sources */, A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */, 143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */, + 8134013815B092FD001FF0B8 /* Base64.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp index 8fe8a38de..4c44d8b99 100644 --- a/Source/WTF/wtf/Assertions.cpp +++ b/Source/WTF/wtf/Assertions.cpp @@ -88,7 +88,7 @@ static void vprintf_stderr_common(const char* format, va_list args) CFStringGetCString(str, buffer, length, kCFStringEncodingUTF8); -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 asl_log(0, 0, ASL_LEVEL_NOTICE, "%s", buffer); #endif fputs(buffer, stderr); @@ -99,7 +99,7 @@ static void vprintf_stderr_common(const char* format, va_list args) return; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 va_list copyOfArgs; va_copy(copyOfArgs, args); asl_vlog(0, 0, ASL_LEVEL_NOTICE, format, copyOfArgs); diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt index 274f04c97..9d34d4563 100644 --- a/Source/WTF/wtf/CMakeLists.txt +++ b/Source/WTF/wtf/CMakeLists.txt @@ -118,6 +118,7 @@ SET(WTF_HEADERS text/AtomicString.h text/AtomicStringImpl.h + text/Base64.h text/CString.h text/StringBuffer.h text/StringHash.h @@ -174,6 +175,7 @@ SET(WTF_SOURCES dtoa/strtod.cc text/AtomicString.cpp + text/Base64.cpp text/CString.cpp text/StringBuilder.cpp text/StringImpl.cpp diff --git a/Source/WTF/wtf/FastMalloc.cpp b/Source/WTF/wtf/FastMalloc.cpp index cc8521cfb..0083f18d6 100644 --- a/Source/WTF/wtf/FastMalloc.cpp +++ b/Source/WTF/wtf/FastMalloc.cpp @@ -4654,10 +4654,10 @@ extern "C" { malloc_introspection_t jscore_fastmalloc_introspection = { &FastMallocZone::enumerate, &FastMallocZone::goodSize, &FastMallocZone::check, &FastMallocZone::print, &FastMallocZone::log, &FastMallocZone::forceLock, &FastMallocZone::forceUnlock, &FastMallocZone::statistics -#if !defined(BUILDING_ON_LEOPARD) || OS(IOS) +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 || OS(IOS) , 0 // zone_locked will not be called on the zone unless it advertises itself as version five or higher. #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) || OS(IOS) +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 || OS(IOS) , 0, 0, 0, 0 // These members will not be used unless the zone advertises itself as version seven or higher. #endif diff --git a/Source/WTF/wtf/ListHashSet.h b/Source/WTF/wtf/ListHashSet.h index 21e38d83a..fa654c5d9 100644 --- a/Source/WTF/wtf/ListHashSet.h +++ b/Source/WTF/wtf/ListHashSet.h @@ -34,6 +34,10 @@ namespace WTF { // order - iterating it will always give back values in the order // in which they are added. + // Unlike iteration of most WTF Hash data structures, iteration is + // guaranteed safe against mutation of the ListHashSet, except for + // removal of the item currently pointed to by a given iterator. + // In theory it would be possible to add prepend, insertAfter // and an append that moves the element to the end even if already present, // but unclear yet if these are needed. diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 919f872bc..fbf881a5e 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -334,21 +334,19 @@ #define WTF_OS_IOS 1 #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC #define WTF_OS_MAC_OS_X 1 -/* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */ -#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 -#define BUILDING_ON_LEOPARD 1 -#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 -#define BUILDING_ON_SNOW_LEOPARD 1 -#elif !defined(MAC_OS_X_VERSION_10_8) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8 -#define BUILDING_ON_LION 1 -#endif -#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 -#define TARGETING_LEOPARD 1 -#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 -#define TARGETING_SNOW_LEOPARD 1 -#elif !defined(MAC_OS_X_VERSION_10_8) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 -#define TARGETING_LION 1 -#endif + +/* FIXME: These can be removed after sufficient time has passed since the removal of BUILDING_ON / TARGETING macros. */ + +#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED 0 / 0 +#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED 0 / 0 + +#define BUILDING_ON_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED +#define BUILDING_ON_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED +#define BUILDING_ON_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED + +#define TARGETING_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED +#define TARGETING_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED +#define TARGETING_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED #endif /* OS(FREEBSD) - FreeBSD */ @@ -533,7 +531,7 @@ #if CPU(X86_64) #define WTF_USE_PLUGIN_HOST_PROCESS 1 #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #define ENABLE_GESTURE_EVENTS 1 #define ENABLE_RUBBER_BANDING 1 #define WTF_USE_SCROLLBAR_PAINTER 1 @@ -556,7 +554,7 @@ #if defined(ENABLE_VIDEO) #define ENABLE_VIDEO_TRACK 1 #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 #define HAVE_LAYER_HOSTING_IN_WINDOW_SERVER 1 #endif #define WTF_USE_APPKIT 1 @@ -704,7 +702,7 @@ #define HAVE_SYS_TIMEB_H 1 #define WTF_USE_ACCELERATE 1 -#ifndef TARGETING_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 #define HAVE_DISPATCH_H 1 #define HAVE_HOSTED_CORE_ANIMATION 1 @@ -1040,7 +1038,7 @@ #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1 #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 #define ENABLE_THREADED_SCROLLING 1 #endif @@ -1102,11 +1100,11 @@ #define ENABLE_GC_VALIDATION 1 #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #define WTF_USE_AVFOUNDATION 1 #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 #define WTF_USE_COREMEDIA 1 #endif @@ -1118,7 +1116,7 @@ #define WTF_USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1 #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) #define HAVE_INVERTED_WHEEL_EVENTS 1 #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/ThreadingPthreads.cpp b/Source/WTF/wtf/ThreadingPthreads.cpp index 510173d09..2cfa874e0 100644 --- a/Source/WTF/wtf/ThreadingPthreads.cpp +++ b/Source/WTF/wtf/ThreadingPthreads.cpp @@ -55,7 +55,7 @@ #include <sys/time.h> #endif -#if OS(MAC_OS_X) && !defined(BUILDING_ON_LEOPARD) +#if OS(MAC_OS_X) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 #include <objc/objc-auto.h> #endif @@ -228,7 +228,7 @@ void initializeCurrentThreadInternal(const char* threadName) UNUSED_PARAM(threadName); #endif -#if OS(MAC_OS_X) && !defined(BUILDING_ON_LEOPARD) +#if OS(MAC_OS_X) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // All threads that potentially use APIs above the BSD layer must be registered with the Objective-C // garbage collector in case API implementations use garbage-collected memory. objc_registerThreadWithCollector(); diff --git a/Source/WTF/wtf/gobject/GRefPtr.cpp b/Source/WTF/wtf/gobject/GRefPtr.cpp index 3a014da57..5aa067a62 100644 --- a/Source/WTF/wtf/gobject/GRefPtr.cpp +++ b/Source/WTF/wtf/gobject/GRefPtr.cpp @@ -120,6 +120,19 @@ template <> void derefGPtr(GPtrArray* ptr) g_ptr_array_unref(ptr); } +template <> GByteArray* refGPtr(GByteArray* ptr) +{ + if (ptr) + g_byte_array_ref(ptr); + return ptr; +} + +template <> void derefGPtr(GByteArray* ptr) +{ + if (ptr) + g_byte_array_unref(ptr); +} + } // namespace WTF #endif // ENABLE(GLIB_SUPPORT) diff --git a/Source/WTF/wtf/gobject/GRefPtr.h b/Source/WTF/wtf/gobject/GRefPtr.h index f4ff3d12e..df6888c06 100644 --- a/Source/WTF/wtf/gobject/GRefPtr.h +++ b/Source/WTF/wtf/gobject/GRefPtr.h @@ -210,6 +210,8 @@ template <> GSource* refGPtr(GSource* ptr); template <> void derefGPtr(GSource* ptr); template <> GPtrArray* refGPtr(GPtrArray*); template <> void derefGPtr(GPtrArray*); +template <> GByteArray* refGPtr(GByteArray*); +template <> void derefGPtr(GByteArray*); template <typename T> inline T* refGPtr(T* ptr) { diff --git a/Source/WTF/wtf/gobject/GTypedefs.h b/Source/WTF/wtf/gobject/GTypedefs.h index 79c33d262..2efc07233 100644 --- a/Source/WTF/wtf/gobject/GTypedefs.h +++ b/Source/WTF/wtf/gobject/GTypedefs.h @@ -64,6 +64,7 @@ typedef union _GdkEvent GdkEvent; typedef struct _GTimer GTimer; typedef struct _GKeyFile GKeyFile; typedef struct _GPtrArray GPtrArray; +typedef struct _GByteArray GByteArray; #if USE(CAIRO) typedef struct _cairo_surface cairo_surface_t; diff --git a/Source/WebCore/platform/text/Base64.cpp b/Source/WTF/wtf/text/Base64.cpp index bf706f68b..fafa3fab5 100644 --- a/Source/WebCore/platform/text/Base64.cpp +++ b/Source/WTF/wtf/text/Base64.cpp @@ -28,7 +28,7 @@ #include <wtf/StringExtras.h> #include <wtf/text/WTFString.h> -namespace WebCore { +namespace WTF { static const char base64EncMap[64] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, @@ -60,14 +60,14 @@ static const char base64DecMap[128] = { 0x31, 0x32, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00 }; -String base64Encode(const char* data, unsigned length, bool insertLFs) +String base64Encode(const char* data, unsigned length, Base64EncodePolicy policy) { Vector<char> result; - base64Encode(data, length, result, insertLFs); + base64Encode(data, length, result, policy); return String(result.data(), result.size()); } -void base64Encode(const char* data, unsigned len, Vector<char>& out, bool insertLFs) +void base64Encode(const char* data, unsigned len, Vector<char>& out, Base64EncodePolicy policy) { out.clear(); if (!len) @@ -86,7 +86,7 @@ void base64Encode(const char* data, unsigned len, Vector<char>& out, bool insert unsigned outLength = ((len + 2) / 3) * 4; // Deal with the 76 character per line limit specified in RFC 2045. - insertLFs = (insertLFs && outLength > 76); + bool insertLFs = (policy == Base64InsertLFs && outLength > 76); if (insertLFs) outLength += ((outLength - 1) / 76); @@ -159,7 +159,7 @@ static inline bool base64DecodeInternal(const T* data, unsigned len, Vector<char return false; out[outLength] = base64DecMap[ch]; outLength++; - } else if (policy == FailOnInvalidCharacter || (policy == IgnoreWhitespace && !isSpaceOrNewline(ch))) + } else if (policy == Base64FailOnInvalidCharacter || (policy == Base64IgnoreWhitespace && !isSpaceOrNewline(ch))) return false; } @@ -209,4 +209,4 @@ bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy return base64DecodeInternal<UChar>(in.characters(), in.length(), out, policy); } -} // namespace WebCore +} // namespace WTF diff --git a/Source/WTF/wtf/text/Base64.h b/Source/WTF/wtf/text/Base64.h new file mode 100644 index 000000000..5b0d4d80e --- /dev/null +++ b/Source/WTF/wtf/text/Base64.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> + * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Base64_h +#define Base64_h + +#include <wtf/Vector.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +namespace WTF { + +enum Base64EncodePolicy { + Base64DoNotInsertLFs, + Base64InsertLFs +}; + +enum Base64DecodePolicy { + Base64FailOnInvalidCharacter, + Base64IgnoreWhitespace, + Base64IgnoreInvalidCharacters +}; + +WTF_EXPORT_PRIVATE void base64Encode(const char*, unsigned, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); +WTF_EXPORT_PRIVATE void base64Encode(const Vector<char>&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); +WTF_EXPORT_PRIVATE void base64Encode(const CString&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); +WTF_EXPORT_PRIVATE String base64Encode(const char*, unsigned, Base64EncodePolicy = Base64DoNotInsertLFs); +WTF_EXPORT_PRIVATE String base64Encode(const Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); +WTF_EXPORT_PRIVATE String base64Encode(const CString&, Base64EncodePolicy = Base64DoNotInsertLFs); + +WTF_EXPORT_PRIVATE bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter); +WTF_EXPORT_PRIVATE bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter); +WTF_EXPORT_PRIVATE bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter); + +inline void base64Encode(const Vector<char>& in, Vector<char>& out, Base64EncodePolicy policy) +{ + base64Encode(in.data(), in.size(), out, policy); +} + +inline void base64Encode(const CString& in, Vector<char>& out, Base64EncodePolicy policy) +{ + base64Encode(in.data(), in.length(), out, policy); +} + +inline String base64Encode(const Vector<char>& in, Base64EncodePolicy policy) +{ + return base64Encode(in.data(), in.size(), policy); +} + +inline String base64Encode(const CString& in, Base64EncodePolicy policy) +{ + return base64Encode(in.data(), in.length(), policy); +} + +} // namespace WTF + +using WTF::Base64EncodePolicy; +using WTF::Base64DoNotInsertLFs; +using WTF::Base64InsertLFs; +using WTF::Base64DecodePolicy; +using WTF::Base64FailOnInvalidCharacter; +using WTF::Base64IgnoreWhitespace; +using WTF::Base64IgnoreInvalidCharacters; +using WTF::base64Encode; +using WTF::base64Decode; + +#endif // Base64_h diff --git a/Source/WTF/wtf/unicode/icu/CollatorICU.cpp b/Source/WTF/wtf/unicode/icu/CollatorICU.cpp index e507a20bd..bef0f7ab1 100644 --- a/Source/WTF/wtf/unicode/icu/CollatorICU.cpp +++ b/Source/WTF/wtf/unicode/icu/CollatorICU.cpp @@ -61,7 +61,7 @@ PassOwnPtr<Collator> Collator::userDefault() { #if OS(DARWIN) && USE(CF) // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU default doesn't work. -#if !defined(BUILDING_ON_LEOPARD) && !OS(IOS) +#if !OS(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent()); CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get(), kCFLocaleCollatorIdentifier); #else diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index e0737d8fd..603ce2196 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -5,6 +5,7 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/Modules/indexeddb" "${WEBCORE_DIR}/Modules/intents" "${WEBCORE_DIR}/Modules/notifications" + "${WEBCORE_DIR}/Modules/protocolhandler" "${WEBCORE_DIR}/Modules/quota" "${WEBCORE_DIR}/Modules/webaudio" "${WEBCORE_DIR}/Modules/webdatabase" @@ -127,6 +128,8 @@ SET(WebCore_IDL_FILES Modules/geolocation/PositionError.idl Modules/geolocation/PositionErrorCallback.idl + Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl + Modules/webaudio/AudioBuffer.idl Modules/webaudio/AudioBufferCallback.idl Modules/webaudio/AudioBufferSourceNode.idl @@ -393,7 +396,6 @@ SET(WebCore_IDL_FILES page/Location.idl page/MemoryInfo.idl page/Navigator.idl - page/NavigatorRegisterProtocolHandler.idl page/Performance.idl page/PerformanceEntry.idl page/PerformanceEntryList.idl @@ -435,6 +437,8 @@ SET(WebCore_SOURCES Modules/geolocation/GeolocationController.cpp Modules/geolocation/NavigatorGeolocation.cpp + Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp + accessibility/AXObjectCache.cpp accessibility/AccessibilityARIAGrid.cpp accessibility/AccessibilityARIAGridCell.cpp @@ -606,6 +610,8 @@ SET(WebCore_SOURCES dom/ExceptionCodePlaceholder.cpp dom/GenericEventQueue.cpp dom/IconURL.cpp + dom/IdTargetObserver.cpp + dom/IdTargetObserverRegistry.cpp dom/KeyboardEvent.cpp dom/MessageChannel.cpp dom/MessageEvent.cpp @@ -670,6 +676,7 @@ SET(WebCore_SOURCES dom/ViewportArguments.cpp dom/WebKitAnimationEvent.cpp dom/WebKitNamedFlow.cpp + dom/WebKitNamedFlowCollection.cpp dom/WebKitTransitionEvent.cpp dom/WheelEvent.cpp dom/WindowEventContext.cpp @@ -1082,7 +1089,6 @@ SET(WebCore_SOURCES page/MouseEventWithHitTestResults.cpp page/Navigator.cpp page/NavigatorBase.cpp - page/NavigatorRegisterProtocolHandler.cpp page/OriginAccessEntry.cpp page/Page.cpp page/PageGroup.cpp @@ -1242,6 +1248,7 @@ SET(WebCore_SOURCES platform/graphics/filters/SourceGraphic.cpp platform/graphics/filters/arm/NEONHelpers.h + platform/graphics/filters/arm/FEBlendNEON.h platform/graphics/filters/arm/FECompositeArithmeticNEON.h platform/graphics/filters/arm/FEGaussianBlurNEON.h platform/graphics/filters/arm/FELightingNEON.cpp @@ -1297,7 +1304,6 @@ SET(WebCore_SOURCES platform/sql/SQLiteStatement.cpp platform/sql/SQLiteTransaction.cpp - platform/text/Base64.cpp platform/text/BidiContext.cpp platform/text/DateTimeFormat.cpp platform/text/Hyphenation.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 96dd7aad2..3bf650a22 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,4478 @@ +2012-07-14 Eric Carlson <eric.carlson@apple.com> + + Enable AVCF hardware video decoding + https://bugs.webkit.org/show_bug.cgi?id=90015 + <rdar://problem/10770317> + + Reviewed by Anders Carlsson. + + * html/HTMLMediaElement.cpp: + (WebCore): + (WebCore::HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter): New, return the client's graphics + device adapter. + * html/HTMLMediaElement.h: + + * page/ChromeClient.h: + (WebCore::ChromeClient::graphicsDeviceAdapter): New. + + * platform/graphics/MediaPlayer.cpp: + (WebCore::MediaPlayer::graphicsDeviceAdapter): New, ask the media element for the graphics + device adapter. + * platform/graphics/MediaPlayer.h: + + * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h: Soft-link AVCFPlayerSetDirect3DDevice + and AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey. + + * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: + (WebCore::MediaPlayerPrivateAVFoundationCF::createAVAssetForURL): Pass the current d3d9 + device interface to the AVFWrapper. + (WebCore::AVFWrapper::createAssetForURL): If the d3d9 device implements IDirect3DDevice9Ex, + tell the AVAsset to enable hardware video decoding. + (WebCore::AVFWrapper::createPlayer): Pass the d3d9 device to the player if it implements IDirect3DDevice9Ex. + + * platform/graphics/ca/win/CACFLayerTreeHost.h: + (WebCore::CACFLayerTreeHost::graphicsDeviceAdapter): New, default implementation. + + * platform/graphics/ca/win/LegacyCACFLayerTreeHost.h: + (WebCore::LegacyCACFLayerTreeHost::graphicsDeviceAdapter): New, default implementation. + * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: + (WebCore::WKCACFViewLayerTreeHost::graphicsDeviceAdapter): New. + * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h: + + * platform/win/SoftLinking.h: Define SOFT_LINK_DLL_IMPORT_OPTIONAL, SOFT_LINK_LOADED_LIBRARY, + and SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL. + +2012-07-14 Ryosuke Niwa <rniwa@webkit.org> + + Fix Chromium Mac build failure after r122670. + + * platform/graphics/mac/ComplexTextController.cpp: + +2012-07-14 Mark Rowe <mrowe@apple.com> + + Fix the Snow Leopard build. + + * platform/LocalizedStrings.cpp: + (WebCore::contextMenuItemTagLookUpInDictionary): Fix a typo in the condition so that Snow Leopard + continues to take the expected path. + +2012-07-14 Ryosuke Niwa <rniwa@webkit.org> + + Accessing the last item in children should be a constant time operation + https://bugs.webkit.org/show_bug.cgi?id=91320 + + Reviewed by Ojan Vafai. + + Traverse nodes from the last item when the target offset we're looking for is closer to the last item + than to the cached item. e.g. if the cached item was at offset 0 in the collection and length was 100, + we should not be looking for the item at offset 95 from the cached item. + + Note that this trick can be only used in HTML collection that supports itemBefore and when the length + cache is available. + + Also broke shouldSearchFromFirstItem into smaller logical pieces to clarify the intents. + + Test: perf/htmlcollection-last-item.html + + * html/HTMLCollection.cpp: + (WebCore): + (WebCore::HTMLCollection::isLastItemCloserThanLastOrCachedItem): + (WebCore::HTMLCollection::isFirstItemCloserThanCachedItem): + (WebCore::HTMLCollection::item): + * html/HTMLCollection.h: + (HTMLCollection): + +2012-07-14 Mark Rowe <mrowe@apple.com> + + Fix the Windows build. + + * platform/network/cf/DNSCFNet.cpp: Fix the condition to take Windows in to account. + +2012-07-14 Mark Rowe <mrowe@apple.com> + + Make it explicit which code paths iOS should use when doing checks based on OS X versions. + + Rubber-stamped by David Kilzer. + + * WebCore.exp.in: + * accessibility/AccessibilityList.h: + * accessibility/AccessibilityTable.h: + * accessibility/mac/AXObjectCacheMac.mm: + * editing/mac/EditorMac.mm: + * loader/MainResourceLoader.cpp: + * loader/MainResourceLoader.h: + * page/AlternativeTextClient.h: + * page/mac/SettingsMac.mm: + * platform/LocalizedStrings.cpp: + * platform/MemoryPressureHandler.cpp: + * platform/audio/mac/AudioBusMac.mm: + * platform/graphics/Gradient.h: + * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: + * platform/graphics/ca/GraphicsLayerCA.cpp: + * platform/graphics/ca/PlatformCALayer.h: + * platform/graphics/ca/mac/PlatformCALayerMac.mm: + * platform/graphics/ca/mac/TileCache.mm: + * platform/graphics/cg/GraphicsContextCG.cpp: + * platform/graphics/cg/ImageBufferCG.cpp: + * platform/graphics/cg/ImageBufferDataCG.h: + * platform/graphics/cg/ImageCG.cpp: + * platform/graphics/cg/ImageSourceCG.cpp: + * platform/graphics/cocoa/FontPlatformDataCocoa.mm: + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + * platform/graphics/mac/ComplexTextController.cpp: + * platform/graphics/mac/ComplexTextControllerCoreText.mm: + * platform/graphics/mac/FontCacheMac.mm: + * platform/graphics/mac/FontCustomPlatformData.cpp: + * platform/graphics/mac/FontMac.mm: + * platform/graphics/mac/GraphicsContextMac.mm: + * platform/graphics/mac/SimpleFontDataMac.mm: + * platform/graphics/mac/WebLayer.h: + * platform/graphics/mac/WebLayer.mm: + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + * platform/mac/DisplaySleepDisabler.cpp: + * platform/mac/DisplaySleepDisabler.h: + * platform/mac/HTMLConverter.h: + * platform/mac/HTMLConverter.mm: + * platform/mac/MemoryPressureHandlerMac.mm: + * platform/mac/SharedTimerMac.mm: + * platform/mac/SuddenTermination.mm: + * platform/mac/WebFontCache.mm: + * platform/network/Credential.h: + * platform/network/ResourceHandle.h: + * platform/network/cf/DNSCFNet.cpp: + * platform/network/cf/ProxyServerCFNet.cpp: + * platform/network/cf/ResourceRequest.h: + * platform/network/cf/SocketStreamHandleCFNet.cpp: + * platform/network/mac/AuthenticationMac.mm: + * platform/network/mac/CookieStorageMac.mm: + * platform/network/mac/ResourceHandleMac.mm: + * platform/network/mac/ResourceRequestMac.mm: + * platform/network/mac/WebCoreURLResponse.mm: + * platform/text/TextChecking.h: + * platform/text/cf/HyphenationCF.cpp: + * platform/text/mac/HyphenationMac.mm: + * rendering/RenderLayerBacking.cpp: + * rendering/RenderLayerCompositor.cpp: + +2012-07-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122614. + http://trac.webkit.org/changeset/122614 + https://bugs.webkit.org/show_bug.cgi?id=91317 + + Broke performance tests (Requested by rniwa on #webkit). + + * bindings/v8/V8Binding.cpp: + (WebCore::StringCache::v8ExternalStringSlow): + +2012-07-05 Robert Hogan <robert@webkit.org> + + CSS 2.1 failure: vertical-align-boxes-001 fails + https://bugs.webkit.org/show_bug.cgi?id=90626 + + Reviewed by Eric Seidel. + + Tests: css2.1/20110323/vertical-align-boxes-001.htm + + A percentage value vertical-align is always a percentage of the actual line-height rather than + the margin box per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: + refer to the 'line-height' of the element itself'. Confusingly, RenderBox::lineheight() is a + shorthand into the dimensions of the margin box for replaced elements in the other vertical-align + cases, i.e. where it's the margin box that's relevant rather than the 'line-height'. So rather than patch RenderBox's + lineHeight() to somehow consider the percentage cases, just give percentage vertical-align the full computedLineHeight() + rather than lineHeight()'s margin box. + + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::verticalPositionForBox): + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + Iterating backwards over HTMLCollection is O(n^2) + https://bugs.webkit.org/show_bug.cgi?id=91306 + + Reviewed by Anders Carlsson. + + Fixed the bug by introducing itemBefore that iterates nodes backwards to complement itemAfter. + Unfortunately, some HTML collections such as HTMLFormCollection and HTMLTableRowsCollection have + its own itemAfter function and writing an equivalent itemBefore is somewhat tricky. For now, + added a new boolean flag indicating whether a given HTML collection supports itemBefore or not, + and left those HTML collections that override itemAfter alone. + + This also paves our way to share more code between DynamicNodeList and HTMLCollection. + + Test: perf/htmlcollection-backwards-iteration.html + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): Takes ItemBeforeSupportType. + (WebCore::DynamicNodeListCacheBase::supportsItemBefore): Added. + (DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::setItemCache): Replaced a FIXME by an assertion now that + we can. + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::HTMLAllCollection): Supports itemBefore since it doesn't override + itemAfter. + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::create): + (WebCore::isAcceptableElement): Made it a static local function instead of a static member. + (WebCore::nextNode): Templatized. + (WebCore::itemBeforeOrAfter): Extracted from itemAfter and templatized. + (WebCore::HTMLCollection::itemBefore): Added. + (WebCore::HTMLCollection::itemAfter): + (WebCore::HTMLCollection::shouldSearchFromFirstItem): Added. Determines whether we should reset + the item cache to the first item. We obviously do if the cache is invalid. If the target offset + is after the cached offset, then we shouldn't go back regardless of availability of itemBefore. + Otherwise, we go back to the first item iff itemBefore is not available or the distance from + the cached offset to the target offset is greater than the target offset itself. + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): Use the term "offset" to match the terminology elsewhere. + (WebCore::HTMLCollection::itemBeforeOrAfterCachedItem): Ditto. Also added the logic to iterate + nodes backwards using itemBefore. Once we're in this branch, we should always find a matching + item since the target offset was less than the cached offset, and offsets are non-negative. + If we had ever reached the end of the loop without finding an item, it indicates that the cache + has been invalid and we have some serious bug elsewhere. + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollection): + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::HTMLOptionsCollection): Supports itemBefore since it doesn't + override itemAfter. + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::HTMLFormCollection): Doesn't support itemBefore as it overrides + itemAfter. + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::HTMLNameCollection): Ditto. + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): + +2012-07-13 Eric Penner <epenner@google.com> + + [chromium] Add 'self-managed' option to CCPrioritizedTexture to enable render-surface and canvas use cases. + https://bugs.webkit.org/show_bug.cgi?id=91177 + + Reviewed by Adrienne Walker. + + This makes the render-surface memory use case generic as 'self-managed' textures, + as this use case is popping up in other places (eg. canvases). It's exactly the + same idea except we can have as many place-holders as we want at arbitrary + priorities. + + This already tested by the render surface unit tests which now also use the + generic placeholder. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::initializeLayerRenderer): + (WebCore::CCLayerTreeHost::updateLayers): + (WebCore::CCLayerTreeHost::setPrioritiesForSurfaces): + (WebCore): + (WebCore::CCLayerTreeHost::setPrioritiesForLayers): + (WebCore::CCLayerTreeHost::prioritizeTextures): + (WebCore::CCLayerTreeHost::calculateMemoryForRenderSurfaces): + (WebCore::CCLayerTreeHost::paintLayerContents): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + (WebCore::CCPrioritizedTexture::CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder): + * platform/graphics/chromium/cc/CCPrioritizedTexture.h: + (CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::setIsSelfManaged): + (WebCore::CCPrioritizedTexture::isSelfManaged): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + (WebCore::CCPrioritizedTextureManager::prioritizeTextures): + (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): + (WebCore::CCPrioritizedTextureManager::destroyBacking): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: + (CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::memoryForSelfManagedTextures): + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Internals: Clean up the mock PagePopupDriver correctly. + https://bugs.webkit.org/show_bug.cgi?id=91250 + + Unreviewed, a trivial testing code fix. + + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::restoreTo): + (WebCore::InternalSettings::reset): + Resetting PaePopupDriver here instead of Backup::restoreTo. + Also, close the mock popup before resetting PagePopupDriver by clearing m_pagePopupDriver. + * testing/MockPagePopupDriver.cpp: + (WebCore::MockPagePopupDriver::~MockPagePopupDriver): + Close the popup. + +2012-07-13 Tony Payne <tpayne@chromium.org> + + Remove Widget from screenColorProfile + https://bugs.webkit.org/show_bug.cgi?id=91300 + + Reviewed by Adam Barth. + + Chromium, the only platform implementing screenColorProfile, does not + need the Widget, so removing for simplicity. + + Covered by existing tests. + + * platform/PlatformScreen.h: + (WebCore): Updated comment to remove reference to type param that no + longer exists and removed Widget param. + * platform/blackberry/PlatformScreenBlackBerry.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/chromium/PlatformScreenChromium.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/efl/PlatformScreenEfl.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/gtk/PlatformScreenGtk.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/image-decoders/ImageDecoder.h: + (WebCore::ImageDecoder::qcmsOutputDeviceProfile): removed param to + match screenColorProfile()'s new spec. + * platform/mac/PlatformScreenMac.mm: + (WebCore::screenColorProfile): Removed widget param. + * platform/qt/PlatformScreenQt.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/win/PlatformScreenWin.cpp: + (WebCore::screenColorProfile): Removed widget param. + +2012-07-13 Brian Anderson <brianderson@chromium.org> + + [chromium] Add flushes to CCTextureUpdater::update + https://bugs.webkit.org/show_bug.cgi?id=89035 + + Reviewed by Adrienne Walker. + + Automatic flushes are being removed from the command buffer, so + this moves the flushes into the CCTextureUpdater itself. + + CCTextureUpdaterTest added to verify texture upload/flushing patterns. + + * platform/graphics/chromium/cc/CCGraphicsContext.h: + (WebCore::CCGraphicsContext::flush): + (CCGraphicsContext): + * platform/graphics/chromium/cc/CCTextureUpdater.cpp: + (WebCore): + (WebCore::CCTextureUpdater::update): Manual flushes added here. + +2012-07-13 Kiran Muppala <cmuppala@apple.com> + + REGRESSION: RenderInline boundingBox ignores relative position offset + https://bugs.webkit.org/show_bug.cgi?id=91168 + + Reviewed by Simon Fraser. + + RenderGeometryMap, used for caching the transform to the view, + expects the first mapping pushed, to be that of the view itself. + RenderInline was instead pushing it's own offset first. Besides + the offset of the view itself was not being pushed. + + Relaxed the RenderGeometryMap restriction that the first pushed + step should be of the view. It is sufficient that the view's mapping + is pushed in the first call to pushMappingsToAncestor. Modified + RenderInline to push the offset of the view also to the geometry map. + + Test: fast/inline/inline-relative-offset-boundingbox.html + + * rendering/RenderGeometryMap.cpp: + (WebCore::RenderGeometryMap::pushMappingsToAncestor): Add assertion to + check if mapping to view was pushed in first invocation. + (WebCore::RenderGeometryMap::pushView): Correct assertion that checks + if the view's mapping is the first one to be applied. + (WebCore::RenderGeometryMap::stepInserted): Use isRenderView to check if + a mapping step belongs to a view instead of using mapping size. + (WebCore::RenderGeometryMap::stepRemoved): Ditto. + * rendering/RenderInline.cpp: + (WebCore::(anonymous namespace)::AbsoluteQuadsGeneratorContext::AbsoluteQuadsGeneratorContext): + Push mappings all the way up to and including the view. + +2012-07-13 Xianzhu Wang <wangxianzhu@chromium.org> + + Move WebCore/platform/text/Base64 to WTF/wtf/text + https://bugs.webkit.org/show_bug.cgi?id=91162 + + Reviewed by Adam Barth. + + No new tests. Files moving only. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Modules/websockets/WebSocketHandshake.cpp: + (WebCore::generateSecWebSocketKey): + (WebCore::WebSocketHandshake::getExpectedWebSocketAccept): + * Target.pri: + * WebCore.gypi: + * WebCore.order: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * fileapi/FileReaderLoader.cpp: + (WebCore::FileReaderLoader::convertToDataURL): + * inspector/DOMPatchSupport.cpp: + (WebCore::DOMPatchSupport::createDigest): + * inspector/InspectorFileSystemAgent.cpp: + (WebCore): + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::cachedResourceContent): + (WebCore::InspectorPageAgent::sharedBufferContent): + * loader/archive/mhtml/MHTMLArchive.cpp: + (WebCore::MHTMLArchive::generateMHTMLData): + * loader/archive/mhtml/MHTMLParser.cpp: + (WebCore::MHTMLParser::parseNextPart): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::btoa): + (WebCore::DOMWindow::atob): + * page/Page.cpp: + (WebCore::Page::userStyleSheetLocationChanged): + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::CGImageToDataURL): + * platform/graphics/gtk/ImageBufferGtk.cpp: + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/skia/FontCustomPlatformData.cpp: + (WebCore::createUniqueFontName): + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::toDataURL): + (WebCore::ImageDataToDataURL): + * platform/graphics/win/FontCustomPlatformData.cpp: + (WebCore::createUniqueFontName): + * platform/graphics/wince/FontCustomPlatformData.cpp: + (WebCore::createUniqueFontName): + * platform/graphics/wince/ImageBufferWinCE.cpp: + * platform/graphics/wx/ImageBufferWx.cpp: + * platform/network/DataURL.cpp: + (WebCore::handleDataURL): + * platform/network/cf/ResourceHandleCFNet.cpp: + (WebCore::applyBasicAuthorizationHeader): + * platform/network/mac/ResourceHandleMac.mm: + (WebCore::applyBasicAuthorizationHeader): + * platform/network/soup/ResourceHandleSoup.cpp: + * platform/win/SSLKeyGeneratorWin.cpp: + (WebCore::WebCore::signedPublicKeyAndChallengeString): + +2012-07-13 Xianzhu Wang <wangxianzhu@chromium.org> + + [Chromium] Sometimes bottom of text is truncated when page has a fractional scale + https://bugs.webkit.org/show_bug.cgi?id=88684 + + Reviewed by Tony Chang. + + When the page has a fractional scale, the ascent and descent part of the fonts might be fractional. + If the descent part is rounded down, the bottom of the text might be truncated when displayed + when subpixel text positioning is enabled. + To avoid that, borrow one unit from the ascent when possible. + + Test: fast/text/descent-clip-in-scaled-page.html + + * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: + (WebCore::FontPlatformData::setupPaint): Moved NoPreference handling into querySystemForRenderStyle so that fontRenderStyle() can have actual styles without NoPreference. + (WebCore::FontPlatformData::querySystemForRenderStyle): Added NoPreference handling (moved from setupPaint) + * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h: + (FontPlatformData): + (WebCore::FontPlatformData::fontRenderStyle): Added to let SimpleFontDataSkia access the font render styles. + * platform/graphics/skia/SimpleFontDataSkia.cpp: + (WebCore::SimpleFontData::platformInit): + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + Remove an assertion after r122637. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange): + +2012-07-13 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Improve the mobile theme slightly + https://bugs.webkit.org/show_bug.cgi?id=90806 + + Reviewed by Kenneth Rohde Christiansen. + + Improve drawing of the mobile theme's controls' background. + + Ensure the focus ring never appears with the mobile theme, since it + looks bad in combination with the highlights. + + No new tests. The painting code from the mobile theme is still + not covered specifically (it will when we revive pixel tests). + + * platform/qt/RenderThemeQtMobile.cpp: + (WebCore): + (WebCore::addPointToOctants): Added. This is simply a helper to avoid + doing too much duplicate work in drawControlBackground. + (WebCore::drawControlBackground): Rely on the octant logic added above + and take the opportunity to increase the granularity. + (WebCore::borderPen): + (WebCore::StylePainterMobile::findLineEdit): + (WebCore::RenderThemeQtMobile::adjustTextFieldStyle): + * platform/qt/RenderThemeQtMobile.h: + (RenderThemeQtMobile): + (WebCore::RenderThemeQtMobile::supportsFocusRing): + +2012-07-13 Julien Chaffraix <jchaffraix@webkit.org> + + Remove an always-failing table-wrapping check in RenderObject::addChild + https://bugs.webkit.org/show_bug.cgi?id=91286 + + Reviewed by Eric Seidel. + + Due to the structure of the code, this test is always failing (newChild->isTableCell() + is true to get in the branch). + + The changeset adding the code didn't add testing so I poundered adding the mentioned test, + which is passing. However the test would need to be blindly changed to be included in our + test harness. I would also expect this code to be exercised by other table tests anyway. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::addChild): + Removed never-reached branch. While at it, removed a 'what' comment in the same file. + +2012-07-13 Emil A Eklund <eae@chromium.org> + + Use LayoutBoxExtent for image outsets + https://bugs.webkit.org/show_bug.cgi?id=91166 + + Reviewed by Tony Chang. + + Change RenderStyle and calling code to use LayoutBoxExtent for image + outsets and remove text direction and writing mode versions of the + outline getters from RenderStyle as LayoutBoxExtent provides the same + functionality. + + No new tests, no change in functionality. + + * platform/graphics/FractionalLayoutBoxExtent.h: + * platform/graphics/FractionalLayoutBoxExtent.cpp: + (WebCore::FractionalLayoutBoxExtent::logicalTop): + (WebCore::FractionalLayoutBoxExtent::logicalBottom): + Add logicalTop and logicalBottom methods to go with the existing + logicalLeft and logicalRight ones. + + * platform/graphics/FractionalLayoutRect.h: + (WebCore::FractionalLayoutRect::expand): + Add FractionalLayoutBoxExtent version of expand method. + + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::addBorderOutsetVisualOverflow): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets and the logicalTop/Bottom/Left/Right methods. + + (WebCore::clipRectForNinePieceImageStrip): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::maskClipRect): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets and the new FractionalLayoutRect::expand method. + + (WebCore::RenderBox::addVisualEffectOverflow): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintNinePieceImage): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets and the new FractionalLayoutRect::expand method. + + * rendering/style/RenderStyle.h: + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::imageOutsets): + Change getImageOutsets to return a FractionalLayoutBoxExtent object and + rename to imageOutsets to match the webkit naming convention for getters. + + Remove getBorderImageHorizontalOutsets, getBorderImageVerticalOutsets, + getBorderImageInlineDirectionOutsets, getImageHorizontalOutsets, + getImageVerticalOutsets and getBorderImageBlockDirectionOutsets methods + as the same functionality is provided by FractionalLayoutBoxExtent. + +2012-07-13 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=91278 + Improve block margin estimation function to account for not having a layout and for quirks mode + + Reviewed by Simon Fraser. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::marginBeforeEstimateForChild): + Revise marginBeforeEstimateForChild so that it computes block margins for the grandchild before + recurring. This includes the quirks margin information as well. This ensures that the margins are + up-to-date when checked, even before the object has had its first layout. + + * rendering/RenderBlock.h: + (WebCore::RenderBlock::setMarginStartForChild): + (WebCore::RenderBlock::setMarginEndForChild): + (WebCore::RenderBlock::setMarginBeforeForChild): + (WebCore::RenderBlock::setMarginAfterForChild): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeBlockDirectionMargins): + * rendering/RenderBox.h: + (RenderBox): + Add consts in order to compile. + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + NodeLists should not invalidate on irreleavnt attribute changes + https://bugs.webkit.org/show_bug.cgi?id=91277 + + Reviewed by Ojan Vafai. + + Explicitely check the invalidation type and the changed attribute in NodeListNodeData::invalidateCaches + and ElementRareData::clearHTMLCollectionCaches to only invalidate node lists affected by the change. + + Also merged invalidateNodeListsCacheAfterAttributeChanged and invalidateNodeListsCacheAfterChildrenChanged + as invalidateNodeListCachesInAncestors since they're almost identical after r122498. + + In addition, moved shouldInvalidateNodeListForType from Document.cpp to DynamicNodeList.h and renamed it to + shouldInvalidateTypeOnAttributeChange since it needs to called in Node.cpp and ElementRareData.h. + + * dom/Attr.cpp: + (WebCore::Attr::setValue): + (WebCore::Attr::childrenChanged): + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::childrenChanged): + * dom/Document.cpp: + (WebCore::Document::registerNodeListCache): Calls isRootedAtDocument() instead of directly comparing + the value of NodeListRootType in order to prepare for the bug 80269. + (WebCore::Document::unregisterNodeListCache): Ditto. + (WebCore): shouldInvalidateNodeListForType is moved to DynamicNodeList.h + (WebCore::Document::shouldInvalidateNodeListCaches): + * dom/DynamicNodeList.h: + (DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange): Moved from Document.cpp. + * dom/Element.cpp: + (WebCore::Element::attributeChanged): + * dom/ElementRareData.h: + (WebCore::ElementRareData::clearHTMLCollectionCaches): Takes const QualifiedName* to compare against + the invalidation type of HTML collections via shouldInvalidateTypeOnAttributeChange. + * dom/Node.cpp: + (WebCore::Node::invalidateNodeListCachesInAncestors): Merged invalidateNodeListCachesInAncestors and + invalidateNodeListsCacheAfterChildrenChanged. Also pass attrName to clearHTMLCollectionCaches. + (WebCore::NodeListsNodeData::invalidateCaches): Compares attrName against the invalidation type of + node lists via shouldInvalidateTypeOnAttributeChange. + (WebCore): + * dom/Node.h: + (Node): + * dom/NodeRareData.h: + (WebCore::NodeRareData::ensureNodeLists): Merged NodeRareData::createNodeLists. + (WebCore::NodeRareData::clearChildNodeListCache): Moved from Node.cpp. + (NodeRareData): + * html/HTMLCollection.h: + (HTMLCollectionCacheBase): + +2012-07-13 Arpita Bahuguna <arpitabahuguna@gmail.com> + + Refactor RenderTable to use the section's iteration functions. + https://bugs.webkit.org/show_bug.cgi?id=89751 + + Reviewed by Julien Chaffraix. + + Removing anti-pattern wherever possible from RenderTable code. Also, modifying + RenderTable sections' iterations to use helper functions. + + No new tests required for this change since no change in behavior is expected. + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::addOverflowFromChildren): + (WebCore::RenderTable::setCellLogicalWidths): + (WebCore::RenderTable::outerBorderStart): + (WebCore::RenderTable::outerBorderEnd): + Removed anti-patterns involving iterations over RenderObjects. + + (WebCore::RenderTable::outerBorderAfter): + Modified RenderTable sections' iteration to use helper functions. + +2012-07-13 Enrica Casucci <enrica@apple.com> + + Threadsafety issues in WebScriptObject + https://bugs.webkit.org/show_bug.cgi?id=90849 + + Reviewed by Geoff Garen. + + Updated fix for this bug. The JSC API lock needs to be acquired also in JSObject. + + * bindings/objc/WebScriptObject.mm: + (-[WebScriptObject JSObject]): + +2012-07-13 Raymond Toy <rtoy@google.com> + + DelayNode doesn't work if delayTime.value == delayTime.maxValue + https://bugs.webkit.org/show_bug.cgi?id=90357 + + Reviewed by Kenneth Russell. + + Increase delay buffer size slightly so that the read and write + pointers don't become equal when the delay and the max delay are + the same. + + Tests: webaudio/delaynode-max-default-delay.html + webaudio/delaynode-max-nondefault-delay.html + + * Modules/webaudio/DelayDSPKernel.cpp: + (WebCore): Moved SmoothingTimeConstant to WebCore namespace. + (WebCore::DelayDSPKernel::DelayDSPKernel): Add some additional checks to prevent crashes; use bufferLengthForDelay to compute buffer length. + (WebCore::DelayDSPKernel::bufferLengthForDelay): New function to compute buffer length. + * Modules/webaudio/DelayDSPKernel.h: + (DelayDSPKernel): Declare bufferLengthForDelay. + +2012-07-13 Benjamin Poulain <bpoulain@apple.com> + + Always aggressively preload on iOS + https://bugs.webkit.org/show_bug.cgi?id=91276 + + Reviewed by Simon Fraser. + + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::preload): + +2012-07-13 Vineet Chaudhary <rgf748@motorola.com> + + Restructure V8Utilities::extractTransferables() with help of toV8Sequence() + https://bugs.webkit.org/show_bug.cgi?id=91208 + + Reviewed by Kentaro Hara. + + We can remove the specialised check for MessagePort from V8Utilities::extractTransferables() + using toV8Sequence() as it validates the passed object for sequence type per WebIDL spec. + + No new test as just refactoring. + Existing tests under fast/dom/Window/window-* fast/dom/events/* + covers tests. + + * bindings/v8/V8Utilities.cpp: + (WebCore::extractTransferables): + +2012-07-13 Vincent Scheib <scheib@chromium.org> + + Pointer Lock handles disconnected DOM elements + https://bugs.webkit.org/show_bug.cgi?id=77029 + + Reviewed by Adrienne Walker. + + Pointer Lock Controller now checks when elements or documents are + removed, and unlocks if the target element is being removed. + + Tests: pointer-lock/locked-element-iframe-removed-from-dom.html + pointer-lock/locked-element-removed-from-dom.html + + * dom/Document.cpp: + (WebCore::Document::detach): + * dom/Element.cpp: + (WebCore::Element::removedFrom): + (WebCore::Element::webkitRequestPointerLock): + * page/PointerLockController.cpp: + (WebCore::PointerLockController::requestPointerLock): + (WebCore::PointerLockController::elementRemoved): + (WebCore): + (WebCore::PointerLockController::documentDetached): + (WebCore::PointerLockController::didLosePointerLock): + (WebCore::PointerLockController::enqueueEvent): + * page/PointerLockController.h: + (WebCore): + (PointerLockController): + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + HTMLCollection should use DynamicNodeList's invalidation model + https://bugs.webkit.org/show_bug.cgi?id=90326 + + Reviewed by Anders Carlsson. + + Make HTMLCollection invalidated upon attribute and children changes instead of invalidating it on demand + by comparing DOM tree versions. Node that HTMLCollections owned by Document are invalidated with other + document-rooted node lists in m_listsInvalidatedAtDocument for simplicity although this mechanism is + normally used for node lists owned by a non-Document node that contains nodes outside of its subtree. + ItemProperties and FormControls are more "traditional" users of the mechanism. + + Also, merged DynamicNodeList::invalidateCache and HTMLCollection::invalidateCache. + + * dom/Document.cpp: + (WebCore::Document::registerNodeListCache): Renamed. No longer takes NodeListInvalidationType or + NodeListRootType since they can be obtained from the cache base. Increment the node list counter for + InvalidateOnIdNameAttrChange when a HTMLCollection is passed in since all HTMLCollections need to be + invalidated on id or name content attribute changes due to named getters. + (WebCore::Document::unregisterNodeListCache): Ditto. + (WebCore::shouldInvalidateNodeListForType): + (WebCore::Document::shouldInvalidateNodeListCaches): + (WebCore::Document::clearNodeListCaches): + * dom/Document.h: + (WebCore): Added InvalidateOnIdNameAttrChange, InvalidateOnHRefAttrChange, and InvalidateOnAnyAttrChange. + (Document): + * dom/DynamicNodeList.cpp: + (WebCore::DynamicNodeListCacheBase::invalidateCache): Added. Invalidates caches of both DynamicNodeList + and HTMLCollection. We can't afford to use virtual function calls here because this function is called on + all node lists and HTML collections owned by ancestors of an element under which a node is added, removed, + or its attributes are changed. + (WebCore): + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): Initializes member variables directly + instead of calling clearCache now that DynamicNodeListCacheBase::invalidateCache has become polymorphic. + (DynamicNodeListCacheBase): Increased the number of bits for m_invalidationType since we now have 9 + invalidation types. + (WebCore::DynamicSubtreeNodeList::~DynamicSubtreeNodeList): + (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList): + * dom/ElementRareData.h: + (ElementRareData): + (WebCore::ElementRareData::clearHTMLCollectionCaches): Added. + (WebCore::ElementRareData::adoptTreeScope): Added; similar to NodeRareData::adoptTreeScope. + * dom/Node.cpp: + (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged): Clears HTML collection caches as well as + node list caches. + (WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged): Ditto. + * dom/NodeRareData.h: + (WebCore::NodeListsNodeData::adoptTreeScope): + * dom/TreeScopeAdopter.cpp: + (WebCore::TreeScopeAdopter::moveTreeToNewScope): Calls ElementRareData's adoptTreeScope as well as + NodeRareData's. + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::namedItemWithIndex): + * html/HTMLCollection.cpp: + (WebCore::rootTypeFromCollectionType): Added. As mentioned above, treat all Document-owned HTML collection + as if rooted at document for convenience. + (WebCore::invalidationTypeExcludingIdAndNameAttributes): Added. Since all HTML collection requires + invalidation on id and name content attribute changes, which is taken care by the special logic in + Document::registerNodeListCache, exclude those two attributes from consideration. + (WebCore::HTMLCollection::HTMLCollection): Calls Document::registerNodeListCache. + (WebCore::HTMLCollection::~HTMLCollection): Calls Document::unregisterNodeListCache. + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): + (WebCore::HTMLCollection::namedItem): + (WebCore::HTMLCollection::updateNameCache): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollectionCacheBase): Removed m_cacheTreeVersion and clearCache since they're no longer used. + (HTMLCollection): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::namedItem): + (WebCore::HTMLFormCollection::updateNameCache): + * html/HTMLOptionsCollection.h: + (HTMLOptionsCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::updateNameCache): + * html/HTMLPropertiesCollection.h: + (WebCore::HTMLPropertiesCollection::invalidateCache): + +2012-07-13 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Remove incorrect debug assertion in LayerRendererChromium.cpp + https://bugs.webkit.org/show_bug.cgi?id=91260 + + Reviewed by Adrienne Walker. + + ASSERT(!clipped) was being triggered after skinny almost-degenerate + quads went through anti-aliasing inflation, and then were being + transformed back from device space to local space. It turns out + this assertion is too aggressive, and we don't yet have an obvious + need to change the behavior on the clipped==true case. + + No new tests needed, this patch fixes only comments and debug code. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawRenderPassQuad): + fixed a comment. + + (WebCore::LayerRendererChromium::drawTileQuad): + fixed a similar comment, removed unnecessary assertion. + +2012-07-13 Philip Rogers <pdr@google.com> + + Remove assert in localCoordinateSpaceTransform() + https://bugs.webkit.org/show_bug.cgi?id=91189 + + Reviewed by Nikolas Zimmermann. + + The assert in localCoordinateSpaceTransform was added to catch subclasses forgetting + to override the method but it is better to simply return the identity matrix. + + This scenario can occur when we break the SVG content model, such as asking for + the CTM of a <g> element inside a <tspan>. This is undefined in the spec because + tspan is not a subclass of SVGLocatable but both Firefox and Opera + implement this by returning the identity matrix. + + Test: svg/custom/invalid-ctm.svg + + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::localCoordinateSpaceTransform): + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + [V8] String wrappers should be marked Independent + https://bugs.webkit.org/show_bug.cgi?id=91251 + + Reviewed by Adam Barth. + + Currently V8 String wrappers are not marked Independent. + By marking them Independent, they can be reclaimed by the scavenger GC. + + I tried to find some cases where this change reduces memory usage, + but couldn't due to sensitive behavior of GC. + + No tests. No change in behavior. + + * bindings/v8/V8Binding.cpp: + (WebCore::StringCache::v8ExternalStringSlow): + +2012-07-13 Peter Beverloo <peter@chromium.org> + + [Chromium] Make the v8 i18n API dependency conditional for Android, disable strict aliasing + https://bugs.webkit.org/show_bug.cgi?id=91240 + + Reviewed by Adam Barth. + + Disable the v8 internationalization API for Chromium Android, as it's + disabled and not always available in checkouts. Furthermore, disable + strict aliasing for the webkit_remaining target, similar to what + x11-based builds are doing (see the webcore_prerequisites target). + + * WebCore.gyp/WebCore.gyp: + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + [CallWith=XXX] arguments should be placed at the head of method arguments + https://bugs.webkit.org/show_bug.cgi?id=91217 + + Reviewed by Adam Barth. + + The EFL build with the ENABLE_FILE_SYSTEM flag caused a build error, + because CodeGeneratorJS.pm assumes webkitEntries(ScriptExecutionContext*, HTMLInputElement*) + but the actual signature is webkitEntries(HTMLInputElement*, ScriptExecutionContext*) (bug 91185). + + Per https://trac.webkit.org/wiki/WebKitIDL#CallWith, [CallWith=XXX] arguments should be placed + at the head of the arguments. (i.e. the behavior of CodeGeneratorJS.pm is correct.) + + Thus the correct fix is (1) to change the signature of webkitEntries() and webkitGetAsEntry() + so that ScriptExecutionContext* comes first and (2) to modify CodeGeneratorV8.pm to support the order. + + Test: bindings/scripts/test/TestObj.idl + + * Modules/filesystem/DataTransferItemFileSystem.h: Placed ScriptExecutionContext* at the head of arguments. + (DataTransferItemFileSystem): + * Modules/filesystem/HTMLInputElementFileSystem.cpp: Ditto. + (WebCore::HTMLInputElementFileSystem::webkitEntries): + * Modules/filesystem/HTMLInputElementFileSystem.h: Ditto. + (HTMLInputElementFileSystem): + * Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp: Ditto. + (WebCore::DataTransferItemFileSystem::webkitGetAsEntry): + + * bindings/scripts/CodeGeneratorV8.pm: Modified to support the correct order. + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + (GenerateFunctionCallString): + + * bindings/scripts/test/V8/V8TestInterface.cpp: Updated run-bindings-tests results. + (WebCore::TestInterfaceV8Internal::supplementalMethod2Callback): + +2012-07-13 Mary Wu <mary.wu@torchmobile.com.cn> + + [BlackBerry] Some small changes in network code + https://bugs.webkit.org/show_bug.cgi?id=90974 + + Reviewed by Rob Buis. + + 1. Set status in NetworkJob/SocketStreamHandleBlackBerry so that + its wrapped stream can also query the stream result. + 2. pass download attribute to NetworkRequest. + + RIM PR# 171555 + Reviewed internally by Lyon Chen and Joe Mason. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::handleNotifyClose): + * platform/network/blackberry/NetworkJob.h: + (WebCore::NetworkJob::status): + * platform/network/blackberry/ResourceRequestBlackBerry.cpp: + (WebCore::platformTargetTypeForRequest): + * platform/network/blackberry/SocketStreamHandle.h: + (WebCore::SocketStreamHandle::status): + (SocketStreamHandle): + * platform/network/blackberry/SocketStreamHandleBlackBerry.cpp: + (WebCore::SocketStreamHandle::notifyStatusReceived): + (WebCore::SocketStreamHandle::notifyClose): + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Remove uiSourceCode from Resource. + https://bugs.webkit.org/show_bug.cgi?id=91201 + + Reviewed by Pavel Feldman. + + Removed Resource._uiSourceCode field as it is not used anymore. + + * inspector/front-end/Resource.js: + (WebInspector.Resource.prototype.isHidden): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode): + +2012-07-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122450 and r122580. + http://trac.webkit.org/changeset/122450 + http://trac.webkit.org/changeset/122580 + https://bugs.webkit.org/show_bug.cgi?id=91263 + + Caused multiple regressions on ClusterFuzz (Requested by + inferno-sec on #webkit). + + * bindings/js/ScriptWrappable.h: + (WebCore::ScriptWrappable::reportMemoryUsage): + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::reportMemoryUsage): + * bindings/v8/IntrusiveDOMWrapperMap.h: + (WebCore::ChunkedTable::reportMemoryUsage): + * bindings/v8/ScriptWrappable.h: + (WebCore::ScriptWrappable::reportMemoryUsage): + * bindings/v8/V8Binding.cpp: + (WebCore::V8BindingPerIsolateData::reportMemoryUsage): + (WebCore::StringCache::reportMemoryUsage): + * bindings/v8/V8DOMMap.h: + * css/PropertySetCSSStyleDeclaration.cpp: + (WebCore::InlineCSSStyleDeclaration::ensureMutablePropertySet): + * css/StylePropertySet.cpp: + * css/StylePropertySet.h: + (WebCore::StylePropertySet::reportMemoryUsage): + * dom/CharacterData.cpp: + (WebCore::CharacterData::reportMemoryUsage): + * dom/ContainerNode.h: + (WebCore::ContainerNode::reportMemoryUsage): + * dom/Document.cpp: + (WebCore::Document::reportMemoryUsage): + * dom/Element.cpp: + (WebCore::Element::detachAttribute): + (WebCore::Element::removeAttribute): + (WebCore::Element::attributes): + (WebCore::Element::setAttributeInternal): + (WebCore::Element::parserSetAttributes): + (WebCore::Element::hasEquivalentAttributes): + (WebCore::Element::createAttributeData): + (WebCore): + (WebCore::Element::setAttributeNode): + (WebCore::Element::removeAttributeNode): + (WebCore::Element::getAttributeNode): + (WebCore::Element::getAttributeNodeNS): + (WebCore::Element::hasAttribute): + (WebCore::Element::hasAttributeNS): + (WebCore::Element::normalizeAttributes): + (WebCore::Element::cloneAttributesFromElement): + * dom/Element.h: + (WebCore::Element::attributeData): + (Element): + (WebCore::Element::reportMemoryUsage): + (WebCore::Element::ensureAttributeData): + (WebCore::Element::updatedAttributeData): + (WebCore::Element::ensureUpdatedAttributeData): + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::attrIfExists): + (WebCore::ElementAttributeData::ensureAttr): + (WebCore::ElementAttributeData::setAttr): + (WebCore::ElementAttributeData::removeAttr): + (WebCore::ElementAttributeData::setClass): + (WebCore): + (WebCore::ElementAttributeData::ensureInlineStyle): + (WebCore::ElementAttributeData::ensureMutableInlineStyle): + (WebCore::ElementAttributeData::destroyInlineStyle): + (WebCore::ElementAttributeData::addAttribute): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::isEquivalent): + (WebCore::ElementAttributeData::detachAttrObjectsFromElement): + (WebCore::ElementAttributeData::getAttributeItemIndexSlowCase): + (WebCore::ElementAttributeData::cloneDataFrom): + (WebCore::ElementAttributeData::clearAttributes): + (WebCore::ElementAttributeData::replaceAttribute): + (WebCore::ElementAttributeData::getAttributeNode): + * dom/ElementAttributeData.h: + (WebCore::ElementAttributeData::create): + (ElementAttributeData): + (WebCore::ElementAttributeData::setIdForStyleResolution): + (WebCore::ElementAttributeData::setAttributeStyle): + (WebCore::ElementAttributeData::length): + (WebCore::ElementAttributeData::isEmpty): + (WebCore::ElementAttributeData::attributeItem): + (WebCore::ElementAttributeData::getAttributeItem): + (WebCore::ElementAttributeData::reportMemoryUsage): + (WebCore::ElementAttributeData::ElementAttributeData): + (WebCore::ElementAttributeData::attributeVector): + (WebCore::ElementAttributeData::clonedAttributeVector): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::getAttributeItemIndex): + * dom/MemoryInstrumentation.h: + (MemoryInstrumentation): + (MemoryObjectInfo): + (WebCore::MemoryObjectInfo::reportInstrumentedPointer): + (WebCore::MemoryObjectInfo::reportPointer): + (WebCore::MemoryObjectInfo::reportInstrumentedObject): + (WebCore::MemoryObjectInfo::reportObject): + (WebCore::MemoryObjectInfo::reportObjectInfo): + (WebCore::MemoryObjectInfo::reportHashMap): + (WebCore::MemoryObjectInfo::reportHashSet): + (WebCore::MemoryObjectInfo::reportListHashSet): + (WebCore::MemoryObjectInfo::reportVector): + (WebCore::MemoryObjectInfo::reportString): + (WebCore::MemoryObjectInfo::objectType): + (WebCore::MemoryObjectInfo::objectSize): + (WebCore::MemoryObjectInfo::memoryInstrumentation): + * dom/Node.cpp: + (WebCore::Node::reportMemoryUsage): + * dom/QualifiedName.h: + (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage): + (WebCore::QualifiedName::reportMemoryUsage): + * dom/StyledElement.cpp: + (WebCore::StyledElement::style): + (WebCore::StyledElement::classAttributeChanged): + (WebCore::StyledElement::setInlineStyleProperty): + (WebCore::StyledElement::removeInlineStyleProperty): + (WebCore::StyledElement::addSubresourceAttributeURLs): + * dom/StyledElement.h: + (WebCore::StyledElement::ensureInlineStyle): + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::createHTMLElementFromSavedElement): + * platform/TreeShared.h: + (WebCore::TreeShared::reportMemoryUsage): + * xml/parser/XMLDocumentParserQt.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + +2012-07-13 Huang Dongsung <luxtella@company100.net> + + Remove down-casting to BitmapImage in GraphicsContext::drawImage. + https://bugs.webkit.org/show_bug.cgi?id=90755 + + Reviewed by Simon Fraser. + + Add a BitmapImage draw method which takes RespectImageOrientationEnum enum as + the last argument for CG. Then we can remove the conditional down-casting in + GraphicsContext::drawImage. + + This change is needed for parallel image decoders. Because parallel image + decoders use a Bitmap image wrapper class which extends Image (not Bitmap), the + down-casting above causes the loss of RespectImageOrientationEnum which must be + passed to BitmapImage. + + No new tests, no behavior change. + + * platform/graphics/BitmapImage.cpp: + * platform/graphics/BitmapImage.h: + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::drawImage): + * platform/graphics/Image.cpp: + (WebCore::Image::draw): + (WebCore): + * platform/graphics/Image.h: + (Image): + +2012-07-13 Lauro Neto <lauro.neto@openbossa.org> + + Fix QtWebKit build with OpenGLES after GC3D/E3D refactor + https://bugs.webkit.org/show_bug.cgi?id=91156 + + Reviewed by Noam Rosenthal. + + Adds several build fixes. + + * platform/graphics/GraphicsContext3D.h: + Use E3DOpenGLES instead of previously removed E3DQt. + + * platform/graphics/OpenGLESShims.h: + Enable defines for Qt. + + * platform/graphics/opengl/Extensions3DOpenGLES.cpp: + (WebCore::Extensions3DOpenGLES::blitFramebuffer): + (WebCore): + (WebCore::Extensions3DOpenGLES::renderbufferStorageMultisample): + (WebCore::Extensions3DOpenGLES::copyTextureCHROMIUM): + Added pure virtual stubs. + + (WebCore::Extensions3DOpenGLES::supportsExtension): + Remove PROC suffix. See bug #91130. + + * platform/graphics/opengl/Extensions3DOpenGLES.h: + (Extensions3DOpenGLES): + Added pure virtual stubs. + + * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: + (WebCore::GraphicsContext3D::reshapeFBOs): + Readded missing function after removed in r122250. + + (WebCore): + Use PLATFORM(BLACKBERRY) guard around port-specific include. + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + Added USE(OPENGL_ES_2) guard instead of always loading the OpenGL extensions. + + +2012-07-13 Keishi Hattori <keishi@webkit.org> + + Form of FormAssociatedElement is not updated when id target changes. + https://bugs.webkit.org/show_bug.cgi?id=91042 + + Reviewed by Kent Tamura. + + Test: fast/forms/update-form-attribute-element.html + + This patch introduces the IdTargetObserver and IdTargetObserverRegistry class. + They can be used to be notified when the element that an id is pointing to (the id target) + changes. + + * CMakeLists.txt: Added IdTargetObserverRegistry.{h,cpp} and IdTargetObserver.{h,cpp} + * GNUmakefile.list.am: Ditto. + * Target.pri: Ditto. + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * dom/DOMAllInOne.cpp: + * dom/IdTargetObserver.cpp: Added. When you want notified of changes to an id target, you should create a new class that inherits this. + (WebCore): + (WebCore::IdTargetObserver::IdTargetObserver): + (WebCore::IdTargetObserver::~IdTargetObserver): + * dom/IdTargetObserver.h: Added. + (WebCore): + (IdTargetObserver): + * dom/IdTargetObserverRegistry.cpp: Added. + (WebCore): + (WebCore::IdTargetObserverRegistry::create): + (WebCore::IdTargetObserverRegistry::addObserver): Register an IdTargetObserver to observe an id target. + (WebCore::IdTargetObserverRegistry::removeObserver): Unregisters an IdTargetObserver from observing. + (WebCore::IdTargetObserverRegistry::notifyObserversInternal): + * dom/IdTargetObserverRegistry.h: Added. + (WebCore): + (IdTargetObserverRegistry): + (WebCore::IdTargetObserverRegistry::IdTargetObserverRegistry): + (WebCore::IdTargetObserverRegistry::notifyObservers): Calls idTargetChanged on all observers for an id. Inlining first part of function for performance. + * dom/TreeScope.cpp: + (WebCore::TreeScope::TreeScope): + (WebCore::TreeScope::addElementById): Calls IdTargetObserverRegistry::notifyObservers because the id target might have changed. + (WebCore::TreeScope::removeElementById): Ditto. + * dom/TreeScope.h: + (WebCore): + (WebCore::TreeScope::idTargetObserverRegistry): + (TreeScope): + * html/FormAssociatedElement.cpp: Observer for id targets defined by the form attribute. + (WebCore::FormAssociatedElement::didMoveToNewDocument): + (WebCore::FormAssociatedElement::insertedInto): + (WebCore::FormAssociatedElement::removedFrom): + (WebCore::FormAssociatedElement::formAttributeChanged): + (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver): Creates and sets up a new FormAttributeTargetObserver. + (WebCore): + (WebCore::FormAssociatedElement::formAttributeTargetChanged): + (WebCore::FormAttributeTargetObserver::create): + (WebCore::FormAttributeTargetObserver::FormAttributeTargetObserver): + (WebCore::FormAttributeTargetObserver::idTargetChanged): + * html/FormAssociatedElement.h: + (FormAssociatedElement): + * html/FormController.cpp: + * html/FormController.h: + (FormController): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::removedFrom): + (WebCore::HTMLFormElement::formElementIndexWithFormAttribute): Modified to take a range. It + scans the range and returns the index to insert the element in m_associatedElement. + (WebCore::HTMLFormElement::formElementIndex): Modified to only scan the elements in + m_associatedElement that precede and follow the form element. + * html/HTMLFormElement.h: + (HTMLFormElement): + +2012-07-13 Gabor Rapcsanyi <rgabor@webkit.org> + + Optimizing blend filter to ARM-NEON with intrinsics + https://bugs.webkit.org/show_bug.cgi?id=90949 + + Reviewed by Zoltan Herczeg. + + The feBlend SVG filter modes can be greatly fasten up with ARM-NEON since + we are able to calculate with 2 pixels (8 channels) at the same time. + The code is written with NEON intrinsics and it doesn't affect the + general - it has the same behaviour as the original algorithm. + With this NEON optimization the calculation is ~4.5 times faster for each mode. + + Existing tests cover this issue. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/filters/FEBlend.cpp: + (WebCore::FEBlend::platformApplyGeneric): + (WebCore): + (WebCore::FEBlend::platformApplySoftware): + * platform/graphics/filters/FEBlend.h: + (FEBlend): + * platform/graphics/filters/arm/FEBlendNEON.h: Added. + (WebCore): + (FEBlendUtilitiesNEON): + (WebCore::FEBlendUtilitiesNEON::div255): integer divison with 255 + (WebCore::FEBlendUtilitiesNEON::normal): calculate normal mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::multiply): calculate multiply mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::screen): calculate screen mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::darken): calculate darken mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::lighten): calculate lighten mode blending for two pixels + (WebCore::FEBlend::platformApplyNEON): + +2012-07-13 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: native memory instrumentation: extract instrumentation methods into MemoryClassInfo + https://bugs.webkit.org/show_bug.cgi?id=91227 + + Reviewed by Pavel Feldman. + + void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + MemoryClassInfo<Node> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + info.visitBaseClass<ScriptWrappable>(this); + + info.addMember(m_notInstrumentedPointer); // automatically detects poniter/reference + info.addInstrumentedMember(m_next); + info.addHashSet<MemoryInstrumentation::NonClass>(m_aHash); // NonClass value_type (report only size of internal template structures) + info.addHashSet<MemoryInstrumentation::NotInstrumentedClass>(m_aHashSet); // not instrumented value_type (use sizeof) + info.addHashSet<MemoryInstrumentation::InstrumentedClass>(m_aHashSet); // instrumented value_type (call visit) + } + + The change is covered by existing tests for native memory snapshot. + + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::reportMemoryUsage): + * bindings/v8/IntrusiveDOMWrapperMap.h: + (WebCore::ChunkedTable::reportMemoryUsage): + * bindings/v8/ScriptWrappable.h: + (WebCore::ScriptWrappable::reportMemoryUsage): + * bindings/v8/V8Binding.cpp: + (WebCore::V8BindingPerIsolateData::reportMemoryUsage): + (WebCore::StringCache::reportMemoryUsage): + * bindings/v8/V8DOMMap.h: + * css/StylePropertySet.h: + (WebCore::StylePropertySet::reportMemoryUsage): + * dom/CharacterData.cpp: + (WebCore::CharacterData::reportMemoryUsage): + * dom/ContainerNode.h: + (WebCore::ContainerNode::reportMemoryUsage): + * dom/Document.cpp: + (WebCore::Document::reportMemoryUsage): + * dom/Element.h: + (WebCore::Element::reportMemoryUsage): + * dom/ElementAttributeData.h: + (WebCore::ElementAttributeData::reportMemoryUsage): + * dom/MemoryInstrumentation.h: + (MemoryInstrumentation): + (WebCore::MemoryObjectInfo::objectType): + (WebCore::MemoryObjectInfo::objectSize): + (WebCore::MemoryObjectInfo::memoryInstrumentation): + (MemoryObjectInfo): + (WebCore::MemoryObjectInfo::reportObjectInfo): + (WebCore): + (MemoryClassInfo): + (WebCore::MemoryClassInfo::MemoryClassInfo): + (WebCore::MemoryClassInfo::visitBaseClass): + (WebCore::MemoryClassInfo::reportInstrumentedPointer): + (WebCore::MemoryClassInfo::reportInstrumentedObject): + (WebCore::MemoryClassInfo::reportPointer): + (WebCore::MemoryClassInfo::reportObject): + (WebCore::MemoryClassInfo::reportHashMap): + (WebCore::MemoryClassInfo::reportHashSet): + (WebCore::MemoryClassInfo::reportListHashSet): + (WebCore::MemoryClassInfo::reportVector): + (WebCore::MemoryClassInfo::reportString): + * dom/Node.cpp: + (WebCore::Node::reportMemoryUsage): + * dom/QualifiedName.h: + (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage): + (WebCore::QualifiedName::reportMemoryUsage): + * platform/TreeShared.h: + (WebCore::TreeShared::reportMemoryUsage): + +2012-07-13 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: align scope filters + https://bugs.webkit.org/show_bug.cgi?id=91213 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/elementsPanel.css: + (.crumbs): + * inspector/front-end/inspector.css: + (.status-bar > div): + (.scope-bar): + (.scope-bar li): + (.scope-bar li.all): + * inspector/front-end/networkLogView.css: + +2012-07-13 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: too many hardcoded strings in InspectorBackendDispatcher. + https://bugs.webkit.org/show_bug.cgi?id=89198 + + Reviewed by Yury Semikhatsky. + + Instead of generating error message string on every call (mostly for nothing), + error message is generated deeper inside the handler and only command name + is passed every time. + + * inspector/CodeGeneratorInspector.py: + (Generator.process_command): + +2012-07-13 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:* pages + https://bugs.webkit.org/show_bug.cgi?id=91121 + + Reviewed by Yong Li. + + Update the about:config pages, and improve the aesthetics of the about:build, about:version, about:credits, about:memory, about:config, and similar pages. + + No new tests, because there is no new funtionality. + + * platform/network/blackberry/NetworkJob.cpp: Update the aesthetics of about:* pages + +2012-07-13 Olivier Blin <olivier.blin@softathome.com> + + Fix checking for optional DeviceOrientationEvent.absolute in JSC bindings + https://bugs.webkit.org/show_bug.cgi?id=91225 + + Reviewed by Steve Block. + + This issue comes from r105036 + + * bindings/js/JSDeviceOrientationEventCustom.cpp: + (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent): + +2012-07-13 Andrei Bucur <abucur@adobe.com> + [CSS Regions] Fix build for bug 89000 + https://bugs.webkit.org/show_bug.cgi?id=91215 + + Reviewed by Kentaro Hara. + + Remove the unused variable m_state that was a leftover from a previous version of the patch. + + Tests: No new tests, build fix. + + * dom/WebKitNamedFlow.cpp: + (WebCore::WebKitNamedFlow::WebKitNamedFlow): + * dom/WebKitNamedFlow.h: + (WebKitNamedFlow): + +2012-07-13 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] Fix bugs in HarfBuzzShaper + https://bugs.webkit.org/show_bug.cgi?id=90951 + + Reviewed by Tony Chang. + + The current implementation has following problems: + - Cannot render RTL text if the TextRun is divided into more than two + HarfBuzzRun. + - Script handling in TextRun partitioning is incorrect. + - Inaccurate calculation of selection rect. + - Wrong rendering position when the first glyph of the TextRun have + non-zero offsets in terms of HarfBuzz. + + To fix these problems I rewrote HarfBuzzShaper class. Here is the summary: + - Divide the whole range of TextRun first, then shape them in visual + order. + - Divide TextRun in the same way of old-harfbuzz's + hb_utf16_script_run_next(). + - Prefer float than int when calculating selection. + - Adjust the drawing point after shaping. + + Added tests covers the fix except for the last problem. The last problem will be covered + by fast/text/international/complex-joining-using-gpos.html after chromium linux port switches + to use HarfBuzzShaper. + + Tests: fast/text/shaping/shaping-script-order.html + fast/text/shaping/shaping-selection-rect.html + + * platform/graphics/harfbuzz/FontHarfBuzz.cpp: + (WebCore::Font::drawComplexText): Adjusts point after shaping. + * platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp: + (WebCore::HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun): + (WebCore): + (WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Added. + (WebCore::HarfBuzzShaper::HarfBuzzRun::setGlyphAndAdvance): Offsets are no longer needed. + (WebCore::HarfBuzzShaper::HarfBuzzRun::xPositionForOffset): Calculates character offset based on advance. + (WebCore::normalizeCharacters): Added. + (WebCore::HarfBuzzShaper::HarfBuzzShaper): + (WebCore::HarfBuzzShaper::~HarfBuzzShaper): + (WebCore::HarfBuzzShaper::shape): Divides TextRun first, then shapes them. + (WebCore::HarfBuzzShaper::adjustStartPoint): Added. + (WebCore::HarfBuzzShaper::collectHarfBuzzRuns): Added. + (WebCore::HarfBuzzShaper::shapeHarfBuzzRuns): Added. + (WebCore::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun): Followed other changes. + (WebCore::HarfBuzzShaper::selectionRect): Use float for calculating selection. + * platform/graphics/harfbuzz/ng/HarfBuzzShaper.h: + (HarfBuzzShaper): Holds the start index of character. Removed unnecessary variables. + (WebCore::HarfBuzzShaper::HarfBuzzRun::create): Ditto. + (HarfBuzzRun): + (WebCore::HarfBuzzShaper::HarfBuzzRun::fontData): Added. + (WebCore::HarfBuzzShaper::HarfBuzzRun::startIndex): Ditto. + (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Ditto. + (WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto. + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r122545. + http://trac.webkit.org/changeset/122545 + https://bugs.webkit.org/show_bug.cgi?id=91185 + + We found that this was a wrong fix + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r122553. + http://trac.webkit.org/changeset/122553 + https://bugs.webkit.org/show_bug.cgi?id=91198 + + We found that this was a wrong fix + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Change the timing of form state restore + https://bugs.webkit.org/show_bug.cgi?id=89962 + + Reviewed by Hajime Morita. + + For a preparation to fix a form identification problem (Bug 91209), + restore controls states when the parsing of their owner forms is + completed. For controls without owners, their states are restored when + their parsing is completed as ever. + + No new tests. This doesn't change observable behavior. + + * html/FormController.cpp: + (WebCore::ownerFormForState): + Added. This code was used in formKey(), and restoreControlState*() use it. + (WebCore::FormKeyGenerator::formKey): Use ownerFormForState(). No behavior change. + (WebCore::FormController::restoreControlStateFor): + Moved some code from HTMLFormControlElementWithState::finishParsingChildren(). + The difference is we don't resotre state if this control is owned by a form. + (WebCore::FormController::restoreControlStateIn): + Restore states of associated controls. This is called from + finishParsingChildren() for <form>. + * html/FormController.h: + (FormController): + - Declare restoreControlStateFor() and restoreControlStateIn(). + - Make takeStateForFormElement() private. + + * html/FormAssociatedElement.cpp: + (WebCore::FormAssociatedElement::isFormControlElementWithState): + Added. The default implementation returns false. + * html/FormAssociatedElement.h: + (FormAssociatedElement): + Added isFormControlElementWithState() for FormController::restoreControlStateIn(). + * html/HTMLFormControlElementWithState.cpp: + (WebCore::HTMLFormControlElementWithState::finishParsingChildren): + Some code was moved to FormController:restoreControlStateFor(). + (WebCore::HTMLFormControlElementWithState::isFormControlElementWithState): + Added. Returns true. + * html/HTMLFormControlElementWithState.h: + (HTMLFormControlElementWithState): Declare isFormControlElementWithState(). + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::finishParsingChildren): + Added. Calls FormController::restoreControlStateIn(). + * html/HTMLFormElement.h: + (HTMLFormElement): Declare finishParsingChildren(). + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Make calendar pickers testable + https://bugs.webkit.org/show_bug.cgi?id=84827 + + Reviewed by Hajime Morita. + + WebCore: + - Add PagePopupDriver, an interface to open/close a PagePopup. + - Add setPagePopupDriver() to ChromeClient in order to inject a + PagePopupDriver for testing. + + Internals: + Add MockPagePopupDriver, which creates a MockPagePopup, which creates a + normal <iframe> in the top-level document, and load the popup content on + it. MockPagePopupDriver is enabled by + internals.settings.setEnableMockPagePopup(true). + + Test: fast/forms/date/calendar-picker-appearance.html + + * WebCore.gypi: Add new files. + * WebCore.xcodeproj/project.pbxproj: Add files to make this buildable. + * page/ChromeClient.h: + (ChromeClient): Add function for PagePopupDriver. + * loader/EmptyClients.h: Add empty implementations for PagePopupDriver functions. + * page/PagePopupDriver.h: Added. + (PagePopupDriver): + (WebCore::PagePopupDriver::~PagePopupDriver): + + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::restoreTo): Reset the mock PagePopupDriver. + (WebCore::InternalSettings::setEnableMockPagePopup): + Register MockPagePopupDriver to ChromeClient. + * testing/InternalSettings.h: + (InternalSettings): Declare setEnableMockPagePopup(). + * testing/InternalSettings.idl: ditto. + * testing/MockPagePopupDriver.cpp: Added. + (MockPagePopup): Pseudo PagePopup implementation with the standard <iframe>. + (WebCore::MockPagePopupDriver::MockPagePopupDriver): Added. + (WebCore::MockPagePopupDriver::create): Added. + (WebCore::MockPagePopupDriver::~MockPagePopupDriver): Added. + (WebCore::MockPagePopupDriver::openPagePopup): + Added. An override of PagePopupDriver function. This creates a MockPagePopup. + (WebCore::MockPagePopupDriver::closePagePopup): + Added. An override of PagePopupDriver function. This deletes the MockPagePopup. + * testing/MockPagePopupDriver.h: + (MockPagePopupDriver): Added. + + * testing/v8/WebCoreTestSupport.cpp: + (WebCoreTestSupport::injectPagePopupController): + Added. Production code uses per-Page context feature framework. However + MockPagePopup uses the same page as the host page. So we can't use the + framework and need to inject window.pagePopupController manually. + * testing/v8/WebCoreTestSupport.h: + (WebCoreTestSupport): Add injectPagePopupController(). + +2012-07-12 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: mute the native looks of the selects in the console. + https://bugs.webkit.org/show_bug.cgi?id=91120 + + Reviewed by Vsevolod Vlasov. + + This is necessary for Mac now that we don't use border images for select. + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.get statusBarItems): + (WebInspector.ConsoleView.prototype.addContext): + (WebInspector.ConsoleView.prototype.removeContext): + (WebInspector.ConsoleView.prototype._updateIsolatedWorldSelector): + (WebInspector.ConsoleView.prototype._appendIsolatedContextOption): + (WebInspector.ConsoleView.prototype._currentEvaluationContext): + (WebInspector.ConsoleView.prototype._currentIsolatedContextId): + * inspector/front-end/StatusBarButton.js: + (WebInspector.StatusBarComboBox): + (WebInspector.StatusBarComboBox.prototype.addOption): + (WebInspector.StatusBarComboBox.prototype.removeOption): + (WebInspector.StatusBarComboBox.prototype.removeOptions): + (WebInspector.StatusBarComboBox.prototype.selectedOption): + * inspector/front-end/inspector.css: + (.status-bar-select-container): + (select.status-bar-item): + (.console-context): + +2012-07-13 Andrei Bucur <abucur@adobe.com> + + [CSS Regions] Fix the lifecycle for the flow objects and their renderers + https://bugs.webkit.org/show_bug.cgi?id=89000 + + Reviewed by Eric Seidel. + + This patch adds the concept of a NamedFlowCollection, owned by the document, that keeps track of + all the named flows that exist in the Document. This collection contains a ListHashSet of weak references to + all the existing NamedFlows in the document. This is not a managed set because the CREATED flows are referenced from the renderer and + the NULL flows are only cached, they should be destructible. + Two named flows are considered to be equal if they have the same name. + I've changed the NamedFlow state to depend on the existence of its renderer. A flow thread that has a renderer will also have a NamedFlow object. + A flow thread without a renderer can have a NamedFlow object, but only in the NULL state. It's possible for a NamedFlow object to jump from the + NULL state to the CREATED state if it was not destroyed (e.g. it was referenced from JS). Keeping track of the NULL state flows that have listeners will be important + so when they go back to the CREATED state, the listeners would still be there. + + Link to spec: http://www.w3.org/TR/2012/WD-css3-regions-20120503/ + + Tests: The old tests have been modified to take into account the new behavior + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/DOMAllInOne.cpp: + * dom/Document.cpp: + (WebCore::Document::~Document): + (WebCore): + (WebCore::Document::webkitGetFlowByName): + (WebCore::Document::namedFlows): + * dom/Document.h: + (WebCore): + (Document): + * dom/WebKitNamedFlow.cpp: + (WebCore::WebKitNamedFlow::WebKitNamedFlow): + (WebCore::WebKitNamedFlow::~WebKitNamedFlow): + (WebCore::WebKitNamedFlow::create): + (WebCore): + (WebCore::WebKitNamedFlow::name): + (WebCore::WebKitNamedFlow::overset): + (WebCore::nodeInFlowThread): + (WebCore::WebKitNamedFlow::getRegionsByContentNode): + (WebCore::WebKitNamedFlow::getContent): + (WebCore::WebKitNamedFlow::setRenderer): + * dom/WebKitNamedFlow.h: + (WebCore): + (WebKitNamedFlow): + (WebCore::WebKitNamedFlow::getFlowState): + (WebCore::WebKitNamedFlow::switchFlowState): + * dom/WebKitNamedFlowCollection.cpp: Added. + (WebCore): + (WebCore::WebKitNamedFlowCollection::WebKitNamedFlowCollection): + (WebCore::WebKitNamedFlowCollection::length): An O(1) operation + (WebCore::WebKitNamedFlowCollection::item): An O(N) operation + (WebCore::WebKitNamedFlowCollection::flowByName): An O(1) operation + (WebCore::WebKitNamedFlowCollection::ensureNamedFlowInCreatedState): An O(1) operation + (WebCore::WebKitNamedFlowCollection::moveNamedFlowToNullState): An O(1) operation + (WebCore::WebKitNamedFlowCollection::discardNamedFlow): An O(1) operation + (WebCore::WebKitNamedFlowCollection::documentDestroyed): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::hash): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::equal): + (WebKitNamedFlowCollection::NamedFlowHashFunctions): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::hash): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::equal): + * dom/WebKitNamedFlowCollection.h: Copied from Source/WebCore/dom/WebKitNamedFlow.h. + (WebCore): + (WebKitNamedFlowCollection): + (WebCore::WebKitNamedFlowCollection::create): + (WebCore::WebKitNamedFlowCollection::document): + * rendering/FlowThreadController.cpp: + (WebCore::FlowThreadController::ensureRenderFlowThreadWithName): + (WebCore::FlowThreadController::removeFlowThread): + (WebCore): + * rendering/FlowThreadController.h: + (FlowThreadController): + * rendering/RenderNamedFlowThread.cpp: + (WebCore::RenderNamedFlowThread::RenderNamedFlowThread): + (WebCore): + (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread): + (WebCore::RenderNamedFlowThread::removeRegionFromThread): + (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentNode): + (WebCore::RenderNamedFlowThread::flowThreadName): + (WebCore::RenderNamedFlowThread::willBeDestroyed): + * rendering/RenderNamedFlowThread.h: + (RenderNamedFlowThread): + (WebCore::RenderNamedFlowThread::contentNodes): + (WebCore::RenderNamedFlowThread::canBeDestroyed): + +2012-07-13 Vineet Chaudhary <rgf748@motorola.com> + + [V8Bindings] Implement generalised method to validates that the passed object is a sequence type. + https://bugs.webkit.org/show_bug.cgi?id=91056 + + Reviewed by Kentaro Hara. + + Currently the V8 implementation validates that the passed object is a sequence type only + for MessagePort in V8Utilities::extractTransferables(). + There should be generalised method for other types too. + Spec URL: http://www.w3.org/TR/2012/WD-WebIDL-20120207/#es-sequence + + No new test, Just refactoring. There should be no behavioral changes. + + * bindings/v8/V8Binding.h: + (WebCore::toV8Sequence): Added implementation of toV8Sequence(). + +2012-07-13 Zeno Albisser <zeno@webkit.org> + + [Qt][WK2] Implement GraphicsSurface for Linux/GLX. + https://bugs.webkit.org/show_bug.cgi?id=90881 + + Add a GLX based GraphicsSurface implementation for Linux. + Native X windows are being used for exchanging textures + with the UIProcess. + + Reviewed by Noam Rosenthal. + + * Target.pri: + * WebCore.pri: + * platform/graphics/surfaces/GraphicsSurface.cpp: + (WebCore::GraphicsSurface::create): + Move creating GraphicsSurface instance into + platformCreate/platformImport functions to allow + platform specific creation based on the provided flags. + (WebCore::GraphicsSurface::GraphicsSurface): + (WebCore::GraphicsSurface::~GraphicsSurface): + Call platformDestroy when destroying a GraphicsSurface. + (WebCore): + * platform/graphics/surfaces/GraphicsSurface.h: + Make platformCreate/platformImport functions static + to be able to call these from the static create function. + Add Destructor prototype and add GraphicsSurfacePrivate member. + (WebCore): + (GraphicsSurface): + * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp: + (WebCore): + (WebCore::GraphicsSurface::platformCreate): + (WebCore::GraphicsSurface::platformImport): + Insert creation of GraphicsSurface instance. + This allows having a platform specific creation mechanism + for GLX. + * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp: Added. + (WebCore): + (OffScreenRootWindow): + (WebCore::OffScreenRootWindow::OffScreenRootWindow): + (WebCore::OffScreenRootWindow::get): + (WebCore::OffScreenRootWindow::~OffScreenRootWindow): + Add an OffScreenRootWindow singelton that is being used + as a parent for all native offscreen windows. + (GraphicsSurfacePrivate): + This class is used to manage all the X related resources + such as opening a display or creating XPixmaps etc. + (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate): + Open a connection to the X server and create a + QOpenGLContext that can be used to resolve GL functions. + (WebCore::GraphicsSurfacePrivate::~GraphicsSurfacePrivate): + Properly cleanup and release all the X resources again. + (WebCore::GraphicsSurfacePrivate::createSurface): + Create a surface that is placed off screen and can be + used as a rendering target by the WebProcess. + (WebCore::GraphicsSurfacePrivate::createPixmap): + Create a GLXPixmap from the XWindow that was previously + redirected by the WebProcess. This GLXPixmap can then be + bound to a texture and being painted on screen by the + UIProcess. + (WebCore::GraphicsSurfacePrivate::makeCurrent): + (WebCore::GraphicsSurfacePrivate::swapBuffers): + (WebCore::GraphicsSurfacePrivate::display): + (WebCore::GraphicsSurfacePrivate::glxPixmap): + (WebCore::GraphicsSurfacePrivate::size): + (WebCore::GraphicsSurfacePrivate::glContext): + (WebCore::resolveGLMethods): + Initialize all the function pointers for the GL functions used. + (WebCore::GraphicsSurface::platformExport): + (WebCore::GraphicsSurface::platformGetTextureID): + Bind the GLXPixmap to a texture. + (WebCore::GraphicsSurface::platformCopyToGLTexture): + Not beeing implemented for GLX. + (WebCore::GraphicsSurface::platformCopyFromFramebuffer): + Blit origin fbo onto the GraphicsSurface's backing. + (WebCore::GraphicsSurface::platformCreate): + (WebCore::GraphicsSurface::platformImport): + (WebCore::GraphicsSurface::platformLock): + (WebCore::GraphicsSurface::platformUnlock): + (WebCore::GraphicsSurface::platformDestroy): + +2012-07-13 Dongwoo Im <dw.im@samsung.com> + + CodeGeneratorJS.pm : SetterExpression should use 'push' rather than 'unshift' + https://bugs.webkit.org/show_bug.cgi?id=91198 + + Reviewed by Kentaro Hara. + + 'SetterExpression' should use 'push' to make arguments, rather than 'unshift'. + + No new tests. Covered by existing tests. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-13 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for input type "number" when step mismatched + https://bugs.webkit.org/show_bug.cgi?id=91197 + + Reviewed by Kent Tamura. + + This patch fixes implementation of Decimal::ceiling() and floor(). + They return wrong value for small fractional numbers. + + The bug is occurred when: + - Step-able input type, e.g. number, date, datetime, and so on. + - Current value is step mismatched + - Current value is smaller than step + - Step up/down by spin button + because spin button up/down actions are implemented in InputType::setpUpFromRenderer + which calls Decimal::ceiling() and floor() for step mismatched case. + + Tests: fast/forms/number/number-stepup-stepdown-from-renderer.html: Added test cases + WebKit/chromium/tests/DecimalTest.cpp: Added test cases + + * platform/Decimal.cpp: + (WebCore::Decimal::ceiling): Changed to return 1 for positive small fractional number. + (WebCore::Decimal::floor): Changed to return -1 for negative small fractional number. + +2012-07-13 Dominic Mazzoni <dmazzoni@google.com> + + Should be possible to focus elements within canvas fallback content + https://bugs.webkit.org/show_bug.cgi?id=87898 + + Reviewed by Chris Fleizach. + + Patches isFocusable in dom/Node.cpp and html/HTMLFormControlElement.cpp + to make elements focusable if they're a descendent of a canvas element + if they would otherwise have been focusable but just didn't have + a renderer. Adds a bit to ElementRareData to efficiently keep track + of elements in a canvas subtree. + + Test: fast/canvas/fallback-content.html + + * dom/Element.cpp: + (WebCore::Element::attach): + (WebCore::Element::detach): + (WebCore::Element::setIsInCanvasSubtree): + (WebCore): + (WebCore::Element::isInCanvasSubtree): + * dom/Element.h: + (Element): + * dom/ElementRareData.h: + (ElementRareData): + (WebCore::ElementRareData::ElementRareData): + * dom/Node.cpp: + (WebCore::Node::isFocusable): + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::attach): + (WebCore): + * html/HTMLCanvasElement.h: + (HTMLCanvasElement): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::isFocusable): + +2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add API to get HTTPS status to WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=91100 + + Reviewed by Martin Robinson. + + * platform/network/soup/ResourceResponse.h: + (WebCore::ResourceResponse::soupMessageCertificate): Return the + certificate. + (WebCore::ResourceResponse::setSoupMessageCertificate): Set a + certificate. + (WebCore::ResourceResponse::soupMessageTLSErrors): Return the TLS + errors. + (WebCore::ResourceResponse::setSoupMessageTLSErrors): Set TLS + errors. + * platform/network/soup/ResourceResponseSoup.cpp: + (WebCore::ResourceResponse::toSoupMessage): Set the certificate + and TLS errors to the newly created SoupMessage. + (WebCore::ResourceResponse::updateFromSoupMessage): Get the + certificate and TLS errors from the SoupMessage. + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + RadioNodeList is not updated upon input type change + https://bugs.webkit.org/show_bug.cgi?id=91178 + + Reviewed by Alexey Proskuryakov. + + Invalidate the radio node lists when type content attribute changes since it excludes + image type input elements. + + Test: fast/forms/radionodelist-image-type.html + + * dom/Document.cpp: + (WebCore::shouldInvalidateNodeListForType): + * dom/Document.h: Renamed InvalidateOnIdNameForAttrChange to InvalidateOnFormAttrChange + since listing all attribute name isn't useful at this point. + * html/RadioNodeList.cpp: + (WebCore::RadioNodeList::RadioNodeList): + +2012-07-12 Dongwoo Im <dw.im@samsung.com> + + CodeGeneratorJS.pm need to handle the attribute which has "CallWith=ScriptExecutionContext" option. + https://bugs.webkit.org/show_bug.cgi?id=91185 + + Reviewed by Kentaro Hara. + + When an attribute has "CallWith=ScriptExecutionContext" option, 'ScriptExecutionContext*' parameter should be the last parameter. + + No new tests. Covered by existing tests. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-12 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r117738): [Forms] stepMismatch for input type "time" with large step value always return false. + https://bugs.webkit.org/show_bug.cgi?id=91062 + + Reviewed by Kent Tamura. + + This patch changes value of StepRange::acceptableError to zero for + integer restricted step value. + + No new tests, existing test covers (fast/forms/time/ValidityState-stepMismatch-time.html) this change although they are listed in TestExpectation file. + + * html/StepRange.cpp: + (WebCore::StepRange::acceptableError): Changed to return 0 if step value is restricted to be an integer. + +2012-07-12 Dan Bernstein <mitz@apple.com> + + Pass an option flag to CFStringGetHyphenationLocationBeforeIndex() that tells it to not + terminate the search at the last word boundary before the given index. + + Reviewed by Adele Peterson. + + No test, because the current version of Core Foundation ignores the options parameter. + + * platform/text/cf/HyphenationCF.cpp: + (WebCore::lastHyphenLocation): Changed the options parameter from 0 to 1. + +2012-07-12 Eric Seidel <eric@webkit.org> + + Incorrect behaviour calling Range setStart or setEnd with boundary in different document + https://bugs.webkit.org/show_bug.cgi?id=42517 + + Reviewed by Ojan Vafai. + + Added a new static inline "checkForDifferentRootContainer" to share some code + and made setStart/setEnd do the right thing in the x-document case. I removed + the bogus checks in set*After/set*Before functions, and since they just call + through to setStart/setEnd, they also now do the right thing. + + Test: fast/dom/Range/set-wrong-document-err.html + + * dom/Range.cpp: + (WebCore::checkForDifferentRootContainer): + (WebCore): + (WebCore::Range::setStart): + (WebCore::Range::setEnd): + (WebCore::Range::setStartAfter): + (WebCore::Range::setEndBefore): + (WebCore::Range::setEndAfter): + (WebCore::Range::setStartBefore): + +2012-07-12 Erik Arvidsson <arv@chromium.org> + + [V8] Simplify CodeGeneratorV8 since V8OnProto is only true for DOMWindow + https://bugs.webkit.org/show_bug.cgi?id=91165 + + Reviewed by Nate Chapin. + + The old code was dead code since V8OnProto only ever gets set to 1 for DOMWindow. + + No new tests. No change in functionality. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrSetter): + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Build fix. Initialize unused const member variables to make compilers happy. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): + +2012-07-12 Konrad Piascik <kpiascik@rim.com> + + Web Inspector: Geolocation override + https://bugs.webkit.org/show_bug.cgi?id=89365 + + Reviewed by Pavel Feldman. + + Reverted original patch. + Change has not been reviewed by the right people. It declares + public protocol methods and is wrong in several ways. + + * Modules/geolocation/GeolocationController.cpp: + (WebCore::GeolocationController::GeolocationController): + (WebCore::GeolocationController::positionChanged): + * Modules/geolocation/GeolocationController.h: + (GeolocationController): + * inspector/Inspector.json: + * inspector/InspectorInstrumentation.cpp: + (WebCore): + * inspector/InspectorInstrumentation.h: + (WebCore): + (InspectorInstrumentation): + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::InspectorPageAgent): + * inspector/InspectorPageAgent.h: + * inspector/front-end/Settings.js: + * inspector/front-end/SettingsScreen.js: + (WebInspector.UserAgentSettingsTab): + (WebInspector.UserAgentSettingsTab.prototype._createDeviceMetricsElement): + * inspector/front-end/UserAgentSupport.js: + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Move m_type and m_hasNameCache from HTMLCollectionCacheBase to DynamicNodeListCacheBase for better bit packing + https://bugs.webkit.org/show_bug.cgi?id=91164 + + Reviewed by Anders Carlsson. + + Moved m_type and m_hasNameCache from HTMLCollection and renamed them to m_collectionType and m_isNameCacheValid. + + Also renamed shouldIncludeChildren to shouldOnlyIncludeDirectChildren and negated the return value since + all HTMLCollection include children in the collection and the function was meant to tell us whether the collection + should include descendents that are not direct children of base(). + + In addition, renamed nextNodeOrSibling to nextNode since "or sibling" doesn't seem to add any semantic clarity. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): + (DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::type): + (WebCore::DynamicNodeListCacheBase::hasNameCache): + (WebCore::DynamicNodeListCacheBase::setHasNameCache): + (WebCore::DynamicNodeListCacheBase::clearCache): + * html/HTMLCollection.cpp: + (WebCore::shouldOnlyIncludeDirectChildren): + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::isAcceptableElement): + (WebCore::nextNode): + (WebCore::HTMLCollection::itemAfter): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollectionCacheBase): + (WebCore::HTMLCollectionCacheBase::clearCache): + +2012-07-12 Shinya Kawanaka <shinyak@chromium.org> + + Needs callback before AuthorShadowRoot is added. + https://bugs.webkit.org/show_bug.cgi?id=91167 + + Reviewed by Hajime Morita. + + This is a preliminary patch for adding multiple Shadow DOM support for media elements and form elements. + They assume that UserAgentShadowRoot is the oldest, however currently a page author may try to add + AuthorShadowRoot before adding UserAgentShadowRoot. + + This patch adds a callback before AuthorShadowRoot is being added, and allow us to add UserAgentShadowRoot + for those elements. See also Bug 77936, Bug 77937, Bug 90532. + + * dom/Element.h: + (WebCore::Element::willAddAuthorShadowRoot): + * dom/ElementShadow.cpp: + (WebCore::ElementShadow::addShadowRoot): + * dom/ElementShadow.h: + (ElementShadow): + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::create): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] Remove the RenderPass pointer from RenderPassDrawQuad + https://bugs.webkit.org/show_bug.cgi?id=91023 + + Reviewed by Adrienne Walker. + + Removes the RenderPass pointer and keeps only an integer id in the + quad to refer back to the RenderPass the quad reads from. + + Covered by existing tests. + + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::findRenderPassById): + (WebCore): + (WebCore::removeRenderPassesRecursive): + (WebCore::CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass): + (WebCore::CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass): + (WebCore::CCLayerTreeHostImpl::removeRenderPasses): + (WebCore::CCLayerTreeHostImpl::prepareToDraw): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (FrameData): + (CullRenderPassesWithCachedTextures): + (CullRenderPassesWithNoQuads): + (CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + * platform/graphics/chromium/cc/CCRenderPass.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + +2012-07-12 Elliott Sprehn <esprehn@gmail.com> + + Unneeded tree walking when adding or removing children due to RenderCounter / RenderQuote logic + https://bugs.webkit.org/show_bug.cgi?id=89900 + + Reviewed by Eric Seidel and Abhishek Arya. + + Previously we would walk the all children a renderer whenever adding + or removing a child renderer from its RenderObjectChildList to look for + RenderQuote and RenderCounter instances to update. This patch introduces + a counter in RenderView for the number of RenderQuote and RenderCounter + instances in that document so we can avoid these traversals. + + No tests needed since this is just a short circuiting of logic and the existing + tests should cover it. + + * rendering/RenderCounter.cpp: + (WebCore::RenderCounter::RenderCounter): Increment instance counter. + (WebCore::RenderCounter::willBeDestroyed): Decrement instance counter. + (WebCore): + (WebCore::RenderCounter::rendererRemovedFromTree): Short circuit when counter is zero. + (WebCore::RenderCounter::rendererSubtreeAttached): Short circuit when counter is zero. + * rendering/RenderCounter.h: + (RenderCounter): + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::removeChildNode): Short circuit calling into Counter and Quote code when the document is being destroyed. + * rendering/RenderQuote.cpp: + (WebCore::RenderQuote::RenderQuote): + (WebCore::RenderQuote::willBeDestroyed): + (WebCore): + (WebCore::RenderQuote::rendererSubtreeAttached): Increment instance counter. + (WebCore::RenderQuote::rendererRemovedFromTree): Decrement instance counter. + * rendering/RenderQuote.h: + (RenderQuote): + * rendering/RenderView.cpp: + (WebCore::RenderView::RenderView): + * rendering/RenderView.h: Methods for managing the RenderQuote and RenderCounter counts. + (RenderView): + (WebCore::RenderView::addRenderQuote): + (WebCore::RenderView::removeRenderQuote): + (WebCore::RenderView::hasRenderQuotes): + (WebCore::RenderView::addRenderCounter): + (WebCore::RenderView::removeRenderCounter): + (WebCore::RenderView::hasRenderCounters): + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Merge HTMLCollectionWithArrayStorage into HTMLCollection + https://bugs.webkit.org/show_bug.cgi?id=91144 + + Reviewed by Anders Carlsson. + + Merged HTMLCollectionWithArrayStorage::item into HTMLCollection::item and got rid of + HTMLCollectionWithArrayStorage. Also de-virtualized HTMLCollection::item and HTMLCollection::length + and merged itemInArrayAfter and itemAfter. + + In addition, improved the algorithm in HTMLCollection::length to take advantage of item cache. + Instead of always computing the length from the beginning, we start the search from the cached item + so that if we're near end of the collection, we avoid significant portion of the node traversal. + + Furthermore, made HTMLCollection always call setItemCache with a non-null item and HTMLCollection::item + set the length cache when it reaches the end of the collection to avoid redundant length calculations. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::setItemCache): Add a FIXME. + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::itemAfter): Regular HTMLCollection doesn't have uses elements array so + assert that offsetInArray is always 0. + (WebCore): Removed calcLength. + (WebCore::HTMLCollection::length): Rewritten. The algorithm is as follows: + When there is no item cache, we look for the first item by calling item(0). If item(0) returns null, + then it must have set the length cache so bail out. If the previous step didn't bail out, then + the item cache is valid and not null (see above), so count the number of remaining items in collection + starting at the cached item's offset + 1. + (WebCore::HTMLCollection::item): Avoid calling setItemCache with null. When the first item is null, + set the length cache instead. + (WebCore::HTMLCollection::itemAfterCachedItem): Extracted from HTMLCollectionWithArrayStorage::item. + (WebCore::HTMLCollection::namedItem): Pass in arrayOffset to itemAfter. Note this variable is never + used since only HTMLFormCollection and HTMLPropertiesCollection use array offsets but they override + this function. + (WebCore::HTMLCollection::updateNameCache): Ditto. + * html/HTMLCollection.h: + (HTMLCollection): + (WebCore): + * html/HTMLFormCollection.cpp: Removed calcLength(). Even though this function didn't iterate over + the collection directly, HTMLFormElement::length and HTMLFieldSetElement::length did so we're not + regressing any performance here. + (WebCore::HTMLFormCollection::HTMLFormCollection): + (WebCore::HTMLFormCollection::itemAfter): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::itemAfter): + * html/HTMLNameCollection.h: + (HTMLNameCollection): + * html/HTMLPropertiesCollection.cpp: Removed calcLength(). + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + (WebCore::HTMLPropertiesCollection::itemAfter): + (WebCore): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::itemAfter): + * html/HTMLTableRowsCollection.h: + (HTMLTableRowsCollection): + +2012-07-12 Pravin D <pravind.2k4@gmail.com> + + Row size/position is wrongly calculated when table having overlapping rowspan cell and colspan cell + https://bugs.webkit.org/show_bug.cgi?id=16811 + + Reviewed by Julien Chaffraix. + + The height of a row is calculated by taking the max height of the cells contained in it. When a row contains + a rowSpan cell and if this row is not the last row of the cell, then its height is max height of other non + rowSpan cells. If the row is the last row of the rowSpan cell, then using the contraint laid by CSS2.1 spec + "For a rowSpan cell, the sum of the row heights involved must be great enough to encompass the cell spanning the rows", + the last remaining height of the rowSpan(cell height minus heights of other involved rows) is taken into consideration + while calculating the height of this row. + Currently when calculating the height of the row we are only using the height of the primary cell at position (row, col). + However when a row has colSpan cell and rowSpan, they might overlap. In such a sitution as only the primary cells height + is considered, the height of the row will be calculated worngly if the other overlapping cell has greater height. + Thus all the overlapping cell at position (row, col) must be considered while calculating the height of a row. + + Test: fast/table/last-cell-of-rowspan-overlapping-colspan-cell.html + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::calcRowLogicalHeight): + Fixed function to use all the overlapping cells at position(row, col) to calculate the height/position of rows. + +2012-07-12 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Enable IDBFactory.deleteDatabase() and webkitGetDatabaseNames() in Workers + https://bugs.webkit.org/show_bug.cgi?id=90310 + + Reviewed by Tony Chang. + + Simplify Document vs. Worker logic for IDBFactory::open() and hook up the + other two IDBFactory methods for use by workers as well. + + Test: storage/indexeddb/factory-basics-workers.html + + * Modules/indexeddb/IDBFactory.cpp: + (isContextValid): Helper function consolidating checks that context is usable. + (getIndexedDBDatabasePath): Helper function for accessing group settings. + (WebCore::IDBFactory::getDatabaseNames): Simplify - just pass context through to back end. + (WebCore::IDBFactory::open): Ditto. + (WebCore::IDBFactory::deleteDatabase): Ditto. + (WebCore::IDBFactory::cmp): Whitespace. + * Modules/indexeddb/IDBFactoryBackendImpl.cpp: Obsolete openFromWorker() removed. + (WebCore::IDBFactoryBackendImpl::getDatabaseNames): Signature updated. + (WebCore::IDBFactoryBackendImpl::deleteDatabase): Signature updated. + (WebCore::IDBFactoryBackendImpl::open): Signature updated. + * Modules/indexeddb/IDBFactoryBackendImpl.h: + (IDBFactoryBackendImpl): + * Modules/indexeddb/IDBFactoryBackendInterface.h: Interface methods now take both SecurityOrigin + and ScriptExecutionContext, but not Frame. In the proxy, SecurityOrigin is redundant (can be + accessed from context) but on the real back end the context is null (as Frame was previously). + (IDBFactoryBackendInterface): + * inspector/InspectorIndexedDBAgent.cpp: + (WebCore): + (WebCore::InspectorIndexedDBAgent::requestDatabaseNamesForFrame): + (WebCore::InspectorIndexedDBAgent::requestDatabase): + (WebCore::InspectorIndexedDBAgent::requestData): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] The root layer should not try create a second RenderSurface for itself + https://bugs.webkit.org/show_bug.cgi?id=91124 + + Reviewed by Adrienne Walker. + + Tests: CCLayerTreeHostImplTest.rootLayerDoesntCreateExtraSurface + + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::subtreeShouldRenderToSeparateSurface): + +2012-07-12 Adam Barth <abarth@webkit.org> + + Regression (r122359) Layout Test html5lib/runner.html is failing + https://bugs.webkit.org/show_bug.cgi?id=91047 + + Reviewed by Tony Chang. + + This ASSERT is bogus because doctypes can be removed from the DOM and + then re-added. + + Test: fast/viewport/viewport-legacy-xhtmlmp-remove-and-add.html + + * dom/Document.cpp: + (WebCore::Document::setDocType): + +2012-07-12 Ojan Vafai <ojan@chromium.org> + + Implied minimum size of flex items is min-content + https://bugs.webkit.org/show_bug.cgi?id=87546 + + Reviewed by Tony Chang. + + http://dev.w3.org/csswg/css3-flexbox/#min-size-auto + In the main axis direction, min-size of auto means min-content. + + Test: css3/flexbox/flex-item-min-size.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeLogicalWidthInRegionUsing): + (WebCore::RenderBox::computeContentLogicalHeightUsing): + (WebCore::RenderBox::computeReplacedLogicalWidthUsing): + (WebCore::RenderBox::computeReplacedLogicalHeightUsing): + (WebCore::RenderBox::computePositionedLogicalWidthUsing): + (WebCore::RenderBox::computePositionedLogicalHeightUsing): + It turned out that these FIXMEs are all unnecessary with the changes to RenderFlexibleBox. + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): + (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): + +2012-07-12 Eric Penner <epenner@google.com> + + [chromium] Use CCTexture/TextureAllocator and remove TextureManager + https://bugs.webkit.org/show_bug.cgi?id=91001 + + Reviewed by Adrienne Walker. + + Use CCTexture to clean up CCPrioritizedTexture::Backing. + Add TextureAllocator.h and remove remainder of TextureManager.h/cpp. + Minor move/refactoring of link/unlink in CCPrioritizedTexture. + Remove double initialization of the default memory limit. + + Covered by existing tests (refactoring). + + * WebCore.gypi: + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: + (WebCore): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: + (WebCore): + * platform/graphics/chromium/ImageLayerChromium.cpp: + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::initialize): + * platform/graphics/chromium/ManagedTexture.cpp: Removed. + * platform/graphics/chromium/ManagedTexture.h: Removed. + * platform/graphics/chromium/RenderSurfaceChromium.h: + (WebCore): + * platform/graphics/chromium/TextureAllocator.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h. + (WebCore): + (TextureAllocator): + (WebCore::TextureAllocator::~TextureAllocator): + * platform/graphics/chromium/TextureManager.cpp: Removed. + * platform/graphics/chromium/TextureManager.h: Removed. + * platform/graphics/chromium/TiledLayerChromium.cpp: + * platform/graphics/chromium/TrackingTextureAllocator.cpp: + (WebCore::TrackingTextureAllocator::createTexture): + (WebCore::TrackingTextureAllocator::deleteTexture): + * platform/graphics/chromium/TrackingTextureAllocator.h: + * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::prioritizeTextures): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + (WebCore::CCPrioritizedTexture::CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::setDimensions): + (WebCore::CCPrioritizedTexture::textureId): + (WebCore::CCPrioritizedTexture::bindTexture): + (WebCore::CCPrioritizedTexture::framebufferTexture2D): + (WebCore::CCPrioritizedTexture::link): + (WebCore): + (WebCore::CCPrioritizedTexture::unlink): + * platform/graphics/chromium/cc/CCPrioritizedTexture.h: + (WebCore): + (WebCore::CCPrioritizedTexture::bytes): + (CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::haveBackingTexture): + (WebCore::CCPrioritizedTexture::Backing::Backing): + (WebCore::CCPrioritizedTexture::Backing::~Backing): + (WebCore::CCPrioritizedTexture::Backing::owner): + (Backing): + (WebCore::CCPrioritizedTexture::backing): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + (WebCore::CCPrioritizedTextureManager::prioritizeTextures): + (WebCore::CCPrioritizedTextureManager::requestLate): + (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): + (WebCore::CCPrioritizedTextureManager::reduceMemory): + (WebCore::CCPrioritizedTextureManager::clearAllMemory): + (WebCore::CCPrioritizedTextureManager::registerTexture): + (WebCore::CCPrioritizedTextureManager::returnBackingTexture): + (WebCore::CCPrioritizedTextureManager::createBacking): + (WebCore::CCPrioritizedTextureManager::destroyBacking): + (WebCore::CCPrioritizedTextureManager::assertInvariants): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: + (CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::defaultMemoryAllocationLimit): + (WebCore::CCPrioritizedTextureManager::compareBackings): + * platform/graphics/chromium/cc/CCPriorityCalculator.h: + * platform/graphics/chromium/cc/CCScopedTexture.cpp: + * platform/graphics/chromium/cc/CCScopedTexture.h: + * platform/graphics/chromium/cc/CCTexture.h: + (WebCore::CCTexture::CCTexture): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Let XCode have its own way. + + * WebCore.xcodeproj/project.pbxproj: + +2012-07-12 Julien Chaffraix <jchaffraix@webkit.org> + + ASSERT(genChild->isListMarker() || genChild->style()->styleType() == FIRST_LETTER) triggered on flex-box content + https://bugs.webkit.org/show_bug.cgi?id=91003 + + Reviewed by Abhishek Arya. + + Tests: fast/flexbox/assert-generated-deprecated-flexbox.html + fast/flexbox/assert-generated-new-flexbox.html + + The issue was that findBeforeAfterParent didn't return the right parent for the flex-box case. This would + make us update the wrong children (and not propagate the style updates properly). + + * rendering/RenderObjectChildList.cpp: + (WebCore::findBeforeAfterParent): + Added a check for flex boxes (both deprecated and new). + +2012-07-12 Pravin D <pravind.2k4@gmail.com> + + Percentage width replaced element in zero percent/fixed width container block incorrectly rendered. + https://bugs.webkit.org/show_bug.cgi?id=9493 + + Reviewed by Andy Estes. + + When the width of the container is zero percent/fixed value then the width of the replaced element must also be zero. + + Test: fast/css/percent-width-img-inside-zero-percent-and-fixed-container.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeReplacedLogicalWidthUsing): + When the containing block's available width is zero there can be two cases. + The containing block is floated/positioned in which case the width of the replaced child element must be its instrinsic width. + On the other hand if the width of the container is specified to be either zero percent or fixed value then the width of the + replaced elment must be zero. + +2012-07-11 Ryosuke Niwa <rniwa@webkit.org> + + invalidateNodeListsCacheAfterAttributeChanged should dynamically figure out which attribute needs invalidation + https://bugs.webkit.org/show_bug.cgi?id=91046 + + Reviewed by Anders Carlsson. + + Added an array of counters (m_nodeListCounts) for each set of attributes (NodeListInvalidationType) node lists care about + to Document, and made DynamicSubtreeNodeList's constructor and destructor increment and decrement these counters via + registerDynamicSubtreeNodeList and unregisterDynamicSubtreeNodeList respectively. shouldInvalidateDynamicSubtreeNodeList, + which is called by invalidateNodeListsCacheAfterAttributeChanged, then use these counters to determine whether a given + attribute change should result in node list invalidations. + + Also removed m_numNodeListCaches from TreeScope because this counter has now become redundant with m_nodeListCounts. + + * dom/ChildNodeList.cpp: + (WebCore::ChildNodeList::ChildNodeList): Do not invalidate on attribute changes. + * dom/ClassNodeList.cpp: + (WebCore::ClassNodeList::ClassNodeList): Invalidate on class attribute changes. + * dom/Document.cpp: + (WebCore::Document::Document): Initialize m_nodeListCounts. + (WebCore::Document::~Document): Add assertions to make sure m_listsInvalidatedAtDocument, m_nodeListCounts, and + m_collections are all empty. + (WebCore::Document::registerDynamicSubtreeNodeList): This function is now called for all DynamicSubtreeNodeLists supposed + to just ones rooted at the document in order to increment the counter for each invalidation type. + (WebCore::Document::unregisterDynamicSubtreeNodeList): Ditto. + (WebCore::shouldInvalidateDynamicSubtreeNodeListForType): Checks the attribute name against NodeListInvalidationType. + (WebCore::Document::shouldInvalidateDynamicSubtreeNodeList): Returns true if the given attribute name matches the invalidation + type of the existing DynamicSubtreeNodeLists in the document. If the attribute name is not given (used when children change), + then it checks for the existence of any DynamicSubtreeNodeLists. Conceptually, this function can be written as a list of + "if" statements that checks values in m_nodeListCounts and the attribute name. We use "for" loop and switch statement instead + to share logic and detect future addition of values to NodeListInvalidationType. + * dom/Document.h: + (Document): Moved RootType and InvalidationType from DynamicNodeListCacheBase and renamed them to NodeListRootType and + NodeListInvalidationType respectively in order to reduce the possibility of future name collisions. Also the invalidation type + now contains 6 values instead of 2. + * dom/DynamicNodeList.cpp: + (WebCore): + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::shouldInvalidateOnAttributeChange): + (WebCore::DynamicNodeListCacheBase::rootType): Added. + (WebCore::DynamicNodeListCacheBase::invalidationType): Added. + (DynamicNodeListCacheBase): Uses 3 bits to store invalidation type now that the number of values have increased from 2 to 6. + (WebCore::DynamicNodeList::DynamicNodeList): + (WebCore::DynamicSubtreeNodeList::~DynamicSubtreeNodeList): Call unregisterDynamicSubtreeNodeList. + (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList): Call registerDynamicSubtreeNodeList. + * dom/MicroDataItemList.cpp: + (WebCore::MicroDataItemList::MicroDataItemList): Invalidate on itemscope, itemprop, and itemtype content attribute changes. + * dom/NameNodeList.cpp: + (WebCore::NameNodeList::NameNodeList): Invalidate on name attribute changes. + * dom/Node.cpp: + (WebCore::Node::clearRareData): + (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged): Replaced the hard coded check list of attributes, by a call + to shouldInvalidateDynamicSubtreeNodeList. + (WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged): Calls shouldInvalidateDynamicSubtreeNodeList. + (WebCore::Node::getElementsByTagName): + (WebCore::Node::getElementsByTagNameNS): + (WebCore::Node::getElementsByName): + (WebCore::Node::getElementsByClassName): + (WebCore::Node::radioNodeList): + (WebCore::NodeRareData::createNodeLists): + * dom/NodeRareData.h: + (WebCore::NodeListsNodeData::adoptTreeScope): Unregister and register node lists in m_tagNodeListCacheNS since all node lists + need to be accounted in m_nodeListCounts. + (WebCore::NodeRareData::ensureNodeLists): + (NodeRareData): + * dom/TagNodeList.cpp: + (WebCore::TagNodeList::TagNodeList): Do not invalidate on any attribute changes. + * dom/TreeScope.cpp: + (WebCore::TreeScope::TreeScope): No longer initializes m_numNodeListCaches since it has been removed. + * dom/TreeScope.h: + (TreeScope): Removed m_numNodeListCaches. + * dom/TreeScopeAdopter.cpp: + (WebCore::TreeScopeAdopter::moveTreeToNewScope): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): Just pass in DoNotInvalidateOnAttributeChanges for now since + it's never used in HTMLCollections. + * html/LabelableElement.cpp: + (WebCore::LabelableElement::labels): + * html/LabelsNodeList.cpp: + (WebCore::LabelsNodeList::LabelsNodeList): Invalidate on for content attribute changes. + (WebCore::LabelsNodeList::~LabelsNodeList): + * html/RadioNodeList.cpp: + (WebCore::RadioNodeList::RadioNodeList): Invalidate on id, name, and for content attribute changes. + (WebCore::RadioNodeList::~RadioNodeList): + +2012-07-12 Gavin Barraclough <barraclough@apple.com> + + Threadsafety issues in WebScriptObject + https://bugs.webkit.org/show_bug.cgi?id=90849 + + Reviewed by Filip Pizlo & Oliver Hunt. + + Updated fix for this bug. Taking the JSC API lock from WebScriptObject::release + may not be safe; better to just guard the JSWrapperCache with its own spinlock. + + * bindings/objc/WebScriptObject.mm: + (WebCore::getJSWrapper): + - Added spinlock; also retain/autorelease the returned wrapper - it is unsafe + to wait for the caller to do so, due to a race condition vs release removing + the wrapper from the map. + (WebCore::addJSWrapper): + - Take the spinlock guarding the cache. + (WebCore::removeJSWrapper): + - Take the spinlock guarding the cache. + (WebCore::removeJSWrapperIfRetainCountOne): + - Take the spinlock guarding the cache, remove the wrapper if retainCount is one. + (WebCore::createJSWrapper): + - Remove the API lock; this method no longer needs to retain/autorelease (this is + done by getJSWrapper). + (-[WebScriptObject _setImp:originRootObject:rootObject:]): + - Remove the API lock. + (-[WebScriptObject release]): + - Remove the API lock, retainCount check moved into removeJSWrapperIfRetainCountOne. + +2012-07-11 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=91000 + REGRESSION (r122244): Overflow elements don't shrink as much as they should. + + Reviewed by Simon Fraser. + + This is a fix for a a regression from https://bugs.webkit.org/show_bug.cgi?id=90646. + + I incorrectly analyzed the issue with Robert Hogan's negative margin patch and fooled myself into putting back + in an incorrect minimum width check from long ago. + + What should have happened in the test case I patched is that the overflow element should shrink to 0. The issue + with improving the logical top estimate in the previous patch is it made the clear delta become 0. This in turn + exposed a bug in our clearing algorithm with Robert's changes where you could need a relayout even if you didn't + actually move. This issue only occurs because the floats list is getting changed mid-layout because of negative margins. + + The patch changes getClearDelta to call setChildNeedsLayout(true) on children whose widths change even when their + positions do not. In effect this dynamic addition of new floats after you have done a layout on the child already means + that you can need to lay out again despite not actually having to move. + + To handle this, the code that does the relayout is now called if the child needs a relayout. This is done even if + the logical top estimate matches the final position. + + No new tests required, since the test in fast/block/float is now correctly covering the issue. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::getClearDelta): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::shrinkLogicalWidthToAvoidFloats): + +2012-07-12 James Weatherall <wez@chromium.org> + + storage tests are flaky (crashing) on windows + https://bugs.webkit.org/show_bug.cgi?id=90469 + + Reviewed by Kentaro Hara. + + Add a missing check that the underlying V8 object reference in a V8 NPObject is valid, and zero the NPObject's rootObject member when disposing it, to ensure that it won't be mistakenly touched after that point. + + This patch is intended to resolve flakiness in the storage tests including: + storage/indexeddb/mozilla/indexes.html + storage/indexeddb/mozilla/key-requirements-inline-and-passed.html + storage/websql/multiple-databases-garbage-collection.html + + * bindings/v8/NPV8Object.cpp: + (WebCore::disposeUnderlyingV8Object): + Zero the NPObject's underlying rootObject. + (_NPN_EvaluateHelper): + Add check that the underlying V8 object reference is valid. + +2012-07-12 No'am Rosenthal <noam.rosenthal@nokia.com> + + Move TextureMapperAnimation and texmap/LayerTransform to platform/graphics + https://bugs.webkit.org/show_bug.cgi?id=91111 + + Reviewed by Kenneth Rohde Christiansen. + + TextureMapperAnimation and LayerTransform are not specific to TextureMapper, and we want + to use them for other purposes as well. Moving them to platform/graphics would make that + more explicit. + + No new tests, moving files around. + + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * platform/graphics/GraphicsLayerAnimation.cpp: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp. + * platform/graphics/GraphicsLayerAnimation.h: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h. + * platform/graphics/GraphicsLayerTransform.cpp: Renamed from Source/WebCore/platform/graphics/texmap/LayerTransform.cpp. + * platform/graphics/GraphicsLayerTransform.h: Renamed from Source/WebCore/platform/graphics/texmap/LayerTransform.h. + * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: + (WebCore::GraphicsLayerTextureMapper::addAnimation): + * platform/graphics/texmap/GraphicsLayerTextureMapper.h: + (GraphicsLayerTextureMapper): + * platform/graphics/texmap/TextureMapperLayer.h: + (TextureMapperLayer): + (WebCore::TextureMapperLayer::setAnimatedTransform): + (WebCore::TextureMapperLayer::setAnimatedOpacity): + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Simplify UISourceCode code after moving revisions support inside it. + https://bugs.webkit.org/show_bug.cgi?id=91118 + + Reviewed by Pavel Feldman. + + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode.prototype._setContent): + (WebInspector.UISourceCode.prototype.revertToOriginal): + (WebInspector.UISourceCode.prototype.revertAndClearHistory): + (WebInspector.UISourceCode.prototype.contentChanged): + (WebInspector.UISourceCode.prototype.commitWorkingCopy): + (WebInspector.Revision.prototype.revertToThis): + +2012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Unreviewed. Build fix for r122462. + + * platform/qt/MemoryUsageSupportQt.cpp: + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Remove resources panel edited resources search support. + https://bugs.webkit.org/show_bug.cgi?id=91101 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.performSearch.callback): + (WebInspector.ResourcesPanel.prototype.performSearch): + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r122460 inspector closure compilation fix follow up. + + * inspector/front-end/RevisionHistoryView.js: + (WebInspector.RevisionHistoryView): + +2012-07-12 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: fix native memory instrumentation code for the bindings instrumentation. + https://bugs.webkit.org/show_bug.cgi?id=91096 + + The instrumented class has to have instrumentation method which reports class size and type and + the member objects and pointers. + + Sample: + void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::DOM); // report object size and type. + TreeShared<Node, ContainerNode>::reportMemoryUsage(memoryObjectInfo); // call base class instrumentation. + ScriptWrappable::reportMemoryUsage(memoryObjectInfo); // call base class instrumentation. + memoryObjectInfo->reportPointer(m_document, MemoryInstrumentation::DOM); // report uninstrumented pointer. + memoryObjectInfo->reportInstrumentedPointer(m_next); // report instrumented pointer. + memoryObjectInfo->reportInstrumentedObject(m_anObject); // report instrumented object. + } + + Reviewed by Pavel Feldman. + + Existing tests for native memory instrumentation. + + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::reportMemoryUsage): + * bindings/v8/DOMDataStore.h: + (WebCore): + (DOMDataStore): + * bindings/v8/IntrusiveDOMWrapperMap.h: + (WebCore::ChunkedTable::reportMemoryUsage): + * bindings/v8/ScriptProfiler.cpp: + (WebCore::ScriptProfiler::collectBindingMemoryInfo): + * bindings/v8/V8Binding.cpp: + (WebCore::V8BindingPerIsolateData::reportMemoryUsage): + (WebCore::StringCache::reportMemoryUsage): + * bindings/v8/V8Binding.h: + (WebCore): + (StringCache): + (V8BindingPerIsolateData): + * bindings/v8/V8DOMMap.h: + (WebCore): + (AbstractWeakReferenceMap): + * inspector/InspectorMemoryAgent.cpp: + (WebCore): + +2012-07-12 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: beautify find bar looks, simplify search update routines. + https://bugs.webkit.org/show_bug.cgi?id=91087 + + Reviewed by Vsevolod Vlasov. + + This change updates the looks to the one on the screenshots and simplifies match count update routines. + + * inspector/front-end/SearchController.js: + (WebInspector.SearchController.onMatchesMouseDown): + (WebInspector.SearchController): + (WebInspector.SearchController.prototype.activePanelChanged.performPanelSearch): + (WebInspector.SearchController.prototype.activePanelChanged): + (WebInspector.SearchController.prototype._updateSearchNavigationButtonState): + (WebInspector.SearchController.prototype._updateSearchMatchesCountAndCurrentMatchIndex): + (WebInspector.SearchController.prototype._onKeyDown): + (WebInspector.SearchController.prototype._onInput): + (WebInspector.SearchController.prototype._onNextButtonSearch): + (WebInspector.SearchController.prototype._onPrevButtonSearch): + (WebInspector.SearchController.prototype._performSearch): + * inspector/front-end/inspector.css: + (#search): + (#search:focus): + (.toolbar-search-navigation-controls): + (.toolbar-search-navigation): + (.toolbar-search-navigation.enabled:hover): + (.toolbar-search-navigation.enabled, .toolbar-search-navigation.enabled:active): + (.toolbar-search): + (.toolbar-search-control): + (.search-results-matches): + (.inspector-footer): + +2012-07-12 Joshua Bell <jsbell@chromium.org> + + IndexedDB: ASSERT hit calling open from callback in Worker + https://bugs.webkit.org/show_bug.cgi?id=90832 + + Reviewed by Kentaro Hara. + + GroupSettings are used to provide the backing store path in some + ports. Accessing those settings from a Worker was added, but the + access referenced thread startup data that is cleared before the + run loop, so an IDBFactory.open() call executed asynchronously + would dereference a null pointer. Plumb the settings startup + data into the context itself, like all of the other properties. + + Test: storage/indexeddb/open-twice-workers.html + + * Modules/indexeddb/IDBFactory.cpp: + (WebCore::IDBFactory::open): + * workers/DedicatedWorkerContext.cpp: + (WebCore::DedicatedWorkerContext::DedicatedWorkerContext): + * workers/DedicatedWorkerContext.h: + (WebCore::DedicatedWorkerContext::create): + (DedicatedWorkerContext): + * workers/DedicatedWorkerThread.cpp: + (WebCore::DedicatedWorkerThread::createWorkerContext): + * workers/DedicatedWorkerThread.h: + (DedicatedWorkerThread): + * workers/SharedWorkerContext.cpp: + (WebCore::SharedWorkerContext::SharedWorkerContext): + * workers/SharedWorkerContext.h: + (WebCore::SharedWorkerContext::create): + (SharedWorkerContext): + * workers/SharedWorkerThread.cpp: + (WebCore::SharedWorkerThread::createWorkerContext): + * workers/SharedWorkerThread.h: + (SharedWorkerThread): + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::WorkerContext): + * workers/WorkerContext.h: + (WebCore::WorkerContext::groupSettings): + (WorkerContext): + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::workerThread): + * workers/WorkerThread.h: + (WorkerThread): + +2012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] Implement MemoryUsageSupport + https://bugs.webkit.org/show_bug.cgi?id=91094 + + Reviewed by Adam Barth. + + Implements Qt versions of the memory-usage functions using the information we have available + from the various memory systems used in WebKit. + + Also gets rid of a redundant indirection in V8GCController. + + * Target.pri: + * bindings/v8/V8GCController.cpp: + (WebCore::V8GCController::gcEpilogue): + (WebCore::V8GCController::checkMemoryUsage): + * platform/qt/MemoryUsageSupportQt.cpp: Added. + (WebCore::mallocMemoryUsage): + (WebCore::memoryUsageKB): + (WebCore::actualMemoryUsageKB): + (WebCore::MemoryUsageSupport::memoryUsageMB): + (WebCore::MemoryUsageSupport::actualMemoryUsageMB): + (WebCore::MemoryUsageSupport::lowMemoryUsageMB): + (WebCore::MemoryUsageSupport::highMemoryUsageMB): + (WebCore::MemoryUsageSupport::highUsageDeltaMB): + (WebCore::MemoryUsageSupport::processMemorySizesInBytes): + * platform/qt/PlatformSupport.h: + (PlatformSupport): + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Revision history view should be updated when uiSourceCodes are removed or replaced. + https://bugs.webkit.org/show_bug.cgi?id=91095 + + Reviewed by Pavel Feldman. + + RevisionHistoryView is now reset in WorkspaceReset event handler. + UISourceCodes are now removed from RevisionHistoryView when uiSourceCode is removed or replace. + + * inspector/front-end/RevisionHistoryView.js: + (WebInspector.RevisionHistoryView): + (WebInspector.RevisionHistoryView.prototype._clearHistory): + (WebInspector.RevisionHistoryView.prototype._uiSourceCodeRemoved): + (WebInspector.RevisionHistoryView.prototype._uiSourceCodeReplaced): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._reset): + +2012-07-12 Dongwoo Im <dw.im@samsung.com> + + InspectorFileSystemAgent.cpp have to include File.h explicitly + https://bugs.webkit.org/show_bug.cgi?id=91078 + + Reviewed by Vsevolod Vlasov. + + Make sure the InspectorFileSystemAgent.cpp include the File.h by including explicitly. + + No new tests. Covered by existing tests. + + * inspector/InspectorFileSystemAgent.cpp: Include File.h + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: [Regression] Stale revisions should be removed on navigation. + https://bugs.webkit.org/show_bug.cgi?id=91080 + + Reviewed by Pavel Feldman. + + Moved all the code responsible for script mapping resetting to Workspace. + Stale revisions are removed in Workspace._reset now. + + * inspector/front-end/ScriptSnippetModel.js: + (WebInspector.ScriptSnippetModel): + * inspector/front-end/StylesPanel.js: + (WebInspector.StylesUISourceCodeProvider): + (WebInspector.StylesUISourceCodeProvider.prototype._populate): + (WebInspector.StylesUISourceCodeProvider.prototype.reset): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode.prototype._restoreRevisionHistory): + * inspector/front-end/Workspace.js: + (WebInspector.Workspace): + (WebInspector.Workspace.prototype._reset): + +2012-07-12 Andreas Kling <kling@webkit.org> + + Make ElementAttributeData a variable-sized object to reduce memory use. + <http://webkit.org/b/88240> + + Reviewed by Antti "Obi-Wan" Koivisto. + + Take advantage of the fact that we know at ElementAttributeData construction time how many attributes + it needs to accomodate and allocate exactly as much space as needed instead of using a Vector. + For elements that never have their attribute list mutated (the vast majority), this saves a lot of + memory and removes the indirection to Vector<Attribute>'s heap-allocated storage. + + Introduced a mutability flag to ElementAttributeData and sprinkled assertions all over to make sure + that nothing tries to mutate an element with a raw attribute array. + + When an Element's attribute(s) are mutated, we reconstruct the ElementAttributeData, this time using + a Vector as backing instead. This is triggered when calling Element::mutableAttributeData(). + + This reduces memory consumption by 3.2MB when viewing the full HTML5 spec at <http://whatwg.org/c/>. + That is a ~35% reduction in DOM attribute memory use. + + Furthermore, that page ends up promoting 27% of the elements to mutable attribute storage due to dynamic + adding of "class" attributes. For more static pages, savings are even greater. + + Also did away with ElementAttributeData::removeAttribute(name) and do separate index lookup where + needed. Not a big deal but avoids double lookup of attributes when removing them. + + * css/PropertySetCSSStyleDeclaration.cpp: + (WebCore::InlineCSSStyleDeclaration::ensureMutablePropertySet): + + Call ensureInlineStyle() on the element so we know we have a StylePropertySet to work with. + May cause the creation (and replacement) of a new underlying StylePropertySet on the Element's + attribute data. + + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::adoptCSSOMWrapperFrom): + + Added. Allows switching the underlying StylePropertySet object while retaining CSSOM wrapper + identity (web facing behavior.) + + * dom/Element.cpp: + (WebCore::Element::detachAttribute): + (WebCore::Element::removeAttribute): + (WebCore::Element::attributes): + (WebCore::Element::setAttributeInternal): + (WebCore::Element::parserSetAttributes): + (WebCore::Element::hasEquivalentAttributes): + (WebCore::Element::setAttributeNode): + (WebCore::Element::removeAttributeNode): + (WebCore::Element::getAttributeNode): + (WebCore::Element::getAttributeNodeNS): + (WebCore::Element::hasAttribute): + (WebCore::Element::hasAttributeNS): + (WebCore::Element::normalizeAttributes): + (WebCore::Element::cloneAttributesFromElement): + (WebCore::Element::createMutableAttributeData): + * dom/Element.h: + (WebCore::Element::attributeData): + (Element): + (WebCore::Element::updatedAttributeData): + (WebCore::Element::ensureAttributeData): + (WebCore::Element::ensureUpdatedAttributeData): + (WebCore::Element::mutableAttributeData): + (WebCore): + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::createImmutable): + (WebCore): + (WebCore::ElementAttributeData::ElementAttributeData): + (WebCore::ElementAttributeData::~ElementAttributeData): + (WebCore::ElementAttributeData::attrIfExists): + (WebCore::ElementAttributeData::ensureAttr): + (WebCore::ElementAttributeData::setAttr): + (WebCore::ElementAttributeData::removeAttr): + (WebCore::ElementAttributeData::ensureInlineStyle): + (WebCore::ElementAttributeData::ensureMutableInlineStyle): + (WebCore::ElementAttributeData::destroyInlineStyle): + (WebCore::ElementAttributeData::addAttribute): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::isEquivalent): + (WebCore::ElementAttributeData::detachAttrObjectsFromElement): + (WebCore::ElementAttributeData::getAttributeItemIndexSlowCase): + (WebCore::ElementAttributeData::cloneDataFrom): + (WebCore::ElementAttributeData::clearAttributes): + (WebCore::ElementAttributeData::replaceAttribute): + (WebCore::ElementAttributeData::getAttributeNode): + * dom/ElementAttributeData.h: + (WebCore::ElementAttributeData::create): + (ElementAttributeData): + (WebCore::ElementAttributeData::setClass): + (WebCore::ElementAttributeData::setIdForStyleResolution): + (WebCore::ElementAttributeData::inlineStyle): + (WebCore::ElementAttributeData::setAttributeStyle): + (WebCore::ElementAttributeData::reportMemoryUsage): + (WebCore::ElementAttributeData::isMutable): + (WebCore::ElementAttributeData::makeMutable): + (WebCore::ElementAttributeData::length): + (WebCore): + (WebCore::ElementAttributeData::isEmpty): + (WebCore::ElementAttributeData::array): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::getAttributeItem): + (WebCore::ElementAttributeData::getAttributeItemIndex): + (WebCore::ElementAttributeData::attributeItem): + * dom/StyledElement.cpp: + (WebCore::StyledElement::style): + (WebCore::StyledElement::classAttributeChanged): + (WebCore::StyledElement::setInlineStyleProperty): + (WebCore::StyledElement::removeInlineStyleProperty): + (WebCore::StyledElement::addSubresourceAttributeURLs): + * dom/StyledElement.h: + (WebCore::StyledElement::ensureInlineStyle): + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::createHTMLElementFromSavedElement): + * xml/parser/XMLDocumentParserQt.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + +2012-07-12 Florin Malita <fmalita@chromium.org> + + Incorrect handling of chained pending resources in SVGUseElement + https://bugs.webkit.org/show_bug.cgi?id=89686 + + Reviewed by Nikolas Zimmermann. + + Currently SVGUseElement builds the shadow tree when the target first + becomes available. This is normally OK, but if the target itself (or + one of its children) is a <use> element with pending resources, then + the shadow expansion only captures the current state of the tree and + never gets updated when the pending resource becomes available. + + In order to support arbitrary <use>-on-<use> constructs, this patch + tracks nested <use> dependencies and rebuilds the dependent trees + whenever the target gets updated. + + + Tests: svg/custom/use-nested-expected.svg + svg/custom/use-nested.svg + + * svg/SVGElement.cpp: + (WebCore::SVGElement::removedFrom): removedFrom needs to be called up the inheritance chain + before invoking removeAllElementReferencesForTarget. Otherwise we could end up finding the + element being removed as a valid target in SVGUseElement::buildInstanceTree because its + InDocument flag is not cleared yet. + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::~SVGUseElement): + (WebCore::SVGUseElement::clearResourceReferences): + (WebCore::SVGUseElement::buildPendingResource): + (WebCore::SVGUseElement::buildShadowAndInstanceTree): + (WebCore::SVGUseElement::buildInstanceTree): + * svg/SVGUseElement.h: + (SVGUseElement): + Track <use> -> <use> dependencies using SVGDocumentExtensions' + m_elementDependencies framework and ensure dependent trees are rebuilt + when the target itself gets rebuilt. + +2012-07-12 MORITA Hajime <morrita@google.com> + + Typo: ParentTranversalDetails should be ParentTraversalDetails + https://bugs.webkit.org/show_bug.cgi?id=91059 + + Reviewed by Andreas Kling. + + Did a bare rename from ParentTranversalDetails to ParentTraversalDetails + + No new tests, just a rename. + + * dom/ComposedShadowTreeWalker.cpp: + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseInsertionPoint): + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseShadowRoot): + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::didFindNode): + (WebCore::ComposedShadowTreeWalker::findParent): + (WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents): + (WebCore::ComposedShadowTreeWalker::traverseParent): + (WebCore::ComposedShadowTreeWalker::traverseParentInCurrentTree): + (WebCore::ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost): + * dom/ComposedShadowTreeWalker.h: + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::ParentTraversalDetails): + (ComposedShadowTreeWalker): + * dom/NodeRenderingContext.h: + (NodeRenderingContext): + +2012-07-11 Antti Koivisto <antti@apple.com> + + Failure to dispatch didFinishLoadForFrame if font load fails synchronously + https://bugs.webkit.org/show_bug.cgi?id=91018 + + Reviewed by Enrica Casucci. + + New font loads may be triggered by layout after the document load is complete but before we have dispatched + didFinishLoading for the frame. If the load fails synchronously we might fail to ever invoke + FrameLoader::checkLoadComplete and so fail to dispatch didFinishLoading. + + Make sure this doesn't happen by calling FrameLoader::checkLoadComplete explicitly after triggering font loads. + + * css/CSSFontSelector.cpp: + (WebCore::CSSFontSelector::beginLoadTimerFired): + +2012-07-12 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Register protocol handler files should be in Modules/protocolhandler + https://bugs.webkit.org/show_bug.cgi?id=90766 + + Reviewed by Hajime Morita. + + The register protocol handler files are now self-contained. This patch is moved to the Modules. + + No new tests. Covered by existing tests. + + * CMakeLists.txt: + * GNUmakefile.am: + * GNUmakefile.list.am: + * Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp: Renamed from Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp. + (WebCore): + (WebCore::initProtocolHandlerWhitelist): + (WebCore::verifyCustomHandlerURL): + (WebCore::isProtocolWhitelisted): + (WebCore::verifyProtocolHandlerScheme): + (WebCore::NavigatorRegisterProtocolHandler::NavigatorRegisterProtocolHandler): + (WebCore::NavigatorRegisterProtocolHandler::~NavigatorRegisterProtocolHandler): + (WebCore::NavigatorRegisterProtocolHandler::registerProtocolHandler): + (WebCore::customHandlersStateString): + (WebCore::NavigatorRegisterProtocolHandler::isProtocolHandlerRegistered): + (WebCore::NavigatorRegisterProtocolHandler::unregisterProtocolHandler): + * Modules/protocolhandler/NavigatorRegisterProtocolHandler.h: Renamed from Source/WebCore/page/NavigatorRegisterProtocolHandler.h. + (WebCore): + (NavigatorRegisterProtocolHandler): + * Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl: Renamed from Source/WebCore/page/NavigatorRegisterProtocolHandler.idl. + * Target.pri: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/copyForwardingHeaders.cmd: + * WebCore.xcodeproj/project.pbxproj: + +2012-07-12 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Cannot use digest proxy auth and NTLM auth at the same time + https://bugs.webkit.org/show_bug.cgi?id=91054 + + Reviewed by George Staikos. + + Added an interface function syncProxyCredential() in class + PageClientBlackBerry, which is responsible to notify WebPageClient + to synchronize proxy credential to the chrome process. + + Internally reviewed by Jason Liu <jason.liu@torchmobile.com.cn> + + No new tests since there's no functional change. + + * platform/blackberry/PageClientBlackBerry.h: + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::storeCredentials): Remember the accepted proxy + credential and notify webpage client to synchronize it. + +2012-07-12 Xingnan Wang <xingnan.wang@intel.com> + + [IndexedDB] upperOpen set to true in lowerBound()/lowerOpen set to true in upperBound() + https://bugs.webkit.org/show_bug.cgi?id=90867 + + Reviewed by Tony Chang. + + In the latest W3C spec upperOpen/lowerOpen are set to true in lowerBound()/upperBound(), which + we should keep aligned with. + + No new tests - updated storage/indexeddb/keyrange.html to match new behavior. + + * Modules/indexeddb/IDBKeyRange.cpp: + (WebCore::IDBKeyRange::lowerBound): + (WebCore::IDBKeyRange::upperBound): + +2012-07-12 MORITA Hajime <morrita@google.com> + + [Shadow DOM] <video> with <shadow> crashes + https://bugs.webkit.org/show_bug.cgi?id=91055 + + Reviewed by Kent Tamura. + + This is similar to Bug 90480, where an undesired renderer is created by + locating an insertion point on the shadow boundary. + + This change adds a guard for such case by cheking whether the + source node of each to-be-created renderer comes from the UA shadow + tree, which is allowed to have a renderer. + + Test: fast/dom/shadow/insertion-point-video-crash.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::childShouldCreateRenderer): Added a check. + (WebCore::HTMLMediaElement::mediaControls): Added const. + (WebCore::HTMLMediaElement::hasMediaControls): Added const. + * html/HTMLMediaElement.h: + (HTMLMediaElement): + +2012-07-12 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r122184): LocaleMac::currentLocale should use current locale rather than newly create locale object. + https://bugs.webkit.org/show_bug.cgi?id=91057 + + Reviewed by Kent Tamura. + + This patch changes NSLocale object of LocaleMac::m_locale variable to + current NSLocale object rather than newly created NSLocale object from + locale identifier. + + No new tests. We don't have way to change system preferences from + test scripts and restoring them. To test this patch, we need to do so. + + * platform/text/mac/LocaleMac.h: + (LocaleMac): Added a constructor which takes NSLocale object. + * platform/text/mac/LocaleMac.mm: + (WebCore::LocaleMac::LocaleMac): Added a constructor which takes NSLocale object. + (WebCore::LocaleMac::currentLocale): Changed to construct LocaleMac object from NSLocale object rather than locale identifier. + +2012-07-11 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add webkit_cookie_manager_set_persistent_storage() to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=83016 + + Reviewed by Martin Robinson. + + * platform/network/soup/CookieStorageSoup.cpp: + (WebCore::soupCookiesChanged): Do not notify about changes in + other cookie jars than the current one. + +2012-07-12 Philip Rogers <pdr@google.com> + + Refactor RenderSVGShape bounding box code + https://bugs.webkit.org/show_bug.cgi?id=90655 + + Reviewed by Nikolas Zimmermann. + + RenderSVGShape::objectBoundingBox worked differently than RenderSVGShape::strokeBoundingBox by + not caching the object bounding box and instead computing it on each call. For consistency and + performance objectBoundingBox has been refactored to return a cached value. + + createShape has been renamed updateShapeFromElement for understandability. updateShapeFromElement + now updates the internal state of the shape (bounding boxes, etc) from the associated element. + RenderSVGShape::inflateWithStrokeAndMarkerBounds has been merged into + RenderSVGShape::calculateStrokeBoundingBox which is called from updateShapeFromElement. + + After this change all bounding box computation is now handled in updateShapeFromElement. Because + subclasses override updateShapeFromElement it will be easy for them to have custom bounding box + code there (as will happen for RenderSVGPath in a followup patch). + + strokeBoundingBox and objectBoundingBox are now able to return their cached values immediately + in RenderSVGRect and RenderSVGEllipse instead of checking their fallback state on each call. + + Additionally, to save space RenderSVGEllipse and RenderSVGRect now use the m_fillBoundingBox and + m_strokeBoundingBox of RenderSVGShape instead of having their own. + + This patch also removes setStrokeAndMarkerBoundingBox that was previously dead code. + + No new tests, just a refactoring. + + * rendering/svg/RenderSVGEllipse.cpp: + (WebCore::RenderSVGEllipse::updateShapeFromElement): + (WebCore): + (WebCore::RenderSVGEllipse::fillShape): + (WebCore::RenderSVGEllipse::strokeShape): + (WebCore::RenderSVGEllipse::shapeDependentStrokeContains): + * rendering/svg/RenderSVGEllipse.h: + (RenderSVGEllipse): + (WebCore::RenderSVGEllipse::isEmpty): + * rendering/svg/RenderSVGRect.cpp: + (WebCore::RenderSVGRect::updateShapeFromElement): + (WebCore): + (WebCore::RenderSVGRect::fillShape): + (WebCore::RenderSVGRect::strokeShape): + (WebCore::RenderSVGRect::shapeDependentStrokeContains): + (WebCore::RenderSVGRect::shapeDependentFillContains): + * rendering/svg/RenderSVGRect.h: + (RenderSVGRect): + (WebCore::RenderSVGRect::isEmpty): + * rendering/svg/RenderSVGShape.cpp: + (WebCore::RenderSVGShape::updateShapeFromElement): + (WebCore): + (WebCore::RenderSVGShape::layout): + (WebCore::RenderSVGShape::calculateObjectBoundingBox): + (WebCore::RenderSVGShape::calculateStrokeBoundingBox): + (WebCore::RenderSVGShape::updateRepaintBoundingBox): + * rendering/svg/RenderSVGShape.h: + (RenderSVGShape): + (WebCore::RenderSVGShape::objectBoundingBox): + (WebCore::RenderSVGShape::strokeBoundingBox): + +2012-07-12 Kent Tamura <tkent@chromium.org> + + Do not save the form state signature if nothing is saved + https://bugs.webkit.org/show_bug.cgi?id=91050 + + Reviewed by Hajime Morita. + + This change will reduce the size of HistoyItem. + + Test: fast/forms/state-restore-empty-state.html + + * html/FormController.cpp: + (WebCore::FormController::formElementsState): + If stateVector has only the signature string, clear it. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91051> Fix the Qt Mac build after r122400. + + Qt on Mac builds with a deployment target of OS X 10.5. However, it was not been setting + BUILDING_ON_LEOPARD / TARGETING_LEOPARD and thus was falling down code paths in DisplaySleepDisabler.cpp + that were specific to Snow Leopard and newer. After the removal of BUILDING_ON_LEOPARD + and TARGETING_LEOPARD it ended up falling down the correct Leopard-compatible code path, + which revealed that the code made assumptions about which headers had already been included. + + * platform/mac/DisplaySleepDisabler.cpp: Include CoreServices/CoreServices.h to pull in + a declaration of UpdateSystemActivity when targeting Leopard. + +2012-07-11 Matt Falkenhagen <falken@chromium.org> + + Add dialog element feature toggle to InternalSettings + https://bugs.webkit.org/show_bug.cgi?id=90934 + + Reviewed by Hajime Morita. + + This enables layout tests to be written for dialog although the feature is disabled by default. + + Tests: fast/dom/HTMLDialogElement/dialog-disabled.html + fast/dom/HTMLDialogElement/dialog-enabled.html + + * WebCore.exp.in: Added newly exported symbol. + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::Backup): Backup dialog feature flag. + (WebCore::InternalSettings::Backup::restoreTo): Restore dialog feature flag. + (WebCore::InternalSettings::setDialogElementEnabled): Added. + (WebCore): + * testing/InternalSettings.h: Added support for dialog. + (Backup): + (InternalSettings): + * testing/InternalSettings.idl: Added support for dialog. + +2012-07-11 Kent Tamura <tkent@chromium.org> + + Accessing width or height of a detached image input element causes crash + https://bugs.webkit.org/show_bug.cgi?id=90885 + + Reviewed by Kentaro Hara. + + Test: fast/forms/image/width-and-height-of-detached-input.html + + * html/ImageInputType.cpp: + (WebCore::ImageInputType::height): Add null check for m_imageLoader. + (WebCore::ImageInputType::width): ditto. + +2012-07-11 Kent Tamura <tkent@chromium.org> + + Do not save state of stateless form controls + https://bugs.webkit.org/show_bug.cgi?id=90964 + + Reviewed by Hajime Morita. + + By Bug 89409, we started to store unmodified form control + state. However we don't need to make such state for the following + types. + - password + - submit + - reset + - button + - keygen + + Test: fast/forms/state-restore-skip-stateless.html + + * html/BaseButtonInputType.cpp: + (WebCore::BaseButtonInputType::shouldSaveAndRestoreFormControlState): + Added. Disable saving state for submit, reset, and button types. + * html/BaseButtonInputType.h: + (BaseButtonInputType): Add shouldSaveAndRestoreFormControlState. + * html/HTMLFormControlElementWithState.h: + (HTMLFormControlElementWithState): Make shouldSaveAndRestoreFormControlState virtual. + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::shouldSaveAndRestoreFormControlState): + Added. Checks InputType::shouldSaveAndRestoreFormControlState first. + * html/HTMLInputElement.h: + (HTMLInputElement): Override shouldSaveAndRestoreFormControlState. + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::shouldSaveAndRestoreFormControlState) + Added. Disable saving state for <keygen>.: + * html/HTMLKeygenElement.h: Override shouldSaveAndRestoreFormControlState. + * html/InputType.cpp: + (WebCore::InputType::shouldSaveAndRestoreFormControlState): + Added. Enable saving state for all types by default. + * html/InputType.h: + (InputType): Add shouldSaveAndRestoreFormControlState. + * html/PasswordInputType.cpp: + (WebCore::PasswordInputType::shouldSaveAndRestoreFormControlState): + Added. Disabled saving state. + (WebCore::PasswordInputType::saveFormControlState): + Because shouldSaveAndRestoreFormControlState() returns false, + saveFormControlState should be never called. + * html/PasswordInputType.h: + (PasswordInputType): Override shouldSaveAndRestoreFormControlState. + +2012-07-11 No'am Rosenthal <noam.rosenthal@nokia.com> + + Compilation error with GLES2 when using gl2ext.h from ANGLE. + https://bugs.webkit.org/show_bug.cgi?id=91030 + + Reviewed by Kenneth Russell. + + gl2ext.h defines PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG and not + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC. This is a bug in the original Khronos header, + but we should work around it until fixed headers are integrated. + + + * platform/graphics/opengl/Extensions3DOpenGLES.h: + (Extensions3DOpenGLES): + Removed the "PROC" suffix to work around the header bug. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Attempt to fix the Chromium Mac build after r122400. + + * platform/text/cf/HyphenationCF.cpp: Ensure that Chromium only compiles the body of this file if + building for a new enough version of OS X. + +2012-07-11 Kent Tamura <tkent@chromium.org> + + [Mac] Sort project.pbxproj + + * WebCore.xcodeproj/project.pbxproj: Apply Tools/Scripts/sort-Xcode-project-file + +2012-07-11 Dan Bernstein <mitz@apple.com> + + When a table row height grows because of pagination, not all cells’ heights are adjusted + https://bugs.webkit.org/show_bug.cgi?id=91043 + + Reviewed by Sam Weinig. + + The fix for in bug <http://webkit.org/b/83595> in <http://trac.webkit.org/r113738> made table + rows grow as necessary to fit cells that grow as a result of pagination. But it had two bad + side effects: earlier cells on the row would not grow by the same amount, and later cells on + the row would factor the existing growth into their intrinsic padding. + + Test: fast/multicol/table-row-height-increase.html + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::layoutRows): Now when a cell becomes taller than the row height, + the additional height needed is recorded, and the cell is shrunk back to row height. Then + after finishing the row, all cells occurring on the row (including cells spanning it but not + starting on it) are grown by the same amount. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Switch a few cases that care about the SDK over to checking __MAC_OS_X_VERSION_MAX_ALLOWED so that things build. + + Part of <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + Reviewed by Filip Pizlo. + + * platform/graphics/cg/GraphicsContextCG.cpp: The SDK we're building against determines whether the constant is available. + * platform/mac/EmptyProtocolDefinitions.h: The SDK we're building against determines whether the protocols are declared. + * platform/mac/NSScrollerImpDetails.h: The SDK we're building against determines whether the constants and method are + available. + * platform/mac/SharedTimerMac.mm: The SDK we're building against determines whether the function has already been declared. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * WebCore.exp.in: + * accessibility/AccessibilityList.h: + * accessibility/AccessibilityTable.h: + * accessibility/mac/AXObjectCacheMac.mm: + * editing/mac/EditorMac.mm: + * loader/MainResourceLoader.cpp: + * loader/MainResourceLoader.h: + * page/AlternativeTextClient.h: + * page/ContextMenuController.cpp: + * page/mac/SettingsMac.mm: + * platform/LocalizedStrings.cpp: + * platform/MemoryPressureHandler.cpp: + * platform/audio/mac/AudioBusMac.mm: + * platform/graphics/Gradient.h: + * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: + * platform/graphics/ca/GraphicsLayerCA.cpp: + * platform/graphics/ca/PlatformCALayer.h: + * platform/graphics/ca/mac/PlatformCALayerMac.mm: + * platform/graphics/ca/mac/TileCache.mm: + * platform/graphics/cg/GraphicsContextCG.cpp: + * platform/graphics/cg/ImageBufferCG.cpp: + * platform/graphics/cg/ImageBufferDataCG.cpp: + * platform/graphics/cg/ImageBufferDataCG.h: + * platform/graphics/cg/ImageCG.cpp: + * platform/graphics/cg/ImageSourceCG.cpp: + * platform/graphics/cg/PathCG.cpp: + * platform/graphics/cocoa/FontPlatformDataCocoa.mm: + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + * platform/graphics/mac/ComplexTextController.cpp: + * platform/graphics/mac/ComplexTextControllerCoreText.mm: + * platform/graphics/mac/FontCacheMac.mm: + * platform/graphics/mac/FontCustomPlatformData.cpp: + * platform/graphics/mac/FontMac.mm: + * platform/graphics/mac/GraphicsContextMac.mm: + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + * platform/graphics/mac/SimpleFontDataMac.mm: + * platform/graphics/mac/WebLayer.h: + * platform/graphics/mac/WebLayer.mm: + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + * platform/mac/CursorMac.mm: + * platform/mac/DisplaySleepDisabler.cpp: + * platform/mac/DisplaySleepDisabler.h: + * platform/mac/EmptyProtocolDefinitions.h: + * platform/mac/HTMLConverter.h: + * platform/mac/HTMLConverter.mm: + * platform/mac/MemoryPressureHandlerMac.mm: + * platform/mac/NSScrollerImpDetails.h: + * platform/mac/PlatformEventFactoryMac.mm: + * platform/mac/PopupMenuMac.mm: + * platform/mac/ScrollAnimatorMac.mm: + * platform/mac/ScrollElasticityController.mm: + * platform/mac/SharedTimerMac.mm: + * platform/mac/SuddenTermination.mm: + * platform/mac/WebCoreFullScreenWindow.mm: + * platform/mac/WebCoreNSCellExtras.h: + * platform/mac/WebCoreSystemInterface.h: + * platform/mac/WebCoreSystemInterface.mm: + * platform/mac/WebFontCache.mm: + * platform/mac/WebVideoFullscreenController.mm: + * platform/mac/WebVideoFullscreenHUDWindowController.mm: + * platform/network/Credential.h: + * platform/network/ResourceHandle.h: + * platform/network/cf/DNSCFNet.cpp: + * platform/network/cf/ProxyServerCFNet.cpp: + * platform/network/cf/ResourceRequest.h: + * platform/network/cf/ResourceRequestCFNet.cpp: + * platform/network/cf/SocketStreamHandleCFNet.cpp: + * platform/network/mac/AuthenticationMac.mm: + * platform/network/mac/CookieStorageMac.mm: + * platform/network/mac/ResourceHandleMac.mm: + * platform/network/mac/ResourceRequestMac.mm: + * platform/network/mac/WebCoreURLResponse.mm: + * platform/text/TextChecking.h: + * platform/text/cf/HyphenationCF.cpp: + * platform/text/mac/HyphenationMac.mm: + * rendering/RenderLayerBacking.cpp: + * rendering/RenderLayerCompositor.cpp: + * rendering/RenderThemeMac.mm: + +2012-07-11 Robert Kroeger <rjkroege@chromium.org> + + Suppress horizontal conversion of PlatformWheelEvents when hasPreciseScrollingDeltas is true + https://bugs.webkit.org/show_bug.cgi?id=89580 + + WebKit GTK and Chromium Linux force vertical wheel events to + scroll horizontally when over horizontal scroll bars. This is + undesirable for touchpad scrolling with + hasPreciseScrollingDeltas() == true. Modified shouldTurnVerticalTicksIntoHorizontal + to not perform this conversion for PlatformWheelEvents with preciseScrollingDeltas. + + Reviewed by Adam Barth. + + Tests: fast/events/touch/gesture/touch-gesture-scroll-sideways.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal): + (WebCore::EventHandler::handleWheelEvent): + * page/EventHandler.h: + (EventHandler): + * page/chromium/EventHandlerChromium.cpp: + (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal): + * page/gtk/EventHandlerGtk.cpp: + (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal): + +2012-07-11 Hayato Ito <hayato@chromium.org> + + Unreviewed gardening. + Build fix for r122373. + + * platform/chromium/support/WebCompositorSharedQuadState.cpp: + (WebKit::WebCompositorSharedQuadState::WebCompositorSharedQuadState): + +2012-07-11 Shinya Kawanaka <shinyak@chromium.org> + + SVGUseElement should not use Element::ensureShadowRoot(). + https://bugs.webkit.org/show_bug.cgi?id=90938 + + Reviewed by Hajime Morita. + + We would like to remove Element::ensureShadowRoot() because we would like to stabilize the lifecycle of Shadow DOM. + This patch rewrites SVGUseElement::create() not to use Element::ensureShadowRoot(). Since our convention to create + a shadow subtree is to create a method createShadowSubtree(), I obeyed it. + + No new tests. Simple refactoring. + + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::create): + (WebCore::SVGUseElement::createShadowSubtree): + (WebCore): + * svg/SVGUseElement.h: + (SVGUseElement): + +2012-07-11 Alexandre Elias <aelias@google.com> + + [chromium] Move compositor quads to Platform/chromium/public + https://bugs.webkit.org/show_bug.cgi?id=90582 + + Reviewed by Adrienne Walker. + + This moves CCSharedQuadState, CCDrawQuad, and all but two CC*DrawQuad + classes to the WebKit namespace, as a first step to pushing them + across the process boundary for the ubercompositor. + + - The intent is to serialize the class hierarchy using the same + mechanism as WebInputEvent. In order to do this, there are three + requirements: pure POD data, a method returning size, and a packing + pragma. + + - Private data members are fine with this kind of serializer, and a + default constructor is not needed. Because of that, we can maintain + the same encapsulation and convenient APIs (behind + WEBKIT_IMPLEMENTATION) as the original classes. To ease the + transition, the original WebCore headers still exist and typedef to + the new classes. + + - However, SharedQuadState will be serialized using the normal + IPC_STRUCT_TRAITS macro, so I made its members public. A custom + serializer (on quad lists) will maintain the pointers from quads to + SharedQuadStates. + + - I converted the Material casting mechanism to materialCast() methods + living in the derived classes. That way, the WebCompositorQuad header + doesn't need to know about all its derived classes. + + - Quad classes not yet transitioned can still be used in + non-ubercompositor mode. CCRenderPassDrawQuad and CCYUVVideoDrawQuad + are currently non-POD and I left them in their original files. + + This approach is the best I've found so far, since it preserves all + WebCore-facing APIs and avoids unnecessary code duplication (new quad + types or members can be added by modifying only one place). There + also should not be an unreasonable amount of custom serializer code + required. + + No new tests. (No-op refactoring.) + + * WebCore.gypi: + * platform/chromium/support/WebCompositorQuad.cpp: Added. + (WebKit): + (WebKit::WebCompositorQuad::WebCompositorQuad): + (WebKit::WebCompositorQuad::opaqueRect): + (WebKit::WebCompositorQuad::setQuadVisibleRect): + (WebKit::WebCompositorQuad::size): + * platform/chromium/support/WebCompositorSharedQuadState.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp. + (WebKit): + (WebKit::WebCompositorSharedQuadState::WebCompositorSharedQuadState): + (WebKit::WebCompositorSharedQuadState::create): + (WebKit::WebCompositorSharedQuadState::isLayerAxisAlignedIntRect): + * platform/chromium/support/WebCompositorSolidColorQuad.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp. + (WebKit): + (WebKit::WebCompositorSolidColorQuad::create): + (WebKit::WebCompositorSolidColorQuad::WebCompositorSolidColorQuad): + (WebKit::WebCompositorSolidColorQuad::materialCast): + * platform/chromium/support/WebCompositorTextureQuad.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp. + (WebKit): + (WebKit::WebCompositorTextureQuad::create): + (WebKit::WebCompositorTextureQuad::WebCompositorTextureQuad): + (WebKit::WebCompositorTextureQuad::setNeedsBlending): + (WebKit::WebCompositorTextureQuad::materialCast): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawQuad): + * platform/graphics/chromium/LayerRendererChromium.h: + * platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp: + (WebCore::CCCheckerboardDrawQuad::create): + (WebCore::CCCheckerboardDrawQuad::CCCheckerboardDrawQuad): + (WebCore::CCCheckerboardDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h: + (CCCheckerboardDrawQuad): + * platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp: + (WebCore::CCDebugBorderDrawQuad::create): + (WebCore::CCDebugBorderDrawQuad::CCDebugBorderDrawQuad): + (WebCore::CCDebugBorderDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h: + (CCDebugBorderDrawQuad): + * platform/graphics/chromium/cc/CCDrawQuad.cpp: Removed. + * platform/graphics/chromium/cc/CCDrawQuad.h: + (WebCore): + * platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp: + (WebCore::CCIOSurfaceDrawQuad::create): + (WebCore::CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad): + (WebCore::CCIOSurfaceDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h: + (CCIOSurfaceDrawQuad): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderPass.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore): + * platform/graphics/chromium/cc/CCSharedQuadState.h: + (WebCore): + * platform/graphics/chromium/cc/CCSolidColorDrawQuad.h: + (WebCore): + * platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp: + (WebCore::CCStreamVideoDrawQuad::create): + (WebCore::CCStreamVideoDrawQuad::CCStreamVideoDrawQuad): + (WebCore::CCStreamVideoDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h: + (CCStreamVideoDrawQuad): + * platform/graphics/chromium/cc/CCTextureDrawQuad.h: + (WebCore): + * platform/graphics/chromium/cc/CCTileDrawQuad.cpp: + (WebCore::CCTileDrawQuad::create): + (WebCore::CCTileDrawQuad::CCTileDrawQuad): + (WebCore::CCTileDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCTileDrawQuad.h: + (CCTileDrawQuad): + * platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp: + (WebCore::CCYUVVideoDrawQuad::create): + (WebCore::CCYUVVideoDrawQuad::CCYUVVideoDrawQuad): + (WebCore::CCYUVVideoDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h: + (CCYUVVideoDrawQuad): + +2012-07-11 Robert Kroeger <rjkroege@chromium.org> + + [chromium] [regression] Don't use ScrollByPrecisePixels on Chromium Mac. + https://bugs.webkit.org/show_bug.cgi?id=91020 + + Reviewed by Adam Barth. + + A change in https://bugs.webkit.org/show_bug.cgi?id=87535 to + improve the operation of smooth scrolling incorrectly caused + Chromium Mac to use the wrong scroll granularity on + hasPreciseScrollingDeltas() == true wheelevent scrolls. + Exclude the change on the Chromium Mac platform. + + * platform/ScrollAnimator.cpp: + (WebCore::ScrollAnimator::handleWheelEvent): Adjusted #ifdef to exclude Chromium + Mac from ScrollByPrecisePixels change. + +2012-07-11 Jia Pu <jpu@apple.com> + + On Mac, autocorrection sometimes fails to take place in Safari. + https://bugs.webkit.org/show_bug.cgi?id=89982 + + Reviewed by Ryosuke Niwa. + + We should check the value of shouldCheckForCorrection, not shouldShowCorrectionPanel, to determine if we should + early return in markAndReplaceFor(). Also, since we don't want autocorrection to happen when we only change selection, + not the content, so we shouldn't set TextCheckingTypeCorrection flag in markMisspellingsAndBadGrammar() as this function + is triggered only by selection change. + + * editing/Editor.cpp: + (WebCore::Editor::markAndReplaceFor): + (WebCore::Editor::markMisspellingsAndBadGrammar): + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122361. + http://trac.webkit.org/changeset/122361 + https://bugs.webkit.org/show_bug.cgi?id=91027 + + Broke Windows build and fast/forms/state-restore-broken- + state.html (Requested by rniwa on #webkit). + + * testing/Internals.idl: + +2012-07-10 Simon Fraser <simon.fraser@apple.com> + + Assertion ASSERTION FAILED: enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQuad(result).boundingBox()) when compositing in paginated mode + https://bugs.webkit.org/show_bug.cgi?id=90919 + + Reviewed by Antti Koivisto. + + r121124 added a fast path for geometry mapping that goes via layers + when possible. However, this broke paginated pages, which put + the root (RenderView) layer into column mode, because it failed + to check for columns on the ancestor layer. + + Rather than make a risky change to convertToLayerCoords(), add a local + function canMapViaLayer(), which is like RenderLayer::canUseConvertToLayerCoords(), + but doesn't check for compositing (compositing itself is not a reason + to avoid convertToLayerCoords). Call canMapViaLayer() with the ancestorLayer + to check whether the ancestor has columns, which fixes the bug. + + Test: compositing/columns/geometry-map-paginated-assert.html + + * rendering/RenderGeometryMap.cpp: + (WebCore::canMapViaLayer): + (WebCore::RenderGeometryMap::pushMappingsToAncestor): + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Rename layerRect to contentRect for rects that live in content space + https://bugs.webkit.org/show_bug.cgi?id=90843 + + Reviewed by Adrienne Walker. + + Dropped the layerTransform() from CCSharedQuadState, as nothing should be + using it to draw with. RenderPasses need a weird drawTransform right now + which was stored in layerTransform, so moved this to the RenderPass quad. + + No new tests. No change in behaviour. + + * platform/graphics/chromium/CanvasLayerTextureUpdater.cpp: + (WebCore::CanvasLayerTextureUpdater::paintContents): + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::update): + (WebCore::ContentLayerChromium::needMoreUpdates): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::update): + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::visibleContentOpaqueRegion): + * platform/graphics/chromium/LayerChromium.h: + (WebCore::LayerChromium::visibleContentRect): + (WebCore::LayerChromium::setVisibleContentRect): + (LayerChromium): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawRenderPassQuad): + (WebCore::LayerRendererChromium::drawTileQuad): + (WebCore::LayerRendererChromium::drawYUVVideoQuad): + (WebCore::LayerRendererChromium::drawStreamVideoQuad): + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::updateBounds): + (WebCore::TiledLayerChromium::setNeedsDisplayRect): + (WebCore::TiledLayerChromium::invalidateContentRect): + (WebCore::TiledLayerChromium::updateTiles): + (WebCore::TiledLayerChromium::setTexturePriorities): + (WebCore::TiledLayerChromium::setTexturePrioritiesInRect): + (WebCore::TiledLayerChromium::visibleContentOpaqueRegion): + (WebCore::TiledLayerChromium::updateContentRect): + (WebCore::TiledLayerChromium::needsIdlePaint): + (WebCore::TiledLayerChromium::idlePaintRect): + * platform/graphics/chromium/TiledLayerChromium.h: + (TiledLayerChromium): + * platform/graphics/chromium/cc/CCDrawQuad.h: + (WebCore::CCDrawQuad::visibleContentRect): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::createSharedQuadState): + (WebCore::CCLayerImpl::appendDebugBorderQuad): + (WebCore::CCLayerImpl::visibleContentOpaqueRegion): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore::CCLayerImpl::visibleContentRect): + (WebCore::CCLayerImpl::setVisibleContentRect): + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerTilingData.cpp: + (WebCore::CCLayerTilingData::contentRectToTileIndices): + (WebCore::CCLayerTilingData::opaqueRegionInContentRect): + (WebCore::CCLayerTilingData::setBounds): + * platform/graphics/chromium/cc/CCLayerTilingData.h: + (CCLayerTilingData): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateVisibleContentRect): + (WebCore::layerShouldBeSkipped): + (WebCore): + (WebCore::calculateVisibleAndScissorRectsInternal): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::addOcclusionBehindLayer): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::drawTransform): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::createSharedQuadState): + (WebCore::CCRenderSurface::createReplicaSharedQuadState): + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCSharedQuadState.cpp: + (WebCore::CCSharedQuadState::create): + (WebCore::CCSharedQuadState::CCSharedQuadState): + (WebCore::CCSharedQuadState::isLayerAxisAlignedIntRect): + * platform/graphics/chromium/cc/CCSharedQuadState.h: + (CCSharedQuadState): + (WebCore::CCSharedQuadState::visibleContentRect): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::appendQuads): + (WebCore::CCTiledLayerImpl::visibleContentOpaqueRegion): + +2012-07-11 Chris Fleizach <cfleizach@apple.com> + + ARIA spinbutton role incorrectly mapped to ProgressIndicatorRole + https://bugs.webkit.org/show_bug.cgi?id=77298 + + Reviewed by Anders Carlsson. + + * accessibility/AccessibilityObject.cpp: + (WebCore::createARIARoleMap): + +2012-07-11 Huang Dongsung <luxtella@company100.net> + + BitmapImage::frameIsCompleteAtIndex() must return false if ImageDecoder is not initialized. + https://bugs.webkit.org/show_bug.cgi?id=90757 + + Reviewed by Simon Fraser. + + The current code fortunately has worked so far because only + BitmapImage::startAnimation calls frameIsCompleteAtIndex, and startAnimation + cannot call frameIsCompleteAtIndex if ImageDecoder is not yet initialized. + startAnimation returns at the first line becase shouldAnimate() always return + false in this case. + + if (m_frameTimer || !shouldAnimate() || frameCount() <= 1) + return; + + This change is needed because parallel image decoders call + BitmapImage::frameIsCompleteAtIndex in other places too. + + No new tests, manually tested whether the caller exists or not that + calls BitmapImage::frameIsCompleteAtIndex() before ImageDecoder is + initialized. + + * platform/graphics/BitmapImage.cpp: + (WebCore::BitmapImage::frameIsCompleteAtIndex): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Update code to use the new constant name. + + * platform/wx/PasteboardWx.cpp: + (WebCore::Pasteboard::documentFragment): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Ignore array and sequence types for attributes as well + as functions since the CPP bindings do not yet support them. + + * bindings/scripts/CodeGeneratorCPP.pm: + (SkipAttribute): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Use DOMStringList instead of DOMString[] for in / out type. + + * testing/Internals.idl: + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Minimum size used for occlusion tracking should be a setting on CCLayerTreeHost + https://bugs.webkit.org/show_bug.cgi?id=90993 + + Reviewed by Adrienne Walker. + + Move the default minimum size used for occlusion tracking from the + CCOcclusionTracker class into CCLayerTreeSettings. This value is then + used on both threads as the lower limit for any occlusion to be + remembered. + + This allows us to use (0, 0) as the minimum size for tests, allowing all + occlusion to be tracked. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::paintLayerContents): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore::CCLayerTreeSettings::CCLayerTreeSettings): + (CCLayerTreeSettings): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCOcclusionTracker.h: + +2012-07-11 Anders Carlsson <andersca@apple.com> + + Add -Wtautological-compare and -Wsign-compare warning flags + https://bugs.webkit.org/show_bug.cgi?id=90994 + + Reviewed by Mark Rowe. + + * Configurations/Base.xcconfig: + +2012-07-11 Dean Jackson <dino@apple.com> + + TileCache layers have wrong border debug color + https://bugs.webkit.org/show_bug.cgi?id=90922 + + Reviewed by Simon Fraser. + + Commit r122152 updated the layer hierarchy when a tile + cache is being used by the view. As part of that, GraphicsLayerClient::shouldUseTileCache() + was changed to return false in some situations (the idea was that it + should only be called from the createGraphicsLayer method). However + there were two other call points: one that sets the debug colors on + borders, the other was a call that keeps the document background in sync. + + Add a new method usingTileCache() that returns the current state. Also fix + a FIXME where the debug code always called into the client rather than + caching the value on the GraphicsLayer. + + Test: compositing/document-background-color.html + + * platform/graphics/GraphicsLayer.cpp: + (WebCore::GraphicsLayer::GraphicsLayer): + (WebCore::GraphicsLayer::updateDebugIndicators): check the local variable when + setting the debug colors. + * platform/graphics/GraphicsLayer.h: + (GraphicsLayer): new bool member variable m_usingTileCache. + * platform/graphics/GraphicsLayerClient.h: + (WebCore::GraphicsLayerClient::usingTileCache): new virtual method to query if + this client is actually using the tile cache. + * platform/graphics/ca/GraphicsLayerCA.cpp: + (WebCore::GraphicsLayerCA::GraphicsLayerCA): set the member variable m_usingTileCache + if the GraphicsLayerClient says we are. + * rendering/RenderLayerBacking.h: + (WebCore::RenderLayerBacking::usingTileCache): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::documentBackgroundColorDidChange): call usingTileCache() + rather than shouldUseTileCache(), because the latter's value might not always reflect + the existence of a cache. + +2012-07-11 Ryosuke Niwa <rniwa@webkit.org> + + Clang build fix after r122345. + Also let XCode do its own thing. + + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLCollection.cpp: + (WebCore::HTMLCollectionWithArrayStorage::item): + * html/HTMLCollection.h: + (HTMLCollectionWithArrayStorage): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::itemInArrayAfter): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::itemInArrayAfter): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): + +2012-07-11 Arnaud Renevier <a.renevier@sisa.samsung.com> + + [Gtk] allow building with css-filters + https://bugs.webkit.org/show_bug.cgi?id=90908 + + Reviewed by Eric Seidel. + + Add support for css-filters in Source/WebCore/GNUmakefile.am + configure.ac + + No functional change, so no new tests. + + * GNUmakefile.am: + +2012-07-10 Ryosuke Niwa <rniwa@webkit.org> + + HTMLFormCollection::item and HTMLPropertiesCollection::item should share code + https://bugs.webkit.org/show_bug.cgi?id=90932 + + Reviewed by Anders Carlsson. + + Merged HTMLFormCollection::item and HTMLPropertiesCollection::item as HTMLCollectionWithArrayStorage::item, + which can be merged into HTMLCollection::item in a follow up patch. + + Also moved the call to invalidateCacheIfNeeded into HTMLCollection::updateNameCache() as done in + HTMLPropertiesCollection. + + In addition, moved the early bail out for when the base element doesn't have itemscope attribute from individual + functions to updateRefElements so that HTMLCollectionWithArrayStorage::item doesn't need to have this check. + + * html/HTMLCollection.cpp: + (WebCore::HTMLCollectionWithArrayStorage::item): Added. It's based on HTMLPropertiesCollection::item but it only + has the single loop (as supposed to nested loops) as HTMLFormCollection doesn't have multiple items per element + in the array unlike HTMLPropertiesCollection. In addition, offsetInArray (was i in HTMLPropertiesCollection::item) is + incremented in each itemAfter due to this semantic difference in each itemAfter. + (WebCore::HTMLCollection::updateNameCache): + (WebCore::HTMLCollection::hasNamedItem): + (WebCore::HTMLCollection::namedItems): + * html/HTMLCollection.h: + (HTMLCollectionWithArrayStorage): + (WebCore::HTMLCollectionWithArrayStorage::HTMLCollectionWithArrayStorage): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::HTMLFormCollection): + (WebCore::HTMLFormCollection::calcLength): Merged numberOfFormControlElements since it was only called here. + (WebCore::HTMLFormCollection::itemAfter): Added. HTMLFormCollection has exactly one item per element in the array + so we increment the offset in each iteration. Note that when we're continuing a search, we need to increment + the offset in order to avoid returning the same item. + (WebCore::HTMLFormCollection::updateNameCache): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + (WebCore::HTMLPropertiesCollection::updateRefElements): Set m_hasItemRefElements true upfront since we never fail to + update ref elements. Bail out as soon as we cleared the m_itemRefElements when the base element doesn't have itemscope + content attribute. + (WebCore::HTMLPropertiesCollection::itemAfter): Added. We reset previousItem to null because the existing itemAfter + requires previousItem be null when we're moving to a new entry in m_itemRefElements. + (WebCore::HTMLPropertiesCollection::calcLength): + (WebCore::HTMLPropertiesCollection::cacheFirstItem): + (WebCore::HTMLPropertiesCollection::updateNameCache): Merged findProperties since this was the only caller. + (WebCore::HTMLPropertiesCollection::names): + (WebCore::HTMLPropertiesCollection::namedItem): + (WebCore::HTMLPropertiesCollection::hasNamedItem): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): Made updateRefElements public as it's called in HTMLCollectionWithArrayStorage::item. + +2012-07-11 Sami Kyostila <skyostil@chromium.org> + + RenderView layer is marked as fixed position container in the scrolling tree if page scale != 1 + https://bugs.webkit.org/show_bug.cgi?id=89216 + + Reviewed by Simon Fraser. + + Render layers with CSS transforms should become containers for any fixed + positioned descendants. However, because this check is done with + RenderLayer::hasTransform(), we also end up marking the RenderLayer for the + RenderView as fixed position container if a non-identity page scale factor is + used. This is because page scale is applied as a transform for that layer. + + This breaks fixed position layers, because they become fixed relative to the + RenderView layer instead of outer scroll clip layer. + + The fix is to avoid marking any root layers as fixed position containers. + + No new test because the scrolling tree isn't currently testable. + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + +2012-07-11 Julien Chaffraix <jchaffraix@webkit.org> + + REGRESSION (r116203): overflow sections don't have scrollbars + https://bugs.webkit.org/show_bug.cgi?id=90052 + + Reviewed by Simon Fraser. + + This issue stems from RenderLayers with overlay scrollbars not being considered + self-painting. + + After r120395 (follow-up of r116203), we ignore subtrees that have no self-painting layer for + painting. Normal scrollbars are painted by their renderer so they were properly painted. However + overlay scrollbars need to be painted by their RenderLayer as a separate phase (see bug 57057) so + they were not painted anymore. The fix is simple: make RenderLayer with overlay scrollbars + self-painting as they should have been in the first place. + + Unfortunately no tests as I don't think we have a good way of testing overlay + scrollbars. Tested manually though on the super simple test case from the bug. + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::shouldBeSelfPaintingLayer): + Overlay scrollbars make the layer self-painting. + + (WebCore::RenderLayer::updateScrollbarsAfterLayout): + Added a call to updateSelfPaintingLayer. + + (WebCore::RenderLayer::styleChanged): + Moved the call to updateSelfPaintingLayer after recomputing the scrollbars to ensure proper behavior. + Added a comment underlining the reason. + + (WebCore::RenderLayer::updateSelfPaintingLayer): + Renamed as it is now called during layout too. + + * rendering/RenderLayer.h: + (RenderLayer): Updated after updateSelfPaintingLayer rename. + +2012-07-11 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + NodesFromRect doesn't work on SVG root elements. + https://bugs.webkit.org/show_bug.cgi?id=89990 + + Reviewed by Antonio Gomes. + + Adds support for rect-based hit-testing on the SVG root element. + This means that while rect-based hit-testing is still not supported + within SVG elements, that at least it works on SVG root elements as + it would on any other replaced element. + + Test: fast/dom/nodesFromRect-svg.html + + * rendering/svg/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::nodeAtPoint): + +2012-07-11 Joshua Netterfield <jnetterfield@rim.com> + + [Qt] REGRESSION(r122250): It broke USE(3D_GRAPHICS)=1 and ENABLE(WEBGL)=0 builds + https://bugs.webkit.org/show_bug.cgi?id=90943 + + Reviewed by Csaba Osztrogonác. + + Uses proper guarding in Extensions3DOpenGLCommon and Extensions3DOpenGLES as per https://bugs.webkit.org/show_bug.cgi?id=90506. + + No new tests, becasue there is no new functionality. + + * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: Use proper guarding. + * platform/graphics/opengl/Extensions3DOpenGLES.cpp: Use proper guarding. + +2012-07-10 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: migrate from background images to CSS for statusbar rendering. + https://bugs.webkit.org/show_bug.cgi?id=90902 + + Reviewed by Vsevolod Vlasov. + + This change removes statusbar* images and uses gradients and borders to re-create original inspector look. + + * WebCore.gypi: + * inspector/front-end/Images/statusbarBackground.png: Removed. + * inspector/front-end/Images/statusbarBottomBackground.png: Removed. + * inspector/front-end/Images/statusbarButtons.png: Removed. + * inspector/front-end/Images/statusbarMenuButton.png: Removed. + * inspector/front-end/Images/statusbarMenuButtonSelected.png: Removed. + * inspector/front-end/StatusBarButton.js: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: + (body.drawer-visible #main-status-bar): + (body.drawer-visible #main-status-bar::after): + (.status-bar-background): + (.status-bar > div): + (.glyph): + (button.status-bar-item): + (.status-bar button.status-bar-item:active): + (select.status-bar-item): + (select.status-bar-item, select.status-bar-item:hover): + (body.detached .alternate-status-bar-buttons-bar): + (.alternate-status-bar-buttons-bar): + (.alternate-status-bar-buttons-bar .status-bar-item): + (.alternate-status-bar-buttons-bar .status-bar-item.emulate-active): + (#drawer): + (body.drawer-visible #drawer-contents): + (#drawer-status-bar): + * inspector/front-end/inspector.html: + * inspector/front-end/scriptsPanel.css: + (button.status-bar-item.scripts-navigator-show-hide-button): + (button.status-bar-item.scripts-navigator-show-hide-button:active): + (button.status-bar-item.scripts-debugger-show-hide-button): + (button.status-bar-item.scripts-debugger-show-hide-button:active): + +2012-07-11 Jason Liu <jason.liu@torchmobile.com.cn> + + [BlackBerry] crash in CookieDatabaseBackingStore. + https://bugs.webkit.org/show_bug.cgi?id=90270 + + Reviewed by George Staikos. + + There is one case for this crash. + 1. A browser crashes and locks cookies' database for a while. + 2. Open a new browser when the old one doesn't finish crashing. + 3. The new one writes the cookies' database and receives a SQLITE_BUSY error + in CookieDatabaseBackingStore's invokeOpen. So this database isn't opened. + 4. invokeGetCookiesWithLimit returns 0. + 5. Crash happens when using a null pointer. + + Add function setBusyTimeout(1000) and a guard for cookies' pointer. + setBusyTimeout will call sqlite3_busy_timeout. + + When the SQLite database is accessed for reading it is locked for writing + until the reading access is finished. Another process cannot access the database + while it is locked. The timeout time sets a limit while this process tries to access + the locked database. If the database is unlocked within the timeout time it can be + accessed, otherwise an access fails. + + No new tests. This crash is hard to reproduce, and it happens only on our platform. + + * platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp: + (WebCore::CookieDatabaseBackingStore::getCookiesFromDatabase): + +2012-07-11 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Move revisions support to UISourceCode. + https://bugs.webkit.org/show_bug.cgi?id=90888 + + Reviewed by Pavel Feldman. + + Moved revisions support to UISourceCode. + Revision management code is moved unchanged where possible and should be refactored later. + + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleModelResourceBinding.prototype._innerStyleSheetChanged): revision is now added to uiSourceCode, not resource. + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer.prototype._notifyUISourceCodeContentCommitted): + Extension server is now listening for Workspace.UISourceCodeContentCommitted event instead of ResourceTreeModel.ResourceContentCommitted. + * inspector/front-end/Resource.js: + * inspector/front-end/ResourceTreeModel.js: ResourceTreeModel.ResourceContentCommitted renamed to Workspace.UISourceCodeContentCommitted. + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceSourceFrame): ResourceSourceFrame is not update when revisions are added anymore as resource conenten is considered immutable now + * inspector/front-end/RevisionHistoryView.js: + (WebInspector.RevisionHistoryView.populateRevisions): + (WebInspector.RevisionHistoryView): + (WebInspector.RevisionHistoryView.showHistory): + (WebInspector.RevisionHistoryView.prototype._createUISourceCodeItem): + (WebInspector.RevisionHistoryView.prototype._revisionAdded.get if): + (WebInspector.RevisionHistoryView.prototype._revisionAdded): + (WebInspector.RevisionHistoryView.prototype._revealUISourceCode.get if): + (WebInspector.RevisionHistoryView.prototype._revealUISourceCode): + (WebInspector.RevisionHistoryView.prototype._reset): + * inspector/front-end/ScriptSnippetModel.js: Snippets are not loaded before ResourceTreeModel.mainFrame is available anymore. + (WebInspector.ScriptSnippetModel): + (WebInspector.ScriptSnippetModel.prototype._setScriptSnippetContent): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode): + (WebInspector.UISourceCode.prototype.requestOriginalContent): + (WebInspector.UISourceCode.prototype._setContent): + (WebInspector.UISourceCode.prototype.addRevision): + (WebInspector.UISourceCode.prototype._restoreRevisionHistory): + (WebInspector.UISourceCode.prototype._clearRevisionHistory): + (WebInspector.UISourceCode.prototype.revertToOriginal): + (WebInspector.UISourceCode.prototype.revertAndClearHistory): + (WebInspector.UISourceCode.prototype.revertAndClearHistory.clearHistory): + (WebInspector.UISourceCode.prototype.commitWorkingCopy): + (WebInspector.UISourceCode.prototype.canonicalMimeType): + (WebInspector.Revision): + (WebInspector.Revision._revisionHistoryRegistry): + (WebInspector.Revision._ensureStaleRevisionsFileteredOut.persist): + (WebInspector.Revision._ensureStaleRevisionsFileteredOut): + (WebInspector.Revision.prototype.get uiSourceCode): + (WebInspector.Revision.prototype.get timestamp): + (WebInspector.Revision.prototype.get content): + (WebInspector.Revision.prototype.revertToThis): + (WebInspector.Revision.prototype.contentURL): + (WebInspector.Revision.prototype.contentType): + (WebInspector.Revision.prototype.requestContent): + (WebInspector.Revision.prototype.searchInContent): + (WebInspector.Revision.prototype._persist): + * inspector/front-end/UserAgentSupport.js: Drive-by closure compilation fix. + * inspector/front-end/Workspace.js: + * inspector/front-end/inspector.js: ScriptSnippetModel is now created after ResourceTreeModel. + +2012-07-11 MORITA Hajime <morrita@google.com> + + WebCoreSupport needs objects each of which follows major WebCore objects + https://bugs.webkit.org/show_bug.cgi?id=88499 + + Reviewed by Alexey Proskuryakov. + + This change + + - Makes Internals rough lifetime to follow Document. + Note that Internals can survive longer than Document in same case. + Internals::m_document is cleared when the document destruction is notified. + - Makes InternalSettings rough lifetime to follow the Page. + This is done by making InternalSettings a supplement of the page. + Now InternalSettings object is created per Page instead of per Frame. + + Per-test setting clearance is done by newly introduced InternalSettings::Backup, + which recovers the modified settings and refreshes it for each time a test starts. + + * WebCore.exp.in: + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::Backup): + (WebCore): + (WebCore::InternalSettings::Backup::restoreTo): + (WebCore::InternalSettings::from): + (WebCore::InternalSettings::~InternalSettings): + (WebCore::InternalSettings::InternalSettings): + (WebCore::InternalSettings::reset): + (WebCore::InternalSettings::settings): + (WebCore::InternalSettings::setFixedElementsLayoutRelativeToFrame): + (WebCore::InternalSettings::setFixedPositionCreatesStackingContext): + (WebCore::InternalSettings::allowRoundingHacks): + (WebCore::InternalSettings::userPreferredLanguages): + (WebCore::InternalSettings::setUserPreferredLanguages): + (WebCore::InternalSettings::setShouldDisplayTrackKind): + (WebCore::InternalSettings::shouldDisplayTrackKind): + (WebCore::InternalSettings::setPagination): + * testing/InternalSettings.h: + (Backup): + (InternalSettings): + (WebCore::InternalSettings::page): + * testing/InternalSettings.idl: + * testing/Internals.cpp: + (WebCore::Internals::Internals): + (WebCore): + (WebCore::Internals::contextDocument): + (WebCore::Internals::frame): + (WebCore::Internals::settings): + (WebCore::Internals::setPagination): Replaced as an alias. + (WebCore::Internals::userPreferredLanguages): Replaced as an alias. + (WebCore::Internals::setUserPreferredLanguages): Replaced as an alias. + (WebCore::Internals::setShouldDisplayTrackKind): Replaced as an alias. + (WebCore::Internals::shouldDisplayTrackKind): Replaced as an alias. + (WebCore::Internals::emitInspectorDidBeginFrame): + (WebCore::Internals::emitInspectorDidCancelFrame): + (WebCore::Internals::allowRoundingHacks): Replaced as an alias. + * testing/Internals.h: + (WebCore): + (Internals): + * testing/js/WebCoreTestSupport.cpp: + (WebCoreTestSupport::injectInternalsObject): + (WebCoreTestSupport::resetInternalsObject): + * testing/v8/WebCoreTestSupport.cpp: + (WebCoreTestSupport::injectInternalsObject): + (WebCoreTestSupport::resetInternalsObject): + 2012-07-11 Yoshifumi Inoue <yosin@chromium.org> [Mac] Expose time format related functions diff --git a/Source/WebCore/Configurations/Base.xcconfig b/Source/WebCore/Configurations/Base.xcconfig index 5fd5eb748..b82dde170 100644 --- a/Source/WebCore/Configurations/Base.xcconfig +++ b/Source/WebCore/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors; +COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; @@ -51,6 +51,7 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_SIGN_COMPARE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); @@ -124,15 +125,12 @@ GCC_GENERATE_DEBUGGING_SYMBOLS_macosx_1070 = YES; GCC_GENERATE_DEBUGGING_SYMBOLS_macosx_1080 = YES; GCC_GENERATE_DEBUGGING_SYMBOLS_macosx_1090 = YES; -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 158c88c90..6ab4bc3da 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -719,4 +719,4 @@ localizedStrings["CPU Time"] = "CPU Time"; localizedStrings["Encoded Data Length"] = "Encoded Data Length"; localizedStrings["%d Bytes"] = "%d Bytes"; localizedStrings["Time End"] = "Time End"; -localizedStrings["Search:"] = "Search:"; +localizedStrings["Find"] = "Find"; diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index b825f0b7a..18465f9f1 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -17,6 +17,7 @@ webcore_cppflags += \ -I$(srcdir)/Source/WebCore/Modules/indexeddb \ -I$(srcdir)/Source/WebCore/Modules/mediastream \ -I$(srcdir)/Source/WebCore/Modules/notifications \ + -I$(srcdir)/Source/WebCore/Modules/protocolhandler \ -I$(srcdir)/Source/WebCore/Modules/webaudio \ -I$(srcdir)/Source/WebCore/Modules/webdatabase \ -I$(srcdir)/Source/WebCore/Modules/websockets \ @@ -487,6 +488,15 @@ webcore_cppflags += -DENABLE_CSS_REGIONS=1 endif # END ENABLE_CSS_REGIONS # ---- +# Filters +# ---- +if ENABLE_CSS_FILTERS +FEATURE_DEFINES += ENABLE_CSS_FILTERS=1 +webcore_cppflags += -DENABLE_CSS_FILTERS=1 + +endif # END ENABLE_CSS_FILTERS + +# ---- # Exclusions # ---- if ENABLE_CSS_EXCLUSIONS diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index 3781727aa..c79f8db82 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -713,6 +713,7 @@ dom_binding_idls += \ $(WebCore)/Modules/notifications/Notification.idl \ $(WebCore)/Modules/notifications/NotificationCenter.idl \ $(WebCore)/Modules/notifications/NotificationPermissionCallback.idl \ + $(WebCore)/Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl \ $(WebCore)/Modules/webaudio/AudioContext.idl \ $(WebCore)/Modules/webaudio/AudioPannerNode.idl \ $(WebCore)/Modules/webaudio/DynamicsCompressorNode.idl \ @@ -1206,6 +1207,8 @@ webcore_modules_sources += \ Source/WebCore/Modules/notifications/NotificationPermissionCallback.h \ Source/WebCore/Modules/notifications/WorkerContextNotifications.cpp \ Source/WebCore/Modules/notifications/WorkerContextNotifications.h \ + Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp \ + Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.h \ Source/WebCore/Modules/webdatabase/AbstractDatabase.cpp \ Source/WebCore/Modules/webdatabase/AbstractDatabase.h \ Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp \ @@ -1939,6 +1942,10 @@ webcore_sources += \ Source/WebCore/dom/GenericEventQueue.h \ Source/WebCore/dom/IconURL.cpp \ Source/WebCore/dom/IconURL.h \ + Source/WebCore/dom/IdTargetObserver.cpp \ + Source/WebCore/dom/IdTargetObserver.h \ + Source/WebCore/dom/IdTargetObserverRegistry.cpp \ + Source/WebCore/dom/IdTargetObserverRegistry.h \ Source/WebCore/dom/HashChangeEvent.h \ Source/WebCore/dom/KeyboardEvent.cpp \ Source/WebCore/dom/KeyboardEvent.h \ @@ -2074,6 +2081,8 @@ webcore_sources += \ Source/WebCore/dom/WebKitAnimationEvent.h \ Source/WebCore/dom/WebKitNamedFlow.cpp \ Source/WebCore/dom/WebKitNamedFlow.h \ + Source/WebCore/dom/WebKitNamedFlowCollection.cpp \ + Source/WebCore/dom/WebKitNamedFlowCollection.h \ Source/WebCore/dom/WebKitTransitionEvent.cpp \ Source/WebCore/dom/WebKitTransitionEvent.h \ Source/WebCore/dom/WheelEvent.cpp \ @@ -3045,8 +3054,6 @@ webcore_sources += \ Source/WebCore/page/Navigator.h \ Source/WebCore/page/NavigatorBase.cpp \ Source/WebCore/page/NavigatorBase.h \ - Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp \ - Source/WebCore/page/NavigatorRegisterProtocolHandler.h \ Source/WebCore/page/OriginAccessEntry.cpp \ Source/WebCore/page/OriginAccessEntry.h \ Source/WebCore/page/Page.cpp \ @@ -3285,6 +3292,7 @@ webcore_sources += \ Source/WebCore/platform/graphics/filters/SpotLightSource.cpp \ Source/WebCore/platform/graphics/filters/SpotLightSource.h \ Source/WebCore/platform/graphics/filters/arm/NEONHelpers.h \ + Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h \ Source/WebCore/platform/graphics/filters/arm/FECompositeArithmeticNEON.h \ Source/WebCore/platform/graphics/filters/arm/FEGaussianBlurNEON.h \ Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp \ @@ -3680,8 +3688,6 @@ webcore_sources += \ Source/WebCore/platform/SuddenTermination.h \ Source/WebCore/platform/Supplementable.h \ Source/WebCore/platform/SystemTime.h \ - Source/WebCore/platform/text/Base64.cpp \ - Source/WebCore/platform/text/Base64.h \ Source/WebCore/platform/text/BidiContext.cpp \ Source/WebCore/platform/text/BidiContext.h \ Source/WebCore/platform/text/BidiResolver.h \ @@ -6121,10 +6127,10 @@ webcore_sources += \ Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \ - Source/WebCore/platform/graphics/texmap/LayerTransform.cpp \ - Source/WebCore/platform/graphics/texmap/LayerTransform.h \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.h \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.h \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h \ Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \ @@ -6144,10 +6150,10 @@ webcore_sources += \ Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \ - Source/WebCore/platform/graphics/texmap/LayerTransform.cpp \ - Source/WebCore/platform/graphics/texmap/LayerTransform.h \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.h \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.h \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h \ Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \ diff --git a/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h b/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h index a79361caa..91e8c0583 100644 --- a/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h +++ b/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h @@ -43,7 +43,7 @@ class ScriptExecutionContext; class DataTransferItemFileSystem { public: - static PassRefPtr<Entry> webkitGetAsEntry(DataTransferItem*, ScriptExecutionContext*); + static PassRefPtr<Entry> webkitGetAsEntry(ScriptExecutionContext*, DataTransferItem*); private: DataTransferItemFileSystem(); diff --git a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp index bbdfb71c2..c0ed985df 100644 --- a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp +++ b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp @@ -46,7 +46,7 @@ namespace WebCore { // static -PassRefPtr<EntryArray> HTMLInputElementFileSystem::webkitEntries(HTMLInputElement* input, ScriptExecutionContext* scriptExecutionContext) +PassRefPtr<EntryArray> HTMLInputElementFileSystem::webkitEntries(ScriptExecutionContext* scriptExecutionContext, HTMLInputElement* input) { RefPtr<EntryArray> array = EntryArray::create(); diff --git a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h index 01a8bdb3b..ae8bf8912 100644 --- a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h +++ b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h @@ -41,7 +41,7 @@ class ScriptExecutionContext; class HTMLInputElementFileSystem { public: - static PassRefPtr<EntryArray> webkitEntries(HTMLInputElement*, ScriptExecutionContext*); + static PassRefPtr<EntryArray> webkitEntries(ScriptExecutionContext*, HTMLInputElement*); private: HTMLInputElementFileSystem(); diff --git a/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp b/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp index bd223a61a..7c32fef2e 100644 --- a/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp +++ b/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp @@ -51,7 +51,7 @@ namespace WebCore { // static -PassRefPtr<Entry> DataTransferItemFileSystem::webkitGetAsEntry(DataTransferItem* item, ScriptExecutionContext* scriptExecutionContext) +PassRefPtr<Entry> DataTransferItemFileSystem::webkitGetAsEntry(ScriptExecutionContext* scriptExecutionContext, DataTransferItem* item) { DataTransferItemPolicyWrapper* itemPolicyWrapper = static_cast<DataTransferItemPolicyWrapper*>(item); diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.cpp b/Source/WebCore/Modules/geolocation/GeolocationController.cpp index 6ff08d646..e1ace93a5 100644 --- a/Source/WebCore/Modules/geolocation/GeolocationController.cpp +++ b/Source/WebCore/Modules/geolocation/GeolocationController.cpp @@ -30,13 +30,11 @@ #include "GeolocationClient.h" #include "GeolocationPosition.h" -#include "InspectorInstrumentation.h" namespace WebCore { -GeolocationController::GeolocationController(Page* page, GeolocationClient* client) +GeolocationController::GeolocationController(Page*, GeolocationClient* client) : m_client(client) - , m_page(page) { } @@ -100,9 +98,6 @@ void GeolocationController::cancelPermissionRequest(Geolocation* geolocation) void GeolocationController::positionChanged(GeolocationPosition* position) { - position = InspectorInstrumentation::checkGeolocationPositionOrError(m_page, position); - if (!position) - return; m_lastPosition = position; Vector<RefPtr<Geolocation> > observersVector; copyToVector(m_observers, observersVector); diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.h b/Source/WebCore/Modules/geolocation/GeolocationController.h index bc61b9e4d..fc3b513b3 100644 --- a/Source/WebCore/Modules/geolocation/GeolocationController.h +++ b/Source/WebCore/Modules/geolocation/GeolocationController.h @@ -68,7 +68,6 @@ private: GeolocationController(Page*, GeolocationClient*); GeolocationClient* m_client; - Page* m_page; RefPtr<GeolocationPosition> m_lastPosition; typedef HashSet<RefPtr<Geolocation> > ObserversSet; diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp index 8be9d1d24..7e10cb1a5 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp @@ -63,70 +63,73 @@ IDBFactory::~IDBFactory() { } -PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext* context) +namespace { +static bool isContextValid(ScriptExecutionContext* context) { - if (!context->isDocument()) { - // FIXME: make this work with workers. - return 0; + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + return document->frame() && document->page(); } +#if !ENABLE(WORKERS) + if (context->isWorkerContext()) + return false; +#endif + return true; +} - Document* document = static_cast<Document*>(context); - if (!document->frame() || !document->page()) +static String getIndexedDBDatabasePath(ScriptExecutionContext* context) +{ + ASSERT(isContextValid(context)); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + return document->page()->group().groupSettings()->indexedDBDatabasePath(); + } +#if ENABLE(WORKERS) + WorkerContext* workerContext = static_cast<WorkerContext*>(context); + const GroupSettings* groupSettings = workerContext->groupSettings(); + if (groupSettings) + return groupSettings->indexedDBDatabasePath(); +#endif + return String(); +} +} + +PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext* context) +{ + if (!isContextValid(context)) return 0; - RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this), 0); - GroupSettings* groupSettings = document->page()->group().groupSettings(); - m_backend->getDatabaseNames(request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0); + m_backend->getDatabaseNames(request, context->securityOrigin(), context, getIndexedDBDatabasePath(context)); return request; } PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { - ASSERT(context->isDocument() || context->isWorkerContext()); - if (name.isNull()) { ec = IDBDatabaseException::IDB_TYPE_ERR; return 0; } - if (context->isDocument()) { - Document* document = static_cast<Document*>(context); - if (!document->frame() || !document->page()) - return 0; - Frame* frame = document->frame(); - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0); - m_backend->open(name, request.get(), context->securityOrigin(), frame, document->page()->group().groupSettings()->indexedDBDatabasePath()); - return request; - } -#if ENABLE(WORKERS) + if (!isContextValid(context)) + return 0; + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0); - WorkerContext* workerContext = static_cast<WorkerContext*>(context); - GroupSettings* groupSettings = workerContext->thread()->groupSettings(); - m_backend->openFromWorker(name, request.get(), context->securityOrigin(), workerContext, groupSettings ? groupSettings->indexedDBDatabasePath() : String()); + m_backend->open(name, request, context->securityOrigin(), context, getIndexedDBDatabasePath(context)); return request; -#else - return 0; -#endif } PassRefPtr<IDBVersionChangeRequest> IDBFactory::deleteDatabase(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { - if (!context->isDocument()) { - // FIXME: make this work with workers. - return 0; - } - - Document* document = static_cast<Document*>(context); - if (!document->frame() || !document->page()) - return 0; - if (name.isNull()) { ec = IDBDatabaseException::IDB_TYPE_ERR; return 0; } + if (!isContextValid(context)) + return 0; - RefPtr<IDBVersionChangeRequest> request = IDBVersionChangeRequest::create(document, IDBAny::createNull(), ""); - GroupSettings* groupSettings = document->page()->group().groupSettings(); - m_backend->deleteDatabase(name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); + RefPtr<IDBVersionChangeRequest> request = IDBVersionChangeRequest::create(context, IDBAny::createNull(), ""); + m_backend->deleteDatabase(name, request, context->securityOrigin(), context, getIndexedDBDatabasePath(context)); return request; } @@ -138,8 +141,8 @@ short IDBFactory::cmp(PassRefPtr<IDBKey> first, PassRefPtr<IDBKey> second, Excep if (!first->isValid() || !second->isValid()) { ec = IDBDatabaseException::DATA_ERR; return 0; - } - + } + return static_cast<short>(first->compare(second.get())); } diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp index 447ba7751..3cce0c375 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp @@ -35,7 +35,6 @@ #include "IDBDatabaseException.h" #include "IDBLevelDBBackingStore.h" #include "IDBTransactionCoordinator.h" -#include "SecurityOrigin.h" #include <wtf/Threading.h> #include <wtf/UnusedParam.h> @@ -81,7 +80,7 @@ void IDBFactoryBackendImpl::removeIDBBackingStore(const String& fileIdentifier) m_backingStoreMap.remove(fileIdentifier); } -void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDirectory) +void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const String& dataDirectory) { RefPtr<IDBBackingStore> backingStore = openBackingStore(securityOrigin, dataDirectory); if (!backingStore) { @@ -99,17 +98,7 @@ void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, callbacks->onSuccess(databaseNames.release()); } -void IDBFactoryBackendImpl::open(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDirectory) -{ - openInternal(name, callbacks, securityOrigin, dataDirectory); -} - -void IDBFactoryBackendImpl::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> securityOrigin, WorkerContext*, const String& dataDirectory) -{ - openInternal(name, callbacks, securityOrigin, dataDirectory); -} - -void IDBFactoryBackendImpl::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDirectory) +void IDBFactoryBackendImpl::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const String& dataDirectory) { const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin.get()); @@ -160,7 +149,7 @@ PassRefPtr<IDBBackingStore> IDBFactoryBackendImpl::openBackingStore(PassRefPtr<S return 0; } -void IDBFactoryBackendImpl::openInternal(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpSecurityOrigin, const String& dataDirectory) +void IDBFactoryBackendImpl::open(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpSecurityOrigin, ScriptExecutionContext*, const String& dataDirectory) { RefPtr<SecurityOrigin> securityOrigin = prpSecurityOrigin; const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin.get()); diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h index 20564a885..ca1d05282 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h @@ -29,6 +29,7 @@ #define IDBFactoryBackendImpl_h #include "IDBFactoryBackendInterface.h" +#include "SecurityOrigin.h" #include <wtf/HashMap.h> #include <wtf/text/StringHash.h> @@ -55,19 +56,15 @@ public: void addIDBBackingStore(const String& fileIdentifier, IDBBackingStore*); virtual void removeIDBBackingStore(const String& fileIdentifier); - virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); - - virtual void open(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); - virtual void openFromWorker(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, WorkerContext*, const String& dataDir); - virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); + virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir); + virtual void open(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir); + virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir); protected: IDBFactoryBackendImpl(); virtual PassRefPtr<IDBBackingStore> openBackingStore(PassRefPtr<SecurityOrigin>, const String& dataDir); private: - void openInternal(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, const String& dataDir); - typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap; IDBDatabaseBackendMap m_databaseBackendMap; diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h index 19a1c9784..44f5c786e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h @@ -53,11 +53,9 @@ public: static PassRefPtr<IDBFactoryBackendInterface> create(); virtual ~IDBFactoryBackendInterface() { } - virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir) = 0; - - virtual void open(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir) = 0; - virtual void openFromWorker(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, WorkerContext*, const String& dataDir) = 0; - virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir) = 0; + virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0; + virtual void open(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0; + virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp b/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp index 341e2cf72..92e845426 100644 --- a/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp @@ -59,7 +59,7 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::lowerBound(PassRefPtr<IDBKey> bound, bool o return 0; } - return IDBKeyRange::create(bound, 0, open ? LowerBoundOpen : LowerBoundClosed, UpperBoundClosed); + return IDBKeyRange::create(bound, 0, open ? LowerBoundOpen : LowerBoundClosed, UpperBoundOpen); } PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool open, ExceptionCode& ec) @@ -69,7 +69,7 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool o return 0; } - return IDBKeyRange::create(0, bound, LowerBoundClosed, open ? UpperBoundOpen : UpperBoundClosed); + return IDBKeyRange::create(0, bound, LowerBoundOpen, open ? UpperBoundOpen : UpperBoundClosed); } PassRefPtr<IDBKeyRange> IDBKeyRange::bound(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, bool lowerOpen, bool upperOpen, ExceptionCode& ec) diff --git a/Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp index 0d5eb89c9..0d5eb89c9 100644 --- a/Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp +++ b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp diff --git a/Source/WebCore/page/NavigatorRegisterProtocolHandler.h b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.h index 2193e01f4..2193e01f4 100644 --- a/Source/WebCore/page/NavigatorRegisterProtocolHandler.h +++ b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.h diff --git a/Source/WebCore/page/NavigatorRegisterProtocolHandler.idl b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl index 1bd57f2fe..1bd57f2fe 100644 --- a/Source/WebCore/page/NavigatorRegisterProtocolHandler.idl +++ b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl diff --git a/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp b/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp index 2bd5759ea..1f35e55a2 100644 --- a/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp +++ b/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp @@ -33,21 +33,25 @@ using namespace std; -const float SmoothingTimeConstant = 0.020f; // 20ms - namespace WebCore { +const float SmoothingTimeConstant = 0.020f; // 20ms + DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor) : AudioDSPKernel(processor) , m_writeIndex(0) , m_firstTime(true) { ASSERT(processor && processor->sampleRate() > 0); - if (!processor) + if (!(processor && processor->sampleRate() > 0)) return; m_maxDelayTime = processor->maxDelayTime(); - m_buffer.allocate(static_cast<size_t>(processor->sampleRate() * m_maxDelayTime)); + ASSERT(m_maxDelayTime >= 0); + if (m_maxDelayTime < 0) + return; + + m_buffer.allocate(bufferLengthForDelay(m_maxDelayTime, processor->sampleRate())); m_buffer.zero(); m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, processor->sampleRate()); @@ -63,7 +67,7 @@ DelayDSPKernel::DelayDSPKernel(double maxDelayTime, float sampleRate) if (maxDelayTime <= 0.0) return; - size_t bufferLength = static_cast<size_t>(sampleRate * maxDelayTime); + size_t bufferLength = bufferLengthForDelay(maxDelayTime, sampleRate); ASSERT(bufferLength); if (!bufferLength) return; @@ -74,6 +78,13 @@ DelayDSPKernel::DelayDSPKernel(double maxDelayTime, float sampleRate) m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate); } +size_t DelayDSPKernel::bufferLengthForDelay(double maxDelayTime, double sampleRate) const +{ + // Compute the length of the buffer needed to handle a max delay of |maxDelayTime|. One is + // added to handle the case where the actual delay equals the maximum delay. + return 1 + AudioUtilities::timeToSampleFrame(maxDelayTime, sampleRate); +} + void DelayDSPKernel::process(const float* source, float* destination, size_t framesToProcess) { size_t bufferLength = m_buffer.size(); diff --git a/Source/WebCore/Modules/webaudio/DelayDSPKernel.h b/Source/WebCore/Modules/webaudio/DelayDSPKernel.h index 1d556ea4e..62421eab5 100644 --- a/Source/WebCore/Modules/webaudio/DelayDSPKernel.h +++ b/Source/WebCore/Modules/webaudio/DelayDSPKernel.h @@ -58,6 +58,7 @@ private: double m_desiredDelayFrames; DelayProcessor* delayProcessor() { return static_cast<DelayProcessor*>(processor()); } + size_t bufferLengthForDelay(double delayTime, double sampleRate) const; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp b/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp index f7c836965..caddb9b58 100644 --- a/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp +++ b/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp @@ -36,7 +36,6 @@ #include "WebSocketHandshake.h" #include "WebSocket.h" -#include "Base64.h" #include "Cookie.h" #include "CookieJar.h" #include "Document.h" @@ -53,6 +52,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index b91497553..5dac2b05d 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -432,6 +432,7 @@ SOURCES += \ Modules/notifications/NotificationCenter.cpp \ Modules/notifications/NotificationController.cpp \ Modules/notifications/WorkerContextNotifications.cpp \ + Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp \ css/CSSAspectRatioValue.cpp \ css/CSSBorderImageSliceValue.cpp \ css/CSSBorderImage.cpp \ @@ -572,6 +573,8 @@ SOURCES += \ dom/ExceptionCodePlaceholder.cpp \ dom/GenericEventQueue.cpp \ dom/IconURL.cpp \ + dom/IdTargetObserver.cpp \ + dom/IdTargetObserverRegistry.cpp \ dom/KeyboardEvent.cpp \ dom/MessageChannel.cpp \ dom/MessageEvent.cpp \ @@ -637,6 +640,7 @@ SOURCES += \ dom/ViewportArguments.cpp \ dom/WebKitAnimationEvent.cpp \ dom/WebKitNamedFlow.cpp \ + dom/WebKitNamedFlowCollection.cpp \ dom/WebKitTransitionEvent.cpp \ dom/WheelEvent.cpp \ dom/WindowEventContext.cpp \ @@ -1041,7 +1045,6 @@ SOURCES += \ page/MouseEventWithHitTestResults.cpp \ page/Navigator.cpp \ page/NavigatorBase.cpp \ - page/NavigatorRegisterProtocolHandler.cpp \ page/OriginAccessEntry.cpp \ page/Page.cpp \ page/PageGroup.cpp \ @@ -1075,7 +1078,6 @@ SOURCES += \ platform/animation/Animation.cpp \ platform/animation/AnimationList.cpp \ platform/Arena.cpp \ - platform/text/Base64.cpp \ platform/text/BidiContext.cpp \ platform/text/DateTimeFormat.cpp \ platform/text/Hyphenation.cpp \ @@ -1119,6 +1121,8 @@ SOURCES += \ platform/graphics/Gradient.cpp \ platform/graphics/GraphicsContext.cpp \ platform/graphics/GraphicsLayer.cpp \ + platform/graphics/GraphicsLayerAnimation.cpp \ + platform/graphics/GraphicsLayerTransform.cpp \ platform/graphics/GraphicsTypes.cpp \ platform/graphics/Image.cpp \ platform/graphics/ImageBuffer.cpp \ @@ -1167,7 +1171,7 @@ SOURCES += \ platform/LinkHash.cpp \ platform/Logging.cpp \ platform/MemoryPressureHandler.cpp \ - platform/MemoryUsageSupport.cpp \ + platform/qt/MemoryUsageSupportQt.cpp \ platform/MIMETypeRegistry.cpp \ platform/mock/DeviceMotionClientMock.cpp \ platform/mock/DeviceOrientationClientMock.cpp \ @@ -1757,6 +1761,8 @@ HEADERS += \ dom/ExceptionBase.h \ dom/ExceptionCode.h \ dom/FragmentScriptingPermission.h \ + dom/IdTargetObserver.h \ + dom/IdTargetObserverRegistry.h \ dom/KeyboardEvent.h \ dom/MemoryInstrumentation.h \ dom/MessageChannel.h \ @@ -1818,6 +1824,7 @@ HEADERS += \ dom/ViewportArguments.h \ dom/WebKitAnimationEvent.h \ dom/WebKitNamedFlow.h \ + dom/WebKitNamedFlowCollection.h \ dom/WebKitTransitionEvent.h \ dom/WheelEvent.h \ editing/AlternativeTextController.h \ @@ -2274,6 +2281,7 @@ HEADERS += \ platform/graphics/filters/SourceAlpha.h \ platform/graphics/filters/SourceGraphic.h \ platform/graphics/filters/arm/NEONHelpers.h \ + platform/graphics/filters/arm/FEBlendNEON.h \ platform/graphics/filters/arm/FECompositeArithmeticNEON.h \ platform/graphics/filters/arm/FEGaussianBlurNEON.h \ platform/graphics/filters/arm/FELightingNEON.h \ @@ -2294,7 +2302,9 @@ HEADERS += \ platform/graphics/Gradient.h \ platform/graphics/GraphicsContext.h \ platform/graphics/GraphicsLayer.h \ + platform/graphics/GraphicsLayerAnimation.h \ platform/graphics/GraphicsLayerClient.h \ + platform/graphics/GraphicsLayerTransform.h \ platform/graphics/GraphicsTypes.h \ platform/graphics/GraphicsTypes3D.h \ platform/graphics/Image.h \ @@ -2318,9 +2328,7 @@ HEADERS += \ platform/graphics/SimpleFontData.h \ platform/graphics/surfaces/GraphicsSurface.h \ platform/graphics/texmap/GraphicsLayerTextureMapper.h \ - platform/graphics/texmap/LayerTransform.h \ platform/graphics/texmap/TextureMapper.h \ - platform/graphics/texmap/TextureMapperAnimation.h \ platform/graphics/texmap/TextureMapperBackingStore.h \ platform/graphics/texmap/TextureMapperImageBuffer.h \ platform/graphics/texmap/TextureMapperLayer.h \ @@ -2425,7 +2433,6 @@ HEADERS += \ platform/sql/SQLiteStatement.h \ platform/sql/SQLiteTransaction.h \ platform/sql/SQLValue.h \ - platform/text/Base64.h \ platform/text/BidiContext.h \ platform/text/DateTimeFormat.h \ platform/text/DecodeEscapeSequences.h \ @@ -2936,9 +2943,7 @@ SOURCES += \ platform/graphics/qt/PatternQt.cpp \ platform/graphics/qt/StillImageQt.cpp \ platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ - platform/graphics/texmap/LayerTransform.cpp \ platform/graphics/texmap/TextureMapper.cpp \ - platform/graphics/texmap/TextureMapperAnimation.cpp \ platform/graphics/texmap/TextureMapperBackingStore.cpp \ platform/graphics/texmap/TextureMapperImageBuffer.cpp \ platform/graphics/texmap/TextureMapperLayer.cpp \ @@ -4179,6 +4184,9 @@ contains(DEFINES, WTF_USE_GRAPHICS_SURFACE=1) { SOURCES += platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp INCLUDEPATH += /System/Library/Frameworks/CoreFoundation.framework/Headers } + contains(DEFINES, HAVE_XCOMPOSITE=1) { + SOURCES += platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp + } } # Make sure the derived sources are built diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 2fa7d5cf7..1b2618e7f 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -611,6 +611,9 @@ __ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiifNS_7IntSizeE __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv __ZN7WebCore26stopObservingCookieChangesEv +__ZN7WebCore26ContextDestructionObserverD2Ev +__ZN7WebCore26ContextDestructionObserverC2EPNS_22ScriptExecutionContextE +__ZN7WebCore26ContextDestructionObserver16contextDestroyedEv __ZN7WebCore27AuthenticationChallengeBaseC2Ev __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS1_6StringE __ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_21DeviceOrientationDataEEE @@ -1986,23 +1989,23 @@ __ZN7WebCore7IntSizeC1ERK7_NSSize __ZNK7WebCore7IntSizecv7_NSSizeEv #endif -#if defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 _wkGetNSEventMomentumPhase #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 _wkCALayerEnumerateRectsBeingDrawnWithBlock _wkCFURLRequestAllowAllPostCaching _wkCGPathAddRoundedRect _wkCreateCTTypesetterWithUniCharProviderAndOptions #endif -#if (!defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS)) && !PLATFORM(IOS_SIMULATOR) +#if (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !PLATFORM(IOS_SIMULATOR) _wkIOSurfaceContextCreate _wkIOSurfaceContextCreateImage #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 _wkAVAssetResolvedURL _wkCopyDefaultSearchProviderDisplayName _wkCreateVMPressureDispatchOnMainQueue @@ -2011,7 +2014,7 @@ _wkExecutableWasLinkedOnOrBeforeSnowLeopard _wkRecommendedScrollerStyle #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 _wkExecutableWasLinkedOnOrBeforeLion _wkFilterAddData _wkFilterCreateInstance @@ -2070,7 +2073,7 @@ __ZN7WebCore14ResourceHandle46setPrivateBrowsingStorageSessionIdentifierBaseERKN __ZN7WebCore14ResourceHandle21currentStorageSessionEv __ZN7WebCore14ResourceHandle29privateBrowsingStorageSessionEv __ZN7WebCore26currentCFHTTPCookieStorageEv -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 __ZN7WebCore14ResourceHandle24setDefaultStorageSessionEP21__CFURLStorageSession #else __ZN7WebCore14ResourceHandle24setDefaultStorageSessionEPK21__CFURLStorageSession @@ -2376,6 +2379,10 @@ __ZN7WebCore9FrameView25serviceScriptedAnimationsEy __ZN7WebCore22RuntimeEnabledFeatures18isShadowDOMEnabledE #endif +#if ENABLE(DIALOG_ELEMENT) +__ZN7WebCore22RuntimeEnabledFeatures22isDialogElementEnabledE +#endif + #if ENABLE(SVG) __ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE __ZN7WebCore8Document13svgExtensionsEv @@ -2540,7 +2547,7 @@ __ZNK7WebCore4KURL7isValidEv __ZNK7WebCore4KURL22protocolIsInHTTPFamilyEv #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 __ZN7WebCore27AlternativeTextUIController15addAlternativesERKN3WTF9RetainPtrI18NSTextAlternativesEE __ZN7WebCore27AlternativeTextUIController22alternativesForContextEy __ZN7WebCore27AlternativeTextUIController5clearEv diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index a53117419..c274e2f03 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -62,6 +62,7 @@ '../Modules/indexeddb', '../Modules/mediastream', '../Modules/notifications', + '../Modules/protocolhandler', '../Modules/quota', '../Modules/speech', '../Modules/webaudio', @@ -1055,6 +1056,7 @@ '--include', '../Modules/intents', '--include', '../Modules/mediastream', '--include', '../Modules/notifications', + '--include', '../Modules/protocolhandler', '--include', '../Modules/webaudio', '--include', '../Modules/webdatabase', '--include', '../css', @@ -1890,7 +1892,6 @@ ], 'dependencies': [ 'webcore_prerequisites', - '<(chromium_src_dir)/third_party/v8-i18n/build/all.gyp:v8-i18n', ], # This is needed for mac because of webkit_system_interface. It'd be nice # if this hard dependency could be split off the rest. @@ -2025,6 +2026,20 @@ ['exclude', 'Gtk\\.cpp$'], ], }], + ['OS=="android"', { + 'cflags': [ + # WebCore does not work with strict aliasing enabled. + # https://bugs.webkit.org/show_bug.cgi?id=25864 + '-fno-strict-aliasing', + ], + }, { # OS!="android" + 'dependencies': [ + # Android doesn't have this third party repository, so can't + # include it. It's not used by Android in any case. + '<(chromium_src_dir)/third_party/v8-i18n/build/all.gyp:v8-i18n', + ], + 'sources/': [['exclude', 'Android\\.cpp$']] + }], ['OS!="mac"', { 'sources/': [['exclude', 'Mac\\.(cpp|mm?)$']] }], diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 9b68d3ef3..f3f77ea43 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -243,6 +243,7 @@ 'page/PageGroup.h', 'page/PagePopup.h', 'page/PagePopupClient.h', + 'page/PagePopupDriver.h', 'page/PageSerializer.h', 'page/PageVisibilityState.h', 'page/PrintContext.h', @@ -490,7 +491,6 @@ 'platform/sql/SQLValue.h', 'platform/sql/SQLiteDatabase.h', 'platform/sql/SQLiteTransaction.h', - 'platform/text/Base64.h', 'platform/text/BidiRunList.h', 'platform/text/BidiContext.h', 'platform/text/BidiResolver.h', @@ -847,6 +847,7 @@ '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', @@ -1165,7 +1166,6 @@ 'page/Location.idl', 'page/MemoryInfo.idl', 'page/Navigator.idl', - 'page/NavigatorRegisterProtocolHandler.idl', 'page/PagePopupController.idl', 'page/Performance.idl', 'page/PerformanceEntry.idl', @@ -1581,6 +1581,8 @@ 'Modules/notifications/NotificationPermissionCallback.h', 'Modules/notifications/WorkerContextNotifications.cpp', 'Modules/notifications/WorkerContextNotifications.h', + 'Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp', + 'Modules/protocolhandler/NavigatorRegisterProtocolHandler.h', 'Modules/quota/DOMWindowQuota.cpp', 'Modules/quota/DOMWindowQuota.h', 'Modules/quota/StorageInfo.cpp', @@ -3060,8 +3062,6 @@ 'page/Navigator.h', 'page/NavigatorBase.cpp', 'page/NavigatorBase.h', - 'page/NavigatorRegisterProtocolHandler.cpp', - 'page/NavigatorRegisterProtocolHandler.h', 'page/OriginAccessEntry.cpp', 'page/OriginAccessEntry.h', 'page/Page.cpp', @@ -3492,6 +3492,10 @@ 'platform/graphics/GraphicsContext.cpp', 'platform/graphics/GraphicsContext3D.cpp', 'platform/graphics/GraphicsLayer.cpp', + 'platform/graphics/GraphicsLayerAnimation.cpp', + 'platform/graphics/GraphicsLayerAnimation.h', + 'platform/graphics/GraphicsLayerTransform.cpp', + 'platform/graphics/GraphicsLayerTransform.h', 'platform/graphics/GraphicsTypes.cpp', 'platform/graphics/Image.cpp', 'platform/graphics/ImageBuffer.cpp', @@ -3709,6 +3713,7 @@ 'platform/graphics/filters/SpotLightSource.cpp', 'platform/graphics/filters/SpotLightSource.h', 'platform/graphics/filters/arm/NEONHelpers.h', + 'platform/graphics/filters/arm/FEBlendNEON.h', 'platform/graphics/filters/arm/FECompositeArithmeticNEON.h', 'platform/graphics/filters/arm/FEGaussianBlurNEON.h', 'platform/graphics/filters/arm/FELightingNEON.cpp', @@ -3906,12 +3911,8 @@ 'platform/graphics/skia/TransformationMatrixSkia.cpp', 'platform/graphics/texmap/GraphicsLayerTextureMapper.cpp', 'platform/graphics/texmap/GraphicsLayerTextureMapper.h', - 'platform/graphics/texmap/LayerTransform.cpp', - 'platform/graphics/texmap/LayerTransform.h', 'platform/graphics/texmap/TextureMapper.cpp', 'platform/graphics/texmap/TextureMapper.h', - 'platform/graphics/texmap/TextureMapperAnimation.cpp', - 'platform/graphics/texmap/TextureMapperAnimation.h', 'platform/graphics/texmap/TextureMapperBackingStore.cpp', 'platform/graphics/texmap/TextureMapperBackingStore.h', 'platform/graphics/texmap/TextureMapperGL.cpp', @@ -4382,7 +4383,6 @@ 'platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp', 'platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp', 'platform/text/AtomicStringKeyedMRUCache.h', - 'platform/text/Base64.cpp', 'platform/text/BidiContext.cpp', 'platform/text/DateTimeFormat.cpp', 'platform/text/Hyphenation.cpp', @@ -5179,6 +5179,10 @@ 'dom/IgnoreDestructiveWriteCountIncrementer.h', 'dom/IconURL.cpp', 'dom/IconURL.h', + 'dom/IdTargetObserver.cpp', + 'dom/IdTargetObserver.h', + 'dom/IdTargetObserverRegistry.cpp', + 'dom/IdTargetObserverRegistry.h', 'dom/KeyboardEvent.cpp', 'dom/MemoryInstrumentation.h', 'dom/MessageChannel.cpp', @@ -5298,6 +5302,8 @@ 'dom/WebKitAnimationEvent.h', 'dom/WebKitNamedFlow.cpp', 'dom/WebKitNamedFlow.h', + 'dom/WebKitNamedFlowCollection.cpp', + 'dom/WebKitNamedFlowCollection.h', 'dom/WebKitTransitionEvent.cpp', 'dom/WebKitTransitionEvent.h', 'dom/WheelEvent.cpp', @@ -6187,6 +6193,8 @@ 'testing/Internals.h', 'testing/InternalSettings.cpp', 'testing/InternalSettings.h', + 'testing/MockPagePopupDriver.cpp', + 'testing/MockPagePopupDriver.h', ], 'webcore_resource_files': [ 'English.lproj/Localizable.strings', @@ -6541,12 +6549,7 @@ 'inspector/front-end/Images/spinnerInactiveSelected.gif', 'inspector/front-end/Images/splitviewDimple.png', 'inspector/front-end/Images/splitviewDividerBackground.png', - 'inspector/front-end/Images/statusbarBackground.png', - 'inspector/front-end/Images/statusbarBottomBackground.png', 'inspector/front-end/Images/statusbarButtonGlyphs.png', - 'inspector/front-end/Images/statusbarButtons.png', - 'inspector/front-end/Images/statusbarMenuButton.png', - 'inspector/front-end/Images/statusbarMenuButtonSelected.png', 'inspector/front-end/Images/statusbarResizerHorizontal.png', 'inspector/front-end/Images/statusbarResizerVertical.png', 'inspector/front-end/Images/successGreenDot.png', @@ -8196,6 +8199,15 @@ 'platform/chromium/support/GraphicsContext3DPrivate.cpp', 'platform/chromium/support/GraphicsContext3DPrivate.h', 'platform/chromium/support/WebAudioBus.cpp', + 'platform/chromium/support/WebCompositorCheckerboardQuad.cpp', + 'platform/chromium/support/WebCompositorDebugBorderQuad.cpp', + 'platform/chromium/support/WebCompositorIOSurfaceQuad.cpp', + 'platform/chromium/support/WebCompositorQuad.cpp', + 'platform/chromium/support/WebCompositorSharedQuadState.cpp', + 'platform/chromium/support/WebCompositorSolidColorQuad.cpp', + 'platform/chromium/support/WebCompositorStreamVideoQuad.cpp', + 'platform/chromium/support/WebCompositorTextureQuad.cpp', + 'platform/chromium/support/WebCompositorTileQuad.cpp', 'platform/chromium/support/WebData.cpp', 'platform/chromium/support/WebHTTPBody.cpp', 'platform/chromium/support/WebHTTPLoadInfo.cpp', @@ -8245,8 +8257,6 @@ 'platform/graphics/chromium/LayerTextureSubImage.cpp', 'platform/graphics/chromium/LayerTextureSubImage.h', 'platform/graphics/chromium/LayerTextureUpdater.h', - 'platform/graphics/chromium/ManagedTexture.cpp', - 'platform/graphics/chromium/ManagedTexture.h', 'platform/graphics/chromium/PlatformCanvas.cpp', 'platform/graphics/chromium/PlatformCanvas.h', 'platform/graphics/chromium/PlatformColor.h', @@ -8268,8 +8278,7 @@ 'platform/graphics/chromium/TextureCopier.h', 'platform/graphics/chromium/TextureLayerChromium.cpp', 'platform/graphics/chromium/TextureLayerChromium.h', - 'platform/graphics/chromium/TextureManager.cpp', - 'platform/graphics/chromium/TextureManager.h', + 'platform/graphics/chromium/TextureAllocator.h', 'platform/graphics/chromium/TextureUploader.h', 'platform/graphics/chromium/ThrottledTextureUploader.cpp', 'platform/graphics/chromium/ThrottledTextureUploader.h', @@ -8288,17 +8297,14 @@ 'platform/graphics/chromium/cc/CCAnimationCurve.cpp', 'platform/graphics/chromium/cc/CCAnimationCurve.h', 'platform/graphics/chromium/cc/CCAnimationEvents.h', - 'platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp', 'platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h', 'platform/graphics/chromium/cc/CCDamageTracker.cpp', 'platform/graphics/chromium/cc/CCDamageTracker.h', - 'platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp', 'platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h', 'platform/graphics/chromium/cc/CCDebugRectHistory.cpp', 'platform/graphics/chromium/cc/CCDebugRectHistory.h', 'platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp', 'platform/graphics/chromium/cc/CCDelayBasedTimeSource.h', - 'platform/graphics/chromium/cc/CCDrawQuad.cpp', 'platform/graphics/chromium/cc/CCDrawQuad.h', 'platform/graphics/chromium/cc/CCFontAtlas.cpp', 'platform/graphics/chromium/cc/CCFontAtlas.h', @@ -8309,7 +8315,6 @@ 'platform/graphics/chromium/cc/CCGestureCurve.h', 'platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp', 'platform/graphics/chromium/cc/CCHeadsUpDisplay.h', - 'platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp', 'platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h', 'platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp', 'platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h', @@ -8373,19 +8378,15 @@ 'platform/graphics/chromium/cc/CCScrollbarLayerImpl.h', 'platform/graphics/chromium/cc/CCSettings.cpp', 'platform/graphics/chromium/cc/CCSettings.h', - 'platform/graphics/chromium/cc/CCSharedQuadState.cpp', 'platform/graphics/chromium/cc/CCSharedQuadState.h', 'platform/graphics/chromium/cc/CCSingleThreadProxy.cpp', 'platform/graphics/chromium/cc/CCSingleThreadProxy.h', - 'platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp', 'platform/graphics/chromium/cc/CCSolidColorDrawQuad.h', 'platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp', 'platform/graphics/chromium/cc/CCSolidColorLayerImpl.h', - 'platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp', 'platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h', 'platform/graphics/chromium/cc/CCTexture.cpp', 'platform/graphics/chromium/cc/CCTexture.h', - 'platform/graphics/chromium/cc/CCTextureDrawQuad.cpp', 'platform/graphics/chromium/cc/CCTextureDrawQuad.h', 'platform/graphics/chromium/cc/CCTextureLayerImpl.cpp', 'platform/graphics/chromium/cc/CCTextureLayerImpl.h', @@ -8395,7 +8396,6 @@ 'platform/graphics/chromium/cc/CCThreadProxy.cpp', 'platform/graphics/chromium/cc/CCThreadProxy.h', 'platform/graphics/chromium/cc/CCThreadTask.h', - 'platform/graphics/chromium/cc/CCTileDrawQuad.cpp', 'platform/graphics/chromium/cc/CCTileDrawQuad.h', 'platform/graphics/chromium/cc/CCTiledLayerImpl.cpp', 'platform/graphics/chromium/cc/CCTiledLayerImpl.h', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index 3b2b3f651..e1abbec66 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -16000,7 +16000,6 @@ __ZN7WebCore20endOfEditableContentERKNS_15VisiblePositionE __ZNK7WebCore21BackForwardController9backCountEv __ZN7WebCore19BackForwardListImpl13backListCountEv __ZNK7WebCore21BackForwardController12forwardCountEv -__ZN7WebCore12base64DecodeERKN3WTF6StringERNS0_6VectorIcLm0EEENS_18Base64DecodePolicyE __ZN3WTF9HashTableINS_6StringESt4pairIS1_PNS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0EEEENS_18PairFirstExtractorISA_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSF_IS9_EEEESG_E16lookupForWritingIS1_NS_22IdentityHashTranslatorIS1_SA_SD_EEEES2_IPSA_bERKT_ __ZN3WTF9HashTableINS_6StringESt4pairIS1_PNS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0EEEENS_18PairFirstExtractorISA_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSF_IS9_EEEESG_E3addIS1_S9_NS_17HashMapTranslatorISA_SI_SD_EEEES2_INS_17HashTableIteratorIS1_SA_SC_SD_SI_SG_EEbERKT_RKT0_ __ZN3WTF9HashTableINS_6StringESt4pairIS1_PNS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0EEEENS_18PairFirstExtractorISA_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSF_IS9_EEEESG_E6lookupIS1_NS_22IdentityHashTranslatorIS1_SA_SD_EEEEPSA_RKT_ diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index 0d60155cf..b399bc292 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -8,7 +8,7 @@ SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/WebCore QT *= network sql -haveQt(5): QT *= gui-private +haveQt(5): QT *= core-private gui-private WEBCORE_GENERATED_SOURCES_DIR = $${ROOT_BUILD_DIR}/Source/WebCore/$${GENERATED_SOURCES_DESTDIR} @@ -18,6 +18,7 @@ INCLUDEPATH += \ $$SOURCE_DIR/Modules/geolocation \ $$SOURCE_DIR/Modules/indexeddb \ $$SOURCE_DIR/Modules/notifications \ + $$SOURCE_DIR/Modules/protocolhandler \ $$SOURCE_DIR/Modules/quota \ $$SOURCE_DIR/Modules/webaudio \ $$SOURCE_DIR/Modules/webdatabase \ @@ -203,6 +204,7 @@ contains(DEFINES, ENABLE_VIDEO=1) { 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 } diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 9062c8b23..53b224c3b 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -24927,6 +24927,18 @@ </File> </Filter> <Filter + Name="protocolhandler" + > + <File + RelativePath="..\Modules\protocolhandler\NavigatorRegisterProtocolHandler.cpp" + > + </File> + <File + RelativePath="..\Modules\protocolhandler\NavigatorRegisterProtocolHandler.h" + > + </File> + </Filter> + <Filter Name="quota" > <File @@ -26835,14 +26847,6 @@ > </File> <File - RelativePath="..\page\NavigatorRegisterProtocolHandler.cpp" - > - </File> - <File - RelativePath="..\page\NavigatorRegisterProtocolHandler.h" - > - </File> - <File RelativePath="..\page\OriginAccessEntry.cpp" > </File> @@ -31545,6 +31549,10 @@ > </File> <File + RelativePath="..\platform\graphics\filters\arm\FEBlendNEON.h" + > + </File> + <File RelativePath="..\platform\graphics\filters\FEColorMatrix.cpp" > </File> @@ -33214,18 +33222,6 @@ Name="text" > <File - RelativePath="..\platform\text\AtomicStringImpl.h" - > - </File> - <File - RelativePath="..\platform\text\Base64.cpp" - > - </File> - <File - RelativePath="..\platform\text\Base64.h" - > - </File> - <File RelativePath="..\platform\text\BidiContext.cpp" > </File> @@ -51195,6 +51191,118 @@ > </File> <File + RelativePath="..\dom\IdTargetObserver.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\dom\IdTargetObserver.h" + > + </File> + <File + RelativePath="..\dom\IdTargetObserverRegistry.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\dom\IdTargetObserverRegistry.h" + > + </File> + <File RelativePath="..\dom\IgnoreDestructiveWriteCountIncrementer.h" > </File> @@ -54506,6 +54614,62 @@ RelativePath="..\dom\WebKitNamedFlow.h" > </File> + <File + RelativePath="..\dom\WebKitNamedFlowCollection.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\dom\WebKitNamedFlowCollection.h" + > + </File> <File RelativePath="..\dom\WebKitTransitionEvent.cpp" > diff --git a/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops index 0641d65a0..12e87676c 100644 --- a/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops +++ b/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops @@ -7,7 +7,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\Modules\filesystem";"$(ProjectDir)..\Modules\geolocation";"$(ProjectDir)..\Modules\indexeddb";"$(ProjectDir)..\Modules\quota";"$(ProjectDir)..\Modules\notifications";"$(ProjectDir)..\Modules\webdatabase";"$(ProjectDir)..\Modules\websockets";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\mathml";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\rendering\svg";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\bindings\js\specialization";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\html\shadow";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\cache";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\scrolling";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\ca";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\filters\arm";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(ProjectDir)..\xml\parser";"$(ConfigurationBuildDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\properties";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\testing";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib"" + AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\Modules\filesystem";"$(ProjectDir)..\Modules\geolocation";"$(ProjectDir)..\Modules\indexeddb";"$(ProjectDir)..\Modules\protocolhandler";"$(ProjectDir)..\Modules\quota";"$(ProjectDir)..\Modules\notifications";"$(ProjectDir)..\Modules\webdatabase";"$(ProjectDir)..\Modules\websockets";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\mathml";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\rendering\svg";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\bindings\js\specialization";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\html\shadow";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\cache";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\scrolling";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\ca";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\filters\arm";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(ProjectDir)..\xml\parser";"$(ConfigurationBuildDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\properties";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\testing";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib"" PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS" UsePrecompiledHeader="2" PrecompiledHeaderThrough="WebCorePrefix.h" diff --git a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd index 83f1f0317..0917cd791 100755 --- a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd +++ b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd @@ -21,8 +21,9 @@ xcopy /y /d "%ProjectDir%..\config.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%CONFIGURATIONBUILDDIR%\obj\WebCore\DerivedSources\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\filesystem\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\geolocation\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" -xcopy /y /d "%ProjectDir%..\Modules\quota\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\notifications\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\Modules\protocolhandler\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\Modules\quota\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\webdatabase\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\websockets\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\accessibility\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index c126c95af..da4730919 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -281,6 +281,8 @@ 0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; }; 0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; }; 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; }; + 12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */; }; + 12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */; }; 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; }; 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; }; @@ -1868,7 +1870,6 @@ 75793ED50D0CE85B007FC0AC /* DOMMessageEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */; }; 758978EC127090D60076D5A9 /* SpeechInputResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 758978EA127090D60076D5A9 /* SpeechInputResult.cpp */; }; 762F1ED7159D960A007408F2 /* HTMLDialogElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 762F1ED6159D960A007408F2 /* HTMLDialogElement.h */; }; - 762F1ED9159D961A007408F2 /* HTMLDialogElement.idl in Resources */ = {isa = PBXBuildFile; fileRef = 762F1ED8159D961A007408F2 /* HTMLDialogElement.idl */; }; 762F1EDB159D968A007408F2 /* HTMLDialogElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 762F1EDA159D968A007408F2 /* HTMLDialogElement.cpp */; }; 7633A72613D8B33A008501B6 /* LocaleToScriptMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 7633A72413D8B33A008501B6 /* LocaleToScriptMapping.h */; }; 7633A72713D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7633A72513D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp */; }; @@ -3643,8 +3644,6 @@ 97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97E4028F13A696ED00913D67 /* IconController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E4028D13A696ED00913D67 /* IconController.cpp */; }; 97E4029013A696ED00913D67 /* IconController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E4028E13A696ED00913D67 /* IconController.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 97E4A12614F4C5D400870E43 /* NavigatorRegisterProtocolHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */; }; - 97E4A12714F4C5D700870E43 /* NavigatorRegisterProtocolHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */; }; 97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; }; 97F8E665151D4A4B00D2D181 /* WorkerContextNotifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97F8E661151D4A3F00D2D181 /* WorkerContextNotifications.cpp */; }; 97F8E666151D4A4E00D2D181 /* WorkerContextNotifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 97F8E662151D4A3F00D2D181 /* WorkerContextNotifications.h */; }; @@ -4873,8 +4872,6 @@ B2B1F7170D00CAA8004AEA64 /* PointerEventsHitRules.h in Headers */ = {isa = PBXBuildFile; fileRef = B2B1F7150D00CAA8004AEA64 /* PointerEventsHitRules.h */; }; B2B2645C0D00A77E000ACC1D /* StringCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2B2645A0D00A77E000ACC1D /* StringCF.cpp */; }; B2B2645D0D00A77E000ACC1D /* StringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */; }; - B2C3DA210D006C1D00EF6F26 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */; }; - B2C3DA220D006C1D00EF6F26 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9F10D006C1D00EF6F26 /* Base64.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA230D006C1D00EF6F26 /* BidiContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */; }; B2C3DA240D006C1D00EF6F26 /* BidiContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA250D006C1D00EF6F26 /* BidiResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5727,6 +5724,10 @@ C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */; }; C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */; }; C37CDEBD149EF2030042090D /* ColorChooserClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C37CDEBC149EF2030042090D /* ColorChooserClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */; }; + C3CF17A515B0063F00276D39 /* IdTargetObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A115B0063F00276D39 /* IdTargetObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */; }; + C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; }; C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; }; C50B561712119D23008B46E0 /* GroupSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C50B561512119D23008B46E0 /* GroupSettings.h */; settings = {ATTRIBUTES = (Private, ); }; }; C50D0E820FF4272900AC2644 /* StorageNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */; }; @@ -6167,6 +6168,11 @@ F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */; }; F50664F7157F52DC00AC226F /* FormController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50664F5157F52DC00AC226F /* FormController.cpp */; }; F50664F8157F52DC00AC226F /* FormController.h in Headers */ = {isa = PBXBuildFile; fileRef = F50664F6157F52DC00AC226F /* FormController.h */; }; + F50824691548D89A00A119AB /* PagePopup.h in Headers */ = {isa = PBXBuildFile; fileRef = F50824681548D89A00A119AB /* PagePopup.h */; }; + F508246B1548D8E100A119AB /* PagePopupClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F508246A1548D8E100A119AB /* PagePopupClient.h */; }; + F508246E1548D96200A119AB /* MockPagePopupDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F508246C1548D96200A119AB /* MockPagePopupDriver.cpp */; }; + F508246F1548D96200A119AB /* MockPagePopupDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = F508246D1548D96200A119AB /* MockPagePopupDriver.h */; }; + F5122C901547FA1B0028A93B /* PagePopupDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */; }; F5142C69123F12B000F5BD4C /* LocalizedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = F5142C68123F12B000F5BD4C /* LocalizedNumber.h */; }; F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; }; F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; }; @@ -7236,6 +7242,8 @@ 0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; }; 0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; }; 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; }; + 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamedFlowCollection.h; sourceTree = "<group>"; }; + 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitNamedFlowCollection.cpp; sourceTree = "<group>"; }; 1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; }; 1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; }; 1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; }; @@ -8991,8 +8999,8 @@ 762F1EDA159D968A007408F2 /* HTMLDialogElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDialogElement.cpp; sourceTree = "<group>"; }; 7633A72413D8B33A008501B6 /* LocaleToScriptMapping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocaleToScriptMapping.h; sourceTree = "<group>"; }; 7633A72513D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocaleToScriptMappingDefault.cpp; sourceTree = "<group>"; }; - 76808B4D159DADFA002B5233 /* JSHTMLDialogElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSHTMLDialogElement.cpp; path = JSHTMLDialogElement.cpp; sourceTree = "<group>"; }; - 76808B4E159DADFA002B5233 /* JSHTMLDialogElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSHTMLDialogElement.h; path = JSHTMLDialogElement.h; sourceTree = "<group>"; }; + 76808B4D159DADFA002B5233 /* JSHTMLDialogElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDialogElement.cpp; sourceTree = "<group>"; }; + 76808B4E159DADFA002B5233 /* JSHTMLDialogElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDialogElement.h; sourceTree = "<group>"; }; 7694563A1214D97C0007CBAE /* JSDOMTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMTokenList.cpp; sourceTree = "<group>"; }; 7694563B1214D97C0007CBAE /* JSDOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMTokenList.h; sourceTree = "<group>"; }; 769456591214DB630007CBAE /* DOMDOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMTokenList.h; sourceTree = "<group>"; }; @@ -10326,6 +10334,7 @@ 938192040F87E1EC00D5352A /* BinaryPropertyList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinaryPropertyList.h; sourceTree = "<group>"; }; 9382AAB10D8C386100F357A6 /* NodeWithIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeWithIndex.h; sourceTree = "<group>"; }; 9382DF5710A8D5C900925652 /* ColorSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorSpace.h; sourceTree = "<group>"; }; + 938C496815AD67E300FCB2E1 /* FEBlendNEON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FEBlendNEON.h; sourceTree = "<group>"; }; 938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLElementWrapperFactory.h; sourceTree = "<group>"; }; 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElementWrapperFactory.cpp; sourceTree = "<group>"; }; 938E662509F09956008A48EC /* HTMLCanvasElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLCanvasElement.idl; sourceTree = "<group>"; }; @@ -10542,9 +10551,6 @@ 97205ABA1239292700B17380 /* PluginDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginDocument.h; sourceTree = "<group>"; }; 9728C3111268E4390041E89B /* MarkupAccumulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkupAccumulator.cpp; sourceTree = "<group>"; }; 9728C3121268E4390041E89B /* MarkupAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkupAccumulator.h; sourceTree = "<group>"; }; - 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorRegisterProtocolHandler.cpp; sourceTree = "<group>"; }; - 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorRegisterProtocolHandler.h; sourceTree = "<group>"; }; - 9730BE1614EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorRegisterProtocolHandler.idl; sourceTree = "<group>"; }; 9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentWriter.cpp; sourceTree = "<group>"; }; 9738899F116EA9DC00ADF313 /* DocumentWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentWriter.h; sourceTree = "<group>"; }; 973DC63D145A9409002842C2 /* ExceptionCodeDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionCodeDescription.cpp; sourceTree = "<group>"; }; @@ -12058,8 +12064,6 @@ B2B1F7150D00CAA8004AEA64 /* PointerEventsHitRules.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PointerEventsHitRules.h; sourceTree = "<group>"; }; B2B2645A0D00A77E000ACC1D /* StringCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StringCF.cpp; sourceTree = "<group>"; }; B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StringImplCF.cpp; sourceTree = "<group>"; }; - B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; }; - B2C3D9F10D006C1D00EF6F26 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; }; B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BidiContext.cpp; sourceTree = "<group>"; }; B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BidiContext.h; sourceTree = "<group>"; }; B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BidiResolver.h; sourceTree = "<group>"; }; @@ -12949,6 +12953,10 @@ C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseClickableWithKeyInputType.cpp; sourceTree = "<group>"; }; C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseClickableWithKeyInputType.h; sourceTree = "<group>"; }; C37CDEBC149EF2030042090D /* ColorChooserClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooserClient.h; sourceTree = "<group>"; }; + C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserver.cpp; sourceTree = "<group>"; }; + C3CF17A115B0063F00276D39 /* IdTargetObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserver.h; sourceTree = "<group>"; }; + C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserverRegistry.cpp; sourceTree = "<group>"; }; + C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = "<group>"; }; C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; }; C50B561512119D23008B46E0 /* GroupSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupSettings.h; sourceTree = "<group>"; }; C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespace.cpp; sourceTree = "<group>"; }; @@ -13451,6 +13459,11 @@ F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenTypeSanitizer.h; path = opentype/OpenTypeSanitizer.h; sourceTree = "<group>"; }; F50664F5157F52DC00AC226F /* FormController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormController.cpp; sourceTree = "<group>"; }; F50664F6157F52DC00AC226F /* FormController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormController.h; sourceTree = "<group>"; }; + F50824681548D89A00A119AB /* PagePopup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagePopup.h; sourceTree = "<group>"; }; + F508246A1548D8E100A119AB /* PagePopupClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagePopupClient.h; sourceTree = "<group>"; }; + F508246C1548D96200A119AB /* MockPagePopupDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MockPagePopupDriver.cpp; path = testing/MockPagePopupDriver.cpp; sourceTree = SOURCE_ROOT; }; + F508246D1548D96200A119AB /* MockPagePopupDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockPagePopupDriver.h; path = testing/MockPagePopupDriver.h; sourceTree = SOURCE_ROOT; }; + F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagePopupDriver.h; sourceTree = "<group>"; }; F5142C68123F12B000F5BD4C /* LocalizedNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedNumber.h; sourceTree = "<group>"; }; F523D23B02DE4396018635CA /* HTMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocument.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D23C02DE4396018635CA /* HTMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -15117,11 +15130,12 @@ 49ECEB5C1499790D00CDD3A4 /* arm */ = { isa = PBXGroup; children = ( + 938C496815AD67E300FCB2E1 /* FEBlendNEON.h */, 49ECEB5E1499790D00CDD3A4 /* FECompositeArithmeticNEON.h */, 49ECEB601499790D00CDD3A4 /* FEGaussianBlurNEON.h */, - 930062D7159B45B600ACD48A /* NEONHelpers.h */, 49ECEB611499790D00CDD3A4 /* FELightingNEON.cpp */, 49ECEB621499790D00CDD3A4 /* FELightingNEON.h */, + 930062D7159B45B600ACD48A /* NEONHelpers.h */, ); name = arm; path = filters/arm; @@ -15629,6 +15643,8 @@ 9FFE3E7811B59C5D0037874E /* MemoryInfo.cpp */, 9FFE3E7911B59C5D0037874E /* MemoryInfo.h */, 9FFE3E7C11B59C6E0037874E /* MemoryInfo.idl */, + F508246C1548D96200A119AB /* MockPagePopupDriver.cpp */, + F508246D1548D96200A119AB /* MockPagePopupDriver.h */, 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */, 935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */, A9C6E5A30D746458006442E9 /* Navigator.cpp */, @@ -15636,9 +15652,6 @@ A9C6E65D0D746694006442E9 /* Navigator.idl */, E12719C90EEEC21300F61213 /* NavigatorBase.cpp */, E12719C60EEEC16800F61213 /* NavigatorBase.h */, - 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */, - 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */, - 9730BE1614EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.idl */, 00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */, 00146289103CD1DE000B20DB /* OriginAccessEntry.h */, 65FEA86809833ADE00BED4AB /* Page.cpp */, @@ -15647,6 +15660,9 @@ 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */, 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */, 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */, + F50824681548D89A00A119AB /* PagePopup.h */, + F508246A1548D8E100A119AB /* PagePopupClient.h */, + F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */, 371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */, 371E65CB13661EDC00BEEDB0 /* PageSerializer.h */, FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */, @@ -17218,8 +17234,8 @@ D359D787129CA2710006E5D2 /* HTMLDetailsElement.h */, D359D788129CA2710006E5D2 /* HTMLDetailsElement.idl */, 762F1EDA159D968A007408F2 /* HTMLDialogElement.cpp */, - 762F1ED8159D961A007408F2 /* HTMLDialogElement.idl */, 762F1ED6159D960A007408F2 /* HTMLDialogElement.h */, + 762F1ED8159D961A007408F2 /* HTMLDialogElement.idl */, A8EA79ED0A1916DF00A8EF5F /* HTMLDirectoryElement.cpp */, A8EA79EE0A1916DF00A8EF5F /* HTMLDirectoryElement.h */, 1A85B1D90A1B23A400D8C87C /* HTMLDirectoryElement.idl */, @@ -17511,9 +17527,9 @@ 971145FE14EF006E00674FD9 /* Modules */ = { isa = PBXGroup; children = ( - 333F703D0FB49C16008E12A6 /* notifications */, 971145FF14EF007900674FD9 /* geolocation */, 9712A55315004E3C0048AF10 /* indexeddb */, + 333F703D0FB49C16008E12A6 /* notifications */, 89F60B08157F68350075E157 /* quota */, 97BC69D51505F054001B74AC /* webdatabase */, 97AABCF714FA09B5007457AE /* websockets */, @@ -17956,9 +17972,11 @@ A75E8B7F0E1DE2B0007F2481 /* filters */ = { isa = PBXGroup; children = ( + 49ECEB5C1499790D00CDD3A4 /* arm */, + 50D4060F147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp */, + 50D40610147D49DE00D30BB5 /* CustomFilterCompiledProgram.h */, 50987C24157D676D00BDA835 /* CustomFilterGlobalContext.cpp */, 50987C25157D676D00BDA835 /* CustomFilterGlobalContext.h */, - 49ECEB5C1499790D00CDD3A4 /* arm */, 50D405F7147D31F300D30BB5 /* CustomFilterMesh.cpp */, 50D405F8147D31F300D30BB5 /* CustomFilterMesh.h */, 50CC089914C6E99C0017AB51 /* CustomFilterNumberParameter.h */, @@ -17968,8 +17986,6 @@ 503D0CA714B5B08700F32F57 /* CustomFilterProgram.cpp */, 503D0CA814B5B08700F32F57 /* CustomFilterProgram.h */, 503D0CA914B5B08700F32F57 /* CustomFilterProgramClient.h */, - 50D4060F147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp */, - 50D40610147D49DE00D30BB5 /* CustomFilterCompiledProgram.h */, A1E1154313015C3D0054AC8C /* DistantLightSource.cpp */, 84730D5A1248F0B300D3A9C9 /* DistantLightSource.h */, A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */, @@ -19582,7 +19598,6 @@ B2A015910AF6CD53006BCE0E /* graphics */ = { isa = PBXGroup; children = ( - 0562F9601573F88F0031CA16 /* PlatformLayer.h */, 076F0D0812B8192700C26AA4 /* avfoundation */, 499B3EC0128CCC1800E726C2 /* ca */, B27535290B053814002CE64F /* cg */, @@ -19696,6 +19711,7 @@ A88DD4860B4629A300C02990 /* PathTraversalState.h */, A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */, A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */, + 0562F9601573F88F0031CA16 /* PlatformLayer.h */, BCAB417F13E356E800D8AAF3 /* Region.cpp */, BCAB418013E356E800D8AAF3 /* Region.h */, A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */, @@ -19744,8 +19760,6 @@ B2C3D9F90D006C1D00EF6F26 /* mac */, B734B17F119B98DB006587BD /* transcoder */, 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */, - B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */, - B2C3D9F10D006C1D00EF6F26 /* Base64.h */, B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */, B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */, B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */, @@ -20091,8 +20105,8 @@ A9C6E6460D7465CA006442E9 /* JSDOMMimeTypeArrayCustom.cpp */, A9C6E64A0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp */, A9C6E64B0D7465E7006442E9 /* JSDOMPluginCustom.cpp */, - BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */, 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */, + BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */, 14E0BC55136148A8002AD12E /* JSDOMTokenListCustom.cpp */, BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */, 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, @@ -20800,12 +20814,12 @@ ED501DC90B249F3900AE18D9 /* mac */ = { isa = PBXGroup; children = ( - CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */, CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */, + CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */, ED501DC50B249F2900AE18D9 /* EditorMac.mm */, 4A8C96EA0BE69032004EEFF0 /* FrameSelectionMac.mm */, - CE7B2DB21586ABAD0098B3FA /* TextAlternativeWithRange.mm */, CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */, + CE7B2DB21586ABAD0098B3FA /* TextAlternativeWithRange.mm */, ); name = mac; sourceTree = "<group>"; @@ -20924,6 +20938,8 @@ 858C39100AA8FF0000B187A4 /* CSSStyleSheet.idl */, BC80C9850CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp */, BC80C9860CD294EE00A0B7B3 /* CSSTimingFunctionValue.h */, + A882DA1F1593846A000115ED /* CSSToStyleMap.cpp */, + A882DA221593848D000115ED /* CSSToStyleMap.h */, 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */, 371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */, A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */, @@ -21033,15 +21049,13 @@ 8AA61CFD144D595B00F37350 /* WebKitCSSRegionRule.cpp */, 8AA61CFE144D595B00F37350 /* WebKitCSSRegionRule.h */, 8AD0A55614C87425000D83C5 /* WebKitCSSRegionRule.idl */, - 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */, - 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */, 5038BC0614711CDB0095E0D1 /* WebKitCSSShaderValue.cpp */, 50B42157146976960087E604 /* WebKitCSSShaderValue.h */, + 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */, + 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */, BC9ADD7F0CC4092200098C4C /* WebKitCSSTransformValue.cpp */, BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */, 31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */, - A882DA1F1593846A000115ED /* CSSToStyleMap.cpp */, - A882DA221593848D000115ED /* CSSToStyleMap.h */, ); path = css; sourceTree = "<group>"; @@ -21136,10 +21150,10 @@ A871DEC90A1530C700B12A68 /* RenderFrameSet.h */, CDEA7C831276230400B846DD /* RenderFullScreen.cpp */, CDEA7C821276230400B846DD /* RenderFullScreen.h */, - BC128B00137C8D4600CAC845 /* RenderGrid.cpp */, - BC128A72137C867C00CAC845 /* RenderGrid.h */, 0F3F0E57157030C3006DA57F /* RenderGeometryMap.cpp */, 0F3F0E58157030C3006DA57F /* RenderGeometryMap.h */, + BC128B00137C8D4600CAC845 /* RenderGrid.cpp */, + BC128A72137C867C00CAC845 /* RenderGrid.h */, BCEA482A097D93020094C9E4 /* RenderHTMLCanvas.cpp */, BCEA482B097D93020094C9E4 /* RenderHTMLCanvas.h */, 0FD308D3117D168400A791F7 /* RenderIFrame.cpp */, @@ -21456,6 +21470,10 @@ 8482B7441198C32E00BFB005 /* HashChangeEvent.idl */, 45099C401370A7800058D513 /* IconURL.cpp */, 45BAC2AF1360BBAB005DA258 /* IconURL.h */, + C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */, + C3CF17A115B0063F00276D39 /* IdTargetObserver.h */, + C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */, + C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */, 8AB4BC76126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h */, 85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */, 85031B2E0A44EFC700F992E0 /* KeyboardEvent.h */, @@ -21487,13 +21505,13 @@ 85031B330A44EFC700F992E0 /* MutationEvent.cpp */, 85031B340A44EFC700F992E0 /* MutationEvent.h */, 93EEC1F309C2877700C515D1 /* MutationEvent.idl */, + C6F0900514327B6100685849 /* MutationObserver.cpp */, + C6F0900614327B6100685849 /* MutationObserver.h */, + C6F0900714327B6100685849 /* MutationObserver.idl */, D6E528A1149A926D00EFE1F3 /* MutationObserverInterestGroup.cpp */, D6E528A2149A926D00EFE1F3 /* MutationObserverInterestGroup.h */, D6E276AD14637455001D280A /* MutationObserverRegistration.cpp */, D6E276AE14637455001D280A /* MutationObserverRegistration.h */, - C6F0900514327B6100685849 /* MutationObserver.cpp */, - C6F0900614327B6100685849 /* MutationObserver.h */, - C6F0900714327B6100685849 /* MutationObserver.idl */, C6F08FB91430FE8F00685849 /* MutationRecord.cpp */, C6F08FBA1430FE8F00685849 /* MutationRecord.h */, C6F08FBB1430FE8F00685849 /* MutationRecord.idl */, @@ -21639,6 +21657,8 @@ 93EEC1F709C2877700C515D1 /* WheelEvent.idl */, 4123E568127B3041000FEEA7 /* WindowEventContext.cpp */, 4123E567127B3041000FEEA7 /* WindowEventContext.h */, + 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */, + 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */, ); path = dom; sourceTree = "<group>"; @@ -21665,10 +21685,10 @@ FBC220DD1237FBEB00BCF788 /* opengl */ = { isa = PBXGroup; children = ( - 44DAB5AF15A623580097C1E4 /* Extensions3DOpenGLCommon.cpp */, - 44DAB5B015A623580097C1E4 /* Extensions3DOpenGLCommon.h */, 6E67D2A41280E8A4008758F7 /* Extensions3DOpenGL.cpp */, 6E67D2A51280E8A4008758F7 /* Extensions3DOpenGL.h */, + 44DAB5AF15A623580097C1E4 /* Extensions3DOpenGLCommon.cpp */, + 44DAB5B015A623580097C1E4 /* Extensions3DOpenGLCommon.h */, FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */, 96ABA42214BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp */, ); @@ -21989,6 +22009,7 @@ 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */, CEDA12D7152CA1CB00D9E08D /* AlternativeTextClient.h in Headers */, CE08C3D2152B599A0021B8C2 /* AlternativeTextController.h in Headers */, + CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */, 490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */, 49E912AB0EFAC906009D0CAF /* Animation.h in Headers */, 316FE1120E6E1DA700BF6088 /* AnimationBase.h in Headers */, @@ -22067,7 +22088,6 @@ 51741D0F0B07259A00ED442C /* BackForwardList.h in Headers */, BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */, BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */, - B2C3DA220D006C1D00EF6F26 /* Base64.h in Headers */, 379E61CA126CA5C400B63E8D /* BaseButtonInputType.h in Headers */, 379E61CC126CA5C400B63E8D /* BaseCheckableInputType.h in Headers */, C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */, @@ -22266,6 +22286,7 @@ A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */, A8EA80070A19516E00A8EF5F /* CSSStyleSheet.h in Headers */, BC80C9880CD294EE00A0B7B3 /* CSSTimingFunctionValue.h in Headers */, + A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */, 371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */, DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */, A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */, @@ -22278,13 +22299,14 @@ BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */, BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */, 62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */, + 50D40612147D49DE00D30BB5 /* CustomFilterCompiledProgram.h in Headers */, + 50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */, 50D405FA147D31F300D30BB5 /* CustomFilterMesh.h in Headers */, 50CC089A14C6E99C0017AB51 /* CustomFilterNumberParameter.h in Headers */, 50ACE2CB14B5D79300446666 /* CustomFilterOperation.h in Headers */, 509CC9FB14C069ED00BBECBD /* CustomFilterParameter.h in Headers */, 503D0CAB14B5B08700F32F57 /* CustomFilterProgram.h in Headers */, 503D0CAC14B5B08700F32F57 /* CustomFilterProgramClient.h in Headers */, - 50D40612147D49DE00D30BB5 /* CustomFilterCompiledProgram.h in Headers */, A8CB413E0E8633FD0032C4F0 /* DashArray.h in Headers */, A80E6D0B0A1989CA007FB8C5 /* DashboardRegion.h in Headers */, 97BC6A211505F081001B74AC /* Database.h in Headers */, @@ -22303,8 +22325,8 @@ 81AC599A131636E60009A7E0 /* DataTransferItemList.h in Headers */, 2E97CCEB12939CB800C5C8FF /* DataView.h in Headers */, A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */, - 453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */, F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */, + 453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */, F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */, F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */, 45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */, @@ -23049,6 +23071,7 @@ 9767CE0C145ABC13005E64DB /* ExceptionInterfaces.h in Headers */, 6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */, 6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */, + 44DAB5B215A623580097C1E4 /* Extensions3DOpenGLCommon.h in Headers */, 7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */, A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */, A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */, @@ -23237,6 +23260,7 @@ E1A31663134BCAE8007C9A4F /* HTMLConverter.h in Headers */, F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */, D359D78A129CA2710006E5D2 /* HTMLDetailsElement.h in Headers */, + 762F1ED7159D960A007408F2 /* HTMLDialogElement.h in Headers */, A8EA79FA0A1916DF00A8EF5F /* HTMLDirectoryElement.h in Headers */, A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */, A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */, @@ -23640,6 +23664,7 @@ 4A1E719114E101E400626F9D /* JSHTMLContentElement.h in Headers */, F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */, D359D8BF129CA55C0006E5D2 /* JSHTMLDetailsElement.h in Headers */, + 76808B50159DADFA002B5233 /* JSHTMLDialogElement.h in Headers */, 1A85B1E70A1B240500D8C87C /* JSHTMLDirectoryElement.h in Headers */, 1A85B2B70A1B2AC700D8C87C /* JSHTMLDivElement.h in Headers */, 1A85B1E90A1B240500D8C87C /* JSHTMLDListElement.h in Headers */, @@ -24107,6 +24132,7 @@ D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */, BCB16C180979C3BD00467741 /* MemoryCache.h in Headers */, 9FFE3E7B11B59C5D0037874E /* MemoryInfo.h in Headers */, + 4F32BB1B14FA85E800F6C1A3 /* MemoryInstrumentation.h in Headers */, 6571DCC81385E6A400702DD0 /* MemoryPressureHandler.h in Headers */, D630E2AC149BF344005B2F95 /* MemoryUsageSupport.h in Headers */, 93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */, @@ -24122,6 +24148,7 @@ 9B375EDB14478A0100F3CAE5 /* MicroDataItemList.h in Headers */, 37DDCD9513844FD50008B793 /* MIMEHeader.h in Headers */, BC772C4F0C4EB3040083285F /* MIMETypeRegistry.h in Headers */, + F508246F1548D96200A119AB /* MockPagePopupDriver.h in Headers */, C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */, F55B3DC61251F12D003EF269 /* MonthInputType.h in Headers */, 85031B460A44EFC700F992E0 /* MouseEvent.h in Headers */, @@ -24143,7 +24170,6 @@ A9C6E5A60D746458006442E9 /* Navigator.h in Headers */, E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */, 9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */, - 97E4A12614F4C5D400870E43 /* NavigatorRegisterProtocolHandler.h in Headers */, 8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */, 656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */, 628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */, @@ -24205,6 +24231,9 @@ 9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */, 9712A60515004EDA0048AF10 /* PageGroupIndexedDatabase.h in Headers */, 7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */, + F50824691548D89A00A119AB /* PagePopup.h in Headers */, + F508246B1548D8E100A119AB /* PagePopupClient.h in Headers */, + F5122C901547FA1B0028A93B /* PagePopupDriver.h in Headers */, F3820895147D35F90010BC06 /* PageRuntimeAgent.h in Headers */, F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */, 371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */, @@ -24294,7 +24323,6 @@ 7E33CD01127F340D00BE8F17 /* PurgePriority.h in Headers */, 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */, 379E371713736A6600B9E919 /* QuotedPrintable.h in Headers */, - BC128A73137C867C00CAC845 /* RenderGrid.h in Headers */, 5A574F29131DB96D00471B88 /* QuotesData.h in Headers */, B22279720D00BF220071B782 /* RadialGradientAttributes.h in Headers */, F55B3DCC1251F12D003EF269 /* RadioInputType.h in Headers */, @@ -24340,6 +24368,7 @@ A871DED10A1530C700B12A68 /* RenderFrameSet.h in Headers */, CDEA7C841276230400B846DD /* RenderFullScreen.h in Headers */, 0F3F0E5A157030C3006DA57F /* RenderGeometryMap.h in Headers */, + BC128A73137C867C00CAC845 /* RenderGrid.h in Headers */, BCEA486A097D93020094C9E4 /* RenderHTMLCanvas.h in Headers */, 0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */, BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */, @@ -24930,6 +24959,7 @@ F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */, 6550B6A6099DF0270090D781 /* Text.h in Headers */, 93309E17099E64920056E581 /* TextAffinity.h in Headers */, + CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */, B2C3DA340D006C1D00EF6F26 /* TextBoundaries.h in Headers */, B2C3DA360D006C1D00EF6F26 /* TextBreakIterator.h in Headers */, B2C3DA380D006C1D00EF6F26 /* TextBreakIteratorInternalICU.h in Headers */, @@ -25023,6 +25053,7 @@ BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */, BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */, BCDF317C11F8D683003C5BF8 /* UserTypingGestureIndicator.h in Headers */, + 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */, 2E3BBF081162DA1100B9409A /* UUID.h in Headers */, F5A154281279534D00D0B0C0 /* ValidationMessage.h in Headers */, 15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */, @@ -25087,10 +25118,11 @@ 31288E750E3005D6003619AE /* WebKitCSSKeyframesRule.h in Headers */, 498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */, 8AA61D00144D595B00F37350 /* WebKitCSSRegionRule.h in Headers */, - 0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */, 29CD61DE146D02890068E82A /* WebKitCSSShaderValue.h in Headers */, + 0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */, BC9ADD230CC4032600098C4C /* WebKitCSSTransformValue.h in Headers */, 89878566122CA064003AABDA /* WebKitFlags.h in Headers */, + 12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */, 494BD7950F55C8EE00747828 /* WebKitPoint.h in Headers */, 31C0FF250E4CEB6E007D6FE5 /* WebKitTransitionEvent.h in Headers */, 0FCF332F0F2B9A25004B6795 /* WebLayer.h in Headers */, @@ -25194,15 +25226,8 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, FD537353137B651800008DCE /* ZeroPole.h in Headers */, - CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */, - CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */, - 50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */, - 4F32BB1B14FA85E800F6C1A3 /* MemoryInstrumentation.h in Headers */, - A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */, - 762F1ED7159D960A007408F2 /* HTMLDialogElement.h in Headers */, - 76808B50159DADFA002B5233 /* JSHTMLDialogElement.h in Headers */, - 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */, - 44DAB5B215A623580097C1E4 /* Extensions3DOpenGLCommon.h in Headers */, + C3CF17A515B0063F00276D39 /* IdTargetObserver.h in Headers */, + C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -25574,6 +25599,7 @@ E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */, 84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */, CE08C3D1152B599A0021B8C2 /* AlternativeTextController.cpp in Sources */, + CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */, 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */, 49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */, 316FE1110E6E1DA700BF6088 /* AnimationBase.cpp in Sources */, @@ -25633,7 +25659,6 @@ BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */, BCA8CA5F11E4E6D100812FB7 /* BackForwardListImpl.cpp in Sources */, BC124EE70C2641CD009E2349 /* BarInfo.cpp in Sources */, - B2C3DA210D006C1D00EF6F26 /* Base64.cpp in Sources */, 379E61C9126CA5C300B63E8D /* BaseButtonInputType.cpp in Sources */, 379E61CB126CA5C400B63E8D /* BaseCheckableInputType.cpp in Sources */, C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */, @@ -25798,6 +25823,7 @@ A80E6CEF0A1989CA007FB8C5 /* CSSStyleRule.cpp in Sources */, A8EA80080A19516E00A8EF5F /* CSSStyleSheet.cpp in Sources */, BC80C9870CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp in Sources */, + A882DA201593846A000115ED /* CSSToStyleMap.cpp in Sources */, 371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */, AD03AAFA1468455300A39B5B /* CSSValue.cpp in Sources */, 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */, @@ -25808,10 +25834,11 @@ 265541521489B233000DFC5D /* CursorIOS.cpp in Sources */, 93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */, 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */, + 50D40611147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp in Sources */, + 50987C26157D676D00BDA835 /* CustomFilterGlobalContext.cpp in Sources */, 50D405F9147D31F300D30BB5 /* CustomFilterMesh.cpp in Sources */, 50CC0A3914C6F5B10017AB51 /* CustomFilterOperation.cpp in Sources */, 503D0CAA14B5B08700F32F57 /* CustomFilterProgram.cpp in Sources */, - 50D40611147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp in Sources */, 97BC6A201505F081001B74AC /* Database.cpp in Sources */, 97BC6A231505F081001B74AC /* DatabaseAuthorizer.cpp in Sources */, 97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */, @@ -26247,6 +26274,7 @@ A7CACDB113CE875C00BBBE3F /* ExceptionCodePlaceholder.cpp in Sources */, 148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */, 6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */, + 44DAB5B115A623580097C1E4 /* Extensions3DOpenGLCommon.cpp in Sources */, 7728694E14F8882500F484DC /* EXTTextureFilterAnisotropic.cpp in Sources */, A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */, A75E8B8A0E1DE2D6007F2481 /* FEColorMatrix.cpp in Sources */, @@ -26405,6 +26433,7 @@ 5D4F51DF132725480016F541 /* HTMLConverter.mm in Sources */, F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */, D359D789129CA2710006E5D2 /* HTMLDetailsElement.cpp in Sources */, + 762F1EDB159D968A007408F2 /* HTMLDialogElement.cpp in Sources */, A8EA79F90A1916DF00A8EF5F /* HTMLDirectoryElement.cpp in Sources */, A8EA7CB10A192B9C00A8EF5F /* HTMLDivElement.cpp in Sources */, A8EA79F50A1916DF00A8EF5F /* HTMLDListElement.cpp in Sources */, @@ -26756,6 +26785,7 @@ BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */, 4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */, C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */, + 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */, BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */, BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */, 7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */, @@ -26835,6 +26865,7 @@ 4A1E719014E101E400626F9D /* JSHTMLContentElement.cpp in Sources */, F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */, D359D8BE129CA55C0006E5D2 /* JSHTMLDetailsElement.cpp in Sources */, + 76808B4F159DADFA002B5233 /* JSHTMLDialogElement.cpp in Sources */, 1A85B1E60A1B240500D8C87C /* JSHTMLDirectoryElement.cpp in Sources */, 1A85B2B60A1B2AC700D8C87C /* JSHTMLDivElement.cpp in Sources */, 1A85B1E80A1B240500D8C87C /* JSHTMLDListElement.cpp in Sources */, @@ -27386,6 +27417,7 @@ 37DDCD9413844FD50008B793 /* MIMEHeader.cpp in Sources */, BC772C4E0C4EB3040083285F /* MIMETypeRegistry.cpp in Sources */, BC772C5E0C4EB3440083285F /* MIMETypeRegistryMac.mm in Sources */, + F508246E1548D96200A119AB /* MockPagePopupDriver.cpp in Sources */, C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */, F55B3DC51251F12D003EF269 /* MonthInputType.cpp in Sources */, 85031B450A44EFC700F992E0 /* MouseEvent.cpp in Sources */, @@ -27406,7 +27438,6 @@ A9C6E5A50D746458006442E9 /* Navigator.cpp in Sources */, E12719CA0EEEC21300F61213 /* NavigatorBase.cpp in Sources */, 9711460314EF009A00674FD9 /* NavigatorGeolocation.cpp in Sources */, - 97E4A12714F4C5D700870E43 /* NavigatorRegisterProtocolHandler.cpp in Sources */, 5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */, 59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */, 1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */, @@ -27513,7 +27544,6 @@ E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */, 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */, 379E371613736A6600B9E919 /* QuotedPrintable.cpp in Sources */, - BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */, 5A574F28131DB96D00471B88 /* QuotesData.cpp in Sources */, F55B3DCB1251F12D003EF269 /* RadioInputType.cpp in Sources */, B658FFA51522EFAA00DD5595 /* RadioNodeList.cpp in Sources */, @@ -27552,6 +27582,7 @@ A871DED20A1530C700B12A68 /* RenderFrameSet.cpp in Sources */, CDEA7C851276230400B846DD /* RenderFullScreen.cpp in Sources */, 0F3F0E59157030C3006DA57F /* RenderGeometryMap.cpp in Sources */, + BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */, BCEA4869097D93020094C9E4 /* RenderHTMLCanvas.cpp in Sources */, 0FD308D5117D168500A791F7 /* RenderIFrame.cpp in Sources */, BCEA4875097D93020094C9E4 /* RenderImage.cpp in Sources */, @@ -28028,6 +28059,7 @@ BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */, F55B3DD51251F12D003EF269 /* TelephoneInputType.cpp in Sources */, 6550B6A5099DF0270090D781 /* Text.cpp in Sources */, + CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */, 372C00C4129611F1005C9575 /* TextBoundaries.cpp in Sources */, B2AFFC970D00A5DF0030074D /* TextBoundaries.mm in Sources */, B2C3DA370D006C1D00EF6F26 /* TextBreakIteratorICU.cpp in Sources */, @@ -28100,6 +28132,7 @@ BCACF3BC1072921A00C0C8A3 /* UserContentURLPattern.cpp in Sources */, 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */, BCDF317B11F8D683003C5BF8 /* UserTypingGestureIndicator.cpp in Sources */, + 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */, 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */, F5A154271279534D00D0B0C0 /* ValidationMessage.cpp in Sources */, 15C7708E100D3C6B005BA267 /* ValidityState.cpp in Sources */, @@ -28161,6 +28194,7 @@ BC9ADD800CC4092200098C4C /* WebKitCSSTransformValue.cpp in Sources */, 1A1414B513A0F0500019996C /* WebKitFontFamilyNames.cpp in Sources */, D7613A501474F13F00DB8606 /* WebKitNamedFlow.cpp in Sources */, + 12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */, 31C0FF240E4CEB6E007D6FE5 /* WebKitTransitionEvent.cpp in Sources */, 0FCF332E0F2B9A25004B6795 /* WebLayer.mm in Sources */, E1A3162E134BC32D007C9A4F /* WebNSAttributedStringExtras.mm in Sources */, @@ -28252,15 +28286,8 @@ E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */, FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, - 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */, - CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */, - CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */, - 50987C26157D676D00BDA835 /* CustomFilterGlobalContext.cpp in Sources */, - A882DA201593846A000115ED /* CSSToStyleMap.cpp in Sources */, - 762F1EDB159D968A007408F2 /* HTMLDialogElement.cpp in Sources */, - 76808B4F159DADFA002B5233 /* JSHTMLDialogElement.cpp in Sources */, - 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */, - 44DAB5B115A623580097C1E4 /* Extensions3DOpenGLCommon.cpp in Sources */, + C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */, + C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/accessibility/AccessibilityList.h b/Source/WebCore/accessibility/AccessibilityList.h index de5e96df3..3cfde0bdf 100644 --- a/Source/WebCore/accessibility/AccessibilityList.h +++ b/Source/WebCore/accessibility/AccessibilityList.h @@ -29,7 +29,7 @@ #ifndef AccessibilityList_h #define AccessibilityList_h -#if PLATFORM(MAC) && defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define ACCESSIBILITY_LISTS 0 #else #define ACCESSIBILITY_LISTS 1 diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp index 245bda5bf..793b54a60 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp @@ -1399,7 +1399,7 @@ static ARIARoleMap* createARIARoleMap() { "search", LandmarkSearchRole }, { "separator", SplitterRole }, { "slider", SliderRole }, - { "spinbutton", ProgressIndicatorRole }, + { "spinbutton", SpinButtonRole }, { "status", ApplicationStatusRole }, { "tab", TabRole }, { "tablist", TabListRole }, diff --git a/Source/WebCore/accessibility/AccessibilityTable.h b/Source/WebCore/accessibility/AccessibilityTable.h index 21814f2db..7fd7cc611 100644 --- a/Source/WebCore/accessibility/AccessibilityTable.h +++ b/Source/WebCore/accessibility/AccessibilityTable.h @@ -32,7 +32,7 @@ #include "AccessibilityRenderObject.h" #include <wtf/Forward.h> -#if PLATFORM(MAC) && defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define ACCESSIBILITY_TABLES 0 #else #define ACCESSIBILITY_TABLES 1 diff --git a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm b/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm index acbc25f70..3608d21b6 100644 --- a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm +++ b/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm @@ -71,7 +71,7 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific macNotification = NSAccessibilityFocusedUIElementChangedNotification; break; case AXAutocorrectionOccured: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 macNotification = @"AXAutocorrectionOccurred"; break; #else @@ -107,7 +107,7 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific case AXRowCountChanged: macNotification = NSAccessibilityRowCountChangedNotification; break; -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 case AXRowExpanded: macNotification = NSAccessibilityRowExpandedNotification; break; diff --git a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp index 5a0ff7d73..25976e411 100644 --- a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp @@ -81,7 +81,7 @@ JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec) double beta = exec->argument(4).toNumber(exec); bool gammaProvided = !exec->argument(5).isUndefinedOrNull(); double gamma = exec->argument(5).toNumber(exec); - bool absoluteProvided = !exec->argument(5).isUndefinedOrNull(); + bool absoluteProvided = !exec->argument(6).isUndefinedOrNull(); bool absolute = exec->argument(6).toBoolean(); RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute); DeviceOrientationEvent* imp = static_cast<DeviceOrientationEvent*>(impl()); diff --git a/Source/WebCore/bindings/objc/WebScriptObject.mm b/Source/WebCore/bindings/objc/WebScriptObject.mm index cf55e7415..1a51b81a2 100644 --- a/Source/WebCore/bindings/objc/WebScriptObject.mm +++ b/Source/WebCore/bindings/objc/WebScriptObject.mm @@ -50,6 +50,7 @@ #import <runtime/JSLock.h> #import <runtime/Completion.h> #import <runtime/Completion.h> +#import <wtf/TCSpinLock.h> #import <wtf/Threading.h> @@ -60,16 +61,24 @@ using namespace WebCore; namespace WebCore { static NSMapTable* JSWrapperCache; +static SpinLock spinLock = SPINLOCK_INITIALIZER; NSObject* getJSWrapper(JSObject* impl) { + ASSERT(isMainThread()); + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) return nil; - return static_cast<NSObject*>(NSMapGet(JSWrapperCache, impl)); + NSObject* wrapper = static_cast<NSObject*>(NSMapGet(JSWrapperCache, impl)); + return wrapper ? [[wrapper retain] autorelease] : nil; } void addJSWrapper(NSObject* wrapper, JSObject* impl) { + ASSERT(isMainThread()); + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) JSWrapperCache = createWrapperCache(); NSMapInsert(JSWrapperCache, impl, wrapper); @@ -77,18 +86,27 @@ void addJSWrapper(NSObject* wrapper, JSObject* impl) void removeJSWrapper(JSObject* impl) { + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) return; NSMapRemove(JSWrapperCache, impl); } -id createJSWrapper(JSC::JSObject* object, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root) +static void removeJSWrapperIfRetainCountOne(NSObject* wrapper, JSObject* impl) { - // NSMap is not thread safe, hold the JSC API lock; also synchronize this vs. release. - JSC::JSLockHolder holder(JSDOMWindowBase::commonJSGlobalData()); + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) + return; + if ([wrapper retainCount] == 1) + NSMapRemove(JSWrapperCache, impl); +} + +id createJSWrapper(JSC::JSObject* object, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root) +{ if (id wrapper = getJSWrapper(object)) - return [[wrapper retain] autorelease]; + return wrapper; return [[[WebScriptObject alloc] _initWithJSObject:object originRootObject:origin rootObject:root] autorelease]; } @@ -148,9 +166,6 @@ static void _didExecute(WebScriptObject *obj) _private->rootObject = rootObject.leakRef(); _private->originRootObject = originRootObject.leakRef(); - // NSMap is not thread safe, hold the JSC API lock. - JSC::JSLockHolder holder(JSDOMWindowBase::commonJSGlobalData()); - WebCore::addJSWrapper(self, imp); if (_private->rootObject) @@ -231,15 +246,9 @@ static void _didExecute(WebScriptObject *obj) - (oneway void)release { - { - // NSMap is not thread safe, hold the JSC API lock; also synchronize this vs. getJSWrapper. - JSC::JSLockHolder holder(JSDOMWindowBase::commonJSGlobalData()); - - // If we're releasing the last reference to this object, remove if from the map, - // this will prevent this object from being returned by getJSWrapper. - if (_private->imp && [self retainCount] == 1) - WebCore::removeJSWrapper(_private->imp); - } + // If we're releasing the last reference to this object, remove if from the map. + if (_private->imp) + WebCore::removeJSWrapperIfRetainCountOne(self, _private->imp); [super release]; } @@ -521,6 +530,9 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root - (JSObjectRef)JSObject { + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + + JSLockHolder lock(exec); if (![self _isSafeScript]) return NULL; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm index 5ed40ff0e..ed90de825 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -223,6 +223,14 @@ sub SkipAttribute return 1 if $attribute->signature->type =~ /Constructor$/; + if ($codeGenerator->GetArrayType($attribute->signature->type)) { + return 1; + } + + if ($codeGenerator->GetSequenceType($attribute->signature->type)) { + return 1; + } + $codeGenerator->AssertNotSequenceType($attribute->signature->type); # FIXME: This is typically used to add script execution state arguments to the method. diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 3b0115bdf..147c3d986 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -922,9 +922,6 @@ END if ($getterStringUsesImp) { my ($functionName, @arguments) = $codeGenerator->GetterExpression(\%implIncludes, $interfaceName, $attribute); - - push(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 0, 0)); - push(@arguments, "ec") if $useExceptions; if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; @@ -934,6 +931,7 @@ END } else { $functionName = "imp->${functionName}"; } + unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 0, 0)); $getterString = "${functionName}(" . join(", ", @arguments) . ")"; } else { $getterString = "impInstance"; @@ -1134,20 +1132,8 @@ END push(@implContentDecls, " $svgWrappedNativeType* imp = &impInstance;\n"); } } elsif ($attrExt->{"V8OnProto"}) { - if ($interfaceName eq "DOMWindow") { push(@implContentDecls, <<END); - v8::Handle<v8::Object> holder = info.Holder(); -END - } else { - # perform lookup first - push(@implContentDecls, <<END); - v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This()); - if (holder.IsEmpty()) - return; -END - } - push(@implContentDecls, <<END); - ${implClassName}* imp = V8${implClassName}::toNative(holder); + ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END } else { my $attrType = GetTypeFromSignature($attribute->signature); @@ -1227,9 +1213,6 @@ END push(@implContentDecls, ");\n"); } else { my ($functionName, @arguments) = $codeGenerator->SetterExpression(\%implIncludes, $interfaceName, $attribute); - - push(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 1, 0)); - push(@arguments, $result); push(@arguments, "ec") if $useExceptions; if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { @@ -1240,6 +1223,7 @@ END } else { $functionName = "imp->${functionName}"; } + unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 1, 0)); push(@implContentDecls, " ${functionName}(" . join(", ", @arguments) . ");\n"); } } @@ -3386,7 +3370,7 @@ sub GenerateFunctionCallString() my @callWithOutput = (); my @callWithArgs = GenerateCallWith($callWith, \@callWithOutput, $indent, 0, 1, $function); $result .= join("", @callWithOutput); - push(@arguments, @callWithArgs); + unshift(@arguments, @callWithArgs); $index += @callWithArgs; $numberOfParameters += @callWithArgs; diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index ecc15b173..b828d54bc 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -134,7 +134,7 @@ static v8::Handle<v8::Value> supplementalMethod2Callback(const v8::Arguments& ar ScriptExecutionContext* scriptContext = getScriptExecutionContext(); if (!scriptContext) return v8::Undefined(); - RefPtr<TestObj> result = TestSupplemental::supplementalMethod2(imp, scriptContext, strArg, objArg, ec); + RefPtr<TestObj> result = TestSupplemental::supplementalMethod2(scriptContext, imp, strArg, objArg, ec); if (UNLIKELY(ec)) goto fail; return toV8(result.release(), args.GetIsolate()); diff --git a/Source/WebCore/bindings/v8/DOMDataStore.cpp b/Source/WebCore/bindings/v8/DOMDataStore.cpp index dbca39540..95efd5059 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.cpp +++ b/Source/WebCore/bindings/v8/DOMDataStore.cpp @@ -119,13 +119,13 @@ void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type) return 0; } -void DOMDataStore::reportMemoryUsage(MemoryInstrumentation* instrumentation) +void DOMDataStore::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - instrumentation->reportPointer(this, MemoryInstrumentation::Binding); - domNodeMap().reportMemoryUsage(instrumentation); - activeDomNodeMap().reportMemoryUsage(instrumentation); - domObjectMap().reportMemoryUsage(instrumentation); - activeDomObjectMap().reportMemoryUsage(instrumentation); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportInstrumentedPointer(m_domNodeMap); + memoryObjectInfo->reportInstrumentedPointer(m_activeDomNodeMap); + memoryObjectInfo->reportInstrumentedPointer(m_domObjectMap); + memoryObjectInfo->reportInstrumentedPointer(m_activeDomObjectMap); } // Called when the object is near death (not reachable from JS roots). diff --git a/Source/WebCore/bindings/v8/DOMDataStore.h b/Source/WebCore/bindings/v8/DOMDataStore.h index b5bdfc392..3e6d43d72 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.h +++ b/Source/WebCore/bindings/v8/DOMDataStore.h @@ -47,7 +47,7 @@ namespace WebCore { class DOMData; class DOMDataStore; - class MemoryInstrumentation; + class MemoryObjectInfo; typedef WTF::Vector<DOMDataStore*> DOMDataList; @@ -87,7 +87,7 @@ namespace WebCore { static void weakActiveDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject); static void weakNodeCallback(v8::Persistent<v8::Value> v8Object, void* domObject); - void reportMemoryUsage(MemoryInstrumentation*); + void reportMemoryUsage(MemoryObjectInfo*) const; protected: static void weakDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject); diff --git a/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h b/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h index 5d61668c1..52308bdc4 100644 --- a/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h +++ b/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h @@ -102,10 +102,11 @@ class ChunkedTable { visitEntries(store, chunk->m_entries, chunk->m_entries + CHUNK_SIZE, visitor); } - void reportMemoryUsage(MemoryInstrumentation* instrumentation) + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); for (Chunk* chunk = m_chunks; chunk; chunk = chunk->m_previous) - instrumentation->reportPointer(chunk, MemoryInstrumentation::Binding); + memoryObjectInfo->reportPointer(chunk, MemoryInstrumentation::Binding); } private: @@ -183,10 +184,10 @@ public: m_table.clear(); } - virtual void reportMemoryUsage(MemoryInstrumentation* instrumentation) OVERRIDE + virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { - instrumentation->reportPointer(this, MemoryInstrumentation::Binding); - m_table.reportMemoryUsage(instrumentation); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportInstrumentedObject(m_table); } private: diff --git a/Source/WebCore/bindings/v8/NPV8Object.cpp b/Source/WebCore/bindings/v8/NPV8Object.cpp index d4d6cfc9c..6a76bfff5 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.cpp +++ b/Source/WebCore/bindings/v8/NPV8Object.cpp @@ -186,6 +186,7 @@ void disposeUnderlyingV8Object(NPObject* npObject) #endif v8NpObject->v8Object.Dispose(); v8NpObject->v8Object.Clear(); + v8NpObject->rootObject = 0; } } // namespace WebCore @@ -320,6 +321,9 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri if (npObject->_class != npScriptObjectClass) return false; + V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); + if (v8NpObject->v8Object.IsEmpty()) + return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); diff --git a/Source/WebCore/bindings/v8/ScriptProfiler.cpp b/Source/WebCore/bindings/v8/ScriptProfiler.cpp index 8d6c5029e..07f039e7c 100644 --- a/Source/WebCore/bindings/v8/ScriptProfiler.cpp +++ b/Source/WebCore/bindings/v8/ScriptProfiler.cpp @@ -223,9 +223,7 @@ void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor) void ScriptProfiler::collectBindingMemoryInfo(MemoryInstrumentation* instrumentation) { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); - if (!data) - return; - data->reportMemoryUsage(instrumentation); + instrumentation->reportInstrumentedPointer(data); } size_t ScriptProfiler::profilerSnapshotsSize() diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index c29bcf833..8198ad0d6 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -90,15 +90,16 @@ void V8BindingPerIsolateData::dispose(v8::Isolate* isolate) isolate->SetData(0); } -void V8BindingPerIsolateData::reportMemoryUsage(MemoryInstrumentation* instrumentation) +void V8BindingPerIsolateData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - instrumentation->reportPointer(this, MemoryInstrumentation::Binding); - instrumentation->reportHashMap(m_rawTemplates, MemoryInstrumentation::Binding); - instrumentation->reportHashMap(m_templates, MemoryInstrumentation::Binding); - m_stringCache.reportMemoryUsage(instrumentation); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportHashMap(m_rawTemplates); + memoryObjectInfo->reportHashMap(m_templates); + memoryObjectInfo->reportInstrumentedObject(m_stringCache); + memoryObjectInfo->reportVector(m_domDataList); for (size_t i = 0; i < m_domDataList.size(); i++) - m_domDataList[i]->reportMemoryUsage(instrumentation); + memoryObjectInfo->reportInstrumentedPointer(m_domDataList[i]); } // WebCoreStringResource is a helper class for v8ExternalString. It is used @@ -587,9 +588,10 @@ v8::Persistent<v8::FunctionTemplate> getToStringTemplate() return toStringTemplate; } -void StringCache::reportMemoryUsage(MemoryInstrumentation* instrumentation) +void StringCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - instrumentation->reportHashMap(m_stringCache, MemoryInstrumentation::Binding); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportHashMap(m_stringCache); } PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value> value) diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index cb420002f..c63bf21b8 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -34,6 +34,7 @@ #include "BindingSecurity.h" #include "DOMDataStore.h" #include "PlatformString.h" +#include "V8BindingMacros.h" #include "V8DOMWrapper.h" #include "V8GCController.h" #include "V8HiddenPropertyName.h" @@ -49,7 +50,7 @@ namespace WebCore { class EventListener; class EventTarget; class ExternalStringVisitor; - class MemoryInstrumentation; + class MemoryObjectInfo; // FIXME: Remove V8Binding. class V8Binding { @@ -79,7 +80,7 @@ namespace WebCore { void remove(StringImpl*); - void reportMemoryUsage(MemoryInstrumentation*); + void reportMemoryUsage(MemoryObjectInfo*) const; private: v8::Local<v8::String> v8ExternalStringSlow(StringImpl*, v8::Isolate*); @@ -217,7 +218,7 @@ namespace WebCore { GCEventData& gcEventData() { return m_gcEventData; } - void reportMemoryUsage(MemoryInstrumentation*); + void reportMemoryUsage(MemoryObjectInfo*) const; private: explicit V8BindingPerIsolateData(v8::Isolate*); @@ -439,6 +440,31 @@ namespace WebCore { return result; } + // Validates that the passed object is a sequence type per WebIDL spec + // http://www.w3.org/TR/2012/WD-WebIDL-20120207/#es-sequence + inline v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value> value, uint32_t& length) + { + if (!value->IsObject()) { + V8Proxy::throwTypeError(); + return v8::Local<v8::Value>(); + } + + v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); + v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); + + EXCEPTION_BLOCK(v8::Local<v8::Value>, lengthValue, object->Get(v8::String::New("length"))); + + if (lengthValue->IsUndefined() || lengthValue->IsNull()) { + V8Proxy::throwTypeError(); + return v8::Local<v8::Value>(); + } + + EXCEPTION_BLOCK(uint32_t, sequenceLength, lengthValue->Int32Value()); + length = sequenceLength; + + return v8Value; + } + // Enables caching v8 wrappers created for WTF::StringImpl. Currently this cache requires // all the calls (both to convert WTF::String to v8::String and to GC the handle) // to be performed on the main thread. diff --git a/Source/WebCore/bindings/v8/V8DOMMap.h b/Source/WebCore/bindings/v8/V8DOMMap.h index 4ee6c318d..2b70c582b 100644 --- a/Source/WebCore/bindings/v8/V8DOMMap.h +++ b/Source/WebCore/bindings/v8/V8DOMMap.h @@ -39,7 +39,7 @@ namespace WebCore { class DOMDataStore; class Node; - class MemoryInstrumentation; + class MemoryObjectInfo; template <class KeyType, class ValueType> class AbstractWeakReferenceMap { public: @@ -64,7 +64,7 @@ namespace WebCore { v8::WeakReferenceCallback weakReferenceCallback() { return m_weakReferenceCallback; } - virtual void reportMemoryUsage(MemoryInstrumentation*) = 0; + virtual void reportMemoryUsage(MemoryObjectInfo*) const = 0; private: v8::WeakReferenceCallback m_weakReferenceCallback; @@ -134,9 +134,10 @@ namespace WebCore { visitor->endMap(); } - virtual void reportMemoryUsage(MemoryInstrumentation* instrumentation) OVERRIDE + virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { - instrumentation->reportHashMap(m_map, MemoryInstrumentation::Binding); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportHashMap(m_map); } protected: diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index 991e88b5c..5943dc3b5 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -475,23 +475,6 @@ int V8GCController::workingSetEstimateMB = 0; namespace { -int getMemoryUsageInMB() -{ -#if PLATFORM(CHROMIUM) - return MemoryUsageSupport::memoryUsageMB(); -#else - return 0; -#endif -} - -int getActualMemoryUsageInMB() -{ -#if PLATFORM(CHROMIUM) - return MemoryUsageSupport::actualMemoryUsageMB(); -#else - return 0; -#endif -} } // anonymous namespace @@ -506,7 +489,7 @@ void V8GCController::gcEpilogue() GCEpilogueVisitor<Node, SpecialCaseEpilogueNodeHandler, &DOMDataStore::weakNodeCallback> epilogueNodeVisitor; visitActiveDOMNodes(&epilogueNodeVisitor); - workingSetEstimateMB = getActualMemoryUsageInMB(); + workingSetEstimateMB = MemoryUsageSupport::actualMemoryUsageMB(); #ifndef NDEBUG // Check all survivals are weak. @@ -530,7 +513,7 @@ void V8GCController::checkMemoryUsage() const int lowMemoryUsageMB = MemoryUsageSupport::lowMemoryUsageMB(); const int highMemoryUsageMB = MemoryUsageSupport::highMemoryUsageMB(); const int highUsageDeltaMB = MemoryUsageSupport::highUsageDeltaMB(); - int memoryUsageMB = getMemoryUsageInMB(); + int memoryUsageMB = MemoryUsageSupport::memoryUsageMB(); if ((memoryUsageMB > lowMemoryUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highMemoryUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB)) v8::V8::LowMemoryNotification(); #endif diff --git a/Source/WebCore/bindings/v8/V8Utilities.cpp b/Source/WebCore/bindings/v8/V8Utilities.cpp index 7d9334d0e..57d130a7c 100644 --- a/Source/WebCore/bindings/v8/V8Utilities.cpp +++ b/Source/WebCore/bindings/v8/V8Utilities.cpp @@ -92,26 +92,17 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A return true; } - if (!value->IsObject()) { - V8Proxy::throwTypeError("TransferArray argument must be an object"); - return false; - } uint32_t length = 0; - v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); - if (value->IsArray()) { v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); length = array->Length(); } else { - // Sequence-type object - get the length attribute - v8::Local<v8::Value> sequenceLength = transferrables->Get(v8::String::New("length")); - if (!sequenceLength->IsNumber()) { - V8Proxy::throwTypeError("TransferArray argument has no length attribute"); + if (toV8Sequence(value, length).IsEmpty()) return false; - } - length = sequenceLength->Uint32Value(); } + v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); + // Validate the passed array of transferrables. for (unsigned int i = 0; i < length; ++i) { v8::Local<v8::Value> transferrable = transferrables->Get(i); @@ -126,7 +117,7 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A else if (V8ArrayBuffer::HasInstance(transferrable)) arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(transferrable))); else { - V8Proxy::throwTypeError("TransferArray argument must contain only Transferables"); + V8Proxy::throwTypeError(); return false; } } diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp index cb3262e52..0a9a3a078 100644 --- a/Source/WebCore/css/CSSFontSelector.cpp +++ b/Source/WebCore/css/CSSFontSelector.cpp @@ -586,6 +586,10 @@ void CSSFontSelector::beginLoadTimerFired(Timer<WebCore::CSSFontSelector>*) } // Ensure that if the request count reaches zero, the frame loader will know about it. cachedResourceLoader->loadDone(); + // New font loads may be triggered by layout after the document load is complete but before we have dispatched + // didFinishLoading for the frame. Make sure the delegate is always dispatched by checking explicitly. + if (m_document && m_document->frame()) + m_document->frame()->loader()->checkLoadComplete(); } } diff --git a/Source/WebCore/dom/Attr.cpp b/Source/WebCore/dom/Attr.cpp index de9e4ff43..95c3fe052 100644 --- a/Source/WebCore/dom/Attr.cpp +++ b/Source/WebCore/dom/Attr.cpp @@ -119,7 +119,7 @@ void Attr::setValue(const AtomicString& value) createTextChild(); m_ignoreChildrenChanged--; - invalidateNodeListsCacheAfterAttributeChanged(m_name, m_element); + invalidateNodeListCachesInAncestors(&m_name, m_element); } void Attr::setValue(const AtomicString& value, ExceptionCode&) @@ -162,7 +162,7 @@ void Attr::childrenChanged(bool, Node*, Node*, int) if (m_ignoreChildrenChanged > 0) return; - invalidateNodeListsCacheAfterAttributeChanged(qualifiedName(), m_element); + invalidateNodeListCachesInAncestors(&qualifiedName(), m_element); // FIXME: We should include entity references in the value diff --git a/Source/WebCore/dom/ChildNodeList.cpp b/Source/WebCore/dom/ChildNodeList.cpp index 4b50bc88e..86fab6f30 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, RootedAtNode, DoNotInvalidateOnAttributeChange) + : DynamicNodeList(node, NodeListIsRootedAtNode, DoNotInvalidateOnAttributeChanges) { } diff --git a/Source/WebCore/dom/ClassNodeList.cpp b/Source/WebCore/dom/ClassNodeList.cpp index 36a89e4e6..14db32478 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) + : DynamicSubtreeNodeList(rootNode, InvalidateOnClassAttrChange) , m_classNames(classNames, document()->inQuirksMode()) , m_originalClassNames(classNames) { diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp index 1d8feed18..2faf8593c 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp @@ -51,18 +51,18 @@ static inline ElementShadow* shadowOfParent(const Node* node) return 0; } -inline void ComposedShadowTreeWalker::ParentTranversalDetails::didTraverseInsertionPoint(InsertionPoint* insertionPoint) +inline void ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseInsertionPoint(InsertionPoint* insertionPoint) { if (!m_insertionPoint) m_insertionPoint = insertionPoint; } -inline void ComposedShadowTreeWalker::ParentTranversalDetails::didTraverseShadowRoot(const ShadowRoot* root) +inline void ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseShadowRoot(const ShadowRoot* root) { m_resetStyleInheritance = m_resetStyleInheritance || root->resetStyleInheritance(); } -inline void ComposedShadowTreeWalker::ParentTranversalDetails::didFindNode(ContainerNode* node) +inline void ComposedShadowTreeWalker::ParentTraversalDetails::didFindNode(ContainerNode* node) { if (!m_outOfComposition) m_node = node; @@ -75,7 +75,7 @@ ComposedShadowTreeWalker ComposedShadowTreeWalker::fromFirstChild(const Node* no return walker; } -void ComposedShadowTreeWalker::findParent(const Node* node, ParentTranversalDetails* details) +void ComposedShadowTreeWalker::findParent(const Node* node, ParentTraversalDetails* details) { ComposedShadowTreeWalker walker(node, CrossUpperBoundary, CanStartFromShadowBoundary); ContainerNode* found = toContainerNode(walker.traverseParent(walker.get(), details)); @@ -203,7 +203,7 @@ inline Node* ComposedShadowTreeWalker::escapeFallbackContentElement(const Node* return 0; } -inline Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node, ParentTranversalDetails* details) const +inline Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node, ParentTraversalDetails* details) const { ASSERT(node); if (!isInsertionPoint(node)) @@ -222,7 +222,7 @@ void ComposedShadowTreeWalker::parent() // FIXME: Use an iterative algorithm so that it can be inlined. // https://bugs.webkit.org/show_bug.cgi?id=90415 -Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTranversalDetails* details) const +Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTraversalDetails* details) const { if (!canCrossUpperBoundary() && node->isShadowRoot()) { ASSERT(toShadowRoot(node)->isYoungest()); @@ -243,14 +243,14 @@ Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTranversa return traverseParentInCurrentTree(node, details); } -inline Node* ComposedShadowTreeWalker::traverseParentInCurrentTree(const Node* node, ParentTranversalDetails* details) const +inline Node* ComposedShadowTreeWalker::traverseParentInCurrentTree(const Node* node, ParentTraversalDetails* details) const { if (Node* parent = node->parentNode()) return parent->isShadowRoot() ? traverseParentBackToYoungerShadowRootOrHost(toShadowRoot(parent), details) : traverseNodeEscapingFallbackContents(parent, details); return 0; } -Node* ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot* shadowRoot, ParentTranversalDetails* details) const +Node* ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot* shadowRoot, ParentTraversalDetails* details) const { ASSERT(shadowRoot); if (shadowRoot->isYoungest()) { diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.h b/Source/WebCore/dom/ComposedShadowTreeWalker.h index 0af34cd42..3c7e00ba4 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.h +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.h @@ -49,9 +49,9 @@ public: CannotStartFromShadowBoundary }; - class ParentTranversalDetails { + class ParentTraversalDetails { public: - ParentTranversalDetails() + ParentTraversalDetails() : m_node(0) , m_insertionPoint(0) , m_resetStyleInheritance(false) @@ -80,7 +80,7 @@ public: // For a common use case such as: // for (ComposedShadowTreeWalker walker = ComposedShadowTreeWalker::fromFirstChild(node); walker.get(); walker.nextSibling()) static ComposedShadowTreeWalker fromFirstChild(const Node*, Policy = CrossUpperBoundary); - static void findParent(const Node*, ParentTranversalDetails*); + static void findParent(const Node*, ParentTraversalDetails*); Node* get() const { return const_cast<Node*>(m_node); } @@ -96,7 +96,7 @@ public: void previous(); private: - ComposedShadowTreeWalker(const Node*, ParentTranversalDetails*); + ComposedShadowTreeWalker(const Node*, ParentTraversalDetails*); enum TraversalDirection { TraversalDirectionForward, @@ -131,7 +131,7 @@ private: Node* traverseFirstChild(const Node*) const; Node* traverseLastChild(const Node*) const; Node* traverseChild(const Node*, TraversalDirection) const; - Node* traverseParent(const Node*, ParentTranversalDetails* = 0) const; + Node* traverseParent(const Node*, ParentTraversalDetails* = 0) const; static Node* traverseNextSibling(const Node*); static Node* traversePreviousSibling(const Node*); @@ -142,9 +142,9 @@ private: static Node* traverseSiblingOrBackToYoungerShadowRoot(const Node*, TraversalDirection); static Node* escapeFallbackContentElement(const Node*, TraversalDirection); - Node* traverseNodeEscapingFallbackContents(const Node*, ParentTranversalDetails* = 0) const; - Node* traverseParentInCurrentTree(const Node*, ParentTranversalDetails* = 0) const; - Node* traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot*, ParentTranversalDetails* = 0) const; + Node* traverseNodeEscapingFallbackContents(const Node*, ParentTraversalDetails* = 0) const; + Node* traverseParentInCurrentTree(const Node*, ParentTraversalDetails* = 0) const; + Node* traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot*, ParentTraversalDetails* = 0) const; const Node* m_node; Policy m_policy; diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index c23a0b9e9..fd53a2fad 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -680,7 +680,7 @@ void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil document()->incDOMTreeVersion(); if (!changedByParser && childCountDelta) document()->updateRangesAfterChildrenChanged(this); - invalidateNodeListsCacheAfterChildrenChanged(); + invalidateNodeListCachesInAncestors(); } void ContainerNode::cloneChildNodes(ContainerNode *clone) diff --git a/Source/WebCore/dom/DOMAllInOne.cpp b/Source/WebCore/dom/DOMAllInOne.cpp index 592d72992..be7bd07c1 100644 --- a/Source/WebCore/dom/DOMAllInOne.cpp +++ b/Source/WebCore/dom/DOMAllInOne.cpp @@ -84,6 +84,8 @@ #include "ExceptionBase.cpp" #include "ExceptionCodePlaceholder.cpp" #include "IconURL.cpp" +#include "IdTargetObserver.cpp" +#include "IdTargetObserverRegistry.cpp" #include "KeyboardEvent.cpp" #include "MessageChannel.cpp" #include "MessageEvent.cpp" @@ -144,6 +146,7 @@ #include "ViewportArguments.cpp" #include "WebKitAnimationEvent.cpp" #include "WebKitNamedFlow.cpp" +#include "WebKitNamedFlowCollection.cpp" #include "WebKitTransitionEvent.cpp" #include "WheelEvent.cpp" #include "WindowEventContext.cpp" diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index bc5eabbda..64167fcec 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -157,6 +157,7 @@ #include "UndoManager.h" #include "UserContentURLPattern.h" #include "WebKitNamedFlow.h" +#include "WebKitNamedFlowCollection.h" #include "XMLDocumentParser.h" #include "XMLHttpRequest.h" #include "XMLNSNames.h" @@ -564,7 +565,10 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) static int docID = 0; m_docID = docID++; - + + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) + m_nodeListCounts[i] = 0; + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_collections); i++) m_collections[i] = 0; @@ -615,6 +619,9 @@ Document::~Document() if (m_styleSheets) m_styleSheets->documentDestroyed(); + if (m_namedFlows) + m_namedFlows->documentDestroyed(); + if (m_elemSheet) m_elemSheet->clearOwnerNode(); if (m_pageUserSheet) @@ -648,6 +655,14 @@ Document::~Document() if (hasRareData()) clearRareData(); + ASSERT(!m_listsInvalidatedAtDocument.size()); + + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) + ASSERT(!m_nodeListCounts[i]); + + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_collections); i++) + ASSERT(!m_collections[i]); + m_document = 0; InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); @@ -804,7 +819,6 @@ void Document::setDocType(PassRefPtr<DocumentType> docType) if (m_docType) { this->adoptIfNeeded(m_docType.get()); #if ENABLE(LEGACY_VIEWPORT_ADAPTION) - ASSERT(m_viewportArguments.type == ViewportArguments::Implicit); if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false)) processViewport("width=device-width, height=device-height", ViewportArguments::XHTMLMobileProfile); #endif @@ -1116,44 +1130,26 @@ bool Document::cssGridLayoutEnabled() const #if ENABLE(CSS_REGIONS) -static bool validFlowName(const String& flowName) -{ - if (equalIgnoringCase(flowName, "auto") - || equalIgnoringCase(flowName, "default") - || equalIgnoringCase(flowName, "inherit") - || equalIgnoringCase(flowName, "initial") - || equalIgnoringCase(flowName, "none")) - return false; - return true; -} - PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName) { - return webkitGetFlowByName(flowName, CheckFlowNameForInvalidValues); -} - -PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName, FlowNameCheck flowNameCheck) -{ if (!cssRegionsEnabled() || !renderer()) return 0; - if (flowNameCheck == CheckFlowNameForInvalidValues) { - if (flowName.isEmpty() || !validFlowName(flowName)) - return 0; - - // Make a slower check for invalid flow name. - CSSParser parser(document()); - if (!parser.parseFlowThread(flowName)) - return 0; - } + // It's possible to have pending styles not applied that affect the existing flows. + updateStyleIfNeeded(); - if (RenderView* view = renderer()->view()) - return view->flowThreadController()->ensureRenderFlowThreadWithName(flowName)->ensureNamedFlow(); - return 0; + return namedFlows()->flowByName(flowName); } - #endif +WebKitNamedFlowCollection* Document::namedFlows() +{ + if (!m_namedFlows) + m_namedFlows = WebKitNamedFlowCollection::create(this); + + return m_namedFlows.get(); +} + PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec) { String prefix, localName; @@ -2084,6 +2080,11 @@ void Document::detach() ASSERT(attached()); ASSERT(!m_inPageCache); +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->documentDetached(this); +#endif + if (this == topDocument()) clearAXObjectCache(); @@ -3865,20 +3866,48 @@ void Document::setCSSTarget(Element* n) n->setNeedsStyleRecalc(); } -void Document::registerDynamicSubtreeNodeList(DynamicSubtreeNodeList* list) +void Document::registerNodeListCache(DynamicNodeListCacheBase* list) { - m_listsInvalidatedAtDocument.add(list); + if (list->type() != InvalidCollectionType) + m_nodeListCounts[InvalidateOnIdNameAttrChange]++; + m_nodeListCounts[list->invalidationType()]++; + if (list->isRootedAtDocument()) + m_listsInvalidatedAtDocument.add(list); } -void Document::unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList* list) +void Document::unregisterNodeListCache(DynamicNodeListCacheBase* list) { - m_listsInvalidatedAtDocument.remove(list); + if (list->type() != InvalidCollectionType) + m_nodeListCounts[InvalidateOnIdNameAttrChange]--; + m_nodeListCounts[list->invalidationType()]--; + if (list->isRootedAtDocument()) { + ASSERT(m_listsInvalidatedAtDocument.contains(list)); + m_listsInvalidatedAtDocument.remove(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::clearNodeListCaches() { - HashSet<DynamicSubtreeNodeList*>::iterator end = m_listsInvalidatedAtDocument.end(); - for (HashSet<DynamicSubtreeNodeList*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) + HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end(); + for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) (*it)->invalidateCache(); } @@ -5965,7 +5994,7 @@ PassRefPtr<NodeList> Document::getItems(const String& typeNames) // In this case we need to create an unique string identifier to map such request in the cache. String localTypeNames = typeNames.isNull() ? MicroDataItemList::undefinedItemType() : typeNames; - return ensureRareData()->ensureNodeLists(this)->addCacheWithName<MicroDataItemList>(this, DynamicNodeList::MicroDataItemListType, localTypeNames); + return ensureRareData()->ensureNodeLists()->addCacheWithName<MicroDataItemList>(this, DynamicNodeList::MicroDataItemListType, localTypeNames); } #endif diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 87dfa32c2..2f4db13ce 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -79,6 +79,7 @@ class DocumentMarkerController; class DocumentParser; class DocumentType; class DocumentWeakReference; +class DynamicNodeListCacheBase; class EditingText; class Element; class EntityReference; @@ -137,6 +138,7 @@ class TextResourceDecoder; class TreeWalker; class UndoManager; class WebKitNamedFlow; +class WebKitNamedFlowCollection; class XMLHttpRequest; class XPathEvaluator; class XPathExpression; @@ -186,6 +188,19 @@ enum PageshowEventPersistence { enum StyleResolverUpdateFlag { RecalcStyleImmediately, DeferRecalcStyle, RecalcStyleIfNeeded }; +enum NodeListInvalidationType { + DoNotInvalidateOnAttributeChanges = 0, + InvalidateOnClassAttrChange, + InvalidateOnIdNameAttrChange, + InvalidateOnNameAttrChange, + InvalidateOnForAttrChange, + InvalidateForFormControls, + InvalidateOnHRefAttrChange, + InvalidateOnItemAttrChange, + InvalidateOnAnyAttrChange, +}; +const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1; + class Document : public ContainerNode, public TreeScope, public ScriptExecutionContext { public: static PassRefPtr<Document> create(Frame* frame, const KURL& url) @@ -332,14 +347,11 @@ public: bool cssRegionsEnabled() const; #if ENABLE(CSS_REGIONS) - enum FlowNameCheck { - CheckFlowNameForInvalidValues, - DoNotCheckFlowNameForInvalidValues - }; PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&); - PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&, FlowNameCheck); #endif + WebKitNamedFlowCollection* namedFlows(); + bool regionBasedColumnsEnabled() const; bool cssGridLayoutEnabled() const; @@ -723,8 +735,9 @@ public: bool isPendingStyleRecalc() const; void styleRecalcTimerFired(Timer<Document>*); - void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*); - void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*); + void registerNodeListCache(DynamicNodeListCacheBase*); + void unregisterNodeListCache(DynamicNodeListCacheBase*); + bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const; void clearNodeListCaches(); void attachNodeIterator(NodeIterator*); @@ -1408,7 +1421,8 @@ private: InheritedBool m_designMode; - HashSet<DynamicSubtreeNodeList*> m_listsInvalidatedAtDocument; + HashSet<DynamicNodeListCacheBase*> m_listsInvalidatedAtDocument; + unsigned m_nodeListCounts[numNodeListInvalidationTypes]; HTMLCollection* m_collections[NumUnnamedDocumentCachedTypes]; typedef HashMap<AtomicString, HTMLNameCollection*> NamedCollectionMap; @@ -1516,6 +1530,8 @@ private: bool m_visualUpdatesAllowed; Timer<Document> m_visualUpdatesSuppressionTimer; + RefPtr<WebKitNamedFlowCollection> m_namedFlows; + #ifndef NDEBUG bool m_didDispatchViewportPropertiesChanged; #endif diff --git a/Source/WebCore/dom/DynamicNodeList.cpp b/Source/WebCore/dom/DynamicNodeList.cpp index b97125c6b..25a4504e3 100644 --- a/Source/WebCore/dom/DynamicNodeList.cpp +++ b/Source/WebCore/dom/DynamicNodeList.cpp @@ -25,11 +25,30 @@ #include "Document.h" #include "Element.h" +#include "HTMLCollection.h" +#include "HTMLPropertiesCollection.h" namespace WebCore { -DynamicSubtreeNodeList::~DynamicSubtreeNodeList() +void DynamicNodeListCacheBase::invalidateCache() const { + m_cachedItem = 0; + m_isLengthCacheValid = false; + m_isItemCacheValid = false; + m_isNameCacheValid = false; + if (type() == InvalidCollectionType) + return; + + const HTMLCollectionCacheBase* cacheBase = static_cast<const HTMLCollectionCacheBase*>(this); + cacheBase->m_idCache.clear(); + cacheBase->m_nameCache.clear(); + cacheBase->m_cachedElementsArrayOffset = 0; + +#if ENABLE(MICRODATA) + // FIXME: There should be more generic mechanism to clear caches in subclasses. + if (type() == ItemProperties) + static_cast<const HTMLPropertiesCollection*>(this)->invalidateCache(); +#endif } unsigned DynamicSubtreeNodeList::length() const diff --git a/Source/WebCore/dom/DynamicNodeList.h b/Source/WebCore/dom/DynamicNodeList.h index 83b2ed3eb..a3c12c2d9 100644 --- a/Source/WebCore/dom/DynamicNodeList.h +++ b/Source/WebCore/dom/DynamicNodeList.h @@ -24,7 +24,9 @@ #ifndef DynamicNodeList_h #define DynamicNodeList_h +#include "CollectionType.h" #include "Document.h" +#include "HTMLNames.h" #include "NodeList.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> @@ -34,30 +36,45 @@ namespace WebCore { class Element; class Node; +enum NodeListRootType { + NodeListIsRootedAtNode, + NodeListIsRootedAtDocument, +}; + class DynamicNodeListCacheBase { public: - enum RootType { - RootedAtNode, - RootedAtDocument, + enum ItemBeforeSupportType { + DoNotSupportItemBefore, + SupportItemBefore, }; - enum InvalidationType { - AlwaysInvalidate, - DoNotInvalidateOnAttributeChange, - }; - - DynamicNodeListCacheBase(RootType rootType, InvalidationType invalidationType) - : m_rootedAtDocument(rootType == RootedAtDocument) - , m_shouldInvalidateOnAttributeChange(invalidationType == AlwaysInvalidate) + DynamicNodeListCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, + CollectionType collectionType = InvalidCollectionType, ItemBeforeSupportType itemBeforeSupportType = DoNotSupportItemBefore) + : m_cachedItem(0) + , m_isLengthCacheValid(false) + , m_isItemCacheValid(false) + , m_rootedAtDocument(rootType == NodeListIsRootedAtDocument) + , m_invalidationType(invalidationType) + , m_isNameCacheValid(false) + , m_collectionType(collectionType) + , m_supportsItemBefore(itemBeforeSupportType == SupportItemBefore) { - clearCache(); + ASSERT(m_invalidationType == static_cast<unsigned>(invalidationType)); + ASSERT(m_collectionType == static_cast<unsigned>(collectionType)); } public: ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootedAtDocument; } - ALWAYS_INLINE bool shouldInvalidateOnAttributeChange() const { return m_shouldInvalidateOnAttributeChange; } + ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); } + ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionType>(m_collectionType); } + + void invalidateCache() const; + + static bool shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType, const QualifiedName&); protected: + bool supportsItemBefore() const { return m_supportsItemBefore; } + ALWAYS_INLINE bool isItemCacheValid() const { return m_isItemCacheValid; } ALWAYS_INLINE Node* cachedItem() const { return m_cachedItem; } ALWAYS_INLINE unsigned cachedItemOffset() const { return m_cachedItemOffset; } @@ -71,17 +88,14 @@ protected: } ALWAYS_INLINE void setItemCache(Node* item, unsigned offset) const { + ASSERT(item); m_cachedItem = item; m_cachedItemOffset = offset; m_isItemCacheValid = true; } - void clearCache() const - { - m_cachedItem = 0; - m_isLengthCacheValid = false; - m_isItemCacheValid = false; - } + bool hasNameCache() const { return m_isNameCacheValid; } + void setHasNameCache() const { m_isNameCacheValid = true; } private: mutable Node* m_cachedItem; @@ -89,12 +103,42 @@ private: mutable unsigned m_cachedItemOffset; mutable unsigned m_isLengthCacheValid : 1; mutable unsigned m_isItemCacheValid : 1; - - // From DynamicNodeList const unsigned m_rootedAtDocument : 1; - const unsigned m_shouldInvalidateOnAttributeChange : 1; + const unsigned m_invalidationType : 4; + + // From HTMLCollection + mutable unsigned m_isNameCacheValid : 1; + const unsigned m_collectionType : 5; + const unsigned m_supportsItemBefore : 1; }; +ALWAYS_INLINE bool DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType type, const QualifiedName& attrName) +{ + switch (type) { + case InvalidateOnClassAttrChange: + return attrName == HTMLNames::classAttr; + case InvalidateOnNameAttrChange: + return attrName == HTMLNames::nameAttr; + case InvalidateOnIdNameAttrChange: + return attrName == HTMLNames::idAttr || attrName == HTMLNames::nameAttr; + case InvalidateOnForAttrChange: + return attrName == HTMLNames::forAttr; + case InvalidateForFormControls: + return attrName == HTMLNames::nameAttr || attrName == HTMLNames::idAttr || attrName == HTMLNames::forAttr || attrName == HTMLNames::typeAttr; + case InvalidateOnHRefAttrChange: + return attrName == HTMLNames::hrefAttr; + case InvalidateOnItemAttrChange: +#if ENABLE(MICRODATA) + return attrName == HTMLNames::itemscopeAttr || attrName == HTMLNames::itempropAttr || attrName == HTMLNames::itemtypeAttr; +#endif // Intentionally fall through + case DoNotInvalidateOnAttributeChanges: + return false; + case InvalidateOnAnyAttrChange: + return true; + } + return false; +} + class DynamicNodeList : public NodeList, public DynamicNodeListCacheBase { public: enum NodeListType { @@ -106,7 +150,7 @@ public: LabelsNodeListType, MicroDataItemListType, }; - DynamicNodeList(PassRefPtr<Node> ownerNode, RootType rootType, InvalidationType invalidationType) + DynamicNodeList(PassRefPtr<Node> ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType) : DynamicNodeListCacheBase(rootType, invalidationType) , m_ownerNode(ownerNode) { } @@ -119,7 +163,6 @@ public: // Other methods (not part of DOM) Node* ownerNode() const { return m_ownerNode.get(); } - void invalidateCache() { clearCache(); } protected: Node* rootNode() const @@ -138,14 +181,19 @@ private: class DynamicSubtreeNodeList : public DynamicNodeList { public: - virtual ~DynamicSubtreeNodeList(); + virtual ~DynamicSubtreeNodeList() + { + document()->unregisterNodeListCache(this); + } virtual unsigned length() const OVERRIDE; virtual Node* item(unsigned index) const OVERRIDE; protected: - DynamicSubtreeNodeList(PassRefPtr<Node> node, RootType rootType = RootedAtNode, InvalidationType invalidationType = AlwaysInvalidate) + DynamicSubtreeNodeList(PassRefPtr<Node> node, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) : DynamicNodeList(node, rootType, invalidationType) - { } + { + document()->registerNodeListCache(this); + } private: Node* itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const; diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 2287f40b1..eb1733b5d 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -705,7 +705,7 @@ void Element::attributeChanged(const Attribute& attribute) setNeedsStyleRecalc(); } - invalidateNodeListsCacheAfterAttributeChanged(attribute.name(), this); + invalidateNodeListCachesInAncestors(&attribute.name(), this); if (!AXObjectCache::accessibilityEnabled()) return; @@ -913,6 +913,10 @@ void Element::removedFrom(ContainerNode* insertionPoint) if (containsFullScreenElement()) setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); #endif +#if ENABLE(POINTER_LOCK) + if (document()->page()) + document()->page()->pointerLockController()->elementRemoved(this); +#endif setSavedLayerScrollOffset(IntSize()); @@ -937,6 +941,9 @@ void Element::attach() createRendererIfNeeded(); StyleResolverParentPusher parentPusher(this); + if (parentElement() && parentElement()->isInCanvasSubtree()) + setIsInCanvasSubtree(true); + // When a shadow root exists, it does the work of attaching the children. if (ElementShadow* shadow = this->shadow()) { parentPusher.push(); @@ -975,8 +982,10 @@ void Element::detach() RenderWidget::suspendWidgetHierarchyUpdates(); unregisterNamedFlowContentNode(); cancelFocusAppearanceUpdate(); - if (hasRareData()) + if (hasRareData()) { + setIsInCanvasSubtree(false); elementRareData()->resetComputedStyle(); + } if (ElementShadow* shadow = this->shadow()) { detachChildrenIfNeeded(); @@ -1671,6 +1680,17 @@ bool Element::styleAffectedByEmpty() const return hasRareData() && elementRareData()->m_styleAffectedByEmpty; } +void Element::setIsInCanvasSubtree(bool isInCanvasSubtree) +{ + ElementRareData* data = ensureElementRareData(); + data->m_isInCanvasSubtree = isInCanvasSubtree; +} + +bool Element::isInCanvasSubtree() const +{ + return hasRareData() && elementRareData()->m_isInCanvasSubtree; +} + AtomicString Element::computeInheritedLanguage() const { const Node* n = this; @@ -1874,7 +1894,8 @@ void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo #if ENABLE(POINTER_LOCK) void Element::webkitRequestPointerLock() { - document()->frame()->page()->pointerLockController()->requestPointerLock(this, 0, 0); + if (document()->page()) + document()->page()->pointerLockController()->requestPointerLock(this, 0, 0); } #endif diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 1d576a81a..0c338d6cb 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -268,6 +268,7 @@ public: ElementShadow* shadow() const; ElementShadow* ensureShadow(); + virtual void willAddAuthorShadowRoot() { } // FIXME: Remove Element::ensureShadowRoot // https://bugs.webkit.org/show_bug.cgi?id=77608 @@ -281,6 +282,9 @@ public: void setStyleAffectedByEmpty(); bool styleAffectedByEmpty() const; + void setIsInCanvasSubtree(bool); + bool isInCanvasSubtree() const; + AtomicString computeInheritedLanguage() const; virtual void accessKeyAction(bool /*sendToAnyEvent*/) { } diff --git a/Source/WebCore/dom/ElementRareData.h b/Source/WebCore/dom/ElementRareData.h index 3723d1a08..07394ebd1 100644 --- a/Source/WebCore/dom/ElementRareData.h +++ b/Source/WebCore/dom/ElementRareData.h @@ -26,6 +26,7 @@ #include "DatasetDOMStringMap.h" #include "Element.h" #include "ElementShadow.h" +#include "HTMLCollection.h" #include "NamedNodeMap.h" #include "NodeRareData.h" #include <wtf/OwnPtr.h> @@ -57,6 +58,7 @@ public: return (*m_cachedCollections)[type - FirstNodeCollectionType]; } + void removeCachedHTMLCollection(HTMLCollection* collection, CollectionType type) { ASSERT(m_cachedCollections); @@ -64,6 +66,38 @@ public: (*m_cachedCollections)[type - FirstNodeCollectionType] = 0; } + void clearHTMLCollectionCaches(const QualifiedName* attrName) + { + if (!m_cachedCollections) + return; + + bool shouldIgnoreType = !attrName || *attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr; + + for (unsigned i = 0; i < (*m_cachedCollections).size(); i++) { + if (HTMLCollection* collection = (*m_cachedCollections)[i]) { + if (shouldIgnoreType || DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(collection->invalidationType(), *attrName)) + collection->invalidateCache(); + } + } + } + + void adoptTreeScope(Document* oldDocument, Document* newDocument) + { + if (!m_cachedCollections) + return; + + for (unsigned i = 0; i < (*m_cachedCollections).size(); i++) { + HTMLCollection* collection = (*m_cachedCollections)[i]; + if (!collection) + continue; + collection->invalidateCache(); + if (oldDocument != newDocument) { + oldDocument->unregisterNodeListCache(collection); + newDocument->registerNodeListCache(collection); + } + } + } + typedef FixedArray<HTMLCollection*, NumNodeCollectionTypes> CachedHTMLCollectionArray; OwnPtr<CachedHTMLCollectionArray> m_cachedCollections; @@ -76,7 +110,8 @@ public: OwnPtr<ElementShadow> m_shadow; OwnPtr<NamedNodeMap> m_attributeMap; - bool m_styleAffectedByEmpty; + bool m_styleAffectedByEmpty : 1; + bool m_isInCanvasSubtree : 1; IntSize m_savedLayerScrollOffset; @@ -94,6 +129,7 @@ inline ElementRareData::ElementRareData() : NodeRareData() , m_minimumSizeForResizing(defaultMinimumSizeForResizing()) , m_styleAffectedByEmpty(false) + , m_isInCanvasSubtree(false) #if ENABLE(FULLSCREEN_API) , m_containsFullScreenElement(false) #endif diff --git a/Source/WebCore/dom/ElementShadow.cpp b/Source/WebCore/dom/ElementShadow.cpp index 1f650f772..68a9b0189 100644 --- a/Source/WebCore/dom/ElementShadow.cpp +++ b/Source/WebCore/dom/ElementShadow.cpp @@ -65,7 +65,7 @@ static bool validateShadowRoot(Document* document, ShadowRoot* shadowRoot, Excep return true; } -void ElementShadow::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> shadowRoot, ExceptionCode& ec) +void ElementShadow::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> shadowRoot, ShadowRoot::ShadowRootType type, ExceptionCode& ec) { ASSERT(shadowHost); ASSERT(shadowRoot); @@ -73,6 +73,9 @@ void ElementShadow::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> sh if (!validateShadowRoot(shadowHost->document(), shadowRoot.get(), ec)) return; + if (type == ShadowRoot::AuthorShadowRoot) + shadowHost->willAddAuthorShadowRoot(); + shadowRoot->setHost(shadowHost); shadowRoot->setParentTreeScope(shadowHost->treeScope()); m_shadowRoots.push(shadowRoot.get()); diff --git a/Source/WebCore/dom/ElementShadow.h b/Source/WebCore/dom/ElementShadow.h index 13de1c021..6f650112a 100644 --- a/Source/WebCore/dom/ElementShadow.h +++ b/Source/WebCore/dom/ElementShadow.h @@ -53,7 +53,7 @@ public: ShadowRoot* oldestShadowRoot() const; void removeAllShadowRoots(); - void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ExceptionCode&); + void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ShadowRoot::ShadowRootType, ExceptionCode&); void attach(); void detach(); diff --git a/Source/WebCore/dom/IdTargetObserver.cpp b/Source/WebCore/dom/IdTargetObserver.cpp new file mode 100644 index 000000000..afadd38f9 --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserver.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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. + */ + +#include "config.h" +#include "IdTargetObserver.h" + +#include "IdTargetObserverRegistry.h" + +namespace WebCore { + +IdTargetObserver::IdTargetObserver(IdTargetObserverRegistry& registry, const AtomicString& id) + : m_registry(®istry) + , m_id(id) +{ + m_registry->addObserver(m_id, this); +} + +IdTargetObserver::~IdTargetObserver() +{ + if (m_registry) + m_registry->removeObserver(m_id, this); +} + +} // namespace WebCore diff --git a/Source/WebCore/dom/IdTargetObserver.h b/Source/WebCore/dom/IdTargetObserver.h new file mode 100644 index 000000000..f9007c478 --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserver.h @@ -0,0 +1,50 @@ +/* + * 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. ``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 IdTargetObserver_h +#define IdTargetObserver_h + +#include <wtf/text/AtomicString.h> + +namespace WebCore { + +class IdTargetObserverRegistry; + +class IdTargetObserver { +public: + virtual ~IdTargetObserver(); + virtual void idTargetChanged() = 0; + +protected: + IdTargetObserver(IdTargetObserverRegistry&, const AtomicString& id); + +private: + IdTargetObserverRegistry* m_registry; + AtomicString m_id; +}; + +} // namespace WebCore + +#endif // IdTargetObserver_h diff --git a/Source/WebCore/dom/IdTargetObserverRegistry.cpp b/Source/WebCore/dom/IdTargetObserverRegistry.cpp new file mode 100644 index 000000000..5fc26acfe --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserverRegistry.cpp @@ -0,0 +1,85 @@ +/* + * 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. ``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. + */ + +#include "config.h" +#include "IdTargetObserverRegistry.h" + +#include "IdTargetObserver.h" + +namespace WebCore { + +PassOwnPtr<IdTargetObserverRegistry> IdTargetObserverRegistry::create() +{ + return adoptPtr(new IdTargetObserverRegistry()); +} + +void IdTargetObserverRegistry::addObserver(const AtomicString& id, IdTargetObserver* observer) +{ + if (id.isEmpty()) + return; + + IdToObserverSetMap::AddResult result = m_registry.add(id.impl(), nullptr); + if (result.isNewEntry) + result.iterator->second = adoptPtr(new ObserverSet()); + + result.iterator->second->add(observer); +} + +void IdTargetObserverRegistry::removeObserver(const AtomicString& id, IdTargetObserver* observer) +{ + if (id.isEmpty() || m_registry.isEmpty()) + return; + + IdToObserverSetMap::iterator iter = m_registry.find(id.impl()); + + ObserverSet* set = iter->second.get(); + set->remove(observer); + if (set->isEmpty() && set != m_notifyingObserversInSet) + m_registry.remove(iter); +} + +void IdTargetObserverRegistry::notifyObserversInternal(const AtomicString& id) +{ + ASSERT(!id.isEmpty()); + ASSERT(!m_registry.isEmpty()); + + m_notifyingObserversInSet = m_registry.get(id.impl()); + if (!m_notifyingObserversInSet) + return; + + Vector<IdTargetObserver*> copy; + copyToVector(*m_notifyingObserversInSet, copy); + for (Vector<IdTargetObserver*>::const_iterator it = copy.begin(); it != copy.end(); ++it) { + if (m_notifyingObserversInSet->contains(*it)) + (*it)->idTargetChanged(); + } + + if (m_notifyingObserversInSet->isEmpty()) + m_registry.remove(id.impl()); + + m_notifyingObserversInSet = 0; +} + +} // namespace WebCore diff --git a/Source/WebCore/dom/IdTargetObserverRegistry.h b/Source/WebCore/dom/IdTargetObserverRegistry.h new file mode 100644 index 000000000..aba755210 --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserverRegistry.h @@ -0,0 +1,68 @@ +/* + * 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. ``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 IdTargetObserverRegistry_h +#define IdTargetObserverRegistry_h + +#include <wtf/Forward.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/text/AtomicString.h> + +namespace WebCore { + +class IdTargetObserver; + +class IdTargetObserverRegistry { + friend class IdTargetObserver; + +public: + static PassOwnPtr<IdTargetObserverRegistry> create(); + void notifyObservers(const AtomicString& id); + +private: + IdTargetObserverRegistry() : m_notifyingObserversInSet(0) { } + void addObserver(const AtomicString& id, IdTargetObserver*); + void removeObserver(const AtomicString& id, IdTargetObserver*); + void notifyObserversInternal(const AtomicString& id); + + typedef HashSet<IdTargetObserver*> ObserverSet; + typedef HashMap<AtomicStringImpl*, OwnPtr<ObserverSet> > IdToObserverSetMap; + IdToObserverSetMap m_registry; + ObserverSet* m_notifyingObserversInSet; +}; + +inline void IdTargetObserverRegistry::notifyObservers(const AtomicString& id) +{ + ASSERT(!m_notifyingObserversInSet); + if (id.isEmpty() || m_registry.isEmpty()) + return; + IdTargetObserverRegistry::notifyObserversInternal(id); +} + +} // namespace WebCore + +#endif // IdTargetObserverRegistry_h diff --git a/Source/WebCore/dom/MicroDataItemList.cpp b/Source/WebCore/dom/MicroDataItemList.cpp index 21c170a40..7b4863537 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) + : DynamicSubtreeNodeList(rootNode, InvalidateOnItemAttrChange) , m_typeNames(typeNames, document()->inQuirksMode()) , m_originalTypeNames(typeNames) { diff --git a/Source/WebCore/dom/NameNodeList.cpp b/Source/WebCore/dom/NameNodeList.cpp index 4ebbed1bc..34d5a534c 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) + : DynamicSubtreeNodeList(rootNode, InvalidateOnNameAttrChange) , m_name(name) { } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 0950cd933..7d2aa6f09 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -47,6 +47,7 @@ #include "DocumentType.h" #include "DynamicNodeList.h" #include "Element.h" +#include "ElementRareData.h" #include "ElementShadow.h" #include "Event.h" #include "EventContext.h" @@ -489,8 +490,6 @@ OwnPtr<NodeRareData> Node::createRareData() void Node::clearRareData() { ASSERT(hasRareData()); - if (treeScope() && rareData()->nodeLists()) - treeScope()->removeNodeListCache(); #if ENABLE(MUTATION_OBSERVERS) ASSERT(!transientMutationObserverRegistry() || transientMutationObserverRegistry()->isEmpty()); @@ -920,7 +919,17 @@ bool Node::isFocusable() const // If the node is in a display:none tree it might say it needs style recalc but // the whole document is actually up to date. ASSERT(!document()->childNeedsStyleRecalc()); - + + // Elements in canvas fallback content are not rendered, but they are allowed to be + // focusable as long as their canvas is displayed and visible. + if (isElementNode() && toElement(this)->isInCanvasSubtree()) { + const Element* e = toElement(this); + while (e && !e->hasLocalName(canvasTag)) + e = e->parentElement(); + ASSERT(e); + return e->renderer() && e->renderer()->style()->visibility() == VISIBLE; + } + // FIXME: Even if we are not visible, we might have a child that is visible. // Hyatt wants to fix that some day with a "has visible content" flag or the like. if (!renderer() || renderer()->style()->visibility() != VISIBLE) @@ -953,70 +962,28 @@ unsigned Node::nodeIndex() const return count; } -void Node::invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName& attrName, Element* attributeOwnerElement) +void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement) { - if (hasRareData() && isAttributeNode()) { - NodeRareData* data = rareData(); - ASSERT(!data->nodeLists()); - data->clearChildNodeListCache(); - } + if (hasRareData() && (!attrName || isAttributeNode())) + rareData()->clearChildNodeListCache(); // Modifications to attributes that are not associated with an Element can't invalidate NodeList caches. - if (!attributeOwnerElement) + if (attrName && !attributeOwnerElement) return; - // FIXME: Move the list of attributes each NodeList type cares about to be a static on the - // appropriate NodeList class. Then use those lists here and in invalidateCachesThatDependOnAttributes - // to only invalidate the cache types that depend on the attribute that changed. - // FIXME: Keep track of when we have no caches of a given type so that we can avoid the for-loop - // below even if a related attribute changed (e.g. if we have no RadioNodeLists, we don't need - // to invalidate any caches when id attributes change.) - if (attrName != classAttr -#if ENABLE(MICRODATA) - && attrName != itemscopeAttr - && attrName != itempropAttr - && attrName != itemtypeAttr -#endif - && attrName != nameAttr - && attrName != forAttr - && (attrName != idAttr || !attributeOwnerElement->isFormControlElement())) + if (!document()->shouldInvalidateNodeListCaches()) return; document()->clearNodeListCaches(); - if (!treeScope()->hasNodeListCaches()) - return; - for (Node* node = this; node; node = node->parentNode()) { - ASSERT(this == node || !node->isAttributeNode()); if (!node->hasRareData()) continue; NodeRareData* data = node->rareData(); - if (!data->nodeLists()) - continue; - - data->nodeLists()->invalidateCaches(&attrName); - } -} - -void Node::invalidateNodeListsCacheAfterChildrenChanged() -{ - if (hasRareData()) - rareData()->clearChildNodeListCache(); - - document()->clearNodeListCaches(); - - if (!treeScope()->hasNodeListCaches()) - return; - - for (Node* node = this; node; node = node->parentNode()) { - if (!node->hasRareData()) - continue; - NodeRareData* data = node->rareData(); - if (!data->nodeLists()) - continue; - - data->nodeLists()->invalidateCaches(); + if (data->nodeLists()) + data->nodeLists()->invalidateCaches(attrName); + if (node->isElementNode()) + static_cast<ElementRareData*>(data)->clearHTMLCollectionCaches(attrName); } } @@ -1563,8 +1530,8 @@ PassRefPtr<NodeList> Node::getElementsByTagName(const AtomicString& localName) return 0; if (document()->isHTMLDocument()) - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<HTMLTagNodeList>(this, DynamicNodeList::TagNodeListType, localName); - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<TagNodeList>(this, DynamicNodeList::TagNodeListType, localName); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLTagNodeList>(this, DynamicNodeList::TagNodeListType, localName); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<TagNodeList>(this, DynamicNodeList::TagNodeListType, localName); } PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName) @@ -1575,23 +1542,23 @@ PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceU if (namespaceURI == starAtom) return getElementsByTagName(localName); - return ensureRareData()->ensureNodeLists(this)->addCacheWithQualifiedName(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); + return ensureRareData()->ensureNodeLists()->addCacheWithQualifiedName(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); } PassRefPtr<NodeList> Node::getElementsByName(const String& elementName) { - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<NameNodeList>(this, DynamicNodeList::NameNodeListType, elementName); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<NameNodeList>(this, DynamicNodeList::NameNodeListType, elementName); } PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames) { - return ensureRareData()->ensureNodeLists(this)->addCacheWithName<ClassNodeList>(this, DynamicNodeList::ClassNodeListType, classNames); + return ensureRareData()->ensureNodeLists()->addCacheWithName<ClassNodeList>(this, DynamicNodeList::ClassNodeListType, classNames); } PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name) { ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<RadioNodeList>(this, DynamicNodeList::RadioNodeListType, name); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<RadioNodeList>(this, DynamicNodeList::RadioNodeListType, name); } PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionCode& ec) @@ -2257,14 +2224,16 @@ void NodeListsNodeData::invalidateCaches(const QualifiedName* attrName) { NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomicNameCaches.end(); for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begin(); it != atomicNameCacheEnd; ++it) { - if (!attrName || it->second->shouldInvalidateOnAttributeChange()) - it->second->invalidateCache(); + DynamicNodeList* list = it->second; + if (!attrName || DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(list->invalidationType(), *attrName)) + list->invalidateCache(); } NodeListNameCacheMap::const_iterator nameCacheEnd = m_nameCaches.end(); for (NodeListNameCacheMap::const_iterator it = m_nameCaches.begin(); it != nameCacheEnd; ++it) { - if (!attrName || it->second->shouldInvalidateOnAttributeChange()) - it->second->invalidateCache(); + DynamicNodeList* list = it->second; + if (!attrName || DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(list->invalidationType(), *attrName)) + list->invalidateCache(); } if (!attrName) @@ -2780,20 +2749,6 @@ void Node::setItemType(const String& value) #endif -void NodeRareData::createNodeLists(Node* node) -{ - ASSERT(node); - setNodeLists(NodeListsNodeData::create()); - if (TreeScope* treeScope = node->treeScope()) - treeScope->addNodeListCache(); -} - -void NodeRareData::clearChildNodeListCache() -{ - if (m_childNodeList) - m_childNodeList->invalidateCache(); -} - // It's important not to inline removedLastRef, because we don't want to inline the code to // delete a Node at each deref call site. void Node::removedLastRef() diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index 93a66d9ec..c9a28f49d 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -558,8 +558,7 @@ public: void showTreeForThisAcrossFrame() const; #endif - void invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName&, Element* attributeOwnerElement); - void invalidateNodeListsCacheAfterChildrenChanged(); + void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = 0, Element* attributeOwnerElement = 0); NodeListsNodeData* nodeLists(); void removeCachedChildNodeList(); diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h index 5c03d8b38..0bdc3e8ac 100644 --- a/Source/WebCore/dom/NodeRareData.h +++ b/Source/WebCore/dom/NodeRareData.h @@ -129,7 +129,7 @@ public: return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNodeListCacheNS.isEmpty(); } - void adoptTreeScope(TreeScope* oldTreeScope, TreeScope* newTreeScope, Document* oldDocument, Document* newDocument) + void adoptTreeScope(Document* oldDocument, Document* newDocument) { invalidateCaches(); @@ -138,8 +138,8 @@ public: for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begin(); it != atomicNameCacheEnd; ++it) { DynamicSubtreeNodeList* list = it->second; if (list->isRootedAtDocument()) { - oldDocument->unregisterDynamicSubtreeNodeList(list); - newDocument->registerDynamicSubtreeNodeList(list); + oldDocument->unregisterNodeListCache(list); + newDocument->registerNodeListCache(list); } } @@ -147,15 +147,19 @@ public: for (NodeListNameCacheMap::const_iterator it = m_nameCaches.begin(); it != nameCacheEnd; ++it) { DynamicSubtreeNodeList* list = it->second; if (list->isRootedAtDocument()) { - oldDocument->unregisterDynamicSubtreeNodeList(list); - newDocument->registerDynamicSubtreeNodeList(list); + oldDocument->unregisterNodeListCache(list); + newDocument->registerNodeListCache(list); } } - } - if (oldTreeScope) - oldTreeScope->removeNodeListCache(); - newTreeScope->addNodeListCache(); + TagNodeListCacheNS::const_iterator tagEnd = m_tagNodeListCacheNS.end(); + for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.begin(); it != tagEnd; ++it) { + DynamicSubtreeNodeList* list = it->second; + ASSERT(!list->isRootedAtDocument()); + oldDocument->unregisterNodeListCache(list); + newDocument->registerNodeListCache(list); + } + } } private: @@ -215,13 +219,17 @@ public: void clearNodeLists() { m_nodeLists.clear(); } void setNodeLists(PassOwnPtr<NodeListsNodeData> lists) { m_nodeLists = lists; } NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); } - NodeListsNodeData* ensureNodeLists(Node* node) + NodeListsNodeData* ensureNodeLists() { if (!m_nodeLists) - createNodeLists(node); + setNodeLists(NodeListsNodeData::create()); return m_nodeLists.get(); } - void clearChildNodeListCache(); + void clearChildNodeListCache() + { + if (m_childNodeList) + m_childNodeList->invalidateCache(); + } ChildNodeList* childNodeList() const { return m_childNodeList; } void setChildNodeList(ChildNodeList* list) { m_childNodeList = list; } @@ -340,7 +348,6 @@ protected: void setNeedsFocusAppearanceUpdateSoonAfterAttach(bool needs) { m_needsFocusAppearanceUpdateSoonAfterAttach = needs; } private: - void createNodeLists(Node*); TreeScope* m_treeScope; OwnPtr<NodeListsNodeData> m_nodeLists; diff --git a/Source/WebCore/dom/NodeRenderingContext.h b/Source/WebCore/dom/NodeRenderingContext.h index 36171dd1e..8aa07f955 100644 --- a/Source/WebCore/dom/NodeRenderingContext.h +++ b/Source/WebCore/dom/NodeRenderingContext.h @@ -70,7 +70,7 @@ public: private: Node* m_node; - ComposedShadowTreeWalker::ParentTranversalDetails m_parentDetails; + ComposedShadowTreeWalker::ParentTraversalDetails m_parentDetails; RefPtr<RenderStyle> m_style; RenderNamedFlowThread* m_parentFlowRenderer; AtomicString m_flowThread; diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp index f7f2f4f6c..d736ce53d 100644 --- a/Source/WebCore/dom/Range.cpp +++ b/Source/WebCore/dom/Range.cpp @@ -196,6 +196,18 @@ bool Range::collapsed(ExceptionCode& ec) const return m_start == m_end; } +static inline bool checkForDifferentRootContainer(const RangeBoundaryPoint& start, const RangeBoundaryPoint& end) +{ + Node* endRootContainer = end.container(); + while (endRootContainer->parentNode()) + endRootContainer = endRootContainer->parentNode(); + Node* startRootContainer = start.container(); + while (startRootContainer->parentNode()) + startRootContainer = startRootContainer->parentNode(); + + return startRootContainer != endRootContainer || (Range::compareBoundaryPoints(start, end, ASSERT_NO_EXCEPTION) > 0); +} + void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) { if (!m_start.container()) { @@ -208,9 +220,10 @@ void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) return; } + bool didMoveDocument = false; if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; + setDocument(refNode->document()); + didMoveDocument = true; } ec = 0; @@ -220,20 +233,8 @@ void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) m_start.set(refNode, offset, childNode); - // check if different root container - Node* endRootContainer = m_end.container(); - while (endRootContainer->parentNode()) - endRootContainer = endRootContainer->parentNode(); - Node* startRootContainer = m_start.container(); - while (startRootContainer->parentNode()) - startRootContainer = startRootContainer->parentNode(); - if (startRootContainer != endRootContainer) + if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end)) collapse(true, ec); - // check if new start after end - else if (compareBoundaryPoints(m_start, m_end, ec) > 0) { - ASSERT(!ec); - collapse(true, ec); - } } void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) @@ -248,9 +249,10 @@ void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) return; } + bool didMoveDocument = false; if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; + setDocument(refNode->document()); + didMoveDocument = true; } ec = 0; @@ -260,20 +262,8 @@ void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) m_end.set(refNode, offset, childNode); - // check if different root container - Node* endRootContainer = m_end.container(); - while (endRootContainer->parentNode()) - endRootContainer = endRootContainer->parentNode(); - Node* startRootContainer = m_start.container(); - while (startRootContainer->parentNode()) - startRootContainer = startRootContainer->parentNode(); - if (startRootContainer != endRootContainer) + if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end)) collapse(false, ec); - // check if new end before start - if (compareBoundaryPoints(m_start, m_end, ec) > 0) { - ASSERT(!ec); - collapse(false, ec); - } } void Range::setStart(const Position& start, ExceptionCode& ec) @@ -1253,11 +1243,6 @@ void Range::setStartAfter(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) @@ -1278,11 +1263,6 @@ void Range::setEndBefore(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) @@ -1303,18 +1283,12 @@ void Range::setEndAfter(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) return; setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, ec); - } void Range::selectNode(Node* refNode, ExceptionCode& ec) @@ -1529,11 +1503,6 @@ void Range::setStartBefore(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 6c2e5c7d1..7b5d95331 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -122,7 +122,7 @@ PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ShadowRootType type, #endif ec = 0; - element->ensureShadow()->addShadowRoot(element, shadowRoot, ec); + element->ensureShadow()->addShadowRoot(element, shadowRoot, type, ec); if (ec) return 0; ASSERT(element == shadowRoot->host()); diff --git a/Source/WebCore/dom/TagNodeList.cpp b/Source/WebCore/dom/TagNodeList.cpp index 60e7b40e7..295a8d9b2 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, RootedAtNode, DoNotInvalidateOnAttributeChange) + : DynamicSubtreeNodeList(rootNode, DoNotInvalidateOnAttributeChanges) , m_namespaceURI(namespaceURI) , m_localName(localName) { diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp index 5642fcf8d..e88b13ab8 100644 --- a/Source/WebCore/dom/TreeScope.cpp +++ b/Source/WebCore/dom/TreeScope.cpp @@ -39,6 +39,7 @@ #include "HTMLFrameOwnerElement.h" #include "HTMLMapElement.h" #include "HTMLNames.h" +#include "IdTargetObserverRegistry.h" #include "InsertionPoint.h" #include "Page.h" #include "ShadowRoot.h" @@ -54,7 +55,7 @@ using namespace HTMLNames; TreeScope::TreeScope(ContainerNode* rootNode) : m_rootNode(rootNode) , m_parentTreeScope(0) - , m_numNodeListCaches(0) + , m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { ASSERT(rootNode); } @@ -93,11 +94,13 @@ Element* TreeScope::getElementById(const AtomicString& elementId) const void TreeScope::addElementById(const AtomicString& elementId, Element* element) { m_elementsById.add(elementId.impl(), element); + m_idTargetObserverRegistry->notifyObservers(elementId); } void TreeScope::removeElementById(const AtomicString& elementId, Element* element) { m_elementsById.remove(elementId.impl(), element); + m_idTargetObserverRegistry->notifyObservers(elementId); } Node* TreeScope::ancestorInThisScope(Node* node) const diff --git a/Source/WebCore/dom/TreeScope.h b/Source/WebCore/dom/TreeScope.h index 5ecc0392f..841bbb6c1 100644 --- a/Source/WebCore/dom/TreeScope.h +++ b/Source/WebCore/dom/TreeScope.h @@ -36,6 +36,7 @@ class ContainerNode; class DOMSelection; class Element; class HTMLMapElement; +class IdTargetObserverRegistry; class Node; // A class which inherits both Node and TreeScope must call clearRareData() in its destructor @@ -61,10 +62,6 @@ public: void removeImageMap(HTMLMapElement*); HTMLMapElement* getImageMap(const String& url) const; - void addNodeListCache() { ++m_numNodeListCaches; } - void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; } - bool hasNodeListCaches() const { return m_numNodeListCaches; } - DOMSelection* getSelection() const; // Find first anchor with the given name. @@ -82,6 +79,8 @@ public: ContainerNode* rootNode() const { return m_rootNode; } + IdTargetObserverRegistry& idTargetObserverRegistry() const { return *m_idTargetObserverRegistry.get(); } + protected: TreeScope(ContainerNode*); virtual ~TreeScope(); @@ -95,7 +94,7 @@ private: DocumentOrderedMap m_elementsById; DocumentOrderedMap m_imageMapsByName; - unsigned m_numNodeListCaches; + OwnPtr<IdTargetObserverRegistry> m_idTargetObserverRegistry; mutable RefPtr<DOMSelection> m_selection; }; diff --git a/Source/WebCore/dom/TreeScopeAdopter.cpp b/Source/WebCore/dom/TreeScopeAdopter.cpp index 88e1a6fd5..3601e0859 100644 --- a/Source/WebCore/dom/TreeScopeAdopter.cpp +++ b/Source/WebCore/dom/TreeScopeAdopter.cpp @@ -26,8 +26,10 @@ #include "TreeScopeAdopter.h" #include "Document.h" +#include "ElementRareData.h" #include "ElementShadow.h" #include "NodeRareData.h" +#include "RenderStyle.h" #include "ShadowRoot.h" namespace WebCore { @@ -47,9 +49,12 @@ void TreeScopeAdopter::moveTreeToNewScope(Node* root) const oldDocument->incDOMTreeVersion(); for (Node* node = root; node; node = node->traverseNextNode(root)) { - NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope); - if (rareData && rareData->nodeLists()) - rareData->nodeLists()->adoptTreeScope(m_oldScope, m_newScope, oldDocument, newDocument); + if (NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope)) { + if (rareData->nodeLists()) + rareData->nodeLists()->adoptTreeScope(oldDocument, newDocument); + if (node->isElementNode()) + static_cast<ElementRareData*>(rareData)->adoptTreeScope(oldDocument, newDocument); + } if (willMoveToNewDocument) moveNodeToNewDocument(node, oldDocument, newDocument); diff --git a/Source/WebCore/dom/WebKitNamedFlow.cpp b/Source/WebCore/dom/WebKitNamedFlow.cpp index 0ffb703fd..7a07fba17 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.cpp +++ b/Source/WebCore/dom/WebKitNamedFlow.cpp @@ -33,32 +33,55 @@ #include "RenderNamedFlowThread.h" #include "RenderRegion.h" #include "StaticNodeList.h" +#include "WebKitNamedFlowCollection.h" namespace WebCore { -WebKitNamedFlow::WebKitNamedFlow(RenderNamedFlowThread* parentFlowThread) -: m_parentFlowThread(parentFlowThread) +WebKitNamedFlow::WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName) + : m_flowThreadName(flowThreadName) + , m_flowManager(manager) + , m_parentFlowThread(0) { } WebKitNamedFlow::~WebKitNamedFlow() { + // The named flow is not "strong" referenced from anywhere at this time so it shouldn't be reused if the named flow is recreated. + m_flowManager->discardNamedFlow(this); } -String WebKitNamedFlow::name() const +PassRefPtr<WebKitNamedFlow> WebKitNamedFlow::create(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName) { - return m_parentFlowThread->flowThreadName(); + return adoptRef(new WebKitNamedFlow(manager, flowThreadName)); +} + +const AtomicString& WebKitNamedFlow::name() const +{ + return m_flowThreadName; } bool WebKitNamedFlow::overset() const { - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); - return m_parentFlowThread->overset(); + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); + + // The renderer may be destroyed or created after the style update. + // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary. + return m_parentFlowThread ? m_parentFlowThread->overset() : true; +} + +static inline bool nodeInFlowThread(Node* contentNode, RenderNamedFlowThread* flowThread) +{ + return contentNode->renderer() && contentNode->renderer()->inRenderFlowThread() && flowThread == contentNode->renderer()->enclosingRenderFlowThread(); } int WebKitNamedFlow::firstEmptyRegionIndex() const { - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); + + if (!m_parentFlowThread) + return -1; const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); if (regionList.isEmpty()) @@ -74,15 +97,20 @@ int WebKitNamedFlow::firstEmptyRegionIndex() const PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode) { + Vector<RefPtr<Node> > regionNodes; + if (!contentNode) - return 0; + return StaticNodeList::adopt(regionNodes); - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); - Vector<RefPtr<Node> > regionNodes; - if (contentNode->renderer() - && contentNode->renderer()->inRenderFlowThread() - && m_parentFlowThread == contentNode->renderer()->enclosingRenderFlowThread()) { + // The renderer may be destroyed or created after the style update. + // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary. + if (!m_parentFlowThread) + return StaticNodeList::adopt(regionNodes); + + if (nodeInFlowThread(contentNode, m_parentFlowThread)) { const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) { const RenderRegion* renderRegion = *iter; @@ -92,16 +120,25 @@ PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode) regionNodes.append(renderRegion->node()); } } + return StaticNodeList::adopt(regionNodes); } PassRefPtr<NodeList> WebKitNamedFlow::getContent() { - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); - Vector<RefPtr<Node> > contentNodes; - for (NamedFlowContentNodes::const_iterator it = m_parentFlowThread->contentNodes().begin(); it != m_parentFlowThread->contentNodes().end(); ++it) { - Node* node = const_cast<Node*>(*it); + + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); + + // The renderer may be destroyed or created after the style update. + // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary. + if (!m_parentFlowThread) + return StaticNodeList::adopt(contentNodes); + + const NamedFlowContentNodes& contentNodesList = m_parentFlowThread->contentNodes(); + for (NamedFlowContentNodes::const_iterator it = contentNodesList.begin(); it != contentNodesList.end(); ++it) { + Node* node = *it; ASSERT(node->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName()); contentNodes.append(node); } @@ -109,5 +146,14 @@ PassRefPtr<NodeList> WebKitNamedFlow::getContent() return StaticNodeList::adopt(contentNodes); } +void WebKitNamedFlow::setRenderer(RenderNamedFlowThread* parentFlowThread) +{ + // The named flow can either go from a no_renderer->renderer or renderer->no_renderer state; anything else could indicate a bug. + ASSERT((!m_parentFlowThread && parentFlowThread) || (m_parentFlowThread && !parentFlowThread)); + + // If parentFlowThread is 0, the flow thread will move in the "NULL" state" + m_parentFlowThread = parentFlowThread; +} + } // namespace WebCore diff --git a/Source/WebCore/dom/WebKitNamedFlow.h b/Source/WebCore/dom/WebKitNamedFlow.h index f0c6a124c..5a39e8d9c 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.h +++ b/Source/WebCore/dom/WebKitNamedFlow.h @@ -39,25 +39,36 @@ namespace WebCore { class NodeList; class RenderNamedFlowThread; +class WebKitNamedFlowCollection; class WebKitNamedFlow : public RefCounted<WebKitNamedFlow> { public: - static PassRefPtr<WebKitNamedFlow> create(RenderNamedFlowThread* parentFlowThread) - { - return adoptRef(new WebKitNamedFlow(parentFlowThread)); - } + static PassRefPtr<WebKitNamedFlow> create(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName); ~WebKitNamedFlow(); - String name() const; + const AtomicString& name() const; bool overset() const; int firstEmptyRegionIndex() const; PassRefPtr<NodeList> getRegionsByContent(Node*); PassRefPtr<NodeList> getContent(); + void setRenderer(RenderNamedFlowThread* parentFlowThread); + + enum FlowState { + FlowStateCreated, + FlowStateNull + }; + + FlowState flowState() const { return m_parentFlowThread ? FlowStateCreated : FlowStateNull; } + private: - WebKitNamedFlow(RenderNamedFlowThread*); + WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection>, const AtomicString&); + + // The name of the flow thread as specified in CSS. + AtomicString m_flowThreadName; + RefPtr<WebKitNamedFlowCollection> m_flowManager; RenderNamedFlowThread* m_parentFlowThread; }; diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp new file mode 100644 index 000000000..b0cff11b5 --- /dev/null +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2012 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * 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 "WebKitNamedFlowCollection.h" + +#include "Document.h" +#include "WebKitNamedFlow.h" + +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +WebKitNamedFlowCollection::WebKitNamedFlowCollection(Document* doc) + : m_document(doc) +{ +} + +WebKitNamedFlow* WebKitNamedFlowCollection::flowByName(const String& flowName) +{ + NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); + if (it == m_namedFlows.end() || (*it)->flowState() == WebKitNamedFlow::FlowStateNull) + return 0; + + return *it; +} + +PassRefPtr<WebKitNamedFlow> WebKitNamedFlowCollection::ensureFlowWithName(const String& flowName) +{ + NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); + if (it != m_namedFlows.end()) { + WebKitNamedFlow* namedFlow = *it; + ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); + + return namedFlow; + } + + RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName); + m_namedFlows.add(newFlow.get()); + + return newFlow.release(); +} + +void WebKitNamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow) +{ + // The document is not valid anymore so the collection will be destroyed anyway. + if (!m_document) + return; + + ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); + ASSERT(m_namedFlows.contains(namedFlow)); + + m_namedFlows.remove(namedFlow); +} + +void WebKitNamedFlowCollection::documentDestroyed() +{ + m_document = 0; +} + +// The HashFunctions object used by the HashSet to compare between NamedFlows. +// It is safe to set safeToCompareToEmptyOrDeleted because the HashSet will never contain null pointers or deleted values. +struct WebKitNamedFlowCollection::NamedFlowHashFunctions { + static unsigned hash(WebKitNamedFlow* key) { return DefaultHash<String>::Hash::hash(key->name()); } + static bool equal(WebKitNamedFlow* a, WebKitNamedFlow* b) { return a->name() == b->name(); } + static const bool safeToCompareToEmptyOrDeleted = true; +}; + +// The HashTranslator is used to lookup a NamedFlow in the set using a name. +struct WebKitNamedFlowCollection::NamedFlowHashTranslator { + static unsigned hash(const String& key) { return DefaultHash<String>::Hash::hash(key); } + static bool equal(WebKitNamedFlow* a, const String& b) { return a->name() == b; } +}; + +} // namespace WebCore diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.h b/Source/WebCore/dom/WebKitNamedFlowCollection.h new file mode 100644 index 000000000..130c6c8fb --- /dev/null +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * 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 WebKitNamedFlowCollection_h +#define WebKitNamedFlowCollection_h + +#include <wtf/Forward.h> +#include <wtf/ListHashSet.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Document; +class WebKitNamedFlow; + +class WebKitNamedFlowCollection : public RefCounted<WebKitNamedFlowCollection> { +public: + static PassRefPtr<WebKitNamedFlowCollection> create(Document* doc) { return adoptRef(new WebKitNamedFlowCollection(doc)); } + + WebKitNamedFlow* flowByName(const String&); + PassRefPtr<WebKitNamedFlow> ensureFlowWithName(const String&); + + void discardNamedFlow(WebKitNamedFlow*); + + void documentDestroyed(); + + Document* document() const { return m_document; } + +private: + WebKitNamedFlowCollection(Document*); + + Document* m_document; + + struct NamedFlowHashFunctions; + struct NamedFlowHashTranslator; + + typedef ListHashSet<WebKitNamedFlow*, 1, NamedFlowHashFunctions> NamedFlowSet; + + NamedFlowSet m_namedFlows; +}; + +} // namespace WebCore + +#endif // WebKitNamedFlowCollection_h diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp index c3043b504..9f33299c2 100644 --- a/Source/WebCore/editing/Editor.cpp +++ b/Source/WebCore/editing/Editor.cpp @@ -2085,7 +2085,7 @@ void Editor::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, const Vect if (result->type == TextCheckingTypeLink && selectionOffset > resultLocation + resultLength + 1) continue; - if (!(shouldPerformReplacement || shouldShowCorrectionPanel || shouldMarkLink) || !doReplacement) + if (!(shouldPerformReplacement || shouldCheckForCorrection || shouldMarkLink) || !doReplacement) continue; String replacedString = plainText(rangeToReplace.get()); @@ -2188,7 +2188,9 @@ void Editor::markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelec if (unifiedTextCheckerEnabled()) { if (!isContinuousSpellCheckingEnabled()) return; - TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling | TextCheckingTypeCorrection; + + // markMisspellingsAndBadGrammar() is triggered by selection change, in which case we check spelling and grammar, but don't autocorrect misspellings. + TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling; if (markGrammar && isGrammarCheckingEnabled()) textCheckingOptions |= TextCheckingTypeGrammar; markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedRange().get(), grammarSelection.toNormalizedRange().get()); diff --git a/Source/WebCore/editing/mac/EditorMac.mm b/Source/WebCore/editing/mac/EditorMac.mm index c42c623bf..4b8cd442b 100644 --- a/Source/WebCore/editing/mac/EditorMac.mm +++ b/Source/WebCore/editing/mac/EditorMac.mm @@ -81,7 +81,7 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText) bool choosePlainText; m_frame->editor()->client()->setInsertionPasteboard(NSGeneralPboard); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, range, allowPlainText, choosePlainText); if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted)) pasteAsFragment(fragment, canSmartReplaceWithPasteboard(pasteboard), false); diff --git a/Source/WebCore/fileapi/FileReaderLoader.cpp b/Source/WebCore/fileapi/FileReaderLoader.cpp index 46f04c44d..f24cdc82f 100644 --- a/Source/WebCore/fileapi/FileReaderLoader.cpp +++ b/Source/WebCore/fileapi/FileReaderLoader.cpp @@ -34,7 +34,6 @@ #include "FileReaderLoader.h" -#include "Base64.h" #include "Blob.h" #include "BlobURL.h" #include "FileReaderLoaderClient.h" @@ -48,6 +47,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> #include <wtf/text/StringBuilder.h> using namespace std; diff --git a/Source/WebCore/html/BaseButtonInputType.cpp b/Source/WebCore/html/BaseButtonInputType.cpp index f7115019e..5fde8d799 100644 --- a/Source/WebCore/html/BaseButtonInputType.cpp +++ b/Source/WebCore/html/BaseButtonInputType.cpp @@ -41,6 +41,11 @@ namespace WebCore { using namespace HTMLNames; +bool BaseButtonInputType::shouldSaveAndRestoreFormControlState() const +{ + return false; +} + bool BaseButtonInputType::appendFormData(FormDataList&, bool) const { // Buttons except overridden types are never successful. diff --git a/Source/WebCore/html/BaseButtonInputType.h b/Source/WebCore/html/BaseButtonInputType.h index cbd852fc9..4dfbb043f 100644 --- a/Source/WebCore/html/BaseButtonInputType.h +++ b/Source/WebCore/html/BaseButtonInputType.h @@ -41,6 +41,7 @@ protected: BaseButtonInputType(HTMLInputElement* element) : BaseClickableWithKeyInputType(element) { } private: + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; virtual bool appendFormData(FormDataList&, bool) const OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE; virtual bool storesValueSeparateFromAttribute() OVERRIDE; diff --git a/Source/WebCore/html/CollectionType.h b/Source/WebCore/html/CollectionType.h index f308afd15..9cd70cea0 100644 --- a/Source/WebCore/html/CollectionType.h +++ b/Source/WebCore/html/CollectionType.h @@ -60,7 +60,8 @@ enum CollectionType { ItemProperties, // Microdata item properties in the document #endif - FormControls + FormControls, + InvalidCollectionType }; static const CollectionType FirstUnnamedDocumentCachedType = DocImages; diff --git a/Source/WebCore/html/FormAssociatedElement.cpp b/Source/WebCore/html/FormAssociatedElement.cpp index 21791f096..f05177c1a 100644 --- a/Source/WebCore/html/FormAssociatedElement.cpp +++ b/Source/WebCore/html/FormAssociatedElement.cpp @@ -30,12 +30,24 @@ #include "HTMLFormElement.h" #include "HTMLNames.h" #include "HTMLObjectElement.h" +#include "IdTargetObserver.h" #include "ValidityState.h" namespace WebCore { using namespace HTMLNames; +class FormAttributeTargetObserver : IdTargetObserver { +public: + static PassOwnPtr<FormAttributeTargetObserver> create(const AtomicString& id, FormAssociatedElement*); + virtual void idTargetChanged() OVERRIDE; + +private: + FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement*); + + FormAssociatedElement* m_element; +}; + FormAssociatedElement::FormAssociatedElement() : m_form(0) { @@ -58,7 +70,7 @@ void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument) { HTMLElement* element = toHTMLElement(this); if (oldDocument && element->fastHasAttribute(formAttr)) - oldDocument->formController()->unregisterFormElementWithFormAttribute(this); + resetFormAttributeTargetObserver(); } void FormAssociatedElement::insertedInto(ContainerNode* insertionPoint) @@ -69,14 +81,14 @@ void FormAssociatedElement::insertedInto(ContainerNode* insertionPoint) HTMLElement* element = toHTMLElement(this); if (element->fastHasAttribute(formAttr)) - element->document()->formController()->registerFormElementWithFormAttribute(this); + resetFormAttributeTargetObserver(); } void FormAssociatedElement::removedFrom(ContainerNode* insertionPoint) { HTMLElement* element = toHTMLElement(this); if (insertionPoint->inDocument() && element->fastHasAttribute(formAttr)) - element->document()->formController()->unregisterFormElementWithFormAttribute(this); + m_formAttributeTargetObserver = nullptr; // If the form and element are both in the same tree, preserve the connection to the form. // Otherwise, null out our form and remove ourselves from the form's list of elements. if (m_form && element->highestAncestor() != m_form->highestAncestor()) @@ -153,9 +165,11 @@ void FormAssociatedElement::formAttributeChanged() if (!element->fastHasAttribute(formAttr)) { // The form attribute removed. We need to reset form owner here. setForm(element->findFormAncestor()); - element->document()->formController()->unregisterFormElementWithFormAttribute(this); - } else + m_formAttributeTargetObserver = nullptr; + } else { resetFormOwner(); + resetFormAttributeTargetObserver(); + } } bool FormAssociatedElement::customError() const @@ -221,12 +235,27 @@ void FormAssociatedElement::setCustomValidity(const String& error) m_customValidationMessage = error; } +void FormAssociatedElement::resetFormAttributeTargetObserver() +{ + m_formAttributeTargetObserver = FormAttributeTargetObserver::create(toHTMLElement(this)->fastGetAttribute(formAttr), this); +} + +void FormAssociatedElement::formAttributeTargetChanged() +{ + resetFormOwner(); +} + const AtomicString& FormAssociatedElement::name() const { const AtomicString& name = toHTMLElement(this)->getNameAttribute(); return name.isNull() ? emptyAtom : name; } +bool FormAssociatedElement::isFormControlElementWithState() const +{ + return false; +} + const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement) { if (associatedElement->isFormControlElement()) @@ -242,4 +271,20 @@ HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociatedElement*>(associatedElement))); } +PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(const AtomicString& id, FormAssociatedElement* element) +{ + return adoptPtr(new FormAttributeTargetObserver(id, element)); +} + +FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement* element) + : IdTargetObserver(toHTMLElement(element)->treeScope()->idTargetObserverRegistry(), id) + , m_element(element) +{ +} + +void FormAttributeTargetObserver::idTargetChanged() +{ + m_element->formAttributeTargetChanged(); +} + } // namespace Webcore diff --git a/Source/WebCore/html/FormAssociatedElement.h b/Source/WebCore/html/FormAssociatedElement.h index 5a47ea076..b135df1fa 100644 --- a/Source/WebCore/html/FormAssociatedElement.h +++ b/Source/WebCore/html/FormAssociatedElement.h @@ -28,6 +28,7 @@ namespace WebCore { +class FormAttributeTargetObserver; class FormDataList; class HTMLFormElement; class ValidationMessage; @@ -46,6 +47,7 @@ public: ValidityState* validity(); virtual bool isFormControlElement() const = 0; + virtual bool isFormControlElementWithState() const; virtual bool isEnumeratable() const = 0; // Returns the 'name' attribute value. If this element has no name @@ -79,6 +81,8 @@ public: bool valid() const; virtual void setCustomValidity(const String&); + void formAttributeTargetChanged(); + protected: FormAssociatedElement(); @@ -101,6 +105,9 @@ private: virtual void refFormAssociatedElement() = 0; virtual void derefFormAssociatedElement() = 0; + void resetFormAttributeTargetObserver(); + + OwnPtr<FormAttributeTargetObserver> m_formAttributeTargetObserver; HTMLFormElement* m_form; OwnPtr<ValidityState> m_validityState; String m_customValidationMessage; diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp index b7c38e2a8..c30845be5 100644 --- a/Source/WebCore/html/FormController.cpp +++ b/Source/WebCore/html/FormController.cpp @@ -29,6 +29,14 @@ namespace WebCore { using namespace HTMLNames; +static inline HTMLFormElement* ownerFormForState(const HTMLFormControlElementWithState& control) +{ + // Assume controls with form attribute have no owners because we restore + // state during parsing and form owners of such controls might be + // indeterminate. + return control.fastHasAttribute(formAttr) ? 0 : control.form(); +} + // ---------------------------------------------------------------------------- // Serilized form of FormControlState: @@ -103,10 +111,7 @@ static inline AtomicString createKey(HTMLFormElement* form, unsigned index) AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control) { - // Assume contorl with form attribute have no owners because we restores - // state during parsing and form owners of such controls might be - // indeterminate. - HTMLFormElement* form = control.fastHasAttribute(formAttr) ? 0 : control.form(); + HTMLFormElement* form = ownerFormForState(control); if (!form) { DEFINE_STATIC_LOCAL(AtomicString, formKeyForNoOwner, ("No owner")); return formKeyForNoOwner; @@ -172,6 +177,9 @@ Vector<String> FormController::formElementsState() const stateVector.append(keyGenerator->formKey(*elementWithState).string()); elementWithState->saveFormControlState().serializeTo(stateVector); } + bool hasOnlySignature = stateVector.size() == 1; + if (hasOnlySignature) + stateVector.clear(); return stateVector; } @@ -237,23 +245,35 @@ void FormController::willDeleteForm(HTMLFormElement* form) m_formKeyGenerator->willDeleteForm(form); } -void FormController::registerFormElementWithFormAttribute(FormAssociatedElement* element) -{ - ASSERT(toHTMLElement(element)->fastHasAttribute(formAttr)); - m_formElementsWithFormAttribute.add(element); -} - -void FormController::unregisterFormElementWithFormAttribute(FormAssociatedElement* element) +void FormController::restoreControlStateFor(HTMLFormControlElementWithState& control) { - m_formElementsWithFormAttribute.remove(element); + // We don't save state of a control with shouldSaveAndRestoreFormControlState() + // == false. But we need to skip restoring process too because a control in + // another form might have the same pair of name and type and saved its state. + if (!control.shouldSaveAndRestoreFormControlState()) + return; + if (ownerFormForState(control)) + return; + FormControlState state = takeStateForFormElement(control); + if (state.valueSize() > 0) + control.restoreFormControlState(state); } -void FormController::resetFormElementsOwner() +void FormController::restoreControlStateIn(HTMLFormElement& form) { - typedef FormAssociatedElementListHashSet::iterator Iterator; - Iterator end = m_formElementsWithFormAttribute.end(); - for (Iterator it = m_formElementsWithFormAttribute.begin(); it != end; ++it) - (*it)->resetFormOwner(); + const Vector<FormAssociatedElement*>& elements = form.associatedElements(); + for (size_t i = 0; i < elements.size(); ++i) { + if (!elements[i]->isFormControlElementWithState()) + continue; + HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(elements[i]); + if (!control->shouldSaveAndRestoreFormControlState()) + continue; + if (ownerFormForState(*control) != &form) + continue; + FormControlState state = takeStateForFormElement(*control); + if (state.valueSize() > 0) + control->restoreFormControlState(state); + } } FormElementKey::FormElementKey(AtomicStringImpl* name, AtomicStringImpl* type, AtomicStringImpl* formKey) diff --git a/Source/WebCore/html/FormController.h b/Source/WebCore/html/FormController.h index e15c1dc24..4528483ed 100644 --- a/Source/WebCore/html/FormController.h +++ b/Source/WebCore/html/FormController.h @@ -129,22 +129,18 @@ public: Vector<String> formElementsState() const; // This should be callled only by Document::setStateForNewFormElements(). void setStateForNewFormElements(const Vector<String>&); - FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&); void willDeleteForm(HTMLFormElement*); - - void registerFormElementWithFormAttribute(FormAssociatedElement*); - void unregisterFormElementWithFormAttribute(FormAssociatedElement*); - void resetFormElementsOwner(); + void restoreControlStateFor(HTMLFormControlElementWithState&); + void restoreControlStateIn(HTMLFormElement&); private: FormController(); + FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&); CheckedRadioButtons m_checkedRadioButtons; typedef ListHashSet<HTMLFormControlElementWithState*, 64> FormElementListHashSet; FormElementListHashSet m_formElementsWithState; - typedef ListHashSet<RefPtr<FormAssociatedElement>, 32> FormAssociatedElementListHashSet; - FormAssociatedElementListHashSet m_formElementsWithFormAttribute; typedef HashMap<FormElementKey, Deque<FormControlState>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap; FormElementStateMap m_stateForNewFormElements; diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp index c68b00608..e769b2641 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) + : HTMLCollection(document, DocAll, SupportItemBefore) { } @@ -46,7 +46,6 @@ HTMLAllCollection::~HTMLAllCollection() Node* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigned index) const { - invalidateCacheIfNeeded(); updateNameCache(); if (Vector<Element*>* cache = idCache(name)) { diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp index 073afa218..e1b9f48a1 100644 --- a/Source/WebCore/html/HTMLCanvasElement.cpp +++ b/Source/WebCore/html/HTMLCanvasElement.cpp @@ -135,6 +135,12 @@ RenderObject* HTMLCanvasElement::createRenderer(RenderArena* arena, RenderStyle* return HTMLElement::createRenderer(arena, style); } +void HTMLCanvasElement::attach() +{ + setIsInCanvasSubtree(true); + HTMLElement::attach(); +} + void HTMLCanvasElement::addObserver(CanvasObserver* observer) { m_observers.add(observer); diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h index b83162083..2dde80fd4 100644 --- a/Source/WebCore/html/HTMLCanvasElement.h +++ b/Source/WebCore/html/HTMLCanvasElement.h @@ -142,6 +142,7 @@ private: virtual void parseAttribute(const Attribute&) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual void attach(); void reset(); diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp index 1f1c9c569..ef5f270a7 100644 --- a/Source/WebCore/html/HTMLCollection.cpp +++ b/Source/WebCore/html/HTMLCollection.cpp @@ -40,7 +40,7 @@ namespace WebCore { using namespace HTMLNames; -static bool shouldIncludeChildren(CollectionType type) +static bool shouldOnlyIncludeDirectChildren(CollectionType type) { switch (type) { case DocAll: @@ -63,27 +63,106 @@ static bool shouldIncludeChildren(CollectionType type) case ItemProperties: #endif case FormControls: - return true; + return false; case NodeChildren: case TRCells: case TSectionRows: case TableTBodies: - return false; + return true; + case InvalidCollectionType: + break; } ASSERT_NOT_REACHED(); return false; } -HTMLCollection::HTMLCollection(Node* base, CollectionType type) - : HTMLCollectionCacheBase(type, shouldIncludeChildren(type)) +static NodeListRootType rootTypeFromCollectionType(CollectionType type) +{ + switch (type) { + case DocImages: + case DocApplets: + case DocEmbeds: + case DocObjects: + case DocForms: + case DocLinks: + case DocAnchors: + case DocScripts: + case DocAll: + case WindowNamedItems: + case DocumentNamedItems: +#if ENABLE(MICRODATA) + case ItemProperties: +#endif + case FormControls: + return NodeListIsRootedAtDocument; + case NodeChildren: + case TableTBodies: + case TSectionRows: + case TableRows: + case TRCells: + case SelectOptions: + case SelectedOptions: + case DataListOptions: + case MapAreas: + case InvalidCollectionType: + return NodeListIsRootedAtNode; + } + ASSERT_NOT_REACHED(); + return NodeListIsRootedAtNode; +} + +static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(CollectionType type) +{ + switch (type) { + case DocImages: + case DocEmbeds: + case DocObjects: + case DocForms: + case DocAnchors: // Depends on name attribute. + case DocScripts: + case DocAll: + case WindowNamedItems: // Depends on id and name attributes. + case DocumentNamedItems: // Ditto. + case NodeChildren: + case TableTBodies: + case TSectionRows: + case TableRows: + case TRCells: + case SelectOptions: + case MapAreas: + return DoNotInvalidateOnAttributeChanges; + case DocApplets: + case SelectedOptions: + case DataListOptions: + // FIXME: We can do better some day. + return InvalidateOnAnyAttrChange; + case DocLinks: + return InvalidateOnHRefAttrChange; +#if ENABLE(MICRODATA) + case ItemProperties: + return InvalidateOnItemAttrChange; +#endif + case FormControls: + return InvalidateForFormControls; + case InvalidCollectionType: + break; + } + ASSERT_NOT_REACHED(); + return DoNotInvalidateOnAttributeChanges; +} + + +HTMLCollection::HTMLCollection(Node* base, CollectionType type, ItemBeforeSupportType itemBeforeSupportType) + : HTMLCollectionCacheBase(rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), type, itemBeforeSupportType) , m_base(base) { ASSERT(m_base); + m_base->document()->registerNodeListCache(this); } PassRefPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type) { - return adoptRef(new HTMLCollection(base, type)); + return adoptRef(new HTMLCollection(base, type, SupportItemBefore)); } HTMLCollection::~HTMLCollection() @@ -96,34 +175,16 @@ HTMLCollection::~HTMLCollection() toElement(base())->removeCachedHTMLCollection(this, type()); } else // HTMLNameCollection removes cache by itself. ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems); -} - -void HTMLCollection::invalidateCacheIfNeeded() const -{ - uint64_t docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion(); - - if (cacheTreeVersion() == docversion) - return; - invalidateCache(); + m_base->document()->unregisterNodeListCache(this); } -void HTMLCollection::invalidateCache() const +static inline bool isAcceptableElement(CollectionType type, Element* element) { -#if ENABLE(MICRODATA) - // FIXME: There should be more generic mechanism to clear caches in subclasses. - if (type() == ItemProperties) - static_cast<const HTMLPropertiesCollection*>(this)->clearCache(); -#endif - clearCache(static_cast<HTMLDocument*>(m_base->document())->domTreeVersion()); -} - -inline bool HTMLCollection::isAcceptableElement(Element* element) const -{ - if (!element->isHTMLElement() && !(type() == DocAll || type() == NodeChildren)) + if (!element->isHTMLElement() && !(type == DocAll || type == NodeChildren)) return false; - switch (type()) { + switch (type) { case DocImages: return element->hasLocalName(imgTag); case DocScripts: @@ -170,70 +231,159 @@ inline bool HTMLCollection::isAcceptableElement(Element* element) const case DocumentNamedItems: case TableRows: case WindowNamedItems: + case InvalidCollectionType: ASSERT_NOT_REACHED(); } return false; } -static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren) +template<bool forward> +static Node* nextNode(Node* base, Node* previous, bool onlyIncludeDirectChildren) { - return includeChildren ? node->traverseNextNode(base) : node->traverseNextSibling(base); + if (forward) + return onlyIncludeDirectChildren ? previous->nextSibling() : previous->traverseNextNode(base); + else + return onlyIncludeDirectChildren ? previous->previousSibling() : previous->traversePreviousNode(base); } -Element* HTMLCollection::itemAfter(Node* previous) const +template<bool forward> +static Element* itemBeforeOrAfter(CollectionType type, Node* base, unsigned& offsetInArray, Node* previous) { - Node* current; - if (!previous) - current = m_base->firstChild(); - else - current = nextNodeOrSibling(base(), previous, includeChildren()); - - for (; current; current = nextNodeOrSibling(base(), current, includeChildren())) { - if (!current->isElementNode()) - continue; - Element* element = static_cast<Element*>(current); - if (isAcceptableElement(element)) - return element; + ASSERT_UNUSED(offsetInArray, !offsetInArray); + bool onlyIncludeDirectChildren = shouldOnlyIncludeDirectChildren(type); + Node* rootNode = base; + Node* current = previous ? nextNode<forward>(rootNode, previous, onlyIncludeDirectChildren) : (forward ? base->firstChild() : base->lastChild()); + + for (; current; current = nextNode<forward>(rootNode, current, onlyIncludeDirectChildren)) { + if (current->isElementNode() && isAcceptableElement(type, toElement(current))) + return toElement(current); } return 0; } -unsigned HTMLCollection::calcLength() const +Element* HTMLCollection::itemBefore(unsigned& offsetInArray, Element* previous) const { - unsigned len = 0; - for (Element* current = itemAfter(0); current; current = itemAfter(current)) - ++len; - return len; + return itemBeforeOrAfter<false>(type(), base(), offsetInArray, previous); +} + +Element* HTMLCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +{ + return itemBeforeOrAfter<true>(type(), base(), offsetInArray, previous); +} + +bool ALWAYS_INLINE HTMLCollection::isLastItemCloserThanLastOrCachedItem(unsigned offset) const +{ + ASSERT(isLengthCacheValid()); + unsigned distanceFromLastItem = cachedLength() - offset; + if (!isItemCacheValid()) + return distanceFromLastItem < offset; + + return cachedItemOffset() < offset && distanceFromLastItem < offset - cachedItemOffset(); +} + +bool ALWAYS_INLINE HTMLCollection::isFirstItemCloserThanCachedItem(unsigned offset) const +{ + ASSERT(isItemCacheValid()); + if (cachedItemOffset() < offset) + return false; + + unsigned distanceFromCachedItem = cachedItemOffset() - offset; + return offset < distanceFromCachedItem; } -// since the collections are to be "live", we have to do the -// calculation every time if anything has changed unsigned HTMLCollection::length() const { - invalidateCacheIfNeeded(); - if (!isLengthCacheValid()) - setLengthCache(calcLength()); - return cachedLength(); + if (isLengthCacheValid()) + return cachedLength(); + + if (!isItemCacheValid() && !item(0)) { + ASSERT(isLengthCacheValid()); + return 0; + } + + ASSERT(isItemCacheValid()); + ASSERT(cachedItem()); + unsigned offset = cachedItemOffset(); + do { + offset++; + } while (itemBeforeOrAfterCachedItem(offset)); + + setLengthCache(offset); + return offset; } -Node* HTMLCollection::item(unsigned index) const +Node* HTMLCollection::item(unsigned offset) const { - invalidateCacheIfNeeded(); - if (isItemCacheValid() && cachedItemOffset() == index) + if (isItemCacheValid() && cachedItemOffset() == offset) return cachedItem(); - if (isLengthCacheValid() && cachedLength() <= index) + + if (isLengthCacheValid() && cachedLength() <= offset) return 0; - if (!isItemCacheValid() || cachedItemOffset() > index) { - setItemCache(itemAfter(0), 0); - if (!cachedItem()) + +#if ENABLE(MICRODATA) + if (type() == ItemProperties) + 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); + ASSERT(lastItem); + setItemCache(lastItem, cachedLength() - 1, 0); + } else if (!isItemCacheValid() || isFirstItemCloserThanCachedItem(offset) || (!supportsItemBefore() && offset < cachedItemOffset())) { + unsigned offsetInArray = 0; + Node* firstItem = itemAfter(offsetInArray, 0); + if (!firstItem) { + setLengthCache(0); return 0; + } + setItemCache(firstItem, 0, offsetInArray); + ASSERT(!cachedItemOffset()); } - Node* e = cachedItem(); - for (unsigned pos = cachedItemOffset(); e && pos < index; pos++) - e = itemAfter(e); - setItemCache(e, index); - return cachedItem(); + + if (cachedItemOffset() == offset) + return cachedItem(); + + return itemBeforeOrAfterCachedItem(offset); +} + +Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const +{ + unsigned currentOffset = cachedItemOffset(); + ASSERT(cachedItem()->isElementNode()); + Element* currentItem = toElement(cachedItem()); + ASSERT(currentOffset != offset); + + unsigned offsetInArray = cachedElementsArrayOffset(); + + if (offset < cachedItemOffset()) { + ASSERT(supportsItemBefore()); + while ((currentItem = itemBefore(offsetInArray, currentItem))) { + ASSERT(currentOffset); + currentOffset--; + if (currentOffset == offset) { + setItemCache(currentItem, currentOffset, offsetInArray); + return currentItem; + } + } + ASSERT_NOT_REACHED(); + return 0; + } + + while ((currentItem = itemAfter(offsetInArray, currentItem))) { + currentOffset++; + if (currentOffset == offset) { + setItemCache(currentItem, currentOffset, offsetInArray); + return currentItem; + } + } + + setLengthCache(currentOffset); + + return 0; } static inline bool nameShouldBeVisibleInDocumentAll(HTMLElement* element) @@ -271,21 +421,21 @@ Node* HTMLCollection::namedItem(const AtomicString& name) const // attribute. If a match is not found, the method then searches for an // object with a matching name attribute, but only on those elements // that are allowed a name attribute. - invalidateCacheIfNeeded(); + unsigned arrayOffset = 0; unsigned i = 0; - for (Element* e = itemAfter(0); e; e = itemAfter(e)) { + for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { if (checkForNameMatch(e, /* checkName */ false, name)) { - setItemCache(e, i); + setItemCache(e, i, arrayOffset); return e; } i++; } i = 0; - for (Element* e = itemAfter(0); e; e = itemAfter(e)) { + for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { if (checkForNameMatch(e, /* checkName */ true, name)) { - setItemCache(e, i); + setItemCache(e, i, arrayOffset); return e; } i++; @@ -299,7 +449,8 @@ void HTMLCollection::updateNameCache() const if (hasNameCache()) return; - for (Element* element = itemAfter(0); element; element = itemAfter(element)) { + unsigned arrayOffset = 0; + for (Element* element = itemAfter(arrayOffset, 0); element; element = itemAfter(arrayOffset, element)) { if (!element->isHTMLElement()) continue; HTMLElement* e = toHTMLElement(element); @@ -319,7 +470,6 @@ bool HTMLCollection::hasNamedItem(const AtomicString& name) const if (name.isEmpty()) return false; - invalidateCacheIfNeeded(); updateNameCache(); if (Vector<Element*>* cache = idCache(name)) { @@ -341,7 +491,6 @@ void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& if (name.isEmpty()) return; - invalidateCacheIfNeeded(); updateNameCache(); Vector<Element*>* idResults = idCache(name); diff --git a/Source/WebCore/html/HTMLCollection.h b/Source/WebCore/html/HTMLCollection.h index bb7c7459c..6343e8edf 100644 --- a/Source/WebCore/html/HTMLCollection.h +++ b/Source/WebCore/html/HTMLCollection.h @@ -39,31 +39,13 @@ class NodeList; class HTMLCollectionCacheBase : public DynamicNodeListCacheBase { public: - HTMLCollectionCacheBase(CollectionType type, bool includeChildren) - : DynamicNodeListCacheBase(RootedAtNode, AlwaysInvalidate) // These two flags are never used + HTMLCollectionCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, CollectionType collectionType, ItemBeforeSupportType itemBeforeSupportType) + : DynamicNodeListCacheBase(rootType, invalidationType, collectionType, itemBeforeSupportType) , m_cachedElementsArrayOffset(0) - , m_cacheTreeVersion(0) - , m_hasNameCache(false) - , m_type(type) - , m_includeChildren(includeChildren) { - ASSERT(static_cast<CollectionType>(m_type) == type); } - CollectionType type() const { return static_cast<CollectionType>(m_type); } - protected: - void clearCache(uint64_t currentDomTreeVersion) const - { - DynamicNodeListCacheBase::clearCache(); - m_idCache.clear(); - m_nameCache.clear(); - m_cachedElementsArrayOffset = 0; - m_cacheTreeVersion = currentDomTreeVersion; - m_hasNameCache = false; - } - - using DynamicNodeListCacheBase::setItemCache; void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const { setItemCache(item, offset); @@ -71,34 +53,23 @@ protected: } unsigned cachedElementsArrayOffset() const { return m_cachedElementsArrayOffset; } - bool includeChildren() const { return m_includeChildren; } - uint64_t cacheTreeVersion() const { return m_cacheTreeVersion; } - 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()); } void appendIdCache(const AtomicString& name, Element* element) const { append(m_idCache, name, element); } void appendNameCache(const AtomicString& name, Element* element) const { append(m_nameCache, name, element); } - bool hasNameCache() const { return m_hasNameCache; } - void setHasNameCache() const { m_hasNameCache = true; } - static void append(NodeCacheMap&, const AtomicString&, Element*); private: using DynamicNodeListCacheBase::isRootedAtDocument; - using DynamicNodeListCacheBase::shouldInvalidateOnAttributeChange; - using DynamicNodeListCacheBase::clearCache; + using DynamicNodeListCacheBase::setItemCache; mutable NodeCacheMap m_idCache; mutable NodeCacheMap m_nameCache; mutable unsigned m_cachedElementsArrayOffset; - mutable uint64_t m_cacheTreeVersion; - // FIXME: Move these bit flags to DynamicNodeListCacheBase to pack them better. - mutable unsigned m_hasNameCache : 1; - const unsigned m_type : 5; // CollectionType - const unsigned m_includeChildren : 1; + friend void DynamicNodeListCacheBase::invalidateCache() const; }; class HTMLCollection : public RefCounted<HTMLCollection>, public HTMLCollectionCacheBase { @@ -108,7 +79,7 @@ public: // DOM API unsigned length() const; - virtual Node* item(unsigned index) const; + Node* item(unsigned index) const; virtual Node* namedItem(const AtomicString& name) const; PassRefPtr<NodeList> tags(const String&); @@ -117,7 +88,6 @@ public: void namedItems(const AtomicString& name, Vector<RefPtr<Node> >&) const; bool isEmpty() const { - invalidateCacheIfNeeded(); if (isLengthCacheValid()) return !cachedLength(); if (isItemCacheValid()) @@ -126,7 +96,6 @@ public: } bool hasExactlyOneItem() const { - invalidateCacheIfNeeded(); if (isLengthCacheValid()) return cachedLength() == 1; if (isItemCacheValid()) @@ -136,21 +105,19 @@ public: Node* base() const { return m_base.get(); } - void invalidateCache() const; - void invalidateCacheIfNeeded() const; - protected: - HTMLCollection(Node* base, CollectionType); + HTMLCollection(Node* base, CollectionType, ItemBeforeSupportType); virtual void updateNameCache() const; - virtual Element* itemAfter(Node*) const; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const; private: bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const; - virtual unsigned calcLength() const; - - bool isAcceptableElement(Element*) 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; }; diff --git a/Source/WebCore/html/HTMLFormCollection.cpp b/Source/WebCore/html/HTMLFormCollection.cpp index 3f95f8408..b845f0c6f 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) + : HTMLCollection(base, FormControls, DoNotSupportItemBefore) { ASSERT(base->hasTagName(formTag) || base->hasTagName(fieldsetTag)); } @@ -67,48 +67,17 @@ const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const return static_cast<HTMLFormElement*>(base())->imageElements(); } -unsigned HTMLFormCollection::numberOfFormControlElements() const +Element* HTMLFormCollection::itemAfter(unsigned& offset, Element* previousItem) const { - ASSERT(base()); - ASSERT(base()->hasTagName(formTag) || base()->hasTagName(fieldsetTag)); - if (base()->hasTagName(formTag)) - return static_cast<HTMLFormElement*>(base())->length(); - return static_cast<HTMLFieldSetElement*>(base())->length(); -} - -unsigned HTMLFormCollection::calcLength() const -{ - return numberOfFormControlElements(); -} - -Node* HTMLFormCollection::item(unsigned index) const -{ - invalidateCacheIfNeeded(); - - if (isItemCacheValid() && cachedItemOffset() == index) - return cachedItem(); - - if (isLengthCacheValid() && cachedLength() <= index) - return 0; - - if (!isItemCacheValid() || cachedItemOffset() > index) - setItemCache(0, 0, 0); - const Vector<FormAssociatedElement*>& elementsArray = formControlElements(); - unsigned currentIndex = cachedItemOffset(); - - for (unsigned i = cachedElementsArrayOffset(); i < elementsArray.size(); i++) { - if (elementsArray[i]->isEnumeratable()) { - HTMLElement* element = toHTMLElement(elementsArray[i]); - if (index == currentIndex) { - setItemCache(element, index, i); - return element; - } - - currentIndex++; - } + if (previousItem) + offset++; + while (offset < elementsArray.size()) { + FormAssociatedElement* element = elementsArray[offset]; + if (element->isEnumeratable()) + return toHTMLElement(element); + offset++; } - return 0; } @@ -142,7 +111,6 @@ Node* HTMLFormCollection::namedItem(const AtomicString& name) const // attribute. If a match is not found, the method then searches for an // object with a matching name attribute, but only on those elements // that are allowed a name attribute. - invalidateCacheIfNeeded(); const Vector<HTMLImageElement*>* imagesElements = base()->hasTagName(fieldsetTag) ? 0 : &formImageElements(); if (HTMLElement* item = firstNamedItem(formControlElements(), imagesElements, idAttr, name)) return item; diff --git a/Source/WebCore/html/HTMLFormCollection.h b/Source/WebCore/html/HTMLFormCollection.h index 753a0d06e..82cbfed15 100644 --- a/Source/WebCore/html/HTMLFormCollection.h +++ b/Source/WebCore/html/HTMLFormCollection.h @@ -40,18 +40,16 @@ public: virtual ~HTMLFormCollection(); - virtual Node* item(unsigned index) const; virtual Node* namedItem(const AtomicString& name) const; private: HTMLFormCollection(Element*); virtual void updateNameCache() const; - virtual unsigned calcLength() const; const Vector<FormAssociatedElement*>& formControlElements() const; const Vector<HTMLImageElement*>& formImageElements() const; - unsigned numberOfFormControlElements() const; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index 901783beb..913c4ddb0 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -312,7 +312,9 @@ bool HTMLFormControlElement::supportsFocus() const bool HTMLFormControlElement::isFocusable() const { - if (!renderer() || !renderer()->isBox() || toRenderBox(renderer())->size().isEmpty()) + // If there's a renderer, make sure the size isn't empty, but if there's no renderer, + // it might still be focusable if it's in a canvas subtree (handled in Node::isFocusable). + if (renderer() && (!renderer()->isBox() || toRenderBox(renderer())->size().isEmpty())) return false; // HTMLElement::isFocusable handles visibility and calls suportsFocus which // will cover the disabled case. diff --git a/Source/WebCore/html/HTMLFormControlElementWithState.cpp b/Source/WebCore/html/HTMLFormControlElementWithState.cpp index 22940e0d6..f96d264c0 100644 --- a/Source/WebCore/html/HTMLFormControlElementWithState.cpp +++ b/Source/WebCore/html/HTMLFormControlElementWithState.cpp @@ -70,16 +70,12 @@ FormControlState HTMLFormControlElementWithState::saveFormControlState() const void HTMLFormControlElementWithState::finishParsingChildren() { HTMLFormControlElement::finishParsingChildren(); + document()->formController()->restoreControlStateFor(*this); +} - // We don't save state of a control with shouldSaveAndRestoreFormControlState()=false. - // But we need to skip restoring process too because a control in another - // form might have the same pair of name and type and saved its state. - if (!shouldSaveAndRestoreFormControlState()) - return; - - FormControlState state = document()->formController()->takeStateForFormElement(*this); - if (state.valueSize() > 0) - restoreFormControlState(state); +bool HTMLFormControlElementWithState::isFormControlElementWithState() const +{ + return true; } } // namespace Webcore diff --git a/Source/WebCore/html/HTMLFormControlElementWithState.h b/Source/WebCore/html/HTMLFormControlElementWithState.h index f14d856a8..5e7bb1acd 100644 --- a/Source/WebCore/html/HTMLFormControlElementWithState.h +++ b/Source/WebCore/html/HTMLFormControlElementWithState.h @@ -36,7 +36,7 @@ public: virtual bool canContainRangeEndPoint() const { return false; } - bool shouldSaveAndRestoreFormControlState() const; + virtual bool shouldSaveAndRestoreFormControlState() const; virtual FormControlState saveFormControlState() const; // The specified FormControlState must have at least one string value. virtual void restoreFormControlState(const FormControlState&) { } @@ -47,6 +47,7 @@ protected: virtual bool shouldAutocomplete() const; virtual void finishParsingChildren(); virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; + virtual bool isFormControlElementWithState() const OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index 3c8bb073c..9b2a5915c 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -141,14 +141,6 @@ Node::InsertionNotificationRequest HTMLFormElement::insertedInto(ContainerNode* return InsertionDone; } -void HTMLFormElement::didNotifyDescendantInsertions(ContainerNode* insertionPoint) -{ - ASSERT(insertionPoint->inDocument()); - HTMLElement::didNotifyDescendantInsertions(insertionPoint); - if (hasID()) - document()->formController()->resetFormElementsOwner(); -} - static inline Node* findRoot(Node* n) { Node* root = n; @@ -164,8 +156,6 @@ void HTMLFormElement::removedFrom(ContainerNode* insertionPoint) for (unsigned i = 0; i < associatedElements.size(); ++i) associatedElements[i]->formRemovedFromTree(root); HTMLElement::removedFrom(insertionPoint); - if (insertionPoint->inDocument() && hasID()) - document()->formController()->resetFormElementsOwner(); } void HTMLFormElement::handleLocalEvents(Event* event) @@ -436,33 +426,33 @@ template<class T, size_t n> static void removeFromVector(Vector<T*, n> & vec, T* } } -unsigned HTMLFormElement::formElementIndexWithFormAttribute(Element* element) +unsigned HTMLFormElement::formElementIndexWithFormAttribute(Element* element, unsigned rangeStart, unsigned rangeEnd) { - // Compares the position of the form element and the inserted element. - // Updates the indeces in order to the relation of the position: - unsigned short position = compareDocumentPosition(element); - if (position & (DOCUMENT_POSITION_CONTAINS | DOCUMENT_POSITION_CONTAINED_BY)) - ++m_associatedElementsAfterIndex; - else if (position & DOCUMENT_POSITION_PRECEDING) { - ++m_associatedElementsBeforeIndex; - ++m_associatedElementsAfterIndex; - } - if (m_associatedElements.isEmpty()) return 0; + ASSERT(rangeStart <= rangeEnd); + + if (rangeStart == rangeEnd) + return rangeStart; + + unsigned left = rangeStart; + unsigned right = rangeEnd - 1; + unsigned short position; + // Does binary search on m_associatedElements in order to find the index // to be inserted. - unsigned left = 0, right = m_associatedElements.size() - 1; while (left != right) { unsigned middle = left + ((right - left) / 2); + ASSERT(middle < m_associatedElementsBeforeIndex || middle >= m_associatedElementsAfterIndex); position = element->compareDocumentPosition(toHTMLElement(m_associatedElements[middle])); if (position & DOCUMENT_POSITION_FOLLOWING) right = middle; else left = middle + 1; } - + + ASSERT(left < m_associatedElementsBeforeIndex || left >= m_associatedElementsAfterIndex); position = element->compareDocumentPosition(toHTMLElement(m_associatedElements[left])); if (position & DOCUMENT_POSITION_FOLLOWING) return left; @@ -474,8 +464,16 @@ unsigned HTMLFormElement::formElementIndex(FormAssociatedElement* associatedElem HTMLElement* element = toHTMLElement(associatedElement); // Treats separately the case where this element has the form attribute // for performance consideration. - if (element->fastHasAttribute(formAttr)) - return formElementIndexWithFormAttribute(element); + if (element->fastHasAttribute(formAttr)) { + unsigned short position = compareDocumentPosition(element); + if (position & DOCUMENT_POSITION_PRECEDING) { + ++m_associatedElementsBeforeIndex; + ++m_associatedElementsAfterIndex; + return HTMLFormElement::formElementIndexWithFormAttribute(element, 0, m_associatedElementsBeforeIndex - 1); + } + if (position & DOCUMENT_POSITION_FOLLOWING && !(position & DOCUMENT_POSITION_CONTAINED_BY)) + return HTMLFormElement::formElementIndexWithFormAttribute(element, m_associatedElementsAfterIndex, m_associatedElements.size()); + } // Check for the special case where this element is the very last thing in // the form's tree of children; we don't want to walk the entire tree in that @@ -685,4 +683,10 @@ bool HTMLFormElement::shouldAutocomplete() const return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off"); } +void HTMLFormElement::finishParsingChildren() +{ + HTMLElement::finishParsingChildren(); + document()->formController()->restoreControlStateIn(*this); +} + } // namespace diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h index ee9ccf39b..9d4739423 100644 --- a/Source/WebCore/html/HTMLFormElement.h +++ b/Source/WebCore/html/HTMLFormElement.h @@ -119,8 +119,8 @@ private: virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; - virtual void didNotifyDescendantInsertions(ContainerNode*) OVERRIDE; virtual void removedFrom(ContainerNode*) OVERRIDE; + virtual void finishParsingChildren() OVERRIDE; virtual void handleLocalEvents(Event*); @@ -135,7 +135,7 @@ private: void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger); - unsigned formElementIndexWithFormAttribute(Element*); + unsigned formElementIndexWithFormAttribute(Element*, unsigned rangeStart, unsigned rangeEnd); unsigned formElementIndex(FormAssociatedElement*); // Returns true if the submission should proceed. diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index a12ba7849..77ea42567 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -526,6 +526,13 @@ const AtomicString& HTMLInputElement::formControlType() const return m_inputType->formControlType(); } +bool HTMLInputElement::shouldSaveAndRestoreFormControlState() const +{ + if (!m_inputType->shouldSaveAndRestoreFormControlState()) + return false; + return HTMLTextFormControlElement::shouldSaveAndRestoreFormControlState(); +} + FormControlState HTMLInputElement::saveFormControlState() const { return m_inputType->saveFormControlState(); diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index e10825cd6..20f0b42d1 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -296,6 +296,7 @@ private: virtual const AtomicString& formControlType() const; + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; virtual FormControlState saveFormControlState() const OVERRIDE; virtual void restoreFormControlState(const FormControlState&) OVERRIDE; diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index 499ceb341..a1b032e06 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -129,6 +129,11 @@ void HTMLKeygenElement::reset() static_cast<HTMLFormControlElement*>(shadowSelect())->reset(); } +bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const +{ + return false; +} + HTMLSelectElement* HTMLKeygenElement::shadowSelect() const { ShadowRoot* root = this->shadow()->oldestShadowRoot(); diff --git a/Source/WebCore/html/HTMLKeygenElement.h b/Source/WebCore/html/HTMLKeygenElement.h index a28d26993..78b0c691c 100644 --- a/Source/WebCore/html/HTMLKeygenElement.h +++ b/Source/WebCore/html/HTMLKeygenElement.h @@ -51,6 +51,7 @@ private: virtual bool supportLabels() const OVERRIDE { return true; } virtual void reset(); + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; HTMLSelectElement* shadowSelect() const; }; diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index fddc42893..31d46df3f 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -488,7 +488,11 @@ RenderObject* HTMLMediaElement::createRenderer(RenderArena* arena, RenderStyle*) bool HTMLMediaElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const { - return childContext.isOnUpperEncapsulationBoundary() && HTMLElement::childShouldCreateRenderer(childContext); + if (!hasMediaControls()) + return false; + // Only allows nodes from the controls shadow subtree. + return (mediaControls()->treeScope() == childContext.node()->treeScope() + && childContext.isOnUpperEncapsulationBoundary() && HTMLElement::childShouldCreateRenderer(childContext)); } Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) @@ -3481,6 +3485,16 @@ void HTMLMediaElement::mediaPlayerRenderingModeChanged(MediaPlayer*) } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) +GraphicsDeviceAdapter* HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const +{ + if (!document() || !document()->page()) + return 0; + + return document()->page()->chrome()->client()->graphicsDeviceAdapter(); +} +#endif + void HTMLMediaElement::mediaPlayerEngineUpdated(MediaPlayer*) { LOG(Media, "HTMLMediaElement::mediaPlayerEngineUpdated"); @@ -4142,12 +4156,12 @@ void HTMLMediaElement::privateBrowsingStateDidChange() m_player->setPrivateBrowsingMode(privateMode); } -MediaControls* HTMLMediaElement::mediaControls() +MediaControls* HTMLMediaElement::mediaControls() const { return toMediaControls(shadow()->oldestShadowRoot()->firstChild()); } -bool HTMLMediaElement::hasMediaControls() +bool HTMLMediaElement::hasMediaControls() const { ElementShadow* elementShadow = shadow(); if (!elementShadow) diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index 4015a2f86..9f8150a9b 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -291,7 +291,7 @@ public: bool closedCaptionsVisible() const; void setClosedCaptionsVisible(bool); - MediaControls* mediaControls(); + MediaControls* mediaControls() const; void sourceWasRemoved(HTMLSourceElement*); void sourceWasAdded(HTMLSourceElement*); @@ -432,6 +432,10 @@ private: virtual bool mediaPlayerNeedsSiteSpecificHacks() const OVERRIDE; virtual String mediaPlayerDocumentHost() const OVERRIDE; +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const OVERRIDE; +#endif + void loadTimerFired(Timer<HTMLMediaElement>*); void progressEventTimerFired(Timer<HTMLMediaElement>*); void playbackProgressTimerFired(Timer<HTMLMediaElement>*); @@ -508,7 +512,7 @@ private: void invalidateCachedTime(); void refreshCachedTime() const; - bool hasMediaControls(); + bool hasMediaControls() const; bool createMediaControls(); void configureMediaControls(); diff --git a/Source/WebCore/html/HTMLNameCollection.cpp b/Source/WebCore/html/HTMLNameCollection.cpp index e253e3055..246235d07 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) + : HTMLCollection(document, type, DoNotSupportItemBefore) , m_name(name) { } @@ -49,8 +49,9 @@ HTMLNameCollection::~HTMLNameCollection() static_cast<Document*>(base())->removeDocumentNamedItemCache(this, m_name); } -Element* HTMLNameCollection::itemAfter(Node* previous) const +Element* HTMLNameCollection::itemAfter(unsigned& offsetInArray, Element* previous) const { + ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(previous != base()); Node* current; diff --git a/Source/WebCore/html/HTMLNameCollection.h b/Source/WebCore/html/HTMLNameCollection.h index 08f829a91..dd9d45d9d 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(Node*) const OVERRIDE; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; AtomicString m_name; }; diff --git a/Source/WebCore/html/HTMLOptionsCollection.cpp b/Source/WebCore/html/HTMLOptionsCollection.cpp index 7000f2891..960fc8995 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) + : HTMLCollection(select, SelectOptions, SupportItemBefore) { ASSERT(select->hasTagName(HTMLNames::selectTag)); } diff --git a/Source/WebCore/html/HTMLOptionsCollection.h b/Source/WebCore/html/HTMLOptionsCollection.h index bd6fe7d07..3cd8e7fcb 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.h +++ b/Source/WebCore/html/HTMLOptionsCollection.h @@ -46,8 +46,6 @@ public: void setLength(unsigned, ExceptionCode&); - using HTMLCollection::invalidateCacheIfNeeded; - private: HTMLOptionsCollection(Element*); }; diff --git a/Source/WebCore/html/HTMLPropertiesCollection.cpp b/Source/WebCore/html/HTMLPropertiesCollection.cpp index 87394c230..c17e7c696 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) + : HTMLCollection(itemNode, ItemProperties, DoNotSupportItemBefore) , m_hasPropertyNameCache(false) , m_hasItemRefElements(false) { @@ -69,10 +69,13 @@ void HTMLPropertiesCollection::updateRefElements() const HTMLElement* baseElement = toHTMLElement(base()); m_itemRefElements.clear(); + m_hasItemRefElements = true; + + if (!baseElement->fastHasAttribute(itemscopeAttr)) + return; if (!baseElement->fastHasAttribute(itemrefAttr)) { m_itemRefElements.append(baseElement); - m_hasItemRefElements = true; return; } @@ -97,7 +100,6 @@ void HTMLPropertiesCollection::updateRefElements() const m_itemRefElements.append(element); } } - m_hasItemRefElements = true; } static Node* nextNodeWithProperty(Node* base, Node* node) @@ -110,7 +112,18 @@ static Node* nextNodeWithProperty(Node* base, Node* node) ? node->traverseNextNode(base) : node->traverseNextSibling(base); } -Element* HTMLPropertiesCollection::itemAfter(Element* base, Node* previous) const +Element* HTMLPropertiesCollection::itemAfter(unsigned& offsetInArray, Element* previousItem) const +{ + while (offsetInArray < m_itemRefElements.size()) { + if (Element* next = itemAfter(m_itemRefElements[offsetInArray], previousItem)) + return next; + offsetInArray++; + previousItem = 0; + } + return 0; +} + +HTMLElement* HTMLPropertiesCollection::itemAfter(HTMLElement* base, Element* previous) const { Node* current; current = previous ? nextNodeWithProperty(base, previous) : base; @@ -127,116 +140,38 @@ Element* HTMLPropertiesCollection::itemAfter(Element* base, Node* previous) cons return 0; } -unsigned HTMLPropertiesCollection::calcLength() const -{ - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return 0; - - unsigned length = 0; - updateRefElements(); - - for (unsigned i = 0; i < m_itemRefElements.size(); ++i) { - for (Element* element = itemAfter(m_itemRefElements[i], 0); element; element = itemAfter(m_itemRefElements[i], element)) - ++length; - } - - return length; -} - -void HTMLPropertiesCollection::cacheFirstItem() const -{ - for (unsigned i = 0; i < m_itemRefElements.size(); ++i) { - if (Element* element = itemAfter(m_itemRefElements[i], 0)) - return setItemCache(element, 0, i); - } - setItemCache(0, 0, 0); -} - -Node* HTMLPropertiesCollection::item(unsigned index) const -{ - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return 0; - - invalidateCacheIfNeeded(); - if (isItemCacheValid() && cachedItemOffset() == index) - return cachedItem(); - - if (isLengthCacheValid() && cachedLength() <= index) - return 0; - - updateRefElements(); - if (!isItemCacheValid() || cachedItemOffset() > index) { - cacheFirstItem(); - ASSERT(isItemCacheValid()); - if (!cachedItem() || cachedItemOffset() == index) - return cachedItem(); - } - - unsigned currentPosition = cachedItemOffset(); - Node* element = cachedItem(); - ASSERT(currentPosition != index); - - for (unsigned i = cachedElementsArrayOffset(); i < m_itemRefElements.size(); ++i) { - while (currentPosition < index) { - element = itemAfter(m_itemRefElements[i], element); - if (!element) - break; - currentPosition++; - - if (currentPosition == index) { - setItemCache(element, currentPosition, i); - return cachedItem(); - } - } - } - - setLengthCache(currentPosition); - - return 0; -} - -void HTMLPropertiesCollection::findProperties(Element* base) const -{ - for (Element* element = itemAfter(base, 0); element; element = itemAfter(base, element)) { - DOMSettableTokenList* itemProperty = element->itemProp(); - for (unsigned i = 0; i < itemProperty->length(); ++i) - updatePropertyCache(element, itemProperty->item(i)); - } -} - void HTMLPropertiesCollection::updateNameCache() const { - invalidateCacheIfNeeded(); if (m_hasPropertyNameCache) return; updateRefElements(); - for (unsigned i = 0; i < m_itemRefElements.size(); ++i) - findProperties(m_itemRefElements[i]); + 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)) { + DOMSettableTokenList* itemProperty = element->itemProp(); + for (unsigned propertyIndex = 0; propertyIndex < itemProperty->length(); ++propertyIndex) + updatePropertyCache(element, itemProperty->item(propertyIndex)); + } + } m_hasPropertyNameCache = true; } PassRefPtr<DOMStringList> HTMLPropertiesCollection::names() const { - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return DOMStringList::create(); - updateNameCache(); - + if (!m_propertyNames) + m_propertyNames = DOMStringList::create(); return m_propertyNames; } PassRefPtr<NodeList> HTMLPropertiesCollection::namedItem(const String& name) const { - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return 0; - - Vector<RefPtr<Node> > namedItems; - updateNameCache(); + Vector<RefPtr<Node> > namedItems; Vector<Element*>* propertyResults = m_propertyCache.get(AtomicString(name).impl()); for (unsigned i = 0; propertyResults && i < propertyResults->size(); ++i) namedItems.append(propertyResults->at(i)); @@ -247,9 +182,6 @@ PassRefPtr<NodeList> HTMLPropertiesCollection::namedItem(const String& name) con bool HTMLPropertiesCollection::hasNamedItem(const AtomicString& name) const { - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return false; - updateNameCache(); if (Vector<Element*>* propertyCache = m_propertyCache.get(name.impl())) { diff --git a/Source/WebCore/html/HTMLPropertiesCollection.h b/Source/WebCore/html/HTMLPropertiesCollection.h index 7826df409..dba91cac1 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.h +++ b/Source/WebCore/html/HTMLPropertiesCollection.h @@ -45,14 +45,13 @@ public: static PassRefPtr<HTMLPropertiesCollection> create(Node*); virtual ~HTMLPropertiesCollection(); - virtual Node* item(unsigned) const OVERRIDE; + void updateRefElements() const; PassRefPtr<DOMStringList> names() const; - virtual PassRefPtr<NodeList> namedItem(const String&) const OVERRIDE; virtual bool hasNamedItem(const AtomicString&) const OVERRIDE; - void clearCache() const + void invalidateCache() const { m_itemRefElements.clear(); m_propertyNames.clear(); @@ -64,16 +63,12 @@ public: private: HTMLPropertiesCollection(Node*); - virtual unsigned calcLength() const OVERRIDE; - void findProperties(Element* base) const; - Node* findRefElements(Node* previous) const; - void cacheFirstItem() const; - Element* itemAfter(Element* base, Node* previous) const; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + HTMLElement* itemAfter(HTMLElement* base, Element* previous) const; void updateNameCache() const; - void updateRefElements() const; void updatePropertyCache(Element* element, const AtomicString& propertyName) const { @@ -88,7 +83,7 @@ private: append(m_propertyCache, propertyName, element); } - mutable Vector<Element*> m_itemRefElements; + mutable Vector<HTMLElement*> m_itemRefElements; mutable RefPtr<DOMStringList> m_propertyNames; mutable NodeCacheMap m_propertyCache; diff --git a/Source/WebCore/html/HTMLTableRowsCollection.cpp b/Source/WebCore/html/HTMLTableRowsCollection.cpp index 534db17e6..206864ec2 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) + : HTMLCollection(table, TableRows, DoNotSupportItemBefore) { ASSERT(table->hasTagName(tableTag)); } @@ -162,8 +162,9 @@ PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(Element* tab return adoptRef(new HTMLTableRowsCollection(table)); } -Element* HTMLTableRowsCollection::itemAfter(Node* previous) const +Element* HTMLTableRowsCollection::itemAfter(unsigned& offsetInArray, Element* previous) const { + ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(!previous || (previous->isHTMLElement() && toHTMLElement(previous)->hasLocalName(trTag))); return rowAfter(static_cast<HTMLTableElement*>(base()), static_cast<HTMLTableRowElement*>(previous)); } diff --git a/Source/WebCore/html/HTMLTableRowsCollection.h b/Source/WebCore/html/HTMLTableRowsCollection.h index 02bb9f749..817b14373 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.h +++ b/Source/WebCore/html/HTMLTableRowsCollection.h @@ -46,7 +46,7 @@ public: private: HTMLTableRowsCollection(Element*); - virtual Element* itemAfter(Node*) const OVERRIDE; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/ImageInputType.cpp b/Source/WebCore/html/ImageInputType.cpp index 456f22c75..af4cc9068 100644 --- a/Source/WebCore/html/ImageInputType.cpp +++ b/Source/WebCore/html/ImageInputType.cpp @@ -190,7 +190,7 @@ unsigned ImageInputType::height() const return height; // If the image is available, use its height. - if (m_imageLoader->image()) + if (m_imageLoader && m_imageLoader->image()) return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height(); } @@ -211,7 +211,7 @@ unsigned ImageInputType::width() const return width; // If the image is available, use its width. - if (m_imageLoader->image()) + if (m_imageLoader && m_imageLoader->image()) return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width(); } diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 99e5422ef..4c4586523 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -169,6 +169,11 @@ bool InputType::isRangeControl() const return false; } +bool InputType::shouldSaveAndRestoreFormControlState() const +{ + return true; +} + FormControlState InputType::saveFormControlState() const { String currentValue = element()->value(); diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index fa41ff857..6c6659a7c 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -128,6 +128,7 @@ public: // Form value functions + virtual bool shouldSaveAndRestoreFormControlState() const; virtual FormControlState saveFormControlState() const; virtual void restoreFormControlState(const FormControlState&); virtual bool isFormDataAppendable() const; diff --git a/Source/WebCore/html/LabelableElement.cpp b/Source/WebCore/html/LabelableElement.cpp index 6a2632e2f..af4533d8c 100644 --- a/Source/WebCore/html/LabelableElement.cpp +++ b/Source/WebCore/html/LabelableElement.cpp @@ -47,7 +47,7 @@ PassRefPtr<NodeList> LabelableElement::labels() if (!document()) return 0; - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<LabelsNodeList>(this, DynamicNodeList::LabelsNodeListType, starAtom); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<LabelsNodeList>(this, DynamicNodeList::LabelsNodeListType, starAtom); } } // namespace Webcore diff --git a/Source/WebCore/html/LabelsNodeList.cpp b/Source/WebCore/html/LabelsNodeList.cpp index 89f0baf7c..d3a4ba162 100644 --- a/Source/WebCore/html/LabelsNodeList.cpp +++ b/Source/WebCore/html/LabelsNodeList.cpp @@ -34,15 +34,13 @@ namespace WebCore { using namespace HTMLNames; LabelsNodeList::LabelsNodeList(Node* forNode) - : DynamicSubtreeNodeList(forNode, RootedAtDocument) + : DynamicSubtreeNodeList(forNode, InvalidateOnForAttrChange, NodeListIsRootedAtDocument) { - document()->registerDynamicSubtreeNodeList(this); } LabelsNodeList::~LabelsNodeList() { ownerNode()->nodeLists()->removeCacheWithAtomicName(this, DynamicNodeList::LabelsNodeListType, starAtom); - document()->unregisterDynamicSubtreeNodeList(this); } bool LabelsNodeList::nodeMatches(Element* testNode) const diff --git a/Source/WebCore/html/PasswordInputType.cpp b/Source/WebCore/html/PasswordInputType.cpp index 10c2d9f9e..a64c8e516 100644 --- a/Source/WebCore/html/PasswordInputType.cpp +++ b/Source/WebCore/html/PasswordInputType.cpp @@ -49,9 +49,15 @@ const AtomicString& PasswordInputType::formControlType() const return InputTypeNames::password(); } +bool PasswordInputType::shouldSaveAndRestoreFormControlState() const +{ + return false; +} + FormControlState PasswordInputType::saveFormControlState() const { // Should never save/restore password fields. + ASSERT_NOT_REACHED(); return FormControlState(); } diff --git a/Source/WebCore/html/PasswordInputType.h b/Source/WebCore/html/PasswordInputType.h index 83012cf9c..fb9101c02 100644 --- a/Source/WebCore/html/PasswordInputType.h +++ b/Source/WebCore/html/PasswordInputType.h @@ -42,6 +42,7 @@ public: private: PasswordInputType(HTMLInputElement* element) : BaseTextInputType(element) { } virtual const AtomicString& formControlType() const OVERRIDE; + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; virtual FormControlState saveFormControlState() const OVERRIDE; virtual void restoreFormControlState(const FormControlState&) OVERRIDE; virtual bool shouldUseInputMethod() const OVERRIDE; diff --git a/Source/WebCore/html/RadioNodeList.cpp b/Source/WebCore/html/RadioNodeList.cpp index 15efb5155..bd3cc87b5 100644 --- a/Source/WebCore/html/RadioNodeList.cpp +++ b/Source/WebCore/html/RadioNodeList.cpp @@ -38,16 +38,14 @@ namespace WebCore { using namespace HTMLNames; RadioNodeList::RadioNodeList(Node* rootNode, const AtomicString& name) - : DynamicSubtreeNodeList(rootNode, rootNode->hasTagName(formTag) ? RootedAtDocument : RootedAtNode) + : DynamicSubtreeNodeList(rootNode, InvalidateForFormControls, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) , m_name(name) { - document()->registerDynamicSubtreeNodeList(this); } RadioNodeList::~RadioNodeList() { ownerNode()->nodeLists()->removeCacheWithAtomicName(this, DynamicNodeList::RadioNodeListType, m_name); - document()->unregisterDynamicSubtreeNodeList(this); } static inline HTMLInputElement* toRadioButtonInputElement(Node* node) diff --git a/Source/WebCore/html/StepRange.cpp b/Source/WebCore/html/StepRange.cpp index c7c88fcf9..4d0042f24 100644 --- a/Source/WebCore/html/StepRange.cpp +++ b/Source/WebCore/html/StepRange.cpp @@ -69,7 +69,7 @@ Decimal StepRange::acceptableError() const { // FIXME: We should use DBL_MANT_DIG instead of FLT_MANT_DIG regarding to HTML5 specification. DEFINE_STATIC_LOCAL(const Decimal, twoPowerOfFloatMantissaBits, (Decimal::Positive, 0, UINT64_C(1) << FLT_MANT_DIG)); - return m_step / twoPowerOfFloatMantissaBits; + return m_stepDescription.stepValueShouldBe == StepValueShouldBeReal ? m_step / twoPowerOfFloatMantissaBits : Decimal(0); } Decimal StepRange::alignValueForStep(const Decimal& currentValue, const Decimal& newValue) const diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index 05d3f80c7..b3a5f4151 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -1791,7 +1791,7 @@ $methodInCode ${responseCook} } - sendResponse(callId, result, String::format("Some arguments of method '%s' can't be processed", "$domainName.$methodName"), protocolErrors, error); + sendResponse(callId, result, commandNames[$commandNameIndex], protocolErrors, error); } """) @@ -1886,6 +1886,8 @@ $virtualSetters enum MethodNames { $methodNamesEnumContent + + kMethodNamesEnumSize }; static const char* commandNames[]; @@ -1949,7 +1951,7 @@ $fieldDeclarations static PassRefPtr<InspectorObject> getObject(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors); static PassRefPtr<InspectorArray> getArray(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors); - void sendResponse(long callId, PassRefPtr<InspectorObject> result, const String& errorMessage, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError); + void sendResponse(long callId, PassRefPtr<InspectorObject> result, const char* commandName, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError); }; @@ -1973,7 +1975,7 @@ void InspectorBackendDispatcherImpl::dispatch(const String& message) static CallHandler handlers[] = { $messageHandlers }; - size_t length = sizeof(commandNames) / sizeof(commandNames[0]); + size_t length = WTF_ARRAY_LENGTH(commandNames); for (size_t i = 0; i < length; ++i) dispatchMap.add(commandNames[i], handlers[i]); } @@ -2022,9 +2024,10 @@ $messageHandlers ((*this).*it->second)(callId, messageObject.get()); } -void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<InspectorObject> result, const String& errorMessage, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError) +void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<InspectorObject> result, const char* commandName, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError) { if (protocolErrors->length()) { + String errorMessage = String::format("Some arguments of method '%s' can't be processed", commandName); reportProtocolError(&callId, InvalidParams, errorMessage, protocolErrors); return; } @@ -2165,6 +2168,7 @@ bool InspectorBackendDispatcher::getCommandName(const String& message, String* r return true; } +COMPILE_ASSERT(static_cast<int>(InspectorBackendDispatcher::kMethodNamesEnumSize) == WTF_ARRAY_LENGTH(InspectorBackendDispatcher::commandNames), command_name_array_problem); } // namespace WebCore @@ -2684,7 +2688,9 @@ class Generator: def process_command(json_command, domain_name, agent_field_name, agent_interface_name): json_command_name = json_command["name"] - Generator.method_name_enum_list.append(" k%s_%sCmd," % (domain_name, json_command["name"])) + cmd_enum_name = "k%s_%sCmd" % (domain_name, json_command["name"]) + + Generator.method_name_enum_list.append(" %s," % cmd_enum_name) Generator.method_handler_list.append(" &InspectorBackendDispatcherImpl::%s_%s," % (domain_name, json_command_name)) Generator.backend_method_declaration_list.append(" void %s_%s(long callId, InspectorObject* requestMessageObject);" % (domain_name, json_command_name)) @@ -2813,7 +2819,8 @@ class Generator: methodOutCode=method_out_code, agentCallParams=join(agent_call_param_list, ""), requestMessageObject=request_message_param, - responseCook=response_cook_text)) + responseCook=response_cook_text, + commandNameIndex=cmd_enum_name)) Generator.backend_method_name_declaration_list.append(" \"%s.%s\"," % (domain_name, json_command_name)) Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerCommand(\"%s.%s\", [%s], %s);\n" % (domain_name, json_command_name, js_parameters_text, js_reply_list)) diff --git a/Source/WebCore/inspector/DOMPatchSupport.cpp b/Source/WebCore/inspector/DOMPatchSupport.cpp index 2f22151b2..775c464ec 100644 --- a/Source/WebCore/inspector/DOMPatchSupport.cpp +++ b/Source/WebCore/inspector/DOMPatchSupport.cpp @@ -35,7 +35,6 @@ #include "DOMPatchSupport.h" #include "Attribute.h" -#include "Base64.h" #include "ContextFeatures.h" #include "DOMEditor.h" #include "Document.h" @@ -52,6 +51,7 @@ #include <wtf/HashTraits.h> #include <wtf/RefPtr.h> #include <wtf/SHA1.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> using namespace std; diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index 83f83194e..d178d9d2d 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -364,20 +364,6 @@ "parameters": [ { "name": "value", "type": "boolean", "description": "Whether script execution should be disabled in the page." } ] - }, - { - "name": "setGeolocationData", - "description": "overrides the GeolocationPosition or GeolocationError in the GeolocationController.", - "parameters": [ - { "name": "longitude", "type": "number", "optional": true, "description": "Mock longitude"}, - { "name": "latitude", "type": "number", "optional": true, "description": "Mock latitude"}, - { "name": "accuracy", "type": "number", "optional": true, "description": "Mock accuracy"}, - { "name": "errorType", "type": "string", "optional": true, "enum": ["PermissionDenied", "PositionUnavailable"], "description": "Error type"} - ] - }, - { - "name": "clearGeolocationData", - "description": "clears the overriden GeolocationPosition and GeolocationError." } ], "events": [ diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp index f97abbf96..1b7df9580 100644 --- a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp +++ b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp @@ -34,7 +34,6 @@ #include "InspectorFileSystemAgent.h" -#include "Base64.h" #include "DOMFileSystem.h" #include "DOMImplementation.h" #include "DirectoryEntry.h" @@ -44,6 +43,7 @@ #include "EntryArray.h" #include "EntryCallback.h" #include "ErrorCallback.h" +#include "File.h" #include "FileCallback.h" #include "FileEntry.h" #include "FileError.h" @@ -63,6 +63,7 @@ #include "SecurityOrigin.h" #include "TextEncoding.h" #include "TextResourceDecoder.h" +#include <wtf/text/Base64.h> using WebCore::TypeBuilder::Array; diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp index 6107eb982..0fdaca6e2 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp @@ -186,7 +186,7 @@ private: class ExecutableWithDatabase : public RefCounted<ExecutableWithDatabase> { public: virtual ~ExecutableWithDatabase() { }; - void start(IDBFactoryBackendInterface*, SecurityOrigin*, Frame*, const String& databaseName); + void start(IDBFactoryBackendInterface*, SecurityOrigin*, ScriptExecutionContext*, const String& databaseName); virtual void execute(PassRefPtr<IDBDatabaseBackendInterface>) = 0; }; @@ -233,10 +233,10 @@ private: RefPtr<ExecutableWithDatabase> m_executableWithDatabase; }; -void ExecutableWithDatabase::start(IDBFactoryBackendInterface* idbFactory, SecurityOrigin* securityOrigin, Frame* frame, const String& databaseName) +void ExecutableWithDatabase::start(IDBFactoryBackendInterface* idbFactory, SecurityOrigin* securityOrigin, ScriptExecutionContext* context, const String& databaseName) { RefPtr<OpenDatabaseCallback> callback = OpenDatabaseCallback::create(this); - idbFactory->open(databaseName, callback.get(), securityOrigin, frame, String()); + idbFactory->open(databaseName, callback.get(), securityOrigin, context, String()); } static PassRefPtr<IDBTransactionBackendInterface> transactionForDatabase(IDBDatabaseBackendInterface* idbDatabase, const String& objectStoreName) @@ -732,7 +732,7 @@ void InspectorIndexedDBAgent::requestDatabaseNamesForFrame(ErrorString* errorStr RefPtr<GetDatabaseNamesCallback> callback = GetDatabaseNamesCallback::create(m_frontendProvider.get(), requestId, document->securityOrigin()->toString()); GroupSettings* groupSettings = document->page()->group().groupSettings(); - idbFactory->getDatabaseNames(callback.get(), document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); + idbFactory->getDatabaseNames(callback.get(), document->securityOrigin(), document, groupSettings->indexedDBDatabasePath()); } void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, int requestId, const String& frameId, const String& databaseName) @@ -745,7 +745,7 @@ void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, int requ return; RefPtr<DatabaseLoaderCallback> databaseLoaderCallback = DatabaseLoaderCallback::create(m_frontendProvider.get(), requestId); - databaseLoaderCallback->start(idbFactory, document->securityOrigin(), document->frame(), databaseName); + databaseLoaderCallback->start(idbFactory, document->securityOrigin(), document, databaseName); } void InspectorIndexedDBAgent::requestData(ErrorString* errorString, int requestId, const String& frameId, const String& databaseName, const String& objectStoreName, const String& indexName, int skipCount, int pageSize, const RefPtr<InspectorObject>* keyRange) @@ -769,7 +769,7 @@ void InspectorIndexedDBAgent::requestData(ErrorString* errorString, int requestI } RefPtr<DataLoaderCallback> dataLoaderCallback = DataLoaderCallback::create(m_frontendProvider, requestId, injectedScript, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); - dataLoaderCallback->start(idbFactory, document->securityOrigin(), document->frame(), databaseName); + dataLoaderCallback->start(idbFactory, document->securityOrigin(), document, databaseName); } } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index dadd599c6..325a4c48f 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -1186,19 +1186,6 @@ InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForNonDocument } #endif -#if ENABLE(GEOLOCATION) -GeolocationPosition* InspectorInstrumentation::checkGeolocationPositionOrErrorImpl(InstrumentingAgents* instrumentingAgents, GeolocationPosition* position) -{ - if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent()) { - if (pageAgent->sendGeolocationError()) - return 0; - if (pageAgent->geolocationPosition()) - position = pageAgent->geolocationPosition(); - } - return position; -} -#endif - } // namespace WebCore #endif // !ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 16fd159b1..4350e9ccd 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -56,7 +56,6 @@ class Database; class Element; class EventContext; class DocumentLoader; -class GeolocationPosition; class GraphicsContext; class HitTestResult; class InspectorCSSAgent; @@ -261,10 +260,6 @@ public: static bool collectingHTMLParseErrors(Page*) { return false; } #endif -#if ENABLE(GEOLOCATION) - static GeolocationPosition* checkGeolocationPositionOrError(Page*, GeolocationPosition*); -#endif - private: #if ENABLE(INSPECTOR) static WTF::ThreadSpecific<InspectorTimelineAgent*>& threadSpecificTimelineAgentForOrphanEvents(); @@ -426,10 +421,6 @@ private: static void cancelPauseOnNativeEvent(InstrumentingAgents*); static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&); -#if ENABLE(GEOLOCATION) - static GeolocationPosition* checkGeolocationPositionOrErrorImpl(InstrumentingAgents*, GeolocationPosition*); -#endif - static int s_frontendCounter; #endif }; @@ -1395,19 +1386,6 @@ inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstr #endif } - -#if ENABLE(GEOLOCATION) -inline GeolocationPosition* InspectorInstrumentation::checkGeolocationPositionOrError(Page* page, GeolocationPosition* position) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(position); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - return checkGeolocationPositionOrErrorImpl(instrumentingAgents, position); -#endif - return position; -} -#endif - #if ENABLE(INSPECTOR) inline bool InspectorInstrumentation::collectingHTMLParseErrors(Page* page) { diff --git a/Source/WebCore/inspector/InspectorMemoryAgent.cpp b/Source/WebCore/inspector/InspectorMemoryAgent.cpp index ff01ffbf9..5b3e3662d 100644 --- a/Source/WebCore/inspector/InspectorMemoryAgent.cpp +++ b/Source/WebCore/inspector/InspectorMemoryAgent.cpp @@ -548,6 +548,7 @@ public: void visitBindings() { ScriptProfiler::collectBindingMemoryInfo(&m_domMemoryUsage); + m_domMemoryUsage.processDeferredInstrumentedPointers(); } PassRefPtr<InspectorMemoryBlock> dumpStatistics(InspectorDataCounter* inspectorData) diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp index aed08419d..ef34537f0 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/InspectorPageAgent.cpp @@ -34,7 +34,6 @@ #include "InspectorPageAgent.h" -#include "Base64.h" #include "CachedCSSStyleSheet.h" #include "CachedFont.h" #include "CachedImage.h" @@ -51,9 +50,6 @@ #include "DocumentLoader.h" #include "Frame.h" #include "FrameView.h" -#include "GeolocationController.h" -#include "GeolocationError.h" -#include "GeolocationPosition.h" #include "HTMLFrameOwnerElement.h" #include "HTMLNames.h" #include "IdentifiersFactory.h" @@ -79,6 +75,7 @@ #include <wtf/CurrentTime.h> #include <wtf/ListHashSet.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> using namespace std; @@ -321,8 +318,6 @@ InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, , m_lastScriptIdentifier(0) , m_lastPaintContext(0) , m_didLoadEventFire(false) - , m_geolocationError() - , m_geolocationPosition() { } @@ -972,52 +967,6 @@ void InspectorPageAgent::updateViewMetrics(int width, int height, double fontSca InspectorInstrumentation::mediaQueryResultChanged(document); } -void InspectorPageAgent::setGeolocationData(ErrorString*, const double* longitude, const double* latitude, const double* accuracy, const String* errorType) -{ -#if ENABLE (GEOLOCATION) - GeolocationController* controller = GeolocationController::from(m_page); - if (!controller) - return; - - clearGeolocationData(0); - - if (*errorType == "PermissionDenied") - m_geolocationError = GeolocationError::create(GeolocationError::PermissionDenied, *errorType).leakRef(); - else if (*errorType == "PositionUnavailable") - m_geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, *errorType).leakRef(); - - if (m_geolocationError.get()) { - controller->errorOccurred(m_geolocationError.get()); - return; - } - - m_geolocationPosition = GeolocationPosition::create(currentTimeMS(), *longitude, *latitude, *accuracy).leakRef(); - controller->positionChanged(m_geolocationPosition.get()); -#endif -} - -void InspectorPageAgent::clearGeolocationData(ErrorString*) -{ -#if ENABLE(GEOLOCATION) - m_geolocationError.clear(); - m_geolocationPosition.clear(); -#endif -} - -bool InspectorPageAgent::sendGeolocationError() -{ -#if ENABLE(GEOLOCATION) - if (m_geolocationError.get()) { - GeolocationController* controller = GeolocationController::from(m_page); - if (controller) { - controller->errorOccurred(m_geolocationError.get()); - return true; - } - } -#endif - return false; -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index c2f84f43d..964bc85fc 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -34,8 +34,6 @@ #if ENABLE(INSPECTOR) #include "Frame.h" -#include "GeolocationError.h" -#include "GeolocationPosition.h" #include "InspectorBaseAgent.h" #include "InspectorFrontend.h" #include "PlatformString.h" @@ -110,12 +108,6 @@ public: virtual void setShowPaintRects(ErrorString*, bool show); virtual void getScriptExecutionStatus(ErrorString*, PageCommandHandler::Result::Enum*); virtual void setScriptExecutionDisabled(ErrorString*, bool); - virtual void setGeolocationData(ErrorString*, const double*, const double*, const double*, const String*); - virtual void clearGeolocationData(ErrorString*); - - // Geolocation override helpers. - bool sendGeolocationError(); - GeolocationPosition* geolocationPosition() const {return m_geolocationPosition.get();} // InspectorInstrumentation API void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*); @@ -164,8 +156,6 @@ private: GraphicsContext* m_lastPaintContext; LayoutRect m_lastPaintRect; bool m_didLoadEventFire; - RefPtr<GeolocationError> m_geolocationError; - RefPtr<GeolocationPosition> m_geolocationPosition; }; diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js index 1bccada70..aaf792a12 100644 --- a/Source/WebCore/inspector/front-end/CSSStyleModel.js +++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js @@ -1079,12 +1079,13 @@ WebInspector.CSSStyleModelResourceBinding.prototype = { return; var styleSheetURL = header.origin === "inspector" ? this._viaInspectorResourceURL(header.sourceURL) : header.sourceURL; - var resource = frame.resourceForURL(styleSheetURL); - if (!resource) + + var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(styleSheetURL); + if (!uiSourceCode) return; - if (resource.type === WebInspector.resourceTypes.Stylesheet) - resource.addRevision(content); + if (uiSourceCode.contentType() === WebInspector.resourceTypes.Stylesheet) + uiSourceCode.addRevision(content); } if (!this._styleSheetIdToHeader[styleSheetId]) { diff --git a/Source/WebCore/inspector/front-end/ConsolePanel.js b/Source/WebCore/inspector/front-end/ConsolePanel.js index 62157d26b..fc3b85317 100644 --- a/Source/WebCore/inspector/front-end/ConsolePanel.js +++ b/Source/WebCore/inspector/front-end/ConsolePanel.js @@ -127,6 +127,7 @@ WebInspector.ConsolePanel.prototype = { { this._clearCurrentSearchResultHighlight(); this._currentSearchResultIndex = index; + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); this._searchResults[index].highlightSearchResults(this._searchRegex); }, diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js index 4dfed1a83..02e69bb10 100644 --- a/Source/WebCore/inspector/front-end/ConsoleView.js +++ b/Source/WebCore/inspector/front-end/ConsoleView.js @@ -44,18 +44,12 @@ WebInspector.ConsoleView = function(hideContextSelector) this._clearConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear console log."), "clear-status-bar-item"); this._clearConsoleButton.addEventListener("click", this._requestClearMessages, this); - this._contextSelectElement = document.createElement("select"); - this._contextSelectElement.id = "console-context"; - this._contextSelectElement.className = "status-bar-item"; - this._contextSelectElement.addEventListener("change", this._updateIsolatedWorldSelector.bind(this), false); - - this._isolatedWorldSelectElement = document.createElement("select"); - this._isolatedWorldSelectElement.id = "console-context"; - this._isolatedWorldSelectElement.className = "status-bar-item"; + this._contextSelector = new WebInspector.StatusBarComboBox(this._updateIsolatedWorldSelector.bind(this), "console-context"); + this._isolatedWorldSelector = new WebInspector.StatusBarComboBox(null, "console-context"); if (hideContextSelector) { - this._contextSelectElement.addStyleClass("hidden"); - this._isolatedWorldSelectElement.addStyleClass("hidden"); + this._contextSelector.element.addStyleClass("hidden"); + this._isolatedWorldSelector.element.addStyleClass("hidden"); } this.messagesElement = document.createElement("div"); @@ -77,7 +71,6 @@ WebInspector.ConsoleView = function(hideContextSelector) this.currentGroup = this.topGroup; this._filterBarElement = document.createElement("div"); - this._filterBarElement.id = "console-filter"; this._filterBarElement.className = "scope-bar status-bar-item"; function createDividerElement() { @@ -134,7 +127,7 @@ WebInspector.ConsoleView.Events = { WebInspector.ConsoleView.prototype = { get statusBarItems() { - return [this._clearConsoleButton.element, this._contextSelectElement, this._isolatedWorldSelectElement, this._filterBarElement]; + return [this._clearConsoleButton.element, this._contextSelector.element, this._isolatedWorldSelector.element, this._filterBarElement]; }, addContext: function(context) @@ -144,7 +137,7 @@ WebInspector.ConsoleView.prototype = { option.title = context.url; option._context = context; context._consoleOption = option; - this._contextSelectElement.appendChild(option); + this._contextSelector.addOption(option); context.addEventListener(WebInspector.FrameEvaluationContext.EventTypes.Updated, this._contextUpdated, this); context.addEventListener(WebInspector.FrameEvaluationContext.EventTypes.AddedExecutionContext, this._addedExecutionContext, this); this._updateIsolatedWorldSelector(); @@ -152,7 +145,7 @@ WebInspector.ConsoleView.prototype = { removeContext: function(context) { - this._contextSelectElement.removeChild(context._consoleOption); + this._contextSelector.removeOption(context._consoleOption); this._updateIsolatedWorldSelector(); }, @@ -160,17 +153,17 @@ WebInspector.ConsoleView.prototype = { { var context = this._currentEvaluationContext(); if (!context) { - this._isolatedWorldSelectElement.addStyleClass("hidden"); + this._isolatedWorldSelector.element.addStyleClass("hidden"); return; } var isolatedContexts = context.isolatedContexts(); if (!isolatedContexts.length) { - this._isolatedWorldSelectElement.addStyleClass("hidden"); + this._isolatedWorldSelector.element.addStyleClass("hidden"); return; } - this._isolatedWorldSelectElement.removeStyleClass("hidden"); - this._isolatedWorldSelectElement.removeChildren(); + this._isolatedWorldSelector.element.removeStyleClass("hidden"); + this._isolatedWorldSelector.removeOptions(); this._appendIsolatedContextOption(context.mainWorldContext()); for (var i = 0; i < isolatedContexts.length; i++) this._appendIsolatedContextOption(isolatedContexts[i]); @@ -184,7 +177,7 @@ WebInspector.ConsoleView.prototype = { option.text = isolatedContext.name; option.title = isolatedContext.id; option._executionContextId = isolatedContext.id; - this._isolatedWorldSelectElement.appendChild(option); + this._isolatedWorldSelector.addOption(option); }, _contextUpdated: function(event) @@ -215,18 +208,20 @@ WebInspector.ConsoleView.prototype = { _currentEvaluationContext: function() { - if (this._contextSelectElement.selectedIndex === -1) + var option = this._contextSelector.selectedOption(); + if (!option) return undefined; - return this._contextSelectElement[this._contextSelectElement.selectedIndex]._context; + return option._context; }, _currentIsolatedContextId: function() { - if (this._isolatedWorldSelectElement.hasStyleClass("hidden")) + if (this._isolatedWorldSelector.element.hasStyleClass("hidden")) return undefined; - if (this._isolatedWorldSelectElement.selectedIndex === -1) + var option = this._isolatedWorldSelector.selectedOption(); + if (!option) return undefined; - return this._isolatedWorldSelectElement[this._isolatedWorldSelectElement.selectedIndex]._executionContextId; + return option._executionContextId; }, _updateFilter: function(e) diff --git a/Source/WebCore/inspector/front-end/ExtensionServer.js b/Source/WebCore/inspector/front-end/ExtensionServer.js index b835fb9d3..ce0157f9f 100644 --- a/Source/WebCore/inspector/front-end/ExtensionServer.js +++ b/Source/WebCore/inspector/front-end/ExtensionServer.js @@ -582,9 +582,9 @@ WebInspector.ExtensionServer.prototype = { this._notifyElementsSelectionChanged); } this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ResourceContentCommitted, - WebInspector.resourceTreeModel, - WebInspector.ResourceTreeModel.EventTypes.ResourceContentCommitted, - this._notifyResourceContentCommitted); + WebInspector.workspace, + WebInspector.Workspace.Events.UISourceCodeContentCommitted, + this._notifyUISourceCodeContentCommitted); function onTimelineSubscriptionStarted() { @@ -618,11 +618,11 @@ WebInspector.ExtensionServer.prototype = { this._postNotification(WebInspector.extensionAPI.Events.ResourceAdded, this._makeResource(uiSourceCode)); }, - _notifyResourceContentCommitted: function(event) + _notifyUISourceCodeContentCommitted: function(event) { - var resource = /** @type {WebInspector.Resource} */ event.data.resource; - var contentProvider = resource.uiSourceCode() || resource; - this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(contentProvider), event.data.content); + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + var content = /** @type {string} */ event.data.content; + this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(uiSourceCode), content); }, _notifyRequestFinished: function(event) diff --git a/Source/WebCore/inspector/front-end/Images/statusbarBackground.png b/Source/WebCore/inspector/front-end/Images/statusbarBackground.png Binary files differdeleted file mode 100644 index b466a49cd..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarBackground.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarBottomBackground.png b/Source/WebCore/inspector/front-end/Images/statusbarBottomBackground.png Binary files differdeleted file mode 100644 index fb5c9e483..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarBottomBackground.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarButtons.png b/Source/WebCore/inspector/front-end/Images/statusbarButtons.png Binary files differdeleted file mode 100644 index 163d7b5f4..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarButtons.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png b/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png Binary files differdeleted file mode 100644 index 8904217b0..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png b/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png Binary files differdeleted file mode 100644 index 74fe953fa..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 67364ad3a..4d2c9ea3c 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -322,7 +322,6 @@ WebInspector.NetworkLogView.prototype = { { var filterBarElement = document.createElement("div"); filterBarElement.className = "scope-bar status-bar-item"; - filterBarElement.id = "network-filter"; /** * @param {string} typeName diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index 18131c1c4..476a2d152 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -752,6 +752,7 @@ WebInspector.ProfilesPanel.prototype = { function updateMatchesCount() { WebInspector.searchController.updateSearchMatchesCount(this._totalSearchMatches, this); + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); matchesCountUpdateTimeout = null; } @@ -833,6 +834,8 @@ WebInspector.ProfilesPanel.prototype = { showFirstResult = true; } + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); + if (currentView !== this.visibleView) { this.showView(currentView); WebInspector.searchController.focusSearchField(); @@ -866,6 +869,8 @@ WebInspector.ProfilesPanel.prototype = { showLastResult = true; } + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); + if (currentView !== this.visibleView) { this.showView(currentView); WebInspector.searchController.focusSearchField(); diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js index 9a5f91468..8329a0b7a 100644 --- a/Source/WebCore/inspector/front-end/Resource.js +++ b/Source/WebCore/inspector/front-end/Resource.js @@ -48,7 +48,6 @@ WebInspector.Resource = function(request, url, documentURL, frameId, loaderId, t this._loaderId = loaderId; this._type = type || WebInspector.resourceTypes.Other; this._mimeType = mimeType; - this.history = []; this._isHidden = isHidden; /** @type {?string} */ this._content; @@ -56,12 +55,9 @@ WebInspector.Resource = function(request, url, documentURL, frameId, loaderId, t this._pendingContentCallbacks = []; if (this._request && !this._request.finished) this._request.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading, this._requestFinished, this); - - this._restoreRevisionHistory(); } WebInspector.Resource.Events = { - RevisionAdded: "revision-added", MessageAdded: "message-added", MessagesCleared: "messages-cleared", } @@ -215,65 +211,6 @@ WebInspector.Resource.prototype = { }, /** - * @param {string} newContent - * @param {function(String)=} callback - */ - _setContent: function(newContent, callback) - { - var uiSourceCode = this._uiSourceCode; - if (!this._uiSourceCode || !this._uiSourceCode.isEditable()) - return; - this._uiSourceCode.setWorkingCopy(newContent); - this._uiSourceCode.commitWorkingCopy(callback); - }, - - /** - * @param {string} content - * @param {Date=} timestamp - * @param {boolean=} restoringHistory - */ - addRevision: function(content, timestamp, restoringHistory) - { - if (this.history.length) { - var lastRevision = this.history[this.history.length - 1]; - if (lastRevision._content === content) - return; - } - var revision = new WebInspector.Revision(this, content, timestamp || new Date()); - this.history.push(revision); - - this.dispatchEventToListeners(WebInspector.Resource.Events.RevisionAdded, revision); - if (!restoringHistory) - revision._persist(); - WebInspector.resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceContentCommitted, { resource: this, content: content }); - }, - - _restoreRevisionHistory: function() - { - if (!window.localStorage) - return; - - WebInspector.Revision._ensureStaleRevisionsFileteredOut(); - var registry = WebInspector.Revision._revisionHistoryRegistry(); - var historyItems = registry[this.url]; - for (var i = 0; historyItems && i < historyItems.length; ++i) - this.addRevision(window.localStorage[historyItems[i].key], new Date(historyItems[i].timestamp), true); - }, - - _clearRevisionHistory: function() - { - if (!window.localStorage) - return; - - var registry = WebInspector.Revision._revisionHistoryRegistry(); - var historyItems = registry[this.url]; - for (var i = 0; historyItems && i < historyItems.length; ++i) - delete window.localStorage[historyItems[i].key]; - delete registry[this.url]; - window.localStorage["revision-history"] = JSON.stringify(registry); - }, - - /** * @return {?string} */ contentURL: function() @@ -391,222 +328,14 @@ WebInspector.Resource.prototype = { PageAgent.getResourceContent(this.frameId, this.url, callback.bind(this)); }, - revertToOriginal: function() - { - function revert(content) - { - this._setContent(content, function() {}); - } - this.requestContent(revert.bind(this)); - }, - - revertAndClearHistory: function(callback) - { - function revert(content) - { - this._setContent(content, clearHistory.bind(this)); - } - - function clearHistory() - { - this._clearRevisionHistory(); - this.history = []; - callback(); - } - - this.requestContent(revert.bind(this)); - }, - /** * @return {boolean} */ isHidden: function() { - return !!this._isHidden; - }, - - /** - * @return {WebInspector.UISourceCode} - */ - uiSourceCode: function() - { - return this._uiSourceCode; - }, - - /** - * @param {WebInspector.UISourceCode} uiSourceCode - */ - setUISourceCode: function(uiSourceCode) - { - this._uiSourceCode = uiSourceCode; + return !!this._isHidden; } } WebInspector.Resource.prototype.__proto__ = WebInspector.Object.prototype; -/** - * @constructor - * @implements {WebInspector.ContentProvider} - * @param {WebInspector.Resource} resource - * @param {?string|undefined} content - * @param {Date} timestamp - */ -WebInspector.Revision = function(resource, content, timestamp) -{ - this._resource = resource; - this._content = content; - this._timestamp = timestamp; -} - -WebInspector.Revision._revisionHistoryRegistry = function() -{ - if (!WebInspector.Revision._revisionHistoryRegistryObject) { - if (window.localStorage) { - var revisionHistory = window.localStorage["revision-history"]; - try { - WebInspector.Revision._revisionHistoryRegistryObject = revisionHistory ? JSON.parse(revisionHistory) : {}; - } catch (e) { - WebInspector.Revision._revisionHistoryRegistryObject = {}; - } - } else - WebInspector.Revision._revisionHistoryRegistryObject = {}; - } - return WebInspector.Revision._revisionHistoryRegistryObject; -} - -WebInspector.Revision._ensureStaleRevisionsFileteredOut = function() -{ - if (!window.localStorage) - return; - - if (WebInspector.Revision._staleRevisionsFilteredOut) - return; - WebInspector.Revision._staleRevisionsFilteredOut = true; - - var registry = WebInspector.Revision._revisionHistoryRegistry(); - var filteredRegistry = {}; - for (var url in registry) { - var historyItems = registry[url]; - var filteredHistoryItems = []; - for (var i = 0; historyItems && i < historyItems.length; ++i) { - var historyItem = historyItems[i]; - if (historyItem.loaderId === WebInspector.resourceTreeModel.mainFrame.loaderId) { - filteredHistoryItems.push(historyItem); - filteredRegistry[url] = filteredHistoryItems; - } else - delete window.localStorage[historyItem.key]; - } - } - WebInspector.Revision._revisionHistoryRegistryObject = filteredRegistry; - - function persist() - { - window.localStorage["revision-history"] = JSON.stringify(filteredRegistry); - } - - // Schedule async storage. - setTimeout(persist, 0); -} - -WebInspector.Revision.prototype = { - /** - * @return {WebInspector.Resource} - */ - get resource() - { - return this._resource; - }, - - /** - * @return {Date} - */ - get timestamp() - { - return this._timestamp; - }, - - /** - * @return {?string} - */ - get content() - { - return this._content || null; - }, - - revertToThis: function() - { - function revert(content) - { - if (this._resource._content !== content) - this._resource._setContent(content, function() {}); - } - this.requestContent(revert.bind(this)); - }, - - /** - * @return {?string} - */ - contentURL: function() - { - return this._resource.url; - }, - - /** - * @return {WebInspector.ResourceType} - */ - contentType: function() - { - return this._resource.contentType(); - }, - - /** - * @param {function(?string, boolean, string)} callback - */ - requestContent: function(callback) - { - callback(this._content || "", false, this.resource.mimeType); - }, - - /** - * @param {string} query - * @param {boolean} caseSensitive - * @param {boolean} isRegex - * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback - */ - searchInContent: function(query, caseSensitive, isRegex, callback) - { - callback([]); - }, - - _persist: function() - { - if (!window.localStorage) - return; - - var url = this.contentURL(); - if (url.startsWith("inspector://")) - return; - - var loaderId = WebInspector.resourceTreeModel.mainFrame.loaderId; - var timestamp = this.timestamp.getTime(); - var key = "revision-history|" + url + "|" + loaderId + "|" + timestamp; - - var registry = WebInspector.Revision._revisionHistoryRegistry(); - - var historyItems = registry[url]; - if (!historyItems) { - historyItems = []; - registry[url] = historyItems; - } - historyItems.push({url: url, loaderId: loaderId, timestamp: timestamp, key: key}); - - function persist() - { - window.localStorage[key] = this._content; - window.localStorage["revision-history"] = JSON.stringify(registry); - } - - // Schedule async storage. - setTimeout(persist.bind(this), 0); - } -} diff --git a/Source/WebCore/inspector/front-end/ResourceTreeModel.js b/Source/WebCore/inspector/front-end/ResourceTreeModel.js index 96515861f..e0dfbabb1 100644 --- a/Source/WebCore/inspector/front-end/ResourceTreeModel.js +++ b/Source/WebCore/inspector/front-end/ResourceTreeModel.js @@ -60,7 +60,6 @@ WebInspector.ResourceTreeModel.EventTypes = { FrameDetached: "FrameDetached", MainFrameNavigated: "MainFrameNavigated", ResourceAdded: "ResourceAdded", - ResourceContentCommitted: "resource-content-committed", WillLoadCachedResources: "WillLoadCachedResources", CachedResourcesLoaded: "CachedResourcesLoaded", DOMContentLoaded: "DOMContentLoaded", diff --git a/Source/WebCore/inspector/front-end/ResourceView.js b/Source/WebCore/inspector/front-end/ResourceView.js index 1acef7f2e..ce50b4b6c 100644 --- a/Source/WebCore/inspector/front-end/ResourceView.js +++ b/Source/WebCore/inspector/front-end/ResourceView.js @@ -84,7 +84,6 @@ WebInspector.ResourceSourceFrame = function(resource) { this._resource = resource; WebInspector.SourceFrame.call(this, resource); - this._resource.addEventListener(WebInspector.Resource.Events.RevisionAdded, this._contentChanged, this); } WebInspector.ResourceSourceFrame.prototype = { @@ -93,11 +92,6 @@ WebInspector.ResourceSourceFrame.prototype = { return this._resource; }, - _contentChanged: function(event) - { - this.setContent(this._resource.content, false, this._resource.canonicalMimeType()); - }, - populateTextAreaContextMenu: function(contextMenu, lineNumber) { contextMenu.appendApplicableItems(this._resource); diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js index ee5fc5033..7e928cf40 100644 --- a/Source/WebCore/inspector/front-end/ResourcesPanel.js +++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js @@ -641,16 +641,6 @@ WebInspector.ResourcesPanel.prototype = { var regex = WebInspector.SourceFrame.createSearchRegex(query); var totalMatchesCount = 0; - function searchInEditedResource(treeElement) - { - var resource = treeElement.representedObject; - if (resource.history.length == 0) - return; - var matchesCount = countRegexMatches(regex, resource.content) - treeElement.searchMatchesFound(matchesCount); - totalMatchesCount += matchesCount; - } - function callback(error, result) { if (!error) { @@ -667,8 +657,6 @@ WebInspector.ResourcesPanel.prototype = { if (!resource) continue; - if (resource.history.length > 0) - continue; // Skip edited resources. this._findTreeElementForResource(resource).searchMatchesFound(searchResult.matchesCount); totalMatchesCount += searchResult.matchesCount; } @@ -681,7 +669,6 @@ WebInspector.ResourcesPanel.prototype = { this.jumpToNextSearchResult(); } - this._forAllResourceTreeElements(searchInEditedResource.bind(this)); PageAgent.searchInResources(regex.source, !regex.ignoreCase, true, callback.bind(this)); }, diff --git a/Source/WebCore/inspector/front-end/RevisionHistoryView.js b/Source/WebCore/inspector/front-end/RevisionHistoryView.js index fad2cb143..5e8890374 100644 --- a/Source/WebCore/inspector/front-end/RevisionHistoryView.js +++ b/Source/WebCore/inspector/front-end/RevisionHistoryView.js @@ -39,19 +39,25 @@ WebInspector.RevisionHistoryView = function() this.element.addStyleClass("revision-history-drawer"); this.element.addStyleClass("fill"); this.element.addStyleClass("outline-disclosure"); - this._resourceItems = new Map(); + this._uiSourceCodeItems = new Map(); var olElement = this.element.createChild("ol"); this._treeOutline = new TreeOutline(olElement); - function populateRevisions(resource) + /** + * @param {WebInspector.UISourceCode} uiSourceCode + */ + function populateRevisions(uiSourceCode) { - if (resource.history.length) - this._createResourceItem(resource); + if (uiSourceCode.history.length) + this._createUISourceCodeItem(uiSourceCode); } - WebInspector.resourceTreeModel.forAllResources(populateRevisions.bind(this)); - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceContentCommitted, this._revisionAdded, this); + WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this)); + WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted, this._revisionAdded, this); + WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this); + WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this); + WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.WorkspaceReset, this._reset, this); this._statusElement = document.createElement("span"); this._statusElement.textContent = WebInspector.UIString("Local modifications"); @@ -67,105 +73,118 @@ WebInspector.RevisionHistoryView.showHistory = function(uiSourceCode) WebInspector.RevisionHistoryView._view = new WebInspector.RevisionHistoryView(); var view = WebInspector.RevisionHistoryView._view; WebInspector.showViewInDrawer(view._statusElement, view); - view._revealResource(uiSourceCode.resource()); -} - -WebInspector.RevisionHistoryView.reset = function() -{ - if (WebInspector.RevisionHistoryView._view) - WebInspector.RevisionHistoryView._view._reset(); + view._revealUISourceCode(uiSourceCode); } WebInspector.RevisionHistoryView.prototype = { /** - * @param {WebInspector.Resource} resource + * @param {WebInspector.UISourceCode} uiSourceCode */ - _createResourceItem: function(resource) + _createUISourceCodeItem: function(uiSourceCode) { - var resourceItem = new TreeElement(resource.displayName, null, true); - resourceItem.selectable = false; + var uiSourceCodeItem = new TreeElement(uiSourceCode.parsedURL.displayName, null, true); + uiSourceCodeItem.selectable = false; // Insert in sorted order for (var i = 0; i < this._treeOutline.children.length; ++i) { - if (this._treeOutline.children[i].title.localeCompare(resource.displayName) > 0) { - this._treeOutline.insertChild(resourceItem, i); + if (this._treeOutline.children[i].title.localeCompare(uiSourceCode.parsedURL.displayName) > 0) { + this._treeOutline.insertChild(uiSourceCodeItem, i); break; } } if (i === this._treeOutline.children.length) - this._treeOutline.appendChild(resourceItem); + this._treeOutline.appendChild(uiSourceCodeItem); - this._resourceItems.put(resource, resourceItem); + this._uiSourceCodeItems.put(uiSourceCode, uiSourceCodeItem); - var revisionCount = resource.history.length; + var revisionCount = uiSourceCode.history.length; for (var i = revisionCount - 1; i >= 0; --i) { - var revision = resource.history[i]; - var historyItem = new WebInspector.RevisionHistoryTreeElement(revision, resource.history[i - 1], i !== revisionCount - 1); - resourceItem.appendChild(historyItem); + var revision = uiSourceCode.history[i]; + var historyItem = new WebInspector.RevisionHistoryTreeElement(revision, uiSourceCode.history[i - 1], i !== revisionCount - 1); + uiSourceCodeItem.appendChild(historyItem); } var linkItem = new TreeElement("", null, false); linkItem.selectable = false; - resourceItem.appendChild(linkItem); + uiSourceCodeItem.appendChild(linkItem); var revertToOriginal = linkItem.listItemElement.createChild("span", "revision-history-link revision-history-link-row"); revertToOriginal.textContent = WebInspector.UIString("apply original content"); - revertToOriginal.addEventListener("click", resource.revertToOriginal.bind(resource)); + revertToOriginal.addEventListener("click", uiSourceCode.revertToOriginal.bind(uiSourceCode)); - var clearHistoryElement = resourceItem.listItemElement.createChild("span", "revision-history-link"); + var clearHistoryElement = uiSourceCodeItem.listItemElement.createChild("span", "revision-history-link"); clearHistoryElement.textContent = WebInspector.UIString("revert"); - clearHistoryElement.addEventListener("click", this._clearHistory.bind(this, resource)); - return resourceItem; + clearHistoryElement.addEventListener("click", this._clearHistory.bind(this, uiSourceCode)); + return uiSourceCodeItem; }, /** - * @param {WebInspector.Resource} resource + * @param {WebInspector.UISourceCode} uiSourceCode */ - _clearHistory: function(resource) + _clearHistory: function(uiSourceCode) { - resource.revertAndClearHistory(historyCleared.bind(this)); - - function historyCleared() - { - var resourceItem = this._resourceItems.get(resource); - this._treeOutline.removeChild(resourceItem); - this._resourceItems.remove(resource); - } - + uiSourceCode.revertAndClearHistory(this._removeUISourceCode.bind(this)); }, _revisionAdded: function(event) { - var resource = /** @type {WebInspector.Resource} */ event.data.resource; - var resourceItem = this._resourceItems.get(resource); - if (!resourceItem) { - resourceItem = this._createResourceItem(resource); + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode); + if (!uiSourceCodeItem) { + uiSourceCodeItem = this._createUISourceCodeItem(uiSourceCode); return; } - var historyLength = resource.history.length; - var historyItem = new WebInspector.RevisionHistoryTreeElement(resource.history[historyLength - 1], resource.history[historyLength - 2], false); - if (resourceItem.children.length) - resourceItem.children[0].allowRevert(); - resourceItem.insertChild(historyItem, 0); + var historyLength = uiSourceCode.history.length; + var historyItem = new WebInspector.RevisionHistoryTreeElement(uiSourceCode.history[historyLength - 1], uiSourceCode.history[historyLength - 2], false); + if (uiSourceCodeItem.children.length) + uiSourceCodeItem.children[0].allowRevert(); + uiSourceCodeItem.insertChild(historyItem, 0); }, /** - * @param {WebInspector.Resource} resource + * @param {WebInspector.UISourceCode} uiSourceCode */ - _revealResource: function(resource) + _revealUISourceCode: function(uiSourceCode) { - var resourceItem = this._resourceItems.get(resource); - if (resourceItem) { - resourceItem.reveal(); - resourceItem.expand(); + var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode); + if (uiSourceCodeItem) { + uiSourceCodeItem.reveal(); + uiSourceCodeItem.expand(); } }, + _uiSourceCodeRemoved: function(event) + { + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; + this._removeUISourceCode(uiSourceCode); + }, + + /** + * @param {WebInspector.Event} event + */ + _uiSourceCodeReplaced: function(event) + { + var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode; + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + this._removeUISourceCode(oldUISourceCode); + this._revealUISourceCode(uiSourceCode); + }, + + /** + * @param {WebInspector.UISourceCode} uiSourceCode + */ + _removeUISourceCode: function(uiSourceCode) + { + var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode); + this._treeOutline.removeChild(uiSourceCodeItem); + this._uiSourceCodeItems.remove(uiSourceCode); + }, + _reset: function() { this._treeOutline.removeChildren(); - this._resourceItems.clear(); + this._uiSourceCodeItems.clear(); } } @@ -212,7 +231,7 @@ WebInspector.RevisionHistoryTreeElement.prototype = { if (this._baseRevision) this._baseRevision.requestContent(step1.bind(this)); else - this._revision.resource.requestContent(step1.bind(this)); + this._revision.uiSourceCode.requestOriginalContent(step1.bind(this)); function step1(baseContent) { diff --git a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js index 9d712d0c7..eec340acd 100644 --- a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js +++ b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js @@ -41,8 +41,6 @@ WebInspector.ScriptSnippetModel = function() this._snippetStorage = new WebInspector.SnippetStorage("script", "Script snippet #"); this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSetting("lastSnippetEvaluationIndex", 0); this._snippetScriptMapping = new WebInspector.SnippetScriptMapping(this); - - this._loadSnippets(); } WebInspector.ScriptSnippetModel.snippetSourceURLPrefix = "snippets:///"; @@ -128,7 +126,6 @@ WebInspector.ScriptSnippetModel.prototype = { { var snippet = this._snippetStorage.snippetForId(snippetJavaScriptSource.snippetId); snippet.content = newContent; - snippetJavaScriptSource.contentChanged(newContent, "text/javascript"); }, /** diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index d31fa2dfe..a7519247f 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -366,7 +366,6 @@ WebInspector.ScriptsPanel.prototype = { this.sidebarPanes.watchExpressions.reset(); if (!preserveItems && this.sidebarPanes.workers) this.sidebarPanes.workers.reset(); - WebInspector.RevisionHistoryView.reset(); var uiSourceCodes = this._workspace.uiSourceCodes(); for (var i = 0; i < uiSourceCodes.length; ++i) diff --git a/Source/WebCore/inspector/front-end/SearchController.js b/Source/WebCore/inspector/front-end/SearchController.js index 1565f4d25..5bfad4cdf 100644 --- a/Source/WebCore/inspector/front-end/SearchController.js +++ b/Source/WebCore/inspector/front-end/SearchController.js @@ -35,27 +35,31 @@ WebInspector.SearchController = function() { this._element = document.createElement("div"); - this._element.textContent = "Search:"; + this._element.className = "toolbar-search"; - this._searchInputElement = this._element.createChild("input"); + var labelElement = this._element.createChild("span"); + labelElement.textContent = WebInspector.UIString("Find"); + + this._searchControlElement = this._element.createChild("div", "toolbar-search-control"); + + this._searchInputElement = this._searchControlElement.createChild("input"); this._searchInputElement.id = "search"; - this._searchInputElement.type = "search"; - this._searchInputElement.incremental = true; - this._searchInputElement.results = 0; - this._searchNavigationNextElement = this._element.createChild("div", "toolbar-search-navigation toolbar-search-navigation-next hidden"); - this._searchNavigationNextElement.addEventListener("mousedown", this._onNextButtonSearch.bind(this), false); - this._searchNavigationNextElement.title = WebInspector.UIString("Search Next"); + this._matchesElement = this._searchControlElement.createChild("label", "search-results-matches"); + this._matchesElement.setAttribute("for", "search"); - this._searchNavigationPrevElement = this._element.createChild("div", "toolbar-search-navigation toolbar-search-navigation-prev hidden"); - this._searchNavigationPrevElement.addEventListener("mousedown", this._onPrevButtonSearch.bind(this), false); + var searchNavigationElement = this._searchControlElement.createChild("div", "toolbar-search-navigation-controls"); + this._searchNavigationPrevElement = searchNavigationElement.createChild("div", "toolbar-search-navigation toolbar-search-navigation-prev"); + this._searchNavigationPrevElement.addEventListener("click", this._onPrevButtonSearch.bind(this), false); this._searchNavigationPrevElement.title = WebInspector.UIString("Search Previous"); - this._matchesElement = this._element.createChild("span", "search-results-matches"); + this._searchNavigationNextElement = searchNavigationElement.createChild("div", "toolbar-search-navigation toolbar-search-navigation-next"); + this._searchNavigationNextElement.addEventListener("click", this._onNextButtonSearch.bind(this), false); + this._searchNavigationNextElement.title = WebInspector.UIString("Search Next"); - this._searchInputElement.addEventListener("search", this._onSearch.bind(this), false); // when the search is emptied this._searchInputElement.addEventListener("mousedown", this._onSearchFieldManualFocus.bind(this), false); // when the search field is manually selected this._searchInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true); + this._searchInputElement.addEventListener("input", this._onInput.bind(this), false); var closeButtonElement = this._element.createChild("span", "drawer-header-close-button"); closeButtonElement.textContent = WebInspector.UIString("\u00D7"); @@ -71,7 +75,7 @@ WebInspector.SearchController.prototype = { panel.currentSearchMatches = matches; if (panel === WebInspector.inspectorView.currentPanel()) - this._updateSearchMatchesCountAndCurrentMatchIndex(WebInspector.inspectorView.currentPanel().currentQuery && matches); + this._updateSearchMatchesCountAndCurrentMatchIndex(WebInspector.inspectorView.currentPanel().currentQuery ? matches : 0, -1); }, updateCurrentMatchIndex: function(currentMatchIndex, panel) @@ -80,15 +84,6 @@ WebInspector.SearchController.prototype = { this._updateSearchMatchesCountAndCurrentMatchIndex(panel.currentSearchMatches, currentMatchIndex); }, - updateSearchLabel: function() - { - var panelName = WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView.currentPanel().toolbarItemLabel; - if (!panelName) - return; - var newLabel = WebInspector.UIString("Search %s", panelName); - this._searchInputElement.setAttribute("placeholder", newLabel); - }, - cancelSearch: function() { this._searchInputElement.value = ""; @@ -150,8 +145,6 @@ WebInspector.SearchController.prototype = { activePanelChanged: function() { - this.updateSearchLabel(); - if (!this._currentQuery) return; @@ -159,7 +152,7 @@ WebInspector.SearchController.prototype = { if (panel.performSearch) { function performPanelSearch() { - this._updateSearchMatchesCountAndCurrentMatchIndex(); + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); panel.currentQuery = this._currentQuery; panel.performSearch(this._currentQuery); @@ -169,57 +162,30 @@ WebInspector.SearchController.prototype = { setTimeout(performPanelSearch.bind(this), 0); } else { // Update to show Not found for panels that can't be searched. - this._updateSearchMatchesCountAndCurrentMatchIndex(); + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); } }, _updateSearchNavigationButtonState: function(enabled) { if (enabled) { - this._searchNavigationPrevElement.removeStyleClass("hidden"); - this._searchNavigationNextElement.removeStyleClass("hidden"); + this._searchNavigationPrevElement.addStyleClass("enabled"); + this._searchNavigationNextElement.addStyleClass("enabled"); } else { - this._searchNavigationPrevElement.addStyleClass("hidden"); - this._searchNavigationNextElement.addStyleClass("hidden"); + this._searchNavigationPrevElement.removeStyleClass("enabled"); + this._searchNavigationNextElement.removeStyleClass("enabled"); } }, /** - * @param {?number=} matches - * @param {number=} currentMatchIndex + * @param {number} matches + * @param {number} currentMatchIndex */ _updateSearchMatchesCountAndCurrentMatchIndex: function(matches, currentMatchIndex) { - if (matches == null) { - this._matchesElement.addStyleClass("hidden"); - // Make Search Nav key non-accessible when there is no active search. - this._updateSearchNavigationButtonState(false); - return; - } - - if (matches) { - if (matches === 1) { - if (currentMatchIndex === 0) - var matchesString = WebInspector.UIString("1 of 1 match"); - else - var matchesString = WebInspector.UIString("1 match"); - } else { - if (typeof currentMatchIndex === "number") - var matchesString = WebInspector.UIString("%d of %d matches", currentMatchIndex + 1, matches); - else - var matchesString = WebInspector.UIString("%d matches", matches); - // Make search nav key accessible when there are more than 1 search results found. - this._updateSearchNavigationButtonState(true); - } - } else { - var matchesString = WebInspector.UIString("Not Found"); - // Make search nav key non-accessible when there is no match found. - this._updateSearchNavigationButtonState(false); - } - - this._matchesElement.removeStyleClass("hidden"); - this._matchesElement.textContent = matchesString; - WebInspector.toolbar.resize(); + if (matches === 0 || currentMatchIndex >= 0) + this._matchesElement.textContent = WebInspector.UIString("%d of %d", currentMatchIndex + 1, matches); + this._updateSearchNavigationButtonState(matches > 0); }, focusSearchField: function() @@ -246,64 +212,36 @@ WebInspector.SearchController.prototype = { return false; } - if (!isEnterKey(event)) - return false; - - // Select all of the text so the user can easily type an entirely new query. - event.target.select(); - - // Only call performSearch if the Enter key was pressed. Otherwise the search - // performance is poor because of searching on every key. The search field has - // the incremental attribute set, so we still get incremental searches. - this._onSearch(event); - - // Call preventDefault since this was the Enter key. This prevents a "search" event - // from firing for key down. This stops performSearch from being called twice in a row. - event.preventDefault(); + if (isEnterKey(event)) + this._performSearch(event.target.value, true, event.shiftKey); }, - _onSearch: function(event) + _onInput: function(event) { - var forceSearch = event.keyIdentifier === "Enter"; - this._performSearch(event.target.value, forceSearch, event.shiftKey, false); + 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, false); + this._performSearch(this._searchInputElement.value, true, false); + this._searchInputElement.focus(); }, _onPrevButtonSearch: function(event) { // Simulate previous search on search-navigation-button click. - this._performSearch(this._searchInputElement.value, true, true, false); + this._performSearch(this._searchInputElement.value, true, true); + this._searchInputElement.focus(); }, /** * @param {boolean=} forceSearch * @param {boolean=} isBackwardSearch - * @param {boolean=} repeatSearch */ - _performSearch: function(query, forceSearch, isBackwardSearch, repeatSearch) + _performSearch: function(query, forceSearch, isBackwardSearch) { - var isShortSearch = (query.length < 3); - - // Clear a leftover short search flag due to a non-conflicting forced search. - if (isShortSearch && this._shortSearchWasForcedByKeyEvent && this._currentQuery !== query) - delete this._shortSearchWasForcedByKeyEvent; - - // Indicate this was a forced search on a short query. - if (isShortSearch && forceSearch) - this._shortSearchWasForcedByKeyEvent = true; - - if (!query || !query.length || (!forceSearch && isShortSearch)) { - // Prevent clobbering a short search forced by the user. - if (this._shortSearchWasForcedByKeyEvent) { - delete this._shortSearchWasForcedByKeyEvent; - return; - } - + if (!query || !query.length) { delete this._currentQuery; for (var panelName in WebInspector.panels) { @@ -313,14 +251,12 @@ WebInspector.SearchController.prototype = { if (hadCurrentQuery && panel.searchCanceled) panel.searchCanceled(); } - - this._updateSearchMatchesCountAndCurrentMatchIndex(); - + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); return; } var currentPanel = WebInspector.inspectorView.currentPanel(); - if (!repeatSearch && query === currentPanel.currentQuery && currentPanel.currentQuery === this._currentQuery) { + if (query === currentPanel.currentQuery && currentPanel.currentQuery === this._currentQuery) { // When this is the same query and a forced search, jump to the next // search result for a good user experience. if (forceSearch) { @@ -332,12 +268,15 @@ WebInspector.SearchController.prototype = { return; } - this._currentQuery = query; + if (!forceSearch && query.length < 3 && !this._currentQuery) + return; - this._updateSearchMatchesCountAndCurrentMatchIndex(); + this._currentQuery = query; - if (!currentPanel.performSearch) + if (!currentPanel.performSearch) { + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); return; + } currentPanel.currentQuery = query; currentPanel.performSearch(query); diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index 19c143a48..a37829daf 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -99,8 +99,6 @@ WebInspector.Settings = function() this.zoomLevel = this.createSetting("zoomLevel", 0); this.savedURLs = this.createSetting("savedURLs", {}); this.javaScriptDisabled = this.createSetting("javaScriptDisabled", false); - this.geolocationOverride = this.createSetting("geolocationOverride", ""); - this.geolocationError = this.createSetting("geolocationError", "None"); // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused // periodical breakpoints duplication leading to inspector slowness. diff --git a/Source/WebCore/inspector/front-end/SettingsScreen.js b/Source/WebCore/inspector/front-end/SettingsScreen.js index f63922705..6876e86cb 100644 --- a/Source/WebCore/inspector/front-end/SettingsScreen.js +++ b/Source/WebCore/inspector/front-end/SettingsScreen.js @@ -349,7 +349,6 @@ WebInspector.UserAgentSettingsTab = function() p.appendChild(this._createUserAgentControl()); if (Capabilities.canOverrideDeviceMetrics) p.appendChild(this._createDeviceMetricsControl()); - p.appendChild(this._createGeolocationOverrideControl()); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents)); } @@ -650,115 +649,6 @@ WebInspector.UserAgentSettingsTab.prototype = { cellElement.appendChild(this._createCheckboxSetting(WebInspector.UIString("Fit in window"), WebInspector.settings.deviceFitWindow, true, this._fitWindowCheckboxElement)); return fieldsetElement; - }, - - _createGeolocationOverrideControl: function() - { - const geolocationSetting = WebInspector.settings.geolocationOverride.get(); - var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseSetting(geolocationSetting); - - const p = document.createElement("p"); - const labelElement = p.createChild("label"); - const checkboxElement = labelElement.createChild("input"); - checkboxElement.id = "geolocation-override-checkbox"; - checkboxElement.type = "checkbox"; - checkboxElement.checked = !geolocation || (geolocation._latitude && geolocation._longitude); - checkboxElement.addEventListener("click", this._onGeolocationOverrideCheckboxClicked.bind(this), false); - this._geolocationOverrideCheckboxElement = checkboxElement; - labelElement.appendChild(document.createTextNode(WebInspector.UIString("Override Geolocation"))); - - const geolocationSectionElement = this._createGeolocationOverrideElement(geolocation); - p.appendChild(geolocationSectionElement); - - const geolocationErrorElement = this._createRadioSetting(WebInspector.UIString("Geolocation Error"), [ - [ "None", WebInspector.UIString("None") ], - [ "PermissionDenied", WebInspector.UIString("PermissionDenied") ], - [ "PositionUnavailable", WebInspector.UIString("PositionUnavailable") ] ], WebInspector.settings.geolocationError); - p.appendChild(geolocationErrorElement); - this._geolocationErrorElement = geolocationErrorElement; - this._geolocationSectionElement = geolocationSectionElement; - - this._setGeolocationPosition(geolocation, false, true); - - return p; - }, - - _onGeolocationOverrideCheckboxClicked: function() - { - if (this._geolocationOverrideCheckboxElement.checked) { - this._geolocationSectionElement.removeStyleClass("hidden"); - this._geolocationErrorElement.removeStyleClass("hidden"); - var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value, this._longitudeElement.value); - if (geolocation) - this._setGeolocationPosition(geolocation, false, false); - if (!this._latitudeElement.value) - this._latitudeElement.focus(); - } else { - this._geolocationSectionElement.addStyleClass("hidden"); - this._geolocationErrorElement.addStyleClass("hidden"); - PageAgent.clearGeolocationData(); - } - }, - - _applyGeolocationUserInput: function() - { - this._setGeolocationPosition(WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value.trim(), this._longitudeElement.value.trim()), true, false); - }, - - /** - * @param {?WebInspector.UserAgentSupport.GeolocationPosition} geolocation - * @param {boolean} userInputModified - * @param {boolean} updateCheckbox - */ - _setGeolocationPosition: function(geolocation, userInputModified, updateCheckbox) - { - if (!geolocation) - return; - - if (!userInputModified) { - this._latitudeElement.value = geolocation._latitude; - this._longitudeElement.value = geolocation._longitude; - } - - var value = geolocation.toSetting(); - WebInspector.settings.geolocationOverride.set(value); - - if (this._geolocationOverrideCheckboxElement && updateCheckbox) { - this._geolocationOverrideCheckboxElement.checked = !!geolocation.toSetting(); - this._onGeolocationOverrideCheckboxClicked(); - } - }, - - /** - * @param {WebInspector.UserAgentSupport.GeolocationPosition} geolocation - */ - _createGeolocationOverrideElement: function(geolocation) - { - var fieldsetElement = document.createElement("fieldset"); - fieldsetElement.id = "geolocation-override-section"; - - function createInput(parentElement, id, defaultText) - { - var element = parentElement.createChild("input"); - element.id = id; - element.maxLength = 12; - element.style.width = "80px"; - element.value = defaultText; - element.addEventListener("blur", this._applyGeolocationUserInput.bind(this), false); - return element; - } - - var tableElement = fieldsetElement.createChild("table"); - - var rowElement = tableElement.createChild("tr"); - var cellElement = rowElement.createChild("td"); - cellElement.appendChild(document.createTextNode(WebInspector.UIString("Geolocation Position:"))); - cellElement = rowElement.createChild("td"); - this._latitudeElement = createInput.call(this, cellElement, "geolocation-override-latitude", String(geolocation._latitude)); - cellElement.appendChild(document.createTextNode(" , ")); - this._longitudeElement = createInput.call(this, cellElement, "geolocation-override-longitude", String(geolocation._longitude)); - - return fieldsetElement; } } diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index ab2c85628..580012450 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -333,7 +333,7 @@ WebInspector.SourceFrame.prototype = { this._searchResults = this._collectRegexMatches(regex); var selection = this._textEditor.lastSelection(); for (var i = 0; selection && i < this._searchResults.length; ++i) { - if (this._searchResults[i].compareTo(selection) > 0) { + if (this._searchResults[i].compareTo(selection) >= 0) { this._currentSearchResultIndex = i - 1; break; } diff --git a/Source/WebCore/inspector/front-end/StatusBarButton.js b/Source/WebCore/inspector/front-end/StatusBarButton.js index 78f0405f4..f3554fad2 100644 --- a/Source/WebCore/inspector/front-end/StatusBarButton.js +++ b/Source/WebCore/inspector/front-end/StatusBarButton.js @@ -198,7 +198,7 @@ WebInspector.StatusBarButton.prototype = { var optionsBarElement = optionsGlassPane.element.createChild("div", "alternate-status-bar-buttons-bar"); const buttonHeight = 24; optionsBarElement.style.height = (buttonHeight * buttons.length) + "px"; - optionsBarElement.style.left = this.element.offsetLeft + "px"; + optionsBarElement.style.left = (this.element.offsetLeft + 1) + "px"; var boundMouseOver = mouseOver.bind(this); var boundMouseOut = mouseOut.bind(this); @@ -241,3 +241,53 @@ WebInspector.StatusBarButton.prototype = { } WebInspector.StatusBarButton.prototype.__proto__ = WebInspector.Object.prototype; + +/** + * @constructor + * @param {?function(Event)} changeHandler + * @param {string=} className + */ +WebInspector.StatusBarComboBox = function(changeHandler, className) +{ + this.element = document.createElement("span"); + this.element.className = "status-bar-select-container"; + + this._selectElement = this.element.createChild("select", "status-bar-item"); + if (changeHandler) + this._selectElement.addEventListener("change", changeHandler, false); + if (className) + this._selectElement.addStyleClass(className); +} + +WebInspector.StatusBarComboBox.prototype = { + /** + * @param {Element} option + */ + addOption: function(option) + { + this._selectElement.appendChild(option); + }, + + /** + * @param {Element} option + */ + removeOption: function(option) + { + this._selectElement.removeChild(option); + }, + + removeOptions: function() + { + this._selectElement.removeChildren(); + }, + + /** + * @return {?Element} + */ + selectedOption: function() + { + if (this._selectElement.selectedIndex >= 0) + return this._selectElement[this._selectElement.selectedIndex]; + return null; + } +} diff --git a/Source/WebCore/inspector/front-end/StylesPanel.js b/Source/WebCore/inspector/front-end/StylesPanel.js index 87b09b435..0c00b1534 100644 --- a/Source/WebCore/inspector/front-end/StylesPanel.js +++ b/Source/WebCore/inspector/front-end/StylesPanel.js @@ -33,10 +33,11 @@ */ WebInspector.StylesUISourceCodeProvider = function() { - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, this._initialize, this); - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources, this.reset, this); - + /** + * @type {Array.<WebInspector.UISourceCode>} + */ this._uiSourceCodes = []; + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); } WebInspector.StylesUISourceCodeProvider.prototype = { @@ -48,11 +49,8 @@ WebInspector.StylesUISourceCodeProvider.prototype = { return this._uiSourceCodes; }, - _initialize: function() + _populate: function() { - if (this._initialized) - return; - function populateFrame(frame) { for (var i = 0; i < frame.childFrames.length; ++i) @@ -62,10 +60,8 @@ WebInspector.StylesUISourceCodeProvider.prototype = { for (var i = 0; i < resources.length; ++i) this._resourceAdded({data:resources[i]}); } - populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame); - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); - this._initialized = true; + populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame); }, _resourceAdded: function(event) @@ -81,6 +77,7 @@ WebInspector.StylesUISourceCodeProvider.prototype = { reset: function() { this._uiSourceCodes = []; + this._populate(); } } diff --git a/Source/WebCore/inspector/front-end/UISourceCode.js b/Source/WebCore/inspector/front-end/UISourceCode.js index 49e5e310b..ce2411654 100644 --- a/Source/WebCore/inspector/front-end/UISourceCode.js +++ b/Source/WebCore/inspector/front-end/UISourceCode.js @@ -42,8 +42,6 @@ WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMappi { this._url = url; this._resource = resource; - if (resource) - resource.setUISourceCode(this); this._parsedURL = new WebInspector.ParsedURL(url); this._contentProvider = contentProvider; this._sourceMapping = sourceMapping; @@ -58,8 +56,11 @@ WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMappi */ this._consoleMessages = []; - if (this.resource()) - this.resource().addEventListener(WebInspector.Resource.Events.RevisionAdded, this._revisionAdded, this); + /** + * @type {Array.<WebInspector.Revision>} + */ + this.history = []; + this._restoreRevisionHistory(); } WebInspector.UISourceCode.Events = { @@ -136,21 +137,102 @@ WebInspector.UISourceCode.prototype = { this._contentProvider.requestContent(this.fireContentAvailable.bind(this)); }, - _revisionAdded: function(event) + /** + * @param {function(?string,boolean,string)} callback + */ + requestOriginalContent: function(callback) { - var revision = /** @type {WebInspector.Revision} */ event.data; - this.contentChanged(revision.content || "", this._resource.canonicalMimeType()); + this._contentProvider.requestContent(callback); }, /** * @param {string} newContent - * @param {string} mimeType */ - contentChanged: function(newContent, mimeType) + _setContent: function(newContent) + { + this.setWorkingCopy(newContent); + this.commitWorkingCopy(function() {}); + }, + + /** + * @param {string} content + * @param {Date=} timestamp + * @param {boolean=} restoringHistory + */ + addRevision: function(content, timestamp, restoringHistory) + { + if (this.history.length) { + var lastRevision = this.history[this.history.length - 1]; + if (lastRevision._content === content) + return; + } + var revision = new WebInspector.Revision(this, content, timestamp || new Date()); + this.history.push(revision); + + this.contentChanged(revision.content || "", this.canonicalMimeType()); + if (!restoringHistory) + revision._persist(); + WebInspector.workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: content }); + }, + + _restoreRevisionHistory: function() { - if (this._committingWorkingCopy) + if (!window.localStorage) return; + var registry = WebInspector.Revision._revisionHistoryRegistry(); + var historyItems = registry[this.url]; + for (var i = 0; historyItems && i < historyItems.length; ++i) + this.addRevision(window.localStorage[historyItems[i].key], new Date(historyItems[i].timestamp), true); + }, + + _clearRevisionHistory: function() + { + if (!window.localStorage) + return; + + var registry = WebInspector.Revision._revisionHistoryRegistry(); + var historyItems = registry[this.url]; + for (var i = 0; historyItems && i < historyItems.length; ++i) + delete window.localStorage[historyItems[i].key]; + delete registry[this.url]; + window.localStorage["revision-history"] = JSON.stringify(registry); + }, + + revertToOriginal: function() + { + /** + * @param {?string} content + * @param {boolean} contentEncoded + * @param {string} mimeType + */ + function callback(content, contentEncoded, mimeType) + { + this._setContent(); + } + + this.requestOriginalContent(callback.bind(this)); + }, + + revertAndClearHistory: function(callback) + { + function revert(content) + { + this._setContent(content); + this._clearRevisionHistory(); + this.history = []; + callback(); + } + + this.requestOriginalContent(revert.bind(this)); + }, + + /** + * @param {string} newContent + * @param {string} mimeType + */ + contentChanged: function(newContent, mimeType) + { this._content = newContent; this._mimeType = mimeType; this._contentLoaded = true; @@ -206,13 +288,8 @@ WebInspector.UISourceCode.prototype = { } var newContent = this._workingCopy; - this._committingWorkingCopy = true; this.workingCopyCommitted(callback); - if (this.resource()) - this.resource().addRevision(newContent); - delete this._committingWorkingCopy; - this.contentChanged(newContent, this._mimeType); - + this.addRevision(newContent); }, /** @@ -240,6 +317,14 @@ WebInspector.UISourceCode.prototype = { }, /** + * @return {string} + */ + canonicalMimeType: function() + { + return this.contentType().canonicalMimeType() || this._mimeType; + }, + + /** * @return {?string} */ content: function() @@ -433,3 +518,166 @@ WebInspector.UILocation.prototype = { WebInspector.RawLocation = function() { } + +/** + * @constructor + * @implements {WebInspector.ContentProvider} + * @param {WebInspector.UISourceCode} uiSourceCode + * @param {?string|undefined} content + * @param {Date} timestamp + */ +WebInspector.Revision = function(uiSourceCode, content, timestamp) +{ + this._uiSourceCode = uiSourceCode; + this._content = content; + this._timestamp = timestamp; +} + +WebInspector.Revision._revisionHistoryRegistry = function() +{ + if (!WebInspector.Revision._revisionHistoryRegistryObject) { + if (window.localStorage) { + var revisionHistory = window.localStorage["revision-history"]; + try { + WebInspector.Revision._revisionHistoryRegistryObject = revisionHistory ? JSON.parse(revisionHistory) : {}; + } catch (e) { + WebInspector.Revision._revisionHistoryRegistryObject = {}; + } + } else + WebInspector.Revision._revisionHistoryRegistryObject = {}; + } + return WebInspector.Revision._revisionHistoryRegistryObject; +} + +WebInspector.Revision.filterOutStaleRevisions = function() +{ + if (!window.localStorage) + return; + + var registry = WebInspector.Revision._revisionHistoryRegistry(); + var filteredRegistry = {}; + for (var url in registry) { + var historyItems = registry[url]; + var filteredHistoryItems = []; + for (var i = 0; historyItems && i < historyItems.length; ++i) { + var historyItem = historyItems[i]; + if (historyItem.loaderId === WebInspector.resourceTreeModel.mainFrame.loaderId) { + filteredHistoryItems.push(historyItem); + filteredRegistry[url] = filteredHistoryItems; + } else + delete window.localStorage[historyItem.key]; + } + } + WebInspector.Revision._revisionHistoryRegistryObject = filteredRegistry; + + function persist() + { + window.localStorage["revision-history"] = JSON.stringify(filteredRegistry); + } + + // Schedule async storage. + setTimeout(persist, 0); +} + +WebInspector.Revision.prototype = { + /** + * @return {WebInspector.UISourceCode} + */ + get uiSourceCode() + { + return this._uiSourceCode; + }, + + /** + * @return {Date} + */ + get timestamp() + { + return this._timestamp; + }, + + /** + * @return {?string} + */ + get content() + { + return this._content || null; + }, + + revertToThis: function() + { + function revert(content) + { + if (this._uiSourceCode._content !== content) + this._uiSourceCode._setContent(content); + } + this.requestContent(revert.bind(this)); + }, + + /** + * @return {?string} + */ + contentURL: function() + { + return this._uiSourceCode.url; + }, + + /** + * @return {WebInspector.ResourceType} + */ + contentType: function() + { + return this._uiSourceCode.contentType(); + }, + + /** + * @param {function(?string, boolean, string)} callback + */ + requestContent: function(callback) + { + callback(this._content || "", false, this.uiSourceCode.canonicalMimeType()); + }, + + /** + * @param {string} query + * @param {boolean} caseSensitive + * @param {boolean} isRegex + * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback + */ + searchInContent: function(query, caseSensitive, isRegex, callback) + { + callback([]); + }, + + _persist: function() + { + if (!window.localStorage) + return; + + var url = this.contentURL(); + if (url.startsWith("inspector://")) + return; + + var loaderId = WebInspector.resourceTreeModel.mainFrame.loaderId; + var timestamp = this.timestamp.getTime(); + var key = "revision-history|" + url + "|" + loaderId + "|" + timestamp; + + var registry = WebInspector.Revision._revisionHistoryRegistry(); + + var historyItems = registry[url]; + if (!historyItems) { + historyItems = []; + registry[url] = historyItems; + } + historyItems.push({url: url, loaderId: loaderId, timestamp: timestamp, key: key}); + + function persist() + { + window.localStorage[key] = this._content; + window.localStorage["revision-history"] = JSON.stringify(registry); + } + + // Schedule async storage. + setTimeout(persist.bind(this), 0); + } +} diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js index 5ebfc9e5e..c23ca652e 100644 --- a/Source/WebCore/inspector/front-end/UIUtils.js +++ b/Source/WebCore/inspector/front-end/UIUtils.js @@ -78,7 +78,7 @@ WebInspector.elementDragEnd = function(event) WebInspector.GlassPane = function() { this.element = document.createElement("div"); - this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1"; + this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1000;"; this.element.id = "glass-pane-for-drag"; document.body.appendChild(this.element); } diff --git a/Source/WebCore/inspector/front-end/UserAgentSupport.js b/Source/WebCore/inspector/front-end/UserAgentSupport.js index e6082ef51..976b507bd 100644 --- a/Source/WebCore/inspector/front-end/UserAgentSupport.js +++ b/Source/WebCore/inspector/front-end/UserAgentSupport.js @@ -37,8 +37,6 @@ WebInspector.UserAgentSupport = function() this._deviceMetricsChanged(); WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsChanged, this); WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChanged, this); - WebInspector.settings.geolocationOverride.addChangeListener(this._geolocationPositionChanged, this); - WebInspector.settings.geolocationError.addChangeListener(this._onGeolocationErrorChanged, this); } /** @@ -165,83 +163,11 @@ WebInspector.UserAgentSupport.DeviceMetrics.prototype = { } } -WebInspector.UserAgentSupport.GeolocationPosition = function (latitude, longitude) -{ - this._latitude = latitude; - this._longitude = longitude; -} - -WebInspector.UserAgentSupport.GeolocationPosition.prototype = { - /** - * @return {string} - */ - toSetting: function() - { - return (this._latitude || this._latitude == 0) && (this._longitude || this._longitude == 0) ? this._latitude + "@" + this._longitude : ""; - } -} - -/** - * @return {WebInspector.UserAgentSupport.GeolocationPosition} - */ -WebInspector.UserAgentSupport.GeolocationPosition.parseSetting = function(value) -{ - if (value) { - var splitPosition = value.split("@"); - if (splitPosition.length === 2) - return new WebInspector.UserAgentSupport.GeolocationPosition(parseFloat(splitPosition[0]), parseFloat(splitPosition[1])); - } - return new WebInspector.UserAgentSupport.GeolocationPosition(0, 0); -} - -/** - * @return {?WebInspector.UserAgentSupport.GeolocationPosition} - */ -WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput = function(latitudeString, longitudeString) -{ - function isUserInputValid(value) - { - if (!value) - return true; - return /^[-]?[0-9]*[.]?[0-9]*$/.test(value); - } - - if (!latitudeString ^ !latitudeString) - return null; - - var isLatitudeValid = isUserInputValid(latitudeString); - var isLongitudeValid = isUserInputValid(longitudeString); - - if (!isLatitudeValid && !isLongitudeValid) - return null; - - var latitude = isLatitudeValid ? parseFloat(latitudeString) : -1; - var longitude = isLongitudeValid ? parseFloat(longitudeString) : -1; - - return new WebInspector.UserAgentSupport.GeolocationPosition(latitude, longitude); -} - WebInspector.UserAgentSupport.prototype = { _deviceMetricsChanged: function() { var metrics = WebInspector.UserAgentSupport.DeviceMetrics.parseSetting(WebInspector.settings.deviceMetrics.get()); if (metrics.isValid()) PageAgent.setDeviceMetricsOverride(metrics.width, metrics.height, metrics.fontScaleFactor, WebInspector.settings.deviceFitWindow.get()); - }, - - _geolocationPositionChanged: function(errorType) - { - var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseSetting(WebInspector.settings.geolocationOverride.get()); - PageAgent.setGeolocationData(geolocation._latitude, geolocation._longitude, 150, typeof errorType === 'string'? errorType : WebInspector.settings.geolocationError.get()); - }, - - /** - * @param {WebInspector.Event} event - */ - _onGeolocationErrorChanged: function(event) - { - this._geolocationPositionChanged(event.data); - console.log(event); } } - diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index 6ec8fe6c9..b4fc85fd5 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -308,12 +308,7 @@ <file>Images/spinnerInactiveSelected.gif</file> <file>Images/splitviewDimple.png</file> <file>Images/splitviewDividerBackground.png</file> - <file>Images/statusbarBackground.png</file> - <file>Images/statusbarBottomBackground.png</file> - <file>Images/statusbarButtons.png</file> <file>Images/statusbarButtonGlyphs.png</file> - <file>Images/statusbarMenuButton.png</file> - <file>Images/statusbarMenuButtonSelected.png</file> <file>Images/statusbarResizerHorizontal.png</file> <file>Images/statusbarResizerVertical.png</file> <file>Images/successGreenDot.png</file> diff --git a/Source/WebCore/inspector/front-end/Workspace.js b/Source/WebCore/inspector/front-end/Workspace.js index 3dbded6c8..32182d595 100644 --- a/Source/WebCore/inspector/front-end/Workspace.js +++ b/Source/WebCore/inspector/front-end/Workspace.js @@ -130,9 +130,11 @@ WebInspector.Workspace = function() new WebInspector.PresentationConsoleMessageHelper(this); WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._reset, this); + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, this._reset, this); } WebInspector.Workspace.Events = { + UISourceCodeContentCommitted: "uiSourceCodeContentCommitted", WorkspaceReset: "WorkspaceReset" } @@ -151,6 +153,7 @@ WebInspector.Workspace.prototype = { for (var i = 0; i < uiSourceCodeProviders.length; ++i) { uiSourceCodeProviders[i].reset(); } + WebInspector.Revision.filterOutStaleRevisions(); this.dispatchEventToListeners(WebInspector.Workspace.Events.WorkspaceReset, null); } } diff --git a/Source/WebCore/inspector/front-end/elementsPanel.css b/Source/WebCore/inspector/front-end/elementsPanel.css index 8c9bc3c58..687a1b8b1 100644 --- a/Source/WebCore/inspector/front-end/elementsPanel.css +++ b/Source/WebCore/inspector/front-end/elementsPanel.css @@ -66,6 +66,7 @@ text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; color: rgb(20, 20, 20); margin-left: -1px; + margin-top: -1px; padding-right: 12px; } diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index d8341b7e1..8da534c08 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -264,26 +264,62 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { } #search { - width: 205px; - margin-left: 4px; - margin-right: 4px; - font-size: 11px; + -webkit-appearance: none; + border: 0; + padding: 0 2px; + margin: 0; + width: 165px; +} + +#search:focus { + outline: none; +} + +.toolbar-search-navigation-controls { + position: absolute; + top: 0; + right: 0; + height: 18px; + background-image: -webkit-linear-gradient(rgb(228, 228, 228), rgb(204, 204, 204) 75%, rgb(206, 206, 206)); } .toolbar-search-navigation { - width: 16px; - height: 16px; - position: relative; - top: 4px; - margin: 0px 1px; - background-repeat: no-repeat; display: inline-block; - background-position: 2px 5px; - border: 1px solid transparent; + width: 18px; + height: 18px; + background-repeat: no-repeat; + background-position: 4px 7px; + border-left: 1px solid rgb(170, 170, 170); + opacity: 0.3; +} + +.toolbar-search-navigation.enabled:hover { + border-left: 1px solid rgb(190, 190, 190); + opacity: 0.9; +} + +.toolbar-search-navigation.enabled, .toolbar-search-navigation.enabled:active { + border-left: 1px solid rgb(170, 170, 170); + opacity: 0.7; } -.toolbar-search-navigation:hover { - border: 1px solid rgba(120, 120, 120, 0.6); +#search:focus { + outline: none; +} + +.toolbar-search { + line-height: 19px; +} + +.toolbar-search-control { + display: inline-block; + position: relative; + background-color: white; + border: 1px solid rgb(202, 202, 202); + margin: 1px 2px; + height: 20px; + border-radius: 2px; + padding-right: 36px; } .toolbar-search-navigation.toolbar-search-navigation-prev { @@ -294,18 +330,18 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { background-image: url(Images/searchNext.png); } -.toolbar-search-navigation-hidden { - background: none; -} - body.compact #search { font-size: 11px; } .search-results-matches { + display: inline-block; + min-width: 70px; + min-height: 10px; + text-align: right; font-size: 11px; - text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0; - padding-left: 4px; + padding: 0 4px; + color: rgb(165, 165, 165); } .toolbar-item.elements .toolbar-icon { @@ -443,12 +479,17 @@ body.compact #main { body.drawer-visible #main-status-bar { height: 24px; - background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackground.png); - background-repeat: no-repeat, repeat-x; - background-position: right center, center; + border-bottom: 1px solid rgb(202, 202, 202); cursor: ns-resize; } +body.drawer-visible #main-status-bar::after { + position: absolute; + right: 0; + top: 5px; + content: url(Images/statusbarResizerVertical.png); +} + body.drawer-visible #main-status-bar * { cursor: default; } @@ -458,18 +499,18 @@ body.drawer-visible #main-panels { } .status-bar { - background-color: rgb(235, 235, 235); - background-image: url(Images/statusbarBackground.png); - background-repeat: repeat-x; white-space: nowrap; height: 23px; overflow: hidden; z-index: 12; + background-image: -webkit-linear-gradient(rgb(253,253,253), rgb(230,230,230) 75%, rgb(230,230,230)); + border-top: 1px solid rgb(202, 202, 202); } .status-bar > div { display: inline-block; vertical-align: top; + overflow: visible; } .status-bar-item { @@ -490,7 +531,7 @@ body.drawer-visible #main-panels { .glyph { position: absolute; - top: 0; + top: -1px; left: 0; right: 0; bottom: 0; @@ -520,12 +561,15 @@ body.drawer-visible #main-panels { button.status-bar-item { position: relative; width: 32px; - background-image: url(Images/statusbarButtons.png); - background-position: 0 0; + border-left: 1px solid rgb(202, 202, 202); + border-right: 1px solid rgb(202, 202, 202); } -button.status-bar-item:active, button.status-bar-item.emulate-active { - background-position: 32px 0 !important; +.status-bar select.status-bar-item:active, +.status-bar button.status-bar-item:active { + background-color: rgb(163,163,163); + border-left: 1px solid rgb(120, 120, 120); + border-right: 1px solid rgb(120, 120, 120); } button.status-bar-item .glyph.shadow { @@ -546,21 +590,33 @@ button.status-bar-item.extension { background-color: auto; } +.status-bar-select-container { + display: inline-block; + background-image: url(Images/disclosureTriangleSmallDown.png); + background-repeat: no-repeat; + background-position-x: right; + background-position-y: 6px; + padding-right: 10px; + border-right: 5px solid transparent; +} + select.status-bar-item { min-width: 48px; - border-width: 0 17px 0 2px; - padding: 0 2px 0 6px; font-weight: bold; color: rgb(48, 48, 48); text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; - -webkit-border-image: url(Images/statusbarMenuButton.png) 0 17 0 2; - -webkit-border-radius: 0; -webkit-appearance: none; + border: 0; + border-radius: 0; + padding: 0 15px 0 5px; + margin-right: -15px; + position: relative; + top: -1px; } -select.status-bar-item:active { - color: black; - -webkit-border-image: url(Images/statusbarMenuButtonSelected.png) 0 17 0 2; +select.status-bar-item, select.status-bar-item:hover { + border-left: 1px solid rgb(202, 202, 202); + border-right: 1px solid rgb(202, 202, 202); } .status-bar-item > .glyph { @@ -586,16 +642,28 @@ button.settings-status-bar-item { right: 0; } +body.detached .alternate-status-bar-buttons-bar { + margin-left: 1px; +} + .alternate-status-bar-buttons-bar { position: absolute; width: 31px; bottom: -3px; - margin-left: 1px; background: white; } .alternate-status-bar-buttons-bar .status-bar-item { + height: 24px; margin-top: -1px; + border: 1px solid rgb(202, 202, 202); + border-bottom: 1px solid transparent; +} + +.alternate-status-bar-buttons-bar .status-bar-item.emulate-active { + background-color: rgb(163,163,163); + border: 1px solid rgb(120, 120, 120); + border-bottom: 1px solid transparent; } .settings-status-bar-item .glyph { @@ -660,7 +728,6 @@ body.port-qt #dock-status-bar-item { right: 0; height: 200px; background-color: white; - background-image: url(Images/statusbarBottomBackground.png); background-repeat: repeat-x; background-position: bottom; } @@ -668,7 +735,7 @@ body.port-qt #dock-status-bar-item { body.drawer-visible #drawer-contents { position: absolute; top: 0; - bottom: 23px; + bottom: 24px; left: 0; right: 0; } @@ -682,7 +749,6 @@ body.drawer-visible #drawer { bottom: 0; left: 0; right: 0; - background: none; } body.platform-mac .monospace, body.platform-mac .source-code { @@ -1763,20 +1829,16 @@ button.edit-source-status-bar-item.toggled-on .glyph { margin-top: 23px; } -#console-filter { - margin-top: 1px; -} - .scope-bar { - height: 23px; - padding: 2px 10px 0; + line-height: 19px; + padding-right: 10px; overflow: hidden; } .scope-bar li { display: inline-block; - margin: 1px 2px 0 0; - padding: 1px 7px 3px; + margin: 0 2px; + padding: 2px 6px; font-size: 11px; line-height: 12px; font-weight: bold; @@ -1788,7 +1850,6 @@ button.edit-source-status-bar-item.toggled-on .glyph { } .scope-bar-divider { - margin: 1px 9px 0 8px; background-color: rgba(0, 0, 0, 0.4); height: 16px; width: 1px; @@ -1801,6 +1862,10 @@ button.edit-source-status-bar-item.toggled-on .glyph { text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; } +.scope-bar li.all { + margin: 0 8px; +} + .scope-bar li:hover { background: rgba(0, 0, 0, 0.2); } @@ -2761,7 +2826,7 @@ body.platform-mac #drawer-status-bar .search-status-bar-progress { border-width: 0 0 11px 0; } -#console-context { +.console-context { max-width: 200px; } @@ -2771,10 +2836,5 @@ body.platform-mac #drawer-status-bar .search-status-bar-progress { left: 0; right: 0; font-size: 11px; - padding-left: 7px; - padding-bottom: 7px; -} - -.inspector-footer > div { - vertical-align: middle; + padding-left: 5px; } diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 59be1f3dd..1e6a01294 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -452,7 +452,6 @@ WebInspector._doLoadedDoneWithCapabilities = function() this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._updateErrorAndWarningCounts, this); this.debuggerModel = new WebInspector.DebuggerModel(); - this.scriptSnippetModel = new WebInspector.ScriptSnippetModel(); this.breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this.debuggerModel); WebInspector.CSSCompletions.requestCSSNameCompletions(); @@ -466,6 +465,8 @@ WebInspector._doLoadedDoneWithCapabilities = function() this.domAgent = new WebInspector.DOMAgent(); this.javaScriptContextManager = new WebInspector.JavaScriptContextManager(this.resourceTreeModel, this.consoleView); + this.scriptSnippetModel = new WebInspector.ScriptSnippetModel(); + InspectorBackend.registerInspectorDispatcher(this); this.cssModel = new WebInspector.CSSStyleModel(); diff --git a/Source/WebCore/inspector/front-end/networkLogView.css b/Source/WebCore/inspector/front-end/networkLogView.css index 822ec2662..f454194e1 100644 --- a/Source/WebCore/inspector/front-end/networkLogView.css +++ b/Source/WebCore/inspector/front-end/networkLogView.css @@ -465,9 +465,6 @@ } /* Filters */ -#network-filter { - margin-top: 1px; -} .network-log-grid.data-grid table.data tr.revealed.network-item { display: none; diff --git a/Source/WebCore/inspector/front-end/scriptsPanel.css b/Source/WebCore/inspector/front-end/scriptsPanel.css index 3d7fb058a..12df13dd5 100644 --- a/Source/WebCore/inspector/front-end/scriptsPanel.css +++ b/Source/WebCore/inspector/front-end/scriptsPanel.css @@ -51,10 +51,7 @@ position: relative; margin-top: -1px; height: 24px; -} - -#scripts-debug-toolbar img { - padding-top: 2px; + border-bottom: 1px solid rgb(202, 202, 202); } #scripts-debug-sidebar-contents { @@ -171,7 +168,13 @@ button.status-bar-item.scripts-navigator-show-hide-button { background-image: none; height: 16px; width: 16px; - margin: 3px 2px 2px 2px; + margin: 4px 2px 2px 2px; + border: none; +} + +button.status-bar-item.scripts-navigator-show-hide-button:active { + top: 1px; + left: 1px; } button.status-bar-item.scripts-navigator-show-hide-button.toggled-overlay @@ -251,7 +254,13 @@ button.status-bar-item.scripts-debugger-show-hide-button { background-image: none; height: 16px; width: 16px; - margin: 3px 2px 2px 2px; + margin: 4px 2px 2px 2px; + border: none; +} + +button.status-bar-item.scripts-debugger-show-hide-button:active { + top: 1px; + right: 15px; } .status-bar-item.scripts-debugger-show-hide-button > .glyph { diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index 979a4acd8..a96f26e5f 100644 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -124,6 +124,8 @@ public: #if ENABLE(PAGE_POPUP) virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect&) OVERRIDE { return 0; } virtual void closePagePopup(PagePopup*) OVERRIDE { } + virtual void setPagePopupDriver(PagePopupDriver*) OVERRIDE { } + virtual void resetPagePopupDriver() OVERRIDE { } #endif #if ENABLE(REGISTER_PROTOCOL_HANDLER) diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 8b2204d24..6093652d0 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -57,7 +57,7 @@ #include "PluginDatabase.h" #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 #include "WebCoreSystemInterface.h" #endif @@ -76,7 +76,7 @@ MainResourceLoader::MainResourceLoader(Frame* frame) , m_loadingMultipartContent(false) , m_waitingForContentPolicy(false) , m_timeOfLastDataReceived(0.0) -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 , m_filter(0) #endif { @@ -84,7 +84,7 @@ MainResourceLoader::MainResourceLoader(Frame* frame) MainResourceLoader::~MainResourceLoader() { -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 ASSERT(!m_filter); #endif } @@ -134,7 +134,7 @@ void MainResourceLoader::didCancel(const ResourceError& error) // like calling DOMWindow::print(), during which a half-canceled load could try to finish. documentLoader()->mainReceivedError(error); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { wkFilterRelease(m_filter); m_filter = 0; @@ -413,7 +413,7 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r) } #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (r.url().protocolIs("https") && wkFilterIsManagedSession()) m_filter = wkFilterCreateInstance(r.nsURLResponse()); #endif @@ -443,7 +443,7 @@ void MainResourceLoader::didReceiveData(const char* data, int length, long long ASSERT(!defersLoading()); #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { ASSERT(!wkFilterWasBlocked(m_filter)); const char* blockedData = wkFilterAddData(m_filter, data, &length); @@ -469,7 +469,7 @@ void MainResourceLoader::didReceiveData(const char* data, int length, long long ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (WebFilterEvaluator *filter = m_filter) { // If we got here, it means we know if we were blocked or not. If we were blocked, we're // done loading the page altogether. Either way, we don't need the filter anymore. @@ -496,7 +496,7 @@ void MainResourceLoader::didFinishLoading(double finishTime) RefPtr<MainResourceLoader> protect(this); RefPtr<DocumentLoader> dl = documentLoader(); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { int length; const char* data = wkFilterDataComplete(m_filter, &length); @@ -521,7 +521,7 @@ void MainResourceLoader::didFinishLoading(double finishTime) void MainResourceLoader::didFail(const ResourceError& error) { -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { wkFilterRelease(m_filter); m_filter = 0; diff --git a/Source/WebCore/loader/MainResourceLoader.h b/Source/WebCore/loader/MainResourceLoader.h index f005ddc3a..c3b822249 100644 --- a/Source/WebCore/loader/MainResourceLoader.h +++ b/Source/WebCore/loader/MainResourceLoader.h @@ -34,7 +34,7 @@ #include "SubstituteData.h" #include <wtf/Forward.h> -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 OBJC_CLASS WebFilterEvaluator; #endif @@ -112,7 +112,7 @@ namespace WebCore { bool m_waitingForContentPolicy; double m_timeOfLastDataReceived; -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 WebFilterEvaluator *m_filter; #endif }; diff --git a/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp b/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp index cb9c7e570..cffbef9b3 100644 --- a/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp +++ b/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp @@ -33,7 +33,6 @@ #if ENABLE(MHTML) #include "MHTMLArchive.h" -#include "Base64.h" #include "Document.h" #include "Frame.h" #include "MHTMLParser.h" @@ -47,6 +46,7 @@ #include <wtf/CryptographicallyRandomNumber.h> #include <wtf/DateMath.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/Base64.h> #include <wtf/text/StringBuilder.h> #if HAVE(SYS_TIME_H) diff --git a/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp b/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp index dbb0c8335..fa1a2268d 100644 --- a/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp +++ b/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp @@ -33,13 +33,13 @@ #if ENABLE(MHTML) #include "MHTMLParser.h" -#include "Base64.h" #include "MHTMLArchive.h" #include "MIMEHeader.h" #include "MIMETypeRegistry.h" #include "QuotedPrintable.h" #include <wtf/HashMap.h> #include <wtf/NotFound.h> +#include <wtf/text/Base64.h> namespace WebCore { diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp index 90060476c..e1987c3fe 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp @@ -728,14 +728,20 @@ void CachedResourceLoader::preload(CachedResource::Type type, ResourceRequest& r // FIXME: Rip this out when we are sure it is no longer necessary (even for mobile). UNUSED_PARAM(referencedFromBody); - bool hasRendering = m_document->body() && m_document->body()->renderer(); - bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet; - if (!hasRendering && !canBlockParser) { - // Don't preload subresources that can't block the parser before we have something to draw. - // This helps prevent preloads from delaying first display when bandwidth is limited. - PendingPreload pendingPreload = { type, request, charset }; - m_pendingPreloads.append(pendingPreload); - return; + bool delaySubresourceLoad = true; +#if PLATFORM(IOS) + delaySubresourceLoad = false; +#endif + if (delaySubresourceLoad) { + bool hasRendering = m_document->body() && m_document->body()->renderer(); + bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet; + if (!hasRendering && !canBlockParser) { + // Don't preload subresources that can't block the parser before we have something to draw. + // This helps prevent preloads from delaying first display when bandwidth is limited. + PendingPreload pendingPreload = { type, request, charset }; + m_pendingPreloads.append(pendingPreload); + return; + } } requestPreload(type, request, charset); } diff --git a/Source/WebCore/page/AlternativeTextClient.h b/Source/WebCore/page/AlternativeTextClient.h index 67245e64d..a81358994 100644 --- a/Source/WebCore/page/AlternativeTextClient.h +++ b/Source/WebCore/page/AlternativeTextClient.h @@ -31,10 +31,10 @@ #include <wtf/Vector.h> #include <wtf/text/WTFString.h> -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) // Some platforms provide UI for suggesting alternative dictation text. #define WTF_USE_DICTATION_ALTERNATIVES 1 -#endif // PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#endif // PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) namespace WebCore { diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index 91c04bf9e..9e7b59696 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009 Apple, Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple, Inc. All rights reserved. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * Copyright (C) 2012 Samsung Electronics. All rights reserved. * @@ -63,6 +63,7 @@ namespace WebCore { class Page; class PagePopup; class PagePopupClient; + class PagePopupDriver; class PopupMenuClient; class SecurityOrigin; class GraphicsContext3D; @@ -81,6 +82,10 @@ namespace WebCore { class ColorChooserClient; #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + struct GraphicsDeviceAdapter; +#endif + class ChromeClient { public: virtual void chromeDestroyed() = 0; @@ -276,6 +281,10 @@ namespace WebCore { virtual CompositingTriggerFlags allowedCompositingTriggers() const { return static_cast<CompositingTriggerFlags>(AllTriggers); } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } +#endif + virtual bool supportsFullscreenForNode(const Node*) { return false; } virtual void enterFullscreenForNode(Node*) { } virtual void exitFullscreenForNode(Node*) { } @@ -320,6 +329,9 @@ namespace WebCore { // The return value can be 0. virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView) = 0; virtual void closePagePopup(PagePopup*) = 0; + // For testing. + virtual void setPagePopupDriver(PagePopupDriver*) = 0; + virtual void resetPagePopupDriver() = 0; #endif // This function is called whenever a text field <input> is // created. The implementation should return true if it wants diff --git a/Source/WebCore/page/ContextMenuController.cpp b/Source/WebCore/page/ContextMenuController.cpp index 6e188fdf1..3a8a8dd8a 100644 --- a/Source/WebCore/page/ContextMenuController.cpp +++ b/Source/WebCore/page/ContextMenuController.cpp @@ -703,7 +703,7 @@ static bool selectionContainsPossibleWord(Frame* frame) } #if PLATFORM(MAC) -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 1 #else #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 0 @@ -934,7 +934,7 @@ void ContextMenuController::populate() appendItem(IgnoreGrammarItem, m_contextMenu.get()); appendItem(*separatorItem(), m_contextMenu.get()); haveContextMenuItemsForMisspellingOrGrammer = true; -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 } else { // If the string was autocorrected, generate a contextual menu item allowing it to be changed back. String replacedString = m_hitTestResult.replacedString(); diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 895b96258..2e198373e 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -30,7 +30,6 @@ #include "AbstractDatabase.h" #include "BackForwardController.h" #include "BarInfo.h" -#include "Base64.h" #include "BeforeUnloadEvent.h" #include "CSSComputedStyleDeclaration.h" #include "CSSRuleList.h" @@ -99,6 +98,7 @@ #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> #include <wtf/MathExtras.h> +#include <wtf/text/Base64.h> #include <wtf/text/WTFString.h> #if ENABLE(REQUEST_ANIMATION_FRAME) @@ -1070,7 +1070,7 @@ String DOMWindow::atob(const String& encodedString, ExceptionCode& ec) } Vector<char> out; - if (!base64Decode(encodedString, out, FailOnInvalidCharacter)) { + if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter)) { ec = INVALID_CHARACTER_ERR; return String(); } diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index a0c9afc43..8eea3fa65 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -2290,7 +2290,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe } #if !PLATFORM(GTK) && !(PLATFORM(CHROMIUM) && (OS(UNIX) && !OS(DARWIN))) -bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const +bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const { return false; } @@ -2345,7 +2345,7 @@ bool EventHandler::handleWheelEvent(const PlatformWheelEvent& e) // Instead, the handlers should know convert vertical scrolls // appropriately. PlatformWheelEvent event = e; - if (m_baseEventType == PlatformEvent::NoType && shouldTurnVerticalTicksIntoHorizontal(result)) + if (m_baseEventType == PlatformEvent::NoType && shouldTurnVerticalTicksIntoHorizontal(result, e)) event = event.copyTurningVerticalTicksIntoHorizontalTicks(); if (node) { diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index c72dc0943..32c95b456 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -266,7 +266,7 @@ private: void autoscrollTimerFired(Timer<EventHandler>*); bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0); - bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const; + bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const; bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; } static bool isKeyboardOptionTab(KeyboardEvent*); diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index d30900f60..c45e532f1 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -23,7 +23,6 @@ #include "AlternativeTextClient.h" #include "BackForwardController.h" #include "BackForwardList.h" -#include "Base64.h" #include "Chrome.h" #include "ChromeClient.h" #include "ContextMenuClient.h" @@ -77,6 +76,7 @@ #include <wtf/HashMap.h> #include <wtf/RefCountedLeakCounter.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/Base64.h> #include <wtf/text/StringHash.h> namespace WebCore { @@ -790,7 +790,7 @@ void Page::userStyleSheetLocationChanged() m_didLoadUserStyleSheet = true; Vector<char> styleSheetAsUTF8; - if (base64Decode(decodeURLEscapeSequences(url.string().substring(35)), styleSheetAsUTF8, IgnoreWhitespace)) + if (base64Decode(decodeURLEscapeSequences(url.string().substring(35)), styleSheetAsUTF8, Base64IgnoreWhitespace)) m_userStyleSheet = String::fromUTF8(styleSheetAsUTF8.data(), styleSheetAsUTF8.size()); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp b/Source/WebCore/page/PagePopupDriver.h index aae033514..695d622c8 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp +++ b/Source/WebCore/page/PagePopupDriver.h @@ -23,20 +23,21 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" - -#include "cc/CCCheckerboardDrawQuad.h" +#ifndef PagePopupDriver_h +#define PagePopupDriver_h namespace WebCore { -PassOwnPtr<CCCheckerboardDrawQuad> CCCheckerboardDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect) -{ - return adoptPtr(new CCCheckerboardDrawQuad(sharedQuadState, quadRect)); -} +class IntRect; +class PagePopup; +class PagePopupClient; -CCCheckerboardDrawQuad::CCCheckerboardDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect) - : CCDrawQuad(sharedQuadState, CCDrawQuad::Checkerboard, quadRect) -{ -} +class PagePopupDriver { +public: + virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView) = 0; + virtual void closePagePopup(PagePopup*) = 0; + virtual ~PagePopupDriver() { } +}; } +#endif diff --git a/Source/WebCore/page/PointerLockController.cpp b/Source/WebCore/page/PointerLockController.cpp index c250cb7be..abbfc80f4 100644 --- a/Source/WebCore/page/PointerLockController.cpp +++ b/Source/WebCore/page/PointerLockController.cpp @@ -48,15 +48,12 @@ PassOwnPtr<PointerLockController> PointerLockController::create(Page* page) void PointerLockController::requestPointerLock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback) { - if (!target) - return; - - if (!target->inDocument()) { + if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) { enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); return; } - if (isLocked()) { + if (m_element) { // FIXME: Keep enqueueEvent usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) enqueueEvent(eventNames().webkitpointerlockchangeEvent, target); if (m_element->document() != target->document()) @@ -91,6 +88,25 @@ void PointerLockController::requestPointerUnlock() return m_page->chrome()->client()->requestPointerUnlock(); } +void PointerLockController::elementRemoved(Element* element) +{ + if (m_element == element) { + m_documentOfRemovedElementWhileWaitingForUnlock = m_element->document(); + // Set element null immediately to block any future interaction with it + // including mouse events received before the unlock completes. + m_element = 0; + requestPointerUnlock(); + } +} + +void PointerLockController::documentDetached(Document* document) +{ + if (m_element && m_element->document() == document) { + m_element = 0; + requestPointerUnlock(); + } +} + bool PointerLockController::isLocked() { return m_page->chrome()->client()->isPointerLocked(); @@ -136,11 +152,12 @@ void PointerLockController::didLosePointerLock(bool sendChangeEvent) { // FIXME: Keep enqueueEvent usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) if (sendChangeEvent) - enqueueEvent(eventNames().webkitpointerlockchangeEvent, m_element.get()); + enqueueEvent(eventNames().webkitpointerlockchangeEvent, m_element ? m_element->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get()); // FIXME: Remove callback usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) RefPtr<Element> elementToNotify(m_element); m_element = 0; + m_documentOfRemovedElementWhileWaitingForUnlock = 0; m_successCallback = 0; m_failureCallback = 0; if (elementToNotify && elementToNotify->document()->frame()) @@ -161,9 +178,14 @@ void PointerLockController::dispatchLockedMouseEvent(const PlatformMouseEvent& e void PointerLockController::enqueueEvent(const AtomicString& type, Element* element) { - if (!element) - return; - element->document()->enqueueDocumentEvent(Event::create(type, true, false)); + if (element) + enqueueEvent(type, element->document()); +} + +void PointerLockController::enqueueEvent(const AtomicString& type, Document* document) +{ + if (document) + document->enqueueDocumentEvent(Event::create(type, true, false)); } } // namespace WebCore diff --git a/Source/WebCore/page/PointerLockController.h b/Source/WebCore/page/PointerLockController.h index 55cf6eea1..991754e45 100644 --- a/Source/WebCore/page/PointerLockController.h +++ b/Source/WebCore/page/PointerLockController.h @@ -33,6 +33,7 @@ namespace WebCore { class Element; +class Document; class Page; class PlatformMouseEvent; class VoidCallback; @@ -45,7 +46,9 @@ public: void requestPointerLock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback); void requestPointerUnlock(); - bool isLocked(); + void elementRemoved(Element*); + void documentDetached(Document*); + bool isLocked(); // FIXME: Rename to isClientLocked and move to private when removing old API. (https://bugs.webkit.org/show_bug.cgi?id=84402) Element* element() const; void didAcquirePointerLock(); @@ -56,8 +59,10 @@ public: private: explicit PointerLockController(Page*); void enqueueEvent(const AtomicString& type, Element*); + void enqueueEvent(const AtomicString& type, Document*); Page* m_page; RefPtr<Element> m_element; + RefPtr<Document> m_documentOfRemovedElementWhileWaitingForUnlock; // FIXME: Remove callback usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) RefPtr<VoidCallback> m_successCallback; diff --git a/Source/WebCore/page/chromium/EventHandlerChromium.cpp b/Source/WebCore/page/chromium/EventHandlerChromium.cpp index 97c1cbe73..05080f629 100644 --- a/Source/WebCore/page/chromium/EventHandlerChromium.cpp +++ b/Source/WebCore/page/chromium/EventHandlerChromium.cpp @@ -158,9 +158,9 @@ unsigned EventHandler::accessKeyModifiers() // GTK+ must scroll horizontally if the mouse pointer is on top of the // horizontal scrollbar while scrolling with the wheel. // This code comes from gtk/EventHandlerGtk.cpp. -bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const +bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent& event) const { - return result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar; + return !event.hasPreciseScrollingDeltas() && result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar; } #endif diff --git a/Source/WebCore/page/gtk/EventHandlerGtk.cpp b/Source/WebCore/page/gtk/EventHandlerGtk.cpp index 4386a4de3..7e83eb610 100644 --- a/Source/WebCore/page/gtk/EventHandlerGtk.cpp +++ b/Source/WebCore/page/gtk/EventHandlerGtk.cpp @@ -126,7 +126,7 @@ unsigned EventHandler::accessKeyModifiers() // horizontal scrollbar while scrolling with the wheel; we need to // add the deltas and ticks here so that this behavior is consistent // for styled scrollbars. -bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const +bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent&) const { return result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar; } diff --git a/Source/WebCore/page/mac/SettingsMac.mm b/Source/WebCore/page/mac/SettingsMac.mm index 23b792583..04bf49984 100644 --- a/Source/WebCore/page/mac/SettingsMac.mm +++ b/Source/WebCore/page/mac/SettingsMac.mm @@ -69,7 +69,7 @@ void Settings::initializeDefaultFontFamilies() setStandardFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); setSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); #else diff --git a/Source/WebCore/platform/Decimal.cpp b/Source/WebCore/platform/Decimal.cpp index 263cbeebf..3bb6570b5 100644 --- a/Source/WebCore/platform/Decimal.cpp +++ b/Source/WebCore/platform/Decimal.cpp @@ -628,7 +628,7 @@ Decimal Decimal::ceiling() const const int numberOfDigits = countDigits(result); const int numberOfDropDigits = -exponent(); if (numberOfDigits < numberOfDropDigits) - return zero(Positive); + return isPositive() ? Decimal(1) : zero(Positive); result = scaleDown(result, numberOfDropDigits - 1); if (sign() == Positive && result % 10 > 0) @@ -670,7 +670,7 @@ Decimal Decimal::floor() const const int numberOfDigits = countDigits(result); const int numberOfDropDigits = -exponent(); if (numberOfDigits < numberOfDropDigits) - return zero(Positive); + return isPositive() ? zero(Positive) : Decimal(-1); result = scaleDown(result, numberOfDropDigits - 1); if (isNegative() && result % 10 > 0) diff --git a/Source/WebCore/platform/LocalizedStrings.cpp b/Source/WebCore/platform/LocalizedStrings.cpp index 9c4bdf3f9..e79b518e9 100644 --- a/Source/WebCore/platform/LocalizedStrings.cpp +++ b/Source/WebCore/platform/LocalizedStrings.cpp @@ -72,7 +72,7 @@ static String formatLocalizedString(String format, ...) #endif } -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static String truncatedStringForLookupMenuItem(const String& original) { if (original.isEmpty()) @@ -244,7 +244,7 @@ String contextMenuItemTagSearchInSpotlight() String contextMenuItemTagSearchWeb() { -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) RetainPtr<CFStringRef> searchProviderName(AdoptCF, wkCopyDefaultSearchProviderDisplayName()); return formatLocalizedString(WEB_UI_STRING("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get()); #else @@ -254,7 +254,7 @@ String contextMenuItemTagSearchWeb() String contextMenuItemTagLookUpInDictionary(const String& selectedString) { -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 UNUSED_PARAM(selectedString); return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item"); #else @@ -755,7 +755,7 @@ String htmlSelectMultipleItems(size_t count) String imageTitle(const String& filename, const IntSize& size) { #if USE(CF) -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFStringRef> filenameCFString(AdoptCF, filename.createCFString()); RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCopyCurrent()); RetainPtr<CFNumberFormatterRef> formatter(AdoptCF, CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle)); diff --git a/Source/WebCore/platform/MemoryPressureHandler.cpp b/Source/WebCore/platform/MemoryPressureHandler.cpp index 15e680862..614ec36d6 100644 --- a/Source/WebCore/platform/MemoryPressureHandler.cpp +++ b/Source/WebCore/platform/MemoryPressureHandler.cpp @@ -42,7 +42,7 @@ MemoryPressureHandler::MemoryPressureHandler() { } -#if !PLATFORM(MAC) || defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 void MemoryPressureHandler::install() { } void MemoryPressureHandler::uninstall() { } diff --git a/Source/WebCore/platform/PlatformScreen.h b/Source/WebCore/platform/PlatformScreen.h index df989a10b..1111f9d6a 100644 --- a/Source/WebCore/platform/PlatformScreen.h +++ b/Source/WebCore/platform/PlatformScreen.h @@ -52,8 +52,7 @@ namespace WebCore { FloatRect screenRect(Widget*); FloatRect screenAvailableRect(Widget*); - // type can be "monitor" or the name of a profile such as "sRGB" or "Adobe RGB". - void screenColorProfile(Widget*, ColorProfile&); + void screenColorProfile(ColorProfile&); #if PLATFORM(MAC) NSScreen *screenForWindow(NSWindow *); diff --git a/Source/WebCore/platform/ScrollAnimator.cpp b/Source/WebCore/platform/ScrollAnimator.cpp index 15c46a116..74fd3616e 100644 --- a/Source/WebCore/platform/ScrollAnimator.cpp +++ b/Source/WebCore/platform/ScrollAnimator.cpp @@ -91,7 +91,7 @@ bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e) bool handled = false; -#if PLATFORM(CHROMIUM) +#if PLATFORM(CHROMIUM) && !OS(DARWIN) ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrecisePixel : ScrollByPixel; #else ScrollGranularity granularity = ScrollByPixel; diff --git a/Source/WebCore/platform/audio/mac/AudioBusMac.mm b/Source/WebCore/platform/audio/mac/AudioBusMac.mm index b47f953e2..45fb41755 100644 --- a/Source/WebCore/platform/audio/mac/AudioBusMac.mm +++ b/Source/WebCore/platform/audio/mac/AudioBusMac.mm @@ -49,7 +49,7 @@ PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float samp NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]]; NSURL *audioFileURL = [bundle URLForResource:[NSString stringWithUTF8String:name] withExtension:@"wav" subdirectory:@"audio"]; -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 NSDataReadingOptions options = NSDataReadingMapped; #else NSDataReadingOptions options = NSDataReadingMappedIfSafe; diff --git a/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp b/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp index a76c04184..770843585 100644 --- a/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp +++ b/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp @@ -218,6 +218,8 @@ void CookieDatabaseBackingStore::invokeOpen(const String& cookieJar) // This table schema is compliant with Mozilla's. createTableQuery += " (" + databaseFields + ", " + primaryKeyFields+");"; + m_db.setBusyTimeout(1000); + if (!m_db.executeCommand(createTableQuery)) { LOG_ERROR("Could not create the table to store the cookies into. No cookie will be stored!"); LOG_ERROR("SQLite Error Message: %s", m_db.lastErrorMsg()); @@ -346,7 +348,8 @@ void CookieDatabaseBackingStore::getCookiesFromDatabase(Vector<ParsedCookie*>& s TypedReplyBuffer< Vector<ParsedCookie*>* > replyBuffer(0); dispatchMessage(createMethodCallMessageWithReturn(&CookieDatabaseBackingStore::invokeGetCookiesWithLimit, &replyBuffer, this, limit)); Vector<ParsedCookie*>* cookies = replyBuffer.pointer(); - stackOfCookies.swap(*cookies); + if (cookies) + stackOfCookies.swap(*cookies); delete cookies; } diff --git a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h index 8a1f8870f..752bdb693 100644 --- a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h +++ b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h @@ -72,6 +72,7 @@ public: virtual bool isVisible() const = 0; virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool) = 0; + virtual void syncProxyCredential(const WebCore::Credential&) = 0; }; #endif // PageClientBlackBerry_h diff --git a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp index 592539cd4..1d8703156 100644 --- a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp @@ -64,7 +64,7 @@ FloatRect screenRect(Widget* widget) return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::primaryScreen()->size()))); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp index 46f33dafd..54d58da13 100644 --- a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp +++ b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp @@ -73,9 +73,8 @@ FloatRect screenAvailableRect(Widget* widget) return PlatformSupport::screenAvailableRect(widget); } -void screenColorProfile(Widget*, ColorProfile& toProfile) +void screenColorProfile(ColorProfile& toProfile) { - // FIXME: Add support for multiple monitors. WebKit::WebVector<char> profile; WebKit::Platform::current()->screenColorProfile(&profile); toProfile.append(profile.data(), profile.size()); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorCheckerboardQuad.cpp index bdbca95fb..970db2b84 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorCheckerboardQuad.cpp @@ -25,27 +25,27 @@ #include "config.h" -#include "cc/CCTextureDrawQuad.h" +#include <public/WebCompositorCheckerboardQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCTextureDrawQuad> CCTextureDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +namespace WebKit { + +PassOwnPtr<WebCompositorCheckerboardQuad> WebCompositorCheckerboardQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect) { - return adoptPtr(new CCTextureDrawQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped)); + return adoptPtr(new WebCompositorCheckerboardQuad(sharedQuadState, quadRect)); } -CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) - : CCDrawQuad(sharedQuadState, CCDrawQuad::TextureContent, quadRect) - , m_textureId(textureId) - , m_premultipliedAlpha(premultipliedAlpha) - , m_uvRect(uvRect) - , m_flipped(flipped) +WebCompositorCheckerboardQuad::WebCompositorCheckerboardQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::Checkerboard, quadRect) { } -void CCTextureDrawQuad::setNeedsBlending() +const WebCompositorCheckerboardQuad* WebCompositorCheckerboardQuad::materialCast(const WebCompositorQuad* quad) { - m_needsBlending = true; + ASSERT(quad->material() == WebCompositorQuad::Checkerboard); + return static_cast<const WebCompositorCheckerboardQuad*>(quad); } + } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorDebugBorderQuad.cpp index 1527c47c5..179f6c14f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorDebugBorderQuad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,19 @@ #include "config.h" -#include "cc/CCDebugBorderDrawQuad.h" +#include <public/WebCompositorDebugBorderQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCDebugBorderDrawQuad> CCDebugBorderDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) +namespace WebKit { + +PassOwnPtr<WebCompositorDebugBorderQuad> WebCompositorDebugBorderQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) { - return adoptPtr(new CCDebugBorderDrawQuad(sharedQuadState, quadRect, color, width)); + return adoptPtr(new WebCompositorDebugBorderQuad(sharedQuadState, quadRect, color, width)); } -CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) - : CCDrawQuad(sharedQuadState, CCDrawQuad::DebugBorder, quadRect) +WebCompositorDebugBorderQuad::WebCompositorDebugBorderQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::DebugBorder, quadRect) , m_color(color) , m_width(width) { @@ -44,4 +46,10 @@ CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuad m_needsBlending = true; } +const WebCompositorDebugBorderQuad* WebCompositorDebugBorderQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::DebugBorder); + return static_cast<const WebCompositorDebugBorderQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp new file mode 100644 index 000000000..63a29314d --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp @@ -0,0 +1,52 @@ +/* + * 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" + +#include <public/WebCompositorIOSurfaceQuad.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<WebCompositorIOSurfaceQuad> WebCompositorIOSurfaceQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) +{ + return adoptPtr(new WebCompositorIOSurfaceQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId)); +} + +WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::IOSurfaceContent, quadRect) + , m_ioSurfaceSize(ioSurfaceSize) + , m_ioSurfaceTextureId(ioSurfaceTextureId) +{ +} + +const WebCompositorIOSurfaceQuad* WebCompositorIOSurfaceQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::IOSurfaceContent); + return static_cast<const WebCompositorIOSurfaceQuad*>(quad); +} + +} diff --git a/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp new file mode 100644 index 000000000..7a02ca0ea --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp @@ -0,0 +1,97 @@ +/* + * 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" +#include <public/WebCompositorQuad.h> + +#include "IntRect.h" +#include <public/WebCompositorCheckerboardQuad.h> +#include <public/WebCompositorDebugBorderQuad.h> +#include <public/WebCompositorIOSurfaceQuad.h> +#include <public/WebCompositorSolidColorQuad.h> +#include <public/WebCompositorStreamVideoQuad.h> +#include <public/WebCompositorTextureQuad.h> +#include <public/WebCompositorTileQuad.h> + +using namespace WebCore; + +namespace WebKit { + +WebCompositorQuad::WebCompositorQuad(const WebCompositorSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) + : m_sharedQuadState(sharedQuadState) + , m_material(material) + , m_quadRect(quadRect) + , m_quadVisibleRect(quadRect) + , m_quadOpaque(true) + , m_needsBlending(false) +{ + ASSERT(m_sharedQuadState); + ASSERT(m_material != Invalid); +} + +IntRect WebCompositorQuad::opaqueRect() const +{ + if (opacity() != 1) + return IntRect(); + if (m_sharedQuadState->opaque && m_quadOpaque) + return m_quadRect; + return m_opaqueRect; +} + +void WebCompositorQuad::setQuadVisibleRect(const IntRect& quadVisibleRect) +{ + IntRect intersection = quadVisibleRect; + intersection.intersect(m_quadRect); + m_quadVisibleRect = intersection; +} + +unsigned WebCompositorQuad::size() const +{ + switch (material()) { + case Checkerboard: + return sizeof(WebCompositorCheckerboardQuad); + case DebugBorder: + return sizeof(WebCompositorDebugBorderQuad); + case IOSurfaceContent: + return sizeof(WebCompositorIOSurfaceQuad); + case TextureContent: + return sizeof(WebCompositorTextureQuad); + case SolidColor: + return sizeof(WebCompositorSolidColorQuad); + case TiledContent: + return sizeof(WebCompositorTileQuad); + case StreamVideoContent: + return sizeof(WebCompositorStreamVideoQuad); + case Invalid: + case RenderPass: + case YUVVideoContent: + break; + } + + CRASH(); + return sizeof(WebCompositorQuad); +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp index 5e0681ff5..313564c00 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,35 +25,42 @@ #include "config.h" -#include "cc/CCSharedQuadState.h" +#include <public/WebCompositorSharedQuadState.h> +#include "FloatQuad.h" #include "cc/CCMathUtil.h" -using WebKit::WebTransformationMatrix; +using WebCore::FloatQuad; +using WebCore::IntRect; -namespace WebCore { +namespace WebKit { -PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque) +WebCompositorSharedQuadState::WebCompositorSharedQuadState() + : opacity(0) + , opaque(false) { - return adoptPtr(new CCSharedQuadState(quadTransform, layerTransform, layerRect, scissorRect, opacity, opaque)); } -CCSharedQuadState::CCSharedQuadState(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque) - : m_quadTransform(quadTransform) - , m_layerTransform(layerTransform) - , m_layerRect(layerRect) - , m_scissorRect(scissorRect) - , m_opacity(opacity) - , m_opaque(opaque) +PassOwnPtr<WebCompositorSharedQuadState> WebCompositorSharedQuadState::create(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) { + return adoptPtr(new WebCompositorSharedQuadState(quadTransform, visibleContentRect, scissorRect, opacity, opaque)); } -bool CCSharedQuadState::isLayerAxisAlignedIntRect() const +WebCompositorSharedQuadState::WebCompositorSharedQuadState(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) + : quadTransform(quadTransform) + , visibleContentRect(visibleContentRect) + , scissorRect(scissorRect) + , opacity(opacity) + , opaque(opaque) +{ +} + +bool WebCompositorSharedQuadState::isLayerAxisAlignedIntRect() const { // Note: this doesn't consider window or projection matrices. // Assume that they're orthonormal and have integer scales and translations. bool clipped = false; - FloatQuad quad = CCMathUtil::mapQuad(quadTransform(), FloatQuad(layerRect()), clipped); + FloatQuad quad = WebCore::CCMathUtil::mapQuad(quadTransform, FloatQuad(IntRect(visibleContentRect)), clipped); return !clipped && quad.isRectilinear() && quad.boundingBox().isExpressibleAsIntRect(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSolidColorQuad.cpp index 8668369b6..782458c72 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorSolidColorQuad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,19 @@ #include "config.h" -#include "cc/CCSolidColorDrawQuad.h" +#include <public/WebCompositorSolidColorQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) +namespace WebKit { + +PassOwnPtr<WebCompositorSolidColorQuad> WebCompositorSolidColorQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) { - return adoptPtr(new CCSolidColorDrawQuad(sharedQuadState, quadRect, color)); + return adoptPtr(new WebCompositorSolidColorQuad(sharedQuadState, quadRect, color)); } -CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) - : CCDrawQuad(sharedQuadState, CCDrawQuad::SolidColor, quadRect) +WebCompositorSolidColorQuad::WebCompositorSolidColorQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::SolidColor, quadRect) , m_color(color) { if (SkColorGetA(m_color) < 255) @@ -44,4 +46,10 @@ CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadSt m_opaqueRect = quadRect; } +const WebCompositorSolidColorQuad* WebCompositorSolidColorQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::SolidColor); + return static_cast<const WebCompositorSolidColorQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp new file mode 100644 index 000000000..ae257aaf7 --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp @@ -0,0 +1,52 @@ +/* + * 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" + +#include <public/WebCompositorStreamVideoQuad.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<WebCompositorStreamVideoQuad> WebCompositorStreamVideoQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebTransformationMatrix& matrix) +{ + return adoptPtr(new WebCompositorStreamVideoQuad(sharedQuadState, quadRect, textureId, matrix)); +} + +WebCompositorStreamVideoQuad::WebCompositorStreamVideoQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebTransformationMatrix& matrix) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::StreamVideoContent, quadRect) + , m_textureId(textureId) + , m_matrix(matrix) +{ +} + +const WebCompositorStreamVideoQuad* WebCompositorStreamVideoQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::StreamVideoContent); + return static_cast<const WebCompositorStreamVideoQuad*>(quad); +} + +} diff --git a/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp new file mode 100644 index 000000000..e5f45fdc4 --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <public/WebCompositorTextureQuad.h> + +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) +{ + return adoptPtr(new WebCompositorTextureQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped)); +} + +WebCompositorTextureQuad::WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TextureContent, quadRect) + , m_textureId(textureId) + , m_premultipliedAlpha(premultipliedAlpha) + , m_uvRect(uvRect) + , m_flipped(flipped) +{ +} + +void WebCompositorTextureQuad::setNeedsBlending() +{ + m_needsBlending = true; +} + +const WebCompositorTextureQuad* WebCompositorTextureQuad::materialCast(const WebKit::WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::TextureContent); + return static_cast<const WebCompositorTextureQuad*>(quad); +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp index b35b6f69f..27aa77508 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,19 @@ #include "config.h" -#include "cc/CCTileDrawQuad.h" +#include <public/WebCompositorTileQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* 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) +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) { - return adoptPtr(new CCTileDrawQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + return adoptPtr(new WebCompositorTileQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } -CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* 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) - : CCDrawQuad(sharedQuadState, CCDrawQuad::TiledContent, quadRect) +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) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TiledContent, quadRect) , m_textureId(textureId) , m_textureOffset(textureOffset) , m_textureSize(textureSize) @@ -51,4 +53,10 @@ CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const I m_opaqueRect = opaqueRect; } +const WebCompositorTileQuad* WebCompositorTileQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::TiledContent); + return static_cast<const WebCompositorTileQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp index 5332c2fbf..394da63f6 100644 --- a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp +++ b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp @@ -100,7 +100,7 @@ FloatRect screenAvailableRect(Widget* widget) return screenRect(widget); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/graphics/BitmapImage.cpp b/Source/WebCore/platform/graphics/BitmapImage.cpp index 04528591a..45460f8d3 100644 --- a/Source/WebCore/platform/graphics/BitmapImage.cpp +++ b/Source/WebCore/platform/graphics/BitmapImage.cpp @@ -304,7 +304,7 @@ NativeImagePtr BitmapImage::frameAtIndex(size_t index) bool BitmapImage::frameIsCompleteAtIndex(size_t index) { if (!ensureFrameIsCached(index)) - return true; // Why would an invalid index return true here? + return false; return m_frames[index].m_isComplete; } @@ -563,11 +563,4 @@ Color BitmapImage::solidColor() const return m_solidColor; } -#if !USE(CG) -void BitmapImage::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum) -{ - draw(ctx, dstRect, srcRect, styleColorSpace, op); -} -#endif - } diff --git a/Source/WebCore/platform/graphics/BitmapImage.h b/Source/WebCore/platform/graphics/BitmapImage.h index 21885cdd4..f5bfeb145 100644 --- a/Source/WebCore/platform/graphics/BitmapImage.h +++ b/Source/WebCore/platform/graphics/BitmapImage.h @@ -199,7 +199,9 @@ protected: virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator); #endif virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator); - void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum); +#if USE(CG) + virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum); +#endif #if (OS(WINCE) && !PLATFORM(QT)) virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp index 1fd52a919..e4e545a1b 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp @@ -35,6 +35,16 @@ namespace WebCore { +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const +{ + return style->isHorizontalWritingMode() ? m_top : m_left; +} + +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const +{ + return style->isHorizontalWritingMode() ? m_bottom : m_right; +} + FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const { return style->isHorizontalWritingMode() ? m_left : m_top; diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h index af9630880..921c84b90 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h @@ -53,6 +53,8 @@ public: inline void setBottom(FractionalLayoutUnit value) { m_bottom = value; } inline void setLeft(FractionalLayoutUnit value) { m_left = value; } + FractionalLayoutUnit logicalTop(const RenderStyle*) const; + FractionalLayoutUnit logicalBottom(const RenderStyle*) const; FractionalLayoutUnit logicalLeft(const RenderStyle*) const; FractionalLayoutUnit logicalRight(const RenderStyle*) const; diff --git a/Source/WebCore/platform/graphics/FractionalLayoutRect.h b/Source/WebCore/platform/graphics/FractionalLayoutRect.h index d91be931a..a06d17508 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutRect.h +++ b/Source/WebCore/platform/graphics/FractionalLayoutRect.h @@ -31,6 +31,7 @@ #ifndef FractionalLayoutRect_h #define FractionalLayoutRect_h +#include "FractionalLayoutBoxExtent.h" #include "FractionalLayoutPoint.h" #include "IntRect.h" #include <wtf/Vector.h> @@ -99,6 +100,11 @@ public: void move(FractionalLayoutUnit dx, FractionalLayoutUnit dy) { m_location.move(dx, dy); } void expand(const FractionalLayoutSize& size) { m_size += size; } + void expand(const FractionalLayoutBoxExtent& box) + { + m_location.move(-box.left(), -box.top()); + m_size.expand(box.left() + box.right(), box.top() + box.bottom()); + } void expand(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(dw, dh); } void contract(const FractionalLayoutSize& size) { m_size -= size; } void contract(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(-dw, -dh); } diff --git a/Source/WebCore/platform/graphics/Gradient.h b/Source/WebCore/platform/graphics/Gradient.h index 5e36ff3c3..6ae483ac8 100644 --- a/Source/WebCore/platform/graphics/Gradient.h +++ b/Source/WebCore/platform/graphics/Gradient.h @@ -39,7 +39,7 @@ typedef struct CGContext* CGContextRef; -#define USE_CG_SHADING defined(BUILDING_ON_LEOPARD) +#define USE_CG_SHADING (PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050) #if USE_CG_SHADING typedef struct CGShading* CGShadingRef; diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp index bf1f8c056..6664b8644 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp @@ -490,10 +490,7 @@ void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const #endif } - if (image->isBitmapImage()) - static_cast<BitmapImage*>(image)->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation); - else - image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op); + image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation); if (useLowQualityScale) setImageInterpolationQuality(previousInterpolationQuality); diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index 51eef09c5..1e6184293 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -956,10 +956,7 @@ public: ANGLEWebKitBridge m_compiler; #endif -#if PLATFORM(QT) && defined(QT_OPENGL_ES_2) - friend class Extensions3DQt; - OwnPtr<Extensions3DQt> m_extensions; -#elif PLATFORM(BLACKBERRY) +#if PLATFORM(BLACKBERRY) || (PLATFORM(QT) && defined(QT_OPENGL_ES_2)) friend class Extensions3DOpenGLES; OwnPtr<Extensions3DOpenGLES> m_extensions; #elif !PLATFORM(CHROMIUM) diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.cpp b/Source/WebCore/platform/graphics/GraphicsLayer.cpp index 9a52fb67b..dda637311 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayer.cpp @@ -79,6 +79,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) , m_acceleratesDrawing(false) , m_maintainsPixelAlignment(false) , m_appliesPageScale(false) + , m_usingTileCache(false) , m_paintingPhase(GraphicsLayerPaintAll) , m_contentsOrientation(CompositingCoordinatesTopDown) , m_parent(0) @@ -340,9 +341,7 @@ void GraphicsLayer::updateDebugIndicators() { if (GraphicsLayer::showDebugBorders()) { if (drawsContent()) { - // FIXME: It's weird to ask the client if this layer is a tile cache layer. - // Maybe we should just cache that information inside GraphicsLayer? - if (m_client->shouldUseTileCache(this)) // tile cache layer: dark blue + if (m_usingTileCache) // tile cache layer: dark blue setDebugBorder(Color(0, 0, 128, 128), 0.5); else if (m_usingTiledLayer) setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h index 7939717fa..ccd61fb9e 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayer.h +++ b/Source/WebCore/platform/graphics/GraphicsLayer.h @@ -466,6 +466,7 @@ protected: bool m_acceleratesDrawing : 1; bool m_maintainsPixelAlignment : 1; bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it. + bool m_usingTileCache : 1; GraphicsLayerPaintingPhase m_paintingPhase; CompositingCoordinatesOrientation m_contentsOrientation; // affects orientation of layer contents diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp index aa022a24e..ef8232c5d 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp @@ -18,12 +18,11 @@ */ #include "config.h" -#include "TextureMapperAnimation.h" +#include "GraphicsLayerAnimation.h" #include "UnitBezier.h" #include <wtf/CurrentTime.h> -#if USE(TEXTURE_MAPPER) namespace WebCore { @@ -145,7 +144,7 @@ static TransformationMatrix applyTransformAnimation(const TransformOperations* f } -TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch) +GraphicsLayerAnimation::GraphicsLayerAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch) : m_keyframes(keyframes) , m_boxSize(boxSize) , m_animation(Animation::create(animation)) @@ -156,21 +155,21 @@ TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframe { } -void TextureMapperAnimation::applyInternal(TextureMapperAnimationClient* client, const AnimationValue* from, const AnimationValue* to, float progress) +void GraphicsLayerAnimation::applyInternal(Client* client, const AnimationValue* from, const AnimationValue* to, float progress) { switch (m_keyframes.property()) { case AnimatedPropertyOpacity: - client->setOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress)); + client->setAnimatedOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress)); return; case AnimatedPropertyWebkitTransform: - client->setTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch)); + client->setAnimatedTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch)); return; default: ASSERT_NOT_REACHED(); } } -bool TextureMapperAnimation::isActive() const +bool GraphicsLayerAnimation::isActive() const { if (state() != StoppedState) return true; @@ -178,11 +177,11 @@ bool TextureMapperAnimation::isActive() const return m_animation->fillsForwards(); } -bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const +bool GraphicsLayerAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const { - HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end(); - for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { - const Vector<TextureMapperAnimation>& animations = it->second; + HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end(); + for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { + const Vector<GraphicsLayerAnimation>& animations = it->second; for (size_t i = 0; i < animations.size(); ++i) { if (animations[i].isActive() && animations[i].property() == type) return true; @@ -191,13 +190,13 @@ bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) return false; } -bool TextureMapperAnimations::hasRunningAnimations() const +bool GraphicsLayerAnimations::hasRunningAnimations() const { - HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end(); - for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { - const Vector<TextureMapperAnimation>& animations = it->second; + HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end(); + for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { + const Vector<GraphicsLayerAnimation>& animations = it->second; for (size_t i = 0; i < animations.size(); ++i) { - if (animations[i].state() == TextureMapperAnimation::PlayingState) + if (animations[i].state() == GraphicsLayerAnimation::PlayingState) return true; } } @@ -205,7 +204,7 @@ bool TextureMapperAnimations::hasRunningAnimations() const return false; } -void TextureMapperAnimation::apply(TextureMapperAnimationClient* client) +void GraphicsLayerAnimation::apply(Client* client) { if (state() == StoppedState) return; @@ -244,29 +243,29 @@ void TextureMapperAnimation::apply(TextureMapperAnimationClient* client) } } -void TextureMapperAnimation::pause(double offset) +void GraphicsLayerAnimation::pause(double offset) { // FIXME: should apply offset here. setState(PausedState); m_pauseTime = WTF::currentTime() - offset; } -void TextureMapperAnimations::add(const String& name, const TextureMapperAnimation& animation) +void GraphicsLayerAnimations::add(const String& name, const GraphicsLayerAnimation& animation) { - HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name); + HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name); if (it != m_animations.end()) { it->second.append(animation); return; } - Vector<TextureMapperAnimation> animations; + Vector<GraphicsLayerAnimation> animations; animations.append(animation); m_animations.add(name, animations); } -void TextureMapperAnimations::pause(const String& name, double offset) +void GraphicsLayerAnimations::pause(const String& name, double offset) { - HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name); + HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name); if (it == m_animations.end()) return; @@ -274,14 +273,13 @@ void TextureMapperAnimations::pause(const String& name, double offset) it->second[i].pause(offset); } -void TextureMapperAnimations::apply(TextureMapperAnimationClient* client) +void GraphicsLayerAnimations::apply(GraphicsLayerAnimation::Client* client) { - HashMap<String, Vector<TextureMapperAnimation> >::iterator end = m_animations.end(); - for (HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.begin(); it != end; ++it) { + HashMap<String, Vector<GraphicsLayerAnimation> >::iterator end = m_animations.end(); + for (HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.begin(); it != end; ++it) { for (size_t i = 0; i < it->second.size(); ++i) it->second[i].apply(client); } } } -#endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h index d0e90b518..2fbc05a12 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h +++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h @@ -17,32 +17,30 @@ Boston, MA 02110-1301, USA. */ -#ifndef TextureMapperAnimation_h -#define TextureMapperAnimation_h +#ifndef GraphicsLayerAnimation_h +#define GraphicsLayerAnimation_h #include "GraphicsLayer.h" #include "TransformationMatrix.h" #include <wtf/HashMap.h> #include <wtf/text/StringHash.h> -#if USE(TEXTURE_MAPPER) namespace WebCore { -class TextureMapperAnimationClient { -public: - virtual void setTransform(const TransformationMatrix&) = 0; - virtual void setOpacity(float) = 0; -}; - -class TextureMapperAnimation { +class GraphicsLayerAnimation { public: enum AnimationState { PlayingState, PausedState, StoppedState }; + class Client { + public: + virtual void setAnimatedTransform(const TransformationMatrix&) = 0; + virtual void setAnimatedOpacity(float) = 0; + }; - TextureMapperAnimation() + GraphicsLayerAnimation() : m_keyframes(AnimatedPropertyInvalid) { } - TextureMapperAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool); - void apply(TextureMapperAnimationClient*); + GraphicsLayerAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool); + void apply(Client*); void pause(double); AnimationState state() const { return m_state; } void setState(AnimationState s) { m_state = s; } @@ -50,7 +48,7 @@ public: bool isActive() const; private: - void applyInternal(TextureMapperAnimationClient*, const AnimationValue* from, const AnimationValue* to, float progress); + void applyInternal(Client*, const AnimationValue* from, const AnimationValue* to, float progress); KeyframeValueList m_keyframes; IntSize m_boxSize; RefPtr<Animation> m_animation; @@ -62,24 +60,22 @@ private: AnimationState m_state; }; -class TextureMapperAnimations { +class GraphicsLayerAnimations { public: - TextureMapperAnimations() { } + GraphicsLayerAnimations() { } - void add(const String&, const TextureMapperAnimation&); + void add(const String&, const GraphicsLayerAnimation&); void remove(const String& name) { m_animations.remove(name); } void pause(const String&, double); - void apply(TextureMapperAnimationClient*); + void apply(GraphicsLayerAnimation::Client*); bool isEmpty() const { return m_animations.isEmpty(); } bool hasRunningAnimations() const; bool hasActiveAnimationsOfType(AnimatedPropertyID type) const; private: - HashMap<String, Vector<TextureMapperAnimation> > m_animations; + HashMap<String, Vector<GraphicsLayerAnimation> > m_animations; }; } -#endif // USE(TEXTURE_MAPPER) - -#endif // TextureMapperAnimation_h +#endif // GraphicsLayerAnimation_h diff --git a/Source/WebCore/platform/graphics/GraphicsLayerClient.h b/Source/WebCore/platform/graphics/GraphicsLayerClient.h index 36a7f4365..7049e4226 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayerClient.h +++ b/Source/WebCore/platform/graphics/GraphicsLayerClient.h @@ -56,6 +56,7 @@ public: virtual ~GraphicsLayerClient() {} virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; } + virtual bool usingTileCache(const GraphicsLayer*) const { return false; } // Callback for when hardware-accelerated animation started. virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0; diff --git a/Source/WebCore/platform/graphics/texmap/LayerTransform.cpp b/Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp index 1c3c02e57..77cac87d6 100644 --- a/Source/WebCore/platform/graphics/texmap/LayerTransform.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp @@ -18,60 +18,60 @@ */ #include "config.h" -#include "LayerTransform.h" +#include "GraphicsLayerTransform.h" namespace WebCore { -LayerTransform::LayerTransform() -: m_flattening(false) -, m_dirty(false) // false by default since all default values would be combined as the identity matrix -, m_childrenDirty(false) +GraphicsLayerTransform::GraphicsLayerTransform() + : m_flattening(false) + , m_dirty(false) // false by default since all default values would be combined as the identity matrix + , m_childrenDirty(false) { } -void LayerTransform::setPosition(const FloatPoint& position) +void GraphicsLayerTransform::setPosition(const FloatPoint& position) { m_position = position; m_dirty = true; } -void LayerTransform::setSize(const FloatSize& size) +void GraphicsLayerTransform::setSize(const FloatSize& size) { m_size = size; m_dirty = true; } -void LayerTransform::setAnchorPoint(const FloatPoint3D& anchorPoint) +void GraphicsLayerTransform::setAnchorPoint(const FloatPoint3D& anchorPoint) { m_anchorPoint = anchorPoint; m_dirty = true; } -void LayerTransform::setFlattening(bool flattening) +void GraphicsLayerTransform::setFlattening(bool flattening) { m_flattening = flattening; m_dirty = true; } -void LayerTransform::setLocalTransform(const TransformationMatrix& transform) +void GraphicsLayerTransform::setLocalTransform(const TransformationMatrix& transform) { m_local = transform; m_dirty = true; } -void LayerTransform::setChildrenTransform(const TransformationMatrix& transform) +void GraphicsLayerTransform::setChildrenTransform(const TransformationMatrix& transform) { m_children = transform; m_dirty = true; } -TransformationMatrix LayerTransform::combined() +TransformationMatrix GraphicsLayerTransform::combined() { ASSERT(!m_dirty); return m_combined; } -TransformationMatrix LayerTransform::combinedForChildren() +TransformationMatrix GraphicsLayerTransform::combinedForChildren() { ASSERT(!m_dirty); if (m_childrenDirty) @@ -79,7 +79,7 @@ TransformationMatrix LayerTransform::combinedForChildren() return m_combinedForChildren; } -void LayerTransform::combineTransforms(const TransformationMatrix& parentTransform) +void GraphicsLayerTransform::combineTransforms(const TransformationMatrix& parentTransform) { float originX = m_anchorPoint.x() * m_size.width(); float originY = m_anchorPoint.y() * m_size.height(); @@ -96,7 +96,7 @@ void LayerTransform::combineTransforms(const TransformationMatrix& parentTransfo m_childrenDirty = true; } -void LayerTransform::combineTransformsForChildren() +void GraphicsLayerTransform::combineTransformsForChildren() { ASSERT(!m_dirty); ASSERT(m_childrenDirty); diff --git a/Source/WebCore/platform/graphics/texmap/LayerTransform.h b/Source/WebCore/platform/graphics/GraphicsLayerTransform.h index b73818501..5da25b4d8 100644 --- a/Source/WebCore/platform/graphics/texmap/LayerTransform.h +++ b/Source/WebCore/platform/graphics/GraphicsLayerTransform.h @@ -17,8 +17,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef LayerTransform_h -#define LayerTransform_h +#ifndef GraphicsLayerTransform_h +#define GraphicsLayerTransform_h #include "FloatPoint.h" #include "FloatPoint3D.h" @@ -27,9 +27,9 @@ namespace WebCore { -class LayerTransform { +class GraphicsLayerTransform { public: - LayerTransform(); + GraphicsLayerTransform(); void setPosition(const FloatPoint&); void setSize(const FloatSize&); void setAnchorPoint(const FloatPoint3D&); @@ -59,4 +59,4 @@ private: } -#endif // LayerTransform_h +#endif // GraphicsLayerTransform_h diff --git a/Source/WebCore/platform/graphics/Image.cpp b/Source/WebCore/platform/graphics/Image.cpp index 0ace7ac20..2b19f1349 100644 --- a/Source/WebCore/platform/graphics/Image.cpp +++ b/Source/WebCore/platform/graphics/Image.cpp @@ -89,6 +89,11 @@ void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, ctxt->setCompositeOperation(previousOperator); } +void Image::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum) +{ + draw(ctx, dstRect, srcRect, styleColorSpace, op); +} + void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op) { if (mayFillWithSolidColor()) { diff --git a/Source/WebCore/platform/graphics/Image.h b/Source/WebCore/platform/graphics/Image.h index 3ff48236a..a6b949047 100644 --- a/Source/WebCore/platform/graphics/Image.h +++ b/Source/WebCore/platform/graphics/Image.h @@ -181,6 +181,7 @@ protected: virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator) { } #endif virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0; + virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum); void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOperator); void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator); diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp index 73aacd496..ec622437e 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.cpp +++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -208,7 +208,7 @@ static Vector<MediaPlayerFactory*>& installedMediaEngines() enginesQueried = true; #if USE(AVFOUNDATION) - if (Settings::isAVFoundationEnabled()) { + if (1 /* @@Settings::isAVFoundationEnabled() @@ */) { #if PLATFORM(MAC) MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(addMediaEngine); #elif PLATFORM(WIN) @@ -1068,6 +1068,16 @@ String MediaPlayer::userAgent() const return m_mediaPlayerClient->mediaPlayerUserAgent(); } +#if PLATFORM(WIN) && USE(AVFOUNDATION) +GraphicsDeviceAdapter* MediaPlayer::graphicsDeviceAdapter() const +{ + if (!m_mediaPlayerClient) + return 0; + + return m_mediaPlayerClient->mediaPlayerGraphicsDeviceAdapter(this); +} +#endif + } #endif diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h index 8eb728596..3b382d83a 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.h +++ b/Source/WebCore/platform/graphics/MediaPlayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -99,6 +99,10 @@ class MediaPlayer; struct MediaPlayerFactory; class TimeRanges; +#if PLATFORM(WIN) && USE(AVFOUNDATION) +struct GraphicsDeviceAdapter; +#endif + class MediaPlayerClient { public: enum CORSMode { Unspecified, Anonymous, UseCredentials }; @@ -165,6 +169,10 @@ public: virtual void mediaPlayerRenderingModeChanged(MediaPlayer*) { } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const { return 0; } +#endif + #if ENABLE(MEDIA_SOURCE) virtual void mediaPlayerSourceOpened() { } virtual String mediaPlayerSourceURL() const { return "x-media-source-unsupported:"; } @@ -356,6 +364,10 @@ public: void acceleratedRenderingStateChanged(); #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + GraphicsDeviceAdapter* graphicsDeviceAdapter() const; +#endif + bool hasSingleSecurityOrigin() const; bool didPassCORSAccessCheck() const; diff --git a/Source/WebCore/platform/graphics/OpenGLESShims.h b/Source/WebCore/platform/graphics/OpenGLESShims.h index 052af5e45..4e0951201 100644 --- a/Source/WebCore/platform/graphics/OpenGLESShims.h +++ b/Source/WebCore/platform/graphics/OpenGLESShims.h @@ -26,7 +26,7 @@ #ifndef OpenGLESShims_h #define OpenGLESShims_h -#if PLATFORM(BLACKBERRY) +#if PLATFORM(BLACKBERRY) || PLATFORM(QT) #define glBindFramebufferEXT glBindFramebuffer #define glFramebufferTexture2DEXT glFramebufferTexture2D #define glBindRenderbufferEXT glBindRenderbuffer diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h b/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h index 04098002d..95b9403bf 100644 --- a/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h +++ b/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -177,6 +177,8 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetCopyAudiovisualMIMETypes, CFArr SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetCreateWithURLAndOptions, AVCFURLAssetRef, __cdecl, (CFAllocatorRef allocator, CFURLRef URL, CFDictionaryRef options, dispatch_queue_t notificationQueue), (allocator, URL, options, notificationQueue)) #define AVCFURLAssetCreateWithURLAndOptions softLink_AVCFURLAssetCreateWithURLAndOptions +SOFT_LINK_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerSetDirect3DDevice, void, __cdecl, (AVCFPlayerRef player, IDirect3DDevice9* d3dDevice)) + // Variables SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetImageGeneratorApertureModeCleanAperture, const CFStringRef); @@ -244,3 +246,6 @@ SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemTracksChangedNotific SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerRateChangedNotification, const CFStringRef); #define AVCFPlayerRateChangedNotification get_AVCFPlayerRateChangedNotification() + +SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, const CFStringRef); +#define AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey get_AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey() diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp b/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp index a9f39a40d..81d862981 100644 --- a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp +++ b/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ #include "MediaPlayerPrivateAVFoundationCF.h" #include "ApplicationCacheResource.h" +#include "COMPtr.h" #include "FloatConversion.h" #include "FrameView.h" #include "GraphicsContext.h" @@ -44,9 +45,9 @@ #include <AVFoundationCF/AVCFPlayerLayer.h> #include <AVFoundationCF/AVFoundationCF.h> #include <CoreMedia/CoreMedia.h> - #include <delayimp.h> #include <dispatch/dispatch.h> +#include <WebKitQuartzCoreAdditions/WKCACFTypes.h> #include <wtf/HashMap.h> #include <wtf/Threading.h> #include <wtf/UnusedParam.h> @@ -87,7 +88,7 @@ public: void createAssetForURL(const String& url); void setAsset(AVCFURLAssetRef); - void createPlayer(); + void createPlayer(IDirect3DDevice9*); void createPlayerItem(); void checkPlayability(); @@ -137,6 +138,7 @@ private: RefPtr<PlatformCALayer> m_videoLayerWrapper; OwnPtr<LayerClient> m_layerClient; + COMPtr<IDirect3DDevice9Ex> m_d3dDevice; }; uintptr_t AVFWrapper::s_nextAVFWrapperObjectID; @@ -339,7 +341,7 @@ void MediaPlayerPrivateAVFoundationCF::createAVPlayer() ASSERT(m_avfWrapper); setDelayCallbacks(true); - m_avfWrapper->createPlayer(); + m_avfWrapper->createPlayer(reinterpret_cast<IDirect3DDevice9*>(player()->graphicsDeviceAdapter())); setDelayCallbacks(false); } @@ -355,8 +357,9 @@ void MediaPlayerPrivateAVFoundationCF::createAVPlayerItem() void MediaPlayerPrivateAVFoundationCF::createAVAssetForURL(const String& url) { ASSERT(!m_avfWrapper); - + setDelayCallbacks(true); + m_avfWrapper = new AVFWrapper(this); m_avfWrapper->createAssetForURL(url); setDelayCallbacks(false); @@ -955,20 +958,36 @@ void AVFWrapper::disconnectAndDeleteAVFWrapper(void* context) void AVFWrapper::createAssetForURL(const String& url) { ASSERT(!avAsset()); - + RetainPtr<CFURLRef> urlRef(AdoptCF, KURL(ParsedURLString, url).createCFURL()); + AVCFURLAssetRef assetRef = AVCFURLAssetCreateWithURLAndOptions(kCFAllocatorDefault, urlRef.get(), 0, m_notificationQueue); m_avAsset.adoptCF(assetRef); } -void AVFWrapper::createPlayer() +void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice) { ASSERT(!avPlayer() && avPlayerItem()); + RetainPtr<CFMutableDictionaryRef> optionsRef(AdoptCF, CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + + if (d3dDevice) { + // QI for an IDirect3DDevice9Ex interface, it is required to do HW video decoding. + COMPtr<IDirect3DDevice9Ex> d3dEx(Query, d3dDevice); + m_d3dDevice = d3dEx; + } else + m_d3dDevice = 0; + + if (m_d3dDevice && AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey) + CFDictionarySetValue(optionsRef.get(), AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, kCFBooleanTrue); + // FIXME: We need a way to create a AVPlayer without an AVPlayerItem, see <rdar://problem/9877730>. - AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), 0, m_notificationQueue); + AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), optionsRef.get(), m_notificationQueue); m_avPlayer.adoptCF(playerRef); + if (m_d3dDevice && AVCFPlayerSetDirect3DDevicePtr()) + AVCFPlayerSetDirect3DDevicePtr()(playerRef, m_d3dDevice.get()); + CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter(); ASSERT(center); diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm index a26141daf..59a72f789 100644 --- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm +++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm @@ -258,7 +258,7 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url) [options.get() setObject:[NSNumber numberWithInt:AVAssetReferenceRestrictionForbidRemoteReferenceToLocal | AVAssetReferenceRestrictionForbidLocalReferenceToRemote] forKey:AVURLAssetReferenceRestrictionsKey]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 RetainPtr<NSMutableDictionary> headerFields(AdoptNS, [[NSMutableDictionary alloc] init]); String referrer = player()->referrer(); diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp index 55d479b8a..e3a565d18 100644 --- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp +++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp @@ -247,7 +247,7 @@ static bool animationHasStepsTimingFunction(const KeyframeValueList& valueList, static inline bool supportsAcceleratedFilterAnimations() { // <rdar://problem/10907251> - WebKit2 doesn't support CA animations of CI filters on Lion and below -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) return true; #else return false; @@ -268,8 +268,10 @@ GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient* client) , m_uncommittedChanges(0) { PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer; - if (client && client->shouldUseTileCache(this)) + if (client && client->shouldUseTileCache(this)) { layerType = PlatformCALayer::LayerTypeTileCacheLayer; + m_usingTileCache = true; + } m_layer = PlatformCALayer::create(layerType, this); @@ -1881,7 +1883,7 @@ bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValue int numAnimations = isMatrixAnimation ? 1 : operations->size(); bool reverseAnimationList = true; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(WIN) +#if !PLATFORM(IOS) && !PLATFORM(WIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // Old versions of Core Animation apply animations in reverse order (<rdar://problem/7095638>) so we need to flip the list. // to be non-additive. For binary compatibility, the current version of Core Animation preserves this behavior for applications linked // on or before Snow Leopard. @@ -2390,7 +2392,7 @@ void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth) FloatSize GraphicsLayerCA::constrainedSize() const { FloatSize constrainedSize = m_size; -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 float tileColumns = ceilf(m_size.width() / kTiledLayerTileSize); float tileRows = ceilf(m_size.height() / kTiledLayerTileSize); double numTiles = tileColumns * tileRows; diff --git a/Source/WebCore/platform/graphics/ca/PlatformCALayer.h b/Source/WebCore/platform/graphics/ca/PlatformCALayer.h index 002b7a07a..1ed94115c 100644 --- a/Source/WebCore/platform/graphics/ca/PlatformCALayer.h +++ b/Source/WebCore/platform/graphics/ca/PlatformCALayer.h @@ -213,7 +213,7 @@ public: void printTree() const; #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) void synchronouslyDisplayTilesInRect(const FloatRect&); #endif diff --git a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm index 3a7ac781f..f28967c51 100644 --- a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm +++ b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm @@ -93,7 +93,7 @@ static double mediaTimeToCurrentTime(CFTimeInterval t) @end -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @interface CATiledLayer(GraphicsLayerCAPrivate) - (void)displayInRect:(CGRect)r levelOfDetail:(int)lod options:(NSDictionary *)dict; - (BOOL)canDrawConcurrently; @@ -103,7 +103,7 @@ static double mediaTimeToCurrentTime(CFTimeInterval t) @interface CALayer(Private) - (void)setContentsChanged; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - (void)setAcceleratesDrawing:(BOOL)flag; - (BOOL)acceleratesDrawing; #endif @@ -554,7 +554,7 @@ void PlatformCALayer::setMasksToBounds(bool value) bool PlatformCALayer::acceleratesDrawing() const { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return [m_layer.get() acceleratesDrawing]; #else return false; @@ -563,7 +563,7 @@ bool PlatformCALayer::acceleratesDrawing() const void PlatformCALayer::setAcceleratesDrawing(bool acceleratesDrawing) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 BEGIN_BLOCK_OBJC_EXCEPTIONS [m_layer.get() setAcceleratesDrawing:acceleratesDrawing]; END_BLOCK_OBJC_EXCEPTIONS @@ -910,7 +910,7 @@ void PlatformCALayer::setTimeOffset(CFTimeInterval value) float PlatformCALayer::contentsScale() const { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return [m_layer.get() contentsScale]; #else return 1; @@ -919,7 +919,7 @@ float PlatformCALayer::contentsScale() const void PlatformCALayer::setContentsScale(float value) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 BEGIN_BLOCK_OBJC_EXCEPTIONS [m_layer.get() setContentsScale:value]; END_BLOCK_OBJC_EXCEPTIONS @@ -937,7 +937,7 @@ TiledBacking* PlatformCALayer::tiledBacking() return [tileCacheLayer tiledBacking]; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void PlatformCALayer::synchronouslyDisplayTilesInRect(const FloatRect& rect) { if (m_layerType != LayerTypeWebTiledLayer) diff --git a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm index 59d8b1f9b..f79c63b29 100644 --- a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm +++ b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm @@ -36,7 +36,7 @@ using namespace std; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @interface CALayer (WebCALayerDetails) - (void)setAcceleratesDrawing:(BOOL)flag; @end @@ -157,7 +157,7 @@ void TileCache::setScale(CGFloat scale) if (m_scale == scale && m_deviceScaleFactor == deviceScaleFactor) return; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 Vector<FloatRect> dirtyRects; m_deviceScaleFactor = deviceScaleFactor; @@ -182,7 +182,7 @@ void TileCache::setScale(CGFloat scale) void TileCache::setAcceleratesDrawing(bool acceleratesDrawing) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (m_acceleratesDrawing == acceleratesDrawing) return; @@ -401,7 +401,7 @@ RetainPtr<WebTileLayer> TileCache::createTileLayer(const IntRect& tileRect) [layer.get() setName:@"Tile"]; #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [layer.get() setContentsScale:m_deviceScaleFactor]; [layer.get() setAcceleratesDrawing:m_acceleratesDrawing]; #endif diff --git a/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h index 2b82377d8..6628b92be 100644 --- a/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,6 +46,10 @@ struct WKCACFContext; typedef struct CGImage* CGImageRef; +#if USE(AVFOUNDATION) +struct GraphicsDeviceAdapter; +#endif + namespace WebCore { class CACFLayerTreeHostClient; @@ -66,6 +70,9 @@ public: virtual void resize() = 0; void flushPendingGraphicsLayerChangesSoon(); virtual void setShouldInvertColors(bool); +#if USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } +#endif // AbstractCACFLayerTreeHost virtual void flushPendingLayerChangesNow(); diff --git a/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h index bfa530b92..5662fed5c 100644 --- a/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,6 +64,10 @@ private: virtual void paint(); virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()); +#if USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE { return 0; } +#endif + Timer<LegacyCACFLayerTreeHost> m_renderTimer; COMPtr<IDirect3DDevice9> m_d3dDevice; WKCACFContext* m_context; diff --git a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp index 2b47a3e1d..d945c3e2e 100644 --- a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -61,6 +61,7 @@ SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewSetContextDidChangeCallback, void SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewGetLastCommitTime, CFTimeInterval, __cdecl, (WKCACFViewRef view), (view)) SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewSetContextUserData, void, __cdecl, (WKCACFViewRef view, void* userData), (view, userData)) SOFT_LINK_OPTIONAL(WebKitQuartzCoreAdditions, WKCACFViewSetShouldInvertColors, void, _cdecl, (WKCACFViewRef view, bool shouldInvertColors)) +SOFT_LINK_OPTIONAL(WebKitQuartzCoreAdditions, WKCACFViewGetD3DDevice9, IDirect3DDevice9*, _cdecl, (WKCACFViewRef view)) PassRefPtr<WKCACFViewLayerTreeHost> WKCACFViewLayerTreeHost::create() { @@ -175,6 +176,16 @@ void WKCACFViewLayerTreeHost::setShouldInvertColors(bool shouldInvertColors) WKCACFViewSetShouldInvertColorsPtr()(m_view.get(), shouldInvertColors); } +#if USE(AVFOUNDATION) +GraphicsDeviceAdapter* WKCACFViewLayerTreeHost::graphicsDeviceAdapter() const +{ + if (!WKCACFViewGetD3DDevice9Ptr()) + return 0; + + return reinterpret_cast<GraphicsDeviceAdapter*>(WKCACFViewGetD3DDevice9Ptr()(m_view.get())); +} +#endif + } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h index 2660e43d1..567157125 100644 --- a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -54,6 +54,9 @@ private: virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()); virtual CFTimeInterval lastCommitTime() const; virtual void setShouldInvertColors(bool); +#if USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE; +#endif RetainPtr<WKCACFViewRef> m_view; bool m_viewNeedsUpdate; diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index 5e5f56853..3b4c9ccf3 100644 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -29,7 +29,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "CairoUtilities.h" #include "Color.h" @@ -43,6 +42,7 @@ #include "RefPtrCairo.h" #include <cairo.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> using namespace std; diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 748946820..2657d5412 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -54,12 +54,12 @@ #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 // Building on 10.6 or later: kCGInterpolationMedium is defined in the CGInterpolationQuality enum. #define HAVE_CG_INTERPOLATION_MEDIUM 1 #endif -#ifndef TARGETING_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Targeting 10.6 or later: use kCGInterpolationMedium. #define WTF_USE_CG_INTERPOLATION_MEDIUM 1 #endif @@ -1181,7 +1181,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, con blurRadius = min(blurRadius, narrowPrecisionToCGFloat(1000.0)); -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 if (!isAcceleratedContext()) { // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated // to the desired integer. Also see: <rdar://problem/10056277> @@ -1598,7 +1598,7 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const void GraphicsContext::setAllowsFontSmoothing(bool allowsFontSmoothing) { UNUSED_PARAM(allowsFontSmoothing); -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 CGContextRef context = platformContext(); CGContextSetAllowsFontSmoothing(context, allowsFontSmoothing); #endif diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp index 81982a188..21e9db4c2 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -28,7 +28,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "GraphicsContext.h" #include "GraphicsContextCG.h" @@ -42,6 +41,7 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/RetainPtr.h> #include <wtf/UnusedParam.h> +#include <wtf/text/Base64.h> #include <wtf/text/WTFString.h> #if PLATFORM(MAC) || PLATFORM(CHROMIUM) @@ -52,7 +52,7 @@ #include <IOSurface/IOSurface.h> #endif -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 #include <wtf/CurrentTime.h> #endif @@ -183,7 +183,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace m_context->scale(FloatSize(1, -1)); m_context->translate(0, -size.height()); m_context->setIsAcceleratedContext(accelerateRendering); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif success = true; @@ -195,7 +195,7 @@ ImageBuffer::~ImageBuffer() GraphicsContext* ImageBuffer::context() const { -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 // Force a flush if last flush was more than 20ms ago if (m_context->isAcceleratedContext()) { double elapsedTime = currentTimeMS() - m_data.m_lastFlushTime; @@ -250,7 +250,7 @@ NativeImagePtr ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const #if USE(IOSURFACE_CANVAS_BACKING_STORE) else { image = wkIOSurfaceContextCreateImage(context()->platformContext()); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif } @@ -310,7 +310,7 @@ PassRefPtr<Uint8ClampedArray> ImageBuffer::getUnmultipliedImageData(const IntRec { if (m_context->isAcceleratedContext()) { CGContextFlush(context()->platformContext()); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif } @@ -321,7 +321,7 @@ PassRefPtr<Uint8ClampedArray> ImageBuffer::getPremultipliedImageData(const IntRe { if (m_context->isAcceleratedContext()) { CGContextFlush(context()->platformContext()); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif } diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp index 5e3ae78a8..649d9b766 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp @@ -62,7 +62,7 @@ ImageBufferData::ImageBufferData(const IntSize&) #if USE(ACCELERATE) -#ifndef TARGETING_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 static bool haveVImageRoundingErrorFix() { return true; } #else // The vImage unpremultiply routine had a rounding bug before 10.6.7 <rdar://problem/8631548> @@ -72,7 +72,7 @@ static bool haveVImageRoundingErrorFix() static bool result = (Gestalt(gestaltSystemVersion, &version) == noErr && version > 0x1066); return result; } -#endif // TARGETING_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #if USE(IOSURFACE_CANVAS_BACKING_STORE) static void convertScanline(void* data, size_t tileNumber, bool premultiply) diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h index 6233c6c2c..8e61edff9 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h +++ b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h @@ -30,7 +30,7 @@ #include <wtf/RetainPtr.h> #include <wtf/Uint8ClampedArray.h> -#if (PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)) +#if (PLATFORM(MAC) && USE(CA) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) #define WTF_USE_IOSURFACE_CANVAS_BACKING_STORE 1 #endif @@ -54,7 +54,7 @@ public: Checked<unsigned, RecordOverflow> m_bytesPerRow; CGColorSpaceRef m_colorSpace; RetainPtr<IOSurfaceRef> m_surface; -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 mutable double m_lastFlushTime; #endif diff --git a/Source/WebCore/platform/graphics/cg/ImageCG.cpp b/Source/WebCore/platform/graphics/cg/ImageCG.cpp index fed911aeb..2c0cca22b 100644 --- a/Source/WebCore/platform/graphics/cg/ImageCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageCG.cpp @@ -269,7 +269,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const // FIXME: We cannot use CGContextDrawTiledImage with scaled tiles on Leopard, because it suffers from rounding errors. Snow Leopard is ok. float scaledTileWidth = tileRect.width() * narrowPrecisionToFloat(patternTransform.a()); float w = CGImageGetWidth(tileImage); -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (w == size().width() && h == size().height() && scaledTileWidth == tileRect.width() && scaledTileHeight == tileRect.height()) #else if (w == size().width() && h == size().height()) diff --git a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp index 43353650c..7cf02968e 100644 --- a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -85,7 +85,7 @@ ImageSource::~ImageSource() void ImageSource::clear(bool destroyAllFrames, size_t, SharedBuffer* data, bool allDataReceived) { -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Recent versions of ImageIO discard previously decoded image frames if the client // application no longer holds references to them, so there's no need to throw away // the decoder unless we're explicitly asked to destroy all of the frames. @@ -116,7 +116,7 @@ static CFDictionaryRef imageSourceOptions(ImageSource::ShouldSkipMetadata skipMe if (!options) { const unsigned numOptions = 3; -#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // Lion and Snow Leopard only return Orientation when kCGImageSourceSkipMetaData is false, // and incorrectly return cached metadata if an image is queried once with kCGImageSourceSkipMetaData true // and then subsequently with kCGImageSourceSkipMetaData false. diff --git a/Source/WebCore/platform/graphics/cg/PathCG.cpp b/Source/WebCore/platform/graphics/cg/PathCG.cpp index 6cc937836..e7dee39d3 100644 --- a/Source/WebCore/platform/graphics/cg/PathCG.cpp +++ b/Source/WebCore/platform/graphics/cg/PathCG.cpp @@ -175,7 +175,7 @@ FloatRect Path::boundingRect() const // does not, but only exists on 10.6 and above. CGRect bound = CGRectZero; -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 bound = CGPathGetPathBoundingBox(m_path); #else bound = CGPathGetBoundingBox(m_path); @@ -236,7 +236,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) void Path::platformAddPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius) { -#if PLATFORM(MAC) && (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 bool equalWidths = (topLeftRadius.width() == topRightRadius.width() && topRightRadius.width() == bottomLeftRadius.width() && bottomLeftRadius.width() == bottomRightRadius.width()); bool equalHeights = (topLeftRadius.height() == bottomLeftRadius.height() && bottomLeftRadius.height() == topRightRadius.height() && topRightRadius.height() == bottomRightRadius.height()); diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp index f869c58a2..d75cf054d 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp @@ -33,6 +33,7 @@ #include "LayerPainterChromium.h" #include "PlatformColor.h" #include "PlatformContextSkia.h" +#include "TextureAllocator.h" #include "cc/CCGraphicsContext.h" #include "skia/ext/platform_canvas.h" diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h index d97968c03..276e2b391 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h @@ -38,6 +38,7 @@ 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 diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp index 23cffea94..86fb2c8c3 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp @@ -34,6 +34,7 @@ #include "PlatformColor.h" #include "SkCanvas.h" #include "SkDevice.h" +#include "TextureAllocator.h" #include "cc/CCGraphicsContext.h" namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h index 787b39937..9f1388827 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h @@ -34,6 +34,8 @@ 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 { diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp index be8484b75..782780a40 100644 --- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp @@ -75,8 +75,9 @@ void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& c m_painter->paint(canvas, layerRect, opaqueLayerRect); canvas->restore(); - opaqueLayerRect.scale(contentsWidthScale, contentsHeightScale); - resultingOpaqueRect = enclosedIntRect(opaqueLayerRect); + FloatRect opaqueContentRect = opaqueLayerRect; + opaqueContentRect.scale(contentsWidthScale, contentsHeightScale); + resultingOpaqueRect = enclosedIntRect(opaqueContentRect); m_contentRect = contentRect; } diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 078d377d0..9f40f7fe1 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -97,14 +97,14 @@ void ContentLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTr { createTextureUpdaterIfNeeded(); - IntRect layerRect; + IntRect contentRect; - // Always call updateLayerRect() but with an empty layer rectangle when + // Always call updateContentRect() but with an empty layer rectangle when // layer doesn't draw contents. if (drawsContent()) - layerRect = visibleLayerRect(); + contentRect = visibleContentRect(); - updateLayerRect(updater, layerRect, occlusion); + updateContentRect(updater, contentRect, occlusion); m_needsDisplay = false; } @@ -112,7 +112,7 @@ bool ContentLayerChromium::needMoreUpdates() { if (!drawsContent()) return false; - return needsIdlePaint(visibleLayerRect()); + return needsIdlePaint(visibleContentRect()); } void ContentLayerChromium::createTextureUpdaterIfNeeded() diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index 14164133d..696563acf 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -36,7 +36,6 @@ #include "LayerTextureSubImage.h" #include "LayerTextureUpdater.h" -#include "ManagedTexture.h" #include "PlatformColor.h" #include "cc/CCLayerTreeHost.h" @@ -155,11 +154,11 @@ void ImageLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTrac if (m_needsDisplay) { m_textureUpdater->setBitmap(m_bitmap); updateTileSizeAndTilingOption(); - invalidateRect(IntRect(IntPoint(), contentBounds())); + invalidateContentRect(IntRect(IntPoint(), contentBounds())); m_needsDisplay = false; } - updateLayerRect(updater, visibleLayerRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion); } void ImageLayerChromium::createTextureUpdaterIfNeeded() diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp index 38b856e63..4ae8db39c 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -732,7 +732,7 @@ void LayerChromium::notifyAnimationFinished(double wallClockTime) Region LayerChromium::visibleContentOpaqueRegion() const { if (opaque()) - return visibleLayerRect(); + return visibleContentRect(); return Region(); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h index e3ceb94d0..40668f556 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h @@ -154,8 +154,8 @@ public: void setTransform(const WebKit::WebTransformationMatrix&); bool transformIsAnimating() const; - const IntRect& visibleLayerRect() const { return m_visibleLayerRect; } - void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; } + const IntRect& visibleContentRect() const { return m_visibleContentRect; } + void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; } const IntRect& scissorRect() const { return m_scissorRect; } void setScissorRect(const IntRect& scissorRect) { m_scissorRect = scissorRect; } @@ -344,7 +344,7 @@ private: IntSize m_bounds; // Uses layer's content space. - IntRect m_visibleLayerRect; + IntRect m_visibleContentRect; // During drawing, identifies the region outside of which nothing should be drawn. // Currently this is set to layer's clipRect if usesLayerClipping is true, otherwise diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 55b5929a3..a72674140 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -43,28 +43,18 @@ #include "SharedGraphicsContext3D.h" #include "SkBitmap.h" #include "SkColor.h" -#include "TextureManager.h" #include "ThrottledTextureUploader.h" #include "TraceEvent.h" #include "TrackingTextureAllocator.h" -#include "cc/CCCheckerboardDrawQuad.h" -#include "cc/CCDebugBorderDrawQuad.h" -#include "cc/CCIOSurfaceDrawQuad.h" #include "cc/CCLayerQuad.h" #include "cc/CCMathUtil.h" #include "cc/CCProxy.h" #include "cc/CCRenderPass.h" -#include "cc/CCRenderPassDrawQuad.h" #include "cc/CCRenderSurfaceFilters.h" #include "cc/CCScopedTexture.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" -#include "cc/CCSolidColorDrawQuad.h" -#include "cc/CCStreamVideoDrawQuad.h" -#include "cc/CCTextureDrawQuad.h" -#include "cc/CCTileDrawQuad.h" #include "cc/CCVideoLayerImpl.h" -#include "cc/CCYUVVideoDrawQuad.h" #include <public/WebGraphicsContext3D.h> #include <public/WebVideoFrame.h> #include <wtf/CurrentTime.h> @@ -218,8 +208,6 @@ bool LayerRendererChromium::initialize() m_capabilities.usingGpuMemoryManager = extensions.contains("GL_CHROMIUM_gpu_memory_manager"); if (m_capabilities.usingGpuMemoryManager) m_context->setMemoryAllocationChangedCallbackCHROMIUM(this); - else - m_client->setMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize())); m_capabilities.usingDiscardFramebuffer = extensions.contains("GL_CHROMIUM_discard_framebuffer"); @@ -327,7 +315,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa { HashMap<int, const CCRenderPass*> passesInFrame; for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) - passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i].get()); + passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]); Vector<int> passesToDelete; HashMap<int, OwnPtr<CCScopedTexture> >::const_iterator passIterator; @@ -414,7 +402,7 @@ void LayerRendererChromium::drawRenderPass(const CCRenderPass* renderPass, const drawQuad(it->get()); } -void LayerRendererChromium::drawQuad(const CCDrawQuad* quad) +void LayerRendererChromium::drawQuad(const WebKit::WebCompositorQuad* quad) { IntRect scissorRect = quad->scissorRect(); @@ -430,35 +418,35 @@ void LayerRendererChromium::drawQuad(const CCDrawQuad* quad) GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); switch (quad->material()) { - case CCDrawQuad::Invalid: + case WebKit::WebCompositorQuad::Invalid: ASSERT_NOT_REACHED(); break; - case CCDrawQuad::Checkerboard: - drawCheckerboardQuad(quad->toCheckerboardDrawQuad()); + case WebKit::WebCompositorQuad::Checkerboard: + drawCheckerboardQuad(CCCheckerboardDrawQuad::materialCast(quad)); break; - case CCDrawQuad::DebugBorder: - drawDebugBorderQuad(quad->toDebugBorderDrawQuad()); + case WebKit::WebCompositorQuad::DebugBorder: + drawDebugBorderQuad(CCDebugBorderDrawQuad::materialCast(quad)); break; - case CCDrawQuad::IOSurfaceContent: - drawIOSurfaceQuad(quad->toIOSurfaceDrawQuad()); + case WebKit::WebCompositorQuad::IOSurfaceContent: + drawIOSurfaceQuad(CCIOSurfaceDrawQuad::materialCast(quad)); break; - case CCDrawQuad::RenderPass: - drawRenderPassQuad(quad->toRenderPassDrawQuad()); + case WebKit::WebCompositorQuad::RenderPass: + drawRenderPassQuad(CCRenderPassDrawQuad::materialCast(quad)); break; - case CCDrawQuad::SolidColor: - drawSolidColorQuad(quad->toSolidColorDrawQuad()); + case WebKit::WebCompositorQuad::SolidColor: + drawSolidColorQuad(WebKit::WebCompositorSolidColorQuad::materialCast(quad)); break; - case CCDrawQuad::StreamVideoContent: - drawStreamVideoQuad(quad->toStreamVideoDrawQuad()); + case WebKit::WebCompositorQuad::StreamVideoContent: + drawStreamVideoQuad(CCStreamVideoDrawQuad::materialCast(quad)); break; - case CCDrawQuad::TextureContent: - drawTextureQuad(quad->toTextureDrawQuad()); + case WebKit::WebCompositorQuad::TextureContent: + drawTextureQuad(WebKit::WebCompositorTextureQuad::materialCast(quad)); break; - case CCDrawQuad::TiledContent: - drawTileQuad(quad->toTileDrawQuad()); + case WebKit::WebCompositorQuad::TiledContent: + drawTileQuad(CCTileDrawQuad::materialCast(quad)); break; - case CCDrawQuad::YUVVideoContent: - drawYUVVideoQuad(quad->toYUVVideoDrawQuad()); + case WebKit::WebCompositorQuad::YUVVideoContent: + drawYUVVideoQuad(CCYUVVideoDrawQuad::materialCast(quad)); break; } } @@ -610,7 +598,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) if (!contentsTexture || !contentsTexture->id()) return; - WebTransformationMatrix renderTransform = quad->layerTransform(); + WebTransformationMatrix renderTransform = quad->drawTransform(); // Apply a scaling factor to size the quad from 1x1 to its intended size. renderTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1); WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(windowMatrix() * projectionMatrix() * renderTransform).to2dTransform(); @@ -633,7 +621,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) // Draw the background texture if there is one. if (backgroundTexture) { ASSERT(backgroundTexture->size() == quad->quadRect().size()); - copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->layerTransform()); + copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->drawTransform()); } bool clipped = false; @@ -711,11 +699,11 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge)); } - // Map device space quad to surface space. contentsDeviceTransform has no perspective since it was generated with to2dTransform() so we don't need to project. + // Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project. FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped); ASSERT(!clipped); - drawTexturedQuad(quad->layerTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad, + drawTexturedQuad(quad->drawTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad, shaderMatrixLocation, shaderAlphaLocation, shaderQuadLocation); } @@ -807,7 +795,7 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) return; bool clipped = false; - FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->layerRect()), clipped); + FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped); ASSERT(!clipped); TileProgramUniforms uniforms; @@ -891,10 +879,12 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) // Create device space quad. CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); - // Map quad to layer space. + // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project. WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse(); localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped); - ASSERT(!clipped); + + // We should not ASSERT(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become + // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. } else { // Move fragment shader transform to vertex shader. We can do this while // still producing correct results as fragmentTexTransformLocation @@ -968,11 +958,12 @@ void LayerRendererChromium::drawYUVVideoQuad(const CCYUVVideoDrawQuad* quad) }; GLC(context(), context()->uniform3fv(program->fragmentShader().yuvAdjLocation(), 1, yuvAdjust)); - const IntSize& bounds = quad->quadRect().size(); - drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), FloatQuad(), - program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), - -1); + WebTransformationMatrix quadTransform = quad->quadTransform(); + IntRect quadRect = quad->quadRect(); + quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); + + drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), FloatQuad(), + program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1); // Reset active texture back to texture 0. GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); @@ -995,11 +986,12 @@ void LayerRendererChromium::drawStreamVideoQuad(const CCStreamVideoDrawQuad* qua GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); - const IntSize& bounds = quad->quadRect().size(); - drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), - program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), - -1); + WebTransformationMatrix quadTransform = quad->quadTransform(); + IntRect quadRect = quad->quadRect(); + quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); + + drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), + program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1); } struct TextureProgramBinding { @@ -1092,9 +1084,11 @@ void LayerRendererChromium::drawIOSurfaceQuad(const CCIOSurfaceDrawQuad* quad) 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)); - const IntSize& bounds = quad->quadRect().size(); + WebTransformationMatrix quadTransform = quad->quadTransform(); + IntRect quadRect = quad->quadRect(); + quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); - drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); + drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 6afe66806..415520d7f 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -37,7 +37,16 @@ #include "Extensions3DChromium.h" #include "TextureCopier.h" #include "TrackingTextureAllocator.h" +#include "cc/CCCheckerboardDrawQuad.h" +#include "cc/CCDebugBorderDrawQuad.h" +#include "cc/CCIOSurfaceDrawQuad.h" +#include "cc/CCRenderPassDrawQuad.h" #include "cc/CCRenderer.h" +#include "cc/CCSolidColorDrawQuad.h" +#include "cc/CCStreamVideoDrawQuad.h" +#include "cc/CCTextureDrawQuad.h" +#include "cc/CCTileDrawQuad.h" +#include "cc/CCYUVVideoDrawQuad.h" #include <wtf/PassOwnPtr.h> namespace WebKit { @@ -46,17 +55,7 @@ class WebGraphicsContext3D; namespace WebCore { -class CCCheckerboardDrawQuad; -class CCDebugBorderDrawQuad; -class CCDrawQuad; -class CCIOSurfaceDrawQuad; -class CCRenderPassDrawQuad; class CCScopedTexture; -class CCSolidColorDrawQuad; -class CCStreamVideoDrawQuad; -class CCTextureDrawQuad; -class CCTileDrawQuad; -class CCYUVVideoDrawQuad; class GeometryBinding; class ScopedEnsureFramebufferAllocation; diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp b/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp deleted file mode 100644 index 4dabf1beb..000000000 --- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp +++ /dev/null @@ -1,151 +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: - * 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" - -#if USE(ACCELERATED_COMPOSITING) - -#include "ManagedTexture.h" - -#include "GraphicsContext3D.h" -#include "cc/CCGraphicsContext.h" -#include <public/WebGraphicsContext3D.h> - -using WebKit::WebGraphicsContext3D; - -namespace WebCore { - -ManagedTexture::ManagedTexture(TextureManager* manager) - : m_textureManager(manager) - , m_token(0) - , m_format(0) - , m_textureId(0) -{ - m_textureManager->registerTexture(this); -} - -ManagedTexture::ManagedTexture(TextureManager* manager, TextureToken token, IntSize size, unsigned format, unsigned textureId) - : m_textureManager(manager) - , m_token(token) - , m_size(size) - , m_format(format) - , m_textureId(textureId) -{ - m_textureManager->registerTexture(this); -} - -ManagedTexture::~ManagedTexture() -{ - if (!m_textureManager) - return; - m_textureManager->unregisterTexture(this); - if (m_token) - m_textureManager->releaseToken(m_token); -} - -void ManagedTexture::setTextureManager(TextureManager* manager) -{ - if (manager == m_textureManager) - return; - - if (m_textureManager) - m_textureManager->unregisterTexture(this); - m_textureManager = manager; - clear(); - if (m_textureManager) - m_textureManager->registerTexture(this); -} - -bool ManagedTexture::isValid(const IntSize& size, unsigned format) -{ - return m_token && size == m_size && format == m_format && m_textureManager && m_textureManager->hasTexture(m_token); -} - -bool ManagedTexture::reserve(const IntSize& size, unsigned format) -{ - if (!m_textureManager) - return false; - - if (!m_token) - m_token = m_textureManager->getToken(); - - bool reserved = true; - if (size == m_size && format == m_format && m_textureManager->hasTexture(m_token)) - m_textureManager->protectTexture(m_token); - else { - m_textureId = 0; - reserved = m_textureManager->requestTexture(m_token, size, format); - if (reserved) { - m_size = size; - m_format = format; - } - } - - return reserved; -} - -void ManagedTexture::unreserve() -{ - if (!m_token || !m_textureManager) - return; - - m_textureManager->unprotectTexture(m_token); -} - -void ManagedTexture::allocate(TextureAllocator* allocator) -{ - ASSERT(m_textureManager->hasTexture(m_token)); - if (!m_textureId) - m_textureId = m_textureManager->allocateTexture(allocator, m_token); -} - -void ManagedTexture::bindTexture(CCGraphicsContext* context, TextureAllocator* allocator) -{ - allocate(allocator); - WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId); -} - -PassOwnPtr<ManagedTexture> ManagedTexture::steal() -{ - OwnPtr<ManagedTexture> texture = adoptPtr(new ManagedTexture(m_textureManager, m_token, m_size, m_format, m_textureId)); - clear(); - return texture.release(); -} - -void ManagedTexture::clear() -{ - m_token = 0; - m_size = IntSize(); - m_format = 0; - m_textureId = 0; -} - -} - -#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h b/Source/WebCore/platform/graphics/chromium/ManagedTexture.h deleted file mode 100644 index 6e67ebf68..000000000 --- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h +++ /dev/null @@ -1,86 +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: - * 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 ManagedTexture_h -#define ManagedTexture_h - -#include "IntSize.h" -#include "TextureManager.h" - -#include <wtf/FastAllocBase.h> -#include <wtf/Noncopyable.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - -class CCGraphicsContext; - -class ManagedTexture { - WTF_MAKE_NONCOPYABLE(ManagedTexture); -public: - static PassOwnPtr<ManagedTexture> create(TextureManager* manager) - { - return adoptPtr(new ManagedTexture(manager)); - } - ~ManagedTexture(); - - void setTextureManager(TextureManager*); - void clearManager() { m_textureManager = 0; } - - bool isValid(const IntSize&, unsigned format); - bool reserve(const IntSize&, unsigned format); - void unreserve(); - bool isReserved() - { - return m_textureManager && m_textureManager->isProtected(m_token); - } - - void allocate(TextureAllocator*); - void bindTexture(CCGraphicsContext*, TextureAllocator*); - - IntSize size() const { return m_size; } - unsigned format() const { return m_format; } - unsigned textureId() const { return m_textureId; } - - // Steal token and textureId by instantiates a new texture using existing - // member variables. - PassOwnPtr<ManagedTexture> steal(); - -private: - explicit ManagedTexture(TextureManager*); - ManagedTexture(TextureManager*, TextureToken, IntSize, unsigned format, unsigned textureId); - - void clear(); - - TextureManager* m_textureManager; - TextureToken m_token; - IntSize m_size; - unsigned m_format; - unsigned m_textureId; -}; - -} - -#endif // ManagedTexture_h diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index 0e7d4e38c..2b608f4e7 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -40,7 +40,6 @@ namespace WebCore { class FilterOperations; class LayerChromium; class LayerRendererChromium; -class ManagedTexture; class RenderSurfaceChromium { WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium); diff --git a/Source/WebCore/platform/graphics/chromium/TextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TextureAllocator.h new file mode 100644 index 000000000..58de11522 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/TextureAllocator.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef TextureAllocator_h +#define TextureAllocator_h + +#include "GraphicsContext3D.h" +#include "IntRect.h" +#include "IntSize.h" + +namespace WebCore { + +class TextureAllocator { +public: + virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0; + virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0; + virtual void deleteAllTextures() = 0; + +protected: + virtual ~TextureAllocator() { } +}; + +} + +#endif + + diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp deleted file mode 100644 index 485c72228..000000000 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp +++ /dev/null @@ -1,325 +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: - * 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" - -#if USE(ACCELERATED_COMPOSITING) - -#include "TextureManager.h" - -#include "ManagedTexture.h" -#include "TraceEvent.h" - -using namespace std; - -namespace WebCore { - - -namespace { -size_t memoryLimitBytes(size_t viewportMultiplier, const IntSize& viewportSize, size_t minMegabytes, size_t maxMegabytes) -{ - if (!viewportMultiplier) - return maxMegabytes * 1024 * 1024; - if (viewportSize.isEmpty()) - return minMegabytes * 1024 * 1024; - return max(minMegabytes * 1024 * 1024, min(maxMegabytes * 1024 * 1024, viewportMultiplier * TextureManager::memoryUseBytes(viewportSize, GraphicsContext3D::RGBA))); -} -} - -size_t TextureManager::highLimitBytes(const IntSize& viewportSize) -{ - size_t viewportMultiplier, minMegabytes, maxMegabytes; -#if OS(ANDROID) - viewportMultiplier = 16; - minMegabytes = 32; - maxMegabytes = 64; -#else - viewportMultiplier = 0; - minMegabytes = 0; - maxMegabytes = 128; -#endif - return memoryLimitBytes(viewportMultiplier, viewportSize, minMegabytes, maxMegabytes); -} - -size_t TextureManager::reclaimLimitBytes(const IntSize& viewportSize) -{ - size_t viewportMultiplier, minMegabytes, maxMegabytes; -#if OS(ANDROID) - viewportMultiplier = 8; - minMegabytes = 16; - maxMegabytes = 32; -#else - viewportMultiplier = 0; - minMegabytes = 0; - maxMegabytes = 64; -#endif - return memoryLimitBytes(viewportMultiplier, viewportSize, minMegabytes, maxMegabytes); -} - -size_t TextureManager::memoryUseBytes(const IntSize& size, GC3Denum textureFormat) -{ - // FIXME: This assumes all textures are 1 byte/component. - const GC3Denum type = GraphicsContext3D::UNSIGNED_BYTE; - unsigned int componentsPerPixel = 4; - unsigned int bytesPerComponent = 1; - if (!GraphicsContext3D::computeFormatAndTypeParameters(textureFormat, type, &componentsPerPixel, &bytesPerComponent)) - ASSERT_NOT_REACHED(); - - return size.width() * size.height() * componentsPerPixel * bytesPerComponent; -} - - -TextureManager::TextureManager(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize) - : m_maxMemoryLimitBytes(maxMemoryLimitBytes) - , m_preferredMemoryLimitBytes(preferredMemoryLimitBytes) - , m_memoryUseBytes(0) - , m_maxTextureSize(maxTextureSize) - , m_nextToken(1) -{ -} - -TextureManager::~TextureManager() -{ - for (HashSet<ManagedTexture*>::iterator it = m_registeredTextures.begin(); it != m_registeredTextures.end(); ++it) - (*it)->clearManager(); -} - -void TextureManager::setMemoryAllocationLimitBytes(size_t memoryLimitBytes) -{ - setMaxMemoryLimitBytes(memoryLimitBytes); -#if defined(OS_ANDROID) - // On android, we are setting the preferred memory limit to half of our - // maximum allocation, because we would like to stay significantly below - // the absolute memory limit whenever we can. Specifically, by limitting - // prepainting only to the halfway memory mark. - setPreferredMemoryLimitBytes(memoryLimitBytes / 2); -#else - setPreferredMemoryLimitBytes(memoryLimitBytes); -#endif -} - -void TextureManager::setMaxMemoryLimitBytes(size_t memoryLimitBytes) -{ - reduceMemoryToLimit(memoryLimitBytes); - ASSERT(currentMemoryUseBytes() <= memoryLimitBytes); - m_maxMemoryLimitBytes = memoryLimitBytes; -} - -void TextureManager::setPreferredMemoryLimitBytes(size_t memoryLimitBytes) -{ - m_preferredMemoryLimitBytes = memoryLimitBytes; -} - -void TextureManager::registerTexture(ManagedTexture* texture) -{ - ASSERT(texture); - ASSERT(!m_registeredTextures.contains(texture)); - - m_registeredTextures.add(texture); -} - -void TextureManager::unregisterTexture(ManagedTexture* texture) -{ - ASSERT(texture); - ASSERT(m_registeredTextures.contains(texture)); - - m_registeredTextures.remove(texture); -} - -TextureToken TextureManager::getToken() -{ - return m_nextToken++; -} - -void TextureManager::releaseToken(TextureToken token) -{ - TextureMap::iterator it = m_textures.find(token); - if (it != m_textures.end()) - removeTexture(token, it->second); -} - -bool TextureManager::hasTexture(TextureToken token) -{ - return m_textures.contains(token); -} - -bool TextureManager::isProtected(TextureToken token) -{ - return token && hasTexture(token) && m_textures.get(token).isProtected; -} - -void TextureManager::protectTexture(TextureToken token) -{ - ASSERT(hasTexture(token)); - TextureInfo info = m_textures.take(token); - info.isProtected = true; - m_textures.add(token, info); - // If someone protects a texture, put it at the end of the LRU list. - m_textureLRUSet.remove(token); - m_textureLRUSet.add(token); -} - -void TextureManager::unprotectTexture(TextureToken token) -{ - TextureMap::iterator it = m_textures.find(token); - if (it != m_textures.end()) - it->second.isProtected = false; -} - -void TextureManager::unprotectAllTextures() -{ - for (TextureMap::iterator it = m_textures.begin(); it != m_textures.end(); ++it) - it->second.isProtected = false; -} - -void TextureManager::evictTexture(TextureToken token, TextureInfo info) -{ - TRACE_EVENT0("cc", "TextureManager::evictTexture"); - removeTexture(token, info); -} - -void TextureManager::reduceMemoryToLimit(size_t limit) -{ - while (m_memoryUseBytes > limit) { - ASSERT(!m_textureLRUSet.isEmpty()); - bool foundCandidate = false; - for (ListHashSet<TextureToken>::iterator lruIt = m_textureLRUSet.begin(); lruIt != m_textureLRUSet.end(); ++lruIt) { - TextureToken token = *lruIt; - TextureInfo info = m_textures.get(token); - if (info.isProtected) - continue; - evictTexture(token, info); - foundCandidate = true; - break; - } - if (!foundCandidate) - return; - } -} - -void TextureManager::addTexture(TextureToken token, TextureInfo info) -{ - ASSERT(!m_textureLRUSet.contains(token)); - ASSERT(!m_textures.contains(token)); - m_memoryUseBytes += memoryUseBytes(info.size, info.format); - m_textures.set(token, info); - m_textureLRUSet.add(token); -} - -void TextureManager::deleteEvictedTextures(TextureAllocator* allocator) -{ - if (allocator) { - for (size_t i = 0; i < m_evictedTextures.size(); ++i) { - if (m_evictedTextures[i].textureId) { -#ifndef NDEBUG - ASSERT(m_evictedTextures[i].allocator == allocator); -#endif - allocator->deleteTexture(m_evictedTextures[i].textureId, m_evictedTextures[i].size, m_evictedTextures[i].format); - } - } - } - m_evictedTextures.clear(); -} - -void TextureManager::evictAndRemoveAllDeletedTextures() -{ - unprotectAllTextures(); - reduceMemoryToLimit(0); - m_evictedTextures.clear(); -} - -void TextureManager::evictAndDeleteAllTextures(TextureAllocator* allocator) -{ - unprotectAllTextures(); - reduceMemoryToLimit(0); - deleteEvictedTextures(allocator); -} - -void TextureManager::removeTexture(TextureToken token, TextureInfo info) -{ - ASSERT(m_textureLRUSet.contains(token)); - ASSERT(m_textures.contains(token)); - m_memoryUseBytes -= memoryUseBytes(info.size, info.format); - m_textures.remove(token); - ASSERT(m_textureLRUSet.contains(token)); - m_textureLRUSet.remove(token); - EvictionEntry entry; - entry.textureId = info.textureId; - entry.size = info.size; - entry.format = info.format; -#ifndef NDEBUG - entry.allocator = info.allocator; -#endif - m_evictedTextures.append(entry); -} - -unsigned TextureManager::allocateTexture(TextureAllocator* allocator, TextureToken token) -{ - TextureMap::iterator it = m_textures.find(token); - ASSERT(it != m_textures.end()); - TextureInfo* info = &it.get()->second; - ASSERT(info->isProtected); - - unsigned textureId = allocator->createTexture(info->size, info->format); - info->textureId = textureId; -#ifndef NDEBUG - info->allocator = allocator; -#endif - return textureId; -} - -bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format) -{ - if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) - return false; - - TextureMap::iterator it = m_textures.find(token); - if (it != m_textures.end()) { - ASSERT(it->second.size != size || it->second.format != format); - removeTexture(token, it->second); - } - - size_t memoryRequiredBytes = memoryUseBytes(size, format); - if (memoryRequiredBytes > m_maxMemoryLimitBytes) - return false; - - reduceMemoryToLimit(m_maxMemoryLimitBytes - memoryRequiredBytes); - if (m_memoryUseBytes + memoryRequiredBytes > m_maxMemoryLimitBytes) - return false; - - TextureInfo info; - info.size = size; - info.format = format; - info.textureId = 0; - info.isProtected = true; -#ifndef NDEBUG - info.allocator = 0; -#endif - addTexture(token, info); - return true; -} - -} - -#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h deleted file mode 100644 index 47a189bcc..000000000 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.h +++ /dev/null @@ -1,140 +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: - * 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 TextureManager_h -#define TextureManager_h - -#include "GraphicsContext3D.h" -#include "IntRect.h" -#include "IntSize.h" -#include <wtf/FastAllocBase.h> -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/ListHashSet.h> -#include <wtf/Vector.h> - -namespace WebCore { - -class ManagedTexture; -typedef int TextureToken; - -class TextureAllocator { -public: - virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0; - virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0; - virtual void deleteAllTextures() = 0; - -protected: - virtual ~TextureAllocator() { } -}; - -class TextureManager { - WTF_MAKE_NONCOPYABLE(TextureManager); -public: - static PassOwnPtr<TextureManager> create(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize) - { - return adoptPtr(new TextureManager(maxMemoryLimitBytes, preferredMemoryLimitBytes, maxTextureSize)); - } - ~TextureManager(); - - // Absolute maximum limit for texture allocations for this instance. - static size_t highLimitBytes(const IntSize& viewportSize); - // Preferred texture size limit given the viewport size. - static size_t reclaimLimitBytes(const IntSize& viewportSize); - - static size_t memoryUseBytes(const IntSize&, GC3Denum format); - - void setMemoryAllocationLimitBytes(size_t); - void setMaxMemoryLimitBytes(size_t); - size_t maxMemoryLimitBytes() { return m_maxMemoryLimitBytes; } - void setPreferredMemoryLimitBytes(size_t); - size_t preferredMemoryLimitBytes() { return m_preferredMemoryLimitBytes; } - - void registerTexture(ManagedTexture*); - void unregisterTexture(ManagedTexture*); - - TextureToken getToken(); - void releaseToken(TextureToken); - bool hasTexture(TextureToken); - - bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat); - - void protectTexture(TextureToken); - void unprotectTexture(TextureToken); - void unprotectAllTextures(); - bool isProtected(TextureToken); - - unsigned allocateTexture(TextureAllocator*, TextureToken); - void deleteEvictedTextures(TextureAllocator*); - - void evictAndRemoveAllDeletedTextures(); - void evictAndDeleteAllTextures(TextureAllocator*); - - void reduceMemoryToLimit(size_t); - size_t currentMemoryUseBytes() const { return m_memoryUseBytes; } - -private: - TextureManager(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize); - - struct TextureInfo { - IntSize size; - GC3Denum format; - unsigned textureId; - bool isProtected; -#ifndef NDEBUG - TextureAllocator* allocator; -#endif - }; - - void addTexture(TextureToken, TextureInfo); - void removeTexture(TextureToken, TextureInfo); - void evictTexture(TextureToken, TextureInfo); - - HashSet<ManagedTexture*> m_registeredTextures; - - typedef HashMap<TextureToken, TextureInfo> TextureMap; - TextureMap m_textures; - ListHashSet<TextureToken> m_textureLRUSet; - - size_t m_maxMemoryLimitBytes; - size_t m_preferredMemoryLimitBytes; - size_t m_memoryUseBytes; - int m_maxTextureSize; - TextureToken m_nextToken; - - struct EvictionEntry { - unsigned textureId; - IntSize size; - GC3Denum format; -#ifndef NDEBUG - TextureAllocator* allocator; -#endif - }; - - Vector<EvictionEntry> m_evictedTextures; -}; - -} - -#endif diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index 5c4bc05ce..d085c9dd1 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -30,7 +30,6 @@ #include "TiledLayerChromium.h" #include "GraphicsContext3D.h" -#include "ManagedTexture.h" #include "Region.h" #include "TextStream.h" @@ -156,7 +155,7 @@ void TiledLayerChromium::updateBounds() newRegion.subtract(oldRegion); Vector<IntRect> rects = newRegion.rects(); for (size_t i = 0; i < rects.size(); ++i) - invalidateRect(rects[i]); + invalidateContentRect(rects[i]); } void TiledLayerChromium::setTileSize(const IntSize& size) @@ -288,7 +287,7 @@ void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) FloatRect scaledDirtyRect(dirtyRect); scaledDirtyRect.scale(contentsWidthScale, contentsHeightScale); IntRect dirty = enclosingIntRect(scaledDirtyRect); - invalidateRect(dirty); + invalidateContentRect(dirty); LayerChromium::setNeedsDisplayRect(dirtyRect); } @@ -306,10 +305,10 @@ void TiledLayerChromium::setIsNonCompositedContent(bool isNonCompositedContent) setBorderTexelOption(borderTexelOption); } -void TiledLayerChromium::invalidateRect(const IntRect& layerRect) +void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) { updateBounds(); - if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw) + if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw) return; for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { @@ -319,7 +318,7 @@ void TiledLayerChromium::invalidateRect(const IntRect& layerRect) if (!tile) continue; IntRect bound = m_tiler->tileRect(tile); - bound.intersect(layerRect); + bound.intersect(contentRect); tile->dirtyRect.unite(bound); } } @@ -356,7 +355,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in // Create tiles as needed, expanding a dirty rect to contain all // the dirty regions currently being drawn. All dirty tiles that are to be painted // get their updateRect set to dirtyRect and dirtyRect cleared. This way if - // invalidateRect is invoked during updateLayerRect we don't lose the request. + // invalidateContentRect is invoked during updateContentRect we don't lose the request. IntRect paintRect; for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { @@ -377,7 +376,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in // When not idle painting, if the visible region of the tile is occluded, don't reserve a texture or update the tile. // If any part of the tile is visible, then we need to update it so the tile is pushed to the impl thread. if (!idle && occlusion) { - IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleLayerRect()); + IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleContentRect()); if (occlusion->occluded(this, visibleTileRect)) { ASSERT(!tile->updated); continue; @@ -517,21 +516,21 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc) { - setTexturePrioritiesInRect(priorityCalc, visibleLayerRect()); + setTexturePrioritiesInRect(priorityCalc, visibleContentRect()); } -void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleRect) +void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleContentRect) { updateBounds(); resetUpdateState(); - IntRect prepaintRect = idlePaintRect(visibleRect); + IntRect prepaintRect = idlePaintRect(visibleContentRect); bool drawsToRootSurface = !targetRenderSurface()->targetRenderSurface(); // Minimally create the tiles in the desired pre-paint rect. if (!prepaintRect.isEmpty()) { int left, top, right, bottom; - m_tiler->layerRectToTileIndices(prepaintRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(prepaintRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) for (int i = left; i <= right; ++i) if (!tileAt(i, j)) @@ -542,9 +541,9 @@ void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& // These textures must stay alive while the updated textures are incrementally // uploaded, swapped atomically via pushProperties, and finally deleted // after the commit is complete, after which they can be recycled. - if (!visibleRect.isEmpty()) { + if (!visibleContentRect.isEmpty()) { int left, top, right, bottom; - m_tiler->layerRectToTileIndices(visibleRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(visibleContentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); @@ -581,10 +580,10 @@ void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& // can be removed soon with better priorities, but for now paint these layers after // 512 pixels of pre-painting. Later we can just pass an animating flag etc. to the // calculator and it can take care of this special case if we still need it. - if (visibleRect.isEmpty() && !prepaintRect.isEmpty()) + if (visibleContentRect.isEmpty() && !prepaintRect.isEmpty()) tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(512, drawsToRootSurface)); - else if (!visibleRect.isEmpty()) - tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(visibleRect, tileRect, drawsToRootSurface)); + else if (!visibleContentRect.isEmpty()) + tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(visibleContentRect, tileRect, drawsToRootSurface)); } } @@ -593,8 +592,8 @@ Region TiledLayerChromium::visibleContentOpaqueRegion() const if (m_skipsDraw) return Region(); if (opaque()) - return visibleLayerRect(); - return m_tiler->opaqueRegionInLayerRect(visibleLayerRect()); + return visibleContentRect(); + return m_tiler->opaqueRegionInContentRect(visibleContentRect()); } void TiledLayerChromium::resetUpdateState() @@ -611,7 +610,7 @@ void TiledLayerChromium::resetUpdateState() } } -void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion) +void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion) { m_skipsDraw = false; m_skipsIdlePaint = false; @@ -625,7 +624,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec // Visible painting. Only paint visible tiles if the visible rect isn't empty. if (!contentRect.isEmpty()) { int left, top, right, bottom; - m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); updateTiles(false, left, top, right, bottom, updater, occlusion); } @@ -639,7 +638,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec return; int prepaintLeft, prepaintTop, prepaintRight, prepaintBottom; - m_tiler->layerRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom); + m_tiler->contentRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom); // If the layer is not visible, we have nothing to expand from, so instead we prepaint the outer-most set of tiles. if (contentRect.isEmpty()) { @@ -657,7 +656,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec } int left, top, right, bottom; - m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); // Otherwise, prepaint anything that was occluded but inside the layer's visible region. updateTiles(true, left, top, right, bottom, updater, 0); @@ -693,7 +692,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec } } -bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect) +bool TiledLayerChromium::needsIdlePaint(const IntRect& visibleContentRect) { if (m_skipsIdlePaint) return false; @@ -701,17 +700,17 @@ bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect) if (m_tiler->hasEmptyBounds()) return false; - IntRect idlePaintContentRect = idlePaintRect(contentRect); + IntRect idlePaintContentRect = idlePaintRect(visibleContentRect); if (idlePaintContentRect.isEmpty()) return false; int left, top, right, bottom; - m_tiler->layerRectToTileIndices(idlePaintContentRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(idlePaintContentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { - // If the layerRect is empty, then we are painting the outer-most set of tiles only. - if (contentRect.isEmpty() && i != left && i != right && j != top && j != bottom) + // If the visibleContentRect is empty, then we are painting the outer-most set of tiles only. + if (visibleContentRect.isEmpty() && i != left && i != right && j != top && j != bottom) continue; UpdatableTile* tile = tileAt(i, j); ASSERT(tile); // Did setTexturePriorities get skipped? @@ -728,14 +727,14 @@ bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect) return false; } -IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect) +IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleContentRect) { IntRect contentRect(IntPoint::zero(), contentBounds()); // For layers that are animating transforms but not visible at all, we don't know what part // of them is going to become visible. For small layers we return the entire layer, for larger // ones we avoid prepainting the layer at all. - if (visibleRect.isEmpty()) { + if (visibleContentRect.isEmpty()) { bool isSmallLayer = m_tiler->numTilesX() <= 9 && m_tiler->numTilesY() <= 9 && m_tiler->numTilesX() * m_tiler->numTilesY() <= 9; if ((drawTransformIsAnimating() || screenSpaceTransformIsAnimating()) && isSmallLayer) return contentRect; @@ -744,7 +743,7 @@ IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect) // FIXME: This can be made a lot larger now! We should increase // this slowly while insuring it doesn't cause any perf issues. - IntRect prepaintRect = visibleRect; + IntRect prepaintRect = visibleContentRect; prepaintRect.inflateX(m_tiler->tileSize().width()); prepaintRect.inflateY(m_tiler->tileSize().height() * 2); prepaintRect.intersect(contentRect); diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h index d2ed45c04..c80c422f9 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h @@ -77,18 +77,18 @@ protected: virtual void createTextureUpdaterIfNeeded() = 0; // Set invalidations to be potentially repainted during update(). - void invalidateRect(const IntRect& layerRect); + void invalidateContentRect(const IntRect& contentRect); // Reset state on tiles that will be used for updating the layer. void resetUpdateState(); - // Prepare data needed to update textures that intersect with layerRect. - void updateLayerRect(CCTextureUpdater&, const IntRect& layerRect, const CCOcclusionTracker*); + // Prepare data needed to update textures that intersect with contentRect. + void updateContentRect(CCTextureUpdater&, const IntRect& contentRect, const CCOcclusionTracker*); // After preparing an update, returns true if more painting is needed. - bool needsIdlePaint(const IntRect& layerRect); + bool needsIdlePaint(const IntRect& visibleContentRect); - IntRect idlePaintRect(const IntRect& visibleLayerRect); + IntRect idlePaintRect(const IntRect& visibleContentRect); bool skipsDraw() const { return m_skipsDraw; } @@ -104,7 +104,7 @@ private: bool tileOnlyNeedsPartialUpdate(UpdatableTile*); bool tileNeedsBufferedUpdate(UpdatableTile*); - void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleLayerRect); + void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleContentRect); void updateTiles(bool idle, int left, int top, int right, int bottom, CCTextureUpdater&, const CCOcclusionTracker*); diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp index c589a3c6e..7ae29f912 100644 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp +++ b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp @@ -75,7 +75,7 @@ unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum f if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) return 0; - m_currentMemoryUseBytes += TextureManager::memoryUseBytes(size, format); + m_currentMemoryUseBytes += CCTexture::memorySizeBytes(size, format); unsigned textureId = 0; GLC(m_context, textureId = m_context->createTexture()); @@ -100,7 +100,7 @@ unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum f void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format) { - m_currentMemoryUseBytes -= TextureManager::memoryUseBytes(size, 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)); diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h index 78ef40d1b..38f7ca043 100644 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h +++ b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h @@ -25,7 +25,7 @@ #ifndef TrackingTextureAllocator_h #define TrackingTextureAllocator_h -#include "TextureManager.h" +#include "TextureAllocator.h" #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h index 27f8c56bd..35104dcf5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h @@ -26,20 +26,10 @@ #ifndef CCCheckerboardDrawQuad_h #define CCCheckerboardDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorCheckerboardQuad.h> namespace WebCore { - -class CCCheckerboardDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCCheckerboardDrawQuad); -public: - static PassOwnPtr<CCCheckerboardDrawQuad> create(const CCSharedQuadState*, const IntRect&); - -private: - CCCheckerboardDrawQuad(const CCSharedQuadState*, const IntRect&); -}; - +typedef WebKit::WebCompositorCheckerboardQuad CCCheckerboardDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h index ea1cf8476..a72c27417 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,27 +26,10 @@ #ifndef CCDebugBorderDrawQuad_h #define CCDebugBorderDrawQuad_h -#include "SkColor.h" -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorDebugBorderQuad.h> namespace WebCore { - -class CCDebugBorderDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCDebugBorderDrawQuad); -public: - static PassOwnPtr<CCDebugBorderDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor, int width); - - SkColor color() const { return m_color; }; - int width() const { return m_width; } - -private: - CCDebugBorderDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor, int width); - - SkColor m_color; - int m_width; -}; - +typedef WebKit::WebCompositorDebugBorderQuad CCDebugBorderDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp deleted file mode 100644 index 601f5621d..000000000 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "cc/CCDrawQuad.h" - -#include "cc/CCCheckerboardDrawQuad.h" -#include "cc/CCDebugBorderDrawQuad.h" -#include "cc/CCIOSurfaceDrawQuad.h" -#include "cc/CCRenderPassDrawQuad.h" -#include "cc/CCSolidColorDrawQuad.h" -#include "cc/CCStreamVideoDrawQuad.h" -#include "cc/CCTextureDrawQuad.h" -#include "cc/CCTileDrawQuad.h" -#include "cc/CCYUVVideoDrawQuad.h" - -namespace WebCore { - -CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) - : m_sharedQuadState(sharedQuadState) - , m_material(material) - , m_quadRect(quadRect) - , m_quadVisibleRect(quadRect) - , m_quadOpaque(true) - , m_needsBlending(false) -{ - ASSERT(m_sharedQuadState); - ASSERT(m_material != Invalid); -} - -IntRect CCDrawQuad::opaqueRect() const -{ - if (opacity() != 1) - return IntRect(); - if (m_sharedQuadState->isOpaque() && m_quadOpaque) - return m_quadRect; - return m_opaqueRect; -} - -void CCDrawQuad::setQuadVisibleRect(const IntRect& quadVisibleRect) -{ - m_quadVisibleRect = quadVisibleRect; - m_quadVisibleRect.intersect(m_quadRect); -} - -const CCCheckerboardDrawQuad* CCDrawQuad::toCheckerboardDrawQuad() const -{ - ASSERT(m_material == Checkerboard); - return static_cast<const CCCheckerboardDrawQuad*>(this); -} - -const CCDebugBorderDrawQuad* CCDrawQuad::toDebugBorderDrawQuad() const -{ - ASSERT(m_material == DebugBorder); - return static_cast<const CCDebugBorderDrawQuad*>(this); -} - -const CCIOSurfaceDrawQuad* CCDrawQuad::toIOSurfaceDrawQuad() const -{ - ASSERT(m_material == IOSurfaceContent); - return static_cast<const CCIOSurfaceDrawQuad*>(this); -} - -const CCRenderPassDrawQuad* CCDrawQuad::toRenderPassDrawQuad() const -{ - ASSERT(m_material == RenderPass); - return static_cast<const CCRenderPassDrawQuad*>(this); -} - -const CCSolidColorDrawQuad* CCDrawQuad::toSolidColorDrawQuad() const -{ - ASSERT(m_material == SolidColor); - return static_cast<const CCSolidColorDrawQuad*>(this); -} - -const CCStreamVideoDrawQuad* CCDrawQuad::toStreamVideoDrawQuad() const -{ - ASSERT(m_material == StreamVideoContent); - return static_cast<const CCStreamVideoDrawQuad*>(this); -} - -const CCTextureDrawQuad* CCDrawQuad::toTextureDrawQuad() const -{ - ASSERT(m_material == TextureContent); - return static_cast<const CCTextureDrawQuad*>(this); -} -const CCTileDrawQuad* CCDrawQuad::toTileDrawQuad() const -{ - ASSERT(m_material == TiledContent); - return static_cast<const CCTileDrawQuad*>(this); -} - -const CCYUVVideoDrawQuad* CCDrawQuad::toYUVVideoDrawQuad() const -{ - ASSERT(m_material == YUVVideoContent); - return static_cast<const CCYUVVideoDrawQuad*>(this); -} - - -} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h index 756b68036..5f536a85a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,91 +26,10 @@ #ifndef CCDrawQuad_h #define CCDrawQuad_h -#include "cc/CCSharedQuadState.h" +#include <public/WebCompositorQuad.h> namespace WebCore { - -class CCCheckerboardDrawQuad; -class CCDebugBorderDrawQuad; -class CCIOSurfaceDrawQuad; -class CCRenderPassDrawQuad; -class CCSolidColorDrawQuad; -class CCStreamVideoDrawQuad; -class CCTextureDrawQuad; -class CCTileDrawQuad; -class CCYUVVideoDrawQuad; - -// CCDrawQuad is a bag of data used for drawing a quad. Because different -// materials need different bits of per-quad data to render, classes that derive -// from CCDrawQuad store additional data in their derived instance. The Material -// enum is used to "safely" upcast to the derived class. -class CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCDrawQuad); -public: - const IntRect& quadRect() const { return m_quadRect; } - const WebKit::WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform(); } - const WebKit::WebTransformationMatrix& layerTransform() const { return m_sharedQuadState->layerTransform(); } - const IntRect& layerRect() const { return m_sharedQuadState->layerRect(); } - const IntRect& scissorRect() const { return m_sharedQuadState->scissorRect(); } - float opacity() const { return m_sharedQuadState->opacity(); } - // For the purposes of blending, what part of the contents of this quad are opaque? - IntRect opaqueRect() const; - bool needsBlending() const { return m_needsBlending || !opaqueRect().contains(m_quadVisibleRect); } - bool isLayerAxisAlignedIntRect() const { return m_sharedQuadState->isLayerAxisAlignedIntRect(); } - - // Allows changing the rect that gets drawn to make it smaller. Parameter passed - // in will be clipped to quadRect(). - void setQuadVisibleRect(const IntRect&); - const IntRect& quadVisibleRect() const { return m_quadVisibleRect; } - - enum Material { - Invalid, - Checkerboard, - DebugBorder, - IOSurfaceContent, - RenderPass, - TextureContent, - SolidColor, - TiledContent, - YUVVideoContent, - StreamVideoContent, - }; - - Material material() const { return m_material; } - bool isDebugQuad() const { return m_material == DebugBorder; } - - const CCCheckerboardDrawQuad* toCheckerboardDrawQuad() const; - const CCDebugBorderDrawQuad* toDebugBorderDrawQuad() const; - const CCIOSurfaceDrawQuad* toIOSurfaceDrawQuad() const; - const CCRenderPassDrawQuad* toRenderPassDrawQuad() const; - const CCSolidColorDrawQuad* toSolidColorDrawQuad() const; - const CCStreamVideoDrawQuad* toStreamVideoDrawQuad() const; - const CCTextureDrawQuad* toTextureDrawQuad() const; - const CCTileDrawQuad* toTileDrawQuad() const; - const CCYUVVideoDrawQuad* toYUVVideoDrawQuad() const; - - const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; } - -protected: - CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&); - - const CCSharedQuadState* m_sharedQuadState; - - Material m_material; - IntRect m_quadRect; - IntRect m_quadVisibleRect; - - // By default, the shared quad state determines whether or not this quad is - // opaque or needs blending. Derived classes can override with these - // variables. - bool m_quadOpaque; - bool m_needsBlending; - - // Be default, this rect is empty. It is used when the shared quad state and above - // variables determine that the quad is not fully opaque but may be partially opaque. - IntRect m_opaqueRect; -}; - +typedef WebKit::WebCompositorQuad CCDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h b/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h index 405885ffb..be8c8a557 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h @@ -48,6 +48,12 @@ public: WebKit::WebGraphicsContext3D* context3D() { return m_context3D.get(); } + void flush() + { + if (m_context3D) + m_context3D->flush(); + } + private: CCGraphicsContext() { } explicit CCGraphicsContext(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp index 731f770c0..be19983ef 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp @@ -31,7 +31,6 @@ #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" #include "PlatformCanvas.h" -#include "TextureManager.h" #include "cc/CCDebugRectHistory.h" #include "cc/CCFrameRateCounter.h" #include "cc/CCLayerTreeHostImpl.h" diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h index 27f863ee6..77d326cbd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h @@ -26,26 +26,10 @@ #ifndef CCIOSurfaceDrawQuad_h #define CCIOSurfaceDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorIOSurfaceQuad.h> namespace WebCore { - -class CCIOSurfaceDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCIOSurfaceDrawQuad); -public: - static PassOwnPtr<CCIOSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); - - const IntSize& ioSurfaceSize() const { return m_ioSurfaceSize; } - unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; } - -private: - CCIOSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); - - IntSize m_ioSurfaceSize; - unsigned m_ioSurfaceTextureId; -}; - +typedef WebKit::WebCompositorIOSurfaceQuad CCIOSurfaceDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 44772156d..9a88376c2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -147,7 +147,7 @@ bool CCLayerImpl::descendantDrawsContent() PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const { - return CCSharedQuadState::create(quadTransform(), drawTransform(), visibleLayerRect(), m_scissorRect, drawOpacity(), opaque()); + return CCSharedQuadState::create(quadTransform(), m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); } void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*) @@ -172,8 +172,8 @@ void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu if (!hasDebugBorders()) return; - IntRect layerRect(IntPoint(), contentBounds()); - quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, layerRect, debugBorderColor(), debugBorderWidth())); + IntRect contentRect(IntPoint(), contentBounds()); + quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth())); } unsigned CCLayerImpl::contentsTextureId() const @@ -613,7 +613,7 @@ void CCLayerImpl::setDoubleSided(bool doubleSided) Region CCLayerImpl::visibleContentOpaqueRegion() const { if (opaque()) - return visibleLayerRect(); + return visibleContentRect(); return Region(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index 00a351b22..2b9a49bd3 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/CCSharedQuadState.h" #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> @@ -48,7 +49,6 @@ class CCLayerSorter; class CCLayerTreeHostImpl; class CCQuadCuller; class CCRenderer; -class CCSharedQuadState; class LayerChromium; class CCLayerImpl : public CCLayerAnimationControllerClient { @@ -227,8 +227,8 @@ public: CCInputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType) const; - const IntRect& visibleLayerRect() const { return m_visibleLayerRect; } - void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; } + const IntRect& visibleContentRect() const { return m_visibleContentRect; } + void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; } bool doubleSided() const { return m_doubleSided; } void setDoubleSided(bool); @@ -332,7 +332,7 @@ private: bool m_layerSurfacePropertyChanged; // Uses layer's content space. - IntRect m_visibleLayerRect; + IntRect m_visibleContentRect; bool m_masksToBounds; bool m_opaque; float m_opacity; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp index 823a316a3..49d23366c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp @@ -99,12 +99,12 @@ void CCLayerTilingData::reset() m_tiles.clear(); } -void CCLayerTilingData::layerRectToTileIndices(const IntRect& layerRect, int& left, int& top, int& right, int& bottom) const +void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const { - left = m_tilingData.tileXIndexFromSrcCoord(layerRect.x()); - top = m_tilingData.tileYIndexFromSrcCoord(layerRect.y()); - right = m_tilingData.tileXIndexFromSrcCoord(layerRect.maxX() - 1); - bottom = m_tilingData.tileYIndexFromSrcCoord(layerRect.maxY() - 1); + left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x()); + top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y()); + right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1); + bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1); } IntRect CCLayerTilingData::tileRect(const Tile* tile) const @@ -114,21 +114,21 @@ IntRect CCLayerTilingData::tileRect(const Tile* tile) const return tileRect; } -Region CCLayerTilingData::opaqueRegionInLayerRect(const IntRect& layerRect) const +Region CCLayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const { - if (layerRect.isEmpty()) + if (contentRect.isEmpty()) return Region(); Region opaqueRegion; int left, top, right, bottom; - layerRectToTileIndices(layerRect, left, top, right, bottom); + contentRectToTileIndices(contentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { Tile* tile = tileAt(i, j); if (!tile) continue; - IntRect tileOpaqueRect = intersection(layerRect, tile->opaqueRect()); + IntRect tileOpaqueRect = intersection(contentRect, tile->opaqueRect()); opaqueRegion.unite(tileOpaqueRect); } } @@ -141,7 +141,7 @@ void CCLayerTilingData::setBounds(const IntSize& size) // Any tiles completely outside our new bounds are invalid and should be dropped. int left, top, right, bottom; - layerRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom); + contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom); Vector<TileMapKey> invalidTileKeys; for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) { if (it->first.first > right || it->first.second > bottom) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h index 081fe844e..25ff179ca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h @@ -98,10 +98,10 @@ public: void setBounds(const IntSize&); IntSize bounds() const; - void layerRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const; + void contentRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const; IntRect tileRect(const Tile*) const; - Region opaqueRegionInLayerRect(const IntRect&) const; + Region opaqueRegionInContentRect(const IntRect&) const; void reset(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 414b20526..da2cb32a0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -27,7 +27,6 @@ #include "cc/CCLayerTreeHost.h" #include "LayerChromium.h" -#include "ManagedTexture.h" #include "Region.h" #include "TraceEvent.h" #include "TreeSynchronizer.h" @@ -153,6 +152,7 @@ void CCLayerTreeHost::initializeLayerRenderer() m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize); + m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA); m_layerRendererInitialized = true; @@ -490,8 +490,6 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u // Reset partial texture update requests. m_partialTextureUpdateRequests = 0; - prioritizeTextures(updateList); - bool needMoreUpdates = paintLayerContents(updateList, updater); if (m_triggerIdleUpdates && needMoreUpdates) setNeedsCommit(); @@ -500,13 +498,20 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u updateList[i]->clearRenderSurface(); } -void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) +void CCLayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) +{ + // Surfaces have a place holder for their memory since they are managed + // independantly but should still be tracked and reduce other memory usage. + m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()); + m_surfaceMemoryPlaceholder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); + m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryBytes); +} + +void CCLayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) { // Use BackToFront since it's cheap and this isn't order-dependent. typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType; - m_contentsTextureManager->clearPriorities(); - CCPriorityCalculator calculator; CCLayerIteratorType end = CCLayerIteratorType::end(&updateList); for (CCLayerIteratorType it = CCLayerIteratorType::begin(&updateList); it != end; ++it) { @@ -519,7 +524,25 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) it->replicaLayer()->maskLayer()->setTexturePriorities(calculator); } } +} + +void CCLayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList, CCOverdrawMetrics& metrics) +{ + m_contentsTextureManager->clearPriorities(); + + size_t memoryForRenderSurfacesMetric = calculateMemoryForRenderSurfaces(renderSurfaceLayerList); + + setPrioritiesForLayers(renderSurfaceLayerList); + setPrioritiesForSurfaces(memoryForRenderSurfacesMetric); + metrics.didUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes()); + metrics.didUseRenderSurfaceTextureMemoryBytes(memoryForRenderSurfacesMetric); + + m_contentsTextureManager->prioritizeTextures(); +} + +size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateList) +{ size_t readbackBytes = 0; size_t maxBackgroundTextureBytes = 0; size_t contentsTextureBytes = 0; @@ -529,7 +552,7 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) LayerChromium* renderSurfaceLayer = updateList[i].get(); RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); - size_t bytes = TextureManager::memoryUseBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA); + size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA); contentsTextureBytes += bytes; if (renderSurface->backgroundFilters().isEmpty()) @@ -538,11 +561,9 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) if (bytes > maxBackgroundTextureBytes) maxBackgroundTextureBytes = bytes; if (!readbackBytes) - readbackBytes = TextureManager::memoryUseBytes(m_deviceViewportSize, GraphicsContext3D::RGBA); + readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GraphicsContext3D::RGBA); } - size_t renderSurfacesBytes = readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; - - m_contentsTextureManager->prioritizeTextures(renderSurfacesBytes); + return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; } bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, CCTextureUpdater& updater) @@ -574,7 +595,9 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList bool needMoreUpdates = false; bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off. CCOcclusionTracker occlusionTracker(IntRect(IntPoint(), deviceViewportSize()), recordMetricsForFrame); - occlusionTracker.setMinimumTrackingSize(CCOcclusionTracker::preferredMinimumTrackingSize()); + occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize); + + prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics()); CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { @@ -592,8 +615,6 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList occlusionTracker.leaveLayer(it); } - occlusionTracker.overdrawMetrics().didUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes()); - occlusionTracker.overdrawMetrics().didUseRenderSurfaceTextureMemoryBytes(m_contentsTextureManager->memoryForRenderSurfacesBytes()); occlusionTracker.overdrawMetrics().recordMetrics(this); return needMoreUpdates; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index c2143eae5..bd65650f4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -51,7 +51,6 @@ class CCLayerChromium; class CCLayerTreeHostImpl; class CCLayerTreeHostImplClient; class CCTextureUpdater; -class ManagedTexture; class Region; class TextureAllocator; class CCPrioritizedTextureManager; @@ -96,6 +95,7 @@ struct CCLayerTreeSettings { , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) , defaultTileSize(IntSize(256, 256)) , maxUntiledLayerSize(IntSize(512, 512)) + , minimumOcclusionTrackingSize(IntSize(160, 160)) { } bool acceleratePainting; @@ -112,6 +112,7 @@ struct CCLayerTreeSettings { size_t maxPartialTextureUpdates; IntSize defaultTileSize; IntSize maxUntiledLayerSize; + IntSize minimumOcclusionTrackingSize; }; // Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost @@ -284,7 +285,10 @@ private: void updateLayers(LayerChromium*, CCTextureUpdater&); - void prioritizeTextures(const LayerList& updateList); + void prioritizeTextures(const LayerList&, CCOverdrawMetrics&); + void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); + void setPrioritiesForLayers(const LayerList&); + size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); void animateLayers(double monotonicTime); bool animateLayersRecursive(LayerChromium* current, double monotonicTime); @@ -308,6 +312,7 @@ private: RefPtr<LayerChromium> m_rootLayer; OwnPtr<CCPrioritizedTextureManager> m_contentsTextureManager; + OwnPtr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder; CCLayerTreeSettings m_settings; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp index 51ae04802..1c677555a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp @@ -153,7 +153,7 @@ static bool isSurfaceBackFaceVisible(LayerType* layer, const WebTransformationMa } template<typename LayerType> -static IntRect calculateVisibleLayerRect(LayerType* layer) +static IntRect calculateVisibleContentRect(LayerType* layer) { ASSERT(layer->targetRenderSurface()); @@ -176,8 +176,8 @@ static IntRect calculateVisibleLayerRect(LayerType* layer) bounds.height() / static_cast<double>(contentBounds.height())); transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); - IntRect visibleLayerRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform); - return visibleLayerRect; + IntRect visibleContentRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform); + return visibleContentRect; } static bool isScaleOrTranslation(const WebTransformationMatrix& m) @@ -219,7 +219,7 @@ static bool layerShouldBeSkipped(LayerType* layer) // // Some additional conditions need to be computed at a later point after the recursion is finished. // - the intersection of render surface content and layer clipRect is empty - // - the visibleLayerRect is empty + // - the visibleContentRect is empty // // Note, if the layer should not have been drawn due to being fully transparent, // we would have skipped the entire subtree and never made it into this function, @@ -261,6 +261,11 @@ static inline bool subtreeShouldBeSkipped(LayerChromium* layer) template<typename LayerType> static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlignedWithRespectToParent) { + // The root layer has a special render surface that is set up externally, so + // it shouldn't be treated as a surface in this code. + if (!layer->parent()) + return false; + // Cache this value, because otherwise it walks the entire subtree several times. bool descendantDrawsContent = layer->descendantDrawsContent(); @@ -833,7 +838,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay } // FIXME: Instead of using the following function to set visibility rects on a second -// tree pass, revise calculateVisibleLayerRect() so that this can be done in a single +// tree pass, revise calculateVisibleContentRect() so that this can be done in a single // pass inside calculateDrawTransformsInternal<>(). template<typename LayerType, typename LayerList, typename RenderSurfaceType> static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfaceLayerList, const FloatRect& rootScissorRect) @@ -846,13 +851,13 @@ static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfa if (it.representsTargetRenderSurface()) { LayerType* maskLayer = it->maskLayer(); if (maskLayer) - maskLayer->setVisibleLayerRect(IntRect(IntPoint(), it->contentBounds())); + maskLayer->setVisibleContentRect(IntRect(IntPoint(), it->contentBounds())); LayerType* replicaMaskLayer = it->replicaLayer() ? it->replicaLayer()->maskLayer() : 0; if (replicaMaskLayer) - replicaMaskLayer->setVisibleLayerRect(IntRect(IntPoint(), it->contentBounds())); + replicaMaskLayer->setVisibleContentRect(IntRect(IntPoint(), it->contentBounds())); } else if (it.representsItself()) { - IntRect visibleLayerRect = calculateVisibleLayerRect(*it); - it->setVisibleLayerRect(visibleLayerRect); + IntRect visibleContentRect = calculateVisibleContentRect(*it); + it->setVisibleContentRect(visibleContentRect); IntRect scissorRect = calculateLayerScissorRect<LayerType, RenderSurfaceType>(*it, rootScissorRect); it->setScissorRect(scissorRect); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 26a09e70f..ada3c8e3b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -42,6 +42,7 @@ #include "cc/CCLayerTreeHostCommon.h" #include "cc/CCOverdrawMetrics.h" #include "cc/CCPageScaleAnimation.h" +#include "cc/CCPrioritizedTextureManager.h" #include "cc/CCRenderPassDrawQuad.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" @@ -122,7 +123,7 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC , m_deviceScaleFactor(1) , m_visible(true) , m_contentsTexturesWerePurgedSinceLastCommit(false) - , m_memoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize())) + , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) , m_headsUpDisplay(CCHeadsUpDisplay::create()) , m_pageScale(1) , m_pageScaleDelta(1) @@ -295,17 +296,16 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) CCLayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceIndex]; CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); - // FIXME: Make this unique across all CCLayerTreeHostImpls. - int globalRenderPassId = renderSurfaceLayer->id(); - - OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, globalRenderPassId); + int renderPassId = renderSurfaceLayer->id(); + OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, renderPassId); surfacePassMap.add(renderSurface, pass.get()); - frame.renderPasses.append(pass.release()); + frame.renderPasses.append(pass.get()); + frame.renderPassesById.add(renderPassId, pass.release()); } bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off. CCOcclusionTrackerImpl occlusionTracker(enclosingIntRect(m_rootScissorRect), recordMetricsForFrame); - occlusionTracker.setMinimumTrackingSize(CCOcclusionTrackerImpl::preferredMinimumTrackingSize()); + occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize); if (settings().showOccludingRects) occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingScreenSpaceRects); @@ -329,7 +329,7 @@ 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->visibleLayerRect()) && !it->visibleLayerRect().isEmpty() && !it->scissorRect().isEmpty()) { + } 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); @@ -406,19 +406,26 @@ IntSize CCLayerTreeHostImpl::contentSize() const return m_rootScrollLayerImpl->children()[0]->contentBounds(); } -// static -void CCLayerTreeHostImpl::removeRenderPassesRecursive(CCRenderPassList& passes, size_t bottomPass, const CCRenderPass* firstToRemove, CCRenderPassList& skippedPasses) +static inline CCRenderPass* findRenderPassById(int renderPassId, const CCLayerTreeHostImpl::FrameData& frame) +{ + CCRenderPassIdHashMap::const_iterator it = frame.renderPassesById.find(renderPassId); + ASSERT(it != frame.renderPassesById.end()); + return it->second.get(); +} + +static void removeRenderPassesRecursive(int removeRenderPassId, CCLayerTreeHostImpl::FrameData& frame) { - size_t removeIndex = passes.find(firstToRemove); + CCRenderPass* removeRenderPass = findRenderPassById(removeRenderPassId, frame); + size_t removeIndex = frame.renderPasses.find(removeRenderPass); // The pass was already removed by another quad - probably the original, and we are the replica. if (removeIndex == notFound) return; - OwnPtr<CCRenderPass> removedPass = passes[removeIndex].release(); - passes.remove(removeIndex); + const CCRenderPass* removedPass = frame.renderPasses[removeIndex]; + frame.renderPasses.remove(removeIndex); - // Now follow up for all RenderPass quads and remove their render passes recursively. + // Now follow up for all RenderPass quads and remove their RenderPasses recursively. const CCQuadList& quadList = removedPass->quadList(); CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); for (; quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { @@ -426,36 +433,32 @@ void CCLayerTreeHostImpl::removeRenderPassesRecursive(CCRenderPassList& passes, if (currentQuad->material() != CCDrawQuad::RenderPass) continue; - CCRenderPassDrawQuad* renderPassQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); - const CCRenderPass* nextRenderPass = renderPassQuad->renderPass(); - - // Our search is now limited up to the pass that we just removed. - // Substitute removeIndex for bottomPass now. - removeRenderPassesRecursive(passes, removeIndex, nextRenderPass, skippedPasses); + int nextRemoveRenderPassId = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); + removeRenderPassesRecursive(nextRemoveRenderPassId, frame); } - skippedPasses.append(removedPass.release()); } -bool CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad& quad) const +bool CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData&) const { return quad.contentsChangedSinceLastFrame().isEmpty() && m_renderer.haveCachedResourcesForRenderPassId(quad.renderPassId()); } -bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const CCRenderPassList& passList, const CCRenderPassDrawQuad& quad) const +bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData& frame) const { - size_t passIndex = passList.find(quad.renderPass()); + const CCRenderPass* renderPass = findRenderPassById(quad.renderPassId(), frame); + size_t passIndex = frame.renderPasses.find(renderPass); ASSERT(passIndex != notFound); // If any quad or RenderPass draws into this RenderPass, then keep it. - const CCQuadList& quadList = passList[passIndex]->quadList(); + const CCQuadList& quadList = frame.renderPasses[passIndex]->quadList(); for (CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { CCDrawQuad* currentQuad = quadListIterator->get(); if (currentQuad->material() != CCDrawQuad::RenderPass) return false; - const CCRenderPassDrawQuad* quadInPass = static_cast<CCRenderPassDrawQuad*>(currentQuad); - if (passList.contains(quadInPass->renderPass())) + const CCRenderPass* contributingPass = findRenderPassById(CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(), frame); + if (frame.renderPasses.contains(contributingPass)) return false; } return true; @@ -470,7 +473,7 @@ template<typename RenderPassCuller> void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& frame) { for (size_t it = culler.renderPassListBegin(frame.renderPasses); it != culler.renderPassListEnd(frame.renderPasses); it = culler.renderPassListNext(it)) { - CCRenderPass* currentPass = frame.renderPasses[it].get(); + const CCRenderPass* currentPass = frame.renderPasses[it]; const CCQuadList& quadList = currentPass->quadList(); CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); @@ -481,7 +484,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& continue; CCRenderPassDrawQuad* renderPassQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); - if (!culler.shouldRemoveRenderPass(frame.renderPasses, *renderPassQuad)) + if (!culler.shouldRemoveRenderPass(*renderPassQuad, frame)) continue; // We are changing the vector in the middle of iteration. Because we @@ -490,7 +493,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& // change. So, capture the iterator position from the end of the // list, and restore it after the change. int positionFromEnd = frame.renderPasses.size() - it; - removeRenderPassesRecursive(frame.renderPasses, it, renderPassQuad->renderPass(), frame.skippedPasses); + removeRenderPassesRecursive(renderPassQuad->renderPassId(), frame); it = frame.renderPasses.size() - positionFromEnd; ASSERT(it >= 0); } @@ -504,6 +507,7 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) frame.renderSurfaceLayerList = &m_renderSurfaceLayerList; frame.renderPasses.clear(); + frame.renderPassesById.clear(); frame.renderSurfaceLayerList->clear(); frame.willDrawLayers.clear(); @@ -542,13 +546,13 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) // RenderWidget. // The root RenderPass is the last one to be drawn. - CCRenderPass* rootRenderPass = frame.renderPasses.last().get(); + const CCRenderPass* rootRenderPass = frame.renderPasses.last(); m_fpsCounter->markBeginningOfFrame(currentTime()); m_layerRenderer->beginDrawingFrame(rootRenderPass); for (size_t i = 0; i < frame.renderPasses.size(); ++i) { - CCRenderPass* renderPass = frame.renderPasses[i].get(); + const CCRenderPass* renderPass = frame.renderPasses[i]; FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(m_rootScissorRect); m_layerRenderer->drawRenderPass(renderPass, rootScissorRectInCurrentSurface); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index 49f2fc62b..753aa384a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -85,7 +85,7 @@ public: struct FrameData { Vector<IntRect> occludingScreenSpaceRects; CCRenderPassList renderPasses; - CCRenderPassList skippedPasses; + CCRenderPassIdHashMap renderPassesById; CCLayerList* renderSurfaceLayerList; CCLayerList willDrawLayers; }; @@ -180,7 +180,7 @@ public: class CullRenderPassesWithCachedTextures { public: - bool shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad&) const; + bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const; // Iterates from the root first, in order to remove the surfaces closest // to the root with cached textures, and all surfaces that draw into @@ -196,7 +196,7 @@ public: class CullRenderPassesWithNoQuads { public: - bool shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad&) const; + bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const; // Iterates in draw order, so that when a surface is removed, and its // target becomes empty, then its target can be removed also. @@ -244,8 +244,6 @@ private: void setBackgroundTickingEnabled(bool); IntSize contentSize() const; - static void removeRenderPassesRecursive(CCRenderPassList& passes, size_t bottomPass, const CCRenderPass* firstToRemove, CCRenderPassList& skippedPasses); - void sendDidLoseContextRecursive(CCLayerImpl*); void clearRenderSurfaces(); bool ensureRenderSurfaceLayerList(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp index b49ff9083..6124ddc9c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp @@ -310,10 +310,10 @@ static inline WebTransformationMatrix contentToTargetSurfaceTransform(const Laye template<typename LayerType> static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const IntRect& scissorRect, const IntSize& minimumTrackingSize, Vector<IntRect>* occludingScreenSpaceRects) { - ASSERT(layer->visibleLayerRect().contains(opaqueContents.bounds())); + ASSERT(layer->visibleContentRect().contains(opaqueContents.bounds())); bool clipped; - FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleLayerRect()), clipped); + FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped); // FIXME: Find a rect interior to each transformed quad. if (clipped || !visibleTransformedQuad.isRectilinear()) return; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h index 027fab71d..0ca966d96 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h @@ -70,8 +70,6 @@ public: void setMinimumTrackingSize(const IntSize& size) { m_minimumTrackingSize = size; } - static IntSize preferredMinimumTrackingSize() { return IntSize(160, 160); } - // The following is used for visualization purposes. void setOccludingScreenSpaceRectsContainer(Vector<IntRect>* rects) { m_occludingScreenSpaceRects = rects; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp index d8cc17485..1df771386 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp @@ -29,6 +29,7 @@ #include "CCPrioritizedTextureManager.h" #include "CCPriorityCalculator.h" #include "LayerRendererChromium.h" +#include "TextureAllocator.h" #include <algorithm> using namespace std; @@ -38,16 +39,17 @@ namespace WebCore { CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format) : m_size(size) , m_format(format) - , m_memorySizeBytes(0) + , m_bytes(0) , m_priority(CCPriorityCalculator::lowestPriority()) , m_isAbovePriorityCutoff(false) - , m_currentBacking(0) + , m_isSelfManaged(false) + , m_backing(0) , m_manager(0) { // m_manager is set in registerTexture() so validity can be checked. ASSERT(format || size.isEmpty()); if (format) - m_memorySizeBytes = TextureManager::memoryUseBytes(size, format); + m_bytes = CCTexture::memorySizeBytes(size, format); if (manager) manager->registerTexture(this); } @@ -74,8 +76,8 @@ void CCPrioritizedTexture::setDimensions(IntSize size, GC3Denum format) m_isAbovePriorityCutoff = false; m_format = format; m_size = size; - m_memorySizeBytes = TextureManager::memoryUseBytes(size, format); - ASSERT(m_manager || !m_currentBacking); + m_bytes = CCTexture::memorySizeBytes(size, format); + ASSERT(m_manager || !m_backing); if (m_manager) m_manager->returnBackingTexture(this); } @@ -97,8 +99,8 @@ void CCPrioritizedTexture::acquireBackingTexture(TextureAllocator* allocator) unsigned CCPrioritizedTexture::textureId() { - if (m_currentBacking) - return m_currentBacking->textureId(); + if (m_backing) + return m_backing->id(); return 0; } @@ -107,7 +109,7 @@ void CCPrioritizedTexture::bindTexture(CCGraphicsContext* context, TextureAlloca ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) acquireBackingTexture(allocator); - ASSERT(m_currentBacking); + ASSERT(m_backing); WebKit::WebGraphicsContext3D* context3d = context->context3D(); if (!context3d) { // FIXME: Implement this path for software compositing. @@ -121,7 +123,7 @@ void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, Text ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) acquireBackingTexture(allocator); - ASSERT(m_currentBacking); + ASSERT(m_backing); WebKit::WebGraphicsContext3D* context3d = context->context3D(); if (!context3d) { // FIXME: Implement this path for software compositing. @@ -130,11 +132,30 @@ void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, Text context3d->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId(), 0); } -void CCPrioritizedTexture::setCurrentBacking(CCPrioritizedTexture::Backing* backing) +void CCPrioritizedTexture::link(Backing* backing) { - if (m_currentBacking == backing) - return; - m_currentBacking = backing; + ASSERT(backing); + ASSERT(!backing->m_owner); + ASSERT(!m_backing); + + m_backing = backing; + m_backing->m_owner = this; +} + +void CCPrioritizedTexture::unlink() +{ + ASSERT(m_backing); + ASSERT(m_backing->m_owner == this); + + m_backing->m_owner = 0; + m_backing = 0; +} + +void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) +{ + setDimensions(IntSize(), GraphicsContext3D::RGBA); + setIsSelfManaged(true); + m_bytes = bytes; } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h index 9ea2fb1e4..46073c5f3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h @@ -26,16 +26,17 @@ #define CCPrioritizedTexture_h #include "CCPriorityCalculator.h" +#include "CCTexture.h" #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" -#include "TextureManager.h" namespace WebCore { class CCPrioritizedTextureManager; class CCPriorityCalculator; class CCGraphicsContext; +class TextureAllocator; class CCPrioritizedTexture { WTF_MAKE_NONCOPYABLE(CCPrioritizedTexture); @@ -57,7 +58,7 @@ public: void setDimensions(IntSize, GC3Denum format); GC3Denum format() const { return m_format; } IntSize size() const { return m_size; } - size_t memorySizeBytes() const { return m_memorySizeBytes; } + size_t bytes() const { return m_bytes; } // Set priority for the requested texture. void setRequestPriority(int priority) { m_priority = priority; } @@ -68,12 +69,12 @@ public: bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; } // This returns whether we still have a backing texture. This can continue - // to be true even after canAquireBackingTexture() becomes false. In this + // to be true even after canAcquireBackingTexture() becomes false. In this // case the texture can be used but shouldn't be updated since it will get // taken away "soon". - bool haveBackingTexture() const { return !!currentBacking(); } + bool haveBackingTexture() const { return !!backing(); } - // If canAquireBackingTexture() is true acquireBackingTexture() will acquire + // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire // a backing texture for use. Call this whenever the texture is actually needed. void acquireBackingTexture(TextureAllocator*); @@ -81,48 +82,39 @@ public: // (all textures are visible) but we can still squeeze into the limit // by not painting occluded textures. In this case the manager // refuses all visible textures and requestLate() will enable - // canAquireBackingTexture() on a call-order basis. We might want to + // canAcquireBackingTexture() on a call-order basis. We might want to // just remove this in the future (carefully) and just make sure we don't // regress OOMs situations. bool requestLate(); - // These functions will aquire the texture if possible. If neither haveBackingTexture() - // nor canAquireBackingTexture() is true, an ID of zero will be used/returned. + // 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(); + // Self-managed textures are accounted for when prioritizing other textures, + // but they are not allocated/recycled/deleted, so this needs to be done + // externally. canAcquireBackingTexture() indicates if the texture would have + // been allowed given its priority. + void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged; } + bool isSelfManaged() { return m_isSelfManaged; } + void setToSelfManagedMemoryPlaceholder(size_t bytes); + private: friend class CCPrioritizedTextureManager; - class Backing { + class Backing : public CCTexture { WTF_MAKE_NONCOPYABLE(Backing); public: - IntSize size() const { return m_size; } - GC3Denum format() const { return m_format; } - size_t memorySizeBytes() const { return m_memorySizeBytes; } - unsigned textureId() const { return m_textureId; } - CCPrioritizedTexture* currentTexture() const { return m_currentTexture; } - void setCurrentTexture(CCPrioritizedTexture* current) { m_currentTexture = current; } + Backing(unsigned id, IntSize size, GC3Denum format) + : CCTexture(id, size, format), m_owner(0) { } + ~Backing() { ASSERT(!m_owner); } + CCPrioritizedTexture* owner() { return m_owner; } private: - friend class CCPrioritizedTextureManager; - - Backing(IntSize size, GC3Denum format, unsigned textureId) - : m_size(size) - , m_format(format) - , m_memorySizeBytes(TextureManager::memoryUseBytes(size, format)) - , m_textureId(textureId) - , m_priority(CCPriorityCalculator::lowestPriority()) - , m_currentTexture(0) { } - ~Backing() { ASSERT(!m_currentTexture); } - - IntSize m_size; - GC3Denum m_format; - size_t m_memorySizeBytes; - unsigned m_textureId; - int m_priority; - CCPrioritizedTexture* m_currentTexture; + friend class CCPrioritizedTexture; + CCPrioritizedTexture* m_owner; }; CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format); @@ -131,17 +123,19 @@ private: void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; } void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; } - Backing* currentBacking() const { return m_currentBacking; } - void setCurrentBacking(Backing*); + Backing* backing() const { return m_backing; } + void link(Backing*); + void unlink(); IntSize m_size; GC3Denum m_format; - size_t m_memorySizeBytes; + size_t m_bytes; size_t m_priority; bool m_isAbovePriorityCutoff; + bool m_isSelfManaged; - Backing* m_currentBacking; + Backing* m_backing; CCPrioritizedTextureManager* m_manager; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp index 5af53df04..d19e5aa19 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp @@ -55,7 +55,7 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager() destroyBacking(*m_backings.begin(), 0); } -void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemoryBytes) +void CCPrioritizedTextureManager::prioritizeTextures() { TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures"); @@ -79,31 +79,29 @@ void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemory m_memoryAvailableBytes = m_maxMemoryLimitBytes; m_priorityCutoff = CCPriorityCalculator::lowestPriority(); - bool reservedRenderSurfaces = false; size_t memoryBytes = 0; for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) { if ((*it)->requestPriority() == CCPriorityCalculator::lowestPriority()) break; - // FIXME: We can make placeholder objects similar to textures to represent the render surface memory request. - if (!reservedRenderSurfaces && CCPriorityCalculator::priorityIsLower((*it)->requestPriority(), CCPriorityCalculator::renderSurfacePriority())) { - size_t newMemoryBytes = memoryBytes + renderSurfacesMemoryBytes; + if ((*it)->isSelfManaged()) { + // Account for self-managed memory immediately by reducing the memory + // available (since it never gets acquired). + size_t newMemoryBytes = memoryBytes + (*it)->bytes(); if (newMemoryBytes > m_memoryAvailableBytes) { m_priorityCutoff = (*it)->requestPriority(); m_memoryAvailableBytes = memoryBytes; break; } - m_memoryAvailableBytes -= renderSurfacesMemoryBytes; - reservedRenderSurfaces = true; - } - - size_t newMemoryBytes = memoryBytes + (*it)->memorySizeBytes(); - if (newMemoryBytes > m_memoryAvailableBytes) { - m_priorityCutoff = (*it)->requestPriority(); - break; + m_memoryAvailableBytes -= (*it)->bytes(); + } else { + size_t newMemoryBytes = memoryBytes + (*it)->bytes(); + if (newMemoryBytes > m_memoryAvailableBytes) { + m_priorityCutoff = (*it)->requestPriority(); + break; + } + memoryBytes = newMemoryBytes; } - - memoryBytes = newMemoryBytes; } // Only allow textures if they are higher than the cutoff. All textures @@ -113,8 +111,8 @@ void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemory for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) { bool isAbovePriorityCutoff = CCPriorityCalculator::priorityIsHigher((*it)->requestPriority(), m_priorityCutoff); (*it)->setAbovePriorityCutoff(isAbovePriorityCutoff); - if (isAbovePriorityCutoff) - m_memoryAboveCutoffBytes += (*it)->memorySizeBytes(); + if (isAbovePriorityCutoff && !(*it)->isSelfManaged()) + m_memoryAboveCutoffBytes += (*it)->bytes(); } ASSERT(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes); @@ -157,23 +155,24 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) if (CCPriorityCalculator::priorityIsLower(texture->requestPriority(), m_priorityCutoff)) return false; - size_t newMemoryBytes = m_memoryAboveCutoffBytes + texture->memorySizeBytes(); + size_t newMemoryBytes = m_memoryAboveCutoffBytes + texture->bytes(); if (newMemoryBytes > m_memoryAvailableBytes) return false; m_memoryAboveCutoffBytes = newMemoryBytes; texture->setAbovePriorityCutoff(true); - if (texture->currentBacking()) { - m_backings.remove(texture->currentBacking()); - m_backings.add(texture->currentBacking()); + if (texture->backing()) { + m_backings.remove(texture->backing()); + m_backings.add(texture->backing()); } return true; } void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, TextureAllocator* allocator) { + ASSERT(!texture->isSelfManaged()); ASSERT(texture->isAbovePriorityCutoff()); - if (texture->currentBacking() || !texture->isAbovePriorityCutoff()) + if (texture->backing() || !texture->isAbovePriorityCutoff()) return; // Find a backing below, by either recycling or allocating. @@ -181,7 +180,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex // First try to recycle for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()) + if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) break; if ((*it)->size() == texture->size() && (*it)->format() == texture->format()) { backing = (*it); @@ -191,14 +190,14 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex // Otherwise reduce memory and just allocate a new backing texures. if (!backing) { - reduceMemory(m_memoryAvailableBytes - texture->memorySizeBytes(), allocator); + reduceMemory(m_memoryAvailableBytes - texture->bytes(), allocator); backing = createBacking(texture->size(), texture->format(), allocator); } // Move the used backing texture to the end of the eviction list. - if (backing->currentTexture()) - unlink(backing->currentTexture(), backing); - link(texture, backing); + if (backing->owner()) + backing->owner()->unlink(); + texture->link(backing); m_backings.remove(backing); m_backings.add(backing); } @@ -211,7 +210,7 @@ void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, TextureAllocat // or until all backings remaining are above the cutoff. while (memoryUseBytes() > limitBytes && m_backings.size() > 0) { BackingSet::iterator it = m_backings.begin(); - if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()) + if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) break; destroyBacking((*it), allocator); } @@ -229,9 +228,9 @@ void CCPrioritizedTextureManager::reduceMemory(TextureAllocator* allocator) // backing textures (any more than 10%). size_t wastedMemory = 0; for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture()) + if ((*it)->owner()) break; - wastedMemory += (*it)->memorySizeBytes(); + wastedMemory += (*it)->bytes(); } size_t tenPercentOfMemory = m_memoryAvailableBytes / 10; if (wastedMemory <= tenPercentOfMemory) @@ -244,8 +243,8 @@ void CCPrioritizedTextureManager::clearAllMemory(TextureAllocator* allocator) // Unlink and destroy all backing textures. while (m_backings.size() > 0) { BackingSet::iterator it = m_backings.begin(); - if ((*it)->currentTexture()) - unlink((*it)->currentTexture(), (*it)); + if ((*it)->owner()) + (*it)->owner()->unlink(); destroyBacking((*it), allocator); } } @@ -258,32 +257,11 @@ void CCPrioritizedTextureManager::allBackingTexturesWereDeleted() clearAllMemory(0); } -void CCPrioritizedTextureManager::unlink(CCPrioritizedTexture* texture, CCPrioritizedTexture::Backing* backing) -{ - ASSERT(texture && backing); - ASSERT(texture->currentBacking() == backing); - ASSERT(backing->currentTexture() == texture); - - texture->setCurrentBacking(0); - backing->setCurrentTexture(0); -} - -void CCPrioritizedTextureManager::link(CCPrioritizedTexture* texture, CCPrioritizedTexture::Backing* backing) -{ - ASSERT(texture && backing); - ASSERT(!texture->currentBacking()); - ASSERT(!backing->currentTexture()); - - texture->setCurrentBacking(backing); - backing->setCurrentTexture(texture); -} - - void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) { ASSERT(texture); ASSERT(!texture->textureManager()); - ASSERT(!texture->currentBacking()); + ASSERT(!texture->backing()); ASSERT(m_textures.find(texture) == m_textures.end()); texture->setManagerInternal(this); @@ -305,11 +283,11 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture) { - if (texture->currentBacking()) { + if (texture->backing()) { // Move the backing texture to the front for eviction/recycling and unlink it. - m_backings.remove(texture->currentBacking()); - m_backings.insertBefore(m_backings.begin(), texture->currentBacking()); - unlink(texture, texture->currentBacking()); + m_backings.remove(texture->backing()); + m_backings.insertBefore(m_backings.begin(), texture->backing()); + texture->unlink(); } } @@ -317,9 +295,8 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz { ASSERT(allocator); - unsigned textureId = allocator->createTexture(size, format); - CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(size, format, textureId); - m_memoryUseBytes += backing->memorySizeBytes(); + CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(allocator->createTexture(size, format), 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; @@ -328,14 +305,15 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, TextureAllocator* allocator) { ASSERT(backing); - ASSERT(!backing->currentTexture() || !backing->currentTexture()->isAbovePriorityCutoff()); + 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->textureId(), backing->size(), backing->format()); - if (backing->currentTexture()) - unlink(backing->currentTexture(), backing); - m_memoryUseBytes -= backing->memorySizeBytes(); + allocator->deleteTexture(backing->id(), backing->size(), backing->format()); + if (backing->owner()) + backing->owner()->unlink(); + m_memoryUseBytes -= backing->bytes(); m_backings.remove(backing); delete backing; @@ -351,15 +329,15 @@ void CCPrioritizedTextureManager::assertInvariants() // Backings/textures must be doubly-linked and only to other backings/textures in this manager. for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture()) { - ASSERT(m_textures.find((*it)->currentTexture()) != m_textures.end()); - ASSERT((*it)->currentTexture()->currentBacking() == (*it)); + if ((*it)->owner()) { + ASSERT(m_textures.find((*it)->owner()) != m_textures.end()); + ASSERT((*it)->owner()->backing() == (*it)); } } for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) { - if ((*it)->currentBacking()) { - ASSERT(m_backings.find((*it)->currentBacking()) != m_backings.end()); - ASSERT((*it)->currentBacking()->currentTexture() == (*it)); + if ((*it)->backing()) { + ASSERT(m_backings.find((*it)->backing()) != m_backings.end()); + ASSERT((*it)->backing()->owner() == (*it)); } } @@ -368,10 +346,10 @@ void CCPrioritizedTextureManager::assertInvariants() // reduceMemory will not find all textures available for eviction/recycling). bool reachedProtected = false; for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()) + if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) reachedProtected = true; if (reachedProtected) - ASSERT((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()); + ASSERT((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()); } } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h index 3c70b2b2a..019c45cf4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h @@ -27,10 +27,10 @@ #include "CCPrioritizedTexture.h" #include "CCPriorityCalculator.h" +#include "CCTexture.h" #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" -#include "TextureManager.h" namespace WebCore { @@ -50,18 +50,25 @@ public: } ~CCPrioritizedTextureManager(); + // FIXME (http://crbug.com/137094): This 64MB default is a straggler from the + // old texture manager and is just to give us a default memory allocation before + // we get a callback from the GPU memory manager. We should probaby either: + // - wait for the callback before rendering anything instead + // - push this into the GPU memory manager somehow. + static size_t defaultMemoryAllocationLimit() { return 64 * 1024 * 1024; } + // memoryUseBytes() describes the number of bytes used by existing allocated textures. // memoryAboveCutoffBytes() describes the number of bytes that would be used if all // textures that are above the cutoff were allocated. // memoryUseBytes() <= memoryAboveCutoffBytes() should always be true. size_t memoryUseBytes() const { return m_memoryUseBytes; } size_t memoryAboveCutoffBytes() const { return m_memoryAboveCutoffBytes; } - size_t memoryForRenderSurfacesBytes() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; } + size_t memoryForSelfManagedTextures() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; } void setMaxMemoryLimitBytes(size_t bytes) { m_maxMemoryLimitBytes = bytes; } size_t maxMemoryLimitBytes() const { return m_maxMemoryLimitBytes; } - void prioritizeTextures(size_t renderSurfacesMemoryBytes); + void prioritizeTextures(); void clearPriorities(); bool requestLate(CCPrioritizedTexture*); @@ -91,8 +98,8 @@ private: // Compare backings. Lowest priority first. static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b) { - int priorityA = a->currentTexture() ? a->currentTexture()->requestPriority() : CCPriorityCalculator::lowestPriority(); - int priorityB = b->currentTexture() ? b->currentTexture()->requestPriority() : CCPriorityCalculator::lowestPriority(); + int priorityA = a->owner() ? a->owner()->requestPriority() : CCPriorityCalculator::lowestPriority(); + int priorityB = b->owner() ? b->owner()->requestPriority() : CCPriorityCalculator::lowestPriority(); if (priorityA == priorityB) return a < b; return CCPriorityCalculator::priorityIsLower(priorityA, priorityB); @@ -102,9 +109,6 @@ private: void reduceMemory(size_t limit, TextureAllocator*); - void link(CCPrioritizedTexture*, CCPrioritizedTexture::Backing*); - void unlink(CCPrioritizedTexture*, CCPrioritizedTexture::Backing*); - CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, TextureAllocator*); void destroyBacking(CCPrioritizedTexture::Backing*, TextureAllocator*); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h index 68a225be0..a90a07390 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h @@ -28,7 +28,6 @@ #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" -#include "TextureManager.h" namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 90a6ee60a..b11100af3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -72,7 +72,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(); bool isReplica = false; - surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass); + surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(sharedQuadState.release()); if (!surface->hasReplica()) @@ -81,7 +81,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC // Add replica after the surface so that it appears below the surface. OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(); isReplica = true; - surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass); + surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(replicaSharedQuadState.release()); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 47ae2f747..010a7674b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -27,16 +27,17 @@ #define CCRenderPass_h #include "SkColor.h" +#include "cc/CCDrawQuad.h" #include "cc/CCOcclusionTracker.h" +#include "cc/CCSharedQuadState.h" +#include <wtf/HashMap.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace WebCore { -class CCDrawQuad; class CCLayerImpl; class CCRenderSurface; -class CCSharedQuadState; // A list of CCDrawQuad objects, sorted internally in front-to-back order. class CCQuadList : public Vector<OwnPtr<CCDrawQuad> > { @@ -81,7 +82,8 @@ protected: bool m_hasTransparentBackground; }; -typedef Vector<OwnPtr<CCRenderPass> > CCRenderPassList; +typedef Vector<CCRenderPass*> CCRenderPassList; +typedef HashMap<int, OwnPtr<CCRenderPass> > CCRenderPassIdHashMap; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp index 75bd761d1..59abfbbcc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp @@ -27,26 +27,32 @@ #include "cc/CCRenderPassDrawQuad.h" -#include "cc/CCRenderPass.h" +using WebKit::WebCompositorQuad; namespace WebCore { -PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCRenderPass* renderPass, bool isReplica, 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, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) { - return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPass, isReplica, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); + return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); } -CCRenderPassDrawQuad::CCRenderPassDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCRenderPass* renderPass, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) - : CCDrawQuad(sharedQuadState, CCDrawQuad::RenderPass, quadRect) - , m_renderPass(renderPass) - , m_renderPassId(renderPass->id()) +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) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::RenderPass, quadRect) + , m_renderPassId(renderPassId) , m_isReplica(isReplica) + , m_drawTransform(drawTransform) , m_filters(filters) , m_backgroundFilters(backgroundFilters) , m_maskTextureId(maskTextureId) , m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame) { - ASSERT(m_renderPass); + ASSERT(m_renderPassId > 0); +} + +const CCRenderPassDrawQuad* CCRenderPassDrawQuad::materialCast(const WebKit::WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::RenderPass); + return static_cast<const CCRenderPassDrawQuad*>(quad); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h index b63a76446..a12f204ca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h @@ -26,34 +26,38 @@ #ifndef CCRenderPassDrawQuad_h #define CCRenderPassDrawQuad_h -#include "cc/CCDrawQuad.h" +#include <public/WebCompositorQuad.h> #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class CCRenderPass; -class CCRenderPassDrawQuad : public CCDrawQuad { +class CCRenderPassDrawQuad : public WebKit::WebCompositorQuad { WTF_MAKE_NONCOPYABLE(CCRenderPassDrawQuad); public: - static PassOwnPtr<CCRenderPassDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCRenderPass*, bool isReplica, 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, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); - const CCRenderPass* renderPass() const { return m_renderPass; } int renderPassId() const { return m_renderPassId; } bool isReplica() const { return m_isReplica; } unsigned maskTextureId() const { return m_maskTextureId; } const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; } + // FIXME: This should be removed and we should draw the RenderPass with the quadTransform. + const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } + const WebKit::WebFilterOperations& filters() const { return m_filters; } const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } + static const CCRenderPassDrawQuad* materialCast(const WebKit::WebCompositorQuad*); private: - CCRenderPassDrawQuad(const CCSharedQuadState*, const IntRect&, const CCRenderPass*, bool isReplica, 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, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); - const CCRenderPass* m_renderPass; int m_renderPassId; bool m_isReplica; + WebKit::WebTransformationMatrix m_drawTransform; WebKit::WebFilterOperations m_filters; WebKit::WebFilterOperations m_backgroundFilters; unsigned m_maskTextureId; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index d3a85d2da..8bd46bf00 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -188,13 +188,13 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState() const { bool isOpaque = false; - return CCSharedQuadState::create(originTransform(), drawTransform(), contentRect(), m_scissorRect, drawOpacity(), isOpaque); + return CCSharedQuadState::create(m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState() const { bool isOpaque = false; - return CCSharedQuadState::create(replicaOriginTransform(), replicaDrawTransform(), contentRect(), m_scissorRect, drawOpacity(), isOpaque); + return CCSharedQuadState::create(m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const @@ -203,7 +203,7 @@ FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRec return CCMathUtil::projectClippedRect(inverseScreenSpaceTransform, rootScissorRect); } -void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, const CCRenderPass* renderPass) +void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) { ASSERT(!forReplica || hasReplica()); @@ -232,9 +232,10 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha } int maskTextureId = maskLayer ? maskLayer->contentsTextureId() : 0; + WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); - quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPass, forReplica, filters(), backgroundFilters(), maskTextureId, contentsChangedSinceLastFrame)); + quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters(), backgroundFilters(), maskTextureId, contentsChangedSinceLastFrame)); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index 894ea5aea..5410befed 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -31,6 +31,7 @@ #include "FloatRect.h" #include "IntRect.h" +#include "cc/CCSharedQuadState.h" #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> #include <wtf/Noncopyable.h> @@ -41,7 +42,6 @@ namespace WebCore { class CCDamageTracker; class CCQuadCuller; class CCRenderPass; -class CCSharedQuadState; class CCLayerImpl; class LayerRendererChromium; class TextStream; @@ -130,7 +130,7 @@ public: PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState() const; - void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, const CCRenderPass*); + void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, int renderPassId); FloatRect computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp index 80f831541..b9f75d184 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp @@ -24,10 +24,9 @@ */ #include "config.h" - #include "cc/CCScopedTexture.h" -#include "TextureManager.h" // For TextureAllocator +#include "TextureAllocator.h" namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h index 5a3c4e964..9f7241f51 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h @@ -26,6 +26,7 @@ #ifndef CCScopedTexture_h #define CCScopedTexture_h +#include "TextureAllocator.h" #include "cc/CCTexture.h" #if !ASSERT_DISABLED @@ -34,7 +35,6 @@ namespace WebCore { -class TextureAllocator; class CCScopedTexture : protected CCTexture { WTF_MAKE_NONCOPYABLE(CCScopedTexture); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h index 4540a06f8..79036ddd4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,40 +26,10 @@ #ifndef CCSharedQuadState_h #define CCSharedQuadState_h -#include "FloatQuad.h" -#include "IntRect.h" -#include <public/WebTransformationMatrix.h> -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorSharedQuadState.h> namespace WebCore { - -class CCSharedQuadState { - WTF_MAKE_NONCOPYABLE(CCSharedQuadState); -public: - static PassOwnPtr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque); - - // The transform that quads in a CCDrawQuad should be transformed with. - const WebKit::WebTransformationMatrix& quadTransform() const { return m_quadTransform; } - // The transform that layerRect() should be transformed with. - const WebKit::WebTransformationMatrix& layerTransform() const { return m_layerTransform; } - const IntRect& layerRect() const { return m_layerRect; } - const IntRect& scissorRect() const { return m_scissorRect; } - - float opacity() const { return m_opacity; } - bool isOpaque() const { return m_opaque; } - bool isLayerAxisAlignedIntRect() const; - -private: - CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque); - - WebKit::WebTransformationMatrix m_quadTransform; - WebKit::WebTransformationMatrix m_layerTransform; - IntRect m_layerRect; - IntRect m_scissorRect; - float m_opacity; - bool m_opaque; -}; - +typedef WebKit::WebCompositorSharedQuadState CCSharedQuadState; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h index 83ea34066..b6c0ee025 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,25 +26,10 @@ #ifndef CCSolidColorDrawQuad_h #define CCSolidColorDrawQuad_h -#include "SkColor.h" -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorSolidColorQuad.h> namespace WebCore { - -class CCSolidColorDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCSolidColorDrawQuad); -public: - static PassOwnPtr<CCSolidColorDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor); - - SkColor color() const { return m_color; }; - -private: - CCSolidColorDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor); - - SkColor m_color; -}; - +typedef WebKit::WebCompositorSolidColorQuad CCSolidColorDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h index 3037348d3..a1890611a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h @@ -26,27 +26,10 @@ #ifndef CCStreamVideoDrawQuad_h #define CCStreamVideoDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <public/WebTransformationMatrix.h> -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorStreamVideoQuad.h> namespace WebCore { - -class CCStreamVideoDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCStreamVideoDrawQuad); -public: - static PassOwnPtr<CCStreamVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); - - unsigned textureId() const { return m_textureId; } - const WebKit::WebTransformationMatrix& matrix() const { return m_matrix; } - -private: - CCStreamVideoDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); - - unsigned m_textureId; - WebKit::WebTransformationMatrix m_matrix; -}; - +typedef WebKit::WebCompositorStreamVideoQuad CCStreamVideoDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h index a29610469..0d5d9f768 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h @@ -35,6 +35,10 @@ namespace WebCore { class CCTexture { public: CCTexture() : m_id(0) { } + CCTexture(unsigned id, IntSize size, GC3Denum format) + : m_id(id) + , m_size(size) + , m_format(format) { } unsigned id() const { return m_id; } const IntSize& size() const { return m_size; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h index a4baefa13..28c3d9132 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h @@ -26,32 +26,10 @@ #ifndef CCTextureDrawQuad_h #define CCTextureDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorTextureQuad.h> namespace WebCore { - -class CCTextureDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCTextureDrawQuad); -public: - static PassOwnPtr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); - - unsigned textureId() const { return m_textureId; } - bool premultipliedAlpha() const { return m_premultipliedAlpha; } - FloatRect uvRect() const { return m_uvRect; } - bool flipped() const { return m_flipped; } - - void setNeedsBlending(); - -private: - CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned texture_id, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); - - unsigned m_textureId; - bool m_premultipliedAlpha; - FloatRect m_uvRect; - bool m_flipped; -}; - +typedef WebKit::WebCompositorTextureQuad CCTextureDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp index 3190d82ff..bc1ed75af 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp @@ -39,6 +39,8 @@ using namespace std; namespace WebCore { +static const int kUploadFlushPeriod = 4; + CCTextureUpdater::CCTextureUpdater() : m_entryIndex(0) { @@ -93,12 +95,20 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo uploader->beginUploads(); + int fullUploadCount = 0; 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); + fullUploadCount++; + if (!(fullUploadCount % kUploadFlushPeriod)) + context->flush(); } + // Make sure there are no dangling uploads without a flush. + if (fullUploadCount % kUploadFlushPeriod) + context->flush(); + bool moreUploads = maxIndex < m_fullEntries.size(); ASSERT(m_partialEntries.size() <= count); @@ -116,8 +126,16 @@ 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); + if (!((index+1) % kUploadFlushPeriod)) + context->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(); + uploader->endUploads(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h index 33501a806..d530f4a48 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,44 +26,10 @@ #ifndef CCTileDrawQuad_h #define CCTileDrawQuad_h -#include "GraphicsTypes3D.h" -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorTileQuad.h> namespace WebCore { - -class CCTileDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCTileDrawQuad); -public: - static PassOwnPtr<CCTileDrawQuad> create(const CCSharedQuadState*, 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); - - Platform3DObject textureId() const { return m_textureId; } - IntPoint textureOffset() const { return m_textureOffset; } - IntSize textureSize() const { return m_textureSize; } - GC3Dint textureFilter() const { return m_textureFilter; } - bool swizzleContents() const { return m_swizzleContents; } - - bool leftEdgeAA() const { return m_leftEdgeAA; } - bool topEdgeAA() const { return m_topEdgeAA; } - bool rightEdgeAA() const { return m_rightEdgeAA; } - bool bottomEdgeAA() const { return m_bottomEdgeAA; } - - bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdgeAA() || bottomEdgeAA(); } - -private: - CCTileDrawQuad(const CCSharedQuadState*, 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); - - Platform3DObject m_textureId; - IntPoint m_textureOffset; - IntSize m_textureSize; - GC3Dint m_textureFilter; - bool m_swizzleContents; - bool m_leftEdgeAA; - bool m_topEdgeAA; - bool m_rightEdgeAA; - bool m_bottomEdgeAA; -}; - +typedef WebKit::WebCompositorTileQuad CCTileDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index 564e3696b..1b2108912 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -54,8 +54,6 @@ static const int debugTileBorderMissingTileColorRed = 255; static const int debugTileBorderMissingTileColorGreen = 0; static const int debugTileBorderMissingTileColorBlue = 0; -class ManagedTexture; - class DrawableTile : public CCLayerTilingData::Tile { WTF_MAKE_NONCOPYABLE(DrawableTile); public: @@ -142,13 +140,13 @@ WebTransformationMatrix CCTiledLayerImpl::quadTransform() const void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) { - const IntRect& layerRect = visibleLayerRect(); + const IntRect& contentRect = visibleContentRect(); - if (!m_tiler || m_tiler->hasEmptyBounds() || layerRect.isEmpty()) + if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty()) return; int left, top, right, bottom; - m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); if (hasDebugBorders()) { for (int j = top; j <= bottom; ++j) { @@ -174,7 +172,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta DrawableTile* tile = tileAt(i, j); IntRect tileRect = m_tiler->tileBounds(i, j); IntRect displayRect = tileRect; - tileRect.intersect(layerRect); + tileRect.intersect(contentRect); // Skip empty tiles. if (tileRect.isEmpty()) @@ -189,7 +187,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta } IntRect tileOpaqueRect = tile->opaqueRect(); - tileOpaqueRect.intersect(layerRect); + tileOpaqueRect.intersect(contentRect); // Keep track of how the top left has moved, so the texture can be // offset the same amount. @@ -235,8 +233,8 @@ Region CCTiledLayerImpl::visibleContentOpaqueRegion() const if (m_skipsDraw) return Region(); if (opaque()) - return visibleLayerRect(); - return m_tiler->opaqueRegionInLayerRect(visibleLayerRect()); + return visibleContentRect(); + return m_tiler->opaqueRegionInContentRect(visibleContentRect()); } void CCTiledLayerImpl::didLoseContext() diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index 3e1f58135..cc349c8e5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -35,7 +35,7 @@ #include "LayerTextureSubImage.h" #include "NotImplemented.h" #include "TextStream.h" -#include "TextureManager.h" // For TextureAllocator +#include "TextureAllocator.h" #include "cc/CCGraphicsContext.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCProxy.h" diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index b2e088fcf..cd5db09bc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp index a2d62ba44..43f2e2f6f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp @@ -27,19 +27,27 @@ #include "cc/CCYUVVideoDrawQuad.h" +using WebKit::WebCompositorQuad; + namespace WebCore { -PassOwnPtr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) +PassOwnPtr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) { return adoptPtr(new CCYUVVideoDrawQuad(sharedQuadState, quadRect, yPlane, uPlane, vPlane)); } -CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) - : CCDrawQuad(sharedQuadState, CCDrawQuad::YUVVideoContent, quadRect) +CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::YUVVideoContent, quadRect) , m_yPlane(yPlane) , m_uPlane(uPlane) , m_vPlane(vPlane) { } +const CCYUVVideoDrawQuad* CCYUVVideoDrawQuad::materialCast(const WebKit::WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::YUVVideoContent); + return static_cast<const CCYUVVideoDrawQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h index 0cd758c5b..6684ad897 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h @@ -26,23 +26,24 @@ #ifndef CCYUVVideoDrawQuad_h #define CCYUVVideoDrawQuad_h -#include "cc/CCDrawQuad.h" #include "cc/CCVideoLayerImpl.h" +#include <public/WebCompositorQuad.h> #include <wtf/PassOwnPtr.h> namespace WebCore { -class CCYUVVideoDrawQuad : public CCDrawQuad { +class CCYUVVideoDrawQuad : public WebKit::WebCompositorQuad { WTF_MAKE_NONCOPYABLE(CCYUVVideoDrawQuad); public: - static PassOwnPtr<CCYUVVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); + static PassOwnPtr<CCYUVVideoDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); const CCVideoLayerImpl::FramePlane& yPlane() const { return m_yPlane; } const CCVideoLayerImpl::FramePlane& uPlane() const { return m_uPlane; } const CCVideoLayerImpl::FramePlane& vPlane() const { return m_vPlane; } + static const CCYUVVideoDrawQuad* materialCast(const WebKit::WebCompositorQuad*); private: - CCYUVVideoDrawQuad(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); + CCYUVVideoDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); CCVideoLayerImpl::FramePlane m_yPlane; CCVideoLayerImpl::FramePlane m_uPlane; diff --git a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm index f30b181f6..fbfe6379f 100644 --- a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm +++ b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm @@ -59,13 +59,13 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool isPrinterFon CGFontRef cgFont = 0; loadFont(nsFont, size, m_font, cgFont); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: Chromium: The following code isn't correct for the Chromium port since the sandbox might // have blocked font loading, in which case we'll only have the real loaded font file after the call to loadFont(). { CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font)); m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 m_isCompositeFontReference = traits & kCTFontCompositeTrait; #endif } @@ -150,11 +150,11 @@ void FontPlatformData::setFont(NSFont *font) #endif m_cgFont.adoptCF(cgFont); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 { CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font)); m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 m_isCompositeFontReference = traits & kCTFontCompositeTrait; #endif } @@ -251,7 +251,7 @@ static bool canSetCascadeListForCustomFont() } return systemVersion >= 0x1060; -#elif !defined(BUILDING_ON_LEOPARD) +#elif PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return true; #else return false; diff --git a/Source/WebCore/platform/graphics/filters/FEBlend.cpp b/Source/WebCore/platform/graphics/filters/FEBlend.cpp index aa733d90f..363a75b7f 100644 --- a/Source/WebCore/platform/graphics/filters/FEBlend.cpp +++ b/Source/WebCore/platform/graphics/filters/FEBlend.cpp @@ -24,6 +24,7 @@ #if ENABLE(FILTERS) #include "FEBlend.h" +#include "FEBlendNEON.h" #include "Filter.h" #include "FloatPoint.h" @@ -86,26 +87,12 @@ static inline unsigned char lighten(unsigned char colorA, unsigned char colorB, return ((std::max((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)) / 255); } -void FEBlend::platformApplySoftware() +void FEBlend::platformApplyGeneric(PassRefPtr<Uint8ClampedArray> pixelArrayA, PassRefPtr<Uint8ClampedArray> pixelArrayB, + Uint8ClampedArray* dstPixelArray, unsigned pixelArrayLength) { - FilterEffect* in = inputEffect(0); - FilterEffect* in2 = inputEffect(1); - - ASSERT(m_mode > FEBLEND_MODE_UNKNOWN); - ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN); + RefPtr<Uint8ClampedArray> srcPixelArrayA = pixelArrayA; + RefPtr<Uint8ClampedArray> srcPixelArrayB = pixelArrayB; - Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); - if (!dstPixelArray) - return; - - IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); - RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect); - - IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect()); - RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect); - - unsigned pixelArrayLength = srcPixelArrayA->length(); - ASSERT(pixelArrayLength == srcPixelArrayB->length()); for (unsigned pixelOffset = 0; pixelOffset < pixelArrayLength; pixelOffset += 4) { unsigned char alphaA = srcPixelArrayA->item(pixelOffset + 3); unsigned char alphaB = srcPixelArrayB->item(pixelOffset + 3); @@ -143,6 +130,45 @@ void FEBlend::platformApplySoftware() } } +void FEBlend::platformApplySoftware() +{ + FilterEffect* in = inputEffect(0); + FilterEffect* in2 = inputEffect(1); + + ASSERT(m_mode > FEBLEND_MODE_UNKNOWN); + ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN); + + Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); + if (!dstPixelArray) + return; + + IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); + RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect); + + IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect()); + RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect); + + unsigned pixelArrayLength = srcPixelArrayA->length(); + ASSERT(pixelArrayLength == srcPixelArrayB->length()); + +#if HAVE(ARM_NEON_INTRINSICS) + if (pixelArrayLength >= 8) + platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength); + else { // If there is just one pixel we expand it to two. + ASSERT(pixelArrayLength > 0); + uint32_t sourceA[2] = {0, 0}; + uint32_t sourceBAndDest[2] = {0, 0}; + + sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0]; + sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[0]; + platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8); + reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0]; + } +#else + platformApplyGeneric(srcPixelArrayA, srcPixelArrayB, dstPixelArray, pixelArrayLength); +#endif +} + void FEBlend::dump() { } diff --git a/Source/WebCore/platform/graphics/filters/FEBlend.h b/Source/WebCore/platform/graphics/filters/FEBlend.h index 68cd1d37a..cc72e4aca 100644 --- a/Source/WebCore/platform/graphics/filters/FEBlend.h +++ b/Source/WebCore/platform/graphics/filters/FEBlend.h @@ -45,6 +45,11 @@ public: BlendModeType blendMode() const; bool setBlendMode(BlendModeType); + void platformApplyGeneric(PassRefPtr<Uint8ClampedArray> pixelArrayA, PassRefPtr<Uint8ClampedArray> pixelArrayB, + Uint8ClampedArray* dstPixelArray, unsigned pixelArrayLength); + void platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, + unsigned colorArrayLength); + virtual void platformApplySoftware(); virtual void dump(); diff --git a/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h b/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h new file mode 100644 index 000000000..97418f2c1 --- /dev/null +++ b/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2012 University of Szeged + * Copyright (C) 2012 Gabor Rapcsanyi + * + * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 FEBlendNEON_h +#define FEBlendNEON_h + +#include <wtf/Platform.h> + +#if ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) + +#include "FEBlend.h" +#include <arm_neon.h> + +namespace WebCore { + +class FEBlendUtilitiesNEON { +public: + static inline uint16x8_t div255(uint16x8_t num, uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t quotient = vshrq_n_u16(num, 8); + uint16x8_t remainder = vaddq_u16(vsubq_u16(num, vmulq_u16(sixteenConst255, quotient)), sixteenConstOne); + return vaddq_u16(quotient, vshrq_n_u16(remainder, 8)); + } + + static inline uint16x8_t normal(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + return vaddq_u16(tmp3, pixelA); + } + + static inline uint16x8_t multiply(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = vaddq_u16(vsubq_u16(sixteenConst255, alphaB), pixelB); + uint16x8_t tmp4 = vmulq_u16(tmp3, pixelA); + uint16x8_t tmp5 = vaddq_u16(tmp2, tmp4); + return div255(tmp5, sixteenConst255, sixteenConstOne); + } + + static inline uint16x8_t screen(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t, uint16x8_t, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vaddq_u16(pixelA, pixelB); + uint16x8_t tmp2 = vmulq_u16(pixelA, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + return vsubq_u16(tmp1, tmp3); + } + + static inline uint16x8_t darken(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + uint16x8_t tmp4 = vaddq_u16(tmp3, pixelA); + + uint16x8_t tmp5 = vsubq_u16(sixteenConst255, alphaB); + uint16x8_t tmp6 = vmulq_u16(tmp5, pixelA); + uint16x8_t tmp7 = div255(tmp6, sixteenConst255, sixteenConstOne); + uint16x8_t tmp8 = vaddq_u16(tmp7, pixelB); + + return vminq_u16(tmp4, tmp8); + } + + static inline uint16x8_t lighten(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + uint16x8_t tmp4 = vaddq_u16(tmp3, pixelA); + + uint16x8_t tmp5 = vsubq_u16(sixteenConst255, alphaB); + uint16x8_t tmp6 = vmulq_u16(tmp5, pixelA); + uint16x8_t tmp7 = div255(tmp6, sixteenConst255, sixteenConstOne); + uint16x8_t tmp8 = vaddq_u16(tmp7, pixelB); + + return vmaxq_u16(tmp4, tmp8); + } +}; + +void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, + unsigned colorArrayLength) +{ + uint8_t* sourcePixelA = reinterpret_cast<uint8_t*>(srcPixelArrayA); + uint8_t* sourcePixelB = reinterpret_cast<uint8_t*>(srcPixelArrayB); + uint8_t* destinationPixel = reinterpret_cast<uint8_t*>(dstPixelArray); + + uint16x8_t sixteenConst255 = vdupq_n_u16(255); + uint16x8_t sixteenConstOne = vdupq_n_u16(1); + + unsigned colorOffset = 0; + while (colorOffset < colorArrayLength) { + unsigned char alphaA1 = srcPixelArrayA[colorOffset + 3]; + unsigned char alphaB1 = srcPixelArrayB[colorOffset + 3]; + unsigned char alphaA2 = srcPixelArrayA[colorOffset + 7]; + unsigned char alphaB2 = srcPixelArrayB[colorOffset + 7]; + + uint16x8_t doubblePixelA = vmovl_u8(vld1_u8(sourcePixelA + colorOffset)); + uint16x8_t doubblePixelB = vmovl_u8(vld1_u8(sourcePixelB + colorOffset)); + uint16x8_t alphaA = vcombine_u16(vdup_n_u16(alphaA1), vdup_n_u16(alphaA2)); + uint16x8_t alphaB = vcombine_u16(vdup_n_u16(alphaB1), vdup_n_u16(alphaB2)); + + uint16x8_t result; + switch (m_mode) { + case FEBLEND_MODE_NORMAL: + result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_MULTIPLY: + result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_SCREEN: + result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_DARKEN: + result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_LIGHTEN: + result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_UNKNOWN: + default: + result = vdupq_n_u16(0); + break; + } + + vst1_u8(destinationPixel + colorOffset, vmovn_u16(result)); + + unsigned char alphaR1 = 255 - ((255 - alphaA1) * (255 - alphaB1)) / 255; + unsigned char alphaR2 = 255 - ((255 - alphaA2) * (255 - alphaB2)) / 255; + + dstPixelArray[colorOffset + 3] = alphaR1; + dstPixelArray[colorOffset + 7] = alphaR2; + + colorOffset += 8; + if (colorOffset > colorArrayLength) { + ASSERT(colorOffset - 4 == colorArrayLength); + colorOffset = colorArrayLength - 8; + } + } +} + +} // namespace WebCore + +#endif // ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) + +#endif // FEBlendNEON_h diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index f2b86b27e..fba8252da 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -1624,7 +1624,7 @@ bool MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin() const bool MediaPlayerPrivateGStreamer::supportsFullscreen() const { -#if defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // See <rdar://problem/7389945> return false; #else diff --git a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp index ea3430aa5..46ff53b4f 100644 --- a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp +++ b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp @@ -19,13 +19,13 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "GdkCairoUtilities.h" #include <wtf/gobject/GOwnPtr.h> #include "GRefPtrGtk.h" #include "MIMETypeRegistry.h" #include <cairo.h> #include <gtk/gtk.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp index cc8efeb43..19a0b9a6d 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp @@ -187,7 +187,8 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run, HarfBuzzShaper shaper(this, run); if (!shaper.shape(&glyphBuffer)) return; - drawGlyphBuffer(gc, run, glyphBuffer, point); + FloatPoint adjustedPoint = shaper.adjustStartPoint(point); + drawGlyphBuffer(gc, run, glyphBuffer, adjustedPoint); #else SkCanvas* canvas = gc->platformContext()->canvas(); ComplexTextController controller(this, run, point.x(), point.y()); diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp index 695531cc1..48b162474 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp @@ -175,31 +175,19 @@ String FontPlatformData::description() const void FontPlatformData::setupPaint(SkPaint* paint) const { - const float ts = m_textSize >= 0 ? m_textSize : 12; + paint->setAntiAlias(m_style.useAntiAlias); + paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); + paint->setEmbeddedBitmapText(m_style.useBitmaps); + paint->setAutohinted(m_style.useAutoHint); + paint->setSubpixelText(m_style.useSubpixelPositioning); + if (m_style.useAntiAlias) + paint->setLCDRenderText(m_style.useSubpixelRendering); - paint->setAntiAlias(m_style.useAntiAlias == FontRenderStyle::NoPreference ? useSkiaAntiAlias : m_style.useAntiAlias); - switch (m_style.useHinting) { - case FontRenderStyle::NoPreference: - paint->setHinting(skiaHinting); - break; - case 0: - paint->setHinting(SkPaint::kNo_Hinting); - break; - default: - paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); - break; - } - - paint->setEmbeddedBitmapText(m_style.useBitmaps == FontRenderStyle::NoPreference ? useSkiaBitmaps : m_style.useBitmaps); + const float ts = m_textSize >= 0 ? m_textSize : 12; paint->setTextSize(SkFloatToScalar(ts)); paint->setTypeface(m_typeface); paint->setFakeBoldText(m_fakeBold); paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0); - paint->setAutohinted(m_style.useAutoHint == FontRenderStyle::NoPreference ? useSkiaAutoHint : m_style.useAutoHint); - paint->setSubpixelText(m_style.useSubpixelPositioning == FontRenderStyle::NoPreference ? useSkiaSubpixelPositioning : m_style.useSubpixelPositioning); - - if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && useSkiaAntiAlias)) - paint->setLCDRenderText(m_style.useSubpixelRendering == FontRenderStyle::NoPreference ? useSkiaSubpixelRendering : m_style.useSubpixelRendering); } SkFontID FontPlatformData::uniqueID() const @@ -272,6 +260,26 @@ HarfbuzzFace* FontPlatformData::harfbuzzFace() const void FontPlatformData::querySystemForRenderStyle() { PlatformSupport::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style); + + // Fix FontRenderStyle::NoPreference to actual styles. + if (m_style.useAntiAlias == FontRenderStyle::NoPreference) + m_style.useAntiAlias = useSkiaAntiAlias; + + if (!m_style.useHinting) + m_style.hintStyle = SkPaint::kNo_Hinting; + else if (m_style.useHinting == FontRenderStyle::NoPreference) + m_style.hintStyle = skiaHinting; + + if (m_style.useBitmaps == FontRenderStyle::NoPreference) + m_style.useBitmaps = useSkiaBitmaps; + if (m_style.useAutoHint == FontRenderStyle::NoPreference) + m_style.useAutoHint = useSkiaAutoHint; + if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference) + m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; + if (m_style.useAntiAlias == FontRenderStyle::NoPreference) + m_style.useAntiAlias = useSkiaAntiAlias; + if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) + m_style.useSubpixelRendering = useSkiaSubpixelRendering; } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h index b4423f400..6f4eca331 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h +++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h @@ -139,6 +139,9 @@ public: HarfbuzzFace* harfbuzzFace() const; #endif + // The returned styles are all actual styles without FontRenderStyle::NoPreference. + const FontRenderStyle& fontRenderStyle() const { return m_style; } + // ------------------------------------------------------------------------- // Global font preferences... diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp index 3eed897ba..68d196df1 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp @@ -32,6 +32,7 @@ #include "HarfBuzzShaper.h" #include "Font.h" +#include "HarfBuzzFace.h" #include "SurrogatePairAwareTextIterator.h" #include "TextRun.h" #include "hb-icu.h" @@ -43,19 +44,47 @@ namespace WebCore { +template<typename T> +class HarfBuzzScopedPtr { +public: + typedef void (*DestroyFunction)(T*); + + HarfBuzzScopedPtr(T* ptr, DestroyFunction destroy) + : m_ptr(ptr) + , m_destroy(destroy) + { + ASSERT(m_destroy); + } + ~HarfBuzzScopedPtr() + { + if (m_ptr) + (*m_destroy)(m_ptr); + } + + T* get() { return m_ptr; } +private: + T* m_ptr; + DestroyFunction m_destroy; +}; + static inline float harfbuzzPositionToFloat(hb_position_t value) { return static_cast<float>(value) / (1 << 16); } -HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(unsigned numCharacters, TextDirection direction, hb_buffer_t* harfbuzzBuffer) - : m_numCharacters(numCharacters) +HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction) + : m_fontData(fontData) + , m_startIndex(startIndex) + , m_numCharacters(numCharacters) , m_direction(direction) { +} + +void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harfbuzzBuffer) +{ m_numGlyphs = hb_buffer_get_length(harfbuzzBuffer); m_glyphs.resize(m_numGlyphs); m_advances.resize(m_numGlyphs); - m_offsets.resize(m_numGlyphs); m_glyphToCharacterIndex.resize(m_numGlyphs); m_logClusters.resize(m_numCharacters); @@ -82,10 +111,9 @@ HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(unsigned numCharacters, TextDirection d } } -void HarfBuzzShaper::HarfBuzzRun::setGlyphAndPositions(unsigned index, uint16_t glyphId, float x, float y, float advance) +void HarfBuzzShaper::HarfBuzzRun::setGlyphAndAdvance(unsigned index, uint16_t glyphId, float advance) { m_glyphs[index] = glyphId; - m_offsets[index].set(x, y); m_advances[index] = advance; } @@ -106,31 +134,49 @@ int HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition(int targetX) return rtl() ? 0 : m_numCharacters; } -int HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset) +float HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset) { ASSERT(offset < m_numCharacters); unsigned glyphIndex = m_logClusters[offset]; - ASSERT(glyphIndex < m_numGlyphs); - float position = m_offsets[glyphIndex].x(); + ASSERT(glyphIndex <= m_numGlyphs); + float position = 0; + for (unsigned i = 0; i < glyphIndex; ++i) + position += m_advances[i]; if (rtl()) position += m_advances[glyphIndex]; - return roundf(position); + return position; +} + +static void normalizeCharacters(const UChar* source, UChar* destination, int length) +{ + int position = 0; + bool error = false; + while (position < length) { + UChar32 character; + int nextPosition = position; + U16_NEXT(source, nextPosition, length, character); + if (Font::treatAsSpace(character)) + character = ' '; + else if (Font::treatAsZeroWidthSpaceInComplexScript(character)) + character = zeroWidthSpace; + U16_APPEND(destination, position, length, character, error); + ASSERT_UNUSED(error, !error); + position = nextPosition; + } } HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run) : HarfBuzzShaperBase(font, run) - , m_startIndexOfCurrentRun(0) - , m_numCharactersOfCurrentRun(0) - , m_harfbuzzBuffer(0) { - setNormalizedBuffer(); + m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); + m_normalizedBufferLength = m_run.length(); + normalizeCharacters(m_run.characters(), m_normalizedBuffer.get(), m_normalizedBufferLength); + setPadding(m_run.expansion()); setFontFeatures(); } HarfBuzzShaper::~HarfBuzzShaper() { - if (m_harfbuzzBuffer) - hb_buffer_destroy(m_harfbuzzBuffer); } void HarfBuzzShaper::setFontFeatures() @@ -152,101 +198,101 @@ void HarfBuzzShaper::setFontFeatures() bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer) { - m_totalWidth = 0; - while (setupHarfBuzzRun()) { - if (!shapeHarfBuzzRun()) - return false; - setGlyphPositionsForHarfBuzzRun(glyphBuffer); - } - - if (!m_harfbuzzRuns.size()) + if (!collectHarfBuzzRuns()) return false; + m_totalWidth = 0; + if (!shapeHarfBuzzRuns(glyphBuffer)) + return false; + m_totalWidth = roundf(m_totalWidth); return true; } -bool HarfBuzzShaper::setupHarfBuzzRun() +FloatPoint HarfBuzzShaper::adjustStartPoint(const FloatPoint& point) { - m_startIndexOfCurrentRun += m_numCharactersOfCurrentRun; + return point + m_startOffset; +} - // Iterate through the text to take the largest range that stays within - // a single font. - int endOfRunIndex = m_normalizedBufferLength - m_startIndexOfCurrentRun; - SurrogatePairAwareTextIterator iterator(m_normalizedBuffer.get() + m_startIndexOfCurrentRun, 0, endOfRunIndex, endOfRunIndex); +bool HarfBuzzShaper::collectHarfBuzzRuns() +{ + SurrogatePairAwareTextIterator iterator(m_normalizedBuffer.get(), 0, m_normalizedBufferLength, m_normalizedBufferLength); UChar32 character; unsigned clusterLength = 0; + unsigned startIndexOfCurrentRun = 0; if (!iterator.consume(character, clusterLength)) return false; - m_currentFontData = m_font->glyphDataForCharacter(character, false).fontData; + const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData; UErrorCode errorCode = U_ZERO_ERROR; - UScriptCode currentScript = uscript_getScript(character, &errorCode); + UScriptCode nextScript = uscript_getScript(character, &errorCode); if (U_FAILURE(errorCode)) return false; - if (currentScript == USCRIPT_INHERITED) - currentScript = USCRIPT_COMMON; - for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) { - const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData; - if (nextFontData != m_currentFontData) - break; - UScriptCode nextScript = uscript_getScript(character, &errorCode); - if (U_FAILURE(errorCode)) - return false; - if (currentScript == nextScript || nextScript == USCRIPT_INHERITED || nextScript == USCRIPT_COMMON) - continue; - if (currentScript == USCRIPT_COMMON) - currentScript = nextScript; - else - break; - } - m_numCharactersOfCurrentRun = iterator.currentCharacter(); - - if (!m_harfbuzzBuffer) { - m_harfbuzzBuffer = hb_buffer_create(); - hb_buffer_set_unicode_funcs(m_harfbuzzBuffer, hb_icu_get_unicode_funcs()); - } else - hb_buffer_reset(m_harfbuzzBuffer); - hb_buffer_set_script(m_harfbuzzBuffer, hb_icu_script_to_script(currentScript)); - - // WebKit always sets direction to LTR during width calculation. - // We only set direction when direction is explicitly set to RTL so that - // preventng wrong width calculation. - if (m_run.rtl()) - hb_buffer_set_direction(m_harfbuzzBuffer, HB_DIRECTION_RTL); - - // Determine whether this run needs to be converted to small caps. - // nextScriptRun() will always send us a run of the same case, because a - // case change while in small-caps mode always results in different - // FontData, so we only need to check the first character's case. - if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[m_startIndexOfCurrentRun])) { - String upperText = String(m_normalizedBuffer.get() + m_startIndexOfCurrentRun, m_numCharactersOfCurrentRun); - upperText.makeUpper(); - m_currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData; - hb_buffer_add_utf16(m_harfbuzzBuffer, upperText.characters(), m_numCharactersOfCurrentRun, 0, m_numCharactersOfCurrentRun); - } else - hb_buffer_add_utf16(m_harfbuzzBuffer, m_normalizedBuffer.get() + m_startIndexOfCurrentRun, m_numCharactersOfCurrentRun, 0, m_numCharactersOfCurrentRun); - return true; + do { + const SimpleFontData* currentFontData = nextFontData; + UScriptCode currentScript = nextScript; + + for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) { + nextFontData = m_font->glyphDataForCharacter(character, false).fontData; + if (nextFontData != currentFontData) + break; + nextScript = uscript_getScript(character, &errorCode); + if (U_FAILURE(errorCode)) + return false; + if ((currentScript != nextScript) && (currentScript != USCRIPT_INHERITED)) + break; + } + unsigned numCharactersOfCurrentRun = iterator.currentCharacter() - startIndexOfCurrentRun; + m_harfbuzzRuns.append(HarfBuzzRun::create(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction())); + currentFontData = nextFontData; + startIndexOfCurrentRun = iterator.currentCharacter(); + } while (iterator.consume(character, clusterLength)); + + return !m_harfbuzzRuns.isEmpty(); } -bool HarfBuzzShaper::shapeHarfBuzzRun() +bool HarfBuzzShaper::shapeHarfBuzzRuns(GlyphBuffer* glyphBuffer) { - FontPlatformData* platformData = const_cast<FontPlatformData*>(&m_currentFontData->platformData()); - HarfBuzzFace* face = platformData->harfbuzzFace(); - if (!face) - return false; - hb_font_t* harfbuzzFont = face->createFont(); - hb_shape(harfbuzzFont, m_harfbuzzBuffer, m_features.size() > 0 ? m_features.data() : 0, m_features.size()); - hb_font_destroy(harfbuzzFont); - m_harfbuzzRuns.append(HarfBuzzRun::create(m_numCharactersOfCurrentRun, m_run.direction(), m_harfbuzzBuffer)); + HarfBuzzScopedPtr<hb_buffer_t> harfbuzzBuffer(hb_buffer_create(), hb_buffer_destroy); + hb_buffer_set_unicode_funcs(harfbuzzBuffer.get(), hb_icu_get_unicode_funcs()); + if (m_run.directionalOverride()) + hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); + + for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) { + unsigned runIndex = m_run.rtl() ? m_harfbuzzRuns.size() - i - 1 : i; + HarfBuzzRun* currentRun = m_harfbuzzRuns[runIndex].get(); + const SimpleFontData* currentFontData = currentRun->fontData(); + + if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) { + String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters()); + upperText.makeUpper(); + currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData; + hb_buffer_add_utf16(harfbuzzBuffer.get(), upperText.characters(), currentRun->numCharacters(), 0, currentRun->numCharacters()); + } else + hb_buffer_add_utf16(harfbuzzBuffer.get(), m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharacters()); + + FontPlatformData* platformData = const_cast<FontPlatformData*>(¤tFontData->platformData()); + HarfBuzzFace* face = platformData->harfbuzzFace(); + if (!face) + return false; + HarfBuzzScopedPtr<hb_font_t> harfbuzzFont(face->createFont(), hb_font_destroy); + hb_shape(harfbuzzFont.get(), harfbuzzBuffer.get(), m_features.isEmpty() ? 0 : m_features.data(), m_features.size()); + + currentRun->applyShapeResult(harfbuzzBuffer.get()); + setGlyphPositionsForHarfBuzzRun(currentRun, i, harfbuzzBuffer.get(), glyphBuffer); + + hb_buffer_reset(harfbuzzBuffer.get()); + if (m_run.directionalOverride()) + hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); + } return true; } -void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(GlyphBuffer* glyphBuffer) +void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, unsigned runIndexInVisualOrder, hb_buffer_t* harfbuzzBuffer, GlyphBuffer* glyphBuffer) { - hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(m_harfbuzzBuffer, 0); - hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(m_harfbuzzBuffer, 0); - HarfBuzzRun* currentRun = m_harfbuzzRuns.last().get(); + const SimpleFontData* currentFontData = currentRun->fontData(); + hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfbuzzBuffer, 0); + hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harfbuzzBuffer, 0); unsigned numGlyphs = currentRun->numGlyphs(); float totalAdvance = 0; @@ -262,26 +308,29 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(GlyphBuffer* glyphBuffer) nextOffsetX = runEnd ? 0 : harfbuzzPositionToFloat(glyphPositions[i + 1].x_offset); nextOffsetY = runEnd ? 0 : -harfbuzzPositionToFloat(glyphPositions[i + 1].y_offset); - unsigned currentCharacterIndex = m_startIndexOfCurrentRun + glyphInfos[i].cluster; + unsigned currentCharacterIndex = currentRun->startIndex() + glyphInfos[i].cluster; bool isClusterEnd = runEnd || glyphInfos[i].cluster != glyphInfos[i + 1].cluster; float spacing = isClusterEnd ? m_letterSpacing : 0; if (isClusterEnd && isWordEnd(currentCharacterIndex)) spacing += determineWordBreakSpacing(); - if (m_currentFontData->isZeroWidthSpaceGlyph(glyph)) { - currentRun->setGlyphAndPositions(i, glyph, 0, 0, 0); + if (currentFontData->isZeroWidthSpaceGlyph(glyph)) { + currentRun->setGlyphAndAdvance(i, glyph, 0); if (glyphBuffer) - glyphBuffer->add(glyph, m_currentFontData, createGlyphBufferAdvance(0, 0)); + glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(0, 0)); continue; } advance += spacing; - currentRun->setGlyphAndPositions(i, glyph, totalAdvance + offsetX, offsetY, advance); + + currentRun->setGlyphAndAdvance(i, glyph, advance); if (glyphBuffer) { + if (!i && !runIndexInVisualOrder) + m_startOffset.set(offsetX, offsetY); float glyphAdvanceX = advance + nextOffsetX - offsetX; float glyphAdvanceY = nextOffsetY - offsetY; - glyphBuffer->add(glyph, m_currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY)); + glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY)); } totalAdvance += advance; @@ -324,37 +373,46 @@ int HarfBuzzShaper::offsetForPosition(float targetX) FloatRect HarfBuzzShaper::selectionRect(const FloatPoint& point, int height, int from, int to) { - int fromX = -1, toX = -1; - int currentX = 0; - // Iterate through the script runs in logical order, searching for the run covering the positions of interest. + float currentX = 0; + float fromX; + float toX; + bool foundFromX = false; + bool foundToX = false; + + if (m_run.rtl()) + currentX = m_totalWidth; for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) { + if (m_run.rtl()) + currentX -= m_harfbuzzRuns[i]->width(); int numCharacters = m_harfbuzzRuns[i]->numCharacters(); - if (fromX == -1 && from >= 0 && from < numCharacters) + if (!foundFromX && from >= 0 && from < numCharacters) { fromX = m_harfbuzzRuns[i]->xPositionForOffset(from) + currentX; - else + foundFromX = true; + } else from -= numCharacters; - if (toX == -1 && to >= 0 && to < numCharacters) + if (!foundToX && to >= 0 && to < numCharacters) { toX = m_harfbuzzRuns[i]->xPositionForOffset(to) + currentX; - else + foundToX = true; + } else to -= numCharacters; - if (fromX != -1 && toX != -1) + if (foundFromX && foundToX) break; - currentX += m_harfbuzzRuns[i]->width(); + if (!m_run.rtl()) + currentX += m_harfbuzzRuns[i]->width(); } // The position in question might be just after the text. - if (fromX == -1) + if (!foundFromX) fromX = 0; - if (toX == -1) + if (!foundToX) toX = m_run.rtl() ? 0 : m_totalWidth; - ASSERT(fromX != -1 && toX != -1); - + // Using floorf() and roundf() as the same as mac port. if (fromX < toX) - return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); - return FloatRect(point.x() + toX, point.y(), fromX - toX, height); + return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - fromX), height); + return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), height); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h index 7beff5d72..eb3935db1 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h @@ -52,6 +52,7 @@ public: virtual ~HarfBuzzShaper(); bool shape(GlyphBuffer* = 0); + FloatPoint adjustStartPoint(const FloatPoint&); float totalWidth() { return m_totalWidth; } int offsetForPosition(float targetX); FloatRect selectionRect(const FloatPoint&, int height, int from, int to); @@ -59,31 +60,37 @@ public: private: class HarfBuzzRun { public: - static PassOwnPtr<HarfBuzzRun> create(unsigned numCharacters, TextDirection direction, hb_buffer_t* buffer) + static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction) { - return adoptPtr(new HarfBuzzRun(numCharacters, direction, buffer)); + return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters, direction)); } - void setGlyphAndPositions(unsigned index, uint16_t glyphId, float x, float y, float); + void applyShapeResult(hb_buffer_t*); + void setGlyphAndAdvance(unsigned index, uint16_t glyphId, float advance); void setWidth(float width) { m_width = width; } int characterIndexForXPosition(int targetX); - int xPositionForOffset(unsigned offset); + float xPositionForOffset(unsigned offset); + const SimpleFontData* fontData() { return m_fontData; } + unsigned startIndex() const { return m_startIndex; } unsigned numCharacters() const { return m_numCharacters; } unsigned numGlyphs() const { return m_numGlyphs; } + uint16_t* glyphs() { return &m_glyphs[0]; } + float* advances() { return &m_advances[0]; } float width() { return m_width; } private: - HarfBuzzRun(unsigned numCharacters, TextDirection, hb_buffer_t*); + HarfBuzzRun(const SimpleFontData*, unsigned startIndex, unsigned numCharacters, TextDirection); bool rtl() { return m_direction == RTL; } + const SimpleFontData* m_fontData; + unsigned m_startIndex; size_t m_numCharacters; unsigned m_numGlyphs; TextDirection m_direction; Vector<uint16_t, 256> m_glyphs; Vector<float, 256> m_advances; - Vector<FloatPoint, 256> m_offsets; Vector<uint16_t, 256> m_logClusters; Vector<uint16_t, 256> m_glyphToCharacterIndex; float m_width; @@ -91,19 +98,17 @@ private: void setFontFeatures(); - bool setupHarfBuzzRun(); - bool shapeHarfBuzzRun(); - void setGlyphPositionsForHarfBuzzRun(GlyphBuffer*); + bool collectHarfBuzzRuns(); + bool shapeHarfBuzzRuns(GlyphBuffer*); + void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, unsigned runIndexInVisualOrder, hb_buffer_t*, GlyphBuffer*); GlyphBufferAdvance createGlyphBufferAdvance(float, float); Vector<hb_feature_t, 4> m_features; - unsigned m_startIndexOfCurrentRun; - unsigned m_numCharactersOfCurrentRun; - const SimpleFontData* m_currentFontData; - hb_buffer_t* m_harfbuzzBuffer; Vector<OwnPtr<HarfBuzzRun>, 16> m_harfbuzzRuns; + FloatPoint m_startOffset; + float m_totalWidth; }; diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp index a9324d37f..f09cb1303 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -33,7 +33,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/unicode/CharacterNames.h> -#if defined(BUILDING_ON_LEOPARD) +#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 diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm index e5304533e..83173db61 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm +++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm @@ -39,7 +39,7 @@ #include <CoreText/CoreText.h> #endif -#if defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // The following symbols are SPI in 10.5. extern "C" { void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); @@ -218,7 +218,7 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 ProviderInfo info = { cp, length, stringAttributes.get() }; RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions)); #else diff --git a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm index 91dd426fe..6b2e05474 100644 --- a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm +++ b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm @@ -52,7 +52,7 @@ static void invalidateFontCache(void*) fontCache()->invalidate(); } -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef) { ASSERT_UNUSED(observer, observer == fontCache()); @@ -69,7 +69,7 @@ static void fontCacheATSNotificationCallback(ATSFontNotificationInfoRef, void*) void FontCache::platformInit() { wkSetUpFontCache(); -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFontsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately); #else // kCTFontManagerRegisteredFontsChangedNotification does not exist on Leopard and earlier. diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp index cfddf363f..d3d872153 100644 --- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp @@ -78,7 +78,7 @@ private: FontCustomPlatformData::~FontCustomPlatformData() { -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (m_atsContainer) ATSFontDeactivate(m_atsContainer, NULL, kATSOptionFlagsDefault); #endif @@ -119,7 +119,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) RetainPtr<CGFontRef> cgFontRef; -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData()); RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get())); @@ -157,7 +157,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); return 0; } -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(containerRef, cgFontRef.leakRef()); #if USE(SKIA_ON_MAC_CHROMIUM) diff --git a/Source/WebCore/platform/graphics/mac/FontMac.mm b/Source/WebCore/platform/graphics/mac/FontMac.mm index 4afb5fbdb..608123cbd 100644 --- a/Source/WebCore/platform/graphics/mac/FontMac.mm +++ b/Source/WebCore/platform/graphics/mac/FontMac.mm @@ -71,7 +71,7 @@ static bool hasBrokenCTFontGetVerticalTranslationsForGlyphs() isCached = true; } return result; -#elif defined(BUILDING_ON_SNOW_LEOPARD) +#elif !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 return true; #else return false; @@ -119,7 +119,7 @@ static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData } else CGContextShowGlyphsWithAdvances(context, glyphs, advances, count); } -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 else { if (!count) return; diff --git a/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm index e08591df4..e3d4f3346 100644 --- a/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm +++ b/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm @@ -129,7 +129,7 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w patternColor = grammarPatternColor.get(); break; } -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) // To support correction panel. case DocumentMarkerAutocorrectionReplacementLineStyle: case DocumentMarkerDictationAlternativesLineStyle: diff --git a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index cd161a3f2..2e849af61 100644 --- a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -267,7 +267,7 @@ void MediaPlayerPrivateQTKit::createQTMovie(const String& url) NSMutableDictionary *movieAttributes = commonMovieAttributes(); [movieAttributes setValue:cocoaURL forKey:QTMovieURLAttribute]; -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings(); CFArrayRef proxiesForURL = CFNetworkCopyProxiesForURL((CFURLRef)cocoaURL, proxySettings); BOOL willUseProxy = YES; @@ -392,7 +392,7 @@ void MediaPlayerPrivateQTKit::createQTMovie(NSURL *url, NSDictionary *movieAttri selector:@selector(didEnd:) name:QTMovieDidEndNotification object:m_qtMovie.get()]; -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(layerHostChanged:) name:@"WebKitLayerHostChanged" @@ -876,7 +876,7 @@ bool MediaPlayerPrivateQTKit::hasAudio() const bool MediaPlayerPrivateQTKit::supportsFullscreen() const { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return true; #else // See <rdar://problem/7389945> @@ -903,7 +903,7 @@ void MediaPlayerPrivateQTKit::setClosedCaptionsVisible(bool closedCaptionsVisibl if (metaDataAvailable()) { wkQTMovieSetShowClosedCaptions(m_qtMovie.get(), closedCaptionsVisible); -#if USE(ACCELERATED_COMPOSITING) && !defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (closedCaptionsVisible && m_qtVideoLayer) { // Captions will be rendered upside down unless we flag the movie as flipped (again). See <rdar://7408440>. [m_qtVideoLayer.get() setGeometryFlipped:YES]; @@ -1001,7 +1001,7 @@ void MediaPlayerPrivateQTKit::cacheMovieScale() NSSize initialSize = NSZeroSize; NSSize naturalSize = [[m_qtMovie.get() attributeForKey:QTMovieNaturalSizeAttribute] sizeValue]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // QTMovieCurrentSizeAttribute is not allowed with instances of QTMovie that have been // opened with QTMovieOpenForPlaybackAttribute, so ask for the display transform attribute instead. NSAffineTransform *displayTransform = [m_qtMovie.get() attributeForKey:@"QTMoviePreferredTransformAttribute"]; @@ -1236,7 +1236,7 @@ void MediaPlayerPrivateQTKit::didEnd() } #if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent) { if (!child || !descendent) @@ -1253,7 +1253,7 @@ static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent) void MediaPlayerPrivateQTKit::layerHostChanged(PlatformLayer* rootLayer) { -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 if (!rootLayer) return; diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index d5d55606d..487591a74 100644 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -82,7 +82,7 @@ static NSString *webFallbackFontFamily(void) } #if !ERROR_DISABLED -#if defined(__LP64__) || (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)) +#if defined(__LP64__) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static NSString* pathFromFont(NSFont*) { // FMGetATSFontRefFromFont is not available. As pathFromFont is only used for debugging purposes, @@ -233,7 +233,7 @@ void SimpleFontData::platformInit() NSString *familyName = [m_platformData.font() familyName]; if ([familyName isEqualToString:@"Times"] || [familyName isEqualToString:@"Helvetica"] || [familyName isEqualToString:@"Courier"]) ascent += floorf(((ascent + descent) * 0.15f) + 0.5f); -#if defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 else if ([familyName isEqualToString:@"Geeza Pro"]) { // Geeza Pro has glyphs that draw slightly above the ascent or far below the descent. Adjust // those vertical metrics to better match reality, so that diacritics at the bottom of one line diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.h b/Source/WebCore/platform/graphics/mac/WebLayer.h index bb0f444bc..1266bb749 100644 --- a/Source/WebCore/platform/graphics/mac/WebLayer.h +++ b/Source/WebCore/platform/graphics/mac/WebLayer.h @@ -36,7 +36,7 @@ namespace WebCore { class PlatformCALayerClient; } -#if defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 @interface CALayer(WebLayerInternal) - (CGAffineTransform)contentsTransform; - (void)setContentsTransform:(CGAffineTransform)t; diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.mm b/Source/WebCore/platform/graphics/mac/WebLayer.mm index 97e9f2882..d783e494a 100644 --- a/Source/WebCore/platform/graphics/mac/WebLayer.mm +++ b/Source/WebCore/platform/graphics/mac/WebLayer.mm @@ -84,7 +84,7 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCA AffineTransform transform = CGContextGetCTM(context); ThemeMac::setFocusRingClipRect(transform.mapRect(clipBounds)); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 __block GraphicsContext* ctx = &graphicsContext; wkCALayerEnumerateRectsBeingDrawnWithBlock(layer, context, ^(CGRect rect){ diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp index 57723560c..5a628810d 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(WEBGL) +#if USE(3D_GRAPHICS) #include "Extensions3DOpenGLCommon.h" #include "ANGLEWebKitBridge.h" @@ -145,4 +145,4 @@ void Extensions3DOpenGLCommon::initializeAvailableExtensions() } // namespace WebCore -#endif // ENABLE(WEBGL) +#endif // USE(3D_GRAPHICS) diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp index e21f559ad..fed5492c6 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp @@ -25,10 +25,11 @@ */ #include "config.h" -#if ENABLE(WEBGL) +#if USE(3D_GRAPHICS) #include "Extensions3DOpenGLES.h" #include "GraphicsContext3D.h" +#include "NotImplemented.h" #include <EGL/egl.h> #include <wtf/Vector.h> @@ -68,6 +69,21 @@ void Extensions3DOpenGLES::renderbufferStorageMultisampleIMG(unsigned long targe m_context->synthesizeGLError(GL_INVALID_OPERATION); } +void Extensions3DOpenGLES::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) +{ + notImplemented(); +} + +void Extensions3DOpenGLES::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) +{ + notImplemented(); +} + +void Extensions3DOpenGLES::copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum) +{ + notImplemented(); +} + Platform3DObject Extensions3DOpenGLES::createVertexArrayOES() { m_context->makeContextCurrent(); @@ -129,8 +145,8 @@ bool Extensions3DOpenGLES::supportsExtension(const String& name) m_glIsVertexArrayOES = reinterpret_cast<PFNGLISVERTEXARRAYOESPROC>(eglGetProcAddress("glIsVertexArrayOES")); m_supportsOESvertexArrayObject = true; } else if (name == "GL_IMG_multisampled_render_to_texture" && !m_supportsIMGMultisampledRenderToTexture) { - m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG")); - m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG")); + m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG")); + m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG")); m_supportsIMGMultisampledRenderToTexture = true; } return true; @@ -146,4 +162,4 @@ String Extensions3DOpenGLES::getExtensions() } // namespace WebCore -#endif // ENABLE(WEBGL) +#endif // USE(3D_GRAPHICS) diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h index 3c460f9e2..c3cc59571 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h @@ -41,6 +41,11 @@ public: virtual void framebufferTexture2DMultisampleIMG(unsigned long target, unsigned long attachment, unsigned long textarget, unsigned int texture, int level, unsigned long samples); virtual void renderbufferStorageMultisampleIMG(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); + // Extension3D methods + virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter); + virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); + virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum); + virtual Platform3DObject createVertexArrayOES(); virtual void deleteVertexArrayOES(Platform3DObject); virtual GC3Dboolean isVertexArrayOES(Platform3DObject); @@ -57,8 +62,8 @@ protected: bool m_supportsOESvertexArrayObject; bool m_supportsIMGMultisampledRenderToTexture; - PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC m_glFramebufferTexture2DMultisampleIMG; - PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC m_glRenderbufferStorageMultisampleIMG; + PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG m_glFramebufferTexture2DMultisampleIMG; + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG m_glRenderbufferStorageMultisampleIMG; PFNGLBINDVERTEXARRAYOESPROC m_glBindVertexArrayOES; PFNGLDELETEVERTEXARRAYSOESPROC m_glDeleteVertexArraysOES; PFNGLGENVERTEXARRAYSOESPROC m_glGenVertexArraysOES; diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp index 6753444f8..fd450141c 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp @@ -284,7 +284,7 @@ void GraphicsContext3D::clearDepth(GC3Dclampf depth) bool GraphicsContext3D::systemAllowsMultisamplingOnATICards() const { #if PLATFORM(MAC) -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 return true; #else ASSERT(isMainThread()); diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp index e4ac6876e..26281909b 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp @@ -34,7 +34,9 @@ #include "Extensions3DOpenGLES.h" #include "IntRect.h" #include "IntSize.h" +#if PLATFORM(BLACKBERRY) #include "LayerWebKitThread.h" +#endif #include "NotImplemented.h" #include "OpenGLESShims.h" @@ -113,6 +115,75 @@ void GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary(int x, int y, int } } +bool GraphicsContext3D::reshapeFBOs(const IntSize& size) +{ + const int width = size.width(); + const int height = size.height(); + GLuint colorFormat = 0, pixelDataType = 0; + if (m_attrs.alpha) { + m_internalColorFormat = GL_RGBA; + colorFormat = GL_RGBA; + pixelDataType = GL_UNSIGNED_BYTE; + } else { + m_internalColorFormat = GL_RGB; + colorFormat = GL_RGB; + pixelDataType = GL_UNSIGNED_SHORT_5_6_5; + } + + // We don't allow the logic where stencil is required and depth is not. + // See GraphicsContext3D::validateAttributes. + bool supportPackedDepthStencilBuffer = (m_attrs.stencil || m_attrs.depth) && getExtensions()->supports("GL_OES_packed_depth_stencil"); + + // Resize regular FBO. + bool mustRestoreFBO = false; + if (m_boundFBO != m_fbo) { + mustRestoreFBO = true; + ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo); + } + + ::glBindTexture(GL_TEXTURE_2D, m_texture); + ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, pixelDataType, 0); + ::glFramebufferTexture2DEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0); + + ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture); + ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0); + ::glBindTexture(GL_TEXTURE_2D, 0); + + // We don't support antialiasing yet. See GraphicsContext3D::validateAttributes. + ASSERT(!m_attrs.antialias); + + if (m_attrs.stencil || m_attrs.depth) { + // Use a 24 bit depth buffer where we know we have it. + if (supportPackedDepthStencilBuffer) { + ::glBindTexture(GL_TEXTURE_2D, m_depthStencilBuffer); + ::glTexImage2D(GL_TEXTURE_2D, 0, GraphicsContext3D::DEPTH_STENCIL, width, height, 0, GraphicsContext3D::DEPTH_STENCIL, GraphicsContext3D::UNSIGNED_INT_24_8, 0); + if (m_attrs.stencil) + ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0); + if (m_attrs.depth) + ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0); + ::glBindTexture(GL_TEXTURE_2D, 0); + } else { + if (m_attrs.stencil) { + ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer); + ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_STENCIL_INDEX8, width, height); + ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer); + } + if (m_attrs.depth) { + ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height); + ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + } + ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, 0); + } + } + if (glCheckFramebufferStatusEXT(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { + // FIXME: cleanup + notImplemented(); + } + + return mustRestoreFBO; +} + void GraphicsContext3D::resolveMultisamplingIfNecessary(const IntRect& rect) { // FIXME: We don't support antialiasing yet. diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index c7191e35b..84729d992 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -19,7 +19,11 @@ #include "config.h" #include "GraphicsContext3D.h" +#if USE(OPENGL_ES_2) +#include "Extensions3DOpenGLES.h" +#else #include "Extensions3DOpenGL.h" +#endif #include "GraphicsContext.h" #include "GraphicsSurface.h" #include "HostWindow.h" diff --git a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp index 1ce1efc08..e7e8fc909 100644 --- a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp @@ -34,7 +34,6 @@ #include "FontCustomPlatformData.h" #if OS(WINDOWS) -#include "Base64.h" #include "OpenTypeUtilities.h" #include "PlatformSupport.h" #elif OS(UNIX) @@ -48,6 +47,7 @@ #if OS(WINDOWS) #include <objbase.h> +#include <wtf/text/Base64.h> #elif OS(UNIX) #include <cstring> #endif diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index ac3d929bc..b5490c656 100644 --- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -33,7 +33,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "BitmapImageSingleFrameSkia.h" #include "Extensions3D.h" @@ -56,6 +55,7 @@ #include "Canvas2DLayerBridge.h" #endif +#include <wtf/text/Base64.h> #include <wtf/text/WTFString.h> using namespace std; diff --git a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp index b4d20b03a..54486c3aa 100644 --- a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp @@ -86,7 +86,7 @@ void SimpleFontData::platformInit() float descent; // Beware those who step here: This code is designed to match Win32 font - // metrics *exactly*. + // metrics *exactly* (except the adjustment of ascent/descent on Linux/Android). if (isVDMXValid) { ascent = vdmxAscent; descent = -vdmxDescent; @@ -94,6 +94,16 @@ void SimpleFontData::platformInit() SkScalar height = -metrics.fAscent + metrics.fDescent + metrics.fLeading; ascent = SkScalarRound(-metrics.fAscent); descent = SkScalarRound(height) - ascent; +#if OS(LINUX) || OS(ANDROID) + // When subpixel positioning is enabled, if the descent is rounded down, the descent part + // of the glyph may be truncated when displayed in a 'overflow: hidden' container. + // To avoid that, borrow 1 unit from the ascent when possible. + // FIXME: This can be removed if sub-pixel ascent/descent is supported. + if (platformData().fontRenderStyle().useSubpixelPositioning && descent < SkScalarToFloat(metrics.fDescent) && ascent >= 1) { + ++descent; + --ascent; + } +#endif } m_fontMetrics.setAscent(ascent); diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp index 018a89c9b..2b8cd6591 100644 --- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp +++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp @@ -27,18 +27,12 @@ namespace WebCore { PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, Flags flags, uint32_t token) { - RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); - if (!surface->platformImport(token)) - return PassRefPtr<GraphicsSurface>(); - return surface; + return platformImport(size, flags, token); } PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, GraphicsSurface::Flags flags) { - RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); - if (!surface->platformCreate(size, flags)) - return PassRefPtr<GraphicsSurface>(); - return surface; + return platformCreate(size, flags); } uint32_t GraphicsSurface::exportToken() @@ -70,13 +64,19 @@ void GraphicsSurface::copyFromFramebuffer(uint32_t fbo, const IntRect& sourceRec } GraphicsSurface::GraphicsSurface(const IntSize& size, Flags flags) - : m_size(size) - , m_flags(flags) + : m_flags(flags) + , m_size(size) , m_platformSurface(0) , m_texture(0) , m_fbo(0) + , m_private(0) { } +GraphicsSurface::~GraphicsSurface() +{ + platformDestroy(); +} + } #endif diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h index ff71fcd8c..7aeed792c 100644 --- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h +++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h @@ -32,10 +32,14 @@ #if OS(DARWIN) typedef struct __IOSurface* IOSurfaceRef; typedef IOSurfaceRef PlatformGraphicsSurface; +#else +typedef uint32_t PlatformGraphicsSurface; #endif namespace WebCore { +struct GraphicsSurfacePrivate; + class GraphicsSurface : public RefCounted<GraphicsSurface> { public: enum Flag { @@ -69,10 +73,11 @@ public: uint32_t getTextureID(); PassOwnPtr<GraphicsContext> beginPaint(const IntRect&, LockOptions); PassRefPtr<Image> createReadOnlyImage(const IntRect&); + ~GraphicsSurface(); protected: - bool platformCreate(const IntSize&, Flags); - bool platformImport(uint32_t); + static PassRefPtr<GraphicsSurface> platformCreate(const IntSize&, Flags); + static PassRefPtr<GraphicsSurface> platformImport(const IntSize&, Flags, uint32_t); uint32_t platformExport(); void platformDestroy(); @@ -100,6 +105,7 @@ private: PlatformGraphicsSurface m_platformSurface; uint32_t m_texture; uint32_t m_fbo; + GraphicsSurfacePrivate* m_private; }; } diff --git a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp index 84312def2..7131b8276 100644 --- a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp +++ b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp @@ -30,6 +30,8 @@ namespace WebCore { +struct GraphicsSurfacePrivate { }; + uint32_t GraphicsSurface::platformExport() { return IOSurfaceGetID(m_platformSurface); @@ -118,7 +120,7 @@ void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntR glFlush(); } -bool GraphicsSurface::platformCreate(const IntSize& size, Flags flags) +PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags) { unsigned pixelFormat = 'BGRA'; unsigned bytesPerElement = 4; @@ -154,14 +156,20 @@ bool GraphicsSurface::platformCreate(const IntSize& size, Flags flags) for (unsigned i = 0; i < 7; i++) CFRelease(values[i]); - m_platformSurface = IOSurfaceCreate(dict); - return !!m_platformSurface; + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + surface->m_platformSurface = IOSurfaceCreate(dict); + if (!surface->m_platformSurface) + return PassRefPtr<GraphicsSurface>(); + return surface; } -bool GraphicsSurface::platformImport(uint32_t token) +PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token) { - m_platformSurface = IOSurfaceLookup(token); - return !!m_platformSurface; + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + surface->m_platformSurface = IOSurfaceLookup(token); + if (!surface->m_platformSurface) + return PassRefPtr<GraphicsSurface>(); + return surface; } static int ioSurfaceLockOptions(int lockOptions) diff --git a/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp new file mode 100644 index 000000000..afc3a84f2 --- /dev/null +++ b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp @@ -0,0 +1,330 @@ +/* + Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "GraphicsSurface.h" + +#if USE(GRAPHICS_SURFACE) + +// Qt headers must be included before glx headers. +#include <QCoreApplication> +#include <QOpenGLContext> +#include <QVector> +#include <QWindow> +#include <qpa/qplatformwindow.h> +#include <GL/glext.h> +#include <GL/glx.h> +#include <X11/extensions/Xcomposite.h> +#include <X11/extensions/Xrender.h> + +namespace WebCore { + +static long X11OverrideRedirect = 1L << 9; + +static PFNGLXBINDTEXIMAGEEXTPROC pGlXBindTexImageEXT = 0; +static PFNGLXRELEASETEXIMAGEEXTPROC pGlXReleaseTexImageEXT = 0; +static PFNGLBINDFRAMEBUFFERPROC pGlBindFramebuffer = 0; +static PFNGLBLITFRAMEBUFFERPROC pGlBlitFramebuffer = 0; + +class OffScreenRootWindow { +public: + OffScreenRootWindow() + { + ++refCount; + } + + QWindow* get(Display* dpy) + { + if (!window) { + window = new QWindow; + window->setGeometry(QRect(-1, -1, 1, 1)); + window->create(); + XSetWindowAttributes attributes; + attributes.override_redirect = true; + XChangeWindowAttributes(dpy, window->handle()->winId(), X11OverrideRedirect, &attributes); + window->show(); + } + return window; + } + + ~OffScreenRootWindow() + { + if (!--refCount) { + delete window; + window = 0; + } + } + +private: + static int refCount; + static QWindow* window; +}; + +int OffScreenRootWindow::refCount = 0; +QWindow* OffScreenRootWindow::window = 0; + +static const int glxSpec[] = { + // The specification is a set key value pairs stored in a simple array. + GLX_LEVEL, 0, + GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT | GLX_WINDOW_BIT, + GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, + GLX_BIND_TO_TEXTURE_RGB_EXT, TRUE, + 0 +}; + +static const int glxAttributes[] = { + GLX_TEXTURE_FORMAT_EXT, + GLX_TEXTURE_FORMAT_RGB_EXT, + GLX_TEXTURE_TARGET_EXT, + GLX_TEXTURE_2D_EXT, + 0 +}; + +struct GraphicsSurfacePrivate { + GraphicsSurfacePrivate() + : m_display(0) + , m_xPixmap(0) + , m_glxPixmap(0) + , m_glContext(adoptPtr(new QOpenGLContext)) + , m_textureIsYInverted(false) + , m_hasAlpha(false) + { + m_display = XOpenDisplay(0); + m_glContext->create(); + } + + ~GraphicsSurfacePrivate() + { + if (m_glxPixmap) + glXDestroyPixmap(m_display, m_glxPixmap); + m_glxPixmap = 0; + + if (m_xPixmap) + XFreePixmap(m_display, m_xPixmap); + m_xPixmap = 0; + + if (m_display) + XCloseDisplay(m_display); + m_display = 0; + } + + uint32_t createSurface(const IntSize& size) + { + m_surface = adoptPtr(new QWindow(m_offScreenWindow.get(m_display))); + m_surface->setSurfaceType(QSurface::OpenGLSurface); + m_surface->setGeometry(0, 0, size.width(), size.height()); + m_surface->create(); + XCompositeRedirectWindow(m_display, m_surface->handle()->winId(), CompositeRedirectManual); + + // Make sure the XRender Extension is available. + int eventBasep, errorBasep; + if (!XRenderQueryExtension(m_display, &eventBasep, &errorBasep)) + return 0; + + m_surface->show(); + + return m_surface->handle()->winId(); + } + + void createPixmap(uint32_t winId) + { + XWindowAttributes attr; + XGetWindowAttributes(m_display, winId, &attr); + + XRenderPictFormat* format = XRenderFindVisualFormat(m_display, attr.visual); + m_hasAlpha = (format->type == PictTypeDirect && format->direct.alphaMask); + m_size = IntSize(attr.width, attr.height); + + int numberOfConfigs; + GLXFBConfig* configs = glXChooseFBConfig(m_display, XDefaultScreen(m_display), glxSpec, &numberOfConfigs); + + m_xPixmap = XCompositeNameWindowPixmap(m_display, winId); + m_glxPixmap = glXCreatePixmap(m_display, *configs, m_xPixmap, glxAttributes); + + uint inverted = 0; + glXQueryDrawable(m_display, m_glxPixmap, GLX_Y_INVERTED_EXT, &inverted); + m_textureIsYInverted = !!inverted; + + XFree(configs); + } + + void makeCurrent() + { + QOpenGLContext* glContext = QOpenGLContext::currentContext(); + if (m_surface && glContext) + glContext->makeCurrent(m_surface.get()); + } + + void swapBuffers() + { + if (!m_surface->isVisible()) + return; + + // Creating and exposing the surface is asynchronous. Therefore we have to wait here + // before swapping the buffers. This should only be the case for the very first frame. + while (!m_surface->isExposed()) + QCoreApplication::processEvents(); + + QOpenGLContext* glContext = QOpenGLContext::currentContext(); + if (m_surface && glContext) + glContext->swapBuffers(m_surface.get()); + } + + + Display* display() const { return m_display; } + + GLXPixmap glxPixmap() const { return m_glxPixmap; } + + IntSize size() const { return m_size; } + + QOpenGLContext* glContext() { return m_glContext.get(); } + +private: + OffScreenRootWindow m_offScreenWindow; + IntSize m_size; + Display* m_display; + Pixmap m_xPixmap; + GLXPixmap m_glxPixmap; + OwnPtr<QWindow> m_surface; + OwnPtr<QOpenGLContext> m_glContext; + bool m_textureIsYInverted; + bool m_hasAlpha; +}; + +static bool resolveGLMethods(GraphicsSurfacePrivate* p) +{ + static bool resolved = false; + if (resolved) + return true; + + QOpenGLContext* glContext = p->glContext(); + pGlXBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT")); + pGlXReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT")); + pGlBindFramebuffer = reinterpret_cast<PFNGLBINDFRAMEBUFFERPROC>(glContext->getProcAddress("glBindFramebuffer")); + pGlBlitFramebuffer = reinterpret_cast<PFNGLBLITFRAMEBUFFERPROC>(glContext->getProcAddress("glBlitFramebuffer")); + + resolved = pGlBlitFramebuffer && pGlBindFramebuffer && pGlXBindTexImageEXT && pGlXReleaseTexImageEXT; + + return resolved; +} + +uint32_t GraphicsSurface::platformExport() +{ + return m_platformSurface; +} + +uint32_t GraphicsSurface::platformGetTextureID() +{ + if (!m_texture) + glGenTextures(1, &m_texture); + + glBindTexture(GL_TEXTURE_2D, m_texture); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + pGlXBindTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT, 0); + + return m_texture; +} + +void GraphicsSurface::platformCopyToGLTexture(uint32_t target, uint32_t id, const IntRect& targetRect, const IntPoint& offset) +{ + // This is not supported by GLX/Xcomposite. +} + +void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntRect& sourceRect) +{ + m_private->makeCurrent(); + int width = m_size.width(); + int height = m_size.height(); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + GLint oldFBO; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO); + pGlBindFramebuffer(GL_READ_FRAMEBUFFER, originFbo); + pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_private->glContext()->defaultFramebufferObject()); + pGlBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR); + pGlBindFramebuffer(GL_FRAMEBUFFER, oldFBO); + glPopAttrib(); + + m_private->swapBuffers(); +} + +PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags) +{ + // X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested. + if (flags & SupportsCopyToTexture) + return PassRefPtr<GraphicsSurface>(); + + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + + surface->m_private = new GraphicsSurfacePrivate(); + if (!resolveGLMethods(surface->m_private)) + return PassRefPtr<GraphicsSurface>(); + + surface->m_platformSurface = surface->m_private->createSurface(size); + + return surface; +} + +PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token) +{ + // X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested. + if (flags & SupportsCopyToTexture) + return PassRefPtr<GraphicsSurface>(); + + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + + surface->m_private = new GraphicsSurfacePrivate(); + if (!resolveGLMethods(surface->m_private)) + return PassRefPtr<GraphicsSurface>(); + + surface->m_platformSurface = token; + + surface->m_private->createPixmap(surface->m_platformSurface); + surface->m_size = surface->m_private->size(); + + return surface; +} + +char* GraphicsSurface::platformLock(const IntRect& rect, int* outputStride, LockOptions lockOptions) +{ + // GraphicsSurface is currently only being used for WebGL, which does not require this locking mechanism. + return 0; +} + +void GraphicsSurface::platformUnlock() +{ + // GraphicsSurface is currently only being used for WebGL, which does not require this locking mechanism. +} + +void GraphicsSurface::platformDestroy() +{ + if (m_texture) { + pGlXReleaseTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT); + glDeleteTextures(1, &m_texture); + } + + delete m_private; + m_private = 0; +} + +} +#endif diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp index 4ca56c6c1..2802933a9 100644 --- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp +++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp @@ -368,7 +368,7 @@ bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList if (valueList.property() == AnimatedPropertyWebkitTransform) listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0; - m_animations.add(keyframesName, TextureMapperAnimation(valueList, boxSize, anim, timeOffset, listsMatch)); + m_animations.add(keyframesName, GraphicsLayerAnimation(valueList, boxSize, anim, timeOffset, listsMatch)); notifyChange(TextureMapperLayer::AnimationChange); m_animationStartedTimer.startOneShot(0); return true; diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h index 403e5492b..c5cbbac04 100644 --- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h +++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h @@ -106,7 +106,7 @@ private: bool m_fixedToViewport; TextureMapperPlatformLayer* m_contentsLayer; FloatRect m_needsDisplayRect; - TextureMapperAnimations m_animations; + GraphicsLayerAnimations m_animations; void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*); Timer<GraphicsLayerTextureMapper> m_animationStartedTimer; }; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h index de2d67f73..45042ca8d 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h @@ -24,11 +24,11 @@ #include "FloatRect.h" #include "GraphicsContext.h" #include "GraphicsLayer.h" +#include "GraphicsLayerAnimation.h" +#include "GraphicsLayerTransform.h" #include "Image.h" #include "IntPointHash.h" -#include "LayerTransform.h" #include "TextureMapper.h" -#include "TextureMapperAnimation.h" #include "TextureMapperBackingStore.h" #include "Timer.h" #include "TransformOperations.h" @@ -56,7 +56,7 @@ public: { } }; -class TextureMapperLayer : public TextureMapperAnimationClient { +class TextureMapperLayer : public GraphicsLayerAnimation::Client { public: // This set of flags help us defer which properties of the layer have been @@ -157,6 +157,10 @@ private: void drawRepaintCounter(GraphicsContext*, GraphicsLayer*); + // GraphicsLayerAnimation::Client + void setAnimatedTransform(const TransformationMatrix& matrix) { setTransform(matrix); } + void setAnimatedOpacity(float opacity) { setOpacity(opacity); } + void syncAnimations(); bool isVisible() const; enum ContentsLayerCount { @@ -168,7 +172,7 @@ private: ContentsLayerCount countPotentialLayersWithContents() const; bool shouldPaintToIntermediateSurface() const; - LayerTransform m_transform; + GraphicsLayerTransform m_transform; inline FloatRect layerRect() const { @@ -230,7 +234,7 @@ private: State m_state; TextureMapper* m_textureMapper; - TextureMapperAnimations m_animations; + GraphicsLayerAnimations m_animations; IntPoint m_scrollPositionDelta; bool m_fixedToViewport; Color m_debugBorderColor; diff --git a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp index 8348acb39..b9d90fef9 100644 --- a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp @@ -21,7 +21,6 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include "Base64.h" #include "FontPlatformData.h" #include "OpenTypeUtilities.h" #include "SharedBuffer.h" @@ -30,6 +29,7 @@ #include <ApplicationServices/ApplicationServices.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <wtf/RetainPtr.h> +#include <wtf/text/Base64.h> // From t2embapi.h, which is missing from the Microsoft Platform SDK. typedef unsigned long(WINAPIV *READEMBEDPROC) (void*, void*, unsigned long); diff --git a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp index 07a875624..844f8ec04 100644 --- a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp @@ -22,11 +22,11 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include "Base64.h" #include "CachedFont.h" #include "FontPlatformData.h" #include "SharedBuffer.h" #include <wtf/RandomNumber.h> +#include <wtf/text/Base64.h> namespace WebCore { diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp index 9c4225a3e..572070553 100644 --- a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp @@ -21,7 +21,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "GraphicsContext.h" #include "Image.h" #include "ImageData.h" diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp index 0cdbc7b3b..57874832e 100644 --- a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -27,7 +27,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "GraphicsContext.h" #include "Image.h" diff --git a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp index 5762a8fc7..712540356 100644 --- a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp +++ b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp @@ -137,7 +137,7 @@ FloatRect screenAvailableRect(Widget* widget) } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.h b/Source/WebCore/platform/image-decoders/ImageDecoder.h index 760ac93f8..911878e1d 100644 --- a/Source/WebCore/platform/image-decoders/ImageDecoder.h +++ b/Source/WebCore/platform/image-decoders/ImageDecoder.h @@ -315,7 +315,7 @@ namespace WebCore { #else // FIXME: add support for multiple monitors. ColorProfile profile; - screenColorProfile(0, profile); + screenColorProfile(profile); if (!profile.isEmpty()) outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); #endif diff --git a/Source/WebCore/platform/mac/CursorMac.mm b/Source/WebCore/platform/mac/CursorMac.mm index d2085339b..ac24b88c4 100644 --- a/Source/WebCore/platform/mac/CursorMac.mm +++ b/Source/WebCore/platform/mac/CursorMac.mm @@ -85,7 +85,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Hand: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = [NSCursor pointingHandCursor]; #else // The pointingHandCursor from NSCursor does not have a shadow on @@ -99,7 +99,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Wait: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("BusyButClickable"); #else m_platformCursor = createNamedCursor("waitCursor", 7, 7); @@ -107,7 +107,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Help: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("Help"); if (m_platformCursor) break; @@ -117,7 +117,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::Move: case Cursor::MiddlePanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("Move"); #else m_platformCursor = createNamedCursor("moveCursor", 7, 7); @@ -126,7 +126,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::EastResize: case Cursor::EastPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeEast"); #else m_platformCursor = createNamedCursor("eastResizeCursor", 14, 7); @@ -135,7 +135,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::NorthResize: case Cursor::NorthPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorth"); #else m_platformCursor = createNamedCursor("northResizeCursor", 7, 1); @@ -144,7 +144,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::NorthEastResize: case Cursor::NorthEastPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNortheast"); #else m_platformCursor = createNamedCursor("northEastResizeCursor", 14, 1); @@ -153,7 +153,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::NorthWestResize: case Cursor::NorthWestPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorthwest"); #else m_platformCursor = createNamedCursor("northWestResizeCursor", 0, 0); @@ -162,7 +162,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::SouthResize: case Cursor::SouthPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeSouth"); #else m_platformCursor = createNamedCursor("southResizeCursor", 7, 14); @@ -171,7 +171,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::SouthEastResize: case Cursor::SouthEastPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeSoutheast"); #else m_platformCursor = createNamedCursor("southEastResizeCursor", 14, 14); @@ -180,7 +180,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::SouthWestResize: case Cursor::SouthWestPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeSouthwest"); #else m_platformCursor = createNamedCursor("southWestResizeCursor", 1, 14); @@ -188,7 +188,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::WestResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeWest"); #else m_platformCursor = createNamedCursor("westResizeCursor", 1, 7); @@ -196,7 +196,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NorthSouthResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorthSouth"); #else m_platformCursor = createNamedCursor("northSouthResizeCursor", 7, 7); @@ -205,7 +205,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::EastWestResize: case Cursor::WestPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeEastWest"); #else m_platformCursor = createNamedCursor("eastWestResizeCursor", 7, 7); @@ -213,7 +213,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NorthEastSouthWestResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNortheastSouthwest"); #else m_platformCursor = createNamedCursor("northEastSouthWestResizeCursor", 7, 7); @@ -221,7 +221,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NorthWestSouthEastResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorthwestSoutheast"); #else m_platformCursor = createNamedCursor("northWestSouthEastResizeCursor", 7, 7); @@ -237,7 +237,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::VerticalText: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = [NSCursor IBeamCursorForVerticalLayout]; #else m_platformCursor = createNamedCursor("verticalTextCursor", 7, 7); @@ -245,7 +245,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Cell: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("Cell"); if (m_platformCursor) break; @@ -254,7 +254,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::ContextMenu: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor contextualMenuCursor]; #else m_platformCursor = createNamedCursor("contextMenuCursor", 3, 2); @@ -262,7 +262,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Alias: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("MakeAlias"); #else m_platformCursor = createNamedCursor("aliasCursor", 11, 3); @@ -270,7 +270,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Progress: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("BusyButClickable"); #else m_platformCursor = createNamedCursor("progressCursor", 3, 2); @@ -278,7 +278,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NoDrop: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor operationNotAllowedCursor]; #else m_platformCursor = createNamedCursor("noDropCursor", 3, 1); @@ -286,7 +286,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Copy: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor dragCopyCursor]; #else m_platformCursor = createNamedCursor("copyCursor", 3, 2); @@ -298,7 +298,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NotAllowed: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor operationNotAllowedCursor]; #else m_platformCursor = createNamedCursor("notAllowedCursor", 11, 11); @@ -306,7 +306,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::ZoomIn: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ZoomIn"); if (m_platformCursor) break; @@ -315,7 +315,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::ZoomOut: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ZoomOut"); if (m_platformCursor) break; diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp index 10730871b..ae0cf5763 100644 --- a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp +++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp @@ -29,8 +29,9 @@ #include <IOKit/pwr_mgt/IOPMLib.h> #include <wtf/RetainPtr.h> -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include <wtf/UnusedParam.h> +#include <CoreServices/CoreServices.h> #endif namespace WebCore { @@ -39,11 +40,11 @@ static const double systemActivityInterval = 1; DisplaySleepDisabler::DisplaySleepDisabler(const char* reason) : m_disableDisplaySleepAssertion(0) -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 , m_systemActivityTimer(this, &DisplaySleepDisabler::systemActivityTimerFired) #endif { -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFStringRef> reasonCF(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8)); IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonCF.get(), &m_disableDisplaySleepAssertion); #else @@ -57,8 +58,8 @@ DisplaySleepDisabler::~DisplaySleepDisabler() { IOPMAssertionRelease(m_disableDisplaySleepAssertion); } - -#ifdef BUILDING_ON_LEOPARD + +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 void DisplaySleepDisabler::systemActivityTimerFired(Timer<DisplaySleepDisabler>*) { UpdateSystemActivity(OverallAct); diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.h b/Source/WebCore/platform/mac/DisplaySleepDisabler.h index 2e466dc16..a2d44a1e7 100644 --- a/Source/WebCore/platform/mac/DisplaySleepDisabler.h +++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.h @@ -29,7 +29,7 @@ #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include "Timer.h" #endif @@ -44,12 +44,12 @@ public: private: DisplaySleepDisabler(const char* reason); -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 void systemActivityTimerFired(Timer<DisplaySleepDisabler>*); #endif uint32_t m_disableDisplaySleepAssertion; -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 Timer<DisplaySleepDisabler> m_systemActivityTimer; #endif }; diff --git a/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h b/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h index c11b05fb5..65a35d19b 100644 --- a/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h +++ b/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h @@ -29,7 +29,7 @@ @protocol NAME <NSObject> \ @end -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MAX_ALLOWED == 1050 EMPTY_PROTOCOL(NSTableViewDataSource) EMPTY_PROTOCOL(NSTableViewDelegate) @@ -38,7 +38,7 @@ EMPTY_PROTOCOL(NSAnimationDelegate) #endif -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 EMPTY_PROTOCOL(NSURLConnectionDelegate) EMPTY_PROTOCOL(NSURLDownloadDelegate) diff --git a/Source/WebCore/platform/mac/HTMLConverter.h b/Source/WebCore/platform/mac/HTMLConverter.h index ea1b85db5..26bf317c3 100644 --- a/Source/WebCore/platform/mac/HTMLConverter.h +++ b/Source/WebCore/platform/mac/HTMLConverter.h @@ -79,7 +79,7 @@ namespace WebCore { } _flags; } -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (id)init; - (id)initWithDOMRange:(DOMRange *)domRange; diff --git a/Source/WebCore/platform/mac/HTMLConverter.mm b/Source/WebCore/platform/mac/HTMLConverter.mm index 22db81c38..67be0059c 100644 --- a/Source/WebCore/platform/mac/HTMLConverter.mm +++ b/Source/WebCore/platform/mac/HTMLConverter.mm @@ -50,7 +50,7 @@ using namespace HTMLNames; static NSFileWrapper *fileWrapperForURL(DocumentLoader *, NSURL *); static NSFileWrapper *fileWrapperForElement(Element*); -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Additional control Unicode characters const unichar WebNextLineCharacter = 0x0085; @@ -100,7 +100,7 @@ static NSFont *WebDefaultFont() @implementation WebHTMLConverter -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static NSFont *_fontForNameAndSize(NSString *fontName, CGFloat size, NSMutableDictionary *cache) { @@ -1657,7 +1657,7 @@ static NSInteger _colCompare(id block1, id block2, void *) return (0 == _errorCode) ? [[_attrStr retain] autorelease] : nil; } -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // This function uses TextIterator, which makes offsets in its result compatible with HTML editing. + (NSAttributedString *)editingAttributedStringFromRange:(Range*)range diff --git a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm index 8d1d10f67..2791feb5d 100644 --- a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm +++ b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm @@ -33,7 +33,7 @@ #import <wtf/CurrentTime.h> #import <wtf/FastMalloc.h> -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import "WebCoreSystemInterface.h" #import <notify.h> #endif @@ -42,7 +42,7 @@ using std::max; namespace WebCore { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #if !PLATFORM(IOS) static dispatch_source_t _cache_event_source = 0; diff --git a/Source/WebCore/platform/mac/NSScrollerImpDetails.h b/Source/WebCore/platform/mac/NSScrollerImpDetails.h index 0c956c6eb..5e2e1ae01 100644 --- a/Source/WebCore/platform/mac/NSScrollerImpDetails.h +++ b/Source/WebCore/platform/mac/NSScrollerImpDetails.h @@ -29,7 +29,7 @@ #include "config.h" // Public APIs not available on versions of Mac on which we build -#if (defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)) +#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 enum { NSScrollerStyleLegacy = 0, NSScrollerStyleOverlay = 1 @@ -44,7 +44,7 @@ enum { typedef NSInteger NSScrollerKnobStyle; #endif -#if (defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)) +#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 @interface NSScroller(NSObject) + (NSScrollerStyle)preferredScrollerStyle; @end diff --git a/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm b/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm index f0ebf5cae..2ec524c20 100644 --- a/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm +++ b/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm @@ -156,7 +156,7 @@ static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event) { uint32_t phase = PlatformWheelEventPhaseNone; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if ([event momentumPhase] & NSEventPhaseBegan) phase |= PlatformWheelEventPhaseBegan; if ([event momentumPhase] & NSEventPhaseStationary) @@ -189,7 +189,7 @@ static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event) static PlatformWheelEventPhase phaseForEvent(NSEvent *event) { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 uint32_t phase = PlatformWheelEventPhaseNone; if ([event phase] & NSEventPhaseBegan) phase |= PlatformWheelEventPhaseBegan; @@ -201,7 +201,7 @@ static PlatformWheelEventPhase phaseForEvent(NSEvent *event) phase |= PlatformWheelEventPhaseEnded; if ([event phase] & NSEventPhaseCancelled) phase |= PlatformWheelEventPhaseCancelled; -#if !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if ([event momentumPhase] & NSEventPhaseMayBegin) phase |= PlatformWheelEventPhaseMayBegin; #endif diff --git a/Source/WebCore/platform/mac/PlatformScreenMac.mm b/Source/WebCore/platform/mac/PlatformScreenMac.mm index 203418b87..71cc4a149 100644 --- a/Source/WebCore/platform/mac/PlatformScreenMac.mm +++ b/Source/WebCore/platform/mac/PlatformScreenMac.mm @@ -76,7 +76,7 @@ FloatRect screenAvailableRect(Widget* widget) return toUserSpace([screenForWindow(window) visibleFrame], window); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/mac/PopupMenuMac.mm b/Source/WebCore/platform/mac/PopupMenuMac.mm index 855784470..c0f19745c 100644 --- a/Source/WebCore/platform/mac/PopupMenuMac.mm +++ b/Source/WebCore/platform/mac/PopupMenuMac.mm @@ -75,10 +75,10 @@ void PopupMenuMac::populate() if (!client()->shouldPopOver()) [m_popup.get() addItemWithTitle:@""]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 TextDirection menuTextDirection = client()->menuStyle().textDirection(); [m_popup.get() setUserInterfaceLayoutDirection:menuTextDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT(client()); int size = client()->listSize(); @@ -98,7 +98,7 @@ void PopupMenuMac::populate() [attributes setObject:font forKey:NSFontAttributeName]; } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<NSMutableParagraphStyle> paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); [paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment]; NSWritingDirection writingDirection = style.textDirection() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; @@ -109,7 +109,7 @@ void PopupMenuMac::populate() [attributes setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName]; } [attributes setObject:paragraphStyle.get() forKey:NSParagraphStyleAttributeName]; -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // FIXME: Add support for styling the foreground and background colors. // FIXME: Find a way to customize text color when an item is highlighted. diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm index 9688c0aaf..600dee583 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm @@ -635,7 +635,7 @@ ScrollAnimatorMac::~ScrollAnimatorMac() static bool scrollAnimationEnabledForSystem() { -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM) return [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollAnimationEnabled"]; #else return [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"]; diff --git a/Source/WebCore/platform/mac/ScrollElasticityController.mm b/Source/WebCore/platform/mac/ScrollElasticityController.mm index 7a753846b..f2845134e 100644 --- a/Source/WebCore/platform/mac/ScrollElasticityController.mm +++ b/Source/WebCore/platform/mac/ScrollElasticityController.mm @@ -33,7 +33,7 @@ #if ENABLE(RUBBER_BANDING) -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 @interface NSProcessInfo (ScrollAnimatorMacExt) - (NSTimeInterval)systemUptime; @end @@ -71,8 +71,7 @@ static const float scrollVelocityZeroingTimeout = 0.10f; static const float rubberbandDirectionLockStretchRatio = 1; static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10; -#if defined(BUILDING_ON_LEOPARD) || defined(BULDING_ON_SNOW_LEOPARD) || \ - defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM) static const float rubberbandStiffness = 20; static const float rubberbandAmplitude = 0.31f; static const float rubberbandPeriod = 1.6f; diff --git a/Source/WebCore/platform/mac/SharedTimerMac.mm b/Source/WebCore/platform/mac/SharedTimerMac.mm index d7c501dc0..3d01a33c7 100644 --- a/Source/WebCore/platform/mac/SharedTimerMac.mm +++ b/Source/WebCore/platform/mac/SharedTimerMac.mm @@ -36,7 +36,7 @@ #include <stdio.h> // On Snow Leopard and newer we'll ask IOKit to deliver notifications on a queue. -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define IOKIT_WITHOUT_LIBDISPATCH 1 #endif @@ -46,7 +46,7 @@ static CFRunLoopTimerRef sharedTimer; static void (*sharedTimerFiredFunction)(); static void timerFired(CFRunLoopTimerRef, void*); -#if !defined(IOKIT_WITHOUT_LIBDISPATCH) && defined(BUILDING_ON_SNOW_LEOPARD) +#if !defined(IOKIT_WITHOUT_LIBDISPATCH) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MAX_ALLOWED == 1060 extern "C" void IONotificationPortSetDispatchQueue(IONotificationPortRef notify, dispatch_queue_t queue); #endif diff --git a/Source/WebCore/platform/mac/SuddenTermination.mm b/Source/WebCore/platform/mac/SuddenTermination.mm index f62411652..406b3bb23 100644 --- a/Source/WebCore/platform/mac/SuddenTermination.mm +++ b/Source/WebCore/platform/mac/SuddenTermination.mm @@ -26,7 +26,7 @@ #import "config.h" #import "SuddenTermination.h" -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 namespace WebCore { diff --git a/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm b/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm index f62d14a03..cc6ea34d1 100644 --- a/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm +++ b/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm @@ -42,7 +42,7 @@ [self setAcceptsMouseMovedEvents:YES]; [self setReleasedWhenClosed:NO]; [self setHasShadow:NO]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [self setMovable:NO]; #else [self setMovableByWindowBackground:NO]; diff --git a/Source/WebCore/platform/mac/WebCoreNSCellExtras.h b/Source/WebCore/platform/mac/WebCoreNSCellExtras.h index 26be462e1..7894d3de8 100644 --- a/Source/WebCore/platform/mac/WebCoreNSCellExtras.h +++ b/Source/WebCore/platform/mac/WebCoreNSCellExtras.h @@ -25,7 +25,7 @@ #import <AppKit/AppKit.h> -#define BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM)) +#define BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM)) #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h index 908dd95a9..ea7c215ca 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h @@ -58,7 +58,7 @@ typedef UInt32 FMFont; typedef FMFont ATSUFontID; typedef UInt16 ATSGlyphRef; -#if PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && USE(CA) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 typedef struct __IOSurface *IOSurfaceRef; #endif @@ -109,7 +109,7 @@ extern "C" { // In alphabetical order. extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef, void (^block)(CGRect rect)); #endif @@ -215,7 +215,7 @@ extern bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGl extern BOOL (*wkUseSharedMediaUI)(); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void* wkGetHyphenationLocationBeforeIndex; #else extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); @@ -232,7 +232,7 @@ extern int (*wkGetNSEventMomentumPhase)(NSEvent *); extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); @@ -264,7 +264,7 @@ extern CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len); extern BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length); extern AXUIElementRef (*wkCreateAXUIElementRef)(id element); -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 typedef struct __CFURLStorageSession* CFURLStorageSessionRef; #else typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; @@ -296,27 +296,27 @@ extern void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRe #endif extern void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import <dispatch/dispatch.h> extern dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 extern NSString *(*wkGetMacOSXVersionString)(void); extern bool (*wkExecutableWasLinkedOnOrBeforeLion)(void); #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS) extern BOOL (*wkFilterIsManagedSession)(void); extern WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *); extern void (*wkFilterRelease)(WebFilterEvaluator *); diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm index c087a5d87..6a6cc4b1d 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -28,7 +28,7 @@ #import <Foundation/Foundation.h> void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect)); #endif BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef); @@ -125,7 +125,7 @@ void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRe void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t); bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGlyph[], size_t); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void* wkGetHyphenationLocationBeforeIndex; #else CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); @@ -133,7 +133,7 @@ int (*wkGetNSEventMomentumPhase)(NSEvent *); #endif CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace); @@ -178,24 +178,24 @@ CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef); void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType); void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 NSString *(*wkGetMacOSXVersionString)(void); bool (*wkExecutableWasLinkedOnOrBeforeLion)(void); #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS) BOOL (*wkFilterIsManagedSession)(void); WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *); void (*wkFilterRelease)(WebFilterEvaluator *); diff --git a/Source/WebCore/platform/mac/WebFontCache.mm b/Source/WebCore/platform/mac/WebFontCache.mm index be666cf5f..c9692b287 100644 --- a/Source/WebCore/platform/mac/WebFontCache.mm +++ b/Source/WebCore/platform/mac/WebFontCache.mm @@ -104,7 +104,7 @@ static BOOL betterChoice(NSFontTraitMask desiredTraits, int desiredWeight, // Workaround for <rdar://problem/5781372>. static inline void fixUpWeight(NSInteger& weight, NSString *fontName) { -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 UNUSED_PARAM(weight); UNUSED_PARAM(fontName); #else diff --git a/Source/WebCore/platform/mac/WebVideoFullscreenController.mm b/Source/WebCore/platform/mac/WebVideoFullscreenController.mm index 47c5391c6..ce35fb1d8 100644 --- a/Source/WebCore/platform/mac/WebVideoFullscreenController.mm +++ b/Source/WebCore/platform/mac/WebVideoFullscreenController.mm @@ -53,7 +53,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) #define QTMovieRateDidChangeNotification getQTMovieRateDidChangeNotification() @interface WebVideoFullscreenWindow : NSWindow -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 <NSAnimationDelegate> #endif { @@ -339,7 +339,7 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) - (void)updateMenuAndDockForFullscreen { // NSApplicationPresentationOptions is available on > 10.6 only: -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSApplicationPresentationOptions options = NSApplicationPresentationDefault; NSScreen* fullscreenScreen = [[self window] screen]; diff --git a/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm b/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm index 631828acc..90f691d7c 100644 --- a/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm +++ b/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm @@ -44,10 +44,10 @@ static inline CGFloat webkit_CGFloor(CGFloat value) return floor(value); } -#define HAVE_MEDIA_CONTROL (!defined(BUILDING_ON_LEOPARD)) +#define HAVE_MEDIA_CONTROL (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) @interface WebVideoFullscreenHUDWindowController (Private) -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 <NSWindowDelegate> #endif diff --git a/Source/WebCore/platform/network/Credential.h b/Source/WebCore/platform/network/Credential.h index aae4d52eb..d43ae8fb8 100644 --- a/Source/WebCore/platform/network/Credential.h +++ b/Source/WebCore/platform/network/Credential.h @@ -27,7 +27,7 @@ #include "PlatformString.h" -#define CERTIFICATE_CREDENTIALS_SUPPORTED ((PLATFORM(MAC) || PLATFORM(IOS)) && !defined(BUILDING_ON_LEOPARD)) +#define CERTIFICATE_CREDENTIALS_SUPPORTED (PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)) #if CERTIFICATE_CREDENTIALS_SUPPORTED #include <Security/SecBase.h> diff --git a/Source/WebCore/platform/network/DataURL.cpp b/Source/WebCore/platform/network/DataURL.cpp index 25a443e83..aae525c25 100644 --- a/Source/WebCore/platform/network/DataURL.cpp +++ b/Source/WebCore/platform/network/DataURL.cpp @@ -27,13 +27,13 @@ #include "config.h" #include "DataURL.h" -#include "Base64.h" #include "HTTPParsers.h" #include "ResourceHandle.h" #include "ResourceHandleClient.h" #include "ResourceRequest.h" #include "ResourceResponse.h" #include "TextEncoding.h" +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> namespace WebCore { @@ -75,7 +75,7 @@ void handleDataURL(ResourceHandle* handle) handle->client()->didReceiveResponse(handle, response); Vector<char> out; - if (base64Decode(data, out, IgnoreWhitespace) && out.size() > 0) { + if (base64Decode(data, out, Base64IgnoreWhitespace) && out.size() > 0) { response.setExpectedContentLength(out.size()); handle->client()->didReceiveData(handle, out.data(), out.size(), 0); } diff --git a/Source/WebCore/platform/network/ResourceHandle.h b/Source/WebCore/platform/network/ResourceHandle.h index ddca0d22f..840097006 100644 --- a/Source/WebCore/platform/network/ResourceHandle.h +++ b/Source/WebCore/platform/network/ResourceHandle.h @@ -67,7 +67,7 @@ typedef int CFHTTPCookieStorageAcceptPolicy; typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef; #endif -#if USE(CFURLSTORAGESESSIONS) && (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD)) +#if USE(CFURLSTORAGESESSIONS) && PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 typedef struct __CFURLStorageSession* CFURLStorageSessionRef; #elif USE(CFURLSTORAGESESSIONS) typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index c64fdc8aa..a48324763 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -20,6 +20,7 @@ #include "NetworkJob.h" #include "AboutData.h" +#include "AboutTemplate.html.cpp" #include "Chrome.h" #include "ChromeClient.h" #include "CookieManager.h" @@ -480,7 +481,8 @@ void NetworkJob::handleNotifyClose(int status) sendResponseIfNeeded(); if (isClientAvailable()) { - + if (isError(status)) + m_extendedStatusCode = status; RecursionGuard guard(m_callingClient); if (shouldNotifyClientFailed()) { String domain = m_extendedStatusCode < 0 ? ResourceError::platformErrorDomain : ResourceError::httpErrorDomain; @@ -800,6 +802,12 @@ void NetworkJob::storeCredentials() CredentialStorage::set(challenge.proposedCredential(), challenge.protectionSpace(), m_response.url()); challenge.setStored(true); + + if (challenge.protectionSpace().serverType() == ProtectionSpaceProxyHTTP) { + BlackBerry::Platform::Client::get()->setProxyCredential(challenge.proposedCredential().user().utf8().data(), + challenge.proposedCredential().password().utf8().data()); + m_frame->page()->chrome()->client()->platformPageClient()->syncProxyCredential(challenge.proposedCredential()); + } } void NetworkJob::purgeCredentials() @@ -837,7 +845,8 @@ void NetworkJob::handleAbout() if (equalIgnoringCase(aboutWhat, "blank")) { handled = true; } else if (equalIgnoringCase(aboutWhat, "credits")) { - result.append(String("<html><head><title>Open Source Credits</title> <style> .about {padding:14px;} </style> <meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"></head><body>")); + 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; @@ -877,16 +886,18 @@ void NetworkJob::handleAbout() result.append(String("</body></html>")); handled = true; } else if (equalIgnoringCase(aboutWhat, "version")) { - result.append(String("<html><meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"></head><body>")); + 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("</body></html>")); + 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(String("<html><head><title>BlackBerry Browser Build Information</title></head><body><table>")); - result.append(String("<tr><td>Build Computer: </td><td>")); + 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>")); @@ -894,11 +905,11 @@ void NetworkJob::handleAbout() result.append(String("</td></tr>")); result.append(String("<tr><td>Build Time: </td><td>")); result.append(String(BlackBerry::Platform::BUILDTIME)); - result.append(String("</td></tr><tr><td></td><td></td></tr>")); + 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("</table></body></html>")); + result.append(String("</body></html>")); handled = true; } else if (equalIgnoringCase(aboutWhat, "memory")) { result = memoryPage(); diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h index a9a7b881b..acc07dcbf 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.h +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h @@ -80,6 +80,7 @@ public: void handleNotifyDataSent(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void notifyClose(int status); void handleNotifyClose(int status); + virtual int status() const { return m_extendedStatusCode; } private: bool isClientAvailable() const { return !m_cancelled && m_handle && m_handle->client(); } diff --git a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp index 5cffde039..3c439d91f 100644 --- a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp +++ b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp @@ -55,6 +55,8 @@ static inline NetworkRequest::TargetType platformTargetTypeForRequest(const Reso { if (request.isXMLHTTPRequest()) return NetworkRequest::TargetIsXMLHTTPRequest; + if (request.forceDownload()) + return NetworkRequest::TargetIsDownload; switch (request.targetType()) { case ResourceRequest::TargetIsMainFrame: diff --git a/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h b/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h index 73b118fef..fce05f1c4 100644 --- a/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h +++ b/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h @@ -57,6 +57,7 @@ public: virtual void notifyDataReceived(BlackBerry::Platform::NetworkBuffer*); virtual void notifyReadyToSendData(); virtual void notifyClose(int status); + virtual int status() const { return m_status; } protected: virtual int platformSend(const char* data, int length); @@ -66,6 +67,7 @@ private: SocketStreamHandle(const String& groupName, const KURL&, SocketStreamHandleClient*); OwnPtr<BlackBerry::Platform::FilterStream> m_socketStream; + int m_status; }; } // namespace WebCore diff --git a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp index 0fd0e6961..90ed528a7 100644 --- a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp +++ b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp @@ -105,7 +105,7 @@ void SocketStreamHandle::notifyStatusReceived(int status, const char* message) // The client can close the handle, potentially removing the last reference. RefPtr<SocketStreamHandle> protect(this); - + m_status = status; if (FilterStream::StatusSuccess != status) m_client->didFailSocketStream(this, SocketStreamError(status)); else { @@ -135,6 +135,9 @@ void SocketStreamHandle::notifyClose(int status) // The client can close the handle, potentially removing the last reference. RefPtr<SocketStreamHandle> protect(this); + if (status < 0 || (400 <= status && status < 600)) + m_status = status; + if (FilterStream::StatusSuccess != status) m_client->didFailSocketStream(this, SocketStreamError(status)); diff --git a/Source/WebCore/platform/network/cf/DNSCFNet.cpp b/Source/WebCore/platform/network/cf/DNSCFNet.cpp index 28c95df97..3f901a541 100644 --- a/Source/WebCore/platform/network/cf/DNSCFNet.cpp +++ b/Source/WebCore/platform/network/cf/DNSCFNet.cpp @@ -42,7 +42,7 @@ #include <CFNetwork/CFNetwork.h> #endif -#if defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include <SystemConfiguration/SystemConfiguration.h> #endif @@ -56,7 +56,7 @@ bool DNSResolveQueue::platformProxyIsEnabledInSystemPreferences() // as it doesn't necessarily look up the actual external IP. Also, if DNS returns a fake internal address, // local caches may keep it even after re-connecting to another network. -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, CFNetworkCopySystemProxySettings()); #else RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, SCDynamicStoreCopyProxies(0)); diff --git a/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp b/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp index 6b0c8b0c5..74db9ee6b 100644 --- a/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp @@ -37,7 +37,7 @@ namespace WebCore { -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static void processProxyServers(Vector<ProxyServer>& proxyServers, CFArrayRef proxies, CFURLRef url); diff --git a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp index 677eee6c1..f6d1f3821 100644 --- a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp @@ -29,7 +29,6 @@ #include "AuthenticationCF.h" #include "AuthenticationChallenge.h" -#include "Base64.h" #include "CookieStorageCFNet.h" #include "CredentialStorage.h" #include "CachedResourceLoader.h" @@ -48,6 +47,7 @@ #include <sys/types.h> #include <wtf/HashMap.h> #include <wtf/Threading.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #if PLATFORM(MAC) diff --git a/Source/WebCore/platform/network/cf/ResourceRequest.h b/Source/WebCore/platform/network/cf/ResourceRequest.h index 72522d9ed..64be955f6 100644 --- a/Source/WebCore/platform/network/cf/ResourceRequest.h +++ b/Source/WebCore/platform/network/cf/ResourceRequest.h @@ -36,7 +36,7 @@ typedef const struct _CFURLRequest* CFURLRequestRef; OBJC_CLASS NSURLRequest; -#if USE(CFURLSTORAGESESSIONS) && (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD)) +#if USE(CFURLSTORAGESESSIONS) && PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 typedef struct __CFURLStorageSession* CFURLStorageSessionRef; #elif USE(CFURLSTORAGESESSIONS) typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; diff --git a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp index 7ce9b6039..520d68578 100644 --- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp @@ -265,7 +265,7 @@ void ResourceRequest::setHTTPPipeliningEnabled(bool flag) s_httpPipeliningEnabled = flag; } -#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if USE(CFNETWORK) || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static inline bool readBooleanPreference(CFStringRef key) { Boolean keyExistsAndHasValidFormat; @@ -281,7 +281,7 @@ unsigned initializeMaximumHTTPConnectionCountPerHost() // Always set the connection count per host, even when pipelining. unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount); -#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if USE(CFNETWORK) || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static const unsigned unlimitedConnectionCount = 10000; if (!ResourceRequest::httpPipeliningEnabled() && readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining"))) diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp b/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp index 9033340d8..d86c76bc6 100644 --- a/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp +++ b/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp @@ -41,7 +41,7 @@ #include <wtf/MainThread.h> #include <wtf/text/WTFString.h> -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include <SystemConfiguration/SystemConfiguration.h> #endif @@ -176,7 +176,7 @@ void SocketStreamHandle::removePACRunLoopSource() void SocketStreamHandle::chooseProxy() { -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFDictionaryRef> proxyDictionary(AdoptCF, CFNetworkCopySystemProxySettings()); #else // We don't need proxy information often, so there is no need to set up a permanent dynamic store session. diff --git a/Source/WebCore/platform/network/mac/AuthenticationMac.mm b/Source/WebCore/platform/network/mac/AuthenticationMac.mm index 82c660a6e..050268931 100644 --- a/Source/WebCore/platform/network/mac/AuthenticationMac.mm +++ b/Source/WebCore/platform/network/mac/AuthenticationMac.mm @@ -165,7 +165,7 @@ NSURLCredential *mac(const Credential& coreCredential) #else -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // There is no constant in headers, but NTLM is supported. NSString * const NSURLAuthenticationMethodNTLM = @"NSURLAuthenticationMethodNTLM"; #endif diff --git a/Source/WebCore/platform/network/mac/CookieStorageMac.mm b/Source/WebCore/platform/network/mac/CookieStorageMac.mm index 25b4d44f2..1de6888a2 100644 --- a/Source/WebCore/platform/network/mac/CookieStorageMac.mm +++ b/Source/WebCore/platform/network/mac/CookieStorageMac.mm @@ -79,7 +79,7 @@ namespace WebCore { void setCookieStoragePrivateBrowsingEnabled(bool enabled) { -#if defined(BUILDING_ON_SNOW_LEOPARD) && USE(CFURLSTORAGESESSIONS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 && USE(CFURLSTORAGESESSIONS) // Don't call wkSetCookieStoragePrivateBrowsingEnabled() when cookie storage is set up via sessions. // That would make NSURLConnect use global private browsing cookie storage regardless of request session. // The global private cookie storage has different semantics - it makes new cookies non-persistent, diff --git a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm index 4ac33ccdc..7e226e259 100644 --- a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm +++ b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm @@ -30,7 +30,6 @@ #import "AuthenticationChallenge.h" #import "AuthenticationMac.h" -#import "Base64.h" #import "BlobRegistry.h" #import "BlockExceptions.h" #import "CookieStorage.h" @@ -52,8 +51,9 @@ #import "SubresourceLoader.h" #import "WebCoreSystemInterface.h" #import "WebCoreURLResponse.h" -#import <wtf/text/CString.h> #import <wtf/UnusedParam.h> +#import <wtf/text/Base64.h> +#import <wtf/text/CString.h> using namespace WebCore; @@ -214,7 +214,7 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential nsRequest = mutableRequest; } -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT([NSURLConnection instancesRespondToSelector:@selector(_initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:)]); static bool supportsSettingConnectionProperties = true; #else @@ -512,7 +512,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall // we make sure that is actually present ASSERT(challenge.nsURLAuthenticationChallenge()); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOWLEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // Proxy authentication is handled by CFNetwork internally. We can get here if the user cancels // CFNetwork authentication dialog, and we shouldn't ask the client to display another one in that case. if (challenge.protectionSpace().isProxy()) { diff --git a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm index 262fdb446..96c497d50 100644 --- a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm +++ b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm @@ -82,7 +82,7 @@ void ResourceRequest::doUpdateResourceRequest() m_httpMethod = method; m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (ResourceRequest::httpPipeliningEnabled()) m_priority = toResourceLoadPriority(wkGetHTTPPipeliningPriority([m_nsRequest.get() _CFURLRequest])); #endif @@ -129,13 +129,13 @@ void ResourceRequest::doUpdatePlatformRequest() nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (ResourceRequest::httpPipeliningEnabled()) wkSetHTTPPipeliningPriority([nsRequest _CFURLRequest], toHTTPPipeliningPriority(m_priority)); #endif [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 wkCFURLRequestAllowAllPostCaching([nsRequest _CFURLRequest]); #endif diff --git a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm index be2e2767f..6aa76f6dd 100644 --- a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm +++ b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm @@ -497,7 +497,7 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse) } } -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Workaround for <rdar://problem/5539824> if (CFStringCompare(result.get(), CFSTR("text/xml"), 0) == kCFCompareEqualTo) result = CFSTR("application/xml"); diff --git a/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp b/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp index 2d7174799..f309e5d84 100644 --- a/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp +++ b/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp @@ -37,8 +37,10 @@ void setCookieStoragePrivateBrowsingEnabled(bool enabled) } #if USE(PLATFORM_STRATEGIES) -static void soupCookiesChanged(SoupCookieJar*, SoupCookie*, SoupCookie*, gpointer) +static void soupCookiesChanged(SoupCookieJar* jar, SoupCookie*, SoupCookie*, gpointer) { + if (jar != soupCookieJar()) + return; platformStrategies()->cookiesStrategy()->notifyCookiesChanged(); } #endif diff --git a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp index 60e4e1532..35d41abfb 100644 --- a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -27,7 +27,6 @@ #include "config.h" #include "ResourceHandle.h" -#include "Base64.h" #include "CachedResourceLoader.h" #include "ChromeClient.h" #include "CookieJarSoup.h" diff --git a/Source/WebCore/platform/network/soup/ResourceResponse.h b/Source/WebCore/platform/network/soup/ResourceResponse.h index 8624c0591..b8084cff4 100644 --- a/Source/WebCore/platform/network/soup/ResourceResponse.h +++ b/Source/WebCore/platform/network/soup/ResourceResponse.h @@ -29,6 +29,7 @@ #include "ResourceResponseBase.h" #include <libsoup/soup.h> +#include <wtf/gobject/GRefPtr.h> namespace WebCore { @@ -37,18 +38,21 @@ public: ResourceResponse() : ResourceResponseBase() , m_soupFlags(static_cast<SoupMessageFlags>(0)) + , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) { } ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename) : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) , m_soupFlags(static_cast<SoupMessageFlags>(0)) + , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) { } ResourceResponse(SoupMessage* soupMessage) : ResourceResponseBase() , m_soupFlags(static_cast<SoupMessageFlags>(0)) + , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) { updateFromSoupMessage(soupMessage); } @@ -62,11 +66,19 @@ public: const String& sniffedContentType() const { return m_sniffedContentType; } void setSniffedContentType(const String& value) { m_sniffedContentType = value; } + GTlsCertificate* soupMessageCertificate() const { return m_certificate.get(); } + void setSoupMessageCertificate(GTlsCertificate* certificate) { m_certificate = certificate; } + + GTlsCertificateFlags soupMessageTLSErrors() const { return m_tlsErrors; } + void setSoupMessageTLSErrors(GTlsCertificateFlags tlsErrors) { m_tlsErrors = tlsErrors; } + private: friend class ResourceResponseBase; SoupMessageFlags m_soupFlags; String m_sniffedContentType; + GRefPtr<GTlsCertificate> m_certificate; + GTlsCertificateFlags m_tlsErrors; void doUpdateResourceResponse() { } diff --git a/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp b/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp index 155048b2b..ddaa893b6 100644 --- a/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp +++ b/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp @@ -51,6 +51,8 @@ SoupMessage* ResourceResponse::toSoupMessage() const soup_message_set_flags(soupMessage, m_soupFlags); + g_object_set(G_OBJECT(soupMessage), "tls-certificate", m_certificate.get(), "tls-errors", m_tlsErrors, NULL); + // Body data is not in the message. return soupMessage; } @@ -84,6 +86,10 @@ void ResourceResponse::updateFromSoupMessage(SoupMessage* soupMessage) setExpectedContentLength(soup_message_headers_get_content_length(soupMessage->response_headers)); setHTTPStatusText(soupMessage->reason_phrase); setSuggestedFilename(filenameFromHTTPContentDisposition(httpHeaderField("Content-Disposition"))); + + GTlsCertificate* certificate = 0; + soup_message_get_https_status(soupMessage, &certificate, &m_tlsErrors); + m_certificate = certificate; } } diff --git a/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp b/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp new file mode 100644 index 000000000..40eafb214 --- /dev/null +++ b/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * (C) 2012 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "config.h" +#include "MemoryUsageSupport.h" + +#include "JSDOMWindow.h" +#include <runtime/MemoryStatistics.h> +#include <wtf/FastMalloc.h> + +#if OS(LINUX) +#include <malloc.h> +#endif + +namespace WebCore { + +#if OS(LINUX) +static size_t mallocMemoryUsage(bool inuse) +{ + // Return how much memory (in bytes) has been allocated on the system heap. + struct mallinfo minfo = ::mallinfo(); + + // If we want the internal memory usage, we subtract the memory used by + // free blocks. That is memory allocated from the system by malloc but + // which malloc considers free. + return minfo.arena - (inuse ? minfo.fordblks : 0); +} +#else +static size_t mallocMemoryUsage(bool) +{ + // FIXME: Implement for other supported OS's. + return 0; +} +#endif + +// This is how much system-memory we use. +static int memoryUsageKB() +{ + size_t mallocUsage = mallocMemoryUsage(false); + WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics(); + + // Extract memory statistics from JavaScriptCore: + JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics(); + size_t jscHeapUsage = JSDOMWindow::commonJSGlobalData()->heap.capacity(); + return (mallocUsage + fmStats.committedVMBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10; +} + +// This is how much memory we use internally, not including memory only reserved from the system. +static int actualMemoryUsageKB() +{ + size_t mallocUsage = mallocMemoryUsage(true); + WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics(); + + // Extract memory statistics from JavaScriptCore: + JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics(); + size_t jscHeapUsage = JSDOMWindow::commonJSGlobalData()->heap.size(); + return (mallocUsage + fmStats.committedVMBytes - fmStats.freeListBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10; +} + +int MemoryUsageSupport::memoryUsageMB() +{ + return memoryUsageKB() >> 10; +} + +int MemoryUsageSupport::actualMemoryUsageMB() +{ + return actualMemoryUsageKB() >> 10; +} + +// FIXME: These values should be determined based on hardware or set by the application. + +static const unsigned normalMemoryWatermark = 128; // Chromium default: 256 +static const unsigned highMemoryWatermark = 256; // Chromium default: 1024 +static const unsigned highMemoryDelta = 64; // Chromium default: 128 + +int MemoryUsageSupport::lowMemoryUsageMB() +{ + return normalMemoryWatermark; +} + +int MemoryUsageSupport::highMemoryUsageMB() +{ + return highMemoryWatermark; +} + +int MemoryUsageSupport::highUsageDeltaMB() +{ + return highMemoryDelta; +} + +bool MemoryUsageSupport::processMemorySizesInBytes(size_t*, size_t*) +{ + // FIXME: Not implemented. + return false; +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/qt/PlatformScreenQt.cpp b/Source/WebCore/platform/qt/PlatformScreenQt.cpp index cf381ee68..f30472a0b 100644 --- a/Source/WebCore/platform/qt/PlatformScreenQt.cpp +++ b/Source/WebCore/platform/qt/PlatformScreenQt.cpp @@ -143,7 +143,7 @@ FloatRect screenAvailableRect(Widget* widget) return FloatRect(r.x(), r.y(), r.width(), r.height()); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/qt/PlatformSupport.h b/Source/WebCore/platform/qt/PlatformSupport.h index 0e188db8f..d0bf1549a 100644 --- a/Source/WebCore/platform/qt/PlatformSupport.h +++ b/Source/WebCore/platform/qt/PlatformSupport.h @@ -92,14 +92,6 @@ public: // Plugin static NPObject* pluginScriptableObject(Widget*); - // If memory usage is below this threshold, do not bother forcing GC. - static int lowMemoryUsageMB() { return 256; } - - // If memory usage is above this threshold, force GC more aggressively. - static int highMemoryUsageMB() { return 1024; } - - // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high. - static int highUsageDeltaMB() { return 128; } }; } diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp index 170d39b59..3d1f94245 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp @@ -66,7 +66,7 @@ static const float buttonPaddingRight = 18; static const float buttonPaddingTop = 2; static const float buttonPaddingBottom = 3; static const float menuListPadding = 9; -static const float textFieldPadding = 5; +static const float textFieldPadding = 10; static const float radiusFactor = 0.36; static const float progressBarChunkPercentage = 0.2; #if ENABLE(PROGRESS_TAG) @@ -108,6 +108,44 @@ uint qHash(const KeyIdentifier& id) return hash; } +/* + * The octants' indices are identified below, for each point (x,y) + * in the first octant, we can populate the 7 others with the corresponding + * point. + * + * index | xpos | ypos + * xd --------------------------- + * 4 |<--->| 3 0 | xd + x | y + * __________________ 1 | xd + y | x + * / \ 2 | xd + y | -x + * 5 | .(c) | 2 3 | xd + x | -y + * 6 | | 1 4 | -xd - x | -y + * \__________________/ 5 | -xd - y | -x + * 6 | -xd - y | x + * 7 0 7 | -xd - x | y + * + **/ + +static void addPointToOctants(QVector<QPainterPath>& octants, const QPointF& center, qreal x, qreal y , int xDelta = 0) +{ + ASSERT(octants.count() == 8); + + for (short i = 0; i < 8; ++i) { + QPainterPath& octant = octants[i]; + QPointF pos(center); + // The Gray code corresponding to the octant's index helps doing the math in a more generic way. + const short gray = (i >> 1) ^ i; + const qreal xOffset = xDelta + ((gray & 1) ? y : x); + pos.ry() += ((gray & 2)? -1 : 1) * ((gray & 1) ? x : y); + pos.rx() += (i < 4) ? xOffset : -xOffset; + + if (octant.elementCount()) + octant.lineTo(pos); + else // The path is empty. Initialize the start point. + octant.moveTo(pos); + } +} + static void drawControlBackground(QPainter* painter, const QPen& pen, const QRect& rect, const QBrush& brush) { QPen oldPen = painter->pen(); @@ -116,28 +154,32 @@ static void drawControlBackground(QPainter* painter, const QPen& pen, const QRec painter->setPen(pen); painter->setBrush(brush); - const int line = 1; - const QRect paddedRect = rect.adjusted(line, line, -line, -line); + static const qreal line = 1.5; + const QRectF paddedRect = rect.adjusted(line, line, -line, -line); - const int n = 3; + static const int n = 3; const qreal invPow = 1 / double(n); ASSERT(paddedRect.width() >= paddedRect.height()); const int radius = paddedRect.height() / 2; const int xDelta = paddedRect.width() / 2 - radius; - const QPoint center = paddedRect.topLeft() + QPoint(xDelta + radius, radius); - qreal x, y; - QPainterPath path; - path.moveTo(-xDelta, -radius); - for (y = -radius ; y <= radius; ++y) { - x = -xDelta - radius * pow(1 - pow(qAbs(y) / radius , n), invPow); - path.lineTo(x, y); + const QPointF center = paddedRect.center(); + qreal x = 0; + qreal y; + QVector<QPainterPath> octants(8); + // Stay within reasonable distance from edge values, which can cause artifacts at certain zoom levels. + static const float epsilon = 0.02; + for (y = radius - epsilon; y - epsilon > x; y -= 0.5) { + x = radius * pow(1 - pow(qAbs(y) / radius , n), invPow); + addPointToOctants(octants, center, x, y, xDelta); } - for (y = radius ; y >= -radius; --y) { - x = xDelta + radius * pow(1 - pow(qAbs(y) / radius , n), invPow); - path.lineTo(x, y); + + QPainterPath path = octants.first(); + for (int i = 1; i < 8; ++i) { + // Due to the orientation of the arcs, we need to reverse the paths with odd indices. + QPainterPath subPath = (i % 2) ? octants.at(i).toReversed() : octants.at(i); + path.connectPath(subPath); } path.closeSubpath(); - path.translate(center); painter->drawPath(path); painter->setPen(oldPen); @@ -152,7 +194,7 @@ static inline QRect shrinkRectToSquare(const QRect& rect) static inline QPen borderPen(QPainter* painter = 0) { - return QPen(darkColor, 0.4 * painterScale(painter), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + return QPen(darkColor, qMin(1.0, 0.4 * painterScale(painter))); } QSharedPointer<StylePainter> RenderThemeQtMobile::getStylePainter(const PaintInfo& pi) @@ -383,14 +425,14 @@ QPixmap StylePainterMobile::findLineEdit(const QSize & size, bool focused) const if (!findCachedControl(id, &result)) { const int focusFrame = painterScale(painter); - result = QPixmap(size + QSize(2 * focusFrame, 2 * focusFrame)); + result = QPixmap(size); result.fill(Qt::transparent); const QRect rect = result.rect().adjusted(focusFrame, focusFrame, -focusFrame, -focusFrame); QPainter cachePainter(&result); drawControlBackground(&cachePainter, borderPen(painter), rect, Qt::white); if (focused) { - QPen focusPen(highlightColor, focusFrame, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + QPen focusPen(highlightColor, 1.2 * painterScale(painter), Qt::SolidLine); drawControlBackground(&cachePainter, focusPen, rect, Qt::NoBrush); } insertIntoCache(id, result); @@ -697,6 +739,10 @@ void RenderThemeQtMobile::adjustTextFieldStyle(StyleResolver*, RenderStyle* styl // padding. Just worth keeping in mind! style->setBackgroundColor(Color::transparent); style->resetBorder(); + style->setBorderTopWidth(frameWidth); + style->setBorderRightWidth(frameWidth); + style->setBorderBottomWidth(frameWidth); + style->setBorderLeftWidth(frameWidth); style->resetPadding(); computeSizeBasedOnStyle(style); style->setPaddingLeft(Length(textFieldPadding, Fixed)); diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.h b/Source/WebCore/platform/qt/RenderThemeQtMobile.h index bc2036c79..2d1e53dad 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.h +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.h @@ -53,8 +53,10 @@ public: virtual bool delegatesMenuListRendering() const { return true; } - // drawFocusRing() will return early if the color is invalid. - virtual Color platformFocusRingColor() const { return Color(); } + // We don't want the focus ring to be drawn by the graphics context so we + // always claim to support it in the theme. + // FIXME: This could be a usability problem in the case of contenteditable divs. + virtual bool supportsFocusRing(const RenderStyle*) const { return true; } protected: diff --git a/Source/WebCore/platform/text/Base64.h b/Source/WebCore/platform/text/Base64.h deleted file mode 100644 index 70855de04..000000000 --- a/Source/WebCore/platform/text/Base64.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> - * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef Base64_h -#define Base64_h - -#include <wtf/Vector.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> - -namespace WebCore { - -enum Base64DecodePolicy { FailOnInvalidCharacter, IgnoreWhitespace, IgnoreInvalidCharacters }; - -void base64Encode(const char*, unsigned, Vector<char>&, bool insertLFs = false); -void base64Encode(const Vector<char>&, Vector<char>&, bool insertLFs = false); -void base64Encode(const CString&, Vector<char>&, bool insertLFs = false); -String base64Encode(const char*, unsigned, bool insertLFs = false); -String base64Encode(const Vector<char>&, bool insertLFs = false); -String base64Encode(const CString&, bool insertLFs = false); - -bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter); -bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter); -bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter); - -inline void base64Encode(const Vector<char>& in, Vector<char>& out, bool insertLFs) -{ - base64Encode(in.data(), in.size(), out, insertLFs); -} - -inline void base64Encode(const CString& in, Vector<char>& out, bool insertLFs) -{ - base64Encode(in.data(), in.length(), out, insertLFs); -} - -inline String base64Encode(const Vector<char>& in, bool insertLFs) -{ - return base64Encode(in.data(), in.size(), insertLFs); -} - -inline String base64Encode(const CString& in, bool insertLFs) -{ - return base64Encode(in.data(), in.length(), insertLFs); -} - -} // namespace WebCore - -#endif // Base64_h diff --git a/Source/WebCore/platform/text/TextChecking.h b/Source/WebCore/platform/text/TextChecking.h index 0742cb32d..53364397f 100644 --- a/Source/WebCore/platform/text/TextChecking.h +++ b/Source/WebCore/platform/text/TextChecking.h @@ -39,18 +39,18 @@ namespace WebCore { #define WTF_USE_GRAMMAR_CHECKING 1 -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) #define WTF_USE_UNIFIED_TEXT_CHECKING 1 #define WTF_USE_AUTOMATIC_TEXT_REPLACEMENT 1 #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) // Some platforms provide UI for suggesting autocorrection. #define WTF_USE_AUTOCORRECTION_PANEL 1 // Some platforms use spelling and autocorrection markers to provide visual cue. // On such platform, if word with marker is edited, we need to remove the marker. #define WTF_USE_MARKER_REMOVAL_UPON_EDITING 1 -#endif // #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // #if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) enum TextCheckingType { TextCheckingTypeSpelling = 1 << 1, diff --git a/Source/WebCore/platform/text/cf/HyphenationCF.cpp b/Source/WebCore/platform/text/cf/HyphenationCF.cpp index f170b8afa..4e3fced44 100644 --- a/Source/WebCore/platform/text/cf/HyphenationCF.cpp +++ b/Source/WebCore/platform/text/cf/HyphenationCF.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "Hyphenation.h" -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if (!PLATFORM(MAC) && !PLATFORM(CHROMIUM)) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #include "AtomicStringKeyedMRUCache.h" #include "TextBreakIteratorInternalICU.h" @@ -70,10 +70,11 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI RetainPtr<CFLocaleRef> locale = cfLocaleCache().get(localeIdentifier); ASSERT(locale); - CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale.get(), 0); + CFOptionFlags searchAcrossWordBoundaries = 1; + CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), searchAcrossWordBoundaries, locale.get(), 0); return result == kCFNotFound ? 0 : result; } } // namespace WebCore -#endif // !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // (!PLATFORM(MAC) && !PLATFORM(CHROMIUM)) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 diff --git a/Source/WebCore/platform/text/mac/HyphenationMac.mm b/Source/WebCore/platform/text/mac/HyphenationMac.mm index 4c8676892..40b77c815 100644 --- a/Source/WebCore/platform/text/mac/HyphenationMac.mm +++ b/Source/WebCore/platform/text/mac/HyphenationMac.mm @@ -26,7 +26,7 @@ #import "config.h" #import "Hyphenation.h" -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 #import "AtomicStringKeyedMRUCache.h" #import "TextBreakIteratorInternalICU.h" @@ -67,4 +67,4 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI } // namespace WebCore -#endif // defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#endif // !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 diff --git a/Source/WebCore/platform/text/mac/LocaleMac.h b/Source/WebCore/platform/text/mac/LocaleMac.h index 6f1365f79..074fe3e12 100644 --- a/Source/WebCore/platform/text/mac/LocaleMac.h +++ b/Source/WebCore/platform/text/mac/LocaleMac.h @@ -65,6 +65,7 @@ public: #endif private: + explicit LocaleMac(NSLocale*); explicit LocaleMac(const String&); NSDateFormatter *createShortDateFormatter(); diff --git a/Source/WebCore/platform/text/mac/LocaleMac.mm b/Source/WebCore/platform/text/mac/LocaleMac.mm index 219e95c84..35b64de6a 100644 --- a/Source/WebCore/platform/text/mac/LocaleMac.mm +++ b/Source/WebCore/platform/text/mac/LocaleMac.mm @@ -55,6 +55,11 @@ static NSDateFormatter* createDateTimeFormatter(NSLocale* locale, NSDateFormatte return formatter; } +LocaleMac::LocaleMac(NSLocale* locale) + : m_locale(locale) +{ +} + LocaleMac::LocaleMac(const String& localeIdentifier) : m_locale([[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]) { @@ -71,7 +76,7 @@ PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier) LocaleMac* LocaleMac::currentLocale() { - static LocaleMac* currentLocale = LocaleMac::create([[NSLocale currentLocale] localeIdentifier]).leakPtr(); + static LocaleMac* currentLocale = new LocaleMac([NSLocale currentLocale]); return currentLocale; } diff --git a/Source/WebCore/platform/win/PlatformScreenWin.cpp b/Source/WebCore/platform/win/PlatformScreenWin.cpp index 21bf23c63..5ea24b414 100644 --- a/Source/WebCore/platform/win/PlatformScreenWin.cpp +++ b/Source/WebCore/platform/win/PlatformScreenWin.cpp @@ -118,7 +118,7 @@ FloatRect screenAvailableRect(Widget* widget) return monitorInfo.rcWork; } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp b/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp index b10961b79..da68de780 100644 --- a/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp +++ b/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "SSLKeyGenerator.h" -#include "Base64.h" +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <windows.h> diff --git a/Source/WebCore/platform/win/SoftLinking.h b/Source/WebCore/platform/win/SoftLinking.h index 4124d5fc5..cd5c2c1bf 100644 --- a/Source/WebCore/platform/win/SoftLinking.h +++ b/Source/WebCore/platform/win/SoftLinking.h @@ -79,6 +79,23 @@ return ptr; \ }\ +#define SOFT_LINK_LOADED_LIBRARY(library, functionName, resultType, callingConvention, parameterDeclarations) \ + typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \ + static functionName##PtrType functionName##Ptr() \ + { \ + static functionName##PtrType ptr; \ + static bool initialized; \ + \ + if (initialized) \ + return ptr; \ + initialized = true; \ + \ + static HINSTANCE libraryInstance = ::GetModuleHandle(L#library); \ + \ + ptr = reinterpret_cast<functionName##PtrType>(SOFT_LINK_GETPROCADDRESS(libraryInstance, #functionName)); \ + return ptr; \ + }\ + /* In order to soft link against functions decorated with __declspec(dllimport), we prepend "softLink_" to the function names. If you use SOFT_LINK_DLL_IMPORT(), you will also need to #define the function name to account for this, e.g.: @@ -102,6 +119,36 @@ return softLink##functionName parameterNames; \ } +#define SOFT_LINK_DLL_IMPORT_OPTIONAL(library, functionName, resultType, callingConvention, parameterDeclarations) \ + typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \ + static functionName##PtrType functionName##Ptr() \ + { \ + static functionName##PtrType ptr; \ + static bool initialized; \ + \ + if (initialized) \ + return ptr; \ + initialized = true; \ + \ + ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName)); \ + return ptr; \ + }\ + +#define SOFT_LINK_DLL_IMPORT_OPTIONAL(library, functionName, resultType, callingConvention, parameterDeclarations) \ + typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \ + static functionName##PtrType functionName##Ptr() \ + { \ + static functionName##PtrType ptr; \ + static bool initialized; \ + \ + if (initialized) \ + return ptr; \ + initialized = true; \ + \ + ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName)); \ + return ptr; \ + }\ + /* Variables exported by a DLL need to be accessed through a function. If you use SOFT_LINK_VARIABLE_DLL_IMPORT(), you will also need to #define the variable name to account for this, e.g.: @@ -117,4 +164,16 @@ return *ptr; \ }\ +/* + Note that this will only work for variable types for which a return value of 0 can signal an error. + */ +#define SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(library, variableName, variableType) \ + static variableType get_##variableName() \ + { \ + static variableType* ptr = reinterpret_cast<variableType*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #variableName)); \ + if (!ptr) \ + return 0; \ + return *ptr; \ + }\ + #endif // SoftLinking_h diff --git a/Source/WebCore/platform/wx/PasteboardWx.cpp b/Source/WebCore/platform/wx/PasteboardWx.cpp index 752fdaccf..48183fa6f 100644 --- a/Source/WebCore/platform/wx/PasteboardWx.cpp +++ b/Source/WebCore/platform/wx/PasteboardWx.cpp @@ -99,7 +99,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP wxHTMLDataObject data; wxTheClipboard->GetData(data); chosePlainText = false; - fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", FragmentScriptingNotAllowed); + fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", DisallowScriptingContent); } else #endif { diff --git a/Source/WebCore/rendering/FlowThreadController.cpp b/Source/WebCore/rendering/FlowThreadController.cpp index cf2207ffe..dc9432c76 100644 --- a/Source/WebCore/rendering/FlowThreadController.cpp +++ b/Source/WebCore/rendering/FlowThreadController.cpp @@ -33,6 +33,8 @@ #include "RenderFlowThread.h" #include "RenderNamedFlowThread.h" +#include "WebKitNamedFlow.h" +#include "WebKitNamedFlowCollection.h" #include <wtf/text/AtomicString.h> namespace WebCore { @@ -65,7 +67,12 @@ RenderNamedFlowThread* FlowThreadController::ensureRenderFlowThreadWithName(cons } } - RenderNamedFlowThread* flowRenderer = new (m_view->renderArena()) RenderNamedFlowThread(m_view->document(), name); + WebKitNamedFlowCollection* namedFlows = m_view->document()->namedFlows(); + + // Sanity check for the absence of a named flow in the "CREATED" state with the same name. + ASSERT(!namedFlows->flowByName(name)); + + RenderNamedFlowThread* flowRenderer = new (m_view->renderArena()) RenderNamedFlowThread(m_view->document(), namedFlows->ensureFlowWithName(name)); flowRenderer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style())); m_renderNamedFlowThreadList->add(flowRenderer); @@ -122,4 +129,10 @@ void FlowThreadController::unregisterNamedFlowContentNode(Node* contentNode) m_mapNamedFlowContentNodes.remove(contentNode); } +void FlowThreadController::removeFlowThread(RenderNamedFlowThread* flowThread) +{ + m_renderNamedFlowThreadList->remove(flowThread); + setIsRenderNamedFlowThreadOrderDirty(true); +} + } // namespace WebCore diff --git a/Source/WebCore/rendering/FlowThreadController.h b/Source/WebCore/rendering/FlowThreadController.h index 0c317692f..d48c87972 100644 --- a/Source/WebCore/rendering/FlowThreadController.h +++ b/Source/WebCore/rendering/FlowThreadController.h @@ -64,6 +64,8 @@ public: void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*); void unregisterNamedFlowContentNode(Node*); + + void removeFlowThread(RenderNamedFlowThread*); protected: FlowThreadController(RenderView*); diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp index dc45001af..a96f61225 100644 --- a/Source/WebCore/rendering/InlineFlowBox.cpp +++ b/Source/WebCore/rendering/InlineFlowBox.cpp @@ -788,10 +788,13 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu RenderStyle* style = renderer()->style(isFirstLineStyle()); if (!style->hasBorderImageOutsets()) return; - - LayoutUnit borderOutsetLogicalTop; - LayoutUnit borderOutsetLogicalBottom; - style->getBorderImageBlockDirectionOutsets(borderOutsetLogicalTop, borderOutsetLogicalBottom); + + FractionalLayoutBoxExtent borderOutsets = style->borderImageOutsets(); + + LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style); + LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style); + LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style); + LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style); // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since // the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes. @@ -800,10 +803,6 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() - outsetLogicalTop, logicalVisualOverflow.y()); LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY()); - - LayoutUnit borderOutsetLogicalLeft; - LayoutUnit borderOutsetLogicalRight; - style->getBorderImageInlineDirectionOutsets(borderOutsetLogicalLeft, borderOutsetLogicalRight); LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : ZERO_LAYOUT_UNIT; LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : ZERO_LAYOUT_UNIT; @@ -1187,29 +1186,25 @@ static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP { LayoutRect clipRect(paintRect); RenderStyle* style = box->renderer()->style(); - LayoutUnit topOutset; - LayoutUnit rightOutset; - LayoutUnit bottomOutset; - LayoutUnit leftOutset; - style->getImageOutsets(image, topOutset, rightOutset, bottomOutset, leftOutset); + LayoutBoxExtent outsets = style->imageOutsets(image); if (box->isHorizontal()) { - clipRect.setY(paintRect.y() - topOutset); - clipRect.setHeight(paintRect.height() + topOutset + bottomOutset); + clipRect.setY(paintRect.y() - outsets.top()); + clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom()); if (box->includeLogicalLeftEdge()) { - clipRect.setX(paintRect.x() - leftOutset); - clipRect.setWidth(paintRect.width() + leftOutset); + clipRect.setX(paintRect.x() - outsets.left()); + clipRect.setWidth(paintRect.width() + outsets.left()); } if (box->includeLogicalRightEdge()) - clipRect.setWidth(clipRect.width() + rightOutset); + clipRect.setWidth(clipRect.width() + outsets.right()); } else { - clipRect.setX(paintRect.x() - leftOutset); - clipRect.setWidth(paintRect.width() + leftOutset + rightOutset); + clipRect.setX(paintRect.x() - outsets.left()); + clipRect.setWidth(paintRect.width() + outsets.left() + outsets.right()); if (box->includeLogicalLeftEdge()) { - clipRect.setY(paintRect.y() - topOutset); - clipRect.setHeight(paintRect.height() + topOutset); + clipRect.setY(paintRect.y() - outsets.top()); + clipRect.setHeight(paintRect.height() + outsets.top()); } if (box->includeLogicalRightEdge()) - clipRect.setHeight(clipRect.height() + bottomOutset); + clipRect.setHeight(clipRect.height() + outsets.bottom()); } return clipRect; } diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 030b18711..94cd749c1 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2091,8 +2091,11 @@ LayoutUnit RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& margin void RenderBlock::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& positiveMarginBefore, LayoutUnit& negativeMarginBefore) const { - // FIXME: We could get even more quirks mode cases right if we dealt with quirk containers. // FIXME: We should deal with the margin-collapse-* style extensions that prevent collapsing and that discard margins. + // Give up if in quirks mode and we're a body/table cell and the top margin of the child box is quirky. + if (document()->inQuirksMode() && child->isMarginBeforeQuirk() && (isTableCell() || isBody())) + return; + LayoutUnit beforeChildMargin = marginBeforeForChild(child); positiveMarginBefore = max(positiveMarginBefore, beforeChildMargin); negativeMarginBefore = max(negativeMarginBefore, -beforeChildMargin); @@ -2118,6 +2121,13 @@ void RenderBlock::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& pos if (!grandchildBox || grandchildBox->style()->clear() != CNONE) return; + // Make sure to update the block margins now for the grandchild box so that we're looking at current values. + if (grandchildBox->needsLayout()) { + grandchildBox->computeBlockDirectionMargins(this); + grandchildBox->setMarginBeforeQuirk(grandchildBox->style()->marginBefore().quirk()); + grandchildBox->setMarginAfterQuirk(grandchildBox->style()->marginAfter().quirk()); + } + // Collapse the margin of the grandchild box with our own to produce an estimate. childBlock->marginBeforeEstimateForChild(grandchildBox, positiveMarginBefore, negativeMarginBefore); } @@ -2427,7 +2437,9 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay setLogicalTopForChild(child, logicalTopAfterClear, ApplyLayoutDelta); // Now we have a final top position. See if it really does end up being different from our estimate. - if (logicalTopAfterClear != logicalTopEstimate) { + // clearFloatsIfNeeded can also mark the child as needing a layout even though we didn't move. This happens + // when collapseMargins dynamically adds overhanging floats because of a child with negative margins. + if (logicalTopAfterClear != logicalTopEstimate || child->needsLayout()) { if (child->shrinkToAvoidFloats()) { // The child's width depends on the line width. // When the child shifts to clear an item, its width can @@ -4583,6 +4595,10 @@ LayoutUnit RenderBlock::getClearDelta(RenderBox* child, LayoutUnit logicalTop) if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWidthForContent(newLogicalTop)) return newLogicalTop - logicalTop; + RenderRegion* region = regionAtBlockOffset(logicalTopForChild(child)); + LayoutRect borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child), DoNotCacheRenderBoxRegionInfo); + LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWritingMode() ? borderBox.width() : borderBox.height(); + // FIXME: None of this is right for perpendicular writing-mode children. LayoutUnit childOldLogicalWidth = child->logicalWidth(); LayoutUnit childOldMarginLeft = child->marginLeft(); @@ -4591,8 +4607,8 @@ LayoutUnit RenderBlock::getClearDelta(RenderBox* child, LayoutUnit logicalTop) child->setLogicalTop(newLogicalTop); child->computeLogicalWidth(); - RenderRegion* region = regionAtBlockOffset(logicalTopForChild(child)); - LayoutRect borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child), DoNotCacheRenderBoxRegionInfo); + region = regionAtBlockOffset(logicalTopForChild(child)); + borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child), DoNotCacheRenderBoxRegionInfo); LayoutUnit childLogicalWidthAtNewLogicalTopOffset = isHorizontalWritingMode() ? borderBox.width() : borderBox.height(); child->setLogicalTop(childOldLogicalTop); @@ -4600,8 +4616,14 @@ LayoutUnit RenderBlock::getClearDelta(RenderBox* child, LayoutUnit logicalTop) child->setMarginLeft(childOldMarginLeft); child->setMarginRight(childOldMarginRight); - if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthAtNewLogicalTopOffset) + if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthAtNewLogicalTopOffset) { + // Even though we may not be moving, if the logical width did shrink because of the presence of new floats, then + // we need to force a relayout as though we shifted. This happens because of the dynamic addition of overhanging floats + // from previous siblings when negative margins exist on a child (see the addOverhangingFloats call at the end of collapseMargins). + if (childLogicalWidthAtOldLogicalTopOffset != childLogicalWidthAtNewLogicalTopOffset) + child->setChildNeedsLayout(true, MarkOnlyThis); return newLogicalTop - logicalTop; + } newLogicalTop = nextFloatLogicalBottomBelow(newLogicalTop); ASSERT(newLogicalTop >= logicalTop); diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 123617104..71416a103 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -295,10 +295,10 @@ public: LayoutUnit marginAfterForChild(const RenderBoxModelObject* child) const { return child->marginAfter(style()); } LayoutUnit marginStartForChild(const RenderBoxModelObject* child) const { return child->marginStart(style()); } LayoutUnit marginEndForChild(const RenderBoxModelObject* child) const { return child->marginEnd(style()); } - void setMarginStartForChild(RenderBox* child, LayoutUnit value) { child->setMarginStart(value, style()); } - void setMarginEndForChild(RenderBox* child, LayoutUnit value) { child->setMarginEnd(value, style()); } - void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) { child->setMarginBefore(value, style()); } - void setMarginAfterForChild(RenderBox* child, LayoutUnit value) { child->setMarginAfter(value, style()); } + void setMarginStartForChild(RenderBox* child, LayoutUnit value) const { child->setMarginStart(value, style()); } + void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child->setMarginEnd(value, style()); } + void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { child->setMarginBefore(value, style()); } + void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { child->setMarginAfter(value, style()); } LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index b64be4e8d..2f2ab2421 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -934,17 +934,7 @@ LayoutRect RenderBox::maskClipRect() LayoutRect borderImageRect = borderBoxRect(); // Apply outsets to the border box. - LayoutUnit topOutset; - LayoutUnit rightOutset; - LayoutUnit bottomOutset; - LayoutUnit leftOutset; - style()->getMaskBoxImageOutsets(topOutset, rightOutset, bottomOutset, leftOutset); - - borderImageRect.setX(borderImageRect.x() - leftOutset); - borderImageRect.setY(borderImageRect.y() - topOutset); - borderImageRect.setWidth(borderImageRect.width() + leftOutset + rightOutset); - borderImageRect.setHeight(borderImageRect.height() + topOutset + bottomOutset); - + borderImageRect.expand(style()->maskBoxImageOutsets()); return borderImageRect; } @@ -1178,7 +1168,6 @@ LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar } LayoutUnit result = cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion, adjustedPageOffsetForContainingBlock) - childMarginStart - childMarginEnd; - result = max(result, minPreferredLogicalWidth()); // Don't shrink below our minimum preferred logical width. // We need to see if margins on either the start side or the end side can contain the floats in question. If they can, // then just using the line width is inaccurate. In the case where a float completely fits, we don't need to use the line @@ -1741,7 +1730,6 @@ LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, Layou ASSERT(!logicalWidth.isUndefined()); - // FIXME: minWidth:auto on a flex-item needs to go down the intrinsicOrAuto path below. if (widthType == MinSize && logicalWidth.isAuto()) return computeBorderBoxLogicalWidth(0); @@ -2077,10 +2065,8 @@ LayoutUnit RenderBox::computeLogicalHeightUsing(SizeType heightType, const Lengt LayoutUnit RenderBox::computeContentLogicalHeightUsing(SizeType heightType, const Length& height) { - // FIXME: For flexboxes, minHeight:auto should be min-content. if (height.isAuto()) return heightType == MinSize ? 0 : -1; - if (height.isFixed()) return height.value(); if (height.isPercent()) @@ -2189,7 +2175,6 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType sizeType, Length logicalWidth) const { - // FIXME: For flexboxes, minWidth:auto should be min-content. if (sizeType == MinSize && logicalWidth.isAuto()) return computeContentBoxLogicalWidth(0); @@ -2206,7 +2191,10 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType sizeType, Length // containing block's block-flow. // https://bugs.webkit.org/show_bug.cgi?id=46496 const LayoutUnit cw = isOutOfFlowPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent(); - if (cw > 0) + Length containerLogicalWidth = containingBlock()->style()->logicalWidth(); + // FIXME: Handle cases when containing block width is calculated or viewport percent. + // https://bugs.webkit.org/show_bug.cgi?id=91071 + if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercent()))) return computeContentBoxLogicalWidth(minimumValueForLength(logicalWidth, cw)); } // fall through @@ -2229,7 +2217,6 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType sizeType, Length logicalHeight) const { - // FIXME: For flexboxes, minWidth:auto should be min-content. if (sizeType == MinSize && logicalHeight.isAuto()) return computeContentBoxLogicalHeight(0); @@ -2337,7 +2324,7 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h) const return containingBlock()->availableLogicalHeight(); } -void RenderBox::computeBlockDirectionMargins(RenderBlock* containingBlock) +void RenderBox::computeBlockDirectionMargins(const RenderBlock* containingBlock) { if (isTableCell()) { // FIXME: Not right if we allow cells to have different directionality than the table. If we do allow this, though, @@ -2667,7 +2654,6 @@ void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, LayoutUnit& logicalWidthValue, LayoutUnit& marginLogicalLeftValue, LayoutUnit& marginLogicalRightValue, LayoutUnit& logicalLeftPos) { - // FIXME: What should flex items do here since min-width:auto == min-width:min-content instead of min-width:auto == min-width:0. if (widthSizeType == MinSize && logicalWidth.isAuto()) logicalWidth = Length(0, Fixed); @@ -3001,7 +2987,6 @@ void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, LayoutUnit& logicalHeightValue, LayoutUnit& marginBeforeValue, LayoutUnit& marginAfterValue, LayoutUnit& logicalTopPos) { - // FIXME: What should flex items do here since min-height:auto == min-height:min-content instead of min-height:auto == min-height:0. if (heightSizeType == MinSize && logicalHeightLength.isAuto()) logicalHeightLength = Length(0, Fixed); @@ -3013,7 +2998,6 @@ void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len LayoutUnit logicalTopValue = 0; - // FIXME: For non-flexboxes + min-height, this needs to treat non-flexboxes as 0. bool logicalHeightIsAuto = logicalHeightLength.isAuto(); bool logicalTopIsAuto = logicalTop.isAuto(); bool logicalBottomIsAuto = logicalBottom.isAuto(); @@ -3591,18 +3575,14 @@ void RenderBox::addVisualEffectOverflow() // Now compute border-image-outset overflow. if (style()->hasBorderImageOutsets()) { - LayoutUnit borderOutsetLeft; - LayoutUnit borderOutsetRight; - LayoutUnit borderOutsetTop; - LayoutUnit borderOutsetBottom; - style()->getBorderImageOutsets(borderOutsetTop, borderOutsetRight, borderOutsetBottom, borderOutsetLeft); + LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right // border is at the lower x coordinate value. - overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsetLeft : borderOutsetRight)); - overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsetRight : borderOutsetLeft)); - overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsetTop : borderOutsetBottom)); - overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsetBottom : borderOutsetTop)); + overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsets.left() : borderOutsets.right())); + overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsets.right() : borderOutsets.left())); + overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsets.top() : borderOutsets.bottom())); + overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsets.bottom() : borderOutsets.top())); } // Add in the final overflow with shadows and outsets combined. diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 031458266..064ed9191 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -290,7 +290,7 @@ public: void computeInlineDirectionMargins(RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth); // Used to resolve margins in the containing block's block-flow direction. - void computeBlockDirectionMargins(RenderBlock* containingBlock); + void computeBlockDirectionMargins(const RenderBlock* containingBlock); enum RenderBoxRegionInfoFlags { CacheRenderBoxRegionInfo, DoNotCacheRenderBoxRegionInfo }; LayoutRect borderBoxRectInRegion(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage = 0, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index a35a206e2..8f9b9a622 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -1234,17 +1234,9 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, // FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function // doesn't have any understanding of the zoom that is in effect on the tile. - LayoutUnit topOutset; - LayoutUnit rightOutset; - LayoutUnit bottomOutset; - LayoutUnit leftOutset; - style->getImageOutsets(ninePieceImage, topOutset, rightOutset, bottomOutset, leftOutset); - - LayoutUnit topWithOutset = rect.y() - topOutset; - LayoutUnit bottomWithOutset = rect.maxY() + bottomOutset; - LayoutUnit leftWithOutset = rect.x() - leftOutset; - LayoutUnit rightWithOutset = rect.maxX() + rightOutset; - IntRect borderImageRect = pixelSnappedIntRect(leftWithOutset, topWithOutset, rightWithOutset - leftWithOutset, bottomWithOutset - topWithOutset); + LayoutRect rectWithOutsets = rect; + rectWithOutsets.expand(style->imageOutsets(ninePieceImage)); + IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets); IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size(), DoNotScaleByEffectiveZoom); diff --git a/Source/WebCore/rendering/RenderCounter.cpp b/Source/WebCore/rendering/RenderCounter.cpp index 29c0f1ccb..de45d895e 100644 --- a/Source/WebCore/rendering/RenderCounter.cpp +++ b/Source/WebCore/rendering/RenderCounter.cpp @@ -474,6 +474,7 @@ RenderCounter::RenderCounter(Document* node, const CounterContent& counter) , m_counterNode(0) , m_nextForSameCounter(0) { + view()->addRenderCounter(); } RenderCounter::~RenderCounter() @@ -484,6 +485,13 @@ RenderCounter::~RenderCounter() } } +void RenderCounter::willBeDestroyed() +{ + if (view()) + view()->removeRenderCounter(); + RenderText::willBeDestroyed(); +} + const char* RenderCounter::renderName() const { return "RenderCounter"; @@ -596,14 +604,17 @@ void RenderCounter::destroyCounterNode(RenderObject* owner, const AtomicString& // map associated with a renderer, so there is no risk in leaking the map. } -void RenderCounter::rendererRemovedFromTree(RenderObject* removedRenderer) +void RenderCounter::rendererRemovedFromTree(RenderObject* renderer) { - RenderObject* currentRenderer = removedRenderer->lastLeafChild(); + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderCounters()) + return; + RenderObject* currentRenderer = renderer->lastLeafChild(); if (!currentRenderer) - currentRenderer = removedRenderer; + currentRenderer = renderer; while (true) { destroyCounterNodes(currentRenderer); - if (currentRenderer == removedRenderer) + if (currentRenderer == renderer) break; currentRenderer = currentRenderer->previousInPreOrder(); } @@ -647,6 +658,9 @@ static void updateCounters(RenderObject* renderer) void RenderCounter::rendererSubtreeAttached(RenderObject* renderer) { + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderCounters()) + return; Node* node = renderer->node(); if (node) node = node->parentNode(); diff --git a/Source/WebCore/rendering/RenderCounter.h b/Source/WebCore/rendering/RenderCounter.h index b4449dd86..6ba936f86 100644 --- a/Source/WebCore/rendering/RenderCounter.h +++ b/Source/WebCore/rendering/RenderCounter.h @@ -40,6 +40,9 @@ public: static void rendererRemovedFromTree(RenderObject*); static void rendererStyleChanged(RenderObject*, const RenderStyle* oldStyle, const RenderStyle* newStyle); +protected: + virtual void willBeDestroyed(); + private: virtual const char* renderName() const; virtual bool isCounter() const; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 1bc3aefaf..e7c0563d6 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -751,7 +751,8 @@ void RenderFlexibleBox::computeMainAxisPreferredSizes(bool relayoutChildren, Ord child->clearOverrideSize(); // Only need to layout here if we will need to get the logicalHeight of the child in computeNextFlexLine. - if (hasOrthogonalFlow(child) && flexBasisForChild(child).isAuto()) { + Length childMainAxisMin = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); + if (hasOrthogonalFlow(child) && (flexBasisForChild(child).isAuto() || childMainAxisMin.isAuto())) { if (!relayoutChildren) child->setChildNeedsLayout(true); child->layoutIfNeeded(); @@ -792,9 +793,17 @@ LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, Layo // https://bugs.webkit.org/show_bug.cgi?id=81809 if (max.isSpecified() && childSize > valueForLength(max, flexboxAvailableContentExtent, renderView)) childSize = valueForLength(max, flexboxAvailableContentExtent, renderView); - // FIXME: Treat auto min values as min-content. + if (min.isSpecified() && childSize < valueForLength(min, flexboxAvailableContentExtent, renderView)) - childSize = valueForLength(min, flexboxAvailableContentExtent, renderView); + return valueForLength(min, flexboxAvailableContentExtent, renderView); + + // FIXME: Support min/max sizes of fit-content, max-content and fill-available. + if (min.isAuto()) { + LayoutUnit minContent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->minPreferredLogicalWidth(); + minContent -= mainAxisBorderAndPaddingExtentForChild(child); + return std::max(childSize, minContent); + } + return childSize; } diff --git a/Source/WebCore/rendering/RenderGeometryMap.cpp b/Source/WebCore/rendering/RenderGeometryMap.cpp index e6993dbef..0a6c9e04f 100644 --- a/Source/WebCore/rendering/RenderGeometryMap.cpp +++ b/Source/WebCore/rendering/RenderGeometryMap.cpp @@ -136,6 +136,25 @@ void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, con do { renderer = renderer->pushMappingToContainer(ancestorRenderer, *this); } while (renderer && renderer != ancestorRenderer); + + ASSERT(m_mapping.isEmpty() || m_mapping[0].m_renderer->isRenderView()); +} + +static bool canMapViaLayer(const RenderLayer* layer) +{ + RenderStyle* style = layer->renderer()->style(); + if (style->position() == FixedPosition || style->isFlippedBlocksWritingMode()) + return false; + + if (layer->renderer()->hasColumns() || layer->renderer()->hasTransform()) + return false; + +#if ENABLE(SVG) + if (layer->renderer()->isSVGRoot()) + return false; +#endif + + return true; } void RenderGeometryMap::pushMappingsToAncestor(const RenderLayer* layer, const RenderLayer* ancestorLayer) @@ -143,9 +162,9 @@ void RenderGeometryMap::pushMappingsToAncestor(const RenderLayer* layer, const R const RenderObject* renderer = layer->renderer(); // The simple case can be handled fast in the layer tree. - bool canConvertInLayerTree = ancestorLayer && renderer->style()->position() != FixedPosition && !renderer->style()->isFlippedBlocksWritingMode(); + bool canConvertInLayerTree = ancestorLayer ? canMapViaLayer(ancestorLayer) : false; for (const RenderLayer* current = layer; current != ancestorLayer && canConvertInLayerTree; current = current->parent()) - canConvertInLayerTree = current->canUseConvertToLayerCoords(); + canConvertInLayerTree = canMapViaLayer(current); if (canConvertInLayerTree) { TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size()); @@ -188,7 +207,7 @@ void RenderGeometryMap::push(const RenderObject* renderer, const TransformationM void RenderGeometryMap::pushView(const RenderView* view, const LayoutSize& scrollOffset, const TransformationMatrix* t) { ASSERT(m_insertionPosition != notFound); - ASSERT(!m_mapping.size()); // The view should always be the first thing pushed. + ASSERT(!m_insertionPosition); // The view should always be the first step. m_mapping.insert(m_insertionPosition, RenderGeometryMapStep(view, false, false, false, t)); @@ -218,8 +237,8 @@ void RenderGeometryMap::popMappingsToAncestor(const RenderLayer* ancestorLayer) void RenderGeometryMap::stepInserted(const RenderGeometryMapStep& step) { - // Offset on the first step is the RenderView's offset, which is only applied when we have fixed-position.s - if (m_mapping.size() > 1) + // RenderView's offset, is only applied when we have fixed-positions. + if (!step.m_renderer->isRenderView()) m_accumulatedOffset += step.m_offset; if (step.m_isNonUniform) @@ -234,8 +253,8 @@ void RenderGeometryMap::stepInserted(const RenderGeometryMapStep& step) void RenderGeometryMap::stepRemoved(const RenderGeometryMapStep& step) { - // Offset on the first step is the RenderView's offset, which is only applied when we have fixed-position.s - if (m_mapping.size() > 1) + // RenderView's offset, is only applied when we have fixed-positions. + if (!step.m_renderer->isRenderView()) m_accumulatedOffset -= step.m_offset; if (step.m_isNonUniform) { diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 3032480c6..c4e142392 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -652,12 +652,7 @@ public: , m_wasFixed(wasFixed) , m_geometryMap() { - RenderObject* root = renderer->parent(); - while (root && root->parent()) - root = root->parent(); - - if (root) - m_geometryMap.pushMappingsToAncestor(renderer, toRenderBoxModelObject(root)); + m_geometryMap.pushMappingsToAncestor(renderer, 0); } void operator()(const FloatRect& rect) diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 12794cb46..31be2e8a3 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -2534,6 +2534,8 @@ void RenderLayer::updateScrollbarsAfterLayout() if (box->hasAutoVerticalScrollbar()) setHasVerticalScrollbar(hasVerticalOverflow); + updateSelfPaintingLayer(); + #if ENABLE(DASHBOARD_SUPPORT) // Force an update since we know the scrollbars have changed things. if (renderer()->document()->hasDashboardRegions()) @@ -4740,6 +4742,7 @@ bool RenderLayer::shouldBeNormalFlowOnly() const bool RenderLayer::shouldBeSelfPaintingLayer() const { return !isNormalFlowOnly() + || hasOverlayScrollbars() || renderer()->hasReflection() || renderer()->hasMask() || renderer()->isTableRow() @@ -4750,7 +4753,7 @@ bool RenderLayer::shouldBeSelfPaintingLayer() const || renderer()->isRenderIFrame(); } -void RenderLayer::updateSelfPaintingLayerAfterStyleChange(const RenderStyle*) +void RenderLayer::updateSelfPaintingLayer() { bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); if (m_isSelfPaintingLayer == isSelfPaintingLayer) @@ -4845,9 +4848,11 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) m_marquee = 0; } - updateSelfPaintingLayerAfterStyleChange(oldStyle); updateStackingContextsAfterStyleChange(oldStyle); updateScrollbarsAfterStyleChange(oldStyle); + // Overlay scrollbars can make this layer self-painting so we need + // to recompute the bit once scrollbars have been updated. + updateSelfPaintingLayer(); if (!hasReflection() && m_reflection) removeReflection(); diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 1c32a4f89..b9dc5d7c7 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -679,7 +679,7 @@ private: bool shouldRepaintAfterLayout() const; - void updateSelfPaintingLayerAfterStyleChange(const RenderStyle* oldStyle); + void updateSelfPaintingLayer(); void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index ee0a442f7..9886fb319 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -471,7 +471,10 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() scrollingCoordinator->setLayerIsFixedToContainerLayer(m_ancestorClippingLayer.get(), false); scrollingCoordinator->setLayerIsFixedToContainerLayer(m_graphicsLayer.get(), false); } - bool isContainer = m_owningLayer->hasTransform(); + // Page scale is applied as a transform on the root render view layer. Because the scroll + // layer is further up in the hierarchy, we need to avoid marking the root render view + // layer as a container. + bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLayer(); scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSuperlayers(), isContainer); } } @@ -1010,7 +1013,7 @@ bool RenderLayerBacking::containsPaintedContent() const if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo()) return hasBoxDecorationsOrBackground(renderer()); #endif -#if PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && USE(CA) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) #elif ENABLE(WEBGL) || ENABLE(ACCELERATED_2D_CANVAS) if (isAcceleratedCanvas(renderer())) return hasBoxDecorationsOrBackground(renderer()); diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h index 622c38c85..0f42d3fb9 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.h +++ b/Source/WebCore/rendering/RenderLayerBacking.h @@ -130,6 +130,7 @@ public: // GraphicsLayerClient interface virtual bool shouldUseTileCache(const GraphicsLayer*) const; + virtual bool usingTileCache(const GraphicsLayer*) const { return m_usingTiledCacheLayer; } virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime); virtual void notifySyncRequired(const GraphicsLayer*); diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 73f05fd7a..47450191a 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -1753,10 +1753,10 @@ bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* render if (AnimationController* animController = renderer->animation()) { return (animController->isRunningAnimationOnRenderer(renderer, CSSPropertyOpacity) && inCompositingMode()) #if ENABLE(CSS_FILTERS) -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if !PLATFORM(MAC) || (!PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) // <rdar://problem/10907251> - WebKit2 doesn't support CA animations of CI filters on Lion and below || animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitFilter) -#endif // !SNOW_LEOPARD && !LION +#endif // !PLATFORM(MAC) || (!PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) #endif // CSS_FILTERS || animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitTransform); } @@ -1910,7 +1910,7 @@ void RenderLayerCompositor::documentBackgroundColorDidChange() return; GraphicsLayer* graphicsLayer = backing->graphicsLayer(); - if (!graphicsLayer->client()->shouldUseTileCache(graphicsLayer)) + if (!graphicsLayer->client()->usingTileCache(graphicsLayer)) return; Color backgroundColor = m_renderView->frameView()->documentBackgroundColor(); diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.cpp b/Source/WebCore/rendering/RenderNamedFlowThread.cpp index 088b87248..227af7df5 100644 --- a/Source/WebCore/rendering/RenderNamedFlowThread.cpp +++ b/Source/WebCore/rendering/RenderNamedFlowThread.cpp @@ -33,10 +33,16 @@ namespace WebCore { -RenderNamedFlowThread::RenderNamedFlowThread(Node* node, const AtomicString& name) +RenderNamedFlowThread::RenderNamedFlowThread(Node* node, PassRefPtr<WebKitNamedFlow> namedFlow) : RenderFlowThread(node) - , m_flowThreadName(name) + , m_namedFlow(namedFlow) { + m_namedFlow->setRenderer(this); +} + +RenderNamedFlowThread::~RenderNamedFlowThread() +{ + m_namedFlow->setRenderer(0); } const char* RenderNamedFlowThread::renderName() const @@ -44,7 +50,6 @@ const char* RenderNamedFlowThread::renderName() const return "RenderNamedFlowThread"; } - RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const { FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin(); @@ -182,10 +187,14 @@ void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion) removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); } + if (canBeDestroyed()) { + destroy(); + return; + } + invalidateRegions(); } - void RenderNamedFlowThread::checkInvalidRegions() { for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { @@ -245,14 +254,6 @@ void RenderNamedFlowThread::pushDependencies(RenderNamedFlowThreadList& list) } } -WebKitNamedFlow* RenderNamedFlowThread::ensureNamedFlow() -{ - if (!m_namedFlow) - m_namedFlow = WebKitNamedFlow::create(this); - - return m_namedFlow.get(); -} - // The content nodes list contains those nodes with -webkit-flow-into: flow. // An element with display:none should also be listed among those nodes. // The list of nodes is ordered. @@ -283,6 +284,21 @@ void RenderNamedFlowThread::unregisterNamedFlowContentNode(Node* contentNode) contentNode->clearInNamedFlow(); m_contentNodes.remove(contentNode); + if (canBeDestroyed()) + destroy(); +} + +const AtomicString& RenderNamedFlowThread::flowThreadName() const +{ + return m_namedFlow->name(); +} + +void RenderNamedFlowThread::willBeDestroyed() +{ + if (!documentBeingDestroyed()) + view()->flowThreadController()->removeFlowThread(this); + + RenderFlowThread::willBeDestroyed(); } } diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.h b/Source/WebCore/rendering/RenderNamedFlowThread.h index d0c8ca014..5e0d96249 100644 --- a/Source/WebCore/rendering/RenderNamedFlowThread.h +++ b/Source/WebCore/rendering/RenderNamedFlowThread.h @@ -44,9 +44,10 @@ typedef ListHashSet<Node*> NamedFlowContentNodes; class RenderNamedFlowThread : public RenderFlowThread { public: - RenderNamedFlowThread(Node*, const AtomicString&); + RenderNamedFlowThread(Node*, PassRefPtr<WebKitNamedFlow>); + virtual ~RenderNamedFlowThread(); - AtomicString flowThreadName() const { return m_flowThreadName; } + const AtomicString& flowThreadName() const; RenderObject* nextRendererForNode(Node*) const; RenderObject* previousRendererForNode(Node*) const; @@ -63,12 +64,14 @@ public: virtual void addRegionToThread(RenderRegion*) OVERRIDE; virtual void removeRegionFromThread(RenderRegion*) OVERRIDE; - WebKitNamedFlow* ensureNamedFlow(); void registerNamedFlowContentNode(Node*); void unregisterNamedFlowContentNode(Node*); const NamedFlowContentNodes& contentNodes() const { return m_contentNodes; } bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); } +protected: + virtual void willBeDestroyed() OVERRIDE; + private: virtual const char* renderName() const OVERRIDE; virtual bool isRenderNamedFlowThread() const OVERRIDE { return true; } @@ -77,11 +80,9 @@ private: void addDependencyOnFlowThread(RenderNamedFlowThread*); void removeDependencyOnFlowThread(RenderNamedFlowThread*); void checkInvalidRegions(); + bool canBeDestroyed() const { return m_regionList.isEmpty() && m_contentNodes.isEmpty(); } private: - // The name of the flow thread as specified in CSS. - AtomicString m_flowThreadName; - // Observer flow threads have invalid regions that depend on the state of this thread // to re-validate their regions. Keeping a set of observer threads make it easy // to notify them when a region was removed from this flow. diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index deb66079c..04f27e652 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -282,15 +282,8 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) needsTable = !isTable(); else if (newChild->isTableRow()) needsTable = !isTableSection(); - else if (newChild->isTableCell()) { + else if (newChild->isTableCell()) needsTable = !isTableRow(); - // I'm not 100% sure this is the best way to fix this, but without this - // change we recurse infinitely when trying to render the CSS2 test page: - // http://www.bath.ac.uk/%7Epy8ieh/internet/eviltests/htmlbodyheadrendering2.html. - // See Radar 2925291. - if (needsTable && isTableCell() && !children->firstChild() && !newChild->isTableCell()) - needsTable = false; - } if (needsTable) { RenderTable* table; @@ -302,10 +295,8 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) addChild(table, beforeChild); } table->addChild(newChild); - } else { - // Just add it... + } else children->insertChildNode(this, newChild, beforeChild); - } if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE) toRenderText(newChild)->transformText(); diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp index 422504e6b..aa1ab8fdc 100644 --- a/Source/WebCore/rendering/RenderObjectChildList.cpp +++ b/Source/WebCore/rendering/RenderObjectChildList.cpp @@ -154,8 +154,12 @@ RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render oldChild->setNextSibling(0); oldChild->setParent(0); - RenderCounter::rendererRemovedFromTree(oldChild); - RenderQuote::rendererRemovedFromTree(oldChild); + // rendererRemovedFromTree walks the whole subtree. We can improve performance + // by skipping this step when destroying the entire tree. + if (!owner->documentBeingDestroyed()) { + RenderCounter::rendererRemovedFromTree(oldChild); + RenderQuote::rendererRemovedFromTree(oldChild); + } if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); @@ -289,8 +293,9 @@ void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* c static RenderObject* findBeforeAfterParent(RenderObject* object) { - // Only table parts need to search for the :before or :after parent - if (!(object->isTable() || object->isTableSection() || object->isTableRow())) + // Only table parts and flex-boxes need to search for the :before or :after parent + // FIXME: We could likely get away without this check and always look for the right parent. + if (!(object->isTable() || object->isTableSection() || object->isTableRow() || object->isFlexibleBoxIncludingDeprecated())) return object; // If there is a :first-letter style applied on the :before or :after content, diff --git a/Source/WebCore/rendering/RenderQuote.cpp b/Source/WebCore/rendering/RenderQuote.cpp index c4dd0c9d8..79da0d20d 100644 --- a/Source/WebCore/rendering/RenderQuote.cpp +++ b/Source/WebCore/rendering/RenderQuote.cpp @@ -57,12 +57,20 @@ RenderQuote::RenderQuote(Document* node, QuoteType quote) , m_next(0) , m_previous(0) { + view()->addRenderQuote(); } RenderQuote::~RenderQuote() { } +void RenderQuote::willBeDestroyed() +{ + if (view()) + view()->removeRenderQuote(); + RenderText::willBeDestroyed(); +} + const char* RenderQuote::renderName() const { return "RenderQuote"; @@ -278,7 +286,8 @@ void RenderQuote::computePreferredLogicalWidths(float lead) void RenderQuote::rendererSubtreeAttached(RenderObject* renderer) { - if (renderer->documentBeingDestroyed()) + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderQuotes()) return; for (RenderObject* descendant = renderer; descendant; descendant = descendant->nextInPreOrder(renderer)) if (descendant->isQuote()) { @@ -287,17 +296,18 @@ void RenderQuote::rendererSubtreeAttached(RenderObject* renderer) } } -void RenderQuote::rendererRemovedFromTree(RenderObject* subtreeRoot) +void RenderQuote::rendererRemovedFromTree(RenderObject* renderer) { - if (subtreeRoot->documentBeingDestroyed()) + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderQuotes()) return; - for (RenderObject* descendant = subtreeRoot; descendant; descendant = descendant->nextInPreOrder(subtreeRoot)) + for (RenderObject* descendant = renderer; descendant; descendant = descendant->nextInPreOrder(renderer)) if (descendant->isQuote()) { RenderQuote* removedQuote = toRenderQuote(descendant); RenderQuote* lastQuoteBefore = removedQuote->m_previous; removedQuote->m_previous = 0; int depth = removedQuote->m_depth; - for (descendant = descendant->nextInPreOrder(subtreeRoot); descendant; descendant = descendant->nextInPreOrder(subtreeRoot)) + for (descendant = descendant->nextInPreOrder(renderer); descendant; descendant = descendant->nextInPreOrder(renderer)) if (descendant->isQuote()) removedQuote = toRenderQuote(descendant); RenderQuote* quoteAfter = removedQuote->m_next; diff --git a/Source/WebCore/rendering/RenderQuote.h b/Source/WebCore/rendering/RenderQuote.h index d9e54375f..10e22d1c7 100644 --- a/Source/WebCore/rendering/RenderQuote.h +++ b/Source/WebCore/rendering/RenderQuote.h @@ -35,6 +35,7 @@ public: static void rendererRemovedFromTree(RenderObject*); protected: virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void willBeDestroyed(); private: virtual const char* renderName() const; virtual bool isQuote() const { return true; }; diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 64337bd5e..7730828a4 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -521,20 +521,14 @@ void RenderTable::addOverflowFromChildren() addOverflowFromChild(m_captions[i]); // Add overflow from our sections. - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->isTableSection()) { - RenderTableSection* section = toRenderTableSection(child); - addOverflowFromChild(section); - } - } + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) + addOverflowFromChild(section); } void RenderTable::setCellLogicalWidths() { - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->isTableSection()) - toRenderTableSection(child)->setCellLogicalWidths(); - } + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) + section->setCellLogicalWidths(); } void RenderTable::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) @@ -1000,18 +994,11 @@ int RenderTable::outerBorderAfter() const if (!collapseBorders()) return 0; int borderWidth = 0; - RenderTableSection* bottomSection; - if (m_foot) - bottomSection = m_foot; - else { - RenderObject* child; - for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling()) { } - bottomSection = child ? toRenderTableSection(child) : 0; - } - if (bottomSection) { - borderWidth = bottomSection->outerBorderAfter(); + + if (RenderTableSection* section = bottomSection()) { + borderWidth = section->outerBorderAfter(); if (borderWidth < 0) - return 0; // Overridden by hidden + return 0; // Overridden by hidden } const BorderValue& tb = style()->borderAfter(); if (tb.style() == BHIDDEN) @@ -1035,10 +1022,8 @@ int RenderTable::outerBorderStart() const borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 0 : 1)) / 2; bool allHidden = true; - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (!child->isTableSection()) - continue; - int sw = toRenderTableSection(child)->outerBorderStart(); + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) { + int sw = section->outerBorderStart(); if (sw < 0) continue; allHidden = false; @@ -1064,10 +1049,8 @@ int RenderTable::outerBorderEnd() const borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 1 : 0)) / 2; bool allHidden = true; - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (!child->isTableSection()) - continue; - int sw = toRenderTableSection(child)->outerBorderEnd(); + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) { + int sw = section->outerBorderEnd(); if (sw < 0) continue; allHidden = false; diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 09a63b91f..70161c779 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -340,41 +340,42 @@ int RenderTableSection::calcRowLogicalHeight() for (unsigned c = 0; c < totalCols; c++) { CellStruct& current = cellAt(r, c); - cell = current.primaryCell(); - - if (!cell || current.inColSpan) - continue; + for (unsigned i = 0; i < current.cells.size(); i++) { + cell = current.cells[i]; + if (current.inColSpan && cell->rowSpan() == 1) + continue; - // FIXME: We are always adding the height of a rowspan to the last rows which doesn't match - // other browsers. See webkit.org/b/52185 for example. - if ((cell->rowIndex() + cell->rowSpan() - 1) != r) - continue; + // FIXME: We are always adding the height of a rowspan to the last rows which doesn't match + // other browsers. See webkit.org/b/52185 for example. + if ((cell->rowIndex() + cell->rowSpan() - 1) != r) + continue; - // For row spanning cells, |r| is the last row in the span. - unsigned cellStartRow = cell->rowIndex(); + // For row spanning cells, |r| is the last row in the span. + unsigned cellStartRow = cell->rowIndex(); - if (cell->hasOverrideHeight()) { - if (!statePusher.didPush()) { - // Technically, we should also push state for the row, but since - // rows don't push a coordinate transform, that's not necessary. - statePusher.push(this, locationOffset()); + if (cell->hasOverrideHeight()) { + if (!statePusher.didPush()) { + // Technically, we should also push state for the row, but since + // rows don't push a coordinate transform, that's not necessary. + statePusher.push(this, locationOffset()); + } + cell->clearIntrinsicPadding(); + cell->clearOverrideSize(); + cell->setChildNeedsLayout(true, MarkOnlyThis); + cell->layoutIfNeeded(); } - cell->clearIntrinsicPadding(); - cell->clearOverrideSize(); - cell->setChildNeedsLayout(true, MarkOnlyThis); - cell->layoutIfNeeded(); - } - int cellLogicalHeight = cell->logicalHeightForRowSizing(); - m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow] + cellLogicalHeight); + int cellLogicalHeight = cell->logicalHeightForRowSizing(); + m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow] + cellLogicalHeight); - // find out the baseline - EVerticalAlign va = cell->style()->verticalAlign(); - if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) { - LayoutUnit baselinePosition = cell->cellBaselinePosition(); - if (baselinePosition > cell->borderBefore() + cell->paddingBefore()) { - m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition - cell->intrinsicPaddingBefore()); - baselineDescent = max(baselineDescent, m_rowPos[cellStartRow] + cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore())); + // find out the baseline + EVerticalAlign va = cell->style()->verticalAlign(); + if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) { + LayoutUnit baselinePosition = cell->cellBaselinePosition(); + if (baselinePosition > cell->borderBefore() + cell->paddingBefore()) { + m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition - cell->intrinsicPaddingBefore()); + baselineDescent = max(baselineDescent, m_rowPos[cellStartRow] + cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore())); + } } } } @@ -547,6 +548,8 @@ void RenderTableSection::layoutRows() rowRenderer->updateLayerTransform(); } + int rowHeightIncreaseForPagination = 0; + for (unsigned c = 0; c < nEffCols; c++) { CellStruct& cs = cellAt(r, c); RenderTableCell* cell = cs.primaryCell(); @@ -671,13 +674,9 @@ void RenderTableSection::layoutRows() // FIXME: Pagination might have made us change size. For now just shrink or grow the cell to fit without doing a relayout. // We'll also do a basic increase of the row height to accommodate the cell if it's bigger, but this isn't quite right // either. It's at least stable though and won't result in an infinite # of relayouts that may never stabilize. - if (cell->logicalHeight() > rHeight) { - unsigned delta = cell->logicalHeight() - rHeight; - for (unsigned rowIndex = rindx + cell->rowSpan(); rowIndex <= totalRows; rowIndex++) - m_rowPos[rowIndex] += delta; - rHeight = cell->logicalHeight(); - } else - cell->setLogicalHeight(rHeight); + if (cell->logicalHeight() > rHeight) + rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseForPagination, cell->logicalHeight() - rHeight); + cell->setLogicalHeight(rHeight); } LayoutSize childOffset(cell->location() - oldCellRect.location()); @@ -691,6 +690,15 @@ void RenderTableSection::layoutRows() cell->repaintDuringLayoutIfMoved(oldCellRect); } } + if (rowHeightIncreaseForPagination) { + for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) + m_rowPos[rowIndex] += rowHeightIncreaseForPagination; + for (unsigned c = 0; c < nEffCols; ++c) { + Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells; + for (size_t i = 0; i < cells.size(); ++i) + cells[i]->setLogicalHeight(cells[i]->logicalHeight() + rowHeightIncreaseForPagination); + } + } } #ifndef NDEBUG diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index e09437db2..6ed4abdef 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -735,7 +735,7 @@ bool RenderThemeMac::paintTextField(RenderObject* o, const PaintInfo& paintInfo, { LocalCurrentGraphicsContext localContext(paintInfo.context); -#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 bool useNSTextFieldCell = o->style()->hasAppearance() && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Color::white && !o->style()->hasBackgroundImage(); @@ -2111,7 +2111,7 @@ IntPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonB bool RenderThemeMac::shouldShowPlaceholderWhenFocused() const { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return true; #else return false; @@ -2183,7 +2183,7 @@ NSTextFieldCell* RenderThemeMac::textField() const [m_textField.get() setBezeled:YES]; [m_textField.get() setEditable:YES]; [m_textField.get() setFocusRingType:NSFocusRingTypeExterior]; -#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 [m_textField.get() setDrawsBackground:YES]; [m_textField.get() setBackgroundColor:[NSColor whiteColor]]; #else diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index d497a33ab..a895bc99e 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -62,6 +62,8 @@ RenderView::RenderView(Node* node, FrameView* view) , m_pageLogicalHeightChanged(false) , m_layoutState(0) , m_layoutStateDisableCount(0) + , m_renderQuoteCount(0) + , m_renderCounterCount(0) { // Clear our anonymous bit, set because RenderObject assumes // any renderer with document as the node is anonymous. diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index 8e5bc3c5a..a768f79d6 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -192,6 +192,17 @@ public: void setFixedPositionedObjectsNeedLayout(); + // FIXME: This is a work around because the current implementation of counters and quotes + // requires walking the entire tree repeatedly and most pages don't actually use either + // feature so we shouldn't take the performance hit when not needed. Long term we should + // rewrite the counter and quotes code. + void addRenderQuote() { m_renderQuoteCount++; } + void removeRenderQuote() { ASSERT(m_renderQuoteCount > 0); m_renderQuoteCount--; } + bool hasRenderQuotes() { return m_renderQuoteCount; } + void addRenderCounter() { m_renderCounterCount++; } + void removeRenderCounter() { ASSERT(m_renderCounterCount > 0); m_renderCounterCount--; } + bool hasRenderCounters() { return m_renderCounterCount; } + protected: virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; @@ -287,6 +298,9 @@ private: #endif OwnPtr<FlowThreadController> m_flowThreadController; RefPtr<IntervalArena> m_intervalArena; + + unsigned m_renderQuoteCount; + unsigned m_renderCounterCount; }; inline RenderView* toRenderView(RenderObject* object) diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp index e410be009..675b0718a 100644 --- a/Source/WebCore/rendering/RootInlineBox.cpp +++ b/Source/WebCore/rendering/RootInlineBox.cpp @@ -883,8 +883,15 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio verticalPosition -= (renderer->lineHeight(firstLine, lineDirection) - renderer->baselinePosition(baselineType(), firstLine, lineDirection)); } else if (verticalAlign == BASELINE_MIDDLE) verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection); - else if (verticalAlign == LENGTH) - verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), renderer->lineHeight(firstLine, lineDirection), renderer->view()); + else if (verticalAlign == LENGTH) { + LayoutUnit lineHeight; + //Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: refer to the 'line-height' of the element itself'. + if (renderer->style()->verticalAlignLength().isPercent()) + lineHeight = renderer->style()->computedLineHeight(); + else + lineHeight = renderer->lineHeight(firstLine, lineDirection); + verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), lineHeight, renderer->view()); + } } // Store the cached value. diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 3ca95d4d0..8e5a90e8c 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -1478,24 +1478,12 @@ Color RenderStyle::initialTapHighlightColor() } #endif -void RenderStyle::getImageOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const +LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const { - top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()); - right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()); - bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()); - left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()); -} - -void RenderStyle::getImageHorizontalOutsets(const NinePieceImage& image, LayoutUnit& left, LayoutUnit& right) const -{ - right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()); - left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()); -} - -void RenderStyle::getImageVerticalOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& bottom) const -{ - top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()); - bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()); + return LayoutBoxExtent(NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()), + NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()), + NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()), + NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth())); } } // namespace WebCore diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index cf4f7ba98..a984ff6c0 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -440,35 +440,19 @@ public: return hasBackgroundImage(); } - void getImageOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const; + LayoutBoxExtent imageOutsets(const NinePieceImage&) const; bool hasBorderImageOutsets() const { return borderImage().hasImage() && borderImage().outset().nonZero(); } - void getBorderImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const + LayoutBoxExtent borderImageOutsets() const { - return getImageOutsets(borderImage(), top, right, bottom, left); + return imageOutsets(borderImage()); } - void getBorderImageHorizontalOutsets(LayoutUnit& left, LayoutUnit& right) const - { - return getImageHorizontalOutsets(borderImage(), left, right); - } - void getBorderImageVerticalOutsets(LayoutUnit& top, LayoutUnit& bottom) const - { - return getImageVerticalOutsets(borderImage(), top, bottom); - } - void getBorderImageInlineDirectionOutsets(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const - { - return getImageInlineDirectionOutsets(borderImage(), logicalLeft, logicalRight); - } - void getBorderImageBlockDirectionOutsets(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const - { - return getImageBlockDirectionOutsets(borderImage(), logicalTop, logicalBottom); - } - - void getMaskBoxImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const + + LayoutBoxExtent maskBoxImageOutsets() const { - return getImageOutsets(maskBoxImage(), top, right, bottom, left); + return imageOutsets(maskBoxImage()); } #if ENABLE(CSS_FILTERS) @@ -1754,18 +1738,6 @@ private: return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom); } - // Helpers for obtaining border image outsets for overflow. - void getImageHorizontalOutsets(const NinePieceImage&, LayoutUnit& left, LayoutUnit& right) const; - void getImageVerticalOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& bottom) const; - void getImageInlineDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const - { - return isHorizontalWritingMode() ? getImageHorizontalOutsets(image, logicalLeft, logicalRight) : getImageVerticalOutsets(image, logicalLeft, logicalRight); - } - void getImageBlockDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const - { - return isHorizontalWritingMode() ? getImageVerticalOutsets(image, logicalTop, logicalBottom) : getImageHorizontalOutsets(image, logicalTop, logicalBottom); - } - // Color accessors are all private to make sure callers use visitedDependentColor instead to access them. Color invalidColor() const { static Color invalid; return invalid; } Color borderLeftColor() const { return surround->border.left().color(); } diff --git a/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp b/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp index b14f8acce..b4a76531e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp @@ -46,18 +46,18 @@ RenderSVGEllipse::~RenderSVGEllipse() { } -void RenderSVGEllipse::createShape() +void RenderSVGEllipse::updateShapeFromElement() { // Before creating a new object we need to clear the cached bounding box // to avoid using garbage. - m_boundingBox = FloatRect(); - m_outerStrokeRect = FloatRect(); + m_fillBoundingBox = FloatRect(); + m_strokeBoundingBox = FloatRect(); m_center = FloatPoint(); m_radii = FloatSize(); // Fallback to RenderSVGShape if shape has a non-scaling stroke. if (hasNonScalingStroke()) { - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); m_usePathFallback = true; return; } else @@ -69,10 +69,10 @@ void RenderSVGEllipse::createShape() if (m_radii.width() <= 0 || m_radii.height() <= 0) return; - m_boundingBox = FloatRect(m_center.x() - m_radii.width(), m_center.y() - m_radii.height(), 2 * m_radii.width(), 2 * m_radii.height()); - m_outerStrokeRect = m_boundingBox; + m_fillBoundingBox = FloatRect(m_center.x() - m_radii.width(), m_center.y() - m_radii.height(), 2 * m_radii.width(), 2 * m_radii.height()); + m_strokeBoundingBox = m_fillBoundingBox; if (style()->svgStyle()->hasStroke()) - m_outerStrokeRect.inflate(strokeWidth() / 2); + m_strokeBoundingBox.inflate(strokeWidth() / 2); } void RenderSVGEllipse::calculateRadiiAndCenter() @@ -97,27 +97,13 @@ void RenderSVGEllipse::calculateRadiiAndCenter() m_center = FloatPoint(ellipse->cx().value(lengthContext), ellipse->cy().value(lengthContext)); } -FloatRect RenderSVGEllipse::objectBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::objectBoundingBox(); - return m_boundingBox; -} - -FloatRect RenderSVGEllipse::strokeBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::strokeBoundingBox(); - return m_outerStrokeRect; -} - void RenderSVGEllipse::fillShape(GraphicsContext* context) const { if (m_usePathFallback) { RenderSVGShape::fillShape(context); return; } - context->fillEllipse(m_boundingBox); + context->fillEllipse(m_fillBoundingBox); } void RenderSVGEllipse::strokeShape(GraphicsContext* context) const @@ -128,7 +114,7 @@ void RenderSVGEllipse::strokeShape(GraphicsContext* context) const RenderSVGShape::strokeShape(context); return; } - context->strokeEllipse(m_boundingBox); + context->strokeEllipse(m_fillBoundingBox); } bool RenderSVGEllipse::shapeDependentStrokeContains(const FloatPoint& point) @@ -137,7 +123,7 @@ bool RenderSVGEllipse::shapeDependentStrokeContains(const FloatPoint& point) // to fall back to RenderSVGShape::shapeDependentStrokeContains in these cases. if (m_usePathFallback || !hasSmoothStroke()) { if (!hasPath()) - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); return RenderSVGShape::shapeDependentStrokeContains(point); } diff --git a/Source/WebCore/rendering/svg/RenderSVGEllipse.h b/Source/WebCore/rendering/svg/RenderSVGEllipse.h index 9e88dee13..f5129df90 100644 --- a/Source/WebCore/rendering/svg/RenderSVGEllipse.h +++ b/Source/WebCore/rendering/svg/RenderSVGEllipse.h @@ -41,19 +41,15 @@ public: private: virtual const char* renderName() const { return "RenderSVGEllipse"; } - virtual void createShape(); - virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_boundingBox.isEmpty(); }; + virtual void updateShapeFromElement(); + virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_fillBoundingBox.isEmpty(); }; virtual void fillShape(GraphicsContext*) const; virtual void strokeShape(GraphicsContext*) const; - virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const; virtual bool shapeDependentStrokeContains(const FloatPoint&); virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const; void calculateRadiiAndCenter(); private: - FloatRect m_boundingBox; - FloatRect m_outerStrokeRect; FloatPoint m_center; FloatSize m_radii; bool m_usePathFallback; diff --git a/Source/WebCore/rendering/svg/RenderSVGRect.cpp b/Source/WebCore/rendering/svg/RenderSVGRect.cpp index 120c132cf..c7f9c5b7b 100755 --- a/Source/WebCore/rendering/svg/RenderSVGRect.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRect.cpp @@ -46,11 +46,11 @@ RenderSVGRect::~RenderSVGRect() { } -void RenderSVGRect::createShape() +void RenderSVGRect::updateShapeFromElement() { // Before creating a new object we need to clear the cached bounding box // to avoid using garbage. - m_boundingBox = FloatRect(); + m_fillBoundingBox = FloatRect(); m_innerStrokeRect = FloatRect(); m_outerStrokeRect = FloatRect(); SVGRectElement* rect = static_cast<SVGRectElement*>(node()); @@ -58,7 +58,7 @@ void RenderSVGRect::createShape() // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling stroke. if (rect->hasAttribute(SVGNames::rxAttr) || rect->hasAttribute(SVGNames::ryAttr) || hasNonScalingStroke()) { - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); m_usePathFallback = true; return; } else @@ -69,12 +69,12 @@ void RenderSVGRect::createShape() if (boundingBoxSize.isEmpty()) return; - m_boundingBox = FloatRect(FloatPoint(rect->x().value(lengthContext), rect->y().value(lengthContext)), boundingBoxSize); + m_fillBoundingBox = FloatRect(FloatPoint(rect->x().value(lengthContext), rect->y().value(lengthContext)), boundingBoxSize); // To decide if the stroke contains a point we create two rects which represent the inner and // the outer stroke borders. A stroke contains the point, if the point is between them. - m_innerStrokeRect = m_boundingBox; - m_outerStrokeRect = m_boundingBox; + m_innerStrokeRect = m_fillBoundingBox; + m_outerStrokeRect = m_fillBoundingBox; if (style()->svgStyle()->hasStroke()) { float strokeWidth = this->strokeWidth(); @@ -82,29 +82,15 @@ void RenderSVGRect::createShape() m_outerStrokeRect.inflate(strokeWidth / 2); } - m_strokeBoundingRect = m_outerStrokeRect; + m_strokeBoundingBox = m_outerStrokeRect; #if USE(CG) // CoreGraphics can inflate the stroke by 1px when drawing a rectangle with antialiasing disabled at non-integer coordinates, we need to compensate. if (style()->svgStyle()->shapeRendering() == SR_CRISPEDGES) - m_strokeBoundingRect.inflate(1); + m_strokeBoundingBox.inflate(1); #endif } -FloatRect RenderSVGRect::objectBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::objectBoundingBox(); - return m_boundingBox; -} - -FloatRect RenderSVGRect::strokeBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::strokeBoundingBox(); - return m_strokeBoundingRect; -} - void RenderSVGRect::fillShape(GraphicsContext* context) const { if (m_usePathFallback) { @@ -120,12 +106,12 @@ void RenderSVGRect::fillShape(GraphicsContext* context) const if (context->hasShadow()) { GraphicsContextStateSaver stateSaver(*context); context->clearShadow(); - context->fillRect(m_boundingBox); + context->fillRect(m_fillBoundingBox); return; } #endif - context->fillRect(m_boundingBox); + context->fillRect(m_fillBoundingBox); } void RenderSVGRect::strokeShape(GraphicsContext* context) const @@ -138,7 +124,7 @@ void RenderSVGRect::strokeShape(GraphicsContext* context) const return; } - context->strokeRect(m_boundingBox, strokeWidth()); + context->strokeRect(m_fillBoundingBox, strokeWidth()); } bool RenderSVGRect::shapeDependentStrokeContains(const FloatPoint& point) @@ -147,7 +133,7 @@ bool RenderSVGRect::shapeDependentStrokeContains(const FloatPoint& point) // to fall back to RenderSVGShape::shapeDependentStrokeContains in these cases. if (m_usePathFallback || !hasSmoothStroke()) { if (!hasPath()) - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); return RenderSVGShape::shapeDependentStrokeContains(point); } @@ -158,7 +144,7 @@ bool RenderSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi { if (m_usePathFallback) return RenderSVGShape::shapeDependentFillContains(point, fillRule); - return m_boundingBox.contains(point.x(), point.y()); + return m_fillBoundingBox.contains(point.x(), point.y()); } } diff --git a/Source/WebCore/rendering/svg/RenderSVGRect.h b/Source/WebCore/rendering/svg/RenderSVGRect.h index 36837f792..63055790c 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRect.h +++ b/Source/WebCore/rendering/svg/RenderSVGRect.h @@ -42,20 +42,16 @@ public: private: virtual const char* renderName() const { return "RenderSVGRect"; } - virtual void createShape(); - virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_boundingBox.isEmpty(); }; + virtual void updateShapeFromElement(); + virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_fillBoundingBox.isEmpty(); }; virtual void fillShape(GraphicsContext*) const; virtual void strokeShape(GraphicsContext*) const; - virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const; virtual bool shapeDependentStrokeContains(const FloatPoint&); virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const; private: - FloatRect m_boundingBox; FloatRect m_innerStrokeRect; FloatRect m_outerStrokeRect; - FloatRect m_strokeBoundingRect; bool m_usePathFallback; }; diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp index c09457e61..707da886e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp @@ -418,32 +418,35 @@ void RenderSVGRoot::updateCachedBoundaries() bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) { LayoutPoint pointInParent = pointInContainer.point() - toLayoutSize(accumulatedOffset); - LayoutPoint pointInBorderBox(pointInParent.x() - x(), pointInParent.y() - y()); + LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); - // Note: For now, we're ignoring hits to border and padding for <svg> - if (!contentBoxRect().contains(pointInBorderBox)) - return false; - - FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent)); + // Only test SVG content if the point is in our content box. + // FIXME: This should be an intersection when rect-based hit tests are supported by nodeAtFloatPoint. + if (contentBoxRect().contains(pointInBorderBox)) { + FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent)); - for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { - if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { - // FIXME: CSS/HTML assumes the local point is relative to the border box, right? - updateHitTestResult(result, pointInBorderBox); + for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. - result.addNodeToRectBasedTestResult(child->node(), pointInContainer); - return true; + if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { + updateHitTestResult(result, pointInBorderBox); + if (!result.addNodeToRectBasedTestResult(child->node(), pointInContainer)) + return true; + } } } // If we didn't early exit above, we've just hit the container <svg> element. Unlike SVG 1.1, 2nd Edition allows container elements to be hit. - if (hitTestAction == HitTestBlockBackground && style()->pointerEvents() != PE_NONE) { + if (hitTestAction == HitTestBlockBackground && visibleToHitTesting()) { // Only return true here, if the last hit testing phase 'BlockBackground' is executed. If we'd return true in the 'Foreground' phase, // hit testing would stop immediately. For SVG only trees this doesn't matter. Though when we have a <foreignObject> subtree we need // to be able to detect hits on the background of a <div> element. If we'd return true here in the 'Foreground' phase, we are not able // to detect these hits anymore. - updateHitTestResult(result, roundedLayoutPoint(localPoint)); - return true; + LayoutRect boundsRect(accumulatedOffset + location(), size()); + if (pointInContainer.intersects(boundsRect)) { + updateHitTestResult(result, pointInBorderBox); + if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect)) + return true; + } } return false; diff --git a/Source/WebCore/rendering/svg/RenderSVGShape.cpp b/Source/WebCore/rendering/svg/RenderSVGShape.cpp index 92d7c28fc..282c50a0b 100755 --- a/Source/WebCore/rendering/svg/RenderSVGShape.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGShape.cpp @@ -64,9 +64,9 @@ RenderSVGShape::~RenderSVGShape() { } -void RenderSVGShape::createShape() +void RenderSVGShape::updateShapeFromElement() { - ASSERT(!m_path); + m_path.clear(); m_path = adoptPtr(new Path); ASSERT(RenderSVGShape::isEmpty()); @@ -74,6 +74,9 @@ void RenderSVGShape::createShape() updatePathFromGraphicsElement(element, path()); processZeroLengthSubpaths(); processMarkerPositions(); + + m_fillBoundingBox = calculateObjectBoundingBox(); + m_strokeBoundingBox = calculateStrokeBoundingBox(); } bool RenderSVGShape::isEmpty() const @@ -86,11 +89,6 @@ void RenderSVGShape::fillShape(GraphicsContext* context) const context->fillPath(path()); } -FloatRect RenderSVGShape::objectBoundingBox() const -{ - return path().fastBoundingRect(); -} - void RenderSVGShape::strokeShape(GraphicsContext* context) const { if (style()->svgStyle()->hasVisibleStroke()) @@ -162,11 +160,11 @@ void RenderSVGShape::layout() bool updateCachedBoundariesInParents = false; - bool needsShapeUpdate = m_needsShapeUpdate; - if (needsShapeUpdate || m_needsBoundariesUpdate) { - m_path.clear(); - createShape(); + if (m_needsShapeUpdate || m_needsBoundariesUpdate) { + updateShapeFromElement(); m_needsShapeUpdate = false; + updateRepaintBoundingBox(); + m_needsBoundariesUpdate = false; updateCachedBoundariesInParents = true; } @@ -180,13 +178,6 @@ void RenderSVGShape::layout() if (everHadLayout() && selfNeedsLayout()) SVGResourcesCache::clientLayoutChanged(this); - // At this point LayoutRepainter already grabbed the old bounds, - // recalculate them now so repaintAfterLayout() uses the new bounds. - if (needsShapeUpdate || m_needsBoundariesUpdate) { - updateCachedBoundaries(); - m_needsBoundariesUpdate = false; - } - // If our bounds changed, notify the parents. if (updateCachedBoundariesInParents) RenderSVGModelObject::setNeedsBoundariesUpdate(); @@ -439,29 +430,44 @@ FloatRect RenderSVGShape::markerRect(float strokeWidth) const return boundaries; } -void RenderSVGShape::updateCachedBoundaries() +FloatRect RenderSVGShape::calculateObjectBoundingBox() const { - if (isEmpty()) { - m_fillBoundingBox = FloatRect(); - m_strokeAndMarkerBoundingBox = FloatRect(); - m_repaintBoundingBox = FloatRect(); - return; + return path().fastBoundingRect(); +} + +FloatRect RenderSVGShape::calculateStrokeBoundingBox() const +{ + ASSERT(m_path); + FloatRect strokeBoundingBox = m_fillBoundingBox; + + const SVGRenderStyle* svgStyle = style()->svgStyle(); + if (svgStyle->hasStroke()) { + BoundingRectStrokeStyleApplier strokeStyle(this, style()); + if (hasNonScalingStroke()) { + AffineTransform nonScalingTransform = nonScalingStrokeTransform(); + if (nonScalingTransform.isInvertible()) { + Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); + FloatRect strokeBoundingRect = usePath->strokeBoundingRect(&strokeStyle); + strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBoundingRect); + strokeBoundingBox.unite(strokeBoundingRect); + } + } else + strokeBoundingBox.unite(path().strokeBoundingRect(&strokeStyle)); + + // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke. + float strokeWidth = this->strokeWidth(); + for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) + strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth)); } - // Cache _unclipped_ fill bounding box, used for calculations in resources - m_fillBoundingBox = objectBoundingBox(); + if (!m_markerPositions.isEmpty()) + strokeBoundingBox.unite(markerRect(strokeWidth())); - // Add zero-length sub-path linecaps to the fill box - // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke. - float strokeWidth = this->strokeWidth(); - for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) - m_fillBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth)); - - // Cache _unclipped_ stroke bounding box, used for calculations in resources (includes marker boundaries) - m_strokeAndMarkerBoundingBox = m_fillBoundingBox; - if (hasPath()) - inflateWithStrokeAndMarkerBounds(); - // Cache smallest possible repaint rectangle + return strokeBoundingBox; +} + +void RenderSVGShape::updateRepaintBoundingBox() +{ m_repaintBoundingBox = strokeBoundingBox(); SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox); } @@ -482,28 +488,6 @@ bool RenderSVGShape::hasSmoothStroke() const && svgStyle->capStyle() == svgStyle->initialCapStyle(); } -void RenderSVGShape::inflateWithStrokeAndMarkerBounds() -{ - const SVGRenderStyle* svgStyle = style()->svgStyle(); - if (svgStyle->hasStroke()) { - BoundingRectStrokeStyleApplier strokeStyle(this, style()); - - // SVG1.2 Tiny only defines non scaling stroke for the stroke but not markers. - if (hasNonScalingStroke()) { - AffineTransform nonScalingTransform = nonScalingStrokeTransform(); - if (nonScalingTransform.isInvertible()) { - Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); - FloatRect strokeBoundingRect = usePath->strokeBoundingRect(&strokeStyle); - strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBoundingRect); - m_strokeAndMarkerBoundingBox.unite(strokeBoundingRect); - } - } else - m_strokeAndMarkerBoundingBox.unite(path().strokeBoundingRect(&strokeStyle)); - } - if (!m_markerPositions.isEmpty()) - m_strokeAndMarkerBoundingBox.unite(markerRect(strokeWidth())); -} - void RenderSVGShape::drawMarkers(PaintInfo& paintInfo) { ASSERT(!m_markerPositions.isEmpty()); diff --git a/Source/WebCore/rendering/svg/RenderSVGShape.h b/Source/WebCore/rendering/svg/RenderSVGShape.h index f6c22db68..81c6b370c 100644 --- a/Source/WebCore/rendering/svg/RenderSVGShape.h +++ b/Source/WebCore/rendering/svg/RenderSVGShape.h @@ -83,11 +83,8 @@ public: } protected: - virtual void createShape(); + virtual void updateShapeFromElement(); virtual bool isEmpty() const; - virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const { return m_strokeAndMarkerBoundingBox; } - void setStrokeAndMarkerBoundingBox(FloatRect rect) { m_strokeAndMarkerBoundingBox = rect; } virtual bool shapeDependentStrokeContains(const FloatPoint&); virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const; float strokeWidth() const; @@ -95,6 +92,9 @@ protected: bool hasNonScalingStroke() const { return style()->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; } bool hasSmoothStroke() const; + FloatRect m_fillBoundingBox; + FloatRect m_strokeBoundingBox; + private: // Hit-detection separated for the fill and the stroke bool fillContains(const FloatPoint&, bool requiresFill = true, const WindRule fillRule = RULE_NONZERO); @@ -113,7 +113,12 @@ private: virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); - void updateCachedBoundaries(); + virtual FloatRect objectBoundingBox() const { return m_fillBoundingBox; } + virtual FloatRect strokeBoundingBox() const { return m_strokeBoundingBox; } + + FloatRect calculateObjectBoundingBox() const; + FloatRect calculateStrokeBoundingBox() const; + void updateRepaintBoundingBox(); AffineTransform nonScalingStrokeTransform() const; bool setupNonScalingStrokeContext(AffineTransform&, GraphicsContextStateSaver&); @@ -132,12 +137,9 @@ private: void strokePath(RenderStyle*, GraphicsContext*, Path*, RenderSVGResource*, const Color&, int); void fillAndStrokePath(GraphicsContext*); - void inflateWithStrokeAndMarkerBounds(); void drawMarkers(PaintInfo&); private: - FloatRect m_fillBoundingBox; - FloatRect m_strokeAndMarkerBoundingBox; FloatRect m_repaintBoundingBox; AffineTransform m_localTransform; OwnPtr<Path> m_path; diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp index c1ffe858d..c80b257da 100644 --- a/Source/WebCore/svg/SVGElement.cpp +++ b/Source/WebCore/svg/SVGElement.cpp @@ -173,12 +173,14 @@ void SVGElement::setXmlbase(const String& value, ExceptionCode&) void SVGElement::removedFrom(ContainerNode* rootParent) { - if (rootParent->inDocument()) { + bool wasInDocument = rootParent->inDocument(); + + StyledElement::removedFrom(rootParent); + + if (wasInDocument) { document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this); document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); } - - StyledElement::removedFrom(rootParent); } SVGSVGElement* SVGElement::ownerSVGElement() const diff --git a/Source/WebCore/svg/SVGStyledElement.cpp b/Source/WebCore/svg/SVGStyledElement.cpp index 7f1e7edbd..0818384ab 100644 --- a/Source/WebCore/svg/SVGStyledElement.cpp +++ b/Source/WebCore/svg/SVGStyledElement.cpp @@ -451,7 +451,6 @@ void SVGStyledElement::clearHasPendingResourcesIfPossible() AffineTransform SVGStyledElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { // To be overriden by SVGStyledLocatableElement/SVGStyledTransformableElement (or as special case SVGTextElement and SVGPatternElement) - ASSERT_NOT_REACHED(); return AffineTransform(); } diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp index 76684c95f..562c0834b 100755 --- a/Source/WebCore/svg/SVGUseElement.cpp +++ b/Source/WebCore/svg/SVGUseElement.cpp @@ -99,7 +99,7 @@ PassRefPtr<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Do { // Always build a #shadow-root for SVGUseElement. RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(tagName, document, wasInsertedByParser)); - use->ensureShadowRoot(); + use->createShadowSubtree(); return use.release(); } @@ -107,6 +107,14 @@ SVGUseElement::~SVGUseElement() { if (m_cachedDocument) m_cachedDocument->removeClient(this); + + clearResourceReferences(); +} + +void SVGUseElement::createShadowSubtree() +{ + ASSERT(!shadow()); + ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot); } SVGElementInstance* SVGUseElement::instanceRoot() @@ -401,6 +409,9 @@ void SVGUseElement::clearResourceReferences() } m_needsShadowTreeRecreation = false; + + ASSERT(document()); + document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this); } void SVGUseElement::buildPendingResource() @@ -408,12 +419,12 @@ void SVGUseElement::buildPendingResource() if (!referencedDocument()) return; clearResourceReferences(); - if (!inDocument()) + if (!inDocument() || isInShadowTree()) return; String id; Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id, externalDocument()); - if (!target) { + if (!target || !target->inDocument()) { // If we can't find the target of an external element, just give up. // We can't observe if the target somewhen enters the external document, nor should we do it. if (externalDocument()) @@ -459,7 +470,7 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children bool foundProblem = false; - buildInstanceTree(target, m_targetElementInstance.get(), foundProblem); + buildInstanceTree(target, m_targetElementInstance.get(), foundProblem, false); if (instanceTreeIsLoading(m_targetElementInstance.get())) return; @@ -513,6 +524,10 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) // Update relative length information. updateRelativeLengthsInformation(); + // Rebuild all dependent use elements. + ASSERT(document()); + document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); + // Eventually dump instance tree #ifdef DUMP_INSTANCE_TREE String text; @@ -580,7 +595,7 @@ RenderObject* SVGUseElement::rendererClipChild() const return 0; } -void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundProblem) +void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundProblem, bool foundUse) { ASSERT(target); ASSERT(targetInstance); @@ -593,6 +608,14 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta foundProblem = hasCycleUseReferencing(static_cast<SVGUseElement*>(target), targetInstance, newTarget); if (foundProblem) return; + + // We only need to track fist degree <use> dependencies. Indirect references are handled + // as the invalidation bubbles up the dependency chain. + if (!foundUse) { + ASSERT(document()); + document()->accessSVGExtensions()->addElementReferencingTarget(this, target); + foundUse = true; + } } else if (isDisallowedElement(target)) { foundProblem = true; return; @@ -620,7 +643,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta targetInstance->appendChild(instance.release()); // Enter recursion, appending new instance tree nodes to the "instance" object. - buildInstanceTree(element, instancePtr, foundProblem); + buildInstanceTree(element, instancePtr, foundProblem, foundUse); if (foundProblem) return; } @@ -631,7 +654,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta RefPtr<SVGElementInstance> newInstance = SVGElementInstance::create(this, static_cast<SVGUseElement*>(target), newTarget); SVGElementInstance* newInstancePtr = newInstance.get(); targetInstance->appendChild(newInstance.release()); - buildInstanceTree(newTarget, newInstancePtr, foundProblem); + buildInstanceTree(newTarget, newInstancePtr, foundProblem, foundUse); } bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, SVGElement*& newTarget) diff --git a/Source/WebCore/svg/SVGUseElement.h b/Source/WebCore/svg/SVGUseElement.h index 971ade6f4..8eb6469f4 100755 --- a/Source/WebCore/svg/SVGUseElement.h +++ b/Source/WebCore/svg/SVGUseElement.h @@ -56,6 +56,8 @@ public: private: SVGUseElement(const QualifiedName&, Document*, bool wasInsertedByParser); + void createShadowSubtree(); + virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const { return true; } @@ -82,7 +84,7 @@ private: virtual bool selfHasRelativeLengths() const; // Instance tree handling - void buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle); + void buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle, bool foundUse); bool hasCycleUseReferencing(SVGUseElement*, SVGElementInstance* targetInstance, SVGElement*& newTarget); // Shadow tree handling diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index 83d375374..6d04cc6ea 100644 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -27,6 +27,8 @@ #include "InternalSettings.h" #include "CachedResourceLoader.h" +#include "Chrome.h" +#include "ChromeClient.h" #include "Document.h" #include "ExceptionCode.h" #include "Frame.h" @@ -34,9 +36,11 @@ #include "InspectorController.h" #include "Language.h" #include "LocaleToScriptMapping.h" +#include "MockPagePopupDriver.h" #include "Page.h" #include "RuntimeEnabledFeatures.h" #include "Settings.h" +#include "TextRun.h" #if ENABLE(INPUT_TYPE_COLOR) #include "ColorChooser.h" @@ -54,18 +58,6 @@ return; \ } -#define InternalSettingsGuardForFrame() \ - if (!frame()) { \ - ec = INVALID_ACCESS_ERR; \ - return; \ - } - -#define InternalSettingsGuardForFrameView() \ - if (!frame() || !frame()->view()) { \ - ec = INVALID_ACCESS_ERR; \ - return; \ - } - #define InternalSettingsGuardForPageReturn(returnValue) \ if (!page()) { \ ec = INVALID_ACCESS_ERR; \ @@ -80,41 +72,34 @@ namespace WebCore { - -PassRefPtr<InternalSettings> InternalSettings::create(Frame* frame) -{ - return adoptRef(new InternalSettings(frame)); -} - -InternalSettings::~InternalSettings() -{ -} - -InternalSettings::InternalSettings(Frame* frame) - : FrameDestructionObserver(frame) - , m_originalPasswordEchoDurationInSeconds(settings()->passwordEchoDurationInSeconds()) - , m_originalPasswordEchoEnabled(settings()->passwordEchoEnabled()) +InternalSettings::Backup::Backup(Page* page, Settings* settings) + : m_originalPasswordEchoDurationInSeconds(settings->passwordEchoDurationInSeconds()) + , m_originalPasswordEchoEnabled(settings->passwordEchoEnabled()) , m_originalCSSExclusionsEnabled(RuntimeEnabledFeatures::cssExclusionsEnabled()) #if ENABLE(SHADOW_DOM) , m_originalShadowDOMEnabled(RuntimeEnabledFeatures::shadowDOMEnabled()) #endif - , m_originalEditingBehavior(settings()->editingBehaviorType()) - , m_originalFixedPositionCreatesStackingContext(settings()->fixedPositionCreatesStackingContext()) - , m_originalSyncXHRInDocumentsEnabled(settings()->syncXHRInDocumentsEnabled()) + , m_originalEditingBehavior(settings->editingBehaviorType()) + , m_originalFixedPositionCreatesStackingContext(settings->fixedPositionCreatesStackingContext()) + , m_originalSyncXHRInDocumentsEnabled(settings->syncXHRInDocumentsEnabled()) #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) - , m_originalJavaScriptProfilingEnabled(page() && page()->inspectorController() && page()->inspectorController()->profilerEnabled()) + , m_originalJavaScriptProfilingEnabled(page->inspectorController() && page->inspectorController()->profilerEnabled()) #endif - , m_originalWindowFocusRestricted(settings()->windowFocusRestricted()) - , m_originalDeviceSupportsTouch(settings()->deviceSupportsTouch()) - , m_originalDeviceSupportsMouse(settings()->deviceSupportsMouse()) + , m_originalWindowFocusRestricted(settings->windowFocusRestricted()) + , m_originalDeviceSupportsTouch(settings->deviceSupportsTouch()) + , m_originalDeviceSupportsMouse(settings->deviceSupportsMouse()) #if ENABLE(TEXT_AUTOSIZING) - , m_originalTextAutosizingEnabled(settings()->textAutosizingEnabled()) - , m_originalTextAutosizingWindowSizeOverride(settings()->textAutosizingWindowSizeOverride()) + , m_originalTextAutosizingEnabled(settings->textAutosizingEnabled()) + , m_originalTextAutosizingWindowSizeOverride(settings->textAutosizingWindowSizeOverride()) +#endif +#if ENABLE(DIALOG_ELEMENT) + , m_originalDialogElementEnabled(RuntimeEnabledFeatures::dialogElementEnabled()) #endif { } -void InternalSettings::restoreTo(Settings* settings) + +void InternalSettings::Backup::restoreTo(Page* page, Settings* settings) { settings->setPasswordEchoDurationInSeconds(m_originalPasswordEchoDurationInSeconds); settings->setPasswordEchoEnabled(m_originalPasswordEchoEnabled); @@ -126,8 +111,8 @@ void InternalSettings::restoreTo(Settings* settings) settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext); settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled); #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) - if (page() && page()->inspectorController()) - page()->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled); + if (page->inspectorController()) + page->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled); #endif settings->setWindowFocusRestricted(m_originalWindowFocusRestricted); settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch); @@ -136,23 +121,50 @@ void InternalSettings::restoreTo(Settings* settings) settings->setTextAutosizingEnabled(m_originalTextAutosizingEnabled); settings->setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride); #endif +#if ENABLE(DIALOG_ELEMENT) + RuntimeEnabledFeatures::setDialogElementEnabled(m_originalDialogElementEnabled); +#endif } -Settings* InternalSettings::settings() const +InternalSettings* InternalSettings::from(Page* page) +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings")); + if (!SuperType::from(page, name)) + SuperType::provideTo(page, name, adoptRef(new InternalSettings(page))); + return static_cast<InternalSettings*>(SuperType::from(page, name)); +} + +InternalSettings::~InternalSettings() { - if (!frame() || !frame()->page()) - return 0; - return frame()->page()->settings(); } -Document* InternalSettings::document() const +InternalSettings::InternalSettings(Page* page) + : m_page(page) + , m_backup(page, page->settings()) { - return frame() ? frame()->document() : 0; } -Page* InternalSettings::page() const +void InternalSettings::reset() { - return document() ? document()->page() : 0; + TextRun::setAllowsRoundingHacks(false); + setUserPreferredLanguages(Vector<String>()); + page()->setPagination(Page::Pagination()); + page()->setPageScaleFactor(1, IntPoint(0, 0)); +#if ENABLE(PAGE_POPUP) + m_pagePopupDriver.clear(); + if (page()->chrome()) + page()->chrome()->client()->resetPagePopupDriver(); +#endif + + m_backup.restoreTo(page(), settings()); + m_backup = Backup(page(), settings()); +} + +Settings* InternalSettings::settings() const +{ + if (!page()) + return 0; + return page()->settings(); } void InternalSettings::setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec) @@ -220,7 +232,7 @@ void InternalSettings::setPasswordEchoDurationInSeconds(double durationInSeconds void InternalSettings::setFixedElementsLayoutRelativeToFrame(bool enabled, ExceptionCode& ec) { - InternalSettingsGuardForFrameView(); + InternalSettingsGuardForSettings(); settings()->setFixedElementsLayoutRelativeToFrame(enabled); } @@ -412,7 +424,7 @@ void InternalSettings::setEditingBehavior(const String& editingBehavior, Excepti void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec) { - InternalSettingsGuardForFrameView(); + InternalSettingsGuardForSettings(); settings()->setFixedPositionCreatesStackingContext(creates); } @@ -444,4 +456,131 @@ void InternalSettings::setWindowFocusRestricted(bool restricted, ExceptionCode& settings()->setWindowFocusRestricted(restricted); } +void InternalSettings::setDialogElementEnabled(bool enabled, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); +#if ENABLE(DIALOG_ELEMENT) + RuntimeEnabledFeatures::setDialogElementEnabled(enabled); +#else + UNUSED_PARAM(enabled); +#endif +} + +void InternalSettings::allowRoundingHacks() const +{ + TextRun::setAllowsRoundingHacks(true); +} + +Vector<String> InternalSettings::userPreferredLanguages() const +{ + return WebCore::userPreferredLanguages(); +} + +void InternalSettings::setUserPreferredLanguages(const Vector<String>& languages) +{ + WebCore::overrideUserPreferredLanguages(languages); +} + +void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec) +{ + InternalSettingsGuardForSettings(); + +#if ENABLE(VIDEO_TRACK) + if (equalIgnoringCase(kind, "Subtitles")) + settings()->setShouldDisplaySubtitles(enabled); + else if (equalIgnoringCase(kind, "Captions")) + settings()->setShouldDisplayCaptions(enabled); + else if (equalIgnoringCase(kind, "TextDescriptions")) + settings()->setShouldDisplayTextDescriptions(enabled); + else + ec = SYNTAX_ERR; +#else + UNUSED_PARAM(kind); + UNUSED_PARAM(enabled); +#endif +} + +bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec) +{ + InternalSettingsGuardForSettingsReturn(false); + +#if ENABLE(VIDEO_TRACK) + if (equalIgnoringCase(kind, "Subtitles")) + return settings()->shouldDisplaySubtitles(); + if (equalIgnoringCase(kind, "Captions")) + return settings()->shouldDisplayCaptions(); + if (equalIgnoringCase(kind, "TextDescriptions")) + return settings()->shouldDisplayTextDescriptions(); + + ec = SYNTAX_ERR; + return false; +#else + UNUSED_PARAM(kind); + return false; +#endif +} + +void InternalSettings::setPagination(const String& mode, int gap, ExceptionCode& ec) +{ + if (!page()) { + ec = INVALID_ACCESS_ERR; + return; + } + + Page::Pagination pagination; + if (mode == "Unpaginated") + pagination.mode = Page::Pagination::Unpaginated; + else if (mode == "LeftToRightPaginated") + pagination.mode = Page::Pagination::LeftToRightPaginated; + else if (mode == "RightToLeftPaginated") + pagination.mode = Page::Pagination::RightToLeftPaginated; + else if (mode == "TopToBottomPaginated") + pagination.mode = Page::Pagination::TopToBottomPaginated; + else if (mode == "BottomToTopPaginated") + pagination.mode = Page::Pagination::BottomToTopPaginated; + else { + ec = SYNTAX_ERR; + return; + } + + pagination.gap = gap; + page()->setPagination(pagination); +} + +void InternalSettings::setEnableMockPagePopup(bool enabled, ExceptionCode& ec) +{ +#if ENABLE(PAGE_POPUP) + InternalSettingsGuardForPage(); + if (!page()->chrome()) + return; + if (!enabled) { + page()->chrome()->client()->resetPagePopupDriver(); + return; + } + if (!m_pagePopupDriver) + m_pagePopupDriver = MockPagePopupDriver::create(page()->mainFrame()); + page()->chrome()->client()->setPagePopupDriver(m_pagePopupDriver.get()); +#else + UNUSED_PARAM(enabled); + UNUSED_PARAM(ec); +#endif +} + +String InternalSettings::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) +{ + if (!page()) { + ec = INVALID_ACCESS_ERR; + return String(); + } + + const int defaultLayoutWidthForNonMobilePages = 980; + + ViewportArguments arguments = page()->viewportArguments(); + ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); + restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight)); + restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); + + return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index 7c3a330e7..1596836da 100644 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -27,7 +27,7 @@ #define InternalSettings_h #include "EditingBehaviorTypes.h" -#include "FrameDestructionObserver.h" +#include "RefCountedSupplement.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/text/WTFString.h> @@ -42,16 +42,48 @@ typedef int ExceptionCode; class Frame; class Document; +class MockPagePopupDriver; class Page; class Settings; -class InternalSettings : public RefCounted<InternalSettings>, - public FrameDestructionObserver { +class InternalSettings : public RefCountedSupplement<Page, InternalSettings> { public: - static PassRefPtr<InternalSettings> create(Frame*); + class Backup { + public: + Backup(Page*, Settings*); + void restoreTo(Page*, Settings*); + + double m_originalPasswordEchoDurationInSeconds; + bool m_originalPasswordEchoEnabled; + bool m_originalCSSExclusionsEnabled; +#if ENABLE(SHADOW_DOM) + bool m_originalShadowDOMEnabled; +#endif + EditingBehaviorType m_originalEditingBehavior; + bool m_originalFixedPositionCreatesStackingContext; + bool m_originalSyncXHRInDocumentsEnabled; +#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) + bool m_originalJavaScriptProfilingEnabled; +#endif + bool m_originalWindowFocusRestricted; + bool m_originalDeviceSupportsTouch; + bool m_originalDeviceSupportsMouse; +#if ENABLE(TEXT_AUTOSIZING) + bool m_originalTextAutosizingEnabled; + IntSize m_originalTextAutosizingWindowSizeOverride; +#endif +#if ENABLE(DIALOG_ELEMENT) + bool m_originalDialogElementEnabled; +#endif + }; + + typedef RefCountedSupplement<Page, InternalSettings> SuperType; + static InternalSettings* from(Page*); virtual ~InternalSettings(); + void reset(); + void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&); void setForceCompositingMode(bool enabled, ExceptionCode&); void setEnableCompositingForFixedPosition(bool enabled, ExceptionCode&); @@ -88,36 +120,27 @@ public: void setFixedPositionCreatesStackingContext(bool, ExceptionCode&); void setSyncXHRInDocumentsEnabled(bool, ExceptionCode&); void setWindowFocusRestricted(bool, ExceptionCode&); - - void restoreTo(Settings*); - + void setDialogElementEnabled(bool, ExceptionCode&); void setJavaScriptProfilingEnabled(bool enabled, ExceptionCode&); - + Vector<String> userPreferredLanguages() const; + void setUserPreferredLanguages(const Vector<String>&); + void setPagination(const String& mode, int gap, ExceptionCode&); + void allowRoundingHacks() const; + void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&); + bool shouldDisplayTrackKind(const String& kind, ExceptionCode&); + void setEnableMockPagePopup(bool, ExceptionCode&); + String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&); private: - InternalSettings(Frame*); + explicit InternalSettings(Page*); + virtual void hostDestroyed() OVERRIDE { m_page = 0; } Settings* settings() const; - Document* document() const; - Page* page() const; + Page* page() const { return m_page; } - double m_originalPasswordEchoDurationInSeconds; - bool m_originalPasswordEchoEnabled; - bool m_originalCSSExclusionsEnabled; -#if ENABLE(SHADOW_DOM) - bool m_originalShadowDOMEnabled; -#endif - EditingBehaviorType m_originalEditingBehavior; - bool m_originalFixedPositionCreatesStackingContext; - bool m_originalSyncXHRInDocumentsEnabled; -#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) - bool m_originalJavaScriptProfilingEnabled; -#endif - bool m_originalWindowFocusRestricted; - bool m_originalDeviceSupportsTouch; - bool m_originalDeviceSupportsMouse; -#if ENABLE(TEXT_AUTOSIZING) - bool m_originalTextAutosizingEnabled; - IntSize m_originalTextAutosizingWindowSizeOverride; + Page* m_page; + Backup m_backup; +#if ENABLE(PAGE_POPUP) + OwnPtr<MockPagePopupDriver> m_pagePopupDriver; #endif }; diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl index 57e0f18be..0e4647283 100644 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -64,6 +64,17 @@ module window { void setSyncXHRInDocumentsEnabled(in boolean enabled) raises(DOMException); void setJavaScriptProfilingEnabled(in boolean creates) raises(DOMException); void setWindowFocusRestricted(in boolean restricted) raises(DOMException); + void setDialogElementEnabled(in boolean enabled) raises(DOMException); + + void setPagination(in DOMString mode, in long gap) raises(DOMException); + sequence<String> userPreferredLanguages(); + void setUserPreferredLanguages(in sequence<String> languages); + void allowRoundingHacks(); + void setEnableMockPagePopup(in boolean enabled) raises(DOMException); +#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK + void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException); + boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException); +#endif }; } diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index c97a19deb..188175937 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -63,7 +63,6 @@ #include "ShadowRoot.h" #include "SpellChecker.h" #include "TextIterator.h" -#include "TextRun.h" #include "TreeScope.h" #include "ViewportArguments.h" @@ -147,9 +146,31 @@ Internals::~Internals() } Internals::Internals(Document* document) - : FrameDestructionObserver(0) + : ContextDestructionObserver(document) { - reset(document); +} + +Document* Internals::contextDocument() const +{ + return static_cast<Document*>(scriptExecutionContext()); +} + +Frame* Internals::frame() const +{ + if (!contextDocument()) + return 0; + return contextDocument()->frame(); +} + +InternalSettings* Internals::settings() const +{ + Document* document = contextDocument(); + if (!document) + return 0; + Page* page = document->page(); + if (!page) + return 0; + return InternalSettings::from(page); } String Internals::address(Node* node) @@ -607,76 +628,14 @@ void Internals::setScrollViewPosition(Document* document, long x, long y, Except frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue); } -void Internals::setPagination(Document* document, const String& mode, int gap, ExceptionCode& ec) +void Internals::setPagination(Document*, const String& mode, int gap, ExceptionCode& ec) { - if (!document || !document->page()) { - ec = INVALID_ACCESS_ERR; - return; - } - - Page::Pagination pagination; - if (mode == "Unpaginated") - pagination.mode = Page::Pagination::Unpaginated; - else if (mode == "LeftToRightPaginated") - pagination.mode = Page::Pagination::LeftToRightPaginated; - else if (mode == "RightToLeftPaginated") - pagination.mode = Page::Pagination::RightToLeftPaginated; - else if (mode == "TopToBottomPaginated") - pagination.mode = Page::Pagination::TopToBottomPaginated; - else if (mode == "BottomToTopPaginated") - pagination.mode = Page::Pagination::BottomToTopPaginated; - else { - ec = SYNTAX_ERR; - return; - } - - pagination.gap = gap; - - document->page()->setPagination(pagination); + settings()->setPagination(mode, gap, ec); } -String Internals::configurationForViewport(Document* document, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) +String Internals::configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) { - if (!document || !document->page()) { - ec = INVALID_ACCESS_ERR; - return String(); - } - - const int defaultLayoutWidthForNonMobilePages = 980; - - ViewportArguments arguments = document->page()->viewportArguments(); - ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); - restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight)); - restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); - - return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); -} - -void Internals::reset(Document* document) -{ - if (!document || !document->settings()) - return; - - observeFrame(document->frame()); - - if (m_settings) - m_settings->restoreTo(document->page()->settings()); - m_settings = InternalSettings::create(document->frame()); - if (Page* page = document->page()) { - page->setPagination(Page::Pagination()); - - if (document->frame() == page->mainFrame()) - setUserPreferredLanguages(Vector<String>()); - - page->setPageScaleFactor(1, IntPoint(0, 0)); - } - - resetDefaultsToConsistentValues(); -} - -void Internals::resetDefaultsToConsistentValues() -{ - TextRun::setAllowsRoundingHacks(false); + return settings()->configurationForViewport(devicePixelRatio, deviceWidth, deviceHeight, availableWidth, availableHeight, ec); } bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) @@ -907,61 +866,22 @@ int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode Vector<String> Internals::userPreferredLanguages() const { - return WebCore::userPreferredLanguages(); + return settings()->userPreferredLanguages(); } void Internals::setUserPreferredLanguages(const Vector<String>& languages) { - WebCore::overrideUserPreferredLanguages(languages); + settings()->setUserPreferredLanguages(languages); } -void Internals::setShouldDisplayTrackKind(Document* document, const String& kind, bool enabled, ExceptionCode& ec) +void Internals::setShouldDisplayTrackKind(Document*, const String& kind, bool enabled, ExceptionCode& ec) { - if (!document || !document->frame() || !document->frame()->settings()) { - ec = INVALID_ACCESS_ERR; - return; - } - -#if ENABLE(VIDEO_TRACK) - Settings* settings = document->frame()->settings(); - - if (equalIgnoringCase(kind, "Subtitles")) - settings->setShouldDisplaySubtitles(enabled); - else if (equalIgnoringCase(kind, "Captions")) - settings->setShouldDisplayCaptions(enabled); - else if (equalIgnoringCase(kind, "TextDescriptions")) - settings->setShouldDisplayTextDescriptions(enabled); - else - ec = SYNTAX_ERR; -#else - UNUSED_PARAM(kind); - UNUSED_PARAM(enabled); -#endif + settings()->setShouldDisplayTrackKind(kind, enabled, ec); } -bool Internals::shouldDisplayTrackKind(Document* document, const String& kind, ExceptionCode& ec) +bool Internals::shouldDisplayTrackKind(Document*, const String& kind, ExceptionCode& ec) { - if (!document || !document->frame() || !document->frame()->settings()) { - ec = INVALID_ACCESS_ERR; - return false; - } - -#if ENABLE(VIDEO_TRACK) - Settings* settings = document->frame()->settings(); - - if (equalIgnoringCase(kind, "Subtitles")) - return settings->shouldDisplaySubtitles(); - if (equalIgnoringCase(kind, "Captions")) - return settings->shouldDisplayCaptions(); - if (equalIgnoringCase(kind, "TextDescriptions")) - return settings->shouldDisplayTextDescriptions(); - - ec = SYNTAX_ERR; - return false; -#else - UNUSED_PARAM(kind); - return false; -#endif + return settings()->shouldDisplayTrackKind(kind, ec); } unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec) @@ -997,12 +917,12 @@ PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int x, int y, void Internals::emitInspectorDidBeginFrame() { - InspectorInstrumentation::didBeginFrame(frame()->page()); + InspectorInstrumentation::didBeginFrame(contextDocument()->frame()->page()); } void Internals::emitInspectorDidCancelFrame() { - InspectorInstrumentation::didCancelFrame(frame()->page()); + InspectorInstrumentation::didCancelFrame(contextDocument()->frame()->page()); } void Internals::setBatteryStatus(Document* document, const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode& ec) @@ -1145,7 +1065,7 @@ void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const void Internals::allowRoundingHacks() const { - TextRun::setAllowsRoundingHacks(true); + settings()->allowRoundingHacks(); } String Internals::counterValue(Element* element) diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index 792ad6761..3a36ce2c1 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -26,7 +26,7 @@ #ifndef Internals_h #define Internals_h -#include "FrameDestructionObserver.h" +#include "ContextDestructionObserver.h" #include "NodeList.h" #include "PlatformString.h" #include <wtf/PassRefPtr.h> @@ -41,22 +41,22 @@ class DOMStringList; class Document; class DocumentMarker; class Element; +class Frame; class InternalSettings; class Node; class Range; +class ScriptExecutionContext; class ShadowRoot; class WebKitPoint; typedef int ExceptionCode; -class Internals : public RefCounted<Internals>, - public FrameDestructionObserver { +class Internals : public RefCounted<Internals> + , public ContextDestructionObserver { public: static PassRefPtr<Internals> create(Document*); virtual ~Internals(); - void reset(Document*); - String elementRenderTreeAsText(Element*, ExceptionCode&); String address(Node*); @@ -115,7 +115,6 @@ public: String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&); void setScrollViewPosition(Document*, long x, long y, ExceptionCode&); - void setPagination(Document*, const String& mode, int gap, ExceptionCode&); String configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&); @@ -167,7 +166,7 @@ public: static const char* internalsId; - InternalSettings* settings() const { return m_settings.get(); } + InternalSettings* settings() const; void setBatteryStatus(Document*, const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode&); @@ -198,10 +197,10 @@ public: private: explicit Internals(Document*); - DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); - void resetDefaultsToConsistentValues(); + Document* contextDocument() const; + Frame* frame() const; - RefPtr<InternalSettings> m_settings; + DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); }; } // namespace WebCore diff --git a/Source/WebCore/testing/MockPagePopupDriver.cpp b/Source/WebCore/testing/MockPagePopupDriver.cpp new file mode 100644 index 000000000..2b196a426 --- /dev/null +++ b/Source/WebCore/testing/MockPagePopupDriver.cpp @@ -0,0 +1,125 @@ +/* + * 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" +#include "MockPagePopupDriver.h" + +#if ENABLE(PAGE_POPUP) +#include "CSSPropertyNames.h" +#include "CSSValueKeywords.h" +#include "DocumentLoader.h" +#include "DocumentWriter.h" +#include "Frame.h" +#include "HTMLIFrameElement.h" +#include "PagePopup.h" +#include "PagePopupClient.h" +#include "PagePopupController.h" +#include "WebCoreTestSupport.h" + +namespace WebCore { + +class MockPagePopup : public PagePopup { +public: + static PassOwnPtr<MockPagePopup> create(PagePopupClient*, const IntRect& originBoundsInRootView, Frame*); + virtual ~MockPagePopup(); + +private: + MockPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView, Frame*); + + PagePopupClient* m_popupClient; + RefPtr<HTMLIFrameElement> m_iframe; + RefPtr<PagePopupController> m_controller; +}; + +inline MockPagePopup::MockPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView, Frame* mainFrame) + : m_popupClient(client) + , m_controller(PagePopupController::create(client)) +{ + Document* document = mainFrame->document(); + m_iframe = HTMLIFrameElement::create(HTMLNames::iframeTag, document); + m_iframe->setIdAttribute("mock-page-popup"); + m_iframe->setInlineStyleProperty(CSSPropertyBorderWidth, 0.0, CSSPrimitiveValue::CSS_PX); + m_iframe->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute); + m_iframe->setInlineStyleProperty(CSSPropertyLeft, originBoundsInRootView.x(), CSSPrimitiveValue::CSS_PX, true); + m_iframe->setInlineStyleProperty(CSSPropertyTop, originBoundsInRootView.maxY(), CSSPrimitiveValue::CSS_PX, true); + if (document->body()) + document->body()->appendChild(m_iframe.get()); + Frame* contentFrame = m_iframe->contentFrame(); + DocumentWriter* writer = contentFrame->loader()->activeDocumentLoader()->writer(); + writer->setMIMEType("text/html"); + writer->setEncoding("UTF-8", false); + writer->begin(); + m_popupClient->writeDocument(*writer); + writer->end(); + + WebCoreTestSupport::injectPagePopupController(contentFrame, m_controller.get()); +} + +PassOwnPtr<MockPagePopup> MockPagePopup::create(PagePopupClient* client, const IntRect& originBoundsInRootView, Frame* mainFrame) +{ + return adoptPtr(new MockPagePopup(client, originBoundsInRootView, mainFrame)); +} + +MockPagePopup::~MockPagePopup() +{ + if (m_iframe && m_iframe->parentNode()) + m_iframe->parentNode()->removeChild(m_iframe.get()); + m_popupClient->didClosePopup(); +} + +inline MockPagePopupDriver::MockPagePopupDriver(Frame* mainFrame) + : m_mainFrame(mainFrame) +{ +} + +PassOwnPtr<MockPagePopupDriver> MockPagePopupDriver::create(Frame* mainFrame) +{ + return adoptPtr(new MockPagePopupDriver(mainFrame)); +} + +MockPagePopupDriver::~MockPagePopupDriver() +{ + closePagePopup(m_mockPagePopup.get()); +} + +PagePopup* MockPagePopupDriver::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView) +{ + if (m_mockPagePopup) + closePagePopup(m_mockPagePopup.get()); + if (!client || !m_mainFrame) + return 0; + m_mockPagePopup = MockPagePopup::create(client, originBoundsInRootView, m_mainFrame); + return m_mockPagePopup.get(); +} + +void MockPagePopupDriver::closePagePopup(PagePopup* popup) +{ + if (!popup || popup != m_mockPagePopup.get()) + return; + m_mockPagePopup.clear(); +} + +} +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp b/Source/WebCore/testing/MockPagePopupDriver.h index 2fdb4efcb..fdbb47f78 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp +++ b/Source/WebCore/testing/MockPagePopupDriver.h @@ -23,22 +23,37 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef MockPagePopupDriver_h +#define MockPagePopupDriver_h -#include "cc/CCIOSurfaceDrawQuad.h" +#include "PagePopupClient.h" +#include "PagePopupDriver.h" +#include <wtf/RefPtr.h> +#if ENABLE(PAGE_POPUP) namespace WebCore { -PassOwnPtr<CCIOSurfaceDrawQuad> CCIOSurfaceDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) -{ - return adoptPtr(new CCIOSurfaceDrawQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId)); -} +class Frame; +class IntRect; +class MockPagePopup; +class PagePopup; -CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) - : CCDrawQuad(sharedQuadState, CCDrawQuad::IOSurfaceContent, quadRect) - , m_ioSurfaceSize(ioSurfaceSize) - , m_ioSurfaceTextureId(ioSurfaceTextureId) -{ -} +class MockPagePopupDriver : public PagePopupDriver { +public: + static PassOwnPtr<MockPagePopupDriver> create(Frame* mainFrame); + virtual ~MockPagePopupDriver(); + +private: + MockPagePopupDriver(Frame* mainFrame); + + // PagePopupDriver functions: + virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView) OVERRIDE; + virtual void closePagePopup(PagePopup*) OVERRIDE; + + OwnPtr<MockPagePopup> m_mockPagePopup; + Frame* m_mainFrame; +}; } +#endif +#endif diff --git a/Source/WebCore/testing/js/WebCoreTestSupport.cpp b/Source/WebCore/testing/js/WebCoreTestSupport.cpp index cfb938749..138b429f0 100644 --- a/Source/WebCore/testing/js/WebCoreTestSupport.cpp +++ b/Source/WebCore/testing/js/WebCoreTestSupport.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "WebCoreTestSupport.h" +#include "Frame.h" +#include "InternalSettings.h" #include "Internals.h" #include "JSDocument.h" #include "JSInternals.h" @@ -43,8 +45,8 @@ void injectInternalsObject(JSContextRef context) JSLockHolder lock(exec); JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); - Document* document = scriptContext->isDocument() ? static_cast<Document*>(scriptContext) : 0; - globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(document))); + if (scriptContext->isDocument()) + globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(static_cast<Document*>(scriptContext)))); } void resetInternalsObject(JSContextRef context) @@ -52,14 +54,9 @@ void resetInternalsObject(JSContextRef context) ExecState* exec = toJS(context); JSLockHolder lock(exec); JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); - JSValue internalsJS = globalObject->getDirect(exec->globalData(), Identifier(exec, Internals::internalsId)); - if (internalsJS.isNull() || internalsJS.isEmpty()) - return; - if (Internals* internals = toInternals(internalsJS)) { - ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); - if (scriptContext->isDocument()) - internals->reset(static_cast<Document*>(scriptContext)); - } + ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); + ASSERT(scriptContext->isDocument()); + InternalSettings::from(static_cast<Document*>(scriptContext)->frame()->page())->reset(); } } diff --git a/Source/WebCore/testing/v8/WebCoreTestSupport.cpp b/Source/WebCore/testing/v8/WebCoreTestSupport.cpp index 28c3729f3..2bdb7a959 100644 --- a/Source/WebCore/testing/v8/WebCoreTestSupport.cpp +++ b/Source/WebCore/testing/v8/WebCoreTestSupport.cpp @@ -27,9 +27,11 @@ #include "WebCoreTestSupport.h" #include "Document.h" +#include "InternalSettings.h" #include "Internals.h" #include "ScriptExecutionContext.h" #include "V8Internals.h" +#include "V8PagePopupController.h" #include <v8.h> @@ -43,8 +45,8 @@ void injectInternalsObject(v8::Local<v8::Context> context) v8::HandleScope scope; ScriptExecutionContext* scriptContext = getScriptExecutionContext(); - Document* document = scriptContext->isDocument() ? static_cast<Document*>(scriptContext) : 0; - context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(document))); + if (scriptContext->isDocument()) + context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(static_cast<Document*>(scriptContext)))); } void resetInternalsObject(v8::Local<v8::Context> context) @@ -56,13 +58,19 @@ void resetInternalsObject(v8::Local<v8::Context> context) v8::Context::Scope contextScope(context); v8::HandleScope scope; - v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8::String::New(Internals::internalsId))); - Internals* internals = object->IsUndefined() ? 0 : V8Internals::toNative(object); - if (internals) { - ScriptExecutionContext* scriptContext = getScriptExecutionContext(); - if (scriptContext->isDocument()) - internals->reset(static_cast<Document*>(scriptContext)); - } + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + ASSERT(scriptContext->isDocument()); + InternalSettings::from(static_cast<Document*>(scriptContext)->frame()->page())->reset(); +} + +#if ENABLE(PAGE_POPUP) +void injectPagePopupController(Frame* frame, PagePopupController* controller) +{ + ASSERT(frame); + ASSERT(controller); + v8::HandleScope scope; + V8Proxy::mainWorldContext(frame)->Global()->Set(v8::String::New("pagePopupController"), toV8(controller)); } +#endif } diff --git a/Source/WebCore/testing/v8/WebCoreTestSupport.h b/Source/WebCore/testing/v8/WebCoreTestSupport.h index fa49c606b..258eea329 100644 --- a/Source/WebCore/testing/v8/WebCoreTestSupport.h +++ b/Source/WebCore/testing/v8/WebCoreTestSupport.h @@ -31,11 +31,20 @@ class Context; template <class T> class Local; } +namespace WebCore { +class Frame; +class PagePopupController; +} + namespace WebCoreTestSupport { void injectInternalsObject(v8::Local<v8::Context>); void resetInternalsObject(v8::Local<v8::Context>); +#if ENABLE(PAGE_POPUP) +void injectPagePopupController(WebCore::Frame*, WebCore::PagePopupController*); +#endif + } // namespace WebCore #endif diff --git a/Source/WebCore/workers/DedicatedWorkerContext.cpp b/Source/WebCore/workers/DedicatedWorkerContext.cpp index 202e29907..f2b2a65f2 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.cpp +++ b/Source/WebCore/workers/DedicatedWorkerContext.cpp @@ -41,8 +41,8 @@ namespace WebCore { -DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) - : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType) +DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType) { } diff --git a/Source/WebCore/workers/DedicatedWorkerContext.h b/Source/WebCore/workers/DedicatedWorkerContext.h index be5befc03..4f7c2c36f 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.h +++ b/Source/WebCore/workers/DedicatedWorkerContext.h @@ -44,9 +44,9 @@ namespace WebCore { class DedicatedWorkerContext : public WorkerContext { public: typedef WorkerContext Base; - static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new DedicatedWorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)); + return adoptRef(new DedicatedWorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType)); } virtual bool isDedicatedWorkerContext() const { return true; } @@ -66,7 +66,7 @@ namespace WebCore { DedicatedWorkerThread* thread(); private: - DedicatedWorkerContext(const KURL&, const String& userAgent, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + DedicatedWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); }; } // namespace WebCore diff --git a/Source/WebCore/workers/DedicatedWorkerThread.cpp b/Source/WebCore/workers/DedicatedWorkerThread.cpp index 678ce830f..81a4edf2b 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.cpp +++ b/Source/WebCore/workers/DedicatedWorkerThread.cpp @@ -54,9 +54,9 @@ DedicatedWorkerThread::~DedicatedWorkerThread() { } -PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) +PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return DedicatedWorkerContext::create(url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType); + return DedicatedWorkerContext::create(url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType); } void DedicatedWorkerThread::runEventLoop() diff --git a/Source/WebCore/workers/DedicatedWorkerThread.h b/Source/WebCore/workers/DedicatedWorkerThread.h index 91e4c82dd..5aa13d0d1 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.h +++ b/Source/WebCore/workers/DedicatedWorkerThread.h @@ -46,7 +46,7 @@ namespace WebCore { ~DedicatedWorkerThread(); protected: - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void runEventLoop(); private: diff --git a/Source/WebCore/workers/SharedWorkerContext.cpp b/Source/WebCore/workers/SharedWorkerContext.cpp index 942baf640..64fce221b 100644 --- a/Source/WebCore/workers/SharedWorkerContext.cpp +++ b/Source/WebCore/workers/SharedWorkerContext.cpp @@ -50,8 +50,8 @@ PassRefPtr<MessageEvent> createConnectEvent(PassRefPtr<MessagePort> port) return event.release(); } -SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) - : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType) +SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType) , m_name(name) { } diff --git a/Source/WebCore/workers/SharedWorkerContext.h b/Source/WebCore/workers/SharedWorkerContext.h index 5e8e59bf6..0ae0c39cc 100644 --- a/Source/WebCore/workers/SharedWorkerContext.h +++ b/Source/WebCore/workers/SharedWorkerContext.h @@ -44,9 +44,9 @@ namespace WebCore { class SharedWorkerContext : public WorkerContext { public: typedef WorkerContext Base; - static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new SharedWorkerContext(name, url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)); + return adoptRef(new SharedWorkerContext(name, url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType)); } virtual ~SharedWorkerContext(); @@ -61,7 +61,7 @@ namespace WebCore { SharedWorkerThread* thread(); private: - SharedWorkerContext(const String& name, const KURL&, const String&, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + SharedWorkerContext(const String& name, const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, PassRefPtr<ScriptCallStack>); diff --git a/Source/WebCore/workers/SharedWorkerThread.cpp b/Source/WebCore/workers/SharedWorkerThread.cpp index 50a89c8e7..d39b3351d 100644 --- a/Source/WebCore/workers/SharedWorkerThread.cpp +++ b/Source/WebCore/workers/SharedWorkerThread.cpp @@ -53,9 +53,9 @@ SharedWorkerThread::~SharedWorkerThread() { } -PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) +PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return SharedWorkerContext::create(m_name, url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType); + return SharedWorkerContext::create(m_name, url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType); } } // namespace WebCore diff --git a/Source/WebCore/workers/SharedWorkerThread.h b/Source/WebCore/workers/SharedWorkerThread.h index 3b35ed133..c343824eb 100644 --- a/Source/WebCore/workers/SharedWorkerThread.h +++ b/Source/WebCore/workers/SharedWorkerThread.h @@ -43,7 +43,7 @@ namespace WebCore { ~SharedWorkerThread(); protected: - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); private: SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp index b10c1470e..45e5ebedd 100644 --- a/Source/WebCore/workers/WorkerContext.cpp +++ b/Source/WebCore/workers/WorkerContext.cpp @@ -85,9 +85,10 @@ public: virtual bool isCleanupTask() const { return true; } }; -WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) +WorkerContext::WorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) : m_url(url) , m_userAgent(userAgent) + , m_groupSettings(settings) , m_script(adoptPtr(new WorkerScriptController(this))) , m_thread(thread) #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h index 0b2f6a1d4..a63ecd80f 100644 --- a/Source/WebCore/workers/WorkerContext.h +++ b/Source/WebCore/workers/WorkerContext.h @@ -33,6 +33,7 @@ #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" +#include "GroupSettings.h" #include "ScriptExecutionContext.h" #include "WorkerEventQueue.h" #include "WorkerScriptController.h" @@ -68,6 +69,7 @@ namespace WebCore { const KURL& url() const { return m_url; } KURL completeURL(const String&) const; + const GroupSettings* groupSettings() { return m_groupSettings.get(); } virtual String userAgent(const KURL&) const; virtual void disableEval(); @@ -137,7 +139,7 @@ namespace WebCore { void notifyObserversOfStop(); protected: - WorkerContext(const KURL&, const String&, WorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + WorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, WorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, PassRefPtr<ScriptCallStack>); void addMessageToWorkerConsole(MessageSource, MessageType, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>); @@ -160,6 +162,7 @@ namespace WebCore { KURL m_url; String m_userAgent; + OwnPtr<GroupSettings> m_groupSettings; mutable RefPtr<WorkerLocation> m_location; mutable RefPtr<WorkerNavigator> m_navigator; diff --git a/Source/WebCore/workers/WorkerThread.cpp b/Source/WebCore/workers/WorkerThread.cpp index 9bde800eb..bd0355c41 100644 --- a/Source/WebCore/workers/WorkerThread.cpp +++ b/Source/WebCore/workers/WorkerThread.cpp @@ -146,7 +146,7 @@ void WorkerThread::workerThread() { { MutexLocker lock(m_threadCreationMutex); - m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType); + m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_groupSettings.release(), m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType); if (m_runLoop.terminated()) { // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet, @@ -193,11 +193,6 @@ void WorkerThread::runEventLoop() m_runLoop.run(m_workerContext.get()); } -GroupSettings* WorkerThread::groupSettings() -{ - return m_startupData->m_groupSettings.get(); -} - class WorkerThreadShutdownFinishTask : public ScriptExecutionContext::Task { public: static PassOwnPtr<WorkerThreadShutdownFinishTask> create() diff --git a/Source/WebCore/workers/WorkerThread.h b/Source/WebCore/workers/WorkerThread.h index 5b1751312..670e3cd1c 100644 --- a/Source/WebCore/workers/WorkerThread.h +++ b/Source/WebCore/workers/WorkerThread.h @@ -62,7 +62,6 @@ namespace WebCore { // Number of active worker threads. static unsigned workerThreadCount(); - GroupSettings* groupSettings(); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) NotificationClient* getNotificationClient() { return m_notificationClient; } @@ -73,7 +72,7 @@ namespace WebCore { WorkerThread(const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); // Factory method for creating a new worker context for the thread. - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0; + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0; // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop. virtual void runEventLoop(); diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 88fe273a8..7614d4154 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,38 @@ +2012-07-13 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [CMake] Proper handling of ENABLE_API_TESTS build option + https://bugs.webkit.org/show_bug.cgi?id=91221 + + Reviewed by Rob Buis. + + Build unit tests only if ENABLE_API_TESTS is set. + + * PlatformEfl.cmake: + +2012-07-12 Simon Hausmann <simon.hausmann@nokia.com> + + Typo in path in generate-webkitversion.pl + https://bugs.webkit.org/show_bug.cgi?id=90883 + + Reviewed by Mark Rowe. + + Correct default path to version config file. In practice it wasn't a problem because only the Qt + build system seems to use the script right now and passes the path to the version file as a + command line parameter. + + * scripts/generate-webkitversion.pl: + +2012-07-11 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Implement Date/Time picker + https://bugs.webkit.org/show_bug.cgi?id=90911 + + Reviewed by Rob Buis. + + Add files into make file. + + * PlatformBlackBerry.cmake: + 2012-07-09 Christophe Dumez <christophe.dumez@intel.com> [EFL] Battery status code needs refactoring to be reused in WebKit2 diff --git a/Source/WebKit/PlatformBlackBerry.cmake b/Source/WebKit/PlatformBlackBerry.cmake index fa61b8bbe..aac068b48 100644 --- a/Source/WebKit/PlatformBlackBerry.cmake +++ b/Source/WebKit/PlatformBlackBerry.cmake @@ -91,6 +91,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/VibrationClientBlackBerry.cpp blackberry/WebCoreSupport/PagePopupBlackBerry.cpp blackberry/WebCoreSupport/SelectPopupClient.cpp + blackberry/WebCoreSupport/DatePickerClient.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 a3fd10911..f6800af57 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -350,13 +350,15 @@ SET(EWKUnitTests_BINARIES test_ewk_view ) -FOREACH(testName ${EWKUnitTests_BINARIES}) - ADD_EXECUTABLE(${testName} ${WEBKIT_EFL_TEST_DIR}/${testName}.cpp ${WEBKIT_EFL_TEST_DIR}/test_runner.cpp) - ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}) - TARGET_LINK_LIBRARIES(${testName} ${EWKUnitTests_LIBRARIES} ewkTestUtils gtest pthread) - ADD_TARGET_PROPERTIES(${testName} LINK_FLAGS "${EWKUnitTests_LINK_FLAGS}") - SET_TARGET_PROPERTIES(${testName} PROPERTIES FOLDER "WebKit") -ENDFOREACH() +IF (ENABLE_API_TESTS) + FOREACH (testName ${EWKUnitTests_BINARIES}) + ADD_EXECUTABLE(${testName} ${WEBKIT_EFL_TEST_DIR}/${testName}.cpp ${WEBKIT_EFL_TEST_DIR}/test_runner.cpp) + ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}) + TARGET_LINK_LIBRARIES(${testName} ${EWKUnitTests_LIBRARIES} ewkTestUtils gtest pthread) + ADD_TARGET_PROPERTIES(${testName} LINK_FLAGS "${EWKUnitTests_LINK_FLAGS}") + SET_TARGET_PROPERTIES(${testName} PROPERTIES FOLDER "WebKit") + ENDFOREACH () +ENDIF () IF (ENABLE_INSPECTOR) SET(WEB_INSPECTOR_DIR ${CMAKE_BINARY_DIR}/WebKit/efl/webinspector) diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index beb09c2c4..588ee9d52 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -77,9 +77,6 @@ namespace WebKit { const int s_renderTimerTimeout = 1.0; WebPage* BackingStorePrivate::s_currentBackingStoreOwner = 0; -Platform::Graphics::Buffer* BackingStorePrivate::s_overScrollImage = 0; -std::string BackingStorePrivate::s_overScrollImagePath; -Platform::IntSize BackingStorePrivate::s_overScrollImageSize; typedef std::pair<int, int> Divisor; typedef Vector<Divisor> DivisorList; @@ -1219,52 +1216,6 @@ void BackingStorePrivate::copyPreviousContentsToBackSurfaceOfTile(const Platform } } -bool BackingStorePrivate::ensureOverScrollImage() -{ - std::string path = m_webPage->settings()->overScrollImagePath().utf8(); - if (path == "") - return false; - - if (s_overScrollImage && path == s_overScrollImagePath) - return true; - - std::string imagePath = Platform::Client::get()->getApplicationLocalDirectory() + path; - - SkBitmap bitmap; - if (!SkImageDecoder::DecodeFile(imagePath.c_str(), &bitmap)) { - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, - "BackingStorePrivate::ensureOverScrollImage could not decode overscroll image: %s", imagePath.c_str()); - return false; - } - - destroyBuffer(s_overScrollImage); - s_overScrollImage = createBuffer(Platform::IntSize(bitmap.width(), bitmap.height()), Platform::Graphics::TemporaryBuffer); - - SkCanvas* canvas = Platform::Graphics::lockBufferDrawable(s_overScrollImage); - if (!canvas) { - destroyBuffer(s_overScrollImage); - s_overScrollImage = 0; - return false; - } - - SkPaint paint; - paint.setXfermodeMode(SkXfermode::kSrc_Mode); - paint.setFlags(SkPaint::kAntiAlias_Flag); - paint.setFilterBitmap(true); - - SkRect rect = SkRect::MakeXYWH(0, 0, bitmap.width(), bitmap.height()); - canvas->save(); - canvas->drawBitmapRect(bitmap, 0, rect, &paint); - canvas->restore(); - - Platform::Graphics::releaseBufferDrawable(s_overScrollImage); - - s_overScrollImageSize = Platform::IntSize(bitmap.width(), bitmap.height()); - s_overScrollImagePath = path; - - return true; -} - void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& contents, const WebCore::TransformationMatrix& transformation, bool flush) @@ -1273,11 +1224,8 @@ void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& conten Platform::IntPoint origin = contents.location(); Platform::IntRect contentsClipped = contents; - // We have to paint the default background in the case of overzoom and // make sure it is invalidated. - Color color(m_webPage->settings()->overZoomColor()); - Platform::IntRectRegion overScrollRegion = Platform::IntRectRegion::subtractRegions(Platform::IntRect(contentsClipped), contentsRect); @@ -1294,21 +1242,13 @@ void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& conten overScrollRect.intersect(Platform::IntRect(Platform::IntPoint(0, 0), surfaceSize())); } - if (ensureOverScrollImage()) { - // Tile the image on the window region. - Platform::IntRect dstRect; - for (int y = overScrollRect.y(); y < overScrollRect.y() + overScrollRect.height(); y += dstRect.height()) { - for (int x = overScrollRect.x(); x < overScrollRect.x() + overScrollRect.width(); x += dstRect.width()) { - Platform::IntRect imageRect = Platform::IntRect(Platform::IntPoint(x - (x % s_overScrollImageSize.width()), - y - (y % s_overScrollImageSize.height())), s_overScrollImageSize); - dstRect = imageRect; - dstRect.intersect(overScrollRect); - Platform::IntRect srcRect = Platform::IntRect(x - imageRect.x(), y - imageRect.y(), dstRect.width(), dstRect.height()); - blitToWindow(dstRect, s_overScrollImage, srcRect, false, 255); - } - } - } else + if (m_webPage->settings()->isEnableDefaultOverScrollBackground()) { + fillWindow(BlackBerry::Platform::Graphics::DefaultBackgroundPattern, + overScrollRect, overScrollRect.location(), 1.0 /*contentsScale*/); + } else { + Color color(m_webPage->settings()->overScrollColor()); clearWindow(overScrollRect, color.red(), color.green(), color.blue(), color.alpha()); + } } } @@ -1426,7 +1366,8 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, #if DEBUG_CHECKERBOARD blitCheckered = true; #endif - checkerWindow(dstRect, checkeredRects.at(i).location(), transformation.a()); + fillWindow(BlackBerry::Platform::Graphics::CheckerboardPattern, + dstRect, checkeredRects.at(i).location(), transformation.a()); } } @@ -1485,7 +1426,8 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, #if DEBUG_CHECKERBOARD blitCheckered = true; #endif - checkerWindow(dirtyRectT, contentsOrigin, transformation.a()); + fillWindow(BlackBerry::Platform::Graphics::CheckerboardPattern, + dirtyRectT, contentsOrigin, transformation.a()); } // Blit the visible buffer here if we have visible zoom jobs. @@ -2507,9 +2449,10 @@ void BackingStorePrivate::blitToWindow(const Platform::IntRect& dstRect, } -void BackingStorePrivate::checkerWindow(const Platform::IntRect& dstRect, - const Platform::IntPoint& contentsOrigin, - double contentsScale) +void BackingStorePrivate::fillWindow(Platform::Graphics::FillPattern pattern, + const Platform::IntRect& dstRect, + const Platform::IntPoint& contentsOrigin, + double contentsScale) { ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()); @@ -2519,11 +2462,9 @@ void BackingStorePrivate::checkerWindow(const Platform::IntRect& dstRect, BlackBerry::Platform::Graphics::Buffer* dstBuffer = buffer(); ASSERT(dstBuffer); if (!dstBuffer) - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelWarn, "Empty window buffer, couldn't checkerWindow"); + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelWarn, "Empty window buffer, couldn't fillWindow"); - Color color(m_webPage->settings()->backgroundColor()); - unsigned char alpha = color.alpha(); - BlackBerry::Platform::Graphics::checkerBuffer(dstBuffer, dstRect, contentsOrigin, contentsScale, alpha); + BlackBerry::Platform::Graphics::fillBuffer(dstBuffer, pattern, dstRect, contentsOrigin, contentsScale); } void BackingStorePrivate::invalidateWindow() diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index 447a10414..a09ecd43a 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -307,7 +307,7 @@ public: void renderContents(Platform::Graphics::Drawable* /*drawable*/, const Platform::IntRect& /*contentsRect*/, const Platform::IntSize& /*destinationSize*/) const; void blitToWindow(const Platform::IntRect& dstRect, const BlackBerry::Platform::Graphics::Buffer* srcBuffer, const Platform::IntRect& srcRect, bool blend, unsigned char globalAlpha); - void checkerWindow(const Platform::IntRect& dstRect, const Platform::IntPoint& contentsOrigin, double contentsScale); + void fillWindow(Platform::Graphics::FillPattern, const Platform::IntRect& dstRect, const Platform::IntPoint& contentsOrigin, double contentsScale); void invalidateWindow(); void invalidateWindow(const Platform::IntRect& dst); @@ -335,8 +335,6 @@ public: BlackBerry::Platform::IntSize surfaceSize() const; BlackBerry::Platform::Graphics::Buffer* buffer() const; - bool ensureOverScrollImage(); - static WebPage* s_currentBackingStoreOwner; bool m_suspendScreenUpdates; @@ -378,10 +376,6 @@ public: bool m_isDirectRenderingAnimationMessageScheduled; #endif - static Platform::Graphics::Buffer* s_overScrollImage; - static std::string s_overScrollImagePath; - static Platform::IntSize s_overScrollImageSize; - protected: virtual ~BackingStorePrivate(); }; diff --git a/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp b/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp index 3250601dd..1c2813ee8 100644 --- a/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp +++ b/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp @@ -19,10 +19,10 @@ #include "config.h" #include "WebKitTextCodec.h" -#include "Base64.h" #include "KURL.h" #include "TextCodecICU.h" #include <wtf/Vector.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> @@ -84,28 +84,38 @@ TranscodeResult transcode(const char* sourceEncoding, const char* targetEncoding return Success; } -WebCore::Base64DecodePolicy base64DecodePolicyForWebCore(Base64DecodePolicy policy) +WTF::Base64DecodePolicy base64DecodePolicyForWTF(Base64DecodePolicy policy) { - // Must make sure Base64DecodePolicy is the same in WebKit and WebCore! - return static_cast<WebCore::Base64DecodePolicy>(policy); + COMPILE_ASSERT(WTF::Base64FailOnInvalidCharacter == static_cast<WTF::Base64DecodePolicy>(Base64FailOnInvalidCharacter)); + COMPILE_ASSERT(WTF::Base64IgnoreWhitespace == static_cast<WTF::Base64DecodePolicy>(Base64IgnoreWhitespace)); + COMPILE_ASSERT(WTF::Base64IgnoreInvalidCharacters == static_cast<WTF::Base64DecodePolicy>(Base64IgnoreInvalidCharacters)); + return static_cast<WTF::Base64DecodePolicy>(policy); } bool base64Decode(const std::string& base64, std::vector<char>& binary, Base64DecodePolicy policy) { Vector<char> result; - if (!WebCore::base64Decode(base64.c_str(), base64.length(), result, base64DecodePolicyForWebCore(policy))) + if (!WTF::base64Decode(base64.c_str(), base64.length(), result, base64DecodePolicyForWTF(policy))) return false; binary.insert(binary.begin(), result.begin(), result.end()); return true; } +WTF::Base64DecodePolicy base64EncodePolicyForWTF(Base64EncodePolicy policy) +{ + // FIXME: Base64InsertCRLF should be Base64InsertLFs. WTF::encodeBase64 doesn't insert CR. + COMPILE_ASSERT(WTF::Base64DoNotInsertLFs == static_cast<WTF::Base64EncodePolicy>(Base64DoNotInsertCRLF)); + COMPILE_ASSERT(WTF::Base64InsertLFs == static_cast<WTF::Base64EncodePolicy>(Base64InsertCRLF)); + return static_cast<WTF::Base64EncodePolicy>(policy); +} + bool base64Encode(const std::vector<char>& binary, std::string& base64, Base64EncodePolicy policy) { Vector<char> result; result.append(&binary[0], binary.size()); - WebCore::base64Encode(&binary[0], binary.size(), result, Base64InsertCRLF == policy ? true : false); + WTF::base64Encode(&binary[0], binary.size(), result, base64EncodePolicyForWTF(policy)); base64.clear(); base64.append(&result[0], result.size()); diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index e318003b4..97b56a7b2 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -337,6 +337,7 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In , m_visible(false) , m_activationState(ActivationActive) , m_shouldResetTilesWhenShown(false) + , m_shouldZoomToInitialScaleAfterLoadFinished(false) , m_userScalable(true) , m_userPerformedManualZoom(false) , m_userPerformedManualScroll(false) @@ -881,9 +882,8 @@ bool WebPage::executeJavaScriptFunction(const std::vector<std::string> &function JSObjectRef functionObject = obj; JSValueRef result = 0; - JSValueRef exception; if (functionObject && thisObject) - result = JSObjectCallAsFunction(ctx, functionObject, thisObject, args.size(), argListRef.data(), &exception); + result = JSObjectCallAsFunction(ctx, functionObject, thisObject, args.size(), argListRef.data(), 0); for (unsigned i = 0; i < args.size(); ++i) JSStringRelease(argList[i]); @@ -892,11 +892,6 @@ bool WebPage::executeJavaScriptFunction(const std::vector<std::string> &function if (!value) { returnType = JSException; - JSStringRef stringRef = JSValueToStringCopy(ctx, exception, 0); - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(stringRef); - WTF::Vector<char> buffer(bufferSize); - JSStringGetUTF8CString(stringRef, buffer.data(), bufferSize); - returnValue = WebString::fromUtf8(buffer.data()); return false; } @@ -1060,6 +1055,7 @@ void WebPagePrivate::setLoadState(LoadState state) m_backingStore->d->resetRenderQueue(); m_backingStore->d->resetTiles(true /* resetBackground */); m_backingStore->d->setScrollingOrZooming(false, false /* shouldBlit */); + m_shouldZoomToInitialScaleAfterLoadFinished = false; m_userPerformedManualZoom = false; m_userPerformedManualScroll = false; m_shouldUseFixedDesktopMode = false; @@ -1084,14 +1080,13 @@ void WebPagePrivate::setLoadState(LoadState state) frameLoadType = m_mainFrame->loader()->loadType(); if (!((m_didRestoreFromPageCache && documentHasViewportArguments) || (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin))) { m_viewportArguments = ViewportArguments(); + m_userScalable = m_webSettings->isUserScalable(); + resetScales(); // At the moment we commit a new load, set the viewport arguments // to any fallback values. If there is a meta viewport in the // content it will overwrite the fallback arguments soon. dispatchViewportPropertiesDidChange(m_userViewportArguments); - - m_userScalable = m_webSettings->isUserScalable(); - resetScales(); } else { IntSize virtualViewport = recomputeVirtualViewportFromViewportArguments(); m_webPage->setVirtualViewportSize(virtualViewport.width(), virtualViewport.height()); @@ -1706,9 +1701,10 @@ void WebPagePrivate::layoutFinished() m_nestedLayoutFinishedCount++; - if (shouldZoomToInitialScaleOnLoad()) + if (shouldZoomToInitialScaleOnLoad()) { zoomToInitialScaleOnLoad(); - else if (loadState() != None) + m_shouldZoomToInitialScaleAfterLoadFinished = false; + } else if (loadState() != None) notifyTransformedContentsSizeChanged(); m_nestedLayoutFinishedCount--; @@ -1743,19 +1739,6 @@ void WebPagePrivate::layoutFinished() } } -bool WebPagePrivate::shouldZoomToInitialScaleOnLoad() const -{ - // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call dispatchDidFirstVisuallyNonEmptyLayout() - // after the load Finished state, in which case the web page will have no chance to zoom to initial scale. So we should give it a chance, - // otherwise the scale of the web page can be incorrect. - FrameLoadType frameLoadType = FrameLoadTypeStandard; - if (m_mainFrame && m_mainFrame->loader()) - frameLoadType = m_mainFrame->loader()->loadType(); - if (m_loadState == Committed || (m_loadState == Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))) - return true; - return false; -} - void WebPagePrivate::zoomToInitialScaleOnLoad() { #if DEBUG_WEBPAGE_LOAD @@ -2344,6 +2327,11 @@ PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredent return static_cast<PageClientBlackBerry::SaveCredentialType>(m_client->notifyShouldSaveCredential(isNew)); } +void WebPagePrivate::syncProxyCredential(const WebCore::Credential& credential) +{ + m_client->syncProxyCredential(credential.user().utf8().data(), credential.password().utf8().data()); +} + void WebPagePrivate::notifyPopupAutofillDialog(const Vector<String>& candidates, const WebCore::IntRect& screenRect) { vector<string> textItems; @@ -4125,37 +4113,7 @@ bool WebPagePrivate::handleWheelEvent(PlatformWheelEvent& wheelEvent) bool WebPage::touchEvent(const Platform::TouchEvent& event) { #if DEBUG_TOUCH_EVENTS - switch (event.m_type) { - case Platform::TouchEvent::TouchEnd: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent Touch End"); - break; - case Platform::TouchEvent::TouchStart: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent Touch Start"); - break; - case Platform::TouchEvent::TouchMove: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent Touch Move"); - break; - case Platform::TouchEvent::TouchCancel: - Platform::log(Platform::LogLevelCritical, "WebPage::touchCancel Touch Cancel"); - break; - } - - for (unsigned i = 0; i < event.m_points.size(); i++) { - switch (event.m_points[i].m_state) { - case Platform::TouchPoint::TouchPressed: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Pressed (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - case Platform::TouchPoint::TouchReleased: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Released (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - case Platform::TouchPoint::TouchMoved: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Moved (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - case Platform::TouchPoint::TouchStationary: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Stationary (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - } - } + BBLOG(LogLevelCritical, "%s", event.toString().c_str()); #endif #if ENABLE(TOUCH_EVENTS) diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index 8ba09dd0a..2742492d1 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -135,7 +135,7 @@ public: virtual void notifyContentRendered(const Platform::IntRect&) = 0; virtual void resizeSurfaceIfNeeded() = 0; - virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle) = 0; + virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle, Platform::VirtualKeyboardType, Platform::VirtualKeyboardEnterKeyType) = 0; virtual void inputFocusLost() = 0; virtual void inputTextChanged() = 0; virtual void inputSelectionChanged(unsigned selectionStart, unsigned selectionEnd) = 0; @@ -215,6 +215,7 @@ public: virtual void setPreventsScreenIdleDimming(bool noDimming) = 0; virtual bool authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0; + virtual void syncProxyCredential(const WebString& username, const WebString& password) = 0; virtual void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0; virtual void notifyDismissAutofillDialog() = 0; diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index a0ffce066..0e46b73c5 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -191,6 +191,7 @@ public: virtual bool isVisible() const { return m_visible; } virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&); virtual SaveCredentialType notifyShouldSaveCredential(bool); + virtual void syncProxyCredential(const WebCore::Credential&); // Called from within WebKit via ChromeClientBlackBerry. void enterFullscreenForNode(WebCore::Node*); @@ -206,7 +207,12 @@ public: void notifyPopupAutofillDialog(const Vector<String>&, const WebCore::IntRect&); void notifyDismissAutofillDialog(); - bool shouldZoomToInitialScaleOnLoad() const; + bool shouldZoomToInitialScaleOnLoad() const { return loadState() == Committed || m_shouldZoomToInitialScaleAfterLoadFinished; } + void setShouldZoomToInitialScaleAfterLoadFinished(bool shouldZoomToInitialScaleAfterLoadFinished) + { + m_shouldZoomToInitialScaleAfterLoadFinished = shouldZoomToInitialScaleAfterLoadFinished; + } + // Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport. void zoomToInitialScaleOnLoad(); @@ -459,6 +465,7 @@ public: bool m_visible; ActivationStateType m_activationState; bool m_shouldResetTilesWhenShown; + bool m_shouldZoomToInitialScaleAfterLoadFinished; bool m_userScalable; bool m_userPerformedManualZoom; bool m_userPerformedManualScroll; diff --git a/Source/WebKit/blackberry/Api/WebSettings.cpp b/Source/WebKit/blackberry/Api/WebSettings.cpp index 0cf36cc69..1156d741a 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.cpp +++ b/Source/WebKit/blackberry/Api/WebSettings.cpp @@ -23,7 +23,6 @@ #include "WebSettings_p.h" #include "WebString.h" -#include <Base64.h> #include <BlackBerryPlatformDeviceInfo.h> #include <BlackBerryPlatformFontInfo.h> #include <BlackBerryPlatformScreen.h> @@ -33,6 +32,7 @@ #include <ViewportArguments.h> #include <wtf/HashSet.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> namespace BlackBerry { namespace WebKit { @@ -48,8 +48,8 @@ DEFINE_STATIC_LOCAL(String, BlackBerryHandlePatternURLs, ("BlackBerryHandlePatte DEFINE_STATIC_LOCAL(String, BlackBerryInitialScale, ("BlackBerryInitialScale")); DEFINE_STATIC_LOCAL(String, BlackBerryLinksHandledExternallyEnabled, ("BlackBerryLinksHandledExternallyEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryMaxPluginInstances, ("BlackBerryMaxPluginInstances")); -DEFINE_STATIC_LOCAL(String, BlackBerryOverZoomColor, ("BlackBerryOverZoomColor")); -DEFINE_STATIC_LOCAL(String, BlackBerryOverScrollImagePath, ("BlackBerryOverScrollImagePath")); +DEFINE_STATIC_LOCAL(String, BlackBerryOverScrollColor, ("BlackBerryOverScrollColor")); +DEFINE_STATIC_LOCAL(String, BlackBerryEnableDefaultOverScrollBackground, ("BlackBerryEnableDefaultOverScrollBackground")); DEFINE_STATIC_LOCAL(String, BlackBerryRenderAnimationsOnScrollOrZoomEnabled, ("BlackBerryRenderAnimationsOnScrollOrZoomEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryScrollbarsEnabled, ("BlackBerryScrollbarsEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryTextReflowMode, ("BlackBerryTextReflowMode")); @@ -164,8 +164,8 @@ WebSettings* WebSettings::standardSettings() settings->m_private->setBoolean(BlackBerryCookiesEnabled, true); settings->m_private->setDouble(BlackBerryInitialScale, -1); settings->m_private->setUnsigned(BlackBerryMaxPluginInstances, 1); - settings->m_private->setUnsigned(BlackBerryOverZoomColor, WebCore::Color::white); - settings->m_private->setString(BlackBerryOverScrollImagePath, ""); + settings->m_private->setUnsigned(BlackBerryOverScrollColor, WebCore::Color::white); + settings->m_private->setBoolean(BlackBerryEnableDefaultOverScrollBackground, true); settings->m_private->setBoolean(BlackBerryScrollbarsEnabled, true); // FIXME: We should detect whether we are embedded in a browser or an email client and default to TextReflowEnabledOnlyForBlockZoom and TextReflowEnabled, respectively. @@ -471,7 +471,7 @@ void WebSettings::setUserStyleSheetString(const char* userStyleSheetString) data.append(userStyleSheetString, length); Vector<char> encodedData; - WebCore::base64Encode(data, encodedData); + base64Encode(data, encodedData); const char prefix[] = "data:text/css;charset=utf-8;base64,"; size_t prefixLength = sizeof(prefix) - 1; @@ -707,24 +707,24 @@ void WebSettings::setShouldRenderAnimationsOnScrollOrZoom(bool enable) m_private->setBoolean(BlackBerryRenderAnimationsOnScrollOrZoomEnabled, enable); } -unsigned WebSettings::overZoomColor() const +unsigned WebSettings::overScrollColor() const { - return m_private->getUnsigned(BlackBerryOverZoomColor); + return m_private->getUnsigned(BlackBerryOverScrollColor); } -void WebSettings::setOverZoomColor(unsigned color) +void WebSettings::setOverScrollColor(unsigned color) { - m_private->setUnsigned(BlackBerryOverZoomColor, color); + m_private->setUnsigned(BlackBerryOverScrollColor, color); } -WebString WebSettings::overScrollImagePath() const +bool WebSettings::isEnableDefaultOverScrollBackground() const { - return m_private->getString(BlackBerryOverScrollImagePath); + return m_private->getBoolean(BlackBerryEnableDefaultOverScrollBackground); } -void WebSettings::setOverScrollImagePath(const char* path) +void WebSettings::setEnableDefaultOverScrollBackground(bool enabled) { - m_private->setString(BlackBerryOverScrollImagePath, path); + m_private->setBoolean(BlackBerryEnableDefaultOverScrollBackground, enabled); } unsigned WebSettings::backgroundColor() const diff --git a/Source/WebKit/blackberry/Api/WebSettings.h b/Source/WebKit/blackberry/Api/WebSettings.h index a1ee57b8a..39f7c209b 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.h +++ b/Source/WebKit/blackberry/Api/WebSettings.h @@ -198,11 +198,11 @@ public: bool shouldRenderAnimationsOnScrollOrZoom() const; void setShouldRenderAnimationsOnScrollOrZoom(bool enable); - unsigned overZoomColor() const; - void setOverZoomColor(unsigned); + unsigned overScrollColor() const; + void setOverScrollColor(unsigned); - WebString overScrollImagePath() const; - void setOverScrollImagePath(const char*); + bool isEnableDefaultOverScrollBackground() const; + void setEnableDefaultOverScrollBackground(bool); unsigned backgroundColor() const; void setBackgroundColor(unsigned); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index a7df5802a..46ae45d59 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,241 @@ +2012-07-13 Xianzhu Wang <wangxianzhu@chromium.org> + + Move WebCore/platform/text/Base64 to WTF/wtf/text + https://bugs.webkit.org/show_bug.cgi?id=91162 + + Reviewed by Adam Barth. + + * Api/WebKitTextCodec.cpp: + (BlackBerry::WebKit::base64DecodePolicyForWTF): + (BlackBerry::WebKit::base64Decode): + (BlackBerry::WebKit::base64EncodePolicyForWTF): + (BlackBerry::WebKit::base64Encode): + * Api/WebSettings.cpp: + (BlackBerry::WebKit::WebSettings::setUserStyleSheetString): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + +2012-07-13 George Staikos <staikos@webkit.org> + + [BlackBerry] Fix crash due to unguarded use of renderer in select + popup. + https://bugs.webkit.org/show_bug.cgi?id=91287 + + Reviewed by Rob Buis. + + No known testcase for this. Found in the wild. + + * WebCoreSupport/SelectPopupClient.cpp: + (WebCore::SelectPopupClient::setValueAndClosePopup): + +2012-07-13 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Add support for attributes to define keyboard and enter key type on the Virtual Keyboard + https://bugs.webkit.org/show_bug.cgi?id=91248 + + Reviewed by Antonio Gomes. + + PR 174733. + + Add data-blackberry-virtual-keyboard-type and + data-blackberry-virtual-keyboard-enter-key to + enable configuration of the desired virtual keyboard + using element attributes. + + Reviewed Internally by Gen Mak. + + * Api/WebPageClient.h: + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::convertStringToKeyboardType): + (WebKit): + (BlackBerry::WebKit::keyboardTypeAttribute): + (BlackBerry::WebKit::convertStringToKeyboardEnterKeyType): + (BlackBerry::WebKit::keyboardEnterKeyTypeAttribute): + (BlackBerry::WebKit::InputHandler::setElementFocused): + +2012-07-13 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] resetBitmapZoomScale called while zooming preventing pinch zoom + https://bugs.webkit.org/show_bug.cgi?id=91247 + + Reviewed by Antonio Gomes. + + PR: 175432 + On yahoo.com, the web page stopped zooming while trying to pinch as + WebPageClient::resetBitmapZoomScale(double) was being called by + WebPagePrivate::zoomToInitialScaleOnLoad() after load finished. + And also yahoo.com was keeping updating layout, which made it really + bad that zoomToInitialScaleOnLoad() was called many times when load + finished and the load type was FrameLoadTypeStandard or FrameLoadTypeSame. + As we only care about the situation that dispatchDidFirstVisuallyNonEmptyLayout() + happens after load finished, we can move the code to that method and + set a flag for WebPage layoutFinished() and zoomToInitialScaleOnLoad() + instead. In this way, we can ensure that the flag is only enabled when + dispatchDidFirstVisuallyNonEmptyLayout() is called after load finished + and get rid of calling zoomToInitialScaleOnLoad() lots of times when + keeping updating layout in such kind of situation. + + Internally reviewed by Arvid Nilsson + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): + (BlackBerry::WebKit::WebPagePrivate::setLoadState): + (BlackBerry::WebKit::WebPagePrivate::layoutFinished): + * Api/WebPage_p.h: + (BlackBerry::WebKit::WebPagePrivate::shouldZoomToInitialScaleOnLoad): + (BlackBerry::WebKit::WebPagePrivate::setShouldZoomToInitialScaleAfterLoadFinished): + (WebPagePrivate): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout): + +2012-07-13 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Use fillBuffer() instead of a user-defined background image. + https://bugs.webkit.org/show_bug.cgi?id=91180 + RIM PR 171458 + + Reviewed by Rob Buis. + Internally reviewed by Andrew Lo. + + By using Platform::Graphics::fillBuffer() to fill the + overscroll area, we save graphics memory for the buffer + that the background image was occupying. + + Also adapt checkerboard drawing as it is now done using + fillBuffer() which replaces checkerBuffer(). + + In the same go, use the opportunity of the WebSettings + API change to make it more consistent, renaming the + OverZoomColor setting to OverScrollColor. + + * Api/BackingStore.cpp: + (WebKit): + (BlackBerry::WebKit::BackingStorePrivate::paintDefaultBackground): + (BlackBerry::WebKit::BackingStorePrivate::blitContents): + (BlackBerry::WebKit::BackingStorePrivate::fillWindow): + * Api/BackingStore_p.h: + (BackingStorePrivate): + * Api/WebSettings.cpp: + (WebKit): + (BlackBerry::WebKit::WebSettings::standardSettings): + (BlackBerry::WebKit::WebSettings::overScrollColor): + (BlackBerry::WebKit::WebSettings::setOverScrollColor): + (BlackBerry::WebKit::WebSettings::isEnableDefaultOverScrollBackground): + (BlackBerry::WebKit::WebSettings::setEnableDefaultOverScrollBackground): + * Api/WebSettings.h: + +2012-07-13 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:* pages + https://bugs.webkit.org/show_bug.cgi?id=91121 + + Reviewed by Yong Li. + + Update the about:config pages, and improve the aesthetics of the about:build, about:version, about:credits, about:memory, about:config, and similar pages. + + No new tests, because there is no new funtionality. + + * WebCoreSupport/AboutData.cpp: + (WebCore): + (WebCore::writeFeatures): + (WebCore::numberToHTMLTr): Converted to template function, added bool specialization to write "true" and "false" instead of "1" and "0" + (WebCore::configPage): + (WebCore::memoryPage): + * WebCoreSupport/AboutTemplate.html.cpp: Template for BlackBerry about:* pages. + +2012-07-12 Benjamin C Meyer <bmeyer@rim.com> + + WebPage::executeJavaScriptFunction crashes when there is an exception + https://bugs.webkit.org/show_bug.cgi?id=91098 + RIM PR #149294 + + When there is an exception currently the code tries to get the string of + the exception via JSValueToStringCopy to pass back, but this cases a + crash inside JavaScriptCore, so change it to simply return false and not + set the return value with the exception string. + + Reviewed by George Staikos. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::executeJavaScriptFunction): + +2012-07-12 Pawel Chomicki <pchomicki@rim.com> + + [BlackBerry] WebPage::touchEvent() should use Platform::TouchEvent's toString() for debugging. + https://bugs.webkit.org/show_bug.cgi?id=91002 + + Reviewed by Antonio Gomes. + Reviewed internally by Genevieve Mak. + + Updated DEBUG_TOUCH_EVENTS section of touchEvent method to utilize + Platform::TouchEvent's toString method. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::touchEvent): + +2012-07-12 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Cannot use digest proxy auth and NTLM auth at the same time + https://bugs.webkit.org/show_bug.cgi?id=91054 + + Reviewed by George Staikos. + + Implemented interface function syncProxyCredential() derived + from class PageClientBlackBerry. + + Internally reviewed by Jason Liu <jason.liu@torchmobile.com.cn> + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::syncProxyCredential): + (WebKit): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-07-11 Mike Lattanzio <mlattanzio@rim.com> + + [BlackBerry] UserViewportArguments are not properly respected. + https://bugs.webkit.org/show_bug.cgi?id=91005 + + Reviewed by Rob Buis. + + PR# 170088. + Move scale and zooming reset on Committed before applying + the user viewport to avoid overriding it immediately. + + Internal review by Konrad Piascik, Jacky Jiang. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setLoadState): + +2012-07-11 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Implement Date/Time picker + https://bugs.webkit.org/show_bug.cgi?id=90911 + + Reviewed by Rob Buis. + + Implement HTML Date/Time picker, also should delete popup when closing popup. + + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::closePagePopup): + * WebCoreSupport/DatePickerClient.cpp: Added. + (WebCore): + (WebCore::DatePickerClient::DatePickerClient): + (WebCore::DatePickerClient::~DatePickerClient): + (WebCore::DatePickerClient::generateHTML): + (WebCore::DatePickerClient::closePopup): + (WebCore::DatePickerClient::contentSize): + (WebCore::DatePickerClient::htmlSource): + (WebCore::DatePickerClient::setValueAndClosePopup): + (WebCore::DatePickerClient::didClosePopup): + (WebCore::DatePickerClient::writeDocument): + * WebCoreSupport/DatePickerClient.h: Added. + (WebKit): + (WebCore): + (DatePickerClient): + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::openDatePopup): + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp index bc44ccb5a..7f50d7f87 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp @@ -18,6 +18,7 @@ #include "config.h" #include "AboutData.h" +#include "AboutTemplate.html.cpp" #include "CString.h" #include "JSDOMWindow.h" @@ -35,20 +36,33 @@ namespace WebCore { -static String numberToHTMLTr(const String& description, unsigned number) +static String writeFeatures(const Vector<String>& trueList, const Vector<String>& falseList) +{ + String ret; + for (unsigned int i = 0, j = 0; i < trueList.size() || j < falseList.size();) { + bool pickFromFalse = ((i >= trueList.size()) || (j < falseList.size() && strcmp(falseList[j].ascii().data(), trueList[i].ascii().data()) < 0)); + const String& item = (pickFromFalse ? falseList : trueList)[ (pickFromFalse ? j : i)++ ]; + ret += String("<tr><td><div class='" + String(pickFromFalse ? "false" : "true") + "'" + (item.length() >= 30 ? " style='font-size:10px;' " : "") + ">" + item + "</div></td></tr>"); + } + return ret; +} + +template<class T> String numberToHTMLTr(const String& description, T number) { return String("<tr><td>") + description + "</td><td>" + String::number(number) + "</td></tr>"; } +template<> String numberToHTMLTr<bool>(const String& description, bool truth) +{ + return String("<tr><td>") + description + "</td><td>" + (truth?"true":"false") + "</td></tr>"; +} + String configPage() { String page; - #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD - page = String("<!DOCTYPE html><html><head><title>BlackBerry Browser Configuration Information</title><meta name=\"viewport\" content=\"width=700\">") - + "<style>@media all and (orientation:landscape) { body { -webkit-column-count:2; -webkit-column-rule:solid; font-size:8px; } h1 { -webkit-column-span: all; } ul { font-size: 50%; } } td,li { text-overflow: ellipsis; overflow: hidden; } .list2 { width: 49%; float:left; padding-right:1px; } ul { list-style-type:none; padding:0px; margin:0px; } h1,h2,h3 { text-align:center; margin:0; } h2 { padding:1em 0 0 0; clear:both; } li,td { font-family:\"DejaVu Sans Condensed\"; }</style>" - + "</head><body><h1>BlackBerry Browser Configuration Information</h1>" - + "<h2>Compiler Information</h2><table>" + 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>" + "<tr><td>_MSC_VER</td><td>" + String::number(_MSC_VER) + "</td></tr>" @@ -67,7 +81,7 @@ String configPage() // Add "" to satisfy check-webkit-style. + ""; - page += String("</table><h2>CPU Information</h2><table>") + page += String("</table></div><br><div class='box'><div class='box-title'>CPU Information</div><table class='fixed-table'><col width=75%><col width=25%>") #if CPU(X86) + "<tr><td>X86</td><td></td></tr>" #elif CPU(ARM) @@ -86,7 +100,7 @@ String configPage() #endif + "</td></tr>"; - page += String("</table><h2>Platform Information</h2><table>") + page += String("</table></div><br><div class='box'><div class='box-title'>Platform Information</div><table class='fixed-table'><col width=75%><col width=25%>") + "<tr><td>WebKit Version</td><td>" + String::number(WEBKIT_MAJOR_VERSION) + "." + String::number(WEBKIT_MINOR_VERSION) + "</td></tr>" + "<tr><td>BlackBerry</td><td>" #if PLATFORM(BLACKBERRY) @@ -104,22 +118,24 @@ String configPage() + "</td></tr>"; BlackBerry::Platform::Settings* settings = BlackBerry::Platform::Settings::instance(); - page += String("</table><h2>Platform Settings</h2><table>"); + page += String("</table></div><br><div class='box'><div class='box-title'>Platform Settings</div><table style='font-size:11px;' class='fixed-table'><col width=75%><col width=25%>"); page += numberToHTMLTr("isRSSFilteringEnabled", settings->isRSSFilteringEnabled()); page += numberToHTMLTr("secondaryThreadStackSize", settings->secondaryThreadStackSize()); page += numberToHTMLTr("maxPixelsPerDecodedImage", settings->maxPixelsPerDecodedImage()); page += numberToHTMLTr("shouldReportLowMemoryToUser", settings->shouldReportLowMemoryToUser()); page += numberToHTMLTr("numberOfBackingStoreTiles", settings->numberOfBackingStoreTiles()); - page += numberToHTMLTr("maximumNumberOfBackingStoreTilesAcrossProcesses", settings->maximumNumberOfBackingStoreTilesAcrossProcesses()); + page += numberToHTMLTr("maximumNumberOfBacking...AcrossProcesses", settings->maximumNumberOfBackingStoreTilesAcrossProcesses()); page += numberToHTMLTr("tabsSupportedByClient", settings->tabsSupportedByClient()); page += numberToHTMLTr("contextMenuEnabled", settings->contextMenuEnabled()); page += numberToHTMLTr("selectionEnabled", settings->selectionEnabled()); + page += numberToHTMLTr("fineCursorControlEnabled", settings->fineCursorControlEnabled()); page += numberToHTMLTr("alwaysShowKeyboardOnFocus", settings->alwaysShowKeyboardOnFocus()); page += numberToHTMLTr("allowCenterScrollAdjustmentForInputFields", settings->allowCenterScrollAdjustmentForInputFields()); page += numberToHTMLTr("unrestrictedResizeEvents", settings->unrestrictedResizeEvents()); page += numberToHTMLTr("isBridgeBrowser", settings->isBridgeBrowser()); page += numberToHTMLTr("isWebGLSupported", settings->isWebGLSupported()); page += numberToHTMLTr("showImageLocationOptionsInGCM", settings->showImageLocationOptionsInGCM()); + page += numberToHTMLTr("forceGLES2WindowUsage", settings->forceGLES2WindowUsage()); page += numberToHTMLTr("maxClickableSpeed", settings->maxClickableSpeed()); page += numberToHTMLTr("maxJitterRadiusClick", settings->maxJitterRadiusClick()); page += numberToHTMLTr("maxJitterRadiusTap", settings->maxJitterRadiusTap()); @@ -131,51 +147,33 @@ String configPage() page += numberToHTMLTr("maxJitterDistanceTap", settings->maxJitterDistanceTap()); page += numberToHTMLTr("maxJitterDistanceSingleTouchMove", settings->maxJitterDistanceSingleTouchMove()); page += numberToHTMLTr("maxJitterDistanceTouchHold", settings->maxJitterDistanceTouchHold()); - page += numberToHTMLTr("maxJitterDistanceHandleDrag", settings->maxJitterDistanceHandleDrag()); page += numberToHTMLTr("maxJitterDistanceTapHighlight", settings->maxJitterDistanceTapHighlight()); + page += numberToHTMLTr("maxJitterDistanceHandleDrag", settings->maxJitterDistanceHandleDrag()); page += numberToHTMLTr("topFatFingerPadding", settings->topFatFingerPadding()); page += numberToHTMLTr("rightFatFingerPadding", settings->rightFatFingerPadding()); page += numberToHTMLTr("bottomFatFingerPadding", settings->bottomFatFingerPadding()); + page += numberToHTMLTr("maxSelectionNeckHeight", settings->maxSelectionNeckHeight()); page += numberToHTMLTr("leftFatFingerPadding", settings->leftFatFingerPadding()); -#define FOR_EACH_TRUE_LIST() \ - for (unsigned int i = 0; i < trueList.size(); ++i) \ - page += String("<li>") + trueList[i] + "</li>" - -#define FOR_EACH_FALSE_LIST() \ - for (unsigned int i = 0; i < falseList.size(); ++i) \ - page += String("<li>") + falseList[i] + "</li>" - Vector<String> trueList, falseList; #include "AboutDataEnableFeatures.cpp" - page += String("</table><h2>WebKit ENABLE Information</h2><div class=\"list2\">"); - page += String("<h3>ENABLE</h3><ul>"); - FOR_EACH_TRUE_LIST(); - page += String("</ul></div><div class=\"list2\"><h3>don't ENABLE</h3><ul>"); - FOR_EACH_FALSE_LIST(); - page += String("</ul></div>"); + page += String("</table></div><br><div class='box'><div class='box-title'>WebKit Features (ENABLE_)</div><table class='fixed-table'>"); + + page += writeFeatures(trueList, falseList); trueList.clear(); falseList.clear(); #include "AboutDataHaveFeatures.cpp" - page += String("</table><h2>WebKit HAVE Information</h2><div class=\"list2\">"); - page += String("<h3>HAVE</h3><ul>"); - FOR_EACH_TRUE_LIST(); - page += String("</ul></div><div class=\"list2\"><h3>don't HAVE</h3><ul>"); - FOR_EACH_FALSE_LIST(); - page += String("</ul></div>"); + page += String("</table></div><br><div class='box'><div class='box-title'>WebKit Features (HAVE_)</div><table class='fixed-table'>"); + + page += writeFeatures(trueList, falseList); trueList.clear(); falseList.clear(); #include "AboutDataUseFeatures.cpp" - page += String("<h2>WebKit USE Information</h2><div class=\"list2\">"); - page += String("<h3>USE</h3><ul>"); - FOR_EACH_TRUE_LIST(); - page += String("</ul></div><div class=\"list2\"><h3>don't USE</h3><ul>"); - FOR_EACH_FALSE_LIST(); - page += String("</ul></div>"); - - page += String("</body></html>"); + page += String("</table></div><br><div class='box'><div class='box-title'>WebKit Features (USE_)</div><table class='fixed-table'>"); + page += writeFeatures(trueList, falseList); + page += String("</table></div></body></html>"); #endif return page; @@ -205,15 +203,14 @@ String memoryPage() { String page; - // generate memory information - page = "<html><head><title>BlackBerry Browser Memory Information</title></head><body><h2>BlackBerry Browser Memory Information</h2>"; + page = writeHeader("Memory") + + "<div class=\"box\"><div class=\"box-title\">Cache Information<br><div style='font-size:11px;color:#A8A8A8'>Size, Living, and Decoded are expressed in KB.</div><br></div><table class='fixed-table'><col width=75%><col width=25%>"; // generate cache information MemoryCache* cacheInc = memoryCache(); MemoryCache::Statistics cacheStat = cacheInc->getStatistics(); - page += "<h2>Cache Information</h2>" - "<table align=\"center\" rules=\"all\"><tr> <th>Item</th> <th>Count</th> <th>Size<br>KB</th> <th>Living<br>KB</th> <th>Decoded<br>KB</th></tr>"; + page += "<tr> <th align=left>Item</th> <th align=left>Count</th> <th align=left>Size</th> <th align=left>Living</th> <th align=left>Decoded</th></tr>"; MemoryCache::TypeStatistic total; total.count = cacheStat.images.count + cacheStat.cssStyleSheets.count @@ -234,7 +231,7 @@ String memoryPage() #endif page += cacheTypeStatisticToHTMLTr("Fonts", cacheStat.fonts); - page += "</table>"; + page += "</table></div><br>"; #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD @@ -244,7 +241,7 @@ String memoryPage() OwnPtr<JSC::TypeCountSet> objectTypeCounts = mainHeap.objectTypeCounts(); OwnPtr<JSC::TypeCountSet> protectedObjectTypeCounts = mainHeap.protectedObjectTypeCounts(); - page += "<h2>JS engine memory usage</h2><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>JS engine memory usage</div><table class='fixed-table'><col width=75%><col width=25%>"; page += numberToHTMLTr("Stack size", jscMemoryStat.stackBytes); page += numberToHTMLTr("JIT memory usage", jscMemoryStat.JITBytes); @@ -255,20 +252,20 @@ String memoryPage() page += numberToHTMLTr("Protected object count", mainHeap.protectedObjectCount()); page += numberToHTMLTr("Protected global object count", mainHeap.protectedGlobalObjectCount()); - page += "</table>"; + page += "</table></div><br>"; - page += "<h3>Object type counts</h3><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>Object type counts</div><table class='fixed-table'><col width=75%><col width=25%>"; dumpJSCTypeCountSetToTableHTML(page, objectTypeCounts.get()); - page += "</table>"; + page += "</table></div><br>"; - page += "<h3>Protected object type counts</h3><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>Protected object type counts</div><table class='fixed-table'><col width=75%><col width=25%>"; dumpJSCTypeCountSetToTableHTML(page, protectedObjectTypeCounts.get()); - page += "</table>"; + page += "</table></div><br>"; // Malloc info. struct mallinfo mallocInfo = mallinfo(); - page += "<h2>Malloc Information</h2><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>Malloc Information</div><table class='fixed-table'><col width=75%><col width=25%>"; page += numberToHTMLTr("Total space in use", mallocInfo.usmblks + mallocInfo.uordblks); page += numberToHTMLTr("Total space in free blocks", mallocInfo.fsmblks + mallocInfo.fordblks); @@ -286,7 +283,7 @@ String memoryPage() if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) page += numberToHTMLTr("Process total mapped memory", processInfo.st_size); - page += "</table>"; + page += "</table></div>"; #endif page += "</body></html>"; diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 8a0adf79d..250c3f959 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -1,42 +1,34 @@ -3D_CANVAS -3D_PLUGIN 3D_RENDERING ACCELERATED_2D_CANVAS ANIMATION_API ASSEMBLER ASSEMBLER_WX_EXCLUSIVE BATTERY_STATUS -BLACKBERRY_CREDENTIAL_PERSIST -BLACKBERRY_DEBUG_MEMORY BLOB BRANCH_COMPACTION CHANNEL_MESSAGING CLASSIC_INTERPRETER -CODEBLOCK_SAMPLING +CLIENT_BASED_GEOLOCATION COMPARE_AND_SWAP COMPUTED_GOTO_CLASSIC_INTERPRETER -CONTEXT_MENUS CSS_FILTERS CSS_GRID_LAYOUT +CSS_IMAGE_SET CSS_SHADERS DASHBOARD_SUPPORT +CUSTOM_SCHEME_HANDLER DATALIST DATA_TRANSFER_ITEMS -DEBUG_MATH_LAYOUT +DASHBOARD_SUPPORT DEBUG_WITH_BREAKPOINT DETAILS DEVICE_ORIENTATION DFG_JIT DIRECTORY_UPLOAD -DOUBLE_TAP_CENTERS DOWNLOAD_ATTRIBUTE DRAG_SUPPORT -DRT -EVENT_MODE_METATAGS EXECUTABLE_ALLOCATOR_DEMAND EXECUTABLE_ALLOCATOR_FIXED -EXPERIMENTAL_FEATURE -FAST_MALLOC_MATCH_VALIDATION FAST_MOBILE_SCROLLING FILE_SYSTEM FILTERS @@ -44,15 +36,14 @@ FIXED_REPORTED_SIZE FTPDIR FULLSCREEN_API GAMEPAD -GC_LOGGING GC_VALIDATION GEOLOCATION GESTURE_EVENTS -GESTURE_RECOGNIZER -GGC +GLIB_SUPPORT GLOBAL_FASTMALLOC_NEW HIGH_DPI_CANVAS ICONDATABASE +IFRAME_SEAMLESS IMAGE_DECODER_DOWN_SAMPLING INDEXED_DATABASE INPUT_SPEECH @@ -67,16 +58,14 @@ INSPECTOR JAVASCRIPT_DEBUGGER JAVASCRIPT_I18N_API JAVA_BRIDGE +JAVASCRIPT_DEBUGGER JIT -JIT_OPTIMIZE_PROPERTY_ACCESS -JIT_USE_SOFT_MODULO JIT_VERBOSE JIT_VERBOSE_OSR -LARGE_HEAP LEGACY_NOTIFICATIONS +LEGACY_WEBKIT_BLOB_BUILDER LINK_PREFETCH LLINT -MAC_JAVA_BRIDGE MATHML MEDIA_SOURCE MEDIA_STATISTICS @@ -89,18 +78,17 @@ MICRODATA MUTATION_OBSERVERS NETSCAPE_PLUGIN_API NETSCAPE_PLUGIN_METADATA_CACHE -NEW_XML +NETWORK_INFO NOTIFICATIONS -NO_LISTBOX_RENDERING OPCODE_SAMPLING -OPCODE_STATS OPENTYPE_SANITIZER ORIENTATION_EVENTS +OVERFLOW_SCROLLING PAGE_VISIBILITY_API PAN_SCROLLING +PARSED_STYLE_SHEET_CACHING +PAGE_POPUP PARALLEL_GC -PARALLEL_JOBS -PASSWORD_ECHO PLUGIN_PACKAGE_SIMPLE_HASH PLUGIN_PROCESS PLUGIN_PROXY_FOR_VIDEO @@ -113,21 +101,17 @@ REGISTER_PROTOCOL_HANDLER REPAINT_THROTTLING REQUEST_ANIMATION_FRAME RUBBER_BANDING -RUN_TIME_HEURISTICS -RXI_IMAGE_FORMAT SAMPLING_COUNTERS SAMPLING_FLAGS SAMPLING_REGIONS SAMPLING_THREAD +SCRIPTED_SPEECH SHADOW_DOM SHARED_WORKERS SIMPLE_HEAP_PROFILING -SINGLE_THREADED -SKIA_GPU_CANVAS -SKIA_TEXT SMOOTH_SCROLLING -SPEECH_INPUT SPELLCHECK +SUBPIXEL_LAYOUT SQL_DATABASE STYLE_SCOPED SVG @@ -135,10 +119,11 @@ SVG_DOM_OBJC_BINDINGS SVG_FONTS TEXT_CARET TEXT_NOTIFICATIONS_ONLY +THREADED_SCROLLING THREADING_GENERIC +THREADED_SCROLLING THREADING_LIBDISPATCH THREADING_OPENMP -THREADING_SCROLLING TOUCH_EVENTS TOUCH_ICON_LOADING VALUE_PROFILER @@ -152,14 +137,11 @@ WEBGL WEBKIT2 WEB_ARCHIVE WEB_AUDIO -WEB_PROCESS_SANDBOX +WEB_INTENTS WEB_SOCKETS WEB_TIMING WORKERS WRITE_BARRIER_PROFILING -WTF_MALLOC_VALIDATION -XHR_RESPONSE_BLOB -XHTMLMP XSLT YARR_JIT YARR_JIT_DEBUG diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in index 344595cfc..d7e99518d 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in @@ -1,37 +1,24 @@ ACCESSIBILITY -ASSEMBLER -AVCF -CG_INTERPOLATION_MEDIUM -COMPUTED_GOTO DISPATCH_H -DTRACE ERRNO_H -HEADER_DETECTION_H HOSTED_CORE_ANIMATION -INTTYPES_H INVERTED_WHEEL_EVENTS ISDEBUGGERPRESENT LANGINFO_H +LAYER_HOSTING_IN_WINDOW_SERVER MADV_DONTNEED MADV_FREE MADV_FREE_REUSE -MERGESORT MMAP NETWORK_CFDATA_ARRAY_CALLBACK -NULLPTR -PATH_BASED_BORDER_RADIUS_DRAWING PTHREAD_H -PTHREAD_MACHDEP_H PTHREAD_NP_H PTHREAD_RWLOCK PTHREAD_SETNAME_NP -QRAWFONT -QSTYLE READLINE RUNLOOP_TIMER SBRK SIGNAL_H -STDINT_H STRINGS_H STRNSTR SYS_PARAM_H @@ -40,8 +27,5 @@ SYS_TIME_H TIMEGM TM_GMTOFF TM_ZONE -VARIADIC_MACRO VASPRINTF VIRTUALALLOC -WEBCOMPOSITOR -WKQCA diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in index 88fec71b7..80ddd27d7 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in @@ -1,6 +1,5 @@ -ACCELERATE ACCELERATED_COMPOSITING -ACCELERATED_COMPOSITING_PLUGIN_LAYER +ARENA_ALLOC_ALIGNMENT_INTEGER ATSUI AUTOCORRECTION_PANEL AUTOMATIC_TEXT_REPLACEMENT @@ -14,6 +13,7 @@ CFURLSTORAGESESSIONS CG CG_INTERPOLATION_MEDIUM CHROME_NETWORK_STACK +CHROMIUM_NET CONCATENATED_IMPULSE_RESPONSES CONSOLE_ENTRY_POINT COREAUDIO @@ -52,13 +52,7 @@ PLUGIN_HOST_PROCESS PROTECTION_SPACE_AUTH_CALLBACK PTHREADS PTHREAD_GETSPECIFIC_DIRECT -QT4_UNICODE -QTKIT -QT_MOBILITY_SYSTEMINFO -QT_MULTIMEDIA QUERY_PERFORMANCE_COUNTER -QXMLQUERY -QXMLSTREAM REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR REQUEST_ANIMATION_FRAME_TIMER SAFARI_THEME diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutTemplate.html.cpp b/Source/WebKit/blackberry/WebCoreSupport/AboutTemplate.html.cpp new file mode 100644 index 000000000..74984ddd1 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutTemplate.html.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +static String writeHeader(const String& header) +{ + return "<!DOCTYPE html><html>" + "<head>" + " <style>.title{text-align:center;color:white;font-size:28pt;}.box{padding:10px;border:2px solid gray;margin:0px;background:black;color:white;-webkit-border-radius: 10px;}.box-title{text-align:center;font-weight:bold;}.true {color:green;}.false {color: red;text-decoration: line-through;}.fixed-table{color:white;border-collapse:collapse;width:100%} tr:nth-child(2n){color:#A8A8A8;}</style>" + " <title>"+title+"</title>" + " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">" + " <style>@media all and (orientation:landscape) { .main { -webkit-column-count:2; -webkit-column-rule:solid; font-size:12px; } h1 { -webkit-column-span: all; } ul { font-size: 75%; } } td,li { text-overflow: ellipsis; overflow: hidden; }</style>" + "</head>" + "<body topmargin='10'>" + " <div class='box'><div class='title'><img alt='BlackBerry Browser Logo' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAIAAAC0Ujn1AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wHCxEvB12VSWwAAAq1SURBVEgNAaoKVfUBFxkjAQIBAAAAAP8BAQEA//8AAAEAAAAAAQEB////AQAAAAAB/wH/AAABAP8A/wAAAQH/AAABAf8AAAD/AQEB/v7/AQIB////AAAA//8AAQH/AAAAAQEB//7/BPX19v//AAABAAEAAAAAAAAAAAAAAAECAv7+/wABAQEDAwAEBv4CBQACBQADBf8AAAEA/wD8+gUB/v779//7+wD//gICAf39/gEAAP8AAAEAAAECAf7+/gAAAAQBAQEAAP8AAQEBAAD/AQECAAH//wACAgIABQT+BQv+CQ79BhD/FRoGHxsGEQ8CAwP89fb66Or54uIB9e4C+vEB+PP++vgCAgEA//8BAQH///////8CAQL///4EAAAAAAAAAQAB/wEAAf8AAAIBAgME/QYKAA8V/RAdBzk6DEc9DyMb7wMFHwcD9v8A8f3+BP39/PDy/MbR/LO6AeXcA/PoAfbwAf77//7+AAAB/////wAABAQEAQ0PGv//AP8BAQH//wIEAwACBv4LEf0UHgQsOBVnW/cgGhH7AOv5/wP/ABUFAOX8AAQCAAIEAPoDAQQHAAr//vCoufmtrwLo2gLy6QD69wH//gAA//7+/gD//wMHCQ0AAAABAAEBAwIBAwcADhT+HiwXVV4gaV/n/g0l9/8M9v7u7fn78Pfx8PgB9Pn99f1Q+sIa+Ozn+BcB/gQBMiUKLy/55fD+8vAB+fgA/voBAAABAQH///8DBgcMAAABAAABAQMFAA0T/R0sGlllIkBBCPH+DfL4D/Xx//Du7+rm+u7qAPHs//HuAvX0xAdCP/WyGvvw5Pwm6vUOBhQQBi4t+ubu/+7sAvv3//v7AAD/AAAAAwcJDgAAAAEBAv8JDf8YJhRIXx8yPgvw9wjz7gbx6uLi4d/i5Pjs7ADx8ADy8wDy8/zx8+nsADkP1isAzD/6uQX8DcftJwMHDAQlK/nZ2QL07//59gH//QAAAAMHBwwBAAH/BQf/ERsDK0MnOlcD7OsF8en36+TK0tXu6Oj98PH/8/T/9PX/8/X+8/X+8PHf3/8TCQksF+kI/u02/bko99ut3jYDAhMGFyD4284C9/EA+vkA//8E/wABAQICAAkN/RQfIShM/eDiCP/s9PfoyNjYA//9Af/+/gD+/v4BCAUCFwz5Nh/1WivZPxnR+fjw+P0G//8C/wAAu8j7/P7j/Qz1CRAlBCdD/vHoA/r1//r4BAEAAP8CBP4LEQoaM/vo7uz35Oj46evu5gL9+f/9/vb7ABMOBzoj7kIk6Ecm3yIN4Pz/AervBeLsEAwJAB0U9dDeCq7JFwsa1/4JFfvr9QgRNvQSwAPz7AD6+QQAAAEAAwb+DhUJ/BHh0sgLBPL//fEJAvzv8fP9/gVYPf1aNdUtGusXCu73/AbB1Q+3ywbi7xP09wJ5V/AjBvuEpAv97OAHBA4DCfX5AfAHCxgCDyX+B9wA9vAE/wH/AAUHAAgT/ezsIw3+7+7u7e7p+vv8KiIOlGfiKhbbBgT/8PUFlrUUo7kA2+UC/v7/Dw38RTUDOCr9rsALzNsJBxEE/u7tAQb5BQT29u73BAoP/AkMAfEEBAEBAf0FB//9B+3m4fcD9hMPAg8D/XBcDG9M1/P1+OTrEKW3+aG19e3tAQEE/gICBP4BBBgYFwgMBe71AZWu8QUDDgX+BP728/74/AEE/QkEAPf+//8ICwIDAwT//wEABAUA/QAC/Pfx8u4oGgWjfA0zI+jN1wm4xgOpuvTa2/QABQQDCAgBAwkBAwkCAQbw9Ai/zgO+xPbo7QQIDg3++/z+AP//AgD//QIB/AcCBQj9BAj/AAEEAQEAAQECAQAA+Pb6TUAVj3AADwr0iaL6sb/w5+0DDg4VHiQY5On0AAIHAgMFAAAAAAAA9PX38/Hy/Pj3AgYSCQIH/v/9AQMDAAH//wD++/z6+foDAgICAAABBAAAAAD+/fj5+0pDF6B+Bejr8Fh029Tc9wcKERUZGA0OEv8AAxkc/+nr8OPl6gMDAgD/AAABAQEDCQUJGQADCfX3+gwKCf///v///gEB/v7+/f7//AL//AAA/wT////9+vokHwmZgR/e4+ZJXrv1+gUUFx4IChEBAwr6+wEAAf7+/v4GBQMA/wEAAAEAAQABAAAAAwb/AgYAAAD+/f7//wAAAAACAwH+AAADAwMBA/0B+vgA//0EAQAAAPv5eFEY6en7Q1qx8vcJCAsS+v0KCAED9/j5+/z9AQEBAAEA3uDnAgMCAAD/AAAA//8BAAEBAQAA/wD/AgIBAQEA/wEB/////f//+P/8BAgDAPHzAP7+BP///x4VCyQdGWqDsvT8EgULCv0A//T19wcGBQIDAf3+//7+/vr7/AABAQEAAQAAAAD//gEBAQAAAP8AAAAAAf3+/v7//wAAAAACAvn5/v8FAP8C9AL38wD//gQAAf8JBQPQ1+7hBBYDBQIBAPj/APv9/v75+/sC/AEEBP78/P3v8PMBAQEAAQAAAAD/AAEA/wAAAP8BAAAAAQEA/wH+/v8EBQL2+f39/QYBEwUA9t8B+fUA//8CAf8B4eHm6OnwCAT8ARwX//8DAQEC/fz++fn7/f3++fr79PX4/v4AAQEBAAD//wD/AQABAQH/AAEA/wEB////AAEB+fv+9ff7+/wBAAIGARL5Au7lAPz6AQAAAwYIDfz7++nq7SghH+wHB/3zAP34+AAB/wIB/wQEA/n5+/n6+/8B/wH/AP8AAQEAAf8BAAD/AQEBAQH//wABAQAAAf7/Av7/BAADCgEfEQTx2QLt5AD8+AD//wMHCA0CAwPt7e7u6+sYEg4AGBn47/j/+vn9/f0FBgP5+fv+/v8AAAEBAAAAAAEBAP8BAAABAQAAAAAAAAEAAAEAAgMBAQUAAgkBGRIDAecD59sB9/QA//0AAAADBwkNAQACAgIB/fv77erq+//9/hUa/vT7APv9AAD+AAAB///+AQEB/wAAAAEAAQAAAAAAAAEAAP8AAAACAAECAQIF/wEIARoVAwfuAubYAvbv//37AAAB/wD/AwYHDP//////Af///gIA/f/39QIE/gAeIP/3/v72+QECAAD/AAD//wAAAAABAAEBAAAAAAAAAQABAgABAwEBBv8CCAIhGgQE7APm2AL17QL9+wAAAAD/AAEA/wMGCA0AAQECAgABAQIB//8B/vv/+PQC+/QAGxgADBH++Pz//wAA/wEAAAAAAAEAAAEAAQIAAAMBBAgABQgAEhIEIxIC890D59oB9e0B/fv///8AAP8BAP8AAAABDA8ZAP8AAAEBAQECAAAAAQAA/wEB/wIGAAoN/hIa/xAa/vkEAPn9//n8AP//AAAAAAEBAAQDAQcEAQkAAvnvAO3iA/Pv//r2AgD+AQAB/f79AQAA////AAAAAQwPGf8AAAEAAAAAAQEBAQAAAP//AAAAAAEDA/8DBQAHCv4IDgALEP8GCgAAAgAAAf8A/gL9+QL59f/07wL49P/79wH+/gAA/wD/AAAAAAAA/////wAAAAAAAAEMDhj/AP8AAAEBAAEAAQAA/wAAAQAAAAAAAAAAAAAAAAH/AgIAAgMAAQMAAQICAwL+/f0A/v0B/v0A/v4BAQAAAP/+/v4BAQEAAAAAAAD//wD///4BAQEA/wCyKWs61Q32JAAAAABJRU5ErkJggg==' /> "+title+"</div></div><br>" + " <div class='main'>"; +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index 29de80020..6c09c64a2 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -321,6 +321,7 @@ void ChromeClientBlackBerry::closePagePopup(PagePopup*) PagePopupBlackBerry* webPopup = m_webPagePrivate->m_webPage->popup(); webPopup->closePopup(); + delete webPopup; } void ChromeClientBlackBerry::setToolbarsVisible(bool) diff --git a/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp new file mode 100644 index 000000000..d70dc4fbe --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DatePickerClient.h" + +#include "Chrome.h" +#include "ChromeClient.h" +#include "Document.h" +#include "DocumentWriter.h" +#include "HTMLInputElement.h" +#include "Page.h" +#include "PagePopup.h" +#include "PopupPicker.h" +#include "RenderObject.h" +#include "WebPage_p.h" +#include "WebString.h" + +#include <wtf/text/StringBuilder.h> + +namespace WebCore { + +DatePickerClient::DatePickerClient(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLInputElement* element) + : m_type(type) + , m_webPage(webPage) + , m_element(element) +{ + generateHTML(type, value, min, max, step); +} + +DatePickerClient::~DatePickerClient() +{ +} + +void DatePickerClient::generateHTML(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step) +{ + StringBuilder source; + source.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><style>\n"); + // Include CSS file. + source.append(popupControlBlackBerryCss, + sizeof(popupControlBlackBerryCss)); + source.append("</style>\n<style>"); + source.append(timeControlBlackBerryCss, + sizeof(timeControlBlackBerryCss)); + source.append("</style></head><body>\n"); + source.append("<script>\n"); + source.append("window.addEventListener('load', function () {"); + switch (type) { + case BlackBerry::Platform::InputTypeDate: + source.append("window.popupcontrol.show(\"Date\", "); + break; + case BlackBerry::Platform::InputTypeTime: + source.append("window.popupcontrol.show(\"Time\", "); + break; + case BlackBerry::Platform::InputTypeDateTime: + source.append("window.popupcontrol.show(\"DateTime\", "); + break; + case BlackBerry::Platform::InputTypeDateTimeLocal: + source.append("window.popupcontrol.show(\"DateTimeLocal\", "); + break; + case BlackBerry::Platform::InputTypeMonth: + case BlackBerry::Platform::InputTypeWeek: + default: + break; + } + if (!value.isEmpty()) + source.append("\"" + String(value.impl()) + "\", "); + else + source.append("0, "); + + if (!min.isEmpty()) + source.append(String(min.impl()) + ", "); + else + source.append("0, "); + if (!max.isEmpty()) + source.append(String(max.impl()) + ", "); + else + source.append("0, "); + source.append(String::number(step)); + source.append("); \n }); \n"); + source.append(timeControlBlackBerryJs, sizeof(timeControlBlackBerryJs)); + source.append("</script>\n"); + source.append("</body> </html>\n"); + m_source = source.toString(); +} + +void DatePickerClient::closePopup() +{ + ASSERT(m_webPage); + m_webPage->m_page->chrome()->client()->closePagePopup(0); +} + +IntSize DatePickerClient::contentSize() +{ + // Fixme: will generate content size dynamically + return IntSize(320, 256); +} + +String DatePickerClient::htmlSource() +{ + return m_source; +} + +void DatePickerClient::setValueAndClosePopup(int, const String& value) +{ + // Return -1 if user cancel the selection. + ASSERT(m_element); + + if (!value.contains("-1")) + m_element->setValue(value); + closePopup(); +} + +void DatePickerClient::didClosePopup() +{ + m_webPage = 0; + m_element = 0; +} + +void DatePickerClient::writeDocument(DocumentWriter& writer) +{ + writer.setMIMEType("text/html"); + writer.begin(KURL()); + writer.addData(m_source.utf8().data(), m_source.utf8().length()); + writer.end(); +} +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h new file mode 100644 index 000000000..bc6411bcb --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DatePickerClient_h +#define DatePickerClient_h + +#include "PagePopupClient.h" +#include <BlackBerryPlatformInputEvents.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +class WebString; +} +} + +namespace WebCore { +class DocumentWriter; +class HTMLInputElement; + +class DatePickerClient : public PagePopupClient { +public: + DatePickerClient(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step, BlackBerry::WebKit::WebPagePrivate*, HTMLInputElement*); + ~DatePickerClient(); + + void generateHTML(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step); + + void writeDocument(DocumentWriter&); + virtual IntSize contentSize(); + virtual String htmlSource(); + void setValueAndClosePopup(int, const String&); + void didClosePopup(); + void closePopup(); + +private: + BlackBerry::Platform::BlackBerryInputType m_type; + String m_source; + BlackBerry::WebKit::WebPagePrivate* m_webPage; + HTMLInputElement* m_element; +}; +} // namespace WebCore +#endif diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index f0d6c7564..9080272d7 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -24,7 +24,6 @@ #include "BackForwardListImpl.h" #include "BackingStoreClient.h" #include "BackingStore_p.h" -#include "Base64.h" #include "Chrome.h" #include "ChromeClientBlackBerry.h" #include "ClientExtension.h" @@ -825,6 +824,14 @@ void FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout() readyToRender(true); + // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call + // dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page + // will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of + // the web page can be incorrect. + FrameLoadType frameLoadType = m_frame->loader()->loadType(); + if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard)) + m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true); + if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) { m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first. m_webPagePrivate->m_backingStore->d->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. diff --git a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp index 00058ef60..f068f1fda 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp @@ -168,7 +168,8 @@ void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue) // Force repaint because we do not send mouse events to the select element // and the element doesn't automatically repaint itself. m_element->dispatchFormControlChangeEvent(); - m_element->renderer()->repaint(); + if (m_element->renderer()) + m_element->renderer()->repaint(); closePopup(); } diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index b3f5413bc..d9cb22d79 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -25,12 +25,14 @@ #include "CString.h" #include "Chrome.h" #include "DOMSupport.h" +#include "DatePickerClient.h" #include "Document.h" #include "DocumentLoader.h" #include "DocumentMarkerController.h" #include "FocusController.h" #include "Frame.h" #include "FrameView.h" +#include "HTMLFormElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HTMLOptGroupElement.h" @@ -211,6 +213,117 @@ static int inputStyle(BlackBerryInputType type, const Element* element) return DEFAULT_STYLE; } +static VirtualKeyboardType convertStringToKeyboardType(const AtomicString& string) +{ + DEFINE_STATIC_LOCAL(AtomicString, Default, ("default")); + DEFINE_STATIC_LOCAL(AtomicString, Url, ("url")); + DEFINE_STATIC_LOCAL(AtomicString, Email, ("email")); + DEFINE_STATIC_LOCAL(AtomicString, Password, ("password")); + DEFINE_STATIC_LOCAL(AtomicString, Web, ("web")); + DEFINE_STATIC_LOCAL(AtomicString, Number, ("number")); + DEFINE_STATIC_LOCAL(AtomicString, Symbol, ("symbol")); + DEFINE_STATIC_LOCAL(AtomicString, Phone, ("phone")); + DEFINE_STATIC_LOCAL(AtomicString, Pin, ("pin")); + DEFINE_STATIC_LOCAL(AtomicString, Hex, ("hexadecimal")); + + if (string.isEmpty()) + return VKBTypeNotSet; + if (equalIgnoringCase(string, Default)) + return VKBTypeDefault; + if (equalIgnoringCase(string, Url)) + return VKBTypeUrl; + if (equalIgnoringCase(string, Email)) + return VKBTypeEmail; + if (equalIgnoringCase(string, Password)) + return VKBTypePassword; + if (equalIgnoringCase(string, Web)) + return VKBTypeWeb; + if (equalIgnoringCase(string, Number)) + return VKBTypeNumPunc; + if (equalIgnoringCase(string, Symbol)) + return VKBTypeSymbol; + if (equalIgnoringCase(string, Phone)) + return VKBTypePhone; + if (equalIgnoringCase(string, Pin) || equalIgnoringCase(string, Hex)) + return VKBTypePin; + return VKBTypeNotSet; +} + +static VirtualKeyboardType keyboardTypeAttribute(const WebCore::Element* element) +{ + DEFINE_STATIC_LOCAL(QualifiedName, keyboardTypeAttr, (nullAtom, "data-blackberry-virtual-keyboard-type", nullAtom)); + + if (element->fastHasAttribute(keyboardTypeAttr)) { + AtomicString attributeString = element->fastGetAttribute(keyboardTypeAttr); + return convertStringToKeyboardType(attributeString); + } + + if (element->isFormControlElement()) { + const HTMLFormControlElement* formElement = static_cast<const HTMLFormControlElement*>(element); + if (formElement->form() && formElement->form()->fastHasAttribute(keyboardTypeAttr)) { + AtomicString attributeString = formElement->form()->fastGetAttribute(keyboardTypeAttr); + return convertStringToKeyboardType(attributeString); + } + } + + return VKBTypeNotSet; +} + +static VirtualKeyboardEnterKeyType convertStringToKeyboardEnterKeyType(const AtomicString& string) +{ + DEFINE_STATIC_LOCAL(AtomicString, Default, ("default")); + DEFINE_STATIC_LOCAL(AtomicString, Connect, ("connect")); + DEFINE_STATIC_LOCAL(AtomicString, Done, ("done")); + DEFINE_STATIC_LOCAL(AtomicString, Go, ("go")); + DEFINE_STATIC_LOCAL(AtomicString, Join, ("join")); + DEFINE_STATIC_LOCAL(AtomicString, Next, ("next")); + DEFINE_STATIC_LOCAL(AtomicString, Search, ("search")); + DEFINE_STATIC_LOCAL(AtomicString, Send, ("send")); + DEFINE_STATIC_LOCAL(AtomicString, Submit, ("submit")); + + if (string.isEmpty()) + return VKBEnterKeyNotSet; + if (equalIgnoringCase(string, Default)) + return VKBEnterKeyDefault; + if (equalIgnoringCase(string, Connect)) + return VKBEnterKeyConnect; + if (equalIgnoringCase(string, Done)) + return VKBEnterKeyDone; + if (equalIgnoringCase(string, Go)) + return VKBEnterKeyGo; + if (equalIgnoringCase(string, Join)) + return VKBEnterKeyJoin; + if (equalIgnoringCase(string, Next)) + return VKBEnterKeyNext; + if (equalIgnoringCase(string, Search)) + return VKBEnterKeySearch; + if (equalIgnoringCase(string, Send)) + return VKBEnterKeySend; + if (equalIgnoringCase(string, Submit)) + return VKBEnterKeySubmit; + return VKBEnterKeyNotSet; +} + +static VirtualKeyboardEnterKeyType keyboardEnterKeyTypeAttribute(const WebCore::Element* element) +{ + DEFINE_STATIC_LOCAL(QualifiedName, keyboardEnterKeyTypeAttr, (nullAtom, "data-blackberry-virtual-keyboard-enter-key", nullAtom)); + + if (element->fastHasAttribute(keyboardEnterKeyTypeAttr)) { + AtomicString attributeString = element->fastGetAttribute(keyboardEnterKeyTypeAttr); + return convertStringToKeyboardEnterKeyType(attributeString); + } + + if (element->isFormControlElement()) { + const HTMLFormControlElement* formElement = static_cast<const HTMLFormControlElement*>(element); + if (formElement->form() && formElement->form()->fastHasAttribute(keyboardEnterKeyTypeAttr)) { + AtomicString attributeString = formElement->form()->fastGetAttribute(keyboardEnterKeyTypeAttr); + return convertStringToKeyboardEnterKeyType(attributeString); + } + } + + return VKBEnterKeyNotSet; +} + WTF::String InputHandler::elementText() { if (!isActiveTextEdit()) @@ -478,8 +591,11 @@ void InputHandler::setElementFocused(Element* element) BlackBerryInputType type = elementType(element); m_currentFocusElementTextEditMask = inputStyle(type, element); - FocusLog(LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d", type, m_currentFocusElementTextEditMask); - m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask); + VirtualKeyboardType keyboardType = keyboardTypeAttribute(element); + VirtualKeyboardEnterKeyType enterKeyType = keyboardEnterKeyTypeAttribute(element); + + FocusLog(LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d, Keyboard Type=%d, Enter Key=%d", type, m_currentFocusElementTextEditMask, keyboardType, enterKeyType); + m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask, keyboardType, enterKeyType); handleInputLocaleChanged(m_webPage->m_webSettings->isWritingDirectionRTL()); @@ -495,15 +611,28 @@ bool InputHandler::openDatePopup(HTMLInputElement* element, BlackBerryInputType if (isActiveTextEdit()) clearCurrentFocusElement(); - m_currentFocusElement = element; - m_currentFocusElementType = TextPopup; + switch (type) { + case BlackBerry::Platform::InputTypeDate: + case BlackBerry::Platform::InputTypeTime: + case BlackBerry::Platform::InputTypeDateTime: + case BlackBerry::Platform::InputTypeDateTimeLocal: { + // Check if popup already exists, close it if does. + m_webPage->m_page->chrome()->client()->closePagePopup(0); + String value = element->value(); + String min = element->getAttribute(HTMLNames::minAttr).string(); + String max = element->getAttribute(HTMLNames::maxAttr).string(); + double step = element->getAttribute(HTMLNames::stepAttr).toDouble(); + + DatePickerClient* client = new DatePickerClient(type, value, min, max, step, m_webPage, element); + // Fail to create HTML popup, use the old path + if (!m_webPage->m_page->chrome()->client()->openPagePopup(client, WebCore::IntRect())) + m_webPage->m_client->openDateTimePopup(type, value, min, max, step); - WTF::String value = element->value(); - WTF::String min = element->getAttribute(HTMLNames::minAttr).string(); - WTF::String max = element->getAttribute(HTMLNames::maxAttr).string(); - double step = element->getAttribute(HTMLNames::stepAttr).toDouble(); - m_webPage->m_client->openDateTimePopup(type, value, min, max, step); - return true; + return true; + } + default: // Other types not supported + return false; + } } bool InputHandler::openColorPopup(HTMLInputElement* element) diff --git a/Source/WebKit/chromium/All.gyp b/Source/WebKit/chromium/All.gyp index d28bce8cf..739a0c8ec 100644 --- a/Source/WebKit/chromium/All.gyp +++ b/Source/WebKit/chromium/All.gyp @@ -47,7 +47,9 @@ 'conditions': [ ['OS=="android"', { 'dependencies': [ + 'WebKitUnitTests.gyp:webkit_unit_tests_apk', '../../../Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:DumpRenderTree_apk', + '../../../Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:TestWebKitAPI_apk', ], }], ], diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index cd904d3c1..ca0049168 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,546 @@ +2012-07-13 Eric Penner <epenner@google.com> + + [chromium] Add 'self-managed' option to CCPrioritizedTexture to enable render-surface and canvas use cases. + https://bugs.webkit.org/show_bug.cgi?id=91177 + + Reviewed by Adrienne Walker. + + * tests/CCPrioritizedTextureTest.cpp: + (WTF::TEST_F): + * tests/TiledLayerChromiumTest.cpp: + +2012-07-13 Brian Anderson <brianderson@chromium.org> + + Add flushes to CCTextureUpdater::update + https://bugs.webkit.org/show_bug.cgi?id=89035 + + Reviewed by Adrienne Walker. + + CCTextureUpdaterTest added to verify texture upload/flushing patterns. + + * WebKit.gypi: + * tests/CCTextureUpdaterTest.cpp: Added. + +2012-07-13 David Grogan <dgrogan@chromium.org> + + IndexedDB: Re-enable indexeddb in test_shell + https://bugs.webkit.org/show_bug.cgi?id=91161 + + Reviewed by Tony Chang. + + IDB used to be allowed to run if webView->permissionClient() was NULL, + as is the case in test_shell. This was inadvertently changed in + http://wkb.ug/90310. + + We still don't have an automated test for this (http://crbug.com/113738) + Tested manually: + + * In test_shell: + 1) Open an IDB page + 2) Verify IDB has permission to open a DB + + * In chrome: + 1) Open an IDB page + 2) Verify IDB has permission to open a DB + 3) Revoke IDB permissions in chrome://chrome/settings/content + 4) Reload the IDB page + 5) Verify IDB doesn't have permission to open a DB + + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::allowIndexedDB): + +2012-07-13 Wei James <james.wei@intel.com> + + enable TestWebKitAPI/webkit_unit_tests apk on x86 android platform by adding abi support + https://bugs.webkit.org/show_bug.cgi?id=91194 + + Reviewed by Adam Barth. + + * WebKitUnitTests.gyp: + +2012-07-13 Dana Jansens <danakj@chromium.org> + + webkit_unit_test CCLayerTreeHostImplTest.testRemoveRenderPasses started failing. + https://bugs.webkit.org/show_bug.cgi?id=91245 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed gardening: skip failing webkit unit test. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed gardening, skip failing webkit_unit_tests. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Make calendar pickers testable + https://bugs.webkit.org/show_bug.cgi?id=84827 + + Reviewed by Hajime Morita. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::ChromeClientImpl): + Initialize m_pagePopupDriver with the WebViewImpl. + (WebKit::ChromeClientImpl::openPagePopup): + Just calls PagePoupDriver::openPagePopup(). + (WebKit::ChromeClientImpl::closePagePopup): + Just calls PagePoupDriver::closePagePopup(). + (WebKit::ChromeClientImpl::setPagePopupDriver): + * src/ChromeClientImpl.h: + (ChromeClientImpl): Add setPagePopupDriver + * src/WebViewImpl.h: + (WebViewImpl): + WebViewImpl implements PagePopupDriver. openPagePopup() and + closePagePopup() override members of PagePopupDriver. + +2012-07-13 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for input type "number" when step mismatched + https://bugs.webkit.org/show_bug.cgi?id=91197 + + Reviewed by Kent Tamura. + + This patch adds test cases for Decimal::ceiling() and floor() of + positive/negative small fractional numbers. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-07-12 Adrienne Walker <enne@google.com> + + [chromium] Root invalidations for RTL pages need to be in the right space + https://bugs.webkit.org/show_bug.cgi?id=91155 + + Reviewed by Kenneth Russell. + + The root layer has a translation on it when placed in the tree, so any + invalidations on this layer likewise need to be adjusted. + + This adjustment is due to the fact that compositor layers all have the + origin in the upper left corner of the layer, but this is not always + the origin for graphics layers. Rather than making compositor layers + have to deal with a potential offset, we change the transform when + inserting the layer into the tree. Invalidations need to be similarly + transformed from document space into compositor layer space. + + The need for this offset is due to the definition of the initial + containing block. RTL pages (pages with dir=RTL on the body) start + scrolled all the way to the right, and the origin is in the upper left + hand corner of this initial viewport. Thus on RTL pages with + horizontal overflow, the left of the document is in negative CSS + space. + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::invalidateRect): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] Remove the RenderPass pointer from RenderPassDrawQuad + https://bugs.webkit.org/show_bug.cgi?id=91023 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-12 Adam Barth <abarth@webkit.org> + + [Chromium] WebSettings should be sorted + https://bugs.webkit.org/show_bug.cgi?id=91157 + + Reviewed by Eric Seidel. + + This might be my OCD, but IMHO this file would be cleaner if we listed + the settings in alphabetic order. + + * public/WebSettings.h: + * src/WebSettingsImpl.h: + (WebSettingsImpl): + (WebKit::WebSettingsImpl::forceSoftwareCompositing): + (WebKit::WebSettingsImpl::viewportEnabled): + (WebKit::WebSettingsImpl::maxUntiledLayerSize): + +2012-07-12 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Enable IDBFactory.deleteDatabase() and webkitGetDatabaseNames() in Workers + https://bugs.webkit.org/show_bug.cgi?id=90310 + + Reviewed by Tony Chang. + + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::allowIndexedDB): Consolidates user-prompting logic. + (WebKit::getWebFrame): Helper to dig out frame from Document, or null for Worker. + (WebKit::IDBFactoryBackendProxy::getDatabaseNames): + (WebKit): + (WebKit::IDBFactoryBackendProxy::open): + (WebKit::IDBFactoryBackendProxy::deleteDatabase): + * src/IDBFactoryBackendProxy.h: Update method signatures to match interface. + (WebCore): + (IDBFactoryBackendProxy): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] The root layer should not try create a second RenderSurface for itself + https://bugs.webkit.org/show_bug.cgi?id=91124 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-12 Eric Penner <epenner@google.com> + + [chromium] Use CCTexture/TextureAllocator and remove TextureManager + https://bugs.webkit.org/show_bug.cgi?id=91001 + + Reviewed by Adrienne Walker. + + Deleting old texture manager tests. + + * WebKit.gypi: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCPrioritizedTextureTest.cpp: + (WTF::CCPrioritizedTextureTest::texturesMemorySize): + * tests/CCThreadedTest.cpp: + * tests/CCTiledLayerTestCommon.h: + * tests/Canvas2DLayerBridgeTest.cpp: + * tests/TextureManagerTest.cpp: Removed. + +2012-07-12 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] r122400 broke 10.6 build + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Reviewed by Tony Chang. + + Use the right availability macros for forward-declaring methods and + defining constants. + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + In r117327, we added a parameter for modifier keys to these methods. + Chromium has since switched to using the methods that require the + extra parameter so we can remove these methods. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit::WebViewImpl::dragTargetDragOver): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-12 Tony Chang <tony@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-12 Adam Barth <abarth@webkit.org> + + [Chromium] Delete last mention of Hixie76 in WebKit/chromium + https://bugs.webkit.org/show_bug.cgi?id=91099 + + Reviewed by Tony Chang. + + This deprecated API is no longer used anywhere. + + * public/WebSettings.h: + (WebKit::WebSettings::setDefaultDeviceScaleFactor): + +2012-07-12 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r122477. + http://trac.webkit.org/changeset/122477 + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Broke Chromium Mac build + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] r122400 broke 10.6 build + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Reviewed by Tony Chang. + + Use the right availability macros for forward-declaring methods and + defining constants. + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Peter Beverloo <peter@chromium.org> + + [Chromium] Enable building APKs for TestWebKitAPI and webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=90989 + + Reviewed by Adam Barth. + + Add dependencies on the webkit_unit_tests_apk and TestWebKitAPI_apk + targets for Android, making sure that we're generating the packages. + + * All.gyp: + +2012-07-12 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Remove unrequired API in WebSurroundingText. + https://bugs.webkit.org/show_bug.cgi?id=91067 + + Reviewed by Adam Barth. + + Remove the unused first initialize method from WebSurroundingText. + Now both Chromium and LayoutTestController use the second method. + + * public/WebSurroundingText.h: + (WebSurroundingText): + * src/WebSurroundingText.cpp: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * src/mac/WebInputEventFactory.mm: + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122358. + http://trac.webkit.org/changeset/122358 + https://bugs.webkit.org/show_bug.cgi?id=91037 + + Build break on WebKit Win (Requested by hayato on #webkit). + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit): + (WebKit::WebViewImpl::dragTargetDragOver): + (WebKit::WebViewImpl::dragTargetDrop): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-11 Alexandre Elias <aelias@google.com> + + [chromium] Move compositor quads to Platform/chromium/public + https://bugs.webkit.org/show_bug.cgi?id=90582 + + Reviewed by Adrienne Walker. + + This moves CCSharedQuadState, CCDrawQuad, and all but two CC*DrawQuad + classes to the WebKit namespace, as a first step to pushing them + across the process boundary for the ubercompositor. + + - The intent is to serialize the class hierarchy using the same + mechanism as WebInputEvent. In order to do this, there are three + requirements: pure POD data, a method returning size, and a packing + pragma. + + - Private data members are fine with this kind of serializer, and a + default constructor is not needed. Because of that, we can maintain + the same encapsulation and convenient APIs (behind + WEBKIT_IMPLEMENTATION) as the original classes. To ease the + transition, the original WebCore headers still exist and typedef to + the new classes. + + - However, SharedQuadState will be serialized using the normal + IPC_STRUCT_TRAITS macro, so I made its members public. A custom + serializer (on quad lists) will maintain the pointers from quads to + SharedQuadStates. + + - I converted the Material casting mechanism to materialCast() methods + living in the derived classes. That way, the WebCompositorQuad header + doesn't need to know about all its derived classes. + + - Quad classes not yet transitioned can still be used in + non-ubercompositor mode. CCRenderPassDrawQuad and CCYUVVideoDrawQuad + are currently non-POD and I left them in their original files. + + This approach is the best I've found so far, since it preserves all + WebCore-facing APIs and avoids unnecessary code duplication (new quad + types or members can be added by modifying only one place). There + also should not be an unreasonable amount of custom serializer code + required. + + * tests/CCLayerTestCommon.cpp: + (CCLayerTestCommon::verifyQuadsExactlyCoverRect): + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Rename layerRect to contentRect for rects that live in content space + https://bugs.webkit.org/show_bug.cgi?id=90843 + + Reviewed by Adrienne Walker. + + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest): + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::createLayer): + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + (CCLayerTestCommon::coverageVisibleRectIntersectsTiles): + (CCLayerTestCommon::coverageVisibleRectIntersectsBounds): + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::prepareToUpdate): + (WebKitTests::FakeTiledLayerChromium::update): + * tests/CCTiledLayerTestCommon.h: + (FakeTiledLayerChromium): + * tests/LayerChromiumTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Minimum size used for occlusion tracking should be a setting on CCLayerTreeHost + https://bugs.webkit.org/show_bug.cgi?id=90993 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-11 Adam Barth <abarth@webkit.org> + + [Chromium] Enable LEGACY_VIEWPORT_ADAPTION + https://bugs.webkit.org/show_bug.cgi?id=90991 + + Reviewed by Tony Chang. + + Chromium wishes to support LEGACY_VIEWPORT_ADAPTION. I actually thought + this was enabled before, but the enable bit got lost in the shuffle. + + * features.gypi: + +2012-07-11 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + In r117327, we added a parameter for modifier keys to these methods. + Chromium has since switched to using the methods that require the + extra parameter so we can remove these methods. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit::WebViewImpl::dragTargetDragOver): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-11 Shawn Singh <shawnsingh@chromium.org> + + Unreviewed build fix, forgot to add URLTestHelpers.* when landing r122344 + + * tests/URLTestHelpers.cpp: Added. + (URLTestHelpers): + (WebKit::URLTestHelpers::registerMockedURLFromBaseURL): + (WebKit::URLTestHelpers::registerMockedURLLoad): + * tests/URLTestHelpers.h: Added. + (WebKit): + (URLTestHelpers): + (WebKit::URLTestHelpers::toKURL): + +2012-07-11 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Use WEBKIT_IMPLEMENTATION == 1 for webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=90094 + + Reviewed by Adrienne Walker. + + This patch adds the WEBKIT_IMPLEMENTATION = 1 define to + WebKitUnitTests.gyp. To get it to compile correctly, some string + and URL code was refactored and fixed, in particular GURL usage is + replaced with KURL usage. + + * WebKit.gyp: + added WEBKIT_IMPLEMENTATION == 1 for unit test code when in shared library + added URLTestHelpers to exclusion in shared library build, because it depends on webkit_support + + * WebKit.gypi: + added URLTestHelpers.h and .cpp to the build process + + * WebKitUnitTests.gyp: + added WEBKIT_IMPLEMENTATION == 1 for unit test code when not in shared library. + note that in shared library build, RunAllTests.cpp does not have WEBKIT_IMPLEMENTATION == 1. + + * public/WebDOMMessageEvent.h: + (WebKit::WebDOMMessageEvent::WebDOMMessageEvent): + * tests/AssociatedURLLoaderTest.cpp: + * tests/EventListenerTest.cpp: + * tests/FrameTestHelpers.cpp: + (WebKit::FrameTestHelpers::loadFrame): + * tests/FrameTestHelpers.h: + * tests/ListenerLeakTest.cpp: + (WebKit::ListenerLeakTest::RunTest): + * tests/PopupMenuTest.cpp: + * tests/RunAllTests.cpp: + * tests/URLTestHelpers.cpp: Added. + (URLTestHelpers): + (WebKit::URLTestHelpers::registerMockedURLFromBaseURL): + (WebKit::URLTestHelpers::registerMockedURLLoad): + * tests/URLTestHelpers.h: Copied from Source/WebKit/chromium/public/WebDOMMessageEvent.h. + (WebKit): + (URLTestHelpers): + (WebKit::URLTestHelpers::toKURL): + * tests/WebFrameTest.cpp: + * tests/WebPageNewSerializerTest.cpp: + * tests/WebPageSerializerTest.cpp: + * tests/WebViewTest.cpp: + +2012-07-10 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: migrate from background images to CSS for statusbar rendering. + https://bugs.webkit.org/show_bug.cgi?id=90902 + + Reviewed by Vsevolod Vlasov. + + * WebKit.gypi: + * src/js/Images/statusbarBackgroundChromium.png: Removed. + * src/js/Images/statusbarBottomBackgroundChromium.png: Removed. + * src/js/Images/statusbarButtonsChromium.png: Removed. + * src/js/Images/statusbarMenuButtonChromium.png: Removed. + * src/js/Images/statusbarMenuButtonSelectedChromium.png: Removed. + * src/js/devTools.css: + (.status-bar-background): + 2012-07-11 Kenichi Ishibashi <bashi@chromium.org> [Chromium] Adding HarfBuzz-ng for Linux diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 67aef6ffa..b33ddc339 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': '145569' + 'chromium_rev': '146381' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 6fce44075..f6868201c 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -688,6 +688,7 @@ ['component=="shared_library"', { 'defines': [ 'WEBKIT_DLL', + 'WEBKIT_IMPLEMENTATION=1', ], 'dependencies': [ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore_bindings', @@ -739,6 +740,7 @@ 'tests/PopupMenuTest.cpp', 'tests/RenderTableCellTest.cpp', 'tests/RenderTableRowTest.cpp', + 'tests/URLTestHelpers.cpp', 'tests/WebFrameTest.cpp', 'tests/WebPageNewSerializerTest.cpp', 'tests/WebPageSerializerTest.cpp', diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 1a5babfd0..59c00795e 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -50,11 +50,6 @@ 'src/js/Images/segmentHoverEndChromium.png', 'src/js/Images/segmentSelectedChromium.png', 'src/js/Images/segmentSelectedEndChromium.png', - 'src/js/Images/statusbarBackgroundChromium.png', - 'src/js/Images/statusbarBottomBackgroundChromium.png', - 'src/js/Images/statusbarButtonsChromium.png', - 'src/js/Images/statusbarMenuButtonChromium.png', - 'src/js/Images/statusbarMenuButtonSelectedChromium.png', ], 'webkit_unittest_files': [ 'tests/ArenaTestHelpers.h', @@ -89,6 +84,7 @@ 'tests/CCScopedTextureTest.cpp', 'tests/CCSolidColorLayerImplTest.cpp', 'tests/CCTestCommon.h', + 'tests/CCTextureUpdaterTest.cpp', 'tests/CCTiledLayerImplTest.cpp', 'tests/CCTiledLayerTestCommon.h', 'tests/CCTiledLayerTestCommon.cpp', @@ -143,13 +139,14 @@ 'tests/ScrollbarLayerChromiumTest.cpp', 'tests/TextureCopierTest.cpp', 'tests/TextureLayerChromiumTest.cpp', - 'tests/TextureManagerTest.cpp', 'tests/ThrottledTextureUploaderTest.cpp', 'tests/TiledLayerChromiumTest.cpp', 'tests/TilingDataTest.cpp', 'tests/TreeSynchronizerTest.cpp', 'tests/TreeTestHelpers.cpp', 'tests/TreeTestHelpers.h', + 'tests/URLTestHelpers.cpp', + 'tests/URLTestHelpers.h', 'tests/WebAnimationTest.cpp', 'tests/WebCompositorInputHandlerImplTest.cpp', 'tests/WebFloatAnimationCurveTest.cpp', diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index bf68f4f49..051c13524 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -87,6 +87,9 @@ 'dependencies': [ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', ], + 'defines': [ + 'WEBKIT_IMPLEMENTATION=1', + ], 'sources': [ '<@(webkit_unittest_files)', ], @@ -170,7 +173,9 @@ '<(PRODUCT_DIR)/webkit_unit_tests_apk', '--ant-args', '-DPRODUCT_DIR=<(ant_build_out)', - '--ant-compile' + '--ant-compile', + '--app_abi', + '<(android_app_abi)', ], }], }], diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 7c02a0127..35f86cf24 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -69,6 +69,7 @@ 'ENABLE_INPUT_TYPE_DATE=1', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0', + 'ENABLE_LEGACY_VIEWPORT_ADAPTION=1', 'ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1', 'ENABLE_LINK_PREFETCH=1', 'ENABLE_LINK_PRERENDER=1', diff --git a/Source/WebKit/chromium/public/WebDOMMessageEvent.h b/Source/WebKit/chromium/public/WebDOMMessageEvent.h index 355b73715..6619af246 100644 --- a/Source/WebKit/chromium/public/WebDOMMessageEvent.h +++ b/Source/WebKit/chromium/public/WebDOMMessageEvent.h @@ -46,6 +46,7 @@ class WebString; class WebDOMMessageEvent : public WebDOMEvent { public: + WebDOMMessageEvent() { } WEBKIT_EXPORT void initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId); WEBKIT_EXPORT WebSerializedScriptValue data() const; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index 56b49ffbb..88ed9639d 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -53,114 +53,112 @@ public: EditingBehaviorUnix }; - virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual bool forceSoftwareCompositing() const = 0; + virtual bool scrollAnimatorEnabled() const = 0; + virtual bool viewportEnabled() const = 0; + virtual void setAccelerated2dCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingEnabled(bool) = 0; + virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; + virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; + virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0; + virtual void setAcceleratedFiltersEnabled(bool) = 0; + virtual void setAcceleratedPaintingEnabled(bool) = 0; + virtual void setAllowDisplayOfInsecureContent(bool) = 0; + virtual void setAllowFileAccessFromFileURLs(bool) = 0; + virtual void setAllowRunningOfInsecureContent(bool) = 0; + virtual void setAllowScriptsToCloseWindows(bool) = 0; + virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; + virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; + virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; + virtual void setAuthorAndUserStylesEnabled(bool) = 0; + virtual void setCaretBrowsingEnabled(bool) = 0; + virtual void setCookieEnabled(bool) = 0; virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setDefaultFontSize(int) = 0; + virtual void setDNSPrefetchingEnabled(bool) = 0; + virtual void setDOMPasteAllowed(bool) = 0; virtual void setDefaultFixedFontSize(int) = 0; - virtual void setMinimumFontSize(int) = 0; - virtual void setMinimumLogicalFontSize(int) = 0; - virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; - virtual void setTextAutosizingEnabled(bool) = 0; + virtual void setDefaultFontSize(int) = 0; virtual void setDefaultTextEncodingName(const WebString&) = 0; - virtual void setDeviceSupportsTouch(bool) = 0; + virtual void setDefaultTileSize(WebSize) = 0; + virtual void setDeferred2dCanvasEnabled(bool) = 0; + virtual void setDeveloperExtrasEnabled(bool) = 0; virtual void setDeviceSupportsMouse(bool) = 0; - virtual void setJavaScriptEnabled(bool) = 0; - virtual void setWebSecurityEnabled(bool) = 0; - virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; - virtual void setLoadsImagesAutomatically(bool) = 0; + virtual void setDeviceSupportsTouch(bool) = 0; + virtual void setDownloadableBinaryFontsEnabled(bool) = 0; + virtual void setEditableLinkBehaviorNeverLive() = 0; + virtual void setEditingBehavior(EditingBehavior) = 0; + virtual void setEnableScrollAnimator(bool) = 0; + virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; + virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; + virtual void setExperimentalCSSRegionsEnabled(bool) = 0; + virtual void setExperimentalCSSVariablesEnabled(bool) = 0; + virtual void setExperimentalWebGLEnabled(bool) = 0; + virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFixedElementsLayoutRelativeToFrame(bool) = 0; + virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFixedPositionCreatesStackingContext(bool) = 0; + virtual void setFontRenderingModeNormal() = 0; + virtual void setForceCompositingMode(bool) = 0; + virtual void setForceSoftwareCompositing(bool) = 0; + virtual void setFrameFlatteningEnabled(bool) = 0; + virtual void setFullScreenEnabled(bool) = 0; + virtual void setHyperlinkAuditingEnabled(bool) = 0; virtual void setImagesEnabled(bool) = 0; - virtual void setPluginsEnabled(bool) = 0; - virtual void setDOMPasteAllowed(bool) = 0; - virtual void setDeveloperExtrasEnabled(bool) = 0; - virtual void setNeedsSiteSpecificQuirks(bool) = 0; - virtual void setShrinksStandaloneImagesToFit(bool) = 0; - virtual void setUsesEncodingDetector(bool) = 0; - virtual void setTextAreasAreResizable(bool) = 0; + virtual void setInteractiveFormValidationEnabled(bool) = 0; virtual void setJavaEnabled(bool) = 0; - virtual void setAllowScriptsToCloseWindows(bool) = 0; - virtual void setUserStyleSheetLocation(const WebURL&) = 0; - virtual void setAuthorAndUserStylesEnabled(bool) = 0; - virtual void setUsesPageCache(bool) = 0; - virtual void setPageCacheSupportsPlugins(bool) = 0; - virtual void setDownloadableBinaryFontsEnabled(bool) = 0; virtual void setJavaScriptCanAccessClipboard(bool) = 0; - virtual void setXSSAuditorEnabled(bool) = 0; - virtual void setDNSPrefetchingEnabled(bool) = 0; - virtual void setFixedElementsLayoutRelativeToFrame(bool) = 0; + virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; + virtual void setJavaScriptEnabled(bool) = 0; + virtual void setLayoutFallbackWidth(int) = 0; + virtual void setLoadsImagesAutomatically(bool) = 0; virtual void setLocalStorageEnabled(bool) = 0; - virtual void setEditableLinkBehaviorNeverLive() = 0; - virtual void setFrameFlatteningEnabled(bool) = 0; - virtual void setFontRenderingModeNormal() = 0; - virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; - virtual void setAllowFileAccessFromFileURLs(bool) = 0; - virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; + virtual void setMaxUntiledLayerSize(WebSize) = 0; + virtual void setMediaPlaybackRequiresUserGesture(bool) = 0; + virtual void setMemoryInfoEnabled(bool) = 0; + virtual void setMinimumAccelerated2dCanvasSize(int) = 0; + virtual void setMinimumFontSize(int) = 0; + virtual void setMinimumLogicalFontSize(int) = 0; + virtual void setMinimumTimerInterval(double) = 0; + virtual void setMockScrollbarsEnabled(bool) = 0; + virtual void setNeedsSiteSpecificQuirks(bool) = 0; virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; - virtual void setWebAudioEnabled(bool) = 0; - virtual void setExperimentalWebGLEnabled(bool) = 0; - virtual void setExperimentalCSSRegionsEnabled(bool) = 0; - virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; - virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; - virtual void setExperimentalCSSVariablesEnabled(bool) = 0; virtual void setOpenGLMultisamplingEnabled(bool) = 0; + virtual void setPageCacheSupportsPlugins(bool) = 0; + virtual void setPasswordEchoDurationInSeconds(double) = 0; + virtual void setPasswordEchoEnabled(bool) = 0; + virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setPluginsEnabled(bool) = 0; virtual void setPrivilegedWebGLExtensionsEnabled(bool) = 0; - virtual void setWebGLErrorsToConsoleEnabled(bool) = 0; + virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setShouldPrintBackgrounds(bool) = 0; virtual void setShowDebugBorders(bool) = 0; virtual void setShowFPSCounter(bool) = 0; - virtual void setShowPlatformLayerTree(bool) = 0; virtual void setShowPaintRects(bool) = 0; - virtual void setEditingBehavior(EditingBehavior) = 0; - virtual void setAcceleratedCompositingEnabled(bool) = 0; - virtual void setForceCompositingMode(bool) = 0; - virtual void setForceSoftwareCompositing(bool) = 0; - virtual void setMockScrollbarsEnabled(bool) = 0; - virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0; - virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0; - virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0; - virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; - virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; - virtual void setAccelerated2dCanvasEnabled(bool) = 0; - virtual void setDeferred2dCanvasEnabled(bool) = 0; - virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; - virtual void setMinimumAccelerated2dCanvasSize(int) = 0; - virtual void setAcceleratedFiltersEnabled(bool) = 0; - virtual void setMemoryInfoEnabled(bool) = 0; - virtual void setHyperlinkAuditingEnabled(bool) = 0; - virtual void setLayoutFallbackWidth(int) = 0; - virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; + virtual void setShowPlatformLayerTree(bool) = 0; + virtual void setShrinksStandaloneImagesToFit(bool) = 0; + virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSyncXHRInDocumentsEnabled(bool) = 0; + virtual void setTextAreasAreResizable(bool) = 0; + virtual void setTextAutosizingEnabled(bool) = 0; + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; virtual void setUnifiedTextCheckerEnabled(bool) = 0; - virtual void setCaretBrowsingEnabled(bool) = 0; - virtual void setInteractiveFormValidationEnabled(bool) = 0; + virtual void setUserStyleSheetLocation(const WebURL&) = 0; + virtual void setUsesEncodingDetector(bool) = 0; + virtual void setUsesPageCache(bool) = 0; virtual void setValidationMessageTimerMagnification(int) = 0; - virtual void setMinimumTimerInterval(double) = 0; - virtual void setFullScreenEnabled(bool) = 0; - virtual void setAllowDisplayOfInsecureContent(bool) = 0; - virtual void setAllowRunningOfInsecureContent(bool) = 0; - virtual void setPasswordEchoEnabled(bool) = 0; - virtual void setPasswordEchoDurationInSeconds(double) = 0; - virtual void setShouldPrintBackgrounds(bool) = 0; - virtual void setEnableScrollAnimator(bool) = 0; - virtual bool scrollAnimatorEnabled() const = 0; - virtual void setVisualWordMovementEnabled(bool) = 0; - virtual void setAcceleratedPaintingEnabled(bool) = 0; virtual void setViewportEnabled(bool) = 0; - virtual void setMediaPlaybackRequiresUserGesture(bool) = 0; - virtual bool viewportEnabled() const = 0; - virtual void setDefaultTileSize(WebSize) = 0; - virtual void setMaxUntiledLayerSize(WebSize) = 0; - virtual void setFixedPositionCreatesStackingContext(bool) = 0; - virtual void setSyncXHRInDocumentsEnabled(bool) = 0; - virtual void setCookieEnabled(bool) = 0; - - virtual bool forceSoftwareCompositing() const = 0; + virtual void setVisualWordMovementEnabled(bool) = 0; + virtual void setWebAudioEnabled(bool) = 0; + virtual void setWebGLErrorsToConsoleEnabled(bool) = 0; + virtual void setWebSecurityEnabled(bool) = 0; + virtual void setXSSAuditorEnabled(bool) = 0; // DEPRECATED virtual void setDefaultDeviceScaleFactor(int) { } - virtual void setHixie76WebSocketProtocolEnabled(bool) { } protected: ~WebSettings() { } diff --git a/Source/WebKit/chromium/public/WebSurroundingText.h b/Source/WebKit/chromium/public/WebSurroundingText.h index 716fe4f0c..fa8c52ff0 100644 --- a/Source/WebKit/chromium/public/WebSurroundingText.h +++ b/Source/WebKit/chromium/public/WebSurroundingText.h @@ -48,10 +48,6 @@ public: WEBKIT_EXPORT bool isNull() const; WEBKIT_EXPORT void reset(); - // Initializes the object go get the surrounding text centered in the position described by the hit test. - // The maximum length of the contents retrieved is defined by maxLength. - WEBKIT_EXPORT void initialize(const WebHitTestResult&, size_t maxLength); - // Initializes the object to get the surrounding text centered in the position relative to a provided node. // The maximum length of the contents retrieved is defined by maxLength. WEBKIT_EXPORT void initialize(const WebNode&, const WebPoint&, size_t maxLength); diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index 96642f666..3ba5da24f 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -317,28 +317,16 @@ public: // Callback methods when a drag-and-drop operation is trying to drop // something on the WebView. - // FIXME: Remove this method after chromium changes catch up. - virtual WebDragOperation dragTargetDragEnter( - const WebDragData&, - const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) = 0; virtual WebDragOperation dragTargetDragEnter( const WebDragData&, const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) = 0; - // FIXME: Remove this method after chromium changes catch up. - virtual WebDragOperation dragTargetDragOver( - const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) = 0; virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) = 0; virtual void dragTargetDragLeave() = 0; - // FIXME: Remove this method after chromium changes catch up. - virtual void dragTargetDrop( - const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; virtual void dragTargetDrop( const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers) = 0; diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 349733919..b2219454c 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -60,6 +60,7 @@ #include "NavigationAction.h" #include "Node.h" #include "Page.h" +#include "PagePopupDriver.h" #include "PlatformScreen.h" #include "PlatformSupport.h" #include "PopupContainer.h" @@ -139,6 +140,9 @@ ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) , m_menubarVisible(true) , m_resizable(true) , m_nextNewWindowNavigationPolicy(WebNavigationPolicyIgnore) +#if ENABLE(PAGE_POPUP) + , m_pagePopupDriver(webView) +#endif { } @@ -1009,12 +1013,25 @@ PassRefPtr<SearchPopupMenu> ChromeClientImpl::createSearchPopupMenu(PopupMenuCli #if ENABLE(PAGE_POPUP) PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView) { - return m_webView->openPagePopup(client, originBoundsInRootView); + ASSERT(m_pagePopupDriver); + return m_pagePopupDriver->openPagePopup(client, originBoundsInRootView); } void ChromeClientImpl::closePagePopup(PagePopup* popup) { - m_webView->closePagePopup(popup); + ASSERT(m_pagePopupDriver); + m_pagePopupDriver->closePagePopup(popup); +} + +void ChromeClientImpl::setPagePopupDriver(PagePopupDriver* driver) +{ + ASSERT(driver); + m_pagePopupDriver = driver; +} + +void ChromeClientImpl::resetPagePopupDriver() +{ + m_pagePopupDriver = m_webView; } #endif diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 5894177e0..86ff7ba68 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -198,6 +198,8 @@ public: #if ENABLE(PAGE_POPUP) virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect&) OVERRIDE; virtual void closePagePopup(WebCore::PagePopup*) OVERRIDE; + virtual void setPagePopupDriver(WebCore::PagePopupDriver*) OVERRIDE; + virtual void resetPagePopupDriver() OVERRIDE; #endif virtual bool willAddTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE; virtual void addTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE; @@ -228,6 +230,9 @@ private: // The policy for how the next webview to be created will be shown. WebNavigationPolicy m_nextNewWindowNavigationPolicy; +#if ENABLE(PAGE_POPUP) + WebCore::PagePopupDriver* m_pagePopupDriver; +#endif }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index 149bfe12a..e2c9bb9e2 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -35,6 +35,7 @@ #include "DOMStringList.h" #include "IDBDatabaseBackendProxy.h" #include "IDBDatabaseError.h" +#include "ScriptExecutionContext.h" #include "SecurityOrigin.h" #include "WebFrameImpl.h" #include "WebIDBCallbacksImpl.h" @@ -72,20 +73,6 @@ IDBFactoryBackendProxy::~IDBFactoryBackendProxy() { } -void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) -{ - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, "Database Listing", origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); - return; - } - - m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); -} - static const char allowIndexedDBMode[] = "allowIndexedDBMode"; class AllowIndexedDBMainThreadBridge : public ThreadSafeRefCounted<AllowIndexedDBMainThreadBridge> { @@ -161,60 +148,80 @@ private: WebWorkerBase* m_webWorkerBase; }; -bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext* workerContext, const String& name, const WebSecurityOrigin&) +bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, const String& name, const WebSecurityOrigin& origin, PassRefPtr<IDBCallbacks> callbacks) { + bool allowed; + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); + WebViewImpl* webView = webFrame->viewImpl(); + // FIXME: webView->permissionClient() returns 0 in test_shell and content_shell http://crbug.com/137269 + allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame, name, origin); + } else { + WorkerContext* workerContext = static_cast<WorkerContext*>(context); + WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy()); + WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + + String mode = allowIndexedDBMode; + mode.append(String::number(runLoop.createUniqueId())); + RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name); + + // Either the bridge returns, or the queue gets terminated. + if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { + bridge->cancel(); + allowed = false; + } else + allowed = bridge->result(); + } - WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy()); - WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + if (!allowed) + callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UNKNOWN_ERR, "The user denied permission to access the database.")); - String mode = allowIndexedDBMode; - mode.append(String::number(runLoop.createUniqueId())); - RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name); + return allowed; +} - // Either the bridge returns, or the queue gets terminated. - if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { - bridge->cancel(); - return false; +static WebFrameImpl* getWebFrame(ScriptExecutionContext* context) +{ + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + return WebFrameImpl::fromFrame(document->frame()); } - - return bridge->result(); + return 0; } -void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const String& dataDir) +void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { -#if ENABLE(WORKERS) - WebSecurityOrigin origin(prpOrigin); - if (!allowIDBFromWorkerThread(context, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, "Database Listing", origin, callbacks)) return; - } - m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, /*webFrame*/0, dataDir); -#endif + + WebFrameImpl* webFrame = getWebFrame(context); + m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -void IDBFactoryBackendProxy::open(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) + +void IDBFactoryBackendProxy::open(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, name, origin, callbacks)) return; - } + WebFrameImpl* webFrame = getWebFrame(context); m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) +void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, name, origin, callbacks)) return; - } + WebFrameImpl* webFrame = getWebFrame(context); m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h index c07db3556..22a6f52a8 100644 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -31,10 +31,11 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBCallbacks.h" #include "IDBFactoryBackendInterface.h" namespace WebCore { -class WorkerContext; +class ScriptExecutionContext; } namespace WebKit { @@ -47,16 +48,13 @@ public: static PassRefPtr<WebCore::IDBFactoryBackendInterface> create(); virtual ~IDBFactoryBackendProxy(); - virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); - - virtual void open(const String& name, WebCore::IDBCallbacks*, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); - virtual void openFromWorker(const String& name, WebCore::IDBCallbacks*, PassRefPtr<WebCore::SecurityOrigin>, WebCore::WorkerContext*, const String& dataDir); - - virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); + virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); + virtual void open(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); + virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); private: IDBFactoryBackendProxy(); - bool allowIDBFromWorkerThread(WebCore::WorkerContext*, const String& name, const WebSecurityOrigin&); + bool allowIndexedDB(WebCore::ScriptExecutionContext*, const String& name, const WebSecurityOrigin&, PassRefPtr<WebCore::IDBCallbacks>); // We don't own this pointer (unlike all the other proxy classes which do). WebIDBFactory* m_webIDBFactory; diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 7e9539376..899315d29 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -157,7 +157,9 @@ WebScrollableLayer NonCompositedContentHost::scrollLayer() void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) { - m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(rect)); + WebCore::IntRect layerRect = rect; + layerRect.move(-m_layerAdjust); + m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(layerRect)); } void NonCompositedContentHost::notifyAnimationStarted(const WebCore::GraphicsLayer*, double /* time */) diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 163862e19..76e30b52f 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -44,112 +44,113 @@ public: explicit WebSettingsImpl(WebCore::Settings*); virtual ~WebSettingsImpl() { } - virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual bool deviceSupportsTouch(); + virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; } + virtual bool scrollAnimatorEnabled() const; + virtual bool viewportEnabled() const { return m_viewportEnabled; } + virtual void setAccelerated2dCanvasEnabled(bool); + virtual void setAcceleratedCompositingEnabled(bool); + virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool); + virtual void setAcceleratedCompositingForAnimationEnabled(bool); + virtual void setAcceleratedCompositingForCanvasEnabled(bool); + virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); + virtual void setAcceleratedCompositingForPluginsEnabled(bool); + virtual void setAcceleratedCompositingForVideoEnabled(bool); + virtual void setAcceleratedFiltersEnabled(bool); + virtual void setAcceleratedPaintingEnabled(bool); + virtual void setAllowDisplayOfInsecureContent(bool); + virtual void setAllowFileAccessFromFileURLs(bool); + virtual void setAllowRunningOfInsecureContent(bool); + virtual void setAllowScriptsToCloseWindows(bool); + virtual void setAllowUniversalAccessFromFileURLs(bool); + virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); + virtual void setAsynchronousSpellCheckingEnabled(bool); + virtual void setAuthorAndUserStylesEnabled(bool); + virtual void setCaretBrowsingEnabled(bool); + virtual void setCookieEnabled(bool); virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setDefaultFontSize(int); + virtual void setDNSPrefetchingEnabled(bool); + virtual void setDOMPasteAllowed(bool); virtual void setDefaultFixedFontSize(int); - virtual void setMinimumFontSize(int); - virtual void setMinimumLogicalFontSize(int); - virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); - virtual void setTextAutosizingEnabled(bool); + virtual void setDefaultFontSize(int); virtual void setDefaultTextEncodingName(const WebString&); - virtual void setDeviceSupportsTouch(bool); - virtual void setDeviceSupportsMouse(bool); - virtual bool deviceSupportsTouch(); - virtual void setJavaScriptEnabled(bool); - virtual void setWebSecurityEnabled(bool); - virtual void setJavaScriptCanOpenWindowsAutomatically(bool); - virtual void setLoadsImagesAutomatically(bool); - virtual void setImagesEnabled(bool); - virtual void setPluginsEnabled(bool); - virtual void setDOMPasteAllowed(bool); + virtual void setDefaultTileSize(WebSize); + virtual void setDeferred2dCanvasEnabled(bool); virtual void setDeveloperExtrasEnabled(bool); - virtual void setNeedsSiteSpecificQuirks(bool); - virtual void setShrinksStandaloneImagesToFit(bool); - virtual void setUsesEncodingDetector(bool); - virtual void setTextAreasAreResizable(bool); - virtual void setJavaEnabled(bool); - virtual void setAllowScriptsToCloseWindows(bool); - virtual void setUserStyleSheetLocation(const WebURL&); - virtual void setAuthorAndUserStylesEnabled(bool); - virtual void setUsesPageCache(bool); - virtual void setPageCacheSupportsPlugins(bool); + virtual void setDeviceSupportsMouse(bool); + virtual void setDeviceSupportsTouch(bool); virtual void setDownloadableBinaryFontsEnabled(bool); - virtual void setJavaScriptCanAccessClipboard(bool); - virtual void setXSSAuditorEnabled(bool); - virtual void setDNSPrefetchingEnabled(bool); - virtual void setFixedElementsLayoutRelativeToFrame(bool); - virtual void setLocalStorageEnabled(bool); virtual void setEditableLinkBehaviorNeverLive(); - virtual void setFrameFlatteningEnabled(bool); - virtual void setFontRenderingModeNormal(); - virtual void setAllowUniversalAccessFromFileURLs(bool); - virtual void setAllowFileAccessFromFileURLs(bool); - virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); - virtual void setOfflineWebApplicationCacheEnabled(bool); - virtual void setWebAudioEnabled(bool); - virtual void setExperimentalWebGLEnabled(bool); - virtual void setExperimentalCSSRegionsEnabled(bool); - virtual void setExperimentalCSSGridLayoutEnabled(bool); + virtual void setEditingBehavior(EditingBehavior); + virtual void setEnableScrollAnimator(bool); virtual void setExperimentalCSSCustomFilterEnabled(bool); + virtual void setExperimentalCSSGridLayoutEnabled(bool); + virtual void setExperimentalCSSRegionsEnabled(bool); virtual void setExperimentalCSSVariablesEnabled(bool); - virtual void setOpenGLMultisamplingEnabled(bool); - virtual void setPrivilegedWebGLExtensionsEnabled(bool); - virtual void setWebGLErrorsToConsoleEnabled(bool); - virtual void setShowDebugBorders(bool); - virtual void setShowFPSCounter(bool); - virtual void setShowPlatformLayerTree(bool); - virtual void setShowPaintRects(bool); - virtual void setDefaultTileSize(WebSize); - virtual void setMaxUntiledLayerSize(WebSize); - virtual void setEditingBehavior(EditingBehavior); - virtual void setAcceleratedCompositingEnabled(bool); + virtual void setExperimentalWebGLEnabled(bool); + virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setFixedElementsLayoutRelativeToFrame(bool); + virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setFixedPositionCreatesStackingContext(bool); + virtual void setFontRenderingModeNormal(); virtual void setForceCompositingMode(bool); virtual void setForceSoftwareCompositing(bool); - virtual void setMockScrollbarsEnabled(bool); - virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool); - virtual void setAcceleratedCompositingForVideoEnabled(bool); - virtual void setAcceleratedCompositingForPluginsEnabled(bool); - virtual void setAcceleratedCompositingForCanvasEnabled(bool); - virtual void setAcceleratedCompositingForAnimationEnabled(bool); - virtual void setAccelerated2dCanvasEnabled(bool); - virtual void setDeferred2dCanvasEnabled(bool); - virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); - virtual void setMinimumAccelerated2dCanvasSize(int); - virtual void setAcceleratedFiltersEnabled(bool); - virtual void setMemoryInfoEnabled(bool); + virtual void setFrameFlatteningEnabled(bool); + virtual void setFullScreenEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); - virtual void setLayoutFallbackWidth(int); - virtual void setAsynchronousSpellCheckingEnabled(bool); - virtual void setUnifiedTextCheckerEnabled(bool); - virtual void setCaretBrowsingEnabled(bool); + virtual void setImagesEnabled(bool); virtual void setInteractiveFormValidationEnabled(bool); - virtual void setValidationMessageTimerMagnification(int); + virtual void setJavaEnabled(bool); + virtual void setJavaScriptCanAccessClipboard(bool); + virtual void setJavaScriptCanOpenWindowsAutomatically(bool); + virtual void setJavaScriptEnabled(bool); + virtual void setLayoutFallbackWidth(int); + virtual void setLoadsImagesAutomatically(bool); + virtual void setLocalStorageEnabled(bool); + virtual void setMaxUntiledLayerSize(WebSize); + virtual void setMediaPlaybackRequiresUserGesture(bool); + virtual void setMemoryInfoEnabled(bool); + virtual void setMinimumAccelerated2dCanvasSize(int); + virtual void setMinimumFontSize(int); + virtual void setMinimumLogicalFontSize(int); virtual void setMinimumTimerInterval(double); - virtual void setFullScreenEnabled(bool); - virtual void setAllowDisplayOfInsecureContent(bool); - virtual void setAllowRunningOfInsecureContent(bool); - virtual void setPasswordEchoEnabled(bool); + virtual void setMockScrollbarsEnabled(bool); + virtual void setNeedsSiteSpecificQuirks(bool); + virtual void setOfflineWebApplicationCacheEnabled(bool); + virtual void setOpenGLMultisamplingEnabled(bool); + virtual void setPageCacheSupportsPlugins(bool); virtual void setPasswordEchoDurationInSeconds(double); - virtual void setShouldPrintBackgrounds(bool); - virtual void setEnableScrollAnimator(bool); - virtual bool scrollAnimatorEnabled() const; - virtual void setVisualWordMovementEnabled(bool); - virtual void setShouldDisplaySubtitles(bool); + virtual void setPasswordEchoEnabled(bool); + virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setPluginsEnabled(bool); + virtual void setPrivilegedWebGLExtensionsEnabled(bool); + virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setShouldDisplayCaptions(bool); + virtual void setShouldDisplaySubtitles(bool); virtual void setShouldDisplayTextDescriptions(bool); - virtual void setAcceleratedPaintingEnabled(bool); - virtual void setFixedPositionCreatesStackingContext(bool); - virtual void setViewportEnabled(bool); - virtual void setMediaPlaybackRequiresUserGesture(bool); - virtual bool viewportEnabled() const { return m_viewportEnabled; } + virtual void setShouldPrintBackgrounds(bool); + virtual void setShowDebugBorders(bool); + virtual void setShowFPSCounter(bool); + virtual void setShowPaintRects(bool); + virtual void setShowPlatformLayerTree(bool); + virtual void setShrinksStandaloneImagesToFit(bool); + virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setSyncXHRInDocumentsEnabled(bool); - virtual void setCookieEnabled(bool); + virtual void setTextAreasAreResizable(bool); + virtual void setTextAutosizingEnabled(bool); + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); + virtual void setUnifiedTextCheckerEnabled(bool); + virtual void setUserStyleSheetLocation(const WebURL&); + virtual void setUsesEncodingDetector(bool); + virtual void setUsesPageCache(bool); + virtual void setValidationMessageTimerMagnification(int); + virtual void setViewportEnabled(bool); + virtual void setVisualWordMovementEnabled(bool); + virtual void setWebAudioEnabled(bool); + virtual void setWebGLErrorsToConsoleEnabled(bool); + virtual void setWebSecurityEnabled(bool); + virtual void setXSSAuditorEnabled(bool); bool showFPSCounter() const { return m_showFPSCounter; } bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } @@ -157,7 +158,6 @@ public: bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; } WebSize defaultTileSize() const { return m_defaultTileSize; } WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; } - virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; } private: WebCore::Settings* m_settings; diff --git a/Source/WebKit/chromium/src/WebSurroundingText.cpp b/Source/WebKit/chromium/src/WebSurroundingText.cpp index f880676ae..45db3d1bd 100644 --- a/Source/WebKit/chromium/src/WebSurroundingText.cpp +++ b/Source/WebKit/chromium/src/WebSurroundingText.cpp @@ -40,15 +40,6 @@ using namespace WebCore; namespace WebKit { -void WebSurroundingText::initialize(const WebHitTestResult& hitTestResult, size_t maxLength) -{ - Node* node = hitTestResult.node().unwrap<Node>(); - if (!node || !node->renderer()) - return; - - m_private.reset(new SurroundingText(VisiblePosition(node->renderer()->positionForPoint(static_cast<IntPoint>(hitTestResult.localPoint()))), maxLength)); -} - void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& nodePoint, size_t maxLength) { const Node* node = webNode.constUnwrap<Node>(); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index dd3315ff9..721bfc1d6 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -2796,15 +2796,6 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( const WebDragData& webDragData, const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) -{ - return dragTargetDragEnter(webDragData, clientPoint, screenPoint, operationsAllowed, 0); -} - -WebDragOperation WebViewImpl::dragTargetDragEnter( - const WebDragData& webDragData, - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) { @@ -2819,14 +2810,6 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( WebDragOperation WebViewImpl::dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) -{ - return dragTargetDragOver(clientPoint, screenPoint, operationsAllowed, 0); -} - -WebDragOperation WebViewImpl::dragTargetDragOver( - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) { @@ -2854,12 +2837,6 @@ void WebViewImpl::dragTargetDragLeave() } void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, - const WebPoint& screenPoint) -{ - dragTargetDrop(clientPoint, screenPoint, 0); -} - -void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers) { diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index f657504f2..4596dcafc 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -52,6 +52,7 @@ #include "IntRect.h" #include "NotificationPresenterImpl.h" #include "PageOverlayList.h" +#include "PagePopupDriver.h" #include "PageWidgetDelegate.h" #include "PlatformGestureCurveTarget.h" #include "UserMediaClientImpl.h" @@ -112,7 +113,14 @@ class WebMouseWheelEvent; class WebSettingsImpl; class WebTouchEvent; -class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl>, public WebCore::PlatformGestureCurveTarget, public PageWidgetEventHandler { +class WebViewImpl : public WebView + , public WebLayerTreeViewClient + , public RefCounted<WebViewImpl> + , public WebCore::PlatformGestureCurveTarget +#if ENABLE(PAGE_POPUP) + , public WebCore::PagePopupDriver +#endif + , public PageWidgetEventHandler { public: enum AutoZoomType { DoubleTap, @@ -239,28 +247,16 @@ public: const WebDragData&, const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed); - virtual WebDragOperation dragTargetDragEnter( - const WebDragData&, - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers); virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed); - virtual WebDragOperation dragTargetDragOver( - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers); virtual void dragTargetDragLeave(); virtual void dragTargetDrop( const WebPoint& clientPoint, - const WebPoint& screenPoint); - virtual void dragTargetDrop( - const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers); virtual unsigned long createUniqueIdentifierForRequest(); @@ -491,8 +487,9 @@ public: void popupOpened(WebCore::PopupContainer* popupContainer); void popupClosed(WebCore::PopupContainer* popupContainer); #if ENABLE(PAGE_POPUP) - WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView); - void closePagePopup(WebCore::PagePopup*); + // PagePopupDriver functions. + virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView) OVERRIDE; + virtual void closePagePopup(WebCore::PagePopup*) OVERRIDE; #endif void hideAutofillPopup(); diff --git a/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png Binary files differdeleted file mode 100644 index b5a780f36..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png Binary files differdeleted file mode 100644 index 531a3efe7..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png Binary files differdeleted file mode 100644 index 136d5a8be..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png Binary files differdeleted file mode 100644 index c8fbd454f..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png Binary files differdeleted file mode 100644 index 668070d9b..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/devTools.css b/Source/WebKit/chromium/src/js/devTools.css index 3d1183404..c7aa9420d 100644 --- a/Source/WebKit/chromium/src/js/devTools.css +++ b/Source/WebKit/chromium/src/js/devTools.css @@ -80,28 +80,8 @@ body.platform-linux #scripts-files { -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2; } -body.drawer-visible #main-status-bar { - background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png); -} - .status-bar { - background-image: url(Images/statusbarBackgroundChromium.png); -} - -button.status-bar-item { - background-image: url(Images/statusbarButtonsChromium.png); -} - -select.status-bar-item:active { - -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2; -} - -#drawer { - background-image: url(Images/statusbarBottomBackgroundChromium.png); -} - -select.status-bar-item { - -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2; + background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235)); } .scope-bar li.selected { diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index f719f2d5e..e1b94a640 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -34,7 +34,7 @@ #include "WebInputEvent.h" #include <wtf/ASCIICType.h> -#if BUILDING_ON_LEOPARD || BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1070 // Additional Lion APIs. enum { @@ -53,9 +53,11 @@ typedef NSUInteger NSEventPhase; - (NSEventPhase)momentumPhase; @end -#endif // BUILDING_ON_LEOPARD || BUILDING_ON_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MAX_ALLOWED < 1070 -#if BUILDING_ON_LEOPARD +// Do not __MAC_OS_X_VERSION_MAX_ALLOWED here because of a bug in the 10.5 SDK, +// see <http://lists.webkit.org/pipermail/webkit-dev/2012-July/021442.html>. +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 // These are not defined in the 10.5 SDK but are defined in later SDKs inside // a MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 #ifdef. @@ -64,7 +66,7 @@ enum { NSEventTypeEndGesture = 20 }; -#endif // BUILDING_ON_LEOPARD +#endif // MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 namespace WebKit { diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp index 03559f7f1..7051bf9d6 100644 --- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp +++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebURLLoaderOptions.h" @@ -42,11 +43,11 @@ #include "platform/WebURLResponse.h" #include <wtf/text/WTFString.h> -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -76,9 +77,9 @@ public: , m_runningMessageLoop(false) { // Reuse one of the test files from WebFrameTest. - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); + std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data()); filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html"; - m_frameFilePath = WebString::fromUTF8(filePath); + m_frameFilePath = WebString::fromUTF8(filePath.c_str()); } void SetUp() @@ -87,7 +88,7 @@ public: m_webView->initializeMainFrame(&m_webFrameClient); // Load the frame before trying to load resources. - GURL url = GURL("http://www.test.com/iframes_test.html"); + WebCore::KURL url = toKURL("http://www.test.com/iframes_test.html"); WebURLResponse response; response.initialize(); response.setMIMEType("text/html"); @@ -184,7 +185,7 @@ public: { WebURLRequest request; request.initialize(); - request.setURL(GURL("http://www.test.com/success.html")); + request.setURL(toKURL("http://www.test.com/success.html")); request.setHTTPMethod(WebString::fromUTF8(unsafeMethod)); WebURLLoaderOptions options; options.untrustedHTTP = true; @@ -200,7 +201,7 @@ public: { WebURLRequest request; request.initialize(); - request.setURL(GURL("http://www.test.com/success.html")); + request.setURL(toKURL("http://www.test.com/success.html")); request.setHTTPHeaderField(WebString::fromUTF8(headerField), WebString::fromUTF8(headerValue)); WebURLLoaderOptions options; options.untrustedHTTP = true; @@ -230,7 +231,7 @@ public: id.append("-Exposed"); id.append(".html"); - GURL url = GURL(id); + WebCore::KURL url = toKURL(id); WebURLRequest request; request.initialize(); request.setURL(url); @@ -282,7 +283,7 @@ protected: // Test a successful same-origin URL load. TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) { - GURL url = GURL("http://www.test.com/SameOriginSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -305,7 +306,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) TEST_F(AssociatedURLLoaderTest, SameOriginRestriction) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/SameOriginRestriction.html"); + WebCore::KURL url = toKURL("http://www.other.com/SameOriginRestriction.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -316,7 +317,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginRestriction) TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginSuccess.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -341,7 +342,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -367,7 +368,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlFailure.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlFailure.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -398,9 +399,9 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) // Test a same-origin URL redirect and load. TEST_F(AssociatedURLLoaderTest, RedirectSuccess) { - GURL url = GURL("http://www.test.com/RedirectSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html"); char redirect[] = "http://www.test.com/RedirectSuccess2.html"; // Same-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -435,9 +436,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectSuccess) // Test that a cross origin redirect response without CORS headers fails. TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure) { - GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html"); char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlFailure.html"; // Cross-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -467,9 +468,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure) // Test that a cross origin redirect response with CORS headers that allow the requesting origin succeeds. TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess) { - GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html"); char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlSuccess.html"; // Cross-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -590,7 +591,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderAllowResponseHeaders) { WebURLRequest request; request.initialize(); - GURL url = GURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html"); request.setURL(url); WebString headerNameString(WebString::fromUTF8("non-whitelisted")); diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index 262fcf76f..892da4f2f 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -175,7 +175,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setScreenSpaceTransform(arbitraryTransform)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawableContentRect(arbitraryIntRect)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setUpdateRect(arbitraryFloatRect)); - EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleLayerRect(arbitraryIntRect)); + EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleContentRect(arbitraryIntRect)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMaxScrollPosition(arbitraryIntSize)); } diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp index b35819759..6cc4d2c39 100644 --- a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp @@ -43,10 +43,11 @@ void verifyQuadsExactlyCoverRect(const CCQuadList& quads, const IntRect& rect) for (size_t i = 0; i < quads.size(); ++i) { CCDrawQuad* quad = quads[i].get(); + IntRect quadRect = quad->quadRect(); - EXPECT_TRUE(rect.contains(quad->quadRect())) << quadString << i; - EXPECT_TRUE(remaining.contains(quad->quadRect())) << quadString << i; - remaining.subtract(Region(quad->quadRect())); + EXPECT_TRUE(rect.contains(quadRect)) << quadString << i; + EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i; + remaining.subtract(Region(quadRect)); } EXPECT_TRUE(remaining.isEmpty()); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 73f1eb974..54409514c 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -2844,13 +2844,13 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id()); EXPECT_EQ(childOfAnimatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id()); - EXPECT_FALSE(child2->visibleLayerRect().isEmpty()); + EXPECT_FALSE(child2->visibleContentRect().isEmpty()); - // The animating layers should have a visibleLayerRect that represents the area of the front face that is within the viewport. - EXPECT_EQ(animatingChild->visibleLayerRect(), IntRect(IntPoint(), animatingChild->contentBounds())); - EXPECT_EQ(animatingSurface->visibleLayerRect(), IntRect(IntPoint(), animatingSurface->contentBounds())); - // And layers in the subtree of the animating layer should have valid visibleLayerRects also. - EXPECT_EQ(childOfAnimatingSurface->visibleLayerRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds())); + // The animating layers should have a visibleContentRect that represents the area of the front face that is within the viewport. + EXPECT_EQ(animatingChild->visibleContentRect(), IntRect(IntPoint(), animatingChild->contentBounds())); + EXPECT_EQ(animatingSurface->visibleContentRect(), IntRect(IntPoint(), animatingSurface->contentBounds())); + // And layers in the subtree of the animating layer should have valid visibleContentRects also. + EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds())); } TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningSurface) @@ -3208,7 +3208,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents) { - // A layer's visibleLayerRect is actually in the layer's content space. The + // A layer's visibleContentRect is actually in the layer's content space. The // screenSpaceTransform converts from the layer's origin space to screen space. This // test makes sure that hit testing works correctly accounts for the contents scale. // A contentsScale that is not 1 effectively forces a non-identity transform between @@ -3216,7 +3216,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // screenSpaceTransformn. The hit testing code must take this into account. // // To test this, the layer is positioned at (25, 25), and is size (50, 50). If - // contentsScale is ignored, then hit testing will mis-interpret the visibleLayerRect + // contentsScale is ignored, then hit testing will mis-interpret the visibleContentRect // as being larger than the actual bounds of the layer. // DebugScopedSetImplThread thisScopeIsOnImplThread; @@ -3242,8 +3242,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. - // The visibleLayerRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. - EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleLayerRect()); + // The visibleContentRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. + EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); @@ -3418,7 +3418,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // (4, 50) is inside the unclipped layer, but that corner of the layer should be // clipped away by the grandParent and should not get hit. If hit testing blindly uses - // visibleLayerRect without considering how parent may clip the layer, then hit + // visibleContentRect without considering how parent may clip the layer, then hit // testing would accidentally think that the point successfully hits the layer. testPoint = IntPoint(4, 50); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index fbede6ced..cb2b7f36f 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -31,7 +31,6 @@ #include "CCTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "LayerRendererChromium.h" -#include "ManagedTexture.h" #include "cc/CCIOSurfaceLayerImpl.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTilingData.h" @@ -70,6 +69,8 @@ public: , m_didRequestRedraw(false) { CCLayerTreeSettings settings; + settings.minimumOcclusionTrackingSize = IntSize(); + m_hostImpl = CCLayerTreeHostImpl::create(settings, this); m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader); m_hostImpl->setViewportSize(IntSize(10, 10)); @@ -86,6 +87,8 @@ public: CCSettings::setPartialSwapEnabled(partialSwap); CCLayerTreeSettings settings; + settings.minimumOcclusionTrackingSize = IntSize(); + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); myHostImpl->initializeLayerRenderer(graphicsContext, UnthrottledUploader); @@ -97,7 +100,7 @@ public: root->setPosition(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setContentBounds(IntSize(10, 10)); - root->setVisibleLayerRect(IntRect(0, 0, 10, 10)); + root->setVisibleContentRect(IntRect(0, 0, 10, 10)); root->setDrawsContent(true); myHostImpl->setRootLayer(root.release()); return myHostImpl.release(); @@ -625,7 +628,7 @@ protected: setContentBounds(IntSize(10, 10)); setDrawsContent(true); setSkipsDraw(false); - setVisibleLayerRect(IntRect(0, 0, 10, 10)); + setVisibleContentRect(IntRect(0, 0, 10, 10)); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels); tiler->setBounds(contentBounds()); @@ -647,7 +650,7 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) root->addChild(DidDrawCheckLayer::create(2)); DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0].get()); - // Ensure visibleLayerRect for layer is empty + // Ensure visibleContentRect for layer is empty layer->setPosition(FloatPoint(100, 100)); layer->setBounds(IntSize(10, 10)); layer->setContentBounds(IntSize(10, 10)); @@ -664,9 +667,9 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) EXPECT_FALSE(layer->willDrawCalled()); EXPECT_FALSE(layer->didDrawCalled()); - EXPECT_TRUE(layer->visibleLayerRect().isEmpty()); + EXPECT_TRUE(layer->visibleContentRect().isEmpty()); - // Ensure visibleLayerRect for layer layer is not empty + // Ensure visibleContentRect for layer layer is not empty layer->setPosition(FloatPoint(0, 0)); EXPECT_FALSE(layer->willDrawCalled()); @@ -679,12 +682,11 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) EXPECT_TRUE(layer->willDrawCalled()); EXPECT_TRUE(layer->didDrawCalled()); - EXPECT_FALSE(layer->visibleLayerRect().isEmpty()); + EXPECT_FALSE(layer->visibleContentRect().isEmpty()); } TEST_F(CCLayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) { - // Make the viewport large so that we can have large layers that get considered for occlusion (small layers do not). IntSize bigSize(1000, 1000); m_hostImpl->setViewportSize(bigSize); @@ -1184,10 +1186,8 @@ private: IntRect m_quadVisibleRect; }; -// https://bugs.webkit.org/show_bug.cgi?id=75783 TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { - { OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setAnchorPoint(FloatPoint(0, 0)); @@ -1200,6 +1200,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) root->addChild(BlendStateCheckLayer::create(2)); BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0].get()); + layer1->setPosition(FloatPoint(2, 2)); CCLayerTreeHostImpl::FrameData frame; @@ -1252,6 +1253,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer1->addChild(BlendStateCheckLayer::create(3)); BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0].get()); + layer2->setPosition(FloatPoint(4, 4)); // 2 opaque layers, drawn without blending. layer1->setOpaque(true); @@ -1626,6 +1628,28 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height()); } +TEST_F(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) +{ + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); + CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); + child->setAnchorPoint(FloatPoint(0, 0)); + child->setBounds(IntSize(10, 10)); + child->setDrawsContent(true); + root->setAnchorPoint(FloatPoint(0, 0)); + root->setBounds(IntSize(10, 10)); + root->setDrawsContent(true); + root->setOpacity(0.7f); + root->addChild(adoptPtr(child)); + + m_hostImpl->setRootLayer(adoptPtr(root)); + + CCLayerTreeHostImpl::FrameData frame; + + EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); + EXPECT_EQ(1u, frame.renderSurfaceLayerList->size()); + EXPECT_EQ(1u, frame.renderPasses.size()); +} + } // namespace class FakeLayerWithQuads : public CCLayerImpl { @@ -1855,7 +1879,7 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); root->setBounds(IntSize(rootRect.width(), rootRect.height())); root->setContentBounds(root->bounds()); - root->setVisibleLayerRect(rootRect); + root->setVisibleContentRect(rootRect); root->setDrawsContent(false); root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); @@ -1864,14 +1888,14 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C child->setOpacity(0.5f); child->setBounds(IntSize(childRect.width(), childRect.height())); child->setContentBounds(child->bounds()); - child->setVisibleLayerRect(childRect); + child->setVisibleContentRect(childRect); child->setDrawsContent(false); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); grandChild->setContentBounds(grandChild->bounds()); - grandChild->setVisibleLayerRect(grandChildRect); + grandChild->setVisibleContentRect(grandChildRect); grandChild->setDrawsContent(true); child->addChild(grandChild.release()); @@ -2420,7 +2444,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, root->setPosition(FloatPoint(0, 0)); root->setBounds(rootSize); root->setContentBounds(rootSize); - root->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); + root->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); root->setDrawsContent(true); layerTreeHostImpl->setRootLayer(root.release()); @@ -2432,7 +2456,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, intermediateLayerPtr->setPosition(FloatPoint(10, 10)); intermediateLayerPtr->setBounds(rootSize); intermediateLayerPtr->setContentBounds(rootSize); - intermediateLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); + intermediateLayerPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); intermediateLayerPtr->setDrawsContent(false); // only children draw content rootPtr->addChild(intermediateLayer.release()); @@ -2446,7 +2470,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, surfaceLayerPtr->setPosition(FloatPoint(10, 10)); surfaceLayerPtr->setBounds(surfaceSize); surfaceLayerPtr->setContentBounds(surfaceSize); - surfaceLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), surfaceSize)); + surfaceLayerPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), surfaceSize)); surfaceLayerPtr->setDrawsContent(false); // only children draw content surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface intermediateLayerPtr->addChild(surfaceLayer.release()); @@ -2460,7 +2484,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, childPtr->setPosition(FloatPoint(5, 5)); childPtr->setBounds(childSize); childPtr->setContentBounds(childSize); - childPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), childSize)); + childPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), childSize)); childPtr->setDrawsContent(true); surfaceLayerPtr->addChild(child.release()); @@ -2496,7 +2520,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2528,7 +2553,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2548,7 +2574,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2574,10 +2601,11 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(quad->renderPass()->id())); + EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2611,7 +2639,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2643,7 +2672,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2676,7 +2706,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2696,7 +2727,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2722,10 +2754,11 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(quad->renderPass()->id())); + EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2760,7 +2793,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2801,7 +2835,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingMemoryLimit) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2834,7 +2869,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingMemoryLimit) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2877,7 +2913,6 @@ struct RenderPassCacheEntry { struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { std::map<char, RenderPassCacheEntry> renderPassCache; - std::map<const CCRenderPass*, char> renderPassId; Vector<OwnPtr<CCRenderSurface> > renderSurfaceStore; Vector<OwnPtr<CCLayerImpl> > layerStore; OwnPtr<CCSharedQuadState> sharedQuadState; @@ -2943,14 +2978,13 @@ 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(), WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); + testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); const char* currentChar = testScript; // Pre-create root pass char rootRenderPassId = testScript[0]; OwnPtr<CCRenderPass> rootRenderPass = createDummyRenderPass(testData, rootRenderPassId); - testData.renderPassId.insert(std::pair<CCRenderPass*, char>(rootRenderPass.get(), rootRenderPassId)); testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(rootRenderPassId, RenderPassCacheEntry(rootRenderPass.release()))); while (*currentChar) { char renderPassId = currentChar[0]; @@ -2997,26 +3031,22 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova currentChar++; } - CCRenderPass* refRenderPassPtr; - if (testData.renderPassCache.find(newRenderPassId) == testData.renderPassCache.end()) { if (hasTexture) renderer->setHaveCachedResourcesForRenderPassId(newRenderPassId); - OwnPtr<CCRenderPass> refRenderPass = createDummyRenderPass(testData, newRenderPassId); - refRenderPassPtr = refRenderPass.get(); - testData.renderPassId.insert(std::pair<CCRenderPass*, char>(refRenderPass.get(), newRenderPassId)); - testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(refRenderPass.release()))); - } else - refRenderPassPtr = testData.renderPassCache[newRenderPassId].renderPass; + OwnPtr<CCRenderPass> renderPass = createDummyRenderPass(testData, newRenderPassId); + testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(renderPass.release()))); + } IntRect quadRect = IntRect(0, 0, 1, 1); IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect(); - OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, refRenderPassPtr, isReplica, WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); + OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, WebKit::WebTransformationMatrix(), WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release()); } } - testData.renderPasses.insert(0, renderPass.release()); + testData.renderPasses.insert(0, renderPass.get()); + testData.renderPassesById.add(renderPassId, renderPass.release()); if (*currentChar) currentChar++; } @@ -3026,9 +3056,8 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf { char* pos = buffer; for (CCRenderPassList::const_reverse_iterator it = testData.renderPasses.rbegin(); it != testData.renderPasses.rend(); ++it) { - CCRenderPass* currentPass = it->get(); - char passId = testData.renderPassId.find(currentPass)->second; - *pos = passId; + const CCRenderPass* currentPass = *it; + *pos = currentPass->id(); pos++; CCQuadList::const_iterator quadListIterator = currentPass->quadList().begin(); @@ -3039,14 +3068,10 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf *pos = 's'; pos++; break; - case CCDrawQuad::RenderPass: { - CCRenderPassDrawQuad* renderPassDrawQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); - const CCRenderPass* refPass = renderPassDrawQuad->renderPass(); - char refPassId = testData.renderPassId.find(refPass)->second; - *pos = refPassId; + case CCDrawQuad::RenderPass: + *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); pos++; break; - } default: *pos = 'x'; pos++; diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 22ed5a997..f0bfd0ea3 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -62,7 +62,7 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE { if (m_overrideOpaqueContentsRect) - return intersection(m_opaqueContentsRect, visibleLayerRect()); + return intersection(m_opaqueContentsRect, visibleContentRect()); return LayerChromium::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) @@ -88,7 +88,7 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE { if (m_overrideOpaqueContentsRect) - return intersection(m_opaqueContentsRect, visibleLayerRect()); + return intersection(m_opaqueContentsRect, visibleContentRect()); return CCLayerImpl::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) @@ -759,7 +759,7 @@ protected: // This extends past both sides of child2, so it will be the original rect. EXPECT_INT_RECT_EQ(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side. - // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect(). + // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleContentRect(). EXPECT_INT_RECT_EQ(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left // and bottom edges are completely unoccluded for some row/column so we get back the original query rect. @@ -869,7 +869,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); - IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleLayerRect()); + IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); @@ -2024,7 +2024,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); - // This is very close to the camera, so pixels in its visibleLayerRect will actually go outside of the layer's clipRect. + // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect. // Ensure that those pixels don't occlude things outside the clipRect. this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); diff --git a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp index 468af36bb..21e0a717c 100644 --- a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp @@ -28,6 +28,7 @@ #include "CCTiledLayerTestCommon.h" #include "cc/CCPrioritizedTextureManager.h" +#include "cc/CCTexture.h" #include <gtest/gtest.h> using namespace WebCore; @@ -50,7 +51,7 @@ public: size_t texturesMemorySize(size_t textureCount) { - return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; + return CCTexture::memorySizeBytes(m_textureSize, m_textureFormat) * textureCount; } PassOwnPtr<CCPrioritizedTextureManager> createManager(size_t maxTextures) @@ -98,7 +99,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) textures[i]->setRequestPriority(100 + i); // Only lower half should be available. - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(textures[0], false)); EXPECT_TRUE(validateTexture(textures[7], false)); EXPECT_FALSE(validateTexture(textures[8], false)); @@ -109,7 +110,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) textures[i]->setRequestPriority(100 - i); // Only upper half should be available. - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_FALSE(validateTexture(textures[0], false)); EXPECT_FALSE(validateTexture(textures[7], false)); EXPECT_TRUE(validateTexture(textures[8], false)); @@ -134,7 +135,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 8 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) validateTexture(textures[i], false); textureManager->reduceMemory(allocator()); @@ -144,7 +145,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 5 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(5)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 5); textureManager->reduceMemory(allocator()); @@ -154,7 +155,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 4 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(4)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 4); textureManager->reduceMemory(allocator()); @@ -180,7 +181,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) for (size_t i = 0; i < numTextures; ++i) textures[i]->setRequestPriority(200 + i); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Allocate textures which are currently high priority. EXPECT_TRUE(validateTexture(textures[0], false)); @@ -195,7 +196,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) for (size_t i = 0; i < numTextures; ++i) moreTextures[i]->setRequestPriority(100 + i); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Textures are now below cutoff. EXPECT_FALSE(validateTexture(textures[0], false)); @@ -241,7 +242,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) // Set max limit to 8 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // The two high priority textures should be available, others should not. for (size_t i = 0; i < 2; ++i) @@ -272,7 +273,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_FALSE(texture->haveBackingTexture()); texture->setRequestPriority(100); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -295,7 +296,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) EXPECT_FALSE(texture->haveBackingTexture()); texture->setRequestPriority(100); - textureManagerOne->prioritizeTextures(0); + textureManagerOne->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -311,7 +312,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) texture->setTextureManager(textureManagerTwo.get()); - textureManagerTwo->prioritizeTextures(0); + textureManagerTwo->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -325,8 +326,10 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -339,7 +342,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS textures[i]->setRequestPriority(100 + i); // Only lower half should be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(textures[0], false)); EXPECT_TRUE(validateTexture(textures[3], false)); EXPECT_FALSE(validateTexture(textures[4], false)); @@ -350,14 +353,14 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS textures[i]->setRequestPriority(100 - i); // Only upper half should be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); EXPECT_FALSE(validateTexture(textures[0], false)); EXPECT_FALSE(validateTexture(textures[3], false)); EXPECT_TRUE(validateTexture(textures[4], false)); EXPECT_TRUE(validateTexture(textures[7], false)); EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); @@ -368,8 +371,10 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -382,7 +387,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa textures[i]->setRequestPriority(100); // The first four to be requested late will be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); for (unsigned i = 0; i < maxTextures; ++i) EXPECT_FALSE(validateTexture(textures[i], false)); for (unsigned i = 0; i < maxTextures; i += 2) @@ -391,7 +396,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa EXPECT_FALSE(validateTexture(textures[i], true)); EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); @@ -402,8 +407,10 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -417,7 +424,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva for (size_t i = 6; i < 8; ++i) textures[i]->setRequestPriority(CCPriorityCalculator::visiblePriority(false)); - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); // Unable to requestLate textures in the child surface. EXPECT_FALSE(validateTexture(textures[6], true)); @@ -428,7 +435,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva EXPECT_TRUE(validateTexture(textures[i], false)); EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index d0d87d252..624d24711 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -67,7 +67,7 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We layer->setSkipsDraw(false); layer->setDrawTransform(drawTransform); layer->setScreenSpaceTransform(drawTransform); - layer->setVisibleLayerRect(layerRect); + layer->setVisibleContentRect(layerRect); layer->setDrawOpacity(opacity); layer->setOpaque(opaque); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index b65e6e72b..e9e041749 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -102,12 +102,10 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40)); - WebTransformationMatrix draw; WebTransformationMatrix origin; - draw.translate(30, 40); + origin.translate(30, 40); - renderSurface->setDrawTransform(draw); renderSurface->setOriginTransform(origin); renderSurface->setContentRect(contentRect); renderSurface->setClipRect(clipRect); @@ -116,13 +114,12 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState(); - EXPECT_TRUE(sharedQuadState->quadTransform().isIdentity()); - EXPECT_EQ(30, sharedQuadState->layerTransform().m41()); - EXPECT_EQ(40, sharedQuadState->layerTransform().m42()); - EXPECT_EQ(contentRect, sharedQuadState->layerRect()); - EXPECT_EQ(clipRect, sharedQuadState->scissorRect()); - EXPECT_EQ(1, sharedQuadState->opacity()); - EXPECT_FALSE(sharedQuadState->isOpaque()); + EXPECT_EQ(30, sharedQuadState->quadTransform.m41()); + EXPECT_EQ(40, sharedQuadState->quadTransform.m42()); + EXPECT_EQ(contentRect, IntRect(sharedQuadState->visibleContentRect)); + EXPECT_EQ(clipRect, IntRect(sharedQuadState->scissorRect)); + EXPECT_EQ(1, sharedQuadState->opacity); + EXPECT_FALSE(sharedQuadState->opaque); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index 22763cef3..1bfc81d8c 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -45,17 +45,17 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(800, 600); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); - verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleLayerRect); + verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); } TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) @@ -66,10 +66,10 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setBackgroundColor(testColor); @@ -78,7 +78,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(quadCuller.quadList()[0]->toSolidColorDrawQuad()->color(), testColor); + EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->color(), testColor); } TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) @@ -89,10 +89,10 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setDrawOpacity(opacity); @@ -101,7 +101,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(opacity, quadCuller.quadList()[0]->toSolidColorDrawQuad()->opacity()); + EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->opacity()); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp new file mode 100644 index 000000000..d0bbd36f4 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp @@ -0,0 +1,520 @@ +/* + * 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/CCTextureUpdater.h" + +#include "CCTiledLayerTestCommon.h" +#include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3DPrivate.h" +#include "WebCompositor.h" +#include "platform/WebThread.h" + +#include <gtest/gtest.h> +#include <wtf/RefPtr.h> + +using namespace WebCore; +using namespace WebKit; +using namespace WebKitTests; +using testing::Test; + + +namespace { + +const int kFlushPeriodFull = 4; +const int kFlushPeriodPartial = kFlushPeriodFull; + +class CCTextureUpdaterTest; + +class WebGraphicsContext3DForUploadTest : public FakeWebGraphicsContext3D { +public: + WebGraphicsContext3DForUploadTest(CCTextureUpdaterTest *test) : m_test(test) { } + virtual void flush(void); + virtual GrGLInterface* onCreateGrGLInterface() { return 0; } + +private: + CCTextureUpdaterTest* m_test; +}; + + +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*, + const WebCore::IntRect sourceRect, + const WebCore::IntRect destRect); + +private: + CCTextureUpdaterTest* m_test; +}; + + +class TextureForUploadTest : public LayerTextureUpdater::Texture { +public: + TextureForUploadTest() : LayerTextureUpdater::Texture(adoptPtr<CCPrioritizedTexture>(0)) { } + virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) { } +}; + + +class CCTextureUpdaterTest : public Test { +public: + CCTextureUpdaterTest() + : m_uploader(this) + , m_fullUploadCountExpected(0) + , m_partialCountExpected(0) + , m_totalUploadCountExpected(0) + , m_maxUploadCountPerUpdate(0) + , m_numBeginUploads(0) + , m_numEndUploads(0) + , m_numConsecutiveFlushes(0) + , m_numDanglingUploads(0) + , m_numTotalUploads(0) + , m_numTotalFlushes(0) + , m_numPreviousUploads(0) + , m_numPreviousFlushes(0) + { } + +public: + void onFlush() + { + // Check for back-to-back flushes. + EXPECT_EQ(0, m_numConsecutiveFlushes) << "Back-to-back flushes detected."; + + // Check for premature flushes + if (m_numPreviousUploads != m_maxUploadCountPerUpdate) { + if (m_numTotalUploads < m_fullUploadCountExpected) + EXPECT_GE(m_numDanglingUploads, kFlushPeriodFull) << "Premature flush detected in full uploads."; + else if (m_numTotalUploads > m_fullUploadCountExpected && m_numTotalUploads < m_totalUploadCountExpected) + EXPECT_GE(m_numDanglingUploads, kFlushPeriodPartial) << "Premature flush detected in partial uploads."; + } + + m_numDanglingUploads = 0; + m_numConsecutiveFlushes++; + m_numTotalFlushes++; + m_numPreviousFlushes++; + } + + void onBeginUploads() + { + m_numPreviousFlushes = 0; + m_numPreviousUploads = 0; + m_numBeginUploads++; + } + + void onUpload() + { + // Check for too many consecutive uploads + if (m_numTotalUploads < m_fullUploadCountExpected) + EXPECT_LT(m_numDanglingUploads, kFlushPeriodFull) << "Too many consecutive full uploads detected."; + else + EXPECT_LT(m_numDanglingUploads, kFlushPeriodPartial) << "Too many consecutive partial uploads detected."; + + m_numConsecutiveFlushes = 0; + m_numDanglingUploads++; + m_numTotalUploads++; + m_numPreviousUploads++; + } + + void onEndUploads() + { + EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; + + // Note: The m_numTotalUploads != m_fullUploadCountExpected comparison + // allows for the quota not to be hit in the case where we are trasitioning + // from full uploads to partial uploads. + if (m_numTotalUploads != m_totalUploadCountExpected && m_numTotalUploads != m_fullUploadCountExpected) { + EXPECT_EQ(m_maxUploadCountPerUpdate, m_numPreviousUploads) + << "endUpload() was called when there are textures to upload, but the upload quota hasn't been filled."; + } + + m_numEndUploads++; + } + +protected: + virtual void SetUp() + { + OwnPtr<WebThread> thread; + WebCompositor::initialize(thread.get()); + + m_context = CCGraphicsContext::create3D( + adoptPtr(new WebGraphicsContext3DForUploadTest(this))); + } + + virtual void TearDown() + { + WebCompositor::shutdown(); + } + + void appendFullUploadsToUpdater(int count) + { + m_fullUploadCountExpected += count; + m_totalUploadCountExpected += count; + + const IntRect rect(0, 0, 300, 150); + for (int i = 0; i < count; i++) + m_updater.appendFullUpdate(&m_texture, rect, rect); + } + + void appendPartialUploadsToUpdater(int count) + { + m_partialCountExpected += count; + m_totalUploadCountExpected += count; + + const IntRect rect(0, 0, 100, 100); + for (int i = 0; i < count; i++) + m_updater.appendPartialUpdate(&m_texture, rect, rect); + } + + void setMaxUploadCountPerUpdate(int count) + { + m_maxUploadCountPerUpdate = count; + } + +protected: + // Classes required to interact and test the CCTextureUpdater + OwnPtr<CCGraphicsContext> m_context; + CCTextureUpdater m_updater; + TextureForUploadTest m_texture; + FakeTextureAllocator m_allocator; + FakeTextureCopier m_copier; + TextureUploaderForUploadTest m_uploader; + + // Properties / expectations of this test + int m_fullUploadCountExpected; + int m_partialCountExpected; + int m_totalUploadCountExpected; + int m_maxUploadCountPerUpdate; + + // Dynamic properties of this test + int m_numBeginUploads; + int m_numEndUploads; + int m_numConsecutiveFlushes; + int m_numDanglingUploads; + int m_numTotalUploads; + int m_numTotalFlushes; + int m_numPreviousUploads; + int m_numPreviousFlushes; +}; + + +void WebGraphicsContext3DForUploadTest::flush(void) +{ + m_test->onFlush(); +} + +void TextureUploaderForUploadTest::beginUploads() +{ + m_test->onBeginUploads(); +} + +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) +{ + m_test->onUpload(); +} + + +// ZERO UPLOADS TESTS +TEST_F(CCTextureUpdaterTest, ZeroUploads) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(0, m_numBeginUploads); + EXPECT_EQ(0, m_numEndUploads); + EXPECT_EQ(0, m_numPreviousFlushes); + EXPECT_EQ(0, m_numPreviousUploads); +} + + +// ONE UPLOAD TESTS +TEST_F(CCTextureUpdaterTest, OneFullUpload) +{ + appendFullUploadsToUpdater(1); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(1, m_numPreviousFlushes); + EXPECT_EQ(1, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, OnePartialUpload) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(1); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(1, m_numPreviousFlushes); + EXPECT_EQ(1, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, OneFullOnePartialUpload) +{ + appendFullUploadsToUpdater(1); + appendPartialUploadsToUpdater(1); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + // We expect the full uploads to be followed by a flush + // before the partial uploads begin. + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(2, m_numPreviousFlushes); + EXPECT_EQ(2, m_numPreviousUploads); +} + + +// NO REMAINDER TESTS +// This class of tests upload a number of textures that is a multiple of the flush period. +const int fullUploadFlushMultipler = 7; +const int fullNoRemainderCount = fullUploadFlushMultipler * kFlushPeriodFull; + +const int partialUploadFlushMultipler = 11; +const int partialNoRemainderCount = partialUploadFlushMultipler * kFlushPeriodPartial; + +TEST_F(CCTextureUpdaterTest, ManyFullUploadsNoRemainder) +{ + appendFullUploadsToUpdater(fullNoRemainderCount); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullNoRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyPartialUploadsNoRemainder) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(partialNoRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(partialNoRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullManyPartialUploadsNoRemainder) +{ + appendFullUploadsToUpdater(fullNoRemainderCount); + appendPartialUploadsToUpdater(partialNoRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullNoRemainderCount + partialNoRemainderCount, m_numPreviousUploads); +} + + +// MIN/MAX REMAINDER TESTS +// This class of tests mix and match uploading 1 more and 1 less texture +// than a multiple of the flush period. + +const int fullMinRemainderCount = fullNoRemainderCount + 1; +const int fullMaxRemainderCount = fullNoRemainderCount - 1; +const int partialMinRemainderCount = partialNoRemainderCount + 1; +const int partialMaxRemainderCount = partialNoRemainderCount - 1; + +TEST_F(CCTextureUpdaterTest, ManyFullAndPartialMinRemainder) +{ + appendFullUploadsToUpdater(fullMinRemainderCount); + appendPartialUploadsToUpdater(partialMinRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler + 2, m_numPreviousFlushes); + EXPECT_EQ(fullMinRemainderCount + partialMinRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullAndPartialUploadsMaxRemainder) +{ + appendFullUploadsToUpdater(fullMaxRemainderCount); + appendPartialUploadsToUpdater(partialMaxRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullMaxRemainderCount + partialMaxRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullMinRemainderManyPartialMaxRemainder) +{ + appendFullUploadsToUpdater(fullMinRemainderCount); + appendPartialUploadsToUpdater(partialMaxRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ((fullUploadFlushMultipler+1) + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullMinRemainderCount + partialMaxRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullMaxRemainderManyPartialMinRemainder) +{ + appendFullUploadsToUpdater(fullMaxRemainderCount); + appendPartialUploadsToUpdater(partialMinRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + (partialUploadFlushMultipler+1), m_numPreviousFlushes); + EXPECT_EQ(fullMaxRemainderCount + partialMinRemainderCount, m_numPreviousUploads); +} + + +// MULTIPLE UPDATE TESTS +// These tests attempt to upload too many textures at once, requiring +// multiple calls to update(). + +int expectedFlushes(int uploads, int flushPeriod) +{ + return (uploads + flushPeriod - 1) / flushPeriod; +} + +TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateFullAndPartial) +{ + const int kMaxUploadsPerUpdate = 40; + const int kFullUploads = 100; + const int kPartialUploads = 20; + + int expectedPreviousFlushes = 0; + int expectedPreviousUploads = 0; + + setMaxUploadCountPerUpdate(kMaxUploadsPerUpdate); + appendFullUploadsToUpdater(kFullUploads); + appendPartialUploadsToUpdater(kPartialUploads); + + // First update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Second update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Third update (20 full, 20 partial) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(3, m_numBeginUploads); + EXPECT_EQ(3, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kFullUploads-kMaxUploadsPerUpdate*2, kFlushPeriodFull) + + expectedFlushes(kPartialUploads, kFlushPeriodPartial); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = (kFullUploads-kMaxUploadsPerUpdate*2)+kPartialUploads; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Final sanity checks + EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads); +} + +TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateAllPartial) +{ + const int kMaxUploadsPerUpdate = 40; + const int kFullUploads = 70; + const int kPartialUploads = 30; + + int expectedPreviousFlushes = 0; + int expectedPreviousUploads = 0; + + setMaxUploadCountPerUpdate(kMaxUploadsPerUpdate); + appendFullUploadsToUpdater(kFullUploads); + appendPartialUploadsToUpdater(kPartialUploads); + + // First update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + 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); + + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + EXPECT_LE(m_numPreviousUploads, kMaxUploadsPerUpdate); + // Be lenient on the exact number of flushes here, as the number of flushes + // will depend on whether some partial uploads were performed. + // 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); + + EXPECT_EQ(3, m_numBeginUploads); + EXPECT_EQ(3, m_numEndUploads); + EXPECT_LE(m_numPreviousUploads, kMaxUploadsPerUpdate); + // Be lenient on the exact number of flushes here as well. + + // Final sanity checks + EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads); +} + + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.cpp b/Source/WebKit/chromium/tests/CCThreadedTest.cpp index 40d3ce5e6..2e2c1a06f 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.cpp +++ b/Source/WebKit/chromium/tests/CCThreadedTest.cpp @@ -34,7 +34,6 @@ #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" -#include "TextureManager.h" #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCActiveAnimation.h" diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index efb3a6a16..588c0ff08 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -48,7 +48,7 @@ static PassOwnPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I tiler->setBounds(layerSize); layer->setTilingData(*tiler); layer->setSkipsDraw(false); - layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize)); + layer->setVisibleContentRect(IntRect(IntPoint(), layerSize)); layer->setDrawOpacity(1); int textureId = 1; @@ -82,7 +82,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with empty visible layer rect produces no quads { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); - layer->setVisibleLayerRect(IntRect()); + layer->setVisibleContentRect(IntRect()); MockCCQuadCuller quadCuller; OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); @@ -96,7 +96,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50)); - layer->setVisibleLayerRect(outsideBounds); + layer->setVisibleContentRect(outsideBounds); MockCCQuadCuller quadCuller; OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); @@ -158,10 +158,10 @@ TEST(CCTiledLayerImplTest, checkerboarding) } } -static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect) +static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); MockCCQuadCuller quadCuller(quads); @@ -201,13 +201,13 @@ static void coverageVisibleRectIntersectsTiles(CCLayerTilingData::BorderTexelOpt // This rect intersects the middle 3x3 of the 5x5 tiles. IntPoint topLeft(65, 73); IntPoint bottomRight(182, 198); - IntRect visibleLayerRect(topLeft, bottomRight - topLeft); + IntRect visibleContentRect(topLeft, bottomRight - topLeft); IntSize layerSize(250, 250); CCQuadList quads; OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleLayerRect); - verifyQuadsExactlyCoverRect(quads, visibleLayerRect); + sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleContentRect); + verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles); @@ -216,11 +216,11 @@ static void coverageVisibleRectIntersectsBounds(CCLayerTilingData::BorderTexelOp DebugScopedSetImplThread scopedImplThread; IntSize layerSize(220, 210); - IntRect visibleLayerRect(IntPoint(), layerSize); + IntRect visibleContentRect(IntPoint(), layerSize); CCQuadList quads; OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleLayerRect); - verifyQuadsExactlyCoverRect(quads, visibleLayerRect); + sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleContentRect); + verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 558cba576..2d1603e48 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -68,7 +68,7 @@ void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const m_prepareCount++; m_lastUpdateRect = contentRect; if (!m_rectToInvalidate.isEmpty()) { - m_layer->invalidateRect(m_rectToInvalidate); + m_layer->invalidateContentRect(m_rectToInvalidate); m_rectToInvalidate = IntRect(); m_layer = 0; } @@ -118,7 +118,7 @@ void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect) void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) { - updateLayerRect(updater, visibleLayerRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion); } void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index 53e58b3a7..9501caba9 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -29,6 +29,7 @@ #include "IntSize.h" #include "LayerTextureUpdater.h" #include "Region.h" +#include "TextureAllocator.h" #include "TextureCopier.h" #include "TextureUploader.h" #include "TiledLayerChromium.h" @@ -110,8 +111,8 @@ public: static WebCore::IntSize tileSize() { return WebCore::IntSize(100, 100); } - using WebCore::TiledLayerChromium::invalidateRect; - using WebCore::TiledLayerChromium::updateLayerRect; + using WebCore::TiledLayerChromium::invalidateContentRect; + using WebCore::TiledLayerChromium::updateContentRect; using WebCore::TiledLayerChromium::needsIdlePaint; using WebCore::TiledLayerChromium::skipsDraw; using WebCore::TiledLayerChromium::numPaintedTiles; @@ -120,7 +121,7 @@ public: virtual void setNeedsDisplayRect(const WebCore::FloatRect&) OVERRIDE; const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } - // Updates the visibleLayerRect(). + // Updates the visibleContentRect(). virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*) OVERRIDE; virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index 435907c94..c206dda5e 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -30,7 +30,6 @@ #include "GraphicsContext3DPrivate.h" #include "ImageBuffer.h" #include "LayerChromium.h" -#include "TextureManager.h" #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCGraphicsContext.h" diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp index db80f5bfe..454dfea2c 100644 --- a/Source/WebKit/chromium/tests/DecimalTest.cpp +++ b/Source/WebKit/chromium/tests/DecimalTest.cpp @@ -211,12 +211,14 @@ TEST_F(DecimalTest, AddSpecialValues) TEST_F(DecimalTest, Ceiling) { EXPECT_EQ(Decimal(1), Decimal(1).ceiling()); + EXPECT_EQ(Decimal(1), encode(1, -10, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling()); EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling()); + EXPECT_EQ(Decimal(0), encode(1, -10, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling()); @@ -229,7 +231,7 @@ TEST_F(DecimalTest, CeilingBigExponent) EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling()); } -TEST_F(DecimalTest, CeilingSmallExponent) +TEST_F(DecimalTest, DISABLED_CeilingSmallExponent) { EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).ceiling()); EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling()); @@ -525,12 +527,14 @@ TEST_F(DecimalTest, EncodedData) TEST_F(DecimalTest, Floor) { EXPECT_EQ(Decimal(1), Decimal(1).floor()); + EXPECT_EQ(Decimal(0), encode(1, -10, Positive).floor()); EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor()); EXPECT_EQ(Decimal(-1), Decimal(-1).floor()); + EXPECT_EQ(Decimal(-1), encode(1, -10, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor()); @@ -543,7 +547,7 @@ TEST_F(DecimalTest, FloorBigExponent) EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor()); } -TEST_F(DecimalTest, FloorSmallExponent) +TEST_F(DecimalTest, DISABLED_FloorSmallExponent) { EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor()); EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).floor()); diff --git a/Source/WebKit/chromium/tests/EventListenerTest.cpp b/Source/WebKit/chromium/tests/EventListenerTest.cpp index 799ac4007..425546952 100644 --- a/Source/WebKit/chromium/tests/EventListenerTest.cpp +++ b/Source/WebKit/chromium/tests/EventListenerTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include "WebDOMEvent.h" #include "WebDOMEventListener.h" #include "WebDOMMutationEvent.h" @@ -78,7 +79,7 @@ public: std::string baseURL("http://www.example.com/"); std::string fileName("listener/mutation_event_listener.html"); bool executeScript = true; - FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); } diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp index e406413dd..a2b1675c0 100644 --- a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp +++ b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include <wtf/StdLibExtras.h> #include "WebFrame.h" #include "WebFrameClient.h" @@ -40,35 +41,16 @@ #include "platform/WebURLResponse.h" #include "WebView.h" #include "WebViewClient.h" -#include <googleurl/src/gurl.h> #include <webkit/support/webkit_support.h> namespace WebKit { namespace FrameTestHelpers { -void registerMockedURLLoad(const std::string& base, const std::string& fileName) -{ - registerMockedURLLoad(GURL(base + fileName), fileName); -} - -void registerMockedURLLoad(GURL url, const std::string& fileName) -{ - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath += "/Source/WebKit/chromium/tests/data/"; - filePath += fileName; - - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); -} - void loadFrame(WebFrame* frame, const std::string& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(GURL(url)); + urlRequest.setURL(URLTestHelpers::toKURL(url)); frame->loadRequest(urlRequest); } diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.h b/Source/WebKit/chromium/tests/FrameTestHelpers.h index fc2fa2d36..bfb57b67c 100644 --- a/Source/WebKit/chromium/tests/FrameTestHelpers.h +++ b/Source/WebKit/chromium/tests/FrameTestHelpers.h @@ -33,8 +33,6 @@ #include <string> -class GURL; - namespace WebKit { class WebFrame; @@ -44,10 +42,6 @@ class WebViewClient; namespace FrameTestHelpers { -void registerMockedURLLoad(const std::string& base, const std::string& fileName); -// Like the previous overload, but it allows more flexibility in the url since it is given by the caller. -void registerMockedURLLoad(GURL, const std::string& fileName); - void loadFrame(WebFrame*, const std::string& url); WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0); diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index e7c655247..fdae37c6a 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -494,7 +494,7 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_FALSE(testLayer->needsDisplay()); // Test properties that should not call needsDisplay and needsCommit when changed. - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleLayerRect(IntRect(0, 0, 40, 50))); + 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)); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 9c9ec25b0..7cdba809c 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -30,6 +30,7 @@ #include "GraphicsContext3D.h" #include "WebCompositor.h" #include "cc/CCDrawQuad.h" +#include "cc/CCPrioritizedTextureManager.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" @@ -76,7 +77,7 @@ public: FakeCCRendererClient() : m_setFullRootLayerDamageCount(0) , m_rootLayer(CCLayerImpl::create(1)) - , m_memoryAllocationLimitBytes(0) + , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) { m_rootLayer->createRenderSurface(); m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); diff --git a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp index 5e321c70d..b0f700a0c 100644 --- a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp +++ b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include "WebView.h" #include <gtest/gtest.h> #include <v8/include/v8-profiler.h> @@ -90,7 +91,7 @@ public: std::string baseURL("http://www.example.com/"); std::string fileName(filename); bool executeScript = true; - FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); } diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp index 7acb31149..59c233632 100644 --- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp @@ -43,6 +43,7 @@ #include "PopupMenuClient.h" #include "PopupMenuChromium.h" #include "RuntimeEnabledFeatures.h" +#include "URLTestHelpers.h" #include "WebDocument.h" #include "WebElement.h" #include "WebFrame.h" @@ -63,6 +64,7 @@ using namespace WebCore; using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -249,15 +251,7 @@ protected: void registerMockedURLLoad(const std::string& fileName) { - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath += "/Source/WebKit/chromium/tests/data/popup/"; - filePath += fileName; - - webkit_support::RegisterMockedURL(WebURL(GURL(baseURL + fileName)), response, WebString::fromUTF8(filePath)); + URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromUTF8("text/html")); } void serveRequests() @@ -269,7 +263,7 @@ protected: { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(GURL(baseURL + fileName))); + urlRequest.setURL(WebURL(toKURL(baseURL + fileName))); frame->loadRequest(urlRequest); } @@ -427,7 +421,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) // mousedown event is held by select node, and we don't simulate the event for the node. // So we can only see mouseup and click event. - EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclick", element.innerText().utf8().data()); // Disable the item at index 1. m_popupMenuClient.setDisabledIndex(1); @@ -439,7 +433,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) simulateLeftMouseUpEvent(row1Point); // The item at index 1 is disabled, so the text should not be changed. - EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclick", element.innerText().utf8().data()); showPopup(); // menuItemHeight * 2.5 means the Y position on the item at index 2. @@ -448,7 +442,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) simulateLeftMouseUpEvent(row1Point); // The item is changed to the item at index 2, from index 0, so change event is fired. - EXPECT_STREQ("upclickchangeupclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclickchangeupclick", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent) @@ -469,7 +463,7 @@ TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent) WebElement element = m_webView->mainFrame()->document().getElementById("message"); // We only can see change event but no other mouse related events. - EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("change", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) @@ -491,7 +485,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) simulateLeftMouseUpEvent(row1Point); WebElement element = m_webView->mainFrame()->document().getElementById("message"); - EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("change", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) @@ -513,7 +507,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) simulateLeftMouseUpEvent(row1Point); WebElement element = m_webView->mainFrame()->document().getElementById("message"); - EXPECT_STREQ("click", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("click", element.innerText().utf8().data()); } } // namespace diff --git a/Source/WebKit/chromium/tests/RunAllTests.cpp b/Source/WebKit/chromium/tests/RunAllTests.cpp index dc0528257..78fd7da3d 100644 --- a/Source/WebKit/chromium/tests/RunAllTests.cpp +++ b/Source/WebKit/chromium/tests/RunAllTests.cpp @@ -28,6 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if WEBKIT_IMPLEMENTATION +#include "config.h" +#endif + // FIXME: Avoid this source dependency on Chromium's base module. #include <base/test/test_suite.h> diff --git a/Source/WebKit/chromium/tests/TextureManagerTest.cpp b/Source/WebKit/chromium/tests/TextureManagerTest.cpp deleted file mode 100644 index d5313f5dc..000000000 --- a/Source/WebKit/chromium/tests/TextureManagerTest.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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 "CCTiledLayerTestCommon.h" -#include "ManagedTexture.h" -#include "TextureManager.h" - -#include <gtest/gtest.h> - -using namespace WebCore; -using namespace WebKitTests; -using namespace WTF; - -namespace { - -class TextureManagerTest : public testing::Test { -public: - TextureManagerTest() - : m_textureSize(256, 256) - , m_textureFormat(GraphicsContext3D::RGBA) - { - } - - virtual ~TextureManagerTest() - { - } - - size_t texturesMemorySize(size_t textureCount) - { - return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; - } - - PassOwnPtr<TextureManager> createTextureManager(size_t maxTextures, size_t preferredTextures) - { - return TextureManager::create(texturesMemorySize(maxTextures), texturesMemorySize(preferredTextures), 1024); - } - - bool requestTexture(TextureManager* manager, TextureToken token) - { - bool result = manager->requestTexture(token, m_textureSize, m_textureFormat); - if (result) - manager->allocateTexture(&m_fakeTextureAllocator, token); - return result; - } - -private: - FakeTextureAllocator m_fakeTextureAllocator; - const IntSize m_textureSize; - const GC3Denum m_textureFormat; -}; - -TEST_F(TextureManagerTest, requestTextureInPreferredLimit) -{ - const size_t preferredTextures = 8; - OwnPtr<TextureManager> textureManager = createTextureManager(preferredTextures * 2, preferredTextures); - TextureToken tokens[preferredTextures]; - for (size_t i = 0; i < preferredTextures; ++i) { - tokens[i] = textureManager->getToken(); - if (i) - EXPECT_GT(tokens[i], tokens[i - 1]); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - EXPECT_TRUE(textureManager->isProtected(tokens[i])); - } - - for (size_t i = 0; i < preferredTextures; ++i) - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); -} - -TEST_F(TextureManagerTest, requestTextureExceedingPreferredLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < preferredTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - textureManager->unprotectTexture(tokens[0]); - textureManager->unprotectTexture(tokens[2]); - - for (size_t i = preferredTextures; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - textureManager->unprotectTexture(tokens[4]); - textureManager->unprotectTexture(tokens[5]); - - // These textures should be valid before the reduceMemoryToLimit call. - EXPECT_TRUE(textureManager->hasTexture(tokens[0])); - EXPECT_TRUE(textureManager->hasTexture(tokens[2])); - - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - - EXPECT_FALSE(textureManager->hasTexture(tokens[0])); - EXPECT_TRUE(textureManager->hasTexture(tokens[1])); - EXPECT_TRUE(textureManager->isProtected(tokens[1])); - EXPECT_FALSE(textureManager->hasTexture(tokens[2])); - EXPECT_TRUE(textureManager->hasTexture(tokens[3])); - EXPECT_TRUE(textureManager->isProtected(tokens[3])); - - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); -} - -TEST_F(TextureManagerTest, requestTextureExceedingMaxLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - for (size_t i = 0; i < maxTextures; ++i) { - TextureToken token = textureManager->getToken(); - EXPECT_FALSE(requestTexture(textureManager.get(), token)); - EXPECT_FALSE(textureManager->hasTexture(token)); - } - - EXPECT_EQ(textureManager->currentMemoryUseBytes(), texturesMemorySize(maxTextures)); - - textureManager->unprotectTexture(tokens[1]); - textureManager->unprotectTexture(tokens[3]); - EXPECT_TRUE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_TRUE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_FALSE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_FALSE(textureManager->hasTexture(tokens[1])); - EXPECT_FALSE(textureManager->hasTexture(tokens[3])); -} - -TEST_F(TextureManagerTest, reduceMemoryToLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < preferredTextures + 1; ++i) - textureManager->unprotectTexture(tokens[i]); - - textureManager->reduceMemoryToLimit(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(1)); - EXPECT_EQ(texturesMemorySize(maxTextures - unprotectedTextures), textureManager->currentMemoryUseBytes()); - - // reduceMemoryToLimit doesn't change the current memory limits. - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, setMaxMemoryLimitBytes) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < unprotectedTextures; ++i) - textureManager->unprotectTexture(tokens[i]); - - textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->setMaxMemoryLimitBytes(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->maxMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, setPreferredMemoryLimitBytes) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < unprotectedTextures; ++i) - textureManager->unprotectTexture(tokens[i]); - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - - // Setting preferred memory limit only won't force reduceMemoryToLimit. - textureManager->setPreferredMemoryLimitBytes(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, textureManagerDestroyedBeforeManagedTexture) -{ - OwnPtr<TextureManager> textureManager = createTextureManager(1, 1); - OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManager.get()); - - IntSize size(50, 50); - unsigned format = GraphicsContext3D::RGBA; - - // Texture is initially invalid, but we should be able to reserve. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - textureManager.clear(); - - // Deleting the manager should invalidate the texture and reservation attempts should fail. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_FALSE(managedTexture->reserve(size, format)); -} - -TEST_F(TextureManagerTest, textureMovedToNewManager) -{ - OwnPtr<TextureManager> textureManagerOne = createTextureManager(1, 1); - OwnPtr<TextureManager> textureManagerTwo = createTextureManager(1, 1); - OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManagerOne.get()); - - IntSize size(50, 50); - unsigned format = GraphicsContext3D::RGBA; - - // Texture is initially invalid, but we should be able to reserve. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - // Setting to the same manager should be a no-op. - managedTexture->setTextureManager(textureManagerOne.get()); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - // Setting to a different manager should invalidate the texture. - managedTexture->setTextureManager(textureManagerTwo.get()); - - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); -} - -} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index c277e006e..f152ab4fb 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -101,13 +101,13 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -116,11 +116,11 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); // Invalidates both tiles... - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); // ....but then only update one of them. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(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. @@ -140,13 +140,13 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -159,10 +159,10 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); // Invalidates part of the top tile... - layer->invalidateRect(IntRect(0, 0, 50, 50)); + layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // ....but the area is occluded. occluded.setOcclusion(IntRect(0, 0, 50, 50)); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -184,13 +184,13 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -211,8 +211,8 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // This should recreate and update the deleted textures. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -235,13 +235,13 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) // This invalidates 25 tiles and then paints one visible tile. layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); // We should need idle-painting for 3x3 tiles in the center. @@ -255,9 +255,9 @@ 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); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -295,21 +295,21 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // This requires 4*30000 bytes of memory. IntRect layer2Rect(0, 0, 100, 300); layer2->setBounds(layer2Rect.size()); - layer2->setVisibleLayerRect(layer2Rect); - layer2->invalidateRect(layer2Rect); + layer2->setVisibleContentRect(layer2Rect); + layer2->invalidateContentRect(layer2Rect); // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer. IntRect layerRect(IntPoint::zero(), IntSize(100, 2400)); layer1->setBounds(layerRect.size()); - layer1->setVisibleLayerRect(layerRect); - layer1->invalidateRect(layerRect); + layer1->setVisibleContentRect(layerRect); + layer1->invalidateContentRect(layerRect); // Paint a single tile in layer2 so that it will idle paint. layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer1->updateLayerRect(updater, layerRect, 0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer1->updateContentRect(updater, layerRect, 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); // We should need idle-painting for both remaining tiles in layer2. EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect)); @@ -325,8 +325,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // Now idle paint layer2. We are going to run out of memory though! layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); // Oh well, commit the frame and push. updateTextures(); @@ -345,9 +345,9 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // Now if layer2 becomes fully visible, we should be able to paint it and push valid textures. layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer2->updateLayerRect(updater, layer2Rect, 0); - layer1->updateLayerRect(updater, layerRect, 0); + textureManager->prioritizeTextures(); + layer2->updateContentRect(updater, layer2Rect, 0); + layer1->updateContentRect(updater, layerRect, 0); updateTextures(); layer1->pushPropertiesTo(layerImpl1.get()); @@ -374,12 +374,12 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) layer->setBounds(IntSize(100, 100)); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); - layer->invalidateRect(IntRect(0, 0, 100, 100)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); + layer->invalidateContentRect(IntRect(0, 0, 100, 100)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -398,13 +398,13 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) // However, during the paint, we invalidate one of the tiles. This should // not prevent the tile from being pushed. layer->setBounds(IntSize(100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get()); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -423,22 +423,22 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer2->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); layer1->setTexturePriorities(priorityCalculator); layer2->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); // Invalidate a tile on layer1 layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); @@ -461,21 +461,21 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer2->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); layer1->setTexturePriorities(priorityCalculator); layer2->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Invalidate a tile on layer2 layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); - layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); layer2->pushPropertiesTo(layer2Impl.get()); @@ -504,12 +504,12 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) // Invalidates 9 tiles and then paints one visible tile. layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // Idle-painting should see no more priority tiles for painting. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -521,8 +521,8 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // We shouldn't signal we need another idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -544,14 +544,14 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) IntRect contentRect; layer->setBounds(contentRect.size()); - layer->setVisibleLayerRect(contentRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(contentRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Empty layers don't paint or idle-paint. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); // Empty layers don't have tiles. EXPECT_EQ(0u, layer->numPaintedTiles()); @@ -580,14 +580,14 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) IntRect visibleRect; layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); for (int i = 0; i < 2; i++) { // Paint / idle-paint. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // Non-visible layers don't need idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -632,11 +632,11 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) IntRect visibleRect; layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // If idlePaintRect gives back a non-empty result then we should paint it. Otherwise, // we shoud paint nothing. @@ -648,9 +648,9 @@ 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); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -661,9 +661,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); for (int k = 0; k < 4; ++k) { layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -687,11 +687,11 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); layer->pushPropertiesTo(layerImpl.get()); @@ -700,22 +700,22 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // Invoke updateLayerRect again. As the layer is valid updateLayerRect shouldn't be invoked on + // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on // the LayerTextureUpdater. - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); - layer->invalidateRect(IntRect(0, 0, 50, 50)); - // setRectToInvalidate triggers invalidateRect() being invoked from updateLayerRect. + 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->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // The layer should still be invalid as updateLayerRect invoked invalidate. - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + // 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); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -733,32 +733,32 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->setBounds(layerBounds.size()); layer->setContentBounds(contentBounds.size()); - layer->setVisibleLayerRect(contentBounds); + layer->setVisibleContentRect(contentBounds); // On first update, the updateRect includes all tiles, even beyond the boundaries of the layer. // However, it should still be in layer space, not content space. - layer->invalidateRect(contentBounds); + layer->invalidateContentRect(contentBounds); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(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); - textureManager->prioritizeTextures(0); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(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->invalidateRect(partialDamage); + layer->invalidateContentRect(partialDamage); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } @@ -771,7 +771,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Create a layer with one tile. layer->setBounds(IntSize(100, 100)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); // Invalidate the entire layer. layer->setNeedsDisplay(); @@ -779,8 +779,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Push the tiles to the impl side and check that there is exactly one. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -791,13 +791,13 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Change the contents scale and verify that the content rectangle requiring painting // is not scaled. layer->setContentsScale(2); - layer->setVisibleLayerRect(IntRect(0, 0, 200, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 200, 200)); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); // The impl side should get 2x2 tiles now. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 200, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 200, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -809,8 +809,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // impl side. layer->setNeedsDisplay(); layer->setTexturePriorities(priorityCalculator); - layer->updateLayerRect(updater, IntRect(1, 0, 0, 1), 0); - textureManager->prioritizeTextures(0); + layer->updateContentRect(updater, IntRect(1, 0, 0, 1), 0); + textureManager->prioritizeTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -839,13 +839,13 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) rootLayer->addChild(childLayer); rootLayer->setBounds(contentBounds); - rootLayer->setVisibleLayerRect(contentRect); + rootLayer->setVisibleContentRect(contentRect); rootLayer->setPosition(FloatPoint(150, 150)); childLayer->setBounds(contentBounds); - childLayer->setVisibleLayerRect(contentRect); + childLayer->setVisibleContentRect(contentRect); childLayer->setPosition(FloatPoint(150, 150)); - rootLayer->invalidateRect(contentRect); - childLayer->invalidateRect(contentRect); + rootLayer->invalidateContentRect(contentRect); + childLayer->invalidateContentRect(contentRect); ccLayerTreeHost->setRootLayer(rootLayer); ccLayerTreeHost->setViewportSize(IntSize(300, 300)); @@ -876,15 +876,15 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); layer->setBounds(IntSize(700, 700)); - layer->setVisibleLayerRect(IntRect(0, 0, 700, 700)); - layer->invalidateRect(IntRect(0, 0, 700, 700)); + layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); + layer->invalidateContentRect(IntRect(0, 0, 700, 700)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); layer->setBounds(IntSize(200, 200)); - layer->invalidateRect(IntRect(0, 0, 200, 200)); + layer->invalidateContentRect(IntRect(0, 0, 200, 200)); } TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) @@ -894,13 +894,13 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) int size = 1 << 30; layer->setBounds(IntSize(size, size)); - layer->setVisibleLayerRect(IntRect(0, 0, 700, 700)); - layer->invalidateRect(IntRect(0, 0, size, size)); + layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); + layer->invalidateContentRect(IntRect(0, 0, size, size)); // Ensure no crash for bounds where size * size would overflow an int. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); } TEST_F(TiledLayerChromiumTest, partialUpdates) @@ -922,8 +922,8 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); layer->setBounds(contentBounds); layer->setPosition(FloatPoint(150, 150)); - layer->setVisibleLayerRect(contentRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(contentRect); + layer->invalidateContentRect(contentRect); ccLayerTreeHost->setRootLayer(layer); ccLayerTreeHost->setViewportSize(IntSize(300, 200)); @@ -946,7 +946,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Full update of 3 tiles and partial update of 3 tiles. - layer->invalidateRect(IntRect(0, 0, 300, 150)); + layer->invalidateContentRect(IntRect(0, 0, 300, 150)); ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; @@ -964,7 +964,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 6 tiles. - layer->invalidateRect(IntRect(50, 50, 200, 100)); + layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -982,7 +982,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Checkerboard all tiles. - layer->invalidateRect(IntRect(0, 0, 300, 200)); + layer->invalidateContentRect(IntRect(0, 0, 300, 200)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -991,7 +991,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 6 checkerboard tiles. - layer->invalidateRect(IntRect(50, 50, 200, 100)); + layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -1009,7 +1009,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 4 tiles. - layer->invalidateRect(IntRect(50, 50, 100, 100)); + layer->invalidateContentRect(IntRect(50, 50, 100, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -1035,12 +1035,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); } @@ -1056,12 +1056,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1071,8 +1071,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); occluded.setOcclusion(IntRect(250, 200, 300, 100)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1082,8 +1082,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); occluded.setOcclusion(IntRect(250, 250, 300, 100)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1104,12 +1104,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 360)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 360)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 360), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 360), &occluded); EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1120,11 +1120,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 350)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 350)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 350), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 350), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1135,11 +1135,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // Now the visible region is even smaller than the occlusion, it should have the same result. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 340)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 340)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 340), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 340), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1160,11 +1160,11 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 600)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); updateTextures(); @@ -1175,7 +1175,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1200,11 +1200,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 50)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1228,11 +1228,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(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. @@ -1248,11 +1248,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // a different layer space. In this case the occluded region catches the // blown up tiles. occluded.setOcclusion(IntRect(200, 200, 300, 200)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1268,11 +1268,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1296,16 +1296,16 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->setBounds(contentBounds.size()); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(visibleBounds); + layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1317,8 +1317,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // visibleContentOpaqueRegion should match the visible part of what is painted opaque. opaquePaintRect = IntRect(10, 10, 90, 190); layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1331,7 +1331,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1345,8 +1345,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(0, 0, 1, 1)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(0, 0, 1, 1)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1360,8 +1360,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(10, 10, 1, 1)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(10, 10, 1, 1)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); @@ -1389,16 +1389,16 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->setBounds(contentBounds.size()); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(visibleBounds); + layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Invalidates and paints the whole layer. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1411,9 +1411,9 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) // Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle, // even though it is not dirty and will not be uploaded. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(0, 0, 1, 1)); - layer->invalidateRect(IntRect(50, 200, 10, 10)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(0, 0, 1, 1)); + layer->invalidateContentRect(IntRect(50, 200, 10, 10)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1448,7 +1448,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->setBounds(rootRect.size()); root->setAnchorPoint(FloatPoint()); - root->setVisibleLayerRect(rootRect); + root->setVisibleContentRect(rootRect); root->addChild(surface); surface->setForceRenderSurface(true); @@ -1460,20 +1460,20 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->setBounds(childRect.size()); child->setAnchorPoint(FloatPoint()); child->setPosition(childRect.location()); - child->setVisibleLayerRect(childRect); + child->setVisibleContentRect(childRect); child2->setBounds(child2Rect.size()); child2->setAnchorPoint(FloatPoint()); child2->setPosition(child2Rect.location()); - child2->setVisibleLayerRect(child2Rect); + child2->setVisibleContentRect(child2Rect); ccLayerTreeHost->setRootLayer(root); ccLayerTreeHost->setViewportSize(rootRect.size()); // With a huge memory limit, all layers should update and push their textures. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; @@ -1506,9 +1506,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca // With a memory limit that includes only the root layer (3x2 tiles) and half the surface that // the child layers draw into, the child layers will not be allocated. If the surface isn't // accounted for, then one of the children would fit within the memory limit. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, (3 * 2 + 3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; @@ -1542,9 +1542,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca // allocated. If render surface memory wasn't accounted for, there is enough space // for one of the children layers, but they draw into a surface that can't be // allocated. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, (3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; @@ -1633,13 +1633,13 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) IntRect contentRect(0, 0, 45, 47); EXPECT_EQ(contentRect.size(), layer->contentBounds()); - layer->setVisibleLayerRect(contentRect); + layer->setVisibleContentRect(contentRect); layer->setTexturePriorities(calculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1647,8 +1647,8 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) updateTextures(); // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. - layer->invalidateRect(contentRect); - layer->updateLayerRect(updater, contentRect, 0); + layer->invalidateContentRect(contentRect); + layer->updateContentRect(updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } @@ -1666,13 +1666,13 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali layer->setContentsScale(1.3); IntRect contentRect(IntPoint(), layer->contentBounds()); - layer->setVisibleLayerRect(contentRect); + layer->setVisibleContentRect(contentRect); layer->setTexturePriorities(calculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1681,7 +1681,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.cpp b/Source/WebKit/chromium/tests/URLTestHelpers.cpp new file mode 100644 index 000000000..b2e6039d1 --- /dev/null +++ b/Source/WebKit/chromium/tests/URLTestHelpers.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "URLTestHelpers.h" + +#include "platform/WebURLResponse.h" +#include <public/WebString.h> +#include <public/WebURL.h> +#include <webkit/support/webkit_support.h> + +namespace WebKit { +namespace URLTestHelpers { + +void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType) +{ + // fullURL = baseURL + fileName. + std::string fullString = std::string(baseURL.utf8().data()) + std::string(fileName.utf8().data()); + registerMockedURLLoad(toKURL(fullString.c_str()), fileName, WebString::fromUTF8(""), mimeType); +} + +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType) +{ + registerMockedURLLoad(fullURL, fileName, WebString::fromUTF8(""), mimeType); +} + +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType) +{ + WebURLResponse response; + response.initialize(); + response.setMIMEType(mimeType); + response.setHTTPStatusCode(200); + + // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName. + std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data()); + filePath.append("/Source/WebKit/chromium/tests/data/"); + filePath.append(std::string(relativeBaseDirectory.utf8().data())); + filePath.append(std::string(fileName.utf8().data())); + + webkit_support::RegisterMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str())); +} + +} // namespace URLTestHelpers +} // namespace WebKit diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.h b/Source/WebKit/chromium/tests/URLTestHelpers.h new file mode 100644 index 000000000..0b9fb00bb --- /dev/null +++ b/Source/WebKit/chromium/tests/URLTestHelpers.h @@ -0,0 +1,61 @@ +/* + * 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 URLTestHelpers_h +#define URLTestHelpers_h + +#include "KURL.h" +#include <public/WebString.h> + +namespace WebKit { + +class WebURL; + +namespace URLTestHelpers { + +inline WebCore::KURL toKURL(const std::string& url) +{ + WTF::String wtfString(url.c_str()); + return WebCore::KURL(WebCore::ParsedURLString, wtfString); +} + +// Helper functions for mock URLs. These functions set up the desired URL and mimeType, with a 200 OK return status. +// For the mock URL, fullURL == baseURL + fileName. +// For the actual file path: <WebKit root directory> + relativeBaseDirectory + fileName, +// or, if the relative base directory is not specified: <WebKit root directory> + fileName. +// +void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html")); +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html")); +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType); + +} // namespace URLTestHelpers +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 6b14cff0f..9b745e029 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -36,6 +36,7 @@ #include "FrameTestHelpers.h" #include "FrameView.h" #include "ResourceError.h" +#include "URLTestHelpers.h" #include "WebDataSource.h" #include "WebDocument.h" #include "WebFindOptions.h" @@ -55,6 +56,7 @@ #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -73,12 +75,12 @@ public: void registerMockedHttpURLLoad(const std::string& fileName) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); } void registerMockedChromeURLLoad(const std::string& fileName) { - FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL.c_str()), WebString::fromUTF8(fileName.c_str())); } protected: @@ -96,7 +98,7 @@ TEST_F(WebFrameTest, ContentText) WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html"); // Now retrieve the frames text and test it only includes visible elements. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find(" visible paragraph")); EXPECT_NE(std::string::npos, content.find(" visible iframe")); EXPECT_EQ(std::string::npos, content.find(" invisible pararaph")); @@ -156,7 +158,7 @@ TEST_F(WebFrameTest, ChromePageJavascript) webView->layout(); // Now retrieve the frame's text and ensure it was modified by running javascript. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find("Clobbered")); } @@ -175,7 +177,7 @@ TEST_F(WebFrameTest, ChromePageNoJavascript) webView->layout(); // Now retrieve the frame's text and ensure it wasn't modified by running javascript. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_EQ(std::string::npos, content.find("Clobbered")); } @@ -187,7 +189,7 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true); // Send a message with the correct origin. - WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL))); + WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL))); WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent"); WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); @@ -195,14 +197,14 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message); // Send another message with incorrect origin. - WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL))); + WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL))); webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message); // Required to see any updates in contentAsText. webView->layout(); // Verify that only the first addition is in the body of the page. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find("Message 1.")); EXPECT_EQ(std::string::npos, content.find("Message 2.")); } @@ -441,13 +443,13 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) float previousScale = webViewImpl->pageScaleFactor(); // Reload the page using the cache. - webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + secondURL), false); + webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false); webkit_support::ServeAsynchronousMockedRequests(); ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); // Reload the page while ignoring the cache. - webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + thirdURL), true); + webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), true); webkit_support::ServeAsynchronousMockedRequests(); ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); @@ -469,8 +471,8 @@ TEST_F(WebFrameTest, IframeRedirect) WebVector<WebURL> redirects; iframeDataSource->redirectChain(redirects); ASSERT_EQ(2U, redirects.size()); - EXPECT_EQ(GURL("about:blank"), GURL(redirects[0])); - EXPECT_EQ(GURL("http://www.test.com/visible_iframe.html"), GURL(redirects[1])); + EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data())); + EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data())); webView->close(); } @@ -731,19 +733,19 @@ TEST_F(WebFrameTest, GetContentAsPlainText) // Generate a simple test case. const char simpleSource[] = "<div>Foo bar</div><div></div>baz"; - GURL testURL("about:blank"); + WebCore::KURL testURL = toKURL("about:blank"); frame->loadHTMLString(simpleSource, testURL); webkit_support::RunAllPendingMessages(); // Make sure it comes out OK. const std::string expected("Foo bar\nbaz"); WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ(expected, std::string(text.utf8())); + EXPECT_EQ(expected, std::string(text.utf8().data())); // Try reading the same one with clipping of the text. const int length = 5; text = frame->contentAsText(length); - EXPECT_EQ(expected.substr(0, length), std::string(text.utf8())); + EXPECT_EQ(expected.substr(0, length), std::string(text.utf8().data())); // Now do a new test with a subframe. const char outerFrameSource[] = "Hello<iframe></iframe> world"; @@ -757,12 +759,12 @@ TEST_F(WebFrameTest, GetContentAsPlainText) webkit_support::RunAllPendingMessages(); text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8())); + EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8().data())); // Get the frame text where the subframe separator falls on the boundary of // what we'll take. There used to be a crash in this case. text = frame->contentAsText(12); - EXPECT_EQ("Hello world", std::string(text.utf8())); + EXPECT_EQ("Hello world", std::string(text.utf8().data())); webView->close(); } @@ -774,23 +776,23 @@ TEST_F(WebFrameTest, GetFullHtmlOfPage) // Generate a simple test case. const char simpleSource[] = "<p>Hello</p><p>World</p>"; - GURL testURL("about:blank"); + WebCore::KURL testURL = toKURL("about:blank"); frame->loadHTMLString(simpleSource, testURL); webkit_support::RunAllPendingMessages(); WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data())); - const std::string html = frame->contentAsMarkup().utf8(); + const std::string html = std::string(frame->contentAsMarkup().utf8().data()); // Load again with the output html. - frame->loadHTMLString(html, testURL); + frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL); webkit_support::RunAllPendingMessages(); - EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8())); + EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data())); text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data())); // Test selection check EXPECT_FALSE(frame->hasSelection()); diff --git a/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp b/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp index 5c3ba98a0..3ea4fcf9e 100644 --- a/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp +++ b/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebPageSerializer.h" @@ -41,11 +42,12 @@ #include "platform/WebURLResponse.h" #include "WebView.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; +using WebKit::URLTestHelpers::registerMockedURLLoad; namespace { @@ -110,41 +112,29 @@ protected: m_webView->close(); } - void registerMockedURLLoad(const WebURL& url, const WebString& fileName, const WebString& mimeType) - { - WebURLResponse response; - response.initialize(); - response.setMIMEType(mimeType); - response.setHTTPStatusCode(200); - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath.append("/Source/WebKit/chromium/tests/data/pageserializer/"); - filePath.append(fileName.utf8()); - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); - } - WebURL setUpCSSTestPage() { - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); return topFrameURL; } - void loadURLInTopFrame(const GURL& url) + void loadURLInTopFrame(const WebURL& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(url)); + urlRequest.setURL(url); m_webView->mainFrame()->loadRequest(urlRequest); // Make sure any pending request get served. webkit_support::ServeAsynchronousMockedRequests(); @@ -161,7 +151,7 @@ protected: static bool resourceVectorContains(const WebVector<WebPageSerializer::Resource>& resources, const char* url, const char* mimeType) { - WebURL webURL = WebURL(GURL(url)); + WebURL webURL = WebURL(toKURL(url)); for (size_t i = 0; i < resources.size(); ++i) { const WebPageSerializer::Resource& resource = resources[i]; if (resource.url == webURL && !resource.data.isEmpty() && !resource.mimeType.compare(WebCString(mimeType))) @@ -184,13 +174,13 @@ private: TEST_F(WebPageNewSerializeTest, PageWithFrames) { // Register the mocked frames. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); loadURLInTopFrame(topFrameURL); @@ -200,7 +190,7 @@ TEST_F(WebPageNewSerializeTest, PageWithFrames) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -227,7 +217,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -249,11 +239,11 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources) TEST_F(WebPageNewSerializeTest, BlankFrames) { // Register the mocked frame and load it. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); loadURLInTopFrame(topFrameURL); @@ -263,7 +253,7 @@ TEST_F(WebPageNewSerializeTest, BlankFrames) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -279,8 +269,8 @@ TEST_F(WebPageNewSerializeTest, BlankFrames) TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration) { - WebURL topFrameURL = GURL("http://www.test.com/simple.xhtml"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), xhtmlMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com/simple.xhtml"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), WebString::fromUTF8("pageserializer/"), xhtmlMimeType()); loadURLInTopFrame(topFrameURL); @@ -290,7 +280,7 @@ TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration) // We expect only one resource, the XML. ASSERT_EQ(1U, resources.size()); - std::string xml = resources[0].data; + std::string xml = std::string(resources[0].data.data()); // We should have one and only one instance of the XML declaration. size_t pos = xml.find("<?xml version="); @@ -310,7 +300,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_TestMHTMLEncoding) ASSERT_FALSE(mhtmlData.isEmpty()); // Read the MHTML data line per line and do some pseudo-parsing to make sure the right encoding is used for the different sections. - LineReader lineReader(mhtmlData); + LineReader lineReader(std::string(mhtmlData.data())); int sectionCheckedCount = 0; const char* expectedEncoding = 0; std::string line; diff --git a/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp b/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp index aa0c6dc2a..feb5f7f6f 100644 --- a/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp +++ b/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebPageSerializer.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "platform/WebString.h" @@ -39,11 +40,11 @@ #include "platform/WebURLResponse.h" #include "WebView.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -73,22 +74,16 @@ protected: m_webView->close(); } - void registerMockedURLLoad(const WebURL& url, const WebString& fileName) + void registerMockedURLLoad(const std::string& url, const WebString& fileName) { - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath.append("/Source/WebKit/chromium/tests/data/pageserialization/"); - filePath.append(fileName.utf8()); - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); + URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::fromUTF8("pageserialization/"), WebString::fromUTF8("text/html")); } - void loadURLInTopFrame(const GURL& url) + void loadURLInTopFrame(const WebURL& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(url)); + urlRequest.setURL(url); m_webView->mainFrame()->loadRequest(urlRequest); // Make sure any pending request get served. webkit_support::ServeAsynchronousMockedRequests(); @@ -96,7 +91,7 @@ protected: static bool webVectorContains(const WebVector<WebURL>& vector, const char* url) { - return vector.contains(WebURL(GURL(url))); + return vector.contains(WebURL(toKURL(std::string(url)))); } // Useful for debugging. @@ -116,8 +111,8 @@ private: TEST_F(WebPageSerializerTest, HTMLNodes) { // Register the mocked frame and load it. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple_page.html")); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("simple_page.html")); loadURLInTopFrame(topFrameURL); // Retrieve all resources. @@ -150,18 +145,18 @@ TEST_F(WebPageSerializerTest, HTMLNodes) TEST_F(WebPageSerializerTest, MultipleFrames) { // Register the mocked frames. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html")); - registerMockedURLLoad(GURL("http://www.test.com/simple_iframe.html"), + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("top_frame.html")); + registerMockedURLLoad("http://www.test.com/simple_iframe.html", WebString::fromUTF8("simple_iframe.html")); - registerMockedURLLoad(GURL("http://www.test.com/object_iframe.html"), + registerMockedURLLoad("http://www.test.com/object_iframe.html", WebString::fromUTF8("object_iframe.html")); - registerMockedURLLoad(GURL("http://www.test.com/embed_iframe.html"), + registerMockedURLLoad("http://www.test.com/embed_iframe.html", WebString::fromUTF8("embed_iframe.html")); // If we don't register a mocked resource for awesome.png, it causes the // document loader of the iframe that has it as its src to assert on close, // not sure why. - registerMockedURLLoad(GURL("http://www.test.com/awesome.png"), + registerMockedURLLoad("http://www.test.com/awesome.png", WebString::fromUTF8("awesome.png")); loadURLInTopFrame(topFrameURL); diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 7903721d9..33ce2f70c 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -35,6 +35,7 @@ #include "FrameTestHelpers.h" #include "FrameView.h" #include "HTMLDocument.h" +#include "URLTestHelpers.h" #include "WebDocument.h" #include "WebFrame.h" #include "WebFrameClient.h" @@ -42,11 +43,11 @@ #include "platform/WebSize.h" #include "WebViewClient.h" #include "WebViewImpl.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -140,7 +141,7 @@ protected: TEST_F(WebViewTest, FocusIsInactive) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); webView->setFocus(true); @@ -168,7 +169,7 @@ TEST_F(WebViewTest, FocusIsInactive) TEST_F(WebViewTest, ActiveState) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); ASSERT_TRUE(webView); @@ -192,7 +193,7 @@ void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& ma { AutoResizeWebViewClient client; std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageHeight; - FrameTestHelpers::registerMockedURLLoad(GURL(url), "specify_size.html"); + URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true, 0, &client); client.testData().setWebView(webView); @@ -291,7 +292,7 @@ TEST_F(WebViewTest, AutoResizeMaxSize) void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str())); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile); webView->setInitialFocus(false); EXPECT_EQ(expectedType, webView->textInputType()); @@ -331,7 +332,7 @@ TEST_F(WebViewTest, DISABLED_TextInputType) TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_populated.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html"); webView->setInitialFocus(false); webView->setEditableSelectionOffsets(5, 13); @@ -345,7 +346,7 @@ TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) EXPECT_EQ(-1, info.compositionEnd); webView->close(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "content_editable_populated.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html")); webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_editable_populated.html"); webView->setInitialFocus(false); webView->setEditableSelectionOffsets(8, 19); @@ -364,12 +365,12 @@ TEST_F(WebViewTest, FormChange) { FormChangeWebViewClient client; client.reset(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_set_value_while_focused.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_set_value_while_focused.html")); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_set_value_while_focused.html", true, 0, &client); EXPECT_TRUE(client.called()); EXPECT_TRUE(client.focused()); client.reset(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_set_value_while_not_focused.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_set_value_while_not_focused.html")); webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_set_value_while_not_focused.html", true, 0, &client); EXPECT_TRUE(client.called()); EXPECT_FALSE(client.focused()); diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 141f8bf1b..7c379dcee 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,38 @@ +2012-07-13 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Add const to the parameter of getters in ewk_security_origin + https://bugs.webkit.org/show_bug.cgi?id=90954 + + Reviewed by Kentaro Hara. + + Move initialization of strings for protocol and host to the ewk_security_origin_new method, + which allows to add const qualifier for ewk_security_origin_protocol_get and ewk_security_origin_host_get. + In addition, add null checks to the getters. + + * ewk/ewk_security_origin.cpp: + (ewk_security_origin_protocol_get): + (ewk_security_origin_host_get): + (ewk_security_origin_new): + * ewk/ewk_security_origin.h: + +2012-07-13 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Add *explicit* keyword to constructor which has a parameter + https://bugs.webkit.org/show_bug.cgi?id=91207 + + Reviewed by Zoltan Herczeg. + + Add *explicit* keyword to contructor which has a parameter in order to avoid implicit type conversion. + + * WebCoreSupport/EditorClientEfl.h: + (EditorClientEfl): + * WebCoreSupport/InspectorClientEfl.h: + (InspectorClientEfl): + * WebCoreSupport/PageClientEfl.h: + (PageClientEfl): + * WebCoreSupport/VibrationClientEfl.h: + (VibrationClientEfl): + 2012-07-10 Adam Barth <abarth@webkit.org> LayoutTestController.dumpConfigurationForViewport should move to Internals diff --git a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h index d1feeb477..2a8ff4fe4 100644 --- a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h @@ -77,7 +77,7 @@ protected: WTF::Deque<WTF::RefPtr<WebCore::UndoStep> > redoStack; public: - EditorClientEfl(Evas_Object *view); + explicit EditorClientEfl(Evas_Object* view); ~EditorClientEfl(); // from EditorClient diff --git a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h index b6a078e72..6b71c4dc5 100644 --- a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h @@ -43,7 +43,7 @@ class Page; class InspectorClientEfl : public InspectorClient { public: - InspectorClientEfl(Evas_Object*); + explicit InspectorClientEfl(Evas_Object*); ~InspectorClientEfl(); virtual void inspectorDestroyed(); diff --git a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h index 6f98d701c..8ba75443c 100644 --- a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h @@ -31,7 +31,7 @@ class GraphicsContext3D; class PageClientEfl { public: - PageClientEfl(Evas_Object* view); + explicit PageClientEfl(Evas_Object* view); virtual ~PageClientEfl(); #if USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h b/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h index e7b0d925a..7d2f8fd8f 100644 --- a/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h @@ -27,7 +27,7 @@ namespace WebCore { class VibrationClientEfl : public VibrationClient { public: - VibrationClientEfl(Evas_Object* view); + explicit VibrationClientEfl(Evas_Object* view); virtual ~VibrationClientEfl() { } virtual void vibrate(const unsigned long& time); diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.cpp b/Source/WebKit/efl/ewk/ewk_security_origin.cpp index 66064a029..076158663 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.cpp +++ b/Source/WebKit/efl/ewk/ewk_security_origin.cpp @@ -39,19 +39,15 @@ struct _Ewk_Security_Origin { const char* host; }; -const char* ewk_security_origin_protocol_get(Ewk_Security_Origin* origin) +const char* ewk_security_origin_protocol_get(const Ewk_Security_Origin* origin) { - if (!origin->protocol) - origin->protocol = eina_stringshare_add(origin->securityOrigin->protocol().utf8().data()); - + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); return origin->protocol; } -const char* ewk_security_origin_host_get(Ewk_Security_Origin* origin) +const char* ewk_security_origin_host_get(const Ewk_Security_Origin* origin) { - if (!origin->host) - origin->host = eina_stringshare_add(origin->securityOrigin->host().utf8().data()); - + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); return origin->host; } @@ -142,8 +138,8 @@ Ewk_Security_Origin* ewk_security_origin_new(WebCore::SecurityOrigin* coreOrigin Ewk_Security_Origin* origin = new Ewk_Security_Origin; origin->securityOrigin = coreOrigin; - origin->host = 0; - origin->protocol = 0; + origin->protocol = eina_stringshare_add(coreOrigin->protocol().utf8().data()); + origin->host = eina_stringshare_add(coreOrigin->host().utf8().data()); return origin; } diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.h b/Source/WebKit/efl/ewk/ewk_security_origin.h index 98abf769a..2d9ea4675 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.h +++ b/Source/WebKit/efl/ewk/ewk_security_origin.h @@ -49,9 +49,9 @@ typedef struct _Ewk_Security_Origin Ewk_Security_Origin; * It returns a internal string which should not * be modified. The string is guaranteed to be stringshared. * - * @return the protocol scheme + * @return the protocol scheme or @c 0 if there is not a protocol scheme */ -EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_protocol_get(const Ewk_Security_Origin *o); /** * Returns the host of the security origin. @@ -61,9 +61,9 @@ EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin * * * @param o security origin object * - * @return the host domain + * @return the host domain or @c 0 if there is not a host scheme */ -EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_host_get(const Ewk_Security_Origin *o); /** * Returns the port of the security origin. diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index c89cbcf1f..25de1125e 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,137 @@ +2012-07-14 Benjamin Poulain <bpoulain@apple.com> + + [Mac] Do not try to update the cache model for every WebPreferences change + https://bugs.webkit.org/show_bug.cgi?id=91302 + + Reviewed by Joseph Pecoraro. + + WebView was listening to any change on any WebPreferences in order to update the cache model. This is unneeded in most cases, + we can just listen to updates of the CacheModel property. + + * WebView/WebPreferences.mm: + (-[WebPreferences initWithIdentifier:]): + (-[WebPreferences _postCacheModelChangedNotification]): + (-[WebPreferences setCacheModel:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (+[WebView initialize]): + (+[WebView _cacheModelChangedNotification:]): + +2012-07-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122665. + http://trac.webkit.org/changeset/122665 + https://bugs.webkit.org/show_bug.cgi?id=91321 + + Broke Mac builds (Requested by rniwa on #webkit). + + * WebView/WebPreferences.mm: + (-[WebPreferences initWithIdentifier:]): + (-[WebPreferences setCacheModel:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (+[WebView initialize]): + (+[WebView _preferencesChangedNotification:]): + +2012-07-13 Benjamin Poulain <bpoulain@apple.com> + + [Mac] Do not try to update the cache model for every WebPreferences change + https://bugs.webkit.org/show_bug.cgi?id=91302 + + Reviewed by Joseph Pecoraro. + + WebView was listening to any change on any WebPreferences in order to update the cache model. This is unneeded in most cases, + we can just listen to updates of the CacheModel property. + + * WebView/WebPreferences.mm: + (-[WebPreferences initWithIdentifier:]): + (-[WebPreferences _postCacheModelChangedNotification]): + (-[WebPreferences setCacheModel:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (+[WebView initialize]): + (+[WebView _cacheModelChangedNotification:]): + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Fix a logic error in the #if so that the correct code is compiled on Snow Leopard. + + I introduced this in r122403 when I inverted the sense of the #if. + + * WebView/WebFullScreenController.mm: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes + + Reviewed by Dan Bernstein. + + * WebView/WebFullScreenController.mm: + (convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists + but otherwise provides a compatibility implementation of it. + (-[WebFullScreenController enterFullScreen:]): Call our new helper. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * DefaultDelegates/WebDefaultContextMenuDelegate.mm: + * Misc/WebKitErrors.m: + * Misc/WebNSControlExtras.m: + * Misc/WebNSFileManagerExtras.mm: + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + * Plugins/WebBaseNetscapePluginView.mm: + * Plugins/WebNetscapePluginView.mm: + * WebCoreSupport/WebChromeClient.mm: + * WebCoreSupport/WebEditorClient.mm: + * WebCoreSupport/WebFrameLoaderClient.mm: + * WebCoreSupport/WebSystemInterface.mm: + * WebView/WebClipView.mm: + * WebView/WebDynamicScrollBarsView.mm: + * WebView/WebFrameView.mm: + * WebView/WebFullScreenController.mm: + * WebView/WebHTMLView.mm: + * WebView/WebHTMLViewInternal.h: + * WebView/WebPDFDocumentExtras.mm: + * WebView/WebPreferences.mm: + * WebView/WebResourceInternal.h: + * WebView/WebScriptDebugDelegate.h: + * WebView/WebView.mm: + * WebView/WebViewPrivate.h: + +2012-07-11 Anders Carlsson <andersca@apple.com> + + Add -Wtautological-compare and -Wsign-compare warning flags + https://bugs.webkit.org/show_bug.cgi?id=90994 + + Reviewed by Mark Rowe. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Add a Mountain Lion version of libWebKitSystemInterface.a. + + Reviewed by John Sullivan. + + * Configurations/DebugRelease.xcconfig: Look for the library under its expected name. + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/mac/Configurations/Base.xcconfig b/Source/WebKit/mac/Configurations/Base.xcconfig index e5c0d263b..d35aea68a 100644 --- a/Source/WebKit/mac/Configurations/Base.xcconfig +++ b/Source/WebKit/mac/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors; +COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; @@ -51,6 +51,7 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_SIGN_COMPARE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR); PREBINDING = NO; @@ -100,15 +101,12 @@ DEAD_CODE_STRIPPING = YES; SECTORDER_FLAGS = -Wl,-order_file,mac/WebKit.order; -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Source/WebKit/mac/Configurations/DebugRelease.xcconfig b/Source/WebKit/mac/Configurations/DebugRelease.xcconfig index eb9259b6d..086c31aa8 100644 --- a/Source/WebKit/mac/Configurations/DebugRelease.xcconfig +++ b/Source/WebKit/mac/Configurations/DebugRelease.xcconfig @@ -57,5 +57,5 @@ WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_macos WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1050 = WebKitSystemInterfaceLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1060 = WebKitSystemInterfaceSnowLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1070 = WebKitSystemInterfaceLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceLion; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceMountainLion; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceMountainLion; diff --git a/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm b/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm index d3eff92e9..7466618b8 100644 --- a/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm +++ b/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm @@ -89,7 +89,7 @@ action = @selector(_searchWithSpotlightFromMenu:); break; case WebMenuItemTagSearchWeb: { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 RetainPtr<CFStringRef> searchProviderName(AdoptCF, WKCopyDefaultSearchProviderDisplayName()); title = [NSString stringWithFormat:UI_STRING_INTERNAL("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get()]; #else @@ -136,7 +136,7 @@ } } -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 1 #else #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 0 diff --git a/Source/WebKit/mac/Misc/WebKitErrors.m b/Source/WebKit/mac/Misc/WebKitErrors.m index b1c6c976b..fe3de8675 100644 --- a/Source/WebKit/mac/Misc/WebKitErrors.m +++ b/Source/WebKit/mac/Misc/WebKitErrors.m @@ -116,7 +116,7 @@ static NSMutableDictionary *descriptions = nil; [userInfo setObject:localizedDescription forKey:NSLocalizedDescriptionKey]; if (contentURL) { [userInfo setObject:contentURL forKey:@"NSErrorFailingURLKey"]; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 [userInfo setObject:[contentURL _web_userVisibleString] forKey:NSErrorFailingURLStringKey]; #else [userInfo setObject:[contentURL _web_userVisibleString] forKey:NSURLErrorFailingURLStringErrorKey]; diff --git a/Source/WebKit/mac/Misc/WebNSControlExtras.m b/Source/WebKit/mac/Misc/WebNSControlExtras.m index 6edf84f6b..81b5c858f 100644 --- a/Source/WebKit/mac/Misc/WebNSControlExtras.m +++ b/Source/WebKit/mac/Misc/WebNSControlExtras.m @@ -46,7 +46,7 @@ NSRect windowFrame = [window frame]; CGFloat backingScaleFactor; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 backingScaleFactor = [window backingScaleFactor]; #else backingScaleFactor = [window userSpaceScaleFactor]; diff --git a/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm b/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm index fa150233d..e7a804398 100644 --- a/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm +++ b/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm @@ -36,7 +36,7 @@ #import <sys/stat.h> #import <wtf/RetainPtr.h> -#ifdef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 extern "C" DADiskRef DADiskCreateFromVolumePath(CFAllocatorRef allocator, DASessionRef session, CFURLRef path); #endif diff --git a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 165a00662..e38ae95b2 100644 --- a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -125,7 +125,7 @@ extern "C" { if (accleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) { // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView. -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry // in order to get the coordinate system right. RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.leakRef()); diff --git a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index 85d7aba42..0f1301314 100644 --- a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -102,7 +102,7 @@ using namespace WebCore; _baseURL.adoptNS([baseURL copy]); _MIMEType.adoptNS([MIME copy]); -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Enable "kiosk mode" when instantiating the QT plug-in inside of Dashboard. See <rdar://problem/6878105> if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.dashboard.client"] && [_pluginPackage.get() bundleIdentifier] == "com.apple.QuickTime Plugin.plugin") { diff --git a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm index 426405f25..4e1aad495 100644 --- a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -1099,7 +1099,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) #endif if (accleratedCompositingEnabled) { // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView. -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry // in order to get the coordinate system right. RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.leakRef()); @@ -2231,7 +2231,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) break; } case NPNURLVProxy: { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (!value) break; @@ -2341,7 +2341,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) // For now, we'll distinguish older broken versions of Silverlight by asking the plug-in if it resolved its full screen badness. - (void)_workaroundSilverlightFullscreenBug:(BOOL)initializedPlugin { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT(_isSilverlight); NPBool isFullscreenPerformanceIssueFixed = 0; NPPluginFuncs *pluginFuncs = [_pluginPackage.get() pluginFuncs]; diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 2ea0d6672..ed6fa573b 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -818,7 +818,7 @@ void WebChromeClient::elementDidBlur(const WebCore::Node* node) bool WebChromeClient::selectItemWritingDirectionIsNatural() { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return false; #else return true; @@ -827,7 +827,7 @@ bool WebChromeClient::selectItemWritingDirectionIsNatural() bool WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection() { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return true; #else return false; diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index ed83da602..6497c95ee 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -74,7 +74,7 @@ using namespace WebCore; using namespace HTMLNames; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @interface NSSpellChecker (WebNSSpellCheckerDetails) - (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography; @end @@ -698,7 +698,7 @@ void WebEditorClient::textDidChangeInTextArea(Element* element) bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(TextCheckingType type) const { // This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions. -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return type != TextCheckingTypeSpelling; #else return true; @@ -769,7 +769,7 @@ void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector } } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static Vector<TextCheckingResult> core(NSArray *incomingResults, TextCheckingTypeMask checkingTypes) { Vector<TextCheckingResult> results; @@ -852,7 +852,7 @@ static Vector<TextCheckingResult> core(NSArray *incomingResults, TextCheckingTyp void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSString *textString = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO]; NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString range:NSMakeRange(0, [textString length]) types:(checkingTypes|NSTextCheckingTypeOrthography) options:nil inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL]; [textString release]; @@ -895,7 +895,7 @@ bool WebEditorClient::spellingUIIsShowing() void WebEditorClient::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) { guesses.clear(); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSString* language = nil; NSOrthography* orthography = nil; NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; @@ -925,7 +925,7 @@ void WebEditorClient::setInputMethodState(bool) { } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 @interface WebEditorSpellCheckResponder : NSObject { WebEditorClient* _client; @@ -965,7 +965,7 @@ void WebEditorClient::didCheckSucceed(int sequence, NSArray* results) void WebEditorClient::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> request) { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT(!m_textCheckingRequest); m_textCheckingRequest = request; diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index ca78e312c..6364420eb 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -668,7 +668,7 @@ void WebFrameLoaderClient::dispatchDidFirstLayout() WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView]; if ([getWebView(m_webFrame.get()) drawsBackground]) [scrollView setDrawsBackground:YES]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic]; [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic]; #endif @@ -1087,7 +1087,7 @@ void WebFrameLoaderClient::provisionalLoadStarted() WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView]; [scrollView setDrawsBackground:NO]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [scrollView setVerticalScrollElasticity:NSScrollElasticityNone]; [scrollView setHorizontalScrollElasticity:NSScrollElasticityNone]; #endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index d1f2f15ee..102ceff38 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -43,7 +43,7 @@ void InitWebCoreSystemInterface(void) return; INIT(AdvanceDefaultButtonPulseAnimation); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CALayerEnumerateRectsBeingDrawnWithBlock); #endif INIT(CGContextGetShouldSmoothFonts); @@ -119,14 +119,14 @@ void InitWebCoreSystemInterface(void) INIT(GetGlyphsForCharacters); INIT(GetVerticalGlyphsForCharacters); -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 INIT(GetHyphenationLocationBeforeIndex); INIT(GetNSEventMomentumPhase); #endif INIT(CreateCTLineWithUniCharProvider); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(IOSurfaceContextCreate); INIT(IOSurfaceContextCreateImage); INIT(CreateCTTypesetterWithUniCharProviderAndOptions); @@ -174,24 +174,24 @@ void InitWebCoreSystemInterface(void) #if PLATFORM(MAC) // FIXME: We should stop using this file in Chromium. -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CreateVMPressureDispatchOnMainQueue); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 INIT(GetMacOSXVersionString); INIT(ExecutableWasLinkedOnOrBeforeLion); #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CGPathAddRoundedRect); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CFURLRequestAllowAllPostCaching); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS) INIT(FilterIsManagedSession); INIT(FilterCreateInstance); INIT(FilterRelease); diff --git a/Source/WebKit/mac/WebView/WebClipView.mm b/Source/WebKit/mac/WebView/WebClipView.mm index 74709b0a3..d06fef760 100644 --- a/Source/WebKit/mac/WebView/WebClipView.mm +++ b/Source/WebKit/mac/WebView/WebClipView.mm @@ -52,7 +52,7 @@ using namespace WebCore; - (void)_immediateScrollToPoint:(NSPoint)newOrigin; @end -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 @interface NSWindow (WebNSWindowDetails) - (void)_disableDelayedWindowDisplay; - (void)_enableDelayedWindowDisplay; @@ -105,13 +105,13 @@ using namespace WebCore; { _isScrolling = YES; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[self window] _disableDelayedWindowDisplay]; #endif [super _immediateScrollToPoint:newOrigin]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[self window] _enableDelayedWindowDisplay]; #endif diff --git a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 801109473..839b54f67 100644 --- a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -413,7 +413,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; // This call updates the initial position correctly. [self adjustForScrollOriginChange]; -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 NSView *documentView = [self documentView]; if ([documentView isKindOfClass:[WebHTMLView class]]) { WebHTMLView *htmlView = (WebHTMLView *)documentView; @@ -522,7 +522,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; BOOL isContinuous; WKGetWheelEventDeltas(event, &deltaX, &deltaY, &isContinuous); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSEventPhase momentumPhase = [event momentumPhase]; BOOL isLatchingEvent = momentumPhase & NSEventPhaseBegan || momentumPhase & NSEventPhaseStationary; #else diff --git a/Source/WebKit/mac/WebView/WebFrameView.mm b/Source/WebKit/mac/WebView/WebFrameView.mm index 7a09e4e06..c98e33942 100644 --- a/Source/WebKit/mac/WebView/WebFrameView.mm +++ b/Source/WebKit/mac/WebView/WebFrameView.mm @@ -322,7 +322,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl // FIXME: Remove the NSAppKitVersionNumberWithDeferredWindowDisplaySupport check once // once AppKit's Deferred Window Display support is available. -#if defined(BUILDING_ON_LEOPARD) || !defined(NSAppKitVersionNumberWithDeferredWindowDisplaySupport) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 || !defined(NSAppKitVersionNumberWithDeferredWindowDisplaySupport) // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is NO // or has no value. For compatibility with Mac OS X 10.5 and lower, deferred updates are off by default. if (![[NSUserDefaults standardUserDefaults] boolForKey:WebKitEnableDeferredUpdatesPreferenceKey]) diff --git a/Source/WebKit/mac/WebView/WebFullScreenController.mm b/Source/WebKit/mac/WebView/WebFullScreenController.mm index acd698ab4..e64f47407 100644 --- a/Source/WebKit/mac/WebView/WebFullScreenController.mm +++ b/Source/WebKit/mac/WebView/WebFullScreenController.mm @@ -70,20 +70,19 @@ static IntRect screenRectOfContents(Element* element) - (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration; @end -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) -@interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard) -- (NSRect)convertRectToScreen:(NSRect)aRect; -@end - -@implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard) -- (NSRect)convertRectToScreen:(NSRect)rect +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +static NSRect convertRectToScreen(NSWindow *window, NSRect rect) { - NSRect frame = [self frame]; + return [window convertRectToScreen:rect]; +} +#else +static NSRect convertRectToScreen(NSWindow *window, NSRect rect) +{ + NSRect frame = [window frame]; rect.origin.x += frame.origin.x; rect.origin.y += frame.origin.y; return rect; } -@end #endif @interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard) @@ -208,10 +207,9 @@ static IntRect screenRectOfContents(Element* element) if (!screen) screen = [NSScreen mainScreen]; NSRect screenFrame = [screen frame]; - - NSRect webViewFrame = [[_webView window] convertRectToScreen: - [_webView convertRect:[_webView frame] toView:nil]]; - + + NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]); + // Flip coordinate system: webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame); @@ -273,14 +271,14 @@ static IntRect screenRectOfContents(Element* element) WKWindowSetClipRect([self window], windowBounds); NSWindow *webWindow = [_webViewPlaceholder.get() window]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that // behavior here, making sure to reset the animation behavior afterward. NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone]; #endif [webWindow orderOut:self]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [webWindow setAnimationBehavior:animationBehavior]; #endif @@ -323,7 +321,7 @@ static IntRect screenRectOfContents(Element* element) [self _updateMenuAndDockForFullScreen]; NSWindow* webWindow = [_webViewPlaceholder.get() window]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that // behavior here, making sure to reset the animation behavior afterward. NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; @@ -338,7 +336,7 @@ static IntRect screenRectOfContents(Element* element) [webWindow setCollectionBehavior:behavior]; } else [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [webWindow setAnimationBehavior:animationBehavior]; #endif @@ -415,7 +413,7 @@ static IntRect screenRectOfContents(Element* element) - (void)_updateMenuAndDockForFullScreen { // NSApplicationPresentationOptions is available on > 10.6 only: -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSApplicationPresentationOptions options = NSApplicationPresentationDefault; NSScreen* fullscreenScreen = [[self window] screen]; diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm index 04a5a9973..505db5302 100644 --- a/Source/WebKit/mac/WebView/WebHTMLView.mm +++ b/Source/WebKit/mac/WebView/WebHTMLView.mm @@ -285,7 +285,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName; - (void)_invalidateGStatesForTree; - (void)_propagateDirtyRectsToOpaqueAncestors; - (void)_windowChangedKeyState; -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)_updateLayerGeometryFromView; #endif @end @@ -411,7 +411,7 @@ static CachedImageClient* promisedDataClient() - (void)_web_clearPrintingModeRecursive; @end -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 @interface WebHTMLView (WebHTMLViewTextCheckingInternal) - (void)orderFrontSubstitutionsPanel:(id)sender; @@ -794,7 +794,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) subresources:0])) return fragment; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if ([types containsObject:NSPICTPboardType] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:NSPICTPboardType @@ -875,7 +875,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) DOMRange *range = [self _selectedRange]; Frame* coreFrame = core([self _frame]); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText]; if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted]) coreFrame->editor()->pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false); @@ -1232,7 +1232,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) } _private->lastScrollPosition = origin; -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 [self _updateLayerHostingViewPosition]; #endif } @@ -1389,7 +1389,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) static BOOL isQuickLookEvent(NSEvent *event) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 const int kCGSEventSystemSubtypeHotKeyCombinationReleased = 9; return [event type] == NSSystemDefined && [event subtype] == kCGSEventSystemSubtypeHotKeyCombinationReleased && [event data1] == 'lkup'; #else @@ -1658,7 +1658,7 @@ static bool mouseEventIsPartOfClickOrDrag(NSEvent *event) static NSArray *types = nil; if (!types) { types = [[NSArray alloc] initWithObjects:WebArchivePboardType, NSHTMLPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPDFPboardType, -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 NSPICTPboardType, #endif NSURLPboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, NSColorPboardType, kUTTypePNG, nil]; @@ -2047,7 +2047,7 @@ static bool mouseEventIsPartOfClickOrDrag(NSEvent *event) [resource release]; return fragment; } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (pboardType == NSPICTPboardType) { WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSPICTPboardType] URL:uniqueURLWithRelativePart(@"image.pict") @@ -2699,7 +2699,7 @@ WEBCORE_COMMAND(yankAndSelect) return YES; } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (action == @selector(orderFrontSubstitutionsPanel:)) { NSMenuItem *menuItem = (NSMenuItem *)item; if ([menuItem isKindOfClass:[NSMenuItem class]]) { @@ -2852,7 +2852,7 @@ WEBCORE_COMMAND(yankAndSelect) return; #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // Legacy scrollbars require tracking the mouse at all times. if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) return; @@ -3391,7 +3391,7 @@ static void setMenuTargets(NSMenu* menu) return; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (_private->trackingAreaForNonKeyWindow) { [self removeTrackingArea:_private->trackingAreaForNonKeyWindow]; [_private->trackingAreaForNonKeyWindow release]; @@ -3424,7 +3424,7 @@ static void setMenuTargets(NSMenu* menu) [_private->completionController endRevertingChange:NO moveLeft:NO]; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) { // Legacy style scrollbars have design details that rely on tracking the mouse all the time. // It's easiest to do this with a tracking area, which we will remove when the window is key @@ -4898,7 +4898,7 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame) static BOOL writingDirectionKeyBindingsEnabled() { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return YES; #else NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -4936,7 +4936,7 @@ static BOOL writingDirectionKeyBindingsEnabled() [self _changeBaseWritingDirectionTo:NSWritingDirectionRightToLeft]; } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)changeBaseWritingDirectionToLTR:(id)sender { [self makeBaseWritingDirectionLeftToRight:sender]; @@ -5151,7 +5151,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (void)orderFrontSubstitutionsPanel:(id)sender { @@ -5286,7 +5286,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) if (font) rect.origin.y += [font ascender]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [self showDefinitionForAttributedString:attrString atPoint:rect.origin]; return; #endif @@ -5476,7 +5476,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) { if (!_private->layerHostingView) { NSView* hostingView = [[WebLayerHostingFlippedView alloc] initWithFrame:[self bounds]]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [hostingView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; #endif [self addSubview:hostingView]; @@ -5488,7 +5488,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) // Make a container layer, which will get sized/positioned by AppKit and CA. CALayer* viewLayer = [WebRootLayer layer]; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Turn off default animations. NSNull *nullValue = [NSNull null]; NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys: @@ -5522,10 +5522,10 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) if ([[self _webView] _postsAcceleratedCompositingNotifications]) [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewDidStartAcceleratedCompositingNotification object:[self _webView] userInfo:nil]; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 [viewLayer setSublayerTransform:CATransform3DMakeScale(1, -1, 1)]; // setGeometryFlipped: doesn't exist on Leopard. [self _updateLayerHostingViewPosition]; -#elif (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION)) +#elif __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // Do geometry flipping here, which flips all the compositing layers so they are top-down. [viewLayer setGeometryFlipped:YES]; #else @@ -5544,7 +5544,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) } } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // This method is necessary on Leopard to work around <rdar://problem/7067892>. - (void)_updateLayerHostingViewPosition { @@ -5572,7 +5572,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [_private->layerHostingView _updateLayerGeometryFromView]; // Workaround for <rdar://problem/7071636> [_private->layerHostingView setFrame:layerViewFrame]; } -#endif // defined(BUILDING_ON_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { diff --git a/Source/WebKit/mac/WebView/WebHTMLViewInternal.h b/Source/WebKit/mac/WebView/WebHTMLViewInternal.h index a4153ab4f..137a1404b 100644 --- a/Source/WebKit/mac/WebView/WebHTMLViewInternal.h +++ b/Source/WebKit/mac/WebView/WebHTMLViewInternal.h @@ -66,7 +66,7 @@ namespace WebCore { - (BOOL)_web_isDrawingIntoLayer; #endif -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)_updateLayerHostingViewPosition; #endif diff --git a/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm b/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm index 3e701cf5c..592edf75b 100644 --- a/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm +++ b/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm @@ -31,7 +31,7 @@ #import <PDFKit/PDFDocument.h> #import <objc/objc-runtime.h> -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 @interface PDFDocument (Internal) - (CGPDFDocumentRef)documentRef; @end diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index 9c28230ba..1defbf5ed 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -47,6 +47,7 @@ using namespace WebCore; NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification"; NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification"; NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification"; +NSString *WebPreferencesCacheModelChangedInternalNotification = @"WebPreferencesCacheModelChangedInternalNotification"; #define KEY(x) (_private->identifier ? [_private->identifier stringByAppendingString:(x)] : (x)) @@ -163,6 +164,10 @@ static WebCacheModel cacheModelForMainBundle(void) } @end +@interface WebPreferences () +- (void)_postCacheModelChangedNotification; +@end + @interface WebPreferences (WebInternal) + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key; + (NSString *)_IBCreatorID; @@ -222,6 +227,7 @@ static WebCacheModel cacheModelForMainBundle(void) [[self class] _setInstance:self forIdentifier:_private->identifier]; [self _postPreferencesChangedNotification]; + [self _postCacheModelChangedNotification]; return self; } @@ -346,7 +352,7 @@ static WebCacheModel cacheModelForMainBundle(void) @"0", WebKitPDFScaleFactorPreferenceKey, @"0", WebKitUseSiteSpecificSpoofingPreferenceKey, [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey, -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded], #else [NSNumber numberWithInt:WebTextDirectionSubmenuNeverIncluded], @@ -802,10 +808,21 @@ static WebCacheModel cacheModelForMainBundle(void) return [self _boolValueForKey:WebKitUsesPageCachePreferenceKey]; } +- (void)_postCacheModelChangedNotification +{ + if (!pthread_main_np()) { + [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO]; + return; + } + + [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesCacheModelChangedInternalNotification object:self userInfo:nil]; +} + - (void)setCacheModel:(WebCacheModel)cacheModel { [self _setIntegerValue:cacheModel forKey:WebKitCacheModelPreferenceKey]; [self setAutomaticallyDetectsCacheModel:NO]; + [self _postCacheModelChangedNotification]; } - (WebCacheModel)cacheModel diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 7e853fa44..5db85cf55 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -46,6 +46,7 @@ typedef enum { extern NSString *WebPreferencesChangedNotification; extern NSString *WebPreferencesRemovedNotification; extern NSString *WebPreferencesChangedInternalNotification; +extern NSString *WebPreferencesCacheModelChangedInternalNotification; @interface WebPreferences (WebPrivate) diff --git a/Source/WebKit/mac/WebView/WebResourceInternal.h b/Source/WebKit/mac/WebView/WebResourceInternal.h index ba84105a0..32442ca6c 100644 --- a/Source/WebKit/mac/WebView/WebResourceInternal.h +++ b/Source/WebKit/mac/WebView/WebResourceInternal.h @@ -29,7 +29,7 @@ #import "WebResourcePrivate.h" #import <wtf/PassRefPtr.h> -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define MAIL_THREAD_WORKAROUND 1 #endif diff --git a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h index 585700fa0..5182f31be 100644 --- a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h +++ b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h @@ -28,7 +28,7 @@ #import <Foundation/Foundation.h> -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 typedef int WebSourceId; #else typedef intptr_t WebSourceId; diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index c35b873f4..b85d8f36b 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -463,7 +463,7 @@ NSString *_WebViewDidStartAcceleratedCompositingNotification = @"_WebViewDidStar static BOOL continuousSpellCheckingEnabled; static BOOL grammarCheckingEnabled; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static BOOL automaticQuoteSubstitutionEnabled; static BOOL automaticLinkDetectionEnabled; static BOOL automaticDashSubstitutionEnabled; @@ -510,7 +510,7 @@ static CFMutableSetRef allWebViewsSet; @implementation WebView (WebPrivate) -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 static NSString *createMacOSXVersionString() { @@ -545,7 +545,7 @@ static NSString *createMacOSXVersionString() return [[NSString alloc] initWithFormat:@"%d", major]; } -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 static NSString *createUserVisibleWebKitVersionString() { @@ -611,7 +611,7 @@ static void WebKitInitializeApplicationCachePathIfNecessary() static bool runningLeopardMail() { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return applicationIsAppleMail(); #endif return NO; @@ -619,7 +619,7 @@ static bool runningLeopardMail() static bool coreVideoHas7228836Fix() { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 NSBundle* coreVideoFrameworkBundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/CoreVideo.framework"]; double version = [[coreVideoFrameworkBundle objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey] doubleValue]; return (version >= 48); @@ -647,7 +647,7 @@ static bool shouldEnableLoadDeferring() [types release]; } -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 // This method should be removed once we no longer want to keep Safari 5.0.x working with nightly builds. - (BOOL)_usesDocumentViews { @@ -1508,7 +1508,7 @@ static bool needsSelfRetainWhileLoadingQuirk() #if ENABLE(FULLSCREEN_API) settings->setFullScreenEnabled([preferences fullScreenEnabled]); #endif -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Asynchronous spell checking API is available for 10.6 or later. settings->setAsynchronousSpellCheckingEnabled([preferences asynchronousSpellCheckingEnabled]); #endif @@ -3040,13 +3040,13 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) WebCore::RunLoop::initializeMainRunLoop(); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) name:WebPreferencesChangedInternalNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_cacheModelChangedNotification:) name:WebPreferencesCacheModelChangedInternalNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesRemovedNotification:) name:WebPreferencesRemovedNotification object:nil]; continuousSpellCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebContinuousSpellCheckingEnabled]; grammarCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebGrammarCheckingEnabled]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 automaticQuoteSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticQuoteSubstitutionEnabled]; automaticLinkDetectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticLinkDetectionEnabled]; automaticDashSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticDashSubstitutionEnabled]; @@ -3054,7 +3054,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) automaticSpellingCorrectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticSpellingCorrectionEnabled]; #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticTextReplacementEnabled]) automaticTextReplacementEnabled = [NSSpellChecker isAutomaticTextReplacementEnabled]; if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticSpellingCorrectionEnabled]) @@ -3261,7 +3261,7 @@ static bool clientNeedsWebViewInitThreadWorkaround() if ([bundleIdentifier _webkit_hasCaseInsensitivePrefix:@"com.apple.Automator."]) return true; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Mail. if ([bundleIdentifier _webkit_isCaseInsensitiveEqualToString:@"com.apple.Mail"]) return true; @@ -4564,7 +4564,7 @@ static WebFrame *incrementFrame(WebFrame *frame, WebFindOptions options = 0) [menuItem setState:checkMark ? NSOnState : NSOffState]; } return YES; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 } else if (action == @selector(toggleAutomaticQuoteSubstitution:)) { BOOL checkMark = [self isAutomaticQuoteSubstitutionEnabled]; if ([(NSObject *)item isKindOfClass:[NSMenuItem class]]) { @@ -4713,7 +4713,7 @@ static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *stri return kit(_private->page->rangeOfString(string, core(previousRange), coreOptions(options)).get()); } -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // FIXME: Remove once WebKit no longer needs to support versions of Safari that call this. - (void)setHoverFeedbackSuspended:(BOOL)newValue { @@ -5402,7 +5402,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu grammarCheckingEnabled = flag; [[NSUserDefaults standardUserDefaults] setBool:grammarCheckingEnabled forKey:WebGrammarCheckingEnabled]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[NSSpellChecker sharedSpellChecker] updatePanels]; #else NSSpellChecker *spellChecker = [NSSpellChecker sharedSpellChecker]; @@ -5429,7 +5429,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticQuoteSubstitutionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticQuoteSubstitutionEnabled; @@ -5438,7 +5438,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticLinkDetectionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticLinkDetectionEnabled; @@ -5447,7 +5447,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticDashSubstitutionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticDashSubstitutionEnabled; @@ -5456,7 +5456,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticTextReplacementEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticTextReplacementEnabled; @@ -5465,14 +5465,14 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticSpellingCorrectionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticSpellingCorrectionEnabled; #endif } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag { @@ -5698,7 +5698,7 @@ static WebFrameView *containingFrameView(NSView *view) NSWindow *window = [self window]; NSWindow *hostWindow = [self hostWindow]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (window) return [window backingScaleFactor]; if (hostWindow) @@ -5913,7 +5913,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num) return cacheModel; } -+ (void)_preferencesChangedNotification:(NSNotification *)notification ++ (void)_cacheModelChangedNotification:(NSNotification *)notification { WebPreferences *preferences = (WebPreferences *)[notification object]; ASSERT([preferences isKindOfClass:[WebPreferences class]]); @@ -6059,7 +6059,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num) if (![selectedString length]) return; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:selectedString]; #else (void)HISearchWindowShow((CFStringRef)selectedString, kNilOptions); @@ -6579,7 +6579,7 @@ void WebInstallMemoryPressureHandler(void) memoryPressureHandler().install(); } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 static IMP originalRecursivelyRemoveMailAttributesImp; @@ -6605,7 +6605,7 @@ static void recursivelyRemoveMailAttributes(DOMNode *self, SEL selector, BOOL a, static void patchMailRemoveAttributesMethod() { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (!WKAppVersionCheckLessThan(@"com.apple.mail", -1, 4.0)) return; Method methodToPatch = class_getInstanceMethod(objc_getRequiredClass("DOMNode"), @selector(recursivelyRemoveMailAttributes:convertObjectsToImages:convertEditableElements:)); diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index b7b3b1c41..0a9808dbc 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -677,7 +677,7 @@ Could be worth adding to the API. - (BOOL)isAutomaticDashSubstitutionEnabled; - (BOOL)isAutomaticTextReplacementEnabled; - (BOOL)isAutomaticSpellingCorrectionEnabled; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag; - (void)toggleAutomaticQuoteSubstitution:(id)sender; - (void)setAutomaticLinkDetectionEnabled:(BOOL)flag; diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index 21b3a0b70..ed1806fa0 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -356,6 +356,32 @@ void QWebFramePrivate::renderCompositedLayers(GraphicsContext* context, const In } #endif +// This code is copied from ChromeClientGtk.cpp. +static void coalesceRectsIfPossible(const QRect& clipRect, QVector<QRect>& rects) +{ + const unsigned int rectThreshold = 10; + const float wastedSpaceThreshold = 0.75f; + bool useUnionedRect = (rects.size() <= 1) || (rects.size() > rectThreshold); + if (!useUnionedRect) { + // Attempt to guess whether or not we should use the unioned rect or the individual rects. + // We do this by computing the percentage of "wasted space" in the union. If that wasted space + // is too large, then we will do individual rect painting instead. + float unionPixels = (clipRect.width() * clipRect.height()); + float singlePixels = 0; + for (size_t i = 0; i < rects.size(); ++i) + singlePixels += rects[i].width() * rects[i].height(); + float wastedSpace = 1 - (singlePixels / unionPixels); + if (wastedSpace <= wastedSpaceThreshold) + useUnionedRect = true; + } + + if (!useUnionedRect) + return; + + rects.clear(); + rects.append(clipRect); +} + void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWebFrame::RenderLayer> layers, const QRegion& clip) { if (!frame->view() || !frame->contentRenderer()) @@ -371,6 +397,8 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWe view->updateLayoutAndStyleIfNeededRecursive(); if (layers & QWebFrame::ContentsLayer) { + QRect clipBoundingRect = clip.boundingRect(); + coalesceRectsIfPossible(clipBoundingRect, vector); for (int i = 0; i < vector.size(); ++i) { const QRect& clipRect = vector.at(i); @@ -396,7 +424,7 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWe context->restore(); } #if USE(ACCELERATED_COMPOSITING) - renderCompositedLayers(context, IntRect(clip.boundingRect())); + renderCompositedLayers(context, IntRect(clipBoundingRect)); #endif } renderFrameExtras(context, layers, clip); diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index e72c0862e..1330870da 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -791,7 +791,8 @@ void QWebPagePrivate::mouseReleaseEvent(T *ev) accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); ev->setAccepted(accepted); - handleClipboard(ev, ev->button()); + if (!ev->isAccepted()) + handleClipboard(ev, ev->button()); handleSoftwareInputPanel(ev->button(), QPointF(ev->pos()).toPoint()); } diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index c6941fa54..6d26ea21c 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,40 @@ +2012-07-12 Huang Dongsung <luxtella@company100.net> + + [Qt] Increase the drawing performance by merging dirty rects. + https://bugs.webkit.org/show_bug.cgi?id=91075 + + Reviewed by Noam Rosenthal. + + QWebFramePrivate calls FrameView::paintContents as many as the number of dirty + rects, so it causes too many redundant render tree traversals. + I changed it to merge dirty rects and call FrameView::paintContents only once. + The algorithm to merge rects is copied from GTK. + + When parallel image decoders are in use, each image is independently repainted + when decoding is finished. This creates a lot by repaint requests. So by merging + these repaint requests, I could improve rendering performance. + + For example, I tested parallel image decoders on the locally mirrored Pinterest site. + QWebFramePrivate called FrameView::paintContents 165 times after parallel image + decoders decoded all the images. It took about 120ms on my six-core Intel Xeon machine. + This patch decreases painting time from 120ms to 30ms. + + * Api/qwebframe.cpp: + (coalesceRectsIfPossible): + (QWebFramePrivate::renderRelativeCoords): + +2012-07-11 Steffen Imhof <steffen.imhof@basyskom.com> + + [Qt] Middle clicking a scrollbar causes text to be pasted. + https://bugs.webkit.org/show_bug.cgi?id=78444 + + Check if the event was already accepted before handling the clipboard. + + Reviewed by Simon Hausmann. + + * Api/qwebpage.cpp: + (QWebPagePrivate::mouseReleaseEvent): + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/scripts/generate-webkitversion.pl b/Source/WebKit/scripts/generate-webkitversion.pl index 8cdb4187b..c83b8496c 100644 --- a/Source/WebKit/scripts/generate-webkitversion.pl +++ b/Source/WebKit/scripts/generate-webkitversion.pl @@ -45,7 +45,7 @@ my $usage = "generate-webkitversion --config WebKit/mac/Configurations/Version.x my $major_version = ""; my $minor_version = ""; # The appropriate Apple-maintained Version.xcconfig file for WebKit version information is in WebKit/mac/Configurations/. -my $configFile = "./Soure/WebKit/mac/Configurations/Version.xcconfig"; +my $configFile = "./Source/WebKit/mac/Configurations/Version.xcconfig"; my $outputDir = ""; GetOptions('config=s' => \$configFile, diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index ce2d8d010..889e24c9b 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,22 @@ +2012-07-14 Eric Carlson <eric.carlson@apple.com> + + Enable AVCF hardware video decoding + https://bugs.webkit.org/show_bug.cgi?id=90015 + <rdar://problem/10770317> + + Reviewed by Anders Carlsson. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::graphicsDeviceAdapter): New, return the view's graphics adapter. + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient): + + * WebView.cpp: + (WebView::graphicsDeviceAdapter): New, return the layer tree host's graphics adapter. + * WebView.h: + (WebCore): + (WebView): + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp index 381dbb021..3f7a418e6 100644 --- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -752,7 +752,13 @@ void WebChromeClient::scheduleCompositingLayerSync() { m_webView->flushPendingGraphicsLayerChangesSoon(); } +#endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) +WebCore::GraphicsDeviceAdapter* WebChromeClient::graphicsDeviceAdapter() const +{ + return m_webView->graphicsDeviceAdapter(); +} #endif COMPtr<IWebUIDelegate> WebChromeClient::uiDelegate() diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h index 9a5af3893..f5559b0c9 100644 --- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -142,6 +142,10 @@ public: virtual void scheduleCompositingLayerSync(); #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE; +#endif + virtual void scrollRectIntoView(const WebCore::IntRect&) const { } #if ENABLE(VIDEO) diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp index c709ba9f1..ececdff22 100644 --- a/Source/WebKit/win/WebView.cpp +++ b/Source/WebKit/win/WebView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple, Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple, Inc. All rights reserved. * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved. * Copyright (C) 2011 Brent Fulgham. All rights reserved. * @@ -6529,6 +6529,15 @@ void WebView::setAcceleratedCompositing(bool accelerated) } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) +WebCore::GraphicsDeviceAdapter* WebView::graphicsDeviceAdapter() const +{ + if (!m_layerTreeHost) + return 0; + return m_layerTreeHost->graphicsDeviceAdapter(); +} +#endif + HRESULT WebView::unused1() { ASSERT_NOT_REACHED(); diff --git a/Source/WebKit/win/WebView.h b/Source/WebKit/win/WebView.h index 821c7e9f4..696e2c77b 100644 --- a/Source/WebKit/win/WebView.h +++ b/Source/WebKit/win/WebView.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved. * Copyright (C) 2011 Brent Fulgham. All rights reserved. * @@ -55,6 +55,9 @@ namespace WebCore { class CACFLayerTreeHost; #endif class FullScreenController; +#if PLATFORM(WIN) && USE(AVFOUNDATION) + struct GraphicsDeviceAdapter; +#endif } namespace WebCore { @@ -947,6 +950,10 @@ public: void setRootChildLayer(WebCore::GraphicsLayer*); #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const; +#endif + void enterFullscreenForNode(WebCore::Node*); void exitFullscreen(); diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 7aefe8e0e..f9f6f1d91 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,813 @@ +2012-07-14 Eric Carlson <eric.carlson@apple.com> + + Enable AVCF hardware video decoding + https://bugs.webkit.org/show_bug.cgi?id=90015 + <rdar://problem/10770317> + + Reviewed by Anders Carlsson. + + * DerivedSources.make: Define HAVE_AVCF if necessary. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit): + (WebKit::WebChromeClient::graphicsDeviceAdapter): New, return the layer tree host's + graphics adapter. + * WebProcess/WebCoreSupport/WebChromeClient.h: + (WebChromeClient): + * WebProcess/WebPage/LayerTreeHost.h: + (WebCore): + (LayerTreeHost): + (WebKit::LayerTreeHost::graphicsDeviceAdapter): New, default implementation. + + * WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h: + (LayerTreeHostCAWin): + +2012-07-13 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [CMake] Proper handling of ENABLE_API_TESTS build option + https://bugs.webkit.org/show_bug.cgi?id=91221 + + Reviewed by Rob Buis. + + Build unit tests only if ENABLE_API_TESTS is set. + + * PlatformEfl.cmake: + +2012-07-13 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Make new public Ewk headers as installable + https://bugs.webkit.org/show_bug.cgi?id=91232 + + Reviewed by Antonio Gomes. + + Make new public Ewk headers installable. + + * PlatformEfl.cmake: + +2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Implement disk cache in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=90797 + + Reviewed by Xan Lopez. + + * WebProcess/gtk/WebProcessGtk.cpp: + (WebKit::getCacheDiskFreeSize): Use an ASSERT instead of an early + return since the cache feature is now always added to the session. + (WebKit::WebProcess::platformSetCacheModel): Get the cache from + the session and set the maximum cache size as computed by + calculateCacheSizes(). + (WebKit::WebProcess::platformClearResourceCaches): Call + soup_cache_clear(). + (WebKit::WebProcess::platformTerminate): Make sure all pending + data is saved to the disk before the web process finishes. + * WebProcess/gtk/WebProcessMainGtk.cpp: + (WebKit::WebProcessMainGtk): Create a SoupCache feature and add it + to the default SoupSession. + +2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Fix disk cache size computation in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=91226 + + Reviewed by Xan Lopez. + + We are passing the free disk space value in bytes to + calculateCacheSizes() which expects values in MB. + + * WebProcess/gtk/WebProcessGtk.cpp: + (WebKit::WebProcess::platformSetCacheModel): + +2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] WebKit2 crash when going back/forward + https://bugs.webkit.org/show_bug.cgi?id=91220 + + Reviewed by Xan Lopez. + + For some reason when a page is loaded from the backforward list, + when the didCommitLoadForFrame callback is called for the main + frame, the callback didInitiateLoadForResource hasn't been called + yet, so we don't even have a main resource at that point. We were + assuming we always had a main resource with a response. For now we + just check whether we have a resource before trying to set the + certificate to fix the crash, but we need to figue out why this is + happening an how to properly fix it. + + * UIProcess/API/gtk/WebKitLoaderClient.cpp: + (didCommitLoadForFrame): Check whether we have a main resource + before setting the certificate. + +2012-07-13 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Use eina stringsharing for Ewk_Web_Resource's url + https://bugs.webkit.org/show_bug.cgi?id=91200 + + Reviewed by Kenneth Rohde Christiansen. + + Use eina stringsharing for Ewk_Web_Resource's url + for consistency. + + * UIProcess/API/efl/ewk_web_resource.cpp: + (_Ewk_Web_Resource): + (_Ewk_Web_Resource::_Ewk_Web_Resource): + (ewk_web_resource_unref): + (ewk_web_resource_url_get): + * UIProcess/API/efl/ewk_web_resource.h: + +2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] WebKitWebView::mouse-target-changed is not emitted when moved to/from edtiable content + https://bugs.webkit.org/show_bug.cgi?id=91216 + + Reviewed by Xan Lopez. + + The problem is that the function to check whether two hit test + results are equal doesn't check the editable flag. + + * UIProcess/API/gtk/WebKitHitTestResult.cpp: + (webkitHitTestResultCompare): Check also the editable flag. + +2012-07-13 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Add *explicit* keyword to constructor which has a parameter + https://bugs.webkit.org/show_bug.cgi?id=91207 + + Reviewed by Zoltan Herczeg. + + Add *explicit* keyword to contructor which has a parameter in order to avoid implicit type conversion. + + * WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h: + (WebFrameNetworkingContext::WebFrameNetworkingContext): + +2012-07-13 Zeno Albisser <zeno@webkit.org> + + [Qt][WK2] Implement GraphicsSurface for Linux/GLX. + https://bugs.webkit.org/show_bug.cgi?id=90881 + + Add a GLX based GraphicsSurface implementation for Linux. + + Reviewed by Noam Rosenthal. + + * Shared/ShareableSurface.cpp: + (WebKit::ShareableSurface::create): + Only create a GraphicsSurface from a ShareableSurface::Handle + in case the Handle contains a valid GraphicsSurface token. + Otherwise fall back to creating a ShareableBitmap. + * UIProcess/LayerTreeCoordinatorProxy.cpp: + (WebKit::createLayerTileUniqueKey): + Create a unique key for a surface based on tileID and layerID. + (WebKit::LayerTreeCoordinatorProxy::updateTileForLayer): + Even when GraphicsSurface is enabled, not all ShareableSurfaces + will necessarily be backed by a GraphicsSurface. In case of + a ShareableSurface being backed by a ShareableBitmap instead, + the GraphicsSurface token will always be null. + So instead of using the GraphicsSurface token as a key for + storing surfaces in a map, we create a unique key from + layerID and tileID. + * UIProcess/LayerTreeCoordinatorProxy.h: + (LayerTreeCoordinatorProxy): + +2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add API to get HTTPS status to WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=91100 + + Reviewed by Martin Robinson. + + Add webkit_uri_response_get_https_status() to return + GTlsCertificate and GTlsCertificateFlags with information about + the SSL certificate and the possible errors with the certificate. + + * GNUmakefile.list.am: Add new files to compilation. + * PlatformEfl.cmake: Ditto. + * Shared/efl/PlatformCertificateInfo.h: Removed. + * Shared/soup/PlatformCertificateInfo.cpp: Added. + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::~PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::encode): Encode the + GTlsCertificate and GTlsCertificateFlags. + (WebKit::PlatformCertificateInfo::decode): Decode + PlatformCertificateInfo into a GTlsCertificate and GTlsCertificateFlags. + * Shared/soup/PlatformCertificateInfo.h: Renamed from Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h. + (WebKit::PlatformCertificateInfo::certificate): Return the certificate. + (WebKit::PlatformCertificateInfo::tlsErrors): Return the TLS errors + * UIProcess/API/gtk/WebKitLoaderClient.cpp: + (didCommitLoadForFrame): Set the certificate of the current frame + to the response of the main resource. + * UIProcess/API/gtk/WebKitURIResponse.cpp: + (webkit_uri_response_get_https_status): Return GTlsCertificate and + GTlsCertificateFlags. + (webkitURIResponseSetCertificateInfo): Update the internal + ResourceResponse with the GTlsCertificate and GTlsCertificateFlags + of the given PlatformCertificateInfo. + * UIProcess/API/gtk/WebKitURIResponse.h: + * UIProcess/API/gtk/WebKitURIResponsePrivate.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol. + * UIProcess/API/gtk/tests/GNUmakefile.am: + * UIProcess/API/gtk/tests/TestMain.h: + (Test::getResourcesDir): Helper function to get the resources + directory of the WebKit2 API tests. + * UIProcess/API/gtk/tests/TestSSL.cpp: Added. + (testSSL): + (serverCallback): + (beforeAll): + (afterAll): + * UIProcess/API/gtk/tests/WebKitTestServer.cpp: + (WebKitTestServer::WebKitTestServer): Add support por SSL test + servers. + * UIProcess/API/gtk/tests/WebKitTestServer.h: + (WebKitTestServer): Add ssl parameter to create a HTTPS server. + * UIProcess/API/gtk/tests/resources/test-cert.pem: Added. + * UIProcess/API/gtk/tests/resources/test-key.pem: Added. + +2012-07-12 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][EFL] Facilitate debugging of the Web Process + https://bugs.webkit.org/show_bug.cgi?id=90768 + + Reviewed by Kenneth Rohde Christiansen. + + The EFL port now checks if the WEB_PROCESS_CMD_PREFIX + environment variable is set and uses it as prefix + when spawning the Web process if it is. This is used + for debugging purposes with prefixes such as: + "xterm -title renderer -e gdb --args". + + * UIProcess/Launcher/ProcessLauncher.h: + (LaunchOptions): + * UIProcess/Launcher/efl/ProcessLauncherEfl.cpp: + (WebKit::ProcessLauncher::launchProcess): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::connect): + +2012-07-12 Timothy Hatcher <timothy@apple.com> + + Make the "Inspect Element" context menu item appear in nightly builds again. + + https://webkit.org/b/89323 + + Reviewed by Anders Carlsson. + + * Shared/API/c/WKContextMenuItem.cpp: + (compatibleContextMenuItemTag): Added. Checks for the specific version of Safari 6 that needs the + tag fixed up to match values it expects. + (WKContextMenuItemGetTag): On Mac platforms call compatibleContextMenuItemTag to fix up the tag + before returning it. + * Shared/API/c/WKContextMenuItemTypes.h: Fix the order of the WKContextMenuItemTag enum + to be binary compatible with older versions of WebKit2. + +2012-07-12 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] Port the test framework to WebKit 2 + https://bugs.webkit.org/show_bug.cgi?id=90606 + + Reviewed by Kenneth Rohde Christiansen. + + This port of EFL's WebKit 1 test framework uses a more gtest-ish + way of writing tests and it is based on a test fixture that loads a + page synchronously as convenience (if needed). This base fixture can be + easily extended by just inheriting from it. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: Added. + (EWK2UnitTest): + (EWK2UnitTest::onLoadProgress): + (EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase): + (EWK2UnitTest::EWK2UnitTestBase::SetUp): + (EWK2UnitTest::EWK2UnitTestBase::TearDown): + (EWK2UnitTest::EWK2UnitTestBase::loadUrlSync): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: Added. + (EWK2UnitTest): + (EWK2UnitTestBase): + (EWK2UnitTest::EWK2UnitTestBase::setLoadProgress): + (EWK2UnitTest::EWK2UnitTestBase::webView): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp: Added. + (EWK2UnitTest): + (EWK2UnitTest::EWK2UnitTestEnvironment::EWK2UnitTestEnvironment): + (EWK2UnitTest::EWK2UnitTestEnvironment::defaultTestPageUrl): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h: Added. + (EWK2UnitTest): + (EWK2UnitTestEnvironment): + (EWK2UnitTest::EWK2UnitTestEnvironment::useX11Window): + (EWK2UnitTest::EWK2UnitTestEnvironment::defaultWidth): + (EWK2UnitTest::EWK2UnitTestEnvironment::defaultHeight): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp: Added. + (parseArguments): + (main): + * UIProcess/API/efl/tests/resources/default_test_page.html: Added. + * UIProcess/API/efl/tests/test_ewk2_view.cpp: Added. + (TEST_F): + +2012-07-12 Christophe Dumez <christophe.dumez@intel.com> + + [WK2] Add missing Network Information API integration to WebContext and WebPage + https://bugs.webkit.org/show_bug.cgi?id=90781 + + Reviewed by Anders Carlsson. + + Integrate Network Information API to WebPage, WebContext and + properly route messages to the WebNetworkInfoManagerProxy. + Without this, the Network Information tests are crashing for + WebKit2. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::~WebContext): + (WebKit::WebContext::disconnectProcess): + (WebKit::WebContext::didReceiveMessage): + (WebKit::WebContext::didReceiveSyncMessage): + * UIProcess/WebContext.h: + (WebKit): + (WebContext): + (WebKit::WebContext::networkInfoManagerProxy): + * UIProcess/WebNetworkInfoManagerProxy.cpp: + (WebKit::WebNetworkInfoManagerProxy::didReceiveSyncMessage): + (WebKit): + * UIProcess/WebNetworkInfoManagerProxy.h: + (WebNetworkInfoManagerProxy): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2012-07-12 No'am Rosenthal <noam.rosenthal@nokia.com> + + Move TextureMapperAnimation and texmap/LayerTransform to platform/graphics + https://bugs.webkit.org/show_bug.cgi?id=91111 + + Reviewed by Kenneth Rohde Christiansen. + + Include the new filenames. + + * WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h: + (WebGraphicsLayer): + +2012-07-12 Adenilson Cavalcanti <cavalcantii@gmail.com> + + [Qt][WK2] Implement web notifications support + https://bugs.webkit.org/show_bug.cgi?id=80702 + + Reviewed by Noam Rosenthal. + + Adding a new type of permission request for Desktop Notifications (plus required code + to register the handle for this requests). + + * UIProcess/API/qt/qwebpermissionrequest.cpp: + (QWebPermissionRequestPrivate::QWebPermissionRequestPrivate): + (QWebPermissionRequestPrivate): + (QWebPermissionRequest::create): + (QWebPermissionRequest::QWebPermissionRequest): + (QWebPermissionRequest::setAllow): + * UIProcess/API/qt/qwebpermissionrequest_p.h: + * UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml: Added. + * UIProcess/API/qt/tests/qmltests/common/notification.html: Added. + * UIProcess/qt/QtWebPageUIClient.cpp: + (WebKit::QtWebPageUIClient::QtWebPageUIClient): + (WebKit::QtWebPageUIClient::policyForNotificationPermissionRequest): + (WebKit): + * UIProcess/qt/QtWebPageUIClient.h: + +2012-07-12 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL][WK2] Browser crashes running BatteryStatus tests. + https://bugs.webkit.org/show_bug.cgi?id=91065 + + Reviewed by Kentaro Hara. + + clientInfo was incorrectly casted to BatteryProviderEfl in helper + function. This patch fixes the issue. + + * UIProcess/API/efl/BatteryProvider.cpp: + (toBatteryProvider): + +2012-07-12 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] [WK2] regression(r122411) Crashes in Ewk_View + https://bugs.webkit.org/show_bug.cgi?id=91068 + + Reviewed by Kentaro Hara. + + Avoid using calloc() to allocate memory for structures + and use new operator instead. calloc() causes unwanted + behavior when allocing a structure which contains + non-pointer types (e.g. a HashMap) and leads to + crashes. + + * UIProcess/API/efl/ewk_context.cpp: + (_Ewk_Context::_Ewk_Context): + * UIProcess/API/efl/ewk_intent.cpp: + (_Ewk_Intent): + (_Ewk_Intent::_Ewk_Intent): + (ewk_intent_unref): + (ewk_intent_new): + * UIProcess/API/efl/ewk_intent_service.cpp: + (_Ewk_Intent_Service): + (_Ewk_Intent_Service::_Ewk_Intent_Service): + (ewk_intent_service_unref): + (ewk_intent_service_new): + * UIProcess/API/efl/ewk_navigation_policy_decision.cpp: + (_Ewk_Navigation_Policy_Decision): + (_Ewk_Navigation_Policy_Decision::_Ewk_Navigation_Policy_Decision): + (ewk_navigation_policy_decision_free): + (ewk_navigation_policy_decision_new): + * UIProcess/API/efl/ewk_url_request.cpp: + (_Ewk_Url_Request): + (_Ewk_Url_Request::_Ewk_Url_Request): + (ewk_url_request_unref): + (ewk_url_request_new): + * UIProcess/API/efl/ewk_url_response.cpp: + (_Ewk_Url_Response): + (_Ewk_Url_Response::_Ewk_Url_Response): + (ewk_url_response_unref): + (ewk_url_response_new): + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::_Ewk_View_Private_Data): + (_ewk_view_priv_new): + (_ewk_view_priv_del): + * UIProcess/API/efl/ewk_web_error.cpp: + (_Ewk_Web_Error): + (_Ewk_Web_Error::_Ewk_Web_Error): + (ewk_web_error_free): + (ewk_web_error_new): + * UIProcess/API/efl/ewk_web_resource.cpp: + (_Ewk_Web_Resource): + (_Ewk_Web_Resource::_Ewk_Web_Resource): + (ewk_web_resource_unref): + (ewk_web_resource_new): + +2012-07-11 Andras Becsi <andras.becsi@nokia.com> + + [Qt][WK2] ASSERT: "!m_viewportItem->isMoving()" in QtViewportHandler::flickMoveEnded() + https://bugs.webkit.org/show_bug.cgi?id=90875 + + Reviewed by Kenneth Rohde Christiansen. + + Since MultiPointTouchArea and PinchArea use the childMouseEventFilter + method to filter touch events and because Flickable filters child mouse + events the canvas calls this function before propagating the touch event + to the WebView. Since Flickable does not accept touch events the canvas + tries to propagate a synthesized mouse event through the base class + childMouseEventFilter function which is accepted by Flickable and + interferes with the input events we send to Flicakble hence messes up + the internal state of the WebView. + This patch reimplements the virtual childMouseEventFilter method so that all + the mouse and touch events can be processed by WebKit before they arrive to + Flickable. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebView::childMouseEventFilter): + * UIProcess/API/qt/qquickwebview_p.h: + +2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix GTK+ debug build after r122425. + + * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp: + (webkitSoupCookieJarSqliteNew): + +2012-07-12 Sergio Villar Senin <svillar@igalia.com> + + [WK2] Performance issue in FindController::findString + https://bugs.webkit.org/show_bug.cgi?id=78132 + + Reviewed by Anders Carlsson. + + FindController should not unmark all text matches by default. It + will be done only if the string is not found or if + markAllTextMatches() is called. This will allow clients to look + for the next/previous without having to unmark() + mark() all the + text matches for every single search operation. + + * UIProcess/API/gtk/WebKitFindController.cpp: + (webKitFindControllerPerform): + (webkit_find_controller_search_next): + (webkit_find_controller_search_previous): + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::updateFindUIAfterPageScroll): + (WebKit::FindController::findString): + +2012-07-12 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][EFL] Add policy client to Ewk_View + https://bugs.webkit.org/show_bug.cgi?id=90953 + + Reviewed by Kenneth Rohde Christiansen. + + Emit new "policy,decision,navigation" and "policy,decision,new,window" + on the Ewk_View when policy decisions should be taken by the client. + + A new Ewk_Navigation_Policy_Decision type is introduced to provide + information about the navigation request and make a decision. + By default, the navigation request is accepted. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_navigation_policy_decision.cpp: Added. + (_Ewk_Navigation_Policy_Decision): + (ewk_navigation_policy_decision_free): + (ewk_navigation_policy_navigation_type_get): + (ewk_navigation_policy_mouse_button_get): + (ewk_navigation_policy_modifiers_get): + (ewk_navigation_policy_frame_name_get): + (ewk_navigation_policy_request_get): + (ewk_navigation_policy_decision_accept): + (ewk_navigation_policy_decision_reject): + (ewk_navigation_policy_decision_download): + (ewk_navigation_policy_decision_new): + * UIProcess/API/efl/ewk_navigation_policy_decision.h: Added. + * UIProcess/API/efl/ewk_navigation_policy_decision_private.h: Added. + * UIProcess/API/efl/ewk_private.h: Added. + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_base_add): + (ewk_view_navigation_policy_decision): + (ewk_view_new_window_policy_decision): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/ewk_view_policy_client.cpp: Added. + (toEwkView): + (decidePolicyForNavigationAction): + (decidePolicyForNewWindowAction): + (ewk_view_policy_client_attach): + * UIProcess/API/efl/ewk_view_policy_client_private.h: Added. + * UIProcess/API/efl/ewk_view_private.h: + +2012-07-11 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add webkit_cookie_manager_set_persistent_storage() to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=83016 + + Reviewed by Martin Robinson. + + Add a custom implementation of SoupCookieJarSqlite based on + libsoup code but using WebCore SQLite classes. SoupCookieJarSqlite + is part of libsoup-gnome, it's not a lot of code and it doesn't + change often, so it's better to simply have our own implementation + instead of making this important feature depend on an optional + dependency. There are plans to move the implementation to libsoup, + if that eventually happens we will remove our code to use libsoup + directly. + + * GNUmakefile.am: Add new dirs to include path. + * GNUmakefile.list.am: Add new files to compilation. + * PlatformEfl.cmake: Ditto. + * Shared/soup/SoupCookiePersistentStorageType.h: Added. + * UIProcess/API/gtk/WebKitCookieManager.cpp: + (webkit_cookie_manager_set_persistent_storage): Set a persistent + storage for cookies. + * UIProcess/API/gtk/WebKitCookieManager.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols + * UIProcess/API/gtk/tests/TestCookieManager.cpp: + (testCookieManagerPersistentStorage): + (serverCallback): + (beforeAll): + (afterAll): + * UIProcess/WebCookieManagerProxy.h: + (WebCookieManagerProxy): Add setCookiePersistentStorage() method + when using soup. + * UIProcess/soup/WebCookieManagerProxySoup.cpp: Added. + (WebKit::WebCookieManagerProxy::setCookiePersistentStorage): Send + SetCookiePersistentStorage message to the web process. + * WebProcess/Cookies/WebCookieManager.h: + (WebCookieManager): Add setCookiePersistentStorage() method when + using soup. + * WebProcess/Cookies/WebCookieManager.messages.in: Add + SetCookiePersistentStorage message when using soup. + * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: + (WebKit::WebCookieManager::setCookiePersistentStorage): Create a + new cookie jar for the given filename and storage type and add it + to the soup session. + * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp: Added. + (webkitSoupCookieJarSqliteOpenDatabase): Open SQLite database. + (webkitSoupCookieJarSqliteCreateTable): Create moz_cookies if it + doesn't exist. + (webkitSoupCookieJarSqliteLoad): Load the initial set of cookies + from the database. + (webkitSoupCookieJarSqliteInsertCookie): Insert a new cookie into + the database. + (webkitSoupCookieJarSqliteDeleteCookie): Delete an exising cookie + from the database. + (webkitSoupCookieJarSqliteChanged): Insert/delete cookies + depending on the change. + (webkitSoupCookieJarSqliteFinalize): + (webkit_soup_cookie_jar_sqlite_init): + (webkit_soup_cookie_jar_sqlite_class_init): + (webkitSoupCookieJarSqliteNew): + * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h: Added. + +2012-07-11 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][EFL] Ewk_View should provide more resource loading notifications + https://bugs.webkit.org/show_bug.cgi?id=90601 + + Reviewed by Antonio Gomes. + + Add new "resource,request,sent", "resource,request,response", + "resource,request,failed" and "resource,request,finished" to + Ewk_View in order to notify the clients of the main resource + load state changes. + + Introduce new Ewk_Url_Response type that is used to provide + information to the clients regarding the resource load + responses that are received. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_url_response.cpp: Added. + (_Ewk_Url_Response): + (ewk_url_response_ref): + (ewk_url_response_unref): + (ewk_url_response_url_get): + (ewk_url_response_status_code_get): + (ewk_url_response_mime_type_get): + (ewk_url_response_new): + * UIProcess/API/efl/ewk_url_response.h: Added. + * UIProcess/API/efl/ewk_url_response_private.h: Added. + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (ewk_view_resource_load_initiated): + (ewk_view_resource_load_response): + (ewk_view_resource_load_failed): + (ewk_view_resource_load_finished): + (ewk_view_resource_request_sent): + (ewk_view_load_provisional_started): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/API/efl/ewk_view_resource_load_client.cpp: + (toEwkView): + (didInitiateLoadForResource): + (didSendRequestForResource): + (didReceiveResponseForResource): + (didFinishLoadForResource): + (didFailLoadForResource): + (ewk_view_resource_load_client_attach): + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Fix a logic error in the #if so that the correct code is compiled on Snow Leopard. + + I introduced this in r122403 when I inverted the sense of the #if. + + * UIProcess/mac/WKFullScreenWindowController.mm: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes + + Reviewed by Dan Bernstein. + + * UIProcess/mac/WKFullScreenWindowController.mm: + (convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists + but otherwise provides a compatibility implementation of it. + (-[WKFullScreenWindowController enterFullScreen:]): Call our new helper. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * Shared/DictionaryPopupInfo.cpp: + * Shared/DictionaryPopupInfo.h: + * Shared/mac/PasteboardTypes.mm: + * Shared/mac/WebEventFactory.mm: + * UIProcess/API/mac/PDFViewController.mm: + * UIProcess/API/mac/PageClientImpl.mm: + * UIProcess/API/mac/WKView.mm: + * UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h: + * UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm: + * UIProcess/Launcher/mac/EnvironmentVariables.cpp: + * UIProcess/Launcher/mac/EnvironmentVariables.h: + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/mac/TextCheckerMac.mm: + * UIProcess/mac/WKFullScreenWindowController.mm: + * UIProcess/mac/WebContextMac.mm: + * UIProcess/mac/WebPageProxyMac.mm: + * WebKit2Prefix.h: + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + * WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/mac/WebPageMac.mm: + * WebProcess/com.apple.WebProcess.sb.in: + * WebProcess/mac/KeychainItemShimMethods.mm: + * WebProcess/mac/SecItemShimMethods.mm: + * WebProcess/mac/WebProcessMac.mm: + * WebProcess/mac/WebProcessMainMac.mm: + * WebProcess/mac/WebProcessShim.mm: + +2012-07-11 Simon Fraser <simon.fraser@apple.com> + + pagesPerView param is misnamed for WKPageSetPageLength() + https://bugs.webkit.org/show_bug.cgi?id=91033 + + Rubber-stamped by Dan Bernstein. + + The name of the second parameter to WKPageSetPageLength(), + 'pagesPerView', was confusing; it's a page size (normally width) + in pixels. + + * UIProcess/API/C/WKPagePrivate.h: + +2012-07-11 Anders Carlsson <andersca@apple.com> + + Add -Wtautological-compare and -Wsign-compare warning flags + https://bugs.webkit.org/show_bug.cgi?id=90994 + + Reviewed by Mark Rowe. + + * Configurations/Base.xcconfig: + +2012-07-11 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt][WK2] Test actual rendering results in API tests + https://bugs.webkit.org/show_bug.cgi?id=80609 + + Reviewed by Alexis Menard. + + Added a very basic test to tst_QQuickWebView to make sure rendering actually occurs. + + * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: + (tst_QQuickWebView): + (tst_QQuickWebView::basicRenderingSanity): + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Add a Mountain Lion version of libWebKitSystemInterface.a. + + Reviewed by John Sullivan. + + * Configurations/DebugRelease.xcconfig: Look for the library under its expected name. + +2012-07-11 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] QRawWebView should notify when rendering is done, so that pixel results can be grabbed at the appropriate moment. + https://bugs.webkit.org/show_bug.cgi?id=90641 + + Reviewed by Jocelyn Turcotte. + + Implement LayerTreeCoordinator::forceRepaint with logic equivalent to the one in + LayerTreeHostCA. If we flush the layers synchronously when forceRepaint is called,when + WKPageForceRepaint returns we are guaranteed to have an up-to-date image, as the visible + tiles are also synchronously updated. + + * UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp: + (WebView::WebView): + (WebView::viewNeedsDisplay): + (WebView::frameLoaded): + (WebView): + (WebView::onRepaintDone): + (WebView::finishForceRepaint): + (WebView::finishFirstLayoutForFrame): + (tst_qrawwebview::doNoBackground1): + (tst_qrawwebview::doNoBackground2): + (tst_qrawwebview::doNoBackground3): + (tst_qrawwebview::run): + The test for QRawWebView has been updated to use the WebKit2 ForcePaint API prior to + generating the pixel results. This has exposed a timing bug in the test - setting the + transparentBackground property of a page has to be done before it's created. This has + been fixed in the test. + + * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::forceRepaint): + (WebKit::LayerTreeCoordinator::performScheduledLayerFlush): + (WebKit): + +2012-07-11 MORITA Hajime <morrita@google.com> + + WebCoreSupport needs objects each of which follows major WebCore objects + https://bugs.webkit.org/show_bug.cgi?id=88499 + + Reviewed by Alexey Proskuryakov. + + Added exporting symbols. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + 2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed, rolling out r122318. diff --git a/Source/WebKit2/Configurations/Base.xcconfig b/Source/WebKit2/Configurations/Base.xcconfig index 0b06dea5f..0182371b9 100644 --- a/Source/WebKit2/Configurations/Base.xcconfig +++ b/Source/WebKit2/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors; +COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; @@ -49,6 +49,7 @@ GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_UNUSED_VARIABLE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR); @@ -96,15 +97,12 @@ DEAD_CODE_STRIPPING = YES; SECTORDER_FLAGS = -Wl,-order_file,mac/WebKit2.order; -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Source/WebKit2/Configurations/DebugRelease.xcconfig b/Source/WebKit2/Configurations/DebugRelease.xcconfig index 89be24a70..e5d40bff4 100644 --- a/Source/WebKit2/Configurations/DebugRelease.xcconfig +++ b/Source/WebKit2/Configurations/DebugRelease.xcconfig @@ -43,5 +43,5 @@ WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(TARGET_MAC WEBKIT_SYSTEM_INTERFACE_LIBRARY_1050 = WebKitSystemInterfaceLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_1060 = WebKitSystemInterfaceSnowLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_1070 = WebKitSystemInterfaceLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1080 = WebKitSystemInterfaceLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_1090 = WebKitSystemInterfaceLion; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_1080 = WebKitSystemInterfaceMountainLion; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_1090 = WebKitSystemInterfaceMountainLion; diff --git a/Source/WebKit2/DerivedSources.make b/Source/WebKit2/DerivedSources.make index ddb8e9a29..f1f5c2cec 100644 --- a/Source/WebKit2/DerivedSources.make +++ b/Source/WebKit2/DerivedSources.make @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Apple Inc. All rights reserved. +# Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -146,5 +146,6 @@ all : HeaderDetection.h HeaderDetection.h : DerivedSources.make if [ -f "$(WEBKITLIBRARIESDIR)/include/WebKitQuartzCoreAdditions/WebKitQuartzCoreAdditionsBase.h" ] && [ ! -f "$(WEBKITLIBRARIESDIR)/include/cairo/cairo.h" ]; then echo "#define HAVE_WKQCA 1" > $@; else echo > $@; fi + if [ -f "$(WEBKITLIBRARIESDIR)/include/AVFoundationCF/AVCFBase.h" ]; then echo "#define HAVE_AVCF 1" >> $@; else echo >> $@; fi endif # Windows_NT diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index b0c0724da..3e2ecaee4 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -40,6 +40,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP -I$(srcdir)/Source/WebKit2/Shared/Plugins \ -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape \ -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape/x11 \ + -I$(srcdir)/Source/WebKit2/Shared/soup \ -I$(srcdir)/Source/WebKit2/UIProcess \ -I$(srcdir)/Source/WebKit2/UIProcess/API \ -I$(srcdir)/Source/WebKit2/UIProcess/API/C \ @@ -418,6 +419,7 @@ Programs_WebKitPluginProcess_CPPFLAGS = \ -I$(srcdir)/Source/WebKit2/UIProcess/Launcher \ -I$(srcdir)/Source/WebKit2/WebProcess/Plugins/ \ -I$(srcdir)/Source/WebKit2/WebProcess/Plugins/Netscape/ \ + -I$(srcdir)/Source/WebKit2/Shared/soup \ -I$(top_builddir)/DerivedSources/WebKit2 \ -I$(top_builddir)/DerivedSources/WebKit2/include \ -I$(top_builddir)/DerivedSources/WebKit2/include/JavaScriptCore \ diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index d420afa22..e9348dee9 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -370,7 +370,6 @@ webkit2_sources += \ Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp \ Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp \ Source/WebKit2/Shared/gtk/NativeWebWheelEventGtk.cpp \ - Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h \ Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp \ Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp \ Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp \ @@ -427,6 +426,9 @@ webkit2_sources += \ Source/WebKit2/Shared/StatisticsData.cpp \ Source/WebKit2/Shared/StatisticsData.h \ Source/WebKit2/Shared/StringPairVector.h \ + Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp \ + Source/WebKit2/Shared/soup/PlatformCertificateInfo.h \ + Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h \ Source/WebKit2/Shared/TextCheckerState.h \ Source/WebKit2/Shared/UserMessageCoders.h \ Source/WebKit2/Shared/UpdateInfo.cpp \ @@ -788,6 +790,7 @@ webkit2_sources += \ Source/WebKit2/UIProcess/ProcessModel.h \ Source/WebKit2/UIProcess/ResponsivenessTimer.cpp \ Source/WebKit2/UIProcess/ResponsivenessTimer.h \ + Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp \ Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.cpp \ Source/WebKit2/UIProcess/soup/WebSoupRequestManagerClient.h \ Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp \ @@ -910,6 +913,8 @@ webkit2_sources += \ Source/WebKit2/WebProcess/Cookies/WebCookieManager.h \ Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp \ Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp \ + Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp \ + Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h \ Source/WebKit2/WebProcess/Downloads/Download.cpp \ Source/WebKit2/WebProcess/Downloads/Download.h \ Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h \ diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index bd07c3b39..9870e0e2e 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -27,6 +27,8 @@ LIST(APPEND WebKit2_SOURCES Shared/efl/WebEventFactory.cpp Shared/efl/WebCoreArgumentCodersEfl.cpp + Shared/soup/PlatformCertificateInfo.cpp + UIProcess/API/C/efl/WKView.cpp UIProcess/API/C/soup/WKContextSoup.cpp @@ -37,9 +39,12 @@ LIST(APPEND WebKit2_SOURCES UIProcess/API/efl/ewk_context.cpp UIProcess/API/efl/ewk_intent.cpp UIProcess/API/efl/ewk_intent_service.cpp + UIProcess/API/efl/ewk_navigation_policy_decision.cpp UIProcess/API/efl/ewk_url_request.cpp + UIProcess/API/efl/ewk_url_response.cpp UIProcess/API/efl/ewk_view.cpp UIProcess/API/efl/ewk_view_loader_client.cpp + UIProcess/API/efl/ewk_view_policy_client.cpp UIProcess/API/efl/ewk_view_resource_load_client.cpp UIProcess/API/efl/ewk_web_error.cpp UIProcess/API/efl/ewk_web_resource.cpp @@ -53,6 +58,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/efl/WebPageProxyEfl.cpp UIProcess/efl/WebPreferencesEfl.cpp + UIProcess/soup/WebCookieManagerProxySoup.cpp UIProcess/soup/WebSoupRequestManagerClient.cpp UIProcess/soup/WebSoupRequestManagerProxy.cpp @@ -62,6 +68,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp WebProcess/Cookies/soup/WebCookieManagerSoup.cpp + WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp WebProcess/Downloads/efl/DownloadEfl.cpp WebProcess/Downloads/efl/FileDownloaderEfl.cpp @@ -96,6 +103,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/network/soup" "${WEBCORE_DIR}/svg/graphics" "${WEBKIT2_DIR}/Shared/efl" + "${WEBKIT2_DIR}/Shared/soup" "${WEBKIT2_DIR}/UIProcess/API/C/efl" "${WEBKIT2_DIR}/UIProcess/API/C/soup" "${WEBKIT2_DIR}/UIProcess/API/efl" @@ -162,8 +170,61 @@ 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_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" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_request.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_view.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_web_error.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_web_resource.h" ) INSTALL(FILES ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc DESTINATION lib/pkgconfig) INSTALL(FILES ${EWebKit2_HEADERS} DESTINATION include/${WebKit2_LIBRARY_NAME}-${PROJECT_VERSION_MAJOR}) + +INCLUDE_DIRECTORIES(${THIRDPARTY_DIR}/gtest/include) + +SET(EWK2UnitTests_LIBRARIES + ${JavaScriptCore_LIBRARY_NAME} + ${WebCore_LIBRARY_NAME} + ${WebKit2_LIBRARY_NAME} + ${ECORE_LIBRARIES} + ${ECORE_EVAS_LIBRARIES} + ${EVAS_LIBRARIES} +) + +IF (ENABLE_GLIB_SUPPORT) + LIST(APPEND EWK2UnitTests_LIBRARIES + ${Glib_LIBRARIES} + ${Gthread_LIBRARIES} + ) +ENDIF() + +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}\") + +ADD_LIBRARY(ewk2UnitTestUtils + ${WEBKIT2_EFL_TEST_DIR}/UnitTestUtils/EWK2UnitTestBase.cpp + ${WEBKIT2_EFL_TEST_DIR}/UnitTestUtils/EWK2UnitTestEnvironment.cpp + ${WEBKIT2_EFL_TEST_DIR}/UnitTestUtils/EWK2UnitTestMain.cpp +) + +TARGET_LINK_LIBRARIES(ewk2UnitTestUtils ${EWK2UnitTests_LIBRARIES}) + +# The "ewk" on the test name needs to be suffixed with "2", otherwise it +# will clash with tests from the WebKit 1 test suite. +SET(EWK2UnitTests_BINARIES + test_ewk2_view +) + +IF (ENABLE_API_TESTS) + FOREACH (testName ${EWK2UnitTests_BINARIES}) + ADD_EXECUTABLE(${testName} ${WEBKIT2_EFL_TEST_DIR}/${testName}.cpp) + ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}) + SET_TESTS_PROPERTIES(${testName} PROPERTIES TIMEOUT 60) + TARGET_LINK_LIBRARIES(${testName} ${EWK2UnitTests_LIBRARIES} ewk2UnitTestUtils gtest pthread) + ENDFOREACH () +ENDIF () diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp index f38368611..41134c971 100644 --- a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp +++ b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp @@ -32,6 +32,10 @@ #include "WKAPICast.h" #include "WKContextMenuItemTypes.h" +#if PLATFORM(MAC) +#import <mach-o/dyld.h> +#endif + using namespace WebCore; using namespace WebKit; @@ -80,10 +84,36 @@ WKContextMenuItemRef WKContextMenuItemSeparatorItem() #endif } +#if PLATFORM(MAC) +static WKContextMenuItemTag compatibleContextMenuItemTag(WKContextMenuItemTag tag) +{ + static bool needsWorkaround = ^bool { + const int32_t safariFrameworkVersionWithIncompatibleContextMenuItemTags = 0x02181900; // 536.25.0 (Safari 6.0) + return NSVersionOfRunTimeLibrary("Safari") == safariFrameworkVersionWithIncompatibleContextMenuItemTags; + }(); + + if (!needsWorkaround) + return tag; + + // kWKContextMenuItemTagDictationAlternative was inserted before kWKContextMenuItemTagInspectElement. + // DictationAlternative is now at the end like it should have been. To be compatible we need to return + // InspectElement for DictationAlternative and shift InspectElement and after by one. + if (tag == kWKContextMenuItemTagDictationAlternative) + return kWKContextMenuItemTagInspectElement; + if (tag >= kWKContextMenuItemTagInspectElement && tag < kWKContextMenuItemBaseApplicationTag) + return tag + 1; + return tag; +} +#endif + WKContextMenuItemTag WKContextMenuItemGetTag(WKContextMenuItemRef itemRef) { #if ENABLE(CONTEXT_MENUS) +#if PLATFORM(MAC) + return compatibleContextMenuItemTag(toAPI(toImpl(itemRef)->data()->action())); +#else return toAPI(toImpl(itemRef)->data()->action()); +#endif #else return toAPI(ContextMenuItemTagNoAction); #endif diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h b/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h index b326794de..d53342663 100644 --- a/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h +++ b/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h @@ -88,7 +88,6 @@ enum { kWKContextMenuItemTagRightToLeft, kWKContextMenuItemTagPDFSinglePageScrolling, kWKContextMenuItemTagPDFFacingPagesScrolling, - kWKContextMenuItemTagDictationAlternative, kWKContextMenuItemTagInspectElement, kWKContextMenuItemTagTextDirectionMenu, kWKContextMenuItemTagTextDirectionDefault, @@ -114,6 +113,7 @@ enum { kWKContextMenuItemTagEnterVideoFullscreen, kWKContextMenuItemTagMediaPlayPause, kWKContextMenuItemTagMediaMute, + kWKContextMenuItemTagDictationAlternative, kWKContextMenuItemBaseApplicationTag = 10000 }; typedef uint32_t WKContextMenuItemTag; diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp index 63221a535..0f9d06ca1 100644 --- a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp +++ b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp @@ -40,7 +40,7 @@ void DictionaryPopupInfo::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encode(fontInfo); encoder->encodeEnum(type); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 bool hadOptions = options; encoder->encodeBool(hadOptions); if (hadOptions) @@ -56,7 +56,7 @@ bool DictionaryPopupInfo::decode(CoreIPC::ArgumentDecoder* decoder, DictionaryPo return false; if (!decoder->decodeEnum(result.type)) return false; -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 bool hadOptions; if (!decoder->decodeBool(hadOptions)) return false; diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.h b/Source/WebKit2/Shared/DictionaryPopupInfo.h index 3814eced0..bcec04c45 100644 --- a/Source/WebKit2/Shared/DictionaryPopupInfo.h +++ b/Source/WebKit2/Shared/DictionaryPopupInfo.h @@ -52,7 +52,7 @@ struct DictionaryPopupInfo { WebCore::FloatPoint origin; FontInfo fontInfo; Type type; -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 RetainPtr<CFDictionaryRef> options; #endif }; diff --git a/Source/WebKit2/Shared/ShareableSurface.cpp b/Source/WebKit2/Shared/ShareableSurface.cpp index cf10e163f..2ef5a4bb9 100644 --- a/Source/WebKit2/Shared/ShareableSurface.cpp +++ b/Source/WebKit2/Shared/ShareableSurface.cpp @@ -149,9 +149,11 @@ ShareableSurface::~ShareableSurface() PassRefPtr<ShareableSurface> ShareableSurface::create(const Handle& handle) { #if USE(GRAPHICS_SURFACE) + if (handle.graphicsSurfaceToken()) { RefPtr<GraphicsSurface> surface = GraphicsSurface::create(handle.m_size, handle.m_flags, handle.m_graphicsSurfaceToken); if (surface) return adoptRef(new ShareableSurface(handle.m_size, handle.m_flags, PassRefPtr<GraphicsSurface>(surface))); + } #endif RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle.m_bitmapHandle); diff --git a/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h b/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h deleted file mode 100644 index 34771b71e..000000000 --- a/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h +++ /dev/null @@ -1,51 +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; 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 PlatformCertificateInfo_h -#define PlatformCertificateInfo_h - -#include "ArgumentDecoder.h" -#include "ArgumentEncoder.h" -#include <WebCore/ResourceResponse.h> - -namespace WebKit { - -class PlatformCertificateInfo { -public: - PlatformCertificateInfo() - { - } - - explicit PlatformCertificateInfo(const WebCore::ResourceResponse&) - { - } - - void encode(CoreIPC::ArgumentEncoder*) const - { - } - - static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&) - { - return true; - } -}; - -} // namespace WebKit - -#endif // PlatformCertificateInfo_h diff --git a/Source/WebKit2/Shared/mac/PasteboardTypes.mm b/Source/WebKit2/Shared/mac/PasteboardTypes.mm index 26cc6dcd5..090eb0290 100644 --- a/Source/WebKit2/Shared/mac/PasteboardTypes.mm +++ b/Source/WebKit2/Shared/mac/PasteboardTypes.mm @@ -44,7 +44,7 @@ static inline NSArray *retain(NSArray *array) NSArray* PasteboardTypes::forEditing() { static NSArray *types = retain([NSArray arrayWithObjects:WebArchivePboardType, NSHTMLPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPDFPboardType, -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 NSPICTPboardType, #endif NSURLPboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, NSColorPboardType, kUTTypePNG, nil]); diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm index 7c185248a..772c0f706 100644 --- a/Source/WebKit2/Shared/mac/WebEventFactory.mm +++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm @@ -199,7 +199,7 @@ static NSPoint pointForEvent(NSEvent *event, NSView *windowView) static WebWheelEvent::Phase phaseForEvent(NSEvent *event) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 uint32_t phase = WebWheelEvent::PhaseNone; if ([event phase] & NSEventPhaseBegan) phase |= WebWheelEvent::PhaseBegan; @@ -211,7 +211,7 @@ static WebWheelEvent::Phase phaseForEvent(NSEvent *event) phase |= WebWheelEvent::PhaseEnded; if ([event phase] & NSEventPhaseCancelled) phase |= WebWheelEvent::PhaseCancelled; -#if !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if ([event phase] & NSEventPhaseMayBegin) phase |= WebWheelEvent::PhaseMayBegin; #endif @@ -226,7 +226,7 @@ static WebWheelEvent::Phase momentumPhaseForEvent(NSEvent *event) { uint32_t phase = WebWheelEvent::PhaseNone; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if ([event momentumPhase] & NSEventPhaseBegan) phase |= WebWheelEvent::PhaseBegan; if ([event momentumPhase] & NSEventPhaseStationary) diff --git a/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp new file mode 100644 index 000000000..c7baba3ee --- /dev/null +++ b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * 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 "PlatformCertificateInfo.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "DataReference.h" +#include <WebCore/ResourceResponse.h> +#include <libsoup/soup.h> + +using namespace WebCore; + +namespace WebKit { + +PlatformCertificateInfo::PlatformCertificateInfo() + : m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) +{ +} + +PlatformCertificateInfo::PlatformCertificateInfo(const ResourceResponse& response) + : m_certificate(response.soupMessageCertificate()) + , m_tlsErrors(response.soupMessageTLSErrors()) +{ +} + +PlatformCertificateInfo::~PlatformCertificateInfo() +{ +} + +void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + if (!m_certificate) { + encoder->encodeBool(false); + return; + } + + GByteArray* certificateData = 0; + g_object_get(G_OBJECT(m_certificate.get()), "certificate", &certificateData, NULL); + if (!certificateData) { + encoder->encodeBool(false); + return; + } + + encoder->encodeBool(true); + GRefPtr<GByteArray> certificate = adoptGRef(certificateData); + encoder->encodeVariableLengthByteArray(CoreIPC::DataReference(certificate->data, certificate->len)); + encoder->encode(static_cast<uint32_t>(m_tlsErrors)); +} + +bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& certificateInfo) +{ + bool hasCertificate; + if (!decoder->decode(hasCertificate)) + return false; + + if (!hasCertificate) + return true; + + CoreIPC::DataReference certificateDataReference; + if (!decoder->decodeVariableLengthByteArray(certificateDataReference)) + return false; + + GByteArray* certificateData = g_byte_array_sized_new(certificateDataReference.size()); + certificateData = g_byte_array_append(certificateData, certificateDataReference.data(), certificateDataReference.size()); + GRefPtr<GByteArray> certificate = adoptGRef(certificateData); + + GTlsBackend* backend = g_tls_backend_get_default(); + certificateInfo.m_certificate = adoptGRef(G_TLS_CERTIFICATE(g_initable_new(g_tls_backend_get_certificate_type(backend), 0, 0, + "certificate", certificate.get(), NULL))); + + uint32_t tlsErrors; + if (!decoder->decode(tlsErrors)) + return false; + certificateInfo.m_tlsErrors = static_cast<GTlsCertificateFlags>(tlsErrors); + + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h index 989467e96..0e76a3e94 100644 --- a/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h +++ b/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h @@ -27,30 +27,35 @@ #ifndef PlatformCertificateInfo_h #define PlatformCertificateInfo_h -#include "ArgumentDecoder.h" -#include "ArgumentEncoder.h" -#include <WebCore/ResourceResponse.h> +#include <libsoup/soup.h> +#include <wtf/gobject/GRefPtr.h> + +namespace CoreIPC { +class ArgumentDecoder; +class ArgumentEncoder; +} + +namespace WebCore { +class ResourceResponse; +} namespace WebKit { class PlatformCertificateInfo { public: - PlatformCertificateInfo() - { - } - - explicit PlatformCertificateInfo(const WebCore::ResourceResponse&) - { - } - - void encode(CoreIPC::ArgumentEncoder*) const - { - } - - static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&) - { - return true; - } + PlatformCertificateInfo(); + explicit PlatformCertificateInfo(const WebCore::ResourceResponse&); + ~PlatformCertificateInfo(); + + GTlsCertificate* certificate() const { return m_certificate.get(); } + GTlsCertificateFlags tlsErrors() const { return m_tlsErrors; } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&); + +private: + GRefPtr<GTlsCertificate> m_certificate; + GTlsCertificateFlags m_tlsErrors; }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h b/Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h new file mode 100644 index 000000000..9fc1c3cd3 --- /dev/null +++ b/Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * 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 SoupCookiePersistentStorageType_h +#define SoupCookiePersistentStorageType_h + +namespace WebKit { + +enum SoupCookiePersistentStorageType { + SoupCookiePersistentStorageText, + SoupCookiePersistentStorageSQLite +}; + +} // namespace WebKit + +#endif // SoupCookiePersistentStorageType_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h index 129d3959b..4a13ae7a2 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h @@ -65,7 +65,7 @@ WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginati WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page); WK_EXPORT void WKPageSetPaginationBehavesLikeColumns(WKPageRef page, bool behavesLikeColumns); WK_EXPORT bool WKPageGetPaginationBehavesLikeColumns(WKPageRef page); -WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pagesPerView); +WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pageLength); WK_EXPORT double WKPageGetPageLength(WKPageRef page); WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap); WK_EXPORT double WKPageGetGapBetweenPages(WKPageRef page); diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp index 2bd55e211..18c9e1443 100644 --- a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp +++ b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp @@ -35,9 +35,9 @@ using namespace WebCore; using namespace WebKit; -static inline BatteryProviderEfl* toBatteryProvider(const void* clientInfo) +static inline BatteryProvider* toBatteryProvider(const void* clientInfo) { - return static_cast<BatteryProviderEfl*>(const_cast<void*>(clientInfo)); + return static_cast<BatteryProvider*>(const_cast<void*>(clientInfo)); } static void startUpdatingCallback(WKBatteryManagerRef batteryManager, const void* clientInfo) diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h index 799d258e0..8fa90aeb9 100644 --- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h +++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h @@ -30,7 +30,9 @@ #include "ewk_context.h" #include "ewk_intent.h" #include "ewk_intent_service.h" +#include "ewk_navigation_policy_decision.h" #include "ewk_url_request.h" +#include "ewk_url_response.h" #include "ewk_view.h" #include "ewk_web_error.h" #include "ewk_web_resource.h" diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp index 791bc95f4..e1ccff23b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp @@ -35,9 +35,8 @@ struct _Ewk_Context { #endif _Ewk_Context(WKContextRef contextRef) - { - this->context = contextRef; - } + : context(contextRef) + { } }; WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp index 63b9ee364..ba923ee0b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp @@ -50,6 +50,17 @@ struct _Ewk_Intent { const char* action; const char* type; const char* service; + + _Ewk_Intent(WKIntentDataRef intentRef) + : __ref(1) +#if ENABLE(WEB_INTENTS) + , wkIntent(intentRef) +#endif + , action(0) + , type(0) + , service(0) + { + } }; #define EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent_, ...) \ @@ -82,7 +93,7 @@ void ewk_intent_unref(Ewk_Intent* intent) eina_stringshare_del(intent->action); eina_stringshare_del(intent->type); eina_stringshare_del(intent->service); - free(intent); + delete intent; #endif } @@ -192,11 +203,7 @@ Ewk_Intent* ewk_intent_new(WKIntentDataRef intentData) { EINA_SAFETY_ON_NULL_RETURN_VAL(intentData, 0); - Ewk_Intent* ewkIntent = static_cast<Ewk_Intent*>(calloc(1, sizeof(Ewk_Intent))); - ewkIntent->__ref = 1; - ewkIntent->wkIntent = intentData; - - return ewkIntent; + return new Ewk_Intent(intentData); } WKIntentDataRef ewk_intent_WKIntentDataRef_get(const Ewk_Intent* intent) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp index be9b84499..9395f421f 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp @@ -50,6 +50,18 @@ struct _Ewk_Intent_Service { const char* href; const char* title; const char* disposition; + + _Ewk_Intent_Service(WKIntentServiceInfoRef serviceRef) + : __ref(1) +#if ENABLE(WEB_INTENTS_TAG) + , wkService(serviceRef) +#endif + , action(0) + , type(0) + , href(0) + , title(0) + , disposition(0) + { } }; #define EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService_, ...) \ @@ -84,7 +96,7 @@ void ewk_intent_service_unref(Ewk_Intent_Service* service) eina_stringshare_del(service->href); eina_stringshare_del(service->title); eina_stringshare_del(service->disposition); - free(service); + delete service; #endif } @@ -168,10 +180,6 @@ Ewk_Intent_Service* ewk_intent_service_new(WKIntentServiceInfoRef wkService) { EINA_SAFETY_ON_NULL_RETURN_VAL(wkService, 0); - Ewk_Intent_Service* ewkIntentService = static_cast<Ewk_Intent_Service*>(calloc(1, sizeof(Ewk_Intent_Service))); - ewkIntentService->__ref = 1; - ewkIntentService->wkService = wkService; - - return ewkIntentService; + return new Ewk_Intent_Service(wkService); } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp new file mode 100644 index 000000000..a21649d34 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp @@ -0,0 +1,162 @@ +/* + * 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_navigation_policy_decision.h" + +#include "WKAPICast.h" +#include "WKFramePolicyListener.h" +#include "WKRetainPtr.h" +#include "ewk_navigation_policy_decision_private.h" +#include "ewk_private.h" +#include "ewk_url_request_private.h" + +using namespace WebKit; + +/** + * \struct _Ewk_Navigation_Policy_Decision + * @brief Contains the navigation policy decision data. + */ +struct _Ewk_Navigation_Policy_Decision { + WKRetainPtr<WKFramePolicyListenerRef> listener; + bool actedUponByClient; + Ewk_Navigation_Type navigationType; + Event_Mouse_Button mouseButton; + Event_Modifier_Keys modifiers; + Ewk_Url_Request* request; + const char* frameName; + + _Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef _listener, Ewk_Navigation_Type _navigationType, Event_Mouse_Button _mouseButton, Event_Modifier_Keys _modifiers, Ewk_Url_Request* _request, const char* _frameName) + : listener(_listener) + , actedUponByClient(false) + , navigationType(_navigationType) + , mouseButton(_mouseButton) + , modifiers(_modifiers) + , request(_request) + , frameName(eina_stringshare_add(_frameName)) + { } +}; + +void ewk_navigation_policy_decision_free(Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN(decision); + + // This is the default choice for all policy decisions in WebPageProxy.cpp. + if (!decision->actedUponByClient) + WKFramePolicyListenerUse(decision->listener.get()); + + ewk_url_request_unref(decision->request); + eina_stringshare_del(decision->frameName); + delete decision; +} + +Ewk_Navigation_Type ewk_navigation_policy_navigation_type_get(const Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(decision, EWK_NAVIGATION_TYPE_OTHER); + + return decision->navigationType; +} + +Event_Mouse_Button ewk_navigation_policy_mouse_button_get(const Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(decision, EVENT_MOUSE_BUTTON_NONE); + + return decision->mouseButton; +} + +Event_Modifier_Keys ewk_navigation_policy_modifiers_get(const Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(decision, static_cast<Event_Modifier_Keys>(0)); + + return decision->modifiers; +} + +const char* ewk_navigation_policy_frame_name_get(const Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(decision, 0); + + return decision->frameName; +} + +Ewk_Url_Request* ewk_navigation_policy_request_get(const Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(decision, 0); + + return decision->request; +} + +void ewk_navigation_policy_decision_accept(Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN(decision); + + WKFramePolicyListenerUse(decision->listener.get()); + decision->actedUponByClient = true; +} + +void ewk_navigation_policy_decision_reject(Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN(decision); + + WKFramePolicyListenerIgnore(decision->listener.get()); + decision->actedUponByClient = true; +} + +void ewk_navigation_policy_decision_download(Ewk_Navigation_Policy_Decision* decision) +{ + EINA_SAFETY_ON_NULL_RETURN(decision); + + WKFramePolicyListenerDownload(decision->listener.get()); + decision->actedUponByClient = true; +} + +// Ewk_Navigation_Type enum validation +COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_LINK_ACTIVATED, kWKFrameNavigationTypeLinkClicked); +COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_FORM_SUBMITTED, kWKFrameNavigationTypeFormSubmitted); +COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_BACK_FORWARD, kWKFrameNavigationTypeBackForward); +COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_RELOAD, kWKFrameNavigationTypeReload); +COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_FORM_RESUBMITTED, kWKFrameNavigationTypeFormResubmitted); +COMPILE_ASSERT_MATCHING_ENUM(EWK_NAVIGATION_TYPE_OTHER, kWKFrameNavigationTypeOther); + +// Event_Mouse_Button enum validation +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_NONE, kWKEventMouseButtonNoButton); +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_LEFT, kWKEventMouseButtonLeftButton); +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_MIDDLE, kWKEventMouseButtonMiddleButton); +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MOUSE_BUTTON_RIGHT, kWKEventMouseButtonRightButton); + +// Event_Modifier_Keys validation +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_SHIFT, kWKEventModifiersShiftKey); +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_CTRL, kWKEventModifiersControlKey); +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_ALT, kWKEventModifiersAltKey); +COMPILE_ASSERT_MATCHING_ENUM(EVENT_MODIFIER_KEY_META, kWKEventModifiersMetaKey); + +Ewk_Navigation_Policy_Decision* ewk_navigation_policy_decision_new(WKFrameNavigationType navigationType, WKEventMouseButton mouseButton, WKEventModifiers modifiers, WKURLRequestRef request, const char* frameName, WKFramePolicyListenerRef listener) +{ + return new Ewk_Navigation_Policy_Decision(listener, + static_cast<Ewk_Navigation_Type>(navigationType), + static_cast<Event_Mouse_Button>(mouseButton), + static_cast<Event_Modifier_Keys>(modifiers), + ewk_url_request_new(request), + frameName); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h new file mode 100644 index 000000000..7681a9f20 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h @@ -0,0 +1,154 @@ +/* + * 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_navigation_policy_decision.h + * @brief Describes the Ewk navigation policy decision API. + */ + +#ifndef ewk_navigation_policy_decision_h +#define ewk_navigation_policy_decision_h + +#include "ewk_url_request.h" +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Navigation_Policy_Decision */ +typedef struct _Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision; + +/// Enum containing navigation types +typedef enum { + EWK_NAVIGATION_TYPE_LINK_ACTIVATED, + EWK_NAVIGATION_TYPE_FORM_SUBMITTED, + EWK_NAVIGATION_TYPE_BACK_FORWARD, + EWK_NAVIGATION_TYPE_RELOAD, + EWK_NAVIGATION_TYPE_FORM_RESUBMITTED, + EWK_NAVIGATION_TYPE_OTHER +} Ewk_Navigation_Type; + +/// Enum containing button types +typedef enum { + EVENT_MOUSE_BUTTON_NONE = -1, + EVENT_MOUSE_BUTTON_LEFT = 0, + EVENT_MOUSE_BUTTON_MIDDLE = 1, + EVENT_MOUSE_BUTTON_RIGHT = 2 +} Event_Mouse_Button; + +typedef enum { + EVENT_MODIFIER_KEY_SHIFT = 1 << 0, + EVENT_MODIFIER_KEY_CTRL = 1 << 1, + EVENT_MODIFIER_KEY_ALT = 1 << 2, + EVENT_MODIFIER_KEY_META = 1 << 3 +} Event_Modifier_Keys; + +/** + * Frees the given object. + * + * @param decision the policy decision object to free + */ +EAPI void ewk_navigation_policy_decision_free(Ewk_Navigation_Policy_Decision *decision); + +/** + * Query type for this navigation policy decision. + * + * @param decision navigation policy decision object to query. + * + * @return the type of navigation. + */ +EAPI Ewk_Navigation_Type ewk_navigation_policy_navigation_type_get(const Ewk_Navigation_Policy_Decision *decision); + +/** + * Query mouse button for this navigation policy decision. + * + * @param decision navigation policy decision object to query. + * + * @return the mouse button clicked to trigger the navigation. + */ +EAPI Event_Mouse_Button ewk_navigation_policy_mouse_button_get(const Ewk_Navigation_Policy_Decision *decision); + +/** + * Query modifier keys for this navigation policy decision. + * + * @param decision navigation policy decision object to query. + * + * @return the modifier keys used when triggering the navigation. + */ +EAPI Event_Modifier_Keys ewk_navigation_policy_modifiers_get(const Ewk_Navigation_Policy_Decision *decision); + +/** + * Query frame name for this navigation policy decision. + * + * The frame name is non-null for new window policy decisions only. + * + * @param decision navigation policy decision object to query. + * + * @return the frame name pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup(). + */ +EAPI const char *ewk_navigation_policy_frame_name_get(const Ewk_Navigation_Policy_Decision *decision); + +/** + * Query URL request for this navigation policy decision. + * + * @param decision navigation policy decision object to query. + * + * @return The URL request pointer or @c NULL in case of error. + */ +EAPI Ewk_Url_Request *ewk_navigation_policy_request_get(const Ewk_Navigation_Policy_Decision *decision); + +/** + * Accepts the navigation request. + * + * The navigation will be accepted by default. + * + * @param decision navigation policy decision object to query. + */ +EAPI void ewk_navigation_policy_decision_accept(Ewk_Navigation_Policy_Decision *decision); + +/** + * Rejects the navigation request. + * + * @param decision navigation policy decision object to query. + */ +EAPI void ewk_navigation_policy_decision_reject(Ewk_Navigation_Policy_Decision *decision); + +/** + * Triggers a download instead of navigating to the url. + * + * @param decision navigation policy decision object to query. + */ +EAPI void ewk_navigation_policy_decision_download(Ewk_Navigation_Policy_Decision *decision); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_navigation_policy_decision_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h new file mode 100644 index 000000000..abc8bedc0 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h @@ -0,0 +1,37 @@ +/* + * 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_navigation_policy_decision_private_h +#define ewk_navigation_policy_decision_private_h + +#include "WKBase.h" +#include "WKEvent.h" +#include "WKPageLoadTypes.h" + +typedef struct _Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision; + +Ewk_Navigation_Policy_Decision* ewk_navigation_policy_decision_new(WKFrameNavigationType navigationType, WKEventMouseButton mouseButton, WKEventModifiers modifiers, WKURLRequestRef request, const char* frameName, WKFramePolicyListenerRef listener); + +#endif // ewk_navigation_policy_decision_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_private.h new file mode 100644 index 000000000..86ca42d4e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_private.h @@ -0,0 +1,34 @@ +/* + * 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_private_h +#define ewk_private_h + +#include <wtf/Assertions.h> + +#define COMPILE_ASSERT_MATCHING_ENUM(ewkName, webcoreName) \ + COMPILE_ASSERT(int(ewkName) == int(webcoreName), mismatchingEnums) + +#endif // ewk_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp index 0aa874bf7..f29a40e5d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp @@ -48,6 +48,14 @@ struct _Ewk_Url_Request { const char* url; const char* first_party; const char* http_method; + + _Ewk_Url_Request(WKURLRequestRef requestRef) + : __ref(1) + , wkRequest(requestRef) + , url(0) + , first_party(0) + , http_method(0) + { } }; #define EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest_, ...) \ @@ -77,7 +85,7 @@ void ewk_url_request_unref(Ewk_Url_Request* request) eina_stringshare_del(request->url); eina_stringshare_del(request->first_party); eina_stringshare_del(request->http_method); - free(request); + delete request; } const char* ewk_url_request_url_get(const Ewk_Url_Request* request) @@ -119,9 +127,5 @@ Ewk_Url_Request* ewk_url_request_new(WKURLRequestRef wkUrlRequest) { EINA_SAFETY_ON_NULL_RETURN_VAL(wkUrlRequest, 0); - Ewk_Url_Request* ewkUrlRequest = static_cast<Ewk_Url_Request*>(calloc(1, sizeof(Ewk_Url_Request))); - ewkUrlRequest->__ref = 1; - ewkUrlRequest->wkRequest = wkUrlRequest; - - return ewkUrlRequest; + return new Ewk_Url_Request(wkUrlRequest); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp new file mode 100644 index 000000000..2ab129717 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp @@ -0,0 +1,103 @@ +/* + * 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_url_response.h" + +#include "ewk_url_response_private.h" +#include <wtf/text/CString.h> + +/** + * \struct _Ewk_Url_Response + * @brief Contains the URL response data. + */ +struct _Ewk_Url_Response { + unsigned int __ref; /**< the reference count of the object */ + WebCore::ResourceResponse coreResponse; + + const char* url; + const char* mimeType; + + _Ewk_Url_Response(const WebCore::ResourceResponse& _coreResponse) + : __ref(1) + , coreResponse(_coreResponse) + , url(0) + , mimeType(0) + { } +}; + +void ewk_url_response_ref(Ewk_Url_Response* response) +{ + EINA_SAFETY_ON_NULL_RETURN(response); + ++response->__ref; +} + +void ewk_url_response_unref(Ewk_Url_Response* response) +{ + EINA_SAFETY_ON_NULL_RETURN(response); + + if (--response->__ref) + return; + + eina_stringshare_del(response->url); + eina_stringshare_del(response->mimeType); + delete response; +} + +const char* ewk_url_response_url_get(const Ewk_Url_Response* response) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + + Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response); + eina_stringshare_replace(&ewkResponse->url, response->coreResponse.url().string().utf8().data()); + + return response->url; +} + +int ewk_url_response_status_code_get(const Ewk_Url_Response* response) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + + return response->coreResponse.httpStatusCode(); +} + +const char* ewk_url_response_mime_type_get(const Ewk_Url_Response* response) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + + Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response); + eina_stringshare_replace(&ewkResponse->mimeType, response->coreResponse.mimeType().utf8().data()); + + return response->mimeType; +} + +/** + * @internal + * Constructs a Ewk_Url_Response from a WebCore::ResourceResponse. + */ +Ewk_Url_Response* ewk_url_response_new(const WebCore::ResourceResponse& coreResponse) +{ + return new Ewk_Url_Response(coreResponse); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h new file mode 100644 index 000000000..165e9a61c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h @@ -0,0 +1,101 @@ +/* + * 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_url_response.h + * @brief Describes the Ewk URL response API. + */ + +#ifndef ewk_url_response_h +#define ewk_url_response_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Url_Response */ +typedef struct _Ewk_Url_Response Ewk_Url_Response; + +/** + * Increases the reference count of the given object. + * + * @param response the URL response object to increase the reference count + */ +EAPI void ewk_url_response_ref(Ewk_Url_Response *response); + +/** + * Decreases the reference count of the given object, possibly freeing it. + * + * When the reference count it's reached 0, the URL request is freed. + * + * @param response the URL response object to decrease the reference count + */ +EAPI void ewk_url_response_unref(Ewk_Url_Response *response); + +/** + * Query URL for this response. + * + * @param response response object to query. + * + * @return the URL pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup(). + */ +EAPI const char *ewk_url_response_url_get(const Ewk_Url_Response *response); + +/** + * Query HTTP status code for this response. + * + * HTTP status code are defined by: + * http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html + * + * @param response response object to query. + * + * @return the HTTP status code. + */ +EAPI int ewk_url_response_status_code_get(const Ewk_Url_Response *response); + +/** + * Query MIME type for this response. + * + * @param response response object to query. + * + * @return the MIME type pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup(). + */ +EAPI const char *ewk_url_response_mime_type_get(const Ewk_Url_Response *response); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_url_response_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h new file mode 100644 index 000000000..32d563fdf --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h @@ -0,0 +1,35 @@ +/* + * 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_url_response_private_h +#define ewk_url_response_private_h + +#include <WebCore/ResourceResponse.h> + +typedef struct _Ewk_Url_Response Ewk_Url_Response; + +Ewk_Url_Response* ewk_url_response_new(const WebCore::ResourceResponse& resourceResponse); + +#endif // ewk_url_response_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index eb6b15bb5..eb1e5e7b2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -32,8 +32,10 @@ #include "ewk_context_private.h" #include "ewk_intent_private.h" #include "ewk_view_loader_client_private.h" +#include "ewk_view_policy_client_private.h" #include "ewk_view_private.h" #include "ewk_view_resource_load_client_private.h" +#include "ewk_web_resource.h" #include <wtf/text/CString.h> using namespace WebKit; @@ -41,10 +43,18 @@ using namespace WebCore; static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; +typedef HashMap<uint64_t, Ewk_Web_Resource*> LoadingResourcesMap; + struct _Ewk_View_Private_Data { OwnPtr<PageClientImpl> pageClient; const char* uri; const char* title; + LoadingResourcesMap loadingResourcesMap; + + _Ewk_View_Private_Data() + : uri(0) + , title(0) + { } }; #define EWK_VIEW_TYPE_CHECK(ewkView, result) \ @@ -255,8 +265,7 @@ static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL; static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) { - Ewk_View_Private_Data* priv = - static_cast<Ewk_View_Private_Data*>(calloc(1, sizeof(Ewk_View_Private_Data))); + Ewk_View_Private_Data* priv = new Ewk_View_Private_Data; if (!priv) { EINA_LOG_CRIT("could not allocate Ewk_View_Private_Data"); return 0; @@ -273,7 +282,7 @@ static void _ewk_view_priv_del(Ewk_View_Private_Data* priv) priv->pageClient = nullptr; eina_stringshare_del(priv->uri); eina_stringshare_del(priv->title); - free(priv); + delete priv; } static void _ewk_view_smart_add(Evas_Object* ewkView) @@ -495,6 +504,7 @@ Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGrou priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView); ewk_view_loader_client_attach(toAPI(priv->pageClient->page()), ewkView); + ewk_view_policy_client_attach(toAPI(priv->pageClient->page()), ewkView); ewk_view_resource_load_client_attach(toAPI(priv->pageClient->page()), ewkView); return ewkView; @@ -567,12 +577,96 @@ Eina_Bool ewk_view_stop(Evas_Object* ewkView) */ void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request) { - Ewk_Web_Resource_Request resourceRequest = {resource, request}; - // FIXME: We will need to store the resource and its identifier at some point - // to get the resource back from the identifier on resource load finish. + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + Ewk_Web_Resource_Request resourceRequest = {resource, request, 0}; + + // Keep the resource internally to reuse it later. + ewk_web_resource_ref(resource); + priv->loadingResourcesMap.add(resourceIdentifier, resource); + evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest); } +/** + * @internal + * Received a response to a resource load request in the view. + * + * Emits signal: "resource,request,response" with pointer to resource response. + */ +void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + if (!priv->loadingResourcesMap.contains(resourceIdentifier)) + return; + + Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Web_Resource_Load_Response resourceLoadResponse = {resource, response}; + evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse); +} + +/** + * @internal + * Failed loading a resource in the view. + * + * Emits signal: "resource,request,finished" with pointer to the resource load error. + */ +void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + if (!priv->loadingResourcesMap.contains(resourceIdentifier)) + return; + + Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Web_Resource_Load_Error resourceLoadError = {resource, error}; + evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError); +} + +/** + * @internal + * Finished loading a resource in the view. + * + * Emits signal: "resource,request,finished" with pointer to the resource. + */ +void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + if (!priv->loadingResourcesMap.contains(resourceIdentifier)) + return; + + Ewk_Web_Resource* resource = priv->loadingResourcesMap.take(resourceIdentifier); + evas_object_smart_callback_call(ewkView, "resource,request,finished", resource); + + ewk_web_resource_unref(resource); +} + +/** + * @internal + * Request was sent for a resource in the view. + * + * Emits signal: "resource,request,sent" with pointer to resource request and possible redirect response. + */ +void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + if (!priv->loadingResourcesMap.contains(resourceIdentifier)) + return; + + Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Web_Resource_Request resourceRequest = {resource, request, redirectResponse}; + + evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest); +} + const char* ewk_view_title_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); @@ -773,9 +867,42 @@ void ewk_view_load_provisional_redirect(Evas_Object* ewkView) */ void ewk_view_load_provisional_started(Evas_Object* ewkView) { + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + // The main frame started provisional load, we should clear + // the loadingResources HashMap to start clean. + LoadingResourcesMap::iterator it = priv->loadingResourcesMap.begin(); + LoadingResourcesMap::iterator end = priv->loadingResourcesMap.end(); + for ( ; it != end; ++it) + ewk_web_resource_unref(it->second); + priv->loadingResourcesMap.clear(); + evas_object_smart_callback_call(ewkView, "load,provisional,started", 0); } +/** + * @internal + * Reports that a navigation policy decision should be taken. + * + * Emits signal: "policy,decision,navigation". + */ +void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision) +{ + evas_object_smart_callback_call(ewkView, "policy,decision,navigation", decision); +} + +/** + * @internal + * Reports that a new window policy decision should be taken. + * + * Emits signal: "policy,decision,new,window". + */ +void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision) +{ + evas_object_smart_callback_call(ewkView, "policy,decision,new,window", decision); +} + Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index f6092a64e..58552ec7d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -34,7 +34,13 @@ * - "load,provisional,failed", const Ewk_Web_Error*: view provisional load failed. * - "load,provisional,redirect", void: view received redirect for provisional load. * - "load,provisional,started", void: view started provisional load. + * - "policy,decision,navigation", Ewk_Navigation_Policy_Decision*: a navigation policy decision should be taken. + * - "policy,decision,new,window", Ewk_Navigation_Policy_Decision*: a new window policy decision should be taken. + * - "resource,request,failed", const Ewk_Web_Resource_Load_Error*: a resource failed loading. + * - "resource,request,finished", const Ewk_Web_Resource*: a resource finished loading. * - "resource,request,new", const Ewk_Web_Resource_Request*: a resource request was initiated. + * - "resource,request,response", Ewk_Web_Resource_Load_Response*: a response to a resource request was received. + * - "resource,request,sent", const Ewk_Web_Resource_Request*: a resource request was sent. * - "title,changed", const char*: title of the main frame was changed. */ @@ -44,6 +50,8 @@ #include "ewk_context.h" #include "ewk_intent.h" #include "ewk_url_request.h" +#include "ewk_url_response.h" +#include "ewk_web_error.h" #include "ewk_web_resource.h" #include <Evas.h> @@ -145,12 +153,35 @@ typedef struct _Ewk_Web_Resource_Request Ewk_Web_Resource_Request; /** * @brief Structure containing details about a resource request. - * - * Details given about a resource is loaded. */ struct _Ewk_Web_Resource_Request { Ewk_Web_Resource *resource; /**< resource being requested */ Ewk_Url_Request *request; /**< URL request for the resource */ + Ewk_Url_Response *redirect_response; /**< Possible redirect response for the resource */ +}; + +/// Creates a type name for _Ewk_Web_Resource_Load_Response. +typedef struct _Ewk_Web_Resource_Load_Response Ewk_Web_Resource_Load_Response; + +/** + * @brief Structure containing details about a response to a resource request. + */ +struct _Ewk_Web_Resource_Load_Response { + Ewk_Web_Resource *resource; /**< resource requested */ + Ewk_Url_Response *response; /**< resource load response */ +}; + +/// Creates a type name for _Ewk_Web_Resource_Load_Error. +typedef struct _Ewk_Web_Resource_Load_Error Ewk_Web_Resource_Load_Error; + +/** + * @brief Structure containing details about a resource load error. + * + * Details given about a resource load failure. + */ +struct _Ewk_Web_Resource_Load_Error { + Ewk_Web_Resource *resource; /**< resource that failed loading */ + Ewk_Web_Error *error; /**< load error */ }; /** diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp new file mode 100644 index 000000000..5f689e56d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client.cpp @@ -0,0 +1,66 @@ +/* + * 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 "WKFrame.h" +#include "ewk_navigation_policy_decision.h" +#include "ewk_navigation_policy_decision_private.h" +#include "ewk_view_policy_client_private.h" +#include "ewk_view_private.h" +#include <wtf/text/CString.h> + +using namespace WebKit; + +static inline Evas_Object* toEwkView(const void* clientInfo) +{ + return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); +} + +static void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo) +{ + Ewk_Navigation_Policy_Decision* decision = ewk_navigation_policy_decision_new(navigationType, mouseButton, modifiers, request, 0, listener); + ewk_view_navigation_policy_decision(toEwkView(clientInfo), decision); + ewk_navigation_policy_decision_free(decision); +} + +static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo) +{ + Ewk_Navigation_Policy_Decision* decision = ewk_navigation_policy_decision_new(navigationType, mouseButton, modifiers, request, toImpl(frameName)->string().utf8().data(), listener); + ewk_view_new_window_policy_decision(toEwkView(clientInfo), decision); + ewk_navigation_policy_decision_free(decision); +} + +void ewk_view_policy_client_attach(WKPageRef pageRef, Evas_Object* ewkView) +{ + WKPagePolicyClient policyClient; + memset(&policyClient, 0, sizeof(WKPagePolicyClient)); + policyClient.version = kWKPagePolicyClientCurrentVersion; + policyClient.clientInfo = ewkView; + policyClient.decidePolicyForNavigationAction = decidePolicyForNavigationAction; + policyClient.decidePolicyForNewWindowAction = decidePolicyForNewWindowAction; + + WKPageSetPagePolicyClient(pageRef, &policyClient); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h new file mode 100644 index 000000000..c67248d96 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_policy_client_private.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_view_policy_client_private_h +#define ewk_view_policy_client_private_h + +#include <Evas.h> +#include <WebKit2/WKBase.h> + +void ewk_view_policy_client_attach(WKPageRef pageRef, Evas_Object* ewkView); + +#endif // ewk_view_policy_client_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index f9f21136c..3c9ce94a7 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -31,8 +31,10 @@ class IntSize; } typedef struct _Ewk_Url_Request Ewk_Url_Request; +typedef struct _Ewk_Url_Response Ewk_Url_Response; typedef struct _Ewk_Web_Error Ewk_Web_Error; typedef struct _Ewk_Web_Resource Ewk_Web_Resource; +typedef struct _Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision; #if ENABLE(WEB_INTENTS) typedef struct _Ewk_Intent Ewk_Intent; #endif @@ -48,8 +50,14 @@ void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress); void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* error); void ewk_view_load_provisional_redirect(Evas_Object* ewkView); void ewk_view_load_provisional_started(Evas_Object* ewkView); +void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision); +void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision); void ewk_view_title_changed(Evas_Object* ewkView, const char* title); +void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error); +void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier); void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request); +void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response); +void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse); Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp index 6be39a208..505bbeddb 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp @@ -31,29 +31,67 @@ #include "WKRetainPtr.h" #include "WKURL.h" #include "WKURLRequest.h" +#include "WKURLResponse.h" #include "ewk_url_request.h" #include "ewk_url_request_private.h" +#include "ewk_url_response.h" +#include "ewk_url_response_private.h" #include "ewk_view_private.h" #include "ewk_view_resource_load_client_private.h" +#include "ewk_web_error.h" +#include "ewk_web_error_private.h" #include "ewk_web_resource.h" #include "ewk_web_resource_private.h" #include <wtf/text/CString.h> using namespace WebKit; +static inline Evas_Object* toEwkView(const void* clientInfo) +{ + return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); +} + static void didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, bool pageIsProvisionallyLoading, const void* clientInfo) { - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading); WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest)); Ewk_Web_Resource* resource = ewk_web_resource_new(toImpl(wkUrl.get())->string().utf8().data(), isMainResource); Ewk_Url_Request* request = ewk_url_request_new(wkRequest); - ewk_view_resource_load_initiated(ewkView, resourceIdentifier, resource, request); + ewk_view_resource_load_initiated(toEwkView(clientInfo), resourceIdentifier, resource, request); ewk_web_resource_unref(resource); ewk_url_request_unref(request); } +static void didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo) +{ + Ewk_Url_Request* request = ewk_url_request_new(wkRequest); + Ewk_Url_Response* redirectResponse = ewk_url_response_new(toImpl(wkRedirectResponse)->resourceResponse()); + ewk_view_resource_request_sent(toEwkView(clientInfo), resourceIdentifier, request, redirectResponse); + ewk_url_request_unref(request); + ewk_url_response_unref(redirectResponse); +} + +static void didReceiveResponseForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLResponseRef wkResponse, const void* clientInfo) +{ + Ewk_Url_Response* response = ewk_url_response_new(toImpl(wkResponse)->resourceResponse()); + ewk_view_resource_load_response(toEwkView(clientInfo), resourceIdentifier, response); + ewk_url_response_unref(response); +} + +static void didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, const void* clientInfo) +{ + ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier); +} + +static void didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef wkError, const void* clientInfo) +{ + Ewk_Web_Error* ewkError = ewk_web_error_new(wkError); + ewk_view_resource_load_failed(toEwkView(clientInfo), resourceIdentifier, ewkError); + ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier); + ewk_web_error_free(ewkError); +} + void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView) { WKPageResourceLoadClient wkResourceLoadClient; @@ -61,6 +99,10 @@ void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkVie wkResourceLoadClient.version = kWKPageResourceLoadClientCurrentVersion; wkResourceLoadClient.clientInfo = ewkView; wkResourceLoadClient.didInitiateLoadForResource = didInitiateLoadForResource; + wkResourceLoadClient.didSendRequestForResource = didSendRequestForResource; + wkResourceLoadClient.didReceiveResponseForResource = didReceiveResponseForResource; + wkResourceLoadClient.didFinishLoadForResource = didFinishLoadForResource; + wkResourceLoadClient.didFailLoadForResource = didFailLoadForResource; WKPageSetPageResourceLoadClient(pageRef, &wkResourceLoadClient); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp index 96b08d3e5..0ac75ab68 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp @@ -44,6 +44,12 @@ struct _Ewk_Web_Error { const char* url; const char* description; + + _Ewk_Web_Error(WKErrorRef errorRef) + : wkError(errorRef) + , url(0) + , description(0) + { } }; #define EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError_, ...) \ @@ -63,7 +69,7 @@ void ewk_web_error_free(Ewk_Web_Error *error) eina_stringshare_del(error->url); eina_stringshare_del(error->description); - free(error); + delete error; } Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error) @@ -122,8 +128,5 @@ Ewk_Web_Error* ewk_web_error_new(WKErrorRef error) { EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0); - Ewk_Web_Error* ewkError = static_cast<Ewk_Web_Error*>(calloc(1, sizeof(Ewk_Web_Error))); - ewkError->wkError = error; - - return ewkError; + return new Ewk_Web_Error(error); } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp index ce1ddde65..44d9c2afc 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp @@ -31,8 +31,14 @@ struct _Ewk_Web_Resource { unsigned int __ref; /**< the reference count of the object */ - CString url; + const char* url; bool isMainResource; + + _Ewk_Web_Resource(const char* _url, bool _isMainResource) + : __ref(1) + , url(eina_stringshare_add(_url)) + , isMainResource(_isMainResource) + { } }; void ewk_web_resource_ref(Ewk_Web_Resource* resource) @@ -49,14 +55,15 @@ void ewk_web_resource_unref(Ewk_Web_Resource* resource) if (--resource->__ref) return; - free(resource); + eina_stringshare_del(resource->url); + delete resource; } const char* ewk_web_resource_url_get(const Ewk_Web_Resource* resource) { EINA_SAFETY_ON_NULL_RETURN_VAL(resource, 0); - return resource->url.data(); + return resource->url; } /** @@ -67,12 +74,7 @@ Ewk_Web_Resource* ewk_web_resource_new(const char* url, bool isMainResource) { EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0); - Ewk_Web_Resource* resource = static_cast<Ewk_Web_Resource*>(calloc(1, sizeof(Ewk_Web_Resource))); - resource->url = url; - resource->isMainResource = isMainResource; - resource->__ref = 1; - - return resource; + return new Ewk_Web_Resource(url, isMainResource); } Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource* resource) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h index 6a3b0802b..3d78d4bc9 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h @@ -61,7 +61,11 @@ EAPI void ewk_web_resource_unref(Ewk_Web_Resource *resource); * * @param resource resource object to query. * - * @return the URL pointer, that may be @c NULL. + * @return the URL pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup(). */ EAPI const char *ewk_web_resource_url_get(const Ewk_Web_Resource *resource); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp new file mode 100644 index 000000000..b96643049 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp @@ -0,0 +1,90 @@ +/* + Copyright (C) 2012 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" +#include "EWK2UnitTestBase.h" + +#include "EWK2UnitTestEnvironment.h" +#include <EWebKit2.h> +#include <Ecore.h> +#include <wtf/UnusedParam.h> + +extern EWK2UnitTest::EWK2UnitTestEnvironment* environment; + +namespace EWK2UnitTest { + +static void onLoadProgress(void* userData, Evas_Object* webView, void* eventInfo) +{ + UNUSED_PARAM(webView); + + EWK2UnitTestBase* test = static_cast<EWK2UnitTestBase*>(userData); + double progress = *static_cast<double*>(eventInfo); + + test->setLoadProgress(progress); +} + +EWK2UnitTestBase::EWK2UnitTestBase() + : m_loadProgress(0) + , m_ecoreEvas(0) + , m_webView(0) +{ +} + +void EWK2UnitTestBase::SetUp() +{ + ASSERT_GT(ecore_evas_init(), 0); + + unsigned int width = environment->defaultWidth(); + unsigned int height = environment->defaultHeight(); + + if (environment->useX11Window()) + m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0); + else + m_ecoreEvas = ecore_evas_buffer_new(width, height); + + ecore_evas_show(m_ecoreEvas); + Evas* evas = ecore_evas_get(m_ecoreEvas); + + m_webView = ewk_view_add(evas); + evas_object_resize(m_webView, width, height); + evas_object_show(m_webView); + evas_object_focus_set(m_webView, true); +} + +void EWK2UnitTestBase::TearDown() +{ + evas_object_del(m_webView); + ecore_evas_free(m_ecoreEvas); + ecore_evas_shutdown(); +} + +void EWK2UnitTestBase::loadUrlSync(const char* url) +{ + m_loadProgress = 0; + + evas_object_smart_callback_add(m_webView, "load,progress", onLoadProgress, this); + ewk_view_uri_set(m_webView, url); + + while (m_loadProgress != 1) + ecore_main_loop_iterate(); + + evas_object_smart_callback_del(m_webView, "load,progress", onLoadProgress); +} + +} // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h new file mode 100644 index 000000000..794688140 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2012 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef EWK2UnitTestBase_h +#define EWK2UnitTestBase_h + +#include <Ecore_Evas.h> +#include <Evas.h> +#include <gtest/gtest.h> + +namespace EWK2UnitTest { + +class EWK2UnitTestBase : public ::testing::Test { +public: + void setLoadProgress(float progress) { m_loadProgress = progress; } + Evas_Object* webView() { return m_webView; } + +protected: + EWK2UnitTestBase(); + + virtual void SetUp(); + virtual void TearDown(); + + void loadUrlSync(const char* url); + +private: + Evas_Object* m_webView; + Ecore_Evas* m_ecoreEvas; + + float m_loadProgress; +}; + +} // namespace EWK2UnitTest + +#endif // EWK2UnitTestBase_h diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp new file mode 100644 index 000000000..61cb53e0f --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp @@ -0,0 +1,37 @@ +/* + Copyright (C) 2012 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" +#include "EWK2UnitTestEnvironment.h" + +namespace EWK2UnitTest { + +EWK2UnitTestEnvironment::EWK2UnitTestEnvironment(bool useX11Window) + : m_defaultWidth(800) + , m_defaultHeight(600) + , m_useX11Window(useX11Window) +{ +} + +const char* EWK2UnitTestEnvironment::defaultTestPageUrl() const +{ + return "file://"TEST_RESOURCES_DIR"/default_test_page.html"; +} + +} // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h new file mode 100644 index 000000000..9e076bea0 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef EWK2UnitTestEnvironment_h +#define EWK2UnitTestEnvironment_h + +#include <gtest/gtest.h> + +namespace EWK2UnitTest { + +class EWK2UnitTestEnvironment : public ::testing::Environment { +public: + EWK2UnitTestEnvironment(bool useX11Window); + + bool useX11Window() const { return m_useX11Window; } + const char* defaultTestPageUrl() const; + + virtual unsigned int defaultWidth() const { return m_defaultWidth; } + virtual unsigned int defaultHeight() const { return m_defaultHeight; } + +private: + unsigned int m_defaultWidth; + unsigned int m_defaultHeight; + + bool m_useX11Window; +}; + +} // namespace EWK2UnitTest + +#endif // EWK2UnitTestEnvironment_h diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp new file mode 100644 index 000000000..06e9c069a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp @@ -0,0 +1,53 @@ +/* + Copyright (C) 2012 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "EWK2UnitTestBase.h" +#include "EWK2UnitTestEnvironment.h" +#include <getopt.h> +#include <gtest/gtest.h> + +using namespace EWK2UnitTest; + +EWK2UnitTestEnvironment* environment = 0; + +static bool parseArguments(int argc, char** argv) +{ + int useX11Window = 0; + + static const option options[] = { + {"useX11Window", no_argument, &useX11Window, 1}, + {0, 0, 0, 0} + }; + + while (getopt_long(argc, argv, "", options, 0) != -1) { } + + return useX11Window; +} + +int main(int argc, char** argv) +{ + bool useX11Window = parseArguments(argc, argv); + + ::testing::InitGoogleTest(&argc, argv); + + environment = new EWK2UnitTestEnvironment(useX11Window); + testing::AddGlobalTestEnvironment(environment); + + return RUN_ALL_TESTS(); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html new file mode 100644 index 000000000..edd81e732 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html @@ -0,0 +1,6 @@ +<HTML> +<BODY> +<H2 align="center">EFL Unit Tests</H2> +<H2 align="center">Default Testing Web Page</H2> +</BODY> +</HTML> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp new file mode 100644 index 000000000..8ee134d35 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -0,0 +1,35 @@ +/* + Copyright (C) 2012 Samsung Electronics + Copyright (C) 2012 Intel Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" + +#include "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include <EWebKit2.h> +#include <gtest/gtest.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +TEST_F(EWK2UnitTestBase, ewk_view_uri_get) +{ + loadUrlSync(environment->defaultTestPageUrl()); + EXPECT_STREQ(ewk_view_uri_get(webView()), environment->defaultTestPageUrl()); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp index 7d8a10e1f..8790c7cbf 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "WebKitCookieManager.h" +#include "SoupCookiePersistentStorageType.h" +#include "WebCookieManagerProxy.h" #include "WebKitCookieManagerPrivate.h" #include "WebKitEnumTypes.h" #include <wtf/gobject/GRefPtr.h> @@ -41,6 +43,9 @@ static guint signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE(WebKitCookieManager, webkit_cookie_manager, G_TYPE_OBJECT) +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite); + COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS, kWKHTTPCookieAcceptPolicyAlways); COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NEVER, kWKHTTPCookieAcceptPolicyNever); COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY, kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain); @@ -104,6 +109,30 @@ WebKitCookieManager* webkitCookieManagerCreate(WKCookieManagerRef wkCookieManage } /** + * webkit_cookie_manager_set_persistent_storage: + * @cookie_manager: a #WebKitCookieManager + * @filename: the filename to read to/write from + * @storage: a #WebKitCookiePersistentStorage + * + * Set the @filename where non-session cookies are stored persistently using + * @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 when the WebKitCookieManager::changed + * signal is emitted. + * By default, @cookie_manager doesn't store the cookies persistenly, so you need to call this + * method to keep cookies saved across sessions. + */ +void webkit_cookie_manager_set_persistent_storage(WebKitCookieManager* manager, const char* filename, WebKitCookiePersistentStorage storage) +{ + g_return_if_fail(WEBKIT_IS_COOKIE_MANAGER(manager)); + g_return_if_fail(filename); + + WKCookieManagerStopObservingCookieChanges(manager->priv->wkCookieManager.get()); + toImpl(manager->priv->wkCookieManager.get())->setCookiePersistentStorage(String::fromUTF8(filename), storage); + WKCookieManagerStartObservingCookieChanges(manager->priv->wkCookieManager.get()); +} + +/** * webkit_cookie_manager_set_accept_policy: * @cookie_manager: a #WebKitCookieManager * @policy: a #WebKitCookieAcceptPolicy diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h index 2472d96a2..28dfe28ef 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h @@ -42,6 +42,20 @@ typedef struct _WebKitCookieManagerClass WebKitCookieManagerClass; typedef struct _WebKitCookieManagerPrivate WebKitCookieManagerPrivate; /** + * WebKitCookiePersistentStorage: + * @WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT: Cookies are stored in a text + * file in the Mozilla "cookies.txt" format. + * @WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE: Cookies are stored in a SQLite + * file in the current Mozilla format. + * + * Enum values used to denote the cookie persistent storage types. + */ +typedef enum { + WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT, + WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE +} WebKitCookiePersistentStorage; + +/** * WebKitCookieAcceptPolicy: * @WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS: Accept all cookies unconditionally. * @WEBKIT_COOKIE_POLICY_ACCEPT_NEVER: Reject all cookies unconditionally. @@ -69,37 +83,42 @@ WEBKIT_API GType webkit_cookie_manager_get_type (void); WEBKIT_API void -webkit_cookie_manager_set_accept_policy (WebKitCookieManager *cookie_manager, - WebKitCookieAcceptPolicy policy); +webkit_cookie_manager_set_persistent_storage (WebKitCookieManager *cookie_manager, + const gchar *filename, + WebKitCookiePersistentStorage storage); + +WEBKIT_API void +webkit_cookie_manager_set_accept_policy (WebKitCookieManager *cookie_manager, + WebKitCookieAcceptPolicy policy); WEBKIT_API void -webkit_cookie_manager_get_accept_policy (WebKitCookieManager *cookie_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +webkit_cookie_manager_get_accept_policy (WebKitCookieManager *cookie_manager, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); WEBKIT_API WebKitCookieAcceptPolicy -webkit_cookie_manager_get_accept_policy_finish (WebKitCookieManager *cookie_manager, - GAsyncResult *result, - GError **error); +webkit_cookie_manager_get_accept_policy_finish (WebKitCookieManager *cookie_manager, + GAsyncResult *result, + GError **error); WEBKIT_API void -webkit_cookie_manager_get_domains_with_cookies (WebKitCookieManager *cookie_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +webkit_cookie_manager_get_domains_with_cookies (WebKitCookieManager *cookie_manager, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); WEBKIT_API gchar ** -webkit_cookie_manager_get_domains_with_cookies_finish (WebKitCookieManager *cookie_manager, - GAsyncResult *result, - GError **error); +webkit_cookie_manager_get_domains_with_cookies_finish (WebKitCookieManager *cookie_manager, + GAsyncResult *result, + GError **error); WEBKIT_API void -webkit_cookie_manager_delete_cookies_for_domain (WebKitCookieManager *cookie_manager, - const gchar *domain); +webkit_cookie_manager_delete_cookies_for_domain (WebKitCookieManager *cookie_manager, + const gchar *domain); WEBKIT_API void -webkit_cookie_manager_delete_all_cookies (WebKitCookieManager *cookie_manager); +webkit_cookie_manager_delete_all_cookies (WebKitCookieManager *cookie_manager); G_END_DECLS diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp index 360137e16..56be3c767 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp @@ -48,6 +48,7 @@ enum { typedef enum { FindOperation, + FindNextPrevOperation, CountOperation } WebKitFindControllerOperation; @@ -345,17 +346,22 @@ static void webKitFindControllerPerform(WebKitFindController* findController, We WKRetainPtr<WKStringRef> wkSearchText(AdoptWK, WKStringCreateWithUTF8CString(findController->priv->searchText.data())); WKPageRef wkPage = getWKPageFromWebKitWebView(findController->priv->webView); - if (operation == FindOperation) { - // Unconditionally highlight text matches. WK1 API was forcing - // clients to enable/disable highlighting. Since most of them - // (all?) where using highlighting we decided to simplify the - // WK2 API and unconditionally show highlights. - wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions | kWKFindOptionsShowHighlight); - WKPageFindString(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); + if (operation == CountOperation) { + WKPageCountStringMatches(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); return; } - WKPageCountStringMatches(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); + if (operation == FindOperation) + // Unconditionally highlight text matches when the search + // starts. WK1 API was forcing clients to enable/disable + // highlighting. Since most of them (all?) where using that + // feature we decided to simplify the WK2 API and + // unconditionally show highlights. Both search_next() and + // search_prev() should not enable highlighting to avoid an + // extra unmarkAllTextMatches() + markAllTextMatches() + wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions | kWKFindOptionsShowHighlight); + + WKPageFindString(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); } static inline void webKitFindControllerSetSearchData(WebKitFindController* findController, const gchar* searchText, guint32 findOptions, guint maxMatchCount) @@ -415,7 +421,8 @@ void webkit_find_controller_search_next(WebKitFindController* findController) g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController)); findController->priv->findOptions = findController->priv->findOptions & ~WEBKIT_FIND_OPTIONS_BACKWARDS; - webKitFindControllerPerform(findController, FindOperation); + findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight; + webKitFindControllerPerform(findController, FindNextPrevOperation); } /** @@ -432,7 +439,8 @@ void webkit_find_controller_search_previous(WebKitFindController* findController g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController)); findController->priv->findOptions = findController->priv->findOptions | WEBKIT_FIND_OPTIONS_BACKWARDS; - webKitFindControllerPerform(findController, FindOperation); + findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight; + webKitFindControllerPerform(findController, FindNextPrevOperation); } /** diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp index 034768cb0..8115d63dd 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp @@ -277,7 +277,8 @@ static bool stringIsEqualToCString(const String& string, const CString& cString) bool webkitHitTestResultCompare(WebKitHitTestResult* hitTestResult, WKHitTestResultRef wkHitTestResult) { WebKitHitTestResultPrivate* priv = hitTestResult->priv; - return stringIsEqualToCString(toImpl(wkHitTestResult)->absoluteLinkURL(), priv->linkURI) + return WKHitTestResultIsContentEditable(wkHitTestResult) == webkit_hit_test_result_context_is_editable(hitTestResult) + && stringIsEqualToCString(toImpl(wkHitTestResult)->absoluteLinkURL(), priv->linkURI) && stringIsEqualToCString(toImpl(wkHitTestResult)->linkTitle(), priv->linkTitle) && stringIsEqualToCString(toImpl(wkHitTestResult)->linkLabel(), priv->linkLabel) && stringIsEqualToCString(toImpl(wkHitTestResult)->absoluteImageURL(), priv->imageURI) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp index e30e51d46..8cd149c5b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp @@ -22,6 +22,7 @@ #include "WebKitLoaderClient.h" #include "WebKitBackForwardListPrivate.h" +#include "WebKitURIResponsePrivate.h" #include "WebKitWebViewBasePrivate.h" #include "WebKitWebViewPrivate.h" #include <wtf/gobject/GOwnPtr.h> @@ -64,7 +65,16 @@ static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us if (!WKFrameIsMainFrame(frame)) return; - webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_COMMITTED); + WebKitWebView* webView = WEBKIT_WEB_VIEW(clientInfo); + WebKitWebResource* resource = webkit_web_view_get_main_resource(webView); + if (resource) { + // We might not have a resource if this load is a content replacement. + // FIXME: For some reason, when going back/forward this callback is emitted even before + // didInitiateLoadForResource(), so we don't have a main resource at this point either. + webkitURIResponseSetCertificateInfo(webkit_web_resource_get_response(resource), WKFrameGetCertificateInfo(frame)); + } + + webkitWebViewLoadChanged(webView, WEBKIT_LOAD_COMMITTED); } static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp index 93f83c2de..43ec3338d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "WebKitURIResponse.h" +#include "PlatformCertificateInfo.h" +#include "WebCertificateInfo.h" #include "WebKitPrivate.h" #include "WebKitURIResponsePrivate.h" #include <glib/gi18n-lib.h> @@ -34,6 +36,7 @@ enum { PROP_MIME_TYPE }; +using namespace WebKit; using namespace WebCore; G_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT) @@ -202,6 +205,31 @@ const gchar* webkit_uri_response_get_mime_type(WebKitURIResponse* response) return response->priv->mimeType.data(); } +/** + * webkit_uri_response_get_https_status: + * @response: a #WebKitURIResponse + * @certificate: (out) (transfer none): return location for a #GTlsCertificate + * @errors: (out): return location for a #GTlsCertificateFlags the verification status of @certificate + * + * Retrieves the #GTlsCertificate associated with the @response connection, + * and the #GTlsCertificateFlags showing what problems, if any, have been found + * with that certificate. + * If the response connection is not HTTPS, this function returns %FALSE. + * + * Returns: %TRUE if @response connection uses HTTPS or %FALSE otherwise. + */ +gboolean webkit_uri_response_get_https_status(WebKitURIResponse* response, GTlsCertificate** certificate, GTlsCertificateFlags* errors) +{ + g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), FALSE); + + if (certificate) + *certificate = response->priv->resourceResponse.soupMessageCertificate(); + if (errors) + *errors = response->priv->resourceResponse.soupMessageTLSErrors(); + + return !!response->priv->resourceResponse.soupMessageCertificate(); +} + WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse) { WebKitURIResponse* uriResponse = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, NULL)); @@ -213,3 +241,10 @@ const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIR { return uriResponse->priv->resourceResponse; } + +void webkitURIResponseSetCertificateInfo(WebKitURIResponse* response, WKCertificateInfoRef wkCertificate) +{ + const PlatformCertificateInfo& certificateInfo = toImpl(wkCertificate)->platformCertificateInfo(); + response->priv->resourceResponse.setSoupMessageCertificate(certificateInfo.certificate()); + response->priv->resourceResponse.setSoupMessageTLSErrors(certificateInfo.tlsErrors()); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h index 0cc6c8959..19705921a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h @@ -24,7 +24,7 @@ #ifndef WebKitURIResponse_h #define WebKitURIResponse_h -#include <glib-object.h> +#include <gio/gio.h> #include <webkit2/WebKitDefines.h> G_BEGIN_DECLS @@ -56,16 +56,21 @@ WEBKIT_API GType webkit_uri_response_get_type (void); WEBKIT_API const gchar * -webkit_uri_response_get_uri (WebKitURIResponse *response); +webkit_uri_response_get_uri (WebKitURIResponse *response); WEBKIT_API guint -webkit_uri_response_get_status_code (WebKitURIResponse *response); +webkit_uri_response_get_status_code (WebKitURIResponse *response); WEBKIT_API guint64 -webkit_uri_response_get_content_length (WebKitURIResponse *response); +webkit_uri_response_get_content_length (WebKitURIResponse *response); WEBKIT_API const gchar * -webkit_uri_response_get_mime_type (WebKitURIResponse *response); +webkit_uri_response_get_mime_type (WebKitURIResponse *response); + +WEBKIT_API gboolean +webkit_uri_response_get_https_status (WebKitURIResponse *response, + GTlsCertificate **certificate, + GTlsCertificateFlags *errors); G_END_DECLS diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h index c2dc49c17..957c9ce77 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h @@ -31,5 +31,6 @@ WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse&); const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIResponse*); +void webkitURIResponseSetCertificateInfo(WebKitURIResponse*, WKCertificateInfoRef); #endif // WebKitURIResponsePrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index ed66eb479..f5c84753c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -315,6 +315,7 @@ webkit_uri_response_get_uri webkit_uri_response_get_status_code webkit_uri_response_get_content_length webkit_uri_response_get_mime_type +webkit_uri_response_get_https_status <SUBSECTION Standard> WebKitURIResponseClass @@ -636,7 +637,9 @@ webkit_find_controller_get_type <SECTION> <FILE>WebKitCookieManager</FILE> WebKitCookieManager +WebKitCookiePersistentStorage WebKitCookieAcceptPolicy +webkit_cookie_manager_set_persistent_storage webkit_cookie_manager_set_accept_policy webkit_cookie_manager_get_accept_policy webkit_cookie_manager_get_accept_policy_finish diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am index 058a613f1..919202522 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am +++ b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am @@ -9,6 +9,7 @@ TEST_PROGS += \ Programs/WebKit2APITests/TestLoaderClient \ Programs/WebKit2APITests/TestPrinting \ Programs/WebKit2APITests/TestResources \ + Programs/WebKit2APITests/TestSSL \ Programs/WebKit2APITests/TestWebKitVersion \ Programs/WebKit2APITests/TestWebKitFindController \ Programs/WebKit2APITests/TestWebKitPolicyClient \ @@ -174,4 +175,10 @@ Programs_WebKit2APITests_TestContextMenu_CPPFLAGS = $(webkit2_tests_cppflags) Programs_WebKit2APITests_TestContextMenu_LDADD = $(webkit2_tests_ldadd) Programs_WebKit2APITests_TestContextMenu_LDFLAGS = $(webkit2_tests_ldflags) +Programs_WebKit2APITests_TestSSL_SOURCES = \ + Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp +Programs_WebKit2APITests_TestSSL_CPPFLAGS = $(webkit2_tests_cppflags) +Programs_WebKit2APITests_TestSSL_LDADD = $(webkit2_tests_ldadd) +Programs_WebKit2APITests_TestSSL_LDFLAGS = $(webkit2_tests_ldflags) + endif # ENABLE_WEBKIT2 diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp index 1ddfd82bf..2fe8998b5 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestCookieManager.cpp @@ -21,8 +21,10 @@ #include "WebKitTestServer.h" #include "WebViewTest.h" +#include <glib/gstdio.h> static WebKitTestServer* kServer; +static char* kTempDirectory; static const char* kFirstPartyDomain = "127.0.0.1"; static const char* kThirdPartyDomain = "localhost"; @@ -58,6 +60,30 @@ public: { g_strfreev(m_domains); g_signal_handlers_disconnect_matched(m_cookieManager, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + if (m_cookiesTextFile) + g_unlink(m_cookiesTextFile.get()); + if (m_cookiesSQLiteFile) + g_unlink(m_cookiesSQLiteFile.get()); + } + + void setPersistentStorage(WebKitCookiePersistentStorage storage) + { + const char* filename = 0; + switch (storage) { + case WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT: + if (!m_cookiesTextFile) + m_cookiesTextFile.set(g_build_filename(kTempDirectory, "cookies.txt", NULL)); + filename = m_cookiesTextFile.get(); + break; + case WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE: + if (!m_cookiesSQLiteFile) + m_cookiesSQLiteFile.set(g_build_filename(kTempDirectory, "cookies.db", NULL)); + filename = m_cookiesSQLiteFile.get(); + break; + default: + g_assert_not_reached(); + } + webkit_cookie_manager_set_persistent_storage(m_cookieManager, filename, storage); } static void getAcceptPolicyReadyCallback(GObject* object, GAsyncResult* result, gpointer userData) @@ -129,6 +155,8 @@ public: char** m_domains; bool m_cookiesChanged; bool m_finishLoopWhenCookiesChange; + GOwnPtr<char> m_cookiesTextFile; + GOwnPtr<char> m_cookiesSQLiteFile; }; static void testCookieManagerAcceptPolicy(CookieManagerTest* test, gconstpointer) @@ -204,6 +232,54 @@ static void testCookieManagerCookiesChanged(CookieManagerTest* test, gconstpoint g_assert(test->m_cookiesChanged); } +static void testCookieManagerPersistentStorage(CookieManagerTest* test, gconstpointer) +{ + test->setAcceptPolicy(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS); + + // Text storage using a new file. + test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT); + char** domains = test->getDomains(); + g_assert(domains); + g_assert_cmpint(g_strv_length(domains), ==, 0); + + test->loadURI(kServer->getURIForPath("/index.html").data()); + test->waitUntilLoadFinished(); + g_assert(test->m_cookiesChanged); + domains = test->getDomains(); + g_assert(domains); + g_assert_cmpint(g_strv_length(domains), ==, 2); + + + // SQLite storage using a new file. + test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE); + domains = test->getDomains(); + g_assert(domains); + g_assert_cmpint(g_strv_length(domains), ==, 0); + + test->loadURI(kServer->getURIForPath("/index.html").data()); + test->waitUntilLoadFinished(); + g_assert(test->m_cookiesChanged); + domains = test->getDomains(); + g_assert(domains); + g_assert_cmpint(g_strv_length(domains), ==, 2); + + // Text storage using an existing file. + test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT); + domains = test->getDomains(); + g_assert(domains); + g_assert_cmpint(g_strv_length(domains), ==, 2); + test->deleteAllCookies(); + g_assert_cmpint(g_strv_length(test->getDomains()), ==, 0); + + // SQLite storage with an existing file. + test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE); + domains = test->getDomains(); + g_assert(domains); + g_assert_cmpint(g_strv_length(domains), ==, 2); + test->deleteAllCookies(); + g_assert_cmpint(g_strv_length(test->getDomains()), ==, 0); +} + static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) { if (message->method != SOUP_METHOD_GET) { @@ -214,10 +290,10 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* soup_message_set_status(message, SOUP_STATUS_OK); if (g_str_equal(path, "/index.html")) { char* indexHtml = g_strdup_printf(kIndexHtmlFormat, soup_server_get_port(server)); - soup_message_headers_replace(message->response_headers, "Set-Cookie", "foo=bar"); + soup_message_headers_replace(message->response_headers, "Set-Cookie", "foo=bar; Max-Age=60"); soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, indexHtml, strlen(indexHtml)); } else if (g_str_equal(path, "/image.png")) - soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux"); + soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux; Max-Age=60"); else g_assert_not_reached(); soup_message_body_complete(message->response_body); @@ -228,12 +304,17 @@ void beforeAll() kServer = new WebKitTestServer(); kServer->run(serverCallback); + kTempDirectory = g_dir_make_tmp("WebKit2Tests-XXXXXX", 0); + g_assert(kTempDirectory); + CookieManagerTest::add("WebKitCookieManager", "accept-policy", testCookieManagerAcceptPolicy); CookieManagerTest::add("WebKitCookieManager", "delete-cookies", testCookieManagerDeleteCookies); CookieManagerTest::add("WebKitCookieManager", "cookies-changed", testCookieManagerCookiesChanged); + CookieManagerTest::add("WebKitCookieManager", "persistent-storage", testCookieManagerPersistentStorage); } void afterAll() { delete kServer; + g_rmdir(kTempDirectory); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h index 6929c3595..6fe9de86d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h @@ -75,6 +75,12 @@ public: return resourcesDir.get(); } + static CString getResourcesDir() + { + GOwnPtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Source", "WebKit2", "UIProcess", "API", "gtk", "tests", "resources", NULL)); + return resourcesDir.get(); + } + void addLogFatalFlag(unsigned flag) { unsigned fatalMask = g_log_set_always_fatal(static_cast<GLogLevelFlags>(G_LOG_FATAL_MASK)); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp new file mode 100644 index 000000000..40e9fbeee --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp @@ -0,0 +1,101 @@ +/* + * 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 "LoadTrackingTest.h" +#include "WebKitTestServer.h" +#include <gtk/gtk.h> + +static WebKitTestServer* kServer; +static const char* indexHTML = "<html><body>Testing WebKit2GTK+ SSL</body></htmll>"; + +class SSLTest: public LoadTrackingTest { +public: + MAKE_GLIB_TEST_FIXTURE(SSLTest); + + SSLTest() + : m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) + { + } + + virtual void loadCommitted() + { + WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView); + g_assert(resource); + WebKitURIResponse* response = webkit_web_resource_get_response(resource); + g_assert(response); + + GTlsCertificate* certificate = 0; + webkit_uri_response_get_https_status(response, &certificate, &m_tlsErrors); + m_certificate = certificate; + } + + void waitUntilLoadFinished() + { + m_certificate = 0; + m_tlsErrors = static_cast<GTlsCertificateFlags>(0); + LoadTrackingTest::waitUntilLoadFinished(); + } + + GRefPtr<GTlsCertificate> m_certificate; + GTlsCertificateFlags m_tlsErrors; +}; + +static void testSSL(SSLTest* test, gconstpointer) +{ + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilLoadFinished(); + g_assert(test->m_certificate); + // We always expect errors because we are using a self-signed certificate, + // but only G_TLS_CERTIFICATE_UNKNOWN_CA flags should be present. + g_assert(test->m_tlsErrors); + g_assert_cmpuint(test->m_tlsErrors, ==, G_TLS_CERTIFICATE_UNKNOWN_CA); + + // Non HTTPS loads shouldn't have a certificate nor errors. + test->loadHtml(indexHTML, 0); + test->waitUntilLoadFinished(); + g_assert(!test->m_certificate); + g_assert(!test->m_tlsErrors); +} + +static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) +{ + if (message->method != SOUP_METHOD_GET) { + soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + soup_message_set_status(message, SOUP_STATUS_OK); + soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, indexHTML, strlen(indexHTML)); + soup_message_body_complete(message->response_body); +} + +void beforeAll() +{ + kServer = new WebKitTestServer(WebKitTestServer::ServerHTTPS); + kServer->run(serverCallback); + + SSLTest::add("WebKitWebView", "ssl", testSSL); +} + +void afterAll() +{ + delete kServer; +} diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp index 55a93de87..98b4a9a2b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp @@ -20,12 +20,26 @@ #include "config.h" #include "WebKitTestServer.h" +#include "TestMain.h" #include <wtf/gobject/GOwnPtr.h> -WebKitTestServer::WebKitTestServer() - : m_soupServer(adoptGRef(soup_server_new(SOUP_SERVER_PORT, 0, NULL))) - , m_baseURI(soup_uri_new("http://127.0.0.1/")) +WebKitTestServer::WebKitTestServer(ServerType type) { + GOwnPtr<char> sslCertificateFile; + GOwnPtr<char> sslKeyFile; + if (type == ServerHTTPS) { + CString resourcesDir = Test::getResourcesDir(); + sslCertificateFile.set(g_build_filename(resourcesDir.data(), "test-cert.pem", NULL)); + sslKeyFile.set(g_build_filename(resourcesDir.data(), "test-key.pem", NULL)); + } + + GRefPtr<SoupAddress> address = adoptGRef(soup_address_new("127.0.0.1", SOUP_ADDRESS_ANY_PORT)); + soup_address_resolve_sync(address.get(), 0); + + m_soupServer = adoptGRef(soup_server_new(SOUP_SERVER_INTERFACE, address.get(), + SOUP_SERVER_SSL_CERT_FILE, sslCertificateFile.get(), + SOUP_SERVER_SSL_KEY_FILE, sslKeyFile.get(), NULL)); + m_baseURI = type == ServerHTTPS ? soup_uri_new("https://127.0.0.1/") : soup_uri_new("http://127.0.0.1/"); soup_uri_set_port(m_baseURI, soup_server_get_port(m_soupServer.get())); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h index 9f00349e0..d4626f6b1 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h @@ -27,7 +27,13 @@ class WebKitTestServer { public: - WebKitTestServer(); + + enum ServerType { + ServerHTTP, + ServerHTTPS + }; + + WebKitTestServer(ServerType type = ServerHTTP); virtual ~WebKitTestServer(); SoupURI* baseURI() { return m_baseURI; } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem new file mode 100644 index 000000000..b34301f25 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB9jCCAV+gAwIBAgIJALeuXBo+vwz9MA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV +BAMMCTEyNy4wLjAuMTAeFw0xMjA3MTIxMjQ4MjRaFw0yMjA3MTAxMjQ4MjRaMBQx +EjAQBgNVBAMMCTEyNy4wLjAuMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +0TUzOQxHBIKDD2mkuq+tU92mQvDZg73B0G+Nhr2T2G6MbcLqIwjg1QYtBZWJ83tZ +xMMEfiweHLF85Z9ohavAgxJlKG7YmvZO79KkFpmjV2W5CVRm0eYMPnzmxNCoaYqo +DLl0zsH6KZOLPKu/fX4eDX9XpAP1f83hWB1UFBmHKN8CAwEAAaNQME4wHQYDVR0O +BBYEFDHv5ZQ1BdmhzTsDUEoY55EXyUdKMB8GA1UdIwQYMBaAFDHv5ZQ1BdmhzTsD +UEoY55EXyUdKMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAh3qMBx7v +jSodMf3OyTqTLE7deLnmnCeBVpgzxRZEoizcGqYcjiqO27i5N5Z6KVQsnITnLiyC +mUtuR5KnF69uTKUw4m/ugZe5whjig5Mq2l410KVK6EeG4tdLlfXR+wi4U5K4KjP6 +p4nchQUXLa2zcbJn+VBexJn6/9wdhr+DUGY= +-----END CERTIFICATE----- diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem new file mode 100644 index 000000000..9036222ce --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/tests/resources/test-key.pem @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANE1MzkMRwSCgw9p +pLqvrVPdpkLw2YO9wdBvjYa9k9hujG3C6iMI4NUGLQWVifN7WcTDBH4sHhyxfOWf +aIWrwIMSZShu2Jr2Tu/SpBaZo1dluQlUZtHmDD585sTQqGmKqAy5dM7B+imTizyr +v31+Hg1/V6QD9X/N4VgdVBQZhyjfAgMBAAECgYB2QwOUsRsIMprRwJ9tJNfvO7G7 +z5i1/zOrlxPC4jHMPBnIBlICwgcOhLI4oOLdr5H8R12n0VqoT7DRwP396iwlJipF +iO1heDMn/8z8LPGwkCK/+ck04rMDksxWIdMwYKBXt9ahnJ/xRLzQ1/3AJiAGnoe5 +/QLXQweofd4mmfsjKQJBAO2CwT7uMP6nMjXgtVMJq5QP8UbeCS1sEOPJJbHuDxJB +/HePQHBjq4kzG6CL4oO7T+5fDv4g+fIIHzuXerZ0imsCQQDhfmiTIc9OucEIfg6/ +ms0JiKSmWc+qoiOCtrILuQvFoNwJRciQANqeJs6wpaDvevSUvBLGfG/7b3HvaE5X +iqBdAkBEQIvp2qcHtuJN60oQF7pPrRknxUyb2e8sljQX4pJAK+gyL19ULMAxiBdL +Vod8VYqNtJFpY+6Pp9fZ1xjzb6ALAkEA4JzrDAw0lQXA+3WduUw4ixOadr2ldyG0 +36KebcDwsfZO18m0Q4UmPz0Gy7zgN0wxzuochaw0W6+iPUiYKOlEXQJBAMWQrPlu +rrinoZS2f8doJ9BNNUa+RNpMug6UXc55qoUJlyiXEh+tu4AaMOtxuGIyC0sAcuw6 +XdAPVPXKd7Mne70= +-----END PRIVATE KEY----- diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm index 91fcf34b2..6a02f562d 100644 --- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm +++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm @@ -504,7 +504,7 @@ bool PDFViewController::forwardScrollWheelEvent(NSEvent *wheelEvent) return true; } -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static IMP oldPDFViewScrollView_scrollWheel; static WKPDFView *findEnclosingWKPDFView(NSView *view) @@ -557,7 +557,7 @@ NSBundle* PDFViewController::pdfKitBundle() if (![pdfKitBundle load]) LOG_ERROR("Couldn't load PDFKit.framework"); -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (Class pdfViewScrollViewClass = [pdfKitBundle classNamed:@"PDFViewScrollView"]) { if (Method scrollWheel = class_getInstanceMethod(pdfViewScrollViewClass, @selector(scrollWheel:))) oldPDFViewScrollView_scrollWheel = method_setImplementation(scrollWheel, reinterpret_cast<IMP>(PDFViewScrollView_scrollWheel)); diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm index 457ce921f..b31946b3c 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -472,7 +472,7 @@ void PageClientImpl::didPerformDictionaryLookup(const String& text, double scale NSPoint textBaselineOrigin = dictionaryPopupInfo.origin; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // Convert to screen coordinates. textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil]; textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin; @@ -487,7 +487,7 @@ void PageClientImpl::didPerformDictionaryLookup(const String& text, double scale void PageClientImpl::dismissDictionaryLookupPanel() { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 WKHideWordDefinitionWindow(); #endif } @@ -519,7 +519,7 @@ String PageClientImpl::dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAl void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited; CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString); #endif @@ -527,7 +527,7 @@ void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType res void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSArray *trackingAreas = [m_wkView trackingAreas]; NSUInteger count = [trackingAreas count]; ASSERT(count == 1); diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index e883215fd..27f233b69 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -104,7 +104,7 @@ @end @interface NSWindow (WKNSWindowDetails) -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 - (NSRect)_growBoxRect; - (id)_growBoxOwner; - (void)_setShowOpaqueGrowBoxForOwner:(id)owner; @@ -957,7 +957,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) - (void)displayIfNeeded { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: We should remove this code when <rdar://problem/9362085> is resolved. In the meantime, // it is necessary to disable scren updates so we get a chance to redraw the corners before this // display is visible. @@ -969,7 +969,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) [super displayIfNeeded]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (shouldMaskWindow) { [window _maskRoundedBottomCorners:_data->_windowBottomCornerIntersectionRect]; NSEnableScreenUpdates(); @@ -1666,7 +1666,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde _data->_page->dragUpdated(&dragData, [[draggingInfo draggingPasteboard] name]); WebCore::DragSession dragSession = _data->_page->dragSession(); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSInteger numberOfValidItemsForDrop = dragSession.numberOfItemsToBeAccepted; NSDraggingFormation draggingFormation = NSDraggingFormationNone; if (dragSession.mouseIsOverFileInput && numberOfValidItemsForDrop > 0) @@ -1778,7 +1778,7 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb } -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 - (BOOL)_ownsWindowGrowBox { NSWindow* window = [self window]; @@ -1888,7 +1888,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl [self removeWindowObservers]; [self addWindowObserversForWindow:window]; -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 if ([currentWindow _growBoxOwner] == self) [currentWindow _setShowOpaqueGrowBoxForOwner:nil]; #endif @@ -1927,7 +1927,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl _data->_endGestureMonitor = nil; } #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 WKHideWordDefinitionWindow(); #endif } @@ -2209,7 +2209,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I - (float)_intrinsicDeviceScaleFactor { NSWindow *window = [self window]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (window) return [window backingScaleFactor]; return [[NSScreen mainScreen] backingScaleFactor]; @@ -2234,7 +2234,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return NO; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - (void)quickLookWithEvent:(NSEvent *)event { NSPoint locationInViewCoordinates = [self convertPoint:[event locationInWindow] fromView:nil]; @@ -2865,7 +2865,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) - (void)_didChangeScrollbarsForMainFrame { -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 [self _updateGrowBoxForWindowFrameChange]; #endif } @@ -2906,7 +2906,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) - (void)_cacheWindowBottomCornerRect { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: We should remove this code when <rdar://problem/9362085> is resolved. NSWindow *window = [self window]; if (!window) @@ -2967,7 +2967,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) // Legacy style scrollbars have design details that rely on tracking the mouse all the time. NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) options |= NSTrackingActiveAlways; else @@ -3009,7 +3009,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return self; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - (BOOL)wantsUpdateLayer { return [self _shouldUseTiledDrawingArea]; @@ -3095,7 +3095,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) + (void)hideWordDefinitionWindow { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 WKHideWordDefinitionWindow(); #endif } diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 046d80339..25bf2e7df 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -1655,6 +1655,38 @@ void QQuickWebView::platformInitialize() WTF::initializeMainThread(); } +bool QQuickWebView::childMouseEventFilter(QQuickItem* item, QEvent* event) +{ + if (!isVisible() || !isEnabled() || !s_flickableViewportEnabled) + return QQuickFlickable::childMouseEventFilter(item, event); + + // 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 + // childMouseEventFilter and filter incoming touch events as well. + + switch (event->type()) { + case QEvent::MouseButtonPress: + mousePressEvent(static_cast<QMouseEvent*>(event)); + return event->isAccepted(); + case QEvent::MouseMove: + mouseMoveEvent(static_cast<QMouseEvent*>(event)); + return event->isAccepted(); + case QEvent::MouseButtonRelease: + mouseReleaseEvent(static_cast<QMouseEvent*>(event)); + return event->isAccepted(); + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + touchEvent(static_cast<QTouchEvent*>(event)); + return event->isAccepted(); + default: + break; + } + + return QQuickFlickable::childMouseEventFilter(item, event); +} + void QQuickWebView::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) { Q_D(QQuickWebView); diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h index e2c8c0dad..ceaab68a0 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h @@ -168,6 +168,7 @@ Q_SIGNALS: void navigationRequested(QWebNavigationRequest* request); protected: + virtual bool childMouseEventFilter(QQuickItem*, QEvent*); virtual void geometryChanged(const QRectF&, const QRectF&); virtual void componentComplete(); virtual void keyPressEvent(QKeyEvent*); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp index c4c1af825..45697a22b 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest.cpp @@ -25,13 +25,13 @@ #include <WebKit2/WKBase.h> #include <WebKit2/WKRetainPtr.h> - class QWebPermissionRequestPrivate : public QSharedData { public: - QWebPermissionRequestPrivate(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef permissionRequest) + QWebPermissionRequestPrivate(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef geo = 0, WKNotificationPermissionRequestRef notify = 0, QWebPermissionRequest::RequestType reqType = QWebPermissionRequest::Geolocation) : origin(securityOrigin) - , type(QWebPermissionRequest::Geolocation) - , request(permissionRequest) + , geolocationRequest(geo) + , notificationRequest(notify) + , type(reqType) , allow(false) { WKRetainPtr<WKStringRef> url = adoptWK(WKSecurityOriginCopyProtocol(origin.get())); @@ -48,8 +48,9 @@ public: } WKRetainPtr<WKSecurityOriginRef> origin; + WKRetainPtr<WKGeolocationPermissionRequestRef> geolocationRequest; + WKRetainPtr<WKNotificationPermissionRequestRef> notificationRequest; QWebPermissionRequest::RequestType type; - WKRetainPtr<WKGeolocationPermissionRequestRef> request; QtWebSecurityOrigin securityInfo; bool allow; }; @@ -59,9 +60,18 @@ QWebPermissionRequest* QWebPermissionRequest::create(WKSecurityOriginRef origin, return new QWebPermissionRequest(origin, request); } -QWebPermissionRequest::QWebPermissionRequest(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef permissionRequest, QObject* parent) +QWebPermissionRequest* QWebPermissionRequest::create(WKSecurityOriginRef origin, WKNotificationPermissionRequestRef request) +{ + return new QWebPermissionRequest(origin, 0, request, QWebPermissionRequest::Notification); +} + +QWebPermissionRequest::QWebPermissionRequest(WKSecurityOriginRef securityOrigin + , WKGeolocationPermissionRequestRef geo + , WKNotificationPermissionRequestRef notify + , QWebPermissionRequest::RequestType type + , QObject* parent) : QObject(parent) - , d(new QWebPermissionRequestPrivate(securityOrigin, permissionRequest)) + , d(new QWebPermissionRequestPrivate(securityOrigin, geo, notify, type)) { } @@ -80,9 +90,16 @@ void QWebPermissionRequest::setAllow(bool accepted) switch (type()) { case Geolocation: { if (accepted) - WKGeolocationPermissionRequestAllow(d->request.get()); + WKGeolocationPermissionRequestAllow(d->geolocationRequest.get()); + else + WKGeolocationPermissionRequestDeny(d->geolocationRequest.get()); + break; + } + case Notification: { + if (accepted) + WKNotificationPermissionRequestAllow(d->notificationRequest.get()); else - WKGeolocationPermissionRequestDeny(d->request.get()); + WKNotificationPermissionRequestDeny(d->notificationRequest.get()); break; } default: diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h index 4708b71a6..000252bdb 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpermissionrequest_p.h @@ -26,6 +26,7 @@ #include <QtCore/QObject> #include <QtCore/qshareddata.h> #include <WebKit2/WKGeolocationPermissionRequest.h> +#include <WebKit2/WKNotificationPermissionRequest.h> #include <WebKit2/WKSecurityOrigin.h> class QWebPermissionRequestPrivate; @@ -39,10 +40,12 @@ class QWEBKIT_EXPORT QWebPermissionRequest : public QObject { public: enum RequestType { - Geolocation + Geolocation, + Notification }; static QWebPermissionRequest* create(WKSecurityOriginRef, WKGeolocationPermissionRequestRef); + static QWebPermissionRequest* create(WKSecurityOriginRef, WKNotificationPermissionRequestRef); virtual ~QWebPermissionRequest(); RequestType type() const; @@ -54,7 +57,11 @@ public Q_SLOTS: private: friend class QWebPermissionRequestPrivate; - QWebPermissionRequest(WKSecurityOriginRef securityOrigin, WKGeolocationPermissionRequestRef permissionRequest, QObject* parent = 0); + QWebPermissionRequest(WKSecurityOriginRef securityOrigin + , WKGeolocationPermissionRequestRef geo = 0 + , WKNotificationPermissionRequestRef notify = 0 + , QWebPermissionRequest::RequestType type = Geolocation + , QObject* parent = 0); private: QExplicitlySharedDataPointer<QWebPermissionRequestPrivate> d; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml new file mode 100644 index 000000000..aa432f60c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml @@ -0,0 +1,55 @@ +import QtQuick 2.0 +import QtTest 1.0 +import QtWebKit 3.0 +import QtWebKit.experimental 1.0 + +WebView { + id: webView + width: 200 + height: 200 + + property bool expectedPermission: false + + SignalSpy { + id: spy + target: experimental + signalName: "permissionRequested" + } + + experimental.onPermissionRequested: { + // Must be false by default + if (!permission.allow) { + permission.allow = true + } else { + console.log("Fail: permission must be set to false") + } + + if (permission.type == PermissionRequest.Notification) { + console.log("Permission is Desktop Notification") + } + } + + TestCase { + name: "WebViewDesktopNotificationPermission" + + // Delayed windowShown to workaround problems with Qt5 in debug mode. + when: false + Timer { + running: parent.windowShown + repeat: false + interval: 1 + onTriggered: parent.when = true + } + + function init() { + spy.clear() + } + + function test_permissionRequest() { + compare(spy.count, 0) + webView.url = Qt.resolvedUrl("../common/notification.html") + spy.wait() + compare(spy.count, 1) + } + } +} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html new file mode 100644 index 000000000..b53533eb0 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html @@ -0,0 +1,19 @@ +<html> +<head> + <title>Desktop Notification Permission test</title> + <script> + requestPermission = function(cb) { + window.webkitNotifications.requestPermission(function() { + if (cb) + cb(window.webkitNotifications.checkPermission() == 0); + }); + } + requestPermission() + </script> +</head> + +<body> + Desktop Notification test +</body> + +</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp index 4d9ce7ba1..a81778270 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp @@ -58,6 +58,7 @@ private slots: void transparentWebViews(); void inputMethod(); + void basicRenderingSanity(); private: void prepareWebViewComponent(); @@ -329,6 +330,28 @@ void tst_QQuickWebView::multipleWebViews() QTest::qWait(200); } +void tst_QQuickWebView::basicRenderingSanity() +{ + showWebView(); + webView()->setSize(QSizeF(300, 400)); + + webView()->setUrl(QUrl(QString::fromUtf8("data:text/html,<html><body bgcolor=\"#00ff00\"></body></html>"))); + QVERIFY(waitForLoadSucceeded(webView())); + + // We have to explicitly move the window into the screen, otherwise it's not rendered. + m_window->setGeometry(0, 0, 300, 400); + m_window->show(); + // This should not crash. + webView()->setVisible(true); + QTest::qWait(200); + QImage grabbedWindow = m_window->grabFrameBuffer(); + QRgb testColor = qRgba(0, 0xff, 0, 0xff); + QVERIFY(grabbedWindow.pixel(10, 10) == testColor); + QVERIFY(grabbedWindow.pixel(100, 10) == testColor); + QVERIFY(grabbedWindow.pixel(10, 100) == testColor); + QVERIFY(grabbedWindow.pixel(100, 100) == testColor); +} + void tst_QQuickWebView::titleUpdate() { QSignalSpy titleSpy(webView(), SIGNAL(titleChanged())); diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp index 9f6888180..b322bacd4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp @@ -58,15 +58,16 @@ static WKPageGroupRef webPageGroup(const QString& name) class WebView : public QObject, public QRawWebViewClient { Q_OBJECT public: - WebView(const QSize& size) + WebView(const QSize& size, bool transparent = false) { WKPageLoaderClient loaderClient; memset(&loaderClient, 0, sizeof(WKPageLoaderClient)); loaderClient.clientInfo = this; - loaderClient.didFinishLoadForFrame = WebView::finishLoadForFrame; + loaderClient.didFirstVisuallyNonEmptyLayoutForFrame = WebView::finishFirstLayoutForFrame; m_webView = new QRawWebView(webContext(), webPageGroup(QString()), this); WKPageSetPageLoaderClient(m_webView->pageRef(), &loaderClient); + m_webView->setTransparentBackground(transparent); m_webView->create(); WKPageSetUseFixedLayout(m_webView->pageRef(), true); @@ -91,8 +92,6 @@ public: virtual void viewNeedsDisplay(const QRect&) { m_webView->paint(QMatrix4x4(), 1, 0); - if (m_frameLoaded) - emit loaded(); } virtual void viewRequestedScroll(const QPoint&) { } @@ -103,7 +102,26 @@ public: virtual void doneWithKeyEvent(const QKeyEvent*, bool wasHandled) { } virtual void doneWithTouchEvent(const QTouchEvent*, bool wasHandled) { } - static void finishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); + void frameLoaded() + { + m_frameLoaded = true; + WKPageForceRepaint(m_webView->pageRef(), this, finishForceRepaint); + } + + void onRepaintDone() + { + emit loaded(); + } + + static void finishForceRepaint(WKErrorRef, void* context) + { + static_cast<WebView*>(context)->onRepaintDone(); + } + + static void finishFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo) + { + static_cast<WebView*>(const_cast<void*>(clientInfo))->frameLoaded(); + } signals: void loaded(); @@ -113,12 +131,6 @@ private: bool m_frameLoaded; }; -void WebView::finishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo) -{ - WebView* obj = static_cast<WebView*>(const_cast<void*>(clientInfo)); - obj->m_frameLoaded = true; -} - static bool compareImages(const QImage& i1, const QImage& i2, int count) { if (i1.size() != i2.size()) @@ -169,37 +181,31 @@ void tst_qrawwebview::doPaint(const QSize& size) void tst_qrawwebview::doNoBackground1(const QSize& size) { - WebView view(size); - view.setTransparentBackground(true); + WebView view(size, true); view.load(m_baseUrl + "/redsquare.html"); view.load(m_baseUrl + "/bluesquare.html"); } void tst_qrawwebview::doNoBackground2(const QSize& size) { - WebView view1(size); - view1.setTransparentBackground(true); + WebView view1(size, true); view1.load(m_baseUrl + "/redsquare.html"); - WebView view2(size); - view2.setTransparentBackground(true); + WebView view2(size, true); view2.load(m_baseUrl + "/bluesquare.html"); } void tst_qrawwebview::doNoBackground3(const QSize& size) { - WebView view1(size); - view1.setTransparentBackground(false); + WebView view1(size, false); view1.load(m_baseUrl + "/redsquare.html"); - WebView view2(size); - view2.setTransparentBackground(true); + WebView view2(size, true); view2.load(m_baseUrl + "/bluesquare.html"); } void tst_qrawwebview::run(PaintMethod method, const QString& expectation) { - QWindow window; window.setSurfaceType(QSurface::OpenGLSurface); window.setGeometry(0, 0, 200, 200); diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h index bc1f867f3..75b2f27a6 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h @@ -31,6 +31,10 @@ #include <wtf/RefPtr.h> #include <wtf/Threading.h> +#ifndef NDEBUG +#include <wtf/text/WTFString.h> +#endif + namespace WebKit { class ProcessLauncher : public ThreadSafeRefCounted<ProcessLauncher> { @@ -54,6 +58,9 @@ public: cpu_type_t architecture; bool executableHeap; #endif +#ifndef NDEBUG + String processCmdPrefix; +#endif }; static PassRefPtr<ProcessLauncher> create(Client* client, const LaunchOptions& launchOptions) diff --git a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp index 14111a2d7..86dddbf61 100644 --- a/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp +++ b/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp @@ -70,7 +70,19 @@ void ProcessLauncher::launchProcess() executablePath = String(executablePathPtr); } String fullPath = executablePath + "/" + processName; - execl(fullPath.utf8().data(), processName.utf8().data(), socket.utf8().data(), static_cast<char*>(0)); +#ifndef NDEBUG + if (m_launchOptions.processCmdPrefix.isEmpty()) +#endif + execl(fullPath.utf8().data(), processName.utf8().data(), socket.utf8().data(), static_cast<char*>(0)); +#ifndef NDEBUG + else { + String cmd = makeString(m_launchOptions.processCmdPrefix, ' ', fullPath, ' ', socket); + if (system(cmd.utf8().data()) == -1) { + ASSERT_NOT_REACHED(); + return; + } + } +#endif } else if (pid > 0) { // parent process; close(sockets[0]); m_processIdentifier = pid; diff --git a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h index 311e59087..00b73a92a 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h +++ b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.h @@ -26,7 +26,7 @@ #ifndef DynamicLinkerEnvironmentExtractor_h #define DynamicLinkerEnvironmentExtractor_h -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #include <mach/machine.h> #include <wtf/Noncopyable.h> @@ -61,6 +61,6 @@ private: } // namespace WebKit -#endif // BUILDING_ON_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 #endif // DynamicLinkerEnvironmentExtractor_h diff --git a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm index bfc270c69..6f35280a0 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm @@ -26,7 +26,7 @@ #include "config.h" #include "DynamicLinkerEnvironmentExtractor.h" -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #include "EnvironmentVariables.h" #include <mach-o/loader.h> @@ -201,4 +201,4 @@ void DynamicLinkerEnvironmentExtractor::getExtractedEnvironmentVariables(Environ } // namespace WebKit -#endif // BUILDING_ON_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 diff --git a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp index 72979f8f7..be0f909eb 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp +++ b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.cpp @@ -136,7 +136,7 @@ void EnvironmentVariables::copyEnvironmentVariables() m_environmentPointer = m_environmentVariables.data(); } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 const char* EnvironmentVariables::preexistingProcessServiceNameKey() { @@ -148,6 +148,6 @@ const char* EnvironmentVariables::preexistingProcessTypeKey() return "WEBKIT_PREEXISTING_PROCESS_TYPE"; } -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h index 33829398d..ff4ab1060 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h +++ b/Source/WebKit2/UIProcess/Launcher/mac/EnvironmentVariables.h @@ -46,7 +46,7 @@ public: char** environmentPointer() const { return m_environmentPointer; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static const char* preexistingProcessServiceNameKey(); static const char* preexistingProcessTypeKey(); #endif diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm index dc839c84f..fab9c24f8 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm @@ -80,7 +80,7 @@ void ProcessLauncher::launchProcess() pid_t processIdentifier = 0; EnvironmentVariables environmentVariables; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static const char* preexistingProcessServiceName = environmentVariables.get(EnvironmentVariables::preexistingProcessServiceNameKey()); ProcessType preexistingProcessType; if (preexistingProcessServiceName) @@ -160,7 +160,7 @@ void ProcessLauncher::launchProcess() // Start suspended so we can set up the termination notification handler. flags |= POSIX_SPAWN_START_SUSPENDED; -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static const int allowExecutableHeapFlag = 0x2000; if (m_launchOptions.executableHeap) flags |= allowExecutableHeapFlag; @@ -168,7 +168,7 @@ void ProcessLauncher::launchProcess() posix_spawnattr_setflags(&attr, flags); -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], architecture); environmentExtractor.getExtractedEnvironmentVariables(environmentVariables); #endif @@ -211,7 +211,7 @@ void ProcessLauncher::launchProcess() listeningPort = MACH_PORT_NULL; processIdentifier = 0; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 } #endif diff --git a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp index 3b0214344..dad90934c 100644 --- a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp +++ b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp @@ -61,15 +61,24 @@ void LayerTreeCoordinatorProxy::createTileForLayer(int layerID, int tileID, cons updateTileForLayer(layerID, tileID, targetRect, updateInfo); } +static inline uint64_t createLayerTileUniqueKey(int layerID, int tileID) +{ + uint64_t key = layerID; + key <<= 32; + key |= tileID; + return key; +} + void LayerTreeCoordinatorProxy::updateTileForLayer(int layerID, int tileID, const IntRect& targetRect, const WebKit::SurfaceUpdateInfo& updateInfo) { RefPtr<ShareableSurface> surface; #if USE(GRAPHICS_SURFACE) - uint32_t token = updateInfo.surfaceHandle.graphicsSurfaceToken(); - HashMap<uint32_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(token); + uint64_t key = createLayerTileUniqueKey(layerID, tileID); + + HashMap<uint64_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(key); if (it == m_surfaces.end()) { surface = ShareableSurface::create(updateInfo.surfaceHandle); - m_surfaces.add(token, surface); + m_surfaces.add(key, surface); } else surface = it->second; #else diff --git a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h index b4e7b7ce2..c0edb6658 100644 --- a/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h +++ b/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h @@ -79,7 +79,7 @@ protected: DrawingAreaProxy* m_drawingAreaProxy; RefPtr<WebLayerTreeRenderer> m_renderer; #if USE(GRAPHICS_SURFACE) - HashMap<uint32_t, RefPtr<ShareableSurface> > m_surfaces; + HashMap<uint64_t, RefPtr<ShareableSurface> > m_surfaces; #endif }; diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm index 290451a4b..3486de437 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm @@ -35,7 +35,7 @@ #import <spawn.h> #import <wtf/text/CString.h> -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import <QuartzCore/CARemoteLayerServer.h> #endif @@ -120,7 +120,7 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa { #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort]; #else mach_port_t renderServerPort = WKInitializeRenderServer(); diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index 5c55636d6..381a25603 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -70,6 +70,10 @@ #include "WebBatteryManagerProxy.h" #endif +#if ENABLE(NETWORK_INFO) +#include "WebNetworkInfoManagerProxy.h" +#endif + #if USE(SOUP) #include "WebSoupRequestManagerProxy.h" #endif @@ -143,6 +147,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa , m_iconDatabase(WebIconDatabase::create(this)) , m_keyValueStorageManagerProxy(WebKeyValueStorageManagerProxy::create(this)) , m_mediaCacheManagerProxy(WebMediaCacheManagerProxy::create(this)) +#if ENABLE(NETWORK_INFO) + , m_networkInfoManagerProxy(WebNetworkInfoManagerProxy::create(this)) +#endif , m_notificationManagerProxy(WebNotificationManagerProxy::create(this)) , m_pluginSiteDataManager(WebPluginSiteDataManager::create(this)) , m_resourceCacheManagerProxy(WebResourceCacheManagerProxy::create(this)) @@ -210,6 +217,11 @@ WebContext::~WebContext() m_mediaCacheManagerProxy->invalidate(); m_mediaCacheManagerProxy->clearContext(); + +#if ENABLE(NETWORK_INFO) + m_networkInfoManagerProxy->invalidate(); + m_networkInfoManagerProxy->clearContext(); +#endif m_notificationManagerProxy->invalidate(); m_notificationManagerProxy->clearContext(); @@ -418,6 +430,9 @@ void WebContext::disconnectProcess(WebProcessProxy* process) m_geolocationManagerProxy->invalidate(); m_keyValueStorageManagerProxy->invalidate(); m_mediaCacheManagerProxy->invalidate(); +#if ENABLE(NETWORK_INFO) + m_networkInfoManagerProxy->invalidate(); +#endif m_notificationManagerProxy->invalidate(); m_resourceCacheManagerProxy->invalidate(); #if USE(SOUP) @@ -782,6 +797,13 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes m_mediaCacheManagerProxy->didReceiveMessage(connection, messageID, arguments); return; } + +#if ENABLE(NETWORK_INFO) + if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) { + m_networkInfoManagerProxy->didReceiveMessage(connection, messageID, arguments); + return; + } +#endif if (messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>()) { m_notificationManagerProxy->didReceiveMessage(connection, messageID, arguments); @@ -835,6 +857,13 @@ void WebContext::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC: m_iconDatabase->didReceiveSyncMessage(connection, messageID, arguments, reply); return; } + +#if ENABLE(NETWORK_INFO) + if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) { + m_networkInfoManagerProxy->didReceiveSyncMessage(connection, messageID, arguments, reply); + return; + } +#endif switch (messageID.get<WebContextLegacyMessage::Kind>()) { case WebContextLegacyMessage::PostSynchronousMessage: { @@ -940,9 +969,12 @@ bool WebContext::httpPipeliningEnabled() const #endif } -void WebContext::getWebCoreStatistics(PassRefPtr<DictionaryCallback> prpCallback) +void WebContext::getWebCoreStatistics(PassRefPtr<DictionaryCallback> callback) { - RefPtr<DictionaryCallback> callback = prpCallback; + if (!m_process) { + callback->invalidate(); + return; + } uint64_t callbackID = callback->callbackID(); m_dictionaryCallbacks.set(callbackID, callback.get()); diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index a777dd317..f01561031 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -57,6 +57,9 @@ class WebGeolocationManagerProxy; class WebIconDatabase; class WebKeyValueStorageManagerProxy; class WebMediaCacheManagerProxy; +#if ENABLE(NETWORK_INFO) +class WebNetworkInfoManagerProxy; +#endif class WebNotificationManagerProxy; class WebPageGroup; class WebPageProxy; @@ -166,6 +169,9 @@ public: WebIconDatabase* iconDatabase() const { return m_iconDatabase.get(); } WebKeyValueStorageManagerProxy* keyValueStorageManagerProxy() const { return m_keyValueStorageManagerProxy.get(); } WebMediaCacheManagerProxy* mediaCacheManagerProxy() const { return m_mediaCacheManagerProxy.get(); } +#if ENABLE(NETWORK_INFO) + WebNetworkInfoManagerProxy* networkInfoManagerProxy() const { return m_networkInfoManagerProxy.get(); } +#endif WebNotificationManagerProxy* notificationManagerProxy() const { return m_notificationManagerProxy.get(); } WebPluginSiteDataManager* pluginSiteDataManager() const { return m_pluginSiteDataManager.get(); } WebResourceCacheManagerProxy* resourceCacheManagerProxy() const { return m_resourceCacheManagerProxy.get(); } @@ -314,6 +320,9 @@ private: RefPtr<WebIconDatabase> m_iconDatabase; RefPtr<WebKeyValueStorageManagerProxy> m_keyValueStorageManagerProxy; RefPtr<WebMediaCacheManagerProxy> m_mediaCacheManagerProxy; +#if ENABLE(NETWORK_INFO) + RefPtr<WebNetworkInfoManagerProxy> m_networkInfoManagerProxy; +#endif RefPtr<WebNotificationManagerProxy> m_notificationManagerProxy; RefPtr<WebPluginSiteDataManager> m_pluginSiteDataManager; RefPtr<WebResourceCacheManagerProxy> m_resourceCacheManagerProxy; diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h index 7dc20d52e..cf1c15b05 100644 --- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h @@ -70,6 +70,10 @@ public: void startObservingCookieChanges(); void stopObservingCookieChanges(); +#if USE(SOUP) + void setCookiePersistentStorage(const String& storagePath, uint32_t storageType); +#endif + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); bool shouldTerminate(WebProcessProxy*) const; diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp index 4abe2d68d..9bacced06 100644 --- a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp @@ -72,6 +72,11 @@ void WebNetworkInfoManagerProxy::didReceiveMessage(CoreIPC::Connection* connecti didReceiveWebNetworkInfoManagerProxyMessage(connection, messageID, arguments); } +void WebNetworkInfoManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, WTF::OwnPtr<CoreIPC::ArgumentEncoder>& reply) +{ + didReceiveSyncWebNetworkInfoManagerProxyMessage(connection, messageID, arguments, reply); +} + void WebNetworkInfoManagerProxy::startUpdating() { if (m_isUpdating) diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h index 660cba9b7..b7298553c 100644 --- a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h @@ -59,6 +59,7 @@ public: void providerDidChangeNetworkInformation(const WTF::AtomicString& eventType, WebNetworkInfo*); void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&); private: explicit WebNetworkInfoManagerProxy(WebContext*); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 85709ef20..17cc2f425 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -1981,7 +1981,7 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields. // FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames. m_pageClient->resetTextInputState(); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: Should this be moved inside resetTextInputState()? dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored); m_pageClient->dismissDictionaryLookupPanel(); @@ -2551,7 +2551,7 @@ void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr) void WebPageProxy::pageDidScroll() { m_uiClient.pageDidScroll(this); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored); #endif } @@ -3530,7 +3530,7 @@ void WebPageProxy::processDidCrash() m_touchEventQueue.clear(); #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored); m_pageClient->dismissDictionaryLookupPanel(); #endif @@ -3905,7 +3905,7 @@ void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing) isShowing = TextChecker::substitutionsPanelIsShowing(); } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void WebPageProxy::showCorrectionPanel(int32_t panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) { m_pageClient->showCorrectionPanel((AlternativeTextType)panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings); @@ -3925,11 +3925,11 @@ void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const Stri { m_pageClient->recordAutocorrectionResponse((AutocorrectionResponseType)responseType, replacedString, replacementString); } -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void WebPageProxy::handleAlternativeTextUIResult(const String& result) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (!isClosed()) process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0); #endif diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 57ab86c24..6c7e68811 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -949,12 +949,12 @@ private: #if PLATFORM(MAC) void substitutionsPanelIsShowing(bool&); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings); void dismissCorrectionPanel(int32_t reason); void dismissCorrectionPanelSoon(int32_t reason, String& result); void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString); -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #if USE(DICTATION_ALTERNATIVES) void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 03412766d..7838d643f 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -287,7 +287,7 @@ messages -> WebPageProxy { #if PLATFORM(MAC) SubstitutionsPanelIsShowing() -> (bool isShowing) #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 # Autocorrection messages ShowCorrectionPanel(int32_t panelType, WebCore::FloatRect boundingBoxOfReplacedString, String replacedString, String replacementString, Vector<String> alternativeReplacementStrings) DismissCorrectionPanel(int32_t reason) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index 152a72e6f..54e0ec39b 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -110,6 +110,11 @@ void WebProcessProxy::connect() launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture; launchOptions.executableHeap = false; #endif +#ifndef NDEBUG + const char* webProcessCmdPrefix = getenv("WEB_PROCESS_CMD_PREFIX"); + if (webProcessCmdPrefix && *webProcessCmdPrefix) + launchOptions.processCmdPrefix = String::fromUTF8(webProcessCmdPrefix); +#endif m_processLauncher = ProcessLauncher::create(this, launchOptions); } } @@ -316,6 +321,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC || messageID.is<CoreIPC::MessageClassWebIconDatabase>() || messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>() || messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>() +#if ENABLE(NETWORK_INFO) + || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>() +#endif || messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>() #if USE(SOUP) || messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>() @@ -343,7 +351,10 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor return; } - if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>() + if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>() +#if ENABLE(NETWORK_INFO) + || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>() +#endif || messageID.is<CoreIPC::MessageClassDownloadProxy>() || messageID.is<CoreIPC::MessageClassWebIconDatabase>()) { m_context->didReceiveSyncMessage(connection, messageID, arguments, reply); return; diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm index 20a63ea03..6da8a4301 100644 --- a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm +++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm @@ -30,7 +30,7 @@ #import <WebCore/NotImplemented.h> #import <wtf/RetainPtr.h> -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @interface NSSpellChecker (WebNSSpellCheckerDetails) - (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography; @end @@ -65,7 +65,7 @@ static void initializeState() textCheckerState.isAutomaticLinkDetectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticLinkDetectionEnabled]; textCheckerState.isAutomaticTextReplacementEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticTextReplacementEnabled]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticSpellingCorrectionEnabled]) textCheckerState.isAutomaticSpellingCorrectionEnabled = [NSSpellChecker isAutomaticSpellingCorrectionEnabled]; #endif @@ -372,7 +372,7 @@ void TextChecker::updateSpellingUIWithGrammarString(int64_t, const String& badGr void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSString* language = nil; NSOrthography* orthography = nil; NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm index e9579ab9e..5293c4889 100644 --- a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm +++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm @@ -62,20 +62,19 @@ static const NSTimeInterval DefaultWatchdogTimerInterval = 1; - (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration; @end -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) -@interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard) -- (NSRect)convertRectToScreen:(NSRect)aRect; -@end - -@implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard) -- (NSRect)convertRectToScreen:(NSRect)rect +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +static NSRect convertRectToScreen(NSWindow *window, NSRect rect) { - NSRect frame = [self frame]; + return [window convertRectToScreen:rect]; +} +#else +static NSRect convertRectToScreen(NSWindow *window, NSRect rect) +{ + NSRect frame = [window frame]; rect.origin.x += frame.origin.x; rect.origin.y += frame.origin.y; return rect; } -@end #endif @interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard) @@ -217,8 +216,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) screen = [NSScreen mainScreen]; NSRect screenFrame = [screen frame]; - NSRect webViewFrame = [[_webView window] convertRectToScreen: - [_webView convertRect:[_webView frame] toView:nil]]; + NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]); // Flip coordinate system: webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame); @@ -295,14 +293,14 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) WKWindowSetClipRect([self window], windowBounds); NSWindow *webWindow = [_webViewPlaceholder.get() window]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that // behavior here, making sure to reset the animation behavior afterward. NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone]; #endif [webWindow orderOut:self]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [webWindow setAnimationBehavior:animationBehavior]; #endif @@ -352,7 +350,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) [self _updateMenuAndDockForFullScreen]; NSWindow* webWindow = [_webViewPlaceholder.get() window]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that // behavior here, making sure to reset the animation behavior afterward. NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; @@ -368,7 +366,7 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) } else [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [webWindow setAnimationBehavior:animationBehavior]; #endif @@ -460,7 +458,7 @@ static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void* - (void)_updateMenuAndDockForFullScreen { // NSApplicationPresentationOptions is available on > 10.6 only: -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSApplicationPresentationOptions options = NSApplicationPresentationDefault; NSScreen* fullScreenScreen = [[self window] screen]; diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm index 438183a23..fcd004e23 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm @@ -33,7 +33,7 @@ #import <WebCore/PlatformPasteboard.h> #import <sys/param.h> -#if HAVE(HOSTED_CORE_ANIMATION) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if HAVE(HOSTED_CORE_ANIMATION) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import <QuartzCore/CARemoteLayerServer.h> #endif @@ -99,7 +99,7 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para #endif #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort]; #else mach_port_t renderServerPort = WKInitializeRenderServer(); diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm index 96712bf0c..c5fe33586 100644 --- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm @@ -63,7 +63,7 @@ namespace WebKit { #error Unknown architecture #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 static String macOSXVersionString() { @@ -98,7 +98,7 @@ static String macOSXVersionString() return String::format("%d", major); } -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 static String userVisibleWebKitVersionString() { diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 648119486..2236d37ee 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -118,6 +118,7 @@ void QtWebPageEventHandler::handleMouseMoveEvent(QMouseEvent* ev) static QPointF lastPos = QPointF(); QTransform fromItemTransform = m_webPage->transformFromItem(); QPointF webPagePoint = fromItemTransform.map(ev->localPos()); + ev->accept(); if (lastPos == webPagePoint) return; lastPos = webPagePoint; @@ -139,6 +140,7 @@ void QtWebPageEventHandler::handleMousePressEvent(QMouseEvent* ev) m_previousClickButton = ev->button(); } + ev->accept(); m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, fromItemTransform, m_clickCount)); m_lastClick = webPagePoint; @@ -147,6 +149,7 @@ void QtWebPageEventHandler::handleMousePressEvent(QMouseEvent* ev) void QtWebPageEventHandler::handleMouseReleaseEvent(QMouseEvent* ev) { + ev->accept(); QTransform fromItemTransform = m_webPage->transformFromItem(); m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, fromItemTransform, /*eventClickCount*/ 0)); } diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp index 6d3447b05..39e1e3d21 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.cpp @@ -48,6 +48,7 @@ QtWebPageUIClient::QtWebPageUIClient(WKPageRef pageRef, QQuickWebView* webView) uiClient.mouseDidMoveOverElement = mouseDidMoveOverElement; uiClient.exceededDatabaseQuota = exceededDatabaseQuota; uiClient.decidePolicyForGeolocationPermissionRequest = policyForGeolocationPermissionRequest; + uiClient.decidePolicyForNotificationPermissionRequest = policyForNotificationPermissionRequest; WKPageSetPageUIClient(pageRef, &uiClient); } @@ -161,4 +162,14 @@ void QtWebPageUIClient::policyForGeolocationPermissionRequest(WKPageRef page, WK toQtWebPageUIClient(clientInfo)->permissionRequest(req); } +void QtWebPageUIClient::policyForNotificationPermissionRequest(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef request, const void *clientInfo) +{ + if (!request) + return; + + QWebPermissionRequest* req = QWebPermissionRequest::create(origin, request); + toQtWebPageUIClient(clientInfo)->permissionRequest(req); +} + } // namespace WebKit + diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h index cdd7e407d..e8aaa826b 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageUIClient.h @@ -59,6 +59,7 @@ private: static void mouseDidMoveOverElement(WKPageRef, WKHitTestResultRef, WKEventModifiers, WKTypeRef userData, const void* clientInfo); static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void *clientInfo); static void policyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKGeolocationPermissionRequestRef, const void*); + static void policyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef, const void*); QQuickWebView* m_webView; QUrl m_lastHoveredURL; diff --git a/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp b/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp new file mode 100644 index 000000000..08914ed81 --- /dev/null +++ b/Source/WebKit2/UIProcess/soup/WebCookieManagerProxySoup.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * 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 "WebCookieManagerProxy.h" + +#include "WebContext.h" +#include "WebCookieManagerMessages.h" + +namespace WebKit { + +void WebCookieManagerProxy::setCookiePersistentStorage(const String& storagePath, uint32_t storageType) +{ + m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::SetCookiePersistentStorage(storagePath, storageType)); +} + +} diff --git a/Source/WebKit2/WebKit2Prefix.h b/Source/WebKit2/WebKit2Prefix.h index ebc0a499f..4deb6299a 100644 --- a/Source/WebKit2/WebKit2Prefix.h +++ b/Source/WebKit2/WebKit2Prefix.h @@ -32,7 +32,7 @@ #if PLATFORM(MAC) -#ifndef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #define ENABLE_WEB_PROCESS_SANDBOX 1 #endif diff --git a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h index c0bd1f3d1..cf78a114e 100644 --- a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h +++ b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h @@ -30,6 +30,10 @@ #include <wtf/Noncopyable.h> #include <wtf/text/WTFString.h> +#if USE(SOUP) +#include "SoupCookiePersistentStorageType.h" +#endif + namespace CoreIPC { class ArgumentDecoder; class Connection; @@ -63,6 +67,10 @@ private: void startObservingCookieChanges(); void stopObservingCookieChanges(); +#if USE(SOUP) + void setCookiePersistentStorage(const String& storagePath, uint32_t storageType); +#endif + void didReceiveWebCookieManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); }; diff --git a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in index 15de9b6c3..0ae1155c0 100644 --- a/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in +++ b/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in @@ -33,4 +33,8 @@ void StartObservingCookieChanges() void StopObservingCookieChanges() + +#if USE(SOUP) + SetCookiePersistentStorage(WTF::String storagePath, uint32_t storageType) +#endif } diff --git a/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp b/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp index da218087a..9b3fbaf16 100644 --- a/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp +++ b/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp @@ -26,8 +26,12 @@ #include "config.h" #include "WebCookieManager.h" +#include "WebKitSoupCookieJarSqlite.h" #include <WebCore/CookieJarSoup.h> +#include <WebCore/ResourceHandle.h> #include <libsoup/soup.h> +#include <wtf/gobject/GRefPtr.h> +#include <wtf/text/CString.h> using namespace WebCore; @@ -77,4 +81,27 @@ HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy() return policy; } +void WebCookieManager::setCookiePersistentStorage(const String& storagePath, uint32_t storageType) +{ + GRefPtr<SoupCookieJar> jar; + switch (storageType) { + case SoupCookiePersistentStorageText: + jar = adoptGRef(soup_cookie_jar_text_new(storagePath.utf8().data(), FALSE)); + break; + case SoupCookiePersistentStorageSQLite: + jar = adoptGRef(webkitSoupCookieJarSqliteNew(storagePath)); + break; + default: + ASSERT_NOT_REACHED(); + } + + SoupCookieJar* currentJar = WebCore::soupCookieJar(); + soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(currentJar)); + SoupSession* session = ResourceHandle::defaultSession(); + soup_session_remove_feature(session, SOUP_SESSION_FEATURE(currentJar)); + soup_session_add_feature(session, SOUP_SESSION_FEATURE(jar.get())); + + WebCore::setSoupCookieJar(jar.get()); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp new file mode 100644 index 000000000..b60584c22 --- /dev/null +++ b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2,1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebKitSoupCookieJarSqlite.h" + +#include <WebCore/SQLiteDatabase.h> +#include <WebCore/SQLiteStatement.h> +#include <WebCore/SQLiteTransaction.h> +#include <libsoup/soup.h> +#include <wtf/CurrentTime.h> +#include <wtf/MathExtras.h> + +using namespace WebCore; + +struct _WebKitSoupCookieJarSqlitePrivate { + String databasePath; + SQLiteDatabase database; + bool isLoading; +}; + +G_DEFINE_TYPE(WebKitSoupCookieJarSqlite, webkit_soup_cookie_jar_sqlite, SOUP_TYPE_COOKIE_JAR) + +enum { + ColumnID, + ColumnName, + ColumnValue, + ColumnHost, + ColumnPath, + ColumnExpiry, + ColumnLastAccess, + ColumnSecure, + ColumnHTTPOnly +}; + +static bool webkitSoupCookieJarSqliteOpenDatabase(WebKitSoupCookieJarSqlite* sqliteJar) +{ + WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv; + if (priv->database.isOpen()) + return true; + + ASSERT(!priv->databasePath.isEmpty()); + if (!priv->database.open(priv->databasePath)) { + g_warning("Can't open database %s", priv->databasePath.utf8().data()); + return false; + } + + priv->database.setSynchronous(SQLiteDatabase::SyncOff); + priv->database.executeCommand("PRAGMA secure_delete = 1;"); + + return true; +} + +static bool webkitSoupCookieJarSqliteCreateTable(WebKitSoupCookieJarSqlite* sqliteJar) +{ + WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv; + if (priv->database.tableExists("moz_cookies")) + return true; + + if (!priv->database.executeCommand("CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT, expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER)")) { + g_warning("Failed to create table moz_cookies: (%i) - %s", priv->database.lastError(), priv->database.lastErrorMsg()); + priv->database.close(); + + return false; + } + + return true; +} + +static void webkitSoupCookieJarSqliteLoad(WebKitSoupCookieJarSqlite* sqliteJar) +{ + if (!webkitSoupCookieJarSqliteOpenDatabase(sqliteJar)) + return; + if (!webkitSoupCookieJarSqliteCreateTable(sqliteJar)) + return; + + WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv; + priv->isLoading = true; + SQLiteStatement query(priv->database, "SELECT id, name, value, host, path, expiry, lastAccessed, isSecure, isHttpOnly FROM moz_cookies;"); + if (query.prepare() != SQLResultOk) { + g_warning("Failed to prepare all cookies query"); + priv->isLoading = false; + return; + } + + SoupCookieJar* jar = SOUP_COOKIE_JAR(sqliteJar); + time_t now = floorf(currentTime()); + int result; + while ((result = query.step()) == SQLResultRow) { + int expireTime = query.getColumnInt(ColumnExpiry); + if (now >= expireTime) + continue; + + SoupCookie* cookie = soup_cookie_new(query.getColumnText(ColumnName).utf8().data(), query.getColumnText(ColumnValue).utf8().data(), + query.getColumnText(ColumnHost).utf8().data(), query.getColumnText(ColumnPath).utf8().data(), + expireTime - now <= G_MAXINT ? expireTime - now : G_MAXINT); + if (query.getColumnInt(ColumnSecure)) + soup_cookie_set_secure(cookie, TRUE); + if (query.getColumnInt(ColumnHTTPOnly)) + soup_cookie_set_http_only(cookie, TRUE); + + soup_cookie_jar_add_cookie(jar, cookie); + } + + if (result != SQLResultDone) + g_warning("Error reading cookies from database"); + priv->isLoading = false; +} + +static bool webkitSoupCookieJarSqliteInsertCookie(WebKitSoupCookieJarSqlite* sqliteJar, SoupCookie* cookie) +{ + WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv; + SQLiteStatement query(priv->database, "INSERT INTO moz_cookies VALUES(NULL, ?, ?, ?, ?, ?, NULL, ?, ?);"); + if (query.prepare() != SQLResultOk) { + g_warning("Failed to prepare insert cookies query"); + return false; + } + + query.bindText(1, String::fromUTF8(cookie->name)); + query.bindText(2, String::fromUTF8(cookie->value)); + query.bindText(3, String::fromUTF8(cookie->domain)); + query.bindText(4, String::fromUTF8(cookie->path)); + query.bindInt(5, static_cast<int64_t>(soup_date_to_time_t(cookie->expires))); + query.bindInt(6, cookie->secure); + query.bindInt(7, cookie->http_only); + if (query.step() != SQLResultDone) { + g_warning("Error adding cookie (name=%s, domain=%s) to database", cookie->name, cookie->name); + return false; + } + + return true; +} + +static bool webkitSoupCookieJarSqliteDeleteCookie(WebKitSoupCookieJarSqlite* sqliteJar, SoupCookie* cookie) +{ + WebKitSoupCookieJarSqlitePrivate* priv = sqliteJar->priv; + SQLiteStatement query(priv->database, "DELETE FROM moz_cookies WHERE name = (?) AND host = (?);"); + if (query.prepare() != SQLResultOk) { + g_warning("Failed to prepare delete cookies query"); + return false; + } + + query.bindText(1, String::fromUTF8(cookie->name)); + query.bindText(2, String::fromUTF8(cookie->domain)); + if (query.step() != SQLResultDone) { + g_warning("Error deleting cookie (name=%s, domain=%s) from database", cookie->name, cookie->name); + return false; + } + + return true; +} + +static void webkitSoupCookieJarSqliteChanged(SoupCookieJar* jar, SoupCookie* oldCookie, SoupCookie* newCookie) +{ + WebKitSoupCookieJarSqlite* sqliteJar = WEBKIT_SOUP_COOKIE_JAR_SQLITE(jar); + if (sqliteJar->priv->isLoading) + return; + if (!webkitSoupCookieJarSqliteOpenDatabase(sqliteJar)) + return; + if (!oldCookie && (!newCookie || !newCookie->expires)) + return; + if (!webkitSoupCookieJarSqliteCreateTable(sqliteJar)) + return; + + SQLiteTransaction updateTransaction(sqliteJar->priv->database); + updateTransaction.begin(); + + if (oldCookie && !webkitSoupCookieJarSqliteDeleteCookie(sqliteJar, oldCookie)) + return; + + if (newCookie && newCookie->expires && !webkitSoupCookieJarSqliteInsertCookie(sqliteJar, newCookie)) + return; + + updateTransaction.commit(); +} + +static void webkitSoupCookieJarSqliteFinalize(GObject* object) +{ + WEBKIT_SOUP_COOKIE_JAR_SQLITE(object)->priv->~WebKitSoupCookieJarSqlitePrivate(); + G_OBJECT_CLASS(webkit_soup_cookie_jar_sqlite_parent_class)->finalize(object); +} + +static void webkit_soup_cookie_jar_sqlite_init(WebKitSoupCookieJarSqlite* sqliteJar) +{ + WebKitSoupCookieJarSqlitePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(sqliteJar, WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqlitePrivate); + sqliteJar->priv = priv; + new (priv) WebKitSoupCookieJarSqlitePrivate(); +} + +static void webkit_soup_cookie_jar_sqlite_class_init(WebKitSoupCookieJarSqliteClass* sqliteJarClass) +{ + SoupCookieJarClass* cookieJarClass = SOUP_COOKIE_JAR_CLASS(sqliteJarClass); + cookieJarClass->changed = webkitSoupCookieJarSqliteChanged; + + GObjectClass* gObjectClass = G_OBJECT_CLASS(sqliteJarClass); + gObjectClass->finalize = webkitSoupCookieJarSqliteFinalize; + + g_type_class_add_private(sqliteJarClass, sizeof(WebKitSoupCookieJarSqlitePrivate)); +} + +SoupCookieJar* webkitSoupCookieJarSqliteNew(const String& databasePath) +{ + ASSERT(!databasePath.isEmpty()); + WebKitSoupCookieJarSqlite* sqliteJar = WEBKIT_SOUP_COOKIE_JAR_SQLITE(g_object_new(WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, NULL)); + sqliteJar->priv->databasePath = databasePath; + webkitSoupCookieJarSqliteLoad(sqliteJar); + return SOUP_COOKIE_JAR(sqliteJar); +} diff --git a/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h new file mode 100644 index 000000000..86a09044d --- /dev/null +++ b/Source/WebKit2/WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2,1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebKitSoupCookieJarSqlite_h +#define WebKitSoupCookieJarSqlite_h + +#include <libsoup/soup-cookie-jar.h> +#include <wtf/text/WTFString.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE (webkit_soup_cookie_jar_sqlite_get_type()) +#define WEBKIT_SOUP_COOKIE_JAR_SQLITE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqlite)) +#define WEBKIT_IS_SOUP_COOKIE_JAR_SQLITE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE)) +#define WEBKIT_SOUP_COOKIE_JAR_SQLITE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqliteClass)) +#define WEBKIT_IS_SOUP_COOKIE_JAR_SQLITE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE)) +#define WEBKIT_SOUP_COOKIE_JAR_SQLITE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WEBKIT_TYPE_SOUP_COOKIE_JAR_SQLITE, WebKitSoupCookieJarSqliteClass)) + +typedef struct _WebKitSoupCookieJarSqlite WebKitSoupCookieJarSqlite; +typedef struct _WebKitSoupCookieJarSqliteClass WebKitSoupCookieJarSqliteClass; +typedef struct _WebKitSoupCookieJarSqlitePrivate WebKitSoupCookieJarSqlitePrivate; + +struct _WebKitSoupCookieJarSqlite { + SoupCookieJar parent; + + WebKitSoupCookieJarSqlitePrivate* priv; +}; + +struct _WebKitSoupCookieJarSqliteClass { + SoupCookieJarClass parentClass; +}; + +GType webkit_soup_cookie_jar_sqlite_get_type(); +SoupCookieJar* webkitSoupCookieJarSqliteNew(const String& databasePath); + +G_END_DECLS + +#endif // WebKitSoupCookieJarSqlite.h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp index 759765dce..d40db796e 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp @@ -38,7 +38,7 @@ #include <WebCore/SharedBuffer.h> #include <utility> -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #include "NetscapeSandboxFunctions.h" #endif @@ -507,7 +507,7 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value) *(NPBool*)value = true; break; -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && ENABLE(PLUGIN_PROCESS) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 && ENABLE(PLUGIN_PROCESS) case WKNVSandboxFunctions: { *(WKNSandboxFunctions **)value = netscapeSandboxFunctions(); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm index 775e3caf6..afcc6456c 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm @@ -28,7 +28,7 @@ #if ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS) -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import "PluginProcess.h" #import "NetscapePluginModule.h" @@ -103,7 +103,7 @@ NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths if (profile.isNull()) exit(EX_NOPERM); -#if !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Use private temporary and cache directories. String systemDirectorySuffix = "com.apple.WebKit.PluginProcess+" + PluginProcess::shared().netscapePluginModule()->module()->bundleIdentifier(); setenv("DIRHELPER_USER_DIR_SUFFIX", fileSystemRepresentation(systemDirectorySuffix).data(), 0); @@ -190,6 +190,6 @@ NPError WKN_FileStopAccessing(const char* path) return NPERR_NO_ERROR; } -#endif // !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #endif // ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 729fc11cf..33370bdef 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without @@ -696,6 +696,15 @@ void WebChromeClient::scheduleCompositingLayerSync() #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) +WebCore::GraphicsDeviceAdapter* WebChromeClient::graphicsDeviceAdapter() const +{ + if (!m_page->drawingArea()) + return 0; + return m_page->drawingArea()->layerTreeHost()->graphicsDeviceAdapter(); +} +#endif + #if ENABLE(TOUCH_EVENTS) void WebChromeClient::needTouchEvents(bool needTouchEvents) { diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h index 44eccffe8..e3b3a5e84 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without @@ -189,6 +189,10 @@ private: } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE; +#endif + #if ENABLE(TOUCH_EVENTS) virtual void needTouchEvents(bool) OVERRIDE; #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index 03d599d91..092ec68d1 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -375,7 +375,7 @@ void WebEditorClient::textWillBeDeletedInTextField(Element* element) bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType type) const { // This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions. -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return type != TextCheckingTypeSpelling; #else return true; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h index d4ed31140..fbadd2f5e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h @@ -135,7 +135,7 @@ private: virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) OVERRIDE; virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) OVERRIDE; virtual void checkGrammarOfString(const UChar*, int length, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) OVERRIDE; -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<WebCore::TextCheckingResult>& results) OVERRIDE; #endif virtual void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail&) OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h index cfb509eae..c22213391 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h @@ -38,7 +38,7 @@ public: } private: - WebFrameNetworkingContext(WebKit::WebFrame* frame) + explicit WebFrameNetworkingContext(WebKit::WebFrame* frame) : WebCore::FrameNetworkingContext(frame->coreFrame()) { } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index 99fd1cd19..eb1049212 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -37,7 +37,7 @@ void InitWebCoreSystemInterface(void) dispatch_once(&initOnce, ^{ INIT(AdvanceDefaultButtonPulseAnimation); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CALayerEnumerateRectsBeingDrawnWithBlock); #endif INIT(CopyCFLocalizationPreferredName); @@ -117,7 +117,7 @@ void InitWebCoreSystemInterface(void) INIT(SetMetadataURL); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(IOSurfaceContextCreate); INIT(IOSurfaceContextCreateImage); INIT(CreateCTTypesetterWithUniCharProviderAndOptions); @@ -156,23 +156,23 @@ void InitWebCoreSystemInterface(void) INIT(CopyCFURLResponseSuggestedFilename); INIT(SetCFURLResponseMIMEType); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CreateVMPressureDispatchOnMainQueue); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 INIT(GetMacOSXVersionString); INIT(ExecutableWasLinkedOnOrBeforeLion); #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CGPathAddRoundedRect); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CFURLRequestAllowAllPostCaching); #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS) INIT(FilterIsManagedSession); INIT(FilterCreateInstance); INIT(FilterRelease); diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp index 8955709ce..a3d1d8feb 100644 --- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp +++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp @@ -97,6 +97,8 @@ void FindController::updateFindUIAfterPageScroll(bool found, const String& strin bool shouldShowOverlay = false; if (!found) { + m_webPage->corePage()->unmarkAllTextMatches(); + // Clear the selection. if (selectedFrame) selectedFrame->selection()->clear(); @@ -114,6 +116,7 @@ void FindController::updateFindUIAfterPageScroll(bool found, const String& strin if (maxMatchCount == numeric_limits<unsigned>::max()) --maxMatchCount; + m_webPage->corePage()->unmarkAllTextMatches(); matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), shouldShowHighlight, maxMatchCount + 1); // Check if we have more matches than allowed. @@ -152,8 +155,6 @@ void FindController::updateFindUIAfterPageScroll(bool found, const String& strin void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount) { - m_webPage->corePage()->unmarkAllTextMatches(); - bool found = m_webPage->corePage()->findString(string, core(options)); m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition(WTF::bind(&FindController::updateFindUIAfterPageScroll, this, found, string, options, maxMatchCount)); diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp index f3e8735e5..ae099d15c 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp @@ -174,7 +174,10 @@ void LayerTreeCoordinator::scrollNonCompositedContents(const WebCore::IntRect& s void LayerTreeCoordinator::forceRepaint() { + // We need to schedule another flush, otherwise the forced paint might cancel a later expected flush. + // This is aligned with LayerTreeHostCA. scheduleLayerFlush(); + flushPendingLayerChanges(); } void LayerTreeCoordinator::sizeDidChange(const WebCore::IntSize& newSize) @@ -231,13 +234,27 @@ void LayerTreeCoordinator::setPageOverlayOpacity(float value) bool LayerTreeCoordinator::flushPendingLayerChanges() { + m_shouldSyncFrame = false; bool didSync = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes(); m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly(); if (m_pageOverlayLayer) m_pageOverlayLayer->syncCompositingStateForThisLayerOnly(); m_rootLayer->syncCompositingStateForThisLayerOnly(); - return didSync; + + if (m_shouldSyncRootLayer) { + m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetRootCompositingLayer(toWebGraphicsLayer(m_rootLayer.get())->id())); + m_shouldSyncRootLayer = false; + } + + if (!m_shouldSyncFrame) + return didSync; + + m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidRenderFrame()); + m_waitingForUIProcess = true; + m_shouldSyncFrame = false; + + return true; } void LayerTreeCoordinator::syncLayerState(WebLayerID id, const WebLayerInfo& info) @@ -246,6 +263,7 @@ void LayerTreeCoordinator::syncLayerState(WebLayerID id, const WebLayerInfo& inf m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidChangeScrollPosition(m_visibleContentsRect.location())); m_shouldSendScrollPositionUpdate = false; } + m_shouldSyncFrame = true; m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetCompositingLayerState(id, info)); } @@ -344,25 +362,16 @@ void LayerTreeCoordinator::performScheduledLayerFlush() if (!m_isValid) return; - m_shouldSyncFrame = false; - flushPendingLayerChanges(); - if (!m_shouldSyncFrame) - return; + if (flushPendingLayerChanges()) + didPerformScheduledLayerFlush(); +} - if (m_shouldSyncRootLayer) { - m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetRootCompositingLayer(toWebGraphicsLayer(m_rootLayer.get())->id())); - m_shouldSyncRootLayer = false; +void LayerTreeCoordinator::didPerformScheduledLayerFlush() +{ + if (m_notifyAfterScheduledLayerFlush) { + static_cast<DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers(); + m_notifyAfterScheduledLayerFlush = false; } - - m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidRenderFrame()); - m_waitingForUIProcess = true; - - if (!m_notifyAfterScheduledLayerFlush) - return; - - // Let the drawing area know that we've done a flush of the layer changes. - static_cast<DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers(); - m_notifyAfterScheduledLayerFlush = false; } void LayerTreeCoordinator::layerFlushTimerFired(Timer<LayerTreeCoordinator>*) diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h index bc449f46a..9b5154c36 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h @@ -104,7 +104,7 @@ private: bool flushPendingLayerChanges(); void cancelPendingLayerFlush(); void performScheduledLayerFlush(); - void sendLayersToUI(); + void didPerformScheduledLayerFlush(); OwnPtr<WebCore::GraphicsLayer> m_rootLayer; diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h index 649c9a950..9ce8ecdad 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.h @@ -23,9 +23,9 @@ #include "FloatPoint3D.h" #include "GraphicsLayer.h" +#include "GraphicsLayerTransform.h" #include "Image.h" #include "IntSize.h" -#include "LayerTransform.h" #include "ShareableBitmap.h" #include "TiledBackingStore.h" #include "TiledBackingStoreClient.h" @@ -165,7 +165,7 @@ private: RefPtr<Image> m_image; GraphicsLayer* m_maskTarget; FloatRect m_needsDisplayRect; - LayerTransform m_layerTransform; + GraphicsLayerTransform m_layerTransform; bool m_inUpdateMode : 1; bool m_shouldUpdateVisibleRect: 1; bool m_shouldSyncLayerState: 1; diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h index b49cc90bd..368230cc9 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,6 +41,10 @@ class FloatPoint; class IntRect; class IntSize; class GraphicsLayer; + +#if PLATFORM(WIN) && USE(AVFOUNDATION) +struct GraphicsDeviceAdapter; +#endif } namespace WebKit { @@ -97,6 +101,10 @@ public: virtual void setLayerHostingMode(LayerHostingMode) { } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } +#endif + protected: explicit LayerTreeHost(WebPage*); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 37d1e0702..2cb290e50 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -130,6 +130,10 @@ #include "WebBatteryClient.h" #endif +#if ENABLE(NETWORK_INFO) +#include "WebNetworkInfoClient.h" +#endif + #if ENABLE(WEB_INTENTS) #include "IntentData.h" #endif @@ -276,6 +280,9 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters) WebCore::provideDeviceMotionTo(m_page.get(), new DeviceMotionClientQt); WebCore::provideDeviceOrientationTo(m_page.get(), new DeviceOrientationClientQt); #endif +#if ENABLE(NETWORK_INFO) + WebCore::provideNetworkInfoTo(m_page.get(), new WebNetworkInfoClient(this)); +#endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) WebCore::provideNotification(m_page.get(), new WebNotificationClient(this)); #endif @@ -3091,7 +3098,7 @@ bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request) return platformCanHandleRequest(request); } -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void WebPage::handleAlternativeTextUIResult(const String& result) { Frame* frame = m_page->focusController()->focusedOrMainFrame(); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index b9dac9137..d234a1da4 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -520,7 +520,7 @@ public: void unmarkAllMisspellings(); void unmarkAllBadGrammar(); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void handleAlternativeTextUIResult(const String&); #endif diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 38f36c2bf..75f7245f5 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -277,7 +277,7 @@ messages -> WebPage { FindZoomableAreaForPoint(WebCore::IntPoint point, WebCore::IntSize area) #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 HandleAlternativeTextUIResult(String result) #endif diff --git a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp index b086aa5ae..7252ad68b 100644 --- a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp +++ b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp @@ -36,6 +36,7 @@ #include <WebCore/GraphicsLayerCA.h> #include <WebCore/LayerChangesFlusher.h> #include <WebCore/PlatformCALayer.h> +#include <WebCore/SoftLinking.h> #include <WebCore/WebCoreInstanceHandle.h> #include <WebKitQuartzCoreAdditions/WKCACFImage.h> #include <WebKitQuartzCoreAdditions/WKCACFView.h> @@ -43,9 +44,15 @@ #include <wtf/MainThread.h> #ifdef DEBUG_ALL -#pragma comment(lib, "WebKitQuartzCoreAdditions_debug") +#define MODULE_NAME "WebKitQuartzCoreAdditions_debug" #else -#pragma comment(lib, "WebKitQuartzCoreAdditions") +#define MODULE_NAME "WebKitQuartzCoreAdditions" +#endif + +#pragma comment(lib, MODULE_NAME) + +#if USE(AVFOUNDATION) +SOFT_LINK_LOADED_LIBRARY(MODULE_NAME, WKCACFViewGetD3DDevice9, IDirect3DDevice9*, _cdecl, (WKCACFViewRef view)) #endif using namespace WebCore; @@ -258,6 +265,17 @@ void LayerTreeHostCAWin::setRootCompositingLayer(GraphicsLayer* graphicsLayer) LayerTreeHostCA::setRootCompositingLayer(graphicsLayer); } +#if USE(AVFOUNDATION) +WebCore::GraphicsDeviceAdapter* LayerTreeHostCAWin::graphicsDeviceAdapter() const +{ + if (!WKCACFViewGetD3DDevice9Ptr()) + return 0; + + return reinterpret_cast<GraphicsDeviceAdapter*>(WKCACFViewGetD3DDevice9Ptr()(m_view.get())); +} +#endif + } // namespace WebKit + #endif // HAVE(WKQCA) diff --git a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h index 3d8d88513..c994a88b5 100644 --- a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h +++ b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h @@ -49,6 +49,10 @@ public: static PassRefPtr<LayerTreeHostCAWin> create(WebPage*); virtual ~LayerTreeHostCAWin(); +#if USE(AVFOUNDATION) + virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE; +#endif + private: explicit LayerTreeHostCAWin(WebPage*); diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm index 22eede843..43d381ecd 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm @@ -481,7 +481,7 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint) NSDictionary *options = nil; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // As context, we are going to use the surrounding paragraph of text. VisiblePosition paragraphStart = startOfParagraph(position); VisiblePosition paragraphEnd = endOfParagraph(position); @@ -513,7 +513,7 @@ void WebPage::performDictionaryLookupForSelection(DictionaryPopupInfo::Type type NSDictionary *options = nil; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 VisiblePosition selectionStart = selection.visibleStart(); VisiblePosition selectionEnd = selection.visibleEnd(); @@ -564,7 +564,7 @@ void WebPage::performDictionaryLookupForRange(DictionaryPopupInfo::Type type, Fr dictionaryPopupInfo.type = type; dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + (style->fontMetrics().ascent() * pageScaleFactor())); dictionaryPopupInfo.fontInfo.fontAttributeDictionary = fontDescriptorAttributes; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 dictionaryPopupInfo.options = (CFDictionaryRef)options; #endif diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in index b38c23c6c..c501e8f5b 100644 --- a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in +++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in @@ -93,7 +93,7 @@ (allow file* (subpath "/private/var/db/mds/system")) -#if !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 (if (positive? (string-length (param "DARWIN_USER_CACHE_DIR"))) (allow file* (subpath (param "DARWIN_USER_CACHE_DIR")))) #else diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp index f4566d3cb..d8d0167f3 100644 --- a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp +++ b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp @@ -47,8 +47,7 @@ namespace WebKit { static uint64_t getCacheDiskFreeSize(SoupCache* cache) { - if (!cache) - return 0; + ASSERT(cache); GOwnPtr<char> cacheDir; g_object_get(G_OBJECT(cache), "cache-dir", &cacheDir.outPtr(), NULL); @@ -89,8 +88,8 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel) unsigned long urlCacheDiskCapacity = 0; SoupSession* session = WebCore::ResourceHandle::defaultSession(); - SoupCache* cache = reinterpret_cast<SoupCache*>(soup_session_get_feature(session, SOUP_TYPE_CACHE)); - uint64_t diskFreeSize = getCacheDiskFreeSize(cache); + SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); + uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024; uint64_t memSize = getMemorySize(); calculateCacheSizes(cacheModel, memSize, diskFreeSize, @@ -101,15 +100,17 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel) WebCore::memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); WebCore::pageCache()->setCapacity(pageCacheCapacity); - if (cache) { - if (urlCacheDiskCapacity > soup_cache_get_max_size(cache)) - soup_cache_set_max_size(cache, urlCacheDiskCapacity); - } + if (urlCacheDiskCapacity > soup_cache_get_max_size(cache)) + soup_cache_set_max_size(cache, urlCacheDiskCapacity); } -void WebProcess::platformClearResourceCaches(ResourceCachesToClear) +void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear) { - notImplemented(); + if (cachesToClear == InMemoryResourceCachesOnly) + return; + + SoupSession* session = WebCore::ResourceHandle::defaultSession(); + soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE))); } void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters&, CoreIPC::ArgumentDecoder*) @@ -119,6 +120,10 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters void WebProcess::platformTerminate() { + SoupSession* session = WebCore::ResourceHandle::defaultSession(); + SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); + soup_cache_flush(cache); + soup_cache_dump(cache); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp index 45b8581b6..199957f43 100644 --- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp @@ -27,6 +27,8 @@ #include "config.h" #include "WebProcessMainGtk.h" +#define LIBSOUP_USE_UNSTABLE_REQUEST_API + #include "WebAuthDialog.h" #include "WKBase.h" #include <WebCore/GtkAuthenticationDialog.h> @@ -34,9 +36,12 @@ #include <WebCore/RunLoop.h> #include <WebKit2/WebProcess.h> #include <gtk/gtk.h> +#include <libsoup/soup-cache.h> #include <runtime/InitializeThreading.h> #include <unistd.h> #include <wtf/MainThread.h> +#include <wtf/gobject/GOwnPtr.h> +#include <wtf/gobject/GRefPtr.h> using namespace WebCore; @@ -70,6 +75,11 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]) g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, SOUP_SESSION_SSL_STRICT, FALSE, NULL); + GOwnPtr<char> soupCacheDirectory(g_build_filename(g_get_user_cache_dir(), g_get_prgname(), NULL)); + GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(soupCacheDirectory.get(), SOUP_CACHE_SINGLE_USER)); + soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache.get())); + soup_cache_load(soupCache.get()); + RunLoop::run(); return 0; diff --git a/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm b/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm index 3f229a1b6..5759aa52f 100644 --- a/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm +++ b/Source/WebKit2/WebProcess/mac/KeychainItemShimMethods.mm @@ -26,7 +26,7 @@ #import "config.h" #import "KeychainItemShimMethods.h" -#if USE(SECURITY_FRAMEWORK) && defined(BUILDING_ON_SNOW_LEOPARD) +#if USE(SECURITY_FRAMEWORK) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 #import "BlockingResponseMap.h" #import "SecKeychainItemRequestData.h" @@ -229,4 +229,4 @@ void initializeKeychainItemShim() } // namespace WebKit -#endif // USE(SECURITY_FRAMEWORK) && defined(BUILDING_ON_SNOW_LEOPARD) +#endif // USE(SECURITY_FRAMEWORK) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 diff --git a/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm b/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm index cfe33adc3..50cbb587a 100644 --- a/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm +++ b/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm @@ -26,7 +26,7 @@ #import "config.h" #import "SecItemShimMethods.h" -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import "BlockingResponseMap.h" #import "SecItemRequestData.h" @@ -119,4 +119,4 @@ void initializeSecItemShim() } // namespace WebKit -#endif // !BUILDING_ON_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm index 69f4fb10b..0a8c0a489 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -45,7 +45,7 @@ #import <objc/runtime.h> #import <stdio.h> -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 #import "KeychainItemShimMethods.h" #else #import "SecItemShimMethods.h" @@ -185,7 +185,7 @@ static void initializeSandbox(const WebProcessCreationParameters& parameters) return; } -#if !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Use private temporary and cache directories. String systemDirectorySuffix = "com.apple.WebProcess+" + parameters.uiProcessBundleIdentifier; setenv("DIRHELPER_USER_DIR_SUFFIX", fileSystemRepresentation(systemDirectorySuffix).data(), 0); @@ -281,7 +281,7 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters void WebProcess::initializeShim() { -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 initializeKeychainItemShim(); #else initializeSecItemShim(); @@ -299,14 +299,14 @@ void WebProcess::platformTerminate() void WebProcess::secItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecItemResponseData& response) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 didReceiveSecItemResponse(requestID, response); #endif } void WebProcess::secKeychainItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecKeychainItemResponseData& response) { -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 didReceiveSecKeychainItemResponse(requestID, response); #endif } diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm index 48ac2f338..1b67fc6c2 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm @@ -47,7 +47,7 @@ #import <wtf/text/CString.h> #import <wtf/text/StringBuilder.h> -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern "C" kern_return_t bootstrap_register2(mach_port_t, name_t, mach_port_t, uint64_t); #endif @@ -73,7 +73,7 @@ int WebProcessMain(const CommandLine& commandLine) String serviceName = commandLine["servicename"]; String clientExecutable; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 clientExecutable = commandLine["client-executable"]; #endif @@ -89,7 +89,7 @@ int WebProcessMain(const CommandLine& commandLine) return 2; } } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 else { mach_port_name_t publishedService; mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &publishedService); @@ -141,7 +141,7 @@ int WebProcessMain(const CommandLine& commandLine) return EXIT_FAILURE; } } -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 String localization = commandLine["localization"]; RetainPtr<CFStringRef> cfLocalization(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(localization.characters()), localization.length())); diff --git a/Source/WebKit2/WebProcess/mac/WebProcessShim.mm b/Source/WebKit2/WebProcess/mac/WebProcessShim.mm index 6d694419b..99166e689 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessShim.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessShim.mm @@ -33,7 +33,7 @@ namespace WebKit { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern "C" void WebKitWebProcessSecItemShimInitialize(const WebProcessSecItemShimCallbacks&); @@ -70,9 +70,9 @@ void WebKitWebProcessSecItemShimInitialize(const WebProcessSecItemShimCallbacks& secItemShimCallbacks = callbacks; } -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 extern "C" void WebKitWebProcessKeychainItemShimInitialize(const WebProcessKeychainItemShimCallbacks&); @@ -121,6 +121,6 @@ void WebKitWebProcessKeychainItemShimInitialize(const WebProcessKeychainItemShim keychainItemShimCallbacks = callbacks; } -#endif // defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 } // namespace WebKit diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 864f6ec59..4c742953c 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -255,6 +255,9 @@ EXPORTS ?utf8@String@WTF@@QBE?AVCString@2@_N@Z ?view@Document@WebCore@@QBEPAVFrameView@2@XZ ?willDetachPage@FrameDestructionObserver@WebCore@@UAEXXZ + ??1ContextDestructionObserver@WebCore@@MAE@XZ + ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ + ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z ?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 dfcbcdd03..fb51f6223 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -148,6 +148,9 @@ EXPORTS ??0String@WTF@@QAE@PB_W@Z ??1FrameDestructionObserver@WebCore@@MAE@XZ ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z + ??1ContextDestructionObserver@WebCore@@MAE@XZ + ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ + ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z ?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z ?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ @@ -261,6 +264,7 @@ EXPORTS ?setAllowsRoundingHacks@TextRun@WebCore@@SAX_N@Z ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z + ??1ContextDestructionObserver@WebCore@@MAE@XZ ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@U?$PtrHash@PAVStringImpl@WTF@@@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z ?registerURLSchemeAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z ?removeURLSchemeRegisteredAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter index a60721a64..48e9505a6 100644 --- a/Source/autotools/symbols.filter +++ b/Source/autotools/symbols.filter @@ -157,6 +157,7 @@ _ZN7WebCore22RuntimeEnabledFeatures31isMultipleShadowSubtreesEnabledE; _ZN7WebCore22RuntimeEnabledFeatures32setMultipleShadowSubtreesEnabledEb; _ZN7WebCore22RuntimeEnabledFeatures18isShadowDOMEnabledE; _ZN7WebCore22RuntimeEnabledFeatures22isCSSExclusionsEnabledE; +_ZN7WebCore22RuntimeEnabledFeatures22isDialogElementEnabledE; _ZNK7WebCore8Document13nodesFromRectEiijjjjbb; _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE; _ZNK7WebCore6Editor26selectionStartHasMarkerForENS_14DocumentMarker10MarkerTypeEii; @@ -167,6 +168,9 @@ _ZN7WebCore8Document35webkitWillEnterFullScreenForElementEPNS_7ElementE; _ZN7WebCore17JSDOMGlobalObject6s_infoE; _ZN7WebCore7TextRun22setAllowsRoundingHacksEb; _ZNK7WebCore14InsertionPoint8isActiveEv; +_ZN7WebCore26ContextDestructionObserverD2Ev; +_ZN7WebCore26ContextDestructionObserverC2EPNS_22ScriptExecutionContextE; +_ZN7WebCore26ContextDestructionObserver16contextDestroyedEv; local: _Z*; cti*; diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake index 32ea38363..889f22e64 100644 --- a/Source/cmake/OptionsEfl.cmake +++ b/Source/cmake/OptionsEfl.cmake @@ -16,12 +16,6 @@ ADD_DEFINITIONS(-DWTF_PLATFORM_EFL=1) SET(WTF_PLATFORM_EFL 1) # ----------------------------------------------------------------------------- -# Enable CTest for the public API unit testing -# ----------------------------------------------------------------------------- -ENABLE_TESTING() -SET(ENABLE_API_TESTS ON) - -# ----------------------------------------------------------------------------- # Determine which font backend will be used # ----------------------------------------------------------------------------- SET(ALL_FONT_BACKENDS freetype pango) @@ -73,6 +67,7 @@ SET(THEME_BINARY_DIR ${CMAKE_BINARY_DIR}/WebKit/efl/DefaultTheme) SET(VERSION_SCRIPT "-Wl,--version-script,${CMAKE_MODULE_PATH}/eflsymbols.filter") WEBKIT_OPTION_BEGIN() +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET ON) diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake index 5cf3586cf..2e93826f6 100644 --- a/Source/cmake/WebKitFeatures.cmake +++ b/Source/cmake/WebKitFeatures.cmake @@ -11,6 +11,7 @@ MACRO (WEBKIT_OPTION_DEFAULT_PORT_VALUE _name _value) ENDMACRO () MACRO (WEBKIT_OPTION_BEGIN) + WEBKIT_OPTION_DEFINE(ENABLE_API_TESTS "Enable public API unit tests" OFF) WEBKIT_OPTION_DEFINE(ENABLE_3D_RENDERING "Toggle 3D rendering support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_ACCELERATED_2D_CANVAS "Toggle accelerated 2D canvas support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_ANIMATION_API "Toggle animation API support" OFF) diff --git a/Source/cmakeconfig.h.cmake b/Source/cmakeconfig.h.cmake index 515823221..035bd10eb 100644 --- a/Source/cmakeconfig.h.cmake +++ b/Source/cmakeconfig.h.cmake @@ -5,6 +5,7 @@ #cmakedefine WEBKIT_USER_AGENT_MINOR_VERSION @WEBKIT_USER_AGENT_MINOR_VERSION@ +#cmakedefine01 ENABLE_API_TESTS #cmakedefine01 ENABLE_3D_RENDERING #cmakedefine01 ENABLE_ACCELERATED_2D_CANVAS #cmakedefine01 ENABLE_AS_IMAGE diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 8f8d602ef..f40f69e15 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,1038 @@ +2012-07-14 Benjamin Poulain <bpoulain@apple.com> + + [Mac] Do not try to update the cache model for every WebPreferences change + https://bugs.webkit.org/show_bug.cgi?id=91302 + + Reviewed by Joseph Pecoraro. + + * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: + * TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm: Added. + (TestWebKitAPI): + (TestWebKitAPI::TEST): + +2012-07-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122665. + http://trac.webkit.org/changeset/122665 + https://bugs.webkit.org/show_bug.cgi?id=91321 + + Broke Mac builds (Requested by rniwa on #webkit). + + * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: + * TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm: Removed. + +2012-07-13 Benjamin Poulain <bpoulain@apple.com> + + [Mac] Do not try to update the cache model for every WebPreferences change + https://bugs.webkit.org/show_bug.cgi?id=91302 + + Reviewed by Joseph Pecoraro. + + * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: + * TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm: Added. + (TestWebKitAPI): + (TestWebKitAPI::TEST): + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + run-webkit-test outputs the wrong number of tests executed when some are skipped. + https://bugs.webkit.org/show_bug.cgi?id=89894 + + Reviewed by Ojan Vafai. + + Fix the logging of the actual number of tests run so that tests + that are skipped aren't included. + + Also revamp the 'expected' output so we distinguish the number + of tests found from the number of tests run (to account for + --repeat-each and --iterations). + + Covered by existing tests. + + * Scripts/webkitpy/layout_tests/controllers/manager.py: + (Manager.prepare_lists_and_print_output): + (Manager._log_num_workers): + (Manager.run): + (Manager._print_result_summary): + * Scripts/webkitpy/layout_tests/models/result_summary.py: + (ResultSummary.__init__): + (ResultSummary.add): + * Scripts/webkitpy/layout_tests/views/printing.py: + (Printer.print_one_line_summary): + * Scripts/webkitpy/layout_tests/views/printing_unittest.py: + (Testprinter.test_print_one_line_summary): + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + nrwt: actually print the exception name and message for otherwise unhandled exceptions + https://bugs.webkit.org/show_bug.cgi?id=91305 + + Reviewed by Adam Barth. + + Two more places where I was printing the stack trace but not the + exception itself :(. These two spots can't easily be + unit-tested, but I tested them by hand. + + * Scripts/webkitpy/layout_tests/run_webkit_tests.py: + (run): + (main): + +2012-07-13 Josh Hawn <jhawn@apple.com> + + Fix for WebContext::getWebCoreStatistics() causes crash if no m_process + https://bugs.webkit.org/show_bug.cgi?id=91116 + + Reviewed by Simon Fraser. + + * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: + Added new test file. + * TestWebKitAPI/Tests/WebKit2/WebCoreStatisticsWithNoWebProcess.cpp: Added. + (TestWebKitAPI::wkContextGetStatisticsCallback): + Tests that callback function receives an error. + (TestWebKitAPI::TEST): + Creates a dummy web context object (no web process). + Calls WKContextGetStatistics with the web context and test callback. + The test callback should get an expected error. + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + test-webkitpy: move printing-related code out of the runner + https://bugs.webkit.org/show_bug.cgi?id=91289 + + Reviewed by Ryosuke Niwa. + + More refactoring ... this moves all printing-related stuff out + of runner.py and into printer.py. + + No functional changes; covered by existing tests. + + * Scripts/webkitpy/test/main.py: + (Tester._run_tests): + * Scripts/webkitpy/test/printer.py: + (Printer.__init__): + (Printer): + (Printer.test_name): + (Printer.print_started_test): + (Printer.print_finished_test): + (Printer.print_result): + * Scripts/webkitpy/test/runner.py: + (Runner.__init__): + (Runner.all_test_names): + (Runner.run): + * Scripts/webkitpy/test/runner_unittest.py: + (RunnerTest.test_regular): + (RunnerTest.test_verbose): + (RunnerTest.test_timing): + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + webkitpy: split printing/logging code for test-webkitpy out into a new class + https://bugs.webkit.org/show_bug.cgi?id=91282 + + Reviewed by Ojan Vafai. + + This patch is the first step at splitting all of the + printing/logging code out separately from the actual + test-running code. + + This is just moving stuff around; no new functionality and no + new tests needed. + + * Scripts/webkitpy/test/finder_unittest.py: + (FinderTest.setUp): + * Scripts/webkitpy/test/main.py: + (Tester.__init__): + (Tester._parse_args): + (Tester.run): + (Tester._run_tests): + (Tester._log_exception): + * Scripts/webkitpy/test/main_unittest.py: + (TesterTest.test_no_tests_found): + * Scripts/webkitpy/test/printer.py: Added. + (Printer): + (Printer.__init__): + (Printer.configure): + (Printer.configure.filter): + (_CaptureAndPassThroughStream): + (_CaptureAndPassThroughStream.__init__): + (_CaptureAndPassThroughStream.write): + (_CaptureAndPassThroughStream._message_is_from_pdb): + (_CaptureAndPassThroughStream.flush): + (_CaptureAndPassThroughStream.getvalue): + +2012-07-13 James Simonsen <simonjam@chromium.org> + + [Navigation Timing] Imported W3C tests contain duplicates and are DOS formatted + https://bugs.webkit.org/show_bug.cgi?id=91184 + + Reviewed by Adam Barth. + + The upstream 'html5' tests are just duplicates of the 'html' tests. + + * Scripts/import-w3c-performance-wg-tests: + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + webkitpy: hide yield_to_caller from callers in MessagePool :) + https://bugs.webkit.org/show_bug.cgi?id=91269 + + Reviewed by Adam Barth. + + yield_to_caller() was an optimization/hack to allow us to run + both manager and worker in a single process/loop without + starving the manager while the worker is running tests. The + worker was required to call yield_to_caller() periodically. It + turns out that I can get equivalent responsiveness by yielding + inside the MessagePool every time the worker posts a message, and this + allows me to no longer need the worker to call the routine. Thus + I rename yield_to_caller() to _yield_to_manager() to be a little + clearer about its purpose. + + Tested by existing tests. + + * Scripts/webkitpy/common/message_pool.py: + (_Worker.run): + (_Worker.post): + (_Worker._yield_to_manager): + * Scripts/webkitpy/layout_tests/controllers/worker.py: + (Worker.handle): + +2012-07-13 Adam Barth <abarth@webkit.org> + + EWSTools should be able to build a commit-queue instance from scratch + https://bugs.webkit.org/show_bug.cgi?id=91264 + + Reviewed by Eric Seidel. + + I've been using this script to build commit-queue instances on Google + Compute Engine and it seems to work. + + * EWSTools/GoogleComputeEngine/build-commit-queue.sh: Added. + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + webkitpy: make worker.start() and worker.stop() optional in the messagepool + https://bugs.webkit.org/show_bug.cgi?id=91170 + + Reviewed by Ojan Vafai. + + test-webkitpy will use messagepool workers that don't actually + have any per-worker state, so they don't need start() and stop() + methods. Now we will only call the methods if they exist; this + means that workers only need to expose a handle() method. + + * Scripts/webkitpy/common/message_pool.py: + (_Worker.terminate): + (_Worker.run): + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + NRWT doesn't print exceptions + https://bugs.webkit.org/show_bug.cgi?id=91129 + + Reviewed by Ojan Vafai. + + Although we printed exceptions in most cases, if an unexpected + exception (like a runtime error) was raised when creating a + port, we wouldn't. This patch fixes that, and also cleans up + how we were logging exceptions from the workers to be less + verbose. + + Because of the corner cases where these errors are occurring, + it's difficult to write automated unit tests for them. I've + tested it quite a bit by hand, though. + + * Scripts/webkitpy/common/message_pool.py: + (_MessagePool._close): + (_MessagePool._handle_worker_exception): + (_Worker.run): + (_Worker._raise): + * Scripts/webkitpy/layout_tests/controllers/manager.py: + (Manager._run_tests): + * Scripts/webkitpy/layout_tests/run_webkit_tests.py: + (main): + +2012-07-13 Wei James <james.wei@intel.com> + + enable TestWebKitAPI/webkit_unit_tests apk on x86 android platform by adding abi support + https://bugs.webkit.org/show_bug.cgi?id=91194 + + Reviewed by Adam Barth. + + * TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp: + +2012-07-13 Simon Pena <spena@igalia.com> + + [GTK] Gardening: update API tests skipped list + https://bugs.webkit.org/show_bug.cgi?id=91224 + + Unreviewed gardening. + + Skip "next" and "previous" tests of FindController until bug #91083 + is fixed. + + * gtk/run-api-tests: + (TestRunner): + +2012-07-13 Zeno Albisser <zeno@webkit.org> + + [Qt][WK2] Implement GraphicsSurface for Linux/GLX. + https://bugs.webkit.org/show_bug.cgi?id=90881 + + Enable GraphicsSurface for Linux based platforms + whenever the Xcomposite extension is available. + + Reviewed by Noam Rosenthal. + + * qmake/config.tests/libXcomposite/libXcomposite.cpp: Added. + (main): + * qmake/config.tests/libXcomposite/libXcomposite.pro: Added. + Add a configure test to detect Xcomposite extension and + activate GraphicsSurface on linux in case the extension is available. + * qmake/configure.pri: + * qmake/mkspecs/features/features.prf: + +2012-07-13 David Grogan <dgrogan@chromium.org> + + nrwt: don't choke when printing invalid utf-8 to stderr + https://bugs.webkit.org/show_bug.cgi?id=91181 + + Reviewed by Dirk Pranke. + + * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py: + (TestResultWriter.write_stderr): + +2012-07-13 Dirk Pranke <dpranke@chromium.org> + + test-webkitpy: more class renaming cleanup + https://bugs.webkit.org/show_bug.cgi?id=91182 + + Reviewed by Adam Barth. + + More removing of the unnecessary "Test" prefix. + + * Scripts/webkitpy/test/finder.py: + (_DirectoryTree): + (Finder.add_tree): + * Scripts/webkitpy/test/main.py: + (Tester._run_tests): + * Scripts/webkitpy/test/runner.py: + (Runner): + * Scripts/webkitpy/test/runner_unittest.py: + (RunnerTest.test_regular): + (RunnerTest.test_verbose): + (RunnerTest.test_timing): + +2012-07-12 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][EFL] Facilitate debugging of the Web Process + https://bugs.webkit.org/show_bug.cgi?id=90768 + + Reviewed by Kenneth Rohde Christiansen. + + Add a new --webprocess-cmd-prefix argument to + run-webkit-tests script for EFL port. If provided, + the prefix will be prepended to the command used + to spawn the Web process. This can be used for + debugging purposes with prefixes such as: + "xterm -title renderer -e gdb --args". + + * Scripts/webkitpy/layout_tests/port/efl.py: + (EflPort.__init__): + (EflPort.setup_environ_for_server): + * Scripts/webkitpy/layout_tests/run_webkit_tests.py: + (parse_args): + * WebKitTestRunner/efl/TestControllerEfl.cpp: + (WTR::TestController::platformRunUntil): Implement support for + m_noTimeout timeout value. + +2012-07-12 Adam Barth <abarth@webkit.org> + + Fix crash in the commit-queue. We need to initialize self.port during __init__. + + * Scripts/webkitpy/tool/commands/queues.py: + (CommitQueue.__init__): + (CommitQueue.begin_work_queue): + +2012-07-12 Dirk Pranke <dpranke@chromium.org> + + test-webkitpy: rename test_finder to finder + https://bugs.webkit.org/show_bug.cgi?id=91175 + + Reviewed by Adam Barth. + + Rename test_finder -> finder, TestFinder -> Finder to remove + some of the stutter in the names. + + * Scripts/webkitpy/test/finder.py: Renamed from Tools/Scripts/webkitpy/test/test_finder.py. + * Scripts/webkitpy/test/finder_unittest.py: Renamed from Tools/Scripts/webkitpy/test/test_finder_unittest.py. + * Scripts/webkitpy/test/main.py: + (Tester.__init__): + +2012-07-12 Adam Barth <abarth@webkit.org> + + CommitQueue is confused about what port it is using + https://bugs.webkit.org/show_bug.cgi?id=91040 + + Reviewed by Dirk Pranke. + + On EC2, we explicitly pass --port to the commit-queue, but that + requires editing the start-queue.sh script locally on each bot. In + moving to Google Compute Engine, we're try to avoid any local edits to + the EWSTools. + + Rather than passing --port to the commit-queue, this patch teaches the + CommitQueue which port its running, which is the approach we use for + the EWS bots. + + Mutating tool._deprecated_port is a bit ugly, but it's what we're doing + currently for the EWS bots. + + * Scripts/webkitpy/tool/commands/queues.py: + (CommitQueue): + (CommitQueue.begin_work_queue): + (CommitQueue.run_command): + * Scripts/webkitpy/tool/commands/queues_unittest.py: + (CommitQueueTest.test_commit_queue): + (mock_run_webkit_patch): + (test_rollout): + (test_rollout_lands): + (test_manual_reject_during_processing): + +2012-07-12 James Simonsen <simonjam@chromium.org> + + [Navigation Timing] Import the W3C Navigation Timing test suite + https://bugs.webkit.org/show_bug.cgi?id=84887 + + Reviewed by Tony Gentilcore. + + * Scripts/import-w3c-performance-wg-tests: Added. + +2012-07-12 Adam Barth <abarth@webkit.org> + + Unreviewed. Nit: git config files use tabs, not spaces. + + * EWSTools/cold-boot.sh: + +2012-07-12 Kwang Yul Seo <skyul@company100.net> + + Unreviewed. Add Dongsung Huang to the list of contributors. He + has submitted over 30 patches on texture mapper, canvas and image decoders. + + * Scripts/webkitpy/common/config/committers.py: + +2012-07-12 Kwang Yul Seo <skyul@company100.net> + + Unreviewed. Change my irc nickname to kseo. + + * Scripts/webkitpy/common/config/committers.py: + +2012-07-12 Dirk Pranke <dpranke@chromium.org> + + webkitpy: clean up logging handlers, lint common.message_pool + https://bugs.webkit.org/show_bug.cgi?id=91152 + + Reviewed by Ojan Vafai. + + The unix implementation of multiprocessing clones any logging + handlers from the parent process into the child; we currently + don't want this behavior in our code, so I was hand-removing the + installed handlers in the child process I knew about. After thinking + about it further, I think it was simpler and safe enough to just + remove all handlers in the child, since the message pool + propagates any message from the child back into the parent. + + We can always change this in the future if it turns out to be an issue. + + I'm also fixing a couple of other lint warnings while I'm at it. + + * Scripts/webkitpy/common/message_pool.py: + (_MessagePool.__exit__): + (_MessagePool._handle_worker_exception): + (_Worker._set_up_logging): + +2012-07-12 Dirk Pranke <dpranke@chromium.org> + + webkitpy: rename manager_worker_broker to message_pool + https://bugs.webkit.org/show_bug.cgi?id=91145 + + Reviewed by Ojan Vafai. + + Since the MessagePool interface is more generic (and simpler) + now and will be reused by test-webkitpy, I'm renaming it and + moving it to webkitpy.common. + + * Scripts/webkitpy/common/message_pool.py: Renamed from Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py. + * Scripts/webkitpy/layout_tests/controllers/manager.py: + (TestRunInterruptedException.__reduce__): + (Manager._run_tests.worker_factory): + (Manager._run_tests): + * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py: + +2012-07-12 Dirk Pranke <dpranke@chromium.org> + + nrwt crashes saving the output for a platform-specific expected test reference + https://bugs.webkit.org/show_bug.cgi?id=90872 + + Reviewed by Ojan Vafai. + + The expected output for a test is copied alongside the test + itself in the layout-test-results directory; in other words, for + foo/bar-expected.txt sits alongside foo/bar.html even if we're + actually using platform/mac/foo/bar-expected.txt. + + Unless the test is a reftest, in which case we would copy the + output to platform/mac/foo/bar-expected.html and set a + 'ref_file' parameter in results.json to indicate the path. This + can be useful in the cases where we have multiple references for + a single test or when multiple tests share the same reference. + + We found a bug where we weren't creating platform/mac/foo under + the results directory, and so this wasn't actually working. + However, treating reftests differently seems like a bad thing, + so we should probably be consistent. This change puts the + -expected.html next to the test, and reworks test_result_writer + so that we create directories uniformly and consistently. + + Note that we weren't catching this problem in unit tests because + the MockFileSystem creates a directory automatically if it + doesn't exist; this was done intentionally for convenience, but + is really a bug and should be fixed; see https://bugs.webkit.org/show_bug.cgi?id=91028. + + I have not added additional tests here since fixing that bug + should be sufficient. + + * Scripts/webkitpy/layout_tests/controllers/manager.py: + (interpret_test_failures): + * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py: + (ResultSummaryTest.test_interpret_test_failures): + * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py: + (write_test_result): + (TestResultWriter._write_binary_file): + (TestResultWriter): + (TestResultWriter._write_text_file): + (TestResultWriter.write_output_files): + (TestResultWriter.write_stderr): + (TestResultWriter.write_crash_log): + (TestResultWriter.create_text_diff_and_write_result): + (TestResultWriter.write_image_diff_files): + (write_reftest): + * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py: + (EndToEndTest.test_reftest_with_two_notrefs): + +2012-07-12 Dirk Pranke <dpranke@chromium.org> + + nrwt: reimplement manager_worker_broker in a much simpler form + https://bugs.webkit.org/show_bug.cgi?id=90513 + + Reviewed by Ojan Vafai. + + This is a wholesale replacement of the MessagePool() implementation + and the other classes in manager_worker_broker.py. All of the + BrokerConnection*, Broker*, etc. classes are gone, and there are now + just a MessagePool class and a _Worker class. Happiness ensues. + + I'm removing manager_worker_broker_unittest.py as well; we get + nearly complete coverage from the integration tests, and will + get more coverage when test-webkitpy moves to use this as well, + so having unit tests seems like unnecessary overhead. (running + coverage numbers with test-webkitpy shows that pretty much the only + uncovered lines are lines that are only run in the child processes, + which coverage doesn't handle at the moment). + + * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py: + (_MessagePool.__init__): + (_MessagePool.run): + (_MessagePool._start_workers): + (_MessagePool): + (_MessagePool.wait): + (_MessagePool._close): + (_MessagePool._handle_done): + (_MessagePool._can_pickle): + (_MessagePool._loop): + (WorkerException): + (_Message.__init__): + (_Message.__repr__): + (_Worker): + (_Worker.__init__): + (_Worker.terminate): + (_Worker._close): + (_Worker.run): + (_Worker.post): + (_Worker.yield_to_caller): + (_Worker._post): + (_Worker._raise): + (_Worker._set_up_logging): + (_WorkerLogHandler.__init__): + (_WorkerLogHandler.emit): + * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py: Removed. + +2012-07-12 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + Migrate DRT to use the methods that take modifier keys. + + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::doDragDrop): + (EventSender::doMouseUp): + (EventSender::doMouseMove): + (EventSender::beginDragWithFiles): + +2012-07-12 Ojan Vafai <ojan@chromium.org> + + Allow putting ranges in user.py list prompts + https://bugs.webkit.org/show_bug.cgi?id=91115 + + Reviewed by Adam Barth. + + Ranges are inclusive and denoted by a dash. This is useful for rebaselining a whole port + since the items are listed with each port's builders being contiguous. + + * Scripts/webkitpy/common/system/user.py: + (User._wait_on_list_response): + * Scripts/webkitpy/common/system/user_unittest.py: + (UserTest.test_prompt_with_multiple_lists.run_prompt_test): + (UserTest.test_prompt_with_multiple_lists): + +2012-07-12 Arnaud Renevier <arno@renevier.net> + + [GTK] Implement disableImageLoading in DRT + https://bugs.webkit.org/show_bug.cgi?id=87973 + + Reviewed by Martin Robinson. + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (resetDefaultsToConsistentValues): + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + (LayoutTestController::disableImageLoading): + +2012-07-12 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Internal symbols are exported on Linux + https://bugs.webkit.org/show_bug.cgi?id=90981 + + Reviewed by Jocelyn Turcotte. + + I should've re-enabled ELF symbol visibility when removing the symbol map in + r106650. + + * qmake/mkspecs/features/default_post.prf: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * DumpRenderTree/mac/Configurations/Base.xcconfig: + * TestWebKitAPI/Configurations/Base.xcconfig: + * WebKitTestRunner/Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Replace definitions of BUILDING_ON / TARGETING macros with macros that will error when used. + + Part of <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros. + + Reviewed by Anders Carlsson. + + * DumpRenderTree/TestNetscapePlugIn/PluginObject.h: Remove the macros completely from here since + they're completely unused in TestNetscapePlugIn. + * DumpRenderTree/config.h: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * DumpRenderTree/cf/WebArchiveDumpSupport.cpp: + * DumpRenderTree/mac/CheckedMalloc.cpp: + * DumpRenderTree/mac/DumpRenderTree.mm: + * DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm: + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + * DumpRenderTree/mac/TextInputController.m: + * TestWebKitAPI/mac/InjectedBundleControllerMac.mm: + * WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm: + * WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm: + +2012-07-11 Robert Kroeger <rjkroege@chromium.org> + + Suppress horizontal conversion of PlatformWheelEvents when hasPreciseScrollingDeltas is true + https://bugs.webkit.org/show_bug.cgi?id=89580 + + WebKit GTK and Chromium Linux force vertical wheel events to + scroll horizontally when over horizontal scroll bars. This is + undesirable for touchpad scrolling with + hasPreciseScrollingDeltas() == true. Modified DumpRenderTree to + let a layout test specify this attribute so that the change's impact + on scrolling can be tested in a layout test. + + Reviewed by Adam Barth. + + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::handleMouseWheel): + +2012-07-11 Simon Fraser <simon.fraser@apple.com> + + Fix the build by declaring -isPaginated before use. + + * MiniBrowser/mac/BrowserWindowController.m: + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122358. + http://trac.webkit.org/changeset/122358 + https://bugs.webkit.org/show_bug.cgi?id=91037 + + Build break on WebKit Win (Requested by hayato on #webkit). + + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::doDragDrop): + (EventSender::doMouseUp): + (EventSender::doMouseMove): + (EventSender::beginDragWithFiles): + +2012-07-03 Dirk Pranke <dpranke@chromium.org> + + nrwt: add a MessagePool abstraction that the manager will call to replace the broker + https://bugs.webkit.org/show_bug.cgi?id=90511 + + Reviewed by Ojan Vafai. + + This change introduces the new MessagePool abstraction that will + replace the classes in manager_worker_broker. It is a minimal + interface that tries to follow the conventions in + multiprocessing.Pool and concurrency.futures ... it provides a + context manager and a run() method that sends N messages to M + workers processes (starting workers as necessary) and waits for + them all to complete, handling cleanup as necessary. The caller + is responsible for providing a handle() method to handle + messages received from the workers. + + This interface basically hides all of the multiprocessing logic from + the manager class. + + The initial implementation of MessagePool is a simple shim + around the existing broker classes; a subsequent change will + replace all the other classes with a much simpler + implementation. + + No additional tests are provided for now; existing tests should + provide adequate coverage, and I will add new unit tests for the + MessagePool class when I replace the existing implementation. + + * Scripts/webkitpy/layout_tests/controllers/manager.py: + (TestRunInterruptedException.__reduce__): + (Manager.__init__): + (Manager._run_tests): + (Manager._run_tests.instead): + (Manager.handle): + (Manager._handle_started_test): + (Manager._handle_finished_test_list): + (Manager._handle_finished_test): + * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py: + (get): + (_MessagePool): + (_MessagePool.__init__): + (_MessagePool.__enter__): + (_MessagePool.__exit__): + (_MessagePool.run): + (_MessagePool.wait): + (_MessagePool.is_done): + (_MessagePool._worker_is_done): + (_MessagePool._close): + (_MessagePool.handle_done): + (_MessagePool.handle_started_test): + (_MessagePool.handle_finished_test): + (_MessagePool.handle_finished_test_list): + (_MessagePool.handle_exception): + (_MessagePool._log_messages): + (_MessagePool._handle_worker_exception): + (_WorkerState): + (_WorkerState.for): + (_WorkerState.__init__): + (_WorkerState.__repr__): + (_get_broker): + * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py: + (make_broker): + +2012-07-11 Simon Fraser <simon.fraser@apple.com> + + Add an option to enter paginated mode in MiniBrowser + https://bugs.webkit.org/show_bug.cgi?id=91035 + + Reviewed by Dan Bernstein. + + Add an item to the Debug menu for MiniBrowser that puts + the web view into paginated mode. For now, we only + do left-to-right pagination, with a fixed column width. + + * MiniBrowser/mac/BrowserWindowController.h: + * MiniBrowser/mac/BrowserWindowController.m: + (-[BrowserWindowController validateMenuItem:]): Update the checked + state of the menu item. + (-[BrowserWindowController isPaginated]): Return YES if paginated. + (-[BrowserWindowController togglePaginationMode:]): Toggle in + and out of pagination mode. + * MiniBrowser/mac/MainMenu.xib: Add the debug menu item. + +2012-07-11 Adam Barth <abarth@webkit.org> + + commit-queue instances on Compute Engine are missing git-svn + https://bugs.webkit.org/show_bug.cgi?id=91034 + + Reviewed by Eric Seidel. + + git-svn is needed to actually commit to SVN from a git working copy. + + * EWSTools/cold-boot.sh: + +2012-07-11 Dirk Pranke <dpranke@chromium.org> + + webkitpy: lint code in webkitpy.layout_tests.models + https://bugs.webkit.org/show_bug.cgi?id=90416 + + Reviewed by Ojan Vafai. + + Cleaning up errors reported from lint-webkitpy. + + Also, suppress the warnings about wildcard imports in pylintrc; + we have nothing particularly against them. + + * Scripts/webkitpy/layout_tests/models/test_configuration.py: + (TestConfigurationConverter.combinations): + * Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py: + (TestConfigurationTest.test_hash.query_unknown_key): + (TestConfigurationTest.test_eq): + * Scripts/webkitpy/layout_tests/models/test_expectations.py: + (ParseError.__init__): + (TestExpectationLine.__init__): + (TestExpectationsModel.get_expectations_string): + (TestExpectationsModel): + (TestExpectationsModel.expectation_to_string): + (TestExpectationsModel.add_expectation_line): + (TestExpectationsModel._clear_expectations_for_test): + (TestExpectationsModel._remove_from_sets): + (TestExpectations.get_expectations_string): + (TestExpectations.expectation_to_string): + (TestExpectations._report_warnings): + * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: + (Base.__init__): + (parse_exp): + (SkippedTests.check): + (TestExpectationParserTests.test_parse_empty_string): + * Scripts/webkitpy/layout_tests/models/test_failures.py: + (FailureTimeout.__init__): + (FailureCrash.__init__): + (FailureImageHashMismatch.__init__): + (FailureReftestMismatch.__init__): + (FailureReftestMismatchDidNotOccur.__init__): + (FailureReftestNoImagesGenerated.__init__): + * Scripts/webkitpy/layout_tests/models/test_failures_unittest.py: + (TestFailuresTest.test_unknown_failure_type.UnknownFailure.message): + (TestFailuresTest.test_unknown_failure_type): + (TestFailuresTest): + (TestFailuresTest.test_message_is_virtual): + * Scripts/webkitpy/layout_tests/models/test_results.py: + (TestResult.loads): + (TestResult.has_failure_matching_types): + * Scripts/webkitpy/pylintrc: + +2012-07-11 Dirk Pranke <dpranke@chromium.org> + + nrwt: clean up names in worker.py + https://bugs.webkit.org/show_bug.cgi?id=90510 + + Reviewed by Ojan Vafai. + + This is the last patch in the series of refactoring worker.py; + all this does is change some names of methods, instance + variables, and method parameters to be clearer (it also changes + some code in manager.py and manager_worker.py to be consistent). + + There are no functional changes in this patch and the existing + tests should cover everything. + + * Scripts/webkitpy/layout_tests/controllers/manager.py: + (Manager.__init__): + (Manager.prepare_lists_and_print_output): + (Manager._run_tests.worker_factory): + (Manager._run_tests): + (Manager._show_results_html_file): + (Manager.handle_finished_test_list): + (_WorkerState.__init__): + * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py: + (_Broker.post_message): + (_Broker._dispatch_message): + (AbstractWorker.__init__): + (AbstractWorker.run): + (AbstractWorker.yield_to_caller): + (AbstractWorker.post): + (_WorkerConnection.__init__): + * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py: + (_TestWorker.__init__): + (_TestWorker.start): + (_TestWorker.handle): + (_TestWorker.stop): + (_TestsMixin): + (_TestsMixin.test_name): + * Scripts/webkitpy/layout_tests/controllers/worker.py: + (Worker.__init__): + (Worker.__del__): + (Worker.start): + (Worker.handle): + (Worker._run_test): + (Worker.stop): + (Worker._timeout): + (Worker._kill_driver): + (Worker._run_test_with_timeout): + (Worker._clean_up_after_test): + (Worker._run_test_in_another_thread.SingleTestThread.run): + (Worker._run_test_in_this_thread): + (Worker._run_single_test): + +2012-07-11 Adam Barth <abarth@webkit.org> + + The commit-queue needs some extra git config to be able to commit + https://bugs.webkit.org/show_bug.cgi?id=91025 + + Reviewed by Eric Seidel. + + In order for the commit-queue to actually commit, it needs to know the + location of the SVN server. + + * EWSTools/cold-boot.sh: + +2012-07-11 Adam Barth <abarth@webkit.org> + + Teach EWSTools how to configure SVN auth credentials + https://bugs.webkit.org/show_bug.cgi?id=91021 + + Reviewed by Eric Seidel. + + To move the commit-queue over to Google Compute Engine, we need a way + to configure the commit-queue's credentials during the machine build + process. There doesn't seem to be a nice command line way of + configuring SVN auth credentials. I tried doing a bogus commit and + supplying the credentials that way, but that's super hacky. + + The approach in this patch is to write the config file directly. The + format of these configurations files is documented in the SVN book, so + this approach doesn't see too sketchy. + + * EWSTools/configure-svn-auth.sh: Added. + +2012-07-11 Ojan Vafai <ojan@chromium.org> + + Dedupe suffixes passed to webkit-patch rebaseline + https://bugs.webkit.org/show_bug.cgi?id=91017 + + Reviewed by Dirk Pranke. + + * Scripts/webkitpy/tool/commands/rebaseline.py: + (Rebaseline._suffixes_to_update): + * Scripts/webkitpy/tool/commands/rebaseline_unittest.py: + (test_rebaseline_multiple_builders_and_tests_command_line): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Add new directories and a new LayoutTestController method. + + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + (LayoutTestController::setStorageDatabaseIdleInterval): + * waf/build/settings.py: + +2012-07-11 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + Migrate DRT to use the methods that take modifier keys. + + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::doDragDrop): + (EventSender::doMouseUp): + (EventSender::doMouseMove): + (EventSender::beginDragWithFiles): + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Add a Mountain Lion version of libWebKitSystemInterface.a. + + Reviewed by John Sullivan. + + * Scripts/copy-webkitlibraries-to-product-directory: Include libWebKitSystemInterfaceMountainLion.a in the list of libraries to copy. + +2012-07-09 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/90835> Teach bisect-builds to work with a Safari.app that has entitlements. + + Reviewed by Dan Bernstein. + + * Scripts/bisect-builds: Use safariPathFromSafariBundle to determine which binary within the application + should be invoked. + +2012-07-11 Zan Dobersek <zandobersek@gmail.com> + + [Gtk] fast/events/keydown-function-keys.html is failing + https://bugs.webkit.org/show_bug.cgi?id=90891 + + Reviewed by Martin Robinson. + + Work around the context menu being shown on F10 key being pressed by + unbiding the key when running tests in DumpRenderTree. The problem + appears when using a recent version of the xkeyboard-config package. + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (setDefaultsToConsistentStateValuesForTesting): + +2012-07-11 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] QRawWebView should notify when rendering is done, so that pixel results can be grabbed at the appropriate moment. + https://bugs.webkit.org/show_bug.cgi?id=90641 + + Reviewed by Jocelyn Turcotte. + + * MiniBrowser/qt/raw/View.h: Comment used old class name (WKView). + (View): + +2012-07-11 Min Qin <qinmin@chromium.org> + + [Android] sending an extra to the DRT apk so that DRT can be run in a seperate thread + https://bugs.webkit.org/show_bug.cgi?id=90831 + + Reviewed by Adam Barth. + + On android, DRT needs to run in a background thread to avoid ANR. + However, the java tests are running on UI thread by default. + We need to send an intent extra to the apk so that it can run on a sub thread. + + * Scripts/webkitpy/layout_tests/port/chromium_android.py: + (ChromiumAndroidDriver._start_once): + +2012-07-11 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] REGRESSION(r107171): Fix --timeout option of Qt's DRT + https://bugs.webkit.org/show_bug.cgi?id=90966 + + Reviewed by Ryosuke Niwa. + + * DumpRenderTree/qt/main.cpp: + (main): Don't remove the argument, because takeOptionValue() did it before. + 2012-07-11 Allan Sandfeld Jensen <allan.jensen@nokia.com> First commit; moving myself to commiters. diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h index 566537c2e..98f183951 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h @@ -29,14 +29,6 @@ #include <WebKit/npfunctions.h> #include <stdarg.h> -#if defined(XP_MACOSX) -#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 -#define BUILDING_ON_LEOPARD 1 -#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 -#define BUILDING_ON_SNOW_LEOPARD 1 -#endif -#endif // XP_MACOSX - class PluginTest; extern NPNetscapeFuncs *browser; diff --git a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp index 33dc28a4c..1f7f172ab 100644 --- a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp +++ b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp @@ -44,7 +44,7 @@ CFTypeID CFURLResponseGetTypeID(void); static void convertMIMEType(CFMutableStringRef mimeType) { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Workaround for <rdar://problem/5539824> on Leopard if (CFStringCompare(mimeType, CFSTR("text/xml"), kCFCompareAnchored | kCFCompareCaseInsensitive) == kCFCompareEqualTo) CFStringReplaceAll(mimeType, CFSTR("application/xml")); @@ -158,7 +158,7 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) CFErrorRef error = 0; CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 CFIndex bytesCount = CFDataGetLength(webArchiveData); RetainPtr<CFReadStreamRef> readStream(AdoptCF, CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, CFDataGetBytePtr(webArchiveData), bytesCount, kCFAllocatorNull)); CFReadStreamOpen(readStream.get()); @@ -208,7 +208,7 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) error = 0; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList.get())); #else RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error)); diff --git a/Tools/DumpRenderTree/chromium/EventSender.cpp b/Tools/DumpRenderTree/chromium/EventSender.cpp index 47bec2a71..7e81f3b54 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/EventSender.cpp @@ -351,7 +351,7 @@ void EventSender::doDragDrop(const WebDragData& dragData, WebDragOperationsMask WebPoint screenPoint(event.globalX, event.globalY); currentDragData = dragData; currentDragEffectsAllowed = mask; - currentDragEffect = webview()->dragTargetDragEnter(dragData, clientPoint, screenPoint, currentDragEffectsAllowed); + currentDragEffect = webview()->dragTargetDragEnter(dragData, clientPoint, screenPoint, currentDragEffectsAllowed, 0); // Finish processing events. replaySavedEvents(); @@ -466,9 +466,9 @@ void EventSender::doMouseUp(const WebMouseEvent& e) WebPoint clientPoint(e.x, e.y); WebPoint screenPoint(e.globalX, e.globalY); - currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed); + currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed, 0); if (currentDragEffect) - webview()->dragTargetDrop(clientPoint, screenPoint); + webview()->dragTargetDrop(clientPoint, screenPoint, 0); else webview()->dragTargetDragLeave(); webview()->dragSourceEndedAt(clientPoint, screenPoint, currentDragEffect); @@ -509,7 +509,7 @@ void EventSender::doMouseMove(const WebMouseEvent& e) return; WebPoint clientPoint(e.x, e.y); WebPoint screenPoint(e.globalX, e.globalY); - currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed); + currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed, 0); } void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) @@ -912,7 +912,7 @@ void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVarian currentDragEffectsAllowed = WebKit::WebDragOperationCopy; // Provide a drag source. - webview()->dragTargetDragEnter(currentDragData, lastMousePos, lastMousePos, currentDragEffectsAllowed); + webview()->dragTargetDragEnter(currentDragData, lastMousePos, lastMousePos, currentDragEffectsAllowed, 0); // dragMode saves events and then replays them later. We don't need/want that. dragMode.set(false); @@ -1043,10 +1043,14 @@ void EventSender::handleMouseWheel(const CppArgumentList& arguments, CppVariant* int horizontal = arguments[0].toInt32(); int vertical = arguments[1].toInt32(); int paged = false; + int hasPreciseScrollingDeltas = false; if (arguments.size() > 2 && arguments[2].isBool()) paged = arguments[2].toBoolean(); + if (arguments.size() > 3 && arguments[3].isBool()) + hasPreciseScrollingDeltas = arguments[3].toBoolean(); + WebMouseWheelEvent event; initMouseEvent(WebInputEvent::MouseWheel, pressedButton, lastMousePos, &event); event.wheelTicksX = static_cast<float>(horizontal); @@ -1054,6 +1058,8 @@ void EventSender::handleMouseWheel(const CppArgumentList& arguments, CppVariant* event.deltaX = event.wheelTicksX; event.deltaY = event.wheelTicksY; event.scrollByPage = paged; + event.hasPreciseScrollingDeltas = hasPreciseScrollingDeltas; + if (continuous) { event.wheelTicksX /= scrollbarPixelsPerTick; event.wheelTicksY /= scrollbarPixelsPerTick; diff --git a/Tools/DumpRenderTree/config.h b/Tools/DumpRenderTree/config.h index d52cd84de..ccff71c7c 100644 --- a/Tools/DumpRenderTree/config.h +++ b/Tools/DumpRenderTree/config.h @@ -50,11 +50,19 @@ #if PLATFORM(MAC) #define WTF_USE_CF 1 -#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 -#define BUILDING_ON_LEOPARD 1 -#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 -#define BUILDING_ON_SNOW_LEOPARD 1 -#endif +// FIXME: These can be removed after sufficient time has passed since the removal of BUILDING_ON / TARGETING macros. + +#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED 0 / 0 +#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED 0 / 0 + +#define BUILDING_ON_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED +#define BUILDING_ON_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED +#define BUILDING_ON_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED + +#define TARGETING_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED +#define TARGETING_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED +#define TARGETING_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED + #endif // PLATFORM(MAC) #if OS(WINDOWS) diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp index 8e3c44ec3..57cd05917 100644 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -464,6 +464,7 @@ static void resetDefaultsToConsistentValues() "enable-caret-browsing", FALSE, "enable-page-cache", FALSE, "auto-resize-window", TRUE, + "auto-load-images", TRUE, "enable-java-applet", FALSE, "enable-plugins", TRUE, "enable-hyperlink-auditing", FALSE, @@ -663,8 +664,12 @@ static void setDefaultsToConsistentStateValuesForTesting() #else GtkCssProvider* cssProvider = gtk_css_provider_new(); gtk_css_provider_load_from_data(cssProvider, + "@binding-set NoKeyboardNavigation { " + " unbind \"<shift>F10\"; " + "} " " * { " " -GtkScrolledWindow-scrollbar-spacing: 0;" + " gtk-key-bindings: NoKeyboardNavigation; " "} ", -1, 0); gtk_style_context_add_provider_for_screen(gdk_display_get_default_screen(gdk_display_get_default()), diff --git a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 2eb899d61..4662df021 100644 --- a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -449,8 +449,11 @@ void LayoutTestController::setAutofilled(JSContextRef context, JSValueRef nodeOb void LayoutTestController::disableImageLoading() { - // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27896 - // Also need to make sure image loading is re-enabled for each new test. + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + ASSERT(view); + + WebKitWebSettings* settings = webkit_web_view_get_settings(view); + g_object_set(G_OBJECT(settings), "auto-load-images", FALSE, NULL); } void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) diff --git a/Tools/DumpRenderTree/mac/CheckedMalloc.cpp b/Tools/DumpRenderTree/mac/CheckedMalloc.cpp index 8bd53e546..b56cb280d 100644 --- a/Tools/DumpRenderTree/mac/CheckedMalloc.cpp +++ b/Tools/DumpRenderTree/mac/CheckedMalloc.cpp @@ -54,7 +54,7 @@ static void* checkedRealloc(malloc_zone_t* zone, void* ptr, size_t size) return savedRealloc(zone, ptr, size); } -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static vm_prot_t protectionOfRegion(mach_vm_address_t address) { mach_vm_size_t regionSize = 0; @@ -71,7 +71,7 @@ void makeLargeMallocFailSilently() { malloc_zone_t* zone = malloc_default_zone(); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 mach_vm_address_t pageStart = reinterpret_cast<vm_address_t>(zone) & static_cast<vm_size_t>(~(getpagesize() - 1)); vm_prot_t initialProtection = protectionOfRegion(pageStart); @@ -85,7 +85,7 @@ void makeLargeMallocFailSilently() zone->malloc = checkedMalloc; zone->realloc = checkedRealloc; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection)) CRASH(); #endif diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig index 8180cabdd..b6fe75a3f 100644 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -55,15 +55,12 @@ REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index dd0eff44b..abba535ed 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -418,7 +418,7 @@ static void activateTestingFonts() "WebKitWeightWatcher700.ttf", "WebKitWeightWatcher800.ttf", "WebKitWeightWatcher900.ttf", -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 "SampleFont.sfont", #endif 0 @@ -590,7 +590,7 @@ static void resetDefaultsToConsistentValues() #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(CHROMIUM) [defaults setBool:NO forKey:@"NSScrollAnimationEnabled"]; #else [defaults setBool:NO forKey:@"AppleScrollAnimationEnabled"]; @@ -655,7 +655,7 @@ static void resetDefaultsToConsistentValues() // So, turn it off for now, but we might want to turn it back on some day. [preferences setUsesPageCache:NO]; [preferences setAcceleratedCompositingEnabled:YES]; -#if USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if USE(CA) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [preferences setCanvasUsesAcceleratedDrawing:YES]; [preferences setAcceleratedDrawingEnabled:NO]; #endif diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm b/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm index b729cf406..b6b22c269 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm @@ -105,7 +105,7 @@ return nil; } -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - (NSDraggingFormation)draggingFormation { return NSDraggingFormationDefault; @@ -140,7 +140,7 @@ { // Ignored. } -#endif // !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @end diff --git a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm index f360c061a..54f87546e 100644 --- a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -1031,7 +1031,7 @@ void LayoutTestController::setWebViewEditable(bool editable) static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoaderRunLoopMode"; -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 @protocol NSURLConnectionDelegate <NSObject> @end #endif @@ -1107,7 +1107,7 @@ static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoade void LayoutTestController::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password) { // See <rdar://problem/7880699>. -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFStringRef> urlStringCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); RetainPtr<CFStringRef> usernameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, username)); RetainPtr<CFStringRef> passwordCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, password)); @@ -1135,7 +1135,7 @@ void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval) void LayoutTestController::setTextDirection(JSStringRef directionName) { -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (JSStringIsEqualToUTF8CString(directionName, "ltr")) [[mainFrame webView] makeBaseWritingDirectionLeftToRight:0]; else if (JSStringIsEqualToUTF8CString(directionName, "rtl")) diff --git a/Tools/DumpRenderTree/mac/TextInputController.m b/Tools/DumpRenderTree/mac/TextInputController.m index afeb16e4d..91dbd84a1 100644 --- a/Tools/DumpRenderTree/mac/TextInputController.m +++ b/Tools/DumpRenderTree/mac/TextInputController.m @@ -31,7 +31,7 @@ #import "DumpRenderTreeMac.h" #import <AppKit/NSInputManager.h> -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 #define SUPPORT_DICTATION_ALTERNATIVES #import <AppKit/NSTextAlternatives.h> #endif diff --git a/Tools/DumpRenderTree/qt/main.cpp b/Tools/DumpRenderTree/qt/main.cpp index 3125d61bc..8188f1816 100644 --- a/Tools/DumpRenderTree/qt/main.cpp +++ b/Tools/DumpRenderTree/qt/main.cpp @@ -220,7 +220,6 @@ int main(int argc, char* argv[]) if (index != -1) { int timeout = takeOptionValue(args, index).toInt(); dumper.setTimeout(timeout); - args.removeAt(index); } index = args.indexOf(QLatin1String("--no-timeout")); diff --git a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index 5935eab25..1470e95fb 100644 --- a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -639,3 +639,8 @@ void LayoutTestController::deliverWebIntent(JSStringRef, JSStringRef, JSStringRe { // FIXME: Implement this. } + +void LayoutTestController::setStorageDatabaseIdleInterval(double) +{ + // FIXME: Implement this. +} diff --git a/Tools/EWSTools/GoogleComputeEngine/build-commit-queue.sh b/Tools/EWSTools/GoogleComputeEngine/build-commit-queue.sh new file mode 100755 index 000000000..a94b02083 --- /dev/null +++ b/Tools/EWSTools/GoogleComputeEngine/build-commit-queue.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# 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. + +if [[ $# -ne 1 ]];then +echo "Usage: build-commit-queue.sh BOT_NUMBER" +exit 1 +fi + +QUEUE_TYPE=commit-queue +BOT_ID=gce-cq-$1 +BUGZILLA_USERNAME=webkit.review.bot@gmail.com +read -s -p "Bugzilla Password: " BUGZILLA_PASSWORD && echo + +SVN_USERNAME=commit-queue@webkit.org +read -s -p "Subversion Password: " SVN_PASSWORD && echo + +# FIXME: We should use gcutil to find a zone that's actually up. +ZONE=us-east-b +IMAGE=projects/google/images/ubuntu-10-04-v20120621 + +gcutil addinstance $BOT_ID --machine_type=standard-4-cpu-ephemeral-disk --image=$IMAGE --zone=$ZONE --wait_until_running + +echo "Sleeping for 30s to let the server spin up ssh..." +sleep 30 + +gcutil ssh $BOT_ID "sudo apt-get install subversion -y && svn checkout http://svn.webkit.org/repository/webkit/trunk/Tools/EWSTools tools && cd tools && bash configure-svn-auth.sh $SVN_USERNAME $SVN_PASSWORD && bash cold-boot.sh $QUEUE_TYPE $BOT_ID $BUGZILLA_USERNAME $BUGZILLA_PASSWORD" diff --git a/Tools/EWSTools/cold-boot.sh b/Tools/EWSTools/cold-boot.sh index 5cf625840..98f9fea13 100755 --- a/Tools/EWSTools/cold-boot.sh +++ b/Tools/EWSTools/cold-boot.sh @@ -49,7 +49,7 @@ echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select tr curl http://src.chromium.org/svn/trunk/src/build/install-build-deps.sh > install-build-deps.sh bash install-build-deps.sh --no-prompt -sudo apt-get install xvfb screen zip -y +sudo apt-get install xvfb screen git-svn zip -y # install-build-deps.sh will install flashplugin-installer, which causes some plug-in tests to crash. sudo apt-get remove flashplugin-installer -y @@ -70,6 +70,19 @@ cat >> .git/config <<EOF password = $4 EOF +if [[ $1 == "commit-queue" ]];then +cat >> .git/config <<EOF +[svn-remote "svn"] + url = http://svn.webkit.org/repository/webkit + fetch = trunk:refs/remotes/origin/master +[user] + email = commit-queue@webkit.org + name = Commit Queue +[merge "changelog"] + driver = perl $PWD/Tools/Scripts/resolve-ChangeLogs --merge-driver %O %B %A +EOF +fi + cd ~/tools echo "screen -t kr ./start-queue.sh" $1 $2 > screen-config bash boot.sh diff --git a/Tools/EWSTools/configure-svn-auth.sh b/Tools/EWSTools/configure-svn-auth.sh new file mode 100755 index 000000000..75fdc2c05 --- /dev/null +++ b/Tools/EWSTools/configure-svn-auth.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# 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. + +if [[ $# -ne 2 ]];then +echo "Usage: configure-svn-auth.sh SVN_USERNAME SVN_PASSWORD" +exit 1 +fi + +cat >> ~/.subversion/auth/svn.simple/7e01475a87eb5db3b8b41e7fbf6415d9 <<EOF +K 8 +passtype +V 6 +simple +K 8 +password +V ${#2} +$2 +K 15 +svn:realmstring +V 39 +<http://svn.webkit.org:80> Mac OS Forge +K 8 +username +V ${#1} +$1 +END +EOF + +# This maches the ACL that subversion uses by default. +chmod 644 ~/.subversion/auth/svn.simple/7e01475a87eb5db3b8b41e7fbf6415d9 diff --git a/Tools/MiniBrowser/Configurations/Base.xcconfig b/Tools/MiniBrowser/Configurations/Base.xcconfig index eb3a4d2ce..85d987d39 100644 --- a/Tools/MiniBrowser/Configurations/Base.xcconfig +++ b/Tools/MiniBrowser/Configurations/Base.xcconfig @@ -50,15 +50,12 @@ REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Tools/MiniBrowser/mac/BrowserWindowController.h b/Tools/MiniBrowser/mac/BrowserWindowController.h index ddc195084..84c9f0afe 100644 --- a/Tools/MiniBrowser/mac/BrowserWindowController.h +++ b/Tools/MiniBrowser/mac/BrowserWindowController.h @@ -60,6 +60,7 @@ - (BOOL)canResetZoom; - (IBAction)toggleZoomMode:(id)sender; +- (IBAction)togglePaginationMode:(id)sender; - (IBAction)dumpSourceToConsole:(id)sender; diff --git a/Tools/MiniBrowser/mac/BrowserWindowController.m b/Tools/MiniBrowser/mac/BrowserWindowController.m index 5d465f6cf..72d37beac 100644 --- a/Tools/MiniBrowser/mac/BrowserWindowController.m +++ b/Tools/MiniBrowser/mac/BrowserWindowController.m @@ -40,6 +40,7 @@ - (void)didFailProvisionalLoadWithErrorForFrame:(WKFrameRef)frame; - (void)didFailLoadWithErrorForFrame:(WKFrameRef)frame; - (void)didSameDocumentNavigationForFrame:(WKFrameRef)frame; +- (BOOL)isPaginated; @end @implementation BrowserWindowController @@ -109,6 +110,9 @@ [menuItem setTitle:[_webView window] ? @"Remove Web View" : @"Insert Web View"]; else if (action == @selector(toggleZoomMode:)) [menuItem setState:_zoomTextOnly ? NSOnState : NSOffState]; + else if ([menuItem action] == @selector(togglePaginationMode:)) + [menuItem setState:[self isPaginated] ? NSOnState : NSOffState]; + return YES; } @@ -242,6 +246,22 @@ } } +- (BOOL)isPaginated +{ + return WKPageGetPaginationMode(_webView.pageRef) != kWKPaginationModeUnpaginated; +} + +- (IBAction)togglePaginationMode:(id)sender +{ + if ([self isPaginated]) + WKPageSetPaginationMode(_webView.pageRef, kWKPaginationModeUnpaginated); + else { + WKPageSetPaginationMode(_webView.pageRef, kWKPaginationModeLeftToRight); + WKPageSetPageLength(_webView.pageRef, _webView.bounds.size.width / 2); + WKPageSetGapBetweenPages(_webView.pageRef, 10); + } +} + - (IBAction)dumpSourceToConsole:(id)sender { WKPageGetSourceForFrame_b(_webView.pageRef, WKPageGetMainFrame(_webView.pageRef), ^(WKStringRef result, WKErrorRef error) { diff --git a/Tools/MiniBrowser/mac/MainMenu.xib b/Tools/MiniBrowser/mac/MainMenu.xib index 634f615b4..b6939956d 100644 --- a/Tools/MiniBrowser/mac/MainMenu.xib +++ b/Tools/MiniBrowser/mac/MainMenu.xib @@ -1,31 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> - <int key="IBDocument.SystemTarget">1060</int> - <string key="IBDocument.SystemVersion">10F569</string> - <string key="IBDocument.InterfaceBuilderVersion">788</string> - <string key="IBDocument.AppKitVersion">1038.29</string> - <string key="IBDocument.HIToolboxVersion">461.00</string> + <int key="IBDocument.SystemTarget">1080</int> + <string key="IBDocument.SystemVersion">12A265</string> + <string key="IBDocument.InterfaceBuilderVersion">2816</string> + <string key="IBDocument.AppKitVersion">1186</string> + <string key="IBDocument.HIToolboxVersion">624.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">788</string> + <string key="NS.object.0">2816</string> </object> - <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <object class="NSArray" key="IBDocument.IntegratedClassDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="535"/> + <string>NSCustomObject</string> + <string>NSMenu</string> + <string>NSMenuItem</string> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys" id="0"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <string key="NS.key.0">PluginDependencyRecalculationVersion</string> + <integer value="1" key="NS.object.0"/> </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -919,6 +916,24 @@ <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> + <object class="NSMenuItem" id="15772092"> + <reference key="NSMenu" ref="865232259"/> + <string key="NSTitle">Paginated Mode</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="35465992"/> + <reference key="NSMixedImage" ref="502551668"/> + </object> + <object class="NSMenuItem" id="624939128"> + <reference key="NSMenu" ref="865232259"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="35465992"/> + <reference key="NSMixedImage" ref="502551668"/> + </object> <object class="NSMenuItem" id="208343368"> <reference key="NSMenu" ref="865232259"/> <string key="NSTitle">Show Statistics Window</string> @@ -1004,6 +1019,30 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> + <string key="label">terminate:</string> + <reference key="source" ref="1050"/> + <reference key="destination" ref="632727374"/> + </object> + <int key="connectionID">449</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">orderFrontStandardAboutPanel:</string> + <reference key="source" ref="1021"/> + <reference key="destination" ref="238522557"/> + </object> + <int key="connectionID">142</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="1021"/> + <reference key="destination" ref="976324537"/> + </object> + <int key="connectionID">495</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> <string key="label">performMiniaturize:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1011231497"/> @@ -1044,14 +1083,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">orderFrontStandardAboutPanel:</string> - <reference key="source" ref="1021"/> - <reference key="destination" ref="238522557"/> - </object> - <int key="connectionID">142</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">performClose:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="776162233"/> @@ -1284,14 +1315,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">terminate:</string> - <reference key="source" ref="1050"/> - <reference key="destination" ref="632727374"/> - </object> - <int key="connectionID">449</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticSpellingCorrection:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="795346622"/> @@ -1387,14 +1410,6 @@ <int key="connectionID">493</int> </object> <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">delegate</string> - <reference key="source" ref="1021"/> - <reference key="destination" ref="976324537"/> - </object> - <int key="connectionID">495</int> - </object> - <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">newWindow:</string> <reference key="source" ref="1014"/> @@ -1404,22 +1419,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">setSharedProcessProcessModel:</string> - <reference key="source" ref="976324537"/> - <reference key="destination" ref="993856752"/> - </object> - <int key="connectionID">543</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">setSharedThreadProcessModel:</string> - <reference key="source" ref="976324537"/> - <reference key="destination" ref="516840223"/> - </object> - <int key="connectionID">544</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">forceRepaint:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="878165919"/> @@ -1444,14 +1443,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">showStatisticsWindow:</string> - <reference key="source" ref="976324537"/> - <reference key="destination" ref="208343368"/> - </object> - <int key="connectionID">554</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">zoomIn:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="694544109"/> @@ -1490,13 +1481,47 @@ </object> <int key="connectionID">567</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">togglePaginationMode:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="15772092"/> + </object> + <int key="connectionID">570</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">setSharedProcessProcessModel:</string> + <reference key="source" ref="976324537"/> + <reference key="destination" ref="993856752"/> + </object> + <int key="connectionID">543</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">setSharedThreadProcessModel:</string> + <reference key="source" ref="976324537"/> + <reference key="destination" ref="516840223"/> + </object> + <int key="connectionID">544</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showStatisticsWindow:</string> + <reference key="source" ref="976324537"/> + <reference key="destination" ref="208343368"/> + </object> + <int key="connectionID">554</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> - <reference key="object" ref="0"/> + <object class="NSArray" key="object" id="0"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> <reference key="children" ref="1048"/> <nil key="parent"/> </object> @@ -2162,6 +2187,8 @@ <reference ref="208343368"/> <reference ref="377902755"/> <reference ref="191469404"/> + <reference ref="624939128"/> + <reference ref="15772092"/> </object> <reference key="parent" ref="816668511"/> </object> @@ -2262,143 +2289,84 @@ <reference key="object" ref="191469404"/> <reference key="parent" ref="865232259"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">568</int> + <reference key="object" ref="624939128"/> + <reference key="parent" ref="865232259"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">569</int> + <reference key="object" ref="15772092"/> + <reference key="parent" ref="865232259"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> + <string>-1.IBPluginDependency</string> + <string>-2.IBPluginDependency</string> <string>-3.IBPluginDependency</string> <string>112.IBPluginDependency</string> - <string>112.ImportedFromIB2</string> <string>124.IBPluginDependency</string> - <string>124.ImportedFromIB2</string> <string>125.IBPluginDependency</string> - <string>125.ImportedFromIB2</string> - <string>125.editorWindowContentRectSynchronizationRect</string> <string>126.IBPluginDependency</string> - <string>126.ImportedFromIB2</string> <string>129.IBPluginDependency</string> - <string>129.ImportedFromIB2</string> <string>130.IBPluginDependency</string> - <string>130.ImportedFromIB2</string> - <string>130.editorWindowContentRectSynchronizationRect</string> <string>131.IBPluginDependency</string> - <string>131.ImportedFromIB2</string> <string>134.IBPluginDependency</string> - <string>134.ImportedFromIB2</string> <string>136.IBPluginDependency</string> - <string>136.ImportedFromIB2</string> <string>143.IBPluginDependency</string> - <string>143.ImportedFromIB2</string> <string>144.IBPluginDependency</string> - <string>144.ImportedFromIB2</string> <string>145.IBPluginDependency</string> - <string>145.ImportedFromIB2</string> <string>149.IBPluginDependency</string> - <string>149.ImportedFromIB2</string> <string>150.IBPluginDependency</string> - <string>150.ImportedFromIB2</string> <string>19.IBPluginDependency</string> - <string>19.ImportedFromIB2</string> <string>195.IBPluginDependency</string> - <string>195.ImportedFromIB2</string> <string>196.IBPluginDependency</string> - <string>196.ImportedFromIB2</string> <string>197.IBPluginDependency</string> - <string>197.ImportedFromIB2</string> <string>198.IBPluginDependency</string> - <string>198.ImportedFromIB2</string> <string>199.IBPluginDependency</string> - <string>199.ImportedFromIB2</string> - <string>200.IBEditorWindowLastContentRect</string> <string>200.IBPluginDependency</string> - <string>200.ImportedFromIB2</string> - <string>200.editorWindowContentRectSynchronizationRect</string> <string>201.IBPluginDependency</string> - <string>201.ImportedFromIB2</string> <string>202.IBPluginDependency</string> - <string>202.ImportedFromIB2</string> <string>203.IBPluginDependency</string> - <string>203.ImportedFromIB2</string> <string>204.IBPluginDependency</string> - <string>204.ImportedFromIB2</string> - <string>205.IBEditorWindowLastContentRect</string> <string>205.IBPluginDependency</string> - <string>205.ImportedFromIB2</string> - <string>205.editorWindowContentRectSynchronizationRect</string> <string>206.IBPluginDependency</string> - <string>206.ImportedFromIB2</string> <string>207.IBPluginDependency</string> - <string>207.ImportedFromIB2</string> <string>208.IBPluginDependency</string> - <string>208.ImportedFromIB2</string> <string>209.IBPluginDependency</string> - <string>209.ImportedFromIB2</string> <string>210.IBPluginDependency</string> - <string>210.ImportedFromIB2</string> <string>211.IBPluginDependency</string> - <string>211.ImportedFromIB2</string> <string>212.IBPluginDependency</string> - <string>212.ImportedFromIB2</string> - <string>212.editorWindowContentRectSynchronizationRect</string> <string>213.IBPluginDependency</string> - <string>213.ImportedFromIB2</string> <string>214.IBPluginDependency</string> - <string>214.ImportedFromIB2</string> <string>215.IBPluginDependency</string> - <string>215.ImportedFromIB2</string> <string>216.IBPluginDependency</string> - <string>216.ImportedFromIB2</string> <string>217.IBPluginDependency</string> - <string>217.ImportedFromIB2</string> <string>218.IBPluginDependency</string> - <string>218.ImportedFromIB2</string> <string>219.IBPluginDependency</string> - <string>219.ImportedFromIB2</string> - <string>220.IBEditorWindowLastContentRect</string> <string>220.IBPluginDependency</string> - <string>220.ImportedFromIB2</string> - <string>220.editorWindowContentRectSynchronizationRect</string> <string>221.IBPluginDependency</string> - <string>221.ImportedFromIB2</string> <string>23.IBPluginDependency</string> - <string>23.ImportedFromIB2</string> <string>236.IBPluginDependency</string> - <string>236.ImportedFromIB2</string> <string>239.IBPluginDependency</string> - <string>239.ImportedFromIB2</string> - <string>24.IBEditorWindowLastContentRect</string> <string>24.IBPluginDependency</string> - <string>24.ImportedFromIB2</string> - <string>24.editorWindowContentRectSynchronizationRect</string> - <string>29.IBEditorWindowLastContentRect</string> <string>29.IBPluginDependency</string> - <string>29.ImportedFromIB2</string> - <string>29.WindowOrigin</string> - <string>29.editorWindowContentRectSynchronizationRect</string> <string>295.IBPluginDependency</string> - <string>296.IBEditorWindowLastContentRect</string> <string>296.IBPluginDependency</string> - <string>296.editorWindowContentRectSynchronizationRect</string> <string>297.IBPluginDependency</string> <string>298.IBPluginDependency</string> <string>346.IBPluginDependency</string> - <string>346.ImportedFromIB2</string> <string>348.IBPluginDependency</string> - <string>348.ImportedFromIB2</string> - <string>349.IBEditorWindowLastContentRect</string> <string>349.IBPluginDependency</string> - <string>349.ImportedFromIB2</string> - <string>349.editorWindowContentRectSynchronizationRect</string> <string>350.IBPluginDependency</string> - <string>350.ImportedFromIB2</string> <string>351.IBPluginDependency</string> - <string>351.ImportedFromIB2</string> <string>354.IBPluginDependency</string> - <string>354.ImportedFromIB2</string> + <string>420.IBPluginDependency</string> <string>450.IBPluginDependency</string> - <string>451.IBEditorWindowLastContentRect</string> <string>451.IBPluginDependency</string> <string>452.IBPluginDependency</string> <string>453.IBPluginDependency</string> @@ -2411,16 +2379,13 @@ <string>466.IBPluginDependency</string> <string>485.IBPluginDependency</string> <string>490.IBPluginDependency</string> - <string>491.IBEditorWindowLastContentRect</string> <string>491.IBPluginDependency</string> <string>492.IBPluginDependency</string> + <string>494.IBPluginDependency</string> <string>5.IBPluginDependency</string> - <string>5.ImportedFromIB2</string> <string>534.IBPluginDependency</string> - <string>535.IBEditorWindowLastContentRect</string> <string>535.IBPluginDependency</string> <string>537.IBPluginDependency</string> - <string>538.IBEditorWindowLastContentRect</string> <string>538.IBPluginDependency</string> <string>539.IBPluginDependency</string> <string>540.IBPluginDependency</string> @@ -2435,176 +2400,87 @@ <string>557.IBPluginDependency</string> <string>558.IBPluginDependency</string> <string>56.IBPluginDependency</string> - <string>56.ImportedFromIB2</string> <string>562.IBPluginDependency</string> <string>565.IBPluginDependency</string> <string>566.IBPluginDependency</string> - <string>57.IBEditorWindowLastContentRect</string> + <string>568.IBPluginDependency</string> + <string>569.IBPluginDependency</string> <string>57.IBPluginDependency</string> - <string>57.ImportedFromIB2</string> - <string>57.editorWindowContentRectSynchronizationRect</string> <string>58.IBPluginDependency</string> - <string>58.ImportedFromIB2</string> <string>72.IBPluginDependency</string> - <string>72.ImportedFromIB2</string> <string>73.IBPluginDependency</string> - <string>73.ImportedFromIB2</string> <string>74.IBPluginDependency</string> - <string>74.ImportedFromIB2</string> <string>75.IBPluginDependency</string> - <string>75.ImportedFromIB2</string> <string>77.IBPluginDependency</string> - <string>77.ImportedFromIB2</string> <string>78.IBPluginDependency</string> - <string>78.ImportedFromIB2</string> <string>79.IBPluginDependency</string> - <string>79.ImportedFromIB2</string> <string>80.IBPluginDependency</string> - <string>80.ImportedFromIB2</string> - <string>81.IBEditorWindowLastContentRect</string> <string>81.IBPluginDependency</string> - <string>81.ImportedFromIB2</string> - <string>81.editorWindowContentRectSynchronizationRect</string> <string>82.IBPluginDependency</string> - <string>82.ImportedFromIB2</string> <string>83.IBPluginDependency</string> - <string>83.ImportedFromIB2</string> <string>92.IBPluginDependency</string> - <string>92.ImportedFromIB2</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{522, 812}, {146, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{436, 809}, {64, 6}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{753, 187}, {275, 113}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{608, 612}, {275, 83}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{650, 538}, {254, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{187, 434}, {243, 243}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{608, 612}, {167, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{753, 217}, {238, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{608, 612}, {241, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{744, 748}, {194, 73}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{525, 802}, {197, 73}}</string> - <string>{{488, 821}, {451, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{74, 862}</string> - <string>{{6, 978}, {478, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{694, 688}, {234, 133}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{475, 832}, {234, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{746, 287}, {220, 133}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{608, 612}, {215, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{753, 197}, {170, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -2617,16 +2493,12 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{881, 798}, {189, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{864, 668}, {260, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{1110, 678}, {154, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -2641,61 +2513,44 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{286, 129}, {275, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{23, 794}, {245, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{608, 618}, {196, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> - <string>{{145, 474}, {199, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="1"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.values" ref="0"/> </object> <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.values" ref="0"/> </object> <nil key="sourceID"/> - <int key="maxID">567</int> + <int key="maxID">570</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -2711,7 +2566,7 @@ <string>setSharedThreadProcessModel:</string> <string>showStatisticsWindow:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> @@ -2726,7 +2581,7 @@ <string>setSharedThreadProcessModel:</string> <string>showStatisticsWindow:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBActionInfo"> <string key="name">setSharedProcessProcessModel:</string> @@ -2744,26 +2599,7 @@ </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> - <string key="minorKey">mac/AppDelegate.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">BrowserAppDelegate</string> - <string key="superclassName">NSObject</string> - <object class="NSMutableDictionary" key="outlets"> - <string key="NS.key.0">window</string> - <string key="NS.object.0">NSWindow</string> - </object> - <object class="NSMutableDictionary" key="toOneOutletInfosByName"> - <string key="NS.key.0">window</string> - <object class="IBToOneOutletInfo" key="NS.object.0"> - <string key="name">window</string> - <string key="candidateClassName">NSWindow</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBUserSource</string> - <string key="minorKey"/> + <string key="minorKey">./Classes/BrowserAppDelegate.h</string> </object> </object> <object class="IBPartialClassDescription"> @@ -2775,6 +2611,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>dumpSourceToConsole:</string> <string>fetch:</string> + <string>find:</string> <string>forceRepaint:</string> <string>goBack:</string> <string>goForward:</string> @@ -2786,7 +2623,7 @@ <string>zoomIn:</string> <string>zoomOut:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> @@ -2800,6 +2637,7 @@ <string>id</string> <string>id</string> <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="actionInfosByName"> @@ -2808,6 +2646,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>dumpSourceToConsole:</string> <string>fetch:</string> + <string>find:</string> <string>forceRepaint:</string> <string>goBack:</string> <string>goForward:</string> @@ -2819,7 +2658,7 @@ <string>zoomIn:</string> <string>zoomOut:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBActionInfo"> <string key="name">dumpSourceToConsole:</string> @@ -2830,6 +2669,10 @@ <string key="candidateClassName">id</string> </object> <object class="IBActionInfo"> + <string key="name">find:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> <string key="name">forceRepaint:</string> <string key="candidateClassName">id</string> </object> @@ -2877,16 +2720,18 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>backButton</string> <string>containerView</string> + <string>findPanelWindow</string> <string>forwardButton</string> <string>progressIndicator</string> <string>reloadButton</string> <string>toolbar</string> <string>urlText</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSButton</string> <string>NSView</string> + <string>NSWindow</string> <string>NSButton</string> <string>NSProgressIndicator</string> <string>NSButton</string> @@ -2900,13 +2745,14 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>backButton</string> <string>containerView</string> + <string>findPanelWindow</string> <string>forwardButton</string> <string>progressIndicator</string> <string>reloadButton</string> <string>toolbar</string> <string>urlText</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBToOneOutletInfo"> <string key="name">backButton</string> @@ -2917,6 +2763,10 @@ <string key="candidateClassName">NSView</string> </object> <object class="IBToOneOutletInfo"> + <string key="name">findPanelWindow</string> + <string key="candidateClassName">NSWindow</string> + </object> + <object class="IBToOneOutletInfo"> <string key="name">forwardButton</string> <string key="candidateClassName">NSButton</string> </object> @@ -2940,12 +2790,11 @@ </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> - <string key="minorKey">mac/BrowserWindowController.h</string> + <string key="minorKey">./Classes/BrowserWindowController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">FirstResponder</string> - <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> @@ -2953,7 +2802,7 @@ <string>forceRepaint:</string> <string>newWindow:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> @@ -2966,7 +2815,7 @@ <string>forceRepaint:</string> <string>newWindow:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBActionInfo"> <string key="name">forceRepaint:</string> @@ -2983,79 +2832,8 @@ <string key="minorKey"/> </object> </object> - </object> - <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBPartialClassDescription"> - <string key="className">NSApplication</string> - <string key="superclassName">NSResponder</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="822405504"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="850738725"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="624831158"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSBrowser</string> - <string key="superclassName">NSControl</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSBrowser.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSButton</string> - <string key="superclassName">NSControl</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSControl</string> - <string key="superclassName">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="310914472"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> - </object> - </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> - <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> @@ -3067,7 +2845,7 @@ <string>saveDocumentAs:</string> <string>saveDocumentTo:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> @@ -3088,7 +2866,7 @@ <string>saveDocumentAs:</string> <string>saveDocumentTo:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBActionInfo"> <string key="name">printDocument:</string> @@ -3117,30 +2895,40 @@ </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSDocument.h</string> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/NSDocument.h</string> </object> </object> <object class="IBPartialClassDescription"> - <string key="className">NSDocument</string> + <string key="className">NSDocumentController</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">_openRecentDocument:</string> + <string key="NS.object.0">id</string> + </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <string key="NS.key.0">_openRecentDocument:</string> + <object class="IBActionInfo" key="NS.object.0"> + <string key="name">_openRecentDocument:</string> + <string key="candidateClassName">id</string> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSDocumentScripting.h</string> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/NSDocumentController.h</string> </object> </object> <object class="IBPartialClassDescription"> - <string key="className">NSDocumentController</string> - <string key="superclassName">NSObject</string> + <string key="className">WebView</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>clearRecentDocuments:</string> - <string>newDocument:</string> - <string>openDocument:</string> - <string>saveAllDocuments:</string> + <string>reloadFromOrigin:</string> + <string>resetPageZoom:</string> + <string>zoomPageIn:</string> + <string>zoomPageOut:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> @@ -3152,447 +2940,34 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>clearRecentDocuments:</string> - <string>newDocument:</string> - <string>openDocument:</string> - <string>saveAllDocuments:</string> + <string>reloadFromOrigin:</string> + <string>resetPageZoom:</string> + <string>zoomPageIn:</string> + <string>zoomPageOut:</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBActionInfo"> - <string key="name">clearRecentDocuments:</string> + <string key="name">reloadFromOrigin:</string> <string key="candidateClassName">id</string> </object> <object class="IBActionInfo"> - <string key="name">newDocument:</string> + <string key="name">resetPageZoom:</string> <string key="candidateClassName">id</string> </object> <object class="IBActionInfo"> - <string key="name">openDocument:</string> + <string key="name">zoomPageIn:</string> <string key="candidateClassName">id</string> </object> <object class="IBActionInfo"> - <string key="name">saveAllDocuments:</string> + <string key="name">zoomPageOut:</string> <string key="candidateClassName">id</string> </object> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSDocumentController.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSFontManager</string> - <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="946436764"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSFormatter</string> - <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSMatrix</string> - <string key="superclassName">NSControl</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSMatrix.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSMenu</string> - <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1056362899"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSMenuItem</string> - <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="472958451"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSMovieView</string> - <string key="superclassName">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSMovieView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="822405504"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="850738725"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="624831158"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="310914472"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="946436764"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="1056362899"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="809545482"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="260078765"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSError.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSProgressIndicator</string> - <string key="superclassName">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSProgressIndicator.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSResponder</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSResponder</string> - <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSTableView</string> - <string key="superclassName">NSControl</string> - <reference key="sourceIdentifier" ref="809545482"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSText</string> - <string key="superclassName">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSText.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSTextField</string> - <string key="superclassName">NSControl</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSTextField.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSTextView</string> - <string key="superclassName">NSText</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSTextView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSToolbar</string> - <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSToolbar.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSView</string> - <reference key="sourceIdentifier" ref="472958451"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSView</string> - <string key="superclassName">NSResponder</string> - <reference key="sourceIdentifier" ref="260078765"/> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSWindow</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSWindow</string> - <string key="superclassName">NSResponder</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSWindow</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSWindowController</string> - <string key="superclassName">NSResponder</string> - <object class="NSMutableDictionary" key="actions"> - <string key="NS.key.0">showWindow:</string> - <string key="NS.object.0">id</string> - </object> - <object class="NSMutableDictionary" key="actionInfosByName"> - <string key="NS.key.0">showWindow:</string> - <object class="IBActionInfo" key="NS.object.0"> - <string key="name">showWindow:</string> - <string key="candidateClassName">id</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/WebView.h</string> </object> </object> </object> @@ -3604,7 +2979,6 @@ <integer value="3000" key="NS.object.0"/> </object> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> - <string key="IBDocument.LastKnownRelativeProjectPath">../MiniBrowser.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -3613,10 +2987,10 @@ <string>NSMenuCheckmark</string> <string>NSMenuMixedState</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>{9, 8}</string> - <string>{7, 2}</string> + <string>{11, 11}</string> + <string>{10, 3}</string> </object> </object> </data> diff --git a/Tools/MiniBrowser/qt/raw/View.h b/Tools/MiniBrowser/qt/raw/View.h index 6de7a25e2..e53223f89 100644 --- a/Tools/MiniBrowser/qt/raw/View.h +++ b/Tools/MiniBrowser/qt/raw/View.h @@ -31,7 +31,7 @@ public: View(const QString& url); ~View(); -public: // WKViewClient +public: // QRawWebViewClient virtual void viewNeedsDisplay(const QRect&); virtual void viewRequestedScroll(const QPoint&) { } virtual void viewProcessCrashed() { } diff --git a/Tools/Scripts/bisect-builds b/Tools/Scripts/bisect-builds index cd348998d..b970db399 100755 --- a/Tools/Scripts/bisect-builds +++ b/Tools/Scripts/bisect-builds @@ -43,9 +43,13 @@ use File::Basename; use File::Path; use File::Spec; use File::Temp qw(tempfile); +use FindBin; use Getopt::Long; use Time::HiRes qw(usleep); +use lib $FindBin::Bin; +use webkitdirs qw(safariPathFromSafariBundle); + sub createTempFile($); sub downloadNightly($$$); sub findMacOSXVersion(); @@ -119,7 +123,7 @@ my $nightlyFilesURLBase = $nightlyWebSite . File::Spec->catdir("/files", $branch $nightlyDownloadDirectory = glob($nightlyDownloadDirectory) if $nightlyDownloadDirectory =~ /^~/; $safariPath = glob($safariPath) if $safariPath =~ /^~/; -$safariPath = File::Spec->catdir($safariPath, "Contents/MacOS/Safari") if $safariPath =~ m#\.app/*#; +$safariPath = safariPathFromSafariBundle($safariPath) if $safariPath =~ m#\.app/*#; $nightlyDownloadDirectory = File::Spec->catdir($nightlyDownloadDirectory, $branch); if (! -d $nightlyDownloadDirectory) { diff --git a/Tools/Scripts/copy-webkitlibraries-to-product-directory b/Tools/Scripts/copy-webkitlibraries-to-product-directory index 3c1532e47..dd6f29d0e 100755 --- a/Tools/Scripts/copy-webkitlibraries-to-product-directory +++ b/Tools/Scripts/copy-webkitlibraries-to-product-directory @@ -37,6 +37,7 @@ my @librariesToCopy = ( "libWebKitSystemInterfaceLeopard.a", "libWebKitSystemInterfaceSnowLeopard.a", "libWebKitSystemInterfaceLion.a", + "libWebKitSystemInterfaceMountainLion.a", "libWebCoreSQLite3.a", ); diff --git a/Tools/Scripts/import-w3c-performance-wg-tests b/Tools/Scripts/import-w3c-performance-wg-tests new file mode 100755 index 000000000..e48e26188 --- /dev/null +++ b/Tools/Scripts/import-w3c-performance-wg-tests @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# 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. + +# This script imports the W3C Web Performance WG's test suite into WebKit. +# +# You must have checked out the 'webperf' repository from https://dvcs.w3.org/hg/ +# +# This script will populate the LayoutTests directory with the new tests. If the +# tests already exist, the script will refuse to run. Please clear out the +# w3c/webperf directory first. +# +# The main step in importing the tests is updating all of the URLs to match our +# directory layout. + +import os +import sys + +if len(sys.argv) != 3: + print 'USAGE: %s path_to_webperf_checkout_root path_to_webkit_checkout_root' + sys.exit(1) + +source_directory = os.path.join(sys.argv[1], 'tests') +destination_directory = os.path.join(sys.argv[2], 'LayoutTests', 'http', 'tests', 'w3c', 'webperf') + +if os.path.exists(destination_directory): + print 'Refusing to overwrite existing directory: %s' % destination_directory + sys.exit(1) +os.makedirs(destination_directory) + +directories_to_copy = ['approved', 'resources'] +directories_to_ignore = ['html5'] # These are just duplicates of the sibling directory 'html'. +replacements = [ + ('www.w3c-test.org', 'localhost:8000'), # This is the alternate host for cross-server requests. + ('w3c-test.org', '127.0.0.1:8000'), # This is the primary test server. + ('webperf/tests', 'w3c/webperf'), # We prepend /w3c to all of our paths. + ('/resources/testharness', '/w3c/resources/testharness'), + ('+ "(" + reloadTime[time] + ")"', ''), # Remove dynamic values from the output. We'll still see PASS. + ('+ "(" + startingTime[time] + ")"', ''), + ('\r\n', '\n'), # Convert to *NIX format. +] + +for directory_to_copy in directories_to_copy: + os.makedirs(os.path.join(destination_directory, directory_to_copy)) + os.chdir(source_directory) + for root, dirs, files in os.walk(directory_to_copy): + for dirname in directories_to_ignore: + if dirname in dirs: + dirs.remove(dirname) + for dirname in dirs: + os.makedirs(os.path.join(destination_directory, root, dirname)) + for filename in files: + with open(os.path.join(source_directory, root, filename), 'r') as in_file: + with open(os.path.join(destination_directory, root, filename), 'w') as out_file: + for line in in_file: + for to_find, replace_with in replacements: + line = line.replace(to_find, replace_with) + assert 'w3c-test.org' not in line, 'Imported test must not depend on live site. Bad line: "%s"' % line + out_file.write(line) diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py index f31510022..4a55d495c 100644 --- a/Tools/Scripts/webkitpy/common/config/committers.py +++ b/Tools/Scripts/webkitpy/common/config/committers.py @@ -123,6 +123,7 @@ contributors_who_are_not_committers = [ Contributor("David Barr", "davidbarr@chromium.org", "barrbrain"), Contributor("David Dorwin", "ddorwin@chromium.org", "ddorwin"), Contributor("David Reveman", "reveman@chromium.org", "reveman"), + Contributor("Dongsung Huang", "luxtella@company100.net", "Huang"), Contributor("Douglas Davidson", "ddavidso@apple.com"), Contributor("Edward O'Connor", "eoconnor@apple.com", "hober"), Contributor("Eric Penner", "epenner@chromium.org", "epenner"), @@ -255,6 +256,7 @@ committers_unable_to_review = [ Committer("Hironori Bono", "hbono@chromium.org", "hbono"), Committer("Helder Correia", "helder.correia@nokia.com", "helder"), Committer("Hin-Chung Lam", ["hclam@google.com", "hclam@chromium.org"]), + Committer("Hugo Parente Lima", "hugo.lima@openbossa.org", "hugopl"), Committer("Ian Vollick", "vollick@chromium.org", "vollick"), Committer("Igor Trindade Oliveira", ["igor.oliveira@webkit.org", "igor.o@sisa.samsung.com"], "igoroliveira"), Committer("Ilya Sherman", "isherman@chromium.org", "isherman"), @@ -303,7 +305,7 @@ committers_unable_to_review = [ Committer("Konrad Piascik", "kpiascik@rim.com", "kpiascik"), Committer("Kristof Kosztyo", "kkristof@inf.u-szeged.hu", "kkristof"), Committer("Krzysztof Kowalczyk", "kkowalczyk@gmail.com"), - Committer("Kwang Yul Seo", ["skyul@company100.net", "kseo@webkit.org"], "kwangseo"), + Committer("Kwang Yul Seo", ["skyul@company100.net", "kseo@webkit.org"], "kseo"), Committer("Leandro Gracia Gil", "leandrogracia@chromium.org", "leandrogracia"), Committer("Leandro Pereira", ["leandro@profusion.mobi", "leandro@webkit.org"], "acidx"), Committer("Leo Yang", ["leo.yang@torchmobile.com.cn", "leoyang@webkit.org", "leoyang.webkit@gmail.com", "leo.yang.c@gmail.com"], "leoyang"), diff --git a/Tools/Scripts/webkitpy/common/message_pool.py b/Tools/Scripts/webkitpy/common/message_pool.py new file mode 100644 index 000000000..2d90cbe0b --- /dev/null +++ b/Tools/Scripts/webkitpy/common/message_pool.py @@ -0,0 +1,311 @@ +# 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. + +"""Module for handling messages and concurrency for run-webkit-tests +and test-webkitpy. This module follows the design for multiprocessing.Pool +and concurrency.futures.ProcessPoolExecutor, with the following differences: + +* Tasks are executed in stateful subprocesses via objects that implement the + Worker interface - this allows the workers to share state across tasks. +* The pool provides an asynchronous event-handling interface so the caller + may receive events as tasks are processed. + +If you don't need these features, use multiprocessing.Pool or concurrency.futures +intead. + +""" + +import cPickle +import logging +import multiprocessing +import Queue +import sys +import time +import traceback + + +from webkitpy.common.host import Host +from webkitpy.common.system import stack_utils + + +_log = logging.getLogger(__name__) + + +def get(caller, worker_factory, num_workers, worker_startup_delay_secs=0.0, host=None): + """Returns an object that exposes a run() method that takes a list of test shards and runs them in parallel.""" + return _MessagePool(caller, worker_factory, num_workers, worker_startup_delay_secs, host) + + +class _MessagePool(object): + def __init__(self, caller, worker_factory, num_workers, worker_startup_delay_secs=0.0, host=None): + self._caller = caller + self._worker_factory = worker_factory + self._num_workers = num_workers + self._worker_startup_delay_secs = worker_startup_delay_secs + self._workers = [] + self._workers_stopped = set() + self._host = host + self._name = 'manager' + self._running_inline = (self._num_workers == 1) + if self._running_inline: + self._messages_to_worker = Queue.Queue() + self._messages_to_manager = Queue.Queue() + else: + self._messages_to_worker = multiprocessing.Queue() + self._messages_to_manager = multiprocessing.Queue() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, exc_traceback): + self._close() + return False + + def run(self, shards): + """Posts a list of messages to the pool and waits for them to complete.""" + for message in shards: + self._messages_to_worker.put(_Message(self._name, message[0], message[1:], from_user=True, logs=())) + + for _ in xrange(self._num_workers): + self._messages_to_worker.put(_Message(self._name, 'stop', message_args=(), from_user=False, logs=())) + + self.wait() + + def _start_workers(self): + assert not self._workers + self._workers_stopped = set() + host = None + if self._running_inline or self._can_pickle(self._host): + host = self._host + + for worker_number in xrange(self._num_workers): + worker = _Worker(host, self._messages_to_manager, self._messages_to_worker, self._worker_factory, worker_number, self._running_inline, self if self._running_inline else None) + self._workers.append(worker) + worker.start() + if self._worker_startup_delay_secs: + time.sleep(self._worker_startup_delay_secs) + + def wait(self): + try: + self._start_workers() + if self._running_inline: + self._workers[0].run() + self._loop(block=False) + else: + self._loop(block=True) + finally: + self._close() + + def _close(self): + for worker in self._workers: + if worker.is_alive(): + worker.terminate() + worker.join() + self._workers = [] + if not self._running_inline: + # FIXME: This is a hack to get multiprocessing to not log tracebacks during shutdown :(. + multiprocessing.util._exiting = True + if self._messages_to_worker: + self._messages_to_worker.close() + self._messages_to_worker = None + if self._messages_to_manager: + self._messages_to_manager.close() + self._messages_to_manager = None + + def _log_messages(self, messages): + for message in messages: + logging.root.handle(message) + + def _handle_done(self, source): + self._workers_stopped.add(source) + + @staticmethod + def _handle_worker_exception(source, exception_type, exception_value, _): + if exception_type == KeyboardInterrupt: + raise exception_type(exception_value) + raise WorkerException(str(exception_value)) + + def _can_pickle(self, host): + try: + cPickle.dumps(host) + return True + except TypeError: + return False + + def _loop(self, block): + try: + while True: + if len(self._workers_stopped) == len(self._workers): + block = False + message = self._messages_to_manager.get(block) + self._log_messages(message.logs) + if message.from_user: + self._caller.handle(message.name, message.src, *message.args) + continue + method = getattr(self, '_handle_' + message.name) + assert method, 'bad message %s' % repr(message) + method(message.src, *message.args) + except Queue.Empty: + pass + + +class WorkerException(Exception): + """Raised when we receive an unexpected/unknown exception from a worker.""" + pass + + +class _Message(object): + def __init__(self, src, message_name, message_args, from_user, logs): + self.src = src + self.name = message_name + self.args = message_args + self.from_user = from_user + self.logs = logs + + def __repr__(self): + return '_Message(src=%s, name=%s, args=%s, from_user=%s, logs=%s)' % (self.src, self.name, self.args, self.from_user, self.logs) + + +class _Worker(multiprocessing.Process): + def __init__(self, host, messages_to_manager, messages_to_worker, worker_factory, worker_number, running_inline, manager): + super(_Worker, self).__init__() + self.host = host + self.worker_number = worker_number + self.name = 'worker/%d' % worker_number + self.log_messages = [] + self._running_inline = running_inline + self._manager = manager + + self._messages_to_manager = messages_to_manager + self._messages_to_worker = messages_to_worker + self._worker = worker_factory(self) + self._logger = None + self._log_handler = None + + def terminate(self): + if self._worker: + if hasattr(self._worker, 'stop'): + self._worker.stop() + self._worker = None + if self.is_alive(): + super(_Worker, self).terminate() + + def _close(self): + if self._log_handler and self._logger: + self._logger.removeHandler(self._log_handler) + self._log_handler = None + self._logger = None + + def start(self): + if not self._running_inline: + super(_Worker, self).start() + + def run(self): + if not self.host: + self.host = Host() + if not self._running_inline: + self._set_up_logging() + + worker = self._worker + exception_msg = "" + _log.debug("%s starting" % self.name) + + try: + if hasattr(worker, 'start'): + worker.start() + while True: + message = self._messages_to_worker.get() + if message.from_user: + worker.handle(message.name, message.src, *message.args) + self._yield_to_manager() + else: + assert message.name == 'stop', 'bad message %s' % repr(message) + break + + _log.debug("%s exiting" % self.name) + except Queue.Empty: + assert False, '%s: ran out of messages in worker queue.' % self.name + except KeyboardInterrupt, e: + self._raise(sys.exc_info()) + except Exception, e: + self._raise(sys.exc_info()) + finally: + try: + if hasattr(worker, 'stop'): + worker.stop() + finally: + self._post(name='done', args=(), from_user=False) + self._close() + + def post(self, name, *args): + self._post(name, args, from_user=True) + self._yield_to_manager() + + def _yield_to_manager(self): + if self._running_inline: + self._manager._loop(block=False) + + def _post(self, name, args, from_user): + log_messages = self.log_messages + self.log_messages = [] + self._messages_to_manager.put(_Message(self.name, name, args, from_user, log_messages)) + + def _raise(self, exc_info): + exception_type, exception_value, exception_traceback = exc_info + if self._running_inline: + raise exception_type, exception_value, exception_traceback + + if exception_type == KeyboardInterrupt: + _log.debug("%s: interrupted, exiting" % self.name) + stack_utils.log_traceback(_log.debug, exception_traceback) + else: + _log.error("%s: %s('%s') raised:" % (self.name, exception_value.__class__.__name__, str(exception_value))) + stack_utils.log_traceback(_log.error, exception_traceback) + # Since tracebacks aren't picklable, send the extracted stack instead. + stack = traceback.extract_tb(exception_traceback) + self._post(name='worker_exception', args=(exception_type, exception_value, stack), from_user=False) + + def _set_up_logging(self): + self._logger = logging.getLogger() + + # The unix multiprocessing implementation clones any log handlers into the child process, + # so we remove them to avoid duplicate logging. + for h in self._logger.handlers: + self._logger.removeHandler(h) + + self._log_handler = _WorkerLogHandler(self) + self._logger.addHandler(self._log_handler) + + +class _WorkerLogHandler(logging.Handler): + def __init__(self, worker): + logging.Handler.__init__(self) + self._worker = worker + + def emit(self, record): + self._worker.log_messages.append(record) diff --git a/Tools/Scripts/webkitpy/common/system/user.py b/Tools/Scripts/webkitpy/common/system/user.py index 262b97944..c49429c0d 100644 --- a/Tools/Scripts/webkitpy/common/system/user.py +++ b/Tools/Scripts/webkitpy/common/system/user.py @@ -90,13 +90,21 @@ class User(object): def _wait_on_list_response(cls, list_items, can_choose_multiple, raw_input): while True: if can_choose_multiple: - response = cls.prompt("Enter one or more numbers (comma-separated), or \"all\": ", raw_input=raw_input) + response = cls.prompt("Enter one or more numbers (comma-separated) or ranges (e.g. 3-7), or \"all\": ", raw_input=raw_input) if not response.strip() or response == "all": return list_items + try: - indices = [int(r) - 1 for r in re.split("\s*,\s*", response)] + indices = [] + for value in re.split("\s*,\s*", response): + parts = value.split('-') + if len(parts) == 2: + indices += range(int(parts[0]) - 1, int(parts[1])) + else: + indices.append(int(value) - 1) except ValueError, err: continue + return [list_items[i] for i in indices] else: try: diff --git a/Tools/Scripts/webkitpy/common/system/user_unittest.py b/Tools/Scripts/webkitpy/common/system/user_unittest.py index 8b7cc1c0c..86b9db7d1 100644 --- a/Tools/Scripts/webkitpy/common/system/user_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/user_unittest.py @@ -59,9 +59,9 @@ class UserTest(unittest.TestCase): actual_result = output_capture.assert_outputs( self, User.prompt_with_multiple_lists, - args=["title", ["subtitle1", "subtitle2"], [["foo", "bar"], ["foobar", "barbaz"]]], + args=["title", ["subtitle1", "subtitle2"], [["foo", "bar"], ["foobar", "barbaz", "foobaz"]]], kwargs={"can_choose_multiple": can_choose_multiple, "raw_input": mock_raw_input}, - expected_stdout="title\n\nsubtitle1\n 1. foo\n 2. bar\n\nsubtitle2\n 3. foobar\n 4. barbaz\n") + expected_stdout="title\n\nsubtitle1\n 1. foo\n 2. bar\n\nsubtitle2\n 3. foobar\n 4. barbaz\n 5. foobaz\n") self.assertEqual(actual_result, expected_result) self.assertEqual(len(inputs), 0) @@ -69,13 +69,17 @@ class UserTest(unittest.TestCase): run_prompt_test(["badinput", "2"], "bar") run_prompt_test(["3"], "foobar") run_prompt_test(["4"], "barbaz") + run_prompt_test(["5"], "foobaz") run_prompt_test(["1,2"], ["foo", "bar"], can_choose_multiple=True) + run_prompt_test(["1-3"], ["foo", "bar", "foobar"], can_choose_multiple=True) + run_prompt_test(["1-2,3"], ["foo", "bar", "foobar"], can_choose_multiple=True) + run_prompt_test(["2-1,3"], ["foobar"], can_choose_multiple=True) run_prompt_test([" 1, 2 "], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test(["all"], ["foo", "bar", 'foobar', 'barbaz'], can_choose_multiple=True) - run_prompt_test([""], ["foo", "bar", 'foobar', 'barbaz'], can_choose_multiple=True) - run_prompt_test([" "], ["foo", "bar", 'foobar', 'barbaz'], can_choose_multiple=True) - run_prompt_test(["badinput", "all"], ["foo", "bar", 'foobar', 'barbaz'], can_choose_multiple=True) + run_prompt_test(["all"], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) + run_prompt_test([""], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) + run_prompt_test([" "], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) + run_prompt_test(["badinput", "all"], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) def test_prompt_with_list(self): def run_prompt_test(inputs, expected_result, can_choose_multiple=False): diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py index f2fed3f4a..7aee0c2fb 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py @@ -44,7 +44,7 @@ import re import sys import time -from webkitpy.layout_tests.controllers import manager_worker_broker +from webkitpy.common import message_pool from webkitpy.layout_tests.controllers import worker from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter from webkitpy.layout_tests.layout_package import json_layout_results_generator @@ -88,11 +88,9 @@ def interpret_test_failures(port, test_name, failures): test_dict['image_diff_percent'] = failure.diff_percent elif isinstance(failure, test_failures.FailureReftestMismatch): test_dict['is_reftest'] = True - test_dict['ref_file'] = port.relative_test_filename(failure.reference_filename) test_dict['image_diff_percent'] = failure.diff_percent elif isinstance(failure, test_failures.FailureReftestMismatchDidNotOccur): test_dict['is_mismatch_reftest'] = True - test_dict['ref_file'] = port.relative_test_filename(failure.reference_filename) if test_failures.FailureMissingResult in failure_types: test_dict['is_missing_text'] = True @@ -266,7 +264,8 @@ class TestRunInterruptedException(Exception): return self.__class__, (self.reason,) -WorkerException = manager_worker_broker.WorkerException +# Export this so callers don't need to know about message pools. +WorkerException = message_pool.WorkerException class TestShard(object): @@ -300,7 +299,6 @@ class Manager(object): self._filesystem = port.host.filesystem self._options = options self._printer = printer - self._message_broker = None self._expectations = None self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR @@ -328,11 +326,9 @@ class Manager(object): self._all_results = [] self._group_stats = {} + self._worker_stats = {} self._current_result_summary = None - # This maps worker names to the state we are tracking for each of them. - self._worker_states = {} - def collect_tests(self, args): """Find all the files to test. @@ -484,20 +480,13 @@ class Manager(object): # now make sure we're explicitly running any tests passed on the command line. self._test_files.update(found_test_files.intersection(self._paths)) - if not num_all_test_files: + num_to_run = len(self._test_files) + num_skipped = num_all_test_files - num_to_run + + if not num_to_run: _log.critical('No tests to run.') return None - num_skipped = num_all_test_files - len(self._test_files) - if num_skipped: - self._printer.print_expected("Running %s (found %d, skipping %d)." % ( - grammar.pluralize('test', num_all_test_files - num_skipped), - num_all_test_files, num_skipped)) - elif len(self._test_files) > 1: - self._printer.print_expected("Running all %d tests." % len(self._test_files)) - else: - self._printer.print_expected("Running %1 test.") - # Create a sorted list of test files so the subset chunk, # if used, contains alphabetically consecutive tests. self._test_files_list = list(self._test_files) @@ -522,6 +511,8 @@ class Manager(object): (self._options.repeat_each if self._options.repeat_each else 1) * \ (self._options.iterations if self._options.iterations else 1) result_summary = ResultSummary(self._expectations, self._test_files | skipped, iterations) + + self._printer.print_expected('Found %s.' % grammar.pluralize('test', num_all_test_files)) self._print_expected_results_of_type(result_summary, test_expectations.PASS, "passes") self._print_expected_results_of_type(result_summary, test_expectations.FAIL, "failures") self._print_expected_results_of_type(result_summary, test_expectations.FLAKY, "flaky") @@ -534,17 +525,16 @@ class Manager(object): for test in skipped: result = test_results.TestResult(test) result.type = test_expectations.SKIP - iterations = \ - (self._options.repeat_each if self._options.repeat_each else 1) * \ - (self._options.iterations if self._options.iterations else 1) for iteration in range(iterations): result_summary.add(result, expected=True) self._printer.print_expected('') - # Check to make sure we didn't filter out all of the tests. - if not len(self._test_files): - _log.info("All tests are being skipped") - return None + if self._options.repeat_each > 1: + self._printer.print_expected('Running each test %d times.' % self._options.repeat_each) + if self._options.iterations > 1: + self._printer.print_expected('Running %d iterations of the tests.' % self._options.iterations) + if iterations > 1: + self._printer.print_expected('') return result_summary @@ -719,11 +709,12 @@ class Manager(object): def _log_num_workers(self, num_workers, num_shards, num_locked_shards): driver_name = self._port.driver_name() if num_workers == 1: - self._printer.print_config("Running 1 %s over %s" % + self._printer.print_config("Running 1 %s over %s." % (driver_name, grammar.pluralize('shard', num_shards))) else: - self._printer.print_config("Running %d %ss in parallel over %d shards (%d locked)" % + self._printer.print_config("Running %d %ss in parallel over %d shards (%d locked)." % (num_workers, driver_name, num_shards, num_locked_shards)) + self._printer.print_config('') def _run_tests(self, file_list, result_summary, num_workers): """Runs the tests in the file_list. @@ -744,11 +735,10 @@ class Manager(object): self._current_result_summary = result_summary self._all_results = [] self._group_stats = {} - self._worker_states = {} + self._worker_stats = {} keyboard_interrupted = False interrupted = False - thread_timings = [] self._printer.print_update('Sharding tests ...') locked_shards, unlocked_shards = self._shard_tests(file_list, int(self._options.child_processes), self._options.fully_parallel) @@ -769,71 +759,32 @@ class Manager(object): num_workers = min(num_workers, len(all_shards)) self._log_num_workers(num_workers, len(all_shards), len(locked_shards)) - def worker_factory(worker_connection, worker_number): - return worker.Worker(worker_connection, worker_number, self.results_directory(), self._options) - - manager_connection = manager_worker_broker.get(num_workers, self, worker_factory, self._port.host) + def worker_factory(worker_connection): + return worker.Worker(worker_connection, self.results_directory(), self._options) if self._options.dry_run: - return (keyboard_interrupted, interrupted, thread_timings, self._group_stats, self._all_results) + return (keyboard_interrupted, interrupted, self._worker_stats.values(), self._group_stats, self._all_results) self._printer.print_update('Starting %s ...' % grammar.pluralize('worker', num_workers)) - for worker_number in xrange(num_workers): - worker_connection = manager_connection.start_worker(worker_number) - worker_state = _WorkerState(worker_number, worker_connection) - self._worker_states[worker_connection.name()] = worker_state - - time.sleep(self._port.worker_startup_delay_secs()) - - self._printer.print_update("Starting testing ...") - for shard in all_shards: - # FIXME: Change 'test_list' to 'shard', make sharding public. - manager_connection.post_message('test_list', shard.name, shard.test_inputs) - - # We post one 'stop' message for each worker. Because the stop message - # are sent after all of the tests, and because each worker will stop - # reading messsages after receiving a stop, we can be sure each - # worker will get a stop message and hence they will all shut down. - for _ in xrange(num_workers): - manager_connection.post_message('stop') try: - while not self.is_done(): - manager_connection.run_message_loop(delay_secs=1.0) - - # Make sure all of the workers have shut down (if possible). - for worker_state in self._worker_states.values(): - if worker_state.worker_connection.is_alive(): - _log.debug('Waiting for worker %d to exit' % worker_state.number) - worker_state.worker_connection.join(5.0) - if worker_state.worker_connection.is_alive(): - _log.error('Worker %d did not exit in time.' % worker_state.number) - + with message_pool.get(self, worker_factory, num_workers, self._port.worker_startup_delay_secs(), self._port.host) as pool: + pool.run(('test_list', shard.name, shard.test_inputs) for shard in all_shards) except KeyboardInterrupt: self._printer.flush() self._printer.write('Interrupted, exiting ...') - self.cancel_workers() keyboard_interrupted = True except TestRunInterruptedException, e: _log.warning(e.reason) - self.cancel_workers() interrupted = True - except WorkerException: - self.cancel_workers() - raise - except: - # Unexpected exception; don't try to clean up workers. - _log.error("Exception raised, exiting") - self.cancel_workers() + except Exception, e: + _log.debug('%s("%s") raised, exiting' % (e.__class__.__name__, str(e))) raise finally: - manager_connection.cleanup() self.stop_servers_with_lock() - thread_timings = [worker_state.stats for worker_state in self._worker_states.values()] - # FIXME: should this be a class instead of a tuple? - return (interrupted, keyboard_interrupted, thread_timings, self._group_stats, self._all_results) + return (interrupted, keyboard_interrupted, self._worker_stats.values(), self._group_stats, self._all_results) def results_directory(self): if not self._retrying: @@ -934,7 +885,7 @@ class Manager(object): self._print_timing_statistics(end_time - start_time, thread_timings, test_timings, individual_test_timings, result_summary) self._print_result_summary(result_summary) - self._printer.print_one_line_summary(result_summary.total, result_summary.expected, result_summary.unexpected) + self._printer.print_one_line_summary(result_summary.total - result_summary.expected_skips, result_summary.expected - result_summary.expected_skips, result_summary.unexpected) unexpected_results = summarize_results(self._port, self._expectations, result_summary, retry_summary, individual_test_timings, only_unexpected=True, interrupted=interrupted) self._printer.print_unexpected_results(unexpected_results) @@ -1375,9 +1326,8 @@ class Manager(object): result_summary: information to log """ failed = result_summary.total_failures - skipped = result_summary.total_tests_by_expectation[test_expectations.SKIP] - total = result_summary.total - passed = total - failed - skipped + total = result_summary.total - result_summary.expected_skips + passed = total - failed pct_passed = 0.0 if total > 0: pct_passed = float(passed) * 100 / total @@ -1442,42 +1392,17 @@ class Manager(object): results_filename = self._filesystem.join(self._results_directory, "results.html") self._port.show_results_html_file(results_filename) - def name(self): - return 'Manager' - - def is_done(self): - worker_states = self._worker_states.values() - return worker_states and all(self._worker_is_done(worker_state) for worker_state in worker_states) - - # FIXME: Inline this function. - def _worker_is_done(self, worker_state): - return worker_state.done - - def cancel_workers(self): - for worker_state in self._worker_states.values(): - worker_state.worker_connection.cancel() - - def handle_started_test(self, source, test_info, hang_timeout): - worker_state = self._worker_states[source] - worker_state.current_test_name = test_info.test_name - worker_state.next_timeout = time.time() + hang_timeout - - def handle_done(self, source, log_messages=None): - worker_state = self._worker_states[source] - worker_state.done = True - self._log_messages(log_messages) - - def handle_exception(self, source, exception_type, exception_value, stack): - if exception_type in (KeyboardInterrupt, TestRunInterruptedException): - raise exception_type(exception_value) - _log.error("%s raised %s('%s'):" % ( - source, - exception_value.__class__.__name__, - str(exception_value))) - self._log_worker_stack(stack) - raise WorkerException(str(exception_value)) - - def handle_finished_list(self, source, list_name, num_tests, elapsed_time): + def handle(self, name, source, *args): + method = getattr(self, '_handle_' + name) + if method: + return method(source, *args) + raise AssertionError('unknown message %s received from %s, args=%s' % (name, source, repr(args))) + + def _handle_started_test(self, worker_name, test_input, test_timeout_sec): + # FIXME: log that we've started another test. + pass + + def _handle_finished_test_list(self, worker_name, list_name, num_tests, elapsed_time): self._group_stats[list_name] = (num_tests, elapsed_time) def find(name, test_lists): @@ -1492,29 +1417,13 @@ class Manager(object): if not self._remaining_locked_shards: self.stop_servers_with_lock() - def handle_finished_test(self, source, result, elapsed_time, log_messages=None): - worker_state = self._worker_states[source] - worker_state.next_timeout = None - worker_state.current_test_name = None - worker_state.stats['total_time'] += elapsed_time - worker_state.stats['num_tests'] += 1 - - self._log_messages(log_messages) + def _handle_finished_test(self, worker_name, result, elapsed_time, log_messages=[]): + self._worker_stats.setdefault(worker_name, {'name': worker_name, 'num_tests': 0, 'total_time': 0}) + self._worker_stats[worker_name]['total_time'] += elapsed_time + self._worker_stats[worker_name]['num_tests'] += 1 self._all_results.append(result) self._update_summary_with_result(self._current_result_summary, result) - def _log_messages(self, messages): - for message in messages: - logging.root.handle(message) - - def _log_worker_stack(self, stack): - webkitpydir = self._port.path_from_webkit_base('Tools', 'Scripts', 'webkitpy') + self._filesystem.sep - for filename, line_number, function_name, text in stack: - if filename.startswith(webkitpydir): - filename = filename.replace(webkitpydir, '') - _log.error(' %s:%u (in %s)' % (filename, line_number, function_name)) - _log.error(' %s' % text) - def read_test_files(fs, filenames, test_path_separator): tests = [] @@ -1563,20 +1472,3 @@ def natural_sort_key(string_to_split): return val return [tryint(chunk) for chunk in re.split('(\d+)', string_to_split)] - - -class _WorkerState(object): - """A class for the manager to use to track the current state of the workers.""" - def __init__(self, number, worker_connection): - self.worker_connection = worker_connection - self.number = number - self.done = False - self.current_test_name = None - self.next_timeout = None - self.stats = {} - self.stats['name'] = worker_connection.name() - self.stats['num_tests'] = 0 - self.stats['total_time'] = 0 - - def __repr__(self): - return "_WorkerState(" + str(self.__dict__) + ")" diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py index 3496322a9..27f06a70e 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py @@ -452,7 +452,6 @@ class ResultSummaryTest(unittest.TestCase): [test_failures.FailureReftestMismatch(self.port.abspath_for_test('foo/common.html'))]) self.assertTrue('is_reftest' in test_dict) self.assertFalse('is_mismatch_reftest' in test_dict) - self.assertEqual(test_dict['ref_file'], 'foo/common.html') test_dict = interpret_test_failures(self.port, 'foo/reftest.html', [test_failures.FailureReftestMismatchDidNotOccur(self.port.abspath_for_test('foo/reftest-expected-mismatch.html'))]) @@ -463,7 +462,6 @@ class ResultSummaryTest(unittest.TestCase): [test_failures.FailureReftestMismatchDidNotOccur(self.port.abspath_for_test('foo/common.html'))]) self.assertFalse('is_reftest' in test_dict) self.assertTrue(test_dict['is_mismatch_reftest']) - self.assertEqual(test_dict['ref_file'], 'foo/common.html') def get_result(self, test_name, result_type=test_expectations.PASS, run_time=0): failures = [] diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py deleted file mode 100755 index f7baced0a..000000000 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py +++ /dev/null @@ -1,515 +0,0 @@ -# Copyright (C) 2011 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Module for handling messages and concurrency for run-webkit-tests. - -This module implements a message broker that connects the manager to the -workers: it provides a messaging abstraction and message loops (building on -top of message_broker), and handles starting workers by launching processes. - -There are a lot of classes and objects involved in a fully connected system. -They interact more or less like: - - Manager --> _InlineManager ---> _InlineWorker <-> Worker - ^ \ / ^ - | v v | - \----------------------- Broker ----------------/ - -The broker simply distributes messages onto topics (named queues); the actual -queues themselves are provided by the caller, as the queue's implementation -requirements varies vary depending on the desired concurrency model -(none/threads/processes). - -In order for shared-nothing messaging between processing to be possible, -Messages must be picklable. - -The module defines one interface and two classes. Callers of this package -must implement the BrokerClient interface, and most callers will create -_BrokerConnections as well as Brokers. - -The classes relate to each other as: - - BrokerClient ------> _BrokerConnection - ^ | - | v - \---------------- _Broker - -(The BrokerClient never calls broker directly after it is created, only -_BrokerConnection. _BrokerConnection passes a reference to BrokerClient to -_Broker, and _Broker only invokes that reference, never talking directly to -BrokerConnection). -""" - -import cPickle -import logging -import multiprocessing -import optparse -import os -import Queue -import sys -import traceback - - -from webkitpy.common.host import Host -from webkitpy.common.system import stack_utils -from webkitpy.layout_tests.views import metered_stream - - -_log = logging.getLogger(__name__) - - -# -# Topic names for Manager <-> Worker messaging -# -MANAGER_TOPIC = 'managers' -ANY_WORKER_TOPIC = 'workers' - - -def get(max_workers, client, worker_factory, host=None): - """Return a connection to a manager/worker message_broker - - Args: - max_workers - max # of workers to run concurrently. - client - BrokerClient implementation to dispatch - replies to. - worker_factory: factory method for creating objects that implement the Worker interface. - host: optional picklable host object that can be passed to workers for testing. - Returns: - A handle to an object that will talk to a message broker configured - for the normal manager/worker communication.""" - if max_workers == 1: - queue_class = Queue.Queue - manager_class = _InlineManager - else: - queue_class = multiprocessing.Queue - manager_class = _MultiProcessManager - - broker = _Broker(queue_class) - return manager_class(broker, client, worker_factory, host) - - -class WorkerException(Exception): - """Raised when we receive an unexpected/unknown exception from a worker.""" - pass - - -class BrokerClient(object): - """Abstract base class / interface that all message broker clients must - implement. In addition to the methods below, by convention clients - implement routines of the signature type - - handle_MESSAGE_NAME(self, src, ...): - - where MESSAGE_NAME matches the string passed to post_message(), and - src indicates the name of the sender. If the message contains values in - the message body, those will be provided as optparams.""" - - def is_done(self): - """Called from inside run_message_loop() to indicate whether to exit.""" - raise NotImplementedError - - def name(self): - """Return a name that identifies the client.""" - raise NotImplementedError - - -class _Broker(object): - """Brokers provide the basic model of a set of topics. Clients can post a - message to any topic using post_message(), and can process messages on one - topic at a time using run_message_loop().""" - - def __init__(self, queue_maker): - """Args: - queue_maker: a factory method that returns objects implementing a - Queue interface (put()/get()). - """ - self._queue_maker = queue_maker - self._topics = {} - - def __del__(self): - self.cleanup() - - def cleanup(self): - for queue in self._topics.values(): - if hasattr(queue, 'close'): - queue.close() - self._topics = {} - - def add_topic(self, topic_name): - if topic_name not in self._topics: - self._topics[topic_name] = self._queue_maker() - - def _get_queue_for_topic(self, topic_name): - return self._topics[topic_name] - - def post_message(self, client, topic_name, message_name, *message_args): - """Post a message to the appropriate topic name. - - Messages have a name and a tuple of optional arguments. Both must be picklable.""" - message = _Message(client.name(), topic_name, message_name, message_args) - queue = self._get_queue_for_topic(topic_name) - queue.put(_Message.dumps(message)) - - def run_message_loop(self, topic_name, client, delay_secs=None): - """Loop processing messages until client.is_done() or delay passes. - - To run indefinitely, set delay_secs to None.""" - assert delay_secs is None or delay_secs > 0 - self._run_loop(topic_name, client, block=True, delay_secs=delay_secs) - - def run_all_pending(self, topic_name, client): - """Process messages until client.is_done() or caller would block.""" - self._run_loop(topic_name, client, block=False, delay_secs=None) - - def _run_loop(self, topic_name, client, block, delay_secs): - queue = self._get_queue_for_topic(topic_name) - while not client.is_done(): - try: - s = queue.get(block, delay_secs) - except Queue.Empty: - return - msg = _Message.loads(s) - self._dispatch_message(msg, client) - - def _dispatch_message(self, message, client): - if not hasattr(client, 'handle_' + message.name): - raise ValueError( - "%s: received message '%s' it couldn't handle" % - (client.name(), message.name)) - optargs = message.args - message_handler = getattr(client, 'handle_' + message.name) - message_handler(message.src, *optargs) - - -class _Message(object): - @staticmethod - def loads(string_value): - obj = cPickle.loads(string_value) - assert(isinstance(obj, _Message)) - return obj - - def __init__(self, src, topic_name, message_name, message_args): - self.src = src - self.topic_name = topic_name - self.name = message_name - self.args = message_args - - def dumps(self): - return cPickle.dumps(self) - - def __repr__(self): - return ("_Message(from='%s', topic_name='%s', message_name='%s')" % - (self.src, self.topic_name, self.name)) - - -class _BrokerConnection(object): - """_BrokerConnection provides a connection-oriented facade on top of a - Broker, so that callers don't have to repeatedly pass the same topic - names over and over.""" - - def __init__(self, broker, client, run_topic, post_topic): - """Create a _BrokerConnection on top of a _Broker. Note that the _Broker - is passed in rather than created so that a single _Broker can be used - by multiple _BrokerConnections.""" - self._broker = broker - self._client = client - self._post_topic = post_topic - self._run_topic = run_topic - broker.add_topic(run_topic) - broker.add_topic(post_topic) - - def cleanup(self): - self._broker.cleanup() - self._broker = None - - def run_message_loop(self, delay_secs=None): - self._broker.run_message_loop(self._run_topic, self._client, delay_secs) - - def post_message(self, message_name, *message_args): - self._broker.post_message(self._client, self._post_topic, - message_name, *message_args) - - def raise_exception(self, exc_info): - # Since tracebacks aren't picklable, send the extracted stack instead, - # but at least log the full traceback. - exception_type, exception_value, exception_traceback = sys.exc_info() - stack_utils.log_traceback(_log.error, exception_traceback) - stack = traceback.extract_tb(exception_traceback) - self._broker.post_message(self._client, self._post_topic, 'exception', exception_type, exception_value, stack) - - -class AbstractWorker(BrokerClient): - def __init__(self, worker_connection, worker_number): - BrokerClient.__init__(self) - self.worker = None - self._worker_connection = worker_connection - self._worker_number = worker_number - self._name = 'worker/%d' % worker_number - self._done = False - self._canceled = False - self._options = optparse.Values({'verbose': False}) - self.host = None - - def name(self): - return self._name - - def is_done(self): - return self._done or self._canceled - - def stop_handling_messages(self): - self._done = True - - def run(self, host): - """Callback for the worker to start executing. Typically does any - remaining initialization and then calls broker_connection.run_message_loop().""" - exception_msg = "" - self.host = host - - self.worker.safe_init() - _log.debug('%s starting' % self._name) - - try: - self._worker_connection.run_message_loop() - if not self.is_done(): - raise AssertionError("%s: ran out of messages in worker queue." - % self._name) - except KeyboardInterrupt: - exception_msg = ", interrupted" - self._worker_connection.raise_exception(sys.exc_info()) - except: - exception_msg = ", exception raised" - self._worker_connection.raise_exception(sys.exc_info()) - finally: - _log.debug("%s done with message loop%s" % (self._name, exception_msg)) - try: - self.worker.cleanup() - finally: - # Make sure we post a done so that we can flush the log messages - # and clean up properly even if we raise an exception in worker.cleanup(). - self._worker_connection.post_message('done') - - def handle_stop(self, source): - self._done = True - - def handle_test_list(self, source, list_name, test_list): - self.worker.handle('test_list', source, list_name, test_list) - - def cancel(self): - """Called when possible to indicate to the worker to stop processing - messages and shut down. Note that workers may be stopped without this - method being called, so clients should not rely solely on this.""" - self._canceled = True - - def yield_to_broker(self): - self._worker_connection.yield_to_broker() - - def post_message(self, *args): - self._worker_connection.post_message(*args) - - -class _ManagerConnection(_BrokerConnection): - def __init__(self, broker, client, worker_factory, host): - _BrokerConnection.__init__(self, broker, client, MANAGER_TOPIC, ANY_WORKER_TOPIC) - self._worker_factory = worker_factory - self._host = host - - def start_worker(self, worker_number): - raise NotImplementedError - - -class _InlineManager(_ManagerConnection): - def __init__(self, broker, client, worker_factory, host): - _ManagerConnection.__init__(self, broker, client, worker_factory, host) - self._inline_worker = None - - def start_worker(self, worker_number): - host = self._host - self._inline_worker = _InlineWorkerConnection(host, self._broker, self._client, self._worker_factory, worker_number) - return self._inline_worker - - def run_message_loop(self, delay_secs=None): - # Note that delay_secs is ignored in this case since we can't easily - # implement it. - self._inline_worker.run() - self._broker.run_all_pending(MANAGER_TOPIC, self._client) - - -class _MultiProcessManager(_ManagerConnection): - def _can_pickle_host(self): - try: - cPickle.dumps(self._host) - return True - except TypeError: - return False - - def start_worker(self, worker_number): - host = None - if self._can_pickle_host(): - host = self._host - worker_connection = _MultiProcessWorkerConnection(host, self._broker, self._worker_factory, worker_number) - worker_connection.start() - return worker_connection - - -class _WorkerConnection(_BrokerConnection): - def __init__(self, host, broker, worker_factory, worker_number): - # FIXME: keeping track of the differences between the WorkerConnection, the AbstractWorker, and the - # actual Worker (created by worker_factory) is very confusing, but this all gets better when - # _WorkerConnection and AbstractWorker get merged. - self._client = AbstractWorker(self, worker_number) - self._worker = worker_factory(self._client, worker_number) - self._client.worker = self._worker - self._host = host - self._log_messages = [] - self._logger = None - self._log_handler = None - _BrokerConnection.__init__(self, broker, self._client, ANY_WORKER_TOPIC, MANAGER_TOPIC) - - def name(self): - return self._client.name() - - def cancel(self): - raise NotImplementedError - - def is_alive(self): - raise NotImplementedError - - def join(self, timeout): - raise NotImplementedError - - def yield_to_broker(self): - pass - - def post_message(self, *args): - # FIXME: This is a hack until we can remove the log_messages arg from the manager. - if args[0] in ('finished_test', 'done'): - log_messages = self._log_messages - self._log_messages = [] - args = args + tuple([log_messages]) - super(_WorkerConnection, self).post_message(*args) - - def set_up_logging(self): - self._logger = logging.root - # The unix multiprocessing implementation clones the MeteredStream log handler - # into the child process, so we need to remove it to avoid duplicate logging. - for h in self._logger.handlers: - # log handlers don't have names until python 2.7. - if getattr(h, 'name', '') == metered_stream.LOG_HANDLER_NAME: - self._logger.removeHandler(h) - break - self._logger.setLevel(logging.DEBUG if self._client._options.verbose else logging.INFO) - self._log_handler = _WorkerLogHandler(self) - self._logger.addHandler(self._log_handler) - - def clean_up_logging(self): - if self._log_handler and self._logger: - self._logger.removeHandler(self._log_handler) - self._log_handler = None - self._logger = None - - -class _InlineWorkerConnection(_WorkerConnection): - def __init__(self, host, broker, manager_client, worker_factory, worker_number): - _WorkerConnection.__init__(self, host, broker, worker_factory, worker_number) - self._alive = False - self._manager_client = manager_client - - def cancel(self): - self._client.cancel() - - def is_alive(self): - return self._alive - - def join(self, timeout): - assert not self._alive - - def run(self): - self._alive = True - try: - self._client.run(self._host) - finally: - self._alive = False - - def yield_to_broker(self): - self._broker.run_all_pending(MANAGER_TOPIC, self._manager_client) - - def raise_exception(self, exc_info): - # Since the worker is in the same process as the manager, we can - # raise the exception directly, rather than having to send it through - # the queue. This allows us to preserve the traceback, but we log - # it anyway for consistency with the multiprocess case. - exception_type, exception_value, exception_traceback = sys.exc_info() - stack_utils.log_traceback(_log.error, exception_traceback) - raise exception_type, exception_value, exception_traceback - - -class _Process(multiprocessing.Process): - def __init__(self, worker_connection, client): - multiprocessing.Process.__init__(self) - self._worker_connection = worker_connection - self._client = client - - def run(self): - if not self._worker_connection._host: - self._worker_connection._host = Host() - self._worker_connection.run() - - -class _MultiProcessWorkerConnection(_WorkerConnection): - def __init__(self, host, broker, worker_factory, worker_number): - _WorkerConnection.__init__(self, host, broker, worker_factory, worker_number) - self._proc = _Process(self, self._client) - - def cancel(self): - return self._proc.terminate() - - def is_alive(self): - return self._proc.is_alive() - - def join(self, timeout): - return self._proc.join(timeout) - - def start(self): - self._proc.start() - - def run(self): - self.set_up_logging() - try: - self._client.run(self._host) - finally: - self.clean_up_logging() - - -class _WorkerLogHandler(logging.Handler): - def __init__(self, worker): - logging.Handler.__init__(self) - self._worker = worker - self._pid = os.getpid() - - def emit(self, record): - self._worker._log_messages.append(record) diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py deleted file mode 100644 index d7c3714d8..000000000 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py +++ /dev/null @@ -1,213 +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. - -import optparse -import Queue -import sys -import unittest - -from webkitpy.common.system import outputcapture -from webkitpy.layout_tests.controllers import manager_worker_broker - - -# In order to reliably control when child workers are starting and stopping, -# we use a pair of global variables to hold queues used for messaging. Ideally -# we wouldn't need globals, but we can't pass these through a lexical closure -# because those can't be Pickled and sent to a subprocess, and we'd prefer not -# to have to pass extra arguments to the worker in the start_worker() call. -starting_queue = None -stopping_queue = None - - -WORKER_NAME = 'worker/1' - -def make_broker(manager, max_workers, start_queue=None, stop_queue=None): - global starting_queue - global stopping_queue - starting_queue = start_queue - stopping_queue = stop_queue - return manager_worker_broker.get(max_workers, manager, _TestWorker) - - -class _TestWorker(object): - def __init__(self, caller, worker_number): - self._caller = caller - self._thing_to_greet = 'everybody' - self._starting_queue = starting_queue - self._stopping_queue = stopping_queue - self._options = optparse.Values({'verbose': False}) - - def name(self): - return WORKER_NAME - - def cleanup(self): - pass - - def handle(self, message, src, an_int, a_str): - assert an_int == 1 - assert a_str == "hello, world" - self._caller.post_message('finished_test', 2) - - def safe_init(self): - if self._starting_queue: - self._starting_queue.put('') - - if self._stopping_queue: - self._stopping_queue.get() - - def stop(self): - self._caller.post_message('done') - - -class FunctionTests(unittest.TestCase): - def test_get__inline(self): - self.assertTrue(make_broker(self, 1) is not None) - - def test_get__processes(self): - # This test sometimes fails on Windows. See <http://webkit.org/b/55087>. - if sys.platform in ('cygwin', 'win32'): - return - self.assertTrue(make_broker(self, 2) is not None) - - -class _TestsMixin(object): - """Mixin class that implements a series of tests to enforce the - contract all implementations must follow.""" - - def name(self): - return 'TesterManager' - - def is_done(self): - return self._done - - def handle_done(self, src, log_messages): - self._done = True - - def handle_finished_test(self, src, an_int, log_messages): - self._an_int = an_int - - def handle_exception(self, src, exception_type, exception_value, stack): - raise exception_type(exception_value) - - def setUp(self): - self._an_int = None - self._broker = None - self._done = False - self._exception = None - self._max_workers = None - - def make_broker(self, starting_queue=None, stopping_queue=None): - self._broker = make_broker(self, self._max_workers, starting_queue, - stopping_queue) - - def test_name(self): - self.make_broker() - worker = self._broker.start_worker(1) - self.assertEquals(worker.name(), WORKER_NAME) - worker.cancel() - worker.join(0.1) - self.assertFalse(worker.is_alive()) - self._broker.cleanup() - - def test_cancel(self): - self.make_broker() - worker = self._broker.start_worker(1) - self._broker.post_message('test_list', 1, 'hello, world') - worker.cancel() - worker.join(0.1) - self.assertFalse(worker.is_alive()) - self._broker.cleanup() - - def test_done(self): - self.make_broker() - worker = self._broker.start_worker(1) - self._broker.post_message('test_list', 1, 'hello, world') - self._broker.post_message('stop') - self._broker.run_message_loop() - worker.join(0.5) - self.assertFalse(worker.is_alive()) - self.assertTrue(self.is_done()) - self.assertEqual(self._an_int, 2) - self._broker.cleanup() - - def test_unknown_message(self): - self.make_broker() - worker = self._broker.start_worker(1) - self._broker.post_message('unknown') - try: - self._broker.run_message_loop() - self.fail() - except ValueError, e: - self.assertEquals(str(e), - "%s: received message 'unknown' it couldn't handle" % WORKER_NAME) - finally: - worker.join(0.5) - self.assertFalse(worker.is_alive()) - self._broker.cleanup() - - -class InlineBrokerTests(_TestsMixin, unittest.TestCase): - def setUp(self): - _TestsMixin.setUp(self) - self._max_workers = 1 - - -# FIXME: https://bugs.webkit.org/show_bug.cgi?id=54520. -if sys.platform not in ('cygwin', 'win32'): - - class MultiProcessBrokerTests(_TestsMixin, unittest.TestCase): - def setUp(self): - _TestsMixin.setUp(self) - self._max_workers = 2 - - -class MessageTest(unittest.TestCase): - def test__no_body(self): - msg = manager_worker_broker._Message('src', 'topic_name', 'message_name', None) - self.assertTrue(repr(msg)) - s = msg.dumps() - new_msg = manager_worker_broker._Message.loads(s) - self.assertEqual(new_msg.name, 'message_name') - self.assertEqual(new_msg.args, None) - self.assertEqual(new_msg.topic_name, 'topic_name') - self.assertEqual(new_msg.src, 'src') - - def test__body(self): - msg = manager_worker_broker._Message('src', 'topic_name', 'message_name', ('body', 0)) - self.assertTrue(repr(msg)) - s = msg.dumps() - new_msg = manager_worker_broker._Message.loads(s) - self.assertEqual(new_msg.name, 'message_name') - self.assertEqual(new_msg.args, ('body', 0)) - self.assertEqual(new_msg.topic_name, 'topic_name') - self.assertEqual(new_msg.src, 'src') - - - -if __name__ == '__main__': - unittest.main() diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py b/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py index 62d214ee9..243a11d8d 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py @@ -40,6 +40,7 @@ def write_test_result(filesystem, port, test_name, driver_output, """Write the test result to the result output directory.""" root_output_dir = port.results_directory() writer = TestResultWriter(filesystem, port, root_output_dir, test_name) + if driver_output.error: writer.write_stderr(driver_output.error) @@ -74,10 +75,10 @@ def write_test_result(filesystem, port, test_name, driver_output, failure.diff_percent = diff_percent else: _log.warn('Can not get image diff. ImageDiff program might not work correctly.') - writer.copy_file(failure.reference_filename) + writer.write_reftest(failure.reference_filename) elif isinstance(failure, test_failures.FailureReftestMismatchDidNotOccur): writer.write_image_files(driver_output.image, expected_image=None) - writer.copy_file(failure.reference_filename) + writer.write_reftest(failure.reference_filename) else: assert isinstance(failure, (test_failures.FailureTimeout, test_failures.FailureReftestNoImagesGenerated)) @@ -124,6 +125,16 @@ class TestResultWriter(object): output_filename = fs.join(self._root_output_dir, self._test_name) return fs.splitext(output_filename)[0] + modifier + def _write_binary_file(self, path, contents): + if contents is not None: + self._make_output_directory() + self._filesystem.write_binary_file(path, contents) + + def _write_text_file(self, path, contents): + if contents is not None: + self._make_output_directory() + self._filesystem.write_text_file(path, contents) + def _output_testname(self, modifier): fs = self._filesystem return fs.splitext(fs.basename(self._test_name))[0] + modifier @@ -141,28 +152,19 @@ class TestResultWriter(object): output: A string containing the test output expected: A string containing the expected test output """ - self._make_output_directory() actual_filename = self.output_filename(self.FILENAME_SUFFIX_ACTUAL + file_type) expected_filename = self.output_filename(self.FILENAME_SUFFIX_EXPECTED + file_type) - fs = self._filesystem - if output is not None: - fs.write_binary_file(actual_filename, output) - if expected is not None: - fs.write_binary_file(expected_filename, expected) + self._write_binary_file(actual_filename, output) + self._write_binary_file(expected_filename, expected) def write_stderr(self, error): - fs = self._filesystem filename = self.output_filename(self.FILENAME_SUFFIX_STDERR + ".txt") - fs.maybe_make_directory(fs.dirname(filename)) - fs.write_binary_file(filename, error) + self._write_binary_file(filename, error) def write_crash_log(self, crash_log): - fs = self._filesystem filename = self.output_filename(self.FILENAME_SUFFIX_CRASH_LOG + ".txt") - fs.maybe_make_directory(fs.dirname(filename)) - if crash_log is not None: - fs.write_text_file(filename, crash_log) + self._write_text_file(filename, crash_log) def write_text_files(self, actual_text, expected_text): self.write_output_files(".txt", actual_text, expected_text) @@ -173,28 +175,26 @@ class TestResultWriter(object): if not actual_text or not expected_text: return - self._make_output_directory() file_type = '.txt' actual_filename = self.output_filename(self.FILENAME_SUFFIX_ACTUAL + file_type) expected_filename = self.output_filename(self.FILENAME_SUFFIX_EXPECTED + file_type) - fs = self._filesystem # We treat diff output as binary. Diff output may contain multiple files # in conflicting encodings. diff = self._port.diff_text(expected_text, actual_text, expected_filename, actual_filename) diff_filename = self.output_filename(self.FILENAME_SUFFIX_DIFF + file_type) - fs.write_binary_file(diff_filename, diff) + self._write_binary_file(diff_filename, diff) # Shell out to wdiff to get colored inline diffs. if self._port.wdiff_available(): wdiff = self._port.wdiff_text(expected_filename, actual_filename) wdiff_filename = self.output_filename(self.FILENAME_SUFFIX_WDIFF) - fs.write_binary_file(wdiff_filename, wdiff) + self._write_binary_file(wdiff_filename, wdiff) # Use WebKit's PrettyPatch.rb to get an HTML diff. if self._port.pretty_patch_available(): pretty_patch = self._port.pretty_patch_text(diff_filename) pretty_patch_filename = self.output_filename(self.FILENAME_SUFFIX_PRETTY_PATCH) - fs.write_binary_file(pretty_patch_filename, pretty_patch) + self._write_binary_file(pretty_patch_filename, pretty_patch) def write_audio_files(self, actual_audio, expected_audio): self.write_output_files('.wav', actual_audio, expected_audio) @@ -204,8 +204,7 @@ class TestResultWriter(object): def write_image_diff_files(self, image_diff): diff_filename = self.output_filename(self.FILENAME_SUFFIX_IMAGE_DIFF) - fs = self._filesystem - fs.write_binary_file(diff_filename, image_diff) + self._write_binary_file(diff_filename, image_diff) diffs_html_filename = self.output_filename(self.FILENAME_SUFFIX_IMAGE_DIFFS_HTML) # FIXME: old-run-webkit-tests shows the diff percentage as the text contents of the "diff" link. @@ -263,9 +262,8 @@ Difference between images: <a href="%(diff_filename)s">diff</a><br> } self._filesystem.write_text_file(diffs_html_filename, html) - def copy_file(self, src_filepath): + def write_reftest(self, src_filepath): fs = self._filesystem - assert fs.exists(src_filepath), 'src_filepath: %s' % src_filepath - dst_filepath = fs.join(self._root_output_dir, self._port.relative_test_filename(src_filepath)) - self._make_output_directory() - fs.copyfile(src_filepath, dst_filepath) + dst_dir = fs.dirname(fs.join(self._root_output_dir, self._test_name)) + dst_filepath = fs.join(dst_dir, fs.basename(src_filepath)) + self._write_text_file(dst_filepath, fs.read_text_file(src_filepath)) diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py b/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py index c68915916..837aea86b 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py @@ -41,14 +41,14 @@ _log = logging.getLogger(__name__) class Worker(object): - def __init__(self, worker_connection, worker_number, results_directory, options): - self._worker_connection = worker_connection - self._worker_number = worker_number - self._name = 'worker/%d' % worker_number + def __init__(self, caller, results_directory, options): + self._caller = caller + self._worker_number = caller.worker_number + self._name = caller.name self._results_directory = results_directory self._options = options - # The remaining fields are initialized in safe_init() + # The remaining fields are initialized in start() self._host = None self._port = None self._batch_size = None @@ -59,12 +59,13 @@ class Worker(object): self._tests_run_filename = None def __del__(self): - self.cleanup() + self.stop() - def safe_init(self): - """This method is called when it is safe for the object to create state that - does not need to be pickled (usually this means it is called in a child process).""" - self._host = self._worker_connection.host + def start(self): + """This method is called when the object is starting to be used and it is safe + for the object to create state that does not need to be pickled (usually this means + it is called in a child process).""" + self._host = self._caller.host self._filesystem = self._host.filesystem self._port = self._host.port_factory.get(self._options.platform, self._options) @@ -73,18 +74,13 @@ class Worker(object): tests_run_filename = self._filesystem.join(self._results_directory, "tests_run%d.txt" % self._worker_number) self._tests_run_file = self._filesystem.open_text_file_for_writing(tests_run_filename) - def handle(self, name, source, list_name, test_list): + def handle(self, name, source, test_list_name, test_inputs): assert name == 'test_list' start_time = time.time() - num_tests = 0 - for test_input in test_list: - self._update_test_input(test_input) + for test_input in test_inputs: self._run_test(test_input) - num_tests += 1 - self._worker_connection.yield_to_broker() - elapsed_time = time.time() - start_time - self._worker_connection.post_message('finished_list', list_name, num_tests, elapsed_time) + self._caller.post('finished_test_list', test_list_name, len(test_inputs), elapsed_time) def _update_test_input(self, test_input): test_input.reference_files = self._port.reference_files(test_input.test_name) @@ -99,25 +95,26 @@ class Worker(object): test_input.should_run_pixel_test = False def _run_test(self, test_input): - test_timeout_sec = self.timeout(test_input) + self._update_test_input(test_input) + test_timeout_sec = self._timeout(test_input) start = time.time() - self._worker_connection.post_message('started_test', test_input, test_timeout_sec) + self._caller.post('started_test', test_input, test_timeout_sec) - result = self.run_test_with_timeout(test_input, test_timeout_sec) + result = self._run_test_with_timeout(test_input, test_timeout_sec) elapsed_time = time.time() - start - self._worker_connection.post_message('finished_test', result, elapsed_time) + self._caller.post('finished_test', result, elapsed_time) - self.clean_up_after_test(test_input, result) + self._clean_up_after_test(test_input, result) - def cleanup(self): + def stop(self): _log.debug("%s cleaning up" % self._name) - self.kill_driver() + self._kill_driver() if self._tests_run_file: self._tests_run_file.close() self._tests_run_file = None - def timeout(self, test_input): + def _timeout(self, test_input): """Compute the appropriate timeout value for a test.""" # The DumpRenderTree watchdog uses 2.5x the timeout; we want to be # larger than that. We also add a little more padding if we're @@ -133,7 +130,7 @@ class Worker(object): thread_timeout_sec = driver_timeout_sec + thread_padding_sec return thread_timeout_sec - def kill_driver(self): + def _kill_driver(self): # Be careful about how and when we kill the driver; if driver.stop() # raises an exception, this routine may get re-entered via __del__. driver = self._driver @@ -142,12 +139,12 @@ class Worker(object): _log.debug("%s killing driver" % self._name) driver.stop() - def run_test_with_timeout(self, test_input, timeout): + def _run_test_with_timeout(self, test_input, timeout): if self._options.run_singly: return self._run_test_in_another_thread(test_input, timeout) return self._run_test_in_this_thread(test_input) - def clean_up_after_test(self, test_input, result): + def _clean_up_after_test(self, test_input, result): self._batch_count += 1 test_name = test_input.test_name self._tests_run_file.write(test_name + "\n") @@ -155,7 +152,7 @@ class Worker(object): if result.failures: # Check and kill DumpRenderTree if we need to. if any([f.driver_needs_restart() for f in result.failures]): - self.kill_driver() + self._kill_driver() # Reset the batch count since the shell just bounced. self._batch_count = 0 @@ -169,7 +166,7 @@ class Worker(object): _log.debug("%s %s passed" % (self._name, test_name)) if self._batch_size > 0 and self._batch_count >= self._batch_size: - self.kill_driver() + self._kill_driver() self._batch_count = 0 def _run_test_in_another_thread(self, test_input, thread_timeout_sec): @@ -195,7 +192,7 @@ class Worker(object): self.result = None def run(self): - self.result = worker.run_single_test(driver, test_input) + self.result = worker._run_single_test(driver, test_input) thread = SingleTestThread() thread.start() @@ -227,11 +224,11 @@ class Worker(object): Returns: a TestResult object. """ if self._driver and self._driver.has_crashed(): - self.kill_driver() + self._kill_driver() if not self._driver: self._driver = self._port.create_driver(self._worker_number) - return self.run_single_test(self._driver, test_input) + return self._run_single_test(self._driver, test_input) - def run_single_test(self, driver, test_input): + def _run_single_test(self, driver, test_input): return single_test_runner.run_single_test(self._port, self._options, test_input, driver, self._name) diff --git a/Tools/Scripts/webkitpy/layout_tests/models/result_summary.py b/Tools/Scripts/webkitpy/layout_tests/models/result_summary.py index 27c5452c0..d46703e8f 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/result_summary.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/result_summary.py @@ -47,6 +47,7 @@ class ResultSummary(object): self.unexpected_results = {} self.failures = {} self.total_failures = 0 + self.expected_skips = 0 self.total_tests_by_expectation[SKIP] = 0 self.tests_by_expectation[SKIP] = set() for expectation in TestExpectations.EXPECTATIONS.values(): @@ -65,6 +66,8 @@ class ResultSummary(object): self.failures[test_result.test_name] = test_result.failures if expected: self.expected += 1 + if test_result.type == SKIP: + self.expected_skips += 1 else: self.unexpected_results[test_result.test_name] = test_result self.unexpected += 1 diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py b/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py index e9607279b..95d0f2b87 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py @@ -26,7 +26,6 @@ # (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 itertools class TestConfiguration(object): def __init__(self, version, architecture, build_type): @@ -212,8 +211,8 @@ class TestConfigurationConverter(object): break else: return - indices[i] += 1 - for j in range(i + 1, r): + indices[i] += 1 # pylint: disable=W0631 + for j in range(i + 1, r): # pylint: disable=W0631 indices[j] = indices[j - 1] + 1 yield tuple(pool[i] for i in indices) diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py index c367b7591..5c43b6ac6 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py @@ -28,8 +28,6 @@ import unittest -from webkitpy.common.host_mock import MockHost - from webkitpy.layout_tests.models.test_configuration import * @@ -77,7 +75,7 @@ class TestConfigurationTest(unittest.TestCase): self.assertTrue(config_dict[TestConfiguration('xp', 'x86', 'release')]) def query_unknown_key(): - config_dict[TestConfiguration('xp', 'x86', 'debug')] + return config_dict[TestConfiguration('xp', 'x86', 'debug')] self.assertRaises(KeyError, query_unknown_key) self.assertTrue(TestConfiguration('xp', 'x86', 'release') in config_dict) @@ -88,8 +86,6 @@ class TestConfigurationTest(unittest.TestCase): def test_eq(self): self.assertEquals(TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'release')) - host = MockHost() - test_port = host.port_factory.get('test-win-xp', None) self.assertNotEquals(TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')) def test_values(self): diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py index 93ef517f4..9c6d478d4 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py @@ -31,12 +31,10 @@ for layout tests. """ -import itertools -import json import logging import re -from webkitpy.layout_tests.models.test_configuration import TestConfiguration, TestConfigurationConverter +from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter _log = logging.getLogger(__name__) @@ -117,6 +115,7 @@ def strip_comments(line): class ParseError(Exception): def __init__(self, warnings): + super(ParseError, self).__init__() self.warnings = warnings def __str__(self): @@ -400,9 +399,10 @@ class TestExpectationLine(object): def __init__(self): """Initializes a blank-line equivalent of an expectation.""" self.original_string = None + self.filename = None # this is the path to the expectations file for this line self.line_number = None - self.name = None - self.path = None + self.name = None # this is the path in the line itself + self.path = None # this is the normpath of self.name self.modifiers = [] self.parsed_modifiers = [] self.parsed_bug_modifiers = [] @@ -515,6 +515,25 @@ class TestExpectationsModel(object): def get_expectations(self, test): return self._test_to_expectations[test] + def get_expectations_string(self, test): + """Returns the expectatons for the given test as an uppercase string. + If there are no expectations for the test, then "PASS" is returned.""" + expectations = self.get_expectations(test) + retval = [] + + for expectation in expectations: + retval.append(self.expectation_to_string(expectation)) + + return " ".join(retval) + + def expectation_to_string(self, expectation): + """Return the uppercased string equivalent of a given expectation.""" + for item in TestExpectations.EXPECTATIONS.items(): + if item[1] == expectation: + return item[0].upper() + raise ValueError(expectation) + + def add_expectation_line(self, expectation_line, in_skipped=False): """Returns a list of warnings encountered while matching modifiers.""" @@ -525,7 +544,7 @@ class TestExpectationsModel(object): if not in_skipped and self._already_seen_better_match(test, expectation_line): continue - self._clear_expectations_for_test(test, expectation_line) + self._clear_expectations_for_test(test) self._test_to_expectation_line[test] = expectation_line self._add_test(test, expectation_line) @@ -559,7 +578,7 @@ class TestExpectationsModel(object): # FIXME: What is this? self._result_type_to_tests[FAIL].add(test) - def _clear_expectations_for_test(self, test, expectation_line): + def _clear_expectations_for_test(self, test): """Remove prexisting expectations for this test. This happens if we are seeing a more precise path than a previous listing. @@ -571,13 +590,13 @@ class TestExpectationsModel(object): self._remove_from_sets(test, self._timeline_to_tests) self._remove_from_sets(test, self._result_type_to_tests) - def _remove_from_sets(self, test, dict): + def _remove_from_sets(self, test, dict_of_sets_of_tests): """Removes the given test from the sets in the dictionary. Args: test: test to look for dict: dict of sets of files""" - for set_of_tests in dict.itervalues(): + for set_of_tests in dict_of_sets_of_tests.itervalues(): if test in set_of_tests: set_of_tests.remove(test) @@ -782,22 +801,10 @@ class TestExpectations(object): return self._model.get_tests_with_timeline(timeline) def get_expectations_string(self, test): - """Returns the expectatons for the given test as an uppercase string. - If there are no expectations for the test, then "PASS" is returned.""" - expectations = self._model.get_expectations(test) - retval = [] - - for expectation in expectations: - retval.append(self.expectation_to_string(expectation)) - - return " ".join(retval) + return self._model.get_expectations_string(test) def expectation_to_string(self, expectation): - """Return the uppercased string equivalent of a given expectation.""" - for item in self.EXPECTATIONS.items(): - if item[1] == expectation: - return item[0].upper() - raise ValueError(expectation) + return self._model.expectation_to_string(expectation) def matches_an_expected_result(self, test, result, pixel_tests_are_enabled): expected_results = self._model.get_expectations(test) @@ -820,7 +827,8 @@ class TestExpectations(object): warnings = [] for expectation in self._expectations: for warning in expectation.warnings: - warnings.append('%s:%d %s %s' % (self._shorten_filename(expectation.filename), expectation.line_number, warning, expectation.name if expectation.expectations else expectation.original_string)) + warnings.append('%s:%d %s %s' % (self._shorten_filename(expectation.filename), expectation.line_number, + warning, expectation.name if expectation.expectations else expectation.original_string)) if warnings: self._has_warnings = True diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py index 7b589b501..c780dac23 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py @@ -95,7 +95,7 @@ class Base(unittest.TestCase): # Note that all of these tests are written assuming the configuration # being tested is Windows XP, Release build. - def __init__(self, testFunc, setUp=None, tearDown=None, description=None): + def __init__(self, testFunc): host = MockHost() self._port = host.port_factory.get('test-win-xp', None) self._exp = None @@ -123,11 +123,11 @@ BUG_TEST WONTFIX MAC : failures/expected/image.html = IMAGE """ def parse_exp(self, expectations, overrides=None, is_lint_mode=False): - self._expectations_dict = OrderedDict() - self._expectations_dict['expectations'] = expectations + expectations_dict = OrderedDict() + expectations_dict['expectations'] = expectations if overrides: - self._expectations_dict['overrides'] = overrides - self._port.expectations_dict = lambda: self._expectations_dict + expectations_dict['overrides'] = overrides + self._port.expectations_dict = lambda: expectations_dict self._exp = TestExpectations(self._port, self.get_basic_tests(), is_lint_mode) def assert_exp(self, test, result): @@ -274,11 +274,11 @@ class SkippedTests(Base): def check(self, expectations, overrides, skips, lint=False): port = MockHost().port_factory.get('qt') port._filesystem.write_text_file(port._filesystem.join(port.layout_tests_dir(), 'failures/expected/text.html'), 'foo') - self._expectations_dict = OrderedDict() - self._expectations_dict['expectations'] = expectations + expectations_dict = OrderedDict() + expectations_dict['expectations'] = expectations if overrides: - self._expectations_dict['overrides'] = overrides - port.expectations_dict = lambda: self._expectations_dict + expectations_dict['overrides'] = overrides + port.expectations_dict = lambda: expectations_dict port.skipped_layout_tests = lambda tests: set(skips) exp = TestExpectations(port, ['failures/expected/text.html'], lint) @@ -532,7 +532,6 @@ class TestExpectationParserTests(unittest.TestCase): host = MockHost() test_port = host.port_factory.get('test-win-xp', None) test_port.test_exists = lambda test: True - test_config = test_port.test_configuration() full_test_list = [] expectation_line = self._tokenize('') parser = TestExpectationParser(test_port, full_test_list, allow_rebaseline_modifier=False) diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py b/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py index 029094ec4..afea52e60 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py @@ -112,6 +112,7 @@ class TestFailure(object): class FailureTimeout(TestFailure): """Test timed out. We also want to restart DumpRenderTree if this happens.""" def __init__(self, is_reftest=False): + super(FailureTimeout, self).__init__() self.is_reftest = is_reftest def message(self): @@ -124,6 +125,7 @@ class FailureTimeout(TestFailure): class FailureCrash(TestFailure): """DumpRenderTree/WebKitTestRunner crashed.""" def __init__(self, is_reftest=False, process_name='DumpRenderTree', pid=None): + super(FailureCrash, self).__init__() self.process_name = process_name self.pid = pid self.is_reftest = is_reftest @@ -168,6 +170,7 @@ class FailureMissingImage(TestFailure): class FailureImageHashMismatch(TestFailure): """Image hashes didn't match.""" def __init__(self, diff_percent=0): + super(FailureImageHashMismatch, self).__init__() self.diff_percent = diff_percent def message(self): @@ -185,6 +188,7 @@ class FailureReftestMismatch(TestFailure): """The result didn't match the reference rendering.""" def __init__(self, reference_filename=None): + super(FailureReftestMismatch, self).__init__() self.reference_filename = reference_filename self.diff_percent = None @@ -196,6 +200,7 @@ class FailureReftestMismatchDidNotOccur(TestFailure): """Unexpected match between the result and the reference rendering.""" def __init__(self, reference_filename=None): + super(FailureReftestMismatchDidNotOccur, self).__init__() self.reference_filename = reference_filename def message(self): @@ -206,6 +211,7 @@ class FailureReftestNoImagesGenerated(TestFailure): """Both the reftest and the -expected html file didn't generate pixel results.""" def __init__(self, reference_filename=None): + super(FailureReftestNoImagesGenerated, self).__init__() self.reference_filename = reference_filename def message(self): diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py index 3b9ba33d0..e096b171f 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py @@ -45,10 +45,14 @@ class TestFailuresTest(unittest.TestCase): def test_unknown_failure_type(self): class UnknownFailure(TestFailure): - pass + def message(self): + return '' failure_obj = UnknownFailure() self.assertRaises(ValueError, determine_result_type, [failure_obj]) + + def test_message_is_virtual(self): + failure_obj = TestFailure() self.assertRaises(NotImplementedError, failure_obj.message) def test_loads(self): diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_results.py b/Tools/Scripts/webkitpy/layout_tests/models/test_results.py index 51ac505c2..346d5a640 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_results.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_results.py @@ -35,8 +35,8 @@ class TestResult(object): """Data object containing the results of a single test.""" @staticmethod - def loads(str): - return cPickle.loads(str) + def loads(string): + return cPickle.loads(string) def __init__(self, test_name, failures=None, test_run_time=None, has_stderr=False): self.test_name = test_name @@ -54,9 +54,9 @@ class TestResult(object): def __ne__(self, other): return not (self == other) - def has_failure_matching_types(self, *args, **kargs): + def has_failure_matching_types(self, *failure_classes): for failure in self.failures: - if type(failure) in args: + if type(failure) in failure_classes: return True return False diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py index 2a1877407..2240657c1 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py @@ -518,7 +518,7 @@ class ChromiumAndroidDriver(chromium.ChromiumDriver): def _start_once(self, pixel_tests, per_test_args): self._port._run_adb_command(['logcat', '-c']) self._port._run_adb_command(['shell', 'echo'] + self.cmd_line(pixel_tests, per_test_args) + ['>', COMMAND_LINE_FILE]) - start_result = self._port._run_adb_command(['shell', 'am', 'start', '-n', DRT_ACTIVITY_FULL_NAME]) + start_result = self._port._run_adb_command(['shell', 'am', 'start', '-e', 'RunInSubThread', '-n', DRT_ACTIVITY_FULL_NAME]) if start_result.find('Exception') != -1: _log.error('Failed to start DumpRenderTree application. Exception:\n' + start_result) return False diff --git a/Tools/Scripts/webkitpy/layout_tests/port/efl.py b/Tools/Scripts/webkitpy/layout_tests/port/efl.py index 5964dfe52..4e43f8b6e 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/efl.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/efl.py @@ -45,6 +45,7 @@ class EflPort(WebKitPort, PulseAudioSanitizer): self._jhbuild_wrapper_path = self.path_from_webkit_base('Tools', 'efl', 'run-with-jhbuild') self.set_option_default('wrapper', self._jhbuild_wrapper_path) + self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix') def _port_flag_for_scripts(self): return "--efl" @@ -56,6 +57,8 @@ class EflPort(WebKitPort, PulseAudioSanitizer): env = super(EflPort, self).setup_environ_for_server(server_name) env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib') + if self.webprocess_cmd_prefix: + env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix return env def clean_up_test_run(self): diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index e3a13c20f..691c8456b 100755 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py @@ -35,6 +35,7 @@ import optparse import os import signal import sys +import traceback from webkitpy.common.host import Host from webkitpy.common.system import stack_utils @@ -131,6 +132,7 @@ def run(port, options, args, regular_output=sys.stderr, buildbot_output=sys.stdo except Exception: exception_type, exception_value, exception_traceback = sys.exc_info() if exception_type not in (KeyboardInterrupt, TestRunInterruptedException, WorkerException): + print >> sys.stderr, '\n%s raised: %s' % (exception_type.__name__, exception_value) stack_utils.log_traceback(_log.error, exception_traceback) raise finally: @@ -254,6 +256,11 @@ def parse_args(args=None): help="Arguments parsed to Android adb, to select device, etc."), ])) + option_group_definitions.append(("EFL-specific Options", [ + optparse.make_option("--webprocess-cmd-prefix", type="string", + default=False, help="Prefix used when spawning the Web process (Debug mode only)"), + ])) + option_group_definitions.append(("WebKit Options", [ optparse.make_option("--gc-between-tests", action="store_true", default=False, help="Force garbage collection between each test"), @@ -464,6 +471,10 @@ def main(argv=None): # FIXME: is this the best way to handle unsupported port names? print >> sys.stderr, str(e) return EXCEPTIONAL_EXIT_STATUS + except Exception, e: + print >> sys.stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) + traceback.print_exc(file=sys.stderr) + raise logging.getLogger().setLevel(logging.DEBUG if options.verbose else logging.INFO) return run(port, options, args) @@ -472,7 +483,7 @@ def main(argv=None): if '__main__' == __name__: try: sys.exit(main()) - except Exception, e: + except BaseException, e: if e.__class__ in (KeyboardInterrupt, TestRunInterruptedException): sys.exit(INTERRUPTED_EXIT_STATUS) sys.exit(EXCEPTIONAL_EXIT_STATUS) diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py index c106fbf47..ad14bf4ef 100755 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py @@ -51,7 +51,7 @@ from webkitpy.common.host_mock import MockHost from webkitpy.layout_tests import port from webkitpy.layout_tests import run_webkit_tests -from webkitpy.layout_tests.controllers.manager_worker_broker import WorkerException +from webkitpy.layout_tests.controllers.manager import WorkerException from webkitpy.layout_tests.port import Port from webkitpy.layout_tests.port.test import TestPort, TestDriver from webkitpy.test.skip import skip_if @@ -951,11 +951,11 @@ class EndToEndTest(unittest.TestCase): self.assertTrue("multiple-mismatch-success.html" not in json["tests"]["reftests"]["foo"]) self.assertTrue("multiple-both-success.html" not in json["tests"]["reftests"]["foo"]) self.assertEqual(json["tests"]["reftests"]["foo"]["multiple-match-failure.html"], - {"expected": "PASS", "ref_file": "reftests/foo/second-mismatching-ref.html", "actual": "IMAGE", "image_diff_percent": 1, 'is_reftest': True}) + {"expected": "PASS", "actual": "IMAGE", "image_diff_percent": 1, 'is_reftest': True}) self.assertEqual(json["tests"]["reftests"]["foo"]["multiple-mismatch-failure.html"], - {"expected": "PASS", "ref_file": "reftests/foo/matching-ref.html", "actual": "IMAGE", "is_mismatch_reftest": True}) + {"expected": "PASS", "actual": "IMAGE", "is_mismatch_reftest": True}) self.assertEqual(json["tests"]["reftests"]["foo"]["multiple-both-failure.html"], - {"expected": "PASS", "ref_file": "reftests/foo/matching-ref.html", "actual": "IMAGE", "is_mismatch_reftest": True}) + {"expected": "PASS", "actual": "IMAGE", "is_mismatch_reftest": True}) class RebaselineTest(unittest.TestCase, StreamTestingMixin): diff --git a/Tools/Scripts/webkitpy/layout_tests/views/printing.py b/Tools/Scripts/webkitpy/layout_tests/views/printing.py index 3d98c6c59..2dd909930 100644 --- a/Tools/Scripts/webkitpy/layout_tests/views/printing.py +++ b/Tools/Scripts/webkitpy/layout_tests/views/printing.py @@ -31,6 +31,7 @@ import optparse +from webkitpy.tool import grammar from webkitpy.common.net import resultsjsonparser from webkitpy.layout_tests.models.test_expectations import TestExpectations from webkitpy.layout_tests.views.metered_stream import MeteredStream @@ -217,23 +218,21 @@ class Printer(object): return incomplete = total - expected - unexpected + incomplete_str = '' if incomplete: self._write("") incomplete_str = " (%d didn't run)" % incomplete - expected_str = str(expected) - else: - incomplete_str = "" - expected_str = "All %d" % expected if unexpected == 0: - self._write("%s tests ran as expected%s." % - (expected_str, incomplete_str)) - elif expected == 1: - self._write("1 test ran as expected, %d didn't%s:" % - (unexpected, incomplete_str)) + if expected == total: + if expected > 1: + self._write("All %d tests ran as expected." % expected) + else: + self._write("The test ran as expected.") + else: + self._write("%s ran as expected%s." % (grammar.pluralize('test', expected), incomplete_str)) else: - self._write("%d tests ran as expected, %d didn't%s:" % - (expected, unexpected, incomplete_str)) + self._write("%s ran as expected, %d didn't%s:" % (grammar.pluralize('test', expected), unexpected, incomplete_str)) self._write("") def print_test_result(self, result, expected, exp_str, got_str): diff --git a/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py b/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py index 56970a863..1312050e9 100644 --- a/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py @@ -206,11 +206,11 @@ class Testprinter(unittest.TestCase): printer, err, out = self.get_printer(['--print', 'one-line-summary']) printer.print_one_line_summary(1, 1, 0) - self.assertWritten(err, ["All 1 tests ran as expected.\n", "\n"]) + self.assertWritten(err, ["The test ran as expected.\n", "\n"]) printer, err, out = self.get_printer(['--print', 'everything']) printer.print_one_line_summary(1, 1, 0) - self.assertWritten(err, ["All 1 tests ran as expected.\n", "\n"]) + self.assertWritten(err, ["The test ran as expected.\n", "\n"]) printer, err, out = self.get_printer(['--print', 'everything']) printer.print_one_line_summary(2, 1, 1) diff --git a/Tools/Scripts/webkitpy/pylintrc b/Tools/Scripts/webkitpy/pylintrc index dae778d63..bdd040415 100644 --- a/Tools/Scripts/webkitpy/pylintrc +++ b/Tools/Scripts/webkitpy/pylintrc @@ -85,13 +85,15 @@ load-plugins= # W0141: Used builtin function '' # W0212: Access to a protected member X of a client class # W0142: Used * or ** magic +# W0401: Wildcard import X # W0402: Uses of a deprecated module 'string' # W0404: 41: Reimport 'XX' (imported line NN) # W0511: TODO # W0603: Using the global statement +# W0614: Unused import X from wildcard import # W0703: Catch "Exception" # W1201: Specify string format arguments as logging function parameters -disable=C0103,C0111,C0302,I0010,I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,W0122,W0141,W0142,W0212,W0402,W0404,W0511,W0603,W0703,W1201 +disable=C0103,C0111,C0302,I0010,I0011,R0201,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,W0122,W0141,W0142,W0212,W0401,W0402,W0404,W0511,W0603,W0614,W0703,W1201 [REPORTS] diff --git a/Tools/Scripts/webkitpy/test/test_finder.py b/Tools/Scripts/webkitpy/test/finder.py index 3a90197e9..132072d82 100644 --- a/Tools/Scripts/webkitpy/test/test_finder.py +++ b/Tools/Scripts/webkitpy/test/finder.py @@ -31,7 +31,7 @@ import sys _log = logging.getLogger(__name__) -class TestDirectoryTree(object): +class _DirectoryTree(object): def __init__(self, filesystem, top_directory, starting_subdirectory): self.filesystem = filesystem self.top_directory = filesystem.realpath(top_directory) @@ -63,7 +63,6 @@ class TestDirectoryTree(object): return realpath.replace(self.top_directory + self.filesystem.sep, '') return None - def clean(self): """Delete all .pyc files in the tree that have no matching .py file.""" _log.debug("Cleaning orphaned *.pyc files from: %s" % self.search_directory) @@ -74,13 +73,13 @@ class TestDirectoryTree(object): self.filesystem.remove(filename) -class TestFinder(object): +class Finder(object): def __init__(self, filesystem): self.filesystem = filesystem self.trees = [] def add_tree(self, top_directory, starting_subdirectory=None): - self.trees.append(TestDirectoryTree(self.filesystem, top_directory, starting_subdirectory)) + self.trees.append(_DirectoryTree(self.filesystem, top_directory, starting_subdirectory)) def additional_paths(self, paths): return [tree.top_directory for tree in self.trees if tree.top_directory not in paths] diff --git a/Tools/Scripts/webkitpy/test/test_finder_unittest.py b/Tools/Scripts/webkitpy/test/finder_unittest.py index 5b6b3b030..09048b159 100644 --- a/Tools/Scripts/webkitpy/test/test_finder_unittest.py +++ b/Tools/Scripts/webkitpy/test/finder_unittest.py @@ -25,10 +25,10 @@ import unittest from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.outputcapture import OutputCapture -from webkitpy.test.test_finder import TestFinder +from webkitpy.test.finder import Finder -class TestFinderTest(unittest.TestCase): +class FinderTest(unittest.TestCase): def setUp(self): files = { '/foo/bar/baz.py': '', @@ -40,7 +40,7 @@ class TestFinderTest(unittest.TestCase): '/tmp/another_unittest.py': '', } self.fs = MockFileSystem(files) - self.finder = TestFinder(self.fs) + self.finder = Finder(self.fs) self.finder.add_tree('/foo', 'bar') self.finder.add_tree('/foo2') @@ -49,7 +49,7 @@ class TestFinderTest(unittest.TestCase): self.root_logger = logging.getLogger() self.log_handler = None for h in self.root_logger.handlers: - if getattr(h, 'name', None) == 'webkitpy.test.main': + if getattr(h, 'name', None) == 'webkitpy.test.printer': self.log_handler = h break if self.log_handler: diff --git a/Tools/Scripts/webkitpy/test/main.py b/Tools/Scripts/webkitpy/test/main.py index c5dc39433..2048d9e59 100644 --- a/Tools/Scripts/webkitpy/test/main.py +++ b/Tools/Scripts/webkitpy/test/main.py @@ -25,24 +25,24 @@ import logging import optparse -import os import StringIO import sys import traceback import unittest from webkitpy.common.system.filesystem import FileSystem -from webkitpy.common.system import outputcapture -from webkitpy.test.test_finder import TestFinder -from webkitpy.test.runner import TestRunner +from webkitpy.test.finder import Finder +from webkitpy.test.printer import Printer +from webkitpy.test.runner import Runner _log = logging.getLogger(__name__) class Tester(object): def __init__(self, filesystem=None): - self.finder = TestFinder(filesystem or FileSystem()) - self.stream = sys.stderr + self.finder = Finder(filesystem or FileSystem()) + self.printer = Printer(sys.stderr) + self._options = None def add_tree(self, top_directory, starting_subdirectory=None): self.finder.add_tree(top_directory, starting_subdirectory) @@ -50,13 +50,13 @@ class Tester(object): def _parse_args(self): parser = optparse.OptionParser(usage='usage: %prog [options] [args...]') parser.add_option('-a', '--all', action='store_true', default=False, - help='run all the tests'), + help='run all the tests') parser.add_option('-c', '--coverage', action='store_true', default=False, - help='generate code coverage info (requires http://pypi.python.org/pypi/coverage)'), + help='generate code coverage info (requires http://pypi.python.org/pypi/coverage)') parser.add_option('-q', '--quiet', action='store_true', default=False, - help='run quietly (errors, warnings, and progress only)'), + help='run quietly (errors, warnings, and progress only)') parser.add_option('-t', '--timing', action='store_true', default=False, - help='display per-test execution time (implies --verbose)'), + help='display per-test execution time (implies --verbose)') parser.add_option('-v', '--verbose', action='count', default=0, help='verbose output (specify once for individual test results, twice for debug messages)') parser.add_option('--skip-integrationtests', action='store_true', default=False, @@ -69,72 +69,9 @@ class Tester(object): return parser.parse_args() - def _configure(self, options): - self._options = options - - if options.timing: - # --timing implies --verbose - options.verbose = max(options.verbose, 1) - - log_level = logging.INFO - if options.quiet: - log_level = logging.WARNING - elif options.verbose == 2: - log_level = logging.DEBUG - self._configure_logging(log_level) - - def _configure_logging(self, log_level): - """Configure the root logger. - - Configure the root logger not to log any messages from webkitpy -- - except for messages from the autoinstall module. Also set the - logging level as described below. - """ - handler = logging.StreamHandler(self.stream) - # We constrain the level on the handler rather than on the root - # logger itself. This is probably better because the handler is - # configured and known only to this module, whereas the root logger - # is an object shared (and potentially modified) by many modules. - # Modifying the handler, then, is less intrusive and less likely to - # interfere with modifications made by other modules (e.g. in unit - # tests). - handler.name = __name__ - handler.setLevel(log_level) - formatter = logging.Formatter("%(message)s") - handler.setFormatter(formatter) - - logger = logging.getLogger() - logger.addHandler(handler) - logger.setLevel(logging.NOTSET) - - # Filter out most webkitpy messages. - # - # Messages can be selectively re-enabled for this script by updating - # this method accordingly. - def filter(record): - """Filter out autoinstall and non-third-party webkitpy messages.""" - # FIXME: Figure out a way not to use strings here, for example by - # using syntax like webkitpy.test.__name__. We want to be - # sure not to import any non-Python 2.4 code, though, until - # after the version-checking code has executed. - if (record.name.startswith("webkitpy.common.system.autoinstall") or - record.name.startswith("webkitpy.test")): - return True - if record.name.startswith("webkitpy"): - return False - return True - - testing_filter = logging.Filter() - testing_filter.filter = filter - - # Display a message so developers are not mystified as to why - # logging does not work in the unit tests. - _log.info("Suppressing most webkitpy logging while running unit tests.") - handler.addFilter(testing_filter) - def run(self): - options, args = self._parse_args() - self._configure(options) + self._options, args = self._parse_args() + self.printer.configure(self._options) self.finder.clean_trees() @@ -149,7 +86,7 @@ class Tester(object): if self._options.coverage: try: import webkitpy.thirdparty.autoinstalled.coverage as coverage - except ImportError, e: + except ImportError: _log.error("Failed to import 'coverage'; can't generate coverage numbers.") return False cov = coverage.coverage() @@ -169,7 +106,7 @@ class Tester(object): # produces lousy error messages for bad modules. try: __import__(name) - except ImportError, e: + except ImportError: _log.fatal('Failed to import %s:' % name) self._log_exception() return False @@ -177,11 +114,9 @@ class Tester(object): suites.append(loader.loadTestsFromName(name, None)) test_suite = unittest.TestSuite(suites) - test_runner = TestRunner(self.stream, self._options, loader) + test_runner = Runner(self.printer, self._options, loader) _log.debug("Running the tests.") - if self._options.pass_through: - outputcapture.OutputCapture.stream_wrapper = _CaptureAndPassThroughStream result = test_runner.run(test_suite) if self._options.coverage: cov.stop() @@ -194,32 +129,3 @@ class Tester(object): traceback.print_exc(file=s) for l in s.buflist: _log.error(' ' + l.rstrip()) - - -class _CaptureAndPassThroughStream(object): - def __init__(self, stream): - self._buffer = StringIO.StringIO() - self._stream = stream - - def write(self, msg): - self._stream.write(msg) - - # Note that we don't want to capture any output generated by the debugger - # because that could cause the results of capture_output() to be invalid. - if not self._message_is_from_pdb(): - self._buffer.write(msg) - - def _message_is_from_pdb(self): - # We will assume that if the pdb module is in the stack then the output - # is being generated by the python debugger (or the user calling something - # from inside the debugger). - import inspect - import pdb - stack = inspect.stack() - return any(frame[1] == pdb.__file__.replace('.pyc', '.py') for frame in stack) - - def flush(self): - self._stream.flush() - - def getvalue(self): - return self._buffer.getvalue() diff --git a/Tools/Scripts/webkitpy/test/main_unittest.py b/Tools/Scripts/webkitpy/test/main_unittest.py index 1a60beef3..2cf6df4a2 100644 --- a/Tools/Scripts/webkitpy/test/main_unittest.py +++ b/Tools/Scripts/webkitpy/test/main_unittest.py @@ -40,7 +40,7 @@ class TesterTest(unittest.TestCase): root_handlers = root_logger.handlers root_logger.handlers = [] - tester.stream = errors + tester.printer.stream = errors tester.finder.find_names = lambda args, skip_integration, run_all: [] oc = OutputCapture() try: diff --git a/Tools/Scripts/webkitpy/test/printer.py b/Tools/Scripts/webkitpy/test/printer.py new file mode 100644 index 000000000..77e28b8d1 --- /dev/null +++ b/Tools/Scripts/webkitpy/test/printer.py @@ -0,0 +1,182 @@ +# Copyright (C) 2012 Google, Inc. +# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 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. + +import logging +import re +import StringIO + +from webkitpy.common.system import outputcapture + +_log = logging.getLogger(__name__) + + +class Printer(object): + def __init__(self, stream, options=None): + self.stream = stream + self.options = options + self.test_description = re.compile("(\w+) \(([\w.]+)\)") + + def test_name(self, test): + m = self.test_description.match(str(test)) + return "%s.%s" % (m.group(2), m.group(1)) + + def configure(self, options): + self.options = options + + if options.timing: + # --timing implies --verbose + options.verbose = max(options.verbose, 1) + + log_level = logging.INFO + if options.quiet: + log_level = logging.WARNING + elif options.verbose == 2: + log_level = logging.DEBUG + + handler = logging.StreamHandler(self.stream) + # We constrain the level on the handler rather than on the root + # logger itself. This is probably better because the handler is + # configured and known only to this module, whereas the root logger + # is an object shared (and potentially modified) by many modules. + # Modifying the handler, then, is less intrusive and less likely to + # interfere with modifications made by other modules (e.g. in unit + # tests). + handler.name = __name__ + handler.setLevel(log_level) + formatter = logging.Formatter("%(message)s") + handler.setFormatter(formatter) + + logger = logging.getLogger() + logger.addHandler(handler) + logger.setLevel(logging.NOTSET) + + # Filter out most webkitpy messages. + # + # Messages can be selectively re-enabled for this script by updating + # this method accordingly. + def filter_records(record): + """Filter out autoinstall and non-third-party webkitpy messages.""" + # FIXME: Figure out a way not to use strings here, for example by + # using syntax like webkitpy.test.__name__. We want to be + # sure not to import any non-Python 2.4 code, though, until + # after the version-checking code has executed. + if (record.name.startswith("webkitpy.common.system.autoinstall") or + record.name.startswith("webkitpy.test")): + return True + if record.name.startswith("webkitpy"): + return False + return True + + testing_filter = logging.Filter() + testing_filter.filter = filter_records + + # Display a message so developers are not mystified as to why + # logging does not work in the unit tests. + _log.info("Suppressing most webkitpy logging while running unit tests.") + handler.addFilter(testing_filter) + + if self.options.pass_through: + outputcapture.OutputCapture.stream_wrapper = _CaptureAndPassThroughStream + + def print_started_test(self, test_name): + if self.options.verbose: + self.stream.write(test_name) + + def print_finished_test(self, result, test_name, test_time, failure, err): + timing = '' + if self.options.timing: + timing = ' %.4fs' % test_time + if self.options.verbose: + if failure: + msg = ' failed' + elif err: + msg = ' erred' + else: + msg = ' passed' + self.stream.write(msg + timing + '\n') + else: + if failure: + msg = 'F' + elif err: + msg = 'E' + else: + msg = '.' + self.stream.write(msg) + + def print_result(self, result, run_time): + self.stream.write('\n') + + for (test, err) in result.errors: + self.stream.write("=" * 80 + '\n') + self.stream.write("ERROR: " + self.test_name(test) + '\n') + self.stream.write("-" * 80 + '\n') + for line in err.splitlines(): + self.stream.write(line + '\n') + self.stream.write('\n') + + for (test, failure) in result.failures: + self.stream.write("=" * 80 + '\n') + self.stream.write("FAILURE: " + self.test_name(test) + '\n') + self.stream.write("-" * 80 + '\n') + for line in failure.splitlines(): + self.stream.write(line + '\n') + self.stream.write('\n') + + self.stream.write('-' * 80 + '\n') + self.stream.write('Ran %d test%s in %.3fs\n' % + (result.testsRun, result.testsRun != 1 and "s" or "", run_time)) + + if result.wasSuccessful(): + self.stream.write('\nOK\n') + else: + self.stream.write('FAILED (failures=%d, errors=%d)\n' % + (len(result.failures), len(result.errors))) + + +class _CaptureAndPassThroughStream(object): + def __init__(self, stream): + self._buffer = StringIO.StringIO() + self._stream = stream + + def write(self, msg): + self._stream.write(msg) + + # Note that we don't want to capture any output generated by the debugger + # because that could cause the results of capture_output() to be invalid. + if not self._message_is_from_pdb(): + self._buffer.write(msg) + + def _message_is_from_pdb(self): + # We will assume that if the pdb module is in the stack then the output + # is being generated by the python debugger (or the user calling something + # from inside the debugger). + import inspect + import pdb + stack = inspect.stack() + return any(frame[1] == pdb.__file__.replace('.pyc', '.py') for frame in stack) + + def flush(self): + self._stream.flush() + + def getvalue(self): + return self._buffer.getvalue() diff --git a/Tools/Scripts/webkitpy/test/runner.py b/Tools/Scripts/webkitpy/test/runner.py index e190f2cd4..9c952075e 100644 --- a/Tools/Scripts/webkitpy/test/runner.py +++ b/Tools/Scripts/webkitpy/test/runner.py @@ -23,7 +23,6 @@ """code to actually run a list of python tests.""" import logging -import re import time import unittest @@ -31,16 +30,11 @@ import unittest _log = logging.getLogger(__name__) -class TestRunner(object): - def __init__(self, stream, options, loader): +class Runner(object): + def __init__(self, printer, options, loader): self.options = options - self.stream = stream + self.printer = printer self.loader = loader - self.test_description = re.compile("(\w+) \(([\w.]+)\)") - - def test_name(self, test): - m = self.test_description.match(str(test)) - return "%s.%s" % (m.group(2), m.group(1)) def all_test_names(self, suite): names = [] @@ -48,7 +42,7 @@ class TestRunner(object): for t in suite._tests: names.extend(self.all_test_names(t)) else: - names.append(self.test_name(suite)) + names.append(self.printer.test_name(suite)) return names def run(self, suite): @@ -57,8 +51,7 @@ class TestRunner(object): result = unittest.TestResult() stop = run_start_time for test_name in all_test_names: - if self.options.verbose: - self.stream.write(test_name) + self.printer.print_started_test(test_name) num_failures = len(result.failures) num_errors = len(result.errors) @@ -75,58 +68,8 @@ class TestRunner(object): failure = result.failures[num_failures][1] elif len(result.errors) > num_errors: err = result.errors[num_errors][1] - self.write_result(result, test_name, stop - start, failure, err) + self.printer.print_finished_test(result, test_name, stop - start, failure, err) - self.write_summary(result, stop - run_start_time) + self.printer.print_result(result, stop - run_start_time) return result - - def write_result(self, result, test_name, test_time, failure=None, err=None): - timing = '' - if self.options.timing: - timing = ' %.4fs' % test_time - if self.options.verbose: - if failure: - msg = ' failed' - elif err: - msg = ' erred' - else: - msg = ' passed' - self.stream.write(msg + timing + '\n') - else: - if failure: - msg = 'F' - elif err: - msg = 'E' - else: - msg = '.' - self.stream.write(msg) - - def write_summary(self, result, run_time): - self.stream.write('\n') - - for (test, err) in result.errors: - self.stream.write("=" * 80 + '\n') - self.stream.write("ERROR: " + self.test_name(test) + '\n') - self.stream.write("-" * 80 + '\n') - for line in err.splitlines(): - self.stream.write(line + '\n') - self.stream.write('\n') - - for (test, failure) in result.failures: - self.stream.write("=" * 80 + '\n') - self.stream.write("FAILURE: " + self.test_name(test) + '\n') - self.stream.write("-" * 80 + '\n') - for line in failure.splitlines(): - self.stream.write(line + '\n') - self.stream.write('\n') - - self.stream.write('-' * 80 + '\n') - self.stream.write('Ran %d test%s in %.3fs\n' % - (result.testsRun, result.testsRun != 1 and "s" or "", run_time)) - - if result.wasSuccessful(): - self.stream.write('\nOK\n') - else: - self.stream.write('FAILED (failures=%d, errors=%d)\n' % - (len(result.failures), len(result.errors))) diff --git a/Tools/Scripts/webkitpy/test/runner_unittest.py b/Tools/Scripts/webkitpy/test/runner_unittest.py index e2ea31aa1..1cf0146fb 100644 --- a/Tools/Scripts/webkitpy/test/runner_unittest.py +++ b/Tools/Scripts/webkitpy/test/runner_unittest.py @@ -25,7 +25,8 @@ import StringIO import unittest from webkitpy.tool.mocktool import MockOptions -from webkitpy.test.runner import TestRunner +from webkitpy.test.printer import Printer +from webkitpy.test.runner import Runner class FakeModuleSuite(object): @@ -74,7 +75,7 @@ class RunnerTest(unittest.TestCase): loader = FakeLoader(('test1 (Foo)', '.', ''), ('test2 (Foo)', 'F', 'test2\nfailed'), ('test3 (Foo)', 'E', 'test3\nerred')) - result = TestRunner(stream, options, loader).run(loader.top_suite()) + result = Runner(Printer(stream, options), options, loader).run(loader.top_suite()) self.assertFalse(result.wasSuccessful()) self.assertEquals(result.testsRun, 3) self.assertEquals(len(result.failures), 1) @@ -87,7 +88,7 @@ class RunnerTest(unittest.TestCase): loader = FakeLoader(('test1 (Foo)', '.', ''), ('test2 (Foo)', 'F', 'test2\nfailed'), ('test3 (Foo)', 'E', 'test3\nerred')) - result = TestRunner(stream, options, loader).run(loader.top_suite()) + result = Runner(Printer(stream, options), options, loader).run(loader.top_suite()) self.assertFalse(result.wasSuccessful()) self.assertEquals(result.testsRun, 3) self.assertEquals(len(result.failures), 1) @@ -100,7 +101,7 @@ class RunnerTest(unittest.TestCase): loader = FakeLoader(('test1 (Foo)', '.', ''), ('test2 (Foo)', 'F', 'test2\nfailed'), ('test3 (Foo)', 'E', 'test3\nerred')) - result = TestRunner(stream, options, loader).run(loader.top_suite()) + result = Runner(Printer(stream, options), options, loader).run(loader.top_suite()) self.assertFalse(result.wasSuccessful()) self.assertEquals(result.testsRun, 3) self.assertEquals(len(result.failures), 1) diff --git a/Tools/Scripts/webkitpy/tool/commands/queues.py b/Tools/Scripts/webkitpy/tool/commands/queues.py index 2af08b718..e8db17c7b 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues.py @@ -38,6 +38,7 @@ from optparse import make_option from StringIO import StringIO from webkitpy.common.config.committervalidator import CommitterValidator +from webkitpy.common.config.ports import DeprecatedPort from webkitpy.common.net.bugzilla import Attachment from webkitpy.common.net.statusserver import StatusServer from webkitpy.common.system.deprecated_logging import error, log @@ -257,10 +258,17 @@ class AbstractPatchQueue(AbstractQueue): class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler, CommitQueueTaskDelegate): name = "commit-queue" + port_name = "chromium-xvfb" + + def __init__(self): + AbstractPatchQueue.__init__(self) + self.port = DeprecatedPort.port(self.port_name) # AbstractPatchQueue methods def begin_work_queue(self): + # FIXME: This violates abstraction + self._tool._deprecated_port = self.port AbstractPatchQueue.begin_work_queue(self) self.committer_validator = CommitterValidator(self._tool) self._expected_failures = ExpectedFailures() @@ -305,7 +313,7 @@ class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler, CommitQueueTaskD # CommitQueueTaskDelegate methods def run_command(self, command): - self.run_webkit_patch(command) + self.run_webkit_patch(command + [self.port.flag()]) def command_passed(self, message, patch): self._update_status(message, patch=patch) diff --git a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py index 1c2d57b1c..1914ccd4b 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py @@ -49,7 +49,7 @@ class TestCommitQueue(CommitQueue): CommitQueue.__init__(self) if tool: self.bind_to_tool(tool) - self._options = MockOptions(confirm=False, parent_command="commit-queue") + self._options = MockOptions(confirm=False, parent_command="commit-queue", port=None) def begin_work_queue(self): output_capture = OutputCapture() @@ -231,8 +231,8 @@ class CommitQueueTest(QueuesTest): def test_commit_queue(self): tool = MockTool() - tool.filesystem.write_text_file('/mock-results/full_results.json', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. - tool.filesystem.write_text_file('/mock-results/webkit_unit_tests_output.xml', '') + tool.filesystem.write_text_file('/tmp/layout-test-results/full_results.json', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. + tool.filesystem.write_text_file('/tmp/layout-test-results/webkit_unit_tests_output.xml', '') expected_stderr = { "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue"), "next_work_item": "", @@ -269,7 +269,7 @@ MOCK: release_work_item: commit-queue 10000 queue = CommitQueue() def mock_run_webkit_patch(command): - if command == ['clean'] or command == ['update']: + if command[0] == 'clean' or command[0] == 'update': # We want cleaning to succeed so we can error out on a step # that causes the commit-queue to reject the patch. return @@ -298,7 +298,7 @@ MOCK: release_work_item: commit-queue 10000 queue = CommitQueue() def mock_run_webkit_patch(command): - if command == ['clean'] or command == ['update']: + if command[0] == 'clean' or command[0] == 'update': # We want cleaning to succeed so we can error out on a step # that causes the commit-queue to reject the patch. return @@ -310,29 +310,29 @@ MOCK: release_work_item: commit-queue 10000 def test_rollout(self): tool = MockTool(log_executive=True) - tool.filesystem.write_text_file('/mock-results/full_results.json', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. - tool.filesystem.write_text_file('/mock-results/webkit_unit_tests_output.xml', '') + tool.filesystem.write_text_file('/tmp/layout-test-results/full_results.json', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. + tool.filesystem.write_text_file('/tmp/layout-test-results/webkit_unit_tests_output.xml', '') tool.buildbot.light_tree_on_fire() expected_stderr = { "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue"), "next_work_item": "", - "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'], cwd=/mock-checkout + "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean', '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Cleaned working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update', '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Updated working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10000], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10000, '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Applied patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'validate-changelog', '--non-interactive', 10000], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'validate-changelog', '--non-interactive', 10000, '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue ChangeLog validated -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=both'], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=both', '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Built patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive', '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Passed tests -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 10000], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 10000, '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Landed patch MOCK: update_status: commit-queue Pass MOCK: release_work_item: commit-queue 10000 -""", +""" % {"port_name": CommitQueue.port_name}, "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.' and additional comment 'Mock error message'\n", "handle_script_error": "ScriptError error message\n\nMOCK output\n", } @@ -346,19 +346,19 @@ MOCK: release_work_item: commit-queue 10000 expected_stderr = { "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue"), "next_work_item": "", - "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean'], cwd=/mock-checkout + "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'clean', '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Cleaned working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update', '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Updated working directory -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10005], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 10005, '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Applied patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'validate-changelog', '--non-interactive', 10005], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'validate-changelog', '--non-interactive', 10005, '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue ChangeLog validated -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 10005], cwd=/mock-checkout +MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 10005, '--port=%(port_name)s'], cwd=/mock-checkout MOCK: update_status: commit-queue Landed patch MOCK: update_status: commit-queue Pass MOCK: release_work_item: commit-queue 10005 -""", +""" % {"port_name": CommitQueue.port_name}, "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '10005' with comment 'Rejecting attachment 10005 from commit-queue.' and additional comment 'Mock error message'\n", "handle_script_error": "ScriptError error message\n\nMOCK output\n", } @@ -382,8 +382,8 @@ MOCK: release_work_item: commit-queue 10005 def test_manual_reject_during_processing(self): queue = SecondThoughtsCommitQueue(MockTool()) queue.begin_work_queue() - queue._tool.filesystem.write_text_file('/mock-results/full_results.json', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. - queue._tool.filesystem.write_text_file('/mock-results/webkit_unit_tests_output.xml', '') + queue._tool.filesystem.write_text_file('/tmp/layout-test-results/full_results.json', '') # Otherwise the commit-queue will hit a KeyError trying to read the results from the MockFileSystem. + queue._tool.filesystem.write_text_file('/tmp/layout-test-results/webkit_unit_tests_output.xml', '') queue._options = Mock() queue._options.port = None expected_stderr = """MOCK: update_status: commit-queue Cleaned working directory diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py index cb7254ba2..c214a339c 100644 --- a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py +++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py @@ -398,10 +398,10 @@ class Rebaseline(AbstractParallelRebaselineCommand): return self._tool.user.prompt_with_list("Which test(s) to rebaseline for %s:" % builder.name(), failing_tests, can_choose_multiple=True) def _suffixes_to_update(self, options): - suffixes = [] + suffixes = set() for suffix_list in options.suffixes: - suffixes += suffix_list.split(",") - return suffixes + suffixes |= set(suffix_list.split(",")) + return list(suffixes) def execute(self, options, args, tool): if options.builders: diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py index a3b9efaeb..433906b8c 100644 --- a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py @@ -465,18 +465,18 @@ MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'txt', 'mock/path tool.executive = MockExecutive(should_log=True) - expected_stdout = """rebaseline-json: {'mock/path/to/test.html': {'MOCK builder2': ['txt', 'png', 'wav'], 'MOCK builder': ['txt', 'png', 'wav'], 'MOCK builder3': ['txt', 'png', 'wav']}, 'mock/path/to/test2.html': {'MOCK builder2': ['txt', 'png', 'wav'], 'MOCK builder': ['txt', 'png', 'wav'], 'MOCK builder3': ['txt', 'png', 'wav']}} + expected_stdout = """rebaseline-json: {'mock/path/to/test.html': {'MOCK builder2': ['wav', 'txt', 'png'], 'MOCK builder': ['wav', 'txt', 'png'], 'MOCK builder3': ['wav', 'txt', 'png']}, 'mock/path/to/test2.html': {'MOCK builder2': ['wav', 'txt', 'png'], 'MOCK builder': ['wav', 'txt', 'png'], 'MOCK builder3': ['wav', 'txt', 'png']}} """ - expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png,wav', '--builder', 'MOCK builder2', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout -MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png,wav', '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout -MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png,wav', '--builder', 'MOCK builder2', '--test', 'mock/path/to/test2.html'], cwd=/mock-checkout -MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png,wav', '--builder', 'MOCK builder', '--test', 'mock/path/to/test2.html'], cwd=/mock-checkout + expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'wav,txt,png', '--builder', 'MOCK builder2', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout +MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'wav,txt,png', '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout +MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'wav,txt,png', '--builder', 'MOCK builder2', '--test', 'mock/path/to/test2.html'], cwd=/mock-checkout +MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'wav,txt,png', '--builder', 'MOCK builder', '--test', 'mock/path/to/test2.html'], cwd=/mock-checkout MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'wav,txt,png', 'mock/path/to/test.html'], cwd=/mock-checkout MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'wav,txt,png', 'mock/path/to/test2.html'], cwd=/mock-checkout """ - OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True, builders=["MOCK builder,MOCK builder2", "MOCK builder3"], suffixes=["txt", "png,wav"], verbose=True), ["mock/path/to/test.html", "mock/path/to/test2.html"], tool], expected_stdout=expected_stdout, expected_stderr=expected_stderr) + OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True, builders=["MOCK builder,MOCK builder2", "MOCK builder3"], suffixes=["txt,png", "png,wav,txt"], verbose=True), ["mock/path/to/test.html", "mock/path/to/test2.html"], tool], expected_stdout=expected_stdout, expected_stderr=expected_stderr) finally: builders._exact_matches = old_exact_matches diff --git a/Tools/TestWebKitAPI/Configurations/Base.xcconfig b/Tools/TestWebKitAPI/Configurations/Base.xcconfig index e64af3b1f..412c440d9 100644 --- a/Tools/TestWebKitAPI/Configurations/Base.xcconfig +++ b/Tools/TestWebKitAPI/Configurations/Base.xcconfig @@ -63,18 +63,15 @@ REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; WEBKIT_UMBRELLA_FRAMEWORKS_DIR = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; WEBCORE_PRIVATE_HEADERS_DIR = $(WEBKIT_UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp index 6f5fba2d8..ff064a02d 100644 --- a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp +++ b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp @@ -133,7 +133,9 @@ '<(PRODUCT_DIR)/TestWebKitAPI_apk', '--ant-args', '-DPRODUCT_DIR=<(ant_build_out)', - '--ant-compile' + '--ant-compile', + '--app_abi', + '<(android_app_abi)', ], }], }], diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj index f5ff80418..50045f3bb 100644 --- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj +++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 0BCD833514857CE400EA2003 /* HashMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BCD833414857CE400EA2003 /* HashMap.cpp */; }; 0BCD856A1485C98B00EA2003 /* TemporaryChange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */; }; + 0F17BBD615AF6C4D007AB753 /* WebCoreStatisticsWithNoWebProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F17BBD415AF6C4D007AB753 /* WebCoreStatisticsWithNoWebProcess.cpp */; }; 0FC6C4CC141027E0005B7F0C /* RedBlackTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */; }; 0FC6C4CF141034AD005B7F0C /* MetaAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */; }; 1A02C84F125D4A8400E3F4BD /* Find.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A02C84E125D4A8400E3F4BD /* Find.cpp */; }; @@ -19,6 +20,7 @@ 1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */; }; 1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; }; 1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; }; + 261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */; }; 26DF5A5E15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26DF5A5D15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm */; }; 26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; }; 333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */; }; @@ -229,6 +231,7 @@ /* Begin PBXFileReference section */ 0BCD833414857CE400EA2003 /* HashMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HashMap.cpp; path = WTF/HashMap.cpp; sourceTree = "<group>"; }; 0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TemporaryChange.cpp; path = WTF/TemporaryChange.cpp; sourceTree = "<group>"; }; + 0F17BBD415AF6C4D007AB753 /* WebCoreStatisticsWithNoWebProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreStatisticsWithNoWebProcess.cpp; sourceTree = "<group>"; }; 0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RedBlackTree.cpp; path = WTF/RedBlackTree.cpp; sourceTree = "<group>"; }; 0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MetaAllocator.cpp; path = WTF/MetaAllocator.cpp; sourceTree = "<group>"; }; 1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; }; @@ -238,6 +241,7 @@ 1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ForceRepaint.cpp; sourceTree = "<group>"; }; 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-accelerated-compositing.html"; sourceTree = "<group>"; }; 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleControllerMac.mm; sourceTree = "<group>"; }; + 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetAndUpdateCacheModel.mm; sourceTree = "<group>"; }; 26DF5A5D15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CancelLoadFromResourceLoadDelegate.mm; sourceTree = "<group>"; }; 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = CancelLoadFromResourceLoadDelegate.html; sourceTree = "<group>"; }; 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; }; @@ -596,6 +600,7 @@ BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */, BC90995D12567BC100083756 /* WKString.cpp */, BC9099931256ACF100083756 /* WKStringJSString.cpp */, + 0F17BBD415AF6C4D007AB753 /* WebCoreStatisticsWithNoWebProcess.cpp */, ); path = WebKit2; sourceTree = "<group>"; @@ -692,6 +697,7 @@ E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */, 517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */, 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */, + 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */, 52B8CF9515868CF000281053 /* SetDocumentURI.mm */, C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */, 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */, @@ -929,6 +935,8 @@ 26DF5A5E15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm in Sources */, F660AA0D15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp in Sources */, F660AA1315A619C9003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */, + 0F17BBD615AF6C4D007AB753 /* WebCoreStatisticsWithNoWebProcess.cpp in Sources */, + 261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WebCoreStatisticsWithNoWebProcess.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WebCoreStatisticsWithNoWebProcess.cpp new file mode 100644 index 000000000..f71f186b7 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2/WebCoreStatisticsWithNoWebProcess.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "PlatformUtilities.h" +#include "test.h" + +namespace TestWebKitAPI { + +static bool done; + +// Callback for WKContextGetStatistics. +static void wkContextGetStatisticsCallback(WKDictionaryRef statistics, WKErrorRef error, void* functionContext) +{ + EXPECT_NOT_NULL(error); + done = true; +} + +TEST(WebKit2, WebCoreStatisticsWithNoWebProcess) +{ + WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate()); + + WKContextGetStatistics(context.get(), 0, wkContextGetStatisticsCallback); + + Util::run(&done); +} + +} // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm b/Tools/TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm new file mode 100644 index 000000000..eed1f8180 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <wtf/RetainPtr.h> + +#import <WebKit/WebView.h> +#import <WebKit/WebPreferences.h> + +@interface WebView (WebViewOtherInternal) ++ (WebCacheModel)_cacheModel; +@end + +namespace TestWebKitAPI { + +TEST(WebKit1, SetAndUpdateCacheModelInitialModel) +{ + EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]); + + RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]); + + EXPECT_EQ((int)WebCacheModelDocumentBrowser, (int)[WebView _cacheModel]); +} + +TEST(WebKit1, SetAndUpdateCacheModelStandardPreferenceChange) +{ + EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]); + + WebPreferences *standardPreferences = [WebPreferences standardPreferences]; + EXPECT_EQ((int)WebCacheModelDocumentBrowser, (int)[WebView _cacheModel]); + + [standardPreferences setCacheModel:WebCacheModelPrimaryWebBrowser]; + EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]); + + [standardPreferences setCacheModel:WebCacheModelDocumentViewer]; + EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]); +} + +TEST(WebKit1, SetAndUpdateCacheModelPreferencesChangeMix) +{ + // On change, the cache model always take the highest value of any preference bound to a WebView. + EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]); + + WebPreferences *standardPreferences = [WebPreferences standardPreferences]; + RetainPtr<WebPreferences> customPreferences(AdoptNS, [[WebPreferences alloc] initWithIdentifier:@"SetAndUpdateCacheModelPreferencesChangeMix"]); + + // 1) The customPreferences is not set on a view. + EXPECT_EQ((int)WebCacheModelDocumentBrowser, (int)[WebView _cacheModel]); + + [standardPreferences setCacheModel:WebCacheModelPrimaryWebBrowser]; + EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]); + + [standardPreferences setCacheModel:WebCacheModelDocumentViewer]; + EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]); + [customPreferences.get() setCacheModel:WebCacheModelPrimaryWebBrowser]; + EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]); + + + // 2) The cache model should follow the highest value of cache model between the two preferences. + RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]); + [webView.get() setPreferences:customPreferences.get()]; + EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]); + + [customPreferences.get() setCacheModel:WebCacheModelDocumentBrowser]; + EXPECT_EQ((int)WebCacheModelDocumentBrowser, (int)[WebView _cacheModel]); + + [standardPreferences setCacheModel:WebCacheModelPrimaryWebBrowser]; + EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]); + [customPreferences.get() setCacheModel:WebCacheModelDocumentViewer]; + EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]); + + // 3) Resetting the view should fall back to standardPreferences. + [standardPreferences setCacheModel:WebCacheModelDocumentViewer]; + [customPreferences.get() setCacheModel:WebCacheModelPrimaryWebBrowser]; + EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]); + + webView.clear(); + EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]); +} + +} // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm b/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm index 4dd4ef020..965beb4ae 100644 --- a/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm +++ b/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm @@ -40,7 +40,7 @@ void InjectedBundleController::platformInitialize() NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInteger:4], @"AppleAntiAliasingThreshold", [NSNumber numberWithInteger:0], @"AppleFontSmoothing", -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(CHROMIUM) [NSNumber numberWithBool:NO], @"NSScrollAnimationEnabled", #else [NSNumber numberWithBool:NO], @"AppleScrollAnimationEnabled", diff --git a/Tools/WebKitTestRunner/Configurations/Base.xcconfig b/Tools/WebKitTestRunner/Configurations/Base.xcconfig index 4015b3e31..9f5405967 100644 --- a/Tools/WebKitTestRunner/Configurations/Base.xcconfig +++ b/Tools/WebKitTestRunner/Configurations/Base.xcconfig @@ -60,18 +60,15 @@ REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; WEBKIT_UMBRELLA_FRAMEWORKS_DIR = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; WEBCORE_PRIVATE_HEADERS_DIR = $(WEBKIT_UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm index 320b28a8a..01d790bc8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm +++ b/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm @@ -234,7 +234,7 @@ void activateFonts() "WebKitWeightWatcher700.ttf", "WebKitWeightWatcher800.ttf", "WebKitWeightWatcher900.ttf", -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 "SampleFont.sfont", #endif 0 diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm index 419064fdb..996acbb09 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm +++ b/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm @@ -39,7 +39,7 @@ void InjectedBundle::platformInitialize(WKTypeRef) NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInteger:4], @"AppleAntiAliasingThreshold", [NSNumber numberWithInteger:0], @"AppleFontSmoothing", -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(CHROMIUM) [NSNumber numberWithBool:NO], @"NSScrollAnimationEnabled", #else [NSNumber numberWithBool:NO], @"AppleScrollAnimationEnabled", diff --git a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp index 9dc2dfc77..fbb36508a 100644 --- a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp +++ b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp @@ -51,8 +51,16 @@ void TestController::platformInitialize() { } -void TestController::platformRunUntil(bool&, double timeout) +void TestController::platformRunUntil(bool& condition, double timeout) { + if (timeout == m_noTimeout) { + // Never timeout if we are debugging or not meant to timeout. + while (!condition) { + ecore_main_loop_iterate(); + sleep(1); + } + return; + } timer = ecore_timer_loop_add(timeout, timerFired, 0); ecore_main_loop_begin(); } diff --git a/Tools/gtk/run-api-tests b/Tools/gtk/run-api-tests index 441342c84..a601a766c 100755 --- a/Tools/gtk/run-api-tests +++ b/Tools/gtk/run-api-tests @@ -62,6 +62,8 @@ class TestRunner: SkippedTest("unittests/testwebinspector", "/webkit/webinspector/close-and-inspect", "Test is flaky in GTK Linux 32-bit Release bot", 82869), SkippedTest("WebKit2APITests/TestWebKitWebView", "/webkit2/WebKitWebView/mouse-target", "Test is flaky in GTK Linux 32-bit Release bot", 82866), SkippedTest("WebKit2APITests/TestResources", "/webkit2/WebKitWebView/resources", "Test is flaky in GTK Linux 32-bit Release bot", 82868), + SkippedTest("WebKit2APITests/TestWebKitFindController", "/webkit2/WebKitFindController/next", "Test fails ", 91083), + SkippedTest("WebKit2APITests/TestWebKitFindController", "/webkit2/WebKitFindController/previous", "Test fails", 91083), SkippedTest("WebKit2APITests/TestWebKitFindController", "/webkit2/WebKitFindController/hide", "Test always fails in Xvfb", 89810), SkippedTest("TestWebKitAPI/TestWebKit2", "WebKit2.WKConnection", "Tests fail and time out out", 84959), SkippedTest("TestWebKitAPI/TestWebKit2", "WebKit2.RestoreSessionStateContainingFormData", "Session State is not implemented in GTK+ port", 84960), diff --git a/Tools/qmake/config.tests/libXcomposite/libXcomposite.cpp b/Tools/qmake/config.tests/libXcomposite/libXcomposite.cpp new file mode 100644 index 000000000..10e1054bd --- /dev/null +++ b/Tools/qmake/config.tests/libXcomposite/libXcomposite.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY 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 <X11/extensions/Xcomposite.h> + +int main(int, char**) +{ + Display* display = XOpenDisplay(0); + int majorVersion; + int minorVersion; + (void)XCompositeQueryVersion(display, &majorVersion, &minorVersion); + XCloseDisplay(display); + return 0; +} diff --git a/Tools/qmake/config.tests/libXcomposite/libXcomposite.pro b/Tools/qmake/config.tests/libXcomposite/libXcomposite.pro new file mode 100644 index 000000000..96c5c2937 --- /dev/null +++ b/Tools/qmake/config.tests/libXcomposite/libXcomposite.pro @@ -0,0 +1,3 @@ +SOURCES = libXcomposite.cpp +OBJECTS_DIR = obj +LIBS += -lXcomposite -lX11 diff --git a/Tools/qmake/configure.pri b/Tools/qmake/configure.pri index 8c009fd20..575deb880 100644 --- a/Tools/qmake/configure.pri +++ b/Tools/qmake/configure.pri @@ -15,6 +15,7 @@ haveQt(5):!quick_check { libpng \ libjpeg \ libwebp \ + libXcomposite \ libxml2 \ libxslt \ libzlib diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index da2efe8a0..767e56372 100644 --- a/Tools/qmake/mkspecs/features/default_post.prf +++ b/Tools/qmake/mkspecs/features/default_post.prf @@ -140,7 +140,7 @@ contains(TEMPLATE, lib) { win32-msvc*|win32-icc: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32 !plugin { - !linux-g++*:!linux-icc*:contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols + contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions } } diff --git a/Tools/qmake/mkspecs/features/features.prf b/Tools/qmake/mkspecs/features/features.prf index 325aeca0d..a7b00869e 100644 --- a/Tools/qmake/mkspecs/features/features.prf +++ b/Tools/qmake/mkspecs/features/features.prf @@ -170,8 +170,16 @@ haveQt(4) { # is called QmlEngine and it is safe for us to use QQuick1 again. } +# Xcomposite Support +haveQt(5):linux-*:config_libXcomposite: DEFINES += HAVE_XCOMPOSITE=1 + +# Support for Graphics Surface !contains(DEFINES, WTF_USE_GRAPHICS_SURFACE=.) { - haveQt(5):mac: DEFINES += WTF_USE_GRAPHICS_SURFACE=1 + haveQt(5) { + mac: DEFINES += WTF_USE_GRAPHICS_SURFACE=1 + # On linux we require libXcomposite to enable graphics surface. + linux-*:contains(DEFINES, HAVE_XCOMPOSITE=1): DEFINES += WTF_USE_GRAPHICS_SURFACE=1 + } } # -------------- Fill in static defaults -------------- diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog index 5b3143eaf..f22e4c5f1 100644 --- a/WebKitLibraries/ChangeLog +++ b/WebKitLibraries/ChangeLog @@ -1,3 +1,16 @@ +2012-07-11 Mark Rowe <mrowe@apple.com> + + Add a Mountain Lion version of libWebKitSystemInterface.a. + + Update the WebKitSystemInterface header and binaries. + + Reviewed by John Sullivan. + + * WebKitSystemInterface.h: + * libWebKitSystemInterfaceLion.a: + * libWebKitSystemInterfaceMountainLion.a: Added. + * libWebKitSystemInterfaceSnowLeopard.a: + 2012-07-04 John Mellor <johnme@chromium.org> Text Autosizing: Add compile flag and runtime setting diff --git a/WebKitLibraries/WebKitSystemInterface.h b/WebKitLibraries/WebKitSystemInterface.h index c388f34d3..0d7727f94 100644 --- a/WebKitLibraries/WebKitSystemInterface.h +++ b/WebKitLibraries/WebKitSystemInterface.h @@ -43,9 +43,7 @@ NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response); NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *response); NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *response); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 CFArrayRef WKCopyNSURLResponseCertificateChain(NSURLResponse *response); -#endif CFStringEncoding WKGetWebDefaultCFStringEncoding(void); @@ -94,7 +92,6 @@ void WKUnregisterUniqueIdForElement(id element); BOOL WKShouldBlockPlugin(NSString *bundleIdentifier, NSString *bundleVersionString); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Remote Accessibility API. void WKAXRegisterRemoteApp(void); void WKAXInitializeElementWithPresenterPid(id, pid_t); @@ -103,7 +100,6 @@ id WKAXRemoteElementForToken(NSData *); void WKAXSetWindowForRemoteElement(id remoteWindow, id remoteElement); void WKAXRegisterRemoteProcess(bool registerProcess, pid_t); pid_t WKAXRemoteProcessIdentifier(id remoteElement); -#endif void WKSetUpFontCache(void); @@ -227,7 +223,7 @@ NSURL *WKQTMovieResolvedURL(QTMovie* movie); CFStringRef WKCopyFoundationCacheDirectory(void); -#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 +#if MAC_OS_X_VERSION_MIN_REQUIRED == 1060 typedef struct __CFURLStorageSession* CFURLStorageSessionRef; #else typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; @@ -319,7 +315,6 @@ NSArray *WKQTGetSitesInMediaDownloadCache(); void WKQTClearMediaDownloadCacheForSite(NSString *site); void WKQTClearMediaDownloadCache(); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 mach_port_t WKInitializeRenderServer(void); @class CALayer; @@ -375,7 +370,6 @@ CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_ NSUInteger WKGetInputPanelWindowStyle(void); UInt8 WKGetNSEventKeyChar(NSEvent *); -#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 @class CAPropertyAnimation; void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function); @@ -390,7 +384,7 @@ void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumber void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString); CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL); -#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 +#if MAC_OS_X_VERSION_MIN_REQUIRED == 1060 typedef enum { WKEventPhaseNone = 0, WKEventPhaseBegan = 1, @@ -404,7 +398,6 @@ int WKGetNSEventMomentumPhase(NSEvent *); void WKWindowSetAlpha(NSWindow *window, float alphaValue); void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 void WKSyncSurfaceToView(NSView *view); void WKEnableSettingCursorWhenInBackground(void); @@ -419,9 +412,7 @@ NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef rep ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void); #endif -#endif - -#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 +#if MAC_OS_X_VERSION_MIN_REQUIRED == 1060 CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index); #endif diff --git a/WebKitLibraries/libWebKitSystemInterfaceLion.a b/WebKitLibraries/libWebKitSystemInterfaceLion.a Binary files differindex f7e2a9cf3..20ff91f52 100644 --- a/WebKitLibraries/libWebKitSystemInterfaceLion.a +++ b/WebKitLibraries/libWebKitSystemInterfaceLion.a diff --git a/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a b/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a Binary files differnew file mode 100644 index 000000000..ce7db6a0c --- /dev/null +++ b/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a diff --git a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a Binary files differindex 0518a464a..c224ee77f 100644 --- a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a +++ b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a diff --git a/configure.ac b/configure.ac index a7e0982b2..c91bd2305 100644 --- a/configure.ac +++ b/configure.ac @@ -1125,6 +1125,14 @@ AC_ARG_ENABLE(css_regions, [],[enable_css_regions="yes"]) AC_MSG_RESULT([$enable_css_regions]) +# check whether to enable CSS Filters support +AC_MSG_CHECKING([whether to enable CSS Filters]) +AC_ARG_ENABLE(css_filters, + AC_HELP_STRING([--enable-css-filters], + [enable support for CSS Filters [default=no]]), + [],[enable_css_filters="no"]) +AC_MSG_RESULT([$enable_css_filters]) + G_IR_SCANNER= G_IR_COMPILER= G_IR_GENERATE= @@ -1465,6 +1473,7 @@ AM_CONDITIONAL([ENABLE_IFRAME_SEAMLESS],[test "$enable_iframe_seamless" = "yes"] AM_CONDITIONAL([ENABLE_TEXT_AUTOSIZING],[test "$enable_text_autosizing" = "yes"]) AM_CONDITIONAL([ENABLE_CSS_EXCLUSIONS],[test "$enable_css_exclusions" = "yes"]) AM_CONDITIONAL([ENABLE_CSS_REGIONS],[test "$enable_css_regions" = "yes"]) +AM_CONDITIONAL([ENABLE_CSS_FILTERS],[test "$enable_css_filters" = "yes"]) # Gtk conditionals AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"]) @@ -1526,6 +1535,7 @@ Features: CSS box-decoration-break support : $enable_css_box_decoration_break CSS Exclusions support : $enable_css_exclusions CSS Regions support : $enable_css_regions + CSS Filters support : $enable_css_filters DeviceOrientation support : $enable_device_orientation Directory upload : $enable_directory_upload DOM mutation observer support : $enable_mutation_observers |
