diff options
633 files changed, 13369 insertions, 3761 deletions
@@ -1,3 +1,91 @@ +2012-09-18 Ryuan Choi <ryuan.choi@samsung.com> + + [CMAKE] Fix build break because of memory exhausted. + https://bugs.webkit.org/show_bug.cgi?id=77327 + + Reviewed by Gyuyoung Kim. + + Added to avoid memory exhaustion on 32bit linux debug build. + + * Source/cmake/OptionsCommon.cmake: + +2012-09-17 Rob Buis <rbuis@rim.com> + + [BlackBerry] Enable VIDEO_TRACK + https://bugs.webkit.org/show_bug.cgi?id=96949 + + Reviewed by Antonio Gomes. + + Turn on VIDEO_TRACK feature. + + * Source/cmake/OptionsBlackBerry.cmake: + +2012-09-17 Zan Dobersek <zandobersek@gmail.com> + + [Gtk] Remove configuration options for stable features that are currently enabled + https://bugs.webkit.org/show_bug.cgi?id=96621 + + Reviewed by Martin Robinson. + + Remove configuration flags that were used for either features that were enabled + by default or were enabled only when unstable features support was enabled. In + any case the feature was removed only if it does not introduce a dependency. + + * configure.ac: + +2012-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Auto-generate the module pri file for QtWebKit + + Reviewed by Simon Hausmann. + + * Source/api.pri: + +2012-09-14 Julien Chaffraix <jchaffraix@webkit.org> + + Revert r127457 and following fixes due to several hit-testing regressions + https://bugs.webkit.org/show_bug.cgi?id=96830 + + Reviewed by Antonio Gomes. + + This change reverts r127457, r127863 and r128505. + + * Source/autotools/symbols.filter: + +2012-09-14 Adam Barth <abarth@webkit.org> + + Remove webkitPostMessage + https://bugs.webkit.org/show_bug.cgi?id=96577 + + Reviewed by Ojan Vafai. + + Add ENABLE_LEGACY_VENDOR_PREFIXES flag. + + * Source/cmake/WebKitFeatures.cmake: + * Source/cmakeconfig.h.cmake: + +2012-09-14 Jeffrey Pfau <jpfau@apple.com> + + Allow third-party storage blocking setting to change while a page is loaded + https://bugs.webkit.org/show_bug.cgi?id=95790 + + Reviewed by Brady Eidson. + + Update exported symbols. + + * Source/autotools/symbols.filter: + +2012-09-14 Bo Liu <boliu@chromium.org> + + Add in-place reload behavior to ImagesEnabled setting + https://bugs.webkit.org/show_bug.cgi?id=95478 + + Reviewed by Adam Barth. + + Export WebCore::Settings::setImagesEnabled symbol. + + * Source/autotools/symbols.filter: + 2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> [Qt] Fix handling of debug/release/debug_and_release/build_all diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 9e4905f93..76a90cad0 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,978 @@ +2012-09-18 Mark Lam <mark.lam@apple.com> + + Not reviewed. Attempt at greening the WinCairo bot. Touching + LowLevelInterpreter.asm to trigger a rebuild of LLIntDesiredOffsets. + https://bugs.webkit.org/show_bug.cgi?id=96992. + + * llint/LowLevelInterpreter.asm: + +2012-09-18 Peter Gal <galpeter@inf.u-szeged.hu> + + [Qt] REGRESSION(r128790): It broke the ARM build + https://bugs.webkit.org/show_bug.cgi?id=96968 + + Reviewed by Filip Pizlo. + + Implement the missing or32 method in the MacroAssemblerARM.h. + + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::or32): + (MacroAssemblerARM): + +2012-09-18 Mark Lam <mark.lam@apple.com> + + Fix for WinCairo builds. + https://bugs.webkit.org/show_bug.cgi?id=96992. + + Reviewed by Filip Pizlo. + + Adding additional vcproj build targets in LLIntDesiredOffsets.vcproj, + LLIntOffsetsExtractor.vcproj, and LLIntAssembly.vcproj to match those + in jsc.vcproj. + + * JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.vcproj: + * JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.vcproj: + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractor.vcproj: + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorCommon.vsprops: Added property svn:eol-style. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebug.vsprops: Added property svn:eol-style. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugAll.vsprops: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugCairoCFLite.vsprops: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorProduction.vsprops: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorRelease.vsprops: Added property svn:eol-style. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleaseCairoCFLite.vsprops: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleasePGO.vsprops: Added. + +2012-09-18 Filip Pizlo <fpizlo@apple.com> + + Unreviewed, fix sloppy English in comment. + + * runtime/JSGlobalObject.cpp: + (JSC): + +2012-09-17 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed, rolling out r128826 and r128813. + + * API/JSCallbackConstructor.cpp: + (JSC): + (JSC::JSCallbackConstructor::JSCallbackConstructor): + * API/JSCallbackConstructor.h: + (JSCallbackConstructor): + * API/JSCallbackObject.cpp: + (JSC): + (JSC::::createStructure): + * API/JSCallbackObject.h: + (JSC::JSCallbackObject::create): + (JSCallbackObject): + * API/JSClassRef.cpp: + (OpaqueJSClass::prototype): + * API/JSObjectRef.cpp: + (JSObjectMake): + (JSObjectGetPrivate): + (JSObjectSetPrivate): + (JSObjectGetPrivateProperty): + (JSObjectSetPrivateProperty): + (JSObjectDeletePrivateProperty): + * API/JSValueRef.cpp: + (JSValueIsObjectOfClass): + * API/JSWeakObjectMapRefPrivate.cpp: + * GNUmakefile.list.am: + * JSCTypedArrayStubs.h: + (JSC): + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): + (JSC::DFG::SpeculativeJIT::emitAllocateJSFinalObject): + * heap/Heap.cpp: + (JSC::Heap::isSafeToSweepStructures): + (JSC): + * heap/Heap.h: + (JSC::Heap::allocatorForObjectWithDestructor): + (Heap): + (JSC::Heap::allocateWithDestructor): + (JSC::Heap::allocateStructure): + (JSC): + * heap/IncrementalSweeper.cpp: + (JSC::IncrementalSweeper::IncrementalSweeper): + (JSC::IncrementalSweeper::sweepNextBlock): + (JSC::IncrementalSweeper::startSweeping): + (JSC::IncrementalSweeper::willFinishSweeping): + (JSC::IncrementalSweeper::structuresCanBeSwept): + (JSC): + * heap/IncrementalSweeper.h: + (IncrementalSweeper): + * heap/MarkedAllocator.cpp: + (JSC::MarkedAllocator::tryAllocateHelper): + (JSC::MarkedAllocator::allocateBlock): + * heap/MarkedAllocator.h: + (JSC::MarkedAllocator::cellsNeedDestruction): + (JSC::MarkedAllocator::onlyContainsStructures): + (MarkedAllocator): + (JSC::MarkedAllocator::MarkedAllocator): + (JSC::MarkedAllocator::init): + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::create): + (JSC::MarkedBlock::MarkedBlock): + (JSC): + (JSC::MarkedBlock::specializedSweep): + (JSC::MarkedBlock::sweep): + (JSC::MarkedBlock::sweepHelper): + * heap/MarkedBlock.h: + (JSC): + (MarkedBlock): + (JSC::MarkedBlock::cellsNeedDestruction): + (JSC::MarkedBlock::onlyContainsStructures): + * heap/MarkedSpace.cpp: + (JSC::MarkedSpace::MarkedSpace): + (JSC::MarkedSpace::resetAllocators): + (JSC::MarkedSpace::canonicalizeCellLivenessData): + (JSC::MarkedSpace::isPagedOut): + (JSC::MarkedSpace::freeBlock): + * heap/MarkedSpace.h: + (MarkedSpace): + (Subspace): + (JSC::MarkedSpace::allocatorFor): + (JSC::MarkedSpace::destructorAllocatorFor): + (JSC::MarkedSpace::allocateWithDestructor): + (JSC::MarkedSpace::allocateStructure): + (JSC::MarkedSpace::forEachBlock): + * heap/SlotVisitor.cpp: + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::emitAllocateBasicJSObject): + (JSC::JIT::emitAllocateJSFinalObject): + (JSC::JIT::emitAllocateJSArray): + * jsc.cpp: + (GlobalObject::create): + * runtime/Arguments.cpp: + (JSC): + * runtime/Arguments.h: + (Arguments): + (JSC::Arguments::Arguments): + * runtime/ErrorPrototype.cpp: + (JSC): + * runtime/Executable.h: + * runtime/InternalFunction.cpp: + (JSC): + (JSC::InternalFunction::InternalFunction): + * runtime/InternalFunction.h: + (InternalFunction): + * runtime/JSCell.h: + (JSC): + (JSC::allocateCell): + * runtime/JSDestructibleObject.h: Removed. + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + (JSC): + * runtime/JSGlobalObject.h: + (JSGlobalObject): + (JSC::JSGlobalObject::createRareDataIfNeeded): + (JSC::JSGlobalObject::create): + * runtime/JSGlobalThis.h: + (JSGlobalThis): + (JSC::JSGlobalThis::JSGlobalThis): + * runtime/JSPropertyNameIterator.h: + * runtime/JSScope.cpp: + (JSC): + * runtime/JSString.h: + (JSC): + * runtime/JSWrapperObject.h: + (JSWrapperObject): + (JSC::JSWrapperObject::JSWrapperObject): + * runtime/MathObject.cpp: + (JSC): + * runtime/NameInstance.h: + (NameInstance): + * runtime/RegExp.h: + * runtime/RegExpObject.cpp: + (JSC): + * runtime/SparseArrayValueMap.h: + * runtime/Structure.h: + (JSC::Structure): + (JSC::JSCell::classInfo): + (JSC): + * runtime/StructureChain.h: + * runtime/SymbolTable.h: + * testRegExp.cpp: + (GlobalObject::create): + +2012-09-17 Geoffrey Garen <ggaren@apple.com> + + Refactored the arguments object so it doesn't dictate closure layout + https://bugs.webkit.org/show_bug.cgi?id=96955 + + Reviewed by Oliver Hunt. + + * bytecode/CodeBlock.h: + (JSC::ExecState::argumentAfterCapture): Helper function for accessing an + argument that has been moved for capture. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): Generate metadata for arguments + that are captured. We don't move any arguments yet, but we do use this + metadata to tell the arguments object if an argument is stored in the + activation. + + * dfg/DFGOperations.cpp: + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compileGetByValOnArguments): + (JSC::DFG::SpeculativeJIT::compileGetArgumentsLength): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): Updated for the arguments object not + malloc'ing a separate backing store, and for a rename from deletedArguments + to slowArguments. + + * interpreter/CallFrame.h: + (ExecState): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::unwindCallFrame): + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * llint/LLIntSlowPaths.cpp: + (JSC::LLInt::LLINT_SLOW_PATH_DECL): Updated for small interface changes. + + * runtime/Arguments.cpp: + (JSC::Arguments::visitChildren): + (JSC::Arguments::copyToArguments): + (JSC::Arguments::fillArgList): + (JSC::Arguments::getOwnPropertySlotByIndex): + (JSC::Arguments::createStrictModeCallerIfNecessary): + (JSC::Arguments::createStrictModeCalleeIfNecessary): + (JSC::Arguments::getOwnPropertySlot): + (JSC::Arguments::getOwnPropertyDescriptor): + (JSC::Arguments::getOwnPropertyNames): + (JSC::Arguments::putByIndex): + (JSC::Arguments::put): + (JSC::Arguments::deletePropertyByIndex): + (JSC::Arguments::deleteProperty): + (JSC::Arguments::defineOwnProperty): + (JSC::Arguments::tearOff): Moved all data inline into the object, for speed, + and refactored all internal argument accesses to use helper functions, so + we can change the implementation without changing lots of code. + + (JSC::Arguments::didTearOffActivation): This function needs to account + for arguments that were moved by the activation object. We do this accounting + through a side vector that tells us where our arguments will be in the + activation. + + (JSC::Arguments::tearOffForInlineCallFrame): + * runtime/Arguments.h: + (Arguments): + (JSC::Arguments::length): + (JSC::Arguments::isTornOff): + (JSC::Arguments::Arguments): + (JSC::Arguments::allocateSlowArguments): + (JSC::Arguments::tryDeleteArgument): + (JSC::Arguments::trySetArgument): + (JSC::Arguments::tryGetArgument): + (JSC::Arguments::isDeletedArgument): + (JSC::Arguments::isArgument): + (JSC::Arguments::argument): + (JSC::Arguments::finishCreation): + + * runtime/JSActivation.h: + (JSC::JSActivation::create): + (JSActivation): + (JSC::JSActivation::captureStart): + (JSC::JSActivation::storageSize): + (JSC::JSActivation::registerOffset): + (JSC::JSActivation::isValid): The activation object is no longer responsible + for copying extra arguments provided by the caller. The argumnents object + does this instead. This means we can allocate and initialize an activation + without worrying about the call frame's argument count. + + * runtime/SymbolTable.h: + (JSC::SlowArgument::SlowArgument): + (SlowArgument): + (JSC): + (JSC::SharedSymbolTable::parameterCount): + (SharedSymbolTable): + (JSC::SharedSymbolTable::slowArguments): + (JSC::SharedSymbolTable::setSlowArguments): Added data structures to back + the algorithms above. + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + 32-bit LLInt get_by_val does vector length checks incorrectly + https://bugs.webkit.org/show_bug.cgi?id=96893 + <rdar://problem/12311678> + + Reviewed by Mark Hahnenberg. + + * llint/LowLevelInterpreter32_64.asm: + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + We don't have a bad enough time if an object's prototype chain crosses global objects + https://bugs.webkit.org/show_bug.cgi?id=96962 + + Reviewed by Geoffrey Garen. + + * runtime/JSGlobalObject.cpp: + (JSC): + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + Unreviewed, fix a broken assertion in offlineasm. + + * offlineasm/armv7.rb: + * offlineasm/backends.rb: + +2012-09-16 Mark Hahnenberg <mhahnenberg@apple.com> + + Delayed structure sweep can leak structures without bound + https://bugs.webkit.org/show_bug.cgi?id=96546 + + Reviewed by Gavin Barraclough. + + This patch gets rid of the separate Structure allocator in the MarkedSpace and adds two new destructor-only + allocators. We now have separate allocators for our three types of objects: those objects with no destructors, + those objects with destructors and with immortal structures, and those objects with destructors that don't have + immortal structures. All of the objects of the third type (destructors without immortal structures) now + inherit from a new class named JSDestructibleObject (which in turn is a subclass of JSNonFinalObject), which stores + the ClassInfo for these classes at a fixed offset for safe retrieval during sweeping/destruction. + + * API/JSCallbackConstructor.cpp: Use JSDestructibleObject for JSCallbackConstructor. + (JSC): + (JSC::JSCallbackConstructor::JSCallbackConstructor): + * API/JSCallbackConstructor.h: + (JSCallbackConstructor): + * API/JSCallbackObject.cpp: Inherit from JSDestructibleObject for normal JSCallbackObjects and use a finalizer for + JSCallbackObject<JSGlobalObject>, since JSGlobalObject also uses a finalizer. + (JSC): + (JSC::::create): We need to move the create function for JSCallbackObject<JSGlobalObject> out of line so we can add + the finalizer for it. We don't want to add the finalizer is something like finishCreation in case somebody decides + to subclass this. We use this same technique for many other subclasses of JSGlobalObject. + (JSC::::createStructure): + * API/JSCallbackObject.h: + (JSCallbackObject): + (JSC): + * API/JSClassRef.cpp: Change all the JSCallbackObject<JSNonFinalObject> to use JSDestructibleObject instead. + (OpaqueJSClass::prototype): + * API/JSObjectRef.cpp: Ditto. + (JSObjectMake): + (JSObjectGetPrivate): + (JSObjectSetPrivate): + (JSObjectGetPrivateProperty): + (JSObjectSetPrivateProperty): + (JSObjectDeletePrivateProperty): + * API/JSValueRef.cpp: Ditto. + (JSValueIsObjectOfClass): + * API/JSWeakObjectMapRefPrivate.cpp: Ditto. + * JSCTypedArrayStubs.h: + (JSC): + * JavaScriptCore.xcodeproj/project.pbxproj: + * dfg/DFGSpeculativeJIT.h: Use the proper allocator type when doing inline allocation in the DFG. + (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): + (JSC::DFG::SpeculativeJIT::emitAllocateJSFinalObject): + * heap/Heap.cpp: + (JSC): + * heap/Heap.h: Add accessors for the various types of allocators now. Also remove the isSafeToSweepStructures function + since it's always safe to sweep Structures now. + (JSC::Heap::allocatorForObjectWithNormalDestructor): + (JSC::Heap::allocatorForObjectWithImmortalStructureDestructor): + (Heap): + (JSC::Heap::allocateWithNormalDestructor): + (JSC): + (JSC::Heap::allocateWithImmortalStructureDestructor): + * heap/IncrementalSweeper.cpp: Remove all the logic to detect when it's safe to sweep Structures from the + IncrementalSweeper since it's always safe to sweep Structures now. + (JSC::IncrementalSweeper::IncrementalSweeper): + (JSC::IncrementalSweeper::sweepNextBlock): + (JSC::IncrementalSweeper::startSweeping): + (JSC::IncrementalSweeper::willFinishSweeping): + (JSC): + * heap/IncrementalSweeper.h: + (IncrementalSweeper): + * heap/MarkedAllocator.cpp: Remove the logic that was preventing us from sweeping Structures if it wasn't safe. Add + tracking of the specific destructor type of allocator. + (JSC::MarkedAllocator::tryAllocateHelper): + (JSC::MarkedAllocator::allocateBlock): + * heap/MarkedAllocator.h: + (JSC::MarkedAllocator::destructorType): + (MarkedAllocator): + (JSC::MarkedAllocator::MarkedAllocator): + (JSC::MarkedAllocator::init): + * heap/MarkedBlock.cpp: Add all the destructor type stuff to MarkedBlocks so that we do the right thing when sweeping. + We also use the stored destructor type to determine the right thing to do in all JSCell::classInfo() calls. + (JSC::MarkedBlock::create): + (JSC::MarkedBlock::MarkedBlock): + (JSC): + (JSC::MarkedBlock::specializedSweep): + (JSC::MarkedBlock::sweep): + (JSC::MarkedBlock::sweepHelper): + * heap/MarkedBlock.h: + (JSC): + (JSC::MarkedBlock::allocator): + (JSC::MarkedBlock::destructorType): + * heap/MarkedSpace.cpp: Add the new destructor allocators to MarkedSpace. + (JSC::MarkedSpace::MarkedSpace): + (JSC::MarkedSpace::resetAllocators): + (JSC::MarkedSpace::canonicalizeCellLivenessData): + (JSC::MarkedSpace::isPagedOut): + (JSC::MarkedSpace::freeBlock): + * heap/MarkedSpace.h: + (MarkedSpace): + (JSC::MarkedSpace::immortalStructureDestructorAllocatorFor): + (JSC::MarkedSpace::normalDestructorAllocatorFor): + (JSC::MarkedSpace::allocateWithImmortalStructureDestructor): + (JSC::MarkedSpace::allocateWithNormalDestructor): + (JSC::MarkedSpace::forEachBlock): + * heap/SlotVisitor.cpp: Add include because the symbol was needed in an inlined function. + * jit/JIT.h: Make sure we use the correct allocator when doing inline allocations in the baseline JIT. + * jit/JITInlineMethods.h: + (JSC::JIT::emitAllocateBasicJSObject): + (JSC::JIT::emitAllocateJSFinalObject): + (JSC::JIT::emitAllocateJSArray): + * jsc.cpp: + (GlobalObject::create): Add finalizer here since JSGlobalObject needs to use a finalizer instead of inheriting from + JSDestructibleObject. + * runtime/Arguments.cpp: Inherit from JSDestructibleObject. + (JSC): + * runtime/Arguments.h: + (Arguments): + (JSC::Arguments::Arguments): + * runtime/ErrorPrototype.cpp: Added an assert to make sure we have a trivial destructor. + (JSC): + * runtime/Executable.h: Indicate that all of the Executable* classes have immortal Structures. + (JSC): + * runtime/InternalFunction.cpp: Inherit from JSDestructibleObject. + (JSC): + (JSC::InternalFunction::InternalFunction): + * runtime/InternalFunction.h: + (InternalFunction): + * runtime/JSCell.h: Added the NEEDS_DESTRUCTOR macro to make it easier for classes to indicate that instead of being + allocated in a destructor MarkedAllocator that they will handle their destruction themselves through the + use of a finalizer. + (JSC): + (HasImmortalStructure): New template to help us determine at compile-time if a particular class + should be allocated in the immortal structure MarkedAllocator. The default value is false. In order + to be allocated in the immortal structure allocator, classes must specialize this template. Also added + a macro to make it easier for classes to specialize the template. + (JSC::allocateCell): Use the appropriate allocator depending on the destructor type. + * runtime/JSDestructibleObject.h: Added. New class that stores the ClassInfo of any subclass so that it can be + accessed safely when the object is being destroyed. + (JSC): + (JSDestructibleObject): + (JSC::JSDestructibleObject::classInfo): + (JSC::JSDestructibleObject::JSDestructibleObject): + (JSC::JSCell::classInfo): Checks the current MarkedBlock to see where it should get the ClassInfo from so that it's always safe. + * runtime/JSGlobalObject.cpp: JSGlobalObject now uses a finalizer instead of a destructor so that it can avoid forcing all + of its relatives in the inheritance hierarchy (e.g. JSScope) to use destructors as well. + (JSC::JSGlobalObject::reset): + * runtime/JSGlobalObject.h: + (JSGlobalObject): + (JSC::JSGlobalObject::createRareDataIfNeeded): Since we always create a finalizer now, we don't have to worry about adding one + for the m_rareData field when it's created. + (JSC::JSGlobalObject::create): + (JSC): + * runtime/JSGlobalThis.h: Inherit from JSDestructibleObject. + (JSGlobalThis): + (JSC::JSGlobalThis::JSGlobalThis): + * runtime/JSPropertyNameIterator.h: Has an immortal Structure. + (JSC): + * runtime/JSScope.cpp: + (JSC): + * runtime/JSString.h: Has an immortal Structure. + (JSC): + * runtime/JSWrapperObject.h: Inherit from JSDestructibleObject. + (JSWrapperObject): + (JSC::JSWrapperObject::JSWrapperObject): + * runtime/MathObject.cpp: Cleaning up some of the inheritance stuff. + (JSC): + * runtime/NameInstance.h: Inherit from JSDestructibleObject. + (NameInstance): + * runtime/RegExp.h: Has immortal Structure. + (JSC): + * runtime/RegExpObject.cpp: Inheritance cleanup. + (JSC): + * runtime/SparseArrayValueMap.h: Has immortal Structure. + (JSC): + * runtime/Structure.h: Has immortal Structure. + (JSC): + * runtime/StructureChain.h: Ditto. + (JSC): + * runtime/SymbolTable.h: Ditto. + (SharedSymbolTable): + (JSC): + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + If a prototype has indexed setters and its instances have indexed storage, then all put_by_val's should have a bad time + https://bugs.webkit.org/show_bug.cgi?id=96596 + + Reviewed by Gavin Barraclough. + + Added comprehensive support for accessors and read-only indexed properties on the + prototype chain. This is done without any performance regression on benchmarks that + we're aware of, by having the entire VM's strategy with respect to arrays tilted + heavily in favor of: + + - The prototype chain of JSArrays never having any accessors or read-only indexed + properties. If that changes, you're going to have a bad time. + + - Prototypes of non-JSArray objects either having no indexed accessors or read-only + indexed properties, or, having those indexed accessor thingies inserted before + any instance object (i.e. object with that prototype as its prototype) is created. + If you add indexed accessors or read-only indexed properties to an object that is + already used as a prototype, you're going to have a bad time. + + See below for the exact definition of having a bad time. + + Put another way, "fair" uses of indexed accessors and read-only indexed properties + are: + + - Put indexed accessors and read-only indexed properties on an object that is never + used as a prototype. This will slow down accesses to that object, but will not + have any effect on any other object. + + - Put those indexed accessor thingies on an object before it is used as a prototype + and then start instantiating objects that claim that object as their prototype. + This will slightly slow down indexed stores to the instance objects, and greatly + slow down all indexed accesses to the prototype, but will have no other effect. + + In short, "fair" uses only affect the object itself and any instance objects. But + if you start using indexed accessors in more eclectic ways, you're going to have + a bad time. + + Specifically, if an object that may be used as a prototype has an indexed accessor + added, the VM performs a whole-heap scan to find all objects that belong to the + same global object as the prototype you modified. If any of those objects has + indexed storage, their indexed storage is put into slow-put mode, just as if their + prototype chain had indexed accessors. This will happen even for objects that do + not currently have indexed accessors in their prototype chain. As well, all JSArray + allocations are caused to create arrays with slow-put storage, and all future + allocations of indexed storage for non-JSArray objects are also flipped to slow-put + mode. Note there are two aspects to having a bad time: (i) the whole-heap scan and + (ii) the poisoning of all indexed storage in the entire global object. (i) is + necessary for correctness. If we detect that an object that may be used as a + prototype has had an indexed accessor or indexed read-only property inserted into + it, then we need to ensure that henceforth all instances of that object inspect + the prototype chain whenever an indexed hole is stored to. But by default, indexed + stores do no such checking because doing so would be unnecessarily slow. So, we must + find all instances of the affected object and flip them into a different array + storage mode that omits all hole optimizations. Since prototypes never keep a list + of instance objects, the only way to find those objects is a whole-heap scan. But + (i) alone would be a potential disaster, if a program frequently allocated an + object without indexed accessors, then allocated a bunch of objects that used that + one as their prototype, and then added indexed accessors to the prototype. So, to + prevent massive heap scan storms in such awkward programs, having a bad time also + implies (ii): henceforth *all* objects belonging to that global object will use + slow put indexed storage, so that we don't ever have to scan the heap again. Note + that here we are using the global object as just an approximation of a program + module; it may be worth investigating in the future if other approximations can be + used instead. + + * bytecode/ArrayProfile.h: + (JSC): + (JSC::arrayModeFromStructure): + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGArrayMode.cpp: + (JSC::DFG::fromObserved): + (JSC::DFG::modeAlreadyChecked): + (JSC::DFG::modeToString): + * dfg/DFGArrayMode.h: + (DFG): + (JSC::DFG::isSlowPutAccess): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::checkArray): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::emitAllocateJSArray): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_new_array): + * runtime/ArrayPrototype.cpp: + (JSC::ArrayPrototype::finishCreation): + (JSC::arrayProtoFuncSort): + * runtime/IndexingType.h: + (JSC): + (JSC::hasIndexedProperties): + (JSC::hasIndexingHeader): + (JSC::hasArrayStorage): + (JSC::shouldUseSlowPut): + * runtime/JSArray.cpp: + (JSC::JSArray::pop): + (JSC::JSArray::push): + (JSC::JSArray::fillArgList): + (JSC::JSArray::copyToArguments): + * runtime/JSArray.h: + (JSC::JSArray::createStructure): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::JSGlobalObject): + (JSC::JSGlobalObject::reset): + (JSC): + (JSC::JSGlobalObject::haveABadTime): + * runtime/JSGlobalObject.h: + (JSGlobalObject): + (JSC::JSGlobalObject::addressOfArrayStructure): + (JSC::JSGlobalObject::havingABadTimeWatchpoint): + (JSC::JSGlobalObject::isHavingABadTime): + * runtime/JSObject.cpp: + (JSC::JSObject::visitButterfly): + (JSC::JSObject::getOwnPropertySlotByIndex): + (JSC::JSObject::put): + (JSC::JSObject::putByIndex): + (JSC::JSObject::enterDictionaryIndexingMode): + (JSC::JSObject::notifyPresenceOfIndexedAccessors): + (JSC): + (JSC::JSObject::createArrayStorage): + (JSC::JSObject::ensureArrayStorageExistsAndEnterDictionaryIndexingMode): + (JSC::JSObject::switchToSlowPutArrayStorage): + (JSC::JSObject::setPrototype): + (JSC::JSObject::resetInheritorID): + (JSC::JSObject::inheritorID): + (JSC::JSObject::allowsAccessFrom): + (JSC::JSObject::deletePropertyByIndex): + (JSC::JSObject::getOwnPropertyNames): + (JSC::JSObject::unwrappedGlobalObject): + (JSC::JSObject::notifyUsedAsPrototype): + (JSC::JSObject::createInheritorID): + (JSC::JSObject::defineOwnIndexedProperty): + (JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype): + (JSC::JSObject::attemptToInterceptPutByIndexOnHole): + (JSC::JSObject::putByIndexBeyondVectorLength): + (JSC::JSObject::putDirectIndexBeyondVectorLength): + (JSC::JSObject::getNewVectorLength): + (JSC::JSObject::getOwnPropertyDescriptor): + * runtime/JSObject.h: + (JSC::JSObject::mayBeUsedAsPrototype): + (JSObject): + (JSC::JSObject::mayInterceptIndexedAccesses): + (JSC::JSObject::getArrayLength): + (JSC::JSObject::getVectorLength): + (JSC::JSObject::canGetIndexQuickly): + (JSC::JSObject::getIndexQuickly): + (JSC::JSObject::canSetIndexQuickly): + (JSC::JSObject::setIndexQuickly): + (JSC::JSObject::initializeIndex): + (JSC::JSObject::completeInitialization): + (JSC::JSObject::inSparseIndexingMode): + (JSC::JSObject::arrayStorage): + (JSC::JSObject::arrayStorageOrNull): + (JSC::JSObject::ensureArrayStorage): + (JSC): + (JSC::JSValue::putByIndex): + * runtime/JSValue.cpp: + (JSC::JSValue::putToPrimitive): + (JSC::JSValue::putToPrimitiveByIndex): + (JSC): + * runtime/JSValue.h: + (JSValue): + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::finishCreation): + * runtime/SparseArrayValueMap.cpp: + (JSC::SparseArrayValueMap::putEntry): + (JSC::SparseArrayEntry::put): + (JSC): + * runtime/SparseArrayValueMap.h: + (JSC): + (SparseArrayEntry): + * runtime/Structure.cpp: + (JSC::Structure::anyObjectInChainMayInterceptIndexedAccesses): + (JSC): + (JSC::Structure::suggestedIndexingTransition): + * runtime/Structure.h: + (Structure): + (JSC::Structure::mayInterceptIndexedAccesses): + * runtime/StructureTransitionTable.h: + (JSC::newIndexingType): + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + Array profiling has convergence issues + https://bugs.webkit.org/show_bug.cgi?id=96891 + + Reviewed by Gavin Barraclough. + + Now each array profiling site merges in the indexing type it observed into + the m_observedArrayModes bitset. The ArrayProfile also uses this to detect + cases where the structure must have gone polymorphic (if the bitset is + polymorphic then the structure must be). This achieves something like the + best of both worlds: on the one hand, we get a probabilistic structure that + we can use to optimize the monomorphic structure case, but on the other hand, + we get an accurate view of the set of types that were encountered. + + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::or32): + (MacroAssemblerARMv7): + * assembler/MacroAssemblerX86.h: + (JSC::MacroAssemblerX86::or32): + (MacroAssemblerX86): + * assembler/MacroAssemblerX86_64.h: + (JSC::MacroAssemblerX86_64::or32): + (MacroAssemblerX86_64): + * assembler/X86Assembler.h: + (X86Assembler): + (JSC::X86Assembler::orl_rm): + * bytecode/ArrayProfile.cpp: + (JSC::ArrayProfile::computeUpdatedPrediction): + * bytecode/ArrayProfile.h: + (JSC::ArrayProfile::addressOfArrayModes): + (JSC::ArrayProfile::structureIsPolymorphic): + * jit/JIT.h: + (JIT): + * jit/JITInlineMethods.h: + (JSC): + (JSC::JIT::emitArrayProfilingSite): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::privateCompilePatchGetArrayLength): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::privateCompilePatchGetArrayLength): + * llint/LowLevelInterpreter.asm: + * llint/LowLevelInterpreter32_64.asm: + * llint/LowLevelInterpreter64.asm: + +2012-09-17 Mark Lam <mark.lam@apple.com> + + Not reviewed. Added svn:eol-style native to unbreak some build bots. + https://bugs.webkit.org/show_bug.cgi?id=96175. + + * JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.vcproj: Added property svn:eol-style. + * JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.vcproj: Added property svn:eol-style. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractor.vcproj: Added property svn:eol-style. + +2012-09-16 Mark Lam <mark.lam@apple.com> + + Added MSVC project changes to enable building the llint. + https://bugs.webkit.org/show_bug.cgi?id=96175. + + Reviewed by Geoff Garen. + + This only adds the ability to build the llint, but currently, only the + C++ backend is supported. By default, the Windows port will remain + running with the baseline JIT. The llint will not be enabled. + + * JavaScriptCore.vcproj/JavaScriptCore.sln: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.vcproj/LLIntAssembly: Added. + * JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.make: Added. + * JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.vcproj: Added. + * JavaScriptCore.vcproj/LLIntAssembly/build-LLIntAssembly.sh: Added. + * JavaScriptCore.vcproj/LLIntDesiredOffsets: Added. + * JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.make: Added. + * JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.vcproj: Added. + * JavaScriptCore.vcproj/LLIntDesiredOffsets/build-LLIntDesiredOffsets.sh: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractor.vcproj: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorCommon.vsprops: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebug.vsprops: Added. + * JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorRelease.vsprops: Added. + +2012-09-16 Filip Pizlo <fpizlo@apple.com> + + JSObject.cpp and JSArray.cpp have inconsistent tests for the invalid array index case + https://bugs.webkit.org/show_bug.cgi?id=96878 + + Reviewed by Sam Weinig. + + Removed the uses of UNLIKELY() because I don't believe they are buying us anything, + since we're already on the slow path. Also found other places where we're testing for + the invalid array index case using unusual predicates rather than just using + MAX_ARRAY_INDEX. With this change, I believe that all of our tests for invalid + array indices (i.e. indices that should be treated as non-indexed properties) + uniformly use MAX_ARRAY_INDEX and PropertyName::NotAnIndex. + + * runtime/JSArray.cpp: + (JSC::JSArray::push): + * runtime/JSObject.cpp: + (JSC::JSObject::putByIndex): + (JSC::JSObject::defineOwnIndexedProperty): + +2012-09-15 Filip Pizlo <fpizlo@apple.com> + + Following the Butterfly refactoring, the comment for lastArraySize was not updated + https://bugs.webkit.org/show_bug.cgi?id=96877 + + Reviewed by Sam Weinig. + + * runtime/JSObject.cpp: + (JSC): + +2012-09-15 Mark Lam <mark.lam@apple.com> + + Fixed JSLock to use the platform abstraction for Mutex instead of + depending on pthreads. + https://bugs.webkit.org/show_bug.cgi?id=96858. + + Reviewed by Filip Pizlo. + + This fixes a synchronization problem on the Windows port and makes + it more reliable when running the layout tests. + + * runtime/InitializeThreading.cpp: + (JSC::initializeThreadingOnce): + * runtime/JSLock.cpp: + (JSC): + (JSC::GlobalJSLock::GlobalJSLock): + (JSC::GlobalJSLock::~GlobalJSLock): + (JSC::GlobalJSLock::initialize): + * runtime/JSLock.h: + (GlobalJSLock): + (JSLock): + +2012-09-15 Filip Pizlo <fpizlo@apple.com> + + Structure check hoisting fails to consider the possibility of conflicting checks on the source of the first assignment to the hoisted variable + https://bugs.webkit.org/show_bug.cgi?id=96872 + + Reviewed by Oliver Hunt. + + This does a few related things: + + - It turns off the use of ForceOSRExit for sure-to-fail CheckStructures, because + I noticed that this would sometimes happen for a ForwardCheckStructure. The + problem is that ForceOSRExit exits backwards, not forwards. Since the code that + led to those ForceOSRExit's being inserted was written out of paranoia rather + than need, I removed it. Specifically, I removed the m_isValid = false code + for CheckStructure/StructureTransitionWatchpoint in AbstractState. + + - If a structure check causes a structure set to go empty, we don't want a + PutStructure to revive the set. It should instead be smart enough to realize + that an empty set implies that the code can't execute. This was the only "bug" + that the use of m_isValid = false was preventing. + + - Finally, the main change: structure check hoisting looks at the source of the + SetLocals on structure-check-hoistable variables and ensures that the source + is not checked with a conflicting structure. This is O(n^2) but it does not + show up at all in performance tests. + + The first two parts of this change were auxiliary bugs that were revealed by + the structure check hoister doing bad things. + + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::initialize): + (JSC::DFG::AbstractState::execute): + * dfg/DFGStructureCheckHoistingPhase.cpp: + (JSC::DFG::StructureCheckHoistingPhase::run): + +2012-09-14 Filip Pizlo <fpizlo@apple.com> + + All of the things in SparseArrayValueMap should be out-of-line + https://bugs.webkit.org/show_bug.cgi?id=96854 + + Reviewed by Andy Estes. + + Those inline methods were buying us nothing. + + * GNUmakefile.list.am: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSArray.cpp: + * runtime/JSGlobalData.cpp: + * runtime/JSObject.cpp: + * runtime/RegExpMatchesArray.cpp: + * runtime/SparseArrayValueMap.cpp: + (JSC::SparseArrayValueMap::SparseArrayValueMap): + (JSC): + (JSC::SparseArrayValueMap::~SparseArrayValueMap): + (JSC::SparseArrayValueMap::finishCreation): + (JSC::SparseArrayValueMap::create): + (JSC::SparseArrayValueMap::destroy): + (JSC::SparseArrayValueMap::createStructure): + (JSC::SparseArrayValueMap::add): + (JSC::SparseArrayValueMap::putEntry): + (JSC::SparseArrayValueMap::putDirect): + (JSC::SparseArrayEntry::get): + (JSC::SparseArrayEntry::getNonSparseMode): + (JSC::SparseArrayValueMap::visitChildren): + * runtime/SparseArrayValueMapInlineMethods.h: Removed. + +2012-09-14 Mike West <mkwst@chromium.org> + + JSC should throw a more descriptive exception when blocking 'eval' via CSP. + https://bugs.webkit.org/show_bug.cgi?id=94331 + + Reviewed by Geoffrey Garen. + + Unless explicitly whitelisted, the 'script-src' Content Security Policy + directive blocks 'eval' and 'eval'-like constructs such as + 'new Function()'. When 'eval' is encountered in code, an 'EvalError' is + thrown, but the associated message is poor: "Eval is disabled" doesn't + give developers enough information about why their code isn't behaving + as expected. + + This patch adds an 'errorMessage' parameter to the JavaScriptCore method + used to disable 'eval'; ContentSecurityPolicy has the opportunity to + pass in a more detailed and descriptive error that contains more context + for the developer. + + * runtime/Executable.cpp: + (JSC::EvalExecutable::compileInternal): + Drop the hard-coded "Eval is disabled" error message in favor of + reading the error message off the global object. + * runtime/FunctionConstructor.cpp: + (JSC::FunctionConstructor::getCallData): + Drop the hard-coded "Function constructor is disabled" error message + in favor of reading the error message off the global object. + * runtime/JSGlobalObject.h: + (JSGlobalObject): + (JSC::JSGlobalObject::evalEnabled): + Making this accessor method const. + (JSC::JSGlobalObject::evalDisabledErrorMessage): + Accessor for the error message set via 'setEvalDisabled'. + (JSC::JSGlobalObject::setEvalEnabled): + Adding an 'errorMessage' parameter which is stored on the global + object, and used when exceptions are thrown. + +2012-09-14 Filip Pizlo <fpizlo@apple.com> + + bbc homepage crashes immediately + https://bugs.webkit.org/show_bug.cgi?id=96812 + <rdar://problem/12081386> + + Reviewed by Oliver Hunt. + + If you use the old storage pointer to write to space you thought was newly allocated, + you're going to have a bad time. + + * runtime/JSArray.cpp: + (JSC::JSArray::unshiftCount): + +2012-09-14 Adam Barth <abarth@webkit.org> + + Remove webkitPostMessage + https://bugs.webkit.org/show_bug.cgi?id=96577 + + Reviewed by Ojan Vafai. + + Add ENABLE_LEGACY_VENDOR_PREFIXES flag. + + * Configurations/FeatureDefines.xcconfig: + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Make force_static_libs_as_shared work on Mac OS + + We had to move a few LIBS += around that were in the wrong place, + and not caught when everything was just linked into the final + QtWebKit library. + + Reviewed by Simon Hausmann. + + * jsc.pro: No need for AppKit, we get it from WTF.pri + +2012-09-14 Kevin Funk <kevin.funk@kdab.com> + + Fix interpreter build + https://bugs.webkit.org/show_bug.cgi?id=96617 + + Reviewed by Simon Hausmann. + + Make compile. + + * interpreter/Interpreter.cpp: + 2012-09-14 Parth Patel <parpatel@rim.com> [BlackBerry] Switching from Slogger to Slogger2 requires changes in CMakeList of diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index f9a0eb29c..ec35cf673 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -95,6 +95,7 @@ ENABLE_LEGACY_NOTIFICATIONS_macosx = $(ENABLE_LEGACY_NOTIFICATIONS_macosx_$(TARG ENABLE_LEGACY_NOTIFICATIONS_macosx_1070 = ; ENABLE_LEGACY_NOTIFICATIONS_macosx_1080 = ENABLE_LEGACY_NOTIFICATIONS; ENABLE_LEGACY_NOTIFICATIONS_macosx_1090 = ENABLE_LEGACY_NOTIFICATIONS; +ENABLE_LEGACY_VENDOR_PREFIXES = ENABLE_LEGACY_VENDOR_PREFIXES; ENABLE_LINK_PREFETCH = ; ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; @@ -139,4 +140,4 @@ ENABLE_WIDGET_REGION_macosx = ENABLE_WIDGET_REGION; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/Configurations/Version.xcconfig b/Source/JavaScriptCore/Configurations/Version.xcconfig index 5cb8681fa..83578f9e9 100644 --- a/Source/JavaScriptCore/Configurations/Version.xcconfig +++ b/Source/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 10; +MINOR_VERSION = 11; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index b1715248c..e79542f9e 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -647,7 +647,6 @@ javascriptcore_sources += \ Source/JavaScriptCore/runtime/SamplingCounter.h \ Source/JavaScriptCore/runtime/SmallStrings.cpp \ Source/JavaScriptCore/runtime/SmallStrings.h \ - Source/JavaScriptCore/runtime/SparseArrayValueMapInlineMethods.h \ Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp \ Source/JavaScriptCore/runtime/SparseArrayValueMap.h \ Source/JavaScriptCore/runtime/StrictEvalActivation.cpp \ diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln index 787abc182..6f4236e03 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln @@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCore", "JavaScriptCore\JavaScriptCore.vcproj", "{011D10F1-B656-4A1B-A0C3-3842F02122C5}"
ProjectSection(ProjectDependencies) = postProject
{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ {9221744B-5715-4F56-9590-42F7AB23DD8B} = {9221744B-5715-4F56-9590-42F7AB23DD8B}
+ {D595E3F6-24F2-4C60-935C-95D50C6B3E96} = {D595E3F6-24F2-4C60-935C-95D50C6B3E96}
+ {877150A0-41B3-4730-9D98-1B8298098B14} = {877150A0-41B3-4730-9D98-1B8298098B14}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsc", "jsc\jsc.vcproj", "{C59E5129-B453-49B7-A52B-1E104715F76E}"
@@ -28,6 +31,30 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testRegExp", "testRegExp\te EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTFGenerated", "..\..\WTF\WTF.vcproj\WTFGenerated.vcproj", "{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntDesiredOffsets", "LLIntDesiredOffsets\LLIntDesiredOffsets.vcproj", "{877150A0-41B3-4730-9D98-1B8298098B14}"
+ ProjectSection(ProjectDependencies) = postProject
+ {5AE5F5E4-782D-4F63-B4D7-3977B52B9950} = {5AE5F5E4-782D-4F63-B4D7-3977B52B9950}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntOffsetsExtractor", "LLIntOffsetsExtractor\LLIntOffsetsExtractor.vcproj", "{D595E3F6-24F2-4C60-935C-95D50C6B3E96}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {877150A0-41B3-4730-9D98-1B8298098B14} = {877150A0-41B3-4730-9D98-1B8298098B14}
+ {5AE5F5E4-782D-4F63-B4D7-3977B52B9950} = {5AE5F5E4-782D-4F63-B4D7-3977B52B9950}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntAssembly", "LLIntAssembly\LLIntAssembly.vcproj", "{9221744B-5715-4F56-9590-42F7AB23DD8B}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D595E3F6-24F2-4C60-935C-95D50C6B3E96} = {D595E3F6-24F2-4C60-935C-95D50C6B3E96}
+ {5AE5F5E4-782D-4F63-B4D7-3977B52B9950} = {5AE5F5E4-782D-4F63-B4D7-3977B52B9950}
+ {877150A0-41B3-4730-9D98-1B8298098B14} = {877150A0-41B3-4730-9D98-1B8298098B14}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_All|Win32 = Debug_All|Win32
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index d75be0b67..f5cbbb150 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -518,10 +518,6 @@ >
</File>
<File
- RelativePath="..\..\runtime\SparseArrayValueMapInlineMethods.h"
- >
- </File>
- <File
RelativePath="..\..\runtime\ArrayStorage.h"
>
</File>
@@ -965,14 +961,14 @@ RelativePath="..\..\runtime\JSString.h"
>
</File>
- <File
- RelativePath="..\..\runtime\JSStringJoiner.cpp"
- >
- </File>
- <File
- RelativePath="..\..\runtime\JSStringJoiner.h"
- >
- </File>
+ <File
+ RelativePath="..\..\runtime\JSStringJoiner.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSStringJoiner.h"
+ >
+ </File>
<File
RelativePath="..\..\runtime\JSSymbolTableObject.cpp"
>
@@ -2022,9 +2018,73 @@ Name="llint"
>
<File
+ RelativePath="..\..\llint\LLIntCLoop.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntCLoop.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntCommon.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntData.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\llint\LLIntData.h"
>
</File>
+ <File
+ RelativePath="..\..\llint\LLIntEntrypoints.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntEntrypoints.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntExceptions.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntExceptions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntOfflineAsmConfig.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntOpcode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntSlowPaths.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntSlowPaths.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntThunks.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LLIntThunks.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LowLevelInterpreter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\llint\LowLevelInterpreter.h"
+ >
+ </File>
</Filter>
<Filter
Name="disassembler"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.make b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.make new file mode 100644 index 000000000..ea4a72902 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.make @@ -0,0 +1,9 @@ +all: + touch "%ConfigurationBuildDir%\buildfailed" + bash build-LLIntAssembly.sh "%ConfigurationBuildDir%" "$(WEBKITLIBRARIESDIR)" + -del "%ConfigurationBuildDir%\buildfailed" + +clean: + -del "%ConfigurationBuildDir%\buildfailed" + -del /s /q "%ConfigurationBuildDir%\obj\LLIntOffsetsExtractor\LLIntOffsetsExtractor.exe" + -del /s /q "%ConfigurationBuildDir%\obj\JavaScriptCore\DerivedSources\LLIntAssembly.h" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.vcproj new file mode 100644 index 000000000..ed6aae895 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/LLIntAssembly.vcproj @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntAssembly"
+ ProjectGUID="{9221744B-5715-4F56-9590-42F7AB23DD8B}"
+ RootNamespace="LLIntAssembly"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean
nmake -f LLIntAssembly.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean"
+ Output="LLIntAssembly.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean
nmake -f LLIntAssembly.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean"
+ Output="LLIntAssembly.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean
nmake -f LLIntAssembly.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean"
+ Output="LLIntAssembly.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean
nmake -f LLIntAssembly.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean"
+ Output="LLIntAssembly.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Production|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean
nmake -f LLIntAssembly.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean"
+ Output="LLIntAssembly.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean
nmake -f LLIntAssembly.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean"
+ Output="LLIntAssembly.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean
nmake -f LLIntAssembly.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntAssembly.make clean"
+ Output="LLIntAssembly.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\build-LLIntAssembly.sh"
+ >
+ </File>
+ <File
+ RelativePath=".\LLIntAssembly.make"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/build-LLIntAssembly.sh b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/build-LLIntAssembly.sh new file mode 100755 index 000000000..a809be776 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntAssembly/build-LLIntAssembly.sh @@ -0,0 +1,26 @@ +#!/usr/bin/bash + +SRCROOT="`pwd`/../.." +SRCROOT=`realpath "$SRCROOT"` +# Do a little dance to get the path into 8.3 form to make it safe for gnu make +# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173 +SRCROOT=`cygpath -m -s "$SRCROOT"` +SRCROOT=`cygpath -u "$SRCROOT"` +export SRCROOT + +XDSTROOT="$1" +export XDSTROOT +# Do a little dance to get the path into 8.3 form to make it safe for gnu make +# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173 +XDSTROOT=`cygpath -m -s "$XDSTROOT"` +XDSTROOT=`cygpath -u "$XDSTROOT"` +export XDSTROOT + +export BUILT_PRODUCTS_DIR="$XDSTROOT/obj" + +cd "${BUILT_PRODUCTS_DIR}/JavaScriptCore/DerivedSources" + +############################################################################## +# Step 3: Build LLIntOffsetsExtractor + +/usr/bin/env ruby "${SRCROOT}/offlineasm/asm.rb" "${SRCROOT}/llint/LowLevelInterpreter.asm" "${BUILT_PRODUCTS_DIR}/LLIntOffsetsExtractor/LLIntOffsetsExtractor.exe" "LLIntAssembly.h" || exit 1 diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.make b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.make new file mode 100644 index 000000000..996c92377 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.make @@ -0,0 +1,9 @@ +all: + touch "%ConfigurationBuildDir%\buildfailed" + bash build-LLIntDesiredOffsets.sh "%ConfigurationBuildDir%" "$(WEBKITLIBRARIESDIR)" + + -del "%ConfigurationBuildDir%\buildfailed" + +clean: + -del "%ConfigurationBuildDir%\buildfailed" + -del /s /q "%ConfigurationBuildDir%\obj\JavaScriptCore\DerivedSources\LLIntDesiredOffsets.h" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.vcproj new file mode 100644 index 000000000..0ece351b0 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/LLIntDesiredOffsets.vcproj @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntDesiredOffsets"
+ ProjectGUID="{877150A0-41B3-4730-9D98-1B8298098B14}"
+ RootNamespace="LLIntDesiredOffsets"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean
nmake -f LLIntDesiredOffsets.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean"
+ Output="LLIntDesiredOffsets.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean
nmake -f LLIntDesiredOffsets.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean"
+ Output="LLIntDesiredOffsets.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean
nmake -f LLIntDesiredOffsets.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean"
+ Output="LLIntDesiredOffsets.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean
nmake -f LLIntDesiredOffsets.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean"
+ Output="LLIntDesiredOffsets.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Production|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean
nmake -f LLIntDesiredOffsets.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean"
+ Output="LLIntDesiredOffsets.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean
nmake -f LLIntDesiredOffsets.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean"
+ Output="LLIntDesiredOffsets.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean
nmake -f LLIntDesiredOffsets.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)
set PRODUCTION=$(PRODUCTION)
nmake /nologo -f LLIntDesiredOffsets.make clean"
+ Output="LLIntDesiredOffsets.h"
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\build-LLIntDesiredOffsets.sh"
+ >
+ </File>
+ <File
+ RelativePath=".\LLIntDesiredOffsets.make"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/build-LLIntDesiredOffsets.sh b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/build-LLIntDesiredOffsets.sh new file mode 100755 index 000000000..57d715ca1 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntDesiredOffsets/build-LLIntDesiredOffsets.sh @@ -0,0 +1,25 @@ +#!/usr/bin/bash + +SRCROOT="`pwd`/../.." +SRCROOT=`realpath "$SRCROOT"` +# Do a little dance to get the path into 8.3 form to make it safe for gnu make +# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173 +SRCROOT=`cygpath -m -s "$SRCROOT"` +SRCROOT=`cygpath -u "$SRCROOT"` +export SRCROOT + +XDSTROOT="$1" +export XDSTROOT +# Do a little dance to get the path into 8.3 form to make it safe for gnu make +# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173 +XDSTROOT=`cygpath -m -s "$XDSTROOT"` +XDSTROOT=`cygpath -u "$XDSTROOT"` +export XDSTROOT + +export BUILT_PRODUCTS_DIR="$XDSTROOT/obj/JavaScriptCore/DerivedSources" + +############################################################################## +# Step 1: Generate LLIntDesiredOffsets.h +mkdir -p "${BUILT_PRODUCTS_DIR}" + +/usr/bin/env ruby "${SRCROOT}/offlineasm/generate_offset_extractor.rb" "${SRCROOT}/llint/LowLevelInterpreter.asm" "${BUILT_PRODUCTS_DIR}/LLIntDesiredOffsets.h" diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractor.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractor.vcproj new file mode 100644 index 000000000..4862b658a --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractor.vcproj @@ -0,0 +1,476 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractor"
+ ProjectGUID="{D595E3F6-24F2-4C60-935C-95D50C6B3E96}"
+ RootNamespace="LLIntOffsetsExtractor"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\LLIntOffsetsExtractor"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\LLIntOffsetsExtractorDebug.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\LLIntOffsetsExtractor"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\LLIntOffsetsExtractorRelease.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\LLIntOffsetsExtractor"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\LLIntOffsetsExtractorDebugCairoCFLite.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\LLIntOffsetsExtractor"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\LLIntOffsetsExtractorDebugAll.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Production|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\LLIntOffsetsExtractor"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\LLIntOffsetsExtractorProduction.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\LLIntOffsetsExtractor"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\LLIntOffsetsExtractorReleaseCairoCFLite.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO|Win32"
+ OutputDirectory="$(ConfigurationBuildDir)\obj\LLIntOffsetsExtractor"
+ IntermediateDirectory="$(ConfigurationBuildDir)\obj\$(ProjectName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\LLIntOffsetsExtractorReleasePGO.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="..\..\llint\LLIntOffsetsExtractor.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorCommon.vsprops new file mode 100644 index 000000000..6340081d9 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorCommon.vsprops @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorCommon"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\private\JavaScriptCore";"$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\";../../;"../../os-win32/";../../assembler/;../../API/;../../parser/;../../heap/;../../runtime/;../../VM/;../../bytecode/;../../interpreter/;../../wtf/;../../debugger/;../../bytecompiler/;../../profiler;../../jit/;"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include""
+ PreprocessorDefinitions="__STD_C"
+ ForcedIncludeFiles="ICUVersion.h"
+ ForcedUsingFiles=""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libicuin$(LibraryConfigSuffix).lib libicuuc$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib user32.lib WTF$(WebKitConfigSuffix).lib"
+ AdditionalLibraryDirectories=""$(IntDir)\lib""
+ SubSystem="1"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebug.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebug.vsprops new file mode 100644 index 000000000..69c0a2738 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebug.vsprops @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorDebug"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\LLIntOffsetsExtractorCommon.vsprops"
+ >
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugAll.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugAll.vsprops new file mode 100644 index 000000000..e508f9160 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugAll.vsprops @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorDebugAll"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\LLIntOffsetsExtractorCommon.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops"
+ >
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugCairoCFLite.vsprops new file mode 100644 index 000000000..33804ca90 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorDebugCairoCFLite.vsprops @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorDebugCairoCFLite"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\LLIntOffsetsExtractorCommon.vsprops"
+ >
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorProduction.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorProduction.vsprops new file mode 100644 index 000000000..3683199fd --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorProduction.vsprops @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorProduction"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\LLIntOffsetsExtractorCommon.vsprops"
+ >
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorRelease.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorRelease.vsprops new file mode 100644 index 000000000..b2f4e872d --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorRelease.vsprops @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorRelease"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\LLIntOffsetsExtractorCommon.vsprops"
+ >
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleaseCairoCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleaseCairoCFLite.vsprops new file mode 100644 index 000000000..4adb12216 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleaseCairoCFLite.vsprops @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorReleaseCairoCFLite"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\LLIntOffsetsExtractorCommon.vsprops"
+ >
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleasePGO.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleasePGO.vsprops new file mode 100644 index 000000000..331f96af2 --- /dev/null +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorReleasePGO.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LLIntOffsetsExtractorReleasePGO"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\LLIntOffsetsExtractorCommon.vsprops"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\..\Production\include\private";"$(ConfigurationBuildDir)\..\Production\include\private\wtf\text""
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index db75c0761..7c5ebaded 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -200,7 +200,6 @@ 0FB7F39C15ED8E4600F167B2 /* PropertyStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39115ED8E3800F167B2 /* Reject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 0FB7F39F15ED8E4600F167B2 /* SparseArrayValueMapInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39315ED8E3800F167B2 /* SparseArrayValueMapInlineMethods.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */; }; 0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0FBD7E691447999600481315 /* CodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBD7E671447998F00481315 /* CodeOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -971,7 +970,6 @@ 0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyStorage.h; sourceTree = "<group>"; }; 0FB7F39115ED8E3800F167B2 /* Reject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reject.h; sourceTree = "<group>"; }; 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SparseArrayValueMap.h; sourceTree = "<group>"; }; - 0FB7F39315ED8E3800F167B2 /* SparseArrayValueMapInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SparseArrayValueMapInlineMethods.h; sourceTree = "<group>"; }; 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFGExitProfile.cpp; sourceTree = "<group>"; }; 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFGExitProfile.h; sourceTree = "<group>"; }; 0FBD7E671447998F00481315 /* CodeOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeOrigin.h; sourceTree = "<group>"; }; @@ -2057,7 +2055,6 @@ 0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */, 0FB7F39115ED8E3800F167B2 /* Reject.h */, 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */, - 0FB7F39315ED8E3800F167B2 /* SparseArrayValueMapInlineMethods.h */, C2D58C3315912FEE0021A844 /* GCActivityCallback.cpp */, BCF605110E203EF800B9A64D /* ArgList.cpp */, BCF605120E203EF800B9A64D /* ArgList.h */, @@ -2952,7 +2949,6 @@ 0FB7F39C15ED8E4600F167B2 /* PropertyStorage.h in Headers */, 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */, 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */, - 0FB7F39F15ED8E4600F167B2 /* SparseArrayValueMapInlineMethods.h in Headers */, 0F0CD4C215F1A6070032F1C0 /* PutDirectIndexMode.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARM.h b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h index e3b0be9da..c4d6c92a5 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -212,6 +212,14 @@ public: m_assembler.orrs(dest, dest, src); } + void or32(RegisterID src, AbsoluteAddress dest) + { + move(TrustedImmPtr(dest.m_ptr), ARMRegisters::S0); + load32(Address(ARMRegisters::S0), ARMRegisters::S1); + or32(src, ARMRegisters::S1); + store32(ARMRegisters::S1, ARMRegisters::S0); + } + void or32(TrustedImm32 imm, RegisterID dest) { m_assembler.orrs(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h index d2da886c2..1dfe888d3 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -313,6 +313,14 @@ public: { m_assembler.orr(dest, dest, src); } + + void or32(RegisterID src, AbsoluteAddress dest) + { + move(TrustedImmPtr(dest.m_ptr), addressTempRegister); + load32(addressTempRegister, dataTempRegister); + or32(src, dataTempRegister); + store32(dataTempRegister, addressTempRegister); + } void or32(TrustedImm32 imm, RegisterID dest) { diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h index d1a4ff3c4..d46867ae3 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h @@ -84,6 +84,11 @@ public: m_assembler.orl_im(imm.m_value, address.m_ptr); } + void or32(RegisterID reg, AbsoluteAddress address) + { + m_assembler.orl_rm(reg, address.m_ptr); + } + void sub32(TrustedImm32 imm, AbsoluteAddress address) { m_assembler.subl_im(imm.m_value, address.m_ptr); diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h index ac90516f4..c827e8ae9 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h @@ -75,6 +75,12 @@ public: or32(imm, Address(scratchRegister)); } + void or32(RegisterID reg, AbsoluteAddress address) + { + move(TrustedImmPtr(address.m_ptr), scratchRegister); + or32(reg, Address(scratchRegister)); + } + void sub32(TrustedImm32 imm, AbsoluteAddress address) { move(TrustedImmPtr(address.m_ptr), scratchRegister); diff --git a/Source/JavaScriptCore/assembler/X86Assembler.h b/Source/JavaScriptCore/assembler/X86Assembler.h index adaee4bc0..acd573049 100644 --- a/Source/JavaScriptCore/assembler/X86Assembler.h +++ b/Source/JavaScriptCore/assembler/X86Assembler.h @@ -541,6 +541,11 @@ public: m_formatter.immediate32(imm); } } + + void orl_rm(RegisterID src, const void* addr) + { + m_formatter.oneByteOp(OP_OR_EvGv, src, addr); + } #endif void subl_rr(RegisterID src, RegisterID dst) diff --git a/Source/JavaScriptCore/bytecode/ArrayProfile.cpp b/Source/JavaScriptCore/bytecode/ArrayProfile.cpp index 6b97f7806..9f4e1ce20 100644 --- a/Source/JavaScriptCore/bytecode/ArrayProfile.cpp +++ b/Source/JavaScriptCore/bytecode/ArrayProfile.cpp @@ -43,6 +43,11 @@ void ArrayProfile::computeUpdatedPrediction(OperationInProgress operation) m_lastSeenStructure = 0; } + if (hasTwoOrMoreBitsSet(m_observedArrayModes)) { + m_structureIsPolymorphic = true; + m_expectedStructure = 0; + } + if (operation == Collection && m_expectedStructure && !Heap::isMarked(m_expectedStructure)) { diff --git a/Source/JavaScriptCore/bytecode/ArrayProfile.h b/Source/JavaScriptCore/bytecode/ArrayProfile.h index 312473f3c..43818d77d 100644 --- a/Source/JavaScriptCore/bytecode/ArrayProfile.h +++ b/Source/JavaScriptCore/bytecode/ArrayProfile.h @@ -36,7 +36,7 @@ namespace JSC { class LLIntOffsetsExtractor; // This is a bitfield where each bit represents an IndexingType that we have seen. -// There are 17 indexing types (0 to 16, inclusive), so 32 bits is more than enough. +// There are 32 indexing types, so an unsigned is enough. typedef unsigned ArrayModes; #define asArrayModes(type) \ @@ -44,7 +44,7 @@ typedef unsigned ArrayModes; inline ArrayModes arrayModeFromStructure(Structure* structure) { - return asArrayModes(structure->indexingTypeIncludingHistory()); + return asArrayModes(structure->indexingType()); } class ArrayProfile { @@ -70,6 +70,7 @@ public: unsigned bytecodeOffset() const { return m_bytecodeOffset; } Structure** addressOfLastSeenStructure() { return &m_lastSeenStructure; } + ArrayModes* addressOfArrayModes() { return &m_observedArrayModes; } void observeStructure(Structure* structure) { @@ -79,7 +80,10 @@ public: void computeUpdatedPrediction(OperationInProgress operation = NoOperation); Structure* expectedStructure() const { return m_expectedStructure; } - bool structureIsPolymorphic() const { return m_structureIsPolymorphic; } + bool structureIsPolymorphic() const + { + return m_structureIsPolymorphic; + } bool hasDefiniteStructure() const { return !structureIsPolymorphic() && m_expectedStructure; diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index 07d1e0a06..d0c969c6d 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -1544,6 +1544,25 @@ namespace JSC { } #endif + inline JSValue ExecState::argumentAfterCapture(size_t argument) + { + if (argument >= argumentCount()) + return jsUndefined(); + + if (!codeBlock()) + return this[argumentOffset(argument)].jsValue(); + + if (argument >= static_cast<size_t>(codeBlock()->symbolTable()->parameterCount())) + return this[argumentOffset(argument)].jsValue(); + + const SlowArgument* slowArguments = codeBlock()->symbolTable()->slowArguments(); + if (!slowArguments || slowArguments[argument].status == SlowArgument::Normal) + return this[argumentOffset(argument)].jsValue(); + + ASSERT(slowArguments[argument].status == SlowArgument::Captured); + return this[slowArguments[argument].indexIfCaptured].jsValue(); + } + #if ENABLE(DFG_JIT) inline void DFGCodeBlocks::mark(void* candidateCodeBlock) { diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 055f605d2..e7a80fe2c 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -423,18 +423,19 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc } } - bool capturesAnyArgument = codeBlock->usesArguments() || codeBlock->usesEval() || m_shouldEmitDebugHooks; // May reify arguments object. - if (!capturesAnyArgument && functionBody->hasCapturedVariables()) { + bool mayReifyArgumentsObject = codeBlock->usesArguments() || codeBlock->usesEval() || m_shouldEmitDebugHooks; + bool capturesAnyArgumentByName = false; + if (functionBody->hasCapturedVariables()) { FunctionParameters& parameters = *functionBody->parameters(); for (size_t i = 0; i < parameters.size(); ++i) { if (!functionBody->captures(parameters[i])) continue; - capturesAnyArgument = true; + capturesAnyArgumentByName = true; break; } } - if (capturesAnyArgument) { + if (mayReifyArgumentsObject || capturesAnyArgumentByName) { symbolTable->setCaptureMode(SharedSymbolTable::AllOfTheThings); symbolTable->setCaptureStart(-CallFrame::offsetFor(symbolTable->parameterCountIncludingThis())); } else { @@ -442,6 +443,16 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc symbolTable->setCaptureStart(m_codeBlock->m_numVars); } + if (mayReifyArgumentsObject && capturesAnyArgumentByName) { + size_t parameterCount = symbolTable->parameterCount(); + OwnArrayPtr<SlowArgument> slowArguments = adoptArrayPtr(new SlowArgument[parameterCount]); + for (size_t i = 0; i < parameterCount; ++i) { + slowArguments[i].status = SlowArgument::Captured; + slowArguments[i].indexIfCaptured = CallFrame::argumentOffset(i); + } + symbolTable->setSlowArguments(slowArguments.release()); + } + RegisterID* calleeRegister = resolveCallee(functionBody); // May push to the scope chain and/or add a captured var. const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack(); @@ -681,7 +692,7 @@ bool BytecodeGenerator::willResolveToArguments(const Identifier& ident) SymbolTableEntry entry = symbolTable().get(ident.impl()); if (entry.isNull()) return false; - + if (m_codeBlock->usesArguments() && m_codeType == FunctionCode) return true; diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index b860a7310..153ba311c 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -147,7 +147,13 @@ void AbstractState::initialize(Graph& graph) for (size_t i = 0; i < graph.m_mustHandleValues.size(); ++i) { AbstractValue value; value.setMostSpecific(graph.m_mustHandleValues[i]); - block->valuesAtHead.operand(graph.m_mustHandleValues.operandForIndex(i)).merge(value); + int operand = graph.m_mustHandleValues.operandForIndex(i); + block->valuesAtHead.operand(operand).merge(value); +#if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) + dataLog(" Initializing Block #%u, operand r%d, to ", blockIndex, operand); + block->valuesAtHead.operand(operand).dump(WTF::dataFile()); + dataLog("\n"); +#endif } block->cfaShouldRevisit = true; } @@ -1093,14 +1099,21 @@ bool AbstractState::execute(unsigned indexInBlock) break; case NewArray: - case NewArrayBuffer: - node.setCanExit(false); + node.setCanExit(true); forNode(nodeIndex).set(m_graph.globalObjectFor(node.codeOrigin)->arrayStructure()); m_haveStructures = true; break; + case NewArrayBuffer: + // Unless we're having a bad time, this node can change its mind about what structure + // it uses. + node.setCanExit(false); + forNode(nodeIndex).set(SpecArray); + break; + case NewArrayWithSize: - speculateInt32Unary(node); + node.setCanExit(true); + forNode(node.child1()).filter(SpecInt32); forNode(nodeIndex).set(m_graph.globalObjectFor(node.codeOrigin)->arrayStructure()); m_haveStructures = true; break; @@ -1293,20 +1306,6 @@ bool AbstractState::execute(unsigned indexInBlock) !value.m_currentKnownStructure.isSubsetOf(set) || !isCellSpeculation(value.m_type)); value.filter(set); - // This is likely to be unnecessary, but it's conservative, and that's a good thing. - // This is trying to avoid situations where the CFA proves that this structure check - // must fail due to a future structure proof. We have two options at that point. We - // can either compile all subsequent code as we would otherwise, or we can ensure - // that the subsequent code is never reachable. The former is correct because the - // Proof Is Infallible (TM) -- hence even if we don't force the subsequent code to - // be unreachable, it must be unreachable nonetheless. But imagine what would happen - // if the proof was borked. In the former case, we'd get really bizarre bugs where - // we assumed that the structure of this object was known even though it wasn't. In - // the latter case, we'd have a slight performance pathology because this would be - // turned into an OSR exit unnecessarily. Which would you rather have? - if (value.m_currentKnownStructure.isClear() - || value.m_futurePossibleStructure.isClear()) - m_isValid = false; m_haveStructures = true; break; } @@ -1325,10 +1324,6 @@ bool AbstractState::execute(unsigned indexInBlock) ASSERT(value.isClear() || isCellSpeculation(value.m_type)); // Value could be clear if we've proven must-exit due to a speculation statically known to be bad. value.filter(node.structure()); - // See comment in CheckStructure for why this is here. - if (value.m_currentKnownStructure.isClear() - || value.m_futurePossibleStructure.isClear()) - m_isValid = false; m_haveStructures = true; node.setCanExit(true); break; @@ -1337,9 +1332,11 @@ bool AbstractState::execute(unsigned indexInBlock) case PutStructure: case PhantomPutStructure: node.setCanExit(false); - clobberStructures(indexInBlock); - forNode(node.child1()).set(node.structureTransitionData().newStructure); - m_haveStructures = true; + if (!forNode(node.child1()).m_currentKnownStructure.isClear()) { + clobberStructures(indexInBlock); + forNode(node.child1()).set(node.structureTransitionData().newStructure); + m_haveStructures = true; + } break; case GetButterfly: case AllocatePropertyStorage: diff --git a/Source/JavaScriptCore/dfg/DFGArrayMode.cpp b/Source/JavaScriptCore/dfg/DFGArrayMode.cpp index eda578205..fe2a05b8b 100644 --- a/Source/JavaScriptCore/dfg/DFGArrayMode.cpp +++ b/Source/JavaScriptCore/dfg/DFGArrayMode.cpp @@ -42,10 +42,16 @@ Array::Mode fromObserved(ArrayModes modes, bool makeSafe) return Array::Undecided; case asArrayModes(NonArrayWithArrayStorage): return makeSafe ? Array::ArrayStorageOutOfBounds : Array::ArrayStorage; + case asArrayModes(NonArrayWithSlowPutArrayStorage): + return Array::SlowPutArrayStorage; case asArrayModes(ArrayWithArrayStorage): return makeSafe ? Array::ArrayWithArrayStorageOutOfBounds : Array::ArrayWithArrayStorage; + case asArrayModes(ArrayWithSlowPutArrayStorage): + return Array::ArrayWithSlowPutArrayStorage; case asArrayModes(NonArrayWithArrayStorage) | asArrayModes(ArrayWithArrayStorage): return makeSafe ? Array::PossiblyArrayWithArrayStorageOutOfBounds : Array::PossiblyArrayWithArrayStorage; + case asArrayModes(NonArrayWithSlowPutArrayStorage) | asArrayModes(ArrayWithSlowPutArrayStorage): + return Array::PossiblyArrayWithSlowPutArrayStorage; default: // We know that this is possibly a kind of array for which, though there is no // useful data in the array profile, we may be able to extract useful data from @@ -124,15 +130,29 @@ bool modeAlreadyChecked(AbstractValue& value, Array::Mode arrayMode) case Array::String: return isStringSpeculation(value.m_type); - case NON_ARRAY_ARRAY_STORAGE_MODES: + case Array::ArrayStorage: + case Array::ArrayStorageOutOfBounds: + case Array::PossiblyArrayWithArrayStorage: + case Array::PossiblyArrayWithArrayStorageOutOfBounds: return value.m_currentKnownStructure.hasSingleton() && (value.m_currentKnownStructure.singleton()->indexingType() & HasArrayStorage); - - case ARRAY_WITH_ARRAY_STORAGE_MODES: + + case Array::SlowPutArrayStorage: + case Array::PossiblyArrayWithSlowPutArrayStorage: + return value.m_currentKnownStructure.hasSingleton() + && (value.m_currentKnownStructure.singleton()->indexingType() & HasSlowPutArrayStorage); + + case Array::ArrayWithArrayStorage: + case Array::ArrayWithArrayStorageOutOfBounds: return value.m_currentKnownStructure.hasSingleton() && (value.m_currentKnownStructure.singleton()->indexingType() & HasArrayStorage) && (value.m_currentKnownStructure.singleton()->indexingType() & IsArray); + case Array::ArrayWithSlowPutArrayStorage: + return value.m_currentKnownStructure.hasSingleton() + && (value.m_currentKnownStructure.singleton()->indexingType() & HasSlowPutArrayStorage) + && (value.m_currentKnownStructure.singleton()->indexingType() & IsArray); + case Array::Arguments: return isArgumentsSpeculation(value.m_type); @@ -184,14 +204,20 @@ const char* modeToString(Array::Mode mode) return "String"; case Array::ArrayStorage: return "ArrayStorage"; + case Array::SlowPutArrayStorage: + return "SlowPutArrayStorage"; case Array::ArrayStorageOutOfBounds: return "ArrayStorageOutOfBounds"; case Array::ArrayWithArrayStorage: return "ArrayWithArrayStorage"; + case Array::ArrayWithSlowPutArrayStorage: + return "ArrayWithSlowPutArrayStorage"; case Array::ArrayWithArrayStorageOutOfBounds: return "ArrayWithArrayStorageOutOfBounds"; case Array::PossiblyArrayWithArrayStorage: return "PossiblyArrayWithArrayStorage"; + case Array::PossiblyArrayWithSlowPutArrayStorage: + return "PossiblyArrayWithSlowPutArrayStorage"; case Array::PossiblyArrayWithArrayStorageOutOfBounds: return "PossiblyArrayWithArrayStorageOutOfBounds"; case Array::Arguments: diff --git a/Source/JavaScriptCore/dfg/DFGArrayMode.h b/Source/JavaScriptCore/dfg/DFGArrayMode.h index 2eb009be0..cc8b1b809 100644 --- a/Source/JavaScriptCore/dfg/DFGArrayMode.h +++ b/Source/JavaScriptCore/dfg/DFGArrayMode.h @@ -47,10 +47,13 @@ enum Mode { Generic, String, ArrayStorage, + SlowPutArrayStorage, ArrayStorageOutOfBounds, ArrayWithArrayStorage, + ArrayWithSlowPutArrayStorage, ArrayWithArrayStorageOutOfBounds, PossiblyArrayWithArrayStorage, + PossiblyArrayWithSlowPutArrayStorage, PossiblyArrayWithArrayStorageOutOfBounds, Arguments, Int8Array, @@ -70,11 +73,14 @@ enum Mode { // have the word "ArrayStorage" in them. #define NON_ARRAY_ARRAY_STORAGE_MODES \ Array::ArrayStorage: \ + case Array::SlowPutArrayStorage: \ case Array::ArrayStorageOutOfBounds: \ case Array::PossiblyArrayWithArrayStorage: \ + case Array::PossiblyArrayWithSlowPutArrayStorage: \ case Array::PossiblyArrayWithArrayStorageOutOfBounds #define ARRAY_WITH_ARRAY_STORAGE_MODES \ Array::ArrayWithArrayStorage: \ + case Array::ArrayWithSlowPutArrayStorage: \ case Array::ArrayWithArrayStorageOutOfBounds #define ALL_ARRAY_STORAGE_MODES \ NON_ARRAY_ARRAY_STORAGE_MODES: \ @@ -83,8 +89,13 @@ enum Mode { Array::ArrayStorage: \ case Array::ArrayWithArrayStorage: \ case Array::PossiblyArrayWithArrayStorage +#define SLOW_PUT_ARRAY_STORAGE_MODES \ + Array::SlowPutArrayStorage: \ + case Array::ArrayWithSlowPutArrayStorage: \ + case Array::PossiblyArrayWithSlowPutArrayStorage #define OUT_OF_BOUNDS_ARRAY_STORAGE_MODES \ - Array::ArrayStorageOutOfBounds: \ + SLOW_PUT_ARRAY_STORAGE_MODES: \ + case Array::ArrayStorageOutOfBounds: \ case Array::ArrayWithArrayStorageOutOfBounds: \ case Array::PossiblyArrayWithArrayStorageOutOfBounds @@ -128,6 +139,16 @@ inline bool isInBoundsAccess(Array::Mode arrayMode) } } +inline bool isSlowPutAccess(Array::Mode arrayMode) +{ + switch (arrayMode) { + case SLOW_PUT_ARRAY_STORAGE_MODES: + return true; + default: + return false; + } +} + inline bool canCSEStorage(Array::Mode arrayMode) { switch (arrayMode) { diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index 19a389218..67ae7bf03 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -1178,7 +1178,7 @@ void DFG_OPERATION operationTearOffArguments(ExecState* exec, JSCell* argumentsC { ASSERT(exec->codeBlock()->usesArguments()); if (activationCell) { - jsCast<Arguments*>(argumentsCell)->didTearOffActivation(exec->globalData(), jsCast<JSActivation*>(activationCell)); + jsCast<Arguments*>(argumentsCell)->didTearOffActivation(exec, jsCast<JSActivation*>(activationCell)); return; } jsCast<Arguments*>(argumentsCell)->tearOff(exec); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index b1f3212f9..07cb11032 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -324,7 +324,8 @@ void SpeculativeJIT::checkArray(Node& node) m_jit.branchTest8( MacroAssembler::Zero, MacroAssembler::Address(temp.gpr(), Structure::indexingTypeOffset()), - MacroAssembler::TrustedImm32(HasArrayStorage))); + MacroAssembler::TrustedImm32( + isSlowPutAccess(node.arrayMode()) ? HasSlowPutArrayStorage : HasArrayStorage))); noResult(m_compileIndex); return; @@ -345,7 +346,8 @@ void SpeculativeJIT::checkArray(Node& node) speculationCheck( Uncountable, JSValueRegs(), NoNode, m_jit.branchTest32( - MacroAssembler::Zero, tempGPR, MacroAssembler::TrustedImm32(HasArrayStorage))); + MacroAssembler::Zero, tempGPR, MacroAssembler::TrustedImm32( + isSlowPutAccess(node.arrayMode()) ? HasSlowPutArrayStorage : HasArrayStorage))); noResult(m_compileIndex); return; @@ -3055,28 +3057,24 @@ void SpeculativeJIT::compileGetByValOnArguments(Node& node) ASSERT(modeAlreadyChecked(m_state.forNode(node.child1()), Array::Arguments)); - m_jit.loadPtr( - MacroAssembler::Address(baseReg, Arguments::offsetOfData()), - scratchReg); - // Two really lame checks. speculationCheck( Uncountable, JSValueSource(), NoNode, m_jit.branchPtr( MacroAssembler::AboveOrEqual, propertyReg, - MacroAssembler::Address(scratchReg, OBJECT_OFFSETOF(ArgumentsData, numArguments)))); + MacroAssembler::Address(baseReg, OBJECT_OFFSETOF(Arguments, m_numArguments)))); speculationCheck( Uncountable, JSValueSource(), NoNode, m_jit.branchTestPtr( MacroAssembler::NonZero, MacroAssembler::Address( - scratchReg, OBJECT_OFFSETOF(ArgumentsData, deletedArguments)))); + baseReg, OBJECT_OFFSETOF(Arguments, m_slowArguments)))); m_jit.move(propertyReg, resultReg); m_jit.neg32(resultReg); m_jit.signExtend32ToPtr(resultReg, resultReg); m_jit.loadPtr( - MacroAssembler::Address(scratchReg, OBJECT_OFFSETOF(ArgumentsData, registers)), + MacroAssembler::Address(baseReg, OBJECT_OFFSETOF(Arguments, m_registers)), scratchReg); #if USE(JSVALUE32_64) @@ -3116,18 +3114,14 @@ void SpeculativeJIT::compileGetArgumentsLength(Node& node) ASSERT(modeAlreadyChecked(m_state.forNode(node.child1()), Array::Arguments)); - m_jit.loadPtr( - MacroAssembler::Address(baseReg, Arguments::offsetOfData()), - resultReg); - speculationCheck( Uncountable, JSValueSource(), NoNode, m_jit.branchTest8( MacroAssembler::NonZero, - MacroAssembler::Address(resultReg, OBJECT_OFFSETOF(ArgumentsData, overrodeLength)))); + MacroAssembler::Address(baseReg, OBJECT_OFFSETOF(Arguments, m_overrodeLength)))); m_jit.load32( - MacroAssembler::Address(resultReg, OBJECT_OFFSETOF(ArgumentsData, numArguments)), + MacroAssembler::Address(baseReg, OBJECT_OFFSETOF(Arguments, m_numArguments)), resultReg); integerResult(resultReg, m_compileIndex); } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index f40db37a6..85e32ddb9 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -2741,25 +2741,37 @@ void SpeculativeJIT::compile(Node& node) // Check if we're writing to a hole; if so increment m_numValuesInVector. MacroAssembler::Jump notHoleValue = m_jit.branch32(MacroAssembler::NotEqual, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), TrustedImm32(JSValue::EmptyValueTag)); - m_jit.add32(TrustedImm32(1), MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); - - // If we're writing to a hole we might be growing the array; - MacroAssembler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); - m_jit.add32(TrustedImm32(1), propertyReg); - m_jit.store32(propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); - m_jit.sub32(TrustedImm32(1), propertyReg); - - lengthDoesNotNeedUpdate.link(&m_jit); + MacroAssembler::Jump isHoleValue; + if (isSlowPutAccess(arrayMode)) { + // This is sort of strange. If we wanted to optimize this code path, we would invert + // the above branch. But it's simply not worth it since this only happens if we're + // already having a bad time. + isHoleValue = m_jit.jump(); + } else { + m_jit.add32(TrustedImm32(1), MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); + + // If we're writing to a hole we might be growing the array; + MacroAssembler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); + m_jit.add32(TrustedImm32(1), propertyReg); + m_jit.store32(propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); + m_jit.sub32(TrustedImm32(1), propertyReg); + + lengthDoesNotNeedUpdate.link(&m_jit); + } notHoleValue.link(&m_jit); // Store the value to the array. m_jit.store32(valueTagReg, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag))); m_jit.store32(valuePayloadReg, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload))); - if (!isInBoundsAccess(node.arrayMode())) { + if (!isInBoundsAccess(arrayMode)) { + MacroAssembler::JumpList slowCases; + slowCases.append(beyondArrayBounds); + if (isSlowPutAccess(arrayMode)) + slowCases.append(isHoleValue); addSlowPathGenerator( slowPathCall( - beyondArrayBounds, this, + slowCases, this, m_jit.codeBlock()->isStrictMode() ? operationPutByValBeyondArrayBoundsStrict : operationPutByValBeyondArrayBoundsNonStrict, NoResult, baseReg, propertyReg, valueTagReg, valuePayloadReg)); } @@ -3128,13 +3140,17 @@ void SpeculativeJIT::compile(Node& node) } case NewArray: { + JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node.codeOrigin); + if (!globalObject->isHavingABadTime()) + globalObject->havingABadTimeWatchpoint()->add(speculationWatchpoint()); + if (!node.numChildren()) { flushRegisters(); GPRResult result(this); GPRResult2 resultTagIgnored(this); callOperation( operationNewEmptyArray, resultTagIgnored.gpr(), result.gpr(), - m_jit.graph().globalObjectFor(node.codeOrigin)->arrayStructure()); + globalObject->arrayStructure()); cellResult(result.gpr(), m_compileIndex); break; } @@ -3167,8 +3183,7 @@ void SpeculativeJIT::compile(Node& node) GPRResult2 resultTag(this); callOperation( - operationNewArray, resultTag.gpr(), resultPayload.gpr(), - m_jit.graph().globalObjectFor(node.codeOrigin)->arrayStructure(), + operationNewArray, resultTag.gpr(), resultPayload.gpr(), globalObject->arrayStructure(), static_cast<void *>(buffer), node.numChildren()); if (scratchSize) { @@ -3184,6 +3199,10 @@ void SpeculativeJIT::compile(Node& node) } case NewArrayWithSize: { + JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node.codeOrigin); + if (!globalObject->isHavingABadTime()) + globalObject->havingABadTimeWatchpoint()->add(speculationWatchpoint()); + SpeculateStrictInt32Operand size(this, node.child1()); GPRReg sizeGPR = size.gpr(); flushRegisters(); @@ -3191,7 +3210,7 @@ void SpeculativeJIT::compile(Node& node) GPRResult2 resultTagIgnored(this); callOperation( operationNewArrayWithSize, resultTagIgnored.gpr(), result.gpr(), - m_jit.graph().globalObjectFor(node.codeOrigin)->arrayStructure(), sizeGPR); + globalObject->arrayStructure(), sizeGPR); cellResult(result.gpr(), m_compileIndex); break; } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index aa5fe6773..f050af699 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -2760,24 +2760,36 @@ void SpeculativeJIT::compile(Node& node) // Check if we're writing to a hole; if so increment m_numValuesInVector. MacroAssembler::Jump notHoleValue = m_jit.branchTestPtr(MacroAssembler::NonZero, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); - m_jit.add32(TrustedImm32(1), MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); - - // If we're writing to a hole we might be growing the array; - MacroAssembler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); - m_jit.add32(TrustedImm32(1), propertyReg); - m_jit.store32(propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); - m_jit.sub32(TrustedImm32(1), propertyReg); - - lengthDoesNotNeedUpdate.link(&m_jit); + MacroAssembler::Jump isHoleValue; + if (isSlowPutAccess(arrayMode)) { + // This is sort of strange. If we wanted to optimize this code path, we would invert + // the above branch. But it's simply not worth it since this only happens if we're + // already having a bad time. + isHoleValue = m_jit.jump(); + } else { + m_jit.add32(TrustedImm32(1), MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); + + // If we're writing to a hole we might be growing the array; + MacroAssembler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); + m_jit.add32(TrustedImm32(1), propertyReg); + m_jit.store32(propertyReg, MacroAssembler::Address(storageReg, ArrayStorage::lengthOffset())); + m_jit.sub32(TrustedImm32(1), propertyReg); + + lengthDoesNotNeedUpdate.link(&m_jit); + } notHoleValue.link(&m_jit); // Store the value to the array. m_jit.storePtr(valueReg, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); if (!isInBoundsAccess(arrayMode)) { + MacroAssembler::JumpList slowCases; + slowCases.append(beyondArrayBounds); + if (isSlowPutAccess(arrayMode)) + slowCases.append(isHoleValue); addSlowPathGenerator( slowPathCall( - beyondArrayBounds, this, + slowCases, this, m_jit.codeBlock()->isStrictMode() ? operationPutByValBeyondArrayBoundsStrict : operationPutByValBeyondArrayBoundsNonStrict, NoResult, baseReg, propertyReg, valueReg)); } @@ -2798,28 +2810,24 @@ void SpeculativeJIT::compile(Node& node) if (!m_compileOkay) return; - m_jit.loadPtr( - MacroAssembler::Address(baseReg, Arguments::offsetOfData()), - scratchReg); - // Two really lame checks. speculationCheck( Uncountable, JSValueSource(), NoNode, m_jit.branchPtr( MacroAssembler::AboveOrEqual, propertyReg, - MacroAssembler::Address(scratchReg, OBJECT_OFFSETOF(ArgumentsData, numArguments)))); + MacroAssembler::Address(baseReg, OBJECT_OFFSETOF(Arguments, m_numArguments)))); speculationCheck( Uncountable, JSValueSource(), NoNode, m_jit.branchTestPtr( MacroAssembler::NonZero, MacroAssembler::Address( - scratchReg, OBJECT_OFFSETOF(ArgumentsData, deletedArguments)))); + baseReg, OBJECT_OFFSETOF(Arguments, m_slowArguments)))); m_jit.move(propertyReg, scratch2Reg); m_jit.neg32(scratch2Reg); m_jit.signExtend32ToPtr(scratch2Reg, scratch2Reg); m_jit.loadPtr( - MacroAssembler::Address(scratchReg, OBJECT_OFFSETOF(ArgumentsData, registers)), + MacroAssembler::Address(baseReg, OBJECT_OFFSETOF(Arguments, m_registers)), scratchReg); m_jit.storePtr( @@ -3120,12 +3128,14 @@ void SpeculativeJIT::compile(Node& node) } case NewArray: { + JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node.codeOrigin); + if (!globalObject->isHavingABadTime()) + globalObject->havingABadTimeWatchpoint()->add(speculationWatchpoint()); + if (!node.numChildren()) { flushRegisters(); GPRResult result(this); - callOperation( - operationNewEmptyArray, result.gpr(), - m_jit.graph().globalObjectFor(node.codeOrigin)->arrayStructure()); + callOperation(operationNewEmptyArray, result.gpr(), globalObject->arrayStructure()); cellResult(result.gpr(), m_compileIndex); break; } @@ -3155,8 +3165,7 @@ void SpeculativeJIT::compile(Node& node) GPRResult result(this); callOperation( - operationNewArray, result.gpr(), - m_jit.graph().globalObjectFor(node.codeOrigin)->arrayStructure(), + operationNewArray, result.gpr(), globalObject->arrayStructure(), static_cast<void*>(buffer), node.numChildren()); if (scratchSize) { @@ -3171,11 +3180,15 @@ void SpeculativeJIT::compile(Node& node) } case NewArrayWithSize: { + JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node.codeOrigin); + if (!globalObject->isHavingABadTime()) + globalObject->havingABadTimeWatchpoint()->add(speculationWatchpoint()); + SpeculateStrictInt32Operand size(this, node.child1()); GPRReg sizeGPR = size.gpr(); flushRegisters(); GPRResult result(this); - callOperation(operationNewArrayWithSize, result.gpr(), m_jit.graph().globalObjectFor(node.codeOrigin)->arrayStructure(), sizeGPR); + callOperation(operationNewArrayWithSize, result.gpr(), globalObject->arrayStructure(), sizeGPR); cellResult(result.gpr(), m_compileIndex); break; } diff --git a/Source/JavaScriptCore/dfg/DFGStructureCheckHoistingPhase.cpp b/Source/JavaScriptCore/dfg/DFGStructureCheckHoistingPhase.cpp index f6fe127a3..0838bb7e5 100644 --- a/Source/JavaScriptCore/dfg/DFGStructureCheckHoistingPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGStructureCheckHoistingPhase.cpp @@ -67,7 +67,8 @@ public: if (!node.shouldGenerate()) continue; switch (node.op()) { - case CheckStructure: { + case CheckStructure: + case StructureTransitionWatchpoint: { Node& child = m_graph[node.child1()]; if (child.op() != GetLocal) break; @@ -91,7 +92,6 @@ public: case GetByOffset: case PutByOffset: case PutStructure: - case StructureTransitionWatchpoint: case AllocatePropertyStorage: case ReallocatePropertyStorage: case GetButterfly: @@ -105,6 +105,40 @@ public: // Don't count these uses. break; + case SetLocal: { + // Find all uses of the source of the SetLocal. If any of them are a + // kind of CheckStructure, then we should notice them to ensure that + // we're not hoisting a check that would contravene checks that are + // already being performed. + VariableAccessData* variable = node.variableAccessData(); + if (variable->isCaptured() || variable->structureCheckHoistingFailed()) + break; + if (!isCellSpeculation(variable->prediction())) + break; + NodeIndex source = node.child1().index(); + for (unsigned subIndexInBlock = 0; subIndexInBlock < block->size(); ++subIndexInBlock) { + NodeIndex subNodeIndex = block->at(subIndexInBlock); + Node& subNode = m_graph[subNodeIndex]; + if (!subNode.shouldGenerate()) + continue; + switch (subNode.op()) { + case CheckStructure: + case StructureTransitionWatchpoint: { + if (subNode.child1().index() != source) + break; + + noticeStructureCheck(variable, subNode.structureSet()); + break; + } + default: + break; + } + } + + m_graph.vote(node, VoteOther); + break; + } + default: m_graph.vote(node, VoteOther); break; diff --git a/Source/JavaScriptCore/interpreter/CallFrame.h b/Source/JavaScriptCore/interpreter/CallFrame.h index 94b37bfc3..da1222ac9 100644 --- a/Source/JavaScriptCore/interpreter/CallFrame.h +++ b/Source/JavaScriptCore/interpreter/CallFrame.h @@ -187,7 +187,7 @@ namespace JSC { // Read a register for a non-constant Register& uncheckedR(int); - // Access to arguments. + // Access to arguments as passed. (After capture, arguments may move to a different location.) size_t argumentCount() const { return argumentCountIncludingThis() - 1; } size_t argumentCountIncludingThis() const { return this[RegisterFile::ArgumentCount].payload(); } static int argumentOffset(int argument) { return s_firstArgumentOffset - argument; } @@ -208,6 +208,8 @@ namespace JSC { JSValue thisValue() { return this[thisArgumentOffset()].jsValue(); } void setThisValue(JSValue value) { this[thisArgumentOffset()] = value; } + JSValue argumentAfterCapture(size_t argument); + static int offsetFor(size_t argumentCountIncludingThis) { return argumentCountIncludingThis + RegisterFile::CallFrameHeaderSize; } // FIXME: Remove these. diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index 739d6022f..ef6cbd5a6 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -473,7 +473,7 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue ex if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->usesArguments()) { if (JSValue arguments = callFrame->uncheckedR(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue()) { if (activation) - jsCast<Arguments*>(arguments)->didTearOffActivation(callFrame->globalData(), jsCast<JSActivation*>(activation)); + jsCast<Arguments*>(arguments)->didTearOffActivation(callFrame, jsCast<JSActivation*>(activation)); else jsCast<Arguments*>(arguments)->tearOff(callFrame); } @@ -3610,8 +3610,8 @@ skip_id_custom_self: uint32_t i = subscript.asUInt32(); if (isJSArray(baseValue)) { JSArray* jsArray = asArray(baseValue); - if (jsArray->canGetIndex(i)) - result = jsArray->getIndex(i); + if (jsArray->canGetIndexQuickly(i)) + result = jsArray->getIndexQuickly(i); else result = jsArray->JSArray::get(callFrame, i); } else if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i)) @@ -3652,8 +3652,8 @@ skip_id_custom_self: uint32_t i = subscript.asUInt32(); if (isJSArray(baseValue)) { JSArray* jsArray = asArray(baseValue); - if (jsArray->canSetIndex(i)) - jsArray->setIndex(*globalData, i, callFrame->r(value).jsValue()); + if (jsArray->canSetIndexQuickly(i)) + jsArray->setIndexQuickly(*globalData, i, callFrame->r(value).jsValue()); else jsArray->JSArray::putByIndex(jsArray, callFrame, i, callFrame->r(value).jsValue(), codeBlock->isStrictMode()); } else @@ -4508,7 +4508,7 @@ skip_id_custom_self: ASSERT(codeBlock->usesArguments()); if (JSValue argumentsValue = callFrame->r(unmodifiedArgumentsRegister(arguments)).jsValue()) { if (JSValue activationValue = callFrame->r(activation).jsValue()) - asArguments(argumentsValue)->didTearOffActivation(callFrame->globalData(), asActivation(activationValue)); + asArguments(argumentsValue)->didTearOffActivation(callFrame, asActivation(activationValue)); else asArguments(argumentsValue)->tearOff(callFrame); } @@ -5012,7 +5012,7 @@ skip_id_custom_self: accessor->setGetter(callFrame->globalData(), asObject(getter)); if (!setter.isUndefined()) accessor->setSetter(callFrame->globalData(), asObject(setter)); - baseObj->putDirectAccessor(callFrame->globalData(), ident, accessor, Accessor); + baseObj->putDirectAccessor(callFrame, ident, accessor, Accessor); vPC += OPCODE_LENGTH(op_put_getter_setter); NEXT_INSTRUCTION(); diff --git a/Source/JavaScriptCore/jit/JIT.h b/Source/JavaScriptCore/jit/JIT.h index ce70b40a7..ac7c8765b 100644 --- a/Source/JavaScriptCore/jit/JIT.h +++ b/Source/JavaScriptCore/jit/JIT.h @@ -437,7 +437,7 @@ namespace JSC { template<typename ClassType, bool destructor, typename StructureType> void emitAllocateBasicJSObject(StructureType, RegisterID result, RegisterID storagePtr); void emitAllocateBasicStorage(size_t, ptrdiff_t offsetFromBase, RegisterID result); template<typename T> void emitAllocateJSFinalObject(T structure, RegisterID result, RegisterID storagePtr); - void emitAllocateJSArray(unsigned valuesRegister, unsigned length, RegisterID cellResult, RegisterID storageResult, RegisterID storagePtr); + void emitAllocateJSArray(unsigned valuesRegister, unsigned length, RegisterID cellResult, RegisterID storageResult, RegisterID storagePtr, RegisterID scratch); #if ENABLE(VALUE_PROFILER) // This assumes that the value to profile is in regT0 and that regT3 is available for @@ -449,6 +449,8 @@ namespace JSC { void emitValueProfilingSite(unsigned) { } void emitValueProfilingSite() { } #endif + void emitArrayProfilingSite(RegisterID structureAndIndexingType, RegisterID scratch, ArrayProfile*); + void emitArrayProfilingSiteForBytecodeIndex(RegisterID structureAndIndexingType, RegisterID scratch, unsigned bytecodeIndex); enum FinalObjectMode { MayBeFinal, KnownNotFinal }; diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h index 35ac44b23..302e109ca 100644 --- a/Source/JavaScriptCore/jit/JITInlineMethods.h +++ b/Source/JavaScriptCore/jit/JITInlineMethods.h @@ -443,7 +443,7 @@ inline void JIT::emitAllocateBasicStorage(size_t size, ptrdiff_t offsetFromBase, subPtr(TrustedImm32(size - offsetFromBase), result); } -inline void JIT::emitAllocateJSArray(unsigned valuesRegister, unsigned length, RegisterID cellResult, RegisterID storageResult, RegisterID storagePtr) +inline void JIT::emitAllocateJSArray(unsigned valuesRegister, unsigned length, RegisterID cellResult, RegisterID storageResult, RegisterID storagePtr, RegisterID scratch) { unsigned initialLength = std::max(length, 4U); size_t initialStorage = Butterfly::totalSize(0, 0, true, ArrayStorage::sizeFor(initialLength)); @@ -453,7 +453,8 @@ inline void JIT::emitAllocateJSArray(unsigned valuesRegister, unsigned length, R emitAllocateBasicStorage(initialStorage, sizeof(IndexingHeader), storageResult); // Allocate the cell for the array. - emitAllocateBasicJSObject<JSArray, false>(TrustedImmPtr(m_codeBlock->globalObject()->arrayStructure()), cellResult, storagePtr); + loadPtr(m_codeBlock->globalObject()->addressOfArrayStructure(), scratch); + emitAllocateBasicJSObject<JSArray, false>(scratch, cellResult, storagePtr); // Store all the necessary info in the ArrayStorage. store32(Imm32(length), Address(storageResult, ArrayStorage::lengthOffset())); @@ -529,7 +530,31 @@ inline void JIT::emitValueProfilingSite() { emitValueProfilingSite(m_bytecodeOffset); } +#endif // ENABLE(VALUE_PROFILER) + +inline void JIT::emitArrayProfilingSite(RegisterID structureAndIndexingType, RegisterID scratch, ArrayProfile* arrayProfile) +{ + RegisterID structure = structureAndIndexingType; + RegisterID indexingType = structureAndIndexingType; + + if (canBeOptimized()) { + storePtr(structure, arrayProfile->addressOfLastSeenStructure()); + load8(Address(structure, Structure::indexingTypeOffset()), indexingType); + move(TrustedImm32(1), scratch); + lshift32(indexingType, scratch); + or32(scratch, AbsoluteAddress(arrayProfile->addressOfArrayModes())); + } else + load8(Address(structure, Structure::indexingTypeOffset()), indexingType); +} + +inline void JIT::emitArrayProfilingSiteForBytecodeIndex(RegisterID structureAndIndexingType, RegisterID scratch, unsigned bytecodeIndex) +{ +#if ENABLE(VALUE_PROFILER) + emitArrayProfilingSite(structureAndIndexingType, scratch, m_codeBlock->getOrAddArrayProfile(bytecodeIndex)); +#else + emitArrayProfilingSite(structureAndIndexingType, scratch, 0); #endif +} #if USE(JSVALUE32_64) diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp index 486be6bf9..642aabb2a 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp @@ -1676,7 +1676,7 @@ void JIT::emit_op_new_array(Instruction* currentInstruction) int dst = currentInstruction[1].u.operand; int values = currentInstruction[2].u.operand; - emitAllocateJSArray(values, length, regT0, regT1, regT2); + emitAllocateJSArray(values, length, regT0, regT1, regT2, regT3); emitStoreCell(dst, regT0); } diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp index bca68f0b4..bbc289838 100644 --- a/Source/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -111,10 +111,8 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction) emitJumpSlowCaseIfNotJSCell(regT0, base); loadPtr(Address(regT0, JSCell::structureOffset()), regT2); -#if ENABLE(VALUE_PROFILER) - storePtr(regT2, currentInstruction[4].u.arrayProfile->addressOfLastSeenStructure()); -#endif - addSlowCase(branchTest8(Zero, Address(regT2, Structure::indexingTypeOffset()), TrustedImm32(HasArrayStorage))); + emitArrayProfilingSite(regT2, regT3, currentInstruction[4].u.arrayProfile); + addSlowCase(branchTest32(Zero, regT2, TrustedImm32(HasArrayStorage))); loadPtr(Address(regT0, JSObject::butterflyOffset()), regT2); addSlowCase(branch32(AboveOrEqual, regT1, Address(regT2, ArrayStorage::vectorLengthOffset()))); @@ -236,10 +234,8 @@ void JIT::emit_op_put_by_val(Instruction* currentInstruction) zeroExtend32ToPtr(regT1, regT1); emitJumpSlowCaseIfNotJSCell(regT0, base); loadPtr(Address(regT0, JSCell::structureOffset()), regT2); -#if ENABLE(VALUE_PROFILER) - storePtr(regT2, currentInstruction[4].u.arrayProfile->addressOfLastSeenStructure()); -#endif - addSlowCase(branchTest8(Zero, Address(regT2, Structure::indexingTypeOffset()), TrustedImm32(HasArrayStorage))); + emitArrayProfilingSite(regT2, regT3, currentInstruction[4].u.arrayProfile); + addSlowCase(branchTest32(Zero, regT2, TrustedImm32(HasArrayStorage))); loadPtr(Address(regT0, JSObject::butterflyOffset()), regT2); addSlowCase(branch32(AboveOrEqual, regT1, Address(regT2, ArrayStorage::vectorLengthOffset()))); @@ -656,13 +652,10 @@ void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress) StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress); // Check eax is an array - loadPtr(Address(regT0, JSCell::structureOffset()), regT3); -#if ENABLE(VALUE_PROFILER) - storePtr(regT3, m_codeBlock->getOrAddArrayProfile(stubInfo->bytecodeIndex)->addressOfLastSeenStructure()); -#endif - load8(Address(regT3, Structure::indexingTypeOffset()), regT3); - Jump failureCases1 = branchTest32(Zero, regT3, TrustedImm32(IsArray)); - Jump failureCases2 = branchTest32(Zero, regT3, TrustedImm32(HasArrayStorage)); + loadPtr(Address(regT0, JSCell::structureOffset()), regT2); + emitArrayProfilingSiteForBytecodeIndex(regT2, regT1, stubInfo->bytecodeIndex); + Jump failureCases1 = branchTest32(Zero, regT2, TrustedImm32(IsArray)); + Jump failureCases2 = branchTest32(Zero, regT2, TrustedImm32(HasArrayStorage)); // Checks out okay! - get the length from the storage loadPtr(Address(regT0, JSObject::butterflyOffset()), regT3); diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp index 04d7c3815..1692f33c3 100644 --- a/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp +++ b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp @@ -210,10 +210,8 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction) addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag))); emitJumpSlowCaseIfNotJSCell(base, regT1); loadPtr(Address(regT0, JSCell::structureOffset()), regT1); -#if ENABLE(VALUE_PROFILER) - storePtr(regT1, currentInstruction[4].u.arrayProfile->addressOfLastSeenStructure()); -#endif - addSlowCase(branchTest8(Zero, Address(regT1, Structure::indexingTypeOffset()), TrustedImm32(HasArrayStorage))); + emitArrayProfilingSite(regT1, regT3, currentInstruction[4].u.arrayProfile); + addSlowCase(branchTest32(Zero, regT1, TrustedImm32(HasArrayStorage))); loadPtr(Address(regT0, JSObject::butterflyOffset()), regT3); addSlowCase(branch32(AboveOrEqual, regT2, Address(regT3, ArrayStorage::vectorLengthOffset()))); @@ -269,10 +267,8 @@ void JIT::emit_op_put_by_val(Instruction* currentInstruction) addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag))); emitJumpSlowCaseIfNotJSCell(base, regT1); loadPtr(Address(regT0, JSCell::structureOffset()), regT1); -#if ENABLE(VALUE_PROFILER) - storePtr(regT1, currentInstruction[4].u.arrayProfile->addressOfLastSeenStructure()); -#endif - addSlowCase(branchTest8(Zero, Address(regT1, Structure::indexingTypeOffset()), TrustedImm32(HasArrayStorage))); + emitArrayProfilingSite(regT1, regT3, currentInstruction[4].u.arrayProfile); + addSlowCase(branchTest32(Zero, regT1, TrustedImm32(HasArrayStorage))); loadPtr(Address(regT0, JSObject::butterflyOffset()), regT3); addSlowCase(branch32(AboveOrEqual, regT2, Address(regT3, ArrayStorage::vectorLengthOffset()))); @@ -617,10 +613,7 @@ void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress) // Check for array loadPtr(Address(regT0, JSCell::structureOffset()), regT2); -#if ENABLE(VALUE_PROFILER) - storePtr(regT2, m_codeBlock->getOrAddArrayProfile(stubInfo->bytecodeIndex)->addressOfLastSeenStructure()); -#endif - load8(Address(regT2, Structure::indexingTypeOffset()), regT3); + emitArrayProfilingSiteForBytecodeIndex(regT2, regT3, stubInfo->bytecodeIndex); Jump failureCases1 = branchTest32(Zero, regT2, TrustedImm32(IsArray)); Jump failureCases2 = branchTest32(Zero, regT2, TrustedImm32(HasArrayStorage)); diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index 40d653b5d..e63f06cef 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -2323,7 +2323,7 @@ DEFINE_STUB_FUNCTION(void, op_tear_off_arguments) ASSERT(callFrame->codeBlock()->usesArguments()); Arguments* arguments = jsCast<Arguments*>(stackFrame.args[0].jsValue()); if (JSValue activationValue = stackFrame.args[1].jsValue()) { - arguments->didTearOffActivation(callFrame->globalData(), jsCast<JSActivation*>(activationValue)); + arguments->didTearOffActivation(callFrame, jsCast<JSActivation*>(activationValue)); return; } arguments->tearOff(callFrame); diff --git a/Source/JavaScriptCore/jsc.pro b/Source/JavaScriptCore/jsc.pro index f226bde40..dfd73e825 100644 --- a/Source/JavaScriptCore/jsc.pro +++ b/Source/JavaScriptCore/jsc.pro @@ -19,10 +19,6 @@ WEBKIT += javascriptcore wtf SOURCES = jsc.cpp -mac { - LIBS_PRIVATE += -framework AppKit -} - win32-* { LIBS += -ladvapi32 } diff --git a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp index b0441e80b..1ddfca37c 100644 --- a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp +++ b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp @@ -1475,7 +1475,7 @@ LLINT_SLOW_PATH_DECL(slow_path_tear_off_arguments) ASSERT(exec->codeBlock()->usesArguments()); Arguments* arguments = jsCast<Arguments*>(exec->uncheckedR(unmodifiedArgumentsRegister(pc[1].u.operand)).jsValue()); if (JSValue activationValue = LLINT_OP_C(2).jsValue()) - arguments->didTearOffActivation(globalData, jsCast<JSActivation*>(activationValue)); + arguments->didTearOffActivation(exec, jsCast<JSActivation*>(activationValue)); else arguments->tearOff(exec); LLINT_END(); diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter.asm index 6f5460aa7..e347ccc70 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter.asm @@ -187,6 +187,20 @@ macro slowPathForCall(advance, slowPath) end) end +macro arrayProfile(structureAndIndexingType, profile, scratch) + const structure = structureAndIndexingType + const indexingType = structureAndIndexingType + if VALUE_PROFILER + storep structure, ArrayProfile::m_lastSeenStructure[profile] + loadb Structure::m_indexingType[structure], indexingType + move 1, scratch + lshifti indexingType, scratch + ori scratch, ArrayProfile::m_observedArrayModes[profile] + else + loadb Structure::m_indexingType[structure], indexingType + end +end + macro checkSwitchToJIT(increment, action) if JIT_ENABLED loadp CodeBlock[cfr], t0 @@ -896,4 +910,3 @@ _llint_op_put_by_id_transition: # Indicate the end of LLInt. _llint_end: crash() - diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm index 0e37a4099..41926d8db 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm @@ -1176,12 +1176,9 @@ _llint_op_get_array_length: loadp 16[PC], t1 loadConstantOrVariablePayload(t0, CellTag, t3, .opGetArrayLengthSlow) loadp JSCell::m_structure[t3], t2 - if VALUE_PROFILER - storep t2, ArrayProfile::m_lastSeenStructure[t1] - end - loadb Structure::m_indexingType[t2], t1 - btiz t1, IsArray, .opGetArrayLengthSlow - btiz t1, HasArrayStorage, .opGetArrayLengthSlow + arrayProfile(t2, t1, t0) + btiz t2, IsArray, .opGetArrayLengthSlow + btiz t2, HasArrayStorage, .opGetArrayLengthSlow loadi 4[PC], t1 loadp 32[PC], t2 loadp JSObject::m_butterfly[t3], t0 @@ -1308,17 +1305,15 @@ _llint_op_put_by_id_transition_normal_out_of_line: _llint_op_get_by_val: traceExecution() loadi 8[PC], t2 - loadi 12[PC], t3 loadConstantOrVariablePayload(t2, CellTag, t0, .opGetByValSlow) + loadp JSCell::m_structure[t0], t2 + loadp 16[PC], t3 + arrayProfile(t2, t3, t1) + btiz t2, HasArrayStorage, .opGetByValSlow + loadi 12[PC], t3 loadConstantOrVariablePayload(t3, Int32Tag, t1, .opGetByValSlow) - loadp JSCell::m_structure[t0], t3 - loadp 16[PC], t2 - if VALUE_PROFILER - storep t3, ArrayProfile::m_lastSeenStructure[t2] - end - btpz Structure::m_indexingType[t3], HasArrayStorage, .opGetByValSlow loadp JSObject::m_butterfly[t0], t3 - biaeq t1, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t0], .opGetByValSlow + biaeq t1, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t3], .opGetByValSlow loadi 4[PC], t0 loadi ArrayStorage::m_vector + TagOffset[t3, t1, 8], t2 loadi ArrayStorage::m_vector + PayloadOffset[t3, t1, 8], t1 @@ -1392,14 +1387,12 @@ _llint_op_put_by_val: traceExecution() loadi 4[PC], t0 loadConstantOrVariablePayload(t0, CellTag, t1, .opPutByValSlow) + loadp JSCell::m_structure[t1], t2 + loadp 16[PC], t0 + arrayProfile(t2, t0, t3) + btiz t2, HasArrayStorage, .opPutByValSlow loadi 8[PC], t0 loadConstantOrVariablePayload(t0, Int32Tag, t2, .opPutByValSlow) - loadp JSCell::m_structure[t1], t3 - loadp 16[PC], t0 - if VALUE_PROFILER - storep t3, ArrayProfile::m_lastSeenStructure[t0] - end - btpz Structure::m_indexingType[t3], HasArrayStorage, .opPutByValSlow loadp JSObject::m_butterfly[t1], t0 biaeq t2, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t0], .opPutByValSlow bieq ArrayStorage::m_vector + TagOffset[t0, t2, 8], EmptyValueTag, .opPutByValEmpty diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm index 7dfcb6728..51a11f53f 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm @@ -1023,12 +1023,9 @@ _llint_op_get_array_length: loadp 32[PB, PC, 8], t1 loadConstantOrVariableCell(t0, t3, .opGetArrayLengthSlow) loadp JSCell::m_structure[t3], t2 - if VALUE_PROFILER - storep t2, ArrayProfile::m_lastSeenStructure[t1] - end - loadb Structure::m_indexingType[t2], t1 - btiz t1, IsArray, .opGetArrayLengthSlow - btiz t1, HasArrayStorage, .opGetArrayLengthSlow + arrayProfile(t2, t1, t0) + btiz t2, IsArray, .opGetArrayLengthSlow + btiz t2, HasArrayStorage, .opGetArrayLengthSlow loadis 8[PB, PC, 8], t1 loadp 64[PB, PC, 8], t2 loadp JSObject::m_butterfly[t3], t0 @@ -1152,16 +1149,14 @@ _llint_op_put_by_id_transition_normal_out_of_line: _llint_op_get_by_val: traceExecution() loadis 16[PB, PC, 8], t2 - loadis 24[PB, PC, 8], t3 loadConstantOrVariableCell(t2, t0, .opGetByValSlow) + loadp JSCell::m_structure[t0], t2 + loadp 32[PB, PC, 8], t3 + arrayProfile(t2, t3, t1) + loadis 24[PB, PC, 8], t3 + btiz t2, HasArrayStorage, .opGetByValSlow loadConstantOrVariableInt32(t3, t1, .opGetByValSlow) sxi2p t1, t1 - loadp JSCell::m_structure[t0], t3 - loadp 32[PB, PC, 8], t2 - if VALUE_PROFILER - storep t3, ArrayProfile::m_lastSeenStructure[t2] - end - btbz Structure::m_indexingType[t3], HasArrayStorage, .opGetByValSlow loadp JSObject::m_butterfly[t0], t3 biaeq t1, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t3], .opGetByValSlow loadis 8[PB, PC, 8], t0 @@ -1235,15 +1230,13 @@ _llint_op_put_by_val: traceExecution() loadis 8[PB, PC, 8], t0 loadConstantOrVariableCell(t0, t1, .opPutByValSlow) + loadp JSCell::m_structure[t1], t2 + loadp 32[PB, PC, 8], t0 + arrayProfile(t2, t0, t3) + btiz t2, HasArrayStorage, .opPutByValSlow loadis 16[PB, PC, 8], t0 loadConstantOrVariableInt32(t0, t2, .opPutByValSlow) sxi2p t2, t2 - loadp JSCell::m_structure[t1], t3 - loadp 32[PB, PC, 8], t0 - if VALUE_PROFILER - storep t3, ArrayProfile::m_lastSeenStructure[t0] - end - btbz Structure::m_indexingType[t3], HasArrayStorage, .opPutByValSlow loadp JSObject::m_butterfly[t1], t0 biaeq t2, -sizeof IndexingHeader + IndexingHeader::m_vectorLength[t0], .opPutByValSlow btpz ArrayStorage::m_vector[t0, t2, 8], .opPutByValEmpty diff --git a/Source/JavaScriptCore/offlineasm/armv7.rb b/Source/JavaScriptCore/offlineasm/armv7.rb index eb9472af3..b05f0e57f 100644 --- a/Source/JavaScriptCore/offlineasm/armv7.rb +++ b/Source/JavaScriptCore/offlineasm/armv7.rb @@ -683,7 +683,7 @@ def emitArmV7Compact(opcode2, opcode3, operands) $asm.puts "#{opcode3} #{armV7FlippedOperands(operands)}" else raise unless operands.size == 2 - raise unless operands[1].is_a? RegisterID + raise unless operands[1].register? if operands[0].is_a? Immediate $asm.puts "#{opcode3} #{operands[1].armV7Operand}, #{operands[1].armV7Operand}, #{operands[0].armV7Operand}" else diff --git a/Source/JavaScriptCore/offlineasm/backends.rb b/Source/JavaScriptCore/offlineasm/backends.rb index 0633f07f8..78e545738 100644 --- a/Source/JavaScriptCore/offlineasm/backends.rb +++ b/Source/JavaScriptCore/offlineasm/backends.rb @@ -56,7 +56,8 @@ class Node $activeBackend = name send("lower" + name) rescue => e - raise "Got error #{e} at #{codeOriginString}" + e.message << "At #{codeOriginString}" + raise e end end end diff --git a/Source/JavaScriptCore/runtime/Arguments.cpp b/Source/JavaScriptCore/runtime/Arguments.cpp index 47795edb2..e5e503ee1 100644 --- a/Source/JavaScriptCore/runtime/Arguments.cpp +++ b/Source/JavaScriptCore/runtime/Arguments.cpp @@ -45,10 +45,10 @@ void Arguments::visitChildren(JSCell* cell, SlotVisitor& visitor) ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); JSObject::visitChildren(thisObject, visitor); - if (thisObject->d->registerArray) - visitor.appendValues(thisObject->d->registerArray.get(), thisObject->d->numArguments); - visitor.append(&thisObject->d->callee); - visitor.append(&thisObject->d->activation); + if (thisObject->m_registerArray) + visitor.appendValues(thisObject->m_registerArray.get(), thisObject->m_numArguments); + visitor.append(&thisObject->m_callee); + visitor.append(&thisObject->m_activation); } void Arguments::destroy(JSCell* cell) @@ -58,7 +58,7 @@ void Arguments::destroy(JSCell* cell) void Arguments::copyToArguments(ExecState* exec, CallFrame* callFrame, uint32_t length) { - if (UNLIKELY(d->overrodeLength)) { + if (UNLIKELY(m_overrodeLength)) { length = min(get(exec, exec->propertyNames().length).toUInt32(exec), length); for (unsigned i = 0; i < length; i++) callFrame->setArgument(i, get(exec, i)); @@ -66,8 +66,8 @@ void Arguments::copyToArguments(ExecState* exec, CallFrame* callFrame, uint32_t } ASSERT(length == this->length(exec)); for (size_t i = 0; i < length; ++i) { - if (!d->deletedArguments || !d->deletedArguments[i]) - callFrame->setArgument(i, argument(i).get()); + if (JSValue value = tryGetArgument(i)) + callFrame->setArgument(i, value); else callFrame->setArgument(i, get(exec, i)); } @@ -75,7 +75,7 @@ void Arguments::copyToArguments(ExecState* exec, CallFrame* callFrame, uint32_t void Arguments::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) { - if (UNLIKELY(d->overrodeLength)) { + if (UNLIKELY(m_overrodeLength)) { unsigned length = get(exec, exec->propertyNames().length).toUInt32(exec); for (unsigned i = 0; i < length; i++) args.append(get(exec, i)); @@ -83,8 +83,8 @@ void Arguments::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) } uint32_t length = this->length(exec); for (size_t i = 0; i < length; ++i) { - if (!d->deletedArguments || !d->deletedArguments[i]) - args.append(argument(i).get()); + if (JSValue value = tryGetArgument(i)) + args.append(value); else args.append(get(exec, i)); } @@ -93,8 +93,8 @@ void Arguments::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) bool Arguments::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned i, PropertySlot& slot) { Arguments* thisObject = jsCast<Arguments*>(cell); - if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { - slot.setValue(thisObject->argument(i).get()); + if (JSValue value = thisObject->tryGetArgument(i)) { + slot.setValue(value); return true; } @@ -103,10 +103,10 @@ bool Arguments::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigne void Arguments::createStrictModeCallerIfNecessary(ExecState* exec) { - if (d->overrodeCaller) + if (m_overrodeCaller) return; - d->overrodeCaller = true; + m_overrodeCaller = true; PropertyDescriptor descriptor; descriptor.setAccessorDescriptor(globalObject()->throwTypeErrorGetterSetter(exec), DontEnum | DontDelete | Accessor); methodTable()->defineOwnProperty(this, exec, exec->propertyNames().caller, descriptor, false); @@ -114,10 +114,10 @@ void Arguments::createStrictModeCallerIfNecessary(ExecState* exec) void Arguments::createStrictModeCalleeIfNecessary(ExecState* exec) { - if (d->overrodeCallee) + if (m_overrodeCallee) return; - d->overrodeCallee = true; + m_overrodeCallee = true; PropertyDescriptor descriptor; descriptor.setAccessorDescriptor(globalObject()->throwTypeErrorGetterSetter(exec), DontEnum | DontDelete | Accessor); methodTable()->defineOwnProperty(this, exec, exec->propertyNames().callee, descriptor, false); @@ -127,26 +127,26 @@ bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName p { Arguments* thisObject = jsCast<Arguments*>(cell); unsigned i = propertyName.asIndex(); - if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + if (JSValue value = thisObject->tryGetArgument(i)) { ASSERT(i < PropertyName::NotAnIndex); - slot.setValue(thisObject->argument(i).get()); + slot.setValue(value); return true; } - if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->d->overrodeLength)) { - slot.setValue(jsNumber(thisObject->d->numArguments)); + if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->m_overrodeLength)) { + slot.setValue(jsNumber(thisObject->m_numArguments)); return true; } - if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->d->overrodeCallee)) { - if (!thisObject->d->isStrictMode) { - slot.setValue(thisObject->d->callee.get()); + if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->m_overrodeCallee)) { + if (!thisObject->m_isStrictMode) { + slot.setValue(thisObject->m_callee.get()); return true; } thisObject->createStrictModeCalleeIfNecessary(exec); } - if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode) + if (propertyName == exec->propertyNames().caller && thisObject->m_isStrictMode) thisObject->createStrictModeCallerIfNecessary(exec); return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot); @@ -156,26 +156,26 @@ bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, Prop { Arguments* thisObject = jsCast<Arguments*>(object); unsigned i = propertyName.asIndex(); - if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + if (JSValue value = thisObject->tryGetArgument(i)) { ASSERT(i < PropertyName::NotAnIndex); - descriptor.setDescriptor(thisObject->argument(i).get(), None); + descriptor.setDescriptor(value, None); return true; } - if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->d->overrodeLength)) { - descriptor.setDescriptor(jsNumber(thisObject->d->numArguments), DontEnum); + if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->m_overrodeLength)) { + descriptor.setDescriptor(jsNumber(thisObject->m_numArguments), DontEnum); return true; } - if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->d->overrodeCallee)) { - if (!thisObject->d->isStrictMode) { - descriptor.setDescriptor(thisObject->d->callee.get(), DontEnum); + if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->m_overrodeCallee)) { + if (!thisObject->m_isStrictMode) { + descriptor.setDescriptor(thisObject->m_callee.get(), DontEnum); return true; } thisObject->createStrictModeCalleeIfNecessary(exec); } - if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode) + if (propertyName == exec->propertyNames().caller && thisObject->m_isStrictMode) thisObject->createStrictModeCallerIfNecessary(exec); return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); @@ -184,9 +184,10 @@ bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, Prop void Arguments::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { Arguments* thisObject = jsCast<Arguments*>(object); - for (unsigned i = 0; i < thisObject->d->numArguments; ++i) { - if (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i]) - propertyNames.add(Identifier(exec, String::number(i))); + for (unsigned i = 0; i < thisObject->m_numArguments; ++i) { + if (!thisObject->isArgument(i)) + continue; + propertyNames.add(Identifier(exec, String::number(i))); } if (mode == IncludeDontEnumProperties) { propertyNames.add(exec->propertyNames().callee); @@ -198,10 +199,8 @@ void Arguments::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyN void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue value, bool shouldThrow) { Arguments* thisObject = jsCast<Arguments*>(cell); - if (i < static_cast<unsigned>(thisObject->d->numArguments) && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { - thisObject->argument(i).set(exec->globalData(), thisObject, value); + if (thisObject->trySetArgument(exec->globalData(), i, value)) return; - } PutPropertySlot slot(shouldThrow); JSObject::put(thisObject, exec, Identifier(exec, String::number(i)), value, slot); @@ -211,28 +210,25 @@ void Arguments::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JS { Arguments* thisObject = jsCast<Arguments*>(cell); unsigned i = propertyName.asIndex(); - if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { - ASSERT(i < PropertyName::NotAnIndex); - thisObject->argument(i).set(exec->globalData(), thisObject, value); + if (thisObject->trySetArgument(exec->globalData(), i, value)) return; - } - if (propertyName == exec->propertyNames().length && !thisObject->d->overrodeLength) { - thisObject->d->overrodeLength = true; + if (propertyName == exec->propertyNames().length && !thisObject->m_overrodeLength) { + thisObject->m_overrodeLength = true; thisObject->putDirect(exec->globalData(), propertyName, value, DontEnum); return; } - if (propertyName == exec->propertyNames().callee && !thisObject->d->overrodeCallee) { - if (!thisObject->d->isStrictMode) { - thisObject->d->overrodeCallee = true; + if (propertyName == exec->propertyNames().callee && !thisObject->m_overrodeCallee) { + if (!thisObject->m_isStrictMode) { + thisObject->m_overrodeCallee = true; thisObject->putDirect(exec->globalData(), propertyName, value, DontEnum); return; } thisObject->createStrictModeCalleeIfNecessary(exec); } - if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode) + if (propertyName == exec->propertyNames().caller && thisObject->m_isStrictMode) thisObject->createStrictModeCallerIfNecessary(exec); JSObject::put(thisObject, exec, propertyName, value, slot); @@ -241,20 +237,12 @@ void Arguments::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JS bool Arguments::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned i) { Arguments* thisObject = jsCast<Arguments*>(cell); - if (i < thisObject->d->numArguments) { + if (i < thisObject->m_numArguments) { if (!Base::deletePropertyByIndex(cell, exec, i)) return false; - - if (!thisObject->d->deletedArguments) { - thisObject->d->deletedArguments = adoptArrayPtr(new bool[thisObject->d->numArguments]); - memset(thisObject->d->deletedArguments.get(), 0, sizeof(bool) * thisObject->d->numArguments); - } - if (!thisObject->d->deletedArguments[i]) { - thisObject->d->deletedArguments[i] = true; + if (thisObject->tryDeleteArgument(i)) return true; - } } - return JSObject::deletePropertyByIndex(thisObject, exec, i); } @@ -265,35 +253,28 @@ bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, PropertyName prope Arguments* thisObject = jsCast<Arguments*>(cell); unsigned i = propertyName.asIndex(); - if (i < thisObject->d->numArguments) { + if (i < thisObject->m_numArguments) { ASSERT(i < PropertyName::NotAnIndex); if (!Base::deleteProperty(cell, exec, propertyName)) return false; - - if (!thisObject->d->deletedArguments) { - thisObject->d->deletedArguments = adoptArrayPtr(new bool[thisObject->d->numArguments]); - memset(thisObject->d->deletedArguments.get(), 0, sizeof(bool) * thisObject->d->numArguments); - } - if (!thisObject->d->deletedArguments[i]) { - thisObject->d->deletedArguments[i] = true; + if (thisObject->tryDeleteArgument(i)) return true; - } } - if (propertyName == exec->propertyNames().length && !thisObject->d->overrodeLength) { - thisObject->d->overrodeLength = true; + if (propertyName == exec->propertyNames().length && !thisObject->m_overrodeLength) { + thisObject->m_overrodeLength = true; return true; } - if (propertyName == exec->propertyNames().callee && !thisObject->d->overrodeCallee) { - if (!thisObject->d->isStrictMode) { - thisObject->d->overrodeCallee = true; + if (propertyName == exec->propertyNames().callee && !thisObject->m_overrodeCallee) { + if (!thisObject->m_isStrictMode) { + thisObject->m_overrodeCallee = true; return true; } thisObject->createStrictModeCalleeIfNecessary(exec); } - if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode) + if (propertyName == exec->propertyNames().caller && thisObject->m_isStrictMode) thisObject->createStrictModeCallerIfNecessary(exec); return JSObject::deleteProperty(thisObject, exec, propertyName); @@ -303,47 +284,46 @@ bool Arguments::defineOwnProperty(JSObject* object, ExecState* exec, PropertyNam { Arguments* thisObject = jsCast<Arguments*>(object); unsigned i = propertyName.asIndex(); - if (i < thisObject->d->numArguments) { + if (i < thisObject->m_numArguments) { ASSERT(i < PropertyName::NotAnIndex); // If the property is not yet present on the object, and is not yet marked as deleted, then add it now. PropertySlot slot; - if ((!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i]) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) - object->putDirectMayBeIndex(exec, propertyName, thisObject->argument(i).get()); + if (!thisObject->isDeletedArgument(i) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) { + JSValue value = thisObject->tryGetArgument(i); + ASSERT(value); + object->putDirectMayBeIndex(exec, propertyName, value); + } if (!Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow)) return false; - if (!thisObject->d->deletedArguments) { - thisObject->d->deletedArguments = adoptArrayPtr(new bool[thisObject->d->numArguments]); - memset(thisObject->d->deletedArguments.get(), 0, sizeof(bool) * thisObject->d->numArguments); - } // From ES 5.1, 10.6 Arguments Object // 5. If the value of isMapped is not undefined, then - if (!thisObject->d->deletedArguments[i]) { + if (thisObject->isArgument(i)) { // a. If IsAccessorDescriptor(Desc) is true, then if (descriptor.isAccessorDescriptor()) { // i. Call the [[Delete]] internal method of map passing P, and false as the arguments. - thisObject->d->deletedArguments[i] = true; + thisObject->tryDeleteArgument(i); } else { // b. Else // i. If Desc.[[Value]] is present, then // 1. Call the [[Put]] internal method of map passing P, Desc.[[Value]], and Throw as the arguments. if (descriptor.value()) - thisObject->argument(i).set(exec->globalData(), thisObject, descriptor.value()); + thisObject->trySetArgument(exec->globalData(), i, descriptor.value()); // ii. If Desc.[[Writable]] is present and its value is false, then // 1. Call the [[Delete]] internal method of map passing P and false as arguments. if (descriptor.writablePresent() && !descriptor.writable()) - thisObject->d->deletedArguments[i] = true; + thisObject->tryDeleteArgument(i); } } return true; } - if (propertyName == exec->propertyNames().length && !thisObject->d->overrodeLength) { - thisObject->putDirect(exec->globalData(), propertyName, jsNumber(thisObject->d->numArguments), DontEnum); - thisObject->d->overrodeLength = true; - } else if (propertyName == exec->propertyNames().callee && !thisObject->d->overrodeCallee) { - thisObject->putDirect(exec->globalData(), propertyName, thisObject->d->callee.get(), DontEnum); - thisObject->d->overrodeCallee = true; - } else if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode) + if (propertyName == exec->propertyNames().length && !thisObject->m_overrodeLength) { + thisObject->putDirect(exec->globalData(), propertyName, jsNumber(thisObject->m_numArguments), DontEnum); + thisObject->m_overrodeLength = true; + } else if (propertyName == exec->propertyNames().callee && !thisObject->m_overrodeCallee) { + thisObject->putDirect(exec->globalData(), propertyName, thisObject->m_callee.get(), DontEnum); + thisObject->m_overrodeCallee = true; + } else if (propertyName == exec->propertyNames().caller && thisObject->m_isStrictMode) thisObject->createStrictModeCallerIfNecessary(exec); return Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow); @@ -354,18 +334,18 @@ void Arguments::tearOff(CallFrame* callFrame) if (isTornOff()) return; - if (!d->numArguments) + if (!m_numArguments) return; // Must be called for the same call frame from which it was created. - ASSERT(bitwise_cast<WriteBarrier<Unknown>*>(callFrame) == d->registers); + ASSERT(bitwise_cast<WriteBarrier<Unknown>*>(callFrame) == m_registers); - d->registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[d->numArguments]); - d->registers = d->registerArray.get() + CallFrame::offsetFor(d->numArguments + 1); + m_registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[m_numArguments]); + m_registers = m_registerArray.get() + CallFrame::offsetFor(m_numArguments + 1); if (!callFrame->isInlineCallFrame()) { - for (size_t i = 0; i < d->numArguments; ++i) - argument(i).set(callFrame->globalData(), this, callFrame->argument(i)); + for (size_t i = 0; i < m_numArguments; ++i) + trySetArgument(callFrame->globalData(), i, callFrame->argumentAfterCapture(i)); return; } @@ -373,16 +353,41 @@ void Arguments::tearOff(CallFrame* callFrame) callFrame->globalData(), callFrame->registers(), callFrame->inlineCallFrame()); } +void Arguments::didTearOffActivation(ExecState* exec, JSActivation* activation) +{ + ASSERT(activation); + if (isTornOff()) + return; + + if (!m_numArguments) + return; + + tearOff(exec); + + SharedSymbolTable* symbolTable = activation->symbolTable(); + const SlowArgument* slowArguments = symbolTable->slowArguments(); + if (!slowArguments) + return; + + ASSERT(symbolTable->captureMode() == SharedSymbolTable::AllOfTheThings); + m_activation.set(exec->globalData(), this, activation); + + allocateSlowArguments(); + size_t count = min<unsigned>(m_numArguments, symbolTable->parameterCount()); + for (size_t i = 0; i < count; ++i) + m_slowArguments[i] = slowArguments[i]; +} + void Arguments::tearOff(CallFrame* callFrame, InlineCallFrame* inlineCallFrame) { if (isTornOff()) return; - if (!d->numArguments) + if (!m_numArguments) return; - d->registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[d->numArguments]); - d->registers = d->registerArray.get() + CallFrame::offsetFor(d->numArguments + 1); + m_registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[m_numArguments]); + m_registers = m_registerArray.get() + CallFrame::offsetFor(m_numArguments + 1); tearOffForInlineCallFrame( callFrame->globalData(), callFrame->registers() + inlineCallFrame->stackOffset, @@ -391,7 +396,7 @@ void Arguments::tearOff(CallFrame* callFrame, InlineCallFrame* inlineCallFrame) void Arguments::tearOffForInlineCallFrame(JSGlobalData& globalData, Register* registers, InlineCallFrame* inlineCallFrame) { - for (size_t i = 0; i < d->numArguments; ++i) { + for (size_t i = 0; i < m_numArguments; ++i) { ValueRecovery& recovery = inlineCallFrame->arguments[i + 1]; // In the future we'll support displaced recoveries (indicating that the // argument was flushed to a different location), but for now we don't do @@ -427,7 +432,7 @@ void Arguments::tearOffForInlineCallFrame(JSGlobalData& globalData, Register* re ASSERT_NOT_REACHED(); break; } - argument(i).set(globalData, this, value); + trySetArgument(globalData, i, value); } } diff --git a/Source/JavaScriptCore/runtime/Arguments.h b/Source/JavaScriptCore/runtime/Arguments.h index c3d25f962..ad0e651ea 100644 --- a/Source/JavaScriptCore/runtime/Arguments.h +++ b/Source/JavaScriptCore/runtime/Arguments.h @@ -33,31 +33,9 @@ namespace JSC { - struct ArgumentsData { - WTF_MAKE_NONCOPYABLE(ArgumentsData); WTF_MAKE_FAST_ALLOCATED; - public: - ArgumentsData() { } - WriteBarrier<JSActivation> activation; - - unsigned numArguments; - - // We make these full byte booleans to make them easy to test from the JIT, - // and because even if they were single-bit booleans we still wouldn't save - // any space. - bool overrodeLength; - bool overrodeCallee; - bool overrodeCaller; - bool isStrictMode; - - WriteBarrierBase<Unknown>* registers; - OwnArrayPtr<WriteBarrier<Unknown> > registerArray; - - OwnArrayPtr<bool> deletedArguments; - - WriteBarrier<JSFunction> callee; - }; - class Arguments : public JSNonFinalObject { + friend class JIT; + friend class DFG::SpeculativeJIT; public: typedef JSNonFinalObject Base; @@ -94,30 +72,22 @@ namespace JSC { uint32_t length(ExecState* exec) const { - if (UNLIKELY(d->overrodeLength)) + if (UNLIKELY(m_overrodeLength)) return get(exec, exec->propertyNames().length).toUInt32(exec); - return d->numArguments; + return m_numArguments; } void copyToArguments(ExecState*, CallFrame*, uint32_t length); void tearOff(CallFrame*); void tearOff(CallFrame*, InlineCallFrame*); - bool isTornOff() const { return d->registerArray; } - void didTearOffActivation(JSGlobalData& globalData, JSActivation* activation) - { - if (isTornOff()) - return; - d->activation.set(globalData, this, activation); - d->registers = &activation->registerAt(0); - } + bool isTornOff() const { return m_registerArray; } + void didTearOffActivation(ExecState*, JSActivation*); static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info); } - static ptrdiff_t offsetOfData() { return OBJECT_OFFSETOF(Arguments, d); } - protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSObject::StructureFlags; @@ -138,11 +108,34 @@ namespace JSC { void createStrictModeCallerIfNecessary(ExecState*); void createStrictModeCalleeIfNecessary(ExecState*); + bool isArgument(size_t); + bool trySetArgument(JSGlobalData&, size_t argument, JSValue); + JSValue tryGetArgument(size_t argument); + bool isDeletedArgument(size_t); + bool tryDeleteArgument(size_t); WriteBarrierBase<Unknown>& argument(size_t); + void allocateSlowArguments(); void init(CallFrame*); - OwnPtr<ArgumentsData> d; + WriteBarrier<JSActivation> m_activation; + + unsigned m_numArguments; + + // We make these full byte booleans to make them easy to test from the JIT, + // and because even if they were single-bit booleans we still wouldn't save + // any space. + bool m_overrodeLength; + bool m_overrodeCallee; + bool m_overrodeCaller; + bool m_isStrictMode; + + WriteBarrierBase<Unknown>* m_registers; + OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray; + + OwnArrayPtr<SlowArgument> m_slowArguments; + + WriteBarrier<JSFunction> m_callee; }; Arguments* asArguments(JSValue); @@ -155,19 +148,76 @@ namespace JSC { inline Arguments::Arguments(CallFrame* callFrame) : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure()) - , d(adoptPtr(new ArgumentsData)) { } inline Arguments::Arguments(CallFrame* callFrame, NoParametersType) : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure()) - , d(adoptPtr(new ArgumentsData)) { } - inline WriteBarrierBase<Unknown>& Arguments::argument(size_t i) + inline void Arguments::allocateSlowArguments() + { + if (m_slowArguments) + return; + m_slowArguments = adoptArrayPtr(new SlowArgument[m_numArguments]); + } + + inline bool Arguments::tryDeleteArgument(size_t argument) { - return d->registers[CallFrame::argumentOffset(i)]; + if (!isArgument(argument)) + return false; + allocateSlowArguments(); + m_slowArguments[argument].status = SlowArgument::Deleted; + return true; + } + + inline bool Arguments::trySetArgument(JSGlobalData& globalData, size_t argument, JSValue value) + { + if (!isArgument(argument)) + return false; + this->argument(argument).set(globalData, this, value); + return true; + } + + inline JSValue Arguments::tryGetArgument(size_t argument) + { + if (!isArgument(argument)) + return JSValue(); + return this->argument(argument).get(); + } + + inline bool Arguments::isDeletedArgument(size_t argument) + { + if (argument >= m_numArguments) + return false; + if (!m_slowArguments) + return false; + if (m_slowArguments[argument].status != SlowArgument::Deleted) + return false; + return true; + } + + inline bool Arguments::isArgument(size_t argument) + { + if (argument >= m_numArguments) + return false; + if (m_slowArguments && m_slowArguments[argument].status == SlowArgument::Deleted) + return false; + return true; + } + + inline WriteBarrierBase<Unknown>& Arguments::argument(size_t argument) + { + ASSERT(isArgument(argument)); + if (!m_slowArguments || m_slowArguments[argument].status == SlowArgument::Normal) + return m_registers[CallFrame::argumentOffset(argument)]; + + ASSERT(m_slowArguments[argument].status == SlowArgument::Captured); + if (!m_activation) + return m_registers[m_slowArguments[argument].indexIfCaptured]; + + return m_activation->registerAt(m_slowArguments[argument].indexIfCaptured); } inline void Arguments::finishCreation(CallFrame* callFrame) @@ -176,17 +226,17 @@ namespace JSC { ASSERT(inherits(&s_info)); JSFunction* callee = jsCast<JSFunction*>(callFrame->callee()); - d->numArguments = callFrame->argumentCount(); - d->registers = reinterpret_cast<WriteBarrierBase<Unknown>*>(callFrame->registers()); - d->callee.set(callFrame->globalData(), this, callee); - d->overrodeLength = false; - d->overrodeCallee = false; - d->overrodeCaller = false; - d->isStrictMode = callFrame->codeBlock()->isStrictMode(); + m_numArguments = callFrame->argumentCount(); + m_registers = reinterpret_cast<WriteBarrierBase<Unknown>*>(callFrame->registers()); + m_callee.set(callFrame->globalData(), this, callee); + m_overrodeLength = false; + m_overrodeCallee = false; + m_overrodeCaller = false; + m_isStrictMode = callFrame->codeBlock()->isStrictMode(); // The bytecode generator omits op_tear_off_activation in cases of no // declared parameters, so we need to tear off immediately. - if (d->isStrictMode || !callee->jsExecutable()->parameterCount()) + if (m_isStrictMode || !callee->jsExecutable()->parameterCount()) tearOff(callFrame); } @@ -196,17 +246,17 @@ namespace JSC { ASSERT(inherits(&s_info)); JSFunction* callee = inlineCallFrame->callee.get(); - d->numArguments = inlineCallFrame->arguments.size() - 1; - d->registers = reinterpret_cast<WriteBarrierBase<Unknown>*>(callFrame->registers()) + inlineCallFrame->stackOffset; - d->callee.set(callFrame->globalData(), this, callee); - d->overrodeLength = false; - d->overrodeCallee = false; - d->overrodeCaller = false; - d->isStrictMode = jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->isStrictMode(); + m_numArguments = inlineCallFrame->arguments.size() - 1; + m_registers = reinterpret_cast<WriteBarrierBase<Unknown>*>(callFrame->registers()) + inlineCallFrame->stackOffset; + m_callee.set(callFrame->globalData(), this, callee); + m_overrodeLength = false; + m_overrodeCallee = false; + m_overrodeCaller = false; + m_isStrictMode = jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->isStrictMode(); // The bytecode generator omits op_tear_off_activation in cases of no // declared parameters, so we need to tear off immediately. - if (d->isStrictMode || !callee->jsExecutable()->parameterCount()) + if (m_isStrictMode || !callee->jsExecutable()->parameterCount()) tearOff(callFrame, inlineCallFrame); } diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp index 503aecda8..c70e40d77 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -132,8 +132,10 @@ ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, Structure* structur void ArrayPrototype::finishCreation(JSGlobalObject* globalObject) { - Base::finishCreation(globalObject->globalData()); + JSGlobalData& globalData = globalObject->globalData(); + Base::finishCreation(globalData); ASSERT(inherits(&s_info)); + notifyUsedAsPrototype(globalData); } bool ArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) @@ -638,7 +640,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec) CallData callData; CallType callType = getCallData(function, callData); - if (thisObj->classInfo() == &JSArray::s_info && !asArray(thisObj)->inSparseIndexingMode()) { + if (thisObj->classInfo() == &JSArray::s_info && !asArray(thisObj)->inSparseIndexingMode() && !shouldUseSlowPut(thisObj->structure()->indexingType())) { if (isNumericCompareFunction(exec, callType, callData)) asArray(thisObj)->sortNumeric(exec, function, callType, callData); else if (callType != CallTypeNone) diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp index b11220bea..2791c65d4 100644 --- a/Source/JavaScriptCore/runtime/Executable.cpp +++ b/Source/JavaScriptCore/runtime/Executable.cpp @@ -202,7 +202,7 @@ JSObject* EvalExecutable::compileInternal(ExecState* exec, JSScope* scope, JITCo m_evalCodeBlock = newCodeBlock.release(); } else { if (!lexicalGlobalObject->evalEnabled()) - return throwError(exec, createEvalError(exec, ASCIILiteral("Eval is disabled"))); + return throwError(exec, createEvalError(exec, lexicalGlobalObject->evalDisabledErrorMessage())); RefPtr<EvalNode> evalNode = parse<EvalNode>(globalData, lexicalGlobalObject, m_source, 0, Identifier(), isStrictMode() ? JSParseStrict : JSParseNormal, EvalNode::isFunctionNode ? JSParseFunctionCode : JSParseProgramCode, lexicalGlobalObject->debugger(), exec, &exception); if (!evalNode) { ASSERT(exception); diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp index 40507dae1..570444e3c 100644 --- a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp +++ b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp @@ -82,7 +82,7 @@ CallType FunctionConstructor::getCallData(JSCell*, CallData& callData) JSObject* constructFunction(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args, const Identifier& functionName, const String& sourceURL, const TextPosition& position) { if (!globalObject->evalEnabled()) - return throwError(exec, createEvalError(exec, ASCIILiteral("Function constructor is disabled"))); + return throwError(exec, createEvalError(exec, globalObject->evalDisabledErrorMessage())); return constructFunctionSkippingEvalEnabledCheck(exec, globalObject, args, functionName, sourceURL, position); } diff --git a/Source/JavaScriptCore/runtime/IndexingType.h b/Source/JavaScriptCore/runtime/IndexingType.h index cd8d71dfe..3b97230ea 100644 --- a/Source/JavaScriptCore/runtime/IndexingType.h +++ b/Source/JavaScriptCore/runtime/IndexingType.h @@ -33,28 +33,65 @@ typedef uint8_t IndexingType; // Flags for testing the presence of capabilities. static const IndexingType IsArray = 1; static const IndexingType HasArrayStorage = 8; +static const IndexingType HasSlowPutArrayStorage = 16; // Additional flags for tracking the history of the type. These are usually // masked off unless you ask for them directly. -static const IndexingType HadArrayStorage = 16; // Means that this object did have array storage in the past. +static const IndexingType HadArrayStorage = 32; // Means that this object did have array storage in the past. +static const IndexingType MayHaveIndexedAccessors = 64; // List of acceptable array types. -static const IndexingType NonArray = 0; -static const IndexingType NonArrayWithArrayStorage = HasArrayStorage; -static const IndexingType ArrayClass = IsArray; // I'd want to call this "Array" but this would lead to disastrous namespace pollution. -static const IndexingType ArrayWithArrayStorage = IsArray | HasArrayStorage; +static const IndexingType NonArray = 0; +static const IndexingType NonArrayWithArrayStorage = HasArrayStorage; +static const IndexingType NonArrayWithSlowPutArrayStorage = HasSlowPutArrayStorage; +static const IndexingType ArrayClass = IsArray; // I'd want to call this "Array" but this would lead to disastrous namespace pollution. +static const IndexingType ArrayWithArrayStorage = IsArray | HasArrayStorage; +static const IndexingType ArrayWithSlowPutArrayStorage = IsArray | HasSlowPutArrayStorage; -// Mask of all possible types. -static const IndexingType AllArrayTypes = 15; +#define ALL_BLANK_INDEXING_TYPES \ + NonArray: \ + case ArrayClass -// Mask of all possible types including the history. -static const IndexingType AllArrayTypesAndHistory = 31; +#define ARRAY_WITH_ARRAY_STORAGE_INDEXING_TYPES \ + ArrayWithArrayStorage: \ + case ArrayWithSlowPutArrayStorage + +#define ALL_ARRAY_STORAGE_INDEXING_TYPES \ + NonArrayWithArrayStorage: \ + case NonArrayWithSlowPutArrayStorage: \ + case ARRAY_WITH_ARRAY_STORAGE_INDEXING_TYPES + +static inline bool hasIndexedProperties(IndexingType indexingType) +{ + switch (indexingType) { + case ALL_BLANK_INDEXING_TYPES: + return false; + default: + return true; + } +} + +static inline bool hasIndexingHeader(IndexingType type) +{ + return hasIndexedProperties(type); +} -inline bool hasIndexingHeader(IndexingType type) +static inline bool hasArrayStorage(IndexingType indexingType) { - return !!(type & HasArrayStorage); + return !!(indexingType & (HasArrayStorage | HasSlowPutArrayStorage)); } +static inline bool shouldUseSlowPut(IndexingType indexingType) +{ + return !!(indexingType & HasSlowPutArrayStorage); +} + +// Mask of all possible types. +static const IndexingType AllArrayTypes = 31; + +// Mask of all possible types including the history. +static const IndexingType AllArrayTypesAndHistory = 127; + } // namespace JSC #endif // IndexingType_h diff --git a/Source/JavaScriptCore/runtime/InitializeThreading.cpp b/Source/JavaScriptCore/runtime/InitializeThreading.cpp index 6e7eddbf1..1a7239f60 100644 --- a/Source/JavaScriptCore/runtime/InitializeThreading.cpp +++ b/Source/JavaScriptCore/runtime/InitializeThreading.cpp @@ -35,6 +35,7 @@ #include "Identifier.h" #include "JSDateMath.h" #include "JSGlobalObject.h" +#include "JSLock.h" #include "LLIntData.h" #include "WriteBarrier.h" #include <wtf/dtoa.h> @@ -53,6 +54,7 @@ static void initializeThreadingOnce() { WTF::double_conversion::initialize(); WTF::initializeThreading(); + GlobalJSLock::initialize(); Options::initialize(); #if ENABLE(WRITE_BARRIER_PROFILING) WriteBarrierCounters::initialize(); diff --git a/Source/JavaScriptCore/runtime/JSActivation.h b/Source/JavaScriptCore/runtime/JSActivation.h index df59c3d94..8211e7710 100644 --- a/Source/JavaScriptCore/runtime/JSActivation.h +++ b/Source/JavaScriptCore/runtime/JSActivation.h @@ -48,7 +48,7 @@ namespace JSC { static JSActivation* create(JSGlobalData& globalData, CallFrame* callFrame, FunctionExecutable* functionExecutable) { - size_t storageSize = JSActivation::storageSize(callFrame, functionExecutable->symbolTable()); + size_t storageSize = JSActivation::storageSize(functionExecutable->symbolTable()); JSActivation* activation = new ( NotNull, allocateCell<JSActivation>( @@ -98,8 +98,8 @@ namespace JSC { NEVER_INLINE PropertySlot::GetValueFunc getArgumentsGetter(); static size_t allocationSize(size_t storageSize); - static size_t storageSize(CallFrame*, SharedSymbolTable*); - static int captureStart(CallFrame*, SharedSymbolTable*); + static size_t storageSize(SharedSymbolTable*); + static int captureStart(SharedSymbolTable*); int registerOffset(); size_t storageSize(); @@ -142,26 +142,26 @@ namespace JSC { return false; } - inline int JSActivation::captureStart(CallFrame* callFrame, SharedSymbolTable* symbolTable) + inline int JSActivation::captureStart(SharedSymbolTable* symbolTable) { if (symbolTable->captureMode() == SharedSymbolTable::AllOfTheThings) - return -CallFrame::offsetFor(std::max<size_t>(callFrame->argumentCountIncludingThis(), symbolTable->parameterCountIncludingThis())); + return -CallFrame::offsetFor(symbolTable->parameterCountIncludingThis()); return symbolTable->captureStart(); } - inline size_t JSActivation::storageSize(CallFrame* callFrame, SharedSymbolTable* symbolTable) + inline size_t JSActivation::storageSize(SharedSymbolTable* symbolTable) { - return symbolTable->captureEnd() - captureStart(callFrame, symbolTable); + return symbolTable->captureEnd() - captureStart(symbolTable); } inline int JSActivation::registerOffset() { - return -captureStart(CallFrame::create(reinterpret_cast<Register*>(m_registers)), symbolTable()); + return -captureStart(symbolTable()); } inline size_t JSActivation::storageSize() { - return storageSize(CallFrame::create(reinterpret_cast<Register*>(m_registers)), symbolTable()); + return storageSize(symbolTable()); } inline void JSActivation::tearOff(JSGlobalData& globalData) @@ -216,7 +216,7 @@ namespace JSC { inline bool JSActivation::isValid(const SymbolTableEntry& entry) { - if (entry.getIndex() < captureStart(CallFrame::create(reinterpret_cast<Register*>(m_registers)), symbolTable())) + if (entry.getIndex() < captureStart(symbolTable())) return false; if (entry.getIndex() >= symbolTable()->captureEnd()) return false; diff --git a/Source/JavaScriptCore/runtime/JSArray.cpp b/Source/JavaScriptCore/runtime/JSArray.cpp index 241049dce..ebbbd41aa 100644 --- a/Source/JavaScriptCore/runtime/JSArray.cpp +++ b/Source/JavaScriptCore/runtime/JSArray.cpp @@ -34,7 +34,6 @@ #include "IndexingHeaderInlineMethods.h" #include "PropertyNameArray.h" #include "Reject.h" -#include "SparseArrayValueMapInlineMethods.h" #include <wtf/AVLTree.h> #include <wtf/Assertions.h> #include <wtf/OwnPtr.h> @@ -405,7 +404,7 @@ JSValue JSArray::pop(ExecState* exec) case ArrayClass: return jsUndefined(); - case ArrayWithArrayStorage: { + case ARRAY_WITH_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = m_butterfly->arrayStorage(); unsigned length = storage->length(); @@ -465,6 +464,16 @@ void JSArray::push(ExecState* exec, JSValue value) break; } + case ArrayWithSlowPutArrayStorage: { + unsigned oldLength = length(); + if (attemptToInterceptPutByIndexOnHole(exec, oldLength, value, true)) { + if (!exec->hadException() && oldLength < 0xFFFFFFFFu) + setLength(exec, oldLength + 1, true); + return; + } + // Fall through. + } + case ArrayWithArrayStorage: { ArrayStorage* storage = m_butterfly->arrayStorage(); @@ -478,8 +487,8 @@ void JSArray::push(ExecState* exec, JSValue value) return; } - // Pushing to an array of length 2^32-1 stores the property, but throws a range error. - if (UNLIKELY(storage->length() == 0xFFFFFFFFu)) { + // Pushing to an array of invalid length (2^31-1) stores the property, but throws a range error. + if (storage->length() > MAX_ARRAY_INDEX) { methodTable()->putByIndex(this, exec, storage->length(), value, true); // Per ES5.1 15.4.4.7 step 6 & 15.4.5.1 step 3.d. if (!exec->hadException()) @@ -549,7 +558,9 @@ bool JSArray::unshiftCount(ExecState* exec, unsigned count) storage = m_butterfly->arrayStorage(); storage->m_indexBias -= count; storage->setVectorLength(storage->vectorLength() + count); - } else if (!unshiftCountSlowCase(exec->globalData(), count)) { + } else if (unshiftCountSlowCase(exec->globalData(), count)) + storage = arrayStorage(); + else { throwOutOfMemoryError(exec); return true; } @@ -916,7 +927,7 @@ void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) case ArrayClass: return; - case ArrayWithArrayStorage: { + case ARRAY_WITH_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = m_butterfly->arrayStorage(); WriteBarrier<Unknown>* vector = storage->m_vector; @@ -946,7 +957,7 @@ void JSArray::copyToArguments(ExecState* exec, CallFrame* callFrame, uint32_t le case ArrayClass: return; - case ArrayWithArrayStorage: { + case ARRAY_WITH_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = m_butterfly->arrayStorage(); unsigned i = 0; WriteBarrier<Unknown>* vector = storage->m_vector; diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h index d382f64a9..c46e67863 100644 --- a/Source/JavaScriptCore/runtime/JSArray.h +++ b/Source/JavaScriptCore/runtime/JSArray.h @@ -78,9 +78,9 @@ namespace JSC { void fillArgList(ExecState*, MarkedArgumentBuffer&); void copyToArguments(ExecState*, CallFrame*, uint32_t length); - static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) + static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, IndexingType indexingType) { - return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info, ArrayWithArrayStorage); + return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info, indexingType); } protected: diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp index e409c8219..26f2b8616 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp @@ -55,7 +55,6 @@ #include "ParserArena.h" #include "RegExpCache.h" #include "RegExpObject.h" -#include "SparseArrayValueMapInlineMethods.h" #include "StrictEvalActivation.h" #include "StrongInlines.h" #include <wtf/RetainPtr.h> diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index 8ee8e1498..a6993aabc 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -111,6 +111,7 @@ static const int preferredScriptCheckTimeInterval = 1000; JSGlobalObject::JSGlobalObject(JSGlobalData& globalData, Structure* structure, const GlobalObjectMethodTable* globalObjectMethodTable) : Base(globalData, structure, 0) , m_masqueradesAsUndefinedWatchpoint(adoptRef(new WatchpointSet(InitializedWatching))) + , m_havingABadTimeWatchpoint(adoptRef(new WatchpointSet(InitializedWatching))) , m_weakRandom(Options::forceWeakRandomSeed() ? Options::forcedWeakRandomSeed() : static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0))) , m_evalEnabled(true) , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable) @@ -230,7 +231,8 @@ void JSGlobalObject::reset(JSValue prototype) m_callbackObjectStructure.set(exec->globalData(), this, JSCallbackObject<JSNonFinalObject>::createStructure(exec->globalData(), this, m_objectPrototype.get())); m_arrayPrototype.set(exec->globalData(), this, ArrayPrototype::create(exec, this, ArrayPrototype::createStructure(exec->globalData(), this, m_objectPrototype.get()))); - m_arrayStructure.set(exec->globalData(), this, JSArray::createStructure(exec->globalData(), this, m_arrayPrototype.get())); + m_arrayStructure.set(exec->globalData(), this, JSArray::createStructure(exec->globalData(), this, m_arrayPrototype.get(), ArrayWithArrayStorage)); + m_arrayStructureForSlowPut.set(exec->globalData(), this, JSArray::createStructure(exec->globalData(), this, m_arrayPrototype.get(), ArrayWithSlowPutArrayStorage)); m_regExpMatchesArrayStructure.set(exec->globalData(), this, RegExpMatchesArray::createStructure(exec->globalData(), this, m_arrayPrototype.get())); m_stringPrototype.set(exec->globalData(), this, StringPrototype::create(exec, this, StringPrototype::createStructure(exec->globalData(), this, m_objectPrototype.get()))); @@ -329,6 +331,96 @@ void JSGlobalObject::reset(JSValue prototype) resetPrototype(exec->globalData(), prototype); } +// Private namespace for helpers for JSGlobalObject::haveABadTime() +namespace { + +class ObjectsWithBrokenIndexingFinder : public MarkedBlock::VoidFunctor { +public: + ObjectsWithBrokenIndexingFinder(MarkedArgumentBuffer&, JSGlobalObject*); + void operator()(JSCell*); + +private: + MarkedArgumentBuffer& m_foundObjects; + JSGlobalObject* m_globalObject; +}; + +ObjectsWithBrokenIndexingFinder::ObjectsWithBrokenIndexingFinder( + MarkedArgumentBuffer& foundObjects, JSGlobalObject* globalObject) + : m_foundObjects(foundObjects) + , m_globalObject(globalObject) +{ +} + +inline bool hasBrokenIndexing(JSObject* object) +{ + // This will change if we have more indexing types. + return !!(object->structure()->indexingType() & HasArrayStorage); +} + +void ObjectsWithBrokenIndexingFinder::operator()(JSCell* cell) +{ + if (!cell->isObject()) + return; + + JSObject* object = asObject(cell); + + // Run this filter first, since it's cheap, and ought to filter out a lot of objects. + if (!hasBrokenIndexing(object)) + return; + + // We only want to have a bad time in the affected global object, not in the entire + // VM. But we have to be careful, since there may be objects that claim to belong to + // a different global object that have prototypes from our global object. + bool foundGlobalObject = false; + for (JSObject* current = object; ;) { + if (current->unwrappedGlobalObject() == m_globalObject) { + foundGlobalObject = true; + break; + } + + JSValue prototypeValue = current->prototype(); + if (prototypeValue.isNull()) + break; + current = asObject(prototypeValue); + } + if (!foundGlobalObject) + return; + + m_foundObjects.append(object); +} + +} // end private namespace for helpers for JSGlobalObject::haveABadTime() + +void JSGlobalObject::haveABadTime(JSGlobalData& globalData) +{ + ASSERT(&globalData == &this->globalData()); + + if (isHavingABadTime()) + return; + + // Make sure that all allocations or indexed storage transitions that are inlining + // the assumption that it's safe to transition to a non-SlowPut array storage don't + // do so anymore. + m_havingABadTimeWatchpoint->notifyWrite(); + ASSERT(isHavingABadTime()); // The watchpoint is what tells us that we're having a bad time. + + // Make sure that all JSArray allocations that load the appropriate structure from + // this object now load a structure that uses SlowPut. + m_arrayStructure.set(globalData, this, m_arrayStructureForSlowPut.get()); + + // Make sure that all objects that have indexed storage switch to the slow kind of + // indexed storage. + MarkedArgumentBuffer foundObjects; // Use MarkedArgumentBuffer because switchToSlowPutArrayStorage() may GC. + ObjectsWithBrokenIndexingFinder finder(foundObjects, this); + globalData.heap.objectSpace().forEachLiveCell(finder); + while (!foundObjects.isEmpty()) { + JSObject* object = asObject(foundObjects.last()); + foundObjects.removeLast(); + ASSERT(hasBrokenIndexing(object)); + object->switchToSlowPutArrayStorage(globalData); + } +} + void JSGlobalObject::createThrowTypeError(ExecState* exec) { JSFunction* thrower = JSFunction::create(exec, this, 0, String(), globalFuncThrowTypeError); diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index 406a65b51..ad56783cc 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -126,7 +126,8 @@ namespace JSC { WriteBarrier<Structure> m_activationStructure; WriteBarrier<Structure> m_nameScopeStructure; WriteBarrier<Structure> m_argumentsStructure; - WriteBarrier<Structure> m_arrayStructure; + WriteBarrier<Structure> m_arrayStructure; // This gets set to m_arrayStructureForSlowPut as soon as we decide to have a bad time. + WriteBarrier<Structure> m_arrayStructureForSlowPut; WriteBarrier<Structure> m_booleanObjectStructure; WriteBarrier<Structure> m_callbackConstructorStructure; WriteBarrier<Structure> m_callbackFunctionStructure; @@ -149,12 +150,14 @@ namespace JSC { Debugger* m_debugger; RefPtr<WatchpointSet> m_masqueradesAsUndefinedWatchpoint; + RefPtr<WatchpointSet> m_havingABadTimeWatchpoint; OwnPtr<JSGlobalObjectRareData> m_rareData; WeakRandom m_weakRandom; bool m_evalEnabled; + String m_evalDisabledErrorMessage; bool m_experimentsEnabled; static JS_EXPORTDATA const GlobalObjectMethodTable s_globalObjectMethodTable; @@ -259,6 +262,7 @@ namespace JSC { Structure* nameScopeStructure() const { return m_nameScopeStructure.get(); } Structure* argumentsStructure() const { return m_argumentsStructure.get(); } Structure* arrayStructure() const { return m_arrayStructure.get(); } + void* addressOfArrayStructure() { return &m_arrayStructure; } Structure* booleanObjectStructure() const { return m_booleanObjectStructure.get(); } Structure* callbackConstructorStructure() const { return m_callbackConstructorStructure.get(); } Structure* callbackFunctionStructure() const { return m_callbackFunctionStructure.get(); } @@ -279,6 +283,14 @@ namespace JSC { Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); } WatchpointSet* masqueradesAsUndefinedWatchpoint() { return m_masqueradesAsUndefinedWatchpoint.get(); } + WatchpointSet* havingABadTimeWatchpoint() { return m_havingABadTimeWatchpoint.get(); } + + bool isHavingABadTime() const + { + return m_havingABadTimeWatchpoint->hasBeenInvalidated(); + } + + void haveABadTime(JSGlobalData&); void setProfileGroup(unsigned value) { createRareDataIfNeeded(); m_rareData->profileGroup = value; } unsigned profileGroup() const @@ -304,8 +316,13 @@ namespace JSC { bool isDynamicScope(bool& requiresDynamicChecks) const; - void setEvalEnabled(bool enabled) { m_evalEnabled = enabled; } - bool evalEnabled() { return m_evalEnabled; } + bool evalEnabled() const { return m_evalEnabled; } + const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorMessage; } + void setEvalEnabled(bool enabled, const String& errorMessage = String()) + { + m_evalEnabled = enabled; + m_evalDisabledErrorMessage = errorMessage; + } void resetPrototype(JSGlobalData&, JSValue prototype); diff --git a/Source/JavaScriptCore/runtime/JSLock.cpp b/Source/JavaScriptCore/runtime/JSLock.cpp index c57c9cdc5..9f02b69b8 100644 --- a/Source/JavaScriptCore/runtime/JSLock.cpp +++ b/Source/JavaScriptCore/runtime/JSLock.cpp @@ -33,21 +33,21 @@ namespace JSC { -// JSLock is only needed to support an obsolete execution model where JavaScriptCore -// automatically protected against concurrent access from multiple threads. -// So it's safe to disable it on non-mac platforms where we don't have native pthreads. -#if (OS(DARWIN) || USE(PTHREADS)) - -static pthread_mutex_t sharedInstanceLock = PTHREAD_MUTEX_INITIALIZER; +Mutex* GlobalJSLock::s_sharedInstanceLock = 0; GlobalJSLock::GlobalJSLock() { - pthread_mutex_lock(&sharedInstanceLock); + s_sharedInstanceLock->lock(); } GlobalJSLock::~GlobalJSLock() { - pthread_mutex_unlock(&sharedInstanceLock); + s_sharedInstanceLock->unlock(); +} + +void GlobalJSLock::initialize() +{ + s_sharedInstanceLock = new Mutex(); } JSLockHolder::JSLockHolder(ExecState* exec) @@ -216,95 +216,4 @@ JSLock::DropAllLocks::~DropAllLocks() m_globalData->apiLock().grabAllLocks(m_lockCount); } -#else // (OS(DARWIN) || USE(PTHREADS)) - -GlobalJSLock::GlobalJSLock() -{ -} - -GlobalJSLock::~GlobalJSLock() -{ -} - -JSLockHolder::JSLockHolder(JSGlobalData*) -{ -} - -JSLockHolder::JSLockHolder(JSGlobalData&) -{ -} - -JSLockHolder::JSLockHolder(ExecState*) -{ -} - -JSLockHolder::~JSLockHolder() -{ -} - -JSLock::JSLock() -{ -} - -JSLock::~JSLock() -{ -} - -bool JSLock::currentThreadIsHoldingLock() -{ - return true; -} - -void JSLock::lock() -{ -} - -void JSLock::unlock() -{ -} - -void JSLock::lock(ExecState*) -{ -} - -void JSLock::unlock(ExecState*) -{ -} - -void JSLock::lock(JSGlobalData&) -{ -} - -void JSLock::unlock(JSGlobalData&) -{ -} - -unsigned JSLock::dropAllLocks() -{ - return 0; -} - -unsigned JSLock::dropAllLocksUnconditionally() -{ - return 0; -} - -void JSLock::grabAllLocks(unsigned) -{ -} - -JSLock::DropAllLocks::DropAllLocks(ExecState*) -{ -} - -JSLock::DropAllLocks::DropAllLocks(JSGlobalData*) -{ -} - -JSLock::DropAllLocks::~DropAllLocks() -{ -} - -#endif // (OS(DARWIN) || USE(PTHREADS)) - } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSLock.h b/Source/JavaScriptCore/runtime/JSLock.h index 94108d013..4c42dc0ae 100644 --- a/Source/JavaScriptCore/runtime/JSLock.h +++ b/Source/JavaScriptCore/runtime/JSLock.h @@ -58,6 +58,10 @@ namespace JSC { public: JS_EXPORT_PRIVATE GlobalJSLock(); JS_EXPORT_PRIVATE ~GlobalJSLock(); + + static void initialize(); + private: + static Mutex* s_sharedInstanceLock; }; class JSLockHolder { @@ -91,12 +95,6 @@ namespace JSC { unsigned dropAllLocksUnconditionally(); void grabAllLocks(unsigned lockCount); - SpinLock m_spinLock; - Mutex m_lock; - ThreadIdentifier m_ownerThread; - intptr_t m_lockCount; - unsigned m_lockDropDepth; - class DropAllLocks { WTF_MAKE_NONCOPYABLE(DropAllLocks); public: @@ -108,6 +106,13 @@ namespace JSC { intptr_t m_lockCount; RefPtr<JSGlobalData> m_globalData; }; + + private: + SpinLock m_spinLock; + Mutex m_lock; + ThreadIdentifier m_ownerThread; + intptr_t m_lockCount; + unsigned m_lockDropDepth; }; } // namespace diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index 6eac0d1cb..229d1aea6 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -42,7 +42,6 @@ #include "PropertyNameArray.h" #include "Reject.h" #include "SlotVisitorInlineMethods.h" -#include "SparseArrayValueMapInlineMethods.h" #include <math.h> #include <wtf/Assertions.h> @@ -50,7 +49,8 @@ namespace JSC { // We keep track of the size of the last array after it was grown. We use this // as a simple heuristic for as the value to grow the next array from size 0. -// This value is capped by the constant FIRST_VECTOR_GROW defined above. +// This value is capped by the constant FIRST_VECTOR_GROW defined in +// ArrayConventions.h. static unsigned lastArraySize = 0; JSCell* getCallableObjectSlow(JSCell* cell) @@ -133,8 +133,7 @@ ALWAYS_INLINE void JSObject::visitButterfly(SlotVisitor& visitor, Butterfly* but // Mark and copy the array if appropriate. switch (structure->indexingType()) { - case ArrayWithArrayStorage: - case NonArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { newButterfly->arrayStorage()->copyHeaderFromDuringGC(*butterfly->arrayStorage()); WriteBarrier<Unknown>* currentTarget = newButterfly->arrayStorage()->m_vector; WriteBarrier<Unknown>* currentSource = butterfly->arrayStorage()->m_vector; @@ -160,8 +159,7 @@ ALWAYS_INLINE void JSObject::visitButterfly(SlotVisitor& visitor, Butterfly* but // Mark the array if appropriate. switch (structure->indexingType()) { - case ArrayWithArrayStorage: - case NonArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: visitor.appendValues(butterfly->arrayStorage()->m_vector, butterfly->arrayStorage()->vectorLength()); if (butterfly->arrayStorage()->m_sparseMap) visitor.append(&butterfly->arrayStorage()->m_sparseMap); @@ -234,12 +232,10 @@ bool JSObject::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, i), slot); switch (thisObject->structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: break; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = thisObject->m_butterfly->arrayStorage(); if (i >= storage->length()) return false; @@ -301,7 +297,7 @@ void JSObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSV unsigned attributes; JSCell* specificValue; PropertyOffset offset = obj->structure()->get(globalData, propertyName, attributes, specificValue); - if (offset != invalidOffset) { + if (isValidOffset(offset)) { if (attributes & ReadOnly) { if (slot.isStrictMode()) throwError(exec, createTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError))); @@ -347,15 +343,14 @@ void JSObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSObject* thisObject = jsCast<JSObject*>(cell); thisObject->checkIndexingConsistency(); - if (UNLIKELY(propertyName > MAX_ARRAY_INDEX)) { + if (propertyName > MAX_ARRAY_INDEX) { PutPropertySlot slot(shouldThrow); thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, propertyName), value, slot); return; } switch (thisObject->structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: break; case NonArrayWithArrayStorage: @@ -381,6 +376,34 @@ void JSObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, return; } + case NonArrayWithSlowPutArrayStorage: + case ArrayWithSlowPutArrayStorage: { + ArrayStorage* storage = thisObject->m_butterfly->arrayStorage(); + + if (propertyName >= storage->vectorLength()) + break; + + WriteBarrier<Unknown>& valueSlot = storage->m_vector[propertyName]; + unsigned length = storage->length(); + + // Update length & m_numValuesInVector as necessary. + if (propertyName >= length) { + if (thisObject->attemptToInterceptPutByIndexOnHole(exec, propertyName, value, shouldThrow)) + return; + length = propertyName + 1; + storage->setLength(length); + ++storage->m_numValuesInVector; + } else if (!valueSlot) { + if (thisObject->attemptToInterceptPutByIndexOnHole(exec, propertyName, value, shouldThrow)) + return; + ++storage->m_numValuesInVector; + } + + valueSlot.set(exec->globalData(), thisObject, value); + thisObject->checkIndexingConsistency(); + return; + } + default: ASSERT_NOT_REACHED(); } @@ -425,8 +448,7 @@ ArrayStorage* JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists void JSObject::enterDictionaryIndexingMode(JSGlobalData& globalData) { switch (structure()->indexingType()) { - case ArrayWithArrayStorage: - case NonArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: enterDictionaryIndexingModeWhenArrayStorageAlreadyExists(globalData, m_butterfly->arrayStorage()); break; @@ -435,10 +457,23 @@ void JSObject::enterDictionaryIndexingMode(JSGlobalData& globalData) } } +void JSObject::notifyPresenceOfIndexedAccessors(JSGlobalData& globalData) +{ + if (mayInterceptIndexedAccesses()) + return; + + setStructure(globalData, Structure::nonPropertyTransition(globalData, structure(), AddIndexedAccessors)); + + if (!mayBeUsedAsPrototype(globalData)) + return; + + globalObject()->haveABadTime(globalData); +} + ArrayStorage* JSObject::createArrayStorage(JSGlobalData& globalData, unsigned length, unsigned vectorLength) { IndexingType oldType = structure()->indexingType(); - ASSERT_UNUSED(oldType, oldType == NonArray || oldType == ArrayClass); + ASSERT_UNUSED(oldType, !hasIndexedProperties(oldType)); Butterfly* newButterfly = m_butterfly->growArrayRight( globalData, structure(), structure()->outOfLineCapacity(), false, 0, ArrayStorage::sizeFor(vectorLength)); @@ -454,7 +489,7 @@ ArrayStorage* JSObject::createArrayStorage(JSGlobalData& globalData, unsigned le result->m_initializationIndex = 0; result->m_inCompactInitialization = 0; #endif - Structure* newStructure = Structure::nonPropertyTransition(globalData, structure(), AllocateArrayStorage); + Structure* newStructure = Structure::nonPropertyTransition(globalData, structure(), structure()->suggestedIndexingTransition()); setButterfly(globalData, newButterfly, newStructure); return result; } @@ -467,12 +502,10 @@ ArrayStorage* JSObject::createInitialArrayStorage(JSGlobalData& globalData) ArrayStorage* JSObject::ensureArrayStorageExistsAndEnterDictionaryIndexingMode(JSGlobalData& globalData) { switch (structure()->indexingType()) { - case ArrayWithArrayStorage: - case NonArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return enterDictionaryIndexingModeWhenArrayStorageAlreadyExists(globalData, m_butterfly->arrayStorage()); - case ArrayClass: - case NonArray: { + case ALL_BLANK_INDEXING_TYPES: { createArrayStorage(globalData, 0, 0); SparseArrayValueMap* map = allocateSparseIndexMap(globalData); map->setSparseMode(); @@ -485,6 +518,22 @@ ArrayStorage* JSObject::ensureArrayStorageExistsAndEnterDictionaryIndexingMode(J } } +void JSObject::switchToSlowPutArrayStorage(JSGlobalData& globalData) +{ + switch (structure()->indexingType()) { + case NonArrayWithArrayStorage: + case ArrayWithArrayStorage: { + Structure* newStructure = Structure::nonPropertyTransition(globalData, structure(), SwitchToSlowPutArrayStorage); + setStructure(globalData, newStructure); + break; + } + + default: + ASSERT_NOT_REACHED(); + break; + } +} + void JSObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); @@ -492,6 +541,33 @@ void JSObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName object->putDirectInternal<PutModeDefineOwnProperty>(exec->globalData(), propertyName, value, attributes, slot, getCallableObject(value)); } +void JSObject::setPrototype(JSGlobalData& globalData, JSValue prototype) +{ + ASSERT(prototype); + if (prototype.isObject()) + asObject(prototype)->notifyUsedAsPrototype(globalData); + + Structure* newStructure = Structure::changePrototypeTransition(globalData, structure(), prototype); + setStructure(globalData, newStructure); + + if (!newStructure->anyObjectInChainMayInterceptIndexedAccesses()) + return; + + if (mayBeUsedAsPrototype(globalData)) { + newStructure->globalObject()->haveABadTime(globalData); + return; + } + + if (!hasIndexingHeader(structure()->indexingType())) + return; + + if (shouldUseSlowPut(structure()->indexingType())) + return; + + newStructure = Structure::nonPropertyTransition(globalData, newStructure, SwitchToSlowPutArrayStorage); + setStructure(globalData, newStructure); +} + bool JSObject::setPrototypeWithCycleCheck(JSGlobalData& globalData, JSValue prototype) { JSValue checkFor = this; @@ -508,9 +584,32 @@ bool JSObject::setPrototypeWithCycleCheck(JSGlobalData& globalData, JSValue prot return true; } +void JSObject::resetInheritorID(JSGlobalData& globalData) +{ + PropertyOffset offset = structure()->get(globalData, globalData.m_inheritorIDKey); + if (!isValidOffset(offset)) + return; + + putDirectOffset(globalData, offset, jsUndefined()); +} + +Structure* JSObject::inheritorID(JSGlobalData& globalData) +{ + if (WriteBarrierBase<Unknown>* location = getDirectLocation(globalData, globalData.m_inheritorIDKey)) { + JSValue value = location->get(); + if (value.isCell()) { + Structure* inheritorID = jsCast<Structure*>(value); + ASSERT(inheritorID->isEmpty()); + return inheritorID; + } + ASSERT(value.isUndefined()); + } + return createInheritorID(globalData); +} + bool JSObject::allowsAccessFrom(ExecState* exec) { - JSGlobalObject* globalObject = isGlobalThis() ? jsCast<JSGlobalThis*>(this)->unwrappedObject() : this->globalObject(); + JSGlobalObject* globalObject = unwrappedGlobalObject(); return globalObject->globalObjectMethodTable()->allowsAccessFrom(globalObject, exec); } @@ -597,12 +696,10 @@ bool JSObject::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned i) return thisObject->methodTable()->deleteProperty(thisObject, exec, Identifier::from(exec, i)); switch (thisObject->structure()->indexingType()) { - case ArrayClass: - case NonArray: + case ALL_BLANK_INDEXING_TYPES: return true; - case ArrayWithArrayStorage: - case NonArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = thisObject->m_butterfly->arrayStorage(); if (i < storage->vectorLength()) { @@ -762,12 +859,10 @@ void JSObject::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNa // is incredibly inefficient for large arrays. We need a different approach, // which almost certainly means a different structure for PropertyNameArray. switch (object->structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: break; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = object->m_butterfly->arrayStorage(); unsigned usedVectorLength = std::min(storage->length(), storage->vectorLength()); @@ -857,6 +952,13 @@ void JSObject::preventExtensions(JSGlobalData& globalData) setStructure(globalData, Structure::preventExtensionsTransition(globalData, structure())); } +JSGlobalObject* JSObject::unwrappedGlobalObject() +{ + if (isGlobalThis()) + return jsCast<JSGlobalThis*>(this)->unwrappedObject(); + return structure()->globalObject(); +} + // This presently will flatten to an uncachable dictionary; this is suitable // for use in delete, we may want to do something different elsewhere. void JSObject::reifyStaticFunctionsForDelete(ExecState* exec) @@ -920,18 +1022,35 @@ NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, PropertyO slot.setUndefined(); } -Structure* JSObject::createInheritorID(JSGlobalData& globalData) +void JSObject::notifyUsedAsPrototype(JSGlobalData& globalData) { - ASSERT(!getDirectLocation(globalData, globalData.m_inheritorIDKey)); - - JSGlobalObject* globalObject; - if (isGlobalThis()) - globalObject = static_cast<JSGlobalThis*>(this)->unwrappedObject(); - else - globalObject = structure()->globalObject(); - ASSERT(globalObject); + PropertyOffset offset = structure()->get(globalData, globalData.m_inheritorIDKey); + if (isValidOffset(offset)) + return; + + PutPropertySlot slot; + putDirectInternal<PutModeDefineOwnProperty>(globalData, globalData.m_inheritorIDKey, jsUndefined(), DontEnum, slot, 0); + + // Note that this method makes the somewhat odd decision to not check if this + // object currently has indexed accessors. We could do that check here, and if + // indexed accessors were found, we could tell the global object to have a bad + // time. But we avoid this, to allow the following to be always fast: + // + // 1) Create an object. + // 2) Give it a setter or read-only property that happens to have a numeric name. + // 3) Allocate objects that use this object as a prototype. + // + // This avoids anyone having a bad time. Even if the instance objects end up + // having indexed storage, the creation of indexed storage leads to a prototype + // chain walk that detects the presence of indexed setters and then does the + // right thing. As a result, having a bad time only happens if you add an + // indexed setter (or getter, or read-only field) to an object that is already + // used as a prototype. +} - Structure* inheritorID = createEmptyObjectStructure(globalData, globalObject, this); +Structure* JSObject::createInheritorID(JSGlobalData& globalData) +{ + Structure* inheritorID = createEmptyObjectStructure(globalData, unwrappedGlobalObject(), this); ASSERT(inheritorID->isEmpty()); PutPropertySlot slot; @@ -980,7 +1099,10 @@ void JSObject::putIndexedDescriptor(ExecState* exec, SparseArrayEntry* entryInMa // Defined in ES5.1 8.12.9 bool JSObject::defineOwnIndexedProperty(ExecState* exec, unsigned index, PropertyDescriptor& descriptor, bool throwException) { - ASSERT(index != 0xFFFFFFFF); + ASSERT(index <= MAX_ARRAY_INDEX); + + if (descriptor.attributes() & (ReadOnly | Accessor)) + notifyPresenceOfIndexedAccessors(exec->globalData()); if (!inSparseIndexingMode()) { // Fast case: we're putting a regular property to a regular array @@ -1109,6 +1231,40 @@ void JSObject::deallocateSparseIndexMap() arrayStorage->m_sparseMap.clear(); } +bool JSObject::attemptToInterceptPutByIndexOnHoleForPrototype(ExecState* exec, JSValue thisValue, unsigned i, JSValue value, bool shouldThrow) +{ + for (JSObject* current = this; ;) { + // This has the same behavior with respect to prototypes as JSObject::put(). It only + // allows a prototype to intercept a put if (a) the prototype declares the property + // we're after rather than intercepting it via an override of JSObject::put(), and + // (b) that property is declared as ReadOnly or Accessor. + + ArrayStorage* storage = current->arrayStorageOrNull(); + if (storage && storage->m_sparseMap) { + SparseArrayValueMap::iterator iter = storage->m_sparseMap->find(i); + if (iter != storage->m_sparseMap->notFound() && (iter->second.attributes & (Accessor | ReadOnly))) { + iter->second.put(exec, thisValue, storage->m_sparseMap.get(), value, shouldThrow); + return true; + } + } + + JSValue prototypeValue = current->prototype(); + if (prototypeValue.isNull()) + return false; + + current = asObject(prototypeValue); + } +} + +bool JSObject::attemptToInterceptPutByIndexOnHole(ExecState* exec, unsigned i, JSValue value, bool shouldThrow) +{ + JSValue prototypeValue = prototype(); + if (prototypeValue.isNull()) + return false; + + return asObject(prototypeValue)->attemptToInterceptPutByIndexOnHoleForPrototype(exec, this, i, value, shouldThrow); +} + void JSObject::putByIndexBeyondVectorLengthWithArrayStorage(ExecState* exec, unsigned i, JSValue value, bool shouldThrow, ArrayStorage* storage) { JSGlobalData& globalData = exec->globalData(); @@ -1189,8 +1345,7 @@ void JSObject::putByIndexBeyondVectorLength(ExecState* exec, unsigned i, JSValue ASSERT(i <= MAX_ARRAY_INDEX); switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: { + case ALL_BLANK_INDEXING_TYPES: { if (indexingShouldBeSparse()) { putByIndexBeyondVectorLengthWithArrayStorage(exec, i, value, shouldThrow, ensureArrayStorageExistsAndEnterDictionaryIndexingMode(globalData)); break; @@ -1205,6 +1360,12 @@ void JSObject::putByIndexBeyondVectorLength(ExecState* exec, unsigned i, JSValue storage->m_numValuesInVector = 1; break; } + + case NonArrayWithSlowPutArrayStorage: + case ArrayWithSlowPutArrayStorage: + if (attemptToInterceptPutByIndexOnHole(exec, i, value, shouldThrow)) + return; + // Otherwise, fall though. case NonArrayWithArrayStorage: case ArrayWithArrayStorage: @@ -1297,9 +1458,11 @@ bool JSObject::putDirectIndexBeyondVectorLength(ExecState* exec, unsigned i, JSV // i should be a valid array index that is outside of the current vector. ASSERT(i <= MAX_ARRAY_INDEX); + if (attributes & (ReadOnly | Accessor)) + notifyPresenceOfIndexedAccessors(globalData); + switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: { + case ALL_BLANK_INDEXING_TYPES: { if (indexingShouldBeSparse() || attributes) return putDirectIndexBeyondVectorLengthWithArrayStorage(exec, i, value, attributes, mode, ensureArrayStorageExistsAndEnterDictionaryIndexingMode(globalData)); if (!isDenseEnoughForVector(i, 0) || i >= MAX_STORAGE_VECTOR_LENGTH) @@ -1311,8 +1474,7 @@ bool JSObject::putDirectIndexBeyondVectorLength(ExecState* exec, unsigned i, JSV return true; } - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return putDirectIndexBeyondVectorLengthWithArrayStorage(exec, i, value, attributes, mode, arrayStorage()); default: @@ -1354,13 +1516,11 @@ ALWAYS_INLINE unsigned JSObject::getNewVectorLength(unsigned desiredLength) unsigned length; switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: vectorLength = 0; length = 0; break; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: vectorLength = m_butterfly->arrayStorage()->vectorLength(); length = m_butterfly->arrayStorage()->length(); break; @@ -1478,12 +1638,10 @@ bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, Prope return false; switch (object->structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: return false; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = object->m_butterfly->arrayStorage(); if (i >= storage->length()) return false; diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h index 8df521b75..8b52915b6 100644 --- a/Source/JavaScriptCore/runtime/JSObject.h +++ b/Source/JavaScriptCore/runtime/JSObject.h @@ -118,7 +118,18 @@ namespace JSC { bool setPrototypeWithCycleCheck(JSGlobalData&, JSValue prototype); Structure* inheritorID(JSGlobalData&); - + void notifyUsedAsPrototype(JSGlobalData&); + + bool mayBeUsedAsPrototype(JSGlobalData& globalData) + { + return isValidOffset(structure()->get(globalData, globalData.m_inheritorIDKey)); + } + + bool mayInterceptIndexedAccesses() + { + return structure()->mayInterceptIndexedAccesses(); + } + JSValue get(ExecState*, PropertyName) const; JSValue get(ExecState*, unsigned propertyName) const; @@ -135,11 +146,9 @@ namespace JSC { unsigned getArrayLength() const { switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: return 0; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return m_butterfly->arrayStorage()->length(); default: ASSERT_NOT_REACHED(); @@ -150,11 +159,9 @@ namespace JSC { unsigned getVectorLength() { switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: return 0; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return m_butterfly->arrayStorage()->vectorLength(); default: ASSERT_NOT_REACHED(); @@ -189,11 +196,9 @@ namespace JSC { bool canGetIndexQuickly(unsigned i) { switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: return false; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return i < m_butterfly->arrayStorage()->vectorLength() && m_butterfly->arrayStorage()->m_vector[i]; default: ASSERT_NOT_REACHED(); @@ -204,8 +209,7 @@ namespace JSC { JSValue getIndexQuickly(unsigned i) { switch (structure()->indexingType()) { - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return m_butterfly->arrayStorage()->m_vector[i].get(); default: ASSERT_NOT_REACHED(); @@ -216,12 +220,15 @@ namespace JSC { bool canSetIndexQuickly(unsigned i) { switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: return false; case NonArrayWithArrayStorage: case ArrayWithArrayStorage: return i < m_butterfly->arrayStorage()->vectorLength(); + case NonArrayWithSlowPutArrayStorage: + case ArrayWithSlowPutArrayStorage: + return i < m_butterfly->arrayStorage()->vectorLength() + && !!m_butterfly->arrayStorage()->m_vector[i]; default: ASSERT_NOT_REACHED(); return false; @@ -231,8 +238,7 @@ namespace JSC { void setIndexQuickly(JSGlobalData& globalData, unsigned i, JSValue v) { switch (structure()->indexingType()) { - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { WriteBarrier<Unknown>& x = m_butterfly->arrayStorage()->m_vector[i]; if (!x) { ArrayStorage* storage = m_butterfly->arrayStorage(); @@ -251,8 +257,7 @@ namespace JSC { void initializeIndex(JSGlobalData& globalData, unsigned i, JSValue v) { switch (structure()->indexingType()) { - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = m_butterfly->arrayStorage(); #if CHECK_ARRAY_CONSISTENCY ASSERT(storage->m_inCompactInitialization); @@ -276,8 +281,7 @@ namespace JSC { void completeInitialization(unsigned newLength) { switch (structure()->indexingType()) { - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: { + case ALL_ARRAY_STORAGE_INDEXING_TYPES: { ArrayStorage* storage = m_butterfly->arrayStorage(); // Check that we have initialized as meny properties as we think we have. UNUSED_PARAM(storage); @@ -298,11 +302,9 @@ namespace JSC { bool inSparseIndexingMode() { switch (structure()->indexingType()) { - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: return false; - case NonArrayWithArrayStorage: - case ArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return m_butterfly->arrayStorage()->inSparseMode(); default: ASSERT_NOT_REACHED(); @@ -487,6 +489,22 @@ namespace JSC { return structure()->globalObject(); } + // Does everything possible to return the global object. If it encounters an object + // that does not have a global object, it returns 0 instead (for example + // JSNotAnObject). + JSGlobalObject* unwrappedGlobalObject(); + + void switchToSlowPutArrayStorage(JSGlobalData&); + + // The receiver is the prototype in this case. The following: + // + // asObject(foo->structure()->storedPrototype())->attemptToInterceptPutByIndexOnHoleForPrototype(...) + // + // is equivalent to: + // + // foo->attemptToInterceptPutByIndexOnHole(...); + bool attemptToInterceptPutByIndexOnHoleForPrototype(ExecState*, JSValue thisValue, unsigned propertyName, JSValue, bool shouldThrow); + static size_t offsetOfInlineStorage(); static ptrdiff_t butterflyOffset() @@ -522,10 +540,7 @@ namespace JSC { // To create derived types you likely want JSNonFinalObject, below. JSObject(JSGlobalData&, Structure*, Butterfly* = 0); - void resetInheritorID(JSGlobalData& globalData) - { - removeDirect(globalData, globalData.m_inheritorIDKey); - } + void resetInheritorID(JSGlobalData&); void visitButterfly(SlotVisitor&, Butterfly*, size_t storageSize); @@ -533,7 +548,7 @@ namespace JSC { // storage. This will assert otherwise. ArrayStorage* arrayStorage() { - ASSERT(structure()->indexingType() | HasArrayStorage); + ASSERT(hasArrayStorage(structure()->indexingType())); return m_butterfly->arrayStorage(); } @@ -542,8 +557,7 @@ namespace JSC { ArrayStorage* arrayStorageOrNull() { switch (structure()->indexingType()) { - case ArrayWithArrayStorage: - case NonArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return m_butterfly->arrayStorage(); default: @@ -558,12 +572,10 @@ namespace JSC { ArrayStorage* ensureArrayStorage(JSGlobalData& globalData) { switch (structure()->indexingType()) { - case ArrayWithArrayStorage: - case NonArrayWithArrayStorage: + case ALL_ARRAY_STORAGE_INDEXING_TYPES: return m_butterfly->arrayStorage(); - case NonArray: - case ArrayClass: + case ALL_BLANK_INDEXING_TYPES: return createInitialArrayStorage(globalData); default: @@ -592,6 +604,10 @@ namespace JSC { void deallocateSparseIndexMap(); bool defineOwnIndexedProperty(ExecState*, unsigned, PropertyDescriptor&, bool throwException); SparseArrayValueMap* allocateSparseIndexMap(JSGlobalData&); + + void notifyPresenceOfIndexedAccessors(JSGlobalData&); + + bool attemptToInterceptPutByIndexOnHole(ExecState*, unsigned index, JSValue, bool shouldThrow); private: friend class LLIntOffsetsExtractor; @@ -824,22 +840,6 @@ inline JSValue JSObject::prototype() const return structure()->storedPrototype(); } -inline void JSObject::setPrototype(JSGlobalData& globalData, JSValue prototype) -{ - ASSERT(prototype); - setStructure(globalData, Structure::changePrototypeTransition(globalData, structure(), prototype)); -} - -inline Structure* JSObject::inheritorID(JSGlobalData& globalData) -{ - if (WriteBarrierBase<Unknown>* location = getDirectLocation(globalData, globalData.m_inheritorIDKey)) { - Structure* inheritorID = jsCast<Structure*>(location->get()); - ASSERT(inheritorID->isEmpty()); - return inheritorID; - } - return createInheritorID(globalData); -} - inline bool JSCell::inherits(const ClassInfo* info) const { return classInfo()->isSubClassOf(info); @@ -1190,8 +1190,7 @@ inline void JSValue::put(ExecState* exec, PropertyName propertyName, JSValue val inline void JSValue::putByIndex(ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow) { if (UNLIKELY(!isCell())) { - PutPropertySlot slot(shouldThrow); - putToPrimitive(exec, Identifier::from(exec, propertyName), value, slot); + putToPrimitiveByIndex(exec, propertyName, value, shouldThrow); return; } asCell()->methodTable()->putByIndex(asCell(), exec, propertyName, value, shouldThrow); diff --git a/Source/JavaScriptCore/runtime/JSValue.cpp b/Source/JavaScriptCore/runtime/JSValue.cpp index caff9973b..ac00fad3d 100644 --- a/Source/JavaScriptCore/runtime/JSValue.cpp +++ b/Source/JavaScriptCore/runtime/JSValue.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2007, 2008, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -113,6 +113,12 @@ void JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue { JSGlobalData& globalData = exec->globalData(); + unsigned index = propertyName.asIndex(); + if (index != PropertyName::NotAnIndex) { + putToPrimitiveByIndex(exec, index, value, slot.isStrictMode()); + return; + } + // Check if there are any setters or getters in the prototype chain JSObject* obj = synthesizePrototype(exec); JSValue prototype; @@ -172,6 +178,21 @@ void JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue return; } +void JSValue::putToPrimitiveByIndex(ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow) +{ + if (propertyName > MAX_ARRAY_INDEX) { + PutPropertySlot slot(shouldThrow); + putToPrimitive(exec, Identifier::from(exec, propertyName), value, slot); + return; + } + + if (synthesizePrototype(exec)->attemptToInterceptPutByIndexOnHoleForPrototype(exec, *this, propertyName, value, shouldThrow)) + return; + + if (shouldThrow) + throwTypeError(exec, StrictModeReadonlyPropertyWriteError); +} + char* JSValue::description() const { static const size_t size = 128; diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index ce9405817..6e01d8d2d 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -240,6 +240,7 @@ namespace JSC { JSValue get(ExecState*, unsigned propertyName, PropertySlot&) const; void put(ExecState*, PropertyName, JSValue, PutPropertySlot&); void putToPrimitive(ExecState*, PropertyName, JSValue, PutPropertySlot&); + void putToPrimitiveByIndex(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); void putByIndex(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); JSObject* toThisObject(ExecState*) const; diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp index 84c60a69c..b1a5b9fb3 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp @@ -74,6 +74,7 @@ void ObjectPrototype::finishCreation(JSGlobalData& globalData, JSGlobalObject*) { Base::finishCreation(globalData); ASSERT(inherits(&s_info)); + notifyUsedAsPrototype(globalData); } bool ObjectPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) diff --git a/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp b/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp index ed8aace66..04fea60e8 100644 --- a/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp +++ b/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp @@ -27,7 +27,6 @@ #include "RegExpMatchesArray.h" #include "ButterflyInlineMethods.h" -#include "SparseArrayValueMapInlineMethods.h" namespace JSC { diff --git a/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp b/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp index 40c4ed26e..3f709b0a7 100644 --- a/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp +++ b/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp @@ -27,11 +27,186 @@ #include "SparseArrayValueMap.h" #include "ClassInfo.h" -#include "SparseArrayValueMapInlineMethods.h" +#include "GetterSetter.h" +#include "JSObject.h" +#include "PropertySlot.h" +#include "Reject.h" +#include "SlotVisitor.h" +#include "Structure.h" namespace JSC { const ClassInfo SparseArrayValueMap::s_info = { "SparseArrayValueMap", 0, 0, 0, CREATE_METHOD_TABLE(SparseArrayValueMap) }; +SparseArrayValueMap::SparseArrayValueMap(JSGlobalData& globalData) + : Base(globalData, globalData.sparseArrayValueMapStructure.get()) + , m_flags(Normal) + , m_reportedCapacity(0) +{ +} + +SparseArrayValueMap::~SparseArrayValueMap() +{ +} + +void SparseArrayValueMap::finishCreation(JSGlobalData& globalData) +{ + Base::finishCreation(globalData); +} + +SparseArrayValueMap* SparseArrayValueMap::create(JSGlobalData& globalData) +{ + SparseArrayValueMap* result = new (NotNull, allocateCell<SparseArrayValueMap>(globalData.heap)) SparseArrayValueMap(globalData); + result->finishCreation(globalData); + return result; +} + +void SparseArrayValueMap::destroy(JSCell* cell) +{ + static_cast<SparseArrayValueMap*>(cell)->SparseArrayValueMap::~SparseArrayValueMap(); +} + +Structure* SparseArrayValueMap::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) +{ + return Structure::create(globalData, globalObject, prototype, TypeInfo(CompoundType, StructureFlags), &s_info); +} + +SparseArrayValueMap::AddResult SparseArrayValueMap::add(JSObject* array, unsigned i) +{ + SparseArrayEntry entry; + entry.setWithoutWriteBarrier(jsUndefined()); + + AddResult result = m_map.add(i, entry); + size_t capacity = m_map.capacity(); + if (capacity != m_reportedCapacity) { + Heap::heap(array)->reportExtraMemoryCost((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>))); + m_reportedCapacity = capacity; + } + return result; +} + +void SparseArrayValueMap::putEntry(ExecState* exec, JSObject* array, unsigned i, JSValue value, bool shouldThrow) +{ + AddResult result = add(array, i); + SparseArrayEntry& entry = result.iterator->second; + + // To save a separate find & add, we first always add to the sparse map. + // In the uncommon case that this is a new property, and the array is not + // extensible, this is not the right thing to have done - so remove again. + if (result.isNewEntry && !array->isExtensible()) { + remove(result.iterator); + if (shouldThrow) + throwTypeError(exec, StrictModeReadonlyPropertyWriteError); + return; + } + + entry.put(exec, array, this, value, shouldThrow); +} + +bool SparseArrayValueMap::putDirect(ExecState* exec, JSObject* array, unsigned i, JSValue value, unsigned attributes, PutDirectIndexMode mode) +{ + AddResult result = add(array, i); + SparseArrayEntry& entry = result.iterator->second; + + // To save a separate find & add, we first always add to the sparse map. + // In the uncommon case that this is a new property, and the array is not + // extensible, this is not the right thing to have done - so remove again. + if (mode != PutDirectIndexLikePutDirect && result.isNewEntry && !array->isExtensible()) { + remove(result.iterator); + return reject(exec, mode == PutDirectIndexShouldThrow, "Attempting to define property on object that is not extensible."); + } + + entry.attributes = attributes; + entry.set(exec->globalData(), this, value); + return true; +} + +void SparseArrayEntry::get(PropertySlot& slot) const +{ + JSValue value = Base::get(); + ASSERT(value); + + if (LIKELY(!value.isGetterSetter())) { + slot.setValue(value); + return; + } + + JSObject* getter = asGetterSetter(value)->getter(); + if (!getter) { + slot.setUndefined(); + return; + } + + slot.setGetterSlot(getter); +} + +void SparseArrayEntry::get(PropertyDescriptor& descriptor) const +{ + descriptor.setDescriptor(Base::get(), attributes); +} + +JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const +{ + JSValue result = Base::get(); + ASSERT(result); + + if (LIKELY(!result.isGetterSetter())) + return result; + + JSObject* getter = asGetterSetter(result)->getter(); + if (!getter) + return jsUndefined(); + + CallData callData; + CallType callType = getter->methodTable()->getCallData(getter, callData); + return call(exec, getter, callType, callData, array, exec->emptyList()); +} + +void SparseArrayEntry::put(ExecState* exec, JSValue thisValue, SparseArrayValueMap* map, JSValue value, bool shouldThrow) +{ + if (!(attributes & Accessor)) { + if (attributes & ReadOnly) { + if (shouldThrow) + throwTypeError(exec, StrictModeReadonlyPropertyWriteError); + return; + } + + set(exec->globalData(), map, value); + return; + } + + JSValue accessor = Base::get(); + ASSERT(accessor.isGetterSetter()); + JSObject* setter = asGetterSetter(accessor)->setter(); + + if (!setter) { + if (shouldThrow) + throwTypeError(exec, StrictModeReadonlyPropertyWriteError); + return; + } + + CallData callData; + CallType callType = setter->methodTable()->getCallData(setter, callData); + MarkedArgumentBuffer args; + args.append(value); + call(exec, setter, callType, callData, thisValue, args); +} + +JSValue SparseArrayEntry::getNonSparseMode() const +{ + ASSERT(!attributes); + return Base::get(); +} + +void SparseArrayValueMap::visitChildren(JSCell* thisObject, SlotVisitor& visitor) +{ + Base::visitChildren(thisObject, visitor); + + SparseArrayValueMap* thisMap = jsCast<SparseArrayValueMap*>(thisObject); + iterator end = thisMap->m_map.end(); + for (iterator it = thisMap->m_map.begin(); it != end; ++it) + visitor.append(&it->second); +} + } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/SparseArrayValueMap.h b/Source/JavaScriptCore/runtime/SparseArrayValueMap.h index aafdf974f..5d8d0577a 100644 --- a/Source/JavaScriptCore/runtime/SparseArrayValueMap.h +++ b/Source/JavaScriptCore/runtime/SparseArrayValueMap.h @@ -36,6 +36,8 @@ namespace JSC { +class SparseArrayValueMap; + struct SparseArrayEntry : public WriteBarrier<Unknown> { typedef WriteBarrier<Unknown> Base; @@ -44,6 +46,7 @@ struct SparseArrayEntry : public WriteBarrier<Unknown> { JSValue get(ExecState*, JSObject*) const; void get(PropertySlot&) const; void get(PropertyDescriptor&) const; + void put(ExecState*, JSValue thisValue, SparseArrayValueMap*, JSValue, bool shouldThrow); JSValue getNonSparseMode() const; unsigned attributes; diff --git a/Source/JavaScriptCore/runtime/SparseArrayValueMapInlineMethods.h b/Source/JavaScriptCore/runtime/SparseArrayValueMapInlineMethods.h deleted file mode 100644 index f3ef32f46..000000000 --- a/Source/JavaScriptCore/runtime/SparseArrayValueMapInlineMethods.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are 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 SparseArrayValueMapInlineMethods_h -#define SparseArrayValueMapInlineMethods_h - -#include "GetterSetter.h" -#include "Reject.h" -#include "SparseArrayValueMap.h" - -namespace JSC { - -inline SparseArrayValueMap::SparseArrayValueMap(JSGlobalData& globalData) - : Base(globalData, globalData.sparseArrayValueMapStructure.get()) - , m_flags(Normal) - , m_reportedCapacity(0) -{ -} - -inline SparseArrayValueMap::~SparseArrayValueMap() -{ -} - -inline void SparseArrayValueMap::finishCreation(JSGlobalData& globalData) -{ - Base::finishCreation(globalData); -} - -inline SparseArrayValueMap* SparseArrayValueMap::create(JSGlobalData& globalData) -{ - SparseArrayValueMap* result = new (NotNull, allocateCell<SparseArrayValueMap>(globalData.heap)) SparseArrayValueMap(globalData); - result->finishCreation(globalData); - return result; -} - -inline void SparseArrayValueMap::destroy(JSCell* cell) -{ - static_cast<SparseArrayValueMap*>(cell)->SparseArrayValueMap::~SparseArrayValueMap(); -} - -inline Structure* SparseArrayValueMap::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) -{ - return Structure::create(globalData, globalObject, prototype, TypeInfo(CompoundType, StructureFlags), &s_info); -} - -inline SparseArrayValueMap::AddResult SparseArrayValueMap::add(JSObject* array, unsigned i) -{ - SparseArrayEntry entry; - entry.setWithoutWriteBarrier(jsUndefined()); - - AddResult result = m_map.add(i, entry); - size_t capacity = m_map.capacity(); - if (capacity != m_reportedCapacity) { - Heap::heap(array)->reportExtraMemoryCost((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>))); - m_reportedCapacity = capacity; - } - return result; -} - -inline void SparseArrayValueMap::putEntry(ExecState* exec, JSObject* array, unsigned i, JSValue value, bool shouldThrow) -{ - AddResult result = add(array, i); - SparseArrayEntry& entry = result.iterator->second; - - // To save a separate find & add, we first always add to the sparse map. - // In the uncommon case that this is a new property, and the array is not - // extensible, this is not the right thing to have done - so remove again. - if (result.isNewEntry && !array->isExtensible()) { - remove(result.iterator); - if (shouldThrow) - throwTypeError(exec, StrictModeReadonlyPropertyWriteError); - return; - } - - if (!(entry.attributes & Accessor)) { - if (entry.attributes & ReadOnly) { - if (shouldThrow) - throwTypeError(exec, StrictModeReadonlyPropertyWriteError); - return; - } - - entry.set(exec->globalData(), this, value); - return; - } - - JSValue accessor = entry.SparseArrayEntry::Base::get(); - ASSERT(accessor.isGetterSetter()); - JSObject* setter = asGetterSetter(accessor)->setter(); - - if (!setter) { - if (shouldThrow) - throwTypeError(exec, StrictModeReadonlyPropertyWriteError); - return; - } - - CallData callData; - CallType callType = setter->methodTable()->getCallData(setter, callData); - MarkedArgumentBuffer args; - args.append(value); - call(exec, setter, callType, callData, array, args); -} - -inline bool SparseArrayValueMap::putDirect(ExecState* exec, JSObject* array, unsigned i, JSValue value, unsigned attributes, PutDirectIndexMode mode) -{ - AddResult result = add(array, i); - SparseArrayEntry& entry = result.iterator->second; - - // To save a separate find & add, we first always add to the sparse map. - // In the uncommon case that this is a new property, and the array is not - // extensible, this is not the right thing to have done - so remove again. - if (mode != PutDirectIndexLikePutDirect && result.isNewEntry && !array->isExtensible()) { - remove(result.iterator); - return reject(exec, mode == PutDirectIndexShouldThrow, "Attempting to define property on object that is not extensible."); - } - - entry.attributes = attributes; - entry.set(exec->globalData(), this, value); - return true; -} - -inline void SparseArrayEntry::get(PropertySlot& slot) const -{ - JSValue value = Base::get(); - ASSERT(value); - - if (LIKELY(!value.isGetterSetter())) { - slot.setValue(value); - return; - } - - JSObject* getter = asGetterSetter(value)->getter(); - if (!getter) { - slot.setUndefined(); - return; - } - - slot.setGetterSlot(getter); -} - -inline void SparseArrayEntry::get(PropertyDescriptor& descriptor) const -{ - descriptor.setDescriptor(Base::get(), attributes); -} - -inline JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const -{ - JSValue result = Base::get(); - ASSERT(result); - - if (LIKELY(!result.isGetterSetter())) - return result; - - JSObject* getter = asGetterSetter(result)->getter(); - if (!getter) - return jsUndefined(); - - CallData callData; - CallType callType = getter->methodTable()->getCallData(getter, callData); - return call(exec, getter, callType, callData, array, exec->emptyList()); -} - -inline JSValue SparseArrayEntry::getNonSparseMode() const -{ - ASSERT(!attributes); - return Base::get(); -} - -inline void SparseArrayValueMap::visitChildren(JSCell* thisObject, SlotVisitor& visitor) -{ - Base::visitChildren(thisObject, visitor); - - SparseArrayValueMap* thisMap = jsCast<SparseArrayValueMap*>(thisObject); - iterator end = thisMap->m_map.end(); - for (iterator it = thisMap->m_map.begin(); it != end; ++it) - visitor.append(&it->second); -} - -} // namespace JSC - -#endif // SparseArrayValueMapInlineMethods_h - diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp index c99c6dda4..a59a0860d 100644 --- a/Source/JavaScriptCore/runtime/Structure.cpp +++ b/Source/JavaScriptCore/runtime/Structure.cpp @@ -309,6 +309,30 @@ Structure* Structure::addPropertyTransitionToExistingStructure(Structure* struct return 0; } +bool Structure::anyObjectInChainMayInterceptIndexedAccesses() const +{ + for (const Structure* current = this; ;) { + if (current->mayInterceptIndexedAccesses()) + return true; + + JSValue prototype = current->storedPrototype(); + if (prototype.isNull()) + return false; + + current = asObject(prototype)->structure(); + } +} + +NonPropertyTransition Structure::suggestedIndexingTransition() const +{ + ASSERT(!hasIndexedProperties(indexingType())); + + if (anyObjectInChainMayInterceptIndexedAccesses() || globalObject()->isHavingABadTime()) + return AllocateSlowPutArrayStorage; + + return AllocateArrayStorage; +} + Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, unsigned attributes, JSCell* specificValue, PropertyOffset& offset) { // If we have a specific function, we may have got to this point if there is diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index 9303a0dbb..e77287b20 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -144,7 +144,16 @@ namespace JSC { IndexingType indexingType() const { return m_indexingType & AllArrayTypes; } IndexingType indexingTypeIncludingHistory() const { return m_indexingType; } - + + bool mayInterceptIndexedAccesses() const + { + return !!(indexingTypeIncludingHistory() & MayHaveIndexedAccessors); + } + + bool anyObjectInChainMayInterceptIndexedAccesses() const; + + NonPropertyTransition suggestedIndexingTransition() const; + JSGlobalObject* globalObject() const { return m_globalObject.get(); } void setGlobalObject(JSGlobalData& globalData, JSGlobalObject* globalObject) { m_globalObject.set(globalData, this, globalObject); } diff --git a/Source/JavaScriptCore/runtime/StructureTransitionTable.h b/Source/JavaScriptCore/runtime/StructureTransitionTable.h index 59e7e94f3..90cb6a4db 100644 --- a/Source/JavaScriptCore/runtime/StructureTransitionTable.h +++ b/Source/JavaScriptCore/runtime/StructureTransitionTable.h @@ -43,7 +43,10 @@ static const unsigned FirstInternalAttribute = 1 << 6; // Use for transitions th // Support for attributes used to indicate transitions not related to properties. // If any of these are used, the string portion of the key should be 0. enum NonPropertyTransition { - AllocateArrayStorage + AllocateArrayStorage, + AllocateSlowPutArrayStorage, + SwitchToSlowPutArrayStorage, + AddIndexedAccessors }; inline unsigned toAttributes(NonPropertyTransition transition) @@ -56,6 +59,13 @@ inline IndexingType newIndexingType(IndexingType oldType, NonPropertyTransition switch (transition) { case AllocateArrayStorage: return oldType | HasArrayStorage; + case AllocateSlowPutArrayStorage: + return oldType | HasSlowPutArrayStorage; + case SwitchToSlowPutArrayStorage: + ASSERT(oldType & HasArrayStorage); + return (oldType & ~HasArrayStorage) | HasSlowPutArrayStorage; + case AddIndexedAccessors: + return oldType | MayHaveIndexedAccessors; default: ASSERT_NOT_REACHED(); return oldType; diff --git a/Source/JavaScriptCore/runtime/SymbolTable.h b/Source/JavaScriptCore/runtime/SymbolTable.h index f6f70c6b9..5427a009b 100644 --- a/Source/JavaScriptCore/runtime/SymbolTable.h +++ b/Source/JavaScriptCore/runtime/SymbolTable.h @@ -40,6 +40,23 @@ namespace JSC { class Watchpoint; class WatchpointSet; + struct SlowArgument { + enum Status { + Normal = 0, + Captured = 1, + Deleted = 2 + }; + + SlowArgument() + : status(Normal) + , indexIfCaptured(0) + { + } + + Status status; + int indexIfCaptured; // If status is 'Captured', indexIfCaptured is our index in the CallFrame. + }; + static ALWAYS_INLINE int missingSymbolMarker() { return std::numeric_limits<int>::max(); } // The bit twiddling in this class assumes that every register index is a @@ -357,9 +374,14 @@ namespace JSC { int captureEnd() { return m_captureEnd; } void setCaptureEnd(int captureEnd) { m_captureEnd = captureEnd; } + int parameterCount() { return m_parameterCountIncludingThis - 1; } int parameterCountIncludingThis() { return m_parameterCountIncludingThis; } void setParameterCountIncludingThis(int parameterCountIncludingThis) { m_parameterCountIncludingThis = parameterCountIncludingThis; } + // 0 if we don't capture any arguments; parameterCount() in length if we do. + const SlowArgument* slowArguments() { return m_slowArguments.get(); } + void setSlowArguments(PassOwnArrayPtr<SlowArgument> slowArguments) { m_slowArguments = slowArguments; } + static JS_EXPORTDATA const ClassInfo s_info; private: @@ -379,8 +401,9 @@ namespace JSC { CaptureMode m_captureMode; int m_captureStart; int m_captureEnd; + + OwnArrayPtr<SlowArgument> m_slowArguments; }; - } // namespace JSC #endif // SymbolTable_h diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index 240d932cf..bedc71772 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,78 @@ +2012-09-17 Brian Anderson <brianderson@chromium.org> + + [chromium] Add rendering commit statistics + https://bugs.webkit.org/show_bug.cgi?id=96938 + + Reviewed by James Robinson. + + Adds total commit time and total commit count to WebRenderingStats. + Allows us to caculate average commit time in performance tests. + + * chromium/public/WebRenderingStats.h: + (WebRenderingStats): + (WebKit::WebRenderingStats::WebRenderingStats): + (WebKit::WebRenderingStats::enumerateFields): + +2012-09-17 Antoine Labour <piman@chromium.org> + + [chromium] Add onSendFrameToParentCompositorAck to WebCompositorOutputSurfaceClient + https://bugs.webkit.org/show_bug.cgi?id=96850 + + Reviewed by James Robinson. + + Hook for the WebCompositorOutputSurface::sendFrameToParent ack. + Also changes WebCompositorFrame from a class to a struct. + + * chromium/public/WebCompositorOutputSurface.h: + (WebKit): + * chromium/public/WebCompositorOutputSurfaceClient.h: + (WebKit): + (WebCompositorOutputSurfaceClient): + +2012-09-17 Alexandre Elias <aelias@chromium.org> + + [chromium] WebCompositorOutputSurface software API + https://bugs.webkit.org/show_bug.cgi?id=96851 + + Reviewed by James Robinson. + + This adds a software-based output option to + WebCompositorOutputSurface, for use with the new software compositor. + If returns a "tear-off" which provides a WebImage object that can be + written to or read. + + * Platform.gypi: + * chromium/public/WebCompositorOutputSurface.h: + (WebKit): + (WebCompositorOutputSurface): + (WebKit::WebCompositorOutputSurface::surfaceSoftware): + * chromium/public/WebCompositorOutputSurfaceSoftware.h: Added. + (WebKit): + (WebCompositorOutputSurfaceSoftware): + (WebKit::WebCompositorOutputSurfaceSoftware::~WebCompositorOutputSurfaceSoftware): + +2012-09-14 Dana Jansens <danakj@chromium.org> + + [chromium] Add the ubercomp WebDelegatedRendererLayer + https://bugs.webkit.org/show_bug.cgi?id=94145 + + Reviewed by Adrienne Walker. + + Expose a WebDelegatedRendererLayer to allow the browser compositor to + embed such a layer in its tree. This layer will be connected to IPC + machinery in the compositor that is yet TBD which will give a set of + RenderPasses with DrawQuads to the impl copy of the layer. + + * Platform.gypi: + * chromium/public/WebCompositorSupport.h: + (WebKit): + (WebKit::WebCompositorSupport::createDelegatedRendererLayer): + (WebCompositorSupport): + * chromium/public/WebDelegatedRendererLayer.h: Added. + (WebKit): + (WebDelegatedRendererLayer): + (WebKit::WebDelegatedRendererLayer::~WebDelegatedRendererLayer): + 2012-09-11 Zach Kuznia <zork@chromium.org> Fix FilterTypeZoom to properly call canvas->restore() diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi index 950d15c59..a6c24571a 100644 --- a/Source/Platform/Platform.gypi +++ b/Source/Platform/Platform.gypi @@ -46,6 +46,7 @@ 'chromium/public/WebCommon.h', 'chromium/public/WebCompositor.h', 'chromium/public/WebCompositorSupport.h', + 'chromium/public/WebCompositorSoftwareOutputDevice.h', 'chromium/public/WebCompositorOutputSurface.h', 'chromium/public/WebCompositorOutputSurfaceClient.h', 'chromium/public/WebContentLayer.h', @@ -53,6 +54,7 @@ 'chromium/public/WebCookie.h', 'chromium/public/WebCookieJar.h', 'chromium/public/WebData.h', + 'chromium/public/WebDelegatedRendererLayer.h', 'chromium/public/WebDragData.h', 'chromium/public/WebExternalTextureLayer.h', 'chromium/public/WebExternalTextureLayerClient.h', diff --git a/Source/Platform/chromium/public/WebCompositorOutputSurface.h b/Source/Platform/chromium/public/WebCompositorOutputSurface.h index e93d8b4f0..ed0138a03 100644 --- a/Source/Platform/chromium/public/WebCompositorOutputSurface.h +++ b/Source/Platform/chromium/public/WebCompositorOutputSurface.h @@ -28,8 +28,9 @@ namespace WebKit { -class WebCompositorFrame; +struct WebCompositorFrame; class WebGraphicsContext3D; +class WebCompositorSoftwareOutputDevice; class WebCompositorOutputSurfaceClient; // Represents the output surface for a compositor. The compositor owns @@ -59,14 +60,14 @@ public: virtual const Capabilities& capabilities() const = 0; - // Obtains the context associated with this output surface. In the event of a lost context, the - // entire output surface should be recreated. + // Obtain the 3d context or the software device associated with this output surface. Either of these may return a null pointer, but not both. + // In the event of a lost context, the entire output surface should be recreated. virtual WebGraphicsContext3D* context3D() const = 0; + virtual WebCompositorSoftwareOutputDevice* softwareDevice() const { return 0; } // Sends frame data to the parent compositor. This should only be called // when capabilities().hasParentCompositor. virtual void sendFrameToParentCompositor(const WebCompositorFrame&) = 0; - }; } diff --git a/Source/Platform/chromium/public/WebCompositorOutputSurfaceClient.h b/Source/Platform/chromium/public/WebCompositorOutputSurfaceClient.h index 8e38fcfe7..fc78c5892 100644 --- a/Source/Platform/chromium/public/WebCompositorOutputSurfaceClient.h +++ b/Source/Platform/chromium/public/WebCompositorOutputSurfaceClient.h @@ -28,9 +28,12 @@ namespace WebKit { +struct WebCompositorFrameAck; + class WebCompositorOutputSurfaceClient { public: virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0; + virtual void onSendFrameToParentCompositorAck(const WebCompositorFrameAck&) { } protected: ~WebCompositorOutputSurfaceClient() { } diff --git a/Source/Platform/chromium/public/WebCompositorSoftwareOutputDevice.h b/Source/Platform/chromium/public/WebCompositorSoftwareOutputDevice.h new file mode 100644 index 000000000..68e011fa8 --- /dev/null +++ b/Source/Platform/chromium/public/WebCompositorSoftwareOutputDevice.h @@ -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. + */ + +#ifndef WebCompositorSoftwareOutputDevice_h +#define WebCompositorSoftwareOutputDevice_h + +namespace WebKit { + +class WebImage; +class WebSize; + +// This is a "tear-off" class providing software drawing support to +// WebCompositorOutputSurface, such as to a platform-provided window +// framebuffer. +class WebCompositorSoftwareOutputDevice { +public: + virtual ~WebCompositorSoftwareOutputDevice() { } + + // Lock the framebuffer and return a pointer to a WebImage referring to its + // pixels. Set forWrite if you intend to change the pixels. Readback + // is supported whether or not forWrite is set. + virtual WebImage* lock(bool forWrite) = 0; + virtual void unlock() = 0; + + virtual void didChangeViewportSize(WebSize) = 0; +}; + +} + +#endif diff --git a/Source/Platform/chromium/public/WebCompositorSupport.h b/Source/Platform/chromium/public/WebCompositorSupport.h index 9088ba9b4..d1439a7a1 100644 --- a/Source/Platform/chromium/public/WebCompositorSupport.h +++ b/Source/Platform/chromium/public/WebCompositorSupport.h @@ -36,6 +36,7 @@ namespace WebKit { class WebAnimationCurve; class WebContentLayer; class WebContentLayerClient; +class WebDelegatedRendererLayer; class WebExternalTextureLayer; class WebExternalTextureLayerClient; class WebFloatAnimationCurve; @@ -81,6 +82,8 @@ public: virtual WebContentLayer* createContentLayer(WebContentLayerClient*) { return 0; } + virtual WebDelegatedRendererLayer* createDelegatedRendererLayer() { return 0; } + virtual WebExternalTextureLayer* createExternalTextureLayer(WebExternalTextureLayerClient* = 0) { return 0; } virtual WebIOSurfaceLayer* createIOSurfaceLayer() { return 0; } diff --git a/Source/Platform/chromium/public/WebDelegatedRendererLayer.h b/Source/Platform/chromium/public/WebDelegatedRendererLayer.h new file mode 100644 index 000000000..473980c2c --- /dev/null +++ b/Source/Platform/chromium/public/WebDelegatedRendererLayer.h @@ -0,0 +1,47 @@ +/* + * 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 WebDelegatedRendererLayer_h +#define WebDelegatedRendererLayer_h + +#include "WebCommon.h" + +namespace WebKit { + +// This class represents a layer that renders the output of another +// delegating compositor. It is created and owned by the embedder, who +// provides the layer with a set of RenderPasses generated by the +// compositor that the layer represents. This layer's output becomes the +// same RenderPasses it received from the embedder. +class WebDelegatedRendererLayer { +public: + virtual ~WebDelegatedRendererLayer() { } + + virtual WebLayer* layer() = 0; +}; + +} // namespace WebKit + +#endif // WebDelegatedRendererLayer_h diff --git a/Source/Platform/chromium/public/WebRenderingStats.h b/Source/Platform/chromium/public/WebRenderingStats.h index 7b2f6410b..abd10a0a9 100644 --- a/Source/Platform/chromium/public/WebRenderingStats.h +++ b/Source/Platform/chromium/public/WebRenderingStats.h @@ -34,6 +34,8 @@ struct WebRenderingStats { int droppedFrameCount; double totalPaintTimeInSeconds; double totalRasterizeTimeInSeconds; + double totalCommitTimeInSeconds; + size_t totalCommitCount; WebRenderingStats() : numAnimationFrames(0) @@ -41,6 +43,8 @@ struct WebRenderingStats { , droppedFrameCount(0) , totalPaintTimeInSeconds(0) , totalRasterizeTimeInSeconds(0) + , totalCommitTimeInSeconds(0) + , totalCommitCount(0) { } @@ -64,6 +68,8 @@ struct WebRenderingStats { enumerator->addInt("droppedFrameCount", droppedFrameCount); enumerator->addDouble("totalPaintTimeInSeconds", totalPaintTimeInSeconds); enumerator->addDouble("totalRasterizeTimeInSeconds", totalRasterizeTimeInSeconds); + enumerator->addDouble("totalCommitTimeInSeconds", totalCommitTimeInSeconds); + enumerator->addInt("totalCommitCount", totalCommitCount); } }; diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 1f6af6bb0..0836c8e5c 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,266 @@ +2012-09-17 Glenn Adams <glenn@skynav.com> + + Including HexNumber.h fails build if hexDigitsForMode is not referenced + https://bugs.webkit.org/show_bug.cgi?id=96873 + + Reviewed by Benjamin Poulain. + + Ensure release build is possible when hexDigitsForMode is not referenced by + template expansion. + + * wtf/HexNumber.h: + (WTF::Internal::hexDigitsForMode): + Change hexDigitsForMode to inline (rather than static). Make string literals + {lower,upper}HexDigits non-local and non-static, but const, to which the linker + should merge references in the RO data segment. + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + The ThreadRescrictionVerifier should be more forcibly disabled on systems that use threads + https://bugs.webkit.org/show_bug.cgi?id=96957 + + Reviewed by Oliver Hunt. + + * wtf/ThreadRestrictionVerifier.h: + (WTF): + (WTF::ThreadRestrictionVerifier::ThreadRestrictionVerifier): + (ThreadRestrictionVerifier): + (WTF::ThreadRestrictionVerifier::setMutexMode): + (WTF::ThreadRestrictionVerifier::setDispatchQueueMode): + (WTF::ThreadRestrictionVerifier::turnOffVerification): + (WTF::ThreadRestrictionVerifier::setShared): + (WTF::ThreadRestrictionVerifier::isSafeToUse): + +2012-09-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r128796. + http://trac.webkit.org/changeset/128796 + https://bugs.webkit.org/show_bug.cgi?id=96966 + + It broke everything (Requested by Ossy_NIGHT on #webkit). + + * wtf/OSAllocatorPosix.cpp: + (WTF::OSAllocator::reserveUncommitted): + (WTF::OSAllocator::reserveAndCommit): + (WTF::OSAllocator::commit): + (WTF::OSAllocator::decommit): + +2012-09-17 Uli Schlachter <psychon@znc.in> + + Implement uncommitted memory for Linux. + https://bugs.webkit.org/show_bug.cgi?id=65766 + + Reviewed by Gavin Barraclough. + + The old approach used MAP_NORESERVE to allocate address space without + committing it. However, that flag gets ignored if + /proc/sys/vm/overcommit_memory is set to 2. The new approach uses a + mapping with PROT_NONE. This works because mappings which aren't even + readable don't get accounted as committed on Linux. + + * wtf/OSAllocatorPosix.cpp: + (WTF::OSAllocator::reserveUncommitted): + (WTF::OSAllocator::reserveAndCommit): + (WTF::OSAllocator::commit): + (WTF::OSAllocator::decommit): + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + Array profiling has convergence issues + https://bugs.webkit.org/show_bug.cgi?id=96891 + + Reviewed by Gavin Barraclough. + + Added functions for testing if something is a power of 2. + + * wtf/MathExtras.h: + (hasZeroOrOneBitsSet): + (hasTwoOrMoreBitsSet): + +2012-09-17 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: now when we can detect instrumented classes we can + remove addInstrumentedMember and use addMember for everything. + https://bugs.webkit.org/show_bug.cgi?id=96913 + + Reviewed by Yury Semikhatsky. + + * wtf/MemoryInstrumentation.h: + (WTF::MemoryInstrumentation::addRootObject): + (WTF::MemoryInstrumentation::addObject): + (WTF::MemoryInstrumentation::addObjectImpl): + (WTF): + (WTF::MemoryInstrumentation::addInstrumentedCollection): + (WTF::MemoryInstrumentation::addInstrumentedMapEntries): + (WTF::MemoryInstrumentation::addInstrumentedMapValues): + * wtf/text/AtomicString.cpp: + (WTF::AtomicString::reportMemoryUsage): + * wtf/text/CString.h: + (WTF::CString::reportMemoryUsage): + * wtf/text/StringImpl.cpp: + (WTF::StringImpl::reportMemoryUsage): + * wtf/text/WTFString.cpp: + (WTF::String::reportMemoryUsage): + * wtf/url/api/ParsedURL.cpp: + (WTF::ParsedURL::reportMemoryUsage): + * wtf/url/api/URLString.cpp: + (WTF::URLString::reportMemoryUsage): + +2012-09-17 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed compilation fix. + + * wtf/MemoryInstrumentation.h: + (WTF::MemoryInstrumentation::reportObjectMemoryUsage): + +2012-09-15 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: automatically detect if class has reportMemoryUsage method + https://bugs.webkit.org/show_bug.cgi?id=96756 + + Reviewed by Alexander Pavlov. + + Implemeted automatic selector of the memory reporting method. If + an object has reportMemoryUsage method then call it. Otherwise + count only object's self size. As the next step we will delete + addInstrumentedMember and addInstrumentedObjectImpl and will + have only addMember and addObjectImpl that would automatically + call reportMemoryUsage if it is present. + + * wtf/MemoryInstrumentation.h: + (WTF::MemoryInstrumentation::selectInstrumentationMethod): + (MemoryInstrumentation): + (WTF::MemoryInstrumentation::reportObjectMemoryUsage): + (WTF::MemoryInstrumentation::addInstrumentedObjectImpl): + (WTF::MemoryInstrumentation::addObjectImpl): + (WTF::::process): + +2012-09-14 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: OwnPtr and RefPtr reported by pointer can be double counted by the memory instrumentation + https://bugs.webkit.org/show_bug.cgi?id=96791 + + Reviewed by Alexander Pavlov. + + * wtf/MemoryInstrumentation.h: + (WTF::MemoryInstrumentation::addObjectImpl): check if the smart pointer has already + been visited before counting its size. + +2012-09-15 Benjamin Poulain <benjamin@webkit.org> + + Fix the build with WTF URL + https://bugs.webkit.org/show_bug.cgi?id=96875 + + Reviewed by Adam Barth. + + Add support for MemoryInstrumentation to WTF's URL classes. + + * wtf/url/api/ParsedURL.cpp: + (WTF::ParsedURL::reportMemoryUsage): + * wtf/url/api/ParsedURL.h: + (ParsedURL): + * wtf/url/api/URLString.cpp: + (WTF::URLString::reportMemoryUsage): + * wtf/url/api/URLString.h: + (URLString): + +2012-09-15 Raphael Kubo da Costa <rakuco@FreeBSD.org> + + llint: Implement LOCAL_LABEL_STRING for the BSD platforms. + https://bugs.webkit.org/show_bug.cgi?id=96870 + + Reviewed by Filip Pizlo. + + * wtf/InlineASM.h: Extend the definition of LOCAL_LABEL_STRING + currently used for OS(LINUX) to the BSDs, since they also normally + use GNU as, and clang/llvm seems to parse that syntax just fine as + well. + +2012-09-14 Alexey Proskuryakov <ap@apple.com> + + Minimize collisions when hashing pairs + https://bugs.webkit.org/show_bug.cgi?id=96022 + + Build fix (with newer clang?) + + * wtf/HashFunctions.h: (WTF::pairIntHash): Be explicit about casting from + 64 bit to 32 bit. + +2012-09-14 Dana Jansens <danakj@chromium.org> + + Minimize collisions when hashing pairs + https://bugs.webkit.org/show_bug.cgi?id=96022 + + Reviewed by Adrienne Walker. + + The current hash function for pairs has poor performance as it does a + nice hash function on 64 bits, but then just drops the top 32 bits. The + hash method for pairs tries to use Thomas Wang's 64 bit Mix Function, + but this requires not dropping any bits in order to retain the + characteristics mentioned by Thomas. + + A better method of hashing sets of 32-bit integers is to use + multiplication in 64 bits with random integers. This method is a + provably almost-universal hash function. Testing shows that this + method decreases the time required, when compared with the current + method, by more than 20% due to better hashing characteristics. + + * wtf/HashFunctions.h: + (WTF): + (WTF::pairIntHash): + Implments the hashing method for a pair of unsigned integers. + + (WTF::PairHash::hash): + Use pairIntHash() on the hash results of each object in the pair. + + (WTF::IntPairHash::hash): + Implement an integer-specific PairHash class that does not need to + hash each object in the pair. It uses pairIntHash on the two + integers in the pair directly. + + (WTF::IntPairHash::equal): + (IntPairHash): + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Make force_static_libs_as_shared work on Mac OS + + We had to move a few LIBS += around that were in the wrong place, + and not caught when everything was just linked into the final + QtWebKit library. + + Reviewed by Simon Hausmann. + + * WTF.pri: + +2012-09-14 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: convert template versions of String*::reportMemoryUsage functions to normal functions. + https://bugs.webkit.org/show_bug.cgi?id=96759 + + Reviewed by Yury Semikhatsky. + + Now when MemoryInstrumentation.h is a part of WTF we can move reportMemoryUsage functions to cpp file. + + * wtf/text/AtomicString.cpp: + (WTF::AtomicString::reportMemoryUsage): + (WTF): + * wtf/text/AtomicString.h: + (WTF): + (AtomicString): + * wtf/text/StringImpl.cpp: + (WTF::StringImpl::reportMemoryUsage): + (WTF): + * wtf/text/StringImpl.h: + (WTF): + (StringImpl): + * wtf/text/WTFString.cpp: + (WTF::String::reportMemoryUsage): + (WTF): + * wtf/text/WTFString.h: + (WTF): + (String): + 2012-09-14 Ilya Tikhonovsky <loislo@chromium.org> Web Inspector: NMI: remove current traits helper class because it is customizing the instrumentation at a wrong place and is not necessary at the moment. diff --git a/Source/WTF/WTF.pri b/Source/WTF/WTF.pri index bcfb491a4..f836f3ce4 100644 --- a/Source/WTF/WTF.pri +++ b/Source/WTF/WTF.pri @@ -36,3 +36,7 @@ qnx { # required for timegm LIBS += -lnbutil } + +mac { + LIBS += -framework AppKit +} diff --git a/Source/WTF/wtf/HashFunctions.h b/Source/WTF/wtf/HashFunctions.h index 808b2b1e5..eb1b2f0cc 100644 --- a/Source/WTF/wtf/HashFunctions.h +++ b/Source/WTF/wtf/HashFunctions.h @@ -86,6 +86,18 @@ namespace WTF { return static_cast<unsigned>(key); } + // Compound integer hash method: http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000 + inline unsigned pairIntHash(unsigned key1, unsigned key2) + { + unsigned shortRandom1 = 277951225; // A random 32-bit value. + unsigned shortRandom2 = 95187966; // A random 32-bit value. + uint64_t longRandom = 19248658165952622LL; // A random 64-bit value. + + uint64_t product = longRandom * (shortRandom1 * key1 + shortRandom2 * key2); + unsigned highBits = static_cast<unsigned>(product >> (sizeof(uint64_t) - sizeof(unsigned))); + return highBits; + } + template<typename T> struct IntHash { static unsigned hash(T key) { return intHash(static_cast<typename IntTypes<sizeof(T)>::UnsignedType>(key)); } static bool equal(T a, T b) { return a == b; } @@ -139,7 +151,7 @@ namespace WTF { template<typename T, typename U> struct PairHash { static unsigned hash(const std::pair<T, U>& p) { - return intHash((static_cast<uint64_t>(DefaultHash<T>::Hash::hash(p.first)) << 32 | DefaultHash<U>::Hash::hash(p.second))); + return pairIntHash(DefaultHash<T>::Hash::hash(p.first), DefaultHash<U>::Hash::hash(p.second)); } static bool equal(const std::pair<T, U>& a, const std::pair<T, U>& b) { @@ -149,6 +161,12 @@ namespace WTF { && DefaultHash<U>::Hash::safeToCompareToEmptyOrDeleted; }; + template<typename T, typename U> struct IntPairHash { + static unsigned hash(const std::pair<T, U>& p) { return pairIntHash(p.first, p.second); } + static bool equal(const std::pair<T, U>& a, const std::pair<T, U>& b) { return PairHash<T, T>::equal(a, b); } + static const bool safeToCompareToEmptyOrDeleted = PairHash<T, U>::safeToCompareToEmptyOrDeleted; + }; + // make IntHash the default hash function for many integer types template<> struct DefaultHash<short> { typedef IntHash<unsigned> Hash; }; @@ -172,6 +190,27 @@ namespace WTF { template<typename P> struct DefaultHash<P*> { typedef PtrHash<P*> Hash; }; template<typename P> struct DefaultHash<RefPtr<P> > { typedef PtrHash<RefPtr<P> > Hash; }; + // make IntPairHash the default hash function for pairs of (at most) 32-bit integers. + + template<> struct DefaultHash<std::pair<short, short> > { typedef IntPairHash<short, short> Hash; }; + template<> struct DefaultHash<std::pair<short, unsigned short> > { typedef IntPairHash<short, unsigned short> Hash; }; + template<> struct DefaultHash<std::pair<short, int> > { typedef IntPairHash<short, int> Hash; }; + template<> struct DefaultHash<std::pair<short, unsigned> > { typedef IntPairHash<short, unsigned> Hash; }; + template<> struct DefaultHash<std::pair<unsigned short, short> > { typedef IntPairHash<unsigned short, short> Hash; }; + template<> struct DefaultHash<std::pair<unsigned short, unsigned short> > { typedef IntPairHash<unsigned short, unsigned short> Hash; }; + template<> struct DefaultHash<std::pair<unsigned short, int> > { typedef IntPairHash<unsigned short, int> Hash; }; + template<> struct DefaultHash<std::pair<unsigned short, unsigned> > { typedef IntPairHash<unsigned short, unsigned> Hash; }; + template<> struct DefaultHash<std::pair<int, short> > { typedef IntPairHash<int, short> Hash; }; + template<> struct DefaultHash<std::pair<int, unsigned short> > { typedef IntPairHash<int, unsigned short> Hash; }; + template<> struct DefaultHash<std::pair<int, int> > { typedef IntPairHash<int, int> Hash; }; + template<> struct DefaultHash<std::pair<int, unsigned> > { typedef IntPairHash<unsigned, unsigned> Hash; }; + template<> struct DefaultHash<std::pair<unsigned, short> > { typedef IntPairHash<unsigned, short> Hash; }; + template<> struct DefaultHash<std::pair<unsigned, unsigned short> > { typedef IntPairHash<unsigned, unsigned short> Hash; }; + template<> struct DefaultHash<std::pair<unsigned, int> > { typedef IntPairHash<unsigned, int> Hash; }; + template<> struct DefaultHash<std::pair<unsigned, unsigned> > { typedef IntPairHash<unsigned, unsigned> Hash; }; + + // make PairHash the default hash function for pairs of arbitrary values. + template<typename T, typename U> struct DefaultHash<std::pair<T, U> > { typedef PairHash<T, U> Hash; }; } // namespace WTF diff --git a/Source/WTF/wtf/HexNumber.h b/Source/WTF/wtf/HexNumber.h index 8fd60323b..a198b92cd 100644 --- a/Source/WTF/wtf/HexNumber.h +++ b/Source/WTF/wtf/HexNumber.h @@ -31,10 +31,10 @@ enum HexConversionMode { namespace Internal { -static const char* hexDigitsForMode(HexConversionMode mode) +const char lowerHexDigits[17] = "0123456789abcdef"; +const char upperHexDigits[17] = "0123456789ABCDEF"; +inline const char* hexDigitsForMode(HexConversionMode mode) { - static const char lowerHexDigits[17] = "0123456789abcdef"; - static const char upperHexDigits[17] = "0123456789ABCDEF"; return mode == Lowercase ? lowerHexDigits : upperHexDigits; } diff --git a/Source/WTF/wtf/InlineASM.h b/Source/WTF/wtf/InlineASM.h index 9d7541623..ad96eea45 100644 --- a/Source/WTF/wtf/InlineASM.h +++ b/Source/WTF/wtf/InlineASM.h @@ -79,7 +79,11 @@ // Don't know about any of the others. #if PLATFORM(MAC) #define LOCAL_LABEL_STRING(name) "L" #name -#elif OS(LINUX) +#elif OS(LINUX) \ + || OS(FREEBSD) \ + || OS(OPENBSD) \ + || OS(NETBSD) + // GNU as-compatible syntax. #define LOCAL_LABEL_STRING(name) ".L" #name #endif diff --git a/Source/WTF/wtf/MathExtras.h b/Source/WTF/wtf/MathExtras.h index d8fd6883e..1a3ec48d5 100644 --- a/Source/WTF/wtf/MathExtras.h +++ b/Source/WTF/wtf/MathExtras.h @@ -294,6 +294,16 @@ inline bool isWithinIntRange(float x) return x > static_cast<float>(std::numeric_limits<int>::min()) && x < static_cast<float>(std::numeric_limits<int>::max()); } +template<typename T> inline bool hasZeroOrOneBitsSet(T value) +{ + return !((value - 1) & value); +} + +template<typename T> inline bool hasTwoOrMoreBitsSet(T value) +{ + return !hasZeroOrOneBitsSet(value); +} + #if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(SOLARIS) using std::isfinite; #if !COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN) diff --git a/Source/WTF/wtf/MemoryInstrumentation.h b/Source/WTF/wtf/MemoryInstrumentation.h index 04ca8d20e..131af8497 100644 --- a/Source/WTF/wtf/MemoryInstrumentation.h +++ b/Source/WTF/wtf/MemoryInstrumentation.h @@ -48,13 +48,46 @@ enum MemoryOwningType { byReference }; +class MemoryObjectInfo { +public: + MemoryObjectInfo(MemoryInstrumentation* memoryInstrumentation, MemoryObjectType ownerObjectType) + : m_memoryInstrumentation(memoryInstrumentation) + , m_objectType(ownerObjectType) + , m_objectSize(0) + { } + + typedef MemoryClassInfo ClassInfo; + + MemoryObjectType objectType() const { return m_objectType; } + size_t objectSize() const { return m_objectSize; } + + MemoryInstrumentation* memoryInstrumentation() { return m_memoryInstrumentation; } + +private: + friend class MemoryClassInfo; + friend class MemoryInstrumentation; + + template<typename T> void reportObjectInfo(MemoryObjectType objectType, size_t actualSize) + { + if (!m_objectSize) { + m_objectSize = actualSize ? actualSize : sizeof(T); + if (objectType) + m_objectType = objectType; + } + } + + MemoryInstrumentation* m_memoryInstrumentation; + MemoryObjectType m_objectType; + size_t m_objectSize; +}; + class MemoryInstrumentation { public: virtual ~MemoryInstrumentation() { } template <typename T> void addRootObject(const T& t) { - addInstrumentedObject(t, 0); + addObject(t, 0); processDeferredInstrumentedPointers(); } @@ -75,6 +108,29 @@ private: friend class MemoryClassInfo; + template<typename T> static void selectInstrumentationMethod(const T* const& object, MemoryObjectInfo* memoryObjectInfo) + { + // If there is reportMemoryUsage method on the object, call it. + // Otherwise count only object's self size. + reportObjectMemoryUsage<T, void (T::*)(MemoryObjectInfo*) const>(object, memoryObjectInfo, 0); + } + + template<typename Type, Type Ptr> struct MemberHelperStruct; + template<typename T, typename Type> + static void reportObjectMemoryUsage(const T* const& object, MemoryObjectInfo* memoryObjectInfo, MemberHelperStruct<Type, &T::reportMemoryUsage>*) + { + object->reportMemoryUsage(memoryObjectInfo); + } + + template<typename T, typename Type> + static void reportObjectMemoryUsage(const T* const&, MemoryObjectInfo* memoryObjectInfo, ...) + { + memoryObjectInfo->reportObjectInfo<T>(0, sizeof(T)); + } + + template<typename T> + static void countNotInstrumentedObject(const T* const&, MemoryObjectInfo*); + template<typename T> class InstrumentedPointer : public InstrumentedPointerBase { public: explicit InstrumentedPointer(const T* pointer, MemoryObjectType ownerObjectType) : m_pointer(pointer), m_ownerObjectType(ownerObjectType) { } @@ -85,12 +141,7 @@ private: const MemoryObjectType m_ownerObjectType; }; - template<typename T> void addObject(const T& t, MemoryObjectType ownerObjectType) - { - OwningTraits<T>::addObject(this, t, ownerObjectType); - } - - template<typename T> void addInstrumentedObject(const T& t, MemoryObjectType ownerObjectType) { OwningTraits<T>::addInstrumentedObject(this, t, ownerObjectType); } + template<typename T> void addObject(const T& t, MemoryObjectType ownerObjectType) { OwningTraits<T>::addObject(this, t, ownerObjectType); } template<typename HashMapType> void addHashMap(const HashMapType&, MemoryObjectType, bool contentOnly = false); template<typename HashSetType> void addHashSet(const HashSetType&, MemoryObjectType, bool contentOnly = false); template<typename CollectionType> void addInstrumentedCollection(const CollectionType&, MemoryObjectType, bool contentOnly = false); @@ -107,10 +158,6 @@ private: template<typename T> struct OwningTraits { // Default byReference implementation. - static void addInstrumentedObject(MemoryInstrumentation* instrumentation, const T& t, MemoryObjectType ownerObjectType) - { - instrumentation->addInstrumentedObjectImpl(&t, ownerObjectType, byReference); - } static void addObject(MemoryInstrumentation* instrumentation, const T& t, MemoryObjectType ownerObjectType) { instrumentation->addObjectImpl(&t, ownerObjectType, byReference); @@ -119,57 +166,17 @@ private: template<typename T> struct OwningTraits<T*> { // Custom byPointer implementation. - static void addInstrumentedObject(MemoryInstrumentation* instrumentation, const T* const& t, MemoryObjectType ownerObjectType) - { - instrumentation->addInstrumentedObjectImpl(t, ownerObjectType, byPointer); - } static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, MemoryObjectType ownerObjectType) { instrumentation->addObjectImpl(t, ownerObjectType, byPointer); } }; - template<typename T> void addInstrumentedObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType); - template<typename T> void addInstrumentedObjectImpl(const OwnPtr<T>* const&, MemoryObjectType, MemoryOwningType); - template<typename T> void addInstrumentedObjectImpl(const RefPtr<T>* const&, MemoryObjectType, MemoryOwningType); - template<typename T> void addObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType); template<typename T> void addObjectImpl(const OwnPtr<T>* const&, MemoryObjectType, MemoryOwningType); template<typename T> void addObjectImpl(const RefPtr<T>* const&, MemoryObjectType, MemoryOwningType); }; -class MemoryObjectInfo { -public: - MemoryObjectInfo(MemoryInstrumentation* memoryInstrumentation, MemoryObjectType ownerObjectType) - : m_memoryInstrumentation(memoryInstrumentation) - , m_objectType(ownerObjectType) - , m_objectSize(0) - { } - - typedef MemoryClassInfo ClassInfo; - - MemoryObjectType objectType() const { return m_objectType; } - size_t objectSize() const { return m_objectSize; } - - MemoryInstrumentation* memoryInstrumentation() { return m_memoryInstrumentation; } - -private: - friend class MemoryClassInfo; - - template<typename T> void reportObjectInfo(MemoryObjectType objectType, size_t actualSize) - { - if (!m_objectSize) { - m_objectSize = actualSize ? actualSize : sizeof(T); - if (objectType) - m_objectType = objectType; - } - } - - MemoryInstrumentation* m_memoryInstrumentation; - MemoryObjectType m_objectType; - size_t m_objectSize; -}; - class MemoryClassInfo { public: template<typename T> @@ -181,7 +188,6 @@ public: m_objectType = memoryObjectInfo->objectType(); } - template<typename M> void addInstrumentedMember(const M& member) { m_memoryInstrumentation->addInstrumentedObject(member, m_objectType); } template<typename M> void addMember(const M& member) { m_memoryInstrumentation->addObject(member, m_objectType); } template<typename HashMapType> void addHashMap(const HashMapType& map) { m_memoryInstrumentation->addHashMap(map, m_objectType, true); } @@ -207,11 +213,11 @@ private: }; template<typename T> -void MemoryInstrumentation::addInstrumentedObjectImpl(const T* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType) +void MemoryInstrumentation::addObjectImpl(const T* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType) { if (owningType == byReference) { MemoryObjectInfo memoryObjectInfo(this, ownerObjectType); - object->reportMemoryUsage(&memoryObjectInfo); + selectInstrumentationMethod<T>(object, &memoryObjectInfo); } else { if (!object || visited(object)) return; @@ -220,25 +226,9 @@ void MemoryInstrumentation::addInstrumentedObjectImpl(const T* const& object, Me } template<typename T> -void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType) -{ - if (owningType == byPointer) - countObjectSize(ownerObjectType, sizeof(*object)); - addInstrumentedObjectImpl(object->get(), ownerObjectType, byPointer); -} - -template<typename T> -void MemoryInstrumentation::addInstrumentedObjectImpl(const RefPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType) -{ - if (owningType == byPointer) - countObjectSize(ownerObjectType, sizeof(*object)); - addInstrumentedObjectImpl(object->get(), ownerObjectType, byPointer); -} - -template<typename T> void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType) { - if (owningType == byPointer) + if (owningType == byPointer && !visited(object)) countObjectSize(ownerObjectType, sizeof(*object)); addObjectImpl(object->get(), ownerObjectType, byPointer); } @@ -246,21 +236,11 @@ void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, Memory template<typename T> void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType) { - if (owningType == byPointer) + if (owningType == byPointer && !visited(object)) countObjectSize(ownerObjectType, sizeof(*object)); addObjectImpl(object->get(), ownerObjectType, byPointer); } -template<typename T> -void MemoryInstrumentation::addObjectImpl(const T* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType) -{ - if (!object || visited(object)) - return; - if (owningType == byReference) - return; - countObjectSize(ownerObjectType, sizeof(T)); -} - template<typename HashMapType> void MemoryInstrumentation::addHashMap(const HashMapType& hashMap, MemoryObjectType ownerObjectType, bool contentOnly) { @@ -285,7 +265,7 @@ void MemoryInstrumentation::addInstrumentedCollection(const CollectionType& coll countObjectSize(ownerObjectType, calculateContainerSize(collection, contentOnly)); typename CollectionType::const_iterator end = collection.end(); for (typename CollectionType::const_iterator i = collection.begin(); i != end; ++i) - addInstrumentedObject(*i, ownerObjectType); + addObject(*i, ownerObjectType); } template<typename MapType> @@ -293,8 +273,8 @@ void MemoryInstrumentation::addInstrumentedMapEntries(const MapType& map, Memory { typename MapType::const_iterator end = map.end(); for (typename MapType::const_iterator i = map.begin(); i != end; ++i) { - addInstrumentedObject(i->first, ownerObjectType); - addInstrumentedObject(i->second, ownerObjectType); + addObject(i->first, ownerObjectType); + addObject(i->second, ownerObjectType); } } @@ -303,7 +283,7 @@ void MemoryInstrumentation::addInstrumentedMapValues(const MapType& map, MemoryO { typename MapType::const_iterator end = map.end(); for (typename MapType::const_iterator i = map.begin(); i != end; ++i) - addInstrumentedObject(i->second, ownerObjectType); + addObject(i->second, ownerObjectType); } template<typename ListHashSetType> @@ -333,7 +313,7 @@ template<typename T> void MemoryInstrumentation::InstrumentedPointer<T>::process(MemoryInstrumentation* memoryInstrumentation) { MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType); - m_pointer->reportMemoryUsage(&memoryObjectInfo); + selectInstrumentationMethod<T>(m_pointer, &memoryObjectInfo); memoryInstrumentation->countObjectSize(memoryObjectInfo.objectType(), memoryObjectInfo.objectSize()); } diff --git a/Source/WTF/wtf/ThreadRestrictionVerifier.h b/Source/WTF/wtf/ThreadRestrictionVerifier.h index 58bfbc410..cff49d318 100644 --- a/Source/WTF/wtf/ThreadRestrictionVerifier.h +++ b/Source/WTF/wtf/ThreadRestrictionVerifier.h @@ -47,14 +47,11 @@ namespace WTF { // The default mode is to verify that the object will only be used on a single thread. The // thread gets captured when setShared(true) is called. // The mode may be changed by calling useMutexMode (or turnOffVerification). +#if !USE(JSC) // This verifier is completely wrong for JavaScript implementations that use threads class ThreadRestrictionVerifier { public: ThreadRestrictionVerifier() -#if USE(JSC) - : m_mode(NoVerificationMode) -#else : m_mode(SingleThreadVerificationMode) -#endif , m_shared(false) , m_owningThread(0) , m_mutex(0) @@ -172,6 +169,39 @@ private: dispatch_queue_t m_owningQueue; #endif }; +#else // !USE(JSC) => so the JSC case +class ThreadRestrictionVerifier { +public: + ThreadRestrictionVerifier() + { + } + + void setMutexMode(Mutex&) + { + } + +#if HAVE(DISPATCH_H) + void setDispatchQueueMode(dispatch_queue_t) + { + } +#endif + + void turnOffVerification() + { + } + + // Indicates that the object may (or may not) be owned by more than one place. + void setShared(bool) + { + } + + // Is it OK to use the object at this moment on the current thread? + bool isSafeToUse() const + { + return true; + } +}; +#endif } diff --git a/Source/WTF/wtf/text/AtomicString.cpp b/Source/WTF/wtf/text/AtomicString.cpp index cbb5a20ee..b91c60e80 100644 --- a/Source/WTF/wtf/text/AtomicString.cpp +++ b/Source/WTF/wtf/text/AtomicString.cpp @@ -26,6 +26,7 @@ #include "StringHash.h" #include <wtf/HashSet.h> +#include <wtf/MemoryInstrumentation.h> #include <wtf/Threading.h> #include <wtf/WTFThreadData.h> #include <wtf/unicode/UTF8.h> @@ -435,4 +436,10 @@ void AtomicString::show() const } #endif +void AtomicString::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this); + info.addMember(m_string); +} + } // namespace WTF diff --git a/Source/WTF/wtf/text/AtomicString.h b/Source/WTF/wtf/text/AtomicString.h index 01b84da65..066b0726b 100644 --- a/Source/WTF/wtf/text/AtomicString.h +++ b/Source/WTF/wtf/text/AtomicString.h @@ -35,6 +35,7 @@ namespace WTF { struct AtomicStringHash; +class MemoryObjectInfo; class AtomicString { public: @@ -158,12 +159,7 @@ public: void show() const; #endif - template<typename MemoryObjectInfo> - void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const - { - typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this); - info.addInstrumentedMember(m_string); - } + WTF_EXPORT_STRING_API void reportMemoryUsage(MemoryObjectInfo*) const; private: // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals. diff --git a/Source/WTF/wtf/text/CString.h b/Source/WTF/wtf/text/CString.h index d442af782..03ab3e54a 100644 --- a/Source/WTF/wtf/text/CString.h +++ b/Source/WTF/wtf/text/CString.h @@ -85,7 +85,7 @@ public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this); - info.addInstrumentedMember(m_buffer); + info.addMember(m_buffer); } private: diff --git a/Source/WTF/wtf/text/StringImpl.cpp b/Source/WTF/wtf/text/StringImpl.cpp index a29263218..c06a966e7 100644 --- a/Source/WTF/wtf/text/StringImpl.cpp +++ b/Source/WTF/wtf/text/StringImpl.cpp @@ -28,6 +28,7 @@ #include "AtomicString.h" #include "StringBuffer.h" #include "StringHash.h" +#include <wtf/MemoryInstrumentation.h> #include <wtf/StdLibExtras.h> #include <wtf/WTFThreadData.h> #include <wtf/unicode/CharacterNames.h> @@ -1791,4 +1792,24 @@ size_t StringImpl::sizeInBytes() const return size + sizeof(*this); } +void StringImpl::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + size_t selfSize = sizeof(StringImpl); + + // Count size used by internal buffer but skip strings that were constructed from literals. + if ((m_hashAndFlags & BufferInternal) && !hasTerminatingNullCharacter()) + // Three cases are covered here: + // 1) a normal 8-bit string with internal storage (BufferInternal) + // 2) a normal 16-bit string with internal storage (BufferInternal) + // 3) empty unique string with length = 0 (BufferInternal) + selfSize += m_length * (m_hashAndFlags & s_hashFlag8BitBuffer ? sizeof(LChar) : sizeof(UChar)); + + MemoryClassInfo info(memoryObjectInfo, this, 0, selfSize); + + if (m_hashAndFlags & BufferSubstring) + info.addMember(m_substringBuffer); + else if (m_hashAndFlags & s_hashFlagHas16BitShadow) // Substring never has its own shadow. + info.addRawBuffer(m_copyData16, (m_length + (hasTerminatingNullCharacter() ? 1 : 0)) * sizeof(UChar)); +} + } // namespace WTF diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h index a18f694be..00c6285d2 100644 --- a/Source/WTF/wtf/text/StringImpl.h +++ b/Source/WTF/wtf/text/StringImpl.h @@ -60,6 +60,7 @@ template<typename CharacterType> struct HashAndCharactersTranslator; struct HashAndUTF8CharactersTranslator; struct LCharBufferTranslator; struct CharBufferFromLiteralDataTranslator; +class MemoryObjectInfo; struct SubstringTranslator; struct UCharBufferTranslator; @@ -715,26 +716,7 @@ public: ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; } #endif - template<typename MemoryObjectInfo> - void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const - { - size_t selfSize = sizeof(StringImpl); - - // Count size used by internal buffer but skip strings that were constructed from literals. - if ((m_hashAndFlags & BufferInternal) && !hasTerminatingNullCharacter()) - // Three cases are covered here: - // 1) a normal 8-bit string with internal storage (BufferInternal) - // 2) a normal 16-bit string with internal storage (BufferInternal) - // 3) empty unique string with length = 0 (BufferInternal) - selfSize += m_length * (m_hashAndFlags & s_hashFlag8BitBuffer ? sizeof(LChar) : sizeof(UChar)); - - typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this, 0, selfSize); - - if (m_hashAndFlags & BufferSubstring) - info.addInstrumentedMember(m_substringBuffer); - else if (m_hashAndFlags & s_hashFlagHas16BitShadow) // Substring never has its own shadow. - info.addRawBuffer(m_copyData16, (m_length + (hasTerminatingNullCharacter() ? 1 : 0)) * sizeof(UChar)); - } + WTF_EXPORT_STRING_API void reportMemoryUsage(MemoryObjectInfo*) const; private: // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. diff --git a/Source/WTF/wtf/text/WTFString.cpp b/Source/WTF/wtf/text/WTFString.cpp index 6f14bcf56..b89acb663 100644 --- a/Source/WTF/wtf/text/WTFString.cpp +++ b/Source/WTF/wtf/text/WTFString.cpp @@ -27,6 +27,7 @@ #include <wtf/ASCIICType.h> #include <wtf/DataLog.h> #include <wtf/MathExtras.h> +#include <wtf/MemoryInstrumentation.h> #include <wtf/text/CString.h> #include <wtf/StringExtras.h> #include <wtf/Vector.h> @@ -820,6 +821,12 @@ String String::fromUTF8WithLatin1Fallback(const LChar* string, size_t size) return utf8; } +void String::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this); + info.addMember(m_impl); +} + // String Operations static bool isCharacterAllowedInBase(UChar c, int base) diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h index b7bd96c17..e3e13b5d8 100644 --- a/Source/WTF/wtf/text/WTFString.h +++ b/Source/WTF/wtf/text/WTFString.h @@ -58,6 +58,7 @@ namespace WebKit { namespace WTF { class CString; +class MemoryObjectInfo; struct StringHash; // Declarations of string operations @@ -455,12 +456,7 @@ public: return (*m_impl)[index]; } - template<typename MemoryObjectInfo> - void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const - { - typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this); - info.addInstrumentedMember(m_impl); - } + WTF_EXPORT_STRING_API void reportMemoryUsage(MemoryObjectInfo*) const; private: RefPtr<StringImpl> m_impl; diff --git a/Source/WTF/wtf/url/api/ParsedURL.cpp b/Source/WTF/wtf/url/api/ParsedURL.cpp index 8a29d5650..0b15fcbca 100644 --- a/Source/WTF/wtf/url/api/ParsedURL.cpp +++ b/Source/WTF/wtf/url/api/ParsedURL.cpp @@ -30,6 +30,7 @@ #if USE(WTFURL) #include <wtf/DataLog.h> +#include <wtf/MemoryInstrumentation.h> #include <wtf/RawURLBuffer.h> #include <wtf/URLComponent.h> #include <wtf/URLParser.h> @@ -174,6 +175,12 @@ String ParsedURL::segment(const URLComponent& component) const return segment; } +void ParsedURL::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this); + info.addMember(m_spec); +} + #ifndef NDEBUG #define SHOW_COMPONENT(parsedURL, componentName) \ diff --git a/Source/WTF/wtf/url/api/ParsedURL.h b/Source/WTF/wtf/url/api/ParsedURL.h index 0c4971bb1..0603cf116 100644 --- a/Source/WTF/wtf/url/api/ParsedURL.h +++ b/Source/WTF/wtf/url/api/ParsedURL.h @@ -64,6 +64,8 @@ public: const URLString& spec() { return m_spec; } + WTF_EXPORT_PRIVATE void reportMemoryUsage(MemoryObjectInfo*) const; + #ifndef NDEBUG WTF_EXPORT_PRIVATE void print() const; #endif diff --git a/Source/WTF/wtf/url/api/URLString.cpp b/Source/WTF/wtf/url/api/URLString.cpp index 9147fe399..cf46a3092 100644 --- a/Source/WTF/wtf/url/api/URLString.cpp +++ b/Source/WTF/wtf/url/api/URLString.cpp @@ -26,10 +26,18 @@ #include "config.h" #include "URLString.h" +#include <wtf/MemoryInstrumentation.h> + #if USE(WTFURL) namespace WTF { +void URLString::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this); + info.addMember(m_string); +} + #ifndef NDEBUG void URLString::print() const { diff --git a/Source/WTF/wtf/url/api/URLString.h b/Source/WTF/wtf/url/api/URLString.h index 70ef21910..0078930db 100644 --- a/Source/WTF/wtf/url/api/URLString.h +++ b/Source/WTF/wtf/url/api/URLString.h @@ -40,6 +40,8 @@ public: const String& string() const { return m_string;} + void reportMemoryUsage(MemoryObjectInfo*) const; + #ifndef NDEBUG WTF_EXPORT_PRIVATE void print() const; #endif diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 928123c29..f74ba2d28 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1685,6 +1685,7 @@ SET(WebCore_SOURCES page/DragController.cpp page/EventHandler.cpp page/EventSource.cpp + page/FeatureObserver.cpp page/FocusController.cpp page/Frame.cpp page/FrameActionScheduler.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index ab238de9f..b5036afcf 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,2667 @@ +2012-09-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] min-device-width failures in media tests + https://bugs.webkit.org/show_bug.cgi?id=96920 + + Reviewed by Kenneth Rohde Christiansen. + + Return a realistic value (800x600) for screen resolution if + it cannot be detected, instead of returning (0x0). + + This allows for some tests to pass on the build bots + where X is not running. + + No new tests, already covered by existing tests. + + * platform/efl/PlatformScreenEfl.cpp: + (WebCore::screenRect): + +2012-09-18 Simon Hausmann <simon.hausmann@digia.com> + + Fix compilation with Qt 5 on MeeGo 1.2 Harmattan + https://bugs.webkit.org/show_bug.cgi?id=96937 + + Reviewed by Jocelyn Turcotte. + + The gl2ext.h header file on the platform is outdated. Instead use the newer copy from Qt + through implicit inclusion of qopengl.h. Since Qt's declarations are based on newer Khronos + headers, the multi sampling extensions do have the PROC suffix, we need the same workaround + as QNX. + + * platform/graphics/opengl/Extensions3DOpenGLES.h: + +2012-09-14 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: [Extensions API] explicitly manage extension audit progress + https://bugs.webkit.org/show_bug.cgi?id=96803 + + Reviewed by Alexander Pavlov. + + - create a sub-progress per audit category; + - manage audit category progress within the category, not in the panel logic; + - consider audit is done when all categories are done; + - expose AuditResults.updateProgress(worked, totalWork) in the extensions API; + - retain old magic for computing audit progress if extension specifies extension results count. + + * inspector/front-end/AuditsPanel.js: + (WebInspector.AuditsPanel.prototype._executeAudit.ruleResultReadyCallback): + (WebInspector.AuditsPanel.prototype._executeAudit): + (WebInspector.AuditCategory.prototype.run.callbackWrapper): + (WebInspector.AuditCategory.prototype.run): + * inspector/front-end/ExtensionAPI.js: + (defineCommonExtensionSymbols): + (injectedExtensionAPI.Audits.prototype.addCategory): + (injectedExtensionAPI.AuditResultImpl.prototype.updateProgress): + * inspector/front-end/ExtensionAuditCategory.js: + (WebInspector.ExtensionAuditCategory.prototype.run): + (WebInspector.ExtensionAuditCategoryResults): + (WebInspector.ExtensionAuditCategoryResults.prototype.done): + (WebInspector.ExtensionAuditCategoryResults.prototype._addResult): + (WebInspector.ExtensionAuditCategoryResults.prototype.updateProgress): + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer): + (WebInspector.ExtensionServer.prototype._onUpdateAuditProgress): + (WebInspector.ExtensionServer.prototype._onStopAuditCategoryRun): + * inspector/front-end/ProgressBar.js: + (WebInspector.ProgressIndicator.prototype.done): Assure only first call to done() has effect. + +2012-09-19 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Revert r127457 and following fixes due to several hit-testing regressions + https://bugs.webkit.org/show_bug.cgi?id=96830 + + Reviewed by Antonio Gomes. + + The revert misssed one related follow-up. + + * dom/Document.cpp: + (WebCore::Document::updateHoverActiveState): + + +2012-09-18 Mihnea Ovidenie <mihnea@adobe.com> + + [CSSRegions]Flag auto-height regions + https://bugs.webkit.org/show_bug.cgi?id=96267 + + Reviewed by Julien Chaffraix. + + The regions having auto logical height should be flagged so that their height will computed as part of a 2 pass-layout mechanism. + A valid region is flagged as having auto logical height if: + - has auto logical height and is part of the normal flow + - has auto logical height, is not part of normal flow and does not have logical top/bottom specified + + An invalid region (part of circular dependency) will not be marked even if its style matches the above situations. + + Test: fast/regions/autoheight-regions-mark.html + + * rendering/FlowThreadController.cpp: Keep a counter of auto logical height valid regions. + (WebCore::FlowThreadController::FlowThreadController): + (WebCore::FlowThreadController::layoutRenderNamedFlowThreads): Verify that the current number of auto logical height regions is correct by iterating over all the regions attached to the flow threads + and compute the number of auto logical height regions on the spot. + (WebCore): + (WebCore::FlowThreadController::isAutoLogicalHeightRegionsFlagConsistent): Helper function that is used to verify the number of auto logical height regions. + * rendering/FlowThreadController.h: + (WebCore::FlowThreadController::hasAutoLogicalHeightRegions): + (WebCore::FlowThreadController::incrementAutoLogicalHeightRegions): + (WebCore::FlowThreadController::decrementAutoLogicalHeightRegions): + (FlowThreadController): + * rendering/RenderFlowThread.cpp: + (WebCore): + (WebCore::RenderFlowThread::autoLogicalHeightRegionsCount): Helper function that is used to count the number of regions marked as having auto logical height. + * rendering/RenderFlowThread.h: + * rendering/RenderRegion.cpp: + (WebCore::RenderRegion::RenderRegion): + (WebCore::RenderRegion::updateRegionHasAutoLogicalHeightFlag): + (WebCore): + (WebCore::RenderRegion::styleDidChange): For a region that is attached to a flow thread, verify whether the style change modified its auto logical height appearance. + (WebCore::RenderRegion::attachRegion): Handle the case of attaching region to a flow thread and the detach/attach sequence when the region is moved in the render tree. + (WebCore::RenderRegion::detachRegion): + * rendering/RenderRegion.h: + (WebCore::RenderRegion::shouldHaveAutoLogicalHeight): + (WebCore::RenderRegion::hasAutoLogicalHeight): + (RenderRegion): + * rendering/RenderTreeAsText.cpp: For the regions that use auto logical height, modify the output to reflect that. + (WebCore::writeRenderNamedFlowThreads): + +2012-09-18 Shinya Kawanaka <shinyak@chromium.org> + + Disable adding an AuthorShadowRoot to replaced elements. + https://bugs.webkit.org/show_bug.cgi?id=96978 + + Reviewed by Hajime Morita. + + We (people who implement Shadow DOM) have concluded that we don't support adding AuthorShadowRoot to + replaced elements in the current spec, since it turned out that a lot of difficulties exist and it brings + a lot of mess to our codebase. + + For now, we just disable adding AuthorShadowRoot to these replaced elements. + + Test: fast/dom/shadow/shadow-disable.html + + * html/HTMLImageElement.h: + * html/HTMLKeygenElement.h: + * html/HTMLMeterElement.h: + * html/HTMLProgressElement.h: + * html/HTMLTextAreaElement.h: + +2012-09-17 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed, rolling out r128826 and r128813. + + * ForwardingHeaders/runtime/JSDestructibleObject.h: Removed. + * bindings/js/JSDOMWrapper.h: + (WebCore::JSDOMWrapper::JSDOMWrapper): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + * bridge/objc/objc_runtime.h: + (ObjcFallbackObjectImp): + * bridge/objc/objc_runtime.mm: + (Bindings): + (JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp): + * bridge/runtime_array.cpp: + (JSC): + (JSC::RuntimeArray::destroy): + * bridge/runtime_array.h: + (JSC::RuntimeArray::create): + * bridge/runtime_object.cpp: + (Bindings): + (JSC::Bindings::RuntimeObject::RuntimeObject): + * bridge/runtime_object.h: + (RuntimeObject): + +2012-09-17 Kent Tamura <tkent@chromium.org> + + Export RuntimeEnabledFeatures::isLangAttributeAwareFormControlUIEnabled correctly + https://bugs.webkit.org/show_bug.cgi?id=96855 + + Reviewed by Hajime Morita. + + * bindings/generic/RuntimeEnabledFeatures.h: + (RuntimeEnabledFeatures): Add WEBCORE_TESTING. + * testing/InternalSettings.cpp: Remove a workaround. + (WebCore::InternalSettings::Backup::Backup): + (WebCore::InternalSettings::Backup::restoreTo): + (WebCore::InternalSettings::setLangAttributeAwareFormControlUIEnabled): + * testing/InternalSettings.h: ditto. + +2012-09-17 Vivek Galatage <vivekgalatage@gmail.com> + + [Gtk] Remove the unused variable warning in GamepadsGtk.cpp using ASSERT_UNUSED macro + https://bugs.webkit.org/show_bug.cgi?id=96975 + + Reviewed by Kentaro Hara. + + Replacing a simple ASSERT with ASSERT_UNUSED to avoid the warning. + + No new tests as refactoring done. + + * platform/gtk/GamepadsGtk.cpp: + (WebCore::GamepadDeviceGtk::readCallback): + +2012-09-17 Roger Fong <roger_fong@apple.com> + + [Win] Null check timing function received from CoreAnimation when calling CACFAnimationGetTimingFunction. + https://bugs.webkit.org/show_bug.cgi?id=96972 + + Reviewed by Timothy Horton + + When paused, some CSS animations cause CoreAnimation to pass back a null timing function when calling CACFAnimationGetTimingFunction. + This patch fixes this simply by ensuring that if the output of this method is null, it does not get passed into CACFAnimationSetTimingFunction + via the PlatformCAAnimation::copyTimingFunctionFrom method. + + * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: + (PlatformCAAnimation::copyTimingFunctionFrom): + +2012-09-17 David Barton <dbarton@mathscribe.com> + + Convert MathML to use flexboxes + https://bugs.webkit.org/show_bug.cgi?id=96843 + + Reviewed by Eric Seidel. + + Using the CSS Flexible Box Model simplifies MathML in many ways. Control over alignment, row vs. + column layout, and child layout order are all much easier. Complexities involving floats, + continuations, and most anonymous boxes are eliminated, as are their potential for crashes and + security vulnerabilities. + + In a flexbox, column alignment is done with align-items or align-self, instead of text-align. + vertical-align and baselinePosition() are replaced by the firstLineBoxBaseline() virtual + function. + + Tested by existing tests. + + * css/mathml.css: + (math): + (math[display="block"]): + (mo, mrow, mfenced, mfrac, msub, msup, msubsup, munder, mover, munderover, msqrt, mroot): + (math, mrow, mfenced, msqrt, mroot): + (msqrt > *): + (mo, mfrac, munder, mover, munderover): + (munder, mover, munderover): + (mfrac > *): + (mfrac[numalign="left"] > :first-child): + (mfrac[numalign="right"] > :first-child): + (mfrac[denomalign="left"] > :last-child): + (mfrac[denomalign="right"] > :last-child): + (msubsup > :last-child, mover > :last-child, munderover > :last-child): + (msub > * + *, msup > * + *, msubsup > * + *, munder > * + *, mover > * + *, munderover > * + *): + (mroot): + (mroot > * + *): + (mtable): + + * mathml/MathMLInlineContainerElement.cpp: + (WebCore::MathMLInlineContainerElement::createRenderer): + * mathml/mathtags.in: + + * rendering/mathml/RenderMathMLBlock.cpp: + (WebCore::RenderMathMLBlock::RenderMathMLBlock): + (WebCore::RenderMathMLBlock::computePreferredLogicalWidths): + (WebCore::RenderMathMLBlock::baselinePosition): + (WebCore::RenderMathMLBlock::renderName): + (WebCore::RenderMathMLBlock::paint): + (WebCore::RenderMathMLTable::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLBlock.h: + (RenderMathMLBlock): + (RenderMathMLTable): + (WebCore::RenderMathMLTable::RenderMathMLTable): + - Change RenderMathMLBlock's base class to RenderFlexibleBox, and its display to FLEX or INLINE_FLEX. + - Add RenderMathMLTable for its firstLineBoxBaseline() function, like { vertical-align: middle }. + + * rendering/mathml/RenderMathMLFenced.cpp: + (WebCore::RenderMathMLFenced::createMathMLOperator): + (WebCore::RenderMathMLFenced::makeFences): + - Use RenderMathMLRow::addChild as a more robust name for RenderBlock::addChild. + (WebCore::RenderMathMLFenced::addChild): + - All inline children of a flexbox are treated as blocks automatically. + + * rendering/mathml/RenderMathMLFraction.cpp: + (WebCore::RenderMathMLFraction::fixChildStyle): + (WebCore::RenderMathMLFraction::updateFromElement): + - numalign and denomalign attributes are now handled by mathml.css. + (WebCore::RenderMathMLFraction::addChild): + (WebCore::RenderMathMLFraction::layout): + (WebCore::RenderMathMLFraction::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLFraction.h: + (RenderMathMLFraction): + + * rendering/mathml/RenderMathMLOperator.cpp: + (WebCore::RenderMathMLOperator::updateFromElement): + (WebCore::RenderMathMLOperator::createStackableStyle): + (WebCore::RenderMathMLOperator::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLOperator.h: + * rendering/mathml/RenderMathMLRow.cpp: + (WebCore::RenderMathMLRow::createAnonymousWithParentRenderer): + + * rendering/mathml/RenderMathMLSubSup.cpp: + (WebCore::RenderMathMLSubSup::RenderMathMLSubSup): + (WebCore::RenderMathMLSubSup::fixScriptsStyle): + (WebCore::RenderMathMLSubSup::addChild): + (WebCore::RenderMathMLSubSup::styleDidChange): + (WebCore::RenderMathMLSubSup::layout): + * rendering/mathml/RenderMathMLSubSup.h: + - Rename Sup to Super, to make it more readable vs. Sub. + - Instead of vertical-align, msub and msup now use the m_scripts anonymous box like msubsup does. + - Individual anonymous block wrappers are no longer needed around the superscript and subscript to + lay them out in a column. + - Handle msub and msup layout, and improve msubsup layout, by requiring a superscript's baseline + to be at least (int) fontSize / 3 + 1 above the main baseline, and a subscript's baseline to be + at least (int) fontSize / 5 + 1 below it. + + * rendering/mathml/RenderMathMLUnderOver.cpp: + (WebCore::RenderMathMLUnderOver::unembellishedOperator): + (WebCore::RenderMathMLUnderOver::firstLineBoxBaseline): + * rendering/mathml/RenderMathMLUnderOver.h: + (RenderMathMLUnderOver): + - RenderMathMLUnderOver no longer needs to use anonymous wrappers for column layout. Centering and + child layout order (overscript first) are also handled by mathml.css. + +2012-09-17 Ryuan Choi <ryuan.choi@samsung.com> + + [EFL] Several key codes are not mapped with evas key name. + https://bugs.webkit.org/show_bug.cgi?id=96915 + + Reviewed by Gyuyoung Kim. + + * platform/efl/EflKeyboardUtilities.cpp: + (WebCore::createWindowsKeyMap): + Added missing items of hashmap for virtual key code. + +2012-09-17 Filip Pizlo <fpizlo@apple.com> + + Unreviewed, fix build. + + * css/CSSRule.cpp: + (SameSizeAsCSSRule): + +2012-09-16 Mark Hahnenberg <mhahnenberg@apple.com> + + Delayed structure sweep can leak structures without bound + https://bugs.webkit.org/show_bug.cgi?id=96546 + + Reviewed by Gavin Barraclough. + + This patch gets rid of the separate Structure allocator in the MarkedSpace and adds two new destructor-only + allocators. We now have separate allocators for our three types of objects: those objects with no destructors, + those objects with destructors and with immortal structures, and those objects with destructors that don't have + immortal structures. All of the objects of the third type (destructors without immortal structures) now + inherit from a new class named JSDestructibleObject (which in turn is a subclass of JSNonFinalObject), which stores + the ClassInfo for these classes at a fixed offset for safe retrieval during sweeping/destruction. + + No new tests. + + * ForwardingHeaders/runtime/JSDestructableObject.h: Added. + * bindings/js/JSDOMWrapper.h: Inherits from JSDestructibleObject. + (JSDOMWrapper): + (WebCore::JSDOMWrapper::JSDOMWrapper): + * bindings/scripts/CodeGeneratorJS.pm: Add finalizers to anything that inherits from JSGlobalObject, + e.g. JSDOMWindow and JSWorkerContexts. For those classes we also need to use the NEEDS_DESTRUCTOR macro. + (GenerateHeader): + * bridge/objc/objc_runtime.h: Inherit from JSDestructibleObject. + (ObjcFallbackObjectImp): + * bridge/objc/objc_runtime.mm: + (Bindings): + (JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp): + * bridge/runtime_array.cpp: Use a finalizer so that JSArray isn't forced to inherit from JSDestructibleObject. + (JSC): + (JSC::RuntimeArray::destroy): + * bridge/runtime_array.h: + (JSC::RuntimeArray::create): + (JSC): + * bridge/runtime_object.cpp: Inherit from JSDestructibleObject. + (Bindings): + (JSC::Bindings::RuntimeObject::RuntimeObject): + * bridge/runtime_object.h: + (RuntimeObject): + +2012-09-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r128809. + http://trac.webkit.org/changeset/128809 + https://bugs.webkit.org/show_bug.cgi?id=96958 + + Broke the Windows build. (Requested by andersca on #webkit). + + * platform/win/BString.cpp: + (WebCore::BString::~BString): + (WebCore::BString::adoptBSTR): + * platform/win/BString.h: + (BString): + +2012-09-17 Patrick Gansterer <paroga@webkit.org> + + [WIN] Use BString in favour of BSTR to improve memory management + https://bugs.webkit.org/show_bug.cgi?id=93128 + + Reviewed by Anders Carlsson. + + BString automatically calls SysFreeString() in its destructor which helps + avoiding memory leaks. So it should be used instead of BSTR directly. + Add operator& to BString to allow its usage for out parameters too (like COMPtr). + This fixes already a few memory leaks in the existing code. + + * platform/win/BString.cpp: + (WebCore::BString::~BString): + (WebCore::BString::adoptBSTR): + (WebCore::BString::clear): + (WebCore): + * platform/win/BString.h: + (BString): + (WebCore::BString::operator&): + +2012-09-17 Tony Chang <tony@chromium.org> + + Make CSS.PrefixUsage histogram smaller to save memory + https://bugs.webkit.org/show_bug.cgi?id=96941 + + Reviewed by Ojan Vafai. + + Each bucket costs about 12 bytes. This reduces the size of the histogram + from 600 to 384, which will save about 2.5k per renderer and browser + process. + + In the long run, we could probably generate a table in makeprop.pl that + only has the webkit prefix values to save even more memory (there are + 194 properties that start with -webkit). + + No new tests, just refactoring. + + * css/CSSParser.cpp: + (WebCore::cssPropertyID): + +2012-09-17 Rob Buis <rbuis@rim.com> + + [BlackBerry] Enable VIDEO_TRACK + https://bugs.webkit.org/show_bug.cgi?id=96949 + + Reviewed by Antonio Gomes. + + Turn on runtime feature for VIDEO_TRACK. + + * bindings/generic/RuntimeEnabledFeatures.cpp: + (WebCore): + +2012-09-17 Adam Barth <abarth@webkit.org> + + Measure the usage of window.webkitIndexedDB so we can measure the transition to webkit.indexedDB + https://bugs.webkit.org/show_bug.cgi?id=96943 + + Reviewed by Ojan Vafai. + + We don't yet support window.indexedDB but we will once + https://bugs.webkit.org/show_bug.cgi?id=96548 lands. This metric will + help us measure the transition from the prefixed to the unprefixed API. + + * Modules/indexeddb/DOMWindowIndexedDatabase.idl: + * page/FeatureObserver.h: + +2012-09-17 Adam Barth <abarth@webkit.org> + + Measure usage of the legacy WebKitBlobBuilder API in the hopes of being able to remove it + https://bugs.webkit.org/show_bug.cgi?id=96939 + + Reviewed by Ojan Vafai. + + In the course of standardization, the BlobBuilder API was removed in + favor of just using the Blob constructor. This patch adds some + measurement to see how often this legacy API is used. If the API is not + used very much, we might be able to remove it. + + * fileapi/WebKitBlobBuilder.cpp: + (WebCore::WebKitBlobBuilder::create): + * page/FeatureObserver.h: + +2012-09-17 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Result of IDBFactory.deleteDatabase() should be undefined, not null + https://bugs.webkit.org/show_bug.cgi?id=96538 + + Reviewed by Tony Chang. + + Trivial implementation change to match the spec. + + Tests: storage/indexeddb/factory-deletedatabase-expected.html + storage/indexeddb/intversion-long-queue-expected.html + + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::deleteDatabase): + +2012-09-17 Rick Byers <rbyers@chromium.org> + + Allow gesture events to set active/hover state. + https://bugs.webkit.org/show_bug.cgi?id=96060 + + Reviewed by Antonio Gomes. + + Adds GestureTapDownCancel as a new PlatformGestureEvent type. On ports + that support gesture events, use GestureTapDown to trigger active/hover + states, and GestureTap/GestureTapDownCancel to clear them. This is + superior to using touch events for a number of reasons: + 1) some ports (chromium) avoid sending touch events unless absolutely + necessary, since they hurt scroll performance by blocking threaded + scrolling. + 2) with touch, and element really shouldn't be 'active' when the user + happens to be touching it while scrolling. In that case they aren't + 'manipulating the element', they're manipulating the page or div that + is scrolling. + 3) similarly, there may be other gestures that involve touching the + element which aren't really about manipulating that element (eg. + pinch to zoom). + + Test: fast/events/touch/gesture/gesture-tap-active-state.html + Test: fast/events/touch/gesture/gesture-tap-active-state-iframe.html + * dom/GestureEvent.cpp: + (WebCore::GestureEvent::create): + * page/EventHandler.cpp: + (WebCore::EventHandler::handleGestureEvent): + (WebCore::EventHandler::handleTouchEvent): + * platform/PlatformEvent.h: + +2012-09-17 Alec Flett <alecflett@chromium.org> + + IndexedDB: Use ScriptValue instead of SerializedScriptValue for get/openCursor + https://bugs.webkit.org/show_bug.cgi?id=95409 + + Reviewed by Kentaro Hara. + + This reduces a bunch of serialization/deserialization when writing + to objectstores with indexes. + + No new tests, as this covers core functionality of IndexedDB, and + almost every test would fail. Some likely tests that would fail + fundamentally include: + + storage/indexeddb/objectstore-basics.html + storage/indexeddb/cursor-basics.html + storage/indexeddb/index-basics.html + + * Modules/indexeddb/IDBAny.cpp: + (WebCore::IDBAny::scriptValue): + (WebCore::IDBAny::integer): + (WebCore): + (WebCore::IDBAny::set): + * Modules/indexeddb/IDBAny.h: + (WebCore): + (IDBAny): + (WebCore::IDBAny::create): + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::setValueReady): + * Modules/indexeddb/IDBCursor.h: + (WebCore): + (IDBCursor): + * Modules/indexeddb/IDBDatabase.cpp: + (WebCore::IDBDatabase::version): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore): + * Modules/indexeddb/IDBRequest.cpp: + (WebCore::IDBRequest::setResultCursor): + (WebCore::IDBRequest::onSuccess): + (WebCore): + (WebCore::IDBRequest::onSuccessInternal): + (WebCore::IDBRequest::dispatchEvent): + * Modules/indexeddb/IDBRequest.h: + (IDBRequest): + * Modules/indexeddb/IDBTransactionCallbacks.h: + * bindings/v8/IDBBindingUtilities.cpp: + (WebCore::deserializeIDBValue): + (WebCore::injectIDBKeyIntoScriptValue): + * bindings/v8/IDBBindingUtilities.h: + (WebCore): + * bindings/v8/custom/V8IDBAnyCustom.cpp: + (WebCore::toV8): + +2012-09-17 Adam Barth <abarth@webkit.org> + + We should make collecting metrics easier by adding an IDL attribute + https://bugs.webkit.org/show_bug.cgi?id=96837 + + Reviewed by Kentaro Hara. + + Currently it is too hard to set up a good measurement experiment to see + whether we can safely remove a feature (including vendor-prefixed + features). This patch introduces the [V8MeasureAs] IDL attribute to make + that process easier. + + When you add the [V8MeasureAs] IDL property to an API, we'll count what + fraction of Page objects used that API. + + * Modules/notifications/DOMWindowNotifications.idl: + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateFeatureObservation): + (GenerateNormalAttrGetter): + (GenerateReplaceableAttrSetter): + (GenerateNormalAttrSetter): + (GenerateOverloadedFunctionCallback): + (GenerateFunctionCallback): + (GenerateConstructorCallback): + (GenerateNamedConstructorCallback): + * bindings/scripts/IDLAttributes.txt: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::testObjAttrAttrGetter): + (WebCore::TestObjV8Internal::testObjAttrAttrSetter): + (WebCore::TestObjV8Internal::objMethodCallback): + (WebCore): + * page/Page.h: + (WebCore::Page::featureObserver): + (Page): + +2012-09-17 Bear Travis <betravis@adobe.com> + + [CSS Exclusions] Enable shape-inside for percentage lengths based on logical height + https://bugs.webkit.org/show_bug.cgi?id=93547 + + Reviewed by Levi Weintraub. + + Shape-inside needs to be passed the logical size to use when computing percentage + based coordinates. The CSS Regions-specific method computeInitialRegionRangeForBlock + has been generalized to updateRegionsAndExclusionsLogicalSize. This method takes + the pre-child-layout logical width and height, and uses them to compute the logical + width and height that regions and exclusions should use for layout. Regions use a + block's maximum possible logical height to compute a region's maximum extent. + Exclusions use a block's fixed logical width and height, or 0 if one does not exist, + to resolve percentage-based shape lengths. The default logical size used for resolving + percentage based coordinates is tested in shape-inside-percentage-auto.html. + + Test: fast/exclusions/shape-inside/shape-inside-percentage.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::updateRegionsAndExclusionsLogicalSize): Calculates the logical + height regions and exclusions should use, and updates their layout sizes through + computeExclusionShapeSize and computeRegionRangeForBlock. + (WebCore): + (WebCore::RenderBlock::computeExclusionShapeSize): Pass the appropriate logical size + to exclusion shapes so they can resolve percentage based coordinates. + (WebCore::RenderBlock::layoutBlock): Call the new updateRegionsAndExclusionsLogicalSize + method. + * rendering/RenderBlock.h: + (RenderBlock): + * rendering/RenderBox.cpp: + (WebCore::percentageLogicalHeightIsResolvable): Determine if percentage lengths + based on logical height can be resolved. + (WebCore): + (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock): Added declaration. + * rendering/RenderBox.h: + (RenderBox): + * rendering/RenderDeprecatedFlexibleBox.cpp: + (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): Calling + updateRegionsAndExclusionsLogicalSize rather than computeInitialRegionRangeForBlock. + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutBlock): Ditto. + * rendering/RenderGrid.cpp: + (WebCore::RenderGrid::layoutBlock): Ditto. + +2012-09-17 Vangelis Kokkevis <vangelis@chromium.org> + + [chromium] Add gpu_test trace events tracking the creation of a DrawingBuffer + and Canvas2DLayerBridge. They will be used by browser tests to verify the + existence of WebGL and accelerated canvas. + https://bugs.webkit.org/show_bug.cgi?id=96871 + + Reviewed by James Robinson. + + * platform/graphics/chromium/Canvas2DLayerBridge.cpp: + (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge): + * platform/graphics/chromium/DrawingBufferChromium.cpp: + (WebCore::DrawingBuffer::DrawingBuffer): + +2012-09-17 Bo Liu <boliu@chromium.org> + + Fix LoadImagesAutomatically cache behavior + https://bugs.webkit.org/show_bug.cgi?id=96829 + + Reviewed by Adam Barth. + + I broke the caching behavior of LoadImagesAutomatically in + http://trac.webkit.org/changeset/128645 + + This restores the original behavior that AutoLoadImage does not block + loads from memory cache. + + Test: fast/loader/display-image-unset-allows-cached-image-load.html + + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::determineRevalidationPolicy): + (WebCore::CachedResourceLoader::clientAllowsImage): + (WebCore::CachedResourceLoader::shouldDeferImageLoad): + * loader/cache/CachedResourceLoader.h: + (CachedResourceLoader): + +2012-09-17 Andrei Poenaru <poenaru@adobe.com> + + Web Inspector: Display Named Flows in the Tabbed Pane of the "CSS Named Flows" Drawer + https://bugs.webkit.org/show_bug.cgi?id=96733 + + Reviewed by Alexander Pavlov. + + Added functionality to the Tabbed Pane from the CSS Named Flows Drawer. + + * English.lproj/localizedStrings.js: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/compile-front-end.py: + * inspector/front-end/CSSNamedFlowCollectionsView.js: + (WebInspector.CSSNamedFlowCollectionsView.prototype._appendNamedFlow): + (WebInspector.CSSNamedFlowCollectionsView.prototype._removeNamedFlow): + (WebInspector.CSSNamedFlowCollectionsView.prototype._updateNamedFlow): + (WebInspector.CSSNamedFlowCollectionsView.prototype._showNamedFlow): + (WebInspector.CSSNamedFlowCollectionsView.prototype._selectNamedFlowInSidebar): + (WebInspector.CSSNamedFlowCollectionsView.prototype._selectNamedFlowTab): + (WebInspector.CSSNamedFlowCollectionsView.prototype._tabSelected): + (WebInspector.CSSNamedFlowCollectionsView.prototype._tabClosed): + (WebInspector.CSSNamedFlowCollectionsView.prototype.wasShown): + (WebInspector.CSSNamedFlowCollectionsView.prototype.willHide): + (WebInspector.FlowTreeElement): + (WebInspector.FlowTreeElement.prototype.setOverset): + * inspector/front-end/CSSNamedFlowView.js: Added. + (WebInspector.CSSNamedFlowView): + (WebInspector.CSSNamedFlowView.prototype._createFlowTreeOutline): + (WebInspector.CSSNamedFlowView.prototype._insertContentNode): + (WebInspector.CSSNamedFlowView.prototype._insertRegion): + (WebInspector.CSSNamedFlowView.prototype.get flow): + (WebInspector.CSSNamedFlowView.prototype.set flow): + (WebInspector.CSSNamedFlowView.prototype._updateRegionOverset): + (WebInspector.CSSNamedFlowView.prototype._mergeContentNodes): + (WebInspector.CSSNamedFlowView.prototype._mergeRegions): + (WebInspector.CSSNamedFlowView.prototype._update): + * inspector/front-end/ElementsPanel.js: + * inspector/front-end/Images/regionEmpty.png: Added. + * inspector/front-end/Images/regionFit.png: Added. + * inspector/front-end/Images/regionOverset.png: Added. + * inspector/front-end/WebKit.qrc: + * inspector/front-end/cssNamedFlows.css: + (.css-named-flow-collections-view .split-view-sidebar-left .named-flow-overflow::before, .css-named-flow-collections-view .region-empty:before, .css-named-flow-collections-view .region-fit::before, .css-named-flow-collections-view .region-overset::before): + (.css-named-flow-collections-view .split-view-sidebar-left .named-flow-overflow::before): + (.css-named-flow-collections-view .region-empty::before): + (.css-named-flow-collections-view .region-fit::before): + (.css-named-flow-collections-view .region-overset::before): + (.css-named-flow-collections-view .split-view-contents .named-flow-element): + +2012-09-17 Zan Dobersek <zandobersek@gmail.com> + + [Gtk] Remove configuration options for stable features that are currently enabled + https://bugs.webkit.org/show_bug.cgi?id=96621 + + Reviewed by Martin Robinson. + + Remove Automake conditional checking for features that are being removed in + configure.ac. Unstable features that don't introduce dependencies are now + disabled if necessary by being listed in the unstable feature defines overriding + variable. + + No new tests - no new functionality. + + * GNUmakefile.am: + * GNUmakefile.features.am: + * bindings/gobject/GNUmakefile.am: + +2012-09-17 Lauro Neto <lauro.neto@openbossa.org> + + [Qt] Cleanup/refactor the user agent detection code + https://bugs.webkit.org/show_bug.cgi?id=96822 + + Unreviewed build fix. + + Build fixes for Windows and Mac OS builds. + + * platform/qt/UserAgentQt.cpp: + (WebCore::UserAgentQt::standardUserAgent): + + QLatin1String doesn't have a default contructor. Replaced #ifdef with #if. + +2012-09-17 Lauro Neto <lauro.neto@openbossa.org> + + Updates to the useragent patch + + [Qt] Cleanup/refactor the user agent detection code + https://bugs.webkit.org/show_bug.cgi?id=96822 + + Reviewed by Simon Hausmann. + + Replaced Q_WS_*/Q_OS_* with WTF OS/CPU detection macros. + Cleanup the check for unsupported OS. + Replaced QString.arg() usage with simple string concatenation. + + * platform/qt/UserAgentQt.cpp: + (WebCore::UserAgentQt::standardUserAgent): + +2012-09-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r128759. + http://trac.webkit.org/changeset/128759 + https://bugs.webkit.org/show_bug.cgi?id=96929 + + New assertion hit on multiple platforms (Requested by carewolf + on #webkit). + + * dom/Document.cpp: + (WebCore::Document::updateHoverActiveState): + +2012-09-17 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: now when we can detect instrumented classes we can + remove addInstrumentedMember and use addMember for everything. + https://bugs.webkit.org/show_bug.cgi?id=96913 + + Reviewed by Yury Semikhatsky. + + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::reportMemoryUsage): + * bindings/v8/IntrusiveDOMWrapperMap.h: + * bindings/v8/V8PerIsolateData.cpp: + (WebCore::V8PerIsolateData::reportMemoryUsage): + * css/CSSBorderImageSliceValue.cpp: + (WebCore::CSSBorderImageSliceValue::reportDescendantMemoryUsage): + * css/CSSCalculationValue.cpp: + * css/CSSCanvasValue.cpp: + (WebCore::CSSCanvasValue::reportDescendantMemoryUsage): + * css/CSSCharsetRule.cpp: + (WebCore::CSSCharsetRule::reportDescendantMemoryUsage): + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::reportMemoryUsage): + * css/CSSCrossfadeValue.cpp: + (WebCore::CSSCrossfadeValue::reportDescendantMemoryUsage): + * css/CSSFontFaceRule.cpp: + (WebCore::CSSFontFaceRule::reportDescendantMemoryUsage): + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::reportDescendantMemoryUsage): + * css/CSSFunctionValue.cpp: + (WebCore::CSSFunctionValue::reportDescendantMemoryUsage): + * css/CSSGradientValue.cpp: + (WebCore::CSSGradientColorStop::reportMemoryUsage): + (WebCore::CSSGradientValue::reportBaseClassMemoryUsage): + (WebCore::CSSLinearGradientValue::reportDescendantMemoryUsage): + (WebCore::CSSRadialGradientValue::reportDescendantMemoryUsage): + * css/CSSImageSetValue.cpp: + (WebCore::CSSImageSetValue::ImageWithScale::reportMemoryUsage): + * css/CSSImageValue.cpp: + (WebCore::CSSImageValue::reportDescendantMemoryUsage): + * css/CSSImportRule.cpp: + (WebCore::CSSImportRule::reportDescendantMemoryUsage): + * css/CSSMediaRule.cpp: + (WebCore::CSSMediaRule::reportDescendantMemoryUsage): + * css/CSSPageRule.cpp: + (WebCore::CSSPageRule::reportDescendantMemoryUsage): + * css/CSSPrimitiveValue.cpp: + (WebCore::CSSPrimitiveValue::reportDescendantMemoryUsage): + * css/CSSProperty.cpp: + (WebCore::CSSProperty::reportMemoryUsage): + * css/CSSReflectValue.cpp: + (WebCore::CSSReflectValue::reportDescendantMemoryUsage): + * css/CSSRule.cpp: + (WebCore::CSSRule::reportBaseClassMemoryUsage): + * css/CSSRuleList.h: + * css/CSSStyleRule.cpp: + (WebCore::CSSStyleRule::reportDescendantMemoryUsage): + * css/CSSStyleSheet.cpp: + (WebCore::CSSStyleSheet::reportMemoryUsage): + * css/CSSValue.cpp: + (WebCore::TextCloneCSSValue::reportDescendantMemoryUsage): + * css/CSSVariableValue.h: + (WebCore::CSSVariableValue::reportDescendantMemoryUsage): + * css/FontFeatureValue.cpp: + (WebCore::FontFeatureValue::reportDescendantMemoryUsage): + * css/FontValue.cpp: + (WebCore::FontValue::reportDescendantMemoryUsage): + * css/MediaList.cpp: + (WebCore::MediaList::reportMemoryUsage): + * css/MediaQuery.cpp: + (WebCore::MediaQuery::reportMemoryUsage): + * css/MediaQueryExp.cpp: + (WebCore::MediaQueryExp::reportMemoryUsage): + * css/PropertySetCSSStyleDeclaration.cpp: + (WebCore::PropertySetCSSStyleDeclaration::reportMemoryUsage): + (WebCore::StyleRuleCSSStyleDeclaration::reportMemoryUsage): + (WebCore::InlineCSSStyleDeclaration::reportMemoryUsage): + * css/ShadowValue.cpp: + (WebCore::ShadowValue::reportDescendantMemoryUsage): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::reportMemoryUsage): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/StyleRule.cpp: + (WebCore::StyleRule::reportDescendantMemoryUsage): + (WebCore::StyleRulePage::reportDescendantMemoryUsage): + (WebCore::StyleRuleFontFace::reportDescendantMemoryUsage): + (WebCore::StyleRuleMedia::reportDescendantMemoryUsage): + (WebCore::StyleRuleRegion::reportDescendantMemoryUsage): + * css/StyleRuleImport.cpp: + (WebCore::StyleRuleImport::reportDescendantMemoryUsage): + * css/StyleSheetContents.cpp: + (WebCore::StyleSheetContents::reportMemoryUsage): + * css/WebKitCSSKeyframeRule.cpp: + (WebCore::StyleKeyframe::reportMemoryUsage): + (WebCore::WebKitCSSKeyframeRule::reportDescendantMemoryUsage): + * css/WebKitCSSKeyframesRule.cpp: + (WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage): + (WebCore::WebKitCSSKeyframesRule::reportDescendantMemoryUsage): + * css/WebKitCSSRegionRule.cpp: + (WebCore::WebKitCSSRegionRule::reportDescendantMemoryUsage): + * css/WebKitCSSSVGDocumentValue.cpp: + (WebCore::WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage): + * css/WebKitCSSShaderValue.cpp: + (WebCore::WebKitCSSShaderValue::reportDescendantMemoryUsage): + * dom/Attribute.h: + (WebCore::Attribute::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.cpp: + (WebCore::ElementAttributeData::reportMemoryUsage): + * dom/Event.cpp: + (WebCore::Event::reportMemoryUsage): + * dom/Node.cpp: + (WebCore::Node::reportMemoryUsage): + * dom/QualifiedName.cpp: + (WebCore::QualifiedName::reportMemoryUsage): + (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage): + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::reportMemoryUsage): + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::reportMemoryUsage): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::reportMemoryUsage): + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::reportMemoryUsage): + * loader/ResourceLoader.cpp: + (WebCore::ResourceLoader::reportMemoryUsage): + * loader/SubresourceLoader.cpp: + (WebCore::SubresourceLoader::reportMemoryUsage): + * loader/SubstituteData.cpp: + (WebCore::SubstituteData::reportMemoryUsage): + * loader/cache/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::reportMemoryUsage): + * loader/cache/CachedFont.cpp: + (WebCore::CachedFont::reportMemoryUsage): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::reportMemoryUsage): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::reportMemoryUsage): + * loader/cache/CachedResourceHandle.cpp: + (WebCore::CachedResourceHandleBase::reportMemoryUsage): + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::reportMemoryUsage): + * loader/cache/CachedSVGDocument.cpp: + (WebCore::CachedSVGDocument::reportMemoryUsage): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::reportMemoryUsage): + * loader/cache/CachedShader.cpp: + (WebCore::CachedShader::reportMemoryUsage): + * loader/cache/CachedXSLStyleSheet.cpp: + (WebCore::CachedXSLStyleSheet::reportMemoryUsage): + * loader/cache/MemoryCache.cpp: + (WebCore::MemoryCache::reportMemoryUsage): + * page/Frame.cpp: + (WebCore::Frame::reportMemoryUsage): + * platform/KURL.cpp: + (WebCore::KURL::reportMemoryUsage): + * platform/KURLGoogle.cpp: + (WebCore::KURLGooglePrivate::reportMemoryUsage): + * platform/KURLWTFURLImpl.h: + (WebCore::KURLWTFURLImpl::reportMemoryUsage): + * platform/TreeShared.h: + (WebCore::TreeShared::reportMemoryUsage): + * platform/graphics/CrossfadeGeneratedImage.cpp: + (WebCore::CrossfadeGeneratedImage::reportMemoryUsage): + * platform/graphics/Image.cpp: + (WebCore::Image::reportMemoryUsage): + * platform/network/ResourceRequestBase.cpp: + (WebCore::ResourceRequestBase::reportMemoryUsage): + * platform/network/ResourceResponseBase.cpp: + (WebCore::ResourceResponseBase::reportMemoryUsage): + * rendering/style/DataRef.h: + (WebCore::DataRef::reportMemoryUsage): + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::reportMemoryUsage): + * rendering/style/StyleRareInheritedData.cpp: + (WebCore::StyleRareInheritedData::reportMemoryUsage): + * rendering/style/StyleRareNonInheritedData.cpp: + (WebCore::StyleRareNonInheritedData::reportMemoryUsage): + * svg/SVGPaint.cpp: + (WebCore::SVGPaint::reportDescendantMemoryUsage): + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImage::reportMemoryUsage): + +2012-09-17 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [TouchAdjustment] Adjusted point outside bounds for non-rectilinear targets + https://bugs.webkit.org/show_bug.cgi?id=96098 + + Reviewed by Antonio Gomes. + + Simplifies how snapTo tries to restrict the adjustment to the touch-area, and + at the same fix it to give better guarantees. + + Test: touchadjustment/rotated-node.html + + * page/TouchAdjustment.cpp: + (WebCore::TouchAdjustment::snapTo): + +2012-09-17 Filip Spacek <fspacek@rim.com> + + [BlackBerry] Use glDeleteProgram to delete OpenGL shader programs. + https://bugs.webkit.org/show_bug.cgi?id=96771 + + Reviewed by Rob Buis. + + Reviewed internally by Arvid Nilsson. + + * platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp: + (WebCore::EGLImageLayerWebKitThread::EGLImageLayerWebKitThread): + (WebCore::EGLImageLayerWebKitThread::~EGLImageLayerWebKitThread): + (WebCore::EGLImageLayerWebKitThread::deleteFrontBuffer): + (WebCore::EGLImageLayerWebKitThread::createShaderIfNeeded): + (WebCore::EGLImageLayerWebKitThread::blitToFrontBuffer): + * platform/graphics/blackberry/EGLImageLayerWebKitThread.h: + (EGLImageLayerWebKitThread): + +2012-09-17 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Revert r127457 and following fixes due to several hit-testing regressions + https://bugs.webkit.org/show_bug.cgi?id=96830 + + Reviewed by Antonio Gomes. + + The revert misssed one related follow-up. + + * dom/Document.cpp: + (WebCore::Document::updateHoverActiveState): + +2012-09-17 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [TouchAdjustment] Adjusted point outside bounds for non-rectilinear targets + https://bugs.webkit.org/show_bug.cgi?id=96098 + + Reviewed by Antonio Gomes. + + Simplifies how snapTo tries to restrict the adjustment to the touch-area, and + at the same fix it to give better guarantees. + + Test: touchadjustment/rotated-node.html + + * page/TouchAdjustment.cpp: + (WebCore::TouchAdjustment::snapTo): + +2012-09-17 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Fix Mac compilation. + + * bindings/v8/DOMDataStore.h: added missing virtual modifier. + (DOMDataStore): + +2012-09-17 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: NMI don't double count fields of StaticDOMDataStore + https://bugs.webkit.org/show_bug.cgi?id=96911 + + Reviewed by Alexander Pavlov. + + Provided two separate memory usage reporting routines for static and + scoped DOM data stores. + + * bindings/v8/DOMDataStore.cpp: + * bindings/v8/DOMDataStore.h: + (DOMDataStore): + * bindings/v8/ScopedDOMDataStore.cpp: + (WebCore::ScopedDOMDataStore::reportMemoryUsage): + (WebCore): + * bindings/v8/ScopedDOMDataStore.h: + (ScopedDOMDataStore): + * bindings/v8/StaticDOMDataStore.cpp: + (WebCore::StaticDOMDataStore::reportMemoryUsage): + (WebCore): + * bindings/v8/StaticDOMDataStore.h: + (StaticDOMDataStore): + +2012-09-17 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] autoscroll-in-textarea.html fails on EFL + https://bugs.webkit.org/show_bug.cgi?id=94150 + + Reviewed by Kenneth Rohde Christiansen. + + Do not call adjustTextAreaStyle() from RenderThemeEfl::adjustTextAreaStyle(). + This is consistent with Mac port implementation. + + Calling adjustTextAreaStyle() causes the TextArea in the test to display 6.5 + rows instead of the 6 that are requested. This causes the test case to fail + because the top row that is being displayed when scrolling down is different + than the one expected. + + Test: fast/events/autoscroll-in-textarea.html + + * platform/efl/RenderThemeEfl.cpp: + (WebCore::RenderThemeEfl::adjustTextAreaStyle): + +2012-09-17 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: XHR replay fixes: should remove replayed xhr from memory cache, should not assert. + https://bugs.webkit.org/show_bug.cgi?id=96904 + + Reviewed by Yury Semikhatsky. + + Replayed request is now removed from meory cache before replaying. + Request body is now set to 0 when it was not present in original request. + + Test: http/tests/inspector/network/network-xhr-replay.html + + * inspector/InspectorResourceAgent.cpp: + (WebCore::InspectorResourceAgent::replayXHR): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::sendFromInspector): + +2012-09-17 Alejandro Piñeiro <apinheiro@igalia.com> + + AX: Regression (r126369) - toggle buttons no longer return accessible titles + https://bugs.webkit.org/show_bug.cgi?id=94858 + + Reviewed by Chris Fleizach. + + After the addition of the ToggleButtonRole some logic broke because some parts + of the code were assuming/waiting for a ButtonRole + + Test: platform/gtk/accessibility/aria-toggle-button-with-title.html + + * accessibility/AccessibilityNodeObject.cpp: + (WebCore::AccessibilityNodeObject::isImageButton): using + isButton instead of a ButtonRole comparison + (WebCore::AccessibilityNodeObject::isPressed): using isButton + instead of a ButtonRole comparison + (WebCore::AccessibilityNodeObject::actionElement): + ToggleButtonRole also contemplated in order to call or not toElement + (WebCore::AccessibilityNodeObject::title): ToggleButtonRole also + contemplated in order to call or not textUnderElement + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::actionVerb): buttonAction also + assigned to ToggleButtonRole + (WebCore::AccessibilityObject::isButton): isButton now returns + that an object is a button if it is a ButtonRole, a + PopUpButtonRole or a ToggleButtonRole + * accessibility/AccessibilityObject.h: + (AccessibilityObject): isButton is now implemented on the .c file + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::actionVerb): ToggleButtonRole + also returns a buttonAction + +2012-09-14 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Group selectors to highlight matched selector in the Styles pane of Elements Panel + https://bugs.webkit.org/show_bug.cgi?id=96626 + + Reviewed by Vsevolod Vlasov. + + Introduced evaluation of element.webkitMatchesSelector() for every part of a selector group (delimited by commas). + Non-matching selectors in groups are dimmed. If element styles have changed so that the element matches none of the selectors, + the entire group is rendered as matched. + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype._innerRebuildUpdate.markCallback): + (WebInspector.StylesSidebarPane.prototype._innerRebuildUpdate): + (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules): + (WebInspector.StylePropertiesSection): + (WebInspector.StylePropertiesSection.prototype._markMatchedSelectorsInGroup.mycallback): + (WebInspector.StylePropertiesSection.prototype._markMatchedSelectorsInGroup.trim): + (WebInspector.StylePropertiesSection.prototype._markMatchedSelectorsInGroup.resolvedCallback): + (WebInspector.StylePropertiesSection.prototype._markMatchedSelectorsInGroup): + (WebInspector.StylePropertiesSection.prototype._markMatchedSelectorsInGroup.matchesCallback): + (WebInspector.StylePropertiesSection.prototype.startEditingSelector): + (WebInspector.StylePropertiesSection.prototype._moveEditorFromSelector.markCallback): + (WebInspector.StylePropertiesSection.prototype._moveEditorFromSelector): + (WebInspector.StylePropertiesSection.prototype.editingSelectorCancelled): + * inspector/front-end/elementsPanel.css: + (.styles-section .selector): + (.styles-section .selector-matches): + +2012-09-17 Mike West <mkwst@chromium.org> + + Don't GC img elements blocked by CSP until error events fire. + https://bugs.webkit.org/show_bug.cgi?id=94677 + + Reviewed by Jochen Eisinger. + + Currently, the GC checks that no load events are pending for an image + element before reclaiming its memory. It's not, however, checking that + error events are taken care of. This leads to the potential of firing an + event on a DOM element that we've already collected. That's a Bad Thing. + + This patch adjusts the check to catch error events as well as load + events, which should ensure that the element isn't collected until it's + really ready. As a drive-by, it also changes the name of the check to + 'hasPendingActivity' from 'hasPendingLoadEvent' for clarity. + + http/tests/security/contentSecurityPolicy/register-bypassing-scheme.html + should no longer crash, and the new + http/tests/security/contentSecurityPolicy/img-blocked-no-gc-crash.html + and fast/events/onerror-img-after-gc.html shouldn't crash either. + + Tests: fast/events/onerror-img-after-gc.html + http/tests/security/contentSecurityPolicy/img-blocked-no-gc-crash.html + + * bindings/v8/V8GCController.cpp: + (WebCore::calculateGroupId): + Switch to using ImageLoader::hasPendingActivity(). + * html/HTMLImageElement.h: + (WebCore::HTMLImageElement::hasPendingActivity): + Switch to using ImageLoader::hasPendingActivity(). + * loader/ImageLoader.h: + (WebCore::ImageLoader::hasPendingActivity): + Added a check against pending error events in order to ensure that + elements aren't garbage collected prematurely. Aslo renamed from + ImageLoader::hasPendingLoadEvent for clarity. + * svg/SVGImageElement.cpp: + (WebCore::SVGImageElement::haveLoadedRequiredResources): + Switch to using ImageLoader::hasPendingActivity(). + +2012-09-17 Philip Rogers <pdr@google.com> + + Make SVGPathSegList.appendItem O(1) instead of O(n) + https://bugs.webkit.org/show_bug.cgi?id=94048 + + Reviewed by Nikolas Zimmermann. + + Paths in SVG can be specified with a String (with the d attribute) or + with an SVGPathSegList. In SVGPathElement a single representation is + maintained: an SVGPathByteStream. To keep the byte stream synchronized with + the d attribute and the PathSegList, this byte stream is + rebuilt on every operation. As a result, any modification to the + path is an O(n) operation. + + This patch takes advantage of the stream aspect of SVGPathByteStream + to make SVGPathSegList.append an O(1) operation instead of O(n). + When an SVGPathSeg is appended to an SVGPathSegList, this patch parses + the SVGPathSeg and directly appends the resulting bytes to the + byte stream. + + To achieve this some plumbing has been added to pass more information + about the actual path changes from the SVGPathSegListTearOff to the + SVGPathElement: instead of the generic commitChange() this patch adds + commitChange(ListModification type). If we decide to change our + internal path data structure in the future, this additional commitChange + function can be used to pass the information needed to make + SVGPathSegList synchronization faster. + + SVG Path Benchmark (http://bl.ocks.org/1296930) showing just the + appendItem() time used in building a 5000 segment path (avg of 3 runs): + WebKit without patch: 562 ms + Firefox 18.01a: 55 ms + Opera 12.50 internal: 27 ms + WebKit with patch: 7 ms + + Test: perf/svg-path-appenditem.html + + This test proves the claim: SVGPathSegList.appendItem is now O(1). + Additional tests that appendItem works are covered with existing tests. + + * svg/SVGPathByteStream.h: + (WebCore::SVGPathByteStream::append): + + This additional append method allows an SVGPathByteStream to be + appended to another. + + * svg/SVGPathElement.cpp: + (WebCore::SVGPathElement::pathSegListChanged): + + By passing the extra ListModification type to pathSegListChanged, + SVGPathElement is now able to only synchronize the parts of the byte stream + that actually changed. In this patch only append is treated + differently but one can imagine other performance improvements this + additional information allows. + + * svg/SVGPathElement.h: + (SVGPathElement): + * svg/SVGPathParser.cpp: + (WebCore::SVGPathParser::parsePathDataFromSource): + + During normal SVGPathSegList parsing we enforce that the path start with a moveto + command. This function has been expanded to make that optional so that parsing + can be performed elsewhere in the path (e.g., in the middle). + + * svg/SVGPathParser.h: + (SVGPathParser): + * svg/SVGPathSegList.cpp: + (WebCore::SVGPathSegList::commitChange): + * svg/SVGPathSegList.h: + (SVGPathSegList): + * svg/SVGPathSegWithContext.h: + (WebCore::SVGPathSegWithContext::commitChange): + * svg/SVGPathUtilities.cpp: + (WebCore::appendSVGPathByteStreamFromSVGPathSeg): + + This function reuses the SVGPathSegList parsing infrastructure + to parse an SVGPathSegList with just the single SVGPathSeg that + is being appended. The resulting byte stream can then be appended + to the result path byte stream. + + (WebCore): + * svg/SVGPathUtilities.h: + (WebCore): + * svg/properties/SVGListProperty.h: + (WebCore::SVGListProperty::appendItemValues): + (WebCore::SVGListProperty::appendItemValuesAndWrappers): + (WebCore::SVGListProperty::commitChange): + (SVGListProperty): + * svg/properties/SVGPathSegListPropertyTearOff.h: + (WebCore::SVGPathSegListPropertyTearOff::commitChange): + (SVGPathSegListPropertyTearOff): + +2012-09-16 James Robinson <jamesr@chromium.org> + + Chromium win build fix - listing a file that doesn't exist is a fatal errors in the msvs gyp generator. + + * WebCore.gypi: + +2012-09-16 Dan Bernstein <mitz@apple.com> + + REGRESSION (r126763): css1/pseudo/firstline.html fails when using the complex text code path + https://bugs.webkit.org/show_bug.cgi?id=96890 + + Reviewed by Sam Weinig. + + Test: fast/text/stale-TextLayout-from-first-line.html + + When a first-line style specifies a font, different pieces of the same RenderText can be + laid out using different fonts, requiring a differet TextLayout for each piece. + + * rendering/RenderBlock.h: + (RenderTextInfo): Added m_font data member. + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::RenderTextInfo::RenderTextInfo): Added initializer for new data member. + (WebCore::RenderBlock::LineBreaker::nextLineBreak): Added code to update the text layout in + renderTextInfo if the font has changed. + +2012-09-16 Kalev Lember <kalevlember@gmail.com> + + [GTK] Missing dllexport causing linking errors on Windows platform + https://bugs.webkit.org/show_bug.cgi?id=96888 + + Reviewed by Kentaro Hara. + + Define BUILDING_WebCore during the build to properly mark + FrameDestructionObserver symbols with __declspec(dllexport) attribute. + + * GNUmakefile.am: + +2012-09-15 Mike West <mkwst@chromium.org> + + Pause inspector when inline scripts are blocked by Content Security Policy. + https://bugs.webkit.org/show_bug.cgi?id=93865 + + Reviewed by Pavel Feldman. + + When Content Security Policy blocks an inline script that's been + injected after the document is parsed, a fairly unhelpful console + warning is generated; it points at line 1, regardless of where the error + occurred. This patch adjusts CSP to not only warn on the console, but + also to notify the inspector that it should pause execution if the + developer has toggled "Break on Exceptions". Developers will have a + better chance of tracking down the error, as they'll have a complete + call stack to work with. + + Tests: inspector/debugger/debugger-pause-on-blocked-event-handler.html + inspector/debugger/debugger-pause-on-blocked-script-injection.html + inspector/debugger/debugger-pause-on-blocked-script-url.html + + * English.lproj/localizedStrings.js: + Adding localizable string for the new friendly pause message. + * inspector/Inspector.json: + Add CSPViolation as a recognized reason for pausing execution. + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::scriptExecutionBlockedByCSP): + Teach the InspectorDebuggerAgent about script blocking. If pause on + exceptions is enabled, call 'InspectorDebuggerAgent::breakProgram', + and pass in an error object with a description that points to CSP + as the culprit. + (WebCore): + * inspector/InspectorDebuggerAgent.h: + (InspectorDebuggerAgent): + * inspector/InspectorInstrumentation.cpp: + (WebCore): + (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSPImpl): + Wire 'InspectorInstrumentation::scriptExecutionBlockedByCSP' to + the InspectorDebuggerAgent backend. + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP): + The public interface that should be kicked whenever CSP blocks + script execution. + (WebCore): + * inspector/front-end/DebuggerModel.js: + Add CSPViolation as a recognized reason for pausing execution. + * inspector/front-end/ScriptsPanel.js: + Add a friendly call stack status message for CSP violations. + * page/ContentSecurityPolicy.cpp: + (CSPDirectiveList): + (WebCore::CSPDirectiveList::checkNonceAndReportViolation): + If script is blocked because the nonce doesn't match, report the + blocked script to the inspector. + (WebCore::CSPDirectiveList::checkInlineAndReportViolation): + If inline script is blocked, report the blocked script to the + inspector. This requires adding a bool parameter to differentiate + blocking inline script from inline style. + (WebCore::CSPDirectiveList::allowJavaScriptURLs): + Tell 'checkInlineAndReportViolation' that we're dealing with script. + (WebCore::CSPDirectiveList::allowInlineEventHandlers): + Tell 'checkInlineAndReportViolation' that we're dealing with script. + (WebCore::CSPDirectiveList::allowInlineScript): + Tell 'checkInlineAndReportViolation' that we're dealing with script. + (WebCore::CSPDirectiveList::allowInlineStyle): + Tell 'checkInlineAndReportViolation' that we're not dealing with script. + (WebCore::ContentSecurityPolicy::reportBlockedScriptExecutionToInspector): + Public interface for the various CSP* classes to poke the inspector. + (WebCore): + * page/ContentSecurityPolicy.h: + +2012-09-15 Florin Malita <fmalita@chromium.org> + + <use> not working when the SVG doc is embedded as <object> data + https://bugs.webkit.org/show_bug.cgi?id=96816 + + Reviewed by Dirk Schulze. + + Updated SVGURIReference::isExternalURIReference() to correctly classify fragment-only URIs. + Also, since the fragment-only test is cheap, it should be the first thing to try. + + Test: svg/custom/object-data-href.html + + * svg/SVGURIReference.h: + (WebCore::SVGURIReference::isExternalURIReference): + +2012-09-15 Benjamin Poulain <benjamin@webkit.org> + + Fix the build with WTF URL + https://bugs.webkit.org/show_bug.cgi?id=96875 + + Reviewed by Adam Barth. + + Fix reportMemoryUsage, the implementation was only partial. + + * WebCore.exp.in: Export two more symbols as needed by API tests. + * platform/KURLWTFURL.cpp: + (WebCore::KURL::string): emptyString() return a reference, + it makes more sense than nullAtom() here. + * platform/KURLWTFURLImpl.h: + (WebCore::KURLWTFURLImpl::reportMemoryUsage): + +2012-09-11 Dirk Schulze <krit@webkit.org> + + Add ClipPathOperation for -webkit-clip-path organization + https://bugs.webkit.org/show_bug.cgi?id=95619 + + Reviewed by Dean Jackson. + + This patch adds a new class ClipPathOperation to manage the values of the + -webkit-clip-path property. ClipPathOperation stores a Path object for clipping and is + a preparation for IRI references of the SVG 'clipPath' element. + + The structure of ClipPathOperation is simular to FilterOperation. + + ClipPathOperation will be extended to support IRI references directly in a second patch. + + No new tests. The changes just affect the backend. + + * GNUmakefile.list.am: Added new ClipPathOperation class. + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * css/CSSComputedStyleDeclaration.cpp: Use ClipPathOperation instead of BasicShape. + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Ditto. + * css/StyleBuilder.cpp: Ditto. + (WebCore): + (WebCore::ApplyPropertyClipPath::setValue): + (WebCore::ApplyPropertyClipPath::applyValue): + (WebCore::ApplyPropertyClipPath::createHandler): + * rendering/ClipPathOperation.h: Added. New handler for property values (BasicShape, references). + (WebCore): + (ClipPathOperation): + (WebCore::ClipPathOperation::~ClipPathOperation): + (WebCore::ClipPathOperation::operator!=): + (WebCore::ClipPathOperation::getOperationType): Return the operation type. + (WebCore::ClipPathOperation::isSameType): Helper function for =operator. + (WebCore::ClipPathOperation::ClipPathOperation): + (ShapeClipPathOperation): Inheriting class for managing BasicShapes. + (WebCore::ShapeClipPathOperation::create): + (WebCore::ShapeClipPathOperation::basicShape): + (WebCore::ShapeClipPathOperation::windRule): + (WebCore::ShapeClipPathOperation::path): + (WebCore::ShapeClipPathOperation::operator==): + (WebCore::ShapeClipPathOperation::ShapeClipPathOperation): + * rendering/RenderLayer.cpp: Use ClipPathOperation to apply clipping. + (WebCore::RenderLayer::paintLayerContents): + * rendering/style/RenderStyle.h: + * rendering/style/StyleRareNonInheritedData.h: + (StyleRareNonInheritedData): + * rendering/svg/SVGRenderingContext.cpp: Ditto. + (WebCore::SVGRenderingContext::prepareToRenderSVGContent): + +2012-09-15 Andreas Kling <kling@webkit.org> + + REGRESSION(r127438): Google Docs to renders text too small. + <http://webkit.org/b/96554> + + Reviewed by Antti Koivisto. + + Don't remove the inline StylePropertySet from ElementAttributeData in ~StyledElement. + This behavior broke sharing of ElementAttributeData between elements with inline style, + since destroying one element would effectively disable the inline style from all other + elements that shared the same attribute data. + + What we actually want in ~StyledElement is to detach from any CSSOM wrapper that may + have been instantiated. Added ElementAttributeData::detachCSSOMWrapperIfNeeded for this + purpose and call that instead. + + Test: fast/dom/shared-inline-style-after-node-removal.html + + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::detachCSSOMWrapperIfNeeded): + (WebCore::ElementAttributeData::destroyInlineStyle): + * dom/ElementAttributeData.h: + (ElementAttributeData): + * dom/StyledElement.cpp: + (WebCore::StyledElement::~StyledElement): + (WebCore::StyledElement::styleAttributeChanged): + * dom/StyledElement.h: + (StyledElement): + +2012-09-15 Kalev Lember <kalevlember@gmail.com> + + [GTK] Include missing header files in the tarball + https://bugs.webkit.org/show_bug.cgi?id=96860 + + Reviewed by Kentaro Hara. + + Build fix; dist two additional headers that are needed for building on + Windows platform. + + * GNUmakefile.list.am: + +2012-09-15 Michael Saboff <msaboff@apple.com> + + Add 8 bit handling to SpaceSplitString + https://bugs.webkit.org/show_bug.cgi?id=96823 + + Reviewed by Sam Weinig. + + Added templated functions based on character type to handle 8 and 16 bit string data. + + * dom/SpaceSplitString.cpp: + (WebCore::hasNonASCIIOrUpper): + (WebCore::SpaceSplitStringData::createVector): + * dom/SpaceSplitString.h: + (SpaceSplitStringData): + +2012-09-15 Dan Bernstein <mitz@apple.com> + + REGRESSION (r125578): The monospace code path in RenderText::widthFromCache disagrees with Font::width on word spacing + https://bugs.webkit.org/show_bug.cgi?id=96869 + + Reviewed by Eric Seidel. + + Test: fast/text/word-space-monospace.html + This also fixes fast/css/word-spacing-characters.html + + * rendering/RenderText.cpp: + (WebCore::RenderText::widthFromCache): Made the conditions for adding word spacing match the + ones in WidthIterator. + +2012-09-15 Dan Bernstein <mitz@apple.com> + + REGRESSION (r125578): Word spacing not applied to newline and tab characters that are treated as spaces + https://bugs.webkit.org/show_bug.cgi?id=96865 + + Reviewed by Sam Weinig. + + Fixes fast/css/word-space-extra.html. + + * platform/graphics/WidthIterator.cpp: + (WebCore::WidthIterator::advanceInternal): Changed back to apply word spacing to all characters + that are treated as spaces, except for tab characters when there are tab stops. + * platform/graphics/mac/ComplexTextController.cpp: + (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Ditto. + +2012-09-15 Dan Bernstein <mitz@apple.com> + + REGRESSION (r125578): The Mac complex text code path disagrees with the fast path on word spacing + https://bugs.webkit.org/show_bug.cgi?id=96857 + + Reviewed by Anders Carlsson. + + Fixes the following tests when run with run-webkit-tests --complex-text: + css2.1/20110323/c541-word-sp-001.htm + css2.1/20110323/word-spacing-remove-space-002.htm + css2.1/20110323/word-spacing-remove-space-003.htm + css2.1/20110323/word-spacing-remove-space-004.htm + css2.1/20110323/word-spacing-remove-space-005.htm + css2.1/20110323/word-spacing-remove-space-006.htm + + Fixes fast/css/word-spacing-characters-complex-text.html + + * platform/graphics/mac/ComplexTextController.cpp: + (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Made the conditions for adding + word spacing match the ones in WidthIterator again. + +2012-09-15 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r128669. + http://trac.webkit.org/changeset/128669 + https://bugs.webkit.org/show_bug.cgi?id=96637 + + Broke http/tests/workers/text-encoding.html on Chromium Linux (dbg) + + * bindings/v8/DOMData.cpp: + (WebCore::DOMData::getCurrentStore): + * bindings/v8/ScopedPersistent.h: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::resetIsolatedWorlds): + (WebCore::ScriptController::evaluateInIsolatedWorld): + (WebCore::ScriptController::currentWorldContext): + * bindings/v8/V8Binding.cpp: + (WebCore::perContextDataForCurrentWorld): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::setIsolatedWorldField): + (WebCore::V8DOMWindowShell::enteredIsolatedWorldContext): + (WebCore::V8DOMWindowShell::destroyIsolatedShell): + (WebCore): + (WebCore::isolatedContextWeakCallback): + (WebCore::V8DOMWindowShell::disposeContext): + (WebCore::V8DOMWindowShell::initializeIfNeeded): + (WebCore::V8DOMWindowShell::setIsolatedWorldSecurityOrigin): + * bindings/v8/V8DOMWindowShell.h: + (V8DOMWindowShell): + (WebCore::V8DOMWindowShell::getEntered): + * bindings/v8/V8DOMWrapper.h: + (WebCore::V8DOMWrapper::getCachedWrapper): + * bindings/v8/WorldContextHandle.cpp: + (WebCore::WorldContextHandle::WorldContextHandle): + * bindings/v8/custom/V8DocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8SVGDocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp: + (WebCore::V8XMLHttpRequest::constructorCallback): + +2012-09-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r128673. + http://trac.webkit.org/changeset/128673 + https://bugs.webkit.org/show_bug.cgi?id=96847 + + Makes plugins/document-open.html crash (Requested by jamesr_ + on #webkit). + + * dom/ContainerNode.cpp: + (WebCore): + (WebCore::ContainerNode::insertBeforeCommon): + (WebCore::ContainerNode::replaceChild): + (WebCore::ContainerNode::removeBetween): + (WebCore::ContainerNode::removeChildren): + (WebCore::ContainerNode::appendChild): + (WebCore::ContainerNode::parserAddChild): + (WebCore::dispatchChildInsertionEvents): + (WebCore::dispatchChildRemovalEvents): + * dom/ContainerNode.h: + * dom/ContainerNodeAlgorithms.h: + (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree): + (WebCore::ChildNodeInsertionNotifier::notify): + (WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromTree): + * dom/Document.cpp: + (WebCore::Document::dispatchWindowEvent): + (WebCore::Document::dispatchWindowLoadEvent): + * dom/EventDispatcher.cpp: + (WebCore::EventDispatcher::dispatchEvent): + * dom/EventTarget.cpp: + (WebCore): + (WebCore::forbidEventDispatch): + (WebCore::allowEventDispatch): + (WebCore::eventDispatchForbidden): + (WebCore::EventTarget::fireEventListeners): + * dom/EventTarget.h: + (WebCore): + (WebCore::forbidEventDispatch): + (WebCore::allowEventDispatch): + * dom/Node.cpp: + (WebCore::Node::dispatchSubtreeModifiedEvent): + (WebCore::Node::dispatchFocusInEvent): + (WebCore::Node::dispatchFocusOutEvent): + (WebCore::Node::dispatchDOMActivateEvent): + * dom/WebKitNamedFlow.cpp: + (WebCore::WebKitNamedFlow::dispatchRegionLayoutUpdateEvent): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::loadInternal): + +2012-09-14 Julien Chaffraix <jchaffraix@webkit.org> + + Revert r127457 and following fixes due to several hit-testing regressions + https://bugs.webkit.org/show_bug.cgi?id=96830 + + Reviewed by Antonio Gomes. + + This change reverts r127457, r127863 and r128505. + + * WebCore.exp.in: + * WebCore.order: + * dom/Document.cpp: + (WebCore::Document::nodesFromRect): + * dom/Document.h: + (Document): + * page/EventHandler.cpp: + (WebCore::EventHandler::hitTestResultAtPoint): + * rendering/HitTestRequest.h: + * rendering/HitTestResult.cpp: + (WebCore::HitTestLocation::HitTestLocation): + * rendering/HitTestResult.h: + (HitTestLocation): + * rendering/RenderFrameBase.cpp: + * rendering/RenderFrameBase.h: + (RenderFrameBase): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hitTest): + * testing/Internals.cpp: + (WebCore::Internals::nodesFromRect): + * testing/Internals.h: + (Internals): + * testing/Internals.idl: + +2012-09-14 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Calling close() during upgradeneeded handler should fire error at open request + https://bugs.webkit.org/show_bug.cgi?id=96807 + + Reviewed by Tony Chang. + + Per spec, if the database connection is closed before the success event fires, the request + should have an error event of type AbortError fired at it. + + Test: storage/indexeddb/intversion-close-in-upgradeneeded.html + + * Modules/indexeddb/IDBDatabase.h: + (WebCore::IDBDatabase::isClosePending): Expose this state so an in-flight success can be morphed. + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::close): Fire the appropriate error at connections that are mid-opening. + * Modules/indexeddb/IDBOpenDBRequest.cpp: + (WebCore::IDBOpenDBRequest::onSuccess): If the connection was closed before the success is enqueued - + which can happen in multi-process ports with asynchronous messaging - convert the success to an error. + +2012-09-14 Ryosuke Niwa <rniwa@webkit.org> + + Turn forbidEventDispatch and allowEventDispatch into a RAII object + https://bugs.webkit.org/show_bug.cgi?id=96717 + + Reviewed by Abhishek Arya. + + Replaced forbidEventDispatch and allowEventDispatch by AssertNoEventDispatch. + + * dom/ContainerNode.cpp: + (WebCore): + (WebCore::ContainerNode::insertBeforeCommon): + (WebCore::ContainerNode::replaceChild): + (WebCore::ContainerNode::removeBetween): + (WebCore::ContainerNode::removeChildren): + (WebCore::ContainerNode::appendChild): + (WebCore::ContainerNode::parserAddChild): + (WebCore::dispatchChildInsertionEvents): + (WebCore::dispatchChildRemovalEvents): + * dom/ContainerNode.h: + (AssertNoEventDispatch): + (WebCore::AssertNoEventDispatch::AssertNoEventDispatch): + (WebCore::AssertNoEventDispatch::~AssertNoEventDispatch): + (WebCore::AssertNoEventDispatch::isEventDispatchForbidden): + (WebCore): + * dom/ContainerNodeAlgorithms.h: + (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree): + (WebCore::ChildNodeInsertionNotifier::notify): + (WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromTree): + * dom/Document.cpp: + (WebCore::Document::dispatchWindowEvent): + (WebCore::Document::dispatchWindowLoadEvent): + * dom/EventDispatcher.cpp: + (WebCore::EventDispatcher::dispatchEvent): + * dom/EventTarget.cpp: + (WebCore): + (WebCore::EventTarget::fireEventListeners): + * dom/EventTarget.h: + (WebCore): + * dom/Node.cpp: + (WebCore::Node::dispatchSubtreeModifiedEvent): + (WebCore::Node::dispatchFocusInEvent): + (WebCore::Node::dispatchFocusOutEvent): + (WebCore::Node::dispatchDOMActivateEvent): + * dom/WebKitNamedFlow.cpp: + (WebCore::WebKitNamedFlow::dispatchRegionLayoutUpdateEvent): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::loadInternal): + +2012-09-14 Mike West <mkwst@chromium.org> + + JSC should throw a more descriptive exception when blocking 'eval' via CSP. + https://bugs.webkit.org/show_bug.cgi?id=94331 + + Reviewed by Geoffrey Garen. + + Unless explicitly whitelisted, the 'script-src' Content Security Policy + directive blocks 'eval' and 'eval'-like constructs such as + 'new Function()'. When 'eval' is encountered in code, an 'EvalError' is + thrown, but the associated message is poor: "Eval is disabled" doesn't + give developers enough information about why their code isn't behaving + as expected. + + This patch adds an 'errorMessage' parameter to the JavaScriptCore method + used to disable 'eval'; ContentSecurityPolicy has the opportunity to + pass in a more detailed and descriptive error that contains more context + for the developer. + + The new error message is tested by adjusting existing tests; nothing new + is required. + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::initScript): + Read the error message off the document's ContentSecurityPolicy. + (WebCore::ScriptController::disableEval): + * bindings/js/ScriptController.h: + (ScriptController): + Pipe the error message through to JSGlobalObject when disabling eval + * bindings/js/WorkerScriptController.cpp: + (WebCore::WorkerScriptController::disableEval): + * bindings/js/WorkerScriptController.h: + (WorkerScriptController): + Pipe the error message through to JSGlobalObject when disabling eval + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::disableEval): + * bindings/v8/ScriptController.h: + (ScriptController): + * bindings/v8/WorkerScriptController.cpp: + (WebCore::WorkerScriptController::disableEval): + * bindings/v8/WorkerScriptController.h: + (WorkerScriptController): + Placeholder for V8 piping to be built in webk.it/94332. + * dom/Document.cpp: + (WebCore::Document::disableEval): + * dom/Document.h: + (Document): + * dom/ScriptExecutionContext.h: + (ScriptExecutionContext): + Pipe the error message through to the ScriptController when + disabling eval. + * page/ContentSecurityPolicy.cpp: + (WebCore::CSPDirectiveList::evalDisabledErrorMessage): + Accessor for the error message that ought be displayed to developers + when 'eval' used while disabled for a specific directive list. + (WebCore::CSPDirectiveList::setEvalDisabledErrorMessage): + Mutator for the error message that ought be displayed to developers + when 'eval' used while disabled for a specific directive list. + (CSPDirectiveList): + (WebCore::CSPDirectiveList::create): + Upon creation of a CSPDirectiveList, set the error message if the + directive list disables 'eval'. + (WebCore::ContentSecurityPolicy::didReceiveHeader): + Pass the error message into ScriptExecutionContext::disableEval. + (WebCore::ContentSecurityPolicy::evalDisabledErrorMessage): + Public accessor for the policy's error message; walks the list of + directive lists and returns the first error message found. + (WebCore): + * page/ContentSecurityPolicy.h: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::disableEval): + * workers/WorkerContext.h: + (WorkerContext): + Pipe the error message through to the ScriptController when + disabling eval. + +2012-09-14 Dan Carney <dcarney@google.com> + + Remove V8DOMWindowShell::getEntered + https://bugs.webkit.org/show_bug.cgi?id=96637 + + Reviewed by Adam Barth. + + V8DOMWindowShell::getEntered was refactored so that the window shell + no longer has to be kept alive by a v8 context but rather a smaller + object. + + No new tests. No change in functionality. + + * bindings/v8/DOMData.cpp: + (WebCore::DOMData::getCurrentStore): + * bindings/v8/ScopedPersistent.h: + (WebCore::ScopedPersistent::leakHandle): + (ScopedPersistent): + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::resetIsolatedWorlds): + (WebCore::ScriptController::evaluateInIsolatedWorld): + (WebCore::ScriptController::currentWorldContext): + * bindings/v8/V8Binding.cpp: + (WebCore::perContextDataForCurrentWorld): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::setIsolatedWorldField): + (WebCore::V8DOMWindowShell::toIsolatedContextData): + (WebCore::isolatedContextWeakCallback): + (WebCore::V8DOMWindowShell::disposeContext): + (WebCore::V8DOMWindowShell::clearIsolatedShell): + (WebCore): + (WebCore::V8DOMWindowShell::initializeIfNeeded): + (WebCore::V8DOMWindowShell::setIsolatedWorldSecurityOrigin): + * bindings/v8/V8DOMWindowShell.h: + (V8DOMWindowShell): + (IsolatedContextData): + (WebCore::V8DOMWindowShell::IsolatedContextData::create): + (WebCore::V8DOMWindowShell::IsolatedContextData::world): + (WebCore::V8DOMWindowShell::IsolatedContextData::perContextData): + (WebCore::V8DOMWindowShell::IsolatedContextData::setSecurityOrigin): + (WebCore::V8DOMWindowShell::IsolatedContextData::securityOrigin): + (WebCore::V8DOMWindowShell::IsolatedContextData::IsolatedContextData): + (WebCore::V8DOMWindowShell::enteredIsolatedContext): + (WebCore::V8DOMWindowShell::enteredIsolatedContextData): + * bindings/v8/V8DOMWrapper.h: + (WebCore::V8DOMWrapper::getCachedWrapper): + * bindings/v8/WorldContextHandle.cpp: + (WebCore::WorldContextHandle::WorldContextHandle): + * bindings/v8/custom/V8DocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8SVGDocumentCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp: + (WebCore::V8XMLHttpRequest::constructorCallback): + +2012-09-14 Michelangelo De Simone <michelangelo@webkit.org> + + [CSS Shaders] u_textureSize uniform should be set to the size of the texture. + https://bugs.webkit.org/show_bug.cgi?id=95914 + + Reviewed by Dean Jackson. + + This adds support for the following shader uniform variables: + + uniform vec2 u_textureSize + uniform vec4 u_meshBox + uniform vec2 u_tileSize + uniform vec2 u_meshSize + + The relevant section of the specification is: + http://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#shader-uniform-variables + + Tests: css3/filters/custom/custom-filter-u-mesh-box.html + css3/filters/custom/custom-filter-u-mesh-size.html + css3/filters/custom/custom-filter-u-texture-size.html + css3/filters/custom/custom-filter-u-tile-size.html + + * platform/graphics/filters/FECustomFilter.cpp: + (WebCore::FECustomFilter::bindProgramAndBuffers): + +2012-09-14 Ojan Vafai <ojan@chromium.org> + + Provide a runtime setting to disable position:sticky + https://bugs.webkit.org/show_bug.cgi?id=96827 + + Reviewed by James Robinson. + + Have it be on by default so that only ports that both enable + the define and don't want it on by default need to do something special. + + * css/CSSParser.cpp: + (WebCore::CSSParserContext::CSSParserContext): + (WebCore::operator==): + (WebCore::isValidKeywordPropertyAndValue): + * css/CSSParserMode.h: + (CSSParserContext): + * dom/Document.cpp: + (WebCore::Document::cssStickyPositionEnabled): + (WebCore): + * dom/Document.h: + (Document): + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (Settings): + (WebCore::Settings::setCSSStickyPositionEnabled): + (WebCore::Settings::cssStickyPositionEnabled): + +2012-09-14 Simon Fraser <simon.fraser@apple.com> + + Fix builds with CSS_IMAGE_RESOLUTION enabled after r128656. + + * css/StyleBuilder.cpp: + (WebCore::ApplyPropertyImageResolution::applyInheritValue): + (WebCore::ApplyPropertyImageResolution::applyInitialValue): + +2012-09-14 Adam Barth <abarth@webkit.org> + + Remove webkitPostMessage + https://bugs.webkit.org/show_bug.cgi?id=96577 + + Reviewed by Ojan Vafai. + + webkitPostMessage works the same as postMessage. The spec and the + implementation have been stable for a while. We should no longer be + exposing this vendor-prefixed API. + + This patch places the webkitPostMessage API behind an ENABLE flag. + We're going to try removing this API in the Chromium port. If we don't + run into trouble, we'll remove it in all the other ports as well. + + This topic has been discussed on webkit-dev in + http://lists.webkit.org/pipermail/webkit-dev/2012-April/020237.html and + http://lists.webkit.org/pipermail/webkit-dev/2012-September/022189.html + + This patch introduces the ENABLE(LEGACY_VENDOR_PREFIXES) flag. Rather + than having a flag for each vendor-prefixed API we're experimenting + with removing, we'll add vendor prefixed APIs to this ENABLE when we + want to try removing them. If we succeed, we'll just delete the APIs. + If we fail, we'll remove them from the ENABLE. That way we avoid the + churn of adding and removing many ENABLE macros. + + * Configurations/FeatureDefines.xcconfig: + * GNUmakefile.am: + * GNUmakefile.features.am: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore): + * bindings/js/JSDedicatedWorkerContextCustom.cpp: + (WebCore): + * bindings/js/JSMessagePortCustom.cpp: + (WebCore): + * bindings/js/JSWorkerCustom.cpp: + (WebCore): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore): + * bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp: + (WebCore): + * bindings/v8/custom/V8MessagePortCustom.cpp: + (WebCore): + * bindings/v8/custom/V8WorkerCustom.cpp: + (WebCore): + * dom/MessagePort.idl: + * page/DOMWindow.idl: + * workers/DedicatedWorkerContext.idl: + * workers/Worker.idl: + +2012-09-14 Simon Fraser <simon.fraser@apple.com> + + REGRESSION: transition doesn’t always override transition-property + https://bugs.webkit.org/show_bug.cgi?id=96658 + + Reviewed by Dean Jackson. + + Setting the animation property on an Animation in CSSToStyleMap::mapAnimationProperty() + is special because we have to call setAnimationMode(Animation::AnimateAll) as well + as setting the property to CSSPropertyInvalid if it's for the initial state + of the transition-property property. + + In order to fix this via StyleBuilder PropertyHandlers, we have to know, + in ApplyPropertyAnimation::applyInitialValue(), which property is getting applied. + This requires passing the CSSPropertyID down through all of the "apply" methods. + + Do some unrelated cleanup in CSSParser::parseTransitionShorthand(); the existing code + was not safe with respect to adding new properties to the shorthand. + + Test: transitions/longhand-vs-shorthand-initial.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseTransitionShorthand): + * css/StyleBuilder.cpp: + (WebCore::ApplyPropertyExpanding::applyInheritValue): + (WebCore::ApplyPropertyExpanding::applyInitialValue): + (WebCore::ApplyPropertyExpanding::applyValue): + (WebCore::ApplyPropertyDefaultBase::applyInheritValue): + (WebCore::ApplyPropertyDefaultBase::applyInitialValue): + (WebCore::ApplyPropertyDefaultBase::applyValue): + (WebCore::ApplyPropertyDefault::applyValue): + (WebCore::ApplyPropertyNumber::applyValue): + (WebCore::ApplyPropertyStyleImage::applyValue): + (WebCore::ApplyPropertyAuto::applyInheritValue): + (WebCore::ApplyPropertyAuto::applyInitialValue): + (WebCore::ApplyPropertyAuto::applyValue): + (WebCore::ApplyPropertyClip::applyInheritValue): + (WebCore::ApplyPropertyClip::applyInitialValue): + (WebCore::ApplyPropertyClip::applyValue): + (WebCore::ApplyPropertyColor::applyInheritValue): + (WebCore::ApplyPropertyColor::applyInitialValue): + (WebCore::ApplyPropertyColor::applyValue): + (WebCore::ApplyPropertyDirection::applyValue): + (WebCore::ApplyPropertyLength::applyValue): + (WebCore::ApplyPropertyString::applyValue): + (WebCore::ApplyPropertyBorderRadius::applyValue): + (WebCore::ApplyPropertyFillLayer::applyInheritValue): + (WebCore::ApplyPropertyFillLayer::applyInitialValue): + (WebCore::ApplyPropertyFillLayer::applyValue): + (WebCore::ApplyPropertyComputeLength::applyValue): + (WebCore::ApplyPropertyFont::applyInheritValue): + (WebCore::ApplyPropertyFont::applyInitialValue): + (WebCore::ApplyPropertyFont::applyValue): + (WebCore::ApplyPropertyFontSize::applyInheritValue): + (WebCore::ApplyPropertyFontSize::applyInitialValue): + (WebCore::ApplyPropertyFontSize::applyValue): + (WebCore::ApplyPropertyFontWeight::applyValue): + (WebCore::ApplyPropertyFontVariantLigatures::applyInheritValue): + (WebCore::ApplyPropertyFontVariantLigatures::applyInitialValue): + (WebCore::ApplyPropertyFontVariantLigatures::applyValue): + (WebCore::ApplyPropertyBorderImage::applyValue): + (WebCore::ApplyPropertyBorderImageModifier::applyInheritValue): + (WebCore::ApplyPropertyBorderImageModifier::applyInitialValue): + (WebCore::ApplyPropertyBorderImageModifier::applyValue): + (WebCore::ApplyPropertyBorderImageSource::applyValue): + (WebCore::ApplyPropertyCounter::emptyFunction): + (WebCore::ApplyPropertyCounter::applyInheritValue): + (WebCore::ApplyPropertyCounter::applyValue): + (WebCore::ApplyPropertyCursor::applyInheritValue): + (WebCore::ApplyPropertyCursor::applyInitialValue): + (WebCore::ApplyPropertyCursor::applyValue): + (WebCore::ApplyPropertyTextAlign::applyValue): + (WebCore::ApplyPropertyTextDecoration::applyValue): + (WebCore::ApplyPropertyLineHeight::applyValue): + (WebCore::ApplyPropertyPageSize::applyInheritValue): + (WebCore::ApplyPropertyPageSize::applyInitialValue): + (WebCore::ApplyPropertyPageSize::applyValue): + (WebCore::ApplyPropertyTextEmphasisStyle::applyInheritValue): + (WebCore::ApplyPropertyTextEmphasisStyle::applyInitialValue): + (WebCore::ApplyPropertyTextEmphasisStyle::applyValue): + (WebCore::ApplyPropertyAnimation::applyInheritValue): + (WebCore::ApplyPropertyAnimation::applyInitialValue): If the property is + CSSPropertyWebkitTransitionProperty, call setAnimationMode(Animation::AnimateAll). + (WebCore::ApplyPropertyAnimation::applyValue): + (WebCore::ApplyPropertyOutlineStyle::applyInheritValue): + (WebCore::ApplyPropertyOutlineStyle::applyInitialValue): + (WebCore::ApplyPropertyOutlineStyle::applyValue): + (WebCore::ApplyPropertyResize::applyValue): + (WebCore::ApplyPropertyVerticalAlign::applyValue): + (WebCore::ApplyPropertyAspectRatio::applyInheritValue): + (WebCore::ApplyPropertyAspectRatio::applyInitialValue): + (WebCore::ApplyPropertyAspectRatio::applyValue): + (WebCore::ApplyPropertyZoom::applyInheritValue): + (WebCore::ApplyPropertyZoom::applyInitialValue): + (WebCore::ApplyPropertyZoom::applyValue): + (WebCore::ApplyPropertyDisplay::applyInheritValue): + (WebCore::ApplyPropertyDisplay::applyInitialValue): + (WebCore::ApplyPropertyDisplay::applyValue): + (WebCore::ApplyPropertyClipPath::applyValue): + (WebCore::ApplyPropertyWrapShape::applyValue): + (WebCore::ApplyPropertyImageResolution::applyInheritValue): + (WebCore::ApplyPropertyImageResolution::applyInitialValue): + (WebCore::ApplyPropertyImageResolution::applyValue): + * css/StyleBuilder.h: + (PropertyHandler): + (WebCore::PropertyHandler::applyInheritValue): + (WebCore::PropertyHandler::applyInitialValue): + (WebCore::PropertyHandler::applyValue): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): Pass in the property ID. + +2012-09-14 Chang Shu <cshu@webkit.org> + + Support constructor-type attribute in idls other than DOMWindow. + https://bugs.webkit.org/show_bug.cgi?id=96821 + + Reviewed by Kentaro Hara. + + In CodeGeneratorJS.pm, we should not assume only DOMWindow uses Constructor + attribute. So for other interfaces, we should pass castedThis->globalObject() + instead of castedThis. + + Test: bindings/scripts/test/JS/JSTestObj.idl + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjConstructorTestSubObj): + (WebCore::jsTestObjConditionalAttr4Constructor): + (WebCore::jsTestObjConditionalAttr5Constructor): + (WebCore::jsTestObjConditionalAttr6Constructor): + +2012-09-14 Tom Sepez <tsepez@chromium.org> + + ImageLoader can't be cleared when video element poster attribute removed. + https://bugs.webkit.org/show_bug.cgi?id=96301 + + Reviewed by Abhishek Arya. + + Same problem as in https://bugs.webkit.org/show_bug.cgi?id=90801. We can't + clear the image loader when the src attribute is cleared, because we might be + inside a handler called on top of an image loader event dispatch. Instead we + will rely on the OwnPtr relationship between the Element and the Image Loader + to limit the lifetime of the loader to that of the element. + + Test: fast/dom/beforeload/clear-video-poster-in-beforeload-listener.html + + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::parseAttribute): + Remove permature clearing of m_imageLoader. + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::parseAttribute): + Remove permature clearing of m_imageLoader. + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::parseAttribute): + Remove permature clearing of m_imageLoader. + +2012-09-14 Jeffrey Pfau <jpfau@apple.com> + + Allow third-party storage blocking setting to change while a page is loaded + https://bugs.webkit.org/show_bug.cgi?id=95790 + + Reviewed by Brady Eidson. + + Pipe through changes to the storage blocking policy to each document and plugin. + + Tests: http/tests/security/storage-blocking-loosened-local-storage.html + http/tests/security/storage-blocking-loosened-plugin.html + http/tests/security/storage-blocking-loosened-private-browsing-plugin.html + http/tests/security/storage-blocking-loosened-shared-worker.html + http/tests/security/storage-blocking-loosened-websql.html + http/tests/security/storage-blocking-strengthened-local-storage.html + http/tests/security/storage-blocking-strengthened-plugin.html + http/tests/security/storage-blocking-strengthened-private-browsing-plugin.html + http/tests/security/storage-blocking-strengthened-shared-worker.html + http/tests/security/storage-blocking-strengthened-websql.html + + * WebCore.exp.in: + * dom/Document.cpp: Pipe changes through to the Document's SecurityOrigin. + (WebCore::Document::storageBlockingStateDidChange): + (WebCore): + * dom/Document.h: + (Document): + * page/DOMWindow.cpp: Check to make sure access is allowed before returning a cached storage area. + (WebCore::DOMWindow::sessionStorage): + (WebCore::DOMWindow::localStorage): + * page/Page.cpp: + (WebCore::Page::collectPluginViews): Refactored out into a function. + (WebCore): + (WebCore::Page::storageBlockingStateChanged): Pipe changes through to each PluginView. + (WebCore::Page::privateBrowsingStateChanged): + * page/Page.h: + (Page): + * page/Settings.cpp: + (WebCore::Settings::setStorageBlockingPolicy): Tell Pages about changes to the storage blocking policy. + (WebCore): + * page/Settings.h: + (Settings): + * plugins/PluginViewBase.h: + (WebCore::PluginViewBase::storageBlockingStateChanged): + +2012-09-14 Dan Carney <dcarney@google.com> + + Prevent workers from calling back into other worlds + https://bugs.webkit.org/show_bug.cgi?id=96790 + + Reviewed by Adam Barth. + + Added a few sanity checks to ensure callbacks are always using the correct world. + + No new tests. No new change in functionality. + + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::getEventListener): + * bindings/v8/V8LazyEventListener.cpp: + (WebCore::V8LazyEventListener::prepareListenerObject): + * bindings/v8/WorldContextHandle.cpp: + (WebCore::WorldContextHandle::WorldContextHandle): + (WebCore::WorldContextHandle::adjustedContext): + * bindings/v8/WorldContextHandle.h: + +2012-09-14 Dana Jansens <danakj@chromium.org> + + Minimize collisions when hashing pairs + https://bugs.webkit.org/show_bug.cgi?id=96022 + + Reviewed by Adrienne Walker. + + Use WTF::pairIntHash() to hash pairs of integers. + + * dom/Document.cpp: + (WebCore::ImmutableAttributeDataCacheKey::hash): + * dom/StyledElement.cpp: + (WebCore::computePresentationAttributeCacheHash): + * platform/graphics/Gradient.cpp: + (WebCore::Gradient::hash): + * platform/graphics/IntPointHash.h: + (WTF::IntPointHash::hash): + * platform/graphics/IntRectHash.h: + * platform/graphics/IntSizeHash.h: + * platform/graphics/blackberry/LayerTileIndex.h: + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::SubimageCacheHash::hash): + +2012-09-14 Rob Buis <rbuis@rim.com> + + [BlackBerry] Use StringBuilder more in BlackBerry RSS classes + https://bugs.webkit.org/show_bug.cgi?id=96820 + + Reviewed by Antonio Gomes. + + Use append/appendLiteral where possible. + + * platform/MIMETypeRegistry.cpp: + (WebCore::mimeTypeAssociationMap): + * platform/network/blackberry/rss/RSSAtomParser.cpp: + (WebCore::RSSAtomParser::parseContent): + (WebCore::RSSAtomParser::parseAuthor): + * platform/network/blackberry/rss/RSSGenerator.cpp: + (WebCore::RSSGenerator::generateHtml): + * platform/network/blackberry/rss/RSSParserBase.cpp: + (WebCore::textFromXMLAttr): + (WebCore::textFromXMLNode): + +2012-09-14 Alexandru Chiculita <achicu@adobe.com> + + [CSS Shaders] Enable anti-aliasing on the FECustomFilter + https://bugs.webkit.org/show_bug.cgi?id=96668 + + Reviewed by Dean Jackson. + + Added multisample frame buffer for the FECustomFilter. It will try to allocate a multisample framebuffer + with a maximum sample count of 4. At the end it will blit the samples back to the original frame buffer, + so that we can read the pixels back. + + This patch uses extensions GL_ANGLE_framebuffer_multisample, GL_ANGLE_framebuffer_blit + and GL_OES_rgb8_rgba8. + + No new tests, multisampling is not working in Chromium DRT and has not pixel effect on WebKit Mac. + + * platform/graphics/filters/FECustomFilter.cpp: + (WebCore::FECustomFilter::FECustomFilter): + (WebCore::FECustomFilter::deleteRenderBuffers): + (WebCore): + (WebCore::FECustomFilter::deleteMultisampleRenderBuffers): + (WebCore::FECustomFilter::drawFilterMesh): + (WebCore::FECustomFilter::createMultisampleBuffer): + (WebCore::FECustomFilter::resolveMultisampleBuffer): + (WebCore::FECustomFilter::canUseMultisampleBuffers): + (WebCore::FECustomFilter::resizeMultisampleBuffers): + (WebCore::FECustomFilter::resizeContext): + * platform/graphics/filters/FECustomFilter.h: + +2012-09-14 Bo Liu <boliu@chromium.org> + + Add in-place reload behavior to ImagesEnabled setting + https://bugs.webkit.org/show_bug.cgi?id=95478 + + Reviewed by Adam Barth. + + Store ImagesEnabled setting in CachedResourceLoader similar to + AutoLoadImages. Move FrameLoaderClient::allowImage to after a + CachedImage has been created and store the cache for reload if it is + blocked. + + Make sure when image loads are deferred by either ImagesEnabled or + LoadImagesAutomatically, onload is not called. + + Added ImagesEnabled to InternalSettings for layout tests. + + Tests: fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html + fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html + + * WebCore.exp.in: + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::didBeginDocument): + * loader/SubresourceLoader.cpp: + (WebCore::SubresourceLoader::willSendRequest): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::load): + * loader/cache/CachedImage.h: + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::didAddClient): + * loader/cache/CachedResource.h: + (WebCore::CachedResource::stillNeedsLoad): + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::CachedResourceLoader): + (WebCore::CachedResourceLoader::requestImage): + (WebCore::CachedResourceLoader::canRequest): + (WebCore::CachedResourceLoader::determineRevalidationPolicy): + (WebCore::CachedResourceLoader::setAutoLoadImages): + (WebCore): + (WebCore::CachedResourceLoader::setImagesEnabled): + (WebCore::CachedResourceLoader::shouldDeferImageLoad): + (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred): + * loader/cache/CachedResourceLoader.h: + (CachedResourceLoader): + (WebCore::CachedResourceLoader::imagesEnabled): + * page/Settings.cpp: + (WebCore::setImageLoadingSettings): + (WebCore::Settings::Settings): + (WebCore::Settings::setLoadsImagesAutomatically): + (WebCore::Settings::imageLoadingSettingsTimerFired): + (WebCore::Settings::setImagesEnabled): + * page/Settings.h: + (Settings): + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::setImagesEnabled): + (WebCore): + * testing/InternalSettings.h: + (InternalSettings): + * testing/InternalSettings.idl: + +2012-09-14 Emil A Eklund <eae@chromium.org> + + https://bugs.webkit.org/show_bug.cgi?id=96226 + REGRESSION (r128006): Three spatial navigation tests are failing + + Reviewed by Ryosuke Niwa. + + Fix spatial navigation regression by reverting parts of r128006. + Specifically the change to remove the overridden boundingBox + method in ContainerNode. + + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::getUpperLeftCorner): + (WebCore): + (WebCore::ContainerNode::getLowerRightCorner): + (WebCore::ContainerNode::boundingBox): + * dom/ContainerNode.h: + (ContainerNode): + +2012-09-14 James Robinson <jamesr@chromium.org> + + Unreviewed, rolling out r128627. + http://trac.webkit.org/changeset/128627 + https://bugs.webkit.org/show_bug.cgi?id=96575 + + Breaks indexeddb content_browsertests in chromium + + * Modules/indexeddb/IDBDatabase.cpp: + (WebCore::IDBDatabase::IDBDatabase): + (WebCore::IDBDatabase::setVersion): + * Modules/indexeddb/IDBDatabase.h: + (IDBDatabase): + +2012-09-14 Alexandru Chiculita <achicu@adobe.com> + + [CSS Shaders] Refactor FECustomFilter to make it usable from platform dependent implementations + https://bugs.webkit.org/show_bug.cgi?id=96801 + + Reviewed by Dean Jackson. + + I've refactored the FECustomFilter to allow FECustomFilterSkia.cpp to use the rendering part + from outside. + + Also removed the Texture class as it is not available on some platforms. + + The changes for Skia will land in a different patch: + https://bugs.webkit.org/show_bug.cgi?id=96579 + + No new tests, the existing custom filters tests should already cover this. + + * platform/graphics/filters/CustomFilterGlobalContext.cpp: + (WebCore::CustomFilterGlobalContext::prepareContextIfNeeded): + * platform/graphics/filters/FECustomFilter.cpp: + (WebCore::FECustomFilter::FECustomFilter): + (WebCore::FECustomFilter::deleteRenderBuffers): + (WebCore::FECustomFilter::drawFilterMesh): + (WebCore): + (WebCore::FECustomFilter::prepareForDrawing): + (WebCore::FECustomFilter::programNeedsInputTexture): + (WebCore::FECustomFilter::applyShader): + (WebCore::FECustomFilter::initializeContext): + (WebCore::FECustomFilter::ensureInputTexture): + (WebCore::FECustomFilter::uploadInputTexture): + (WebCore::FECustomFilter::ensureFrameBuffer): + (WebCore::FECustomFilter::resizeContextIfNeeded): + (WebCore::FECustomFilter::resizeContext): + (WebCore::FECustomFilter::bindProgramAndBuffers): + * platform/graphics/filters/FECustomFilter.h: + (FECustomFilter): + +2012-09-14 Alexey Proskuryakov <ap@apple.com> + + REGRESSION(r126717): It made inspector/styles/media-queries.html fail/flakey + https://bugs.webkit.org/show_bug.cgi?id=95070 + + Roll out r126717, and another change that depends on it. + r126717: Remove parent pointer from StyleSheetContents and StyleRuleImport + r127123: Cache and share parsed imported stylesheets + + * css/CSSImportRule.cpp: + * css/CSSImportRule.h: + * css/CSSStyleSheet.cpp: + (WebCore::CSSStyleSheet::willMutateRules): + (WebCore::CSSStyleSheet::reattachChildRuleCSSOMWrappers): + (WebCore::CSSStyleSheet::insertRule): + (WebCore::CSSStyleSheet::ownerDocument): + * css/CSSStyleSheet.h: + (WebCore::CSSStyleSheet::clearOwnerRule): + * css/StyleRuleImport.cpp: + (WebCore::StyleRuleImport::StyleRuleImport): + (WebCore::StyleRuleImport::~StyleRuleImport): + (WebCore::StyleRuleImport::setCSSStyleSheet): + (WebCore::StyleRuleImport::isLoading): + (WebCore::StyleRuleImport::requestStyleSheet): + * css/StyleRuleImport.h: + (WebCore::StyleRuleImport::parentStyleSheet): + (WebCore::StyleRuleImport::setParentStyleSheet): + (WebCore::StyleRuleImport::clearParentStyleSheet): + (ImportedStyleSheetClient): + (WebCore::StyleRuleImport::ImportedStyleSheetClient::ImportedStyleSheetClient): + (WebCore::StyleRuleImport::ImportedStyleSheetClient::~ImportedStyleSheetClient): + (WebCore::StyleRuleImport::ImportedStyleSheetClient::setCSSStyleSheet): + * css/StyleSheetContents.cpp: + (WebCore::StyleSheetContents::StyleSheetContents): + (WebCore::StyleSheetContents::isCacheable): + (WebCore::StyleSheetContents::parserAppendRule): + (WebCore::StyleSheetContents::clearRules): + (WebCore::StyleSheetContents::wrapperInsertRule): + (WebCore::StyleSheetContents::wrapperDeleteRule): + (WebCore::StyleSheetContents::parseAuthorStyleSheet): + (WebCore::StyleSheetContents::parseStringAtLine): + (WebCore::StyleSheetContents::checkLoaded): + (WebCore::StyleSheetContents::notifyLoadedSheet): + (WebCore::StyleSheetContents::startLoadingDynamicSheet): + (WebCore::StyleSheetContents::rootStyleSheet): + (WebCore::StyleSheetContents::singleOwnerNode): + (WebCore::StyleSheetContents::singleOwnerDocument): + (WebCore::StyleSheetContents::parentStyleSheet): + * css/StyleSheetContents.h: + (WebCore::StyleSheetContents::create): + (StyleSheetContents): + (WebCore::StyleSheetContents::ownerRule): + (WebCore::StyleSheetContents::clearOwnerRule): + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::parseStyleSheet): + * dom/StyleElement.cpp: + (WebCore::StyleElement::createSheet): + * html/HTMLLinkElement.cpp: + (WebCore::HTMLLinkElement::setCSSStyleSheet): + * loader/cache/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::saveParsedStyleSheet): + +2012-09-14 Ojan Vafai <ojan@chromium.org> + + Simplify some code in RenderBox::computePercentageLogicalHeight + https://bugs.webkit.org/show_bug.cgi?id=96704 + + Reviewed by Tony Chang. + + This is strictly code cleanup. No behavior change. + Also removed some comments that were what comments and/or were + getting stale. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation): + (WebCore): + (WebCore::RenderBox::computePercentageLogicalHeight): + * rendering/RenderBox.h: + (RenderBox): + +2012-09-14 Kent Tamura <tkent@chromium.org> + + Unreviewed, a workaround for a mysterious crash on Apple Windows port. + https://bugs.webkit.org/show_bug.cgi?id=96636 + + * testing/InternalSettings.cpp: + Touch RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled only if + ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) + (WebCore::InternalSettings::Backup::Backup): + (WebCore::InternalSettings::Backup::restoreTo): + (WebCore::InternalSettings::setLangAttributeAwareFormControlUIEnabled): + * testing/InternalSettings.h: + (Backup): + +2012-09-14 David Grogan <dgrogan@chromium.org> + + IndexedDB: Print console warning about setVersion + https://bugs.webkit.org/show_bug.cgi?id=96575 + + Reviewed by Tony Chang. + + setVersion has been out of the spec for almost a year but there are + still a lot of users. + + We show the warning once per database object as an approximation for + once per page. + + No new tests, but 150-something rebaselines. + + * Modules/indexeddb/IDBDatabase.cpp: + (WebCore::IDBDatabase::IDBDatabase): + (WebCore::IDBDatabase::setVersion): + * Modules/indexeddb/IDBDatabase.h: + (IDBDatabase): + +2012-09-14 Michelangelo De Simone <michelangelo@webkit.org> + + Use arrays in shaders + https://bugs.webkit.org/show_bug.cgi?id=95223 + + Reviewed by Dean Jackson. + + Custom Filters' support for array() is introduced. Values within + the array() function will be passed as uniforms to shaders. + + Values within array() are comma-separated; the specification will be + updated accordingly: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18839 + + Test: css3/filters/custom/custom-filter-array.html + + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::valueForCustomFilterArrayParameter): + (WebCore): + (WebCore::valueForCustomFilterParameter): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/StyleResolver.h: + (StyleResolver): + * platform/graphics/filters/CustomFilterArrayParameter.h: Container for array() + parameter values. + (WebCore): + (CustomFilterArrayParameter): + (WebCore::CustomFilterArrayParameter::create): + (WebCore::CustomFilterArrayParameter::size): + (WebCore::CustomFilterArrayParameter::valueAt): + (WebCore::CustomFilterArrayParameter::addValue): + (WebCore::CustomFilterArrayParameter::blend): + (WebCore::CustomFilterArrayParameter::operator==): + (WebCore::CustomFilterArrayParameter::CustomFilterArrayParameter): + * platform/graphics/filters/CustomFilterParameter.h: + * platform/graphics/filters/FECustomFilter.cpp: + (WebCore::FECustomFilter::bindProgramArrayParameters): + (WebCore): + (WebCore::FECustomFilter::bindProgramParameters): + * platform/graphics/filters/FECustomFilter.h: + (WebCore): + (FECustomFilter): + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Remove old cruft from the qmake build system + + Rubber-stamped by Simon Hausmann. + + * DerivedSources.pri: + * Target.pri: + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Make force_static_libs_as_shared work on Mac OS + + We had to move a few LIBS += around that were in the wrong place, + and not caught when everything was just linked into the final + QtWebKit library. + + Reviewed by Simon Hausmann. + + * WebCore.pri: + +2012-09-14 Rick Byers <rbyers@chromium.org> + + Gesture events sent to wrong node when page is scrolled + https://bugs.webkit.org/show_bug.cgi?id=96788 + + Reviewed by Antonio Gomes. + + Adjust the co-ordinate space correctly when doing hit testing for + gesture events (as for all other event handling code here). + + Test: platform/chromium/plugins/gesture-events-scrolled.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleGestureEvent): + 2012-09-14 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> [EFL] Attempt to create a theme for 0 sized element leads to assertion hit diff --git a/Source/WebCore/Configurations/FeatureDefines.xcconfig b/Source/WebCore/Configurations/FeatureDefines.xcconfig index 582fad939..44393b90e 100644 --- a/Source/WebCore/Configurations/FeatureDefines.xcconfig +++ b/Source/WebCore/Configurations/FeatureDefines.xcconfig @@ -96,6 +96,7 @@ ENABLE_LEGACY_NOTIFICATIONS_macosx = $(ENABLE_LEGACY_NOTIFICATIONS_macosx_$(TARG ENABLE_LEGACY_NOTIFICATIONS_macosx_1070 = ; ENABLE_LEGACY_NOTIFICATIONS_macosx_1080 = ENABLE_LEGACY_NOTIFICATIONS; ENABLE_LEGACY_NOTIFICATIONS_macosx_1090 = ENABLE_LEGACY_NOTIFICATIONS; +ENABLE_LEGACY_VENDOR_PREFIXES = ENABLE_LEGACY_VENDOR_PREFIXES; ENABLE_LINK_PREFETCH = ; ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; @@ -140,4 +141,4 @@ ENABLE_WIDGET_REGION_macosx = ENABLE_WIDGET_REGION; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebCore/Configurations/Version.xcconfig b/Source/WebCore/Configurations/Version.xcconfig index bcc13945e..64d233886 100644 --- a/Source/WebCore/Configurations/Version.xcconfig +++ b/Source/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 10; +MINOR_VERSION = 11; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri index 62fed6865..717930c14 100644 --- a/Source/WebCore/DerivedSources.pri +++ b/Source/WebCore/DerivedSources.pri @@ -63,10 +63,6 @@ INJECTED_SCRIPT_SOURCE = $$PWD/inspector/InjectedScriptSource.js INJECTED_SCRIPT_WEBGL_MODULE_SOURCE = $$PWD/inspector/InjectedScriptWebGLModuleSource.js -DEBUGGER_SCRIPT_SOURCE = $$PWD/bindings/v8/DebuggerScript.js - -ARRAY_BUFFER_VIEW_CUSTOM_SCRIPT_SOURCE = $$PWD/bindings/v8/custom/V8ArrayBufferViewCustomScript.js - XPATHBISON = $$PWD/xml/XPathGrammar.y enable?(SVG) { @@ -805,19 +801,6 @@ InjectedScriptWebGLModuleSource.commands = perl $$PWD/inspector/xxd.pl InjectedS InjectedScriptWebGLModuleSource.add_output_to_sources = false GENERATORS += InjectedScriptWebGLModuleSource -# GENERATOR 2-c: inspector debugger script source compiler -debuggerScriptSource.output = DebuggerScriptSource.h -debuggerScriptSource.input = DEBUGGER_SCRIPT_SOURCE -debuggerScriptSource.commands = perl $$PWD/inspector/xxd.pl DebuggerScriptSource_js ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -debuggerScriptSource.add_output_to_sources = false -GENERATORS += debuggerScriptSource - -arrayBufferViewCustomScript.output = V8ArrayBufferViewCustomScript.h -arrayBufferViewCustomScript.input = ARRAY_BUFFER_VIEW_CUSTOM_SCRIPT_SOURCE -arrayBufferViewCustomScript.commands = perl $$PWD/inspector/xxd.pl V8ArrayBufferViewCustomScript_js ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -arrayBufferViewCustomScript.add_output_to_sources = false -GENERATORS += arrayBufferViewCustomScript - # GENERATOR 4: CSS grammar cssbison.output = ${QMAKE_FILE_BASE}.cpp cssbison.input = CSSBISON diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 5bf72de42..fad1f2a67 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -334,6 +334,7 @@ localizedStrings["Record"] = "Record"; localizedStrings["Recording…"] = "Recording…"; localizedStrings["Redirect"] = "Redirect"; localizedStrings["Refresh"] = "Refresh"; +localizedStrings["Region is %s."] = "Region is %s."; localizedStrings["Remove Breakpoint"] = "Remove Breakpoint"; localizedStrings["Remove breakpoint"] = "Remove breakpoint"; localizedStrings["Remove Timer"] = "Remove Timer"; @@ -468,12 +469,16 @@ localizedStrings["\xb1 Size"] = "\xb1 Size"; localizedStrings["border"] = "border"; localizedStrings["content"] = "content"; localizedStrings["deleted"] = "deleted"; +localizedStrings["empty"] = "empty"; +localizedStrings["fit"] = "fit"; localizedStrings["line %d"] = "line %d"; localizedStrings["margin"] = "margin"; localizedStrings["new"] = "new"; localizedStrings["or"] = "or"; +localizedStrings["overset"] = "overset"; localizedStrings["padding"] = "padding"; localizedStrings["position"] = "position"; +localizedStrings["region chain"] = "region chain"; localizedStrings["user agent stylesheet"] = "user agent stylesheet"; localizedStrings["user stylesheet"] = "user stylesheet"; localizedStrings["via inspector"] = "via inspector"; @@ -495,6 +500,7 @@ localizedStrings["Paused on a \"%s\" breakpoint set on %s."] = "Paused on a \"%s localizedStrings["Paused on a XMLHttpRequest."] = "Paused on a XMLHttpRequest."; localizedStrings["Paused on a \"%s\" Event Listener."] = "Paused on a \"%s\" Event Listener."; localizedStrings["Paused on a JavaScript breakpoint."] = "Paused on a JavaScript breakpoint."; +localizedStrings["Paused on a script blocked due to Content Security Policy directive: \"%s\"."] = "Paused on a script blocked due to Content Security Policy directive: \"%s\"."; localizedStrings["URL contains \"%s\""] = "URL contains \"%s\""; localizedStrings["Network"] = "Network"; localizedStrings["Status"] = "Status"; diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index f3eeb36ae..61f2d9ed4 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -120,15 +120,6 @@ webcoregtk_cppflags += \ -I$(srcdir)/Source/WebCore/platform/text/enchant # --- -# Channel mesaging support -# --- -if ENABLE_CHANNEL_MESSAGING -feature_defines_overrides += ENABLE_CHANNEL_MESSAGING=1 -else -feature_defines_overrides += ENABLE_CHANNEL_MESSAGING=0 -endif # END ENABLE_CHANNEL_MESSAGING - -# --- # FreeType font backend # --- if USE_FREETYPE @@ -155,33 +146,6 @@ webcoregtk_cppflags += \ endif # END TARGET_WIN32 # ---- -# HTML Meter Element -# ---- -if ENABLE_METER_ELEMENT -feature_defines_overrides += ENABLE_METER_ELEMENT=1 -else -feature_defines_overrides += ENABLE_METER_ELEMENT=0 -endif # END ENABLE_METER_ELEMENT - -# ---- -# HTML Progress Element -# ---- -if ENABLE_PROGRESS_ELEMENT -feature_defines_overrides += ENABLE_PROGRESS_ELEMENT=1 -else -feature_defines_overrides += ENABLE_PROGRESS_ELEMENT=0 -endif # END ENABLE_PROGRESS_ELEMENT - -# ---- -# JavaScript Debugger/Profiler -# ---- -if ENABLE_JAVASCRIPT_DEBUGGER -feature_defines_overrides += ENABLE_JAVASCRIPT_DEBUGGER=1 -else -feature_defines_overrides += ENABLE_JAVASCRIPT_DEBUGGER=0 -endif # END ENABLE_JAVASCRIPT_DEBUGGER - -# ---- # Gamepad support # --- if ENABLE_GAMEPAD @@ -191,15 +155,6 @@ feature_defines_overrides += ENABLE_GAMEPAD=0 endif # END ENABLE_GAMEPAD # ---- -# Database Support -# ---- -if ENABLE_SQL_DATABASE -feature_defines_overrides += ENABLE_SQL_DATABASE=1 -else -feature_defines_overrides += ENABLE_SQL_DATABASE=0 -endif # END ENABLE_SQL_DATABASE - -# ---- # Indexed Database API support # ---- if ENABLE_INDEXED_DATABASE @@ -213,24 +168,6 @@ webcore_cppflags += -DWTF_USE_LEVELDB endif # END USE_LEVELDB # ---- -# DOM mutation observer support -# ---- -if ENABLE_MUTATION_OBSERVERS -feature_defines_overrides += ENABLE_MUTATION_OBSERVERS=1 -else -feature_defines_overrides += ENABLE_MUTATION_OBSERVERS=0 -endif # END ENABLE_MUTATION_OBSERVERS - -# ---- -# Icon Database Support -# ---- -if ENABLE_ICONDATABASE -feature_defines_overrides += -DENABLE_ICONDATABASE=1 -else -feature_defines_overrides += -DENABLE_ICONDATABASE=0 -endif # END ENABLE_ICONDATABASE - -# ---- # Video Support # ---- if ENABLE_VIDEO @@ -241,19 +178,10 @@ webcore_cppflags += -DGST_DISABLE_DEPRECATED endif # END ENABLE_DEBUG endif # END USE_GSTREAMER else -feature_defines_overrides += ENABLE_VIDEO=0 +feature_defines_overrides += ENABLE_VIDEO=0 ENABLE_VIDEO_TRACK=0 endif # END ENABLE_VIDEO # ---- -# Javascript Fullscreen Support -# ---- -if ENABLE_FULLSCREEN_API -feature_defines_overrides += ENABLE_FULLSCREEN_API=1 -else -feature_defines_overrides += ENABLE_FULLSCREEN_API=0 -endif # END ENABLE_FULLSCREEN_API - -# ---- # Filters # ---- if ENABLE_CSS_FILTERS @@ -263,15 +191,6 @@ feature_defines_overrides += ENABLE_CSS_FILTERS=0 endif # END ENABLE_CSS_FILTERS # ---- -# Track Support -# ---- -if ENABLE_VIDEO_TRACK -feature_defines_overrides += ENABLE_VIDEO_TRACK=1 -else -feature_defines_overrides += ENABLE_VIDEO_TRACK=0 -endif # END ENABLE_VIDEO_TRACK - -# ---- # Media Stream Support # ---- if ENABLE_MEDIA_STREAM @@ -304,33 +223,6 @@ feature_defines_overrides += ENABLE_XSLT=0 endif # END ENABLE_XSLT # ---- -# Web Workers support -# ---- -if ENABLE_WORKERS -feature_defines_overrides += ENABLE_WORKERS=1 -else -feature_defines_overrides += ENABLE_WORKERS=0 -endif - -# --- -# Shadow DOM support -# --- -if ENABLE_SHADOW_DOM -feature_defines_overrides += ENABLE_SHADOW_DOM=1 -else -feature_defines_overrides += ENABLE_SHADOW_DOM=0 -endif - -# --- -# SharedWorker support -# --- -if ENABLE_SHARED_WORKERS -feature_defines_overrides += ENABLE_SHARED_WORKERS=1 -else -feature_defines_overrides += ENABLE_SHARED_WORKERS=0 -endif - -# ---- # Filters # ---- if ENABLE_FILTERS @@ -340,32 +232,6 @@ feature_defines_overrides += ENABLE_FILTERS=0 endif # END ENABLE_FILTERS # ---- -# CSS box decoration break -# ---- -if ENABLE_CSS_BOX_DECORATION_BREAK -feature_defines_overrides += ENABLE_CSS_BOX_DECORATION_BREAK=1 -else -feature_defines_overrides += ENABLE_CSS_BOX_DECORATION_BREAK=0 -endif # END ENABLE_CSS_BOX_DECORATION_BREAK - -# ---- -# Regions -# ---- -if ENABLE_CSS_REGIONS -feature_defines_overrides += ENABLE_CSS_REGIONS=1 -else -feature_defines_overrides += ENABLE_CSS_REGIONS=0 -endif # END ENABLE_CSS_REGIONS - -# ---- -# Exclusions -# ---- -if ENABLE_CSS_EXCLUSIONS -feature_defines_overrides += ENABLE_CSS_EXCLUSIONS=1 -else -feature_defines_overrides += ENABLE_CSS_EXCLUSIONS=0 -endif # END ENABLE_CSS_EXCLUSIONS - # Shaders # ---- if ENABLE_CSS_SHADERS @@ -383,15 +249,6 @@ else feature_defines_overrides += ENABLE_GEOLOCATION=0 endif # END ENABLE_GEOLOCATION -# ---- -# MathML support -# ---- -if ENABLE_MATHML -feature_defines_overrides += ENABLE_MATHML=1 -else -feature_defines_overrides += ENABLE_MATHML=0 -endif # END ENABLE_MATHML - # MathML tag and attribute names, and element factory DerivedSources/WebCore/MathMLElementFactory.h: DerivedSources/WebCore/MathMLElementFactory.cpp DerivedSources/WebCore/MathMLNames.h: DerivedSources/WebCore/MathMLNames.cpp @@ -442,42 +299,6 @@ if USE_WEBAUDIO_GSTREAMER webcore_cppflags += -DWTF_USE_WEBAUDIO_GSTREAMER=1 endif -# ---- -# Web Sockets Support -# ---- -if ENABLE_WEB_SOCKETS -feature_defines_overrides += ENABLE_WEB_SOCKETS=1 -else -feature_defines_overrides += ENABLE_WEB_SOCKETS=0 -endif # END ENABLE_WEB_SOCKETS - -# --- -# Blob support -# --- -if ENABLE_BLOB -feature_defines_overrides += ENABLE_BLOB=1 -else -feature_defines_overrides += ENABLE_BLOB=0 -endif # END ENABLE_BLOB - -# --- -# Legacy WebKitBlobBuilder support -# --- -if ENABLE_LEGACY_WEBKIT_BLOB_BUILDER -feature_defines_overrides += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 -else -feature_defines_overrides += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=0 -endif # END ENABLE_LEGACY_WEBKIT_BLOB_BUILDER - -# --- -# RequestAnimationFrame support -# --- -if ENABLE_REQUEST_ANIMATION_FRAME -feature_defines_overrides += ENABLE_REQUEST_ANIMATION_FRAME=1 -else -feature_defines_overrides += ENABLE_REQUEST_ANIMATION_FRAME=0 -endif # END ENABLE_REQUEST_ANIMATION_FRAME - # --- # 3D canvas (WebGL) support # --- @@ -513,42 +334,6 @@ webcore_cppflags += \ endif # END USE_CLUTTER # --- -# MHTML support -# --- -if ENABLE_MHTML -feature_defines_overrides += ENABLE_MHTML=1 -else -feature_defines_overrides += ENABLE_MHTML=0 -endif # END ENABLE_MHTML - -# --- -# Web Timing support -# --- -if ENABLE_WEB_TIMING -feature_defines_overrides += ENABLE_WEB_TIMING=1 -else -feature_defines_overrides += ENABLE_WEB_TIMING=0 -endif # END ENABLE_WEB_TIMING - -# --- -# HTML iframe seamless attribute support -# --- -if ENABLE_IFRAME_SEAMLESS -feature_defines_overrides += ENABLE_IFRAME_SEAMLESS=1 -else -feature_defines_overrides += ENABLE_IFRAME_SEAMLESS=0 -endif # END ENABLE_IFRAME_SEAMLESS - -# --- -# Link prefetch support -# --- -if ENABLE_LINK_PREFETCH -feature_defines_overrides += ENABLE_LINK_PREFETCH=1 -else -feature_defines_overrides += ENABLE_LINK_PREFETCH=0 -endif # END ENABLE_LINK_PREFETCH - -# --- # Spell check support # --- if ENABLE_SPELLCHECK @@ -562,8 +347,11 @@ endif # END ENABLE_SPELLCHECK # If unstable features should not be enabled, their defines should be overriden with a 0 value. # --- if !ENABLE_UNSTABLE_FEATURES -# FIXME: List unstable features here once their configuration options are removed. -feature_defines_unstable += +feature_defines_unstable += \ + ENABLE_MUTATION_OBSERVERS=0 \ + ENABLE_LINK_PREFETCH=0 \ + ENABLE_VIDEO_TRACK=0 \ + ENABLE_WEB_TIMING=0 endif @@ -822,6 +610,7 @@ libWebCore_la_CFLAGS = \ $(global_cflags) libWebCore_la_CPPFLAGS = \ + -DBUILDING_WebCore \ -DBUILDING_WEBKIT \ $(global_cppflags) \ $(webcore_cppflags) \ @@ -879,6 +668,7 @@ libWebCoreGtk_la_CFLAGS = \ $(global_cflags) libWebCoreGtk_la_CPPFLAGS = \ + -DBUILDING_WebCore \ -DBUILDING_WEBKIT \ $(global_cppflags) \ $(webcore_cppflags) \ diff --git a/Source/WebCore/GNUmakefile.features.am b/Source/WebCore/GNUmakefile.features.am index 200058c80..07c941834 100644 --- a/Source/WebCore/GNUmakefile.features.am +++ b/Source/WebCore/GNUmakefile.features.am @@ -47,6 +47,7 @@ feature_defines_defaults += \ ENABLE_JAVASCRIPT_DEBUGGER=1 \ ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0 \ ENABLE_LEGACY_NOTIFICATIONS=0 \ + ENABLE_LEGACY_VENDOR_PREFIXES=1 \ ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 \ ENABLE_LINK_PREFETCH=1 \ ENABLE_LINK_PRERENDER=0 \ @@ -56,7 +57,7 @@ feature_defines_defaults += \ ENABLE_MEDIA_STATISTICS=0 \ ENABLE_MEDIA_STREAM=1 \ ENABLE_METER_ELEMENT=1 \ - ENABLE_MHTML=0 \ + ENABLE_MHTML=1 \ ENABLE_MICRODATA=0 \ ENABLE_MUTATION_OBSERVERS=1 \ ENABLE_NAVIGATOR_CONTENT_UTILS=0 \ diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index 9ed466f0b..ca6dabcf5 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -3968,6 +3968,8 @@ webcore_sources += \ Source/WebCore/page/EventHandler.h \ Source/WebCore/page/EventSource.cpp \ Source/WebCore/page/EventSource.h \ + Source/WebCore/page/FeatureObserver.cpp \ + Source/WebCore/page/FeatureObserver.h \ Source/WebCore/page/FocusController.cpp \ Source/WebCore/page/FocusController.h \ Source/WebCore/page/FocusDirection.h \ @@ -4251,6 +4253,7 @@ webcore_sources += \ Source/WebCore/platform/graphics/cairo/RefPtrCairo.cpp \ Source/WebCore/platform/graphics/cairo/RefPtrCairo.h \ Source/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \ + Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h \ Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp \ Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.h \ Source/WebCore/platform/graphics/filters/CustomFilterMesh.cpp \ @@ -5116,6 +5119,7 @@ webcore_sources += \ Source/WebCore/rendering/style/BasicShapes.h \ Source/WebCore/rendering/style/BorderData.h \ Source/WebCore/rendering/style/BorderValue.h \ + Source/WebCore/rendering/style/ClipPathOperation.h \ Source/WebCore/rendering/style/CollapsedBorderValue.h \ Source/WebCore/rendering/style/ContentData.cpp \ Source/WebCore/rendering/style/ContentData.h \ @@ -5976,6 +5980,7 @@ else if TARGET_WIN32 webcore_sources += \ Source/WebCore/platform/graphics/win/DIBPixelData.cpp \ + Source/WebCore/platform/graphics/win/DIBPixelData.h \ Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp \ Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp \ Source/WebCore/platform/graphics/win/LocalWindowsContext.h \ @@ -5986,6 +5991,7 @@ webcore_sources += \ Source/WebCore/platform/win/SystemInfo.h \ Source/WebCore/platform/win/WebCoreInstanceHandle.cpp \ Source/WebCore/platform/win/WebCoreInstanceHandle.h \ + Source/WebCore/platform/win/WindowsExtras.h \ Source/WebCore/plugins/win/PluginDatabaseWin.cpp \ Source/WebCore/plugins/win/PluginMessageThrottlerWin.cpp \ Source/WebCore/plugins/win/PluginMessageThrottlerWin.h \ diff --git a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl index ad3998b49..09513f1fa 100644 --- a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl +++ b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl @@ -30,7 +30,7 @@ module window { Conditional=INDEXED_DATABASE, Supplemental=DOMWindow ] DOMWindowIndexedDatabase { - readonly attribute IDBFactory webkitIndexedDB; + readonly attribute [V8MeasureAs=PrefixedIndexedDB] IDBFactory webkitIndexedDB; attribute IDBCursorConstructor webkitIDBCursor; attribute IDBDatabaseConstructor webkitIDBDatabase; diff --git a/Source/WebCore/Modules/indexeddb/IDBAny.cpp b/Source/WebCore/Modules/indexeddb/IDBAny.cpp index 2cd8a094c..c603255a7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBAny.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBAny.cpp @@ -34,7 +34,6 @@ #include "IDBIndex.h" #include "IDBKeyPath.h" #include "IDBObjectStore.h" -#include "SerializedScriptValue.h" namespace WebCore { @@ -120,10 +119,10 @@ PassRefPtr<IDBTransaction> IDBAny::idbTransaction() return m_idbTransaction; } -PassRefPtr<SerializedScriptValue> IDBAny::serializedScriptValue() +ScriptValue IDBAny::scriptValue() { - ASSERT(m_type == SerializedScriptValueType); - return m_serializedScriptValue; + ASSERT(m_type == ScriptValueType); + return m_scriptValue; } const String& IDBAny::string() @@ -132,6 +131,12 @@ const String& IDBAny::string() return m_string; } +int64_t IDBAny::integer() +{ + ASSERT(m_type == IntegerType); + return m_integer; +} + void IDBAny::setNull() { ASSERT(m_type == UndefinedType); @@ -201,11 +206,11 @@ void IDBAny::set(PassRefPtr<IDBObjectStore> value) m_idbObjectStore = value; } -void IDBAny::set(PassRefPtr<SerializedScriptValue> value) +void IDBAny::set(const ScriptValue& value) { ASSERT(m_type == UndefinedType); - m_type = SerializedScriptValueType; - m_serializedScriptValue = value; + m_type = ScriptValueType; + m_scriptValue = value; } void IDBAny::set(const IDBKeyPath& value) @@ -236,6 +241,13 @@ void IDBAny::set(const String& value) m_string = value; } +void IDBAny::set(int64_t value) +{ + ASSERT(m_type == UndefinedType); + m_type = IntegerType; + m_integer = value; +} + } // namespace WebCore #endif diff --git a/Source/WebCore/Modules/indexeddb/IDBAny.h b/Source/WebCore/Modules/indexeddb/IDBAny.h index d8783d205..a77bb176d 100644 --- a/Source/WebCore/Modules/indexeddb/IDBAny.h +++ b/Source/WebCore/Modules/indexeddb/IDBAny.h @@ -28,6 +28,7 @@ #if ENABLE(INDEXED_DATABASE) +#include "ScriptValue.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -45,7 +46,6 @@ class IDBKey; class IDBKeyPath; class IDBObjectStore; class IDBTransaction; -class SerializedScriptValue; class IDBAny : public RefCounted<IDBAny> { public: @@ -59,10 +59,11 @@ public: any->set(idbObject); return any.release(); } - static PassRefPtr<IDBAny> create(const IDBKeyPath& keyPath) + template<typename T> + static PassRefPtr<IDBAny> create(const T& idbObject) { RefPtr<IDBAny> any = IDBAny::createInvalid(); - any->set(keyPath); + any->set(idbObject); return any.release(); } template<typename T> @@ -72,6 +73,12 @@ public: any->set(idbObject); return any.release(); } + static PassRefPtr<IDBAny> create(int64_t value) + { + RefPtr<IDBAny> any = IDBAny::createInvalid(); + any->set(value); + return any.release(); + } ~IDBAny(); enum Type { @@ -86,7 +93,8 @@ public: IDBKeyType, IDBObjectStoreType, IDBTransactionType, - SerializedScriptValueType, + ScriptValueType, + IntegerType, StringType, }; @@ -101,7 +109,8 @@ public: PassRefPtr<IDBKey> idbKey(); PassRefPtr<IDBObjectStore> idbObjectStore(); PassRefPtr<IDBTransaction> idbTransaction(); - PassRefPtr<SerializedScriptValue> serializedScriptValue(); + ScriptValue scriptValue(); + int64_t integer(); const String& string(); // Set can only be called once. @@ -115,9 +124,10 @@ public: void set(PassRefPtr<IDBKey>); void set(PassRefPtr<IDBObjectStore>); void set(PassRefPtr<IDBTransaction>); - void set(PassRefPtr<SerializedScriptValue>); void set(const IDBKeyPath&); void set(const String&); + void set(const ScriptValue&); + void set(int64_t); private: IDBAny(); @@ -134,8 +144,9 @@ private: RefPtr<IDBKey> m_idbKey; RefPtr<IDBObjectStore> m_idbObjectStore; RefPtr<IDBTransaction> m_idbTransaction; - RefPtr<SerializedScriptValue> m_serializedScriptValue; + ScriptValue m_scriptValue; String m_string; + int64_t m_integer; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp index 96fe82f76..c51f7f565 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp @@ -38,7 +38,6 @@ #include "IDBTracing.h" #include "IDBTransaction.h" #include "ScriptExecutionContext.h" -#include "SerializedScriptValue.h" namespace WebCore { @@ -260,28 +259,25 @@ void IDBCursor::close() m_request.clear(); } -void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> prpValue) +void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, ScriptValue& value) { m_currentKey = key; m_currentPrimaryKey = primaryKey; - RefPtr<SerializedScriptValue> value = prpValue; if (!isKeyCursor()) { RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); const IDBObjectStoreMetadata metadata = objectStore->metadata(); if (metadata.autoIncrement && !metadata.keyPath.isNull()) { #ifndef NDEBUG - RefPtr<IDBKey> expectedKey = createIDBKeyFromSerializedValueAndKeyPath(value, metadata.keyPath); + RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(value, metadata.keyPath); ASSERT(!expectedKey || expectedKey->isEqual(m_currentPrimaryKey.get())); #endif - RefPtr<SerializedScriptValue> valueAfterInjection = injectIDBKeyIntoSerializedValue(m_currentPrimaryKey, value, metadata.keyPath); - ASSERT(valueAfterInjection); + bool injected = injectIDBKeyIntoScriptValue(m_currentPrimaryKey, value, metadata.keyPath); // FIXME: There is no way to report errors here. Move this into onSuccessWithContinuation so that we can abort the transaction there. See: https://bugs.webkit.org/show_bug.cgi?id=92278 - if (valueAfterInjection) - value = valueAfterInjection; + ASSERT_UNUSED(injected, injected); } } - m_currentValue = IDBAny::create(value.release()); + m_currentValue = IDBAny::create(value); m_gotValue = true; m_valueIsDirty = true; diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.h b/Source/WebCore/Modules/indexeddb/IDBCursor.h index 1b619353f..9a9514757 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.h +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.h @@ -41,7 +41,6 @@ class IDBCallbacks; class IDBCursorBackendInterface; class IDBRequest; class ScriptExecutionContext; -class SerializedScriptValue; typedef int ExceptionCode; @@ -82,7 +81,7 @@ public: void postSuccessHandlerCallback(); void close(); - void setValueReady(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>); + void setValueReady(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, ScriptValue&); // The spec requires that the script object that wraps the value // be unchanged until the value changes as a result of the cursor diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp index d641d04a4..8e0c3ad56 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp @@ -117,7 +117,7 @@ PassRefPtr<IDBAny> IDBDatabase::version() const int64_t intVersion = m_metadata.intVersion; if (intVersion == IDBDatabaseMetadata::NoIntVersion) return IDBAny::createString(m_metadata.version); - return IDBAny::create(SerializedScriptValue::numberValue(intVersion)); + return IDBAny::create(intVersion); } PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const Dictionary& options, ExceptionCode& ec) diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.h b/Source/WebCore/Modules/indexeddb/IDBDatabase.h index 4deb27a68..112b90a99 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.h @@ -88,6 +88,7 @@ public: virtual const AtomicString& interfaceName() const; virtual ScriptExecutionContext* scriptExecutionContext() const; + bool isClosePending() const { return m_closePending; } void forceClose(); const IDBDatabaseMetadata metadata() const { return m_metadata; } void enqueueEvent(PassRefPtr<Event>); diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp index bfb2ae267..73e9aaa6f 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp @@ -550,7 +550,7 @@ void IDBDatabaseBackendImpl::deleteDatabase(PassRefPtr<IDBCallbacks> prpCallback m_id = InvalidId; m_intVersion = IDBDatabaseMetadata::NoIntVersion; m_objectStores.clear(); - callbacks->onSuccess(SerializedScriptValue::nullValue()); + callbacks->onSuccess(SerializedScriptValue::undefinedValue()); } void IDBDatabaseBackendImpl::close(PassRefPtr<IDBDatabaseCallbacks> prpCallbacks) @@ -559,8 +559,13 @@ void IDBDatabaseBackendImpl::close(PassRefPtr<IDBDatabaseCallbacks> prpCallbacks ASSERT(m_databaseCallbacksSet.contains(callbacks)); m_databaseCallbacksSet.remove(callbacks); - // FIXME: If callbacks is also held in m_pendingSecondHalfOpenWithVersionCalls - // it should be removed and onError fired against it. + for (Deque<RefPtr<PendingOpenWithVersionCall> >::iterator it = m_pendingSecondHalfOpenWithVersionCalls.begin(); it != m_pendingSecondHalfOpenWithVersionCalls.end(); ++it) { + if ((*it)->databaseCallbacks() == callbacks) { + (*it)->callbacks()->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "The connection was closed.")); + m_pendingSecondHalfOpenWithVersionCalls.remove(it); + break; + } + } if (connectionCount() > 1) return; diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp index 5ffc1cba9..cc6c28ef2 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp @@ -340,9 +340,8 @@ private: RefPtr<IDBKey> primaryKey = cursor->primaryKey(); RefPtr<IDBAny> valueAny = cursor->value(); - ASSERT(valueAny->type() == IDBAny::SerializedScriptValueType); - RefPtr<SerializedScriptValue> serializedValue = valueAny->serializedScriptValue(); - ScriptValue value(deserializeIDBValue(context, serializedValue)); + ASSERT(valueAny->type() == IDBAny::ScriptValueType); + ScriptValue value = valueAny->scriptValue(); IDBObjectStore::IndexKeys indexKeys; generateIndexKeysForValue(m_indexMetadata, value, &indexKeys); diff --git a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp index 6ef16cf02..752613c5e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp @@ -105,6 +105,15 @@ void IDBOpenDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend idbDatabase = m_result->idbDatabase(); ASSERT(idbDatabase); ASSERT(!m_databaseCallbacks); + + // If the connection closed between onUpgradeNeeded and onSuccess, an error + // should be fired instead of success. The back-end may not be aware of + // the closing state if the events are asynchronously delivered. + if (idbDatabase->isClosePending()) { + m_result.clear(); + onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "The connection was closed.")); + return; + } } else { ASSERT(m_databaseCallbacks); idbDatabase = IDBDatabase::create(scriptExecutionContext(), backend, m_databaseCallbacks); diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp index 43f25a8c3..14072aed9 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp @@ -214,7 +214,7 @@ PassRefPtr<IDBCursor> IDBRequest::getResultCursor() return 0; } -void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value) +void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, const ScriptValue& value) { ASSERT(m_readyState == PENDING); m_cursorKey = key; @@ -276,12 +276,13 @@ void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList) enqueueEvent(createSuccessEvent()); } -void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value) +void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> serializedValue) { IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); if (!shouldEnqueueEvent()) return; + ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedValue); ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType); RefPtr<IDBCursor> cursor; if (m_cursorType == IDBCursorBackendInterface::IndexKeyCursor) @@ -302,7 +303,7 @@ void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) if (idbKey && idbKey->isValid()) m_result = IDBAny::create(idbKey); else - m_result = IDBAny::create(SerializedScriptValue::undefinedValue()); + m_result = IDBAny::createInvalid(); enqueueEvent(createSuccessEvent()); } @@ -337,9 +338,8 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal if (!shouldEnqueueEvent()) return; - m_result = IDBAny::create(serializedScriptValue); - m_pendingCursor.clear(); - enqueueEvent(createSuccessEvent()); + ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedScriptValue); + onSuccessInternal(value); } #ifndef NDEBUG @@ -364,30 +364,32 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScript #ifndef NDEBUG ASSERT(keyPath == effectiveObjectStore(m_source)->keyPath()); #endif - RefPtr<SerializedScriptValue> value = prpSerializedScriptValue; + ScriptValue value = deserializeIDBValue(scriptExecutionContext(), prpSerializedScriptValue); RefPtr<IDBKey> primaryKey = prpPrimaryKey; #ifndef NDEBUG - RefPtr<IDBKey> expectedKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath); + RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(value, keyPath); ASSERT(!expectedKey || expectedKey->isEqual(primaryKey.get())); #endif - RefPtr<SerializedScriptValue> valueAfterInjection = injectIDBKeyIntoSerializedValue(primaryKey, value, keyPath); - ASSERT(valueAfterInjection); - if (!valueAfterInjection) { - // Checks in put() ensure this should only happen if I/O error occurs. - onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error inserting generated key into the object.")); - return; - } - value = valueAfterInjection; - onSuccess(value.release()); + bool injected = injectIDBKeyIntoScriptValue(primaryKey, value, keyPath); + ASSERT_UNUSED(injected, injected); + onSuccessInternal(value); +} + +void IDBRequest::onSuccessInternal(const ScriptValue& value) +{ + m_result = IDBAny::create(value); + m_pendingCursor.clear(); + enqueueEvent(createSuccessEvent()); } -void IDBRequest::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value) +void IDBRequest::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> serializedValue) { IDB_TRACE("IDBRequest::onSuccess(key, primaryKey, value)"); if (!shouldEnqueueEvent()) return; + ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedValue); ASSERT(m_pendingCursor); setResultCursor(m_pendingCursor.release(), key, primaryKey, value); enqueueEvent(createSuccessEvent()); @@ -456,7 +458,7 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) if (event->type() == eventNames().successEvent) { cursorToNotify = getResultCursor(); if (cursorToNotify) - cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimaryKey.release(), m_cursorValue.release()); + cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimaryKey.release(), m_cursorValue); } if (event->type() == eventNames().upgradeneededEvent) { diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index 7f9992485..d82fac720 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -113,6 +113,7 @@ protected: IDBRequest(ScriptExecutionContext*, PassRefPtr<IDBAny> source, IDBTransactionBackendInterface::TaskType, IDBTransaction*); void enqueueEvent(PassRefPtr<Event>); virtual bool shouldEnqueueEvent() const; + void onSuccessInternal(const ScriptValue&); RefPtr<IDBAny> m_result; unsigned short m_errorCode; @@ -131,7 +132,7 @@ private: virtual EventTargetData* ensureEventTargetData(); PassRefPtr<IDBCursor> getResultCursor(); - void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>); + void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, const ScriptValue&); RefPtr<IDBAny> m_source; const IDBTransactionBackendInterface::TaskType m_taskType; @@ -146,7 +147,7 @@ private: RefPtr<IDBCursor> m_pendingCursor; RefPtr<IDBKey> m_cursorKey; RefPtr<IDBKey> m_cursorPrimaryKey; - RefPtr<SerializedScriptValue> m_cursorValue; + ScriptValue m_cursorValue; bool m_didFireUpgradeNeededEvent; EventTargetData m_eventTargetData; diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionCallbacks.h b/Source/WebCore/Modules/indexeddb/IDBTransactionCallbacks.h index 8d906a6eb..189886f9b 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionCallbacks.h +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionCallbacks.h @@ -31,7 +31,6 @@ #if ENABLE(INDEXED_DATABASE) -#include "SerializedScriptValue.h" #include <wtf/RefCounted.h> namespace WebCore { diff --git a/Source/WebCore/Modules/notifications/DOMWindowNotifications.idl b/Source/WebCore/Modules/notifications/DOMWindowNotifications.idl index ea8a129c5..987beb0a0 100644 --- a/Source/WebCore/Modules/notifications/DOMWindowNotifications.idl +++ b/Source/WebCore/Modules/notifications/DOMWindowNotifications.idl @@ -31,7 +31,7 @@ module window { Supplemental=DOMWindow ] DOMWindowNotifications { #if defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS - readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications; + readonly attribute [V8EnabledAtRuntime, V8MeasureAs=LegacyNotifications] NotificationCenter webkitNotifications; #endif #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS attribute NotificationConstructor Notification; diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index 205450682..2cca21e94 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -14,8 +14,6 @@ WEBKIT += javascriptcore CONFIG += staticlib -DEFINES += QT_MAKEDLL - RESOURCES += \ $$PWD/WebCore.qrc @@ -867,6 +865,7 @@ SOURCES += \ page/DragController.cpp \ page/EventHandler.cpp \ page/EventSource.cpp \ + page/FeatureObserver.cpp \ page/FocusController.cpp \ page/Frame.cpp \ page/FrameActionScheduler.cpp \ @@ -2047,6 +2046,7 @@ HEADERS += \ platform/graphics/BitmapImage.h \ platform/graphics/Color.h \ platform/graphics/CrossfadeGeneratedImage.h \ + platform/graphics/filters/CustomFilterArrayParameter.h \ platform/graphics/filters/CustomFilterGlobalContext.h \ platform/graphics/filters/CustomFilterMesh.h \ platform/graphics/filters/CustomFilterMeshGenerator.h \ diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 4069d02e8..e78411831 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -849,6 +849,7 @@ __ZN7WebCore8GradientC1ERKNS_10FloatPointES3_ __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEiNS0_10AnchorTypeE __ZN7WebCore8Settings14setJavaEnabledEb __ZN7WebCore8Settings15setWebGLEnabledEb +__ZN7WebCore8Settings16setImagesEnabledEb __ZN7WebCore8Settings16setScriptEnabledEb __ZN7WebCore8Settings16setUsesPageCacheEb __ZN7WebCore8Settings17setPluginsEnabledEb @@ -881,6 +882,7 @@ __ZN7WebCore8Settings23setUsesEncodingDetectorEb __ZN7WebCore8Settings24setApplicationChromeModeEb __ZN7WebCore8Settings24setDNSPrefetchingEnabledEb __ZN7WebCore8Settings24setMockScrollbarsEnabledEb +__ZN7WebCore8Settings24setStorageBlockingPolicyENS_14SecurityOrigin21StorageBlockingPolicyE __ZN7WebCore8Settings24setTextAreasAreResizableEb __ZN7WebCore8Settings25setDeveloperExtrasEnabledEb __ZN7WebCore8Settings25setFrameFlatteningEnabledEb @@ -1358,7 +1360,7 @@ __ZNK7WebCore7RunLoop9TimerBase8isActiveEv __ZNK7WebCore8Document10renderViewEv __ZNK7WebCore8Document11completeURLERKN3WTF6StringE __ZNK7WebCore8Document13axObjectCacheEv -__ZNK7WebCore8Document13nodesFromRectEiijjjjbbb +__ZNK7WebCore8Document13nodesFromRectEiijjjjbb __ZNK7WebCore8Document14getElementByIdERKN3WTF12AtomicStringE __ZNK7WebCore8Document31displayStringModifiedByEncodingERKN3WTF6StringE __ZNK7WebCore8Document4bodyEv @@ -2563,7 +2565,9 @@ __ZN7WebCore12WorkerThread17workerThreadCountEv #if USE(WTFURL) __ZNK7WebCore4KURL6stringEv +__ZNK7WebCore4KURL7hasPortEv __ZNK7WebCore4KURL7isEmptyEv +__ZNK7WebCore4KURL6isNullEv __ZNK7WebCore4KURL7isValidEv __ZNK7WebCore4KURL22protocolIsInHTTPFamilyEv #endif diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 670d02228..d6ff77575 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -232,6 +232,7 @@ 'page/DragState.h', 'page/EditorClient.h', 'page/EventHandler.h', + 'page/FeatureObserver.h', 'page/FocusController.h', 'page/FocusDirection.h', 'page/Frame.h', @@ -3113,6 +3114,7 @@ 'page/EventHandler.cpp', 'page/EventSource.cpp', 'page/EventSource.h', + 'page/FeatureObserver.cpp', 'page/FocusController.cpp', 'page/Frame.cpp', 'page/FrameActionScheduler.cpp', @@ -4919,6 +4921,7 @@ 'platform/graphics/efl/ImageEfl.cpp', 'platform/graphics/efl/IntPointEfl.cpp', 'platform/graphics/efl/IntRectEfl.cpp', + 'platform/graphics/filters/CustomFilterArrayParameter.h', 'platform/graphics/filters/CustomFilterGlobalContext.cpp', 'platform/graphics/filters/CustomFilterGlobalContext.h', 'platform/graphics/filters/CustomFilterMesh.h', @@ -6496,6 +6499,7 @@ ], 'webinspector_elements_js_files': [ 'inspector/front-end/CSSNamedFlowCollectionsView.js', + 'inspector/front-end/CSSNamedFlowView.js', 'inspector/front-end/ElementsPanel.js', 'inspector/front-end/EventListenersSidebarPane.js', 'inspector/front-end/MetricsSidebarPane.js', @@ -6666,6 +6670,9 @@ 'inspector/front-end/Images/profilesSilhouette.png', 'inspector/front-end/Images/programCounterBorder.png', 'inspector/front-end/Images/radioDot.png', + 'inspector/front-end/Images/regionEmpty.png', + 'inspector/front-end/Images/regionFit.png', + 'inspector/front-end/Images/regionOverset.png', 'inspector/front-end/Images/resourceCSSIcon.png', 'inspector/front-end/Images/resourceDocumentIcon.png', 'inspector/front-end/Images/resourceDocumentIconSmall.png', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index a2434329f..5744c07ef 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -22785,7 +22785,7 @@ __ZNK7WebCore12NodeIterator20updateForNodeRemovalEPNS_4NodeERNS0_11NodePointerE __ZN7WebCore27jsNodeIteratorReferenceNodeEPN3JSC9ExecStateENS0_7JSValueERKNS0_10IdentifierE __ZNK7WebCore4Node20traversePreviousNodeEPKS0_ __ZN7WebCore37jsNodeIteratorPrototypeFunctionDetachEPN3JSC9ExecStateE -__ZNK7WebCore8Document13nodesFromRectEiijjjjbbb +__ZNK7WebCore8Document13nodesFromRectEiijjjjb __ZNK7WebCore8Document17handleZeroPaddingERKNS_14HitTestRequestERNS_13HitTestResultE __ZN3WTF21ListHashSetTranslatorINS_6RefPtrIN7WebCore4NodeEEELm256ENS_7PtrHashIS4_EEE9translateERPNS_15ListHashSetNodeIS4_Lm256EEERKS4_PNS_24ListHashSetNodeAllocatorIS4_Lm256EEE __ZN7WebCore21StaticHashSetNodeListC1ERN3WTF11ListHashSetINS1_6RefPtrINS_4NodeEEELm256ENS1_7PtrHashIS5_EEEE diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index b21e5af0b..542b85fe0 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -176,8 +176,21 @@ enable?(VIDEO) { LIBS += -framework AppKit -framework AudioUnit \ -framework AudioToolbox -framework CoreAudio \ - -framework QuartzCore -framework QTKit - + -framework QuartzCore -framework QTKit \ + -framework Security -framework IOKit + + # We can know the Mac OS version by using the Darwin major version + DARWIN_VERSION = $$split(QMAKE_HOST.version, ".") + DARWIN_MAJOR_VERSION = $$first(DARWIN_VERSION) + equals(DARWIN_MAJOR_VERSION, "12") { + LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a + } else:equals(DARWIN_MAJOR_VERSION, "11") { + LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceLion.a + } else:equals(DARWIN_MAJOR_VERSION, "10") { + LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a + } else:equals(DARWIN_MAJOR_VERSION, "9") { + LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceLeopard.a + } } else:use?(GSTREAMER) { INCLUDEPATH += $$SOURCE_DIR/platform/graphics/gstreamer PKGCONFIG += gstreamer-video-0.10 @@ -217,7 +230,7 @@ use?(libpng): LIBS += -lpng use?(webp): LIBS += -lwebp mac { - LIBS += -framework Carbon -framework AppKit + LIBS += -framework Carbon -framework AppKit -framework IOKit } win32 { diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 51cf6a557..44e694ad1 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -27051,6 +27051,14 @@ >
</File>
<File
+ RelativePath="..\page\FeatureObserver.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\page\FeatureObserver.h"
+ >
+ </File>
+ <File
RelativePath="..\page\FocusController.cpp"
>
</File>
@@ -31877,6 +31885,10 @@ Name="filters"
>
<File
+ RelativePath="..\platform\graphics\filters\CustomFilterArrayParameter.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\filters\CustomFilterGlobalContext.cpp"
>
</File>
@@ -46683,6 +46695,10 @@ RelativePath="..\rendering\style\BasicShapes.h"
>
</File>
+ <File
+ RelativePath="..\rendering\style\ClipPathOperation.h"
+ >
+ </File>
</Filter>
<Filter
Name="svg"
@@ -76026,6 +76042,10 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\CSSNamedFlowView.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\cssNamedFlows.css"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 76aafcd55..20db8f444 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -354,6 +354,7 @@ 14FFE31E0AE1963300136BF5 /* HTMLFrameElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FFE31C0AE1963300136BF5 /* HTMLFrameElementBase.cpp */; }; 150B923915F08DC400E10986 /* WebKitCSSArrayFunctionValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150B923715F08DC400E10986 /* WebKitCSSArrayFunctionValue.cpp */; }; 150B923A15F08DC400E10986 /* WebKitCSSArrayFunctionValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 150B923815F08DC400E10986 /* WebKitCSSArrayFunctionValue.h */; }; + 15B3FC1915FB217800A81BCB /* CustomFilterArrayParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B3FC1715FB217800A81BCB /* CustomFilterArrayParameter.h */; }; 15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C7708A100D3C6A005BA267 /* ValidityState.h */; }; 15C7708E100D3C6B005BA267 /* ValidityState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15C7708B100D3C6A005BA267 /* ValidityState.cpp */; }; 15C77093100D3CA8005BA267 /* JSValidityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C77091100D3CA8005BA267 /* JSValidityState.h */; }; @@ -3689,6 +3690,8 @@ 97C078501165D5BE003A32EF /* SuffixTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C0784F1165D5BE003A32EF /* SuffixTree.h */; }; 97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */; }; 97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 97C740141603F7A10011FF2D /* FeatureObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C740121603F7A10011FF2D /* FeatureObserver.cpp */; }; + 97C740151603F7A10011FF2D /* FeatureObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C740131603F7A10011FF2D /* FeatureObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */; }; 97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97DCE20110807C750057D394 /* HistoryController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DCE1FF10807C750057D394 /* HistoryController.cpp */; }; @@ -6315,6 +6318,7 @@ FABE72FD1059C21100D999DD /* MathMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72FB1059C21100D999DD /* MathMLElementFactory.cpp */; }; FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72FC1059C21100D999DD /* MathMLNames.cpp */; }; FB78AD2E151BF5E600FE54D3 /* CSSParserMode.h in Headers */ = {isa = PBXBuildFile; fileRef = FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = FB92DF4915FED08700994433 /* ClipPathOperation.h */; settings = {ATTRIBUTES = (Private, ); }; }; FBC220DF1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */; }; FBD6AF8815EF25C9008B7110 /* CSSBasicShapes.h in Headers */ = {isa = PBXBuildFile; fileRef = FBD6AF8715EF21D4008B7110 /* CSSBasicShapes.h */; }; FBD6AF8915EF25DB008B7110 /* BasicShapeFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBD6AF8415EF21D4008B7110 /* BasicShapeFunctions.cpp */; }; @@ -7407,6 +7411,7 @@ 14FFE31C0AE1963300136BF5 /* HTMLFrameElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFrameElementBase.cpp; sourceTree = "<group>"; }; 150B923715F08DC400E10986 /* WebKitCSSArrayFunctionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSArrayFunctionValue.cpp; sourceTree = "<group>"; }; 150B923815F08DC400E10986 /* WebKitCSSArrayFunctionValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSArrayFunctionValue.h; sourceTree = "<group>"; }; + 15B3FC1715FB217800A81BCB /* CustomFilterArrayParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomFilterArrayParameter.h; path = filters/CustomFilterArrayParameter.h; sourceTree = "<group>"; }; 15C77089100D3C6A005BA267 /* ValidityState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ValidityState.idl; sourceTree = "<group>"; }; 15C7708A100D3C6A005BA267 /* ValidityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidityState.h; sourceTree = "<group>"; }; 15C7708B100D3C6A005BA267 /* ValidityState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValidityState.cpp; sourceTree = "<group>"; }; @@ -10912,6 +10917,8 @@ 97C1F552122855CB00EDE616 /* HTMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLToken.h; path = parser/HTMLToken.h; sourceTree = "<group>"; }; 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSecurityPolicy.cpp; sourceTree = "<group>"; }; 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentSecurityPolicy.h; sourceTree = "<group>"; }; + 97C740121603F7A10011FF2D /* FeatureObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FeatureObserver.cpp; sourceTree = "<group>"; }; + 97C740131603F7A10011FF2D /* FeatureObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeatureObserver.h; sourceTree = "<group>"; }; 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowProperty.cpp; sourceTree = "<group>"; }; 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowProperty.h; sourceTree = "<group>"; }; 97DCE1FF10807C750057D394 /* HistoryController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HistoryController.cpp; sourceTree = "<group>"; }; @@ -13730,6 +13737,7 @@ FABE72FB1059C21100D999DD /* MathMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLElementFactory.cpp; sourceTree = "<group>"; }; FABE72FC1059C21100D999DD /* MathMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLNames.cpp; sourceTree = "<group>"; }; FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSParserMode.h; sourceTree = "<group>"; }; + FB92DF4915FED08700994433 /* ClipPathOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipPathOperation.h; sourceTree = "<group>"; }; FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DOpenGL.cpp; sourceTree = "<group>"; }; FBD6AF8215EF21A3008B7110 /* BasicShapes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BasicShapes.cpp; path = style/BasicShapes.cpp; sourceTree = "<group>"; }; FBD6AF8315EF21A3008B7110 /* BasicShapes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BasicShapes.h; path = style/BasicShapes.h; sourceTree = "<group>"; }; @@ -15810,6 +15818,8 @@ E0FEF371B17C53EAC1C1FBEE /* EventSource.h */, E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */, 14993BE30B2F2B1C0050497F /* FocusController.cpp */, + 97C740121603F7A10011FF2D /* FeatureObserver.cpp */, + 97C740131603F7A10011FF2D /* FeatureObserver.h */, 14993BE40B2F2B1C0050497F /* FocusController.h */, 062287830B4DB322000C34DF /* FocusDirection.h */, 65BF02290974816300C43196 /* Frame.cpp */, @@ -18181,6 +18191,7 @@ isa = PBXGroup; children = ( 49ECEB5C1499790D00CDD3A4 /* arm */, + 15B3FC1715FB217800A81BCB /* CustomFilterArrayParameter.h */, 50D4060F147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp */, 50D40610147D49DE00D30BB5 /* CustomFilterCompiledProgram.h */, 50987C24157D676D00BDA835 /* CustomFilterGlobalContext.cpp */, @@ -20463,6 +20474,7 @@ FBD6AF8315EF21A3008B7110 /* BasicShapes.h */, BC5EB5E00E81BE8700B25965 /* BorderData.h */, BC5EB5DA0E81B7EA00B25965 /* BorderValue.h */, + FB92DF4915FED08700994433 /* ClipPathOperation.h */, BC5EB5DE0E81B9AB00B25965 /* CollapsedBorderValue.h */, BC5EB97E0E82072500B25965 /* ContentData.cpp */, BC5EB97F0E82072500B25965 /* ContentData.h */, @@ -22589,6 +22601,7 @@ BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */, BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */, 62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */, + 15B3FC1915FB217800A81BCB /* CustomFilterArrayParameter.h in Headers */, 50D40612147D49DE00D30BB5 /* CustomFilterCompiledProgram.h in Headers */, 50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */, 50D405FA147D31F300D30BB5 /* CustomFilterMesh.h in Headers */, @@ -23399,6 +23412,7 @@ 84730D8D1248F0B300D3A9C9 /* FETurbulence.h in Headers */, FD31609512B026F700C1A359 /* FFTConvolver.h in Headers */, FD31609712B026F700C1A359 /* FFTFrame.h in Headers */, + 97C740151603F7A10011FF2D /* FeatureObserver.h in Headers */, 976D6C81122B8A3D001FD1F7 /* File.h in Headers */, 893C47A71238908B002B3D86 /* FileCallback.h in Headers */, 066C772B0AB603B700238CC4 /* FileChooser.h in Headers */, @@ -25554,6 +25568,7 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, FD537353137B651800008DCE /* ZeroPole.h in Headers */, + FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */, 4F7B4A6615FF6D6A006B5F22 /* PlatformMemoryInstrumentation.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -26650,6 +26665,7 @@ FD31609412B026F700C1A359 /* FFTConvolver.cpp in Sources */, FD31609612B026F700C1A359 /* FFTFrame.cpp in Sources */, FD3160C012B0272A00C1A359 /* FFTFrameMac.cpp in Sources */, + 97C740141603F7A10011FF2D /* FeatureObserver.cpp in Sources */, 976D6C80122B8A3D001FD1F7 /* File.cpp in Sources */, 934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */, 89878561122CA064003AABDA /* FileEntry.cpp in Sources */, diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp index 5ba64c0b6..a07380f47 100644 --- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp @@ -372,7 +372,7 @@ bool AccessibilityNodeObject::isWebArea() const bool AccessibilityNodeObject::isImageButton() const { - return isNativeImage() && roleValue() == ButtonRole; + return isNativeImage() && isButton(); } bool AccessibilityNodeObject::isAnchor() const @@ -565,7 +565,7 @@ bool AccessibilityNodeObject::isIndeterminate() const bool AccessibilityNodeObject::isPressed() const { - if (roleValue() != ButtonRole) + if (!isButton()) return false; Node* node = this->node(); @@ -875,6 +875,7 @@ Element* AccessibilityNodeObject::actionElement() const switch (roleValue()) { case ButtonRole: case PopUpButtonRole: + case ToggleButtonRole: case TabRole: case MenuItemRole: case ListItemRole: @@ -1212,6 +1213,7 @@ String AccessibilityNodeObject::title() const switch (roleValue()) { case PopUpButtonRole: case ButtonRole: + case ToggleButtonRole: case CheckBoxRole: case ListBoxOptionRole: case MenuButtonRole: diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp index a5330684e..b9bd9a987 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp @@ -1254,6 +1254,7 @@ const String& AccessibilityObject::actionVerb() const switch (roleValue()) { case ButtonRole: + case ToggleButtonRole: return buttonAction; case TextFieldRole: case TextAreaRole: @@ -1789,4 +1790,11 @@ AccessibilityRole AccessibilityObject::buttonRoleType() const return ButtonRole; } +bool AccessibilityObject::isButton() const +{ + AccessibilityRole role = roleValue(); + + return role == ButtonRole || role == PopUpButtonRole || role == ToggleButtonRole; +} + } // namespace WebCore diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h index 9e4181212..564dd33b3 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.h +++ b/Source/WebCore/accessibility/AccessibilityObject.h @@ -380,7 +380,7 @@ public: bool isTree() const { return roleValue() == TreeRole; } bool isTreeItem() const { return roleValue() == TreeItemRole; } bool isScrollbar() const { return roleValue() == ScrollBarRole; } - bool isButton() const { return roleValue() == ButtonRole; } + bool isButton() const; bool isListItem() const { return roleValue() == ListItemRole; } bool isCheckboxOrRadio() const { return isCheckbox() || isRadioButton(); } bool isScrollView() const { return roleValue() == ScrollAreaRole; } diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 8c1b021d2..704cb4b92 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -2907,6 +2907,7 @@ const String& AccessibilityRenderObject::actionVerb() const switch (roleValue()) { case ButtonRole: + case ToggleButtonRole: return buttonAction; case TextFieldRole: case TextAreaRole: diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index afd6bc5cf..98618c777 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -175,7 +175,7 @@ bool RuntimeEnabledFeatures::isMediaSourceEnabled = false; #endif #if ENABLE(VIDEO_TRACK) -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(CHROMIUM) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) bool RuntimeEnabledFeatures::isVideoTrackEnabled = true; #else bool RuntimeEnabledFeatures::isVideoTrackEnabled = false; diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h index 38320b0f4..f906ce611 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -31,6 +31,8 @@ #ifndef RuntimeEnabledFeatures_h #define RuntimeEnabledFeatures_h +#include "PlatformExportMacros.h" + namespace WebCore { // A class that stores static enablers for all experimental features. Note that @@ -281,7 +283,7 @@ private: static bool isDeviceOrientationEnabled; static bool isSpeechInputEnabled; static bool isCSSExclusionsEnabled; - static bool isLangAttributeAwareFormControlUIEnabled; + WEBCORE_TESTING static bool isLangAttributeAwareFormControlUIEnabled; #if ENABLE(SCRIPTED_SPEECH) static bool isScriptedSpeechEnabled; #endif diff --git a/Source/WebCore/bindings/gobject/GNUmakefile.am b/Source/WebCore/bindings/gobject/GNUmakefile.am index 443bdf692..2328f95e3 100644 --- a/Source/WebCore/bindings/gobject/GNUmakefile.am +++ b/Source/WebCore/bindings/gobject/GNUmakefile.am @@ -412,9 +412,9 @@ webkitgtk_gdom_built_sources += \ DerivedSources/webkit/WebKitDOMHTMLAudioElementPrivate.h \ DerivedSources/webkit/WebKitDOMHTMLVideoElement.cpp \ DerivedSources/webkit/WebKitDOMHTMLVideoElementPrivate.h -endif -if ENABLE_VIDEO_TRACK +# Video Track feature currently depends on HTML Video and is considered unstable. +if ENABLE_UNSTABLE_FEATURES webkitgtk_built_h_api += \ $(top_builddir)/DerivedSources/webkit/WebKitDOMTextTrack.h \ $(top_builddir)/DerivedSources/webkit/WebKitDOMTextTrackList.h \ @@ -433,8 +433,10 @@ webkitgtk_gdom_built_sources += \ DerivedSources/webkit/WebKitDOMTrackEvent.cpp \ DerivedSources/webkit/WebKitDOMTrackEventPrivate.h endif +endif -if ENABLE_WEB_TIMING +# Web Timing feature is currently considered unstable. +if ENABLE_UNSTABLE_FEATURES webkitgtk_built_h_api += \ $(top_builddir)/DerivedSources/webkit/WebKitDOMPerformance.h \ $(top_builddir)/DerivedSources/webkit/WebKitDOMPerformanceNavigation.h \ diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp index 7ee492a50..137880186 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -693,10 +693,12 @@ JSValue JSDOMWindow::postMessage(ExecState* exec) return handlePostMessage(impl(), exec); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) JSValue JSDOMWindow::webkitPostMessage(ExecState* exec) { return handlePostMessage(impl(), exec); } +#endif JSValue JSDOMWindow::setTimeout(ExecState* exec) { diff --git a/Source/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp b/Source/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp index ab0c5ddc6..791e6a521 100644 --- a/Source/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp +++ b/Source/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp @@ -47,10 +47,12 @@ JSC::JSValue JSDedicatedWorkerContext::postMessage(JSC::ExecState* exec) return handlePostMessage(exec, impl()); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) JSC::JSValue JSDedicatedWorkerContext::webkitPostMessage(JSC::ExecState* exec) { return handlePostMessage(exec, impl()); } +#endif } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSMessagePortCustom.cpp b/Source/WebCore/bindings/js/JSMessagePortCustom.cpp index 7a439d360..5b176321d 100644 --- a/Source/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/Source/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -63,10 +63,12 @@ JSC::JSValue JSMessagePort::postMessage(JSC::ExecState* exec) return handlePostMessage(exec, impl()); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) JSC::JSValue JSMessagePort::webkitPostMessage(JSC::ExecState* exec) { return handlePostMessage(exec, impl()); } +#endif void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortArray& portArray, ArrayBufferArray& arrayBuffers) { diff --git a/Source/WebCore/bindings/js/JSWorkerCustom.cpp b/Source/WebCore/bindings/js/JSWorkerCustom.cpp index b1f38a586..944c009a0 100644 --- a/Source/WebCore/bindings/js/JSWorkerCustom.cpp +++ b/Source/WebCore/bindings/js/JSWorkerCustom.cpp @@ -45,10 +45,12 @@ JSC::JSValue JSWorker::postMessage(JSC::ExecState* exec) return handlePostMessage(exec, impl()); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) JSC::JSValue JSWorker::webkitPostMessage(JSC::ExecState* exec) { return handlePostMessage(exec, impl()); } +#endif EncodedJSValue JSC_HOST_CALL JSWorkerConstructor::constructJSWorker(ExecState* exec) { diff --git a/Source/WebCore/bindings/js/ScriptController.cpp b/Source/WebCore/bindings/js/ScriptController.cpp index 1f2e9d372..48f68c8a3 100644 --- a/Source/WebCore/bindings/js/ScriptController.cpp +++ b/Source/WebCore/bindings/js/ScriptController.cpp @@ -222,7 +222,7 @@ JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) windowShell->window()->updateDocument(); if (m_frame->document()) - windowShell->window()->setEvalEnabled(m_frame->document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport)); + windowShell->window()->setEvalEnabled(m_frame->document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport), m_frame->document()->contentSecurityPolicy()->evalDisabledErrorMessage()); if (Page* page = m_frame->page()) { attachDebugger(windowShell, page->debugger()); @@ -250,12 +250,12 @@ void ScriptController::enableEval() windowShell->window()->setEvalEnabled(true); } -void ScriptController::disableEval() +void ScriptController::disableEval(const String& errorMessage) { JSDOMWindowShell* windowShell = existingWindowShell(mainThreadNormalWorld()); if (!windowShell) return; - windowShell->window()->setEvalEnabled(false); + windowShell->window()->setEvalEnabled(false, errorMessage); } bool ScriptController::processingUserGesture() diff --git a/Source/WebCore/bindings/js/ScriptController.h b/Source/WebCore/bindings/js/ScriptController.h index f76fde8fc..187fab52b 100644 --- a/Source/WebCore/bindings/js/ScriptController.h +++ b/Source/WebCore/bindings/js/ScriptController.h @@ -105,7 +105,7 @@ public: WTF::TextPosition eventHandlerPosition() const; void enableEval(); - void disableEval(); + void disableEval(const String& errorMessage); static bool processingUserGesture(); diff --git a/Source/WebCore/bindings/js/WorkerScriptController.cpp b/Source/WebCore/bindings/js/WorkerScriptController.cpp index 74a24b08f..55c34767b 100644 --- a/Source/WebCore/bindings/js/WorkerScriptController.cpp +++ b/Source/WebCore/bindings/js/WorkerScriptController.cpp @@ -189,12 +189,12 @@ bool WorkerScriptController::isExecutionForbidden() const return m_executionForbidden; } -void WorkerScriptController::disableEval() +void WorkerScriptController::disableEval(const String& errorMessage) { initScriptIfNeeded(); JSLockHolder lock(globalData()); - m_workerContextWrapper->setEvalEnabled(false); + m_workerContextWrapper->setEvalEnabled(false, errorMessage); } } // namespace WebCore diff --git a/Source/WebCore/bindings/js/WorkerScriptController.h b/Source/WebCore/bindings/js/WorkerScriptController.h index 3b2acd4b6..a313fb0fe 100644 --- a/Source/WebCore/bindings/js/WorkerScriptController.h +++ b/Source/WebCore/bindings/js/WorkerScriptController.h @@ -75,7 +75,7 @@ namespace WebCore { void forbidExecution(); bool isExecutionForbidden() const; - void disableEval(); + void disableEval(const String& errorMessage); JSC::JSGlobalData* globalData() { return m_globalData.get(); } diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 48cd54d9e..e3766d3ba 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -1878,9 +1878,14 @@ sub GenerateImplementation } elsif ($attribute->signature->type =~ /Constructor$/) { my $constructorType = $codeGenerator->StripModule($attribute->signature->type); $constructorType =~ s/Constructor$//; - # Constructor attribute is only used by DOMWindow.idl, so it's correct to pass castedThis as the global object - # Once JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis->globalObject() - push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis);\n"); + # When Constructor attribute is used by DOMWindow.idl, it's correct to pass castedThis as the global object + # When JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis->globalObject() + if ($interfaceName eq "DOMWindow") { + push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis);\n"); + } else { + AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{"Conditional"}); + push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis->globalObject());\n"); + } } elsif (!@{$attribute->getterExceptions}) { push(@implContent, " UNUSED_PARAM(exec);\n") if !$attribute->signature->extendedAttributes->{"CallWith"}; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index b9f4364bf..068105600 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -813,6 +813,18 @@ static v8::Handle<v8::Value> ${implClassName}ConstructorGetter(v8::Local<v8::Str END } +sub GenerateFeatureObservation +{ + my $measureAs = shift; + + if ($measureAs) { + AddToImplIncludes("FeatureObserver.h"); + return " FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::${measureAs});\n"; + } + + return ""; +} + sub GenerateNormalAttrGetter { my $attribute = shift; @@ -836,8 +848,9 @@ sub GenerateNormalAttrGetter push(@implContentDecls, <<END); static v8::Handle<v8::Value> ${attrName}AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS(\"DOM.$implClassName.$attrName._get\"); + INC_STATS("DOM.$implClassName.$attrName._get"); END + push(@implContentDecls, GenerateFeatureObservation($attrExt->{"V8MeasureAs"})); if ($svgNativeType) { my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName); @@ -1085,6 +1098,7 @@ static void ${implClassName}ReplaceableAttrSetter(v8::Local<v8::String> name, v8 { INC_STATS("DOM.$implClassName.replaceable._set"); END + push(@implContentDecls, GenerateFeatureObservation($dataNode->extendedAttributes->{"V8MeasureAs"})); if ($implClassName eq "DOMWindow" || $dataNode->extendedAttributes->{"CheckSecurity"}) { AddToImplIncludes("Frame.h"); @@ -1117,6 +1131,7 @@ sub GenerateNormalAttrSetter push(@implContentDecls, "static void ${attrName}AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n"); push(@implContentDecls, " INC_STATS(\"DOM.$implClassName.$attrName._set\");\n"); + push(@implContentDecls, GenerateFeatureObservation($attribute->signature->extendedAttributes->{"V8MeasureAs"})); # If the "StrictTypeChecking" extended attribute is present, and the attribute's type is an # interface type, then if the incoming value does not implement that interface, a TypeError is @@ -1423,6 +1438,7 @@ static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments& args) { INC_STATS(\"DOM.$implClassName.$name\"); END + push(@implContentDecls, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"})); foreach my $overload (@{$function->{overloads}}) { my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersCheck($overload); @@ -1473,6 +1489,7 @@ static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments& args) { INC_STATS(\"DOM.$implClassName.$name\"); END + push(@implContentDecls, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"})); push(@implContentDecls, GenerateArgumentsCountCheck($function, $dataNode)); @@ -1799,13 +1816,15 @@ sub GenerateConstructorCallback } } + my $maybeObserveFeature = GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}); + my @beforeArgumentList; my @afterArgumentList; push(@implContent, <<END); v8::Handle<v8::Value> V8${implClassName}::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.${implClassName}.Constructor"); - + ${maybeObserveFeature} if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function."); @@ -1976,6 +1995,8 @@ sub GenerateNamedConstructorCallback } } + my $maybeObserveFeature = GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}); + my @beforeArgumentList; my @afterArgumentList; @@ -1996,7 +2017,7 @@ END static v8::Handle<v8::Value> V8${implClassName}ConstructorCallback(const v8::Arguments& args) { INC_STATS("DOM.${implClassName}.Constructor"); - + ${maybeObserveFeature} if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function."); diff --git a/Source/WebCore/bindings/scripts/IDLAttributes.txt b/Source/WebCore/bindings/scripts/IDLAttributes.txt index 38de69d4e..df3d56d9b 100644 --- a/Source/WebCore/bindings/scripts/IDLAttributes.txt +++ b/Source/WebCore/bindings/scripts/IDLAttributes.txt @@ -119,5 +119,6 @@ V8DoNotCheckSignature V8EnabledAtRuntime=* V8EnabledPerContext=* V8GenerateIsReachable=ImplElementRoot|ImplOwnerRoot|ImplOwnerNodeRoot|ImplBaseRoot +V8MeasureAs=* V8ReadOnly V8Unforgeable diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 1cae2c80c..f48a9c833 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -38,6 +38,7 @@ #include "JSScriptProfile.h" #include "JSTestCallback.h" #include "JSTestObj.h" +#include "JSTestSubObj.h" #include "JSa.h" #include "JSb.h" #include "JSbool.h" @@ -438,7 +439,7 @@ JSValue jsTestObjConstructorStaticStringAttr(ExecState* exec, JSValue slotBase, JSValue jsTestObjConstructorTestSubObj(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); - return JSTestSubObj::getConstructor(exec, castedThis); + return JSTestSubObj::getConstructor(exec, castedThis->globalObject()); } @@ -815,7 +816,7 @@ JSValue jsTestObjConditionalAttr3(ExecState* exec, JSValue slotBase, PropertyNam JSValue jsTestObjConditionalAttr4Constructor(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); - return JSTestObjectA::getConstructor(exec, castedThis); + return JSTestObjectA::getConstructor(exec, castedThis->globalObject()); } #endif @@ -824,7 +825,7 @@ JSValue jsTestObjConditionalAttr4Constructor(ExecState* exec, JSValue slotBase, JSValue jsTestObjConditionalAttr5Constructor(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); - return JSTestObjectB::getConstructor(exec, castedThis); + return JSTestObjectB::getConstructor(exec, castedThis->globalObject()); } #endif @@ -833,7 +834,7 @@ JSValue jsTestObjConditionalAttr5Constructor(ExecState* exec, JSValue slotBase, JSValue jsTestObjConditionalAttr6Constructor(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); - return JSTestObjectC::getConstructor(exec, castedThis); + return JSTestObjectC::getConstructor(exec, castedThis->globalObject()); } #endif diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index 18775f703..f2d1fe810 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -49,7 +49,7 @@ module test { attribute long long longLongAttr; attribute unsigned long long unsignedLongLongAttr; attribute DOMString stringAttr; - attribute TestObj testObjAttr; + attribute [V8MeasureAs=TestFeature] TestObj testObjAttr; JS, V8 // WK_ucfirst, WK_lcfirst exceptional cases. @@ -75,7 +75,7 @@ module test { void voidMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); long longMethod(); long longMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); - TestObj objMethod(); + [V8MeasureAs=TestFeature] TestObj objMethod(); TestObj objMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); void methodWithSequenceArg(in sequence<ScriptProfile> sequenceArg); @@ -97,7 +97,7 @@ module test { // 'Custom' extended attribute attribute [Custom] long customAttr; - [Custom] void customMethod(); + [Custom, V8MeasureAs=CustomTestFeature] void customMethod(); [Custom] void customMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); void addEventListener(in DOMString type, diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index ac868ab99..4a5ea5bc8 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -242,7 +242,7 @@ COMPILE_ASSERT(2 == TestSupplemental::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsW v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestInterface.Constructor"); - + if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function."); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp index 5eb07eef2..0a8fe43fc 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp @@ -45,7 +45,7 @@ WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstruct static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestNamedConstructor.Constructor"); - + if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function."); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp index 558a65ab6..f4a4b452d 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp @@ -43,7 +43,7 @@ template <typename T> void V8_USE(T) { } v8::Handle<v8::Value> V8TestNode::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestNode.Constructor"); - + if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function."); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index c4341b2ae..502428a71 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -26,6 +26,7 @@ #include "DOMStringList.h" #include "Dictionary.h" #include "ExceptionCode.h" +#include "FeatureObserver.h" #include "Frame.h" #include "HTMLNames.h" #include "IDBBindingUtilities.h" @@ -227,6 +228,7 @@ static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.testObjAttr._get"); + FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature); TestObj* imp = V8TestObj::toNative(info.Holder()); return toV8(imp->testObjAttr(), info.Holder(), info.GetIsolate()); } @@ -234,6 +236,7 @@ static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, c static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.testObjAttr._set"); + FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature); TestObj* imp = V8TestObj::toNative(info.Holder()); TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; imp->setTestObjAttr(WTF::getPtr(v)); @@ -1094,6 +1097,7 @@ static v8::Handle<v8::Value> MethodWithArgsCallback(const v8::Arguments& args) static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.objMethod"); + FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature); TestObj* imp = V8TestObj::toNative(args.Holder()); return toV8(imp->objMethod(), args.Holder(), args.GetIsolate()); } @@ -1928,7 +1932,7 @@ static const V8DOMConfiguration::BatchedAttribute V8TestObjAttrs[] = { {"unsignedLongLongAttr", TestObjV8Internal::unsignedLongLongAttrAttrGetter, TestObjV8Internal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '') {"stringAttr", TestObjV8Internal::stringAttrAttrGetter, TestObjV8Internal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '') + // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: 'V8MeasureAs') {"testObjAttr", TestObjV8Internal::testObjAttrAttrGetter, TestObjV8Internal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '') {"XMLObjAttr", TestObjV8Internal::XMLObjAttrAttrGetter, TestObjV8Internal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, @@ -2122,7 +2126,7 @@ COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCh v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.Constructor"); - + if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function."); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp index f2f4cba21..3930d69f7 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp @@ -210,7 +210,7 @@ static const V8DOMConfiguration::BatchedCallback V8TestSerializedScriptValueInte v8::Handle<v8::Value> V8TestSerializedScriptValueInterface::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestSerializedScriptValueInterface.Constructor"); - + if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function."); diff --git a/Source/WebCore/bindings/v8/DOMDataStore.cpp b/Source/WebCore/bindings/v8/DOMDataStore.cpp index 5c70cf843..dc0896cf3 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.cpp +++ b/Source/WebCore/bindings/v8/DOMDataStore.cpp @@ -122,10 +122,10 @@ void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type) void DOMDataStore::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding); - info.addInstrumentedMember(m_domNodeMap); - info.addInstrumentedMember(m_activeDomNodeMap); - info.addInstrumentedMember(m_domObjectMap); - info.addInstrumentedMember(m_activeDomObjectMap); + info.addWeakPointer(m_domNodeMap); + info.addWeakPointer(m_activeDomNodeMap); + info.addWeakPointer(m_domObjectMap); + info.addWeakPointer(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 babdb049f..377167548 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.h +++ b/Source/WebCore/bindings/v8/DOMDataStore.h @@ -86,7 +86,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(MemoryObjectInfo*) const; + virtual void reportMemoryUsage(MemoryObjectInfo*) const; protected: static void weakDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject); diff --git a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp index 4174b7052..1f3008e78 100644 --- a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp +++ b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp @@ -209,25 +209,6 @@ PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValue& valu return createIDBKeyFromScriptValueAndKeyPath(value, keyPath.string()); } -static PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> prpValue, const String& keyPath) -{ - Vector<String> keyPathElements; - IDBKeyPathParseError error; - IDBParseKeyPath(keyPath, keyPathElements, error); - ASSERT(error == IDBKeyPathParseErrorNone); - - RefPtr<SerializedScriptValue> value = prpValue; - - v8::HandleScope handleScope; - v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext()); - - v8::Handle<v8::Value> v8Value(value->deserialize()); - v8::Handle<v8::Value> v8Key(getNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size())); - if (v8Key.IsEmpty()) - return 0; - return createIDBKeyFromValue(v8Key); -} - // FIXME: The only reason this exists is because we need a v8::Context and scope inside a timer. Is there a better / more general way to do this? ScriptValue deserializeIDBValue(ScriptExecutionContext* scriptContext, PassRefPtr<SerializedScriptValue> prpValue) { @@ -236,32 +217,9 @@ ScriptValue deserializeIDBValue(ScriptExecutionContext* scriptContext, PassRefPt return ScriptValue(prpValue->deserialize()); } -PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> prpValue, const IDBKeyPath& keyPath) -{ - IDB_TRACE("createIDBKeyFromSerializedValueAndKeyPath"); - ASSERT(!keyPath.isNull()); - - RefPtr<SerializedScriptValue> value = prpValue; - - if (keyPath.type() == IDBKeyPath::ArrayType) { - IDBKey::KeyArray result; - const Vector<String>& array = keyPath.array(); - for (size_t i = 0; i < array.size(); ++i) { - RefPtr<IDBKey> key = createIDBKeyFromSerializedValueAndKeyPath(value, array[i]); - if (!key) - return 0; - result.append(key); - } - return IDBKey::createArray(result); - } - - ASSERT(keyPath.type() == IDBKeyPath::StringType); - return createIDBKeyFromSerializedValueAndKeyPath(value, keyPath.string()); -} - -PassRefPtr<SerializedScriptValue> injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const IDBKeyPath& keyPath) +bool injectIDBKeyIntoScriptValue(PassRefPtr<IDBKey> key, ScriptValue& value, const IDBKeyPath& keyPath) { - IDB_TRACE("injectIDBKeyIntoSerializedValue"); + IDB_TRACE("injectIDBKeyIntoScriptValue"); ASSERT(keyPath.type() == IDBKeyPath::StringType); Vector<String> keyPathElements; @@ -275,15 +233,15 @@ PassRefPtr<SerializedScriptValue> injectIDBKeyIntoSerializedValue(PassRefPtr<IDB v8::HandleScope handleScope; v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext()); - v8::Handle<v8::Value> v8Value(value->deserialize()); + v8::Handle<v8::Value> v8Value(value.v8Value()); v8::Handle<v8::Value> parent(ensureNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size() - 1)); if (parent.IsEmpty()) - return 0; + return false; if (!set(parent, keyPathElements.last(), toV8(key.get()))) - return 0; + return false; - return SerializedScriptValue::create(v8Value); + return true; } bool canInjectIDBKeyIntoScriptValue(const ScriptValue& scriptValue, const IDBKeyPath& keyPath) diff --git a/Source/WebCore/bindings/v8/IDBBindingUtilities.h b/Source/WebCore/bindings/v8/IDBBindingUtilities.h index b2b629f58..a482dc974 100644 --- a/Source/WebCore/bindings/v8/IDBBindingUtilities.h +++ b/Source/WebCore/bindings/v8/IDBBindingUtilities.h @@ -40,10 +40,7 @@ class SerializedScriptValue; PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value>); -// FIXME: remove the SerializedValue versions when their use is finally removed in https://bugs.webkit.org/show_bug.cgi?id=95409. -PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue>, const IDBKeyPath&); -PassRefPtr<SerializedScriptValue> injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>, const IDBKeyPath&); - +bool injectIDBKeyIntoScriptValue(PassRefPtr<IDBKey>, ScriptValue&, const IDBKeyPath&); PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValue&, const IDBKeyPath&); bool canInjectIDBKeyIntoScriptValue(const ScriptValue&, const IDBKeyPath&); ScriptValue deserializeIDBValue(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>); diff --git a/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h b/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h index 8f069201c..ae20d0369 100644 --- a/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h +++ b/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h @@ -187,7 +187,7 @@ public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding); - info.addInstrumentedMember(m_table); + info.addMember(m_table); } private: diff --git a/Source/WebCore/bindings/v8/ScopedDOMDataStore.cpp b/Source/WebCore/bindings/v8/ScopedDOMDataStore.cpp index 38fe42983..f95136658 100644 --- a/Source/WebCore/bindings/v8/ScopedDOMDataStore.cpp +++ b/Source/WebCore/bindings/v8/ScopedDOMDataStore.cpp @@ -31,6 +31,8 @@ #include "config.h" #include "ScopedDOMDataStore.h" +#include "WebCoreMemoryInstrumentation.h" + namespace WebCore { ScopedDOMDataStore::ScopedDOMDataStore() @@ -50,4 +52,14 @@ ScopedDOMDataStore::~ScopedDOMDataStore() delete m_activeDomObjectMap; } +void ScopedDOMDataStore::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding); + DOMDataStore::reportMemoryUsage(memoryObjectInfo); + info.addMember(m_domNodeMap); + info.addMember(m_activeDomNodeMap); + info.addMember(m_domObjectMap); + info.addMember(m_activeDomObjectMap); +} + } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScopedDOMDataStore.h b/Source/WebCore/bindings/v8/ScopedDOMDataStore.h index 7b1e8c471..7c63b6b9f 100644 --- a/Source/WebCore/bindings/v8/ScopedDOMDataStore.h +++ b/Source/WebCore/bindings/v8/ScopedDOMDataStore.h @@ -49,6 +49,8 @@ namespace WebCore { // This can be called when WTF thread is tearing down. // We assume that all child threads running V8 instances are created by WTF. virtual ~ScopedDOMDataStore(); + + virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index 211ba947a..fb9d557e9 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -485,7 +485,7 @@ void ScriptController::enableEval() v8Context->AllowCodeGenerationFromStrings(true); } -void ScriptController::disableEval() +void ScriptController::disableEval(const String& /* errorMessage */) { v8::HandleScope handleScope; v8::Handle<v8::Context> v8Context = windowShell()->context(); diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index 040215238..dffee3503 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -121,7 +121,7 @@ public: bool haveInterpreter() const; void enableEval(); - void disableEval(); + void disableEval(const String& errorMessage); static bool canAccessFromCurrentOrigin(Frame*); diff --git a/Source/WebCore/bindings/v8/StaticDOMDataStore.cpp b/Source/WebCore/bindings/v8/StaticDOMDataStore.cpp index 4ced6a23e..5d9d09ce1 100644 --- a/Source/WebCore/bindings/v8/StaticDOMDataStore.cpp +++ b/Source/WebCore/bindings/v8/StaticDOMDataStore.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "StaticDOMDataStore.h" #include "V8Binding.h" +#include "WebCoreMemoryInstrumentation.h" namespace WebCore { @@ -53,4 +54,14 @@ StaticDOMDataStore::~StaticDOMDataStore() V8PerIsolateData::current()->unregisterDOMDataStore(this); } +void StaticDOMDataStore::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding); + DOMDataStore::reportMemoryUsage(memoryObjectInfo); + info.addMember(m_staticDomNodeMap); + info.addMember(m_staticActiveDomNodeMap); + info.addMember(m_staticDomObjectMap); + info.addMember(m_staticActiveDomObjectMap); +} + } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/StaticDOMDataStore.h b/Source/WebCore/bindings/v8/StaticDOMDataStore.h index 2d00b27d9..f9c57fc0f 100644 --- a/Source/WebCore/bindings/v8/StaticDOMDataStore.h +++ b/Source/WebCore/bindings/v8/StaticDOMDataStore.h @@ -49,6 +49,8 @@ public: StaticDOMDataStore(); virtual ~StaticDOMDataStore(); + virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; + private: IntrusiveDOMWrapperMap m_staticDomNodeMap; IntrusiveDOMWrapperMap m_staticActiveDomNodeMap; diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp index b288a6f81..febae75a1 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -201,8 +201,7 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(v8::Local<v8::Value> va return 0; if (lookup == ListenerFindOnly) return V8EventListenerList::findWrapper(value, isAttribute); - v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype()); - if (isWrapperOfType(globalPrototype, &V8DOMWindow::info)) + if (isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindow::info)) return V8EventListenerList::findOrCreateWrapper<V8EventListener>(value, isAttribute); #if ENABLE(WORKERS) return V8EventListenerList::findOrCreateWrapper<V8WorkerContextEventListener>(value, isAttribute); diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index 587711f0c..f3e217993 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -241,7 +241,7 @@ typedef Vector<GrouperItem> GrouperList; // element of the tree to which it belongs. static GroupId calculateGroupId(Node* node) { - if (node->inDocument() || (node->hasTagName(HTMLNames::imgTag) && static_cast<HTMLImageElement*>(node)->hasPendingLoadEvent())) + if (node->inDocument() || (node->hasTagName(HTMLNames::imgTag) && static_cast<HTMLImageElement*>(node)->hasPendingActivity())) return GroupId(node->document()); Node* root = node; diff --git a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp index cdb00179f..a40bf1a63 100644 --- a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp @@ -124,7 +124,7 @@ void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context) if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) return; // Use the outer scope to hold context. - v8::Local<v8::Context> v8Context = worldContext().adjustedContext(frame->script()); + v8::Local<v8::Context> v8Context = toV8Context(context, worldContext()); // Bail out if we cannot get the context. if (v8Context.IsEmpty()) return; diff --git a/Source/WebCore/bindings/v8/V8PerIsolateData.cpp b/Source/WebCore/bindings/v8/V8PerIsolateData.cpp index a7fc8d620..e1bc31e5c 100644 --- a/Source/WebCore/bindings/v8/V8PerIsolateData.cpp +++ b/Source/WebCore/bindings/v8/V8PerIsolateData.cpp @@ -86,11 +86,11 @@ void V8PerIsolateData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding); info.addHashMap(m_rawTemplates); info.addHashMap(m_templates); - info.addInstrumentedMember(m_stringCache); + info.addMember(m_stringCache); info.addVector(m_domDataList); for (size_t i = 0; i < m_domDataList.size(); i++) - info.addInstrumentedMember(m_domDataList[i]); + info.addMember(m_domDataList[i]); } #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/bindings/v8/WorkerScriptController.cpp b/Source/WebCore/bindings/v8/WorkerScriptController.cpp index bbd9158be..70208e1fe 100644 --- a/Source/WebCore/bindings/v8/WorkerScriptController.cpp +++ b/Source/WebCore/bindings/v8/WorkerScriptController.cpp @@ -132,7 +132,7 @@ bool WorkerScriptController::isExecutionForbidden() const return m_executionForbidden; } -void WorkerScriptController::disableEval() +void WorkerScriptController::disableEval(const String& /* errorMessage */) { m_proxy->setEvalAllowed(false); } diff --git a/Source/WebCore/bindings/v8/WorkerScriptController.h b/Source/WebCore/bindings/v8/WorkerScriptController.h index 61ed7abc1..68ce89aae 100644 --- a/Source/WebCore/bindings/v8/WorkerScriptController.h +++ b/Source/WebCore/bindings/v8/WorkerScriptController.h @@ -73,7 +73,7 @@ namespace WebCore { void forbidExecution(); bool isExecutionForbidden() const; - void disableEval(); + void disableEval(const String&); // Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context. static WorkerScriptController* controllerForContext(); diff --git a/Source/WebCore/bindings/v8/WorldContextHandle.cpp b/Source/WebCore/bindings/v8/WorldContextHandle.cpp index 180280abc..34b9c19bf 100644 --- a/Source/WebCore/bindings/v8/WorldContextHandle.cpp +++ b/Source/WebCore/bindings/v8/WorldContextHandle.cpp @@ -32,6 +32,8 @@ #include "WorldContextHandle.h" #include "ScriptController.h" +#include "V8Binding.h" +#include "V8DOMWindow.h" #include "V8DOMWindowShell.h" namespace WebCore { @@ -39,9 +41,22 @@ namespace WebCore { WorldContextHandle::WorldContextHandle(WorldToUse worldToUse) : m_worldToUse(worldToUse) { - if (worldToUse == UseMainWorld) + if (worldToUse == UseMainWorld || worldToUse == UseWorkerWorld) return; +#if ENABLE(WORKERS) + // FIXME We are duplicating a lot of effort here checking the context for the worker and for the isolated world. + if (v8::Context::InContext()) { + v8::Handle<v8::Context> context = v8::Context::GetCurrent(); + if (!context.IsEmpty()) { + if (UNLIKELY(!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindow::info))) { + m_worldToUse = UseWorkerWorld; + return; + } + } + } +#endif + V8DOMWindowShell* shell = V8DOMWindowShell::getEntered(); if (LIKELY(!shell)) { m_worldToUse = UseMainWorld; @@ -54,6 +69,7 @@ WorldContextHandle::WorldContextHandle(WorldToUse worldToUse) v8::Local<v8::Context> WorldContextHandle::adjustedContext(ScriptController* script) const { + ASSERT(m_worldToUse != UseWorkerWorld); if (m_worldToUse == UseMainWorld) return script->mainWorldContext(); diff --git a/Source/WebCore/bindings/v8/WorldContextHandle.h b/Source/WebCore/bindings/v8/WorldContextHandle.h index 5574742ae..7565d15cd 100644 --- a/Source/WebCore/bindings/v8/WorldContextHandle.h +++ b/Source/WebCore/bindings/v8/WorldContextHandle.h @@ -40,7 +40,7 @@ namespace WebCore { class ScriptController; -enum WorldToUse { UseMainWorld, UseCurrentWorld }; +enum WorldToUse { UseMainWorld, UseCurrentWorld, UseWorkerWorld }; class WorldContextHandle { public: diff --git a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index e57c6d1b4..0b468d4be 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -357,11 +357,13 @@ v8::Handle<v8::Value> V8DOMWindow::postMessageCallback(const v8::Arguments& args return handlePostMessageCallback(args); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) v8::Handle<v8::Value> V8DOMWindow::webkitPostMessageCallback(const v8::Arguments& args) { INC_STATS("DOM.DOMWindow.webkitPostMessage()"); return handlePostMessageCallback(args); } +#endif // FIXME(fqian): returning string is cheating, and we should // fix this by calling toString function on the receiver. diff --git a/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp index d2a24186b..ff68c3414 100644 --- a/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp @@ -71,11 +71,13 @@ v8::Handle<v8::Value> V8DedicatedWorkerContext::postMessageCallback(const v8::Ar return handlePostMessageCallback(args); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) v8::Handle<v8::Value> V8DedicatedWorkerContext::webkitPostMessageCallback(const v8::Arguments& args) { INC_STATS("DOM.DedicatedWorkerContext.postMessage"); return handlePostMessageCallback(args); } +#endif } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp index e6257eec3..5d71e429e 100644 --- a/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp @@ -31,7 +31,7 @@ #include "V8IDBAny.h" -#include "SerializedScriptValue.h" +#include "ScriptValue.h" #include "V8Binding.h" #include "V8DOMStringList.h" #include "V8IDBCursor.h" @@ -73,10 +73,12 @@ v8::Handle<v8::Value> toV8(IDBAny* impl, v8::Handle<v8::Object> creationContext, return toV8(impl->idbObjectStore(), creationContext, isolate); case IDBAny::IDBTransactionType: return toV8(impl->idbTransaction(), creationContext, isolate); - case IDBAny::SerializedScriptValueType: - return impl->serializedScriptValue()->deserialize(0, isolate); + case IDBAny::ScriptValueType: + return impl->scriptValue().v8Value(); case IDBAny::StringType: return v8String(impl->string(), isolate); + case IDBAny::IntegerType: + return v8::Number::New(impl->integer()); } ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp index 544c7bb2a..5c0a1f5db 100644 --- a/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp @@ -70,10 +70,12 @@ v8::Handle<v8::Value> V8MessagePort::postMessageCallback(const v8::Arguments& ar return handlePostMessageCallback(args); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) v8::Handle<v8::Value> V8MessagePort::webkitPostMessageCallback(const v8::Arguments& args) { INC_STATS("DOM.MessagePort.webkitPostMessage"); return handlePostMessageCallback(args); } +#endif } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp index 1b4f29c3c..0c105fee5 100644 --- a/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp @@ -76,12 +76,13 @@ v8::Handle<v8::Value> V8Worker::postMessageCallback(const v8::Arguments& args) return handlePostMessageCallback(args); } +#if ENABLE(LEGACY_VENDOR_PREFIXES) v8::Handle<v8::Value> V8Worker::webkitPostMessageCallback(const v8::Arguments& args) { INC_STATS("DOM.Worker.webkitPostMessage"); return handlePostMessageCallback(args); } - +#endif } // namespace WebCore diff --git a/Source/WebCore/css/CSSBorderImageSliceValue.cpp b/Source/WebCore/css/CSSBorderImageSliceValue.cpp index 02343f905..7d1b3daf7 100644 --- a/Source/WebCore/css/CSSBorderImageSliceValue.cpp +++ b/Source/WebCore/css/CSSBorderImageSliceValue.cpp @@ -53,7 +53,7 @@ String CSSBorderImageSliceValue::customCssText() const void CSSBorderImageSliceValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_slices); + info.addMember(m_slices); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSCalculationValue.cpp b/Source/WebCore/css/CSSCalculationValue.cpp index c24bfd966..1c158cc2c 100644 --- a/Source/WebCore/css/CSSCalculationValue.cpp +++ b/Source/WebCore/css/CSSCalculationValue.cpp @@ -226,7 +226,7 @@ public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_value); + info.addMember(m_value); } private: @@ -324,8 +324,8 @@ public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_leftSide); - info.addInstrumentedMember(m_rightSide); + info.addMember(m_leftSide); + info.addMember(m_rightSide); } static String buildCssText(const String& leftExpression, const String& rightExpression, CalcOperator op) diff --git a/Source/WebCore/css/CSSCanvasValue.cpp b/Source/WebCore/css/CSSCanvasValue.cpp index 8ecc80c08..787a1742c 100644 --- a/Source/WebCore/css/CSSCanvasValue.cpp +++ b/Source/WebCore/css/CSSCanvasValue.cpp @@ -100,8 +100,8 @@ void CSSCanvasValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectI { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_name); - info.addInstrumentedMember(m_element); + info.addMember(m_name); + info.addMember(m_element); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSCharsetRule.cpp b/Source/WebCore/css/CSSCharsetRule.cpp index 97bfc0586..7a1b5d4ac 100644 --- a/Source/WebCore/css/CSSCharsetRule.cpp +++ b/Source/WebCore/css/CSSCharsetRule.cpp @@ -40,7 +40,7 @@ void CSSCharsetRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectI { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_encoding); + info.addMember(m_encoding); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 1f8c9cca9..8f9418c00 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -64,10 +64,12 @@ #include <wtf/text/StringBuilder.h> #if ENABLE(CSS_SHADERS) +#include "CustomFilterArrayParameter.h" #include "CustomFilterNumberParameter.h" #include "CustomFilterOperation.h" #include "CustomFilterParameter.h" #include "CustomFilterTransformParameter.h" +#include "WebKitCSSArrayFunctionValue.h" #include "WebKitCSSMixFunctionValue.h" #endif @@ -771,6 +773,14 @@ static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend } #if ENABLE(CSS_SHADERS) +static PassRefPtr<CSSValue> valueForCustomFilterArrayParameter(const CustomFilterArrayParameter* arrayParameter) +{ + RefPtr<WebKitCSSArrayFunctionValue> arrayParameterValue = WebKitCSSArrayFunctionValue::create(); + for (unsigned i = 0, size = arrayParameter->size(); i < size; ++i) + arrayParameterValue->append(cssValuePool().createValue(arrayParameter->valueAt(i), CSSPrimitiveValue::CSS_NUMBER)); + return arrayParameterValue.release(); +} + static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilterNumberParameter* numberParameter) { RefPtr<CSSValueList> numberParameterValue = CSSValueList::createSpaceSeparated(); @@ -793,6 +803,8 @@ static PassRefPtr<CSSValue> valueForCustomFilterParameter(const RenderObject* re // FIXME: Add here computed style for the other types: boolean, transform, matrix, texture. ASSERT(parameter); switch (parameter->parameterType()) { + case CustomFilterParameter::ARRAY: + return valueForCustomFilterArrayParameter(static_cast<const CustomFilterArrayParameter*>(parameter)); case CustomFilterParameter::NUMBER: return valueForCustomFilterNumberParameter(static_cast<const CustomFilterNumberParameter*>(parameter)); case CustomFilterParameter::TRANSFORM: @@ -2405,9 +2417,11 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyCounterReset: return counterToCSSValue(style.get(), propertyID); case CSSPropertyWebkitClipPath: - if (!style->clipPath()) - return cssValuePool().createIdentifierValue(CSSValueNone); - return valueForBasicShape(style->clipPath()); + if (ClipPathOperation* operation = style->clipPath()) { + if (operation->getOperationType() == ClipPathOperation::SHAPE) + return valueForBasicShape(static_cast<ShapeClipPathOperation*>(operation)->basicShape()); + } + return cssValuePool().createIdentifierValue(CSSValueNone); #if ENABLE(CSS_REGIONS) case CSSPropertyWebkitFlowInto: if (style->flowThread().isNull()) @@ -2735,7 +2749,7 @@ PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(co void CSSComputedStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_node); + info.addMember(m_node); } CSSRule* CSSComputedStyleDeclaration::parentRule() const diff --git a/Source/WebCore/css/CSSCrossfadeValue.cpp b/Source/WebCore/css/CSSCrossfadeValue.cpp index e347ebd09..a224a3611 100644 --- a/Source/WebCore/css/CSSCrossfadeValue.cpp +++ b/Source/WebCore/css/CSSCrossfadeValue.cpp @@ -143,9 +143,9 @@ void CSSCrossfadeValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObje { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_fromValue); - info.addInstrumentedMember(m_toValue); - info.addInstrumentedMember(m_percentageValue); + info.addMember(m_fromValue); + info.addMember(m_toValue); + info.addMember(m_percentageValue); // FIXME: add instrumentation for // m_cachedFromImage // m_cachedToImage diff --git a/Source/WebCore/css/CSSFontFaceRule.cpp b/Source/WebCore/css/CSSFontFaceRule.cpp index 0dceb8a4d..7d851ed1e 100644 --- a/Source/WebCore/css/CSSFontFaceRule.cpp +++ b/Source/WebCore/css/CSSFontFaceRule.cpp @@ -72,8 +72,8 @@ void CSSFontFaceRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObject { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_fontFaceRule); - info.addInstrumentedMember(m_propertiesCSSOMWrapper); + info.addMember(m_fontFaceRule); + info.addMember(m_propertiesCSSOMWrapper); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSFontFaceSrcValue.cpp b/Source/WebCore/css/CSSFontFaceSrcValue.cpp index 0505f60ad..2a1c04787 100644 --- a/Source/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/Source/WebCore/css/CSSFontFaceSrcValue.cpp @@ -104,11 +104,11 @@ CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document) void CSSFontFaceSrcValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_resource); - info.addInstrumentedMember(m_format); + info.addMember(m_resource); + info.addMember(m_format); // FIXME: add m_cachedFont when MemoryCache is instrumented. #if ENABLE(SVG_FONTS) - info.addInstrumentedMember(m_svgFontFaceElement); + info.addMember(m_svgFontFaceElement); #endif } diff --git a/Source/WebCore/css/CSSFunctionValue.cpp b/Source/WebCore/css/CSSFunctionValue.cpp index 46a98f9b0..bc270de68 100644 --- a/Source/WebCore/css/CSSFunctionValue.cpp +++ b/Source/WebCore/css/CSSFunctionValue.cpp @@ -55,8 +55,8 @@ String CSSFunctionValue::customCssText() const void CSSFunctionValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_name); - info.addInstrumentedMember(m_args); + info.addMember(m_name); + info.addMember(m_args); } } diff --git a/Source/WebCore/css/CSSGradientValue.cpp b/Source/WebCore/css/CSSGradientValue.cpp index fc485f918..f9715f27f 100644 --- a/Source/WebCore/css/CSSGradientValue.cpp +++ b/Source/WebCore/css/CSSGradientValue.cpp @@ -47,8 +47,8 @@ namespace WebCore { void CSSGradientColorStop::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_position); - info.addInstrumentedMember(m_color); + info.addMember(m_position); + info.addMember(m_color); } PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize& size) @@ -465,10 +465,10 @@ void CSSGradientValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObject { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_firstX); - info.addInstrumentedMember(m_firstY); - info.addInstrumentedMember(m_secondX); - info.addInstrumentedMember(m_secondY); + info.addMember(m_firstX); + info.addMember(m_firstY); + info.addMember(m_secondX); + info.addMember(m_secondY); info.addInstrumentedVector(m_stops); } @@ -638,7 +638,7 @@ void CSSLinearGradientValue::reportDescendantMemoryUsage(MemoryObjectInfo* memor { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSGradientValue::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_angle); + info.addMember(m_angle); } String CSSRadialGradientValue::customCssText() const @@ -963,12 +963,12 @@ void CSSRadialGradientValue::reportDescendantMemoryUsage(MemoryObjectInfo* memor { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSGradientValue::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_firstRadius); - info.addInstrumentedMember(m_secondRadius); - info.addInstrumentedMember(m_shape); - info.addInstrumentedMember(m_sizingBehavior); - info.addInstrumentedMember(m_endHorizontalSize); - info.addInstrumentedMember(m_endVerticalSize); + info.addMember(m_firstRadius); + info.addMember(m_secondRadius); + info.addMember(m_shape); + info.addMember(m_sizingBehavior); + info.addMember(m_endHorizontalSize); + info.addMember(m_endVerticalSize); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSImageSetValue.cpp b/Source/WebCore/css/CSSImageSetValue.cpp index 568d756f4..5e6bee5a6 100644 --- a/Source/WebCore/css/CSSImageSetValue.cpp +++ b/Source/WebCore/css/CSSImageSetValue.cpp @@ -174,7 +174,7 @@ void CSSImageSetValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjec void CSSImageSetValue::ImageWithScale::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(imageURL); + info.addMember(imageURL); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSImageValue.cpp b/Source/WebCore/css/CSSImageValue.cpp index c370bdc65..726c2c043 100644 --- a/Source/WebCore/css/CSSImageValue.cpp +++ b/Source/WebCore/css/CSSImageValue.cpp @@ -129,7 +129,7 @@ PassRefPtr<CSSValue> CSSImageValue::cloneForCSSOM() const void CSSImageValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_url); + info.addMember(m_url); // No need to report m_image as it is counted as part of RenderArena. } diff --git a/Source/WebCore/css/CSSImportRule.cpp b/Source/WebCore/css/CSSImportRule.cpp index 772f36589..3bbe650a5 100644 --- a/Source/WebCore/css/CSSImportRule.cpp +++ b/Source/WebCore/css/CSSImportRule.cpp @@ -81,16 +81,9 @@ void CSSImportRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectIn { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_importRule); - info.addInstrumentedMember(m_mediaCSSOMWrapper); - info.addInstrumentedMember(m_styleSheetCSSOMWrapper); -} - -void CSSImportRule::reattachStyleSheetContents() -{ - ASSERT(m_styleSheetCSSOMWrapper); - ASSERT(!parentStyleSheet() || parentStyleSheet()->contents()->hasOneClient()); - m_importRule->reattachStyleSheetContents(m_styleSheetCSSOMWrapper->contents()); + info.addMember(m_importRule); + info.addMember(m_mediaCSSOMWrapper); + info.addMember(m_styleSheetCSSOMWrapper); } CSSStyleSheet* CSSImportRule::styleSheet() const diff --git a/Source/WebCore/css/CSSImportRule.h b/Source/WebCore/css/CSSImportRule.h index e7921f76d..c835f7dd5 100644 --- a/Source/WebCore/css/CSSImportRule.h +++ b/Source/WebCore/css/CSSImportRule.h @@ -45,8 +45,6 @@ public: void reportDescendantMemoryUsage(MemoryObjectInfo*) const; - void reattachStyleSheetContents(); - private: CSSImportRule(StyleRuleImport*, CSSStyleSheet*); diff --git a/Source/WebCore/css/CSSMediaRule.cpp b/Source/WebCore/css/CSSMediaRule.cpp index 4542d3e48..f0e9c79c3 100644 --- a/Source/WebCore/css/CSSMediaRule.cpp +++ b/Source/WebCore/css/CSSMediaRule.cpp @@ -179,9 +179,9 @@ void CSSMediaRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInf { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_mediaCSSOMWrapper); + info.addMember(m_mediaCSSOMWrapper); info.addInstrumentedVector(m_childRuleCSSOMWrappers); - info.addInstrumentedMember(m_ruleListCSSOMWrapper); + info.addMember(m_ruleListCSSOMWrapper); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSPageRule.cpp b/Source/WebCore/css/CSSPageRule.cpp index 839bc20f7..fcb22f48c 100644 --- a/Source/WebCore/css/CSSPageRule.cpp +++ b/Source/WebCore/css/CSSPageRule.cpp @@ -106,8 +106,8 @@ void CSSPageRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_pageRule); - info.addInstrumentedMember(m_propertiesCSSOMWrapper); + info.addMember(m_pageRule); + info.addMember(m_propertiesCSSOMWrapper); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 09eb63666..efd9bae3a 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -199,6 +199,7 @@ CSSParserContext::CSSParserContext(CSSParserMode mode, const KURL& baseURL) , mode(mode) , isHTMLDocument(false) , isCSSCustomFilterEnabled(false) + , isCSSStickyPositionEnabled(false) , isCSSRegionsEnabled(false) , isCSSGridLayoutEnabled(false) #if ENABLE(CSS_VARIABLES) @@ -215,6 +216,7 @@ CSSParserContext::CSSParserContext(Document* document, const KURL& baseURL, cons , mode(document->inQuirksMode() ? CSSQuirksMode : CSSStrictMode) , isHTMLDocument(document->isHTMLDocument()) , isCSSCustomFilterEnabled(document->settings() ? document->settings()->isCSSCustomFilterEnabled() : false) + , isCSSStickyPositionEnabled(document->cssStickyPositionEnabled()) , isCSSRegionsEnabled(document->cssRegionsEnabled()) , isCSSGridLayoutEnabled(document->cssGridLayoutEnabled()) #if ENABLE(CSS_VARIABLES) @@ -232,6 +234,7 @@ bool operator==(const CSSParserContext& a, const CSSParserContext& b) && a.mode == b.mode && a.isHTMLDocument == b.isHTMLDocument && a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled + && a.isCSSStickyPositionEnabled == b.isCSSStickyPositionEnabled && a.isCSSRegionsEnabled == b.isCSSRegionsEnabled && a.isCSSGridLayoutEnabled == b.isCSSGridLayoutEnabled #if ENABLE(CSS_VARIABLES) @@ -670,7 +673,7 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int case CSSPropertyPosition: // static | relative | absolute | fixed | sticky | inherit if (valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed #if ENABLE(CSS_STICKY_POSITION) - || valueID == CSSValueWebkitSticky + || (parserContext.isCSSStickyPositionEnabled && valueID == CSSValueWebkitSticky) #endif ) return true; @@ -3200,18 +3203,19 @@ bool CSSParser::parseAnimationShorthand(bool important) bool CSSParser::parseTransitionShorthand(bool important) { - const unsigned numProperties = webkitTransitionShorthand().length(); + const unsigned numProperties = 4; + ASSERT(numProperties == webkitTransitionShorthand().length()); ShorthandScope scope(this, CSSPropertyWebkitTransition); - bool parsedProperty[] = { false, false, false, false }; - RefPtr<CSSValue> values[4]; + bool parsedProperty[numProperties] = { false }; + RefPtr<CSSValue> values[numProperties]; unsigned i; while (m_valueList->current()) { CSSParserValue* val = m_valueList->current(); if (val->unit == CSSParserValue::Operator && val->iValue == ',') { - // We hit the end. Fill in all remaining values with the initial value. + // We hit the end. Fill in all remaining values with the initial value. m_valueList->next(); for (i = 0; i < numProperties; ++i) { if (!parsedProperty[i]) @@ -10414,12 +10418,12 @@ static CSSPropertyID cssPropertyID(const CharacterType* propertyName, unsigned l const Property* hashTableEntry = findProperty(name, length); const CSSPropertyID propertyID = hashTableEntry ? static_cast<CSSPropertyID>(hashTableEntry->id) : CSSPropertyInvalid; - // 600 is comfortably larger than numCSSProperties to allow for growth - static const int CSSPropertyHistogramSize = 600; - COMPILE_ASSERT(CSSPropertyHistogramSize > numCSSProperties, number_of_css_properties_exceed_CSSPropertyHistogramSize); - - if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid) - HistogramSupport::histogramEnumeration("CSS.PrefixUsage", max(1, propertyID - firstCSSProperty), CSSPropertyHistogramSize); + static const int cssPropertyHistogramSize = numCSSProperties; + if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid) { + int histogramValue = propertyID - firstCSSProperty; + ASSERT(0 <= histogramValue && histogramValue < cssPropertyHistogramSize); + HistogramSupport::histogramEnumeration("CSS.PrefixUsage", histogramValue, cssPropertyHistogramSize); + } return propertyID; } diff --git a/Source/WebCore/css/CSSParserMode.h b/Source/WebCore/css/CSSParserMode.h index 7248bb55a..bf77c3c7b 100644 --- a/Source/WebCore/css/CSSParserMode.h +++ b/Source/WebCore/css/CSSParserMode.h @@ -65,6 +65,7 @@ public: CSSParserMode mode; bool isHTMLDocument; bool isCSSCustomFilterEnabled; + bool isCSSStickyPositionEnabled; bool isCSSRegionsEnabled; bool isCSSGridLayoutEnabled; #if ENABLE(CSS_VARIABLES) diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp index 5d2a7f7e4..922a0f68c 100644 --- a/Source/WebCore/css/CSSPrimitiveValue.cpp +++ b/Source/WebCore/css/CSSPrimitiveValue.cpp @@ -1275,7 +1275,7 @@ void CSSPrimitiveValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObje case CSS_VARIABLE_NAME: #endif // FIXME: detect other cases when m_value is StringImpl* - info.addInstrumentedMember(m_value.string); + info.addMember(m_value.string); break; case CSS_COUNTER: info.addMember(m_value.counter); diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp index f122fa1c5..c7633f8db 100644 --- a/Source/WebCore/css/CSSProperty.cpp +++ b/Source/WebCore/css/CSSProperty.cpp @@ -715,7 +715,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) void CSSProperty::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_value); + info.addMember(m_value); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSReflectValue.cpp b/Source/WebCore/css/CSSReflectValue.cpp index 7ccb76ecf..9439d600e 100644 --- a/Source/WebCore/css/CSSReflectValue.cpp +++ b/Source/WebCore/css/CSSReflectValue.cpp @@ -70,8 +70,8 @@ void CSSReflectValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const Sty void CSSReflectValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_offset); - info.addInstrumentedMember(m_mask); + info.addMember(m_offset); + info.addMember(m_mask); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSRule.cpp b/Source/WebCore/css/CSSRule.cpp index fa7ecf148..b61f3fe65 100644 --- a/Source/WebCore/css/CSSRule.cpp +++ b/Source/WebCore/css/CSSRule.cpp @@ -40,7 +40,11 @@ namespace WebCore { struct SameSizeAsCSSRule : public RefCounted<SameSizeAsCSSRule> { +#if USE(JSC) + char bitfields; +#else unsigned bitfields; +#endif void* pointerUnion; }; @@ -214,9 +218,9 @@ void CSSRule::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); if (m_parentIsRule) - info.addInstrumentedMember(m_parentRule); + info.addMember(m_parentRule); else - info.addInstrumentedMember(m_parentStyleSheet); + info.addMember(m_parentStyleSheet); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSRuleList.h b/Source/WebCore/css/CSSRuleList.h index cacf151af..bb7e1582d 100644 --- a/Source/WebCore/css/CSSRuleList.h +++ b/Source/WebCore/css/CSSRuleList.h @@ -89,7 +89,7 @@ public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_rule); + info.addMember(m_rule); } private: diff --git a/Source/WebCore/css/CSSStyleRule.cpp b/Source/WebCore/css/CSSStyleRule.cpp index 365d8d90f..1b3987146 100644 --- a/Source/WebCore/css/CSSStyleRule.cpp +++ b/Source/WebCore/css/CSSStyleRule.cpp @@ -133,8 +133,8 @@ void CSSStyleRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInf { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_styleRule); - info.addInstrumentedMember(m_propertiesCSSOMWrapper); + info.addMember(m_styleRule); + info.addMember(m_propertiesCSSOMWrapper); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSStyleSheet.cpp b/Source/WebCore/css/CSSStyleSheet.cpp index 90a2ff94a..0e10202c7 100644 --- a/Source/WebCore/css/CSSStyleSheet.cpp +++ b/Source/WebCore/css/CSSStyleSheet.cpp @@ -36,7 +36,6 @@ #include "SVGNames.h" #include "SecurityOrigin.h" #include "StyleRule.h" -#include "StyleRuleImport.h" #include "StyleSheetContents.h" #include "WebCoreMemoryInstrumentation.h" #include <wtf/text/StringBuilder.h> @@ -59,7 +58,7 @@ private: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_styleSheet); + info.addMember(m_styleSheet); } CSSStyleSheet* m_styleSheet; @@ -151,7 +150,7 @@ void CSSStyleSheet::willMutateRules() m_contents->setMutable(); // Any existing CSSOM wrappers need to be connected to the copied child rules. - reattachCSSOMWrappers(); + reattachChildRuleCSSOMWrappers(); } void CSSStyleSheet::didMutateRules() @@ -170,11 +169,8 @@ void CSSStyleSheet::didMutate() owner->styleResolverChanged(DeferRecalcStyle); } -void CSSStyleSheet::reattachCSSOMWrappers() +void CSSStyleSheet::reattachChildRuleCSSOMWrappers() { - if (m_ownerRule) - m_ownerRule->reattachStyleSheetContents(); - for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { if (!m_childRuleCSSOMWrappers[i]) continue; @@ -185,12 +181,12 @@ void CSSStyleSheet::reattachCSSOMWrappers() void CSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_contents); - info.addInstrumentedMember(m_title); - info.addInstrumentedMember(m_mediaQueries); - info.addInstrumentedMember(m_ownerNode); - info.addInstrumentedMember(m_ownerRule); - info.addInstrumentedMember(m_mediaCSSOMWrapper); + info.addMember(m_contents); + info.addMember(m_title); + info.addMember(m_mediaQueries); + info.addMember(m_ownerNode); + info.addMember(m_ownerRule); + info.addMember(m_mediaCSSOMWrapper); info.addInstrumentedVector(m_childRuleCSSOMWrappers); } @@ -287,10 +283,7 @@ unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc if (!success) { ec = HIERARCHY_REQUEST_ERR; return 0; - } - if (rule->isImportRule()) - static_cast<StyleRuleImport*>(rule.get())->requestStyleSheet(rootStyleSheet(), m_contents->parserContext()); - + } if (!m_childRuleCSSOMWrappers.isEmpty()) m_childRuleCSSOMWrappers.insert(index, RefPtr<CSSRule>()); @@ -377,17 +370,11 @@ CSSStyleSheet* CSSStyleSheet::parentStyleSheet() const return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0; } -CSSStyleSheet* CSSStyleSheet::rootStyleSheet() const +Document* CSSStyleSheet::ownerDocument() const { const CSSStyleSheet* root = this; while (root->parentStyleSheet()) root = root->parentStyleSheet(); - return const_cast<CSSStyleSheet*>(root); -} - -Document* CSSStyleSheet::ownerDocument() const -{ - const CSSStyleSheet* root = rootStyleSheet(); return root->ownerNode() ? root->ownerNode()->document() : 0; } diff --git a/Source/WebCore/css/CSSStyleSheet.h b/Source/WebCore/css/CSSStyleSheet.h index 428a11f9c..12190e072 100644 --- a/Source/WebCore/css/CSSStyleSheet.h +++ b/Source/WebCore/css/CSSStyleSheet.h @@ -80,7 +80,6 @@ public: virtual bool isLoading() const OVERRIDE; void clearOwnerRule() { m_ownerRule = 0; } - CSSStyleSheet* rootStyleSheet() const; Document* ownerDocument() const; MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } void setMediaQueries(PassRefPtr<MediaQuerySet>); @@ -102,6 +101,7 @@ public: void didMutate(); void clearChildRuleCSSOMWrappers(); + void reattachChildRuleCSSOMWrappers(); StyleSheetContents* contents() const { return m_contents.get(); } @@ -115,7 +115,6 @@ private: virtual String type() const { return "text/css"; } bool canAccessRules() const; - void reattachCSSOMWrappers(); RefPtr<StyleSheetContents> m_contents; bool m_isInlineStylesheet; diff --git a/Source/WebCore/css/CSSValue.cpp b/Source/WebCore/css/CSSValue.cpp index f5ef1ef41..0a6129d92 100644 --- a/Source/WebCore/css/CSSValue.cpp +++ b/Source/WebCore/css/CSSValue.cpp @@ -83,7 +83,7 @@ public: void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_cssText); + info.addMember(m_cssText); } private: diff --git a/Source/WebCore/css/CSSVariableValue.h b/Source/WebCore/css/CSSVariableValue.h index e32e48f62..4fc4f7523 100644 --- a/Source/WebCore/css/CSSVariableValue.h +++ b/Source/WebCore/css/CSSVariableValue.h @@ -51,8 +51,8 @@ public: void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_name); - info.addInstrumentedMember(m_value); + info.addMember(m_name); + info.addMember(m_value); } private: diff --git a/Source/WebCore/css/FontFeatureValue.cpp b/Source/WebCore/css/FontFeatureValue.cpp index 948d22b64..1034fca94 100644 --- a/Source/WebCore/css/FontFeatureValue.cpp +++ b/Source/WebCore/css/FontFeatureValue.cpp @@ -53,7 +53,7 @@ String FontFeatureValue::customCssText() const void FontFeatureValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_tag); + info.addMember(m_tag); } } diff --git a/Source/WebCore/css/FontValue.cpp b/Source/WebCore/css/FontValue.cpp index acb25d24b..0ba1e6e98 100644 --- a/Source/WebCore/css/FontValue.cpp +++ b/Source/WebCore/css/FontValue.cpp @@ -68,12 +68,12 @@ String FontValue::customCssText() const void FontValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(style); - info.addInstrumentedMember(variant); - info.addInstrumentedMember(weight); - info.addInstrumentedMember(size); - info.addInstrumentedMember(lineHeight); - info.addInstrumentedMember(family); + info.addMember(style); + info.addMember(variant); + info.addMember(weight); + info.addMember(size); + info.addMember(lineHeight); + info.addMember(family); } } diff --git a/Source/WebCore/css/MediaList.cpp b/Source/WebCore/css/MediaList.cpp index 773ceebb5..62903d6b1 100644 --- a/Source/WebCore/css/MediaList.cpp +++ b/Source/WebCore/css/MediaList.cpp @@ -293,7 +293,7 @@ void MediaList::reattach(MediaQuerySet* mediaQueries) void MediaList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_mediaQueries); + info.addMember(m_mediaQueries); } } diff --git a/Source/WebCore/css/MediaQuery.cpp b/Source/WebCore/css/MediaQuery.cpp index dda150fb5..a3f25d712 100644 --- a/Source/WebCore/css/MediaQuery.cpp +++ b/Source/WebCore/css/MediaQuery.cpp @@ -137,9 +137,9 @@ String MediaQuery::cssText() const void MediaQuery::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_mediaType); + info.addMember(m_mediaType); info.addInstrumentedVectorPtr(m_expressions); - info.addInstrumentedMember(m_serializationCache); + info.addMember(m_serializationCache); } } //namespace diff --git a/Source/WebCore/css/MediaQueryExp.cpp b/Source/WebCore/css/MediaQueryExp.cpp index 695ce0ba6..5302d7b9a 100644 --- a/Source/WebCore/css/MediaQueryExp.cpp +++ b/Source/WebCore/css/MediaQueryExp.cpp @@ -112,9 +112,9 @@ String MediaQueryExp::serialize() const void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_mediaFeature); - info.addInstrumentedMember(m_serializationCache); - info.addInstrumentedMember(m_value); + info.addMember(m_mediaFeature); + info.addMember(m_serializationCache); + info.addMember(m_value); } } // namespace diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp index 6093cf814..f6e3db39b 100644 --- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp +++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp @@ -172,7 +172,7 @@ void PropertySetCSSStyleDeclaration::deref() void PropertySetCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_propertySet); + info.addMember(m_propertySet); if (m_cssomCSSValueClones) info.addInstrumentedMapEntries(*m_cssomCSSValueClones); } @@ -432,14 +432,14 @@ void StyleRuleCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObj { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); PropertySetCSSStyleDeclaration::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_parentRule); + info.addMember(m_parentRule); } void InlineCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); PropertySetCSSStyleDeclaration::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_parentElement); + info.addMember(m_parentElement); } void InlineCSSStyleDeclaration::didMutate(MutationType type) diff --git a/Source/WebCore/css/ShadowValue.cpp b/Source/WebCore/css/ShadowValue.cpp index 90ae152fb..a4064cc10 100644 --- a/Source/WebCore/css/ShadowValue.cpp +++ b/Source/WebCore/css/ShadowValue.cpp @@ -82,12 +82,12 @@ String ShadowValue::customCssText() const void ShadowValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(x); - info.addInstrumentedMember(y); - info.addInstrumentedMember(blur); - info.addInstrumentedMember(spread); - info.addInstrumentedMember(style); - info.addInstrumentedMember(color); + info.addMember(x); + info.addMember(y); + info.addMember(blur); + info.addMember(spread); + info.addMember(style); + info.addMember(color); } } diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp index ed0a15fbc..09c27b717 100644 --- a/Source/WebCore/css/StyleBuilder.cpp +++ b/Source/WebCore/css/StyleBuilder.cpp @@ -33,6 +33,7 @@ #include "CSSPrimitiveValueMappings.h" #include "CSSToStyleMap.h" #include "CSSValueList.h" +#include "ClipPathOperation.h" #include "CursorList.h" #include "Document.h" #include "Element.h" @@ -56,7 +57,7 @@ class ApplyPropertyExpanding { public: template <CSSPropertyID id> - static inline void applyInheritValue(StyleResolver* styleResolver) + static inline void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { if (id == CSSPropertyInvalid) return; @@ -64,20 +65,20 @@ public: const StyleBuilder& table = StyleBuilder::sharedStyleBuilder(); const PropertyHandler& handler = table.propertyHandler(id); if (handler.isValid()) - handler.applyInheritValue(styleResolver); + handler.applyInheritValue(propertyID, styleResolver); } - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { - applyInheritValue<one>(styleResolver); - applyInheritValue<two>(styleResolver); - applyInheritValue<three>(styleResolver); - applyInheritValue<four>(styleResolver); - applyInheritValue<five>(styleResolver); + applyInheritValue<one>(propertyID, styleResolver); + applyInheritValue<two>(propertyID, styleResolver); + applyInheritValue<three>(propertyID, styleResolver); + applyInheritValue<four>(propertyID, styleResolver); + applyInheritValue<five>(propertyID, styleResolver); } template <CSSPropertyID id> - static inline void applyInitialValue(StyleResolver* styleResolver) + static inline void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { if (id == CSSPropertyInvalid) return; @@ -85,20 +86,20 @@ public: const StyleBuilder& table = StyleBuilder::sharedStyleBuilder(); const PropertyHandler& handler = table.propertyHandler(id); if (handler.isValid()) - handler.applyInitialValue(styleResolver); + handler.applyInitialValue(propertyID, styleResolver); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { - applyInitialValue<one>(styleResolver); - applyInitialValue<two>(styleResolver); - applyInitialValue<three>(styleResolver); - applyInitialValue<four>(styleResolver); - applyInitialValue<five>(styleResolver); + applyInitialValue<one>(propertyID, styleResolver); + applyInitialValue<two>(propertyID, styleResolver); + applyInitialValue<three>(propertyID, styleResolver); + applyInitialValue<four>(propertyID, styleResolver); + applyInitialValue<five>(propertyID, styleResolver); } template <CSSPropertyID id> - static inline void applyValue(StyleResolver* styleResolver, CSSValue* value) + static inline void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) { if (id == CSSPropertyInvalid) return; @@ -106,19 +107,19 @@ public: const StyleBuilder& table = StyleBuilder::sharedStyleBuilder(); const PropertyHandler& handler = table.propertyHandler(id); if (handler.isValid()) - handler.applyValue(styleResolver, value); + handler.applyValue(propertyID, styleResolver, value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) { if (!expandValue) return; - applyValue<one>(styleResolver, value); - applyValue<two>(styleResolver, value); - applyValue<three>(styleResolver, value); - applyValue<four>(styleResolver, value); - applyValue<five>(styleResolver, value); + applyValue<one>(propertyID, styleResolver, value); + applyValue<two>(propertyID, styleResolver, value); + applyValue<three>(propertyID, styleResolver, value); + applyValue<four>(propertyID, styleResolver, value); + applyValue<five>(propertyID, styleResolver, value); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; @@ -129,9 +130,9 @@ public: static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); } static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); } static InitialType initial() { return (*initialFunction)(); } - static void applyInheritValue(StyleResolver* styleResolver) { setValue(styleResolver->style(), value(styleResolver->parentStyle())); } - static void applyInitialValue(StyleResolver* styleResolver) { setValue(styleResolver->style(), initial()); } - static void applyValue(StyleResolver*, CSSValue*) { } + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), value(styleResolver->parentStyle())); } + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), initial()); } + static void applyValue(CSSPropertyID, StyleResolver*, CSSValue*) { } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } }; @@ -139,7 +140,7 @@ template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const class ApplyPropertyDefault { public: static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (value->isPrimitiveValue()) setValue(styleResolver->style(), *static_cast<CSSPrimitiveValue*>(value)); @@ -155,7 +156,7 @@ template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const class ApplyPropertyNumber { public: static void setValue(RenderStyle* style, NumberType value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -176,7 +177,7 @@ public: template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property> class ApplyPropertyStyleImage { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, value)); } + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, value)); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler(); @@ -193,7 +194,7 @@ public: static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)(); } static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); } - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { if (hasAuto(styleResolver->parentStyle())) setAuto(styleResolver->style()); @@ -201,9 +202,9 @@ public: setValue(styleResolver->style(), value(styleResolver->parentStyle())); } - static void applyInitialValue(StyleResolver* styleResolver) { setAuto(styleResolver->style()); } + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setAuto(styleResolver->style()); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -227,22 +228,22 @@ private: return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()); } public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { RenderStyle* parentStyle = styleResolver->parentStyle(); if (!parentStyle->hasClip()) - return applyInitialValue(styleResolver); + return applyInitialValue(propertyID, styleResolver); styleResolver->style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft()); styleResolver->style()->setHasClip(true); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { styleResolver->style()->setClip(Length(), Length(), Length(), Length()); styleResolver->style()->setHasClip(false); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -276,26 +277,26 @@ template <ColorInherit inheritColorFromParent, Color (*initialFunction)() = &defaultInitialColor> class ApplyPropertyColor { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed. Color color = (styleResolver->parentStyle()->*getterFunction)(); applyColorValue(styleResolver, color.isValid() ? color : (styleResolver->parentStyle()->*defaultFunction)()); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { applyColorValue(styleResolver, initialFunction()); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor) - applyInheritValue(styleResolver); + applyInheritValue(propertyID, styleResolver); else { if (styleResolver->applyPropertyToRegularStyle()) (styleResolver->style()->*setterFunction)(styleResolver->colorFromPrimitiveValue(primitiveValue)); @@ -318,9 +319,9 @@ public: template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()> class ApplyPropertyDirection { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) { - ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(styleResolver, value); + ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(propertyID, styleResolver, value); Element* element = styleResolver->element(); if (element && styleResolver->element() == element->document()->documentElement()) element->document()->setDirectionSetOnDocumentElement(true); @@ -349,7 +350,7 @@ template <Length (RenderStyle::*getterFunction)() const, class ApplyPropertyLength { public: static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -404,7 +405,7 @@ template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::* class ApplyPropertyString { public: static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -426,7 +427,7 @@ template <LengthSize (RenderStyle::*getterFunction)() const, void (RenderStyle:: class ApplyPropertyBorderRadius { public: static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -502,7 +503,7 @@ template <typename T, void (CSSToStyleMap::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)> class ApplyPropertyFillLayer { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)(); FillLayer* prevChild = 0; @@ -526,7 +527,7 @@ public: } } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)(); (currChild->*setFunction)((*initialFunction)(fillLayerType)); @@ -534,7 +535,7 @@ public: (currChild->*clearFunction)(); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)(); FillLayer* prevChild = 0; @@ -582,7 +583,7 @@ template <typename T, class ApplyPropertyComputeLength { public: static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason... if (!value->isPrimitiveValue()) @@ -629,21 +630,21 @@ public: template <typename T, T (FontDescription::*getterFunction)() const, void (FontDescription::*setterFunction)(T), T initialValue> class ApplyPropertyFont { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { FontDescription fontDescription = styleResolver->fontDescription(); (fontDescription.*setterFunction)((styleResolver->parentFontDescription().*getterFunction)()); styleResolver->setFontDescription(fontDescription); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { FontDescription fontDescription = styleResolver->fontDescription(); (fontDescription.*setterFunction)(initialValue); styleResolver->setFontDescription(fontDescription); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -675,7 +676,7 @@ private: return size / 1.2f; } public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { float size = styleResolver->parentStyle()->fontDescription().specifiedSize(); @@ -689,7 +690,7 @@ public: return; } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { FontDescription fontDescription = styleResolver->style()->fontDescription(); float size = styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueMedium, fontDescription.useFixedDefaultSize()); @@ -703,7 +704,7 @@ public: return; } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -778,7 +779,7 @@ public: class ApplyPropertyFontWeight { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -808,7 +809,7 @@ public: class ApplyPropertyFontVariantLigatures { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { const FontDescription& parentFontDescription = styleResolver->parentFontDescription(); FontDescription fontDescription = styleResolver->fontDescription(); @@ -820,7 +821,7 @@ public: styleResolver->setFontDescription(fontDescription); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { FontDescription fontDescription = styleResolver->fontDescription(); @@ -831,7 +832,7 @@ public: styleResolver->setFontDescription(fontDescription); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState; FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState; @@ -897,7 +898,7 @@ template <BorderImageType borderImageType, void (RenderStyle::*setterFunction)(const NinePieceImage&)> class ApplyPropertyBorderImage { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { NinePieceImage image; if (borderImageType == Mask) @@ -920,7 +921,7 @@ private: static inline const NinePieceImage& getValue(RenderStyle* style) { return type == Image ? style->borderImage() : style->maskBoxImage(); } static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == Image ? style->setBorderImage(value) : style->setMaskBoxImage(value); } public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { NinePieceImage image(getValue(styleResolver->style())); switch (modifier) { @@ -940,7 +941,7 @@ public: setValue(styleResolver->style(), image); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { NinePieceImage image(getValue(styleResolver->style())); switch (modifier) { @@ -964,7 +965,7 @@ public: setValue(styleResolver->style(), image); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { NinePieceImage image(getValue(styleResolver->style())); switch (modifier) { @@ -990,7 +991,7 @@ public: template <CSSPropertyID id, StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)()> class ApplyPropertyBorderImageSource { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(id, value)); } + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(id, value)); } static PropertyHandler createHandler() { PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler(); @@ -1002,8 +1003,8 @@ enum CounterBehavior {Increment = 0, Reset}; template <CounterBehavior counterBehavior> class ApplyPropertyCounter { public: - static void emptyFunction(StyleResolver*) { } - static void applyInheritValue(StyleResolver* styleResolver) + static void emptyFunction(CSSPropertyID, StyleResolver*) { } + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives(); CounterDirectiveMap& parentMap = styleResolver->parentStyle()->accessCounterDirectives(); @@ -1019,7 +1020,7 @@ public: } } } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isValueList()) return; @@ -1062,19 +1063,19 @@ public: class ApplyPropertyCursor { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { styleResolver->style()->setCursor(styleResolver->parentStyle()->cursor()); styleResolver->style()->setCursorList(styleResolver->parentStyle()->cursors()); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { styleResolver->style()->clearCursorList(); styleResolver->style()->setCursor(RenderStyle::initialCursor()); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { styleResolver->style()->clearCursorList(); if (value->isValueList()) { @@ -1106,7 +1107,7 @@ public: class ApplyPropertyTextAlign { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -1131,7 +1132,7 @@ public: class ApplyPropertyTextDecoration { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { ETextDecoration t = RenderStyle::initialTextDecoration(); for (CSSValueListIterator i(value); i.hasMore(); i.advance()) { @@ -1150,7 +1151,7 @@ public: class ApplyPropertyLineHeight { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -1264,9 +1265,9 @@ private: return true; } public: - static void applyInheritValue(StyleResolver*) { } - static void applyInitialValue(StyleResolver*) { } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyInheritValue(CSSPropertyID, StyleResolver*) { } + static void applyInitialValue(CSSPropertyID, StyleResolver*) { } + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { styleResolver->style()->resetPageSizeType(); Length width; @@ -1337,21 +1338,21 @@ public: class ApplyPropertyTextEmphasisStyle { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { styleResolver->style()->setTextEmphasisFill(styleResolver->parentStyle()->textEmphasisFill()); styleResolver->style()->setTextEmphasisMark(styleResolver->parentStyle()->textEmphasisMark()); styleResolver->style()->setTextEmphasisCustomMark(styleResolver->parentStyle()->textEmphasisCustomMark()); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { styleResolver->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill()); styleResolver->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark()); styleResolver->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark()); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (value->isValueList()) { CSSValueList* list = static_cast<CSSValueList*>(value); @@ -1418,7 +1419,7 @@ public: static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); } static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); } - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { AnimationList* list = accessAnimations(styleResolver->style()); const AnimationList* parentList = animations(styleResolver->parentStyle()); @@ -1435,17 +1436,19 @@ public: clear(list->animation(i)); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { AnimationList* list = accessAnimations(styleResolver->style()); if (list->isEmpty()) list->append(Animation::create()); setValue(list->animation(0), initial()); + if (propertyID == CSSPropertyWebkitTransitionProperty) + list->animation(0)->setAnimationMode(Animation::AnimateAll); for (size_t i = 1; i < list->size(); ++i) clear(list->animation(i)); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { AnimationList* list = accessAnimations(styleResolver->style()); size_t childIndex = 0; @@ -1474,22 +1477,22 @@ public: class ApplyPropertyOutlineStyle { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { - ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(styleResolver); - ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(styleResolver); + ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(propertyID, styleResolver); + ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(propertyID, styleResolver); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { - ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(styleResolver); - ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(styleResolver); + ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(propertyID, styleResolver); + ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(propertyID, styleResolver); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) { - ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(styleResolver, value); - ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(styleResolver, value); + ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(propertyID, styleResolver, value); + ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(propertyID, styleResolver, value); } static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); } @@ -1497,7 +1500,7 @@ public: class ApplyPropertyResize { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -1527,7 +1530,7 @@ public: class ApplyPropertyVerticalAlign { public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -1549,7 +1552,7 @@ public: class ApplyPropertyAspectRatio { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { if (!styleResolver->parentStyle()->hasAspectRatio()) return; @@ -1558,14 +1561,14 @@ public: styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator()); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { styleResolver->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio()); styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator()); styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator()); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isAspectRatioValue()) { styleResolver->style()->setHasAspectRatio(false); @@ -1592,19 +1595,19 @@ private: } public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { resetEffectiveZoom(styleResolver); styleResolver->setZoom(styleResolver->parentStyle()->zoom()); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { resetEffectiveZoom(styleResolver); styleResolver->setZoom(RenderStyle::initialZoom()); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { ASSERT(value->isPrimitiveValue()); CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); @@ -1650,7 +1653,7 @@ private: return true; } public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { EDisplay display = styleResolver->parentStyle()->display(); if (!isValidDisplayValue(styleResolver, display)) @@ -1658,12 +1661,12 @@ public: styleResolver->style()->setDisplay(display); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { styleResolver->style()->setDisplay(RenderStyle::initialDisplay()); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isPrimitiveValue()) return; @@ -1682,25 +1685,24 @@ public: } }; -template <BasicShape* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<BasicShape>), BasicShape* (*initialFunction)()> +template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*initialFunction)()> class ApplyPropertyClipPath { public: - static void setValue(RenderStyle* style, PassRefPtr<BasicShape> value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value) { (style->*setterFunction)(value); } + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (value->isPrimitiveValue()) { CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); if (primitiveValue->getIdent() == CSSValueNone) setValue(styleResolver->style(), 0); else if (primitiveValue->isShape()) { - RefPtr<BasicShape> clipPathShape = basicShapeForValue(styleResolver, primitiveValue->getShapeValue()); - setValue(styleResolver->style(), clipPathShape.release()); + setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()))); } } } static PropertyHandler createHandler() { - PropertyHandler handler = ApplyPropertyDefaultBase<BasicShape*, getterFunction, PassRefPtr<BasicShape>, setterFunction, BasicShape*, initialFunction>::createHandler(); + PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, getterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation*, initialFunction>::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; @@ -1710,7 +1712,7 @@ template <BasicShape* (RenderStyle::*getterFunction)() const, void (RenderStyle: class ApplyPropertyWrapShape { public: static void setValue(RenderStyle* style, PassRefPtr<BasicShape> value) { (style->*setterFunction)(value); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (value->isPrimitiveValue()) { CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); @@ -1733,21 +1735,21 @@ public: #if ENABLE(CSS_IMAGE_RESOLUTION) class ApplyPropertyImageResolution { public: - static void applyInheritValue(StyleResolver* styleResolver) + static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { - ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInheritValue(styleResolver); - ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInheritValue(styleResolver); - ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(styleResolver); + ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInheritValue(propertyID, styleResolver); + ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInheritValue(propertyID, styleResolver); + ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(propertyID, styleResolver); } - static void applyInitialValue(StyleResolver* styleResolver) + static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) { - ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInitialValue(styleResolver); - ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInitialValue(styleResolver); - ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(styleResolver); + ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInitialValue(propertyID, styleResolver); + ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInitialValue(propertyID, styleResolver); + ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(propertyID, styleResolver); } - static void applyValue(StyleResolver* styleResolver, CSSValue* value) + static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { if (!value->isValueList()) return; diff --git a/Source/WebCore/css/StyleBuilder.h b/Source/WebCore/css/StyleBuilder.h index ab41c9c7f..4ffe85234 100644 --- a/Source/WebCore/css/StyleBuilder.h +++ b/Source/WebCore/css/StyleBuilder.h @@ -37,14 +37,14 @@ class StyleResolver; class PropertyHandler { public: - typedef void (*InheritFunction)(StyleResolver*); - typedef void (*InitialFunction)(StyleResolver*); - typedef void (*ApplyFunction)(StyleResolver*, CSSValue*); + typedef void (*InheritFunction)(CSSPropertyID, StyleResolver*); + typedef void (*InitialFunction)(CSSPropertyID, StyleResolver*); + typedef void (*ApplyFunction)(CSSPropertyID, StyleResolver*, CSSValue*); PropertyHandler() : m_inherit(0), m_initial(0), m_apply(0) { } PropertyHandler(InheritFunction inherit, InitialFunction initial, ApplyFunction apply) : m_inherit(inherit), m_initial(initial), m_apply(apply) { } - void applyInheritValue(StyleResolver* styleResolver) const { ASSERT(m_inherit); (*m_inherit)(styleResolver); } - void applyInitialValue(StyleResolver* styleResolver) const { ASSERT(m_initial); (*m_initial)(styleResolver); } - void applyValue(StyleResolver* styleResolver, CSSValue* value) const { ASSERT(m_apply); (*m_apply)(styleResolver, value); } + void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_inherit); (*m_inherit)(propertyID, styleResolver); } + void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_initial); (*m_initial)(propertyID, styleResolver); } + void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) const { ASSERT(m_apply); (*m_apply)(propertyID, styleResolver, value); } bool isValid() const { return m_inherit && m_initial && m_apply; } InheritFunction inheritFunction() const { return m_inherit; } InitialFunction initialFunction() { return m_initial; } diff --git a/Source/WebCore/css/StylePropertySet.cpp b/Source/WebCore/css/StylePropertySet.cpp index d0f0fab2a..6e3c0fde9 100644 --- a/Source/WebCore/css/StylePropertySet.cpp +++ b/Source/WebCore/css/StylePropertySet.cpp @@ -1127,7 +1127,7 @@ void StylePropertySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con unsigned count = propertyCount(); for (unsigned i = 0; i < count; ++i) - info.addInstrumentedMember(propertyAt(i)); + info.addMember(propertyAt(i)); } // See the function above if you need to update this. diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index 834d1d603..517bdb6b2 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -147,6 +147,7 @@ #endif #if ENABLE(CSS_SHADERS) +#include "CustomFilterArrayParameter.h" #include "CustomFilterNumberParameter.h" #include "CustomFilterOperation.h" #include "CustomFilterParameter.h" @@ -2585,7 +2586,7 @@ void RuleSet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const void RuleSet::RuleSetSelectorPair::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(ruleSet); + info.addMember(ruleSet); } static inline void collectFeaturesFromSelector(StyleResolver::Features& features, const CSSSelector* selector) @@ -3438,11 +3439,11 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) const PropertyHandler& handler = m_styleBuilder.propertyHandler(id); if (handler.isValid()) { if (isInherit) - handler.applyInheritValue(this); + handler.applyInheritValue(id, this); else if (isInitial) - handler.applyInitialValue(this); + handler.applyInitialValue(id, this); else - handler.applyValue(this, value); + handler.applyValue(id, this, value); return; } @@ -5252,6 +5253,21 @@ static bool sortParametersByNameComparator(const RefPtr<CustomFilterParameter>& return codePointCompareLessThan(a->name(), b->name()); } +PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterArrayParameter(const String& name, CSSValueList* values) +{ + RefPtr<CustomFilterArrayParameter> arrayParameter = CustomFilterArrayParameter::create(name); + for (unsigned i = 0, length = values->length(); i < length; ++i) { + CSSValue* value = values->itemWithoutBoundsCheck(i); + if (!value->isPrimitiveValue()) + return 0; + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER) + return 0; + arrayParameter->addValue(primitiveValue->getDoubleValue()); + } + return arrayParameter.release(); +} + PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterNumberParameter(const String& name, CSSValueList* values) { RefPtr<CustomFilterNumberParameter> numberParameter = CustomFilterNumberParameter::create(name); @@ -5282,6 +5298,8 @@ PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterParameter(cons // booleans: https://bugs.webkit.org/show_bug.cgi?id=76438 // textures: https://bugs.webkit.org/show_bug.cgi?id=71442 // mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444 + // Number parameters are wrapped inside a CSSValueList and all + // the other functions values inherit from CSSValueList. if (!parameterValue->isValueList()) return 0; @@ -5289,9 +5307,16 @@ PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterParameter(cons if (!values->length()) return 0; + if (parameterValue->isWebKitCSSArrayFunctionValue()) + return parseCustomFilterArrayParameter(name, values); + + // If the first value of the list is a transform function, + // then we could safely assume that all the remaining items + // are transforms. parseCustomFilterTransformParameter will + // return 0 if that assumption is incorrect. if (values->itemWithoutBoundsCheck(0)->isWebKitCSSTransformValue()) return parseCustomFilterTransformParameter(name, values); - + // We can have only arrays of booleans or numbers, so use the first value to choose between those two. // We need up to 4 values (all booleans or all numbers). if (!values->itemWithoutBoundsCheck(0)->isPrimitiveValue() || values->length() > 4) @@ -5734,7 +5759,7 @@ void StyleResolver::loadPendingResources() void StyleResolver::MatchedProperties::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(properties); + info.addMember(properties); } void StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const @@ -5746,26 +5771,26 @@ void StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage(MemoryObjectIn void MediaQueryResult::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_expression); + info.addMember(m_expression); } void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); info.addMember(m_style); - info.addInstrumentedMember(m_authorStyle); - info.addInstrumentedMember(m_userStyle); - info.addInstrumentedMember(m_siblingRuleSet); - info.addInstrumentedMember(m_uncommonAttributeRuleSet); + info.addMember(m_authorStyle); + info.addMember(m_userStyle); + info.addMember(m_siblingRuleSet); + info.addMember(m_uncommonAttributeRuleSet); info.addHashMap(m_keyframesRuleMap); info.addHashMap(m_matchedPropertiesCache); info.addInstrumentedMapValues(m_matchedPropertiesCache); info.addVector(m_matchedRules); - info.addInstrumentedMember(m_ruleList); + info.addMember(m_ruleList); info.addHashMap(m_pendingImageProperties); info.addInstrumentedMapValues(m_pendingImageProperties); - info.addInstrumentedMember(m_lineHeightValue); + info.addMember(m_lineHeightValue); info.addInstrumentedVector(m_viewportDependentMediaQueryResults); info.addHashMap(m_styleRuleToCSSOMWrapperMap); info.addInstrumentedMapEntries(m_styleRuleToCSSOMWrapperMap); @@ -5780,10 +5805,10 @@ void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const #endif // FIXME: move this to a place where it would be called only once? - info.addInstrumentedMember(defaultStyle); - info.addInstrumentedMember(defaultQuirksStyle); - info.addInstrumentedMember(defaultPrintStyle); - info.addInstrumentedMember(defaultViewSourceStyle); + info.addMember(defaultStyle); + info.addMember(defaultQuirksStyle); + info.addMember(defaultPrintStyle); + info.addMember(defaultViewSourceStyle); } } // namespace WebCore diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h index e698a4ffd..5fb858cfb 100644 --- a/Source/WebCore/css/StyleResolver.h +++ b/Source/WebCore/css/StyleResolver.h @@ -261,6 +261,7 @@ public: StyleShader* cachedOrPendingStyleShaderFromValue(WebKitCSSShaderValue*); bool parseCustomFilterParameterList(CSSValue*, CustomFilterParameterList&); PassRefPtr<CustomFilterParameter> parseCustomFilterParameter(const String& name, CSSValue*); + PassRefPtr<CustomFilterParameter> parseCustomFilterArrayParameter(const String& name, CSSValueList*); PassRefPtr<CustomFilterParameter> parseCustomFilterNumberParameter(const String& name, CSSValueList*); PassRefPtr<CustomFilterParameter> parseCustomFilterTransformParameter(const String& name, CSSValueList*); PassRefPtr<CustomFilterOperation> createCustomFilterOperation(WebKitCSSFilterValue*); diff --git a/Source/WebCore/css/StyleRule.cpp b/Source/WebCore/css/StyleRule.cpp index 6847c16b9..59ed9e58f 100644 --- a/Source/WebCore/css/StyleRule.cpp +++ b/Source/WebCore/css/StyleRule.cpp @@ -209,8 +209,8 @@ unsigned StyleRule::averageSizeInBytes() void StyleRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_properties); - info.addInstrumentedMember(m_selectorList); + info.addMember(m_properties); + info.addMember(m_selectorList); } StyleRule::StyleRule(int sourceLine) @@ -272,8 +272,8 @@ void StyleRulePage::setProperties(PassRefPtr<StylePropertySet> properties) void StyleRulePage::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_properties); - info.addInstrumentedMember(m_selectorList); + info.addMember(m_properties); + info.addMember(m_selectorList); } StyleRuleFontFace::StyleRuleFontFace() @@ -306,7 +306,7 @@ void StyleRuleFontFace::setProperties(PassRefPtr<StylePropertySet> properties) void StyleRuleFontFace::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_properties); + info.addMember(m_properties); } @@ -356,7 +356,7 @@ StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o) void StyleRuleMedia::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_mediaQueries); + info.addMember(m_mediaQueries); } StyleRuleRegion::StyleRuleRegion(CSSSelectorVector* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules) @@ -374,7 +374,7 @@ StyleRuleRegion::StyleRuleRegion(const StyleRuleRegion& o) void StyleRuleRegion::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_selectorList); + info.addMember(m_selectorList); } } // namespace WebCore diff --git a/Source/WebCore/css/StyleRuleImport.cpp b/Source/WebCore/css/StyleRuleImport.cpp index 6e4501b34..26f29e82f 100644 --- a/Source/WebCore/css/StyleRuleImport.cpp +++ b/Source/WebCore/css/StyleRuleImport.cpp @@ -32,12 +32,6 @@ namespace WebCore { -StyleRuleImport::LoadContext::LoadContext(CSSStyleSheet* rootStyleSheet, const CSSParserContext& parentParserContext) - : rootStyleSheet(rootStyleSheet) - , parentParserContext(parentParserContext) -{ -} - PassRefPtr<StyleRuleImport> StyleRuleImport::create(const String& href, PassRefPtr<MediaQuerySet> media) { return adoptRef(new StyleRuleImport(href, media)); @@ -45,9 +39,12 @@ PassRefPtr<StyleRuleImport> StyleRuleImport::create(const String& href, PassRefP StyleRuleImport::StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet> media) : StyleRuleBase(Import, 0) + , m_parentStyleSheet(0) + , m_styleSheetClient(this) , m_strHref(href) , m_mediaQueries(media) , m_cachedSheet(0) + , m_loading(false) { if (!m_mediaQueries) m_mediaQueries = MediaQuerySet::create(String()); @@ -55,98 +52,91 @@ StyleRuleImport::StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet> m StyleRuleImport::~StyleRuleImport() { + if (m_styleSheet) + m_styleSheet->clearOwnerRule(); if (m_cachedSheet) - m_cachedSheet->removeClient(this); + m_cachedSheet->removeClient(&m_styleSheetClient); } -void StyleRuleImport::setCSSStyleSheet(const String& url, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*) +void StyleRuleImport::setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* cachedStyleSheet) { - ASSERT(m_loadContext); - ASSERT(!m_styleSheet); - ASSERT(m_cachedSheet); - - OwnPtr<LoadContext> loadContext = m_loadContext.release(); + if (m_styleSheet) + m_styleSheet->clearOwnerRule(); - CSSParserContext parserContext = loadContext->parentParserContext; + CSSParserContext context = m_parentStyleSheet ? m_parentStyleSheet->parserContext() : CSSStrictMode; + context.charset = charset; if (!baseURL.isNull()) - parserContext.baseURL = baseURL; - parserContext.charset = charset; - -#if ENABLE(PARSED_STYLE_SHEET_CACHING) - m_styleSheet = m_cachedSheet->restoreParsedStyleSheet(parserContext); -#endif - if (!m_styleSheet) { - m_styleSheet = StyleSheetContents::create(url, parserContext); - m_styleSheet->parseAuthorStyleSheet(m_cachedSheet.get(), loadContext->rootStyleSheet.get()); - } - loadContext->rootStyleSheet->contents()->checkLoadCompleted(); + context.baseURL = baseURL; -#if ENABLE(PARSED_STYLE_SHEET_CACHING) - if (m_styleSheet->isCacheable()) - m_cachedSheet->saveParsedStyleSheet(m_styleSheet); -#endif -} + m_styleSheet = StyleSheetContents::create(this, href, context); -bool StyleRuleImport::isLoading() const -{ - return m_loadContext || (m_styleSheet && m_styleSheet->isLoading()); + Document* document = m_parentStyleSheet ? m_parentStyleSheet->singleOwnerDocument() : 0; + m_styleSheet->parseAuthorStyleSheet(cachedStyleSheet, document ? document->securityOrigin() : 0); + + m_loading = false; + + if (m_parentStyleSheet) { + m_parentStyleSheet->notifyLoadedSheet(cachedStyleSheet); + m_parentStyleSheet->checkLoaded(); + } } -bool StyleRuleImport::hadLoadError() const +bool StyleRuleImport::isLoading() const { - return m_cachedSheet && m_cachedSheet->errorOccurred(); + return m_loading || (m_styleSheet && m_styleSheet->isLoading()); } -void StyleRuleImport::requestStyleSheet(CSSStyleSheet* rootSheet, const CSSParserContext& parserContext) +void StyleRuleImport::requestStyleSheet() { - ASSERT(!rootSheet->parentStyleSheet()); - ASSERT(!m_cachedSheet); - - Node* ownerNode = rootSheet->ownerNode(); - if (!ownerNode) + if (!m_parentStyleSheet) return; - Document* document = ownerNode->document(); - - KURL resolvedURL; - if (!parserContext.baseURL.isNull()) - resolvedURL = KURL(parserContext.baseURL, m_strHref); - else - resolvedURL = document->completeURL(m_strHref); - - StyleSheetContents* rootSheetContents = rootSheet->contents(); - if (rootSheetContents->hasImportCycle(this, resolvedURL, document->baseURL())) + Document* document = m_parentStyleSheet->singleOwnerDocument(); + if (!document) return; - ResourceRequest request(resolvedURL); CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader(); - if (rootSheetContents->isUserStyleSheet()) - m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, parserContext.charset); - else - m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request, parserContext.charset); - - if (!m_cachedSheet) + if (!cachedResourceLoader) return; - // if the import rule is issued dynamically, the sheet may be - // removed from the pending sheet count, so let the doc know - // the sheet being imported is pending. - if (rootSheetContents->loadCompleted()) - ownerNode->startLoadingDynamicSheet(); - - m_loadContext = adoptPtr(new LoadContext(rootSheet, parserContext)); - m_cachedSheet->addClient(this); -} -void StyleRuleImport::reattachStyleSheetContents(StyleSheetContents* contents) -{ - m_styleSheet = contents; + KURL absURL; + if (!m_parentStyleSheet->baseURL().isNull()) + // use parent styleheet's URL as the base URL + absURL = KURL(m_parentStyleSheet->baseURL(), m_strHref); + else + absURL = document->completeURL(m_strHref); + + // Check for a cycle in our import chain. If we encounter a stylesheet + // in our parent chain with the same URL, then just bail. + StyleSheetContents* rootSheet = m_parentStyleSheet; + for (StyleSheetContents* sheet = m_parentStyleSheet; sheet; sheet = sheet->parentStyleSheet()) { + if (equalIgnoringFragmentIdentifier(absURL, sheet->baseURL()) + || equalIgnoringFragmentIdentifier(absURL, document->completeURL(sheet->originalURL()))) + return; + rootSheet = sheet; + } + + ResourceRequest request(absURL); + if (m_parentStyleSheet->isUserStyleSheet()) + m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, m_parentStyleSheet->charset()); + else + m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request, m_parentStyleSheet->charset()); + if (m_cachedSheet) { + // if the import rule is issued dynamically, the sheet may be + // removed from the pending sheet count, so let the doc know + // the sheet being imported is pending. + if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && rootSheet == m_parentStyleSheet) + m_parentStyleSheet->startLoadingDynamicSheet(); + m_loading = true; + m_cachedSheet->addClient(&m_styleSheetClient); + } } void StyleRuleImport::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_strHref); - info.addInstrumentedMember(m_mediaQueries); - info.addInstrumentedMember(m_styleSheet); + info.addMember(m_strHref); + info.addMember(m_mediaQueries); + info.addMember(m_styleSheet); } } // namespace WebCore diff --git a/Source/WebCore/css/StyleRuleImport.h b/Source/WebCore/css/StyleRuleImport.h index ae2f6e138..b7df02cf1 100644 --- a/Source/WebCore/css/StyleRuleImport.h +++ b/Source/WebCore/css/StyleRuleImport.h @@ -22,7 +22,6 @@ #ifndef StyleRuleImport_h #define StyleRuleImport_h -#include "CSSParserMode.h" #include "CachedResourceHandle.h" #include "CachedStyleSheetClient.h" #include "StyleRule.h" @@ -33,42 +32,55 @@ class CachedCSSStyleSheet; class MediaQuerySet; class StyleSheetContents; -class StyleRuleImport : public StyleRuleBase, public CachedStyleSheetClient { +class StyleRuleImport : public StyleRuleBase { WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<StyleRuleImport> create(const String& href, PassRefPtr<MediaQuerySet>); - virtual ~StyleRuleImport(); + ~StyleRuleImport(); + + StyleSheetContents* parentStyleSheet() const { return m_parentStyleSheet; } + void setParentStyleSheet(StyleSheetContents* sheet) { ASSERT(sheet); m_parentStyleSheet = sheet; } + void clearParentStyleSheet() { m_parentStyleSheet = 0; } String href() const { return m_strHref; } StyleSheetContents* styleSheet() const { return m_styleSheet.get(); } bool isLoading() const; - bool hadLoadError() const; MediaQuerySet* mediaQueries() { return m_mediaQueries.get(); } - void requestStyleSheet(CSSStyleSheet* rootSheet, const CSSParserContext&); + void requestStyleSheet(); void reportDescendantMemoryUsage(MemoryObjectInfo*) const; - void reattachStyleSheetContents(StyleSheetContents*); - private: + // NOTE: We put the CachedStyleSheetClient in a member instead of inheriting from it + // to avoid adding a vptr to StyleRuleImport. + class ImportedStyleSheetClient : public CachedStyleSheetClient { + public: + ImportedStyleSheetClient(StyleRuleImport* ownerRule) : m_ownerRule(ownerRule) { } + virtual ~ImportedStyleSheetClient() { } + virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet) + { + m_ownerRule->setCSSStyleSheet(href, baseURL, charset, sheet); + } + private: + StyleRuleImport* m_ownerRule; + }; + + void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*); + friend class ImportedStyleSheetClient; + StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet>); - virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*); + StyleSheetContents* m_parentStyleSheet; + ImportedStyleSheetClient m_styleSheetClient; String m_strHref; RefPtr<MediaQuerySet> m_mediaQueries; RefPtr<StyleSheetContents> m_styleSheet; - CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet; - struct LoadContext { - LoadContext(CSSStyleSheet* rootStyleSheet, const CSSParserContext& parentParserContext); - RefPtr<CSSStyleSheet> rootStyleSheet; - CSSParserContext parentParserContext; - }; - OwnPtr<LoadContext> m_loadContext; + bool m_loading; }; } // namespace WebCore diff --git a/Source/WebCore/css/StyleSheetContents.cpp b/Source/WebCore/css/StyleSheetContents.cpp index ba00e2b21..048273bec 100644 --- a/Source/WebCore/css/StyleSheetContents.cpp +++ b/Source/WebCore/css/StyleSheetContents.cpp @@ -54,9 +54,11 @@ unsigned StyleSheetContents::estimatedSizeInBytes() const return size; } -StyleSheetContents::StyleSheetContents(const String& originalURL, const CSSParserContext& context) - : m_originalURL(originalURL) +StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext& context) + : m_ownerRule(ownerRule) + , m_originalURL(originalURL) , m_loadCompleted(false) + , m_isUserStyleSheet(ownerRule && ownerRule->parentStyleSheet() && ownerRule->parentStyleSheet()->isUserStyleSheet()) , m_hasSyntacticallyValidCSSHeader(true) , m_didLoadErrorOccur(false) , m_usesRemUnits(false) @@ -68,6 +70,7 @@ StyleSheetContents::StyleSheetContents(const String& originalURL, const CSSParse StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) : RefCounted<StyleSheetContents>() + , m_ownerRule(0) , m_originalURL(o.m_originalURL) , m_encodingFromCharsetRule(o.m_encodingFromCharsetRule) , m_importRules(o.m_importRules.size()) @@ -101,6 +104,9 @@ bool StyleSheetContents::isCacheable() const // FIXME: Support copying import rules. if (!m_importRules.isEmpty()) return false; + // FIXME: Support cached stylesheets in import rules. + if (m_ownerRule) + return false; // This would require dealing with multiple clients for load callbacks. if (!m_loadCompleted) return false; @@ -123,6 +129,8 @@ void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule) // Parser enforces that @import rules come before anything else except @charset. ASSERT(m_childRules.isEmpty()); m_importRules.append(static_cast<StyleRuleImport*>(rule.get())); + m_importRules.last()->setParentStyleSheet(this); + m_importRules.last()->requestStyleSheet(); return; } m_childRules.append(rule); @@ -161,6 +169,10 @@ void StyleSheetContents::clearCharsetRule() void StyleSheetContents::clearRules() { + for (unsigned i = 0; i < m_importRules.size(); ++i) { + ASSERT(m_importRules.at(i)->parentStyleSheet() == this); + m_importRules[i]->clearParentStyleSheet(); + } m_importRules.clear(); m_childRules.clear(); clearCharsetRule(); @@ -195,6 +207,9 @@ bool StyleSheetContents::wrapperInsertRule(PassRefPtr<StyleRuleBase> rule, unsig if (!rule->isImportRule()) return false; m_importRules.insert(childVectorIndex, static_cast<StyleRuleImport*>(rule.get())); + m_importRules[childVectorIndex]->setParentStyleSheet(this); + m_importRules[childVectorIndex]->requestStyleSheet(); + // FIXME: Stylesheet doesn't actually change meaningfully before the imported sheets are loaded. return true; } // Inserting @import rule after a non-import rule is not allowed. @@ -220,6 +235,7 @@ void StyleSheetContents::wrapperDeleteRule(unsigned index) --childVectorIndex; } if (childVectorIndex < m_importRules.size()) { + m_importRules[childVectorIndex]->clearParentStyleSheet(); m_importRules.remove(childVectorIndex); return; } @@ -250,22 +266,8 @@ const AtomicString& StyleSheetContents::determineNamespace(const AtomicString& p return it->second; } -void StyleSheetContents::requestImportedStyleSheets(CSSStyleSheet* rootSheet) -{ - ASSERT(!rootSheet->parentStyleSheet()); - for (unsigned i = 0; i < m_importRules.size(); ++i) - m_importRules[i]->requestStyleSheet(rootSheet, parserContext()); -} - -void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cachedStyleSheet, CSSStyleSheet* rootSheet) +void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cachedStyleSheet, const SecurityOrigin* securityOrigin) { - if (cachedStyleSheet->errorOccurred()) { - m_didLoadErrorOccur = true; - return; - } - Document* ownerDocument = rootSheet->ownerDocument(); - if (!ownerDocument) - return; // Check to see if we should enforce the MIME type of the CSS resource in strict mode. // Running in iWeb 2 is one example of where we don't want to - <rdar://problem/6099748> bool enforceMIMEType = isStrictParserMode(m_parserContext.mode) && m_parserContext.enforcesCSSMIMETypeInNoQuirksMode; @@ -279,7 +281,6 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached // to at least start with a syntactically valid CSS rule. // This prevents an attacker playing games by injecting CSS strings into HTML, XML, JSON, etc. etc. if (!hasValidMIMEType && !hasSyntacticallyValidCSSHeader()) { - const SecurityOrigin* securityOrigin = ownerDocument->securityOrigin(); bool isCrossOriginCSS = !securityOrigin || !securityOrigin->canRequest(baseURL()); if (isCrossOriginCSS) { clearRules(); @@ -292,13 +293,9 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached // There are two variants of KHTMLFixes.css. One is equal to mediaWikiKHTMLFixesStyleSheet, // while the other lacks the second trailing newline. if (baseURL().string().endsWith("/KHTMLFixes.css") && !sheetText.isNull() && mediaWikiKHTMLFixesStyleSheet.startsWith(sheetText) - && sheetText.length() >= mediaWikiKHTMLFixesStyleSheet.length() - 1) { + && sheetText.length() >= mediaWikiKHTMLFixesStyleSheet.length() - 1) clearRules(); - return; - } } - - requestImportedStyleSheets(rootSheet); } bool StyleSheetContents::parseString(const String& sheetText) @@ -311,10 +308,6 @@ bool StyleSheetContents::parseStringAtLine(const String& sheetText, int startLin CSSParser p(parserContext()); p.parseSheet(this, sheetText, startLineNumber); - if (!m_clients.isEmpty()) { - ASSERT(m_clients.size() == 1); - requestImportedStyleSheets(m_clients[0]); - } return true; } @@ -327,70 +320,66 @@ bool StyleSheetContents::isLoading() const return false; } -bool StyleSheetContents::checkImportedSheetLoadCompleted() -{ - for (unsigned i = 0; i < m_importRules.size(); ++i) { - StyleRuleImport* importRule = m_importRules[i].get(); - if (importRule->isLoading()) - return false; - if (importRule->styleSheet() && !importRule->styleSheet()->checkImportedSheetLoadCompleted()) - return false; - if (importRule->hadLoadError()) - m_didLoadErrorOccur = true; - } - m_loadCompleted = true; - return true; -} - -void StyleSheetContents::checkLoadCompleted() +void StyleSheetContents::checkLoaded() { - if (m_clients.isEmpty()) - return; - if (!checkImportedSheetLoadCompleted()) + if (isLoading()) return; RefPtr<StyleSheetContents> protect(this); - ASSERT(hasOneClient()); - ASSERT(!m_clients[0]->parentStyleSheet()); - RefPtr<Node> ownerNode = m_clients[0]->ownerNode(); - if (!ownerNode) + // Avoid |this| being deleted by scripts that run via + // ScriptableDocumentParser::executeScriptsWaitingForStylesheets(). + // See <rdar://problem/6622300>. + RefPtr<StyleSheetContents> protector(this); + StyleSheetContents* parentSheet = parentStyleSheet(); + if (parentSheet) { + parentSheet->checkLoaded(); + m_loadCompleted = true; return; - + } + RefPtr<Node> ownerNode = singleOwnerNode(); + if (!ownerNode) { + m_loadCompleted = true; + return; + } m_loadCompleted = ownerNode->sheetLoaded(); if (m_loadCompleted) ownerNode->notifyLoadedSheetAndAllCriticalSubresources(m_didLoadErrorOccur); } -bool StyleSheetContents::getAncestors(const StyleRuleImport* importRule, Vector<const StyleSheetContents*>& result) const +void StyleSheetContents::notifyLoadedSheet(const CachedCSSStyleSheet* sheet) { - result.append(this); - for (unsigned i = 0; i < m_importRules.size(); ++i) { - if (m_importRules[i] == importRule) - return true; - } - for (unsigned i = 0; i < m_importRules.size(); ++i) { - if (m_importRules[i]->styleSheet() && m_importRules[i]->styleSheet()->getAncestors(importRule, result)) - return true; - } - result.removeLast(); - return false; + ASSERT(sheet); + m_didLoadErrorOccur |= sheet->errorOccurred(); } -bool StyleSheetContents::hasImportCycle(const StyleRuleImport* importRule, const KURL& importURL, const KURL& documentBaseURL) const +void StyleSheetContents::startLoadingDynamicSheet() { - Vector<const StyleSheetContents*> ancestors; - getAncestors(importRule, ancestors); + if (Node* owner = singleOwnerNode()) + owner->startLoadingDynamicSheet(); +} - KURL parentBaseURL = documentBaseURL; - for (unsigned i = 0; i < ancestors.size(); ++i) { - if (equalIgnoringFragmentIdentifier(importURL, ancestors[i]->baseURL())) - return true; - if (equalIgnoringFragmentIdentifier(importURL, KURL(parentBaseURL, ancestors[i]->originalURL()))) - return true; - parentBaseURL = ancestors[i]->baseURL(); - } - return false; +StyleSheetContents* StyleSheetContents::rootStyleSheet() const +{ + const StyleSheetContents* root = this; + while (root->parentStyleSheet()) + root = root->parentStyleSheet(); + return const_cast<StyleSheetContents*>(root); +} + +Node* StyleSheetContents::singleOwnerNode() const +{ + StyleSheetContents* root = rootStyleSheet(); + if (root->m_clients.isEmpty()) + return 0; + ASSERT(root->m_clients.size() == 1); + return root->m_clients[0]->ownerNode(); +} + +Document* StyleSheetContents::singleOwnerDocument() const +{ + Node* ownerNode = singleOwnerNode(); + return ownerNode ? ownerNode->document() : 0; } KURL StyleSheetContents::completeURL(const String& url) const @@ -463,6 +452,11 @@ bool StyleSheetContents::hasFailedOrCanceledSubresources() const return childRulesHaveFailedOrCanceledSubresources(m_childRules); } +StyleSheetContents* StyleSheetContents::parentStyleSheet() const +{ + return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0; +} + void StyleSheetContents::registerClient(CSSStyleSheet* sheet) { ASSERT(!m_clients.contains(sheet)); @@ -493,8 +487,8 @@ void StyleSheetContents::removedFromMemoryCache() void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_originalURL); - info.addInstrumentedMember(m_encodingFromCharsetRule); + info.addMember(m_originalURL); + info.addMember(m_encodingFromCharsetRule); info.addVector(m_importRules); info.addInstrumentedVector(m_childRules); info.addHashMap(m_namespaces); diff --git a/Source/WebCore/css/StyleSheetContents.h b/Source/WebCore/css/StyleSheetContents.h index c69c55dc1..9dd3eb235 100644 --- a/Source/WebCore/css/StyleSheetContents.h +++ b/Source/WebCore/css/StyleSheetContents.h @@ -43,11 +43,15 @@ class StyleSheetContents : public RefCounted<StyleSheetContents> { public: static PassRefPtr<StyleSheetContents> create(const CSSParserContext& context = CSSParserContext(CSSStrictMode)) { - return adoptRef(new StyleSheetContents(String(), context)); + return adoptRef(new StyleSheetContents(0, String(), context)); } static PassRefPtr<StyleSheetContents> create(const String& originalURL, const CSSParserContext& context) { - return adoptRef(new StyleSheetContents(originalURL, context)); + return adoptRef(new StyleSheetContents(0, originalURL, context)); + } + static PassRefPtr<StyleSheetContents> create(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext& context) + { + return adoptRef(new StyleSheetContents(ownerRule, originalURL, context)); } ~StyleSheetContents(); @@ -56,7 +60,7 @@ public: const AtomicString& determineNamespace(const AtomicString& prefix); - void parseAuthorStyleSheet(const CachedCSSStyleSheet*, CSSStyleSheet* rootSheet); + void parseAuthorStyleSheet(const CachedCSSStyleSheet*, const SecurityOrigin*); bool parseString(const String&); bool parseStringAtLine(const String&, int startLineNumber); @@ -64,7 +68,12 @@ public: bool isLoading() const; - void checkLoadCompleted(); + void checkLoaded(); + void startLoadingDynamicSheet(); + + StyleSheetContents* rootStyleSheet() const; + Node* singleOwnerNode() const; + Document* singleOwnerDocument() const; const String& charset() const { return m_parserContext.charset; } @@ -92,8 +101,12 @@ public: const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRules; } const Vector<RefPtr<StyleRuleImport> >& importRules() const { return m_importRules; } - bool hasImportCycle(const StyleRuleImport* importRule, const KURL& importURL, const KURL& documentBaseURL) const; - + void notifyLoadedSheet(const CachedCSSStyleSheet*); + + StyleSheetContents* parentStyleSheet() const; + StyleRuleImport* ownerRule() const { return m_ownerRule; } + void clearOwnerRule() { m_ownerRule = 0; } + // Note that href is the URL that started the redirect chain that led to // this style sheet. This property probably isn't useful for much except // the JavaScript binding (which needs to use this value for security). @@ -110,8 +123,6 @@ public: bool wrapperInsertRule(PassRefPtr<StyleRuleBase>, unsigned index); void wrapperDeleteRule(unsigned index); - void requestImportedStyleSheets(CSSStyleSheet* rootSheet); - PassRefPtr<StyleSheetContents> copy() const { return adoptRef(new StyleSheetContents(*this)); } void registerClient(CSSStyleSheet*); @@ -128,13 +139,12 @@ public: void reportMemoryUsage(MemoryObjectInfo*) const; private: - StyleSheetContents(const String& originalURL, const CSSParserContext&); + StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext&); StyleSheetContents(const StyleSheetContents&); void clearCharsetRule(); - bool checkImportedSheetLoadCompleted(); - bool getAncestors(const StyleRuleImport*, Vector<const StyleSheetContents*>& result) const; + StyleRuleImport* m_ownerRule; String m_originalURL; diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp index bf3b8695b..8acb54979 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp @@ -92,8 +92,8 @@ String StyleKeyframe::cssText() const void StyleKeyframe::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_properties); - info.addInstrumentedMember(m_key); + info.addMember(m_properties); + info.addMember(m_key); } WebKitCSSKeyframeRule::WebKitCSSKeyframeRule(StyleKeyframe* keyframe, WebKitCSSKeyframesRule* parent) @@ -120,8 +120,8 @@ void WebKitCSSKeyframeRule::reportDescendantMemoryUsage(MemoryObjectInfo* memory { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_keyframe); - info.addInstrumentedMember(m_propertiesCSSOMWrapper); + info.addMember(m_keyframe); + info.addMember(m_propertiesCSSOMWrapper); } } // namespace WebCore diff --git a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp index f8d08078d..a2991a818 100644 --- a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp +++ b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp @@ -91,7 +91,7 @@ void StyleRuleKeyframes::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObj { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); info.addInstrumentedVector(m_keyframes); - info.addInstrumentedMember(m_name); + info.addMember(m_name); } WebKitCSSKeyframesRule::WebKitCSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSheet* parent) @@ -210,9 +210,9 @@ void WebKitCSSKeyframesRule::reportDescendantMemoryUsage(MemoryObjectInfo* memor { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_keyframesRule); + info.addMember(m_keyframesRule); info.addInstrumentedVector(m_childRuleCSSOMWrappers); - info.addInstrumentedMember(m_ruleListCSSOMWrapper); + info.addMember(m_ruleListCSSOMWrapper); } } // namespace WebCore diff --git a/Source/WebCore/css/WebKitCSSRegionRule.cpp b/Source/WebCore/css/WebKitCSSRegionRule.cpp index e64832f6b..5c2c721cd 100644 --- a/Source/WebCore/css/WebKitCSSRegionRule.cpp +++ b/Source/WebCore/css/WebKitCSSRegionRule.cpp @@ -112,9 +112,9 @@ void WebKitCSSRegionRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryOb { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_regionRule); + info.addMember(m_regionRule); info.addInstrumentedVector(m_childRuleCSSOMWrappers); - info.addInstrumentedMember(m_ruleListCSSOMWrapper); + info.addMember(m_ruleListCSSOMWrapper); } } // namespace WebCore diff --git a/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp b/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp index e133c9221..44c880894 100644 --- a/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp +++ b/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp @@ -67,7 +67,7 @@ String WebKitCSSSVGDocumentValue::customCssText() const void WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_url); + info.addMember(m_url); // FIXME: add m_document when cached resources are instrumented. } diff --git a/Source/WebCore/css/WebKitCSSShaderValue.cpp b/Source/WebCore/css/WebKitCSSShaderValue.cpp index 2326999b0..6f9373e0f 100644 --- a/Source/WebCore/css/WebKitCSSShaderValue.cpp +++ b/Source/WebCore/css/WebKitCSSShaderValue.cpp @@ -83,7 +83,7 @@ String WebKitCSSShaderValue::customCssText() const void WebKitCSSShaderValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_url); + info.addMember(m_url); } } // namespace WebCore diff --git a/Source/WebCore/css/mathml.css b/Source/WebCore/css/mathml.css index 25bb7baf6..54fc8de7f 100644 --- a/Source/WebCore/css/mathml.css +++ b/Source/WebCore/css/mathml.css @@ -10,25 +10,55 @@ mtext { math { font-family: STIXGeneral, Symbol, "Times New Roman", sans-serif; - display: inline-block; - padding: 0px; - text-align: left; + display: -webkit-inline-flex !important; padding-left: 1px; padding-right: 1px; } math[display="block"] { - display: block; + display: -webkit-flex !important; + -webkit-justify-content: center; page-break-inside: avoid; - margin-bottom: 1em; - text-align: center; - margin-left: auto; - margin-right: auto; + /* -webkit-margin-before: 1em; -- FIXME: Ask www-math for a default MathML stylesheet, including this (or margin-top). */ + -webkit-margin-after: 1em; } mo, mrow, mfenced, mfrac, msub, msup, msubsup, munder, mover, munderover, msqrt, mroot { - display: inline-block; - white-space: nowrap; + display: -webkit-inline-flex !important; +} +math, mrow, mfenced, msqrt, mroot { + -webkit-align-items: baseline; +} +msqrt > * { /* This rule is needed because of <msqrt>'s anonymous <mrow>. */ + -webkit-align-self: baseline; +} +mo, mfrac, munder, mover, munderover { + -webkit-flex-direction: column; +} +munder, mover, munderover { + -webkit-align-items: center; +} +mfrac > * { + -webkit-align-self: center; +} +mfrac[numalign="left"] > :first-child { + -webkit-align-self: flex-start; +} +mfrac[numalign="right"] > :first-child { + -webkit-align-self: flex-end; +} +mfrac[denomalign="left"] > :last-child { + -webkit-align-self: flex-start; +} +mfrac[denomalign="right"] > :last-child { + -webkit-align-self: flex-end; +} +msubsup > :last-child, mover > :last-child, munderover > :last-child { + -webkit-order: -1; +} + +msub > * + *, msup > * + *, msubsup > * + *, munder > * + *, mover > * + *, munderover > * + * { + font-size: 0.75em; /* FIXME: MathML standard is 0.71em */ } mfenced { @@ -45,28 +75,10 @@ mi + mrow { margin-left: 0.1em; } -msub > * + * { - vertical-align: sub; - font-size: 0.75em; -} - -msup > * + * { - vertical-align: super; - font-size: 0.75em; -} - msubsup > * { padding: 0px; } -msubsup > * + * { - font-size: 0.75em; -} - -munderover > * + *, mover > * + *, munder > * + * { - font-size: 0.75em; -} - mo, mn, mi, mtext { padding: 0px; } @@ -75,6 +87,19 @@ math > mo, mrow > mo, mfenced > mo { padding-right: 0.1em; } +mroot { + position: relative; +} +mroot > * + * { + font-size: 0.75em; + position: absolute; + left: 0; + top: 0; + padding-right: 0.4em; + padding-left: 0.2em; + padding-bottom: 0.35em; +} + math[mathvariant="normal"], mstyle[mathvariant="normal"], mo[mathvariant="normal"], mn[mathvariant="normal"], mi[mathvariant="normal"], mtext[mathvariant="normal"], mspace[mathvariant="normal"], ms[mathvariant="normal"] { font-style: normal; font-weight: normal; @@ -122,24 +147,9 @@ merror { background-color: lightYellow; } -mroot { - position: relative; -} - -mroot > * + * { - font-size: 0.75em; - position: absolute; - left: 0; - top: 0; - padding-right: 0.4em; - padding-left: 0.2em; - padding-bottom: 0.35em; -} - mtable { display: inline-table; text-align: center; - vertical-align: middle; } mtr { diff --git a/Source/WebCore/dom/Attribute.h b/Source/WebCore/dom/Attribute.h index adb18a589..8328a7837 100644 --- a/Source/WebCore/dom/Attribute.h +++ b/Source/WebCore/dom/Attribute.h @@ -71,8 +71,8 @@ public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_name); - info.addInstrumentedMember(m_value); + info.addMember(m_name); + info.addMember(m_value); } private: diff --git a/Source/WebCore/dom/CharacterData.cpp b/Source/WebCore/dom/CharacterData.cpp index 390de1821..9a54a74cd 100644 --- a/Source/WebCore/dom/CharacterData.cpp +++ b/Source/WebCore/dom/CharacterData.cpp @@ -98,7 +98,7 @@ void CharacterData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); Node::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_data); + info.addMember(m_data); } void CharacterData::appendData(const String& data, ExceptionCode&) diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index 3abef6eff..7e02284ce 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -726,6 +726,134 @@ void ContainerNode::cloneChildNodes(ContainerNode *clone) } } +bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const +{ + if (!renderer()) + return false; + // What is this code really trying to do? + RenderObject* o = renderer(); + RenderObject* p = o; + + if (!o->isInline() || o->isReplaced()) { + point = o->localToAbsolute(FloatPoint(), false, true); + return true; + } + + // find the next text/image child, to get a position + while (o) { + p = o; + if (o->firstChild()) + o = o->firstChild(); + else if (o->nextSibling()) + o = o->nextSibling(); + else { + RenderObject* next = 0; + while (!next && o->parent()) { + o = o->parent(); + next = o->nextSibling(); + } + o = next; + + if (!o) + break; + } + ASSERT(o); + + if (!o->isInline() || o->isReplaced()) { + point = o->localToAbsolute(FloatPoint(), false, true); + return true; + } + + if (p->node() && p->node() == this && o->isText() && !o->isBR() && !toRenderText(o)->firstTextBox()) { + // do nothing - skip unrendered whitespace that is a child or next sibling of the anchor + } else if ((o->isText() && !o->isBR()) || o->isReplaced()) { + point = FloatPoint(); + if (o->isText() && toRenderText(o)->firstTextBox()) { + point.move(toRenderText(o)->linesBoundingBox().x(), toRenderText(o)->firstTextBox()->root()->lineTop()); + } else if (o->isBox()) { + RenderBox* box = toRenderBox(o); + point.moveBy(box->location()); + } + point = o->container()->localToAbsolute(point, false, true); + return true; + } + } + + // If the target doesn't have any children or siblings that could be used to calculate the scroll position, we must be + // at the end of the document. Scroll to the bottom. FIXME: who said anything about scrolling? + if (!o && document()->view()) { + point = FloatPoint(0, document()->view()->contentsHeight()); + return true; + } + return false; +} + +bool ContainerNode::getLowerRightCorner(FloatPoint& point) const +{ + if (!renderer()) + return false; + + RenderObject* o = renderer(); + if (!o->isInline() || o->isReplaced()) { + RenderBox* box = toRenderBox(o); + point = o->localToAbsolute(LayoutPoint(box->size()), false, true); + return true; + } + + // find the last text/image child, to get a position + while (o) { + if (o->lastChild()) + o = o->lastChild(); + else if (o->previousSibling()) + o = o->previousSibling(); + else { + RenderObject* prev = 0; + while (!prev) { + o = o->parent(); + if (!o) + return false; + prev = o->previousSibling(); + } + o = prev; + } + ASSERT(o); + if (o->isText() || o->isReplaced()) { + point = FloatPoint(); + if (o->isText()) { + RenderText* text = toRenderText(o); + IntRect linesBox = text->linesBoundingBox(); + if (!linesBox.maxX() && !linesBox.maxY()) + continue; + point.moveBy(linesBox.maxXMaxYCorner()); + } else { + RenderBox* box = toRenderBox(o); + point.moveBy(box->frameRect().maxXMaxYCorner()); + } + point = o->container()->localToAbsolute(point, false, true); + return true; + } + } + return true; +} + +LayoutRect ContainerNode::boundingBox() const +{ + FloatPoint upperLeft, lowerRight; + bool foundUpperLeft = getUpperLeftCorner(upperLeft); + bool foundLowerRight = getLowerRightCorner(lowerRight); + + // If we've found one corner, but not the other, + // then we should just return a point at the corner that we did find. + if (foundUpperLeft != foundLowerRight) { + if (foundUpperLeft) + lowerRight = upperLeft; + else + upperLeft = lowerRight; + } + + return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft)); +} + void ContainerNode::setFocus(bool received) { if (focused() == received) diff --git a/Source/WebCore/dom/ContainerNode.h b/Source/WebCore/dom/ContainerNode.h index 743120abf..f9ec37798 100644 --- a/Source/WebCore/dom/ContainerNode.h +++ b/Source/WebCore/dom/ContainerNode.h @@ -75,6 +75,7 @@ public: virtual void attach() OVERRIDE; virtual void detach() OVERRIDE; + virtual LayoutRect boundingBox() const OVERRIDE; virtual void setFocus(bool = true) OVERRIDE; virtual void setActive(bool active = true, bool pause = false) OVERRIDE; virtual void setHovered(bool = true) OVERRIDE; @@ -104,8 +105,8 @@ public: { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); Node::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_firstChild); - info.addInstrumentedMember(m_lastChild); + info.addMember(m_firstChild); + info.addMember(m_lastChild); } protected: @@ -131,6 +132,9 @@ private: static void dispatchPostAttachCallbacks(); + bool getUpperLeftCorner(FloatPoint&) const; + bool getLowerRightCorner(FloatPoint&) const; + Node* m_firstChild; Node* m_lastChild; }; diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 3ac5d9ec0..ab48ca382 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -1139,6 +1139,11 @@ bool Document::regionBasedColumnsEnabled() const return settings() && settings()->regionBasedColumnsEnabled(); } +bool Document::cssStickyPositionEnabled() const +{ + return settings() && settings()->cssStickyPositionEnabled(); +} + bool Document::cssRegionsEnabled() const { return settings() && settings()->cssRegionsEnabled(); @@ -1387,7 +1392,7 @@ String Document::suggestedMIMEType() const // * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h); // * making it receive the expading size of each direction separately, // i.e. nodesFromRect(x, y, topSize, rightSize, bottomSize, leftSize); -PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const +PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent) const { // FIXME: Share code between this, elementFromPoint and caretRangeFromPoint. if (!renderer()) @@ -1411,8 +1416,6 @@ PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned return 0; if (allowShadowContent) type |= HitTestRequest::AllowShadowContent; - if (allowChildFrameContent) - type |= HitTestRequest::AllowChildFrameContent; HitTestRequest request(type); @@ -2821,12 +2824,12 @@ String Document::userAgent(const KURL& url) const return frame() ? frame()->loader()->userAgent(url) : String(); } -void Document::disableEval() +void Document::disableEval(const String& errorMessage) { if (!frame()) return; - frame()->script()->disableEval(); + frame()->script()->disableEval(errorMessage); } bool Document::canNavigate(Frame* targetFrame) @@ -4552,6 +4555,12 @@ void Document::unregisterForMediaVolumeCallbacks(Element* e) m_mediaVolumeCallbackElements.remove(e); } +void Document::storageBlockingStateDidChange() +{ + if (Settings* settings = this->settings()) + securityOrigin()->setStorageBlockingPolicy(settings->storageBlockingPolicy()); +} + void Document::privateBrowsingStateDidChange() { HashSet<Element*>::iterator end = m_privateBrowsingStateChangedElements.end(); @@ -6145,8 +6154,7 @@ void Document::updateHoverActiveState(const HitTestRequest& request, HitTestResu return; Node* innerNodeInDocument = result.innerNode(); - while (innerNodeInDocument && innerNodeInDocument->document() != this) - innerNodeInDocument = innerNodeInDocument->document()->ownerElement(); + ASSERT(!innerNodeInDocument || innerNodeInDocument->document() == this); Node* oldActiveNode = activeNode(); if (oldActiveNode && !request.active()) { @@ -6241,21 +6249,21 @@ void Document::updateHoverActiveState(const HitTestRequest& request, HitTestResu void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_styleResolver); + info.addMember(m_styleResolver); ContainerNode::reportMemoryUsage(memoryObjectInfo); info.addVector(m_customFonts); - info.addInstrumentedMember(m_url); - info.addInstrumentedMember(m_baseURL); - info.addInstrumentedMember(m_baseURLOverride); - info.addInstrumentedMember(m_baseElementURL); - info.addInstrumentedMember(m_cookieURL); - info.addInstrumentedMember(m_firstPartyForCookies); - info.addInstrumentedMember(m_documentURI); - info.addInstrumentedMember(m_baseTarget); - info.addInstrumentedMember(m_frame); - info.addInstrumentedMember(m_cachedResourceLoader); - info.addInstrumentedMember(m_elemSheet); - info.addInstrumentedMember(m_pageUserSheet); + info.addMember(m_url); + info.addMember(m_baseURL); + info.addMember(m_baseURLOverride); + info.addMember(m_baseElementURL); + info.addMember(m_cookieURL); + info.addMember(m_firstPartyForCookies); + info.addMember(m_documentURI); + info.addMember(m_baseTarget); + info.addMember(m_frame); + info.addMember(m_cachedResourceLoader); + info.addMember(m_elemSheet); + info.addMember(m_pageUserSheet); if (m_pageGroupUserSheets) info.addInstrumentedVectorPtr(m_pageGroupUserSheets); if (m_userSheets) @@ -6263,13 +6271,13 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const info.addHashSet(m_nodeIterators); info.addHashSet(m_ranges); info.addListHashSet(m_styleSheetCandidateNodes); - info.addInstrumentedMember(m_preferredStylesheetSet); - info.addInstrumentedMember(m_selectedStylesheetSet); - info.addInstrumentedMember(m_title.string()); - info.addInstrumentedMember(m_rawTitle.string()); - info.addInstrumentedMember(m_xmlEncoding); - info.addInstrumentedMember(m_xmlVersion); - info.addInstrumentedMember(m_contentLanguage); + info.addMember(m_preferredStylesheetSet); + info.addMember(m_selectedStylesheetSet); + info.addMember(m_title.string()); + info.addMember(m_rawTitle.string()); + info.addMember(m_xmlEncoding); + info.addMember(m_xmlVersion); + info.addMember(m_contentLanguage); info.addHashMap(m_documentNamedItemCollections); info.addHashMap(m_windowNamedItemCollections); #if ENABLE(DASHBOARD_SUPPORT) @@ -6281,7 +6289,7 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const info.addHashSet(m_mediaVolumeCallbackElements); info.addHashSet(m_privateBrowsingStateChangedElements); info.addHashMap(m_elementsByAccessKey); - info.addInstrumentedMember(m_eventQueue); + info.addMember(m_eventQueue); info.addHashSet(m_mediaCanStartListeners); info.addVector(m_pendingTasks); } @@ -6322,7 +6330,7 @@ public: unsigned hash() const { unsigned attributeHash = StringHasher::hashMemory(m_attributes, m_attributeCount * sizeof(Attribute)); - return WTF::intHash((static_cast<uint64_t>(m_localName->existingHash()) << 32 | attributeHash)); + return WTF::pairIntHash(m_localName->existingHash(), attributeHash); } private: diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index acba04c00..d8119c30b 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -355,6 +355,7 @@ public: virtual PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&); PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser); + bool cssStickyPositionEnabled() const; bool cssRegionsEnabled() const; #if ENABLE(CSS_REGIONS) PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&); @@ -380,9 +381,8 @@ public: * @param ignoreClipping whether or not to ignore the root scroll frame when retrieving the element. * If false, this method returns null for coordinates outside of the viewport. */ - PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY, - unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, - bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent = false) const; + PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, + unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent) const; Element* elementFromPoint(int x, int y) const; PassRefPtr<Range> caretRangeFromPoint(int x, int y); @@ -644,7 +644,7 @@ public: virtual String userAgent(const KURL&) const; - virtual void disableEval(); + virtual void disableEval(const String& errorMessage); bool canNavigate(Frame* targetFrame); Frame* findUnsafeParentScrollPropagationBoundary(); @@ -1020,6 +1020,7 @@ public: void registerForPrivateBrowsingStateChangedCallbacks(Element*); void unregisterForPrivateBrowsingStateChangedCallbacks(Element*); + void storageBlockingStateDidChange(); void privateBrowsingStateDidChange(); void setShouldCreateRenderers(bool); diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 8a28cf715..2f4e92564 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -442,8 +442,8 @@ public: { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); ContainerNode::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_tagName); - info.addInstrumentedMember(m_attributeData); + info.addMember(m_tagName); + info.addMember(m_attributeData); } protected: diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index a6454dde1..03f7b81fc 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -213,11 +213,15 @@ void ElementAttributeData::updateInlineStyleAvoidingMutation(StyledElement* elem m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents()); } -void ElementAttributeData::destroyInlineStyle(StyledElement* element) const +void ElementAttributeData::detachCSSOMWrapperIfNeeded(StyledElement* element) { - if (!m_inlineStyleDecl) - return; - m_inlineStyleDecl->clearParentElement(element); + if (m_inlineStyleDecl) + m_inlineStyleDecl->clearParentElement(element); +} + +void ElementAttributeData::destroyInlineStyle(StyledElement* element) +{ + detachCSSOMWrapperIfNeeded(element); m_inlineStyleDecl = 0; } @@ -291,14 +295,14 @@ void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) { size_t actualSize = m_isMutable ? sizeof(ElementAttributeData) : immutableElementAttributeDataSize(m_arraySize); MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM, actualSize); - info.addInstrumentedMember(m_inlineStyleDecl); - info.addInstrumentedMember(m_attributeStyle); + info.addMember(m_inlineStyleDecl); + info.addMember(m_attributeStyle); info.addMember(m_classNames); - info.addInstrumentedMember(m_idForStyleResolution); + info.addMember(m_idForStyleResolution); if (m_isMutable) info.addVector(mutableAttributeVector()); for (unsigned i = 0, len = length(); i < len; i++) - info.addInstrumentedMember(*attributeItem(i)); + info.addMember(*attributeItem(i)); } size_t ElementAttributeData::getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const diff --git a/Source/WebCore/dom/ElementAttributeData.h b/Source/WebCore/dom/ElementAttributeData.h index ab593dabc..e18d8b333 100644 --- a/Source/WebCore/dom/ElementAttributeData.h +++ b/Source/WebCore/dom/ElementAttributeData.h @@ -58,7 +58,8 @@ public: StylePropertySet* ensureInlineStyle(StyledElement*); StylePropertySet* ensureMutableInlineStyle(StyledElement*); void updateInlineStyleAvoidingMutation(StyledElement*, const String& text) const; - void destroyInlineStyle(StyledElement*) const; + void destroyInlineStyle(StyledElement*); + void detachCSSOMWrapperIfNeeded(StyledElement*); const StylePropertySet* attributeStyle() const { return m_attributeStyle.get(); } void setAttributeStyle(PassRefPtr<StylePropertySet> style) const { m_attributeStyle = style; } diff --git a/Source/WebCore/dom/Event.cpp b/Source/WebCore/dom/Event.cpp index a0bf439b5..c1e609ff4 100644 --- a/Source/WebCore/dom/Event.cpp +++ b/Source/WebCore/dom/Event.cpp @@ -159,10 +159,10 @@ void Event::storeResult(const String&) void Event::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_type); + info.addMember(m_type); info.addMember(m_currentTarget); info.addMember(m_target); - info.addInstrumentedMember(m_underlyingEvent); + info.addMember(m_underlyingEvent); } PassRefPtr<Event> Event::cloneFor(HTMLIFrameElement*) const diff --git a/Source/WebCore/dom/GestureEvent.cpp b/Source/WebCore/dom/GestureEvent.cpp index d75cdaa09..1e7b87e7a 100644 --- a/Source/WebCore/dom/GestureEvent.cpp +++ b/Source/WebCore/dom/GestureEvent.cpp @@ -58,6 +58,7 @@ PassRefPtr<GestureEvent> GestureEvent::create(PassRefPtr<AbstractView> view, con case PlatformEvent::GesturePinchBegin: case PlatformEvent::GesturePinchEnd: case PlatformEvent::GesturePinchUpdate: + case PlatformEvent::GestureTapDownCancel: default: return 0; } diff --git a/Source/WebCore/dom/MessagePort.idl b/Source/WebCore/dom/MessagePort.idl index 9f393b437..3cbd20ecb 100644 --- a/Source/WebCore/dom/MessagePort.idl +++ b/Source/WebCore/dom/MessagePort.idl @@ -39,8 +39,12 @@ module events { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [Custom] void postMessage(in any message, in [Optional] Array messagePorts) raises(DOMException); + +#if defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES [Custom] void webkitPostMessage(in any message, in [Optional] Array transfer) raises(DOMException); +#endif // defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES + void start(); void close(); diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 353d283d0..aef669c50 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -2811,11 +2811,11 @@ void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); TreeShared<Node, ContainerNode>::reportMemoryUsage(memoryObjectInfo); ScriptWrappable::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_document); - info.addInstrumentedMember(m_next); - info.addInstrumentedMember(m_previous); + info.addMember(m_document); + info.addMember(m_next); + info.addMember(m_previous); if (m_renderer) - info.addInstrumentedMember(m_renderer->style()); + info.addMember(m_renderer->style()); } } // namespace WebCore diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp index 9a0eafa7b..ef13b4690 100644 --- a/Source/WebCore/dom/ProcessingInstruction.cpp +++ b/Source/WebCore/dom/ProcessingInstruction.cpp @@ -254,7 +254,7 @@ void ProcessingInstruction::parseStyleSheet(const String& sheet) m_loading = false; if (m_isCSS) - static_cast<CSSStyleSheet*>(m_sheet.get())->contents()->checkLoadCompleted(); + static_cast<CSSStyleSheet*>(m_sheet.get())->contents()->checkLoaded(); #if ENABLE(XSLT) else if (m_isXSL) static_cast<XSLStyleSheet*>(m_sheet.get())->checkLoaded(); diff --git a/Source/WebCore/dom/QualifiedName.cpp b/Source/WebCore/dom/QualifiedName.cpp index 56810b4e4..783604732 100644 --- a/Source/WebCore/dom/QualifiedName.cpp +++ b/Source/WebCore/dom/QualifiedName.cpp @@ -145,17 +145,17 @@ const AtomicString& QualifiedName::localNameUpper() const void QualifiedName::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_impl); + info.addMember(m_impl); } void QualifiedName::QualifiedNameImpl::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_prefix); - info.addInstrumentedMember(m_localName); - info.addInstrumentedMember(m_namespace); - info.addInstrumentedMember(m_localNameUpper); + info.addMember(m_prefix); + info.addMember(m_localName); + info.addMember(m_namespace); + info.addMember(m_localNameUpper); } void createQualifiedName(void* targetAddress, const char* name, unsigned nameLength, const AtomicString& nameNamespace) diff --git a/Source/WebCore/dom/ScriptExecutionContext.h b/Source/WebCore/dom/ScriptExecutionContext.h index e7468038c..8ad3e9f24 100644 --- a/Source/WebCore/dom/ScriptExecutionContext.h +++ b/Source/WebCore/dom/ScriptExecutionContext.h @@ -79,7 +79,7 @@ public: virtual String userAgent(const KURL&) const = 0; - virtual void disableEval() = 0; + virtual void disableEval(const String& errorMessage) = 0; bool sanitizeScriptError(String& errorMessage, int& lineNumber, String& sourceURL); void reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); diff --git a/Source/WebCore/dom/SpaceSplitString.cpp b/Source/WebCore/dom/SpaceSplitString.cpp index 9cce7d95b..c301f69ed 100644 --- a/Source/WebCore/dom/SpaceSplitString.cpp +++ b/Source/WebCore/dom/SpaceSplitString.cpp @@ -31,24 +31,31 @@ using namespace WTF; namespace WebCore { -static bool hasNonASCIIOrUpper(const String& string) +template <typename CharacterType> +static inline bool hasNonASCIIOrUpper(const CharacterType* characters, unsigned length) { - const UChar* characters = string.characters(); - unsigned length = string.length(); bool hasUpper = false; - UChar ored = 0; + CharacterType ored = 0; for (unsigned i = 0; i < length; i++) { - UChar c = characters[i]; + CharacterType c = characters[i]; hasUpper |= isASCIIUpper(c); ored |= c; } return hasUpper || (ored & ~0x7F); } -void SpaceSplitStringData::createVector(const String& string) +static inline bool hasNonASCIIOrUpper(const String& string) { - const UChar* characters = string.characters(); unsigned length = string.length(); + + if (string.is8Bit()) + return hasNonASCIIOrUpper(string.characters8(), length); + return hasNonASCIIOrUpper(string.characters16(), length); +} + +template <typename CharacterType> +inline void SpaceSplitStringData::createVector(const CharacterType* characters, unsigned length) +{ unsigned start = 0; while (true) { while (start < length && isHTMLSpace(characters[start])) @@ -65,6 +72,18 @@ void SpaceSplitStringData::createVector(const String& string) } } +void SpaceSplitStringData::createVector(const String& string) +{ + unsigned length = string.length(); + + if (string.is8Bit()) { + createVector(string.characters8(), length); + return; + } + + createVector(string.characters16(), length); +} + bool SpaceSplitStringData::containsAll(SpaceSplitStringData& other) { if (this == &other) diff --git a/Source/WebCore/dom/SpaceSplitString.h b/Source/WebCore/dom/SpaceSplitString.h index fced3ce13..52f2272f6 100644 --- a/Source/WebCore/dom/SpaceSplitString.h +++ b/Source/WebCore/dom/SpaceSplitString.h @@ -58,6 +58,8 @@ namespace WebCore { explicit SpaceSplitStringData(const SpaceSplitStringData&); void createVector(const String&); + template <typename CharacterType> + inline void createVector(const CharacterType*, unsigned); AtomicString m_keyString; Vector<AtomicString, 4> m_vector; diff --git a/Source/WebCore/dom/StyleElement.cpp b/Source/WebCore/dom/StyleElement.cpp index 3fc8e7c44..dd4de2901 100644 --- a/Source/WebCore/dom/StyleElement.cpp +++ b/Source/WebCore/dom/StyleElement.cpp @@ -149,7 +149,6 @@ void StyleElement::createSheet(Element* e, WTF::OrdinalNumber startLineNumber, c { ASSERT(e); ASSERT(e->inDocument()); - Document* document = e->document(); if (m_sheet) { if (m_sheet->isLoading()) @@ -182,7 +181,7 @@ void StyleElement::createSheet(Element* e, WTF::OrdinalNumber startLineNumber, c } if (m_sheet) - m_sheet->contents()->checkLoadCompleted(); + m_sheet->contents()->checkLoaded(); } bool StyleElement::isLoading() const diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index 12feb2af4..eff9a9e70 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -139,7 +139,8 @@ StyledElement::StyledElement(const QualifiedName& name, Document* document, Cons StyledElement::~StyledElement() { - destroyInlineStyle(); + if (attributeData() && attributeData()->isMutable()) + mutableAttributeData()->detachCSSOMWrapperIfNeeded(this); } CSSStyleDeclaration* StyledElement::style() @@ -163,8 +164,8 @@ void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, Sh WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); if (document() && document()->scriptableDocumentParser() && !document()->isInDocumentWrite()) startLineNumber = document()->scriptableDocumentParser()->lineNumber(); - if (newStyleString.isNull()) - destroyInlineStyle(); + if (newStyleString.isNull() && attributeData()) + mutableAttributeData()->destroyInlineStyle(this); else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber)) ensureAttributeData()->updateInlineStyleAvoidingMutation(this, newStyleString); setIsStyleAttributeValid(); @@ -266,7 +267,7 @@ static unsigned computePresentationAttributeCacheHash(const PresentationAttribut return 0; ASSERT(key.attributesAndValues.size()); unsigned attributeHash = StringHasher::hashMemory(key.attributesAndValues.data(), key.attributesAndValues.size() * sizeof(key.attributesAndValues[0])); - return WTF::intHash((static_cast<uint64_t>(key.tagName->existingHash()) << 32 | attributeHash)); + return WTF::pairIntHash(key.tagName->existingHash(), attributeHash); } void StyledElement::updateAttributeStyle() diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h index 66418ddfd..0d0f773ca 100644 --- a/Source/WebCore/dom/StyledElement.h +++ b/Source/WebCore/dom/StyledElement.h @@ -79,12 +79,6 @@ private: void makePresentationAttributeCacheKey(PresentationAttributeCacheKey&) const; void updateAttributeStyle(); - - void destroyInlineStyle() - { - if (attributeData()) - attributeData()->destroyInlineStyle(this); - } }; inline void StyledElement::invalidateStyleAttribute() diff --git a/Source/WebCore/fileapi/WebKitBlobBuilder.cpp b/Source/WebCore/fileapi/WebKitBlobBuilder.cpp index c08e5fab7..d073c36ff 100644 --- a/Source/WebCore/fileapi/WebKitBlobBuilder.cpp +++ b/Source/WebCore/fileapi/WebKitBlobBuilder.cpp @@ -33,7 +33,9 @@ #include "WebKitBlobBuilder.h" #include "Blob.h" +#include "Document.h" #include "ExceptionCode.h" +#include "FeatureObserver.h" #include "File.h" #include "HistogramSupport.h" #include "LineEnding.h" @@ -61,6 +63,11 @@ PassRefPtr<WebKitBlobBuilder> WebKitBlobBuilder::create(ScriptExecutionContext* String message("BlobBuilder is deprecated. Use \"Blob\" constructor instead."); context->addConsoleMessage(JSMessageSource, LogMessageType, WarningMessageLevel, message); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + FeatureObserver::observe(document->domWindow(), FeatureObserver::LegacyBlobBuilder); + } + return adoptRef(new WebKitBlobBuilder()); } diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp index 3bc2d933d..7c5d70cfb 100644 --- a/Source/WebCore/html/HTMLEmbedElement.cpp +++ b/Source/WebCore/html/HTMLEmbedElement.cpp @@ -99,8 +99,6 @@ void HTMLEmbedElement::parseAttribute(const Attribute& attribute) size_t pos = m_serviceType.find(";"); if (pos != notFound) m_serviceType = m_serviceType.left(pos); - if (!isImageType() && m_imageLoader) - m_imageLoader.clear(); } else if (attribute.name() == codeAttr) m_url = stripLeadingAndTrailingHTMLSpaces(attribute.value()); else if (attribute.name() == srcAttr) { diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp index 2ca33bdcb..e934e4d92 100644 --- a/Source/WebCore/html/HTMLImageElement.cpp +++ b/Source/WebCore/html/HTMLImageElement.cpp @@ -426,7 +426,7 @@ void HTMLImageElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); HTMLElement::reportMemoryUsage(memoryObjectInfo); info.addMember(m_imageLoader); - info.addInstrumentedMember(m_form); + info.addMember(m_form); } } diff --git a/Source/WebCore/html/HTMLImageElement.h b/Source/WebCore/html/HTMLImageElement.h index 4657d7cd5..9468a7958 100644 --- a/Source/WebCore/html/HTMLImageElement.h +++ b/Source/WebCore/html/HTMLImageElement.h @@ -83,9 +83,7 @@ public: bool complete() const; - // FIXME: Why do we have two names for the same thing? - bool hasPendingLoadEvent() const { return m_imageLoader.hasPendingLoadEvent(); } - bool hasPendingActivity() const { return m_imageLoader.hasPendingLoadEvent(); } + bool hasPendingActivity() const { return m_imageLoader.hasPendingActivity(); } virtual bool canContainRangeEndPoint() const { return false; } @@ -99,6 +97,8 @@ protected: private: virtual void createShadowSubtree(); + virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } + // Implementation of ImageLoaderClient Element* sourceElement() { return this; } Element* imageElement(); diff --git a/Source/WebCore/html/HTMLKeygenElement.h b/Source/WebCore/html/HTMLKeygenElement.h index 78b0c691c..e3c912947 100644 --- a/Source/WebCore/html/HTMLKeygenElement.h +++ b/Source/WebCore/html/HTMLKeygenElement.h @@ -39,6 +39,8 @@ public: private: HTMLKeygenElement(const QualifiedName&, Document*, HTMLFormElement*); + virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } + virtual bool canStartSelection() const { return false; } virtual void parseAttribute(const Attribute&) OVERRIDE; diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp index 2a732d07a..d2868b610 100644 --- a/Source/WebCore/html/HTMLLinkElement.cpp +++ b/Source/WebCore/html/HTMLLinkElement.cpp @@ -323,10 +323,11 @@ void HTMLLinkElement::setCSSStyleSheet(const String& href, const KURL& baseURL, m_sheet->setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(m_media)); m_sheet->setTitle(title()); - styleSheet->parseAuthorStyleSheet(cachedStyleSheet, m_sheet.get()); + styleSheet->parseAuthorStyleSheet(cachedStyleSheet, document()->securityOrigin()); m_loading = false; - styleSheet->checkLoadCompleted(); + styleSheet->notifyLoadedSheet(cachedStyleSheet); + styleSheet->checkLoaded(); #if ENABLE(PARSED_STYLE_SHEET_CACHING) if (styleSheet->isCacheable()) diff --git a/Source/WebCore/html/HTMLMeterElement.h b/Source/WebCore/html/HTMLMeterElement.h index 8e63c64a8..454e2d3e8 100644 --- a/Source/WebCore/html/HTMLMeterElement.h +++ b/Source/WebCore/html/HTMLMeterElement.h @@ -69,6 +69,7 @@ private: virtual ~HTMLMeterElement(); virtual void willAddAuthorShadowRoot() OVERRIDE; + virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } RenderMeter* renderMeter() const; virtual bool supportLabels() const OVERRIDE { return true; } diff --git a/Source/WebCore/html/HTMLObjectElement.cpp b/Source/WebCore/html/HTMLObjectElement.cpp index cf185a8d3..bc2effca1 100644 --- a/Source/WebCore/html/HTMLObjectElement.cpp +++ b/Source/WebCore/html/HTMLObjectElement.cpp @@ -105,8 +105,6 @@ void HTMLObjectElement::parseAttribute(const Attribute& attribute) m_serviceType = m_serviceType.left(pos); if (renderer()) setNeedsWidgetUpdate(true); - if (!isImageType() && m_imageLoader) - m_imageLoader.clear(); } else if (attribute.name() == dataAttr) { m_url = stripLeadingAndTrailingHTMLSpaces(attribute.value()); if (renderer()) { diff --git a/Source/WebCore/html/HTMLProgressElement.h b/Source/WebCore/html/HTMLProgressElement.h index 46204faa1..8cc45c81e 100644 --- a/Source/WebCore/html/HTMLProgressElement.h +++ b/Source/WebCore/html/HTMLProgressElement.h @@ -55,6 +55,7 @@ private: virtual ~HTMLProgressElement(); virtual void willAddAuthorShadowRoot() OVERRIDE; + virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } virtual bool supportLabels() const OVERRIDE { return true; } diff --git a/Source/WebCore/html/HTMLTextAreaElement.h b/Source/WebCore/html/HTMLTextAreaElement.h index ae4678da3..232915bf1 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.h +++ b/Source/WebCore/html/HTMLTextAreaElement.h @@ -66,6 +66,7 @@ private: enum WrapMethod { NoWrap, SoftWrap, HardWrap }; void createShadowSubtree(); + virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const; static String sanitizeUserInputValue(const String&, unsigned maxLength); diff --git a/Source/WebCore/html/HTMLVideoElement.cpp b/Source/WebCore/html/HTMLVideoElement.cpp index 0e0e22f71..4caadefb9 100644 --- a/Source/WebCore/html/HTMLVideoElement.cpp +++ b/Source/WebCore/html/HTMLVideoElement.cpp @@ -116,8 +116,6 @@ void HTMLVideoElement::parseAttribute(const Attribute& attribute) m_imageLoader = adoptPtr(new HTMLImageLoader(this)); m_imageLoader->updateFromElementIgnoringPreviousError(); } else { - if (m_imageLoader) - m_imageLoader.clear(); if (renderer()) toRenderImage(renderer())->imageResource()->setCachedImage(0); } diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index 8b501c9ff..f1137c78d 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -2767,7 +2767,7 @@ "name": "paused", "parameters": [ { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, - { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "other" ], "description": "Pause reason." }, + { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "CSPViolation", "other" ], "description": "Pause reason." }, { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." } ], "description": "Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria." diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp index 76c9c9530..aa047c914 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -580,6 +580,15 @@ void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*) { } +void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText) +{ + if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions) { + RefPtr<InspectorObject> directive = InspectorObject::create(); + directive->setString("directiveText", directiveText); + breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directive.release()); + } +} + PassRefPtr<Array<TypeBuilder::Debugger::CallFrame> > InspectorDebuggerAgent::currentCallFrames() { if (!m_pausedScriptState) diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.h b/Source/WebCore/inspector/InspectorDebuggerAgent.h index 962376fb8..d1118dc49 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.h +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.h @@ -94,9 +94,6 @@ public: virtual void restartFrame(ErrorString*, const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<InspectorObject>& result); virtual void getScriptSource(ErrorString*, const String& scriptId, String* scriptSource); virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>&); - void schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); - void cancelPauseOnNextStatement(); - void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); virtual void pause(ErrorString*); virtual void resume(ErrorString*); virtual void stepOver(ErrorString*); @@ -116,6 +113,11 @@ public: void runScript(ErrorString*, const TypeBuilder::Debugger::ScriptId&, const int* executionContextId, const String* objectGroup, const bool* doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown); virtual void setOverlayMessage(ErrorString*, const String*); + void schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); + void cancelPauseOnNextStatement(); + void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); + virtual void scriptExecutionBlockedByCSP(const String& directiveText); + class Listener { public: virtual ~Listener() { } diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index 4eda51da4..eb06071e4 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -813,6 +813,14 @@ void InspectorInstrumentation::scriptImportedImpl(InstrumentingAgents* instrumen resourceAgent->setInitialScriptContent(identifier, sourceString); } +void InspectorInstrumentation::scriptExecutionBlockedByCSPImpl(InstrumentingAgents* instrumentingAgents, const String& directiveText) +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) + debuggerAgent->scriptExecutionBlockedByCSP(directiveText); +#endif +} + void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier) { if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent()) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 6936137b7..217d98d02 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -192,6 +192,7 @@ public: static void willLoadXHRSynchronously(ScriptExecutionContext*); static void didLoadXHRSynchronously(ScriptExecutionContext*); static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString); + static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText); static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier); static void domContentLoadedEventFired(Frame*); static void loadEventFired(Frame*); @@ -374,6 +375,7 @@ private: static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*); static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*); static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString); + static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents*, const String& directiveText); static void didReceiveScriptResponseImpl(InstrumentingAgents*, unsigned long identifier); static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*); static void loadEventFiredImpl(InstrumentingAgents*, Frame*); @@ -1240,6 +1242,14 @@ inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* con #endif } +inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText) +{ +#if ENABLE(INSPECTOR) + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) + scriptExecutionBlockedByCSPImpl(instrumentingAgents, directiveText); +#endif +} + inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier) { #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorResourceAgent.cpp b/Source/WebCore/inspector/InspectorResourceAgent.cpp index d8a23ed12..7defb3595 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.cpp +++ b/Source/WebCore/inspector/InspectorResourceAgent.cpp @@ -617,6 +617,10 @@ void InspectorResourceAgent::replayXHR(ErrorString*, const String& requestId) if (!xhrReplayData) return; + CachedResource* cachedResource = memoryCache()->resourceForURL(xhrReplayData->url()); + if (cachedResource) + memoryCache()->remove(cachedResource); + xhr->open(xhrReplayData->method(), xhrReplayData->url(), xhrReplayData->async(), code); HTTPHeaderMap::const_iterator end = xhrReplayData->headers().end(); for (HTTPHeaderMap::const_iterator it = xhrReplayData->headers().begin(); it!= end; ++it) diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index ef235bff7..03eaeee1b 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -180,6 +180,7 @@ modules = [ "dependencies": ["components"], "sources": [ "CSSNamedFlowCollectionsView.js", + "CSSNamedFlowView.js", "ElementsPanel.js", "ElementsPanelDescriptor.js", "EventListenersSidebarPane.js", diff --git a/Source/WebCore/inspector/front-end/AuditsPanel.js b/Source/WebCore/inspector/front-end/AuditsPanel.js index 963a30d47..e48dbc046 100644 --- a/Source/WebCore/inspector/front-end/AuditsPanel.js +++ b/Source/WebCore/inspector/front-end/AuditsPanel.js @@ -98,43 +98,38 @@ WebInspector.AuditsPanel.prototype = { _executeAudit: function(categories, resultCallback) { - var requests = WebInspector.networkLog.requests; - - var rulesRemaining = 0; - for (var i = 0; i < categories.length; ++i) - rulesRemaining += categories[i].ruleCount; - - this._progress.setTotalWork(rulesRemaining); this._progress.setTitle(WebInspector.UIString("Running audit")); - var results = []; - var mainResourceURL = WebInspector.inspectedPageURL; - function ruleResultReadyCallback(categoryResult, ruleResult) { - if (this._progress.isCanceled()) - return; - if (ruleResult && ruleResult.children) categoryResult.addRuleResult(ruleResult); - --rulesRemaining; - this._progress.worked(); - - if (!rulesRemaining || this._progress.isCanceled()) - resultCallback(mainResourceURL, results); + if (this._progress.isCanceled()) + this._progress.done(); } - if (!rulesRemaining || this._progress.isCanceled()) { - resultCallback(mainResourceURL, results); - return; + var results = []; + var mainResourceURL = WebInspector.inspectedPageURL; + var categoriesDone = 0; + function categoryDoneCallback() + { + if (++categoriesDone !== categories.length) + return; + this._progress.done(); + resultCallback(mainResourceURL, results) } + var requests = WebInspector.networkLog.requests.slice(); + var compositeProgress = new WebInspector.CompositeProgress(this._progress); + var subprogresses = []; + for (var i = 0; i < categories.length; ++i) + subprogresses.push(compositeProgress.createSubProgress()); for (var i = 0; i < categories.length; ++i) { var category = categories[i]; var result = new WebInspector.AuditCategoryResult(category); results.push(result); - category.run(requests, ruleResultReadyCallback.bind(this, result), this._progress); + category.run(requests, ruleResultReadyCallback.bind(this, result), categoryDoneCallback.bind(this), subprogresses[i]); } }, @@ -270,12 +265,6 @@ WebInspector.AuditCategory.prototype = { return this._displayName; }, - get ruleCount() - { - this._ensureInitialized(); - return this._rules.length; - }, - addRule: function(rule, severity) { rule.severity = severity; @@ -284,14 +273,24 @@ WebInspector.AuditCategory.prototype = { /** * @param {Array.<WebInspector.NetworkRequest>} requests - * @param {function()} callback + * @param {function(WebInspector.AuditRuleResult)} ruleResultCallback + * @param {function()} categoryDoneCallback * @param {WebInspector.Progress} progress */ - run: function(requests, callback, progress) + run: function(requests, ruleResultCallback, categoryDoneCallback, progress) { this._ensureInitialized(); + var remainingRulesCount = this._rules.length; + progress.setTotalWork(remainingRulesCount); + function callbackWrapper() + { + ruleResultCallback.apply(this, arguments); + progress.worked(); + if (!--remainingRulesCount) + categoryDoneCallback(); + } for (var i = 0; i < this._rules.length; ++i) - this._rules[i].run(requests, callback, progress); + this._rules[i].run(requests, callbackWrapper, progress); }, _ensureInitialized: function() diff --git a/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js b/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js index b6be9e751..239c507b0 100644 --- a/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js +++ b/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js @@ -128,20 +128,15 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { for (var i = 0; i < flow.regions.length; ++i) this._regionNodes[flow.regions[i].nodeId] = flowHash; - var container = document.createElement("div"); - container.createChild("div", "selection"); - container.createChild("span", "title").createChild("span").textContent = flow.name; + var flowTreeItem = new WebInspector.FlowTreeElement(flowContainer); + flowTreeItem.onselect = this._selectNamedFlowTab.bind(this, flowHash); - var flowTreeElement = new TreeElement(container, flowContainer); - if (flow.overset) - flowTreeElement.title.addStyleClass("named-flow-overflow") - - flowContainer.flowTreeElement = flowTreeElement; + flowContainer.flowTreeItem = flowTreeItem; this._namedFlows[flowHash] = flowContainer; if (!this._flowTree.children.length) this._setSidebarHasContent(true); - this._flowTree.appendChild(flowTreeElement); + this._flowTree.appendChild(flowTreeItem); }, /** @@ -151,7 +146,9 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { { var flowContainer = this._namedFlows[flowHash]; - this._flowTree.removeChild(flowContainer.flowTreeElement); + if (this._tabbedPane._tabsById[flowHash]) + this._tabbedPane.closeTab(flowHash); + this._flowTree.removeChild(flowContainer.flowTreeItem); var flow = flowContainer.flow; for (var i = 0; i < flow.content.length; ++i) @@ -189,12 +186,10 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { for (var i = 0; i < flow.regions.length; ++i) this._regionNodes[flow.regions[i].nodeId] = flowHash; - if (flow.overset !== oldFlow.overset) { - if (flow.overset) - flowContainer.flowTreeElement.title.addStyleClass("named-flow-overflow"); - else - flowContainer.flowTreeElement.title.removeStyleClass("named-flow-overflow"); - } + flowContainer.flowTreeItem.setOverset(flow.overset); + + if (flowContainer.flowView) + flowContainer.flowView.flow = flow; }, /** @@ -268,6 +263,7 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { _showNamedFlow: function(flowHash) { this._selectNamedFlowInSidebar(flowHash); + this._selectNamedFlowTab(flowHash); }, /** @@ -275,7 +271,26 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { */ _selectNamedFlowInSidebar: function(flowHash) { - this._namedFlows[flowHash].flowTreeElement.select(true); + this._namedFlows[flowHash].flowTreeItem.select(true); + }, + + /** + * @param {string} flowHash + */ + _selectNamedFlowTab: function(flowHash) + { + var flowContainer = this._namedFlows[flowHash]; + + if (this._tabbedPane.selectedTabId === flowHash) + return; + + if (!this._tabbedPane.selectTab(flowHash)) { + if (!flowContainer.flowView) + flowContainer.flowView = new WebInspector.CSSNamedFlowView(flowContainer.flow); + + this._tabbedPane.appendTab(flowHash, flowContainer.flow.name, flowContainer.flowView); + this._tabbedPane.selectTab(flowHash); + } }, /** @@ -288,6 +303,22 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { }, /** + * @param {WebInspector.Event} event + */ + _tabSelected: function(event) + { + this._selectNamedFlowInSidebar(event.data.tabId); + }, + + /** + * @param {WebInspector.Event} event + */ + _tabClosed: function(event) + { + this._namedFlows[event.data.tabId].flowTreeItem.deselect(); + }, + + /** * @param {?WebInspector.DOMNode} node */ _showNamedFlowForNode: function(node) @@ -323,6 +354,9 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, this._regionLayoutUpdated, this); WebInspector.panel("elements").treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedNodeChanged, this); + + this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._tabSelected, this); + this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabClosed, this._tabClosed, this); }, willHide: function() @@ -334,7 +368,49 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, this._regionLayoutUpdated, this); WebInspector.panel("elements").treeOutline.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedNodeChanged, this); + + this._tabbedPane.removeEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._tabSelected, this); + this._tabbedPane.removeEventListener(WebInspector.TabbedPane.EventTypes.TabClosed, this._tabClosed, this); } } WebInspector.CSSNamedFlowCollectionsView.prototype.__proto__ = WebInspector.SplitView.prototype; + +/** + * @constructor + * @extends {TreeElement} + */ +WebInspector.FlowTreeElement = function(flowContainer) +{ + var container = document.createElement("div"); + container.createChild("div", "selection"); + container.createChild("span", "title").createChild("span").textContent = flowContainer.flow.name; + + TreeElement.call(this, container, flowContainer, false); + + this._overset = false; + this.setOverset(flowContainer.flow.overset); +} + +WebInspector.FlowTreeElement.prototype = { + /** + * @param {boolean} newOverset + */ + setOverset: function(newOverset) + { + if (this._overset === newOverset) + return; + + if (newOverset) { + this.title.addStyleClass("named-flow-overflow"); + this.tooltip = WebInspector.UIString("Overflows."); + } else { + this.title.removeStyleClass("named-flow-overflow"); + this.tooltip = ""; + } + + this._overset = newOverset; + } +} + +WebInspector.FlowTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/CSSNamedFlowView.js b/Source/WebCore/inspector/front-end/CSSNamedFlowView.js new file mode 100644 index 000000000..afb8c1daf --- /dev/null +++ b/Source/WebCore/inspector/front-end/CSSNamedFlowView.js @@ -0,0 +1,256 @@ +/* + * 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 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @constructor + * @extends {WebInspector.View} + * @param {WebInspector.NamedFlow} flow + */ +WebInspector.CSSNamedFlowView = function(flow) +{ + WebInspector.View.call(this); + this.element.addStyleClass("css-named-flow"); + this.element.addStyleClass("outline-disclosure"); + + this._treeOutline = new TreeOutline(this.element.createChild("ol"), true); + + this._contentTreeItem = new TreeElement(WebInspector.UIString("content"), null, true); + this._treeOutline.appendChild(this._contentTreeItem); + + this._regionsTreeItem = new TreeElement(WebInspector.UIString("region chain"), null, true); + this._regionsTreeItem.expand(); + this._treeOutline.appendChild(this._regionsTreeItem); + + this._flow = flow; + + var content = flow.content; + for (var i = 0; i < content.length; ++i) + this._insertContentNode(content[i]); + + var regions = flow.regions; + for (var i = 0; i < regions.length; ++i) + this._insertRegion(regions[i]); +} + +WebInspector.CSSNamedFlowView.OversetTypeMessageMap = { + empty: "empty", + fit: "fit", + overset: "overset" +} + +WebInspector.CSSNamedFlowView.prototype = { + /** + * @param {WebInspector.DOMNode=} rootDOMNode + * @return {?WebInspector.ElementsTreeOutline} + */ + _createFlowTreeOutline: function(rootDOMNode) + { + if (!rootDOMNode) + return null; + + var treeOutline = new WebInspector.ElementsTreeOutline(false, false, true); + treeOutline.element.addStyleClass("named-flow-element"); + treeOutline.setVisible(true); + treeOutline.rootDOMNode = rootDOMNode; + treeOutline.wireToDomAgent(); + WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, treeOutline._elementsTreeUpdater._documentUpdated, treeOutline._elementsTreeUpdater); + + return treeOutline; + }, + + /** + * @param {DOMAgent.NodeId} contentNodeId + * @param {number=} index + */ + _insertContentNode: function(contentNodeId, index) + { + var treeOutline = this._createFlowTreeOutline(WebInspector.domAgent.nodeForId(contentNodeId)); + var treeItem = new TreeElement(treeOutline.element, treeOutline); + + if (index === undefined) { + this._contentTreeItem.appendChild(treeItem); + return; + } + + this._contentTreeItem.insertChild(treeItem, index); + }, + + /** + * @param {CSSAgent.Region} region + * @param {number=} index + */ + _insertRegion: function(region, index) + { + var treeOutline = this._createFlowTreeOutline(WebInspector.domAgent.nodeForId(region.nodeId)); + treeOutline.element.addStyleClass("region-" + region.regionOverset); + + var treeItem = new TreeElement(treeOutline.element, treeOutline); + var oversetText = WebInspector.UIString(WebInspector.CSSNamedFlowView.OversetTypeMessageMap[region.regionOverset]); + treeItem.tooltip = WebInspector.UIString("Region is %s.", oversetText); + + if (index === undefined) { + this._regionsTreeItem.appendChild(treeItem); + return; + } + + this._regionsTreeItem.insertChild(treeItem, index); + }, + + get flow() + { + return this._flow; + }, + + set flow(newFlow) + { + this._update(newFlow); + }, + + /** + * @param {TreeElement} regionTreeItem + * @param {string} newRegionOverset + * @param {string} oldRegionOverset + */ + _updateRegionOverset: function(regionTreeItem, newRegionOverset, oldRegionOverset) + { + var element = regionTreeItem.representedObject.element; + element.removeStyleClass("region-" + oldRegionOverset); + element.addStyleClass("region-" + newRegionOverset); + + var oversetText = WebInspector.UIString(WebInspector.CSSNamedFlowView.OversetTypeMessageMap[newRegionOverset]); + regionTreeItem.tooltip = WebInspector.UIString("Region is %s." , oversetText); + }, + + /** + * @param {Array.<DOMAgent.NodeId>} oldContent + * @param {Array.<DOMAgent.NodeId>} newContent + */ + _mergeContentNodes: function(oldContent, newContent) + { + var nodeIdSet = {}; + for (var i = 0; i < newContent.length; ++i) + nodeIdSet[newContent[i]] = true; + + var oldContentIndex = 0; + var newContentIndex = 0; + var contentTreeChildIndex = 0; + + while(oldContentIndex < oldContent.length || newContentIndex < newContent.length) { + if (oldContentIndex === oldContent.length) { + this._insertContentNode(newContent[newContentIndex]); + ++newContentIndex; + continue; + } + + if (newContentIndex === newContent.length) { + this._contentTreeItem.removeChildAtIndex(contentTreeChildIndex); + ++oldContentIndex; + continue; + } + + if (oldContent[oldContentIndex] === newContent[newContentIndex]) { + ++oldContentIndex; + ++newContentIndex; + ++contentTreeChildIndex; + continue; + } + + if (nodeIdSet[oldContent[oldContentIndex]]) { + this._insertContentNode(newContent[newContentIndex], contentTreeChildIndex); + ++newContentIndex; + ++contentTreeChildIndex; + continue; + } + + this._contentTreeItem.removeChildAtIndex(contentTreeChildIndex); + ++oldContentIndex; + } + }, + + /** + * @param {Array.<CSSAgent.Region>} oldRegions + * @param {Array.<CSSAgent.Region>} newRegions + */ + _mergeRegions: function(oldRegions, newRegions) + { + var nodeIdSet = {}; + for (var i = 0; i < newRegions.length; ++i) + nodeIdSet[newRegions[i].nodeId] = true; + + var oldRegionsIndex = 0; + var newRegionsIndex = 0; + var regionsTreeChildIndex = 0; + + while(oldRegionsIndex < oldRegions.length || newRegionsIndex < newRegions.length) { + if (oldRegionsIndex === oldRegions.length) { + this._insertRegion(newRegions[newRegionsIndex]); + ++newRegionsIndex; + continue; + } + + if (newRegionsIndex === newRegions.length) { + this._regionsTreeItem.removeChildAtIndex(regionsTreeChildIndex); + ++oldRegionsIndex; + continue; + } + + if (oldRegions[oldRegionsIndex].nodeId === newRegions[newRegionsIndex].nodeId) { + if (oldRegions[oldRegionsIndex].regionOverset !== newRegions[newRegionsIndex].regionOverset) + this._updateRegionOverset(this._regionsTreeItem.children[regionsTreeChildIndex], newRegions[newRegionsIndex].regionOverset, oldRegions[oldRegionsIndex].regionOverset); + ++oldRegionsIndex; + ++newRegionsIndex; + ++regionsTreeChildIndex; + continue; + } + + if (nodeIdSet[oldRegions[oldRegionsIndex].nodeId]) { + this._insertRegion(newRegions[newRegionsIndex], regionsTreeChildIndex); + ++newRegionsIndex; + ++regionsTreeChildIndex; + continue; + } + + this._regionsTreeItem.removeChildAtIndex(regionsTreeChildIndex); + ++oldRegionsIndex; + } + }, + + /** + * @param {WebInspector.NamedFlow} newFlow + */ + _update: function(newFlow) + { + this._mergeContentNodes(this._flow.content, newFlow.content); + this._mergeRegions(this._flow.regions, newFlow.regions); + + this._flow = newFlow; + } +} + +WebInspector.CSSNamedFlowView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/DebuggerModel.js b/Source/WebCore/inspector/front-end/DebuggerModel.js index 328c54e8f..21fb45ba1 100644 --- a/Source/WebCore/inspector/front-end/DebuggerModel.js +++ b/Source/WebCore/inspector/front-end/DebuggerModel.js @@ -95,7 +95,8 @@ WebInspector.DebuggerModel.BreakReason = { EventListener: "EventListener", XHR: "XHR", Exception: "exception", - Assert: "assert" + Assert: "assert", + CSPViolation: "CSPViolation" } WebInspector.DebuggerModel.prototype = { diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js index e73588020..2fa6fc3db 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanel.js +++ b/Source/WebCore/inspector/front-end/ElementsPanel.js @@ -29,6 +29,7 @@ */ importScript("CSSNamedFlowCollectionsView.js"); +importScript("CSSNamedFlowView.js"); importScript("EventListenersSidebarPane.js"); importScript("MetricsSidebarPane.js"); importScript("PropertiesSidebarPane.js"); diff --git a/Source/WebCore/inspector/front-end/ExtensionAPI.js b/Source/WebCore/inspector/front-end/ExtensionAPI.js index 4c97f6d2e..a45d83bc3 100644 --- a/Source/WebCore/inspector/front-end/ExtensionAPI.js +++ b/Source/WebCore/inspector/front-end/ExtensionAPI.js @@ -97,6 +97,7 @@ function defineCommonExtensionSymbols(apiPrivate) ShowPanel: "showPanel", StopAuditCategoryRun: "stopAuditCategoryRun", Unsubscribe: "unsubscribe", + UpdateAuditProgress: "updateAuditProgress", UpdateButton: "updateButton", InspectedURLChanged: "inspectedURLChanged" }; @@ -509,6 +510,8 @@ Audits.prototype = { addCategory: function(displayName, resultCount) { var id = "extension-audit-category-" + extensionServer.nextObjectId(); + if (typeof resultCount !== "undefined") + console.warn("Passing resultCount to audits.addCategory() is deprecated. Use AuditResult.updateProgress() instead."); extensionServer.sendRequest({ command: commands.AddAuditCategory, id: id, displayName: displayName, resultCount: resultCount }); return new AuditCategory(id); } @@ -570,6 +573,11 @@ AuditResultImpl.prototype = { return new AuditResultNode(Array.prototype.slice.call(arguments)); }, + updateProgress: function(worked, totalWork) + { + extensionServer.sendRequest({ command: commands.UpdateAuditProgress, resultId: this._id, progress: worked / totalWork }); + }, + done: function() { extensionServer.sendRequest({ command: commands.StopAuditCategoryRun, resultId: this._id }); diff --git a/Source/WebCore/inspector/front-end/ExtensionAuditCategory.js b/Source/WebCore/inspector/front-end/ExtensionAuditCategory.js index d529371c5..4c692c773 100644 --- a/Source/WebCore/inspector/front-end/ExtensionAuditCategory.js +++ b/Source/WebCore/inspector/front-end/ExtensionAuditCategory.js @@ -30,10 +30,11 @@ /** * @constructor + * @extends {WebInspector.AuditCategory} * @param {string} extensionOrigin * @param {string} id * @param {string} displayName - * @param {number} ruleCount + * @param {number=} ruleCount */ WebInspector.ExtensionAuditCategory = function(extensionOrigin, id, displayName, ruleCount) { @@ -55,42 +56,45 @@ WebInspector.ExtensionAuditCategory.prototype = { return this._displayName; }, - get ruleCount() - { - return this._ruleCount; - }, - - run: function(resources, callback) + /** + * @param {Array.<WebInspector.NetworkRequest>} requests + * @param {function(WebInspector.AuditRuleResult)} ruleResultCallback + * @param {function()} categoryDoneCallback + * @param {WebInspector.Progress} progress + */ + run: function(requests, ruleResultCallback, categoryDoneCallback, progress) { - new WebInspector.ExtensionAuditCategoryResults(this, callback); + var results = new WebInspector.ExtensionAuditCategoryResults(this, ruleResultCallback, categoryDoneCallback, progress); + WebInspector.extensionServer.startAuditRun(this, results); } } /** * @constructor * @param {WebInspector.ExtensionAuditCategory} category - * @param {function(WebInspector.AuditRuleResult)} callback + * @param {function(WebInspector.AuditRuleResult)} ruleResultCallback + * @param {function()} categoryDoneCallback + * @param {WebInspector.Progress} progress */ -WebInspector.ExtensionAuditCategoryResults = function(category, callback) +WebInspector.ExtensionAuditCategoryResults = function(category, ruleResultCallback, categoryDoneCallback, progress) { this._category = category; - this._pendingRules = category.ruleCount; - this._ruleCompletionCallback = callback; + this._ruleResultCallback = ruleResultCallback; + this._categoryDoneCallback = categoryDoneCallback; + this._progress = progress; + this._progress.setTotalWork(1); + this._expectedResults = category._ruleCount; + this._actualResults = 0; this.id = category.id + "-" + ++WebInspector.ExtensionAuditCategoryResults._lastId; - WebInspector.extensionServer.startAuditRun(category, this); } WebInspector.ExtensionAuditCategoryResults.prototype = { - get complete() - { - return !this._pendingRules; - }, - - cancel: function() + done: function() { - while (!this.complete) - this._addResult(null); + WebInspector.extensionServer.stopAuditRun(this); + this._progress.done(); + this._categoryDoneCallback(); }, addResult: function(displayName, description, severity, details) @@ -115,10 +119,21 @@ WebInspector.ExtensionAuditCategoryResults.prototype = { _addResult: function(result) { - this._ruleCompletionCallback(result); - this._pendingRules--; - if (!this._pendingRules) - WebInspector.extensionServer.stopAuditRun(this); + this._ruleResultCallback(result); + ++this._actualResults; + if (typeof this._expectedResults === "number") { + this._progress.setWorked(this._actualResults / this._expectedResults); + if (this._actualResults === this._expectedResults) + this.done(); + } + }, + + /** + * @param {number} progress + */ + updateProgress: function(progress) + { + this._progress.setWorked(progress); }, /** diff --git a/Source/WebCore/inspector/front-end/ExtensionServer.js b/Source/WebCore/inspector/front-end/ExtensionServer.js index ec3811b69..3b660d0ab 100644 --- a/Source/WebCore/inspector/front-end/ExtensionServer.js +++ b/Source/WebCore/inspector/front-end/ExtensionServer.js @@ -71,6 +71,7 @@ WebInspector.ExtensionServer = function() this._registerHandler(commands.Subscribe, this._onSubscribe.bind(this)); this._registerHandler(commands.Unsubscribe, this._onUnsubscribe.bind(this)); this._registerHandler(commands.UpdateButton, this._onUpdateButton.bind(this)); + this._registerHandler(commands.UpdateAuditProgress, this._onUpdateAuditProgress.bind(this)); window.addEventListener("message", this._onWindowMessage.bind(this), false); } @@ -550,12 +551,20 @@ WebInspector.ExtensionServer.prototype = { return this._status.OK(); }, + _onUpdateAuditProgress: function(message) + { + var auditResult = this._clientObjects[message.resultId]; + if (!auditResult) + return this._status.E_NOTFOUND(message.resultId); + auditResult.updateProgress(Math.min(Math.max(0, message.progress), 1)); + }, + _onStopAuditCategoryRun: function(message) { var auditRun = this._clientObjects[message.resultId]; if (!auditRun) return this._status.E_NOTFOUND(message.resultId); - auditRun.cancel(); + auditRun.done(); }, _dispatchCallback: function(requestId, port, result) diff --git a/Source/WebCore/inspector/front-end/Images/regionEmpty.png b/Source/WebCore/inspector/front-end/Images/regionEmpty.png Binary files differnew file mode 100644 index 000000000..9b62eb5f7 --- /dev/null +++ b/Source/WebCore/inspector/front-end/Images/regionEmpty.png diff --git a/Source/WebCore/inspector/front-end/Images/regionFit.png b/Source/WebCore/inspector/front-end/Images/regionFit.png Binary files differnew file mode 100644 index 000000000..88fb40855 --- /dev/null +++ b/Source/WebCore/inspector/front-end/Images/regionFit.png diff --git a/Source/WebCore/inspector/front-end/Images/regionOverset.png b/Source/WebCore/inspector/front-end/Images/regionOverset.png Binary files differnew file mode 100644 index 000000000..ee930d8dd --- /dev/null +++ b/Source/WebCore/inspector/front-end/Images/regionOverset.png diff --git a/Source/WebCore/inspector/front-end/ProgressBar.js b/Source/WebCore/inspector/front-end/ProgressBar.js index 83a8a8d64..22a4513f2 100644 --- a/Source/WebCore/inspector/front-end/ProgressBar.js +++ b/Source/WebCore/inspector/front-end/ProgressBar.js @@ -105,6 +105,9 @@ WebInspector.ProgressIndicator.prototype = { done: function() { + if (this._isDone) + return; + this._isDone = true; this.hide(); this.dispatchEventToListeners(WebInspector.ProgressIndicator.Events.Done); }, diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index cb818ef64..f4dc77219 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -298,6 +298,8 @@ WebInspector.ScriptsPanel.prototype = { this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on exception: '%s'.", details.auxData.description)); else if (details.reason === WebInspector.DebuggerModel.BreakReason.Assert) this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on assertion.")); + else if (details.reason === WebInspector.DebuggerModel.BreakReason.CSPViolation) + this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a script blocked due to Content Security Policy directive: \"%s\".", details.auxData.directiveText)); else { function didGetUILocation(uiLocation) { diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js index af13f4189..6ce7b7989 100644 --- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js @@ -358,6 +358,7 @@ WebInspector.StylesSidebarPane.prototype = { var usedProperties = {}; this._markUsedProperties(styleRules, usedProperties); this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, 0, null); + var responsesLeft = this.sections[0].length; var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement; if (styles.computedStyle) @@ -380,9 +381,28 @@ WebInspector.StylesSidebarPane.prototype = { usedProperties = {}; this._markUsedProperties(styleRules, usedProperties); this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, pseudoId, anchorElement); + responsesLeft += this.sections[pseudoId].length; } - this._nodeStylesUpdatedForTest(node, true); + // Mark matching selectors in comma-delimited selector groups. + var boundMarkCallback = markCallback.bind(this); + for (var id in this.sections) { + var sectionsForPseudoId = this.sections[id].slice(); + for (var j = 0; j < sectionsForPseudoId.length; ++j) { + var section = sectionsForPseudoId[j]; + if (!section.styleRule || section.isBlank || section.styleRule.computedStyle || section.styleRule.isAttribute) { + boundMarkCallback(); + continue; + } + section._markMatchedSelectorsInGroup(boundMarkCallback); + } + } + + function markCallback() + { + if (!(--responsesLeft)) + this._nodeStylesUpdatedForTest(node, true); + } }, _nodeStylesUpdatedForTest: function(node, rebuild) @@ -464,7 +484,7 @@ WebInspector.StylesSidebarPane.prototype = { var separatorInserted = false; if (parentStyles.inlineStyle) { if (this._containsInherited(parentStyles.inlineStyle)) { - var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: parentStyles.inlineStyle, isAttribute: true, isInherited: true }; + var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: parentStyles.inlineStyle, isAttribute: true, isInherited: true, parentNode: parentNode }; if (!separatorInserted) { insertInheritedNodeSeparator(parentNode); separatorInserted = true; @@ -485,7 +505,7 @@ WebInspector.StylesSidebarPane.prototype = { insertInheritedNodeSeparator(parentNode); separatorInserted = true; } - styleRules.push({ style: rule.style, selectorText: rule.selectorText, media: rule.media, sourceURL: rule.sourceURL, rule: rule, isInherited: true, editable: !!(rule.style && rule.style.id) }); + styleRules.push({ style: rule.style, selectorText: rule.selectorText, media: rule.media, sourceURL: rule.sourceURL, rule: rule, isInherited: true, parentNode: parentNode, editable: !!(rule.style && rule.style.id) }); } parentNode = parentNode.parentNode; } @@ -873,6 +893,7 @@ WebInspector.StylePropertiesSection = function(parentPane, styleRule, editable, var selectorContainer = document.createElement("div"); this._selectorElement = document.createElement("span"); + this._selectorElement.addStyleClass("selector-matches"); this._selectorElement.textContent = styleRule.selectorText; selectorContainer.appendChild(this._selectorElement); @@ -913,7 +934,7 @@ WebInspector.StylePropertiesSection = function(parentPane, styleRule, editable, this._selectorContainer = selectorContainer; if (isInherited) - this.element.addStyleClass("show-inherited"); // This one is related to inherited rules, not compted style. + this.element.addStyleClass("show-inherited"); // This one is related to inherited rules, not computed style. if (!this.editable) this.element.addStyleClass("read-only"); @@ -1103,6 +1124,91 @@ WebInspector.StylePropertiesSection.prototype = { return null; }, + /** + * @param {function()=} callback + */ + _markMatchedSelectorsInGroup: function(callback) + { + var self = this; + function mycallback() + { + if (callback) + callback(); + } + + var selectorText = this._selectorElement.textContent; + if (!selectorText || selectorText.indexOf(",") === -1) { + mycallback(); + return; + } + + var paneNode = this._parentPane.node; + var relatedNode = this.styleRule.parentNode || paneNode; + if (!relatedNode) { + mycallback(); + return; + } + + function trim(text) + { + return text.trim(); + } + var selectors = selectorText.split(",").map(trim); + + WebInspector.RemoteObject.resolveNode(relatedNode, "", resolvedCallback); + function resolvedCallback(object) + { + if (!object) { + mycallback(); + return; + } + + for (var i = 0, size = selectors.length; i < size; ++i) { + var selector = selectors[i]; + object.callFunctionJSON(matchesSelector, [{ value: selectors[i] }], matchesCallback.bind(this, i)); + } + } + + function matchesSelector(selector) + { + return this.webkitMatchesSelector(selector); + } + + var result = []; + var matchFound; + function matchesCallback(selectorIndex, matches) + { + var isLast = selectorIndex === selectors.length - 1; + var fragment = document.createDocumentFragment(); + result[selectorIndex] = fragment; + + var selectorNode; + if (matches && paneNode === self._parentPane.node) { + selectorNode = document.createElement("span"); + selectorNode.className = "selector-matches"; + selectorNode.appendChild(document.createTextNode(selectors[selectorIndex])); + matchFound = true; + } else + selectorNode = document.createTextNode(selectors[selectorIndex]); + + fragment.appendChild(selectorNode); + if (!isLast) { + fragment.appendChild(document.createTextNode(", ")); + return; + } + + // This check is here in case the element class has been changed from JS during the roundtrip, + // so the element matches none of the distinct selectors. Fall back to "all selectors match". + if (matchFound) { + self._selectorElement.className = "selector"; + self._selectorElement.removeChildren(); + for (var i = 0; i < result.length; ++i) + self._selectorElement.appendChild(result[i]); + } + mycallback(); + } + }, + _checkWillCancelEditing: function() { var willCauseCancelEditing = this._willCauseCancelEditing; @@ -1233,7 +1339,8 @@ WebInspector.StylePropertiesSection.prototype = { if (WebInspector.isBeingEdited(element)) return; - this._selectorElement.scrollIntoViewIfNeeded(false); + element.scrollIntoViewIfNeeded(false); + element.textContent = element.textContent; // Reset selector marks in group. var config = new WebInspector.EditingConfig(this.editingSelectorCommitted.bind(this), this.editingSelectorCancelled.bind(this)); WebInspector.startEditing(this._selectorElement, config); @@ -1243,25 +1350,32 @@ WebInspector.StylePropertiesSection.prototype = { _moveEditorFromSelector: function(moveDirection) { - if (!moveDirection) + + if (!moveDirection) { + this._markMatchedSelectorsInGroup(); return; + } - if (moveDirection === "forward") { - this.expand(); - var firstChild = this.propertiesTreeOutline.children[0]; - while (firstChild && firstChild.inherited) - firstChild = firstChild.nextSibling; - if (!firstChild) - this.addNewBlankProperty().startEditing(); - else - firstChild.startEditing(firstChild.nameElement); - } else { - var previousSection = this.previousEditableSibling(); - if (!previousSection) - return; + this._markMatchedSelectorsInGroup(markCallback.bind(this)); + + function markCallback() { + if (moveDirection === "forward") { + this.expand(); + var firstChild = this.propertiesTreeOutline.children[0]; + while (firstChild && firstChild.inherited) + firstChild = firstChild.nextSibling; + if (!firstChild) + this.addNewBlankProperty().startEditing(); + else + firstChild.startEditing(firstChild.nameElement); + } else { + var previousSection = this.previousEditableSibling(); + if (!previousSection) + return; - previousSection.expand(); - previousSection.addNewBlankProperty().startEditing(); + previousSection.expand(); + previousSection.addNewBlankProperty().startEditing(); + } } }, @@ -1299,7 +1413,9 @@ WebInspector.StylePropertiesSection.prototype = { editingSelectorCancelled: function() { - // Do nothing, this is overridden by BlankStylePropertiesSection. + // Do nothing but mark the selectors in group if necessary. + // This is overridden by BlankStylePropertiesSection. + this._markMatchedSelectorsInGroup(); } } diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index 2e1e2a284..cfeb194e4 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -32,6 +32,7 @@ <file>CSSCompletions.js</file> <file>CSSKeywordCompletions.js</file> <file>CSSNamedFlowCollectionsView.js</file> + <file>CSSNamedFlowView.js</file> <file>CSSSelectorProfileView.js</file> <file>CSSStyleModel.js</file> <file>cm/codemirror.css</file> @@ -307,6 +308,9 @@ <file>Images/profilesSilhouette.png</file> <file>Images/programCounterBorder.png</file> <file>Images/radioDot.png</file> + <file>Images/regionEmpty.png</file> + <file>Images/regionFit.png</file> + <file>Images/regionOverset.png</file> <file>Images/resourceCSSIcon.png</file> <file>Images/resourceDocumentIcon.png</file> <file>Images/resourceDocumentIconSmall.png</file> diff --git a/Source/WebCore/inspector/front-end/cssNamedFlows.css b/Source/WebCore/inspector/front-end/cssNamedFlows.css index 523a516a3..d090b2e94 100644 --- a/Source/WebCore/inspector/front-end/cssNamedFlows.css +++ b/Source/WebCore/inspector/front-end/cssNamedFlows.css @@ -64,14 +64,34 @@ position: relative; } -.css-named-flow-collections-view .split-view-sidebar-left .named-flow-overflow::before { - content: url(Images/namedFlowOverflow.png); +.css-named-flow-collections-view .split-view-sidebar-left .named-flow-overflow::before, .css-named-flow-collections-view .region-empty:before, .css-named-flow-collections-view .region-fit::before, .css-named-flow-collections-view .region-overset::before { cursor: default; float: left; height: 10px; - margin: 2px 3px 0px -13px; + margin-top: 1px; opacity: 0.75; position: relative; vertical-align: middle; z-index: 1; } + +.css-named-flow-collections-view .split-view-sidebar-left .named-flow-overflow::before { + content: url(Images/namedFlowOverflow.png); + margin: 2px 3px 0px -13px; +} + +.css-named-flow-collections-view .region-empty::before { + content: url(Images/regionEmpty.png); +} + +.css-named-flow-collections-view .region-fit::before { + content: url(Images/regionFit.png); +} + +.css-named-flow-collections-view .region-overset::before { + content: url(Images/regionOverset.png); +} + +.css-named-flow-collections-view .split-view-contents .named-flow-element { + margin: 0px 0px 0px -24px; +} diff --git a/Source/WebCore/inspector/front-end/elementsPanel.css b/Source/WebCore/inspector/front-end/elementsPanel.css index eb102cbde..568fd405f 100644 --- a/Source/WebCore/inspector/front-end/elementsPanel.css +++ b/Source/WebCore/inspector/front-end/elementsPanel.css @@ -223,6 +223,14 @@ color: inherit; } +.styles-section .selector { + color: #777; +} + +.styles-section .selector-matches { + color: black; +} + .styles-section a[data-uncopyable] { display: inline-block; } diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp index 5ca9d683d..88b7fe83b 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp @@ -360,26 +360,26 @@ void DocumentLoader::commitData(const char* bytes, size_t length) void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); - info.addInstrumentedMember(m_frame); - info.addInstrumentedMember(m_mainResourceLoader); + info.addMember(m_frame); + info.addMember(m_mainResourceLoader); info.addInstrumentedHashSet(m_subresourceLoaders); info.addInstrumentedHashSet(m_multipartSubresourceLoaders); info.addInstrumentedHashSet(m_plugInStreamLoaders); - info.addInstrumentedMember(m_substituteData); - info.addInstrumentedMember(m_pageTitle.string()); - info.addInstrumentedMember(m_overrideEncoding); + info.addMember(m_substituteData); + info.addMember(m_pageTitle.string()); + info.addMember(m_overrideEncoding); info.addVector(m_responses); - info.addInstrumentedMember(m_originalRequest); - info.addInstrumentedMember(m_originalRequestCopy); - info.addInstrumentedMember(m_request); - info.addInstrumentedMember(m_response); - info.addInstrumentedMember(m_lastCheckedRequest); + info.addMember(m_originalRequest); + info.addMember(m_originalRequestCopy); + info.addMember(m_request); + info.addMember(m_response); + info.addMember(m_lastCheckedRequest); info.addInstrumentedVector(m_responses); info.addHashMap(m_pendingSubstituteResources); info.addInstrumentedHashSet(m_resourcesClientKnowsAbout); info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification); - info.addInstrumentedMember(m_clientRedirectSourceForHistory); - info.addInstrumentedMember(m_mainResourceData); + info.addMember(m_clientRedirectSourceForHistory); + info.addMember(m_mainResourceData); } bool DocumentLoader::doesProgressiveLoad(const String& MIMEType) const diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 7d2ed49fa..41772caee 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -647,6 +647,7 @@ void FrameLoader::didBeginDocument(bool dispatch) m_frame->document()->initContentSecurityPolicy(); Settings* settings = m_frame->document()->settings(); + m_frame->document()->cachedResourceLoader()->setImagesEnabled(!settings || settings->areImagesEnabled()); m_frame->document()->cachedResourceLoader()->setAutoLoadImages(settings && settings->loadsImagesAutomatically()); if (m_documentLoader) { @@ -3279,10 +3280,10 @@ NetworkingContext* FrameLoader::networkingContext() const void FrameLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); - info.addInstrumentedMember(m_documentLoader); - info.addInstrumentedMember(m_provisionalDocumentLoader); - info.addInstrumentedMember(m_policyDocumentLoader); - info.addInstrumentedMember(m_outgoingReferrer); + info.addMember(m_documentLoader); + info.addMember(m_provisionalDocumentLoader); + info.addMember(m_policyDocumentLoader); + info.addMember(m_outgoingReferrer); info.addInstrumentedHashSet(m_openedFrames); } diff --git a/Source/WebCore/loader/ImageLoader.h b/Source/WebCore/loader/ImageLoader.h index 796d71802..910744416 100644 --- a/Source/WebCore/loader/ImageLoader.h +++ b/Source/WebCore/loader/ImageLoader.h @@ -66,7 +66,7 @@ public: void setLoadManually(bool loadManually) { m_loadManually = loadManually; } bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; } - bool hasPendingLoadEvent() const { return m_hasPendingLoadEvent; } + bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; } void dispatchPendingEvent(ImageEventSender*); diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 2d6e45bb8..ea667036c 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -554,7 +554,7 @@ void MainResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); ResourceLoader::reportMemoryUsage(memoryObjectInfo); info.addMember(m_initialRequest); - info.addInstrumentedMember(m_substituteData); + info.addMember(m_substituteData); info.addMember(m_dataLoadTimer); } diff --git a/Source/WebCore/loader/ResourceLoader.cpp b/Source/WebCore/loader/ResourceLoader.cpp index 3315ad558..f0a6c335c 100644 --- a/Source/WebCore/loader/ResourceLoader.cpp +++ b/Source/WebCore/loader/ResourceLoader.cpp @@ -537,11 +537,11 @@ void ResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); info.addMember(m_handle.get()); - info.addInstrumentedMember(m_frame); - info.addInstrumentedMember(m_documentLoader); + info.addMember(m_frame); + info.addMember(m_documentLoader); info.addMember(m_request); info.addMember(m_originalRequest); - info.addInstrumentedMember(m_resourceData); + info.addMember(m_resourceData); info.addMember(m_deferredRequest); info.addMember(m_options); } diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp index 6273a8d33..56de0d341 100644 --- a/Source/WebCore/loader/SubresourceLoader.cpp +++ b/Source/WebCore/loader/SubresourceLoader.cpp @@ -139,8 +139,8 @@ void SubresourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) co { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); ResourceLoader::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_resource); - info.addInstrumentedMember(m_document); + info.addMember(m_resource); + info.addMember(m_document); info.addMember(m_requestCountTracker); } @@ -167,11 +167,13 @@ void SubresourceLoader::willSendRequest(ResourceRequest& newRequest, const Resou ResourceLoader::willSendRequest(newRequest, redirectResponse); if (!previousURL.isNull() && !newRequest.isNull() && previousURL != newRequest.url()) { - if (!m_document->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) { - cancel(); - return; + if (m_document->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) { + if (m_resource->type() != CachedResource::ImageResource || !m_document->cachedResourceLoader()->shouldDeferImageLoad(newRequest.url())) { + m_resource->willSendRequest(newRequest, redirectResponse); + return; + } } - m_resource->willSendRequest(newRequest, redirectResponse); + cancel(); } } diff --git a/Source/WebCore/loader/SubstituteData.cpp b/Source/WebCore/loader/SubstituteData.cpp index 72b535f4a..d22c2bc0c 100644 --- a/Source/WebCore/loader/SubstituteData.cpp +++ b/Source/WebCore/loader/SubstituteData.cpp @@ -38,11 +38,11 @@ namespace WebCore { void SubstituteData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); - info.addInstrumentedMember(m_content); - info.addInstrumentedMember(m_mimeType); - info.addInstrumentedMember(m_textEncoding); - info.addInstrumentedMember(m_failingURL); - info.addInstrumentedMember(m_responseURL); + info.addMember(m_content); + info.addMember(m_mimeType); + info.addMember(m_textEncoding); + info.addMember(m_failingURL); + info.addMember(m_responseURL); } } diff --git a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp index 96432af2b..f18825f58 100644 --- a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp +++ b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp @@ -185,8 +185,7 @@ PassRefPtr<StyleSheetContents> CachedCSSStyleSheet::restoreParsedStyleSheet(cons void CachedCSSStyleSheet::saveParsedStyleSheet(PassRefPtr<StyleSheetContents> sheet) { ASSERT(sheet && sheet->isCacheable()); - if (m_parsedStyleSheetCache == sheet) - return; + if (m_parsedStyleSheetCache) m_parsedStyleSheetCache->removedFromMemoryCache(); m_parsedStyleSheetCache = sheet; @@ -200,8 +199,8 @@ void CachedCSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceCSS); CachedResource::reportMemoryUsage(memoryObjectInfo); info.addMember(m_decoder); - info.addInstrumentedMember(m_parsedStyleSheetCache); - info.addInstrumentedMember(m_decodedSheetText); + info.addMember(m_parsedStyleSheetCache); + info.addMember(m_decodedSheetText); } } diff --git a/Source/WebCore/loader/cache/CachedFont.cpp b/Source/WebCore/loader/cache/CachedFont.cpp index 4c4569ca3..d9a6752b2 100644 --- a/Source/WebCore/loader/cache/CachedFont.cpp +++ b/Source/WebCore/loader/cache/CachedFont.cpp @@ -203,7 +203,7 @@ void CachedFont::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceFont); CachedResource::reportMemoryUsage(memoryObjectInfo); #if ENABLE(SVG_FONTS) - info.addInstrumentedMember(m_externalSVGDocument); + info.addMember(m_externalSVGDocument); #endif #ifdef STORE_FONT_CUSTOM_PLATFORM_DATA info.addMember(m_fontData); diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp index 1527a63af..fa83a54f6 100644 --- a/Source/WebCore/loader/cache/CachedImage.cpp +++ b/Source/WebCore/loader/cache/CachedImage.cpp @@ -79,7 +79,7 @@ CachedImage::~CachedImage() void CachedImage::load(CachedResourceLoader* cachedResourceLoader, const ResourceLoaderOptions& options) { - if (!cachedResourceLoader || cachedResourceLoader->autoLoadImages()) + if (!cachedResourceLoader || !cachedResourceLoader->shouldDeferImageLoad(m_resourceRequest.url())) CachedResource::load(cachedResourceLoader, options); else setLoading(false); @@ -474,7 +474,7 @@ void CachedImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceImage); CachedResource::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_image); + info.addMember(m_image); #if ENABLE(SVG) info.addMember(m_svgImageCache); #endif diff --git a/Source/WebCore/loader/cache/CachedImage.h b/Source/WebCore/loader/cache/CachedImage.h index 4865c7e24..0c452c44a 100644 --- a/Source/WebCore/loader/cache/CachedImage.h +++ b/Source/WebCore/loader/cache/CachedImage.h @@ -82,7 +82,7 @@ public: virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; } virtual bool isImage() const { return true; } - bool stillNeedsLoad() const { return !errorOccurred() && status() == Unknown && !isLoading(); } + virtual bool stillNeedsLoad() const OVERRIDE { return !errorOccurred() && status() == Unknown && !isLoading(); } void load(); // ImageObserver diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp index 83bc8eed3..aa6c5a7fa 100755 --- a/Source/WebCore/loader/cache/CachedResource.cpp +++ b/Source/WebCore/loader/cache/CachedResource.cpp @@ -390,7 +390,7 @@ void CachedResource::didAddClient(CachedResourceClient* c) m_clients.add(c); m_clientsAwaitingCallback.remove(c); } - if (!isLoading()) + if (!isLoading() && !stillNeedsLoad()) c->notifyFinished(this); } @@ -806,18 +806,18 @@ void CachedResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResource); info.addMember(m_resourceRequest); info.addHashSet(m_clients); - info.addInstrumentedMember(m_accept); - info.addInstrumentedMember(m_loader); - info.addInstrumentedMember(m_response); - info.addInstrumentedMember(m_data); + info.addMember(m_accept); + info.addMember(m_loader); + info.addMember(m_response); + info.addMember(m_data); info.addMember(m_cachedMetadata); - info.addInstrumentedMember(m_nextInAllResourcesList); - info.addInstrumentedMember(m_prevInAllResourcesList); - info.addInstrumentedMember(m_nextInLiveResourcesList); - info.addInstrumentedMember(m_prevInLiveResourcesList); - info.addInstrumentedMember(m_owningCachedResourceLoader); - info.addInstrumentedMember(m_resourceToRevalidate); - info.addInstrumentedMember(m_proxyResource); + info.addMember(m_nextInAllResourcesList); + info.addMember(m_prevInAllResourcesList); + info.addMember(m_nextInLiveResourcesList); + info.addMember(m_prevInLiveResourcesList); + info.addMember(m_owningCachedResourceLoader); + info.addMember(m_resourceToRevalidate); + info.addMember(m_proxyResource); info.addInstrumentedHashSet(m_handlesToRevalidate); if (m_purgeableData && !m_purgeableData->wasPurged()) diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h index 0cad3ee7c..7edafd508 100644 --- a/Source/WebCore/loader/cache/CachedResource.h +++ b/Source/WebCore/loader/cache/CachedResource.h @@ -144,6 +144,7 @@ public: bool isLoading() const { return m_loading; } void setLoading(bool b) { m_loading = b; } + virtual bool stillNeedsLoad() const { return false; } SubresourceLoader* loader() { return m_loader.get(); } diff --git a/Source/WebCore/loader/cache/CachedResourceHandle.cpp b/Source/WebCore/loader/cache/CachedResourceHandle.cpp index d95459f06..6e4964ee9 100644 --- a/Source/WebCore/loader/cache/CachedResourceHandle.cpp +++ b/Source/WebCore/loader/cache/CachedResourceHandle.cpp @@ -44,7 +44,7 @@ void CachedResourceHandleBase::setResource(CachedResource* resource) void CachedResourceHandleBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::MemoryCacheStructures); - info.addInstrumentedMember(m_resource); + info.addMember(m_resource); } diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp index 5fd7c505a..0e8c3f6a2 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp @@ -46,6 +46,7 @@ #include "MemoryCache.h" #include "PingLoader.h" #include "ResourceLoadScheduler.h" +#include "SchemeRegistry.h" #include "SecurityOrigin.h" #include "Settings.h" #include <wtf/UnusedParam.h> @@ -115,6 +116,7 @@ CachedResourceLoader::CachedResourceLoader(Document* document) , m_requestCount(0) , m_garbageCollectDocumentResourcesTimer(this, &CachedResourceLoader::garbageCollectDocumentResourcesTimerFired) , m_autoLoadImages(true) + , m_imagesEnabled(true) , m_allowStaleResources(false) { } @@ -160,7 +162,7 @@ CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(ResourceReq } } CachedResourceHandle<CachedImage> resource(static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, request, String(), defaultCachedResourceOptions()).get())); - if (autoLoadImages() && resource && resource->stillNeedsLoad()) + if (!shouldDeferImageLoad(request.url()) && resource && resource->stillNeedsLoad()) resource->load(this, defaultCachedResourceOptions()); return resource; } @@ -362,12 +364,6 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url case CachedResource::ImageResource: if (!m_document->contentSecurityPolicy()->allowImageFromSource(url)) return false; - - if (frame()) { - Settings* settings = frame()->settings(); - if (!frame()->loader()->client()->allowImage(!settings || settings->areImagesEnabled(), url)) - return false; - } break; case CachedResource::FontResource: { if (!m_document->contentSecurityPolicy()->allowFontFromSource(url)) @@ -514,11 +510,11 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida { if (!existingResource) return Load; - + // We already have a preload going for this URL. if (forPreload && existingResource->isPreloaded()) return Use; - + // If the same URL has been loaded as a different type, we need to reload. if (existingResource->type() != type) { LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to type mismatch."); @@ -533,6 +529,11 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida // of things about how revalidation works that manual headers violate, so punt to Reload instead. if (request.isConditional()) return Reload; + + // Do not load from cache if images are not enabled. The load for this image will be blocked + // in requestImage. + if (existingResource->type() == CachedResource::ImageResource && !clientAllowsImage(existingResource->url())) + return Reload; // Don't reload resources while pasting. if (m_allowStaleResources) @@ -629,13 +630,41 @@ void CachedResourceLoader::setAutoLoadImages(bool enable) if (!m_autoLoadImages) return; + reloadImagesIfNotDeferred(); +} + +void CachedResourceLoader::setImagesEnabled(bool enable) +{ + if (enable == m_imagesEnabled) + return; + + m_imagesEnabled = enable; + + if (!m_imagesEnabled) + return; + + reloadImagesIfNotDeferred(); +} + +bool CachedResourceLoader::clientAllowsImage(const KURL& url) const +{ + return !frame() || frame()->loader()->client()->allowImage(m_imagesEnabled, url); +} + +bool CachedResourceLoader::shouldDeferImageLoad(const KURL& url) const +{ + return !clientAllowsImage(url) || !m_autoLoadImages; +} + +void CachedResourceLoader::reloadImagesIfNotDeferred() +{ DocumentResourceMap::iterator end = m_documentResources.end(); for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != end; ++it) { CachedResource* resource = it->second.get(); if (resource->type() == CachedResource::ImageResource) { CachedImage* image = const_cast<CachedImage*>(static_cast<const CachedImage*>(resource)); - if (image->stillNeedsLoad()) + if (image->stillNeedsLoad() && !shouldDeferImageLoad(image->url())) image->load(this, defaultCachedResourceOptions()); } } @@ -883,8 +912,8 @@ void CachedResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); info.addHashMap(m_documentResources); for (DocumentResourceMap::const_iterator i = m_documentResources.begin(); i != m_documentResources.end(); ++i) { - info.addInstrumentedMember(i->first); - info.addInstrumentedMember(i->second); + info.addMember(i->first); + info.addMember(i->second); } info.addHashSet(m_validatedURLs); if (m_preloads) diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h index f4755c22f..21e4f391d 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.h +++ b/Source/WebCore/loader/cache/CachedResourceLoader.h @@ -97,6 +97,10 @@ public: bool autoLoadImages() const { return m_autoLoadImages; } void setAutoLoadImages(bool); + + void setImagesEnabled(bool); + + bool shouldDeferImageLoad(const KURL&) const; CachePolicy cachePolicy() const; @@ -135,6 +139,9 @@ private: void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*); void performPostLoadActions(); + + bool clientAllowsImage(const KURL&) const; + void reloadImagesIfNotDeferred(); HashSet<String> m_validatedURLs; mutable DocumentResourceMap m_documentResources; @@ -152,8 +159,9 @@ private: Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; - // 30 bits left + // 29 bits left bool m_autoLoadImages : 1; + bool m_imagesEnabled : 1; bool m_allowStaleResources : 1; }; diff --git a/Source/WebCore/loader/cache/CachedSVGDocument.cpp b/Source/WebCore/loader/cache/CachedSVGDocument.cpp index 699b6886a..68f2fb483 100644 --- a/Source/WebCore/loader/cache/CachedSVGDocument.cpp +++ b/Source/WebCore/loader/cache/CachedSVGDocument.cpp @@ -75,7 +75,7 @@ void CachedSVGDocument::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) co { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceSVG); CachedResource::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_document); + info.addMember(m_document); info.addMember(m_decoder); } diff --git a/Source/WebCore/loader/cache/CachedScript.cpp b/Source/WebCore/loader/cache/CachedScript.cpp index 5c493397a..41fea3d44 100644 --- a/Source/WebCore/loader/cache/CachedScript.cpp +++ b/Source/WebCore/loader/cache/CachedScript.cpp @@ -123,7 +123,7 @@ void CachedScript::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceScript); CachedResource::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_script); + info.addMember(m_script); info.addMember(m_decoder); #if USE(JSC) info.addMember(m_sourceProviderCache); diff --git a/Source/WebCore/loader/cache/CachedShader.cpp b/Source/WebCore/loader/cache/CachedShader.cpp index 8dc381c46..d31e267de 100644 --- a/Source/WebCore/loader/cache/CachedShader.cpp +++ b/Source/WebCore/loader/cache/CachedShader.cpp @@ -73,7 +73,7 @@ void CachedShader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceShader); CachedResource::reportMemoryUsage(memoryObjectInfo); info.addMember(m_decoder); - info.addInstrumentedMember(m_shaderString); + info.addMember(m_shaderString); } } // namespace WebCore diff --git a/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp b/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp index 81e17d8cb..de6f40ea5 100644 --- a/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp +++ b/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp @@ -93,7 +93,7 @@ void CachedXSLStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceXSLT); CachedResource::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_sheet); + info.addMember(m_sheet); info.addMember(m_decoder); } diff --git a/Source/WebCore/loader/cache/MemoryCache.cpp b/Source/WebCore/loader/cache/MemoryCache.cpp index aaf852a95..66d3201eb 100644 --- a/Source/WebCore/loader/cache/MemoryCache.cpp +++ b/Source/WebCore/loader/cache/MemoryCache.cpp @@ -721,8 +721,8 @@ void MemoryCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const info.addHashMap(m_resources); CachedResourceMap::const_iterator e = m_resources.end(); for (CachedResourceMap::const_iterator i = m_resources.begin(); i != e; ++i) { - info.addInstrumentedMember(i->first); - info.addInstrumentedMember(i->second); + info.addMember(i->first); + info.addMember(i->second); } info.addVector(m_allResources); info.addMember(m_liveDecodedResources); diff --git a/Source/WebCore/mathml/MathMLInlineContainerElement.cpp b/Source/WebCore/mathml/MathMLInlineContainerElement.cpp index eb579d272..e71b9ea85 100644 --- a/Source/WebCore/mathml/MathMLInlineContainerElement.cpp +++ b/Source/WebCore/mathml/MathMLInlineContainerElement.cpp @@ -78,6 +78,8 @@ RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena* arena, R return new (arena) RenderMathMLRoot(this); if (hasLocalName(mfencedTag)) return new (arena) RenderMathMLFenced(this); + if (hasLocalName(mtableTag)) + return new (arena) RenderMathMLTable(this); return new (arena) RenderMathMLBlock(this); } diff --git a/Source/WebCore/mathml/mathtags.in b/Source/WebCore/mathml/mathtags.in index 3a2db351b..b5cccf463 100644 --- a/Source/WebCore/mathml/mathtags.in +++ b/Source/WebCore/mathml/mathtags.in @@ -19,6 +19,7 @@ mo interfaceName=MathMLTextElement mtext interfaceName=MathMLTextElement msub interfaceName=MathMLInlineContainerElement msup interfaceName=MathMLInlineContainerElement +mtable interfaceName=MathMLInlineContainerElement #if 0 // Curently only for MathMLNames used by HTMLTreeBuilder. ms diff --git a/Source/WebCore/page/ContentSecurityPolicy.cpp b/Source/WebCore/page/ContentSecurityPolicy.cpp index 14221865c..fbfbd7ba2 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/ContentSecurityPolicy.cpp @@ -726,6 +726,7 @@ public: bool allowFormAction(const KURL&, ContentSecurityPolicy::ReportingStatus) const; void gatherReportURIs(DOMStringList&) const; + const String& evalDisabledErrorMessage() { return m_evalDisabledErrorMessage; } private: explicit CSPDirectiveList(ContentSecurityPolicy*); @@ -751,15 +752,19 @@ private: bool checkSource(SourceListDirective*, const KURL&) const; bool checkMediaType(MediaListDirective*, const String& type, const String& typeAttribute) const; + void setEvalDisabledErrorMessage(const String& errorMessage) { m_evalDisabledErrorMessage = errorMessage; } + bool checkEvalAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; - bool checkInlineAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool checkInlineAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, bool isScript) const; bool checkNonceAndReportViolation(NonceDirective*, const String& nonce, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool checkSourceAndReportViolation(SourceListDirective*, const KURL&, const String& type) const; bool checkMediaTypeAndReportViolation(MediaListDirective*, const String& type, const String& typeAttribute, const String& consoleMessage) const; bool denyIfEnforcingPolicy() const { return m_reportOnly; } ContentSecurityPolicy* m_policy; + String m_header; bool m_reportOnly; @@ -779,6 +784,8 @@ private: OwnPtr<SourceListDirective> m_styleSrc; Vector<KURL> m_reportURIs; + + String m_evalDisabledErrorMessage; }; CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy) @@ -803,6 +810,11 @@ PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* pol break; } + if (!directives->checkEval(directives->operativeDirective(directives->m_scriptSrc.get()))) { + String message = makeString("Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: \"", directives->operativeDirective(directives->m_scriptSrc.get())->text(), "\".\n"); + directives->setEvalDisabledErrorMessage(message); + } + return directives.release(); } @@ -851,7 +863,11 @@ bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directiv if (checkEval(directive)) return true; reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine, callStack); - return denyIfEnforcingPolicy(); + if (!m_reportOnly) { + m_policy->reportBlockedScriptExecutionToInspector(directive->text()); + return false; + } + return true; } bool CSPDirectiveList::checkNonceAndReportViolation(NonceDirective* directive, const String& nonce, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const @@ -875,12 +891,18 @@ bool CSPDirectiveList::checkMediaTypeAndReportViolation(MediaListDirective* dire return denyIfEnforcingPolicy(); } -bool CSPDirectiveList::checkInlineAndReportViolation(SourceListDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool CSPDirectiveList::checkInlineAndReportViolation(SourceListDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, bool isScript) const { if (checkInline(directive)) return true; reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine); - return denyIfEnforcingPolicy(); + + if (!m_reportOnly) { + if (isScript) + m_policy->reportBlockedScriptExecutionToInspector(directive->text()); + return false; + } + return true; } bool CSPDirectiveList::checkSourceAndReportViolation(SourceListDirective* directive, const KURL& url, const String& type) const @@ -902,7 +924,7 @@ bool CSPDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF:: { DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "))); if (reportingStatus == ContentSecurityPolicy::SendReport) { - return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) + return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true) && checkNonceAndReportViolation(m_scriptNonce.get(), String(), consoleMessage, contextURL, contextLine)); } else { return (checkInline(operativeDirective(m_scriptSrc.get())) @@ -914,7 +936,7 @@ bool CSPDirectiveList::allowInlineEventHandlers(const String& contextURL, const { DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to execute inline event handler because it violates the following Content Security Policy directive: "))); if (reportingStatus == ContentSecurityPolicy::SendReport) { - return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) + return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true) && checkNonceAndReportViolation(m_scriptNonce.get(), String(), consoleMessage, contextURL, contextLine)); } else { return (checkInline(operativeDirective(m_scriptSrc.get())) @@ -926,7 +948,7 @@ bool CSPDirectiveList::allowInlineScript(const String& contextURL, const WTF::Or { DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to execute inline script because it violates the following Content Security Policy directive: "))); return reportingStatus == ContentSecurityPolicy::SendReport ? - checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) : + checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true) : checkInline(operativeDirective(m_scriptSrc.get())); } @@ -934,7 +956,7 @@ bool CSPDirectiveList::allowInlineStyle(const String& contextURL, const WTF::Ord { DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to apply inline style because it violates the following Content Security Policy directive: "))); return reportingStatus == ContentSecurityPolicy::SendReport ? - checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine) : + checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine, false) : checkInline(operativeDirective(m_styleSrc.get())); } @@ -1261,7 +1283,7 @@ void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty } if (!allowEval(0, SuppressReport)) - m_scriptExecutionContext->disableEval(); + m_scriptExecutionContext->disableEval(evalDisabledErrorMessage()); } void ContentSecurityPolicy::setOverrideAllowInlineStyle(bool value) @@ -1349,6 +1371,15 @@ bool ContentSecurityPolicy::allowEval(PassRefPtr<ScriptCallStack> callStack, Con return isAllowedByAllWithCallStack<&CSPDirectiveList::allowEval>(m_policies, callStack, reportingStatus); } +String ContentSecurityPolicy::evalDisabledErrorMessage() const +{ + for (size_t i = 0; i < m_policies.size(); ++i) { + if (!m_policies[i]->allowEval(0, SuppressReport)) + return m_policies[i]->evalDisabledErrorMessage(); + } + return String(); +} + bool ContentSecurityPolicy::allowScriptNonce(const String& nonce, const String& contextURL, const WTF::OrdinalNumber& contextLine, const KURL& url) const { return isAllowedByAllWithNonce<&CSPDirectiveList::allowScriptNonce>(m_policies, nonce, contextURL, contextLine, url); @@ -1357,7 +1388,7 @@ bool ContentSecurityPolicy::allowScriptNonce(const String& nonce, const String& bool ContentSecurityPolicy::allowPluginType(const String& type, const String& typeAttribute, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { for (size_t i = 0; i < m_policies.size(); ++i) { - if (!m_policies[i].get()->allowPluginType(type, typeAttribute, url, reportingStatus)) + if (!m_policies[i]->allowPluginType(type, typeAttribute, url, reportingStatus)) return false; } return true; @@ -1416,7 +1447,7 @@ bool ContentSecurityPolicy::isActive() const void ContentSecurityPolicy::gatherReportURIs(DOMStringList& list) const { for (size_t i = 0; i < m_policies.size(); ++i) - m_policies[i].get()->gatherReportURIs(list); + m_policies[i]->gatherReportURIs(list); } SecurityOrigin* ContentSecurityPolicy::securityOrigin() const @@ -1536,4 +1567,9 @@ void ContentSecurityPolicy::logToConsole(const String& message, const String& co m_scriptExecutionContext->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, contextURL, contextLine.oneBasedInt(), callStack); } +void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String& directiveText) const +{ + InspectorInstrumentation::scriptExecutionBlockedByCSP(m_scriptExecutionContext, directiveText); +} + } diff --git a/Source/WebCore/page/ContentSecurityPolicy.h b/Source/WebCore/page/ContentSecurityPolicy.h index da3d978ca..bbbce6ad4 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.h +++ b/Source/WebCore/page/ContentSecurityPolicy.h @@ -108,10 +108,13 @@ public: void reportUnrecognizedDirective(const String&) const; void reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; + void reportBlockedScriptExecutionToInspector(const String& directiveText) const; + const KURL& url() const; KURL completeURL(const String&) const; SecurityOrigin* securityOrigin() const; void enforceSandboxFlags(SandboxFlags) const; + String evalDisabledErrorMessage() const; private: explicit ContentSecurityPolicy(ScriptExecutionContext*); diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 52107c887..c4651d744 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -735,8 +735,6 @@ Storage* DOMWindow::sessionStorage(ExceptionCode& ec) const { if (!isCurrentlyDisplayedInFrame()) return 0; - if (m_sessionStorage) - return m_sessionStorage.get(); Document* document = this->document(); if (!document) @@ -747,6 +745,9 @@ Storage* DOMWindow::sessionStorage(ExceptionCode& ec) const return 0; } + if (m_sessionStorage) + return m_sessionStorage.get(); + Page* page = document->page(); if (!page) return 0; @@ -762,8 +763,6 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const { if (!isCurrentlyDisplayedInFrame()) return 0; - if (m_localStorage) - return m_localStorage.get(); Document* document = this->document(); if (!document) @@ -774,6 +773,9 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const return 0; } + if (m_localStorage) + return m_localStorage.get(); + Page* page = document->page(); if (!page) return 0; diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index b614fe284..9649aa931 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -186,10 +186,13 @@ module window { [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array messagePorts) raises(DOMException); +#if defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin) raises(DOMException); [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array transferList) raises(DOMException); +#endif // defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES + #else // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port. [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort, in DOMString targetOrigin) diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index f102e856d..919f8e45c 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -264,6 +264,20 @@ static inline bool scrollNode(float delta, ScrollGranularity granularity, Scroll return enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, granularity, absDelta, stopNode); } +#if ENABLE(GESTURE_EVENTS) +static inline bool shouldGesturesTriggerActive() +{ + // If the platform we're on supports GestureTapDown and GestureTapCancel then we'll + // rely on them to set the active state. Unfortunately there's no generic way to + // know in advance what event types are supported. +#if PLATFORM(CHROMIUM) && !OS(ANDROID) + return true; +#else + return false; +#endif +} +#endif + #if !PLATFORM(MAC) inline bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&) @@ -1049,13 +1063,33 @@ HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, bool hitType |= HitTestRequest::IgnoreClipping; if (allowShadowContent) hitType |= HitTestRequest::AllowShadowContent; - if (testScrollbars == ShouldHitTestScrollbars) - hitType |= HitTestRequest::TestChildFrameScrollBars; - // We always need to handle child frame content. - hitType |= HitTestRequest::AllowChildFrameContent; - m_frame->contentRenderer()->hitTest(HitTestRequest(hitType), result); + while (true) { + Node* n = result.innerNode(); + if (!result.isOverWidget() || !n || !n->renderer() || !n->renderer()->isWidget()) + break; + RenderWidget* renderWidget = toRenderWidget(n->renderer()); + Widget* widget = renderWidget->widget(); + if (!widget || !widget->isFrameView()) + break; + Frame* frame = static_cast<HTMLFrameElementBase*>(n)->contentFrame(); + if (!frame || !frame->contentRenderer()) + break; + FrameView* view = static_cast<FrameView*>(widget); + LayoutPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(), + result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop()); + HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width()); + frame->contentRenderer()->hitTest(HitTestRequest(hitType), widgetHitTestResult); + result = widgetHitTestResult; + + if (testScrollbars == ShouldHitTestScrollbars) { + Scrollbar* eventScrollbar = view->scrollbarAtPoint(roundedIntPoint(point)); + if (eventScrollbar) + result.setScrollbar(eventScrollbar); + } + } + // If our HitTestResult is not visible, then we started hit testing too far down the frame chain. // Another hit test at the main frame level should get us the correct visible result. Frame* resultFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : 0; @@ -2380,8 +2414,20 @@ bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || gestureEvent.type() == PlatformEvent::GestureScrollUpdate) eventTarget = m_scrollGestureHandlingNode.get(); - if (!eventTarget) { - HitTestResult result = hitTestResultAtPoint(gestureEvent.position(), false, false, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active); + HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent; + if (gestureEvent.type() == PlatformEvent::GestureTapDown) + hitType |= HitTestRequest::Active; + else if (gestureEvent.type() == PlatformEvent::GestureTap || gestureEvent.type() == PlatformEvent::GestureTapDownCancel) + hitType |= HitTestRequest::Release; + else + hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; + + if (!shouldGesturesTriggerActive()) + hitType |= HitTestRequest::ReadOnly; + + if (!eventTarget || !(hitType & HitTestRequest::ReadOnly)) { + IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.position()); + HitTestResult result = hitTestResultAtPoint(hitTestPoint, false, false, DontHitTestScrollbars, hitType); eventTarget = result.targetNode(); } @@ -2419,6 +2465,7 @@ bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) case PlatformEvent::GesturePinchBegin: case PlatformEvent::GesturePinchEnd: case PlatformEvent::GesturePinchUpdate: + case PlatformEvent::GestureTapDownCancel: break; default: ASSERT_NOT_REACHED(); @@ -3553,6 +3600,11 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) break; } +#if ENABLE(GESTURE_EVENTS) + if (shouldGesturesTriggerActive()) + hitType |= HitTestRequest::ReadOnly; +#endif + // Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap. unsigned touchPointTargetKey = point.id() + 1; RefPtr<EventTarget> touchTarget; diff --git a/Source/WebCore/page/FeatureObserver.cpp b/Source/WebCore/page/FeatureObserver.cpp new file mode 100644 index 000000000..a1f889ec8 --- /dev/null +++ b/Source/WebCore/page/FeatureObserver.cpp @@ -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 GOOGLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FeatureObserver.h" + +#include "DOMWindow.h" +#include "Document.h" +#include "HistogramSupport.h" +#include "Page.h" + +namespace WebCore { + +FeatureObserver::FeatureObserver() + : m_featureMask(0) +{ +} + +FeatureObserver::~FeatureObserver() +{ + // We always log PageDestruction so that we have a scale for the rest of the features. + HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageDestruction, NumberOfFeatures); + + if (!m_featureMask) + return; + + for (int i = 0; i < NumberOfFeatures; ++i) { + if (m_featureMask & (1 << i)) + HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", i, NumberOfFeatures); + } +} + +void FeatureObserver::observe(DOMWindow* domWindow, Feature feature) +{ + Document* document = domWindow->document(); + if (!document) + return; + + Page* page = document->page(); + if (!page) + return; + + page->featureObserver()->didObserve(feature); +} + +} // namespace WebCore diff --git a/Source/WebCore/page/FeatureObserver.h b/Source/WebCore/page/FeatureObserver.h new file mode 100644 index 000000000..c32155918 --- /dev/null +++ b/Source/WebCore/page/FeatureObserver.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 Google, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FeatureObserver_h +#define FeatureObserver_h + +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class DOMWindow; + +class FeatureObserver { + WTF_MAKE_NONCOPYABLE(FeatureObserver); +public: + FeatureObserver(); + ~FeatureObserver(); + + enum Feature { + PageDestruction, + LegacyNotifications, + LegacyBlobBuilder, + PrefixedIndexedDB, + // Add new features above this line. + NumberOfFeatures, // This enum value must be last. + }; + + static void observe(DOMWindow*, Feature); + +private: + void didObserve(Feature feature) + { + COMPILE_ASSERT(sizeof(m_featureMask) * 8 >= NumberOfFeatures, FeaturesMustNotOverflowBitmask); + ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor. + ASSERT(feature < NumberOfFeatures); + m_featureMask |= 1 << static_cast<int>(feature); + } + + int m_featureMask; +}; + +} // namespace WebCore + +#endif // FeatureObserver_h diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index fb65d54cf..a7aaf954b 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -675,8 +675,8 @@ void Frame::dispatchVisibilityStateChangeEvent() void Frame::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_doc.get()); - info.addInstrumentedMember(m_loader); + info.addMember(m_doc.get()); + info.addMember(m_loader); } void Frame::willDetachPage() diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index a5f365e35..cf4d0fec9 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -55,7 +55,6 @@ #include "PageGroup.h" #include "PluginData.h" #include "PluginView.h" -#include "PluginViewBase.h" #include "PointerLockController.h" #include "ProgressTracker.h" #include "RenderArena.h" @@ -1030,16 +1029,8 @@ void Page::dnsPrefetchingStateChanged() frame->document()->initDNSPrefetch(); } -void Page::privateBrowsingStateChanged() +void Page::collectPluginViews(Vector<RefPtr<PluginViewBase>, 32>& pluginViewBases) { - bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled(); - - for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) - frame->document()->privateBrowsingStateDidChange(); - - // Collect the PluginViews in to a vector to ensure that action the plug-in takes - // from below privateBrowsingStateChanged does not affect their lifetime. - Vector<RefPtr<PluginViewBase>, 32> pluginViewBases; for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) { FrameView* view = frame->view(); if (!view) @@ -1055,6 +1046,33 @@ void Page::privateBrowsingStateChanged() pluginViewBases.append(static_cast<PluginViewBase*>(widget)); } } +} + +void Page::storageBlockingStateChanged() +{ + for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) + frame->document()->storageBlockingStateDidChange(); + + // Collect the PluginViews in to a vector to ensure that action the plug-in takes + // from below storageBlockingStateChanged does not affect their lifetime. + Vector<RefPtr<PluginViewBase>, 32> pluginViewBases; + collectPluginViews(pluginViewBases); + + for (size_t i = 0; i < pluginViewBases.size(); ++i) + pluginViewBases[i]->storageBlockingStateChanged(); +} + +void Page::privateBrowsingStateChanged() +{ + bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled(); + + for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) + frame->document()->privateBrowsingStateDidChange(); + + // Collect the PluginViews in to a vector to ensure that action the plug-in takes + // from below privateBrowsingStateChanged does not affect their lifetime. + Vector<RefPtr<PluginViewBase>, 32> pluginViewBases; + collectPluginViews(pluginViewBases); for (size_t i = 0; i < pluginViewBases.size(); ++i) pluginViewBases[i]->privateBrowsingStateChanged(privateBrowsingEnabled); diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h index 6f4fe05be..ba26ce819 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h @@ -21,12 +21,14 @@ #ifndef Page_h #define Page_h +#include "FeatureObserver.h" #include "FrameLoaderTypes.h" #include "FindOptions.h" #include "LayoutTypes.h" #include "PageVisibilityState.h" #include "Pagination.h" #include "PlatformScreen.h" +#include "PluginViewBase.h" #include "Region.h" #include "Supplementable.h" #include "ViewportArguments.h" @@ -196,6 +198,8 @@ namespace WebCore { ProgressTracker* progress() const { return m_progress.get(); } BackForwardController* backForward() const { return m_backForwardController.get(); } + FeatureObserver* featureObserver() { return &m_featureObserver; } + enum ViewMode { ViewModeInvalid, ViewModeWindowed, @@ -277,6 +281,7 @@ namespace WebCore { const String& userStyleSheet() const; void dnsPrefetchingStateChanged(); + void storageBlockingStateChanged(); void privateBrowsingStateChanged(); static void setDebuggerForAllPages(JSC::Debugger*); @@ -356,6 +361,8 @@ namespace WebCore { void setMinimumTimerInterval(double); double minimumTimerInterval() const; + void collectPluginViews(Vector<RefPtr<PluginViewBase>, 32>& pluginViewBases); + OwnPtr<Chrome> m_chrome; OwnPtr<DragCaretController> m_dragCaretController; @@ -387,6 +394,8 @@ namespace WebCore { EditorClient* m_editorClient; ValidationMessageClient* m_validationMessageClient; + FeatureObserver m_featureObserver; + int m_frameCount; String m_groupName; bool m_openedByDOM; diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index f25150b51..2a4c7b4f0 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -46,10 +46,12 @@ using namespace std; namespace WebCore { -static void setLoadsImagesAutomaticallyInAllFrames(Page* page) +static void setImageLoadingSettings(Page* page) { - for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) + for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + frame->document()->cachedResourceLoader()->setImagesEnabled(page->settings()->areImagesEnabled()); frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically()); + } } // Sets the entry in the font map for the given script. If family is the empty string, removes the entry instead. @@ -200,6 +202,9 @@ Settings::Settings(Page* page) , m_acceleratedDrawingEnabled(false) , m_acceleratedFiltersEnabled(false) , m_isCSSCustomFilterEnabled(false) +#if ENABLE(CSS_STICKY_POSITION) + , m_cssStickyPositionEnabled(true) +#endif #if ENABLE(CSS_REGIONS) , m_cssRegionsEnabled(false) #endif @@ -286,7 +291,7 @@ Settings::Settings(Page* page) , m_windowFocusRestricted(true) , m_diagnosticLoggingEnabled(false) , m_scrollingPerformanceLoggingEnabled(false) - , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired) + , m_setImageLoadingSettingsTimer(this, &Settings::imageLoadingSettingsTimerFired) , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds) { // A Frame may not have been created yet, so we initialize the AtomicString @@ -452,12 +457,12 @@ void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically) // Starting these loads synchronously is not important. By putting it on a 0-delay, properly closing the Page cancels them // before they have a chance to really start. // See http://webkit.org/b/60572 for more discussion. - m_loadsImagesAutomaticallyTimer.startOneShot(0); + m_setImageLoadingSettingsTimer.startOneShot(0); } -void Settings::loadsImagesAutomaticallyTimerFired(Timer<Settings>*) +void Settings::imageLoadingSettingsTimerFired(Timer<Settings>*) { - setLoadsImagesAutomaticallyInAllFrames(m_page); + setImageLoadingSettings(m_page); } void Settings::setLoadsSiteIconsIgnoringImageLoadingSetting(bool loadsSiteIcons) @@ -503,6 +508,9 @@ void Settings::setJavaEnabledForLocalFiles(bool isJavaEnabledForLocalFiles) void Settings::setImagesEnabled(bool areImagesEnabled) { m_areImagesEnabled = areImagesEnabled; + + // See comment in setLoadsImagesAutomatically. + m_setImageLoadingSettingsTimer.startOneShot(0); } void Settings::setMediaEnabled(bool isMediaEnabled) @@ -931,6 +939,15 @@ void Settings::setLoadDeferringEnabled(bool enabled) m_loadDeferringEnabled = enabled; } +void Settings::setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy enabled) +{ + if (m_storageBlockingPolicy == enabled) + return; + + m_storageBlockingPolicy = enabled; + m_page->storageBlockingStateChanged(); +} + void Settings::setTiledBackingStoreEnabled(bool enabled) { m_tiledBackingStoreEnabled = enabled; diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 9681e27e0..6247f8564 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -337,6 +337,14 @@ namespace WebCore { void setCSSCustomFilterEnabled(bool enabled) { m_isCSSCustomFilterEnabled = enabled; } bool isCSSCustomFilterEnabled() const { return m_isCSSCustomFilterEnabled; } +#if ENABLE(CSS_STICKY_POSITION) + void setCSSStickyPositionEnabled(bool enabled) { m_cssStickyPositionEnabled = enabled; } + bool cssStickyPositionEnabled() const { return m_cssStickyPositionEnabled; } +#else + void setCSSStickyPositionEnabled(bool) { } + bool cssStickyPositionEnabled() const { return false; } +#endif + #if ENABLE(CSS_REGIONS) void setCSSRegionsEnabled(bool enabled) { m_cssRegionsEnabled = enabled; } bool cssRegionsEnabled() const { return m_cssRegionsEnabled; } @@ -602,7 +610,7 @@ namespace WebCore { void setWindowFocusRestricted(bool restricted) { m_windowFocusRestricted = restricted; } bool windowFocusRestricted() const { return m_windowFocusRestricted; } - void setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy policy) { m_storageBlockingPolicy = policy; } + void setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy); SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy() const { return m_storageBlockingPolicy; } void setScrollingPerformanceLoggingEnabled(bool); @@ -711,6 +719,9 @@ namespace WebCore { bool m_acceleratedDrawingEnabled : 1; bool m_acceleratedFiltersEnabled : 1; bool m_isCSSCustomFilterEnabled : 1; +#if ENABLE(CSS_STICKY_POSITION) + bool m_cssStickyPositionEnabled : 1; +#endif #if ENABLE(CSS_REGIONS) bool m_cssRegionsEnabled : 1; #endif @@ -800,8 +811,8 @@ namespace WebCore { bool m_scrollingPerformanceLoggingEnabled : 1; - Timer<Settings> m_loadsImagesAutomaticallyTimer; - void loadsImagesAutomaticallyTimerFired(Timer<Settings>*); + Timer<Settings> m_setImageLoadingSettingsTimer; + void imageLoadingSettingsTimerFired(Timer<Settings>*); double m_incrementalRenderingSuppressionTimeoutInSeconds; diff --git a/Source/WebCore/page/TouchAdjustment.cpp b/Source/WebCore/page/TouchAdjustment.cpp index 1dd349273..4aeb343af 100644 --- a/Source/WebCore/page/TouchAdjustment.cpp +++ b/Source/WebCore/page/TouchAdjustment.cpp @@ -357,6 +357,20 @@ FloatPoint contentsToWindow(FrameView *view, FloatPoint pt) return FloatPoint(adjusted.x(), adjusted.y()); } +// Adjusts 'point' to the nearest point inside rect, and leaves it unchanged if already inside. +void adjustPointToRect(FloatPoint& point, const FloatRect& rect) +{ + if (point.x() < rect.x()) + point.setX(rect.x()); + else if (point.x() > rect.maxX()) + point.setX(rect.maxX()); + + if (point.y() < rect.y()) + point.setY(rect.y()); + else if (point.y() > rect.maxY()) + point.setY(rect.maxY()); +} + bool snapTo(const SubtargetGeometry& geom, const IntPoint& touchPoint, const IntRect& touchArea, IntPoint& adjustedPoint) { FrameView* view = geom.node()->document()->view(); @@ -378,7 +392,11 @@ bool snapTo(const SubtargetGeometry& geom, const IntPoint& touchPoint, const Int return false; } - // Non-rectilinear element. + // The following code tries to adjust the point to place inside a both the touchArea and the non-rectilinear quad. + // FIXME: This will return the point inside the touch area that is the closest to the quad center, but does not + // guarantee that the point will be inside the quad. Corner-cases exist where the quad will intersect but this + // will fail to adjust the point to somewhere in the intersection. + // Convert quad from content to window coordinates. FloatPoint p1 = contentsToWindow(view, quad.p1()); FloatPoint p2 = contentsToWindow(view, quad.p2()); @@ -392,32 +410,12 @@ bool snapTo(const SubtargetGeometry& geom, const IntPoint& touchPoint, const Int } // Pull point towards the center of the element. - float cx = 0.25 * (p1.x() + p2.x() + p3.x() + p4.x()); - float cy = 0.25 * (p1.y() + p2.y() + p3.y() + p4.y()); - FloatPoint center = FloatPoint(cx, cy); - - FloatSize pullDirection = center - touchPoint; - float distanceToCenter = pullDirection.diagonalLength(); + FloatPoint center = quad.center(); - // Use distance from center to corner of touch area to limit adjustment distance. - float dx = 0.5f * touchArea.width(); - float dy = 0.5f * touchArea.height(); - float touchRadius = sqrt(dx * dx + dy * dy); + adjustPointToRect(center, touchArea); + adjustedPoint = roundedIntPoint(center); - float scaleFactor = touchRadius / distanceToCenter; - if (scaleFactor > 1) - scaleFactor = 1; - pullDirection.scale(scaleFactor); - - int x = static_cast<int>(touchPoint.x() + pullDirection.width()); - int y = static_cast<int>(touchPoint.y() + pullDirection.height()); - IntPoint point(x, y); - - if (quad.containsPoint(point)) { - adjustedPoint = point; - return true; - } - return false; + return quad.containsPoint(adjustedPoint); } // A generic function for finding the target node with the lowest distance metric. A distance metric here is the result diff --git a/Source/WebCore/platform/KURL.cpp b/Source/WebCore/platform/KURL.cpp index 86e2861a2..c3d5099f3 100644 --- a/Source/WebCore/platform/KURL.cpp +++ b/Source/WebCore/platform/KURL.cpp @@ -1921,11 +1921,11 @@ void KURL::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this); #if USE(GOOGLEURL) - info.addInstrumentedMember(m_url); + info.addMember(m_url); #elif USE(WTFURL) - info.addInstrumentedMember(m_urlImpl); + info.addMember(m_urlImpl); #else // !USE(GOOGLEURL) - info.addInstrumentedMember(m_string); + info.addMember(m_string); #endif } diff --git a/Source/WebCore/platform/KURLGoogle.cpp b/Source/WebCore/platform/KURLGoogle.cpp index ba8064058..6f8142672 100644 --- a/Source/WebCore/platform/KURLGoogle.cpp +++ b/Source/WebCore/platform/KURLGoogle.cpp @@ -393,9 +393,9 @@ const String& KURLGooglePrivate::string() const void KURLGooglePrivate::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this); - info.addInstrumentedMember(m_utf8); - info.addInstrumentedMember(m_string); - info.addInstrumentedMember(m_innerURL); + info.addMember(m_utf8); + info.addMember(m_string); + info.addMember(m_innerURL); } // KURL ------------------------------------------------------------------------ diff --git a/Source/WebCore/platform/KURLWTFURL.cpp b/Source/WebCore/platform/KURLWTFURL.cpp index ae2da1d15..f030b8719 100644 --- a/Source/WebCore/platform/KURLWTFURL.cpp +++ b/Source/WebCore/platform/KURLWTFURL.cpp @@ -113,7 +113,7 @@ bool KURL::isValid() const const String& KURL::string() const { if (isNull()) - return nullAtom(); + return emptyString(); if (isValid()) return m_urlImpl->m_parsedURL.spec().string(); diff --git a/Source/WebCore/platform/KURLWTFURLImpl.h b/Source/WebCore/platform/KURLWTFURLImpl.h index 324fefff4..c42487f4d 100644 --- a/Source/WebCore/platform/KURLWTFURLImpl.h +++ b/Source/WebCore/platform/KURLWTFURLImpl.h @@ -28,6 +28,7 @@ #if USE(WTFURL) +#include "PlatformMemoryInstrumentation.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -41,12 +42,11 @@ public: WTF::ParsedURL m_parsedURL; String m_invalidUrlString; - template<typename MemoruObjectInfo> - void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this); - info.addInstrumentedMember(m_parsedURL); - info.addInstrumentedMember(m_invalidUrlString); + info.addMember(m_parsedURL); + info.addMember(m_invalidUrlString); } PassRefPtr<KURLWTFURLImpl> copy() const; }; diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp index a198e8500..0626170e0 100755 --- a/Source/WebCore/platform/MIMETypeRegistry.cpp +++ b/Source/WebCore/platform/MIMETypeRegistry.cpp @@ -638,7 +638,7 @@ static const MIMETypeAssociationMap& mimeTypeAssociationMap() mimeTypeMap = new MIMETypeAssociationMap; - mimeTypeMap->add(ASCIILiteral("image/x-ms-bmp"), ASCIILiteral("image/bmp"))); + mimeTypeMap->add(ASCIILiteral("image/x-ms-bmp"), ASCIILiteral("image/bmp")); mimeTypeMap->add(ASCIILiteral("image/x-windows-bmp"), ASCIILiteral("image/bmp")); mimeTypeMap->add(ASCIILiteral("image/x-bmp"), ASCIILiteral("image/bmp")); mimeTypeMap->add(ASCIILiteral("image/x-bitmap"), ASCIILiteral("image/bmp")); diff --git a/Source/WebCore/platform/PlatformEvent.h b/Source/WebCore/platform/PlatformEvent.h index 52c6488b6..1782b634a 100644 --- a/Source/WebCore/platform/PlatformEvent.h +++ b/Source/WebCore/platform/PlatformEvent.h @@ -54,6 +54,7 @@ public: GestureScrollUpdate, GestureTap, GestureTapDown, + GestureTapDownCancel, GestureDoubleTap, GestureTwoFingerTap, GestureLongPress, diff --git a/Source/WebCore/platform/TreeShared.h b/Source/WebCore/platform/TreeShared.h index 4b1291cc7..09737f897 100644 --- a/Source/WebCore/platform/TreeShared.h +++ b/Source/WebCore/platform/TreeShared.h @@ -114,7 +114,7 @@ public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this); - info.addInstrumentedMember(m_parent); + info.addMember(m_parent); } private: diff --git a/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp b/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp index 5263470a6..eadd123bc 100644 --- a/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp +++ b/Source/WebCore/platform/efl/EflKeyboardUtilities.cpp @@ -196,6 +196,10 @@ static void createWindowsKeyMap() windowsKeyMap().set(ASCIILiteral("KP_End"), VK_END); windowsKeyMap().set(ASCIILiteral("KP_Insert"), VK_INSERT); windowsKeyMap().set(ASCIILiteral("KP_Delete"), VK_DELETE); + windowsKeyMap().set(ASCIILiteral("KP_Multiply"), VK_MULTIPLY); + windowsKeyMap().set(ASCIILiteral("KP_Subtract"), VK_SUBTRACT); + windowsKeyMap().set(ASCIILiteral("KP_Decimal"), VK_DECIMAL); + windowsKeyMap().set(ASCIILiteral("KP_Devide"), VK_DIVIDE); // Set alphabet to the windowsKeyMap. addCharactersToWinKeyMap('a', 'z', VK_A); @@ -204,6 +208,14 @@ static void createWindowsKeyMap() // Set digits to the windowsKeyMap. addCharactersToWinKeyMap('0', '9', VK_0); + // Set digits of keypad to the windowsKeyMap. + for (unsigned i = 0; i < 10; ++i) { + StringBuilder builder; + builder.appendLiteral("KP_"); + builder.appendNumber(i); + windowsKeyMap().set(builder.toString(), VK_NUMPAD0 + i); + } + // Set shifted digits to the windowsKeyMap. windowsKeyMap().set(ASCIILiteral("exclam"), VK_1); windowsKeyMap().set(ASCIILiteral("at"), VK_2); diff --git a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp index 09d3a1d9d..430bc96ae 100644 --- a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp +++ b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp @@ -114,7 +114,10 @@ bool screenIsMonochrome(Widget* widget) FloatRect screenRect(Widget* widget) { #ifdef HAVE_ECORE_X - int width = 0, height = 0; + // Fallback to realistic values if the EcoreX call fails + // and we cannot accurately detect the screen size. + int width = 800; + int height = 600; CALL_WITH_ECORE_X(ecore_x_screen_size_get(screen, &width, &height)); UNUSED_PARAM(widget); return FloatRect(0, 0, width, height); diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.cpp b/Source/WebCore/platform/efl/RenderThemeEfl.cpp index 490bbddd8..b9a8963c2 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/Source/WebCore/platform/efl/RenderThemeEfl.cpp @@ -893,9 +893,8 @@ bool RenderThemeEfl::paintTextField(RenderObject* object, const PaintInfo& info, return paintThemePart(object, TextField, info, rect); } -void RenderThemeEfl::adjustTextAreaStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const +void RenderThemeEfl::adjustTextAreaStyle(StyleResolver*, RenderStyle*, Element*) const { - adjustTextFieldStyle(styleResolver, style, element); } bool RenderThemeEfl::paintTextArea(RenderObject* object, const PaintInfo& info, const IntRect& rect) diff --git a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp b/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp index bb7ccc243..df51b32ae 100644 --- a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp +++ b/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp @@ -112,8 +112,8 @@ void CrossfadeGeneratedImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectIn { MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); GeneratedImage::reportMemoryUsage(memoryObjectInfo); - info.addInstrumentedMember(m_fromImage); - info.addInstrumentedMember(m_toImage); + info.addMember(m_fromImage); + info.addMember(m_toImage); } } diff --git a/Source/WebCore/platform/graphics/Gradient.cpp b/Source/WebCore/platform/graphics/Gradient.cpp index df2f5360c..95d70ba25 100644 --- a/Source/WebCore/platform/graphics/Gradient.cpp +++ b/Source/WebCore/platform/graphics/Gradient.cpp @@ -33,7 +33,7 @@ #include <wtf/StringHasher.h> #include <wtf/UnusedParam.h> -using WTF::intHash; +using WTF::pairIntHash; namespace WebCore { @@ -283,7 +283,7 @@ unsigned Gradient::hash() const unsigned parametersHash = StringHasher::hashMemory(¶meters, sizeof(parameters)); unsigned stopHash = StringHasher::hashMemory(m_stops.data(), m_stops.size() * sizeof(ColorStop)); - m_cachedHash = intHash((static_cast<uint64_t>(parametersHash) << 32) | stopHash); + m_cachedHash = pairIntHash(parametersHash, stopHash); return m_cachedHash; } diff --git a/Source/WebCore/platform/graphics/Image.cpp b/Source/WebCore/platform/graphics/Image.cpp index 3c67b841e..78e5e4863 100644 --- a/Source/WebCore/platform/graphics/Image.cpp +++ b/Source/WebCore/platform/graphics/Image.cpp @@ -201,7 +201,7 @@ void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsic void Image::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); - info.addInstrumentedMember(m_data); + info.addMember(m_data); info.addMember(m_imageObserver); } diff --git a/Source/WebCore/platform/graphics/IntPointHash.h b/Source/WebCore/platform/graphics/IntPointHash.h index bf25b1479..9c6621e02 100644 --- a/Source/WebCore/platform/graphics/IntPointHash.h +++ b/Source/WebCore/platform/graphics/IntPointHash.h @@ -28,7 +28,7 @@ namespace WTF { // The empty value is (0, INT_MIN), the deleted value is (INT_MIN, 0) struct IntPointHash { - static unsigned hash(const WebCore::IntPoint& p) { return WTF::intHash(static_cast<uint64_t>(p.x()) << 32 | p.y()); } + static unsigned hash(const WebCore::IntPoint& p) { return pairIntHash(p.x(), p.y()); } static bool equal(const WebCore::IntPoint& a, const WebCore::IntPoint& b) { return a == b; } static const bool safeToCompareToEmptyOrDeleted = true; }; diff --git a/Source/WebCore/platform/graphics/IntRectHash.h b/Source/WebCore/platform/graphics/IntRectHash.h index 96132653b..8d6520a16 100644 --- a/Source/WebCore/platform/graphics/IntRectHash.h +++ b/Source/WebCore/platform/graphics/IntRectHash.h @@ -37,7 +37,7 @@ namespace WTF { template<> struct IntHash<WebCore::IntRect> { static unsigned hash(const WebCore::IntRect& key) { - return intHash(static_cast<uint64_t>(DefaultHash<WebCore::IntPoint>::Hash::hash(key.location())) << 32 | DefaultHash<WebCore::IntSize>::Hash::hash(key.size())); + return pairIntHash(DefaultHash<WebCore::IntPoint>::Hash::hash(key.location()), DefaultHash<WebCore::IntSize>::Hash::hash(key.size())); } static bool equal(const WebCore::IntRect& a, const WebCore::IntRect& b) { diff --git a/Source/WebCore/platform/graphics/IntSizeHash.h b/Source/WebCore/platform/graphics/IntSizeHash.h index b209236ef..2f8f19a7b 100644 --- a/Source/WebCore/platform/graphics/IntSizeHash.h +++ b/Source/WebCore/platform/graphics/IntSizeHash.h @@ -27,7 +27,7 @@ namespace WTF { template<> struct IntHash<WebCore::IntSize> { - static unsigned hash(const WebCore::IntSize& key) { return intHash((static_cast<uint64_t>(key.width()) << 32 | key.height())); } + static unsigned hash(const WebCore::IntSize& key) { return pairIntHash(key.width(), key.height()); } static bool equal(const WebCore::IntSize& a, const WebCore::IntSize& b) { return a == b; } static const bool safeToCompareToEmptyOrDeleted = true; }; diff --git a/Source/WebCore/platform/graphics/WidthIterator.cpp b/Source/WebCore/platform/graphics/WidthIterator.cpp index 35305811a..f061ec470 100644 --- a/Source/WebCore/platform/graphics/WidthIterator.cpp +++ b/Source/WebCore/platform/graphics/WidthIterator.cpp @@ -181,8 +181,7 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph // Account for word spacing. // We apply additional space between "words" by adding width to the space character. - // Word-spacing affects each space (U+0020) and non-breaking space (U+00A0). - if ((character == noBreakSpace || character == ' ') && textIterator.currentCharacter() && m_font->wordSpacing()) + if (treatAsSpace && (character != '\t' || !m_run.allowTabs()) && textIterator.currentCharacter() && m_font->wordSpacing()) width += m_font->wordSpacing(); } else m_isAfterExpansion = false; diff --git a/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp b/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp index 8c5b72458..8920e987a 100644 --- a/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp +++ b/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp @@ -45,7 +45,7 @@ EGLImageLayerWebKitThread::EGLImageLayerWebKitThread(LayerType type) , m_needsDisplay(false) , m_frontBufferTexture(0) , m_fbo(0) - , m_shader(0) + , m_program(0) , m_image(0) { layerCompositingThread()->setClient(m_client.get()); @@ -58,7 +58,7 @@ EGLImageLayerWebKitThread::~EGLImageLayerWebKitThread() // before we get this far. ASSERT(!m_frontBufferTexture); ASSERT(!m_fbo); - ASSERT(!m_shader); + ASSERT(!m_program); ASSERT(!m_image); } @@ -123,8 +123,8 @@ void EGLImageLayerWebKitThread::deleteFrontBuffer() m_frontBufferTexture = 0; glDeleteFramebuffers(1, &m_fbo); m_fbo = 0; - glDeleteShader(m_shader); - m_shader = 0; + glDeleteProgram(m_program); + m_program = 0; // The image is in our EGLImageLayerCompositingThreadClient's custody // at this point, and that object is responsible for deleting it. @@ -216,15 +216,15 @@ void EGLImageLayerWebKitThread::createShaderIfNeeded() " gl_FragColor = texture2D(s_texture, v_texCoord); \n" "} \n"; - if (!m_shader) { - m_shader = LayerRenderer::loadShaderProgram(vertexShaderString, fragmentShaderStringRGBA); - if (!m_shader) + if (!m_program) { + m_program = LayerRenderer::loadShaderProgram(vertexShaderString, fragmentShaderStringRGBA); + if (!m_program) return; - glBindAttribLocation(m_shader, GLES2Program::PositionAttributeIndex, "a_position"); - glBindAttribLocation(m_shader, GLES2Program::TexCoordAttributeIndex, "a_texCoord"); - glLinkProgram(m_shader); - unsigned samplerLocation = glGetUniformLocation(m_shader, "s_texture"); - glUseProgram(m_shader); + glBindAttribLocation(m_program, GLES2Program::PositionAttributeIndex, "a_position"); + glBindAttribLocation(m_program, GLES2Program::TexCoordAttributeIndex, "a_texCoord"); + glLinkProgram(m_program); + unsigned samplerLocation = glGetUniformLocation(m_program, "s_texture"); + glUseProgram(m_program); glUniform1i(samplerLocation, 0); } } @@ -255,7 +255,7 @@ void EGLImageLayerWebKitThread::blitToFrontBuffer(unsigned backBufferTexture) glViewport(0, 0, m_size.width(), m_size.height()); glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); - glUseProgram(m_shader); + glUseProgram(m_program); glBindTexture(GL_TEXTURE_2D, backBufferTexture); glColorMask(true, true, true, true); diff --git a/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.h b/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.h index f2561fca4..7f842e960 100644 --- a/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.h +++ b/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.h @@ -56,7 +56,7 @@ private: bool m_needsDisplay; unsigned m_frontBufferTexture; unsigned m_fbo; - unsigned m_shader; + unsigned m_program; void* m_image; Vector<void*> m_garbage; IntSize m_size; diff --git a/Source/WebCore/platform/graphics/blackberry/LayerTileIndex.h b/Source/WebCore/platform/graphics/blackberry/LayerTileIndex.h index 4df008728..574e372d3 100644 --- a/Source/WebCore/platform/graphics/blackberry/LayerTileIndex.h +++ b/Source/WebCore/platform/graphics/blackberry/LayerTileIndex.h @@ -66,7 +66,7 @@ inline bool operator!=(const TileIndex& a, const TileIndex& b) namespace WTF { template<> struct IntHash<WebCore::TileIndex> { - static unsigned hash(const WebCore::TileIndex& key) { return intHash((static_cast<uint64_t>(key.i()) << 32 | key.j())); } + static unsigned hash(const WebCore::TileIndex& key) { return pairIntHash(key.i(), key.j()); } static bool equal(const WebCore::TileIndex& a, const WebCore::TileIndex& b) { return a == b; } static const bool safeToCompareToEmptyOrDeleted = true; }; diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp index f1e46c208..97fb0b609 100644 --- a/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp +++ b/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp @@ -296,7 +296,9 @@ void PlatformCAAnimation::setTimingFunction(const TimingFunction* value, bool re void PlatformCAAnimation::copyTimingFunctionFrom(const PlatformCAAnimation* value) { - CACFAnimationSetTimingFunction(m_animation.get(), CACFAnimationGetTimingFunction(value->m_animation.get())); + CACFTimingFunctionRef timingFunc = CACFAnimationGetTimingFunction(value->m_animation.get()); + if (timingFunc) + CACFAnimationSetTimingFunction(m_animation.get(), timingFunc); } bool PlatformCAAnimation::isRemovedOnCompletion() const diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index b59c277a3..5ddc58aca 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -74,7 +74,7 @@ extern "C" { using namespace std; // FIXME: The following using declaration should be in <wtf/HashFunctions.h>. -using WTF::intHash; +using WTF::pairIntHash; // FIXME: The following using declaration should be in <wtf/HashTraits.h>. using WTF::GenericHashTraits; @@ -116,8 +116,8 @@ struct SubimageCacheEntryTraits : GenericHashTraits<SubimageCacheEntry> { struct SubimageCacheHash { static unsigned hash(CGImageRef image, const FloatRect& rect) { - return intHash((static_cast<uint64_t>(PtrHash<CGImageRef>::hash(image)) << 32) - | (static_cast<unsigned>(rect.x()) << 16) | static_cast<unsigned>(rect.y())); + return pairIntHash(PtrHash<CGImageRef>::hash(image), + (static_cast<unsigned>(rect.x()) << 16) | static_cast<unsigned>(rect.y())); } static unsigned hash(const SubimageCacheEntry& key) { diff --git a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp index b816c33bc..5155fbd62 100644 --- a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp +++ b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp @@ -55,6 +55,9 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, , m_next(0) , m_prev(0) { + // Used by browser tests to detect the use of a Canvas2DLayerBridge. + TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation"); + bool compositorThreadingEnabled = WebKit::Platform::current()->compositorSupport()->isThreadingEnabled(); // FIXME: We currently turn off double buffering when canvas rendering is // deferred. What we should be doing is to use a smarter heuristic based diff --git a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp index f12a5ba27..aeee45188 100644 --- a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp @@ -37,6 +37,7 @@ #include "GraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "GraphicsLayerChromium.h" +#include "TraceEvent.h" #include <algorithm> #include <public/Platform.h> #include <public/WebCompositorSupport.h> @@ -90,6 +91,9 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, , m_multisampleColorBuffer(0) , m_contentsChanged(true) { + // Used by browser tests to detect the use of a DrawingBuffer. + TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation"); + // We need a separate front and back textures if ... m_separateFrontTexture = m_preserveDrawingBuffer == Preserve // ... we have to preserve contents after compositing, which is done with a copy or ... || WebKit::Platform::current()->compositorSupport()->isThreadingEnabled(); // ... if we're in threaded mode and need to double buffer. diff --git a/Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h b/Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h new file mode 100644 index 000000000..b52236dde --- /dev/null +++ b/Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h @@ -0,0 +1,82 @@ +/* + * 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 CustomFilterArrayParameter_h +#define CustomFilterArrayParameter_h + +#if ENABLE(CSS_SHADERS) +#include "CustomFilterParameter.h" +#include <wtf/Vector.h> + +namespace WebCore { + +class CustomFilterArrayParameter : public CustomFilterParameter { +public: + static PassRefPtr<CustomFilterArrayParameter> create(const String& name) + { + return adoptRef(new CustomFilterArrayParameter(name)); + } + + unsigned size() const { return m_data.size(); } + double valueAt(unsigned index) const { return m_data.at(index); } + + void addValue(double value) { m_data.append(value); } + + virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress, const LayoutSize&) + { + // FIXME: https://bugs.webkit.org/show_bug.cgi?id=96437 + UNUSED_PARAM(from); + UNUSED_PARAM(progress); + + return this; + } + + virtual bool operator==(const CustomFilterParameter& o) const + { + if (!isSameType(o)) + return false; + + const CustomFilterArrayParameter* other = static_cast<const CustomFilterArrayParameter*>(&o); + return m_data == other->m_data; + } + +private: + CustomFilterArrayParameter(const String& name) + : CustomFilterParameter(ARRAY, name) + { + } + + Vector<double> m_data; +}; + +} // namespace WebCore + +#endif // ENABLE(CSS_SHADERS) + +#endif // CustomFilterArrayParameter_h diff --git a/Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp b/Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp index 582846e7f..da9782af8 100644 --- a/Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp +++ b/Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp @@ -78,6 +78,8 @@ void CustomFilterGlobalContext::prepareContextIfNeeded(HostWindow* hostWindow) GraphicsContext3D::Attributes attributes; attributes.preserveDrawingBuffer = true; attributes.premultipliedAlpha = false; + attributes.shareResources = true; + attributes.preferDiscreteGPU = true; m_context = GraphicsContext3D::create(attributes, hostWindow, GraphicsContext3D::RenderOffscreen); if (!m_context) return; diff --git a/Source/WebCore/platform/graphics/filters/CustomFilterParameter.h b/Source/WebCore/platform/graphics/filters/CustomFilterParameter.h index 81e5f83c2..641225a56 100644 --- a/Source/WebCore/platform/graphics/filters/CustomFilterParameter.h +++ b/Source/WebCore/platform/graphics/filters/CustomFilterParameter.h @@ -45,6 +45,7 @@ public: // 3d-transforms: https://bugs.webkit.org/show_bug.cgi?id=71443 // mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444 enum ParameterType { + ARRAY, NUMBER, TRANSFORM }; diff --git a/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp b/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp index fd125061d..fb5760f0b 100644 --- a/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp +++ b/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp @@ -1,4 +1,5 @@ /* + * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +33,7 @@ #if ENABLE(CSS_SHADERS) && USE(3D_GRAPHICS) #include "FECustomFilter.h" +#include "CustomFilterArrayParameter.h" #include "CustomFilterCompiledProgram.h" #include "CustomFilterGlobalContext.h" #include "CustomFilterMesh.h" @@ -41,12 +43,12 @@ #include "CustomFilterTransformParameter.h" #include "CustomFilterValidatedProgram.h" #include "DrawingBuffer.h" +#include "Extensions3D.h" #include "GraphicsContext3D.h" #include "ImageData.h" #include "NotImplemented.h" #include "RenderTreeAsText.h" #include "TextStream.h" -#include "Texture.h" #include "TilingData.h" #include "TransformationMatrix.h" @@ -54,6 +56,8 @@ namespace WebCore { +static const int kMaxSampleCount = 4; + static void orthogonalProjectionMatrix(TransformationMatrix& matrix, float left, float right, float bottom, float top) { ASSERT(matrix.isIdentity()); @@ -83,9 +87,14 @@ FECustomFilter::FECustomFilter(Filter* filter, CustomFilterGlobalContext* custom , m_globalContext(customFilterGlobalContext) , m_validatedProgram(validatedProgram) , m_compiledProgram(0) // Don't compile the program unless we need to paint. + , m_inputTexture(0) , m_frameBuffer(0) , m_depthBuffer(0) , m_destTexture(0) + , m_triedMultisampleBuffer(false) + , m_multisampleFrameBuffer(0) + , m_multisampleRenderBuffer(0) + , m_multisampleDepthBuffer(0) , m_parameters(parameters) , m_meshRows(meshRows) , m_meshColumns(meshColumns) @@ -112,6 +121,10 @@ void FECustomFilter::deleteRenderBuffers() if (!m_context) return; m_context->makeContextCurrent(); + if (m_inputTexture) { + m_context->deleteTexture(m_inputTexture); + m_inputTexture = 0; + } if (m_frameBuffer) { // Make sure to unbind any framebuffer from the context first, otherwise // some platforms might refuse to bind the same buffer id again. @@ -127,6 +140,26 @@ void FECustomFilter::deleteRenderBuffers() m_context->deleteTexture(m_destTexture); m_destTexture = 0; } + deleteMultisampleRenderBuffers(); +} + +void FECustomFilter::deleteMultisampleRenderBuffers() +{ + if (m_multisampleFrameBuffer) { + // Make sure to unbind any framebuffer from the context first, otherwise + // some platforms might refuse to bind the same buffer id again. + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0); + m_context->deleteFramebuffer(m_multisampleFrameBuffer); + m_multisampleFrameBuffer = 0; + } + if (m_multisampleRenderBuffer) { + m_context->deleteRenderbuffer(m_multisampleRenderBuffer); + m_multisampleRenderBuffer = 0; + } + if (m_multisampleDepthBuffer) { + m_context->deleteRenderbuffer(m_multisampleDepthBuffer); + m_multisampleDepthBuffer = 0; + } } void FECustomFilter::platformApplySoftware() @@ -148,46 +181,68 @@ void FECustomFilter::clearShaderResult() in->copyUnmultipliedImage(dstPixelArray, effectDrawingRect); } +void FECustomFilter::drawFilterMesh(Platform3DObject inputTexture) +{ + bool multisample = canUseMultisampleBuffers(); + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, multisample ? m_multisampleFrameBuffer : m_frameBuffer); + m_context->viewport(0, 0, m_contextSize.width(), m_contextSize.height()); + + m_context->clearColor(0, 0, 0, 0); + m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT); + + bindProgramAndBuffers(inputTexture); + m_context->drawElements(GraphicsContext3D::TRIANGLES, m_mesh->indicesCount(), GraphicsContext3D::UNSIGNED_SHORT, 0); + unbindVertexAttributes(); + + if (multisample) + resolveMultisampleBuffer(); +} + +bool FECustomFilter::prepareForDrawing(CustomFilterDrawType filterDrawType) +{ + if (!m_context && !initializeContext()) + return false; + m_context->makeContextCurrent(); + + // If the shader had compiler errors we cannot draw anything. + if (!m_compiledProgram->isInitialized()) + return false; + + // Only allocate a texture if the program needs one and the caller doesn't allocate one by itself. + if ((programNeedsInputTexture() && (filterDrawType == NEEDS_INPUT_TEXTURE) && !ensureInputTexture()) + || !ensureFrameBuffer()) + return false; + + return true; +} + +bool FECustomFilter::programNeedsInputTexture() const +{ + ASSERT(m_compiledProgram.get()); + return m_compiledProgram->samplerLocation() != -1; +} + bool FECustomFilter::applyShader() { Uint8ClampedArray* dstPixelArray = createUnmultipliedImageResult(); if (!dstPixelArray) return false; + if (!prepareForDrawing()) + return false; + FilterEffect* in = inputEffect(0); IntRect effectDrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); - RefPtr<Uint8ClampedArray> srcPixelArray = in->asUnmultipliedImage(effectDrawingRect); - IntSize newContextSize(effectDrawingRect.size()); - bool hadContext = m_context; - if (!m_context && !initializeContext()) - return false; - m_context->makeContextCurrent(); - - if (!hadContext || m_contextSize != newContextSize) - resizeContext(newContextSize); - -#if !PLATFORM(BLACKBERRY) // BlackBerry defines its own Texture class. - // Do not draw the filter if the input image cannot fit inside a single GPU texture. - if (m_inputTexture->tiles().numTilesX() != 1 || m_inputTexture->tiles().numTilesY() != 1) - return false; -#endif - - // The shader had compiler errors. We cannot draw anything. - if (!m_compiledProgram->isInitialized()) + if (!resizeContextIfNeeded(newContextSize)) return false; - m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_frameBuffer); - m_context->viewport(0, 0, newContextSize.width(), newContextSize.height()); - - m_context->clearColor(0, 0, 0, 0); - m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT); - - bindProgramAndBuffers(srcPixelArray.get()); - - m_context->drawElements(GraphicsContext3D::TRIANGLES, m_mesh->indicesCount(), GraphicsContext3D::UNSIGNED_SHORT, 0); - - unbindVertexAttributes(); + bool needsInputTexture = programNeedsInputTexture(); + if (needsInputTexture) { + RefPtr<Uint8ClampedArray> srcPixelArray = in->asUnmultipliedImage(effectDrawingRect); + uploadInputTexture(srcPixelArray.get()); + } + drawFilterMesh(needsInputTexture ? m_inputTexture : 0); ASSERT(static_cast<size_t>(newContextSize.width() * newContextSize.height() * 4) == dstPixelArray->length()); m_context->readPixels(0, 0, newContextSize.width(), newContextSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, dstPixelArray->data()); @@ -210,41 +265,170 @@ bool FECustomFilter::initializeContext() m_mesh = CustomFilterMesh::create(m_context.get(), m_meshColumns, m_meshRows, FloatRect(0, 0, 1, 1), m_meshType); + return true; } -void FECustomFilter::resizeContext(const IntSize& newContextSize) +bool FECustomFilter::ensureInputTexture() +{ + if (!m_inputTexture) + m_inputTexture = m_context->createTexture(); + return m_inputTexture; +} + +void FECustomFilter::uploadInputTexture(Uint8ClampedArray* srcPixelArray) +{ + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_inputTexture); + m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_contextSize.width(), m_contextSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, srcPixelArray->data()); +} + +bool FECustomFilter::ensureFrameBuffer() { -#if !PLATFORM(BLACKBERRY) // BlackBerry defines its own Texture class - m_inputTexture = Texture::create(m_context.get(), Texture::RGBA8, newContextSize.width(), newContextSize.height()); -#else - m_inputTexture = Texture::create(true); -#endif - if (!m_frameBuffer) m_frameBuffer = m_context->createFramebuffer(); if (!m_depthBuffer) m_depthBuffer = m_context->createRenderbuffer(); - if (!m_destTexture) { + if (!m_destTexture) m_destTexture = m_context->createTexture(); - m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_destTexture); - m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); - m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); - m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); - m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE); + return m_frameBuffer && m_depthBuffer && m_destTexture; +} + +bool FECustomFilter::createMultisampleBuffer() +{ + ASSERT(!m_triedMultisampleBuffer); + m_triedMultisampleBuffer = true; + + Extensions3D* extensions = m_context->getExtensions(); + if (!extensions + || !extensions->supports("GL_ANGLE_framebuffer_multisample") + || !extensions->supports("GL_ANGLE_framebuffer_blit") + || !extensions->supports("GL_OES_rgb8_rgba8")) + return false; + + extensions->ensureEnabled("GL_ANGLE_framebuffer_blit"); + extensions->ensureEnabled("GL_ANGLE_framebuffer_multisample"); + extensions->ensureEnabled("GL_OES_rgb8_rgba8"); + + if (!m_multisampleFrameBuffer) + m_multisampleFrameBuffer = m_context->createFramebuffer(); + if (!m_multisampleRenderBuffer) + m_multisampleRenderBuffer = m_context->createRenderbuffer(); + if (!m_multisampleDepthBuffer) + m_multisampleDepthBuffer = m_context->createRenderbuffer(); + + return true; +} + +void FECustomFilter::resolveMultisampleBuffer() +{ + ASSERT(m_triedMultisampleBuffer && m_multisampleFrameBuffer && m_multisampleRenderBuffer && m_multisampleDepthBuffer); + m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, m_multisampleFrameBuffer); + m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, m_frameBuffer); + + ASSERT(m_context->getExtensions()); + m_context->getExtensions()->blitFramebuffer(0, 0, m_contextSize.width(), m_contextSize.height(), 0, 0, m_contextSize.width(), m_contextSize.height(), GraphicsContext3D::COLOR_BUFFER_BIT, GraphicsContext3D::NEAREST); + + m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, 0); + m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, 0); + + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_frameBuffer); +} + +bool FECustomFilter::canUseMultisampleBuffers() const +{ + return m_triedMultisampleBuffer && m_multisampleFrameBuffer && m_multisampleRenderBuffer && m_multisampleDepthBuffer; +} + +bool FECustomFilter::resizeMultisampleBuffers(const IntSize& newContextSize) +{ + if (!m_triedMultisampleBuffer && !createMultisampleBuffer()) + return false; + + if (!canUseMultisampleBuffers()) + return false; + + int maxSupportedSampleCount = 0; + m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSupportedSampleCount); + int sampleCount = std::min(kMaxSampleCount, maxSupportedSampleCount); + if (!sampleCount) { + deleteMultisampleRenderBuffers(); + return false; } + + Extensions3D* extensions = m_context->getExtensions(); + ASSERT(extensions); - m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_destTexture); - m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, newContextSize.width(), newContextSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE); + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFrameBuffer); + + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleRenderBuffer); + extensions->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, Extensions3D::RGBA8_OES, newContextSize.width(), newContextSize.height()); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleRenderBuffer); + + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleDepthBuffer); + extensions->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, GraphicsContext3D::DEPTH_COMPONENT16, newContextSize.width(), newContextSize.height()); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_multisampleDepthBuffer); + + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0); + + if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { + deleteMultisampleRenderBuffers(); + return false; + } + + return true; +} + +bool FECustomFilter::resizeContextIfNeeded(const IntSize& newContextSize) +{ + if (newContextSize.isEmpty()) + return false; + if (m_contextSize == newContextSize) + return true; + + int maxTextureSize = 0; + m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &maxTextureSize); + if (newContextSize.height() > maxTextureSize || newContextSize.width() > maxTextureSize) + return false; + + return resizeContext(newContextSize); +} + +bool FECustomFilter::resizeContext(const IntSize& newContextSize) +{ + bool multisample = resizeMultisampleBuffers(newContextSize); m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_frameBuffer); + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_destTexture); + // We are going to clear the output buffer anyway, so we can safely initialize the destination texture with garbage data. +#if PLATFORM(CHROMIUM) + // FIXME: GraphicsContext3D::texImage2DDirect is not implemented on Chromium. + m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, newContextSize.width(), newContextSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0); +#else + m_context->texImage2DDirect(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, newContextSize.width(), newContextSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0); +#endif m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_destTexture, 0); - - m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthBuffer); - m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, newContextSize.width(), newContextSize.height()); - m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + + // We don't need the depth buffer for the texture framebuffer, if we already + // have a multisample buffer. + if (!multisample) { + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, newContextSize.width(), newContextSize.height()); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + } + + if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) + return false; + + if (multisample) { + // Clear the framebuffer first, otherwise the first blit will fail. + m_context->clearColor(0, 0, 0, 0); + m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); + } + + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0); m_contextSize = newContextSize; + return true; } void FECustomFilter::bindVertexAttribute(int attributeLocation, unsigned size, unsigned offset) @@ -261,6 +445,17 @@ void FECustomFilter::unbindVertexAttribute(int attributeLocation) m_context->disableVertexAttribArray(attributeLocation); } +void FECustomFilter::bindProgramArrayParameters(int uniformLocation, CustomFilterArrayParameter* arrayParameter) +{ + unsigned parameterSize = arrayParameter->size(); + Vector<GC3Dfloat> floatVector; + + for (unsigned i = 0; i < parameterSize; ++i) + floatVector.append(arrayParameter->valueAt(i)); + + m_context->uniform1fv(uniformLocation, parameterSize, floatVector.data()); +} + void FECustomFilter::bindProgramNumberParameters(int uniformLocation, CustomFilterNumberParameter* numberParameter) { switch (numberParameter->size()) { @@ -312,6 +507,9 @@ void FECustomFilter::bindProgramParameters() if (uniformLocation == -1) continue; switch (parameter->parameterType()) { + case CustomFilterParameter::ARRAY: + bindProgramArrayParameters(uniformLocation, static_cast<CustomFilterArrayParameter*>(parameter)); + break; case CustomFilterParameter::NUMBER: bindProgramNumberParameters(uniformLocation, static_cast<CustomFilterNumberParameter*>(parameter)); break; @@ -322,24 +520,24 @@ void FECustomFilter::bindProgramParameters() } } -void FECustomFilter::bindProgramAndBuffers(Uint8ClampedArray* srcPixelArray) +void FECustomFilter::bindProgramAndBuffers(Platform3DObject inputTexture) { ASSERT(m_compiledProgram->isInitialized()); m_context->useProgram(m_compiledProgram->program()); - if (m_compiledProgram->samplerLocation() != -1) { + if (programNeedsInputTexture()) { // We should be binding the DOM element texture sampler only if the author is using the CSS mix function. ASSERT(m_validatedProgram->programInfo().programType() == PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE); + ASSERT(m_compiledProgram->samplerLocation() != -1); m_context->activeTexture(GraphicsContext3D::TEXTURE0); m_context->uniform1i(m_compiledProgram->samplerLocation(), 0); -#if !PLATFORM(BLACKBERRY) - m_inputTexture->load(srcPixelArray->data()); - m_inputTexture->bindTile(0); -#else - notImplemented(); -#endif + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, inputTexture); + m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); + m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); + m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); + m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE); } if (m_compiledProgram->projectionMatrixLocation() != -1) { @@ -349,6 +547,24 @@ void FECustomFilter::bindProgramAndBuffers(Uint8ClampedArray* srcPixelArray) projectionMatrix.toColumnMajorFloatArray(glProjectionMatrix); m_context->uniformMatrix4fv(m_compiledProgram->projectionMatrixLocation(), 1, false, &glProjectionMatrix[0]); } + + ASSERT(m_meshColumns); + ASSERT(m_meshRows); + + if (m_compiledProgram->meshSizeLocation() != -1) + m_context->uniform2f(m_compiledProgram->meshSizeLocation(), m_meshColumns, m_meshRows); + + if (m_compiledProgram->tileSizeLocation() != -1) + m_context->uniform2f(m_compiledProgram->tileSizeLocation(), 1.0 / m_meshColumns, 1.0 / m_meshRows); + + if (m_compiledProgram->meshBoxLocation() != -1) { + // FIXME: This will change when filter margins will be implemented, + // see https://bugs.webkit.org/show_bug.cgi?id=71400 + m_context->uniform4f(m_compiledProgram->meshBoxLocation(), -0.5, -0.5, 1.0, 1.0); + } + + if (m_compiledProgram->samplerSizeLocation() != -1) + m_context->uniform2f(m_compiledProgram->samplerSizeLocation(), m_contextSize.width(), m_contextSize.height()); m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_mesh->verticesBufferObject()); m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, m_mesh->elementsBufferObject()); diff --git a/Source/WebCore/platform/graphics/filters/FECustomFilter.h b/Source/WebCore/platform/graphics/filters/FECustomFilter.h index 96bb9185e..e4a2e41d3 100644 --- a/Source/WebCore/platform/graphics/filters/FECustomFilter.h +++ b/Source/WebCore/platform/graphics/filters/FECustomFilter.h @@ -45,6 +45,7 @@ class Uint8ClampedArray; namespace WebCore { class CachedShader; +class CustomFilterArrayParameter; class CustomFilterCompiledProgram; class CustomFilterGlobalContext; class CustomFilterMesh; @@ -55,7 +56,6 @@ class CustomFilterValidatedProgram; class DrawingBuffer; class GraphicsContext3D; class IntSize; -class Texture; class FECustomFilter : public FilterEffect { public: @@ -77,30 +77,57 @@ private: bool applyShader(); void clearShaderResult(); bool initializeContext(); + + enum CustomFilterDrawType { + NEEDS_INPUT_TEXTURE, + NO_INPUT_TEXTURE + }; + bool prepareForDrawing(CustomFilterDrawType = NEEDS_INPUT_TEXTURE); + + void drawFilterMesh(Platform3DObject inputTexture); + bool programNeedsInputTexture() const; + bool ensureInputTexture(); + void uploadInputTexture(Uint8ClampedArray* srcPixelArray); + bool resizeContextIfNeeded(const IntSize&); + bool resizeContext(const IntSize&); + + bool canUseMultisampleBuffers() const; + bool createMultisampleBuffer(); + bool resizeMultisampleBuffers(const IntSize&); + void resolveMultisampleBuffer(); + void deleteMultisampleRenderBuffers(); + + bool ensureFrameBuffer(); void deleteRenderBuffers(); - void resizeContext(const IntSize& newContextSize); + void bindVertexAttribute(int attributeLocation, unsigned size, unsigned offset); void unbindVertexAttribute(int attributeLocation); + void bindProgramArrayParameters(int uniformLocation, CustomFilterArrayParameter*); void bindProgramNumberParameters(int uniformLocation, CustomFilterNumberParameter*); void bindProgramTransformParameter(int uniformLocation, CustomFilterTransformParameter*); void bindProgramParameters(); - void bindProgramAndBuffers(Uint8ClampedArray* srcPixelArray); + void bindProgramAndBuffers(Platform3DObject inputTexture); void unbindVertexAttributes(); // No need to keep a reference here. It is owned by the RenderView. CustomFilterGlobalContext* m_globalContext; RefPtr<GraphicsContext3D> m_context; - RefPtr<Texture> m_inputTexture; RefPtr<CustomFilterValidatedProgram> m_validatedProgram; RefPtr<CustomFilterCompiledProgram> m_compiledProgram; RefPtr<CustomFilterMesh> m_mesh; IntSize m_contextSize; + Platform3DObject m_inputTexture; Platform3DObject m_frameBuffer; Platform3DObject m_depthBuffer; Platform3DObject m_destTexture; + bool m_triedMultisampleBuffer; + Platform3DObject m_multisampleFrameBuffer; + Platform3DObject m_multisampleRenderBuffer; + Platform3DObject m_multisampleDepthBuffer; + RefPtr<CustomFilterProgram> m_program; CustomFilterParameterList m_parameters; diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp index 429da5410..7188c88d7 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -635,7 +635,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() m_afterExpansion = false; // Account for word-spacing. - if (treatAsSpace && characterIndex > 0 && !Font::treatAsSpace(m_run[characterIndex - 1]) && m_font.wordSpacing()) + if (treatAsSpace && (ch != '\t' || !m_run.allowTabs()) && (characterIndex > 0 || r > 0) && m_font.wordSpacing()) advance.width += m_font.wordSpacing(); } else m_afterExpansion = false; diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h index d508a7684..a70eaa7cd 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h @@ -29,11 +29,17 @@ #include "Extensions3DOpenGLCommon.h" +#if PLATFORM(QT) +// Takes care of declaring the GLES extensions. +#include <qopengl.h> +#else #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> +#endif -#if OS(QNX) +#if OS(QNX) || PLATFORM(QT) // See https://bugs.webkit.org/show_bug.cgi?id=91030. +// Newer Khorons headers do define these with a PROC suffix, but older headers don't. #define PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC #define PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC #endif diff --git a/Source/WebCore/platform/gtk/GamepadsGtk.cpp b/Source/WebCore/platform/gtk/GamepadsGtk.cpp index f8a73f4e6..af9609dd0 100644 --- a/Source/WebCore/platform/gtk/GamepadsGtk.cpp +++ b/Source/WebCore/platform/gtk/GamepadsGtk.cpp @@ -91,7 +91,7 @@ gboolean GamepadDeviceGtk::readCallback(GObject* pollableStream, gpointer data) if (error) return g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); - ASSERT(len == sizeof(event)); + ASSERT_UNUSED(len, len == sizeof(event)); gamepadDevice->updateForEvent(event); return TRUE; } diff --git a/Source/WebCore/platform/network/ResourceRequestBase.cpp b/Source/WebCore/platform/network/ResourceRequestBase.cpp index b8193f02f..00f583905 100644 --- a/Source/WebCore/platform/network/ResourceRequestBase.cpp +++ b/Source/WebCore/platform/network/ResourceRequestBase.cpp @@ -447,13 +447,13 @@ bool ResourceRequestBase::isConditional() const void ResourceRequestBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Loader); - info.addInstrumentedMember(m_url); - info.addInstrumentedMember(m_firstPartyForCookies); - info.addInstrumentedMember(m_httpMethod); + info.addMember(m_url); + info.addMember(m_firstPartyForCookies); + info.addMember(m_httpMethod); info.addHashMap(m_httpHeaderFields); info.addInstrumentedMapEntries(m_httpHeaderFields); info.addInstrumentedVector(m_responseContentDispositionEncodingFallbackArray); - info.addInstrumentedMember(m_httpBody); + info.addMember(m_httpBody); } double ResourceRequestBase::defaultTimeoutInterval() diff --git a/Source/WebCore/platform/network/ResourceResponseBase.cpp b/Source/WebCore/platform/network/ResourceResponseBase.cpp index 623524515..2521fb12e 100644 --- a/Source/WebCore/platform/network/ResourceResponseBase.cpp +++ b/Source/WebCore/platform/network/ResourceResponseBase.cpp @@ -571,11 +571,11 @@ void ResourceResponseBase::lazyInit(InitLevel initLevel) const void ResourceResponseBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Loader); - info.addInstrumentedMember(m_url); - info.addInstrumentedMember(m_mimeType); - info.addInstrumentedMember(m_textEncodingName); - info.addInstrumentedMember(m_suggestedFilename); - info.addInstrumentedMember(m_httpStatusText); + info.addMember(m_url); + info.addMember(m_mimeType); + info.addMember(m_textEncodingName); + info.addMember(m_suggestedFilename); + info.addMember(m_httpStatusText); info.addHashMap(m_httpHeaderFields); info.addInstrumentedMapEntries(m_httpHeaderFields); info.addMember(m_resourceLoadTiming); diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp b/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp index dbab969e8..55ce3c375 100644 --- a/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp +++ b/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp @@ -22,6 +22,7 @@ #include "BlackBerryPlatformAssert.h" #include "libxml/parser.h" #include "libxml/xmlwriter.h" +#include <wtf/text/StringBuilder.h> namespace WebCore { @@ -231,7 +232,7 @@ String RSSAtomParser::parseContent(const String& base, xmlNode* node) BLACKBERRY_ASSERT(node); // Why does Blackberry have its own RSS parser? - // FIXME: content should be a StringBuilder. + String content; String type = "default"; String src; @@ -248,9 +249,10 @@ String RSSAtomParser::parseContent(const String& base, xmlNode* node) if (!src.isEmpty()) { if (isRelativePath(src)) src = base + "/" + src; - content += "<a href=\""; - content += src + "\">" + src + "</a>"; - return content; + StringBuilder builder; + builder.appendLiteral("<a href=\""); + builder.append(src + "\">" + src + "</a>"); + return builder.toString(); } if (type == "text" || type.startsWith("text/")) @@ -263,14 +265,16 @@ String RSSAtomParser::parseContent(const String& base, xmlNode* node) if (cur && cur->type == XML_ELEMENT_NODE) { // Encoding of buffer is utf-8. xmlNodeDump(buffer, cur->doc, cur, 0, 0); + StringBuilder builder; if (!base.isEmpty()) { - content += "<base href='"; - content += m_url.baseAsString(); - content += "/"; - content += base; - content += "/' />"; + builder.appendLiteral("<base href='"); + builder.append(m_url.baseAsString()); + builder.appendLiteral("/"); + builder.append(base); + builder.appendLiteral("/' />"); } - content += (const char*)xmlBufferContent(buffer); + builder.append((const char*)xmlBufferContent(buffer)); + content = builder.toString(); } xmlBufferFree(buffer); } else if (type.endsWith("+xml") || type.endsWith("/xml")) @@ -300,9 +304,9 @@ String RSSAtomParser::parseAuthor(xmlNode* node) } if (!email.isEmpty()) { - username += " ("; - username += email; - username += ")"; + username = username + " ("; + username = username + email; + username = username + ")"; } return username; diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp b/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp index 6f1f842a4..3c18992c3 100644 --- a/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp +++ b/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp @@ -23,6 +23,7 @@ #include "RSSParserBase.h" #include <wtf/text/CString.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { @@ -39,131 +40,131 @@ RSSGenerator::~RSSGenerator() String RSSGenerator::generateHtml(RSSFeed* feed) { - String rc; - rc += "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />"; - rc += "<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable= no\">"; - rc += "<title>"; + StringBuilder builder; + builder.appendLiteral("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />"); + builder.appendLiteral("<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable= no\">"); + builder.appendLiteral("<title>"); if (!feed->m_title.isEmpty()) - rc += feed->m_title; + builder.append(feed->m_title); else if (!feed->m_link.isEmpty()) - rc += feed->m_link; + builder.append(feed->m_link); else - rc += s_defaultFeedTitle; + builder.append(s_defaultFeedTitle); - rc += "</title></head><body>"; + builder.appendLiteral("</title></head><body>"); - rc += "<h2>"; + builder.appendLiteral("<h2>"); if (!feed->m_link.isEmpty()) { - rc += "<a href=\""; - rc += feed->m_link; - rc += "\">"; + builder.appendLiteral("<a href=\""); + builder.append(feed->m_link); + builder.appendLiteral("\">"); } if (!feed->m_title.isEmpty()) - rc += feed->m_title; + builder.append(feed->m_title); else - rc += s_defaultFeedTitle; + builder.append(s_defaultFeedTitle); if (!feed->m_link.isEmpty()) - rc += "</a>"; + builder.appendLiteral("</a>"); - rc += "</h2>"; + builder.appendLiteral("</h2>"); if (!feed->m_description.isEmpty()) { - rc += "<p>"; - rc += feed->m_description; - rc += "</p>"; + builder.appendLiteral("<p>"); + builder.append(feed->m_description); + builder.appendLiteral("</p>"); } for (unsigned i = 0; i < feed->m_items.size(); ++i) { RSSItem* item = feed->m_items[i]; String articleName; - rc += "<div id=\""; - rc += articleName; - rc += "\" class=\"article\">\n<a href=\""; + builder.appendLiteral("<div id=\""); + builder.append(articleName); + builder.appendLiteral("\" class=\"article\">\n<a href=\""); if (!item->m_link.isEmpty()) - rc += item->m_link.utf8(true).data(); - rc += "\"><b>"; + builder.append(item->m_link.utf8(true).data()); + builder.appendLiteral("\"><b>"); if (!item->m_title.isEmpty()) - rc += item->m_title.utf8(true).data(); + builder.append(item->m_title.utf8(true).data()); else - rc += s_defaultEntryTitle; - rc += "</b></a>\n<br />"; + builder.append(s_defaultEntryTitle); + builder.appendLiteral("</b></a>\n<br />"); if (!item->m_author.isEmpty()) { - rc += i18n("By"); - rc += " <b>"; - rc += item->m_author.utf8(true).data(); - rc += "</b> "; + builder.append(i18n("By")); + builder.appendLiteral(" <b>"); + builder.append(item->m_author.utf8(true).data()); + builder.appendLiteral("</b> "); } else { if (!feed->m_author.isEmpty()) { - rc += i18n("By"); - rc += " <b>"; - rc += feed->m_author.utf8(true).data(); - rc += "</b> "; + builder.append(i18n("By")); + builder.appendLiteral(" <b>"); + builder.append(feed->m_author.utf8(true).data()); + builder.appendLiteral("</b> "); } } if (!item->m_categories.isEmpty()) { if (!item->m_author.isEmpty()) - rc += i18n("under "); + builder.append(i18n("under ")); else - rc += i18n("Under "); + builder.append(i18n("Under ")); for (unsigned i = 0; i < item->m_categories.size() ; ++i) { - rc += "<b>"; - rc += item->m_categories[i].utf8(true).data(); - rc += "</b>"; + builder.appendLiteral("<b>"); + builder.append(item->m_categories[i].utf8(true).data()); + builder.appendLiteral("</b>"); if (i < item->m_categories.size() - 1) - rc += ", "; + builder.appendLiteral(", "); } } - rc += "<br />"; + builder.appendLiteral("<br />"); if (!item->m_pubDate.isEmpty()) - rc += item->m_pubDate.utf8(true).data(); + builder.append(item->m_pubDate.utf8(true).data()); - rc += "<br />"; + builder.appendLiteral("<br />"); if (!item->m_description.isEmpty()) - rc += item->m_description.utf8(true).data(); - rc += "<br />"; + builder.append(item->m_description.utf8(true).data()); + builder.appendLiteral("<br />"); if (item->m_enclosure) { - rc += "<br />"; - rc += "<a href=\""; - rc += item->m_enclosure->m_url; - rc += "\">"; - rc += i18n("Embedded "); + builder.appendLiteral("<br />"); + builder.appendLiteral("<a href=\""); + builder.append(item->m_enclosure->m_url); + builder.appendLiteral("\">"); + builder.append(i18n("Embedded ")); RSSEnclosure::Type type = item->m_enclosure->typeInEnum(); switch (type) { case RSSEnclosure::TypeImage: - rc += i18n("Image"); + builder.append(i18n("Image")); break; case RSSEnclosure::TypeAudio: - rc += i18n("Audio"); + builder.append(i18n("Audio")); break; case RSSEnclosure::TypeVideo: - rc += i18n("Video"); + builder.append(i18n("Video")); break; case RSSEnclosure::TypeApplication: default: - rc += i18n("Unknown Content"); + builder.append(i18n("Unknown Content")); break; } - rc += i18n(" Source: "); - rc += item->m_enclosure->suggestedName(); - rc += "</a><br /><br />"; + builder.append(i18n(" Source: ")); + builder.append(item->m_enclosure->suggestedName()); + builder.appendLiteral("</a><br /><br />"); } - rc += "<br /></div>\n"; + builder.appendLiteral("<br /></div>\n"); } - rc += "</body></html>\n"; + builder.appendLiteral("</body></html>\n"); - return rc; + return builder.toString(); } } // namespace WebCore diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp b/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp index e0a9d1af4..2421e38c8 100644 --- a/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp +++ b/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp @@ -21,6 +21,7 @@ #include "libxml/parser.h" #include "libxml/xmlwriter.h" +#include <wtf/text/StringBuilder.h> namespace WebCore { @@ -110,14 +111,14 @@ String textFromXMLAttr(xmlAttr* attr) if (!attr) return emptyString(); - String text; + StringBuilder text; for (xmlNode* node = attr->children; node; node = node->next) { if (node->type == XML_TEXT_NODE) - text += reinterpret_cast<const char*>(node->content); + text.append(reinterpret_cast<const char*>(node->content)); } - return text.stripWhiteSpace(); + return text.toString().stripWhiteSpace(); } String textFromXMLNode(xmlNode* node) @@ -125,14 +126,14 @@ String textFromXMLNode(xmlNode* node) if (!node) return emptyString(); - String text; + StringBuilder text; for (node = node->children; node; node = node->next) { if ((node->type == XML_TEXT_NODE) || (node->type == XML_CDATA_SECTION_NODE)) - text += reinterpret_cast<const char*>(node->content); + text.append(reinterpret_cast<const char*>(node->content)); } - return text.stripWhiteSpace(); + return text.toString().stripWhiteSpace(); } } // namespace WebCore diff --git a/Source/WebCore/platform/qt/UserAgentQt.cpp b/Source/WebCore/platform/qt/UserAgentQt.cpp index 7329a8314..3dcf879b2 100644 --- a/Source/WebCore/platform/qt/UserAgentQt.cpp +++ b/Source/WebCore/platform/qt/UserAgentQt.cpp @@ -22,13 +22,13 @@ #include "UserAgentQt.h" -#include <QCoreApplication> +#include <QGuiApplication> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> -#if defined Q_OS_WIN32 +#if OS(WINDOWS) #include <SystemInfo.h> -#endif // Q_OS_WIN32 +#endif // OS(WINDOWS) namespace WebCore { @@ -62,19 +62,16 @@ String UserAgentQt::standardUserAgent(const String &applicationNameForUserAgent, // Platform. ua = ua.arg(QLatin1String( -#ifdef Q_WS_MAC +#if OS(MAC_OS_X) "Macintosh; " -#elif defined Q_WS_QWS - "QtEmbedded; " -#elif defined Q_WS_WIN - // Nothing. -#elif defined Q_WS_X11 - "X11; " +#elif OS(WINDOWS) + "" #else - "Unknown; " + (QGuiApplication::platformName() == QLatin1String("xcb")) ? "X11; " : "Unknown; " #endif )); + // Security strength. QString securityStrength; #if defined(QT_NO_OPENSSL) @@ -84,82 +81,48 @@ String UserAgentQt::standardUserAgent(const String &applicationNameForUserAgent, // Operating system. ua = ua.arg(QLatin1String( -#ifdef Q_OS_AIX +#if OS(AIX) "AIX" -#elif defined Q_OS_WIN32 +#elif OS(WINDOWS) windowsVersionForUAString().latin1().data() -#elif defined Q_OS_DARWIN -#ifdef __i386__ || __x86_64__ +#elif OS(MAC_OS_X) +#if CPU(X86) || CPU(X86_64) "Intel Mac OS X" #else "PPC Mac OS X" #endif -#elif defined Q_OS_BSDI - "BSD" -#elif defined Q_OS_BSD4 - "BSD Four" -#elif defined Q_OS_CYGWIN - "Cygwin" -#elif defined Q_OS_DGUX - "DG/UX" -#elif defined Q_OS_DYNIX - "DYNIX/ptx" -#elif defined Q_OS_FREEBSD +#elif OS(FREEBSD) "FreeBSD" -#elif defined Q_OS_HPUX - "HP-UX" -#elif defined Q_OS_HURD +#elif OS(HURD) "GNU Hurd" -#elif defined Q_OS_IRIX - "SGI Irix" -#elif defined Q_OS_LINUX +#elif OS(LINUX) -#if defined(__x86_64__) +#if CPU(X86_64) "Linux x86_64" -#elif defined(__i386__) +#elif CPU(X86) "Linux i686" #else "Linux" #endif -#elif defined Q_OS_LYNX - "LynxOS" -#elif defined Q_OS_NETBSD +#elif OS(NETBSD) "NetBSD" -#elif defined Q_OS_OS2 - "OS/2" -#elif defined Q_OS_OPENBSD +#elif OS(OPENBSD) "OpenBSD" -#elif defined Q_OS_OS2EMX - "OS/2" -#elif defined Q_OS_OSF - "HP Tru64 UNIX" -#elif defined Q_OS_QNX6 - "QNX RTP Six" -#elif defined Q_OS_QNX +#elif OS(QNX) "QNX" -#elif defined Q_OS_RELIANT - "Reliant UNIX" -#elif defined Q_OS_SCO - "SCO OpenServer" -#elif defined Q_OS_SOLARIS +#elif OS(SOLARIS) "Sun Solaris" -#elif defined Q_OS_ULTRIX - "DEC Ultrix" -#elif defined Q_OS_UNIX +#elif OS(UNIX) // FIXME Looks like all unix variants above are the only cases where OS_UNIX is set. "UNIX BSD/SYSV system" -#elif defined Q_OS_UNIXWARE - "UnixWare Seven, Open UNIX Eight" #else "Unknown" #endif )); // WebKit version. - // FIXME "+" in the version string? - QString version = QString(QLatin1String("%1.%2")).arg(QString::number(webkitMajorVersion), - QString::number(webkitMinorVersion)); + QString version = QString::number(webkitMajorVersion) + QLatin1Char('.') + QString::number(webkitMinorVersion); ua = ua.arg(version, version); } diff --git a/Source/WebCore/plugins/PluginViewBase.h b/Source/WebCore/plugins/PluginViewBase.h index 312d57c09..fc7e98efd 100644 --- a/Source/WebCore/plugins/PluginViewBase.h +++ b/Source/WebCore/plugins/PluginViewBase.h @@ -49,6 +49,7 @@ public: #endif virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; } + virtual void storageBlockingStateChanged() { } virtual void privateBrowsingStateChanged(bool) { } virtual bool getFormValue(String&) { return false; } virtual bool scroll(ScrollDirection, ScrollGranularity) { return false; } diff --git a/Source/WebCore/rendering/ClipPathOperation.h b/Source/WebCore/rendering/ClipPathOperation.h new file mode 100644 index 000000000..c469d6df8 --- /dev/null +++ b/Source/WebCore/rendering/ClipPathOperation.h @@ -0,0 +1,104 @@ +/* + * 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 ClipPathOperation_h +#define ClipPathOperation_h + +#include "BasicShapes.h" +#include "Path.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class ClipPathOperation : public RefCounted<ClipPathOperation> { +public: + enum OperationType { + // FIXME: Add referencing for IRI https://bugs.webkit.org/show_bug.cgi?id=96381 + SHAPE + }; + + virtual ~ClipPathOperation() { } + + virtual bool operator==(const ClipPathOperation&) const = 0; + bool operator!=(const ClipPathOperation& o) const { return !(*this == o); } + + virtual OperationType getOperationType() const { return m_type; } + virtual bool isSameType(const ClipPathOperation& o) const { return o.getOperationType() == m_type; } + +protected: + ClipPathOperation(OperationType type) + : m_type(type) + { + } + + OperationType m_type; +}; + +class ShapeClipPathOperation : public ClipPathOperation { +public: + static PassRefPtr<ShapeClipPathOperation> create(PassRefPtr<BasicShape> shape) + { + return adoptRef(new ShapeClipPathOperation(shape)); + } + + const BasicShape* basicShape() const { return m_shape.get(); } + WindRule windRule() const { return m_shape->windRule(); } + const Path& path(const FloatRect& boundingRect) + { + ASSERT(m_shape); + m_path.clear(); + m_path = adoptPtr(new Path); + m_shape->path(*m_path, boundingRect); + return *m_path; + } + +private: + virtual bool operator==(const ClipPathOperation& o) const + { + if (!isSameType(o)) + return false; + const ShapeClipPathOperation* other = static_cast<const ShapeClipPathOperation*>(&o); + return m_shape == other->m_shape; + } + + ShapeClipPathOperation(PassRefPtr<BasicShape> shape) + : ClipPathOperation(SHAPE) + , m_shape(shape) + { + } + + RefPtr<BasicShape> m_shape; + OwnPtr<Path> m_path; +}; +} + +#endif // ClipPathOperation_h diff --git a/Source/WebCore/rendering/FlowThreadController.cpp b/Source/WebCore/rendering/FlowThreadController.cpp index 9edd0aa7e..cb4bdb1f2 100644 --- a/Source/WebCore/rendering/FlowThreadController.cpp +++ b/Source/WebCore/rendering/FlowThreadController.cpp @@ -49,6 +49,7 @@ FlowThreadController::FlowThreadController(RenderView* view) : m_view(view) , m_currentRenderFlowThread(0) , m_isRenderNamedFlowThreadOrderDirty(false) + , m_autoLogicalHeightRegionsCount(0) { } @@ -98,6 +99,8 @@ void FlowThreadController::layoutRenderNamedFlowThreads() { ASSERT(m_renderNamedFlowThreadList); + ASSERT(isAutoLogicalHeightRegionsFlagConsistent()); + // Remove the left-over flow threads. RenderNamedFlowThreadList toRemoveList; for (RenderNamedFlowThreadList::iterator iter = m_renderNamedFlowThreadList->begin(); iter != m_renderNamedFlowThreadList->end(); ++iter) { @@ -156,4 +159,21 @@ void FlowThreadController::unregisterNamedFlowContentNode(Node* contentNode) m_mapNamedFlowContentNodes.remove(contentNode); } +#ifndef NDEBUG +bool FlowThreadController::isAutoLogicalHeightRegionsFlagConsistent() const +{ + if (!hasRenderNamedFlowThreads()) + return !hasAutoLogicalHeightRegions(); + + // Count the number of auto height regions + unsigned autoLogicalHeightRegions = 0; + for (RenderNamedFlowThreadList::iterator iter = m_renderNamedFlowThreadList->begin(); iter != m_renderNamedFlowThreadList->end(); ++iter) { + RenderNamedFlowThread* flowRenderer = *iter; + autoLogicalHeightRegions += flowRenderer->autoLogicalHeightRegionsCount(); + } + + return autoLogicalHeightRegions == m_autoLogicalHeightRegionsCount; +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/rendering/FlowThreadController.h b/Source/WebCore/rendering/FlowThreadController.h index ae6237d2d..84486f4b2 100644 --- a/Source/WebCore/rendering/FlowThreadController.h +++ b/Source/WebCore/rendering/FlowThreadController.h @@ -67,6 +67,14 @@ public: void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*); void unregisterNamedFlowContentNode(Node*); + bool hasAutoLogicalHeightRegions() const { return m_autoLogicalHeightRegionsCount; } + void incrementAutoLogicalHeightRegions() { ++m_autoLogicalHeightRegionsCount; } + void decrementAutoLogicalHeightRegions() { ASSERT(m_autoLogicalHeightRegionsCount > 0); --m_autoLogicalHeightRegionsCount; } + +#ifndef NDEBUG + bool isAutoLogicalHeightRegionsFlagConsistent() const; +#endif + protected: FlowThreadController(RenderView*); @@ -74,6 +82,7 @@ private: RenderView* m_view; RenderFlowThread* m_currentRenderFlowThread; bool m_isRenderNamedFlowThreadOrderDirty; + unsigned m_autoLogicalHeightRegionsCount; OwnPtr<RenderNamedFlowThreadList> m_renderNamedFlowThreadList; // maps a content node to its render flow thread. HashMap<Node*, RenderNamedFlowThread*> m_mapNamedFlowContentNodes; diff --git a/Source/WebCore/rendering/HitTestRequest.h b/Source/WebCore/rendering/HitTestRequest.h index 3faf88a9f..d937c2504 100644 --- a/Source/WebCore/rendering/HitTestRequest.h +++ b/Source/WebCore/rendering/HitTestRequest.h @@ -35,10 +35,7 @@ public: IgnoreClipping = 1 << 5, SVGClipContent = 1 << 6, TouchEvent = 1 << 7, - AllowShadowContent = 1 << 8, - AllowChildFrameContent = 1 << 9, - ChildFrameHitTest = 1 << 10, - TestChildFrameScrollBars = 1 << 11 + AllowShadowContent = 1 << 8 }; typedef unsigned HitTestRequestType; @@ -57,9 +54,6 @@ public: bool touchEvent() const { return m_requestType & TouchEvent; } bool mouseEvent() const { return !touchEvent(); } bool allowsShadowContent() const { return m_requestType & AllowShadowContent; } - bool allowsChildFrameContent() const { return m_requestType & AllowChildFrameContent; } - bool isChildFrameHitTest() const { return m_requestType & ChildFrameHitTest; } - bool shouldTestChildFrameScrollBars() const { return m_requestType & TestChildFrameScrollBars; } // Convenience functions bool touchMove() const { return move() && touchEvent(); } diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp index 8063c812e..cc390568c 100644 --- a/Source/WebCore/rendering/HitTestResult.cpp +++ b/Source/WebCore/rendering/HitTestResult.cpp @@ -104,7 +104,7 @@ HitTestLocation::HitTestLocation(const HitTestLocation& other, const LayoutSize& , m_boundingBox(other.m_boundingBox) , m_transformedPoint(other.m_transformedPoint) , m_transformedRect(other.m_transformedRect) - , m_region(region ? region : other.m_region) + , m_region(region) , m_isRectBased(other.m_isRectBased) , m_isRectilinear(other.m_isRectilinear) { diff --git a/Source/WebCore/rendering/HitTestResult.h b/Source/WebCore/rendering/HitTestResult.h index bac96a2b1..9129eed44 100644 --- a/Source/WebCore/rendering/HitTestResult.h +++ b/Source/WebCore/rendering/HitTestResult.h @@ -55,7 +55,7 @@ public: // Pass non-zero padding values to perform a rect-based hit test. HitTestLocation(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); // Make a copy the HitTestLocation in a new region by applying given offset to internal point and area. - HitTestLocation(const HitTestLocation&, const LayoutSize& offset, RenderRegion* = 0); + HitTestLocation(const HitTestLocation&, const LayoutSize& offset, RenderRegion*); HitTestLocation(const HitTestLocation&); ~HitTestLocation(); HitTestLocation& operator=(const HitTestLocation&); diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 198f37e91..abed66220 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -1394,20 +1394,45 @@ void RenderBlock::updateWrapShapeInfoAfterStyleChange(const BasicShape* wrapShap } #endif -void RenderBlock::computeInitialRegionRangeForBlock() +void RenderBlock::updateRegionsAndExclusionsLogicalSize() { - if (inRenderFlowThread()) { - // Set our start and end regions. No regions above or below us will be considered by our children. They are - // effectively clamped to our region range. - LayoutUnit oldHeight = logicalHeight(); - LayoutUnit oldLogicalTop = logicalTop(); - setLogicalHeight(MAX_LAYOUT_UNIT / 2); - updateLogicalHeight(); - enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage()); - setLogicalHeight(oldHeight); - setLogicalTop(oldLogicalTop); +#if ENABLE(CSS_EXCLUSIONS) + if (!inRenderFlowThread() && !wrapShapeInfo()) +#else + if (!inRenderFlowThread()) +#endif + return; + + LayoutUnit oldHeight = logicalHeight(); + LayoutUnit oldTop = logicalTop(); + + // Compute the maximum logical height content may cause this block to expand to + // FIXME: These should eventually use the const computeLogicalHeight rather than updateLogicalHeight + setLogicalHeight(MAX_LAYOUT_UNIT / 2); + updateLogicalHeight(); + +#if ENABLE(CSS_EXCLUSIONS) + computeExclusionShapeSize(); +#endif + + // Set our start and end regions. No regions above or below us will be considered by our children. They are + // effectively clamped to our region range. + computeRegionRangeForBlock(); + + setLogicalHeight(oldHeight); + setLogicalTop(oldTop); +} + +#if ENABLE(CSS_EXCLUSIONS) +void RenderBlock::computeExclusionShapeSize() +{ + WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo(); + if (wrapShapeInfo) { + bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvableFromBlock(this, false); + wrapShapeInfo->computeShapeSize(logicalWidth(), percentageLogicalHeightResolvable ? logicalHeight() : ZERO_LAYOUT_UNIT); } } +#endif void RenderBlock::computeRegionRangeForBlock() { @@ -1491,12 +1516,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh if (logicalWidthChangedInRegions()) relayoutChildren = true; } - computeInitialRegionRangeForBlock(); -#if ENABLE(CSS_EXCLUSIONS) - // FIXME: Bug 93547: Resolve logical height for percentage based vertical lengths - if (WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo()) - wrapShapeInfo->computeShapeSize(logicalWidth(), 0); -#endif + updateRegionsAndExclusionsLogicalSize(); // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track // our current maximal positive and negative margins. These values are used when we diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index a54a4b8e1..e3ed210de 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -491,13 +491,14 @@ protected: } #endif - void computeInitialRegionRangeForBlock(); + void updateRegionsAndExclusionsLogicalSize(); void computeRegionRangeForBlock(); virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight); private: #if ENABLE(CSS_EXCLUSIONS) + void computeExclusionShapeSize(); void updateWrapShapeInfoAfterStyleChange(const BasicShape*, const BasicShape* oldWrapShape); #endif virtual RenderObjectChildList* virtualChildren() { return children(); } @@ -715,6 +716,7 @@ private: RenderText* m_text; OwnPtr<TextLayout> m_layout; LazyLineBreakIterator m_lineBreakIterator; + const Font* m_font; }; class LineBreaker { diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index 6394a6db4..cbcc988aa 100755 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -1275,6 +1275,7 @@ void RenderBlock::layoutRunsAndFloats(LineLayoutState& layoutState, bool hasInli RenderBlock::RenderTextInfo::RenderTextInfo() : m_text(0) + , m_font(0) { } @@ -2436,9 +2437,14 @@ InlineIterator RenderBlock::LineBreaker::nextLineBreak(InlineBidiResolver& resol if (renderTextInfo.m_text != t) { t->updateTextIfNeeded(); renderTextInfo.m_text = t; + renderTextInfo.m_font = &f; renderTextInfo.m_layout = f.createLayout(t, width.currentWidth(), collapseWhiteSpace); renderTextInfo.m_lineBreakIterator.reset(t->characters(), t->textLength(), style->locale()); + } else if (renderTextInfo.m_layout && renderTextInfo.m_font != &f) { + renderTextInfo.m_font = &f; + renderTextInfo.m_layout = f.createLayout(t, width.currentWidth(), collapseWhiteSpace); } + TextLayout* textLayout = renderTextInfo.m_layout.get(); for (; current.m_pos < t->textLength(); current.fastIncrementInTextNode()) { diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 2c3375da0..a1a3c9922 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -2119,21 +2119,23 @@ LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heig return -1; } +bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const +{ + // For quirks mode and anonymous blocks, we skip auto-height containingBlocks when computing percentages. + // For standards mode, we treat the percentage as auto if it has an auto-height containing block. + if (!document()->inQuirksMode() && !containingBlock->isAnonymousBlock()) + return false; + return !containingBlock->isTableCell() && !containingBlock->isOutOfFlowPositioned() && containingBlock->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode(); +} + LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const { LayoutUnit availableHeight = -1; - // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing - // block that may have a specified height and then use it. In strict mode, this violates the - // specification, which states that percentage heights just revert to auto if the containing - // block has an auto height. We still skip anonymous containing blocks in both modes, though, and look - // only at explicit containers. bool skippedAutoHeightContainingBlock = false; RenderBlock* cb = containingBlock(); LayoutUnit rootMarginBorderPaddingHeight = 0; - while (!cb->isRenderView() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == cb->isHorizontalWritingMode()) { - if (!document()->inQuirksMode() && !cb->isAnonymousBlock()) - break; + while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation(cb)) { if (cb->isBody() || cb->isRoot()) rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfter() + cb->borderAndPaddingLogicalHeight(); skippedAutoHeightContainingBlock = true; @@ -2153,29 +2155,26 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) availableHeight = cb->contentLogicalWidth(); - else if (cb->isTableCell()) { + else if (cb->isTableCell() && !skippedAutoHeightContainingBlock) { // Table cells violate what the CSS spec says to do with heights. Basically we // don't care if the cell specified a height or not. We just always make ourselves // be a percentage of the cell's current content height. - if (!skippedAutoHeightContainingBlock) { - if (!cb->hasOverrideHeight()) { - // Normally we would let the cell size intrinsically, but scrolling overflow has to be - // treated differently, since WinIE lets scrolled overflow regions shrink as needed. - // While we can't get all cases right, we can at least detect when the cell has a specified - // height or when the table has a specified height. In these cases we want to initially have - // no size and allow the flexing of the table or the cell to its specified height to cause us - // to grow to fill the space. This could end up being wrong in some cases, but it is - // preferable to the alternative (sizing intrinsically and making the row end up too big). - RenderTableCell* cell = toRenderTableCell(cb); - if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto())) - return 0; - return -1; - } - availableHeight = cb->overrideLogicalContentHeight(); - includeBorderPadding = true; + if (!cb->hasOverrideHeight()) { + // Normally we would let the cell size intrinsically, but scrolling overflow has to be + // treated differently, since WinIE lets scrolled overflow regions shrink as needed. + // While we can't get all cases right, we can at least detect when the cell has a specified + // height or when the table has a specified height. In these cases we want to initially have + // no size and allow the flexing of the table or the cell to its specified height to cause us + // to grow to fill the space. This could end up being wrong in some cases, but it is + // preferable to the alternative (sizing intrinsically and making the row end up too big). + RenderTableCell* cell = toRenderTableCell(cb); + if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto())) + return 0; + return -1; } + availableHeight = cb->overrideLogicalContentHeight(); + includeBorderPadding = true; } else if (cbstyle->logicalHeight().isFixed()) { - // Otherwise we only use our percentage height if our containing block had a specified height. LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle->logicalHeight().value()); availableHeight = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { @@ -3727,16 +3726,22 @@ void RenderBox::clearLayoutOverflow() m_overflow->setLayoutOverflow(borderBoxRect()); } -static bool percentageLogicalHeightIsResolvable(const RenderBox* box) +inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) +{ + return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containingBlock(), box->isOutOfFlowPositioned()); +} + +bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) { // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing // block that may have a specified height and then use it. In strict mode, this violates the // specification, which states that percentage heights just revert to auto if the containing // block has an auto height. We still skip anonymous containing blocks in both modes, though, and look // only at explicit containers. - const RenderBlock* cb = box->containingBlock(); + const RenderBlock* cb = containingBlock; + bool inQuirksMode = cb->document()->inQuirksMode(); while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) { - if (!box->document()->inQuirksMode() && !cb->isAnonymousBlock()) + if (!inQuirksMode && !cb->isAnonymousBlock()) break; cb = cb->containingBlock(); } @@ -3758,10 +3763,10 @@ static bool percentageLogicalHeightIsResolvable(const RenderBox* box) if (cb->style()->logicalHeight().isFixed()) return true; if (cb->style()->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) - return percentageLogicalHeightIsResolvable(cb); - if (cb->isRenderView() || (cb->isBody() && box->document()->inQuirksMode()) || isOutOfFlowPositionedWithSpecifiedHeight) + return percentageLogicalHeightIsResolvableFromBlock(cb->containingBlock(), cb->isOutOfFlowPositioned()); + if (cb->isRenderView() || inQuirksMode || isOutOfFlowPositionedWithSpecifiedHeight) return true; - if (cb->isRoot() && box->isOutOfFlowPositioned()) { + if (cb->isRoot() && isOutOfFlowPositioned) { // Match the positioned objects behavior, which is that positioned objects will fill their viewport // always. Note we could only hit this case by recurring into computePercentageLogicalHeight on a positioned containing block. return true; diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 590875a8b..40dfe1539 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -399,6 +399,7 @@ public: virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const; virtual LayoutUnit computeReplacedLogicalHeight() const; + static bool percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool outOfFlowPositioned); LayoutUnit computePercentageLogicalHeight(const Length& height) const; // Block flows subclass availableWidth/Height to handle multi column layout (shrinking the width/height available to children when laying out.) @@ -583,6 +584,8 @@ private: // Returns true if we did a full repaint bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground); + + bool skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const; LayoutUnit containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = 0, bool checkForPerpendicularWritingMode = true) const; diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp index d6191b2e2..8f7151a47 100644 --- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp @@ -243,7 +243,7 @@ void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit) if (logicalWidthChangedInRegions()) relayoutChildren = true; } - computeInitialRegionRangeForBlock(); + updateRegionsAndExclusionsLogicalSize(); LayoutSize previousSize = size(); diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 85a5fe201..141769041 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -249,7 +249,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit) if (logicalWidthChangedInRegions()) relayoutChildren = true; } - computeInitialRegionRangeForBlock(); + updateRegionsAndExclusionsLogicalSize(); LayoutSize previousSize = size(); diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp index 82686117a..0741ea8c8 100644 --- a/Source/WebCore/rendering/RenderFlowThread.cpp +++ b/Source/WebCore/rendering/RenderFlowThread.cpp @@ -754,6 +754,25 @@ bool RenderFlowThread::objectInFlowRegion(const RenderObject* object, const Rend return false; } +#ifndef NDEBUG +unsigned RenderFlowThread::autoLogicalHeightRegionsCount() const +{ + unsigned autoLogicalHeightRegions = 0; + for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { + const RenderRegion* region = *iter; + if (!region->isValid()) { + ASSERT(!region->hasAutoLogicalHeight()); + continue; + } + + if (region->hasAutoLogicalHeight()) + autoLogicalHeightRegions++; + } + + return autoLogicalHeightRegions; +} +#endif + CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) : m_renderFlowThread(renderFlowThread) { diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h index 650097e57..d09183d95 100644 --- a/Source/WebCore/rendering/RenderFlowThread.h +++ b/Source/WebCore/rendering/RenderFlowThread.h @@ -131,6 +131,10 @@ public: bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } +#ifndef NDEBUG + unsigned autoLogicalHeightRegionsCount() const; +#endif + protected: virtual const char* renderName() const = 0; diff --git a/Source/WebCore/rendering/RenderFrameBase.cpp b/Source/WebCore/rendering/RenderFrameBase.cpp index da2dc5a12..aa82870d4 100644 --- a/Source/WebCore/rendering/RenderFrameBase.cpp +++ b/Source/WebCore/rendering/RenderFrameBase.cpp @@ -29,8 +29,6 @@ #include "Frame.h" #include "FrameView.h" #include "HTMLFrameElementBase.h" -#include "HitTestResult.h" -#include "RenderLayer.h" #include "RenderView.h" namespace WebCore { @@ -106,34 +104,4 @@ void RenderFrameBase::layoutWithFlattening(bool hasFixedWidth, bool hasFixedHeig setNeedsLayout(false); } -bool RenderFrameBase::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) -{ - if (request.allowsChildFrameContent()) { - FrameView* childFrameView = static_cast<FrameView*>(widget()); - RenderView* childRoot = childFrameView ? static_cast<RenderView*>(childFrameView->frame()->contentRenderer()) : 0; - - if (childRoot) { - LayoutPoint adjustedLocation = accumulatedOffset + location(); - LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset(); - HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset); - HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest); - - bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTestLocation, result); - if (isInsideChildFrame) - return true; - - if (request.shouldTestChildFrameScrollBars()) { - // ScrollView scrollbars are not the same as RenderLayer scrollbars tested by RenderLayer::hitTestOverflowControls, - // so we need to test ScrollView scrollbars separately here. - // FIXME: Consider if this test could be done unconditionally. - Scrollbar* frameScrollbar = childFrameView->scrollbarAtPoint(newHitTestLocation.roundedPoint()); - if (frameScrollbar) - result.setScrollbar(frameScrollbar); - } - } - } - - return RenderPart::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action); -} - } diff --git a/Source/WebCore/rendering/RenderFrameBase.h b/Source/WebCore/rendering/RenderFrameBase.h index a7deedab1..4fad560c5 100644 --- a/Source/WebCore/rendering/RenderFrameBase.h +++ b/Source/WebCore/rendering/RenderFrameBase.h @@ -36,7 +36,6 @@ protected: explicit RenderFrameBase(Element*); public: - virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; void layoutWithFlattening(bool fixedWidth, bool fixedHeight); }; diff --git a/Source/WebCore/rendering/RenderGrid.cpp b/Source/WebCore/rendering/RenderGrid.cpp index e282f7f41..6e293cc0c 100644 --- a/Source/WebCore/rendering/RenderGrid.cpp +++ b/Source/WebCore/rendering/RenderGrid.cpp @@ -71,7 +71,7 @@ void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit) if (logicalWidthChangedInRegions()) relayoutChildren = true; } - computeInitialRegionRangeForBlock(); + updateRegionsAndExclusionsLogicalSize(); LayoutSize previousSize = size(); diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 4daeecf93..a49544df1 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -3116,12 +3116,10 @@ void RenderLayer::paintLayerContents(RenderLayer* rootLayer, GraphicsContext* co // Apply clip-path to context. RenderStyle* style = renderer()->style(); if (renderer()->hasClipPath() && !context->paintingDisabled() && style) { - if (BasicShape* clipShape = style->clipPath()) { - // FIXME: Investigate if it is better to store and update a Path object in RenderStyle. - // https://bugs.webkit.org/show_bug.cgi?id=95619 - Path clipPath; - clipShape->path(clipPath, calculateLayerBounds(this, rootLayer, 0)); - transparencyLayerContext->clipPath(clipPath, clipShape->windRule()); + ASSERT(style->clipPath()); + if (style->clipPath()->getOperationType() == ClipPathOperation::SHAPE) { + ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(style->clipPath()); + transparencyLayerContext->clipPath(clipPath->path(calculateLayerBounds(this, rootLayer, 0)), clipPath->windRule()); } } @@ -3461,7 +3459,7 @@ bool RenderLayer::hitTest(const HitTestRequest& request, const HitTestLocation& // We didn't hit any layer. If we are the root layer and the mouse is -- or just was -- down, // return ourselves. We do this so mouse events continue getting delivered after a drag has // exited the WebView, and so hit testing over a scrollbar hits the content document. - if (!request.isChildFrameHitTest() && (request.active() || request.release()) && isRootLayer()) { + if ((request.active() || request.release()) && isRootLayer()) { renderer()->updateHitTestResult(result, toRenderView(renderer())->flipForWritingMode(result.point())); insideLayer = this; } diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp index 2b7e4252a..8a7487d7c 100644 --- a/Source/WebCore/rendering/RenderRegion.cpp +++ b/Source/WebCore/rendering/RenderRegion.cpp @@ -49,6 +49,7 @@ RenderRegion::RenderRegion(Node* node, RenderFlowThread* flowThread) , m_parentNamedFlowThread(0) , m_isValid(false) , m_hasCustomRegionStyle(false) + , m_hasAutoLogicalHeight(false) , m_regionState(RegionUndefined) { } @@ -172,6 +173,23 @@ void RenderRegion::checkRegionStyle() m_flowThread->checkRegionsWithStyling(); } +void RenderRegion::updateRegionHasAutoLogicalHeightFlag() +{ + ASSERT(m_flowThread); + + if (!isValid()) + return; + + bool didHaveAutoLogicalHeight = m_hasAutoLogicalHeight; + m_hasAutoLogicalHeight = shouldHaveAutoLogicalHeight(); + if (m_hasAutoLogicalHeight != didHaveAutoLogicalHeight) { + if (m_hasAutoLogicalHeight) + view()->flowThreadController()->incrementAutoLogicalHeightRegions(); + else + view()->flowThreadController()->decrementAutoLogicalHeightRegions(); + } +} + void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderReplaced::styleDidChange(diff, oldStyle); @@ -185,6 +203,7 @@ void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldSt } checkRegionStyle(); + updateRegionHasAutoLogicalHeightFlag(); } void RenderRegion::layout() @@ -282,12 +301,24 @@ void RenderRegion::attachRegion() // The region just got attached to the flow thread, lets check whether // it has region styling rules associated. checkRegionStyle(); + + if (!isValid()) + return; + + m_hasAutoLogicalHeight = shouldHaveAutoLogicalHeight(); + if (hasAutoLogicalHeight()) + view()->flowThreadController()->incrementAutoLogicalHeightRegions(); } void RenderRegion::detachRegion() { - if (m_flowThread) + if (m_flowThread) { m_flowThread->removeRegionFromThread(this); + if (hasAutoLogicalHeight()) { + ASSERT(isValid()); + view()->flowThreadController()->decrementAutoLogicalHeightRegions(); + } + } m_flowThread = 0; } diff --git a/Source/WebCore/rendering/RenderRegion.h b/Source/WebCore/rendering/RenderRegion.h index 3d9d5a8a2..8a4f71206 100644 --- a/Source/WebCore/rendering/RenderRegion.h +++ b/Source/WebCore/rendering/RenderRegion.h @@ -114,6 +114,14 @@ public: // or columns added together. virtual LayoutUnit logicalHeightOfAllFlowThreadContent() const; + bool shouldHaveAutoLogicalHeight() const + { + bool hasSpecifiedEndpointsForHeight = style()->logicalTop().isSpecified() && style()->logicalBottom().isSpecified(); + bool hasAnchoredEndpointsForHeight = isOutOfFlowPositioned() && hasSpecifiedEndpointsForHeight; + return style()->logicalHeight().isAuto() && !hasAnchoredEndpointsForHeight; + } + bool hasAutoLogicalHeight() const { return m_hasAutoLogicalHeight; } + // The top of the nearest page inside the region. For RenderRegions, this is just the logical top of the // flow thread portion we contain. For sets, we have to figure out the top of the nearest column or // page. @@ -154,6 +162,7 @@ private: void printRegionObjectsStyles(); void checkRegionStyle(); + void updateRegionHasAutoLogicalHeightFlag(); protected: RenderFlowThread* m_flowThread; @@ -185,8 +194,9 @@ private: typedef HashMap<const RenderObject*, ObjectRegionStyleInfo > RenderObjectRegionStyleMap; RenderObjectRegionStyleMap m_renderObjectRegionStyle; - bool m_isValid; - bool m_hasCustomRegionStyle; + bool m_isValid : 1; + bool m_hasCustomRegionStyle : 1; + bool m_hasAutoLogicalHeight : 1; RegionState m_regionState; }; diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index 82b956993..7edad3b06 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -727,7 +727,6 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len float monospaceCharacterWidth = f.spaceWidth(); float w = 0; bool isSpace; - bool previousCharWasSpace = true; // FIXME: Preserves historical behavior, but seems wrong for start > 0. ASSERT(m_text); StringImpl& text = *m_text.impl(); for (int i = start; i < start + len; i++) { @@ -737,17 +736,21 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len w += monospaceCharacterWidth; isSpace = true; } else if (c == '\t') { - w += style()->collapseWhiteSpace() ? monospaceCharacterWidth : f.tabWidth(style()->tabSize(), xPos + w); - isSpace = true; + if (style()->collapseWhiteSpace()) { + w += monospaceCharacterWidth; + isSpace = true; + } else { + w += f.tabWidth(style()->tabSize(), xPos + w); + isSpace = false; + } } else isSpace = false; } else { w += monospaceCharacterWidth; isSpace = false; } - if (isSpace && !previousCharWasSpace) + if (isSpace && i > start) w += f.wordSpacing(); - previousCharWasSpace = isSpace; } return w; } diff --git a/Source/WebCore/rendering/RenderTreeAsText.cpp b/Source/WebCore/rendering/RenderTreeAsText.cpp index ef650aded..813cf7e0c 100644 --- a/Source/WebCore/rendering/RenderTreeAsText.cpp +++ b/Source/WebCore/rendering/RenderTreeAsText.cpp @@ -694,6 +694,8 @@ static void writeRenderNamedFlowThreads(TextStream& ts, RenderView* renderView, } if (renderRegion->hasCustomRegionStyle()) ts << " region style: 1"; + if (renderRegion->hasAutoLogicalHeight()) + ts << " hasAutoLogicalHeight"; } if (!renderRegion->isValid()) ts << " invalid"; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp index 08885e001..0bfc1678e 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp @@ -42,7 +42,7 @@ namespace WebCore { using namespace MathMLNames; RenderMathMLBlock::RenderMathMLBlock(Node* container) - : RenderBlock(container) + : RenderFlexibleBox(container) , m_intrinsicPaddingBefore(0) , m_intrinsicPaddingAfter(0) , m_intrinsicPaddingStart(0) @@ -144,7 +144,7 @@ void RenderMathMLBlock::computePreferredLogicalWidths() { ASSERT(preferredLogicalWidthsDirty()); m_preferredLogicalHeight = preferredLogicalHeightUnset; - RenderBlock::computePreferredLogicalWidths(); + RenderFlexibleBox::computePreferredLogicalWidths(); } RenderMathMLBlock* RenderMathMLBlock::createAnonymousMathMLBlock(EDisplay display) @@ -204,16 +204,21 @@ LayoutUnit RenderMathMLBlock::baselinePosition(FontBaseline baselineType, bool f // return 0 here to match our line-height. This matters when RootInlineBox::ascentAndDescentForBox is called on a RootInlineBox for an inline-block. if (linePositionMode == PositionOfInteriorLineBoxes) return 0; - return RenderBlock::baselinePosition(baselineType, firstLine, direction, linePositionMode); + + LayoutUnit baseline = firstLineBoxBaseline(); // FIXME: This may be unnecessary after flex baselines are implemented (https://bugs.webkit.org/show_bug.cgi?id=96188). + if (baseline != -1) + return baseline; + + return RenderFlexibleBox::baselinePosition(baselineType, firstLine, direction, linePositionMode); } const char* RenderMathMLBlock::renderName() const { EDisplay display = style()->display(); - if (display == BLOCK) - return isAnonymous() ? "RenderMathMLBlock (anonymous, block)" : "RenderMathMLBlock (block)"; - if (display == INLINE_BLOCK) - return isAnonymous() ? "RenderMathMLBlock (anonymous, inline-block)" : "RenderMathMLBlock (inline-block)"; + if (display == FLEX) + return isAnonymous() ? "RenderMathMLBlock (anonymous, flex)" : "RenderMathMLBlock (flex)"; + if (display == INLINE_FLEX) + return isAnonymous() ? "RenderMathMLBlock (anonymous, inline-flex)" : "RenderMathMLBlock (inline-flex)"; // |display| should be one of the above. ASSERT_NOT_REACHED(); return isAnonymous() ? "RenderMathMLBlock (anonymous)" : "RenderMathMLBlock"; @@ -222,7 +227,7 @@ const char* RenderMathMLBlock::renderName() const #if ENABLE(DEBUG_MATH_LAYOUT) void RenderMathMLBlock::paint(PaintInfo& info, const LayoutPoint& paintOffset) { - RenderBlock::paint(info, paintOffset); + RenderFlexibleBox::paint(info, paintOffset); if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground) return; @@ -254,6 +259,14 @@ void RenderMathMLBlock::paint(PaintInfo& info, const LayoutPoint& paintOffset) } #endif // ENABLE(DEBUG_MATH_LAYOUT) +LayoutUnit RenderMathMLTable::firstLineBoxBaseline() const +{ + // In legal MathML, we'll have a MathML parent. That RenderFlexibleBox parent will use our firstLineBoxBaseline() for baseline alignment, per + // http://dev.w3.org/csswg/css3-flexbox/#flex-baselines. We want to vertically center an <mtable>, such as a matrix. Essentially the whole <mtable> element fits on a + // single line, whose baseline gives this centering. This is different than RenderTable::firstLineBoxBaseline, which returns the baseline of the first row of a <table>. + return (logicalHeight() + style()->fontMetrics().xHeight()) / 2; +} + } #endif diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h index cd1e26cb2..5d9f4de4f 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h @@ -29,7 +29,8 @@ #if ENABLE(MATHML) -#include "RenderBlock.h" +#include "RenderFlexibleBox.h" +#include "RenderTable.h" #include "StyleInheritedData.h" #define ENABLE_DEBUG_MATH_LAYOUT 0 @@ -38,7 +39,7 @@ namespace WebCore { class RenderMathMLOperator; -class RenderMathMLBlock : public RenderBlock { +class RenderMathMLBlock : public RenderFlexibleBox { public: RenderMathMLBlock(Node* container); virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; @@ -84,7 +85,7 @@ public: #endif // Create a new RenderMathMLBlock, with a new style inheriting from this->style(). - RenderMathMLBlock* createAnonymousMathMLBlock(EDisplay = BLOCK); + RenderMathMLBlock* createAnonymousMathMLBlock(EDisplay = FLEX); private: virtual const char* renderName() const OVERRIDE; @@ -119,6 +120,16 @@ inline const RenderMathMLBlock* toRenderMathMLBlock(const RenderObject* object) // This will catch anyone doing an unnecessary cast. void toRenderMathMLBlock(const RenderMathMLBlock*); +class RenderMathMLTable : public RenderTable { +public: + explicit RenderMathMLTable(Node* node) : RenderTable(node) { } + + virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; + +private: + virtual const char* renderName() const OVERRIDE { return "RenderMathMLTable"; } +}; + } #endif // ENABLE(MATHML) diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp index 68c2b0533..7de06ffe0 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp @@ -83,7 +83,8 @@ void RenderMathMLFenced::updateFromElement() RenderMathMLOperator* RenderMathMLFenced::createMathMLOperator(UChar uChar) { - RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), INLINE_BLOCK); + RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), FLEX); + newStyle->setFlexDirection(FlowColumn); newStyle->setPaddingRight(Length(static_cast<int>(gOperatorPadding * style()->fontSize()), Fixed)); RenderMathMLOperator* newOperator = new (renderArena()) RenderMathMLOperator(node() /* "almost anonymous" */, uChar); newOperator->setStyle(newStyle.release()); @@ -92,9 +93,9 @@ RenderMathMLOperator* RenderMathMLFenced::createMathMLOperator(UChar uChar) void RenderMathMLFenced::makeFences() { - RenderBlock::addChild(createMathMLOperator(m_open), firstChild()); + RenderMathMLRow::addChild(createMathMLOperator(m_open), firstChild()); m_closeFenceRenderer = createMathMLOperator(m_close); - RenderBlock::addChild(m_closeFenceRenderer); + RenderMathMLRow::addChild(m_closeFenceRenderer); } void RenderMathMLFenced::addChild(RenderObject* child, RenderObject* beforeChild) @@ -132,25 +133,16 @@ void RenderMathMLFenced::addChild(RenderObject* child, RenderObject* beforeChild } } - // If we have a block, we'll wrap it in an inline-block. - if (child->isBlockFlow() && child->style()->display() != INLINE_BLOCK) { - // Block objects wrapper. - RenderMathMLBlock* block = createAnonymousMathMLBlock(INLINE_BLOCK); - - block->addChild(child); - child = block; - } - if (beforeChild) { // Adding |x| before an existing |y| e.g. in element (y) - first insert our new child |x|, then its separator, to get (x, y). - RenderBlock::addChild(child, beforeChild); + RenderMathMLRow::addChild(child, beforeChild); if (separatorRenderer) - RenderBlock::addChild(separatorRenderer, beforeChild); + RenderMathMLRow::addChild(separatorRenderer, beforeChild); } else { // Adding |y| at the end of an existing element e.g. (x) - insert the separator first before the closing fence, then |y|, to get (x, y). if (separatorRenderer) - RenderBlock::addChild(separatorRenderer, m_closeFenceRenderer); - RenderBlock::addChild(child, m_closeFenceRenderer); + RenderMathMLRow::addChild(separatorRenderer, m_closeFenceRenderer); + RenderMathMLRow::addChild(child, m_closeFenceRenderer); } } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp index 77bebd84f..4e4273dae 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp @@ -55,7 +55,7 @@ RenderMathMLFraction::RenderMathMLFraction(Element* element) void RenderMathMLFraction::fixChildStyle(RenderObject* child) { ASSERT(child->isAnonymous() && child->style()->refCount() == 1); - child->style()->setTextAlign(CENTER); + child->style()->setFlexDirection(FlowColumn); Length pad(static_cast<int>(style()->fontSize() * gHorizontalPad), Fixed); child->style()->setPaddingLeft(pad); child->style()->setPaddingRight(pad); @@ -72,26 +72,10 @@ void RenderMathMLFraction::updateFromElement() Element* fraction = static_cast<Element*>(node()); RenderObject* numeratorWrapper = firstChild(); - String nalign = fraction->getAttribute(MathMLNames::numalignAttr); - if (equalIgnoringCase(nalign, "left")) - numeratorWrapper->style()->setTextAlign(LEFT); - else if (equalIgnoringCase(nalign, "right")) - numeratorWrapper->style()->setTextAlign(RIGHT); - else - numeratorWrapper->style()->setTextAlign(CENTER); - RenderObject* denominatorWrapper = numeratorWrapper->nextSibling(); if (!denominatorWrapper) return; - String dalign = fraction->getAttribute(MathMLNames::denomalignAttr); - if (equalIgnoringCase(dalign, "left")) - denominatorWrapper->style()->setTextAlign(LEFT); - else if (equalIgnoringCase(dalign, "right")) - denominatorWrapper->style()->setTextAlign(RIGHT); - else - denominatorWrapper->style()->setTextAlign(CENTER); - // FIXME: parse units String thickness = fraction->getAttribute(MathMLNames::linethicknessAttr); m_lineThickness = gLineMedium; @@ -112,7 +96,7 @@ void RenderMathMLFraction::addChild(RenderObject* child, RenderObject* beforeChi { RenderMathMLBlock* row = createAnonymousMathMLBlock(); - RenderBlock::addChild(row, beforeChild); + RenderMathMLBlock::addChild(row, beforeChild); row->addChild(child); fixChildStyle(row); @@ -147,7 +131,7 @@ void RenderMathMLFraction::layout() if (lastChild() && lastChild()->isRenderBlock()) m_lineThickness *= ceilf(gFractionBarWidth * style()->fontSize()); - RenderBlock::layout(); + RenderMathMLBlock::layout(); } void RenderMathMLFraction::paint(PaintInfo& info, const LayoutPoint& paintOffset) @@ -185,7 +169,7 @@ void RenderMathMLFraction::paint(PaintInfo& info, const LayoutPoint& paintOffset info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y())); } -LayoutUnit RenderMathMLFraction::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const +LayoutUnit RenderMathMLFraction::firstLineBoxBaseline() const { if (firstChild() && firstChild()->isRenderMathMLBlock()) { RenderMathMLBlock* numeratorWrapper = toRenderMathMLBlock(firstChild()); @@ -197,7 +181,7 @@ LayoutUnit RenderMathMLFraction::baselinePosition(FontBaseline, bool firstLine, int shift = int(ceil((refStyle->fontMetrics().xHeight() + 1) / 2)); return numeratorWrapper->pixelSnappedOffsetHeight() + shift; } - return RenderMathMLBlock::baselinePosition(AlphabeticBaseline, firstLine, lineDirection, linePositionMode); + return RenderMathMLBlock::firstLineBoxBaseline(); } } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h index eedc7f356..5b068dd31 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h @@ -41,7 +41,7 @@ public: virtual RenderMathMLOperator* unembellishedOperator(); - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; virtual void paint(PaintInfo&, const LayoutPoint&); protected: virtual void layout(); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp index 196783804..ae7badac4 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp @@ -223,8 +223,7 @@ void RenderMathMLOperator::updateFromElement() RefPtr<RenderStyle> newStyle = RenderStyle::create(); newStyle->inheritFrom(style()); - newStyle->setDisplay(INLINE_BLOCK); - newStyle->setVerticalAlign(BASELINE); + newStyle->setDisplay(FLEX); // Check for a stretchable character that is under the minimum height and use the // font size to adjust the glyph size. @@ -335,7 +334,7 @@ PassRefPtr<RenderStyle> RenderMathMLOperator::createStackableStyle(int /* lineHe { RefPtr<RenderStyle> newStyle = RenderStyle::create(); newStyle->inheritFrom(style()); - newStyle->setDisplay(BLOCK); + newStyle->setDisplay(FLEX); FontDescription desc = style()->fontDescription(); desc.setIsAbsoluteSize(true); @@ -382,11 +381,11 @@ RenderBlock* RenderMathMLOperator::createGlyph(UChar glyph, int lineHeight, int return container; } -LayoutUnit RenderMathMLOperator::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const +LayoutUnit RenderMathMLOperator::firstLineBoxBaseline() const { if (m_isStacked) return m_stretchHeight * 2 / 3 - (m_stretchHeight - static_cast<int>(m_stretchHeight / gOperatorExpansion)) / 2; - return RenderMathMLBlock::baselinePosition(AlphabeticBaseline, firstLine, lineDirection, linePositionMode); + return RenderMathMLBlock::firstLineBoxBaseline(); } } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h index 42ed2bee6..85c2c3a8e 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h @@ -45,7 +45,7 @@ public: virtual RenderMathMLOperator* unembellishedOperator() OVERRIDE { return this; } void stretchToHeight(int pixelHeight); - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; protected: virtual void computePreferredLogicalWidths() OVERRIDE; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp index 347e96cf0..52bb6feae 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp @@ -44,7 +44,7 @@ RenderMathMLRow::RenderMathMLRow(Node* node) // FIXME: Change all these createAnonymous... routines to return a PassOwnPtr<>. RenderMathMLRow* RenderMathMLRow::createAnonymousWithParentRenderer(const RenderObject* parent) { - RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), INLINE_BLOCK); + RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), FLEX); RenderMathMLRow* newMRow = new (parent->renderArena()) RenderMathMLRow(parent->document() /* is anonymous */); newMRow->setStyle(newStyle.release()); return newMRow; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp index dd0261de7..ddeafef0b 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp @@ -45,7 +45,7 @@ RenderMathMLSubSup::RenderMathMLSubSup(Element* element) if (element->hasLocalName(MathMLNames::msubTag)) m_kind = Sub; else if (element->hasLocalName(MathMLNames::msupTag)) - m_kind = Sup; + m_kind = Super; else { ASSERT(element->hasLocalName(MathMLNames::msubsupTag)); m_kind = SubSup; @@ -67,13 +67,15 @@ void RenderMathMLSubSup::fixScriptsStyle() { ASSERT(m_scripts && m_scripts->style()->refCount() == 1); RenderStyle* scriptsStyle = m_scripts->style(); - scriptsStyle->setVerticalAlign(TOP); - scriptsStyle->setMarginLeft(Length(gSubsupScriptMargin, Fixed)); - scriptsStyle->setTextAlign(LEFT); + scriptsStyle->setFlexDirection(FlowColumn); + scriptsStyle->setJustifyContent(m_kind == Sub ? JustifyFlexEnd : m_kind == Super ? JustifyFlexStart : JustifySpaceBetween); + if (m_kind == SubSup) + scriptsStyle->setMarginLeft(Length(gSubsupScriptMargin, Fixed)); // Set this wrapper's font-size for its line-height & baseline position, for its children. scriptsStyle->setFontSize(static_cast<int>(0.75 * style()->fontSize())); } +// FIXME: Handle arbitrary addChild/removeChild correctly throughout MathML, e.g. add/remove/add a base child here. void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild) { // Note: The RenderMathMLBlock only allows element children to be added. @@ -81,49 +83,26 @@ void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild if (childElement && !childElement->previousElementSibling()) { // Position 1 is always the base of the msub/msup/msubsup. - RenderMathMLBlock* baseWrapper = createAnonymousMathMLBlock(INLINE_BLOCK); + RenderMathMLBlock* baseWrapper = createAnonymousMathMLBlock(); RenderMathMLBlock::addChild(baseWrapper, firstChild()); baseWrapper->addChild(child); // Make sure we have a script block for rendering. - if (m_kind == SubSup && !m_scripts) { - m_scripts = createAnonymousMathMLBlock(INLINE_BLOCK); + if (!m_scripts) { + m_scripts = createAnonymousMathMLBlock(); fixScriptsStyle(); RenderMathMLBlock::addChild(m_scripts, beforeChild); } - } else { - if (m_kind == SubSup) { - ASSERT(childElement); - if (!childElement) - return; - - RenderMathMLBlock* script = m_scripts->createAnonymousMathMLBlock(); - - // The order is always backwards so the first script is the subscript and the superscript - // is last. That means the superscript is the first to render vertically. - Element* previousSibling = childElement->previousElementSibling(); - if (previousSibling && !previousSibling->previousElementSibling()) - m_scripts->addChild(script); - else - m_scripts->addChild(script, m_scripts->firstChild()); - - script->addChild(child); - } else - RenderMathMLBlock::addChild(child, beforeChild); - } + } else + m_scripts->addChild(child, beforeChild ? m_scripts->firstChild() : 0); } void RenderMathMLSubSup::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderMathMLBlock::styleDidChange(diff, oldStyle); - if (m_scripts) { + if (m_scripts) fixScriptsStyle(); - for (RenderObject* script = m_scripts->firstChild(); script; script = script->nextSibling()) { - ASSERT(script->isAnonymous() && script->style()->refCount() == 1); - script->style()->inheritFrom(m_scripts->style()); - } - } } RenderMathMLOperator* RenderMathMLSubSup::unembellishedOperator() @@ -136,53 +115,53 @@ RenderMathMLOperator* RenderMathMLSubSup::unembellishedOperator() void RenderMathMLSubSup::layout() { - RenderBlock::layout(); + RenderMathMLBlock::layout(); - if (m_kind != SubSup || !m_scripts) - return; RenderMathMLBlock* baseWrapper = toRenderMathMLBlock(firstChild()); - RenderMathMLBlock* superscriptWrapper = toRenderMathMLBlock(m_scripts->firstChild()); - RenderMathMLBlock* subscriptWrapper = toRenderMathMLBlock(m_scripts->lastChild()); - if (!baseWrapper || !superscriptWrapper || !subscriptWrapper || superscriptWrapper == subscriptWrapper) + if (!baseWrapper || !m_scripts) + return; + RenderBox* base = baseWrapper->firstChildBox(); + if (!base) return; - LayoutUnit baseWrapperBaseline = toRenderBox(firstChild())->firstLineBoxBaseline(); - LayoutUnit baseBaseline = baseWrapperBaseline - baseWrapper->paddingBefore(); - LayoutUnit baseExtendUnderBaseline = baseWrapper->logicalHeight() - baseWrapperBaseline; - LayoutUnit axis = style()->fontMetrics().xHeight() / 2; - LayoutUnit superscriptHeight = superscriptWrapper->logicalHeight() - superscriptWrapper->paddingAfter(); - LayoutUnit subscriptHeight = subscriptWrapper->logicalHeight(); - - // Our layout rules are: Don't let the superscript go below the "axis" (half x-height above the + // Our layout rules include: Don't let the superscript go below the "axis" (half x-height above the // baseline), or the subscript above the axis. Also, don't let the superscript's top edge be // below the base's top edge, or the subscript's bottom edge above the base's bottom edge. // // FIXME: Check any subscriptshift or superscriptshift attributes, and maybe use more sophisticated // heuristics from TeX or elsewhere. See https://bugs.webkit.org/show_bug.cgi?id=79274#c5. - // Above we did scriptsStyle->setVerticalAlign(TOP) for mscripts' style, so the superscript's - // top edge will equal the top edge of the base's padding. - LayoutUnit basePaddingTop = superscriptHeight + axis - baseBaseline; - // If basePaddingTop is positive, it's indeed the base's padding-top that we need. If it's negative, - // then we should instead use its absolute value to pad the bottom of the superscript, to get the - // superscript's bottom edge down to the axis. First we compute how much more we need to shift the - // subscript down, once its top edge is at the axis. - LayoutUnit superPaddingBottom = max<LayoutUnit>(baseExtendUnderBaseline + axis - subscriptHeight, 0); - if (basePaddingTop < 0) { - superPaddingBottom += -basePaddingTop; - basePaddingTop = 0; + LayoutUnit baseHeight = base->logicalHeight(); + LayoutUnit baseBaseline = base->firstLineBoxBaseline(); + if (baseBaseline == -1) + baseBaseline = baseHeight; + LayoutUnit axis = style()->fontMetrics().xHeight() / 2; + int fontSize = style()->fontSize(); + + if (RenderBox* superscript = m_kind == Sub ? 0 : m_scripts->lastChildBox()) { + LayoutUnit superscriptHeight = superscript->logicalHeight(); + LayoutUnit superscriptBaseline = superscript->firstLineBoxBaseline(); + if (superscriptBaseline == -1) + superscriptBaseline = superscriptHeight; + LayoutUnit minBaseline = max<LayoutUnit>(fontSize / 3 + 1 + superscriptBaseline, superscriptHeight + axis); + baseWrapper->style()->setPaddingTop(Length(max<LayoutUnit>(minBaseline - baseBaseline, 0), Fixed)); } - setChildNeedsLayout(true, MarkOnlyThis); + if (RenderBox* subscript = m_kind == Super ? 0 : m_scripts->firstChildBox()) { + LayoutUnit subscriptHeight = subscript->logicalHeight(); + LayoutUnit subscriptBaseline = subscript->firstLineBoxBaseline(); + if (subscriptBaseline == -1) + subscriptBaseline = subscriptHeight; + LayoutUnit baseExtendUnderBaseline = baseHeight - baseBaseline; + LayoutUnit subscriptUnderItsBaseline = subscriptHeight - subscriptBaseline; + LayoutUnit minExtendUnderBaseline = max<LayoutUnit>(fontSize / 5 + 1 + subscriptUnderItsBaseline, subscriptHeight - axis); + baseWrapper->style()->setPaddingBottom(Length(max<LayoutUnit>(minExtendUnderBaseline - baseExtendUnderBaseline, 0), Fixed)); + } - baseWrapper->style()->setPaddingTop(Length(basePaddingTop, Fixed)); + setChildNeedsLayout(true, MarkOnlyThis); baseWrapper->setNeedsLayout(true, MarkOnlyThis); - superscriptWrapper->style()->setPaddingBottom(Length(superPaddingBottom, Fixed)); - superscriptWrapper->setNeedsLayout(true, MarkOnlyThis); - m_scripts->setNeedsLayout(true, MarkOnlyThis); - - RenderBlock::layout(); + RenderMathMLBlock::layout(); } } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h index f906d48ca..298225a87 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h @@ -53,7 +53,7 @@ private: // won't occur in valid MathML). RenderBoxModelObject* base() const; - enum SubSupType { Sub, Sup, SubSup }; + enum SubSupType { Sub, Super, SubSup }; SubSupType m_kind; RenderMathMLBlock* m_scripts; }; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp index e07d1cc5c..c0128f483 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp @@ -49,118 +49,21 @@ RenderMathMLUnderOver::RenderMathMLUnderOver(Element* element) } } -RenderBoxModelObject* RenderMathMLUnderOver::base() const -{ - RenderObject* baseWrapper = firstChild(); - if ((m_kind == Over || m_kind == UnderOver) && baseWrapper) - baseWrapper = baseWrapper->nextSibling(); - if (!baseWrapper) - return 0; - RenderObject* base = baseWrapper->firstChild(); - if (!base || !base->isBoxModelObject()) - return 0; - return toRenderBoxModelObject(base); -} - -void RenderMathMLUnderOver::addChild(RenderObject* child, RenderObject* beforeChild) -{ - RenderMathMLBlock* row = createAnonymousMathMLBlock(); - - // look through the children for rendered elements counting the blocks so we know what child - // we are adding - int blocks = 0; - RenderObject* current = this->firstChild(); - while (current) { - blocks++; - current = current->nextSibling(); - } - - switch (blocks) { - case 0: - // this is the base so just append it - RenderBlock::addChild(row, beforeChild); - break; - case 1: - // the under or over - row->style()->setTextAlign(CENTER); - if (m_kind == Over) { - // add the over as first - RenderBlock::addChild(row, firstChild()); - } else { - // add the under as last - RenderBlock::addChild(row, beforeChild); - } - break; - case 2: - // the under or over - row->style()->setTextAlign(CENTER); - if (m_kind == UnderOver) { - // add the over as first - RenderBlock::addChild(row, firstChild()); - } else { - // we really shouldn't get here as only munderover should have three children - RenderBlock::addChild(row, beforeChild); - } - break; - default: - // munderover shouldn't have more than three children. In theory we shouldn't - // get here if the MathML is correctly formed, but that isn't a guarantee. - // We will treat this as another under element and they'll get something funky. - RenderBlock::addChild(row, beforeChild); - } - row->addChild(child); -} - -void RenderMathMLUnderOver::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) -{ - RenderMathMLBlock::styleDidChange(diff, oldStyle); - - RenderObject* base = this->base(); - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - ASSERT(child->isAnonymous() && child->style()->refCount() == 1); - if (child->firstChild() != base) - child->style()->setTextAlign(CENTER); - } -} - RenderMathMLOperator* RenderMathMLUnderOver::unembellishedOperator() { - RenderBoxModelObject* base = this->base(); + RenderObject* base = firstChild(); if (!base || !base->isRenderMathMLBlock()) return 0; return toRenderMathMLBlock(base)->unembellishedOperator(); } -inline int getOffsetHeight(RenderObject* obj) +LayoutUnit RenderMathMLUnderOver::firstLineBoxBaseline() const { - if (obj->isBoxModelObject()) { - RenderBoxModelObject* box = toRenderBoxModelObject(obj); - return box->pixelSnappedOffsetHeight(); - } - - return 0; -} - -LayoutUnit RenderMathMLUnderOver::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const -{ - RenderObject* current = firstChild(); - if (!current || linePositionMode == PositionOfInteriorLineBoxes) - return RenderMathMLBlock::baselinePosition(baselineType, firstLine, direction, linePositionMode); - - LayoutUnit baseline = direction == HorizontalLine ? marginTop() : marginRight(); - switch (m_kind) { - case UnderOver: - case Over: - if (current->nextSibling()) { - baseline += getOffsetHeight(current); - current = current->nextSibling(); - } - // fall through - case Under: - ASSERT(current->isRenderBlock()); - baseline += toRenderBox(current)->firstLineBoxBaseline(); - } - + if (!firstChildBox()) + return -1; + LayoutUnit baseline = firstChildBox()->firstLineBoxBaseline(); + if (baseline != -1 && m_kind != Under) + baseline += lastChildBox()->pixelSnappedOffsetHeight(); // Add in the overscript's height. return baseline; } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h index 07107b94a..c7593349a 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h @@ -35,21 +35,14 @@ namespace WebCore { class RenderMathMLUnderOver : public RenderMathMLBlock { public: RenderMathMLUnderOver(Element*); - virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); virtual RenderMathMLOperator* unembellishedOperator(); - virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; private: - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE; - virtual const char* renderName() const { return "RenderMathMLUnderOver"; } - // Omit our underscript and/or overscript. This may return 0 for a non-MathML base (which - // won't occur in valid MathML). - RenderBoxModelObject* base() const; - enum UnderOverType { Under, Over, UnderOver }; UnderOverType m_kind; }; diff --git a/Source/WebCore/rendering/style/DataRef.h b/Source/WebCore/rendering/style/DataRef.h index 91a78451d..b4d4a7970 100644 --- a/Source/WebCore/rendering/style/DataRef.h +++ b/Source/WebCore/rendering/style/DataRef.h @@ -67,7 +67,7 @@ public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this); - info.addInstrumentedMember(m_data); + info.addMember(m_data); } private: diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index f160d9ecc..0602cfa9b 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -1611,8 +1611,8 @@ void RenderStyle::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const info.addMember(m_background); // FIXME: surrond contains some fields e.g. BorderData that might need to be instrumented. info.addMember(surround); - info.addInstrumentedMember(rareNonInheritedData); - info.addInstrumentedMember(rareInheritedData); + info.addMember(rareNonInheritedData); + info.addMember(rareInheritedData); // FIXME: inherited contains StyleImage and Font fields that might need to be instrumented. info.addMember(inherited); if (m_cachedPseudoStyles) diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 7a117444d..7bcb38eb4 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -1462,14 +1462,14 @@ public: static BasicShape* initialWrapShapeInside() { return 0; } static BasicShape* initialWrapShapeOutside() { return 0; } - void setClipPath(PassRefPtr<BasicShape> shape) + void setClipPath(PassRefPtr<ClipPathOperation> operation) { - if (rareNonInheritedData->m_clipPath != shape) - rareNonInheritedData.access()->m_clipPath = shape; + if (rareNonInheritedData->m_clipPath != operation) + rareNonInheritedData.access()->m_clipPath = operation; } - BasicShape* clipPath() const { return rareNonInheritedData->m_clipPath.get(); } + ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); } - static BasicShape* initialClipPath() { return 0; } + static ClipPathOperation* initialClipPath() { return 0; } Length wrapPadding() const { return rareNonInheritedData->m_wrapPadding; } void setWrapPadding(Length wrapPadding) { SET_VAR(rareNonInheritedData, m_wrapPadding, wrapPadding); } diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp index 17330d935..3962e7f6a 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -266,13 +266,13 @@ void StyleRareInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); info.addMember(textShadow); - info.addInstrumentedMember(highlight); + info.addMember(highlight); info.addMember(cursorData); - info.addInstrumentedMember(hyphenationString); - info.addInstrumentedMember(locale); - info.addInstrumentedMember(textEmphasisCustomMark); + info.addMember(hyphenationString); + info.addMember(locale); + info.addMember(textEmphasisCustomMark); info.addMember(quotes); - info.addInstrumentedMember(m_lineGrid); + info.addMember(m_lineGrid); #if ENABLE(CSS_VARIABLES) info.addMember(m_variables); #endif diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp index 811bfa1fe..bbe07bfde 100644 --- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp @@ -327,8 +327,8 @@ void StyleRareNonInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObject info.addMember(m_wrapShapeInside); info.addMember(m_wrapShapeOutside); info.addMember(m_clipPath); - info.addInstrumentedMember(m_flowThread); - info.addInstrumentedMember(m_regionThread); + info.addMember(m_flowThread); + info.addMember(m_regionThread); } } // namespace WebCore diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h index bb67a3e62..41b8407e0 100644 --- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h @@ -26,6 +26,7 @@ #define StyleRareNonInheritedData_h #include "BasicShapes.h" +#include "ClipPathOperation.h" #include "CounterDirectives.h" #include "CursorData.h" #include "DataRef.h" @@ -138,7 +139,7 @@ public: Length m_wrapMargin; Length m_wrapPadding; - RefPtr<BasicShape> m_clipPath; + RefPtr<ClipPathOperation> m_clipPath; Color m_visitedLinkBackgroundColor; Color m_visitedLinkOutlineColor; diff --git a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp index 6e3cd2dcb..041aed418 100644 --- a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp @@ -123,13 +123,10 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI } } - BasicShape* clipShape = style->clipPath(); - if (clipShape) { - // FIXME: Investigate if it is better to store and update a Path object in RenderStyle. - // https://bugs.webkit.org/show_bug.cgi?id=95619 - Path clipPath; - clipShape->path(clipPath, object->objectBoundingBox()); - m_paintInfo->context->clipPath(clipPath, clipShape->windRule()); + ClipPathOperation* clipPathOperation = style->clipPath(); + if (clipPathOperation && clipPathOperation->getOperationType() == ClipPathOperation::SHAPE) { + ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(clipPathOperation); + m_paintInfo->context->clipPath(clipPath->path(object->objectBoundingBox()), clipPath->windRule()); } SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(m_object); @@ -150,7 +147,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI } RenderSVGResourceClipper* clipper = resources->clipper(); - if (!clipShape && clipper) { + if (!clipPathOperation && clipper) { if (!clipper->applyResource(m_object, style, m_paintInfo->context, ApplyToDefaultMode)) return; } diff --git a/Source/WebCore/svg/SVGImageElement.cpp b/Source/WebCore/svg/SVGImageElement.cpp index 5558d1023..37681f3c4 100644 --- a/Source/WebCore/svg/SVGImageElement.cpp +++ b/Source/WebCore/svg/SVGImageElement.cpp @@ -196,7 +196,7 @@ RenderObject* SVGImageElement::createRenderer(RenderArena* arena, RenderStyle*) bool SVGImageElement::haveLoadedRequiredResources() { - return !externalResourcesRequiredBaseValue() || !m_imageLoader.hasPendingLoadEvent(); + return !externalResourcesRequiredBaseValue() || !m_imageLoader.hasPendingActivity(); } void SVGImageElement::attach() diff --git a/Source/WebCore/svg/SVGPaint.cpp b/Source/WebCore/svg/SVGPaint.cpp index 241266ba3..cce1f4e34 100644 --- a/Source/WebCore/svg/SVGPaint.cpp +++ b/Source/WebCore/svg/SVGPaint.cpp @@ -115,7 +115,7 @@ PassRefPtr<SVGPaint> SVGPaint::cloneForCSSOM() const void SVGPaint::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); - info.addInstrumentedMember(m_uri); + info.addMember(m_uri); } } diff --git a/Source/WebCore/svg/SVGPathByteStream.h b/Source/WebCore/svg/SVGPathByteStream.h index 15ad96121..523faec9f 100644 --- a/Source/WebCore/svg/SVGPathByteStream.h +++ b/Source/WebCore/svg/SVGPathByteStream.h @@ -62,6 +62,11 @@ public: DataIterator begin() { return m_data.begin(); } DataIterator end() { return m_data.end(); } void append(unsigned char byte) { m_data.append(byte); } + void append(SVGPathByteStream* other) + { + for (DataIterator it = other->begin(); it != other->end(); ++it) + append(*it); + } void clear() { m_data.clear(); } bool isEmpty() const { return !m_data.size(); } unsigned size() const { return m_data.size(); } diff --git a/Source/WebCore/svg/SVGPathElement.cpp b/Source/WebCore/svg/SVGPathElement.cpp index 986f5fe5f..04e25ea68 100644 --- a/Source/WebCore/svg/SVGPathElement.cpp +++ b/Source/WebCore/svg/SVGPathElement.cpp @@ -333,14 +333,18 @@ SVGPathSegListPropertyTearOff* SVGPathElement::animatedNormalizedPathSegList() return 0; } -void SVGPathElement::pathSegListChanged(SVGPathSegRole role) +void SVGPathElement::pathSegListChanged(SVGPathSegRole role, ListModification listModification) { switch (role) { case PathSegNormalizedRole: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! break; case PathSegUnalteredRole: - buildSVGPathByteStreamFromSVGPathSegList(m_pathSegList.value, m_pathByteStream.get(), UnalteredParsing); + if (listModification == ListModificationAppend) { + ASSERT(!m_pathSegList.value.isEmpty()); + appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last(), m_pathByteStream.get(), UnalteredParsing); + } else + buildSVGPathByteStreamFromSVGPathSegList(m_pathSegList.value, m_pathByteStream.get(), UnalteredParsing); break; case PathSegUndefinedRole: return; diff --git a/Source/WebCore/svg/SVGPathElement.h b/Source/WebCore/svg/SVGPathElement.h index 265c77930..2bda9497f 100644 --- a/Source/WebCore/svg/SVGPathElement.h +++ b/Source/WebCore/svg/SVGPathElement.h @@ -93,7 +93,7 @@ public: SVGPathByteStream* pathByteStream() const; - void pathSegListChanged(SVGPathSegRole); + void pathSegListChanged(SVGPathSegRole, ListModification = ListModificationUnknown); virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate); diff --git a/Source/WebCore/svg/SVGPathParser.cpp b/Source/WebCore/svg/SVGPathParser.cpp index 7decf56d8..dc4892aab 100644 --- a/Source/WebCore/svg/SVGPathParser.cpp +++ b/Source/WebCore/svg/SVGPathParser.cpp @@ -282,7 +282,7 @@ bool SVGPathParser::parseArcToSegment() return true; } -bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode) +bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode, bool checkForInitialMoveTo) { ASSERT(m_source); ASSERT(m_consumer); @@ -303,7 +303,7 @@ bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode) m_lastCommand = PathSegUnknown; // Path must start with moveto. - if (command != PathSegMoveToAbs && command != PathSegMoveToRel) + if (checkForInitialMoveTo && command != PathSegMoveToAbs && command != PathSegMoveToRel) return false; while (true) { diff --git a/Source/WebCore/svg/SVGPathParser.h b/Source/WebCore/svg/SVGPathParser.h index 52e14c8c6..a9a0b24c8 100644 --- a/Source/WebCore/svg/SVGPathParser.h +++ b/Source/WebCore/svg/SVGPathParser.h @@ -38,7 +38,7 @@ class SVGPathParser { public: SVGPathParser(); - bool parsePathDataFromSource(PathParsingMode pathParsingMode); + bool parsePathDataFromSource(PathParsingMode, bool checkForInitialMoveTo = true); void setCurrentConsumer(SVGPathConsumer* consumer) { m_consumer = consumer; } void setCurrentSource(SVGPathSource* source) { m_source = source; } void cleanup(); diff --git a/Source/WebCore/svg/SVGPathSegList.cpp b/Source/WebCore/svg/SVGPathSegList.cpp index dc7760bd7..d40cb56e6 100644 --- a/Source/WebCore/svg/SVGPathSegList.cpp +++ b/Source/WebCore/svg/SVGPathSegList.cpp @@ -38,11 +38,11 @@ String SVGPathSegList::valueAsString() const return pathString; } -void SVGPathSegList::commitChange(SVGElement* contextElement) +void SVGPathSegList::commitChange(SVGElement* contextElement, ListModification listModification) { ASSERT(contextElement); ASSERT(contextElement->hasTagName(SVGNames::pathTag)); - static_cast<SVGPathElement*>(contextElement)->pathSegListChanged(m_role); + static_cast<SVGPathElement*>(contextElement)->pathSegListChanged(m_role, listModification); } } diff --git a/Source/WebCore/svg/SVGPathSegList.h b/Source/WebCore/svg/SVGPathSegList.h index 5013b9fb4..058c08063 100644 --- a/Source/WebCore/svg/SVGPathSegList.h +++ b/Source/WebCore/svg/SVGPathSegList.h @@ -21,6 +21,7 @@ #define SVGPathSegList_h #if ENABLE(SVG) +#include "SVGListProperty.h" #include "SVGPathSeg.h" #include "SVGPropertyTraits.h" @@ -41,7 +42,7 @@ public: String valueAsString() const; // Only used by SVGPathSegListPropertyTearOff. - void commitChange(SVGElement* contextElement); + void commitChange(SVGElement* contextElement, ListModification); private: SVGPathSegRole m_role; diff --git a/Source/WebCore/svg/SVGPathUtilities.cpp b/Source/WebCore/svg/SVGPathUtilities.cpp index a5af9e704..9caf6a406 100644 --- a/Source/WebCore/svg/SVGPathUtilities.cpp +++ b/Source/WebCore/svg/SVGPathUtilities.cpp @@ -140,6 +140,28 @@ bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList& list, SVGPat return ok; } +bool appendSVGPathByteStreamFromSVGPathSeg(PassRefPtr<SVGPathSeg> pathSeg, SVGPathByteStream* result, PathParsingMode parsingMode) +{ + ASSERT(result); + // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! + ASSERT(parsingMode == UnalteredParsing); + + SVGPathSegList appendedItemList(PathSegUnalteredRole); + appendedItemList.append(pathSeg); + OwnPtr<SVGPathByteStream> appendedByteStream = SVGPathByteStream::create(); + + SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(appendedByteStream.get()); + OwnPtr<SVGPathSegListSource> source = SVGPathSegListSource::create(appendedItemList); + SVGPathParser* parser = globalSVGPathParser(source.get(), builder); + bool ok = parser->parsePathDataFromSource(parsingMode, false); + parser->cleanup(); + + if (ok) + result->append(appendedByteStream.get()); + + return ok; +} + bool buildPathFromByteStream(SVGPathByteStream* stream, Path& result) { ASSERT(stream); diff --git a/Source/WebCore/svg/SVGPathUtilities.h b/Source/WebCore/svg/SVGPathUtilities.h index f24aa009f..bedaa2189 100644 --- a/Source/WebCore/svg/SVGPathUtilities.h +++ b/Source/WebCore/svg/SVGPathUtilities.h @@ -23,6 +23,7 @@ #if ENABLE(SVG) #include "SVGPathByteStream.h" #include "SVGPathConsumer.h" +#include "SVGPathSeg.h" #include <wtf/OwnPtr.h> #include <wtf/text/WTFString.h> @@ -39,6 +40,7 @@ bool buildPathFromByteStream(SVGPathByteStream*, Path&); // SVGPathSegList/String -> SVGPathByteStream bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&, SVGPathByteStream*, PathParsingMode); +bool appendSVGPathByteStreamFromSVGPathSeg(PassRefPtr<SVGPathSeg>, SVGPathByteStream*, PathParsingMode); bool buildSVGPathByteStreamFromString(const String&, SVGPathByteStream*, PathParsingMode); // SVGPathByteStream/SVGPathSegList -> String diff --git a/Source/WebCore/svg/SVGURIReference.h b/Source/WebCore/svg/SVGURIReference.h index c87a1742a..1b6e8e9ec 100755 --- a/Source/WebCore/svg/SVGURIReference.h +++ b/Source/WebCore/svg/SVGURIReference.h @@ -43,14 +43,14 @@ public: static inline bool isExternalURIReference(const String& uri, Document* document) { - // If the URI matches our documents URL, early exit, we're dealing with a local reference. - ASSERT(document); - KURL url = document->completeURL(uri); - if (equalIgnoringFragmentIdentifier(url, document->url())) + // Fragment-only URIs are always internal + if (uri.startsWith('#')) return false; - // If the URI doesn't contain a base string, just see if it starts with a fragment-identifier. - return uri.find('#') != notFound; + // If the URI matches our documents URL, we're dealing with a local reference. + ASSERT(document); + KURL url = document->completeURL(uri); + return !equalIgnoringFragmentIdentifier(url, document->url()); } protected: diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp index 07f67257f..6a76fa38c 100644 --- a/Source/WebCore/svg/graphics/SVGImage.cpp +++ b/Source/WebCore/svg/graphics/SVGImage.cpp @@ -361,7 +361,7 @@ void SVGImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const Image::reportMemoryUsage(memoryObjectInfo); info.addMember(m_chromeClient); info.addMember(m_page); - info.addInstrumentedMember(m_frameCache); + info.addMember(m_frameCache); } } diff --git a/Source/WebCore/svg/properties/SVGListProperty.h b/Source/WebCore/svg/properties/SVGListProperty.h index 1587a40ac..9db2f4ceb 100644 --- a/Source/WebCore/svg/properties/SVGListProperty.h +++ b/Source/WebCore/svg/properties/SVGListProperty.h @@ -28,6 +28,14 @@ namespace WebCore { +enum ListModification { + ListModificationUnknown = 0, + ListModificationInsert = 1, + ListModificationReplace = 2, + ListModificationRemove = 3, + ListModificationAppend = 4 +}; + template<typename PropertyType> class SVGAnimatedListPropertyTearOff; @@ -390,7 +398,7 @@ public: // Append the value at the end of the list. m_values->append(newItem); - commitChange(); + commitChange(ListModificationAppend); return newItem; } @@ -416,7 +424,7 @@ public: m_values->append(newItem->propertyReference()); m_wrappers->append(newItem); - commitChange(); + commitChange(ListModificationAppend); return newItem.release(); } @@ -448,6 +456,11 @@ protected: } virtual void commitChange() = 0; + virtual void commitChange(ListModification) + { + commitChange(); + } + virtual void processIncomingListItemValue(const ListItemType& newItem, unsigned* indexToModify) = 0; virtual void processIncomingListItemWrapper(RefPtr<ListItemTearOff>& newItem, unsigned* indexToModify) = 0; diff --git a/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h index 4f41af397..bac9ee76d 100644 --- a/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h +++ b/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h @@ -140,7 +140,13 @@ private: virtual void commitChange() { ASSERT(m_values); - m_values->commitChange(m_animatedProperty->contextElement()); + m_values->commitChange(m_animatedProperty->contextElement(), ListModificationUnknown); + } + + virtual void commitChange(ListModification listModification) + { + ASSERT(m_values); + m_values->commitChange(m_animatedProperty->contextElement(), listModification); } virtual void processIncomingListItemValue(const ListItemType& newItem, unsigned* indexToModify); diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index b95bbc36c..e088fbce2 100755 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -99,6 +99,7 @@ InternalSettings::Backup::Backup(Page* page, Settings* settings) , m_canStartMedia(page->canStartMedia()) , m_originalMockScrollbarsEnabled(settings->mockScrollbarsEnabled()) , m_langAttributeAwareFormControlUIEnabled(RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled()) + , m_imagesEnabled(settings->areImagesEnabled()) { } @@ -133,6 +134,7 @@ void InternalSettings::Backup::restoreTo(Page* page, Settings* settings) page->setCanStartMedia(m_canStartMedia); settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled); RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttributeAwareFormControlUIEnabled); + settings->setImagesEnabled(m_imagesEnabled); } InternalSettings* InternalSettings::from(Page* page) @@ -651,4 +653,10 @@ void InternalSettings::setLangAttributeAwareFormControlUIEnabled(bool enabled) RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled); } +void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec) +{ + InternalSettingsGuardForSettings(); + settings()->setImagesEnabled(enabled); +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index f5aad8edc..0f94fb25f 100755 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -81,6 +81,7 @@ public: bool m_canStartMedia; bool m_originalMockScrollbarsEnabled; bool m_langAttributeAwareFormControlUIEnabled; + bool m_imagesEnabled; }; typedef RefCountedSupplement<Page, InternalSettings> SuperType; @@ -145,6 +146,8 @@ public: void setMemoryInfoEnabled(bool, ExceptionCode&); void setStorageBlockingPolicy(const String&, ExceptionCode&); void setLangAttributeAwareFormControlUIEnabled(bool); + void setImagesEnabled(bool enabled, ExceptionCode&); + private: explicit InternalSettings(Page*); virtual void hostDestroyed() OVERRIDE { m_page = 0; } diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl index 8f97f89ff..c7455fe16 100755 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -81,6 +81,7 @@ module window { #endif void setMemoryInfoEnabled(in boolean enabled) raises(DOMException); void setStorageBlockingPolicy(in DOMString policy) raises(DOMException); + void setImagesEnabled(in boolean enabled) raises(DOMException); }; } diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index 369481422..3afb3347a 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -966,14 +966,14 @@ unsigned Internals::touchEventHandlerCount(Document* document, ExceptionCode& ec } PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int x, int y, unsigned topPadding, unsigned rightPadding, - unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode& ec) const + unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, ExceptionCode& ec) const { if (!document || !document->frame() || !document->frame()->view()) { ec = INVALID_ACCESS_ERR; return 0; } - return document->nodesFromRect(x, y, topPadding, rightPadding, bottomPadding, leftPadding, ignoreClipping, allowShadowContent, allowChildFrameContent); + return document->nodesFromRect(x, y, topPadding, rightPadding, bottomPadding, leftPadding, ignoreClipping, allowShadowContent); } void Internals::emitInspectorDidBeginFrame() diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index b0f1604b9..d2d452ea9 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -160,7 +160,7 @@ public: unsigned touchEventHandlerCount(Document*, ExceptionCode&); PassRefPtr<NodeList> nodesFromRect(Document*, int x, int y, unsigned topPadding, unsigned rightPadding, - unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode&) const; + unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, ExceptionCode&) const; void emitInspectorDidBeginFrame(); void emitInspectorDidCancelFrame(); diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl index f62ceac85..3bd91299f 100644 --- a/Source/WebCore/testing/Internals.idl +++ b/Source/WebCore/testing/Internals.idl @@ -138,7 +138,7 @@ module window { NodeList nodesFromRect(in Document document, in long x, in long y, in unsigned long topPadding, in unsigned long rightPadding, in unsigned long bottomPadding, in unsigned long leftPadding, - in boolean ignoreClipping, in boolean allowShadowContent, in boolean allowChildFrameContent) raises (DOMException); + in boolean ignoreClipping, in boolean allowShadowContent) raises (DOMException); void emitInspectorDidBeginFrame(); void emitInspectorDidCancelFrame(); diff --git a/Source/WebCore/workers/DedicatedWorkerContext.idl b/Source/WebCore/workers/DedicatedWorkerContext.idl index 48ecfdcae..9e17e543f 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.idl +++ b/Source/WebCore/workers/DedicatedWorkerContext.idl @@ -43,8 +43,12 @@ module threads { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [Custom] void postMessage(in any message, in [Optional] Array messagePorts) raises(DOMException); + +#if defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES [Custom] void webkitPostMessage(in any message, in [Optional] Array transferList) raises(DOMException); +#endif // defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES + #else // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port. void postMessage(in DOMString message, in [Optional] MessagePort messagePort) diff --git a/Source/WebCore/workers/Worker.idl b/Source/WebCore/workers/Worker.idl index 083353c04..3665af6b0 100644 --- a/Source/WebCore/workers/Worker.idl +++ b/Source/WebCore/workers/Worker.idl @@ -43,8 +43,12 @@ module threads { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [Custom] void postMessage(in SerializedScriptValue message, in [Optional] Array messagePorts) raises(DOMException); + +#if defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES [Custom] void webkitPostMessage(in SerializedScriptValue message, in [Optional] Array messagePorts) raises(DOMException); +#endif // defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES + #else // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port. void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort) diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp index d7eaf5db4..c040c3966 100644 --- a/Source/WebCore/workers/WorkerContext.cpp +++ b/Source/WebCore/workers/WorkerContext.cpp @@ -148,9 +148,9 @@ String WorkerContext::userAgent(const KURL&) const return m_userAgent; } -void WorkerContext::disableEval() +void WorkerContext::disableEval(const String& errorMessage) { - m_script->disableEval(); + m_script->disableEval(errorMessage); } WorkerLocation* WorkerContext::location() const diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h index a6d60c814..9841a5e1d 100644 --- a/Source/WebCore/workers/WorkerContext.h +++ b/Source/WebCore/workers/WorkerContext.h @@ -72,7 +72,7 @@ namespace WebCore { const GroupSettings* groupSettings() { return m_groupSettings.get(); } virtual String userAgent(const KURL&) const; - virtual void disableEval(); + virtual void disableEval(const String& errorMessage); WorkerScriptController* script() { return m_script.get(); } void clearScript() { m_script.clear(); } diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp index 4a23ad34e..097bc4427 100644 --- a/Source/WebCore/xml/XMLHttpRequest.cpp +++ b/Source/WebCore/xml/XMLHttpRequest.cpp @@ -684,7 +684,7 @@ void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionCod void XMLHttpRequest::sendFromInspector(PassRefPtr<FormData> formData, ExceptionCode& ec) { - m_requestEntityBody = formData ? formData->deepCopy() : FormData::create(); + m_requestEntityBody = formData ? formData->deepCopy() : 0; createRequest(ec); m_exceptionCode = ec; } diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 4084fc269..d7f18027a 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,15 @@ +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Make force_static_libs_as_shared work on Mac OS + + We had to move a few LIBS += around that were in the wrong place, + and not caught when everything was just linked into the final + QtWebKit library. + + Reviewed by Simon Hausmann. + + * WebKit1.pri: Move multimedia-stuff to WebCore, to share with WK2 + 2012-09-11 Raphael Kubo da Costa <rakuco@webkit.org> [EFL] Rewrite the EFL-related Find modules diff --git a/Source/WebKit/WebKit1.pri b/Source/WebKit/WebKit1.pri index fa2f6fa34..4a7e72e36 100644 --- a/Source/WebKit/WebKit1.pri +++ b/Source/WebKit/WebKit1.pri @@ -12,23 +12,6 @@ INCLUDEPATH += \ $$SOURCE_DIR/qt/WebCoreSupport \ $$ROOT_WEBKIT_DIR/Source/WTF/wtf/qt -enable?(VIDEO):use?(QTKIT) { - LIBS += -framework Security -framework IOKit - - # We can know the Mac OS version by using the Darwin major version - DARWIN_VERSION = $$split(QMAKE_HOST.version, ".") - DARWIN_MAJOR_VERSION = $$first(DARWIN_VERSION) - equals(DARWIN_MAJOR_VERSION, "12") { - LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a - } else:equals(DARWIN_MAJOR_VERSION, "11") { - LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceLion.a - } else:equals(DARWIN_MAJOR_VERSION, "10") { - LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a - } else:equals(DARWIN_MAJOR_VERSION, "9") { - LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceLeopard.a - } -} - enable?(DEVICE_ORIENTATION)|enable?(ORIENTATION_EVENTS) { QT += sensors } diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index d626fec30..7ad6ce859 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -28,6 +28,7 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "InspectorController.h" +#include "InspectorInstrumentation.h" #include "Page.h" #include "SurfacePool.h" #include "WebPage.h" @@ -235,6 +236,16 @@ BackingStorePrivate::~BackingStorePrivate() pthread_mutex_destroy(&m_mutex); } +void BackingStorePrivate::instrumentBeginFrame() +{ + WebCore::InspectorInstrumentation::didBeginFrame(WebPagePrivate::core(m_webPage)); +} + +void BackingStorePrivate::instrumentCancelFrame() +{ + WebCore::InspectorInstrumentation::didCancelFrame(WebPagePrivate::core(m_webPage)); +} + bool BackingStorePrivate::shouldDirectRenderingToWindow() const { // Direct rendering doesn't work with OpenGL compositing code paths due to @@ -349,9 +360,14 @@ void BackingStorePrivate::resumeScreenAndBackingStoreUpdates(BackingStore::Resum --m_suspendScreenUpdates; BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); +#if USE(ACCELERATED_COMPOSITING) + // This will also blit since we set the OSDS flag above. + m_webPage->d->commitRootLayerIfNeeded(); +#else // Do some blitting if necessary. if ((op == BackingStore::Blit || op == BackingStore::RenderAndBlit) && !shouldDirectRenderingToWindow()) blitVisibleContents(); +#endif } void BackingStorePrivate::repaint(const Platform::IntRect& windowRect, diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index 71738951c..6ff040225 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -101,6 +101,9 @@ public: enum TileMatrixDirection { Horizontal, Vertical }; BackingStorePrivate(); + void instrumentBeginFrame(); + void instrumentCancelFrame(); + // Returns whether direct rendering is explicitly turned on or is // required because the surface pool is not large enough to meet // the minimum number of tiles required to scroll. diff --git a/Source/WebKit/blackberry/Api/WebOverlay.cpp b/Source/WebKit/blackberry/Api/WebOverlay.cpp index e01694cef..792a473b0 100644 --- a/Source/WebKit/blackberry/Api/WebOverlay.cpp +++ b/Source/WebKit/blackberry/Api/WebOverlay.cpp @@ -163,9 +163,9 @@ void WebOverlay::removeFromParent() d->parent = 0; } -void WebOverlay::setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize) +void WebOverlay::setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize, ImageDataAdoptionType adoptionType) { - d->setContentsToImage(data, imageSize); + d->setContentsToImage(data, imageSize, adoptionType); } void WebOverlay::setContentsToColor(int r, int g, int b, int a) @@ -329,7 +329,7 @@ void WebOverlayPrivateWebKitThread::removeFromParent() m_layer->removeFromParent(); } -void WebOverlayPrivateWebKitThread::setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize) +void WebOverlayPrivateWebKitThread::setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize, WebOverlay::ImageDataAdoptionType adoptionType) { notImplemented(); } @@ -390,6 +390,7 @@ void WebOverlayLayerCompositingThreadClient::setDrawsContent(bool drawsContent) void WebOverlayLayerCompositingThreadClient::invalidate() { m_texture.clear(); + clearUploadedContents(); } void WebOverlayLayerCompositingThreadClient::setContents(const SkBitmap& contents) @@ -397,6 +398,12 @@ void WebOverlayLayerCompositingThreadClient::setContents(const SkBitmap& content m_contents = contents; m_color = Color(); m_texture.clear(); + clearUploadedContents(); +} + +void WebOverlayLayerCompositingThreadClient::clearUploadedContents() +{ + m_uploadedContents = SkBitmap(); } void WebOverlayLayerCompositingThreadClient::setContentsToColor(const Color& color) @@ -404,6 +411,7 @@ void WebOverlayLayerCompositingThreadClient::setContentsToColor(const Color& col m_contents = SkBitmap(); m_color = color; m_texture.clear(); + clearUploadedContents(); } void WebOverlayLayerCompositingThreadClient::layerCompositingThreadDestroyed(WebCore::LayerCompositingThread*) @@ -446,7 +454,8 @@ void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerComposi m_texture = Texture::create(); m_texture->protect(IntSize(m_contents.width(), m_contents.height())); IntRect bitmapRect(0, 0, m_contents.width(), m_contents.height()); - m_texture->updateContents(m_contents, bitmapRect, bitmapRect, false); + m_uploadedContents = m_contents; + m_texture->updateContents(m_uploadedContents, bitmapRect, bitmapRect, false); } void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread* layer, double /*scale*/, int positionLocation, int texCoordLocation) @@ -464,6 +473,7 @@ void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread void WebOverlayLayerCompositingThreadClient::deleteTextures(LayerCompositingThread*) { m_texture.clear(); + clearUploadedContents(); } WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread(PassRefPtr<LayerCompositingThread> layerCompositingThread) @@ -594,7 +604,7 @@ void WebOverlayPrivateCompositingThread::removeFromParent() scheduleCompositingRun(); } -void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char* data, const IntSize& imageSize) +void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char* data, const IntSize& imageSize, WebOverlay::ImageDataAdoptionType adoptionType) { if (!m_layerCompositingThreadClient) return; @@ -608,7 +618,22 @@ void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char* SkBitmap contents; contents.setConfig(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height()); - contents.setPixels(const_cast<unsigned char*>(data)); + + switch (adoptionType) { + case WebOverlay::ReferenceImageData: + contents.setPixels(const_cast<unsigned char*>(data)); + break; + case WebOverlay::CopyImageData: + if (contents.allocPixels()) { + contents.lockPixels(); + size_t bytes = SkBitmap::ComputeSize(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height()); + memcpy(contents.getPixels(), data, bytes); + contents.unlockPixels(); + } + break; + default: + ASSERT_NOT_REACHED(); + } m_layerCompositingThreadClient->setContents(contents); m_layerCompositingThread->setNeedsTexture(true); @@ -733,7 +758,7 @@ void WebOverlay::removeAnimation(const WebString&) { } -void WebOverlay::setContentsToImage(const unsigned char*, const Platform::IntSize&) +void WebOverlay::setContentsToImage(const unsigned char*, const Platform::IntSize&, ImageDataAdoptionType) { } diff --git a/Source/WebKit/blackberry/Api/WebOverlay.h b/Source/WebKit/blackberry/Api/WebOverlay.h index 5fe80c423..a59f60e28 100644 --- a/Source/WebKit/blackberry/Api/WebOverlay.h +++ b/Source/WebKit/blackberry/Api/WebOverlay.h @@ -55,6 +55,11 @@ class WebString; */ class BLACKBERRY_EXPORT WebOverlay { public: + enum ImageDataAdoptionType { + ReferenceImageData, + CopyImageData + }; + WebOverlay(); WebOverlay(WebCore::GraphicsLayerClient*); virtual ~WebOverlay(); @@ -94,7 +99,7 @@ public: bool addChild(WebOverlay*); void removeFromParent(); - void setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize); + void setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize, ImageDataAdoptionType = ReferenceImageData); void setContentsToColor(int r, int g, int b, int a); void setDrawsContent(bool); diff --git a/Source/WebKit/blackberry/Api/WebOverlay_p.h b/Source/WebKit/blackberry/Api/WebOverlay_p.h index bd274328a..d6c1dc176 100644 --- a/Source/WebKit/blackberry/Api/WebOverlay_p.h +++ b/Source/WebKit/blackberry/Api/WebOverlay_p.h @@ -24,6 +24,7 @@ #include "GraphicsLayer.h" #include "LayerCompositingThread.h" #include "Texture.h" +#include "WebOverlay.h" #include "WebOverlayOverride.h" #include <SkBitmap.h> @@ -45,7 +46,6 @@ class KeyframeValueList; namespace BlackBerry { namespace WebKit { -class WebOverlay; class WebOverlayClient; class WebPagePrivate; @@ -95,7 +95,7 @@ public: virtual void addChild(WebOverlayPrivate*) = 0; virtual void removeFromParent() = 0; - virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize) = 0; + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize, WebOverlay::ImageDataAdoptionType) = 0; virtual void setContentsToColor(const WebCore::Color&) = 0; virtual void setDrawsContent(bool) = 0; @@ -152,7 +152,7 @@ public: virtual void addChild(WebOverlayPrivate*); virtual void removeFromParent(); - virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize); + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize, WebOverlay::ImageDataAdoptionType); virtual void setContentsToColor(const WebCore::Color&); virtual void setDrawsContent(bool); @@ -202,9 +202,13 @@ public: virtual void deleteTextures(WebCore::LayerCompositingThread*); private: + void clearUploadedContents(); + +private: RefPtr<WebCore::Texture> m_texture; bool m_drawsContent; SkBitmap m_contents; + SkBitmap m_uploadedContents; WebCore::Color m_color; WebCore::LayerCompositingThread* m_layerCompositingThread; WebOverlay* m_owner; @@ -243,7 +247,7 @@ public: virtual void addChild(WebOverlayPrivate*); virtual void removeFromParent(); - virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize); + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize, WebOverlay::ImageDataAdoptionType); virtual void setContentsToColor(const WebCore::Color&); virtual void setDrawsContent(bool); diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index e4425607f..6b639bf46 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -386,10 +386,13 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In , m_cursorEventMode(ProcessedCursorEvents) , m_touchEventMode(ProcessedTouchEvents) #endif -#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO) +#if ENABLE(FULLSCREEN_API) +#if ENABLE(VIDEO) , m_scaleBeforeFullScreen(-1.0) , m_xScrollOffsetBeforeFullScreen(-1) #endif + , m_isTogglingFullScreenState(false) +#endif , m_currentCursor(Platform::CursorNone) , m_dumpRenderTree(0) // Lazy initialization. , m_initialScale(-1.0) @@ -3811,54 +3814,21 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize if (atLeft) anchor.setX(0); - double clampedScale; - // Try and zoom here with clamping on. + // FIXME: Determine why the above comment says "clamping on", yet we + // don't set enforceScaleClamping to true. + // FIXME: Determine why ensureContentVisible() is only called for !success + // in the direct-rendering case, but in all cases otherwise. Chances are + // one of these is incorrect and we can unify two branches into one. if (m_backingStore->d->shouldDirectRenderingToWindow()) { bool success = zoomAboutPoint(scale, anchor, false /* enforceScaleClamping */, true /* forceRendering */); if (!success && ensureFocusElementVisible) ensureContentVisible(!newVisibleRectContainsOldVisibleRect); - } else if (shouldZoomAboutPoint(scale, anchor, false /* enforceScaleClamping */, &clampedScale)) { - - // For some reason, the bitmap zoom wants an anchor in backingstore coordinates! - // this is different from zoomAboutPoint, which wants content coordinates. - // See RIM Bug #641. - - FloatPoint transformedAnchor = mapToTransformedFloatPoint(anchor); - FloatPoint transformedScrollPosition = mapToTransformedFloatPoint(scrollPosition()); - - // Prohibit backingstore from updating the window overtop of the bitmap. - m_backingStore->d->suspendScreenAndBackingStoreUpdates(); - - // Need to invert the previous transform to anchor the viewport. - double zoomFraction = clampedScale / transformationMatrix()->m11(); - - // Anchor offset from scroll position in float. - FloatPoint anchorOffset(transformedAnchor.x() - transformedScrollPosition.x(), - transformedAnchor.y() - transformedScrollPosition.y()); - - IntPoint srcPoint( - static_cast<int>(roundf(transformedAnchor.x() - anchorOffset.x() / zoomFraction)), - static_cast<int>(roundf(transformedAnchor.y() - anchorOffset.y() / zoomFraction))); - - const IntRect viewportRect = IntRect(IntPoint::zero(), transformedViewportSize()); - const IntRect dstRect = viewportRect; - - // This is the rect to pass as the actual source rect in the backingstore - // for the transform given by zoom. - IntRect srcRect(srcPoint.x(), - srcPoint.y(), - viewportRect.width() / zoomFraction, - viewportRect.height() / zoomFraction); - m_backingStore->d->blitContents(dstRect, srcRect); - - zoomAboutPoint(clampedScale, anchor, false /*enforceScaleClamping*/, true /*forceRendering*/); - - m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); - + } else if (zoomAboutPoint(scale, anchor, false /*enforceScaleClamping*/, true /*forceRendering*/)) { if (ensureFocusElementVisible) ensureContentVisible(!newVisibleRectContainsOldVisibleRect); + } else { // Suspend all screen updates to the backingstore. @@ -3892,6 +3862,13 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize // If we need layout then render and blit, otherwise just blit as our viewport has changed. m_backingStore->d->resumeScreenAndBackingStoreUpdates(needsLayout ? BackingStore::RenderAndBlit : BackingStore::Blit); } + +#if ENABLE(FULLSCREEN_API) + if (m_isTogglingFullScreenState) { + m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); + m_isTogglingFullScreenState = false; + } +#endif } void WebPage::setViewportSize(const Platform::IntSize& viewportSize, bool ensureFocusElementVisible) diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index 7e427648a..15e1ab919 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -525,6 +525,7 @@ public: double m_scaleBeforeFullScreen; int m_xScrollOffsetBeforeFullScreen; #endif + bool m_isTogglingFullScreenState; #endif Platform::BlackBerryCursor m_currentCursor; diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index aec03ffab..624acf7e3 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,232 @@ +2012-09-18 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Prevent scroll adjustment of input fields when region of interest mechanism active + https://bugs.webkit.org/show_bug.cgi?id=96750 + + Reviewed by Antonio Gomes. + + The region of interest mechanism replaces the scrolling/zooming + functionality in InputHandler::ensureFocusTextElementVisible(). + + We introduce a new fine-grained setting for the various adjustment + modes. The WebKit embedder can disable all scroll types in favor of the + region of interest mechanism by using the new setting. + + PR #208387 + + Reviewed internally by Mike Fenton. + + * WebKitSupport/AboutData.cpp: + (BlackBerry::WebKit::configPage): + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible): + * WebKitSupport/InputHandler.h: + +2012-09-17 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Remove dysfunctional zoom blit in setViewportSize(). + https://bugs.webkit.org/show_bug.cgi?id=96954 + PR 178411 + + Reviewed by Antonio Gomes. + + The blitContents() call removed by this patch used to + be part of scheduleZoomAboutPoint(). Its goal was to + display a preview of the zoomed contents, primarily + when auto-zoomed after rotation. Nested inside a pair + of screen suspend/resume calls, it has been a pointless + no-op for a while. + + Antonio's recent change to remove scheduleZoomAboutPoint() + and call zoomAboutPoint() from setViewportSize() directly + (the only call site) obsoletes the call completely. + The zoomAboutPoint() call itself will cause a re-render + and blit right away, so we don't care about any preview. + zoomAboutPoint() will also take care of the necessary + screen/backingstore suspension. + + The result is a vastly simplified block of code. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setViewportSize): + +2012-09-17 Antonio Gomes <agomes@rim.com> + + [BlackBerry] [FullScreen] entering/leaving fullscreen results in temporary glitches on the screen + https://bugs.webkit.org/show_bug.cgi?id=96927 + PR #180866 + + Reviewed by Yong Li. + + Suspend backing store and screen updates while entering fullscreen, + and only resume at the end, when viewport is resized. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): + (BlackBerry::WebKit::WebPagePrivate::setViewportSize): + * Api/WebPage_p.h: + (WebPagePrivate): + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::enterFullScreenForElement): + (WebCore::ChromeClientBlackBerry::exitFullScreenForElement): + +2012-09-17 Rob Buis <rbuis@rim.com> + + [BlackBerry] Fix compile problems in WebKit/blackberry + https://bugs.webkit.org/show_bug.cgi?id=96926 + + Reviewed by Antonio Gomes. + + This code is slightly out of date and so will not compile, fix it. + + * WebCoreSupport/BatteryClientBlackBerry.cpp: + (WebCore::BatteryClientBlackBerry::BatteryClientBlackBerry): + * WebCoreSupport/BatteryClientBlackBerry.h: + (WebKit): + * WebCoreSupport/CredentialTransformData.h: + * WebCoreSupport/DeviceOrientationClientBlackBerry.cpp: + (DeviceOrientationClientBlackBerry::onOrientation): + * WebCoreSupport/InspectorClientBlackBerry.h: + * WebCoreSupport/PagePopupBlackBerry.cpp: + * WebKitSupport/DOMSupport.cpp: + (BlackBerry::WebKit::DOMSupport::isDateTimeInputField): + (BlackBerry::WebKit::DOMSupport::isTextBasedContentEditableElement): + * WebKitSupport/DumpRenderTreeSupport.cpp: + (DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests): + * WebKitSupport/InPageSearchManager.cpp: + (BlackBerry::WebKit::InPageSearchManager::scopeStringMatches): + +2012-09-17 Antonio Gomes <agomes@rim.com> + + [BlackBerry] BackingStorePrivate::resumeScreenAndBackingStoreUpdates more atomic + https://bugs.webkit.org/show_bug.cgi?id=96925 + + [FullScreen] entering/leaving fullscreen results in temporary glitches on the screen (part 2/3) + PR #180866 + + Reviewed by Rob Buis. + Internally reviewed by Arvid Nilsson. + + Paraphrasing Arvid "resumeBackingStore will be a truly atomic operation. + Well more atomic than it was before, with regards to a mix of accelerated and + non-accelerated compositing content". + + I.e. by committing the root layer (if needed) when resuming the Backing + Store, we call blitVisibleContents right way, so we are actually shortcutting when + AC content will get on screen. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::resumeScreenAndBackingStoreUpdates): + +2012-09-17 Peter Wang <peter.wang@torchmobile.com.cn> + + [BlackBerry] To support "Frames View" of "TimeLine" panel in Inspector + https://bugs.webkit.org/show_bug.cgi?id=96077 + + Reviewed by Rob Buis. + + Invoke the "instrumentBeginFrame" and "instrumentCancelFrame" at the start and end of processing + render message to record one time of page's update. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::instrumentBeginFrame): + (WebKit): + (BlackBerry::WebKit::BackingStorePrivate::instrumentCancelFrame): + * Api/BackingStore_p.h: + * WebKitSupport/RenderQueue.cpp: + (BlackBerry::WebKit::RenderQueue::render): + +2012-09-17 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Support copying image data in WebOverlay. + https://bugs.webkit.org/show_bug.cgi?id=96684 + RIM PR 195444 + + Reviewed by Rob Buis. + Internally reviewed by Arvid Nilsson. + + The publicly exposed WebOverlay class provides a method + setContentsToImage() to assign a pointer to pixel data, + which is later used to provide texture data for the + underlying compositing layer. This works well for static + images that stay in memory and never change, but not + so well for images with changing contents or where the + image data is being reassigned from different image + sources that are not constantly kept around in memory. + + Due to the delayed upload and delayed fetching of + EGLImage data by the GPU, we shouldn't assume the caller + to know how long the image should be retained. Instead, + we should offer another method of setting image data + that takes ownership of the pixel data. + + This patch adds an option to setContentsToImage() that + copies the passed pixel data and doesn't destroy it + until both the texture is destroyed and the image + contents are changed. Using this method, the caller can + withdraw the passed pixel array right after the + setContentsToImage() call without consequences. + + * Api/WebOverlay.cpp: + (BlackBerry::WebKit::WebOverlay::setContentsToImage): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setContentsToImage): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::invalidate): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContents): + (WebKit): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::clearUploadedContents): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToColor): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::deleteTextures): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage): + * Api/WebOverlay.h: + * Api/WebOverlay_p.h: + (WebOverlayPrivate): + (WebOverlayPrivateWebKitThread): + (WebOverlayLayerCompositingThreadClient): + (WebOverlayPrivateCompositingThread): + +2012-09-14 Dana Jansens <danakj@chromium.org> + + Minimize collisions when hashing pairs + https://bugs.webkit.org/show_bug.cgi?id=96022 + + Reviewed by Adrienne Walker. + + Use WTF::pairIntHash() to hash a pair of integers. + + * WebKitSupport/TileIndexHash.h: + +2012-09-14 Genevieve Mak <gmak@rim.com> + + Always send mouse events on pages that don't scroll even if there + is no mouse move listener attatched. + PR #208228 + https://bugs.webkit.org/show_bug.cgi?id=96800 + + Reviewed by Antonio Gomes. + + Reviewed Internally By Antonio Gomes. + + * WebKitSupport/TouchEventHandler.cpp: + (BlackBerry::WebKit::TouchEventHandler::handleTouchPoint): + +2012-09-14 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Update the minimum zoom scale when focusing an input field. + https://bugs.webkit.org/show_bug.cgi?id=96789 + + Reviewed by Antonio Gomes. + + PR 188751. + + Increase the minimum font fix and base it on mm instead of pixels. + + Reviewed Internally by Gen Mak. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible): + 2012-09-13 Antonio Gomes <agomes@rim.com> [BlackBerry] Remove the ability to schedule a zoom about point call. diff --git a/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.cpp index c39f0698f..5b5f4e142 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.cpp @@ -22,13 +22,14 @@ #if ENABLE(BATTERY_STATUS) #include "BatteryController.h" +#include "WebPage_p.h" #include <stdio.h> namespace WebCore { BatteryClientBlackBerry::BatteryClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate) : m_webPagePrivate(webPagePrivate) - : m_tracker(0) + , m_tracker(0) { } diff --git a/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.h index a9f27a7e0..624cc7068 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.h @@ -26,6 +26,12 @@ #include <BlackBerryPlatformBatteryStatusTracker.h> #include <BlackBerryPlatformBatteryStatusTrackerListener.h> +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + namespace WebCore { class BatteryStatus; diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index 8fbf9a56a..5b4ac4aa4 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -735,6 +735,11 @@ bool ChromeClientBlackBerry::supportsFullScreenForElement(const WebCore::Element void ChromeClientBlackBerry::enterFullScreenForElement(WebCore::Element* element) { + // To avoid glitches on the screen when entering fullscreen, lets suspend the + // Backing Store screen updates and only resume at the next call of WebPagePrivate::setViewportSize. + m_webPagePrivate->m_isTogglingFullScreenState = true; + m_webPagePrivate->m_backingStore->d->suspendScreenAndBackingStoreUpdates(); + element->document()->webkitWillEnterFullScreenForElement(element); m_webPagePrivate->enterFullScreenForElement(element); element->document()->webkitDidEnterFullScreenForElement(element); @@ -743,6 +748,9 @@ void ChromeClientBlackBerry::enterFullScreenForElement(WebCore::Element* element void ChromeClientBlackBerry::exitFullScreenForElement(WebCore::Element*) { + m_webPagePrivate->m_isTogglingFullScreenState = true; + m_webPagePrivate->m_backingStore->d->suspendScreenAndBackingStoreUpdates(); + // The element passed into this function is not reliable, i.e. it could // be null. In addition the parameter may be disappearing in the future. // So we use the reference to the element we saved above. diff --git a/Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.h b/Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.h index 409c5776b..734a53b65 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.h +++ b/Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.h @@ -26,8 +26,6 @@ namespace WebCore { -class HTMLFormElement; - struct CredentialTransformData { // If the provided form is suitable for password completion, isValid() will // return true; diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp index 683647506..8519b8fa3 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp @@ -69,7 +69,7 @@ DeviceOrientationData* DeviceOrientationClientBlackBerry::lastOrientation() cons void DeviceOrientationClientBlackBerry::onOrientation(const BlackBerry::Platform::DeviceOrientationEvent* event) { - m_currentOrientation = DeviceOrientation::create(true, event->alpha, true, event->beta, true, event->gamma); + m_currentOrientation = DeviceOrientationData::create(true, event->alpha, true, event->beta, true, event->gamma); if (!m_controller) return; diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h index 34a553650..0591cdd03 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h @@ -22,6 +22,7 @@ #include "InspectorClient.h" #include "InspectorFrontendChannel.h" +#include "InspectorOverlay.h" #include "InspectorOverlayBlackBerry.h" #include <wtf/HashMap.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp index 81c148ffd..e00fb5809 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp @@ -19,6 +19,7 @@ #include "PagePopupBlackBerry.h" +#include "DocumentLoader.h" #include "EmptyClients.h" #include "FrameView.h" #include "JSDOMBinding.h" diff --git a/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp index 24260b039..5ccef3c0e 100644 --- a/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp @@ -139,7 +139,7 @@ static String configPage() page += numberToHTMLTr("selectionEnabled", settings->selectionEnabled()); page += numberToHTMLTr("fineCursorControlEnabled", settings->fineCursorControlEnabled()); page += numberToHTMLTr("alwaysShowKeyboardOnFocus", settings->alwaysShowKeyboardOnFocus()); - page += numberToHTMLTr("allowCenterScrollAdjustmentForInputFields", settings->allowCenterScrollAdjustmentForInputFields()); + page += numberToHTMLTr("allowedScrollAdjustmentForInputFields", settings->allowedScrollAdjustmentForInputFields()); page += numberToHTMLTr("unrestrictedResizeEvents", settings->unrestrictedResizeEvents()); page += numberToHTMLTr("isBridgeBrowser", settings->isBridgeBrowser()); page += numberToHTMLTr("showImageLocationOptionsInGCM", settings->showImageLocationOptionsInGCM()); diff --git a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp index bb0a02851..a2c16d0d1 100644 --- a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp @@ -170,11 +170,11 @@ bool isDateTimeInputField(const Element* element) const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element); // The following types have popup's. - if (inputElement->isDateControl() - || inputElement->isDateTimeControl() - || inputElement->isDateTimeLocalControl() - || inputElement->isTimeControl() - || inputElement->isMonthControl()) + if (inputElement->isDateField() + || inputElement->isDateTimeField() + || inputElement->isDateTimeLocalField() + || inputElement->isTimeField() + || inputElement->isMonthField()) return true; return false; @@ -249,7 +249,7 @@ bool isTextBasedContentEditableElement(Element* element) if (!element) return false; - if (element->isReadOnlyFormControl() || !element->isEnabledFormControl()) + if (element->isReadOnlyNode() || !element->isEnabledFormControl()) return false; if (isPopupInputField(element)) diff --git a/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp b/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp index b777db06a..e4e4ef0c0 100644 --- a/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp @@ -28,7 +28,6 @@ #include "JSCSSStyleDeclaration.h" #include "JSElement.h" #include "Page.h" -#include "ViewportArguments.h" #include "WebPage_p.h" #include "bindings/js/GCController.h" #include <JavaScriptCore/APICast.h> @@ -86,7 +85,7 @@ bool DumpRenderTreeSupport::linksIncludedInFocusChain() int DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(WebPage* webPage) { - GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController(corePage(webPage))->client()); + GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage(webPage))->client()); return mockClient->numberOfPendingPermissionRequests(); } diff --git a/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp b/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp index c57de91b0..b24fda3a6 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp @@ -27,6 +27,7 @@ #include "Node.h" #include "Page.h" #include "Range.h" +#include "ShadowRoot.h" #include "TextIterator.h" #include "Timer.h" #include "WebPage_p.h" @@ -325,7 +326,7 @@ void InPageSearchManager::scopeStringMatches(const String& text, bool reset, boo resultRange->ownerDocument()->markers()->addTextMatchMarker(resultRange.get(), foundActiveMatch); searchRange->setStart(resultRange->endContainer(ec), resultRange->endOffset(ec), ec); - Node* shadowTreeRoot = searchRange->shadowTreeRootNode(); + ShadowRoot* shadowTreeRoot = searchRange->shadowRoot(); if (searchRange->collapsed(ec) && shadowTreeRoot) searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), ec); m_resumeScopingFromRange = resultRange; diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index 690c1bbb7..0048a6430 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -66,6 +66,7 @@ #include <BlackBerryPlatformKeyboardEvent.h> #include <BlackBerryPlatformLog.h> #include <BlackBerryPlatformMisc.h> +#include <BlackBerryPlatformScreen.h> #include <BlackBerryPlatformSettings.h> #include <sys/keycodes.h> #include <wtf/text/CString.h> @@ -1050,7 +1051,7 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) if (!isActiveTextEdit() || !isInputModeEnabled() || !m_currentFocusElement->document()) return; - if (!Platform::Settings::instance()->allowCenterScrollAdjustmentForInputFields() && scrollType != EdgeIfNeeded) + if (!(Platform::Settings::instance()->allowedScrollAdjustmentForInputFields() & scrollType)) return; Frame* elementFrame = m_currentFocusElement->document()->frame(); @@ -1158,9 +1159,10 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) } // If the text is too small, zoom in to make it a minimum size. - static const int s_minimumTextHeightInPixels = 6; + // The minimum size being defined as 3 mm is a good value based on my observations. + static const int s_minimumTextHeightInPixels = Graphics::Screen::primaryScreen()->widthInMMToPixels(3); if (fontHeight && fontHeight < s_minimumTextHeightInPixels) - m_webPage->zoomAboutPoint(s_minimumTextHeightInPixels / fontHeight, m_webPage->centerOfVisibleContentsRect()); + m_webPage->zoomAboutPoint(s_minimumTextHeightInPixels / fontHeight, selectionFocusRect.location()); } void InputHandler::ensureFocusPluginElementVisible() diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.h b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h index e6d3297f7..c65b9916b 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.h +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h @@ -22,6 +22,7 @@ #include "TextChecking.h" #include <BlackBerryPlatformInputEvents.h> +#include <BlackBerryPlatformSettings.h> #include <imf/events.h> #include <imf/input_data.h> @@ -65,7 +66,9 @@ public: ~InputHandler(); enum FocusElementType { TextEdit, TextPopup /* Date/Time & Color */, SelectPopup, Plugin }; - enum CaretScrollType { CenterAlways, CenterIfNeeded, EdgeIfNeeded }; + enum CaretScrollType { CenterAlways = BlackBerry::Platform::Settings::ScrollAdjustmentCenterAlways, + CenterIfNeeded = BlackBerry::Platform::Settings::ScrollAdjustmentCenterIfNeeded, + EdgeIfNeeded = BlackBerry::Platform::Settings::ScrollAdjustmentEdgeIfNeeded }; bool isInputModeEnabled() const; void setInputModeEnabled(bool active = true); diff --git a/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp b/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp index 110be1aa1..eb2593b21 100644 --- a/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp @@ -564,6 +564,8 @@ void RenderQueue::render(bool shouldPerformRegularRenderJobs) double time = WTF::currentTime(); #endif + m_parent->instrumentBeginFrame(); + m_parent->requestLayoutIfNeeded(); #if DEBUG_RENDER_QUEUE @@ -584,6 +586,8 @@ void RenderQueue::render(bool shouldPerformRegularRenderJobs) renderRegularRenderJob(); } else if (!m_nonVisibleScrollJobs.empty()) renderNonVisibleScrollJob(); + + m_parent->instrumentCancelFrame(); } void RenderQueue::renderAllCurrentRegularRenderJobs() diff --git a/Source/WebKit/blackberry/WebKitSupport/TileIndexHash.h b/Source/WebKit/blackberry/WebKitSupport/TileIndexHash.h index 0d4633b75..29d1603c5 100644 --- a/Source/WebKit/blackberry/WebKitSupport/TileIndexHash.h +++ b/Source/WebKit/blackberry/WebKitSupport/TileIndexHash.h @@ -28,7 +28,7 @@ using BlackBerry::WebKit::TileIndex; namespace WTF { template<> struct IntHash<TileIndex> { - static unsigned hash(const TileIndex& key) { return intHash((static_cast<uint64_t>(key.i()) << 32 | key.j())); } + static unsigned hash(const TileIndex& key) { return pairIntHash(key.i(), key.j()); } static bool equal(const TileIndex& a, const TileIndex& b) { return a == b; } static const bool safeToCompareToEmptyOrDeleted = true; }; diff --git a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp index 5aa77f5be..946ef7f6b 100644 --- a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp @@ -187,6 +187,7 @@ bool TouchEventHandler::handleTouchPoint(Platform::TouchPoint& point, bool useFa // Enable input mode on any touch event. m_webPage->m_inputHandler->setInputModeEnabled(); bool pureWithMouseConversion = m_webPage->m_touchEventMode == PureTouchEventsWithMouseConversion; + bool alwaysEnableMouseConversion = pureWithMouseConversion || (!isMainFrameScrollable(m_webPage) && !m_webPage->m_inRegionScroller->d->isActive()); switch (point.m_state) { case Platform::TouchPoint::TouchPressed: @@ -208,7 +209,7 @@ bool TouchEventHandler::handleTouchPoint(Platform::TouchPoint& point, bool useFa // Set or reset the touch mode. Element* possibleTargetNodeForMouseMoveEvents = static_cast<Element*>(m_lastFatFingersResult.positionWasAdjusted() ? elementUnderFatFinger : m_lastFatFingersResult.node()); - m_convertTouchToMouse = pureWithMouseConversion ? true : shouldConvertTouchToMouse(possibleTargetNodeForMouseMoveEvents); + m_convertTouchToMouse = alwaysEnableMouseConversion ? true : shouldConvertTouchToMouse(possibleTargetNodeForMouseMoveEvents); if (!possibleTargetNodeForMouseMoveEvents || (!possibleTargetNodeForMouseMoveEvents->hasEventListeners(eventNames().touchmoveEvent) && !m_convertTouchToMouse)) m_webPage->client()->notifyNoMouseMoveOrTouchMoveHandlers(); @@ -274,9 +275,7 @@ bool TouchEventHandler::handleTouchPoint(Platform::TouchPoint& point, bool useFa PlatformMouseEvent mouseEvent(point.m_pos, m_lastScreenPoint, PlatformEvent::MouseMoved, 1, LeftButton, TouchScreen); m_lastScreenPoint = point.m_screenPos; if (!m_webPage->handleMouseEvent(mouseEvent)) { - // If the page is scrollable and the first event is not handled, ignore subsequent mouse moves. - if (isMainFrameScrollable(m_webPage) || m_webPage->m_inRegionScroller->d->isActive() ) - m_convertTouchToMouse = pureWithMouseConversion; + m_convertTouchToMouse = alwaysEnableMouseConversion; return false; } return true; diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index df6051fb3..851e43976 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,267 @@ +2012-09-17 Brian Anderson <brianderson@chromium.org> + + [chromium] Add rendering commit statistics + https://bugs.webkit.org/show_bug.cgi?id=96938 + + Reviewed by James Robinson. + + Adds total commit time and total commit count to WebRenderingStats. + Allows us to caculate average commit time in performance tests. + + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::renderingStats): + +2012-09-17 James Robinson <jamesr@chromium.org> + + [chromium] Move a FilterOperationsTest and WebInputEventConversionTest back to webkit_unittest_files variable + https://bugs.webkit.org/show_bug.cgi?id=96964 + + Reviewed by Adrienne Walker. + + These targets are really webkit unit tests and shouldn't be guarded by use_libcc_for_compositor. + + * WebKit.gypi: + +2012-09-17 Rick Byers <rbyers@chromium.org> + + Send GestureTapDownCancel to WebCore + https://bugs.webkit.org/show_bug.cgi?id=96060 + + Reviewed by Antonio Gomes. + + Plumb WebInputEvent::GetsureTapCancel to + PlatformInputEvent::GestureTapDownCancel. After all the chromium code + was landed, it was suggested that 'TapDownCancel' was a better name + than 'TapCancel' since you can't cancel a Tap. I'm not changing the + WebInputEvent definition here because that would be a breaking change + to chromium, but I can do that as a series of follow-up CLs. + * src/WebInputEventConversion.cpp: + (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::handleInputEvent): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + +2012-09-17 Alec Flett <alecflett@chromium.org> + + IndexedDB: Use ScriptValue instead of SerializedScriptValue for get/openCursor + https://bugs.webkit.org/show_bug.cgi?id=95409 + + Reviewed by Kentaro Hara. + + This removes a bunch of tests that have been migrated to + LayoutTests, in https://bugs.webkit.org/show_bug.cgi?id=96818. + + * tests/IDBBindingUtilitiesTest.cpp: + (WebCore::checkKeyFromValueAndKeyPathInternal): + (WebCore::checkKeyPathNullValue): + (WebCore::injectKey): + (WebCore::checkInjection): + (WebCore::checkInjectionFails): + (WebCore::checkKeyPathStringValue): + (WebCore::checkKeyPathNumberValue): + (WebCore::TEST): + * tests/IDBKeyPathTest.cpp: + +2012-09-17 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Fix cases where find-in-page doesn't send a final update + https://bugs.webkit.org/show_bug.cgi?id=96402 + + Fix some issues in the WebKit implementation that prevented to send a final + reportFindInPageMatchCount message. + + Reviewed by Adam Barth. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::scopeStringMatches): + (WebKit): + (WebKit::WebFrameImpl::finishCurrentScopingEffort): + (WebKit::WebFrameImpl::cancelPendingScopingEffort): + (WebKit::WebFrameImpl::WebFrameImpl): + (WebKit::WebFrameImpl::shouldScopeMatches): + * src/WebFrameImpl.h: + +2012-09-17 Joshua Bell <jsbell@chromium.org> + + [Chromium] IndexedDB: Remove legacy two-phase open() API members + https://bugs.webkit.org/show_bug.cgi?id=96802 + + Reviewed by Tony Chang. + + Following http://webkit.org/b/90411 and subsequent cleanup on the Chromium side, + these entry points are no longer needed. + + * public/WebIDBDatabase.h: Delete old second-phase open(db-callbacks) + * public/WebIDBFactory.h: Delete old first-phase open() w/o db-callbacks + * src/WebIDBDatabaseImpl.cpp: No longer need to account for a close between phases. + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::close): + (WebKit::WebIDBDatabaseImpl::forceClose): + * src/WebIDBDatabaseImpl.h: + (WebIDBDatabaseImpl): + +2012-09-17 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed. Temporary disable visited set counter check. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore::TEST): + +2012-09-17 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: now when we can detect instrumented classes we can + remove addInstrumentedMember and use addMember for everything. + https://bugs.webkit.org/show_bug.cgi?id=96913 + + Reviewed by Yury Semikhatsky. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore::InstrumentedDOM::reportMemoryUsage): + (WebCore::NonVirtualInstrumented::reportMemoryUsage): + (WebCore::InstrumentedOwner::reportMemoryUsage): + +2012-09-17 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed single line fix for mac chromium canary bot. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore::TEST): + +2012-09-15 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: automatically detect if class has reportMemoryUsage method + https://bugs.webkit.org/show_bug.cgi?id=96756 + + Reviewed by Alexander Pavlov. + + Test that reportMemoryUsage method will be called on the instrumented object + even if it is a template. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore): + (InstrumentedTemplate): + (WebCore::InstrumentedTemplate::InstrumentedTemplate): + (WebCore::InstrumentedTemplate::reportMemoryUsage): + (WebCore::TEST): + +2012-09-14 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: OwnPtr and RefPtr reported by pointer can be double counted by the memory instrumentation + https://bugs.webkit.org/show_bug.cgi?id=96791 + + Reviewed by Alexander Pavlov. + + Test that pointers to RefPtr and OwnPtr won't be double counted by + the memory instrumentation. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore): + (TwoPointersToRefPtr): + (WebCore::TwoPointersToRefPtr::TwoPointersToRefPtr): + (WebCore::TwoPointersToRefPtr::reportMemoryUsage): + (WebCore::TEST): + (TwoPointersToOwnPtr): + (WebCore::TwoPointersToOwnPtr::TwoPointersToOwnPtr): + (WebCore::TwoPointersToOwnPtr::reportMemoryUsage): + +2012-09-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-09-14 Julien Chaffraix <jchaffraix@webkit.org> + + Revert r127457 and following fixes due to several hit-testing regressions + https://bugs.webkit.org/show_bug.cgi?id=96830 + + Reviewed by Antonio Gomes. + + This change reverts r127457, r127863 and r128505. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2012-09-14 Ojan Vafai <ojan@chromium.org> + + Provide a runtime setting to disable position:sticky + https://bugs.webkit.org/show_bug.cgi?id=96827 + + Reviewed by James Robinson. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setCSSStickyPositionEnabled): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-09-14 Adam Barth <abarth@webkit.org> + + Remove webkitPostMessage + https://bugs.webkit.org/show_bug.cgi?id=96577 + + Reviewed by Ojan Vafai. + + Add ENABLE_LEGACY_VENDOR_PREFIXES flag. + + * features.gypi: + +2012-09-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-09-14 Rick Byers <rbyers@chromium.org> + + [chromium] add touch area to gestureTapDown data + https://bugs.webkit.org/show_bug.cgi?id=96806 + + Reviewed by Adam Barth. + + Add width/height for GestureTapDown as for GestureTap/LongPress so that + we can eventually do fuzzing on it. + * public/WebInputEvent.h: + * src/WebInputEventConversion.cpp: + (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder): + +2012-09-14 Peter Beverloo <peter@chromium.org> + + [Chromium] Support the --{in,out,err}-fifo arguments on TestWebKitAPI and webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=96687 + + Reviewed by Tony Chang. + + Android's DumpRenderTree currently supports these arguments, implemented + as part of TestShellAndroid: + http://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp?rev=128496 + + They're used by the layout test runner to get the STDOUT and STDERR while + a layout test run is in process, which is a safer alternative to parsing + all the logcat output manually. The implementation can be seen here: + http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py?rev=128496#L590 + + This patch generalizes parsing of and applying the effects of these arguments + so that they can be used for TestWebKitAPI and webkit_unit_tests as well. + After this patch, this will make it possible to pull out the output-reading + code from Android's layout test port and generalize it so it can be re-used + in the new test-runner for the other two test suites. + + This has no effect when compiling and running these tests as part of Chromium + code, which has a much more advanced test-runner that does parse complete log + output, but also directly depends on code licensed under Apache 2. + + * WebKit.gypi: + * tests/ForwardIOStreamsAndroid.cpp: Added. + (WebKit): + (WebKit::maybeInitIOStreamForwardingForAndroid): + * tests/ForwardIOStreamsAndroid.h: Added. + (WebKit): + * tests/RunAllTests.cpp: + (main): + 2012-09-14 Keishi Hattori <keishi@webkit.org> Make time input lang attribute aware for testing diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index a01b3757e..c5ab4a936 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': '156485' + 'chromium_rev': '157063' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 5d3f850d5..edebf1b3c 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -62,6 +62,7 @@ 'tests/DecimalTest.cpp', 'tests/DragImageTest.cpp', 'tests/EventListenerTest.cpp', + 'tests/FilterOperationsTest.cpp', 'tests/FrameLoaderClientImplTest.cpp', 'tests/FrameTestHelpers.cpp', 'tests/FrameTestHelpers.h', @@ -101,6 +102,7 @@ 'tests/WebCompositorInitializer.h', 'tests/WebCompositorInputHandlerImplTest.cpp', 'tests/WebFrameTest.cpp', + 'tests/WebInputEventConversionTest.cpp', 'tests/WebMediaPlayerClientImplTest.cpp', 'tests/WebPageNewSerializerTest.cpp', 'tests/WebPageSerializerTest.cpp', @@ -165,7 +167,6 @@ 'tests/FakeWebCompositorOutputSurface.h', 'tests/FakeWebGraphicsContext3D.h', 'tests/FakeWebScrollbarThemeGeometry.h', - 'tests/FilterOperationsTest.cpp', 'tests/FloatQuadTest.cpp', 'tests/LayerChromiumTest.cpp', 'tests/MockCCQuadCuller.h', @@ -177,7 +178,6 @@ 'tests/TreeSynchronizerTest.cpp', 'tests/WebAnimationTest.cpp', 'tests/WebFloatAnimationCurveTest.cpp', - 'tests/WebInputEventConversionTest.cpp', 'tests/WebLayerTest.cpp', 'tests/WebLayerTreeViewTest.cpp', 'tests/WebLayerTreeViewTestCommon.h', diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index 18adac9f0..83b32cf6e 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -126,6 +126,7 @@ 'type': 'shared_library', 'dependencies': [ '<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code', + 'io_stream_forwarder_android', ], }], ], @@ -208,6 +209,20 @@ '<(android_app_abi)', ], }], + }, + # FIXME: When the Android test runner framework in Chromium has stabilized enough, + # we should switch to using that and will no longer need the stream forwarding. + # https://bugs.webkit.org/show_bug.cgi?id=96764 + { + 'target_name': 'io_stream_forwarder_android', + 'type': 'static_library', + 'sources': [ + 'tests/ForwardIOStreamsAndroid.cpp', + 'tests/ForwardIOStreamsAndroid.h', + ], + 'dependencies': [ + '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', + ], }], }], ], diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index b98db36d9..c51035d71 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -77,6 +77,7 @@ 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0', 'ENABLE_LEGACY_VIEWPORT_ADAPTION=1', + 'ENABLE_LEGACY_VENDOR_PREFIXES=1', 'ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1', 'ENABLE_LINK_PREFETCH=1', 'ENABLE_LINK_PRERENDER=1', diff --git a/Source/WebKit/chromium/public/WebIDBDatabase.h b/Source/WebKit/chromium/public/WebIDBDatabase.h index 592a10e3e..83b9a425f 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabase.h +++ b/Source/WebKit/chromium/public/WebIDBDatabase.h @@ -66,9 +66,6 @@ public: virtual void close() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void forceClose() { WEBKIT_ASSERT_NOT_REACHED(); } - // FIXME: Remove this method after WK90411 cleanup is complete on the Chromium side. - virtual void open(WebIDBDatabaseCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - protected: WebIDBDatabase() { } }; diff --git a/Source/WebKit/chromium/public/WebIDBFactory.h b/Source/WebKit/chromium/public/WebIDBFactory.h index 69a453abc..12ecf07c7 100644 --- a/Source/WebKit/chromium/public/WebIDBFactory.h +++ b/Source/WebKit/chromium/public/WebIDBFactory.h @@ -55,10 +55,6 @@ public: virtual void getDatabaseNames(WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } - // FIXME: Remove this overload after WK90411 cleanup is complete on the Chromium side. - // The WebKit implementation of open ignores the WebFrame* parameter. - virtual void open(const WebString& name, long long version, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } - // The WebKit implementation of open ignores the WebFrame* parameter. virtual void open(const WebString& name, long long version, WebIDBCallbacks* callbacks, WebIDBDatabaseCallbacks* databaseCallbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h index 075bd0c4e..f3edaf95e 100644 --- a/Source/WebKit/chromium/public/WebInputEvent.h +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -388,6 +388,11 @@ public: struct { int width; int height; + } tapDown; + + struct { + int width; + int height; } longPress; struct { diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index fd0dcb649..5ff206b0a 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -93,6 +93,7 @@ public: virtual void setEnableScrollAnimator(bool) = 0; virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; + virtual void setCSSStickyPositionEnabled(bool) = 0; virtual void setExperimentalCSSRegionsEnabled(bool) = 0; virtual void setExperimentalCSSVariablesEnabled(bool) = 0; virtual void setExperimentalWebGLEnabled(bool) = 0; diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 5b0b01014..641a585a0 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -160,7 +160,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( Frame* selectedFrame = r.innerNonSharedNode()->document()->frame(); WebContextMenuData data; - data.mousePosition = r.roundedPoint(); + data.mousePosition = selectedFrame->view()->contentsToWindow(r.roundedPoint()); // Compute edit flags. data.editFlags = WebContextMenuData::CanDoNone; diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index eb02351da..7bb0efeea 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1779,17 +1779,15 @@ void WebFrameImpl::scopeStringMatches(int identifier, const WebFindOptions& options, bool reset) { - if (!shouldScopeMatches(searchText)) - return; - WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); if (reset) { // This is a brand new search, so we need to reset everything. // Scoping is just about to begin. m_scopingComplete = false; + // Clear highlighting for this frame. - if (frame()->editor()->markedTextMatchesAreHighlighted()) + if (frame() && frame()->editor()->markedTextMatchesAreHighlighted()) frame()->page()->unmarkAllTextMatches(); // Clear the tickmarks and results cache. @@ -1812,6 +1810,14 @@ void WebFrameImpl::scopeStringMatches(int identifier, return; } + if (!shouldScopeMatches(searchText)) { + // Note that we want to defer the final update when resetting even if shouldScopeMatches returns false. + // This is done in order to prevent sending a final message based only on the results of the first frame + // since m_framesScopingCount would be 0 as other frames have yet to reset. + finishCurrentScopingEffort(identifier); + return; + } + RefPtr<Range> searchRange(rangeOfContents(frame()->document())); Node* originalEndContainer = searchRange->endContainer(); @@ -1938,10 +1944,18 @@ void WebFrameImpl::scopeStringMatches(int identifier, return; // Done for now, resume work later. } + finishCurrentScopingEffort(identifier); +} + +void WebFrameImpl::finishCurrentScopingEffort(int identifier) +{ + WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); + // This frame has no further scoping left, so it is done. Other frames might, // of course, continue to scope matches. m_scopingComplete = true; mainFrameImpl->m_framesScopingCount--; + m_lastFindRequestCompletedWithNoMatches = !m_lastMatchCount; // If this is the last frame to finish scoping we need to trigger the final // update to be sent. @@ -1958,6 +1972,9 @@ void WebFrameImpl::cancelPendingScopingEffort() m_deferredScopingWork.clear(); m_activeMatchIndexInCurrentFrame = -1; + + if (!m_scopingComplete) + m_lastFindRequestCompletedWithNoMatches = false; } void WebFrameImpl::increaseMatchCount(int count, int identifier) @@ -2330,6 +2347,7 @@ WebFrameImpl::WebFrameImpl(WebFrameClient* client) , m_totalMatchCount(-1) , m_framesScopingCount(-1) , m_scopingComplete(false) + , m_lastFindRequestCompletedWithNoMatches(false) , m_nextInvalidateAfter(0) , m_findMatchMarkersVersion(0) , m_findMatchRectsAreValid(false) @@ -2612,9 +2630,9 @@ int WebFrameImpl::ordinalOfFirstMatchForFrame(WebFrameImpl* frame) const bool WebFrameImpl::shouldScopeMatches(const String& searchText) { - // Don't scope if we can't find a frame or a view or if the frame is not visible. + // Don't scope if we can't find a frame or a view. // The user may have closed the tab/application, so abort. - if (!frame() || !frame()->view() || !hasVisibleContent()) + if (!frame() || !frame()->view()) return false; ASSERT(frame()->document() && frame()->view()); @@ -2622,7 +2640,7 @@ bool WebFrameImpl::shouldScopeMatches(const String& searchText) // If the frame completed the scoping operation and found 0 matches the last // time it was searched, then we don't have to search it again if the user is // just adding to the search string or sending the same search string again. - if (m_scopingComplete && !m_lastSearchString.isEmpty() && !m_lastMatchCount) { + if (m_lastFindRequestCompletedWithNoMatches && !m_lastSearchString.isEmpty()) { // Check to see if the search string prefixes match. String previousSearchPrefix = searchText.substring(0, m_lastSearchString.length()); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index e59c932c5..58525d701 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -385,6 +385,9 @@ private: // was searched. bool shouldScopeMatches(const WTF::String& searchText); + // Finishes the current scoping effort and triggers any updates if appropriate. + void finishCurrentScopingEffort(int identifier); + // Queue up a deferred call to scopeStringMatches. void scopeStringMatchesSoon( int identifier, const WebString& searchText, const WebFindOptions&, @@ -456,6 +459,10 @@ private: // interrupt it before it completes by submitting a new search). bool m_scopingComplete; + // Keeps track of whether the last find request completed its scoping effort + // without finding any matches in this frame. + bool m_lastFindRequestCompletedWithNoMatches; + // Keeps track of when the scoping effort should next invalidate the scrollbar // and the frame area. int m_nextInvalidateAfter; diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 52879a9a7..b58cd5111 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -48,7 +48,6 @@ namespace WebKit { WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabaseBackendInterface> databaseBackend, WTF::PassRefPtr<IDBDatabaseCallbacksProxy> databaseCallbacks) : m_databaseBackend(databaseBackend) , m_databaseCallbacks(databaseCallbacks) - , m_closePending(false) { } @@ -96,19 +95,15 @@ void WebIDBDatabaseImpl::close() { // Use the callbacks passed in to the constructor so that the backend in // multi-process chromium knows which database connection is closing. - if (!m_databaseCallbacks) { - m_closePending = true; + if (!m_databaseCallbacks) return; - } m_databaseBackend->close(m_databaseCallbacks.release()); } void WebIDBDatabaseImpl::forceClose() { - if (!m_databaseCallbacks) { - m_closePending = true; + if (!m_databaseCallbacks) return; - } RefPtr<IDBDatabaseCallbacksProxy> callbacks = m_databaseCallbacks.release(); m_databaseBackend->close(callbacks); callbacks->onForcedClose(); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h index 9cd1caf59..518ffcdb9 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -62,9 +62,6 @@ public: private: WTF::RefPtr<WebCore::IDBDatabaseBackendInterface> m_databaseBackend; WTF::RefPtr<IDBDatabaseCallbacksProxy> m_databaseCallbacks; - // FIXME: Remove this flag when we consolidate two-phase open. - // http://wkb.ug/90411 - bool m_closePending; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 2afc7dcfe..0cc1e0c24 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -160,6 +160,10 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureTapDown: m_type = PlatformEvent::GestureTapDown; + m_area = IntSize(e.data.tapDown.width, e.data.tapDown.height); + break; + case WebInputEvent::GestureTapCancel: + m_type = PlatformEvent::GestureTapDownCancel; break; case WebInputEvent::GestureDoubleTap: m_type = PlatformEvent::GestureDoubleTap; diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index bb898c966..760cc6835 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -195,6 +195,8 @@ void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const stats.droppedFrameCount = ccStats.droppedFrameCount; stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; + stats.totalCommitTimeInSeconds = ccStats.totalCommitTimeInSeconds; + stats.totalCommitCount = ccStats.totalCommitCount; } void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectTable[128], int fontHeight) diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp index 58a2855cd..51114020b 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -277,6 +277,7 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::GestureFlingCancel: case WebInputEvent::GestureTap: case WebInputEvent::GestureTapDown: + case WebInputEvent::GestureTapCancel: case WebInputEvent::GestureDoubleTap: case WebInputEvent::GestureTwoFingerTap: case WebInputEvent::GestureLongPress: @@ -288,7 +289,6 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::Undefined: case WebInputEvent::MouseEnter: case WebInputEvent::ContextMenu: - case WebInputEvent::GestureTapCancel: return false; } return false; diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 51731fd8f..4cc3ef727 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -337,6 +337,11 @@ void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled) m_settings->setWebGLEnabled(enabled); } +void WebSettingsImpl::setCSSStickyPositionEnabled(bool enabled) +{ + m_settings->setCSSStickyPositionEnabled(enabled); +} + void WebSettingsImpl::setExperimentalCSSRegionsEnabled(bool enabled) { m_settings->setCSSRegionsEnabled(enabled); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index a5f7c0235..e9e01bfcd 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -85,6 +85,7 @@ public: virtual void setEnableScrollAnimator(bool); virtual void setExperimentalCSSCustomFilterEnabled(bool); virtual void setExperimentalCSSGridLayoutEnabled(bool); + virtual void setCSSStickyPositionEnabled(bool); virtual void setExperimentalCSSRegionsEnabled(bool); virtual void setExperimentalCSSVariablesEnabled(bool); virtual void setExperimentalWebGLEnabled(bool); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index d18cd236c..97416e024 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -765,15 +765,12 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) m_client->cancelScheduledContentIntents(); case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: + case WebInputEvent::GestureTapCancel: case WebInputEvent::GesturePinchEnd: case WebInputEvent::GesturePinchUpdate: { PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); } - case WebInputEvent::GestureTapCancel: - // FIXME: Update WebCore to handle this event after chromium has been updated to send it - // http://wkb.ug/96060 - return false; default: ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.cpp b/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.cpp new file mode 100644 index 000000000..0ca5c1b5b --- /dev/null +++ b/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.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 "ForwardIOStreamsAndroid.h" + +#include <android/log.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <wtf/StdLibExtras.h> + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +namespace { + +const char optionInFIFO[] = "--in-fifo="; +const char optionOutFIFO[] = "--out-fifo="; +const char optionErrFIFO[] = "--err-fifo="; + +void androidLogError(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); + +void androidLogError(const char* format, ...) +{ + va_list args; + va_start(args, format); + __android_log_vprint(ANDROID_LOG_ERROR, "WebKit", format, args); + va_end(args); +} + +void removeArg(int index, int* argc, char*** argv) +{ + for (int i = index; i < *argc; ++i) + (*argv)[i] = (*argv)[i + 1]; + --*argc; +} + +void createFIFO(const char* fifoPath) +{ + unlink(fifoPath); + // 0666 is rw-rw-rw-, to allow adb shell to read/write the fifo. + // Explicitly call chmod to ensure the mode is set despite umask. + if (mkfifo(fifoPath, 0666) || chmod(fifoPath, 0666)) { + androidLogError("Failed to create fifo %s: %s\n", fifoPath, strerror(errno)); + exit(EXIT_FAILURE); + } +} + +void redirect(FILE* stream, const char* path, const char* mode) +{ + if (!freopen(path, mode, stream)) { + androidLogError("Failed to redirect stream to file: %s: %s\n", path, strerror(errno)); + exit(EXIT_FAILURE); + } +} + +} // namespace + +namespace WebKit { + +void maybeInitIOStreamForwardingForAndroid(int* argc, char*** argv) +{ + const char* inFIFO = 0; + const char* outFIFO = 0; + const char* errFIFO = 0; + for (int i = 1; i < *argc; ) { + const char* argument = (*argv)[i]; + if (strstr(argument, optionInFIFO) == argument) { + inFIFO = argument + WTF_ARRAY_LENGTH(optionInFIFO) - 1; + createFIFO(inFIFO); + removeArg(i, argc, argv); + } else if (strstr(argument, optionOutFIFO) == argument) { + outFIFO = argument + WTF_ARRAY_LENGTH(optionOutFIFO) - 1; + createFIFO(outFIFO); + removeArg(i, argc, argv); + } else if (strstr(argument, optionErrFIFO) == argument) { + errFIFO = argument + WTF_ARRAY_LENGTH(optionErrFIFO) - 1; + createFIFO(errFIFO); + removeArg(i, argc, argv); + } else + ++i; + } + + // The order of createFIFO() and redirectToFIFO() is important to avoid deadlock. + if (outFIFO) + redirect(stdout, outFIFO, "w"); + if (inFIFO) + redirect(stdin, inFIFO, "r"); + if (errFIFO) + redirect(stderr, errFIFO, "w"); + else { + // Redirect stderr to stdout. + dup2(1, 2); + } +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.h b/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.h new file mode 100644 index 000000000..6dbc638b4 --- /dev/null +++ b/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.h @@ -0,0 +1,40 @@ +/* + * 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 ForwardIOStreamsAndroid_h +#define ForwardIOStreamsAndroid_h + +namespace WebKit { + +// The test executables for Android support three additional command line flags +// (--in-fifo, --out-fifo and --err-fifo) to make it possible to retrieve input +// from a file instead of STDIN, and to forward STDOUT and STDERR to files. When +// running DumpRenderTree, TestWebKitAPI or webkit_unit_tests in WebKit +// infrastructure, these will be used instead of parsing all log output. +void maybeInitIOStreamForwardingForAndroid(int* argc, char*** argv); + +} // namespace WebKit + +#endif // ForwardIOStreamsAndroid_h diff --git a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp index c2d5e7541..46710e745 100644 --- a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp +++ b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp @@ -27,7 +27,6 @@ #include "IDBBindingUtilities.h" #include "IDBKey.h" #include "IDBKeyPath.h" -#include "SerializedScriptValue.h" #include "V8PerIsolateData.h" #include "V8Utilities.h" @@ -40,41 +39,42 @@ using namespace WebCore; namespace { -PassRefPtr<IDBKey> checkKeyFromValueAndKeyPathInternal(SerializedScriptValue* value, const String& keyPath) +PassRefPtr<IDBKey> checkKeyFromValueAndKeyPathInternal(const ScriptValue& value, const String& keyPath) { IDBKeyPath idbKeyPath(keyPath); EXPECT_TRUE(idbKeyPath.isValid()); - return createIDBKeyFromSerializedValueAndKeyPath(value, idbKeyPath); + + return createIDBKeyFromScriptValueAndKeyPath(value, idbKeyPath); } -void checkKeyPathNullValue(SerializedScriptValue* value, const String& keyPath) +void checkKeyPathNullValue(const ScriptValue& value, const String& keyPath) { RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); ASSERT_FALSE(idbKey.get()); } -PassRefPtr<SerializedScriptValue> injectKey(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const String& keyPath) +bool injectKey(PassRefPtr<IDBKey> key, ScriptValue& value, const String& keyPath) { IDBKeyPath idbKeyPath(keyPath); EXPECT_TRUE(idbKeyPath.isValid()); - return injectIDBKeyIntoSerializedValue(key, value, idbKeyPath); + return injectIDBKeyIntoScriptValue(key, value, idbKeyPath); } -void checkInjection(PassRefPtr<IDBKey> prpKey, PassRefPtr<SerializedScriptValue> value, const String& keyPath) +void checkInjection(PassRefPtr<IDBKey> prpKey, ScriptValue& value, const String& keyPath) { RefPtr<IDBKey> key = prpKey; - RefPtr<SerializedScriptValue> newValue = injectKey(key, value, keyPath); - ASSERT_TRUE(newValue); - RefPtr<IDBKey> extractedKey = checkKeyFromValueAndKeyPathInternal(newValue.get(), keyPath); + bool result = injectKey(key, value, keyPath); + ASSERT_TRUE(result); + RefPtr<IDBKey> extractedKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); EXPECT_TRUE(key->isEqual(extractedKey.get())); } -void checkInjectionFails(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const String& keyPath) +void checkInjectionFails(PassRefPtr<IDBKey> key, ScriptValue& value, const String& keyPath) { EXPECT_FALSE(injectKey(key, value, keyPath)); } -void checkKeyPathStringValue(SerializedScriptValue* value, const String& keyPath, const String& expected) +void checkKeyPathStringValue(const ScriptValue& value, const String& keyPath, const String& expected) { RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); ASSERT_TRUE(idbKey.get()); @@ -82,7 +82,7 @@ void checkKeyPathStringValue(SerializedScriptValue* value, const String& keyPath ASSERT_TRUE(expected == idbKey->string()); } -void checkKeyPathNumberValue(SerializedScriptValue* value, const String& keyPath, int expected) +void checkKeyPathNumberValue(const ScriptValue& value, const String& keyPath, int expected) { RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); ASSERT_TRUE(idbKey.get()); @@ -98,10 +98,10 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::String::New("zoo")); - RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object); + ScriptValue scriptValue(object); - checkKeyPathStringValue(serializedScriptValue.get(), "foo", "zoo"); - checkKeyPathNullValue(serializedScriptValue.get(), "bar"); + checkKeyPathStringValue(scriptValue, "foo", "zoo"); + checkKeyPathNullValue(scriptValue, "bar"); } TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) @@ -112,10 +112,10 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::Number::New(456)); - RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object); + ScriptValue scriptValue(object); - checkKeyPathNumberValue(serializedScriptValue.get(), "foo", 456); - checkKeyPathNullValue(serializedScriptValue.get(), "bar"); + checkKeyPathNumberValue(scriptValue, "foo", 456); + checkKeyPathNullValue(scriptValue, "bar"); } TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) @@ -128,10 +128,10 @@ TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) subProperty->Set(v8::String::New("bar"), v8::String::New("zee")); object->Set(v8::String::New("foo"), subProperty); - RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object); + ScriptValue scriptValue(object); - checkKeyPathStringValue(serializedScriptValue.get(), "foo.bar", "zee"); - checkKeyPathNullValue(serializedScriptValue.get(), "bar"); + checkKeyPathStringValue(scriptValue, "foo.bar", "zee"); + checkKeyPathNullValue(scriptValue, "bar"); } TEST(InjectIDBKeyTest, TopLevelPropertyStringValue) @@ -142,10 +142,11 @@ TEST(InjectIDBKeyTest, TopLevelPropertyStringValue) v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::String::New("zoo")); - checkInjection(IDBKey::createString("myNewKey"), SerializedScriptValue::create(object), "bar"); - checkInjection(IDBKey::createNumber(1234), SerializedScriptValue::create(object), "bar"); + ScriptValue foozoo(object); + checkInjection(IDBKey::createString("myNewKey"), foozoo, "bar"); + checkInjection(IDBKey::createNumber(1234), foozoo, "bar"); - checkInjectionFails(IDBKey::createString("key"), SerializedScriptValue::create(object), "foo.bar"); + checkInjectionFails(IDBKey::createString("key"), foozoo, "foo.bar"); } TEST(InjectIDBKeyTest, SubProperty) @@ -158,15 +159,16 @@ TEST(InjectIDBKeyTest, SubProperty) subProperty->Set(v8::String::New("bar"), v8::String::New("zee")); object->Set(v8::String::New("foo"), subProperty); - checkInjection(IDBKey::createString("myNewKey"), SerializedScriptValue::create(object), "foo.baz"); - checkInjection(IDBKey::createNumber(789), SerializedScriptValue::create(object), "foo.baz"); - checkInjection(IDBKey::createDate(4567), SerializedScriptValue::create(object), "foo.baz"); - checkInjection(IDBKey::createDate(4567), SerializedScriptValue::create(object), "bar"); - checkInjection(IDBKey::createArray(IDBKey::KeyArray()), SerializedScriptValue::create(object), "foo.baz"); - checkInjection(IDBKey::createArray(IDBKey::KeyArray()), SerializedScriptValue::create(object), "bar"); + ScriptValue scriptObject(object); + checkInjection(IDBKey::createString("myNewKey"), scriptObject, "foo.baz"); + checkInjection(IDBKey::createNumber(789), scriptObject, "foo.baz"); + checkInjection(IDBKey::createDate(4567), scriptObject, "foo.baz"); + checkInjection(IDBKey::createDate(4567), scriptObject, "bar"); + checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "foo.baz"); + checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "bar"); - checkInjectionFails(IDBKey::createString("zoo"), SerializedScriptValue::create(object), "foo.bar.baz"); - checkInjection(IDBKey::createString("zoo"), SerializedScriptValue::create(object), "foo.xyz.foo"); + checkInjectionFails(IDBKey::createString("zoo"), scriptObject, "foo.bar.baz"); + checkInjection(IDBKey::createString("zoo"), scriptObject, "foo.xyz.foo"); } } // namespace diff --git a/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp b/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp index c3d47d788..cd240cc94 100644 --- a/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp +++ b/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp @@ -127,92 +127,6 @@ TEST(IDBKeyPathTest, InvalidKeyPath5) checkKeyPath(keyPath, expected, 3); } -TEST(IDBKeyPathTest, Extract) -{ - IDBKeyPath keyPath("foo"); - RefPtr<IDBKey> stringZooKey(IDBKey::createString("zoo")); - RefPtr<IDBKey> invalidKey(IDBKey::createInvalid()); - RefPtr<SerializedScriptValue> ssv; - RefPtr<IDBKey> result; - - // keypath: "foo", value: {foo: "zoo"}, expected: "zoo" - UChar dataFooZoo[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x017b}; - ssv = SerializedScriptValue::createFromWire(String(dataFooZoo, WTF_ARRAY_LENGTH(dataFooZoo))); - result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); - EXPECT_TRUE(stringZooKey->isEqual(result.get())); - - // keypath: "foo", value: {foo: null}, expected: invalid - UChar dataFooNull[] = {0x0353, 0x6f66, 0x306f, 0x017b}; - ssv = SerializedScriptValue::createFromWire(String(dataFooNull, WTF_ARRAY_LENGTH(dataFooNull))); - result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); - EXPECT_FALSE(result->isValid()); - - // keypath: "foo", value: {}, expected: null - UChar dataObject[] = {0x017b}; - ssv = SerializedScriptValue::createFromWire(String(dataObject, WTF_ARRAY_LENGTH(dataObject))); - result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); - EXPECT_EQ(0, result.get()); - - // keypath: "foo", value: null, expected: null - ssv = SerializedScriptValue::nullValue(); - result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); - EXPECT_EQ(0, result.get()); -} - -TEST(IDBKeyPathTest, IDBKeyPathPropertyNotAvailable) -{ - IDBKeyPath keyPath("PropertyNotAvailable"); - RefPtr<SerializedScriptValue> ssv; - // {foo: "zoo", bar: null} - UChar data[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x0353, 0x6162, - 0x3072, 0x027b}; - ssv = SerializedScriptValue::createFromWire(String(data, WTF_ARRAY_LENGTH(data))); - RefPtr<IDBKey> result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); - EXPECT_EQ(0, result.get()); - - // null - ssv = SerializedScriptValue::nullValue(); - result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); - EXPECT_EQ(0, result.get()); -} - -TEST(IDBKeyPathTest, InjectIDBKey) -{ - // {foo: 'zoo'} - const UChar initialData[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x017b}; - RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(String(initialData, WTF_ARRAY_LENGTH(initialData))); - - RefPtr<IDBKey> key = IDBKey::createString("myNewKey"); - IDBKeyPath keyPath("bar"); - - // {foo: 'zoo', bar: 'myNewKey'} - const UChar expectedData[] = {0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, - 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f, - 0x5301, 0x6203, 0x7261, 0x013f, 0x0853, - 0x796d, 0x654e, 0x4b77, 0x7965, 0x027b}; - RefPtr<SerializedScriptValue> expectedValue = - SerializedScriptValue::createFromWire(String(expectedData, WTF_ARRAY_LENGTH(expectedData))); - RefPtr<SerializedScriptValue> result = injectIDBKeyIntoSerializedValue(key, value, keyPath); - EXPECT_EQ(expectedValue->toWireString(), result->toWireString()); - - // Should fail - can't apply properties to string value of key foo - keyPath = IDBKeyPath("foo.bad.path"); - result = injectIDBKeyIntoSerializedValue(key, value, keyPath); - EXPECT_EQ(0, result.get()); - - // {foo: 'zoo', bar: {baz: 'myNewKey'}} - const UChar expectedData2[] = {0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, - 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f, - 0x5301, 0x6203, 0x7261, 0x013f, 0x3f6f, - 0x5302, 0x6203, 0x7a61, 0x023f, 0x0853, - 0x796d, 0x654e, 0x4b77, 0x7965, 0x017b, - 0x027b}; - RefPtr<SerializedScriptValue> expectedValue2 = SerializedScriptValue::createFromWire(String(expectedData2, WTF_ARRAY_LENGTH(expectedData2))); - keyPath = IDBKeyPath("bar.baz"); - result = injectIDBKeyIntoSerializedValue(key, value, keyPath); - EXPECT_EQ(expectedValue2->toWireString(), result->toWireString()); -} - } // namespace #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp index 4a0a3cf81..4acf496ad 100644 --- a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp +++ b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp @@ -50,6 +50,7 @@ namespace { class NotInstrumented { public: + NotInstrumented(const char* = 0) { } char m_data[42]; }; @@ -192,7 +193,7 @@ public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_instrumentedUndefined); + info.addMember(m_instrumentedUndefined); } OwnPtr<InstrumentedUndefined> m_instrumentedUndefined; }; @@ -213,7 +214,7 @@ public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_instrumented); + info.addMember(m_instrumented); } Instrumented m_instrumented; @@ -237,7 +238,7 @@ public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); - info.addInstrumentedMember(m_value); + info.addMember(m_value); } T m_value; @@ -275,5 +276,96 @@ TEST(MemoryInstrumentationTest, visitStrings) } } +class TwoPointersToRefPtr { +public: + TwoPointersToRefPtr(const RefPtr<StringImpl>& value) : m_ptr1(&value), m_ptr2(&value) { } + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + info.addMember(m_ptr1); + info.addMember(m_ptr2); + } + + const RefPtr<StringImpl>* m_ptr1; + const RefPtr<StringImpl>* m_ptr2; +}; + +TEST(MemoryInstrumentationTest, refPtrPtr) +{ + RefPtr<StringImpl> refPtr; + TwoPointersToRefPtr root(refPtr); + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + impl.addRootObject(root); + EXPECT_EQ(sizeof(RefPtr<StringImpl>), impl.reportedSizeForAllTypes()); + EXPECT_EQ(1, visitedObjects.size()); +} + +class TwoPointersToOwnPtr { +public: + TwoPointersToOwnPtr(const OwnPtr<NotInstrumented>& value) : m_ptr1(&value), m_ptr2(&value) { } + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + info.addMember(m_ptr1); + info.addMember(m_ptr2); + } + + const OwnPtr<NotInstrumented>* m_ptr1; + const OwnPtr<NotInstrumented>* m_ptr2; +}; + +TEST(MemoryInstrumentationTest, ownPtrPtr) +{ + OwnPtr<NotInstrumented> ownPtr; + TwoPointersToOwnPtr root(ownPtr); + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + impl.addRootObject(root); + EXPECT_EQ(sizeof(OwnPtr<NotInstrumented>), impl.reportedSizeForAllTypes()); + EXPECT_EQ(1, visitedObjects.size()); +} + +template<typename T> +class InstrumentedTemplate { +public: + template<typename V> + InstrumentedTemplate(const V& value) : m_value(value) { } + + template<typename MemoryObjectInfo> + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + info.addMember(m_value); + } + + T m_value; +}; + +TEST(MemoryInstrumentationTest, detectReportMemoryUsageMethod) +{ + { + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + + OwnPtr<InstrumentedTemplate<String> > value = adoptPtr(new InstrumentedTemplate<String>("")); + InstrumentedOwner<InstrumentedTemplate<String>* > root(value.get()); + impl.addRootObject(root); + EXPECT_EQ(sizeof(InstrumentedTemplate<String>) + sizeof(StringImpl), impl.reportedSizeForAllTypes()); + // FIXME: it is failing on Chromium Canary bots but works fine locally. + // EXPECT_EQ(2, visitedObjects.size()); + } + { + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + + OwnPtr<InstrumentedTemplate<NotInstrumented> > value = adoptPtr(new InstrumentedTemplate<NotInstrumented>("")); + InstrumentedOwner<InstrumentedTemplate<NotInstrumented>* > root(value.get()); + impl.addRootObject(root); + EXPECT_EQ(sizeof(InstrumentedTemplate<NotInstrumented>), impl.reportedSizeForAllTypes()); + EXPECT_EQ(1, visitedObjects.size()); + } +} + } // namespace diff --git a/Source/WebKit/chromium/tests/RunAllTests.cpp b/Source/WebKit/chromium/tests/RunAllTests.cpp index 78fd7da3d..be4c7db29 100644 --- a/Source/WebKit/chromium/tests/RunAllTests.cpp +++ b/Source/WebKit/chromium/tests/RunAllTests.cpp @@ -43,6 +43,10 @@ #include "WebUnitTests.h" #endif +#if defined(OS_ANDROID) +#include "ForwardIOStreamsAndroid.h" +#endif + #include <gmock/gmock.h> // TestSuite must be created before SetUpTestEnvironment so it performs @@ -59,6 +63,9 @@ int main(int argc, char** argv) WebKit::DeleteTestSuite(); #else ::testing::InitGoogleMock(&argc, argv); +#if defined(OS_ANDROID) + WebKit::maybeInitIOStreamForwardingForAndroid(&argc, &argv); +#endif TestSuite testSuite(argc, argv); webkit_support::SetUpTestEnvironmentForUnitTests(); int result = testSuite.Run(); diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 7d289c069..8ad470cfc 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,38 @@ +2012-09-17 Dan Bernstein <mitz@apple.com> + + <rdar://problem/12316935> [mac WebKit1]: -[WebView _setPaginationBehavesLikeColumns:] is a no-op + https://bugs.webkit.org/show_bug.cgi?id=96971 + + Reviewed by Sam Weinig. + + * WebView/WebView.mm: + (-[WebView _setPaginationBehavesLikeColumns:]): Added a call to setPagination(). + +2012-09-14 Adam Barth <abarth@webkit.org> + + Remove webkitPostMessage + https://bugs.webkit.org/show_bug.cgi?id=96577 + + Reviewed by Ojan Vafai. + + Add ENABLE_LEGACY_VENDOR_PREFIXES flag. + + * Configurations/FeatureDefines.xcconfig: + +2012-09-14 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=96688 + Put position:fixed elements in their own layers and allow them to + create a stacking context + -and corresponding- + <rdar://problem/11467961> + + Reviewed by Simon Fraser. + + Enable these settings in WK1 too for consistency. + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): + 2012-09-13 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed, rolling out r128552. diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 6a674085e..cd9ca6ded 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -96,6 +96,7 @@ ENABLE_LEGACY_NOTIFICATIONS_macosx = $(ENABLE_LEGACY_NOTIFICATIONS_macosx_$(TARG ENABLE_LEGACY_NOTIFICATIONS_macosx_1070 = ; ENABLE_LEGACY_NOTIFICATIONS_macosx_1080 = ENABLE_LEGACY_NOTIFICATIONS; ENABLE_LEGACY_NOTIFICATIONS_macosx_1090 = ENABLE_LEGACY_NOTIFICATIONS; +ENABLE_LEGACY_VENDOR_PREFIXES = ENABLE_LEGACY_VENDOR_PREFIXES; ENABLE_LINK_PREFETCH = ; ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; @@ -140,4 +141,4 @@ ENABLE_WIDGET_REGION_macosx = ENABLE_WIDGET_REGION; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index d1bed77b3..179e74f7a 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 10; +MINOR_VERSION = 11; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 7b8412cfe..e0ca33284 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -1547,6 +1547,10 @@ static bool needsSelfRetainWhileLoadingQuirk() settings->setRequestAnimationFrameEnabled([preferences requestAnimationFrameEnabled]); settings->setNeedsDidFinishLoadOrderQuirk(needsDidFinishLoadOrderQuirk()); settings->setDiagnosticLoggingEnabled([preferences diagnosticLoggingEnabled]); + + // We have enabled this setting in WebKit2 for the sake of some ScrollingCoordinator work. + // To avoid possible rendering differences, we should enable it for WebKit1 too. + settings->setFixedPositionCreatesStackingContext(true); NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds]; if (timeout > 0) @@ -2866,6 +2870,8 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) Pagination pagination = page->pagination(); pagination.behavesLikeColumns = behavesLikeColumns; + + page->setPagination(pagination); } - (BOOL)_paginationBehavesLikeColumns diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 53a092b85..874c99dee 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,40 @@ +2012-09-17 Leo Franchi <lfranchi@kde.org> + + [Qt] Inspector WebSocket backend protocol update + https://bugs.webkit.org/show_bug.cgi?id=77031 + + Also adds support for multi-frame messages and non-text messages. + Thanks to Jocelyn Turcotte for most of the WebSocket update code! + + Reviewed by Simon Hausmann. + + * WebCoreSupport/InspectorServerQt.cpp: + (WebCore): + (WebCore::generateWebSocketChallengeResponse): + (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): + (WebCore::InspectorServerRequestHandlerQt::webSocketSend): + (WebCore::applyMask): + (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead): + * WebCoreSupport/InspectorServerQt.h: + (InspectorServerRequestHandlerQt): + +2012-09-15 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] QDoc fixes for Qt 5 documentation + https://bugs.webkit.org/show_bug.cgi?id=96796 + + Reviewed by Simon Hausmann. + + Produce fewer warnings and a better documentation. + Having two QML modules providing a WebView component is a bit too much for poor old qdoc to + cope with (or would require a lot of painful disambiguation by hand). Since the plan is to have + QDeclarativeWebView living in the qtquick1 module, we can already take it out of the + documentation generation for now. + + * declarative/qdeclarativewebview.cpp: s/qmlclass/qmltype/ out of principle + * docs/qtwebkit.qdocconf: Remove the \i alias that caused a warning. Use *.h as headers suffix, not sources. + Also remove QDeclarativeWebView from the documentation. + 2012-09-13 Lauro Neto <lauro.neto@openbossa.org> [Qt][WK2] fast/forms/access-key-for-all-elements.html fails diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index 14f5dd734..65bbad0f0 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -34,51 +34,26 @@ #include <QUrl> #include <QWidget> #include <qendian.h> -#include <wtf/MD5.h> +#include <wtf/SHA1.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> namespace WebCore { /*! - Computes the WebSocket handshake response given the two challenge numbers and key3. + Computes the WebSocket handshake response given the input key */ -static void generateWebSocketChallengeResponse(uint32_t number1, uint32_t number2, const unsigned char key3[8], unsigned char response[16]) +static QByteArray generateWebSocketChallengeResponse(const QByteArray& key) { - uint8_t challenge[16]; - qToBigEndian<qint32>(number1, &challenge[0]); - qToBigEndian<qint32>(number2, &challenge[4]); - memcpy(&challenge[8], key3, 8); - MD5 md5; - md5.addBytes(challenge, sizeof(challenge)); - Vector<uint8_t, 16> digest; - md5.checksum(digest); - memcpy(response, digest.data(), 16); -} - -/*! - Parses and returns a WebSocket challenge number according to the - method specified in the WebSocket protocol. - - The field contains numeric digits interspersed with spaces and - non-numeric digits. The protocol ignores the characters that are - neither digits nor spaces. The digits are concatenated and - interpreted as a long int. The result is this number divided by - the number of spaces. - */ -static quint32 parseWebSocketChallengeNumber(QString field) -{ - QString nString; - int numSpaces = 0; - for (int i = 0; i < field.size(); i++) { - QChar c = field[i]; - if (c == QLatin1Char(' ')) - numSpaces++; - else if ((c >= QLatin1Char('0')) && (c <= QLatin1Char('9'))) - nString.append(c); - } - quint32 num = nString.toULong(); - quint32 result = (numSpaces ? (num / numSpaces) : num); - return result; + SHA1 sha1; + Vector<uint8_t, 20> digest; + Vector<char> encoded; + QByteArray toHash("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + toHash.prepend(key); + sha1.addBytes((uint8_t*)toHash.data(), toHash.size()); + sha1.computeHash(digest); + base64Encode((char*)digest.data(), digest.size(), encoded); + return QByteArray(encoded.data(), encoded.size()); } static InspectorServerQt* s_inspectorServer; @@ -192,7 +167,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() m_path = header.path(); m_contentType = header.contentType().toLatin1(); m_contentLength = header.contentLength(); - if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("WebSocket"))) + if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("websocket"))) isWebSocket = true; m_data.clear(); @@ -211,23 +186,14 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() m_tcpConnection->disconnect(SIGNAL(readyRead())); connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead()), Qt::QueuedConnection); - QByteArray key3 = m_tcpConnection->read(8); - - quint32 number1 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key1"))); - quint32 number2 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key2"))); - - char responseData[16]; - generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData); - QByteArray response(responseData, sizeof(responseData)); + QByteArray key = header.value(QLatin1String("Sec-WebSocket-Key")).toLatin1(); + QString accept = QString::fromLatin1(generateWebSocketChallengeResponse(key)); WebKit::QHttpResponseHeader responseHeader(101, QLatin1String("WebSocket Protocol Handshake"), 1, 1); responseHeader.setValue(QLatin1String("Upgrade"), header.value(QLatin1String("Upgrade"))); responseHeader.setValue(QLatin1String("Connection"), header.value(QLatin1String("Connection"))); - responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Origin"))); - responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path)); - responseHeader.setContentLength(response.size()); + responseHeader.setValue(QLatin1String("Sec-WebSocket-Accept"), accept); m_tcpConnection->write(responseHeader.toString().toLatin1()); - m_tcpConnection->write(response); m_tcpConnection->flush(); if ((words.size() == 4) @@ -306,26 +272,43 @@ void InspectorServerRequestHandlerQt::tcpConnectionDisconnected() m_tcpConnection = 0; } -int InspectorServerRequestHandlerQt::webSocketSend(QByteArray payload) +int InspectorServerRequestHandlerQt::webSocketSend(const QString& message) { - Q_ASSERT(m_tcpConnection); - m_tcpConnection->putChar(0x00); - int nBytes = m_tcpConnection->write(payload); - m_tcpConnection->putChar(0xFF); - m_tcpConnection->flush(); - return nBytes; + QByteArray payload = message.toUtf8(); + return webSocketSend(payload.data(), payload.size()); } int InspectorServerRequestHandlerQt::webSocketSend(const char* data, size_t length) { Q_ASSERT(m_tcpConnection); - m_tcpConnection->putChar(0x00); + m_tcpConnection->putChar(0x81); + if (length <= 125) + m_tcpConnection->putChar(static_cast<uint8_t>(length)); + else if (length <= pow(2, 16)) { + m_tcpConnection->putChar(126); + quint16 length16 = qToBigEndian<quint16>(static_cast<quint16>(length)); + m_tcpConnection->write(reinterpret_cast<char*>(&length16), 2); + } else { + m_tcpConnection->putChar(127); + quint64 length64 = qToBigEndian<quint64>(static_cast<quint64>(length)); + m_tcpConnection->write(reinterpret_cast<char*>(&length64), 8); + } int nBytes = m_tcpConnection->write(data, length); - m_tcpConnection->putChar(0xFF); m_tcpConnection->flush(); return nBytes; } +static QByteArray applyMask(const QByteArray& payload, const QByteArray& maskingKey) +{ + Q_ASSERT(maskingKey.size() == 4); + QByteArray unmaskedPayload; + for (int i = 0; i < payload.size(); ++i) { + char unmaskedByte = payload[i] ^ maskingKey[i % 4]; + unmaskedPayload.append(unmaskedByte); + } + return unmaskedPayload; +} + void InspectorServerRequestHandlerQt::webSocketReadyRead() { Q_ASSERT(m_tcpConnection); @@ -333,33 +316,43 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() return; QByteArray content = m_tcpConnection->read(m_tcpConnection->bytesAvailable()); m_data.append(content); - while (m_data.size() > 0) { - // first byte in websocket frame should be 0 - Q_ASSERT(!m_data[0]); - - // Start of WebSocket frame is indicated by 0 - if (m_data[0]) { - qCritical() << "webSocketReadyRead: unknown frame type" << m_data[0]; - m_data.clear(); - m_tcpConnection->close(); - return; + while (m_data.size() > 0) { + const bool isMasked = m_data[1] & 0x80; + quint64 payloadLen = m_data[1] & 0x7F; + int pos = 2; + + if (payloadLen == 126) { + payloadLen = qFromBigEndian<quint16>(*reinterpret_cast<quint16*>(m_data.mid(pos, 2).data())); + pos = 4; + } else if (payloadLen == 127) { + payloadLen = qFromBigEndian<quint64>(*reinterpret_cast<quint64*>(m_data.mid(pos, 8).data())); + pos = 8; } - - // End of WebSocket frame indicated by 0xff. - int pos = m_data.indexOf(0xff, 1); - if (pos < 1) - return; - - // After above checks, length will be >= 0. - size_t length = pos - 1; - if (length <= 0) - return; - - QByteArray payload = m_data.mid(1, length); - + + QByteArray payload; + if (isMasked) { + QByteArray maskingKey = m_data.mid(pos, 4); + pos += 4; + payload = applyMask(m_data.mid(pos, payloadLen), maskingKey); + } else + payload = m_data.mid(pos, payloadLen); + + // Handle fragmentation + if (!(m_data[0] & 0x80)) { // Non-last fragmented payload + m_fragmentedPayload.append(payload); + m_data = m_data.mid(pos + payloadLen); + continue; + } + + if (!(m_data[0] & 0x0F)) { // Last fragment + m_fragmentedPayload.append(payload); + payload = m_fragmentedPayload; + m_fragmentedPayload.clear(); + } + // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte). // Truncate data before delivering message in case of re-entrancy. - m_data = m_data.mid(length + 2); + m_data = m_data.mid(pos + payloadLen); #if ENABLE(INSPECTOR) if (m_inspectorClient) { diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h index b130b0a0d..b0bb0c79d 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h @@ -72,7 +72,7 @@ public: InspectorServerRequestHandlerQt(QTcpSocket *tcpConnection, InspectorServerQt *server); virtual ~InspectorServerRequestHandlerQt(); - virtual int webSocketSend(QByteArray payload); + virtual int webSocketSend(const QString& message); virtual int webSocketSend(const char *payload, size_t length); private Q_SLOTS: @@ -89,6 +89,7 @@ private: int m_contentLength; bool m_endOfHeaders; QByteArray m_data; + QByteArray m_fragmentedPayload; InspectorClientQt* m_inspectorClient; void handleInspectorRequest(QStringList words); diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp index d184c087e..cdfcf53b8 100644 --- a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -152,7 +152,9 @@ bool GraphicsWebView::sceneEvent(QEvent *event) } /*! - \qmlclass WebView QDeclarativeWebView + \qmltype WebView + \instantiates QDeclarativeWebView + \inqmlmodule QtWebKit 1.0 \ingroup qml-view-elements \since 4.7 \brief The WebView item allows you to add Web content to a canvas. diff --git a/Source/WebKit/qt/docs/qtwebkit.qdocconf b/Source/WebKit/qt/docs/qtwebkit.qdocconf index 23d277001..adf5cbf2f 100644 --- a/Source/WebKit/qt/docs/qtwebkit.qdocconf +++ b/Source/WebKit/qt/docs/qtwebkit.qdocconf @@ -3,11 +3,12 @@ project = qtwebkit description = "Qt WebKit API Documentation" -headerdirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit/qt/declarative $SRCDIR/WebKit2/UIProcess/API/qt -sourcedirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit/qt/docs $SRCDIR/Source/JavaScriptCore/qt/api $SRCDIR/WebKit/qt/declarative $SRCDIR/WebKit2/UIProcess/API/qt +headerdirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit2/UIProcess/API/qt +sourcedirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit/qt/docs $SRCDIR/Source/JavaScriptCore/qt/api $SRCDIR/WebKit2/UIProcess/API/qt outputdir = $OUTPUT_DIR/doc/html outputformats = HTML -sources.fileextensions = "*.cpp *.doc *.qdoc *.h" +sources.fileextensions = "*.cpp *.doc *.qdoc" +headers.fileextensions = "*.h" exampledirs = $SRCDIR/WebKit/qt/docs imagedirs = $SRCDIR/WebKit/qt/docs @@ -43,7 +44,6 @@ macro.mdash.HTML = "—" # compat.qdocconf -alias.i = e alias.include = input macro.0 = "\\\\0" diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 14a9396d4..73b494a9f 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,81 @@ +2012-09-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r128809. + http://trac.webkit.org/changeset/128809 + https://bugs.webkit.org/show_bug.cgi?id=96958 + + Broke the Windows build. (Requested by andersca on #webkit). + + * DefaultPolicyDelegate.cpp: + (DefaultPolicyDelegate::decidePolicyForNavigationAction): + (DefaultPolicyDelegate::decidePolicyForMIMEType): + (DefaultPolicyDelegate::unableToImplementPolicyWithError): + * MarshallingHelpers.cpp: + (MarshallingHelpers::KURLToBSTR): + (MarshallingHelpers::CFStringRefToBSTR): + (MarshallingHelpers::stringArrayToSafeArray): + (MarshallingHelpers::safeArrayToStringArray): + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::runJavaScriptPrompt): + * WebCoreSupport/WebEditorClient.cpp: + (WebEditorClient::checkGrammarOfString): + (WebEditorClient::getGuessesForWord): + * WebFrame.cpp: + (WebFrame::canProvideDocumentSource): + * WebHistory.cpp: + (WebHistory::removeItem): + (WebHistory::addItem): + * WebIconDatabase.cpp: + (WebIconDatabase::startUpIconDatabase): + * WebNotificationCenter.cpp: + (WebNotificationCenter::postNotification): + * WebPreferences.cpp: + (WebPreferences::setStringValue): + * WebView.cpp: + (PreferencesChangedOrRemovedObserver::onNotify): + (WebView::close): + (WebView::canShowMIMEType): + (WebView::initWithFrame): + (WebView::setApplicationNameForUserAgent): + (WebView::setCustomUserAgent): + (WebView::userAgentForURL): + (WebView::setCustomTextEncodingName): + (WebView::customTextEncodingName): + (WebView::setPreferences): + (WebView::searchFor): + (WebView::executeCoreCommandByName): + (WebView::markAllMatchesForText): + (WebView::setGroupName): + (WebView::registerURLSchemeAsLocal): + (WebView::replaceSelectionWithText): + (WebView::onNotify): + (WebView::notifyPreferencesChanged): + (WebView::MIMETypeForExtension): + (WebView::standardUserAgentWithApplicationName): + (WebView::addAdditionalPluginDirectory): + (WebView::registerEmbeddedViewMIMEType): + (toString): + (toKURL): + (WebView::addOriginAccessWhitelistEntry): + (WebView::removeOriginAccessWhitelistEntry): + (WebView::geolocationDidFailWithError): + (WebView::setDomainRelaxationForbiddenForURLScheme): + (WebView::setCompositionForTesting): + (WebView::confirmCompositionForTesting): + +2012-09-16 Mark Lam <mark.lam@apple.com> + + Added MSVC project changes to enable building the llint. + https://bugs.webkit.org/show_bug.cgi?id=96175. + + Reviewed by Geoff Garen. + + This only adds the ability to build the llint, but currently, only the + C++ backend is supported. By default, the Windows port will remain + running with the baseline JIT. The llint will not be enabled. + + * WebKit.vcproj/WebKit.sln: + 2012-09-13 Brent Fulgham <bfulgham@webkit.org> [WinCairo] Unreviewed build fix. diff --git a/Source/WebKit/win/WebKit.vcproj/WebKit.sln b/Source/WebKit/win/WebKit.vcproj/WebKit.sln index ab47a727f..0723b2e10 100644 --- a/Source/WebKit/win/WebKit.vcproj/WebKit.sln +++ b/Source/WebKit/win/WebKit.vcproj/WebKit.sln @@ -3,6 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCore", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\JavaScriptCore\JavaScriptCore.vcproj", "{011D10F1-B656-4A1B-A0C3-3842F02122C5}"
ProjectSection(ProjectDependencies) = postProject
+ {9221744B-5715-4F56-9590-42F7AB23DD8B} = {9221744B-5715-4F56-9590-42F7AB23DD8B}
{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
EndProjectSection
EndProject
@@ -190,6 +191,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WTF", "WTF", "{A671AE22-FBC EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTFGenerated", "..\..\..\WTF\WTF.vcproj\WTFGenerated.vcproj", "{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntDesiredOffsets", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\LLIntDesiredOffsets\LLIntDesiredOffsets.vcproj", "{877150A0-41B3-4730-9D98-1B8298098B14}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {5AE5F5E4-782D-4F63-B4D7-3977B52B9950} = {5AE5F5E4-782D-4F63-B4D7-3977B52B9950}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntOffsetsExtractor", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\LLIntOffsetsExtractor\LLIntOffsetsExtractor.vcproj", "{D595E3F6-24F2-4C60-935C-95D50C6B3E96}"
+ ProjectSection(ProjectDependencies) = postProject
+ {877150A0-41B3-4730-9D98-1B8298098B14} = {877150A0-41B3-4730-9D98-1B8298098B14}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntAssembly", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\LLIntAssembly\LLIntAssembly.vcproj", "{9221744B-5715-4F56-9590-42F7AB23DD8B}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D595E3F6-24F2-4C60-935C-95D50C6B3E96} = {D595E3F6-24F2-4C60-935C-95D50C6B3E96}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_All|Win32 = Debug_All|Win32
@@ -640,6 +658,9 @@ Global {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {557FA164-0E39-4DEC-B66C-8795C8E52399}
{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2} = {557FA164-0E39-4DEC-B66C-8795C8E52399}
{14C94979-1ED3-4E1D-9B55-A80FCF4677D0} = {557FA164-0E39-4DEC-B66C-8795C8E52399}
+ {877150A0-41B3-4730-9D98-1B8298098B14} = {557FA164-0E39-4DEC-B66C-8795C8E52399}
+ {D595E3F6-24F2-4C60-935C-95D50C6B3E96} = {557FA164-0E39-4DEC-B66C-8795C8E52399}
+ {9221744B-5715-4F56-9590-42F7AB23DD8B} = {557FA164-0E39-4DEC-B66C-8795C8E52399}
{1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {63FB6F8A-C601-43E3-BD16-A00A465C2CB6}
{0A324352-B3B6-496C-9E5B-4C7E923E628B} = {63FB6F8A-C601-43E3-BD16-A00A465C2CB6}
{E498CA9D-3BD2-4D52-8E37-C8DC76526325} = {63FB6F8A-C601-43E3-BD16-A00A465C2CB6}
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 9e29ab1ca..1a701316d 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,529 @@ +2012-09-18 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r128849. + http://trac.webkit.org/changeset/128849 + https://bugs.webkit.org/show_bug.cgi?id=97007 + + Causes test_ewk2_view to time out. (Requested by rakuco on + #webkit). + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_webprocess_crashed): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/API/efl/ewk_view_ui_client.cpp: + (ewk_view_ui_client_attach): + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + +2012-09-18 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Set the area of tooltips in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=96618 + + Reviewed by Martin Robinson. + + In GTK+ tooltips are associated to a widget, if the mouse is moved + inside the widget area, the tooltip position doesn't change even + if the tooltip text changes. To support multiple tooltips for the + same widget, we need to set the area of the widget for every + tooltip. + + * Shared/WebHitTestResult.cpp: + (WebKit::WebHitTestResult::Data::encode): Encode elementBoundingBox. + (WebKit::WebHitTestResult::Data::decode): Decode elementBoundingBox. + * Shared/WebHitTestResult.h: + (Data): Add elementBoundingBox to WebHitTestResult::Data. + (WebKit::WebHitTestResult::Data::elementBoundingBoxInWindowCoordinates): + Get the bounding box of the inner non shared node of the hit test + result in window coordinates. + (WebKit::WebHitTestResult::Data::Data): + (WebKit::WebHitTestResult::elementBoundingBox): + (WebHitTestResult): + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewMouseTargetChanged): Call webkitWebViewBaseSetTooltipArea. + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (webkitWebViewBaseQueryTooltip): Use the tooltipArea if it's not empty. + (webkitWebViewBaseSetTooltipArea): Set the tooltipArea. + * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: + +2012-09-18 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Fix build without the QtQuick module + + Reviewed by Simon Hausmann. + + * Target.pri: + +2012-09-17 Eunmi Lee <eunmi15.lee@samsung.com> + + [EFL][WK2] Add NativeWebTouchEvent and handle the Touch event. + https://bugs.webkit.org/show_bug.cgi?id=90662 + + Reviewed by Gyuyoung Kim. + + Implement codes to handle touch event for WebKit2 EFL port. + Additionally, types and structure for touch event are defined because + they are not in the Evas. + + * PlatformEfl.cmake: + * Shared/NativeWebTouchEvent.h: + (NativeWebTouchEvent): + * Shared/efl/NativeWebTouchEventEfl.cpp: Added. + (WebKit): + (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): + * Shared/efl/WebEventFactory.cpp: + (WebKit): + (WebKit::typeForTouchEvent): + (WebKit::WebEventFactory::createWebTouchEvent): + * Shared/efl/WebEventFactory.h: + (WebEventFactory): + * UIProcess/API/efl/ewk_touch.h: Added. + +2012-09-17 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed, rolling out r128826 and r128813. + + * WebProcess/Plugins/Netscape/JSNPObject.cpp: + (WebKit): + (WebKit::JSNPObject::JSNPObject): + * WebProcess/Plugins/Netscape/JSNPObject.h: + (JSNPObject): + +2012-09-17 Kent Tamura <tkent@chromium.org> + + Export RuntimeEnabledFeatures::isLangAttributeAwareFormControlUIEnabled correctly + https://bugs.webkit.org/show_bug.cgi?id=96855 + + Reviewed by Hajime Morita. + + * win/WebKit2.def: Remove a symbol + * win/WebKit2CFLite.def: ditto. + +2012-09-17 Byungwoo Lee <bw80.lee@samsung.com> + + [EFL][WK2] Add javascript popup API. + https://bugs.webkit.org/show_bug.cgi?id=95672 + + Reviewed by Gyuyoung Kim. + + Add smart class member function for javascript alert(), confirm() and prompt(). + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_run_javascript_alert): + (ewk_view_run_javascript_confirm): + (ewk_view_run_javascript_prompt): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/API/efl/ewk_view_ui_client.cpp: + (runJavaScriptAlert): + (runJavaScriptConfirm): + (runJavaScriptPrompt): + (ewk_view_ui_client_attach): + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + Added unit test for javascript popup smart class member function. + (checkAlert): + (TEST_F): + (checkConfirm): + (checkPrompt): + +2012-09-17 Regina Chung <heejin.r.chung@samsung.com> + + [EFL][WK2] Regression (r128163) + https://bugs.webkit.org/show_bug.cgi?id=96610 + + Reviewed by Gyuyoung Kim. + + While removing compile warnings r128163 changed the logic of code for entering + accelerated compositing mode, resulting in never being able to enter it. + Changed back to the correct code and fixed the compile warning by using an + appropriate EINA macro. + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_accelerated_compositing_mode_enter): Changed EINA_SAFETY_ON_NULL_RETURN_VAL to *if* condition statement. + +2012-09-17 Sam Weinig <sam@webkit.org> + + Fix the Snow Leopard build. + + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::PluginProcess::platformInitialize): + +2012-09-17 Sam Weinig <sam@webkit.org> + + Add experimental code to enter a sandbox for a plug-in. + Based on a patch by Ivan Krstić. + <rdar://problem/11823151> + + Reviewed by Anders Carlsson. + + Enter a sandbox for a plug-in if a sandbox profile is found in /usr/share/sandbox/ that + has the plug-ins bundle identifier for a name. + + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::initializeSandbox): + (WebKit::PluginProcess::platformInitialize): + Enter the sandbox provided if a profile can be found. + + * WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h: + * WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm: + (enterSandbox): + Factor out the core sandbox entering logic (so if can be used above) and make sure + that Remote Save Panel is enabled. + +2012-09-17 Mark Hahnenberg <mhahnenberg@apple.com> + + Fixing the build after http://trac.webkit.org/changeset/128813 + + * WebProcess/Plugins/Netscape/JSNPObject.cpp: + (WebKit): + (WebKit::JSNPObject::JSNPObject): + * WebProcess/Plugins/Netscape/JSNPObject.h: + (JSNPObject): + +2012-09-17 Anders Carlsson <andersca@apple.com> + + Crash if we fail to allocate memory for the argument encoder buffer. + https://bugs.webkit.org/show_bug.cgi?id=88367 + + Reviewed by Andreas Kling. + <rdar://problem/11488239> + + Since there's no way to recover from malloc returning null here, just crash. + + * Platform/CoreIPC/ArgumentEncoder.cpp: + (CoreIPC::ArgumentEncoder::grow): + +2012-09-17 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=96936 + Opt into layers for fixed positioned elements for TiledDrawingArea + + Reviewed by Tim Horton. + + This code already exists in DrawingAreaImpl, and we need it for + TiledCoreAnimationDrawingArea as well. + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): + +2012-09-17 Anders Carlsson <andersca@apple.com> + + Don't load a blocked plug-in if a non-blocked version of the same plug-in exists + https://bugs.webkit.org/show_bug.cgi?id=96933 + <rdar://problem/12206720> + + Reviewed by Andreas Kling. + + If a plug-in with the same bundle identifier already exists and it's blocked, remove it and replace it + with the other version. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::shouldUsePlugin): + +2012-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Remove 'using namespace WebCore' from header file + + Broke the build on Mac OS X by causing clashes between Fixed from + /usr/include/MacTypes.h and Source/WebCore/platform/Length.h. + + Reviewed by Simon Hausmann.. + + * UIProcess/PageViewportController.cpp: + * UIProcess/PageViewportController.h: + (PageViewportController): + (WebKit::PageViewportController::contentsLayoutSize): + (WebKit): + * UIProcess/qt/PageViewportControllerClientQt.cpp: + * UIProcess/qt/PageViewportControllerClientQt.h: + (PageViewportControllerClientQt): + +2012-09-15 Vivek Galatage <vivekgalatage@gmail.com> + + WinCairo build fix due to missing symbols for setImagesEnabled and setStorageBlockingPolicy + https://bugs.webkit.org/show_bug.cgi?id=96866 + + Reviewed by Kentaro Hara. + + Adding missing symbol defines in the def file to fix the build break + for WinCairo + + * win/WebKit2CFLite.def: + +2012-09-15 Jinwoo Song <jinwoo7.song@samsung.com> + + [EFL][WK2] Provide implementation for PageClientImpl::processDidCrash() + https://bugs.webkit.org/show_bug.cgi?id=96197 + + Reviewed by Gyuyoung Kim. + + WebKit2 EFL does not have an implementation for PageClientImpl::processDidCrash(). + So when WebProcess has crashed, UI process does nothing and is left alone as it is. + + This patch checks if loading was ongoing, if so, set the load progress as 1. + Then send a signal callback "webprocess,crashed" for an application to handle it. + If the application does not handle the crash event, show an Eina Log warning message + with a url at web process exit and load an error page. + + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::processDidCrash): + * UIProcess/API/efl/ewk_private.h: + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_webprocess_crashed): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/ewk_view_private.h: + +2012-09-15 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] QDoc fixes for Qt 5 documentation + https://bugs.webkit.org/show_bug.cgi?id=96796 + + Reviewed by Simon Hausmann. + + Fixup miscellaneous qdoc commands syntax. + + * UIProcess/API/qt/qquickwebview.cpp: + * UIProcess/API/qt/qwebloadrequest.cpp: + +2012-09-14 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Add *explicit* keyword to constructors to WebKit2/UIProcess + https://bugs.webkit.org/show_bug.cgi?id=96732 + + Reviewed by Kentaro Hara. + + As a step of *explicit* cleanup for constructors which have only one parameter, + *explicit* is added to WebKit2/UIProcess in order to avoid implicit type conversion. + + * UIProcess/Authentication/AuthenticationDecisionListener.h: + (AuthenticationDecisionListener): + * UIProcess/Authentication/WebCredential.h: + (WebCredential): + * UIProcess/Authentication/WebProtectionSpace.h: + (WebProtectionSpace): + * UIProcess/GenericCallback.h: + (WebKit::CallbackBase::CallbackBase): + * UIProcess/InspectorServer/WebSocketServer.h: + * UIProcess/ResponsivenessTimer.h: + (ResponsivenessTimer): + * UIProcess/WebApplicationCacheManagerProxy.h: + (WebApplicationCacheManagerProxy): + * UIProcess/WebBackForwardList.h: + (WebBackForwardList): + * UIProcess/WebContextUserMessageCoders.h: + (WebKit::WebContextUserMessageEncoder::WebContextUserMessageEncoder): + * UIProcess/WebFullScreenManagerProxy.h: + (WebFullScreenManagerProxy): + * UIProcess/WebGrammarDetail.h: + (WebGrammarDetail): + * UIProcess/WebInspectorProxy.h: + (WebInspectorProxy): + * UIProcess/WebKeyValueStorageManagerProxy.h: + (WebKeyValueStorageManagerProxy): + * UIProcess/WebMediaCacheManagerProxy.h: + (WebMediaCacheManagerProxy): + * UIProcess/WebNavigationData.h: + (WebNavigationData): + * UIProcess/WebOpenPanelResultListenerProxy.h: + (WebOpenPanelResultListenerProxy): + * UIProcess/WebPopupMenuProxy.h: + (WebKit::WebPopupMenuProxy::WebPopupMenuProxy): + * UIProcess/WebPreferences.h: + (WebPreferences): + +2012-09-14 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=96846 + Tests failing on WK2 bots after giving fixed positioning its own + stacking context + + Reviewed by Geoffrey Garen. + + Tests are failing because I checked in updated results that expect + fixed positioning to create a stacking context. However, + WebKitTestRunner does not enable ScrollingCoordinator, so the code + that I added to enable stacking contexts for fixedPos is never + actually running. This patch moves that code to a place where it will + run for the testing tools, which matches the patch for WK1. + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::updatePreferences): + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): + +2012-09-14 Julien Chaffraix <jchaffraix@webkit.org> + + Revert r127457 and following fixes due to several hit-testing regressions + https://bugs.webkit.org/show_bug.cgi?id=96830 + + Reviewed by Antonio Gomes. + + This change reverts r127457, r127863 and r128505. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + +2012-09-14 Adam Barth <abarth@webkit.org> + + Remove webkitPostMessage + https://bugs.webkit.org/show_bug.cgi?id=96577 + + Reviewed by Ojan Vafai. + + Add ENABLE_LEGACY_VENDOR_PREFIXES flag. + + * Configurations/FeatureDefines.xcconfig: + +2012-09-14 Jeffrey Pfau <jpfau@apple.com> + + Allow third-party storage blocking setting to change while a page is loaded + https://bugs.webkit.org/show_bug.cgi?id=95790 + + Reviewed by Brady Eidson. + + Inform plugins about changes to the storage blocking policy by way of the private browsing feature. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::storageBlockingStateChanged): + (WebKit): + * PluginProcess/PluginControllerProxy.h: + (PluginControllerProxy): + * PluginProcess/PluginControllerProxy.messages.in: Add WK2 message for storageBlockingStateChanged. + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::storageBlockingStateChanged): + (WebKit): + (WebKit::NetscapePlugin::privateBrowsingStateChanged): + (WebKit::NetscapePlugin::updateNPNPrivateMode): Set plugin's private browsing if either private browsing or storage blocking is enabled. + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + (NetscapePlugin): + * WebProcess/Plugins/PDF/BuiltInPDFView.h: + (BuiltInPDFView): + * WebProcess/Plugins/PDF/BuiltInPDFView.mm: Treat storageBlockingStateChanged as a no-op. + (WebKit::BuiltInPDFView::storageBlockingStateChanged): + (WebKit): + * WebProcess/Plugins/Plugin.h: Add pure virtual storageBlockingStateChanged method. + (Plugin): + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::storageBlockingStateChanged): + (WebKit): + * WebProcess/Plugins/PluginProxy.h: + (PluginProxy): + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::storageBlockingStateChanged): + (WebKit): + * WebProcess/Plugins/PluginView.h: + (PluginView): + * win/WebKit2.def: + +2012-09-14 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=96688 + Put position:fixed elements in their own layers and allow them to + create a stacking context + -and corresponding- + <rdar://problem/11467961> + + Reviewed by Simon Fraser. + + Soon we want pages with fixed positioned elements to be able to be + scrolled by the ScrollingCoordinator. As a part of that work, we have + to composite fixed position elements, and we have to allow those + elements to create a stacking context. + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): + +2012-09-14 Bo Liu <boliu@chromium.org> + + Add in-place reload behavior to ImagesEnabled setting + https://bugs.webkit.org/show_bug.cgi?id=95478 + + Reviewed by Adam Barth. + + Export WebCore::Settings::setImagesEnabled symbol. + + * win/WebKit2.def: + +2012-09-14 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] RefPtr<Evas_Object> unit tests fails + https://bugs.webkit.org/show_bug.cgi?id=96809 + + Reviewed by Kenneth Rohde Christiansen. + + Added missing return. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: + (EWK2UnitTest::EWK2UnitTestBase::canvas): + +2012-09-14 Christophe Dumez <christophe.dumez@intel.com> + + WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks + https://bugs.webkit.org/show_bug.cgi?id=57570 + + Reviewed by Kenneth Rohde Christiansen. + + Add new didExceedDatabaseQuota callback to WKBundlePageUIClient + and call it from WebChromeClient::exceededDatabaseQuota(). + This is needed by WebKitTestRunner to dump information about + database callbacks. + + * Shared/APIClientTraits.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::setDatabaseQuota): Call WebDatabaseManager::setQuotaForOrigin() + with "file__0" instead of "file:///" as origin identifier. WebDatabaseManager expects + a database identifier, not a string representation of the security origin. "file__0" is + the string that is used as databaseIdentifier of local files. This bug was causing the + database quota not to be set. The test cases would therefore fail due to the quota being + 0 instead of the value explicitly set. + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + (WebKit::InjectedBundlePageUIClient::didExceedDatabaseQuota): + (WebKit): + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + (InjectedBundlePageUIClient): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::exceededDatabaseQuota): + +2012-09-14 Christophe Dumez <christophe.dumez@intel.com> + + WebKitTestRunner needs layoutTestController.setStopProvisionalFrameLoads + https://bugs.webkit.org/show_bug.cgi?id=42691 + + Reviewed by Kenneth Rohde Christiansen. + + Add WKBundleFrame private API to stop loading of a frame. + This is needed by WebKitTestRunner to implement + testrunner.setStopProvisionalFrameLoads. + + Original patch by Alexey Proskuryakov. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameStopLoading): + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::stopLoading): + (WebKit): + * WebProcess/WebPage/WebFrame.h: + (WebFrame): + +2012-09-14 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [EFL] Add unit test for RefPtr<Evas_Object> + https://bugs.webkit.org/show_bug.cgi?id=96776 + + Reviewed by Simon Hausmann. + + Basic testing of the new EFL specific RefPtr type. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: + (EWK2UnitTest::EWK2UnitTestBase::backingStore): + (EWK2UnitTest::EWK2UnitTestBase::canvas): + + Add some new accessors for Ecore_Evas and Evas*. + + * UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp: Added. + (TEST_F): + 2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> [Qt] Move .mm file to OBJECTIVE_SOURCES diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index 8aa9cd33a..f142ee8cf 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -96,6 +96,7 @@ ENABLE_LEGACY_NOTIFICATIONS_macosx = $(ENABLE_LEGACY_NOTIFICATIONS_macosx_$(TARG ENABLE_LEGACY_NOTIFICATIONS_macosx_1070 = ; ENABLE_LEGACY_NOTIFICATIONS_macosx_1080 = ENABLE_LEGACY_NOTIFICATIONS; ENABLE_LEGACY_NOTIFICATIONS_macosx_1090 = ENABLE_LEGACY_NOTIFICATIONS; +ENABLE_LEGACY_VENDOR_PREFIXES = ENABLE_LEGACY_VENDOR_PREFIXES; ENABLE_LINK_PREFETCH = ; ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; @@ -140,4 +141,4 @@ ENABLE_WIDGET_REGION_macosx = ENABLE_WIDGET_REGION; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(LEGACY_VENDOR_PREFIXES) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index b2a1841f0..b7b7a526a 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 10; +MINOR_VERSION = 11; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp index 64c2048cf..96688a172 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp @@ -80,8 +80,9 @@ uint8_t* ArgumentEncoder::grow(unsigned alignment, size_t size) m_buffer = static_cast<uint8_t*>(malloc(newCapacity)); else m_buffer = static_cast<uint8_t*>(realloc(m_buffer, newCapacity)); - - // FIXME: What should we do if allocating memory fails? + + if (!m_buffer) + CRASH(); m_bufferCapacity = newCapacity; } diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 9418d91b7..80210b9f4 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -17,6 +17,7 @@ LIST(APPEND WebKit2_SOURCES Shared/efl/NativeWebKeyboardEventEfl.cpp Shared/efl/NativeWebWheelEventEfl.cpp Shared/efl/NativeWebMouseEventEfl.cpp + Shared/efl/NativeWebTouchEventEfl.cpp Shared/efl/ProcessExecutablePathEfl.cpp Shared/efl/WebEventFactory.cpp @@ -286,6 +287,7 @@ SET(EWK2UnitTests_BINARIES test_ewk2_cookie_manager test_ewk2_download_job test_ewk2_eina_shared_string + test_ewk2_refptr_evas_object test_ewk2_intents test_ewk2_settings test_ewk2_view diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp index 2ad41daa5..31a5d61a6 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp @@ -563,6 +563,14 @@ void PluginControllerProxy::getPluginScriptableNPObject(uint64_t& pluginScriptab releaseNPObject(pluginScriptableNPObject); } +void PluginControllerProxy::storageBlockingStateChanged(bool isStorageBlockingEnabled) +{ + if (m_storageBlockingEnabled != isStorageBlockingEnabled) { + m_storageBlockingEnabled = isStorageBlockingEnabled; + m_plugin->storageBlockingStateChanged(m_storageBlockingEnabled); + } +} + void PluginControllerProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEnabled) { m_isPrivateBrowsingEnabled = isPrivateBrowsingEnabled; diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.h b/Source/WebKit2/PluginProcess/PluginControllerProxy.h index a9d35a663..b4a40673e 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.h +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.h @@ -35,6 +35,7 @@ #include "ShareableBitmap.h" #include "WebProcessConnectionMessages.h" #include <WebCore/RunLoop.h> +#include <WebCore/SecurityOrigin.h> #include <wtf/Noncopyable.h> namespace CoreIPC { @@ -152,6 +153,7 @@ private: void updateLayerHostingContext(LayerHostingMode); #endif + void storageBlockingStateChanged(bool); void privateBrowsingStateChanged(bool); void getFormValue(bool& returnValue, String& formValue); @@ -163,6 +165,7 @@ private: uint64_t m_pluginInstanceID; String m_userAgent; + bool m_storageBlockingEnabled; bool m_isPrivateBrowsingEnabled; bool m_isAcceleratedCompositingEnabled; bool m_isInitializing; diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in b/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in index 371bee237..d7c2d02b2 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in @@ -106,6 +106,9 @@ messages -> PluginControllerProxy { # Return a snapshot of the plugin Snapshot() -> (WebKit::ShareableBitmap::Handle backingStoreHandle) + # Sent when storage blocking policy changes + StorageBlockingStateChanged(bool storageBlockingEnabled) + # Sent when private browsing is enabled or disabled PrivateBrowsingStateChanged(bool isPrivateBrowsingEnabled) diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm index f4e834c57..7a8cb35f4 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -39,6 +39,10 @@ #import <objc/runtime.h> #import <wtf/HashSet.h> +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +#import "NetscapeSandboxFunctions.h" +#endif + namespace WebKit { static pthread_once_t shouldCallRealDebuggerOnce = PTHREAD_ONCE_INIT; @@ -262,6 +266,33 @@ void PluginProcess::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing) m_connection->send(Messages::PluginProcessProxy::SetFullscreenWindowIsShowing(fullscreenWindowIsShowing), 0); } +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +static void initializeSandbox(const String& pluginPath) +{ + RetainPtr<CFStringRef> cfPluginPath = adoptCF(pluginPath.createCFString()); + RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, cfPluginPath.get(), kCFURLPOSIXPathStyle, false)); + if (!pluginURL) + return; + + RetainPtr<CFBundleRef> pluginBundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, pluginURL.get())); + if (!pluginBundle) + return; + + CFStringRef bundleIdentifier = CFBundleGetIdentifier(pluginBundle.get()); + if (!bundleIdentifier) + return; + + RetainPtr<CFStringRef> sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier); + RetainPtr<CFURLRef> pluginSandboxDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, CFSTR("/usr/share/sandbox/"), kCFURLPOSIXPathStyle, YES)); + RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, pluginSandboxDirectory.get())); + RetainPtr<NSString> profileString = [[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL]; + if (!profileString) + return; + + enterSandbox([profileString.get() UTF8String], 0, 0); +} +#endif + void PluginProcess::platformInitialize(const PluginProcessCreationParameters& parameters) { m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); @@ -273,6 +304,10 @@ void PluginProcess::platformInitialize(const PluginProcessCreationParameters& pa (NSString *)parameters.parentProcessName]; WKSetVisibleApplicationName((CFStringRef)applicationName); + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + initializeSandbox(m_pluginPath); +#endif } } // namespace WebKit diff --git a/Source/WebKit2/Shared/APIClientTraits.h b/Source/WebKit2/Shared/APIClientTraits.h index 3fd03cd31..9b7663d0a 100644 --- a/Source/WebKit2/Shared/APIClientTraits.h +++ b/Source/WebKit2/Shared/APIClientTraits.h @@ -55,7 +55,7 @@ template<> struct APIClientTraits<WKBundlePageFullScreenClient> { }; template<> struct APIClientTraits<WKBundlePageUIClient> { - static const size_t interfaceSizesByVersion[2]; + static const size_t interfaceSizesByVersion[3]; }; template<> struct APIClientTraits<WKPageContextMenuClient> { diff --git a/Source/WebKit2/Shared/NativeWebTouchEvent.h b/Source/WebKit2/Shared/NativeWebTouchEvent.h index f20214a8f..49bbf8010 100644 --- a/Source/WebKit2/Shared/NativeWebTouchEvent.h +++ b/Source/WebKit2/Shared/NativeWebTouchEvent.h @@ -30,6 +30,9 @@ #if PLATFORM(QT) #include <QTouchEvent> +#elif PLATFORM(EFL) +#include "ewk_touch.h" +#include <Evas.h> #endif namespace WebKit { @@ -38,6 +41,8 @@ class NativeWebTouchEvent : public WebTouchEvent { public: #if PLATFORM(QT) explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform); +#elif PLATFORM(EFL) + NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp); #endif #if PLATFORM(QT) diff --git a/Source/WebKit2/Shared/WebHitTestResult.cpp b/Source/WebKit2/Shared/WebHitTestResult.cpp index 26eaf6a0a..799ed5220 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.cpp +++ b/Source/WebKit2/Shared/WebHitTestResult.cpp @@ -43,6 +43,7 @@ void WebHitTestResult::Data::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encode(linkLabel); encoder->encode(linkTitle); encoder->encode(isContentEditable); + encoder->encode(elementBoundingBox); } bool WebHitTestResult::Data::decode(CoreIPC::ArgumentDecoder* decoder, WebHitTestResult::Data& hitTestResultData) @@ -53,7 +54,8 @@ bool WebHitTestResult::Data::decode(CoreIPC::ArgumentDecoder* decoder, WebHitTes || !decoder->decode(hitTestResultData.absoluteMediaURL) || !decoder->decode(hitTestResultData.linkLabel) || !decoder->decode(hitTestResultData.linkTitle) - || !decoder->decode(hitTestResultData.isContentEditable)) + || !decoder->decode(hitTestResultData.isContentEditable) + || !decoder->decode(hitTestResultData.elementBoundingBox)) return false; return true; diff --git a/Source/WebKit2/Shared/WebHitTestResult.h b/Source/WebKit2/Shared/WebHitTestResult.h index 798a2db2b..e53a5c7e2 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.h +++ b/Source/WebKit2/Shared/WebHitTestResult.h @@ -21,8 +21,10 @@ #define WebHitTestResult_h #include "APIObject.h" +#include <WebCore/FrameView.h> #include <WebCore/HitTestResult.h> #include <WebCore/KURL.h> +#include <WebCore/Node.h> #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -49,11 +51,29 @@ public: String linkLabel; String linkTitle; bool isContentEditable; + WebCore::IntRect elementBoundingBox; Data() { } + WebCore::IntRect elementBoundingBoxInWindowCoordinates(const WebCore::HitTestResult& hitTestResult) + { + WebCore::Node* node = hitTestResult.innerNonSharedNode(); + if (!node) + return WebCore::IntRect(); + + WebCore::Frame* frame = node->document()->frame(); + if (!frame) + return WebCore::IntRect(); + + WebCore::FrameView* view = frame->view(); + if (!view) + return WebCore::IntRect(); + + return view->contentsToWindow(node->pixelSnappedBoundingBox()); + } + explicit Data(const WebCore::HitTestResult& hitTestResult) : absoluteImageURL(hitTestResult.absoluteImageURL().string()) , absolutePDFURL(hitTestResult.absolutePDFURL().string()) @@ -62,6 +82,7 @@ public: , linkLabel(hitTestResult.textContent()) , linkTitle(hitTestResult.titleDisplayString()) , isContentEditable(hitTestResult.isContentEditable()) + , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult)) { } @@ -81,6 +102,8 @@ public: bool isContentEditable() const { return m_data.isContentEditable; } + WebCore::IntRect elementBoundingBox() const { return m_data.elementBoundingBox; } + private: explicit WebHitTestResult(const WebHitTestResult::Data& hitTestResultData) : m_data(hitTestResultData) diff --git a/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp b/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp new file mode 100644 index 000000000..70d8bb7c7 --- /dev/null +++ b/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * 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 "NativeWebTouchEvent.h" + +#include "WebEventFactory.h" + +#if ENABLE(TOUCH_EVENTS) + +namespace WebKit { + +NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp) + : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, position, timestamp)) +{ +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.cpp b/Source/WebKit2/Shared/efl/WebEventFactory.cpp index 74a0530a3..6e50ed199 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/efl/WebEventFactory.cpp @@ -192,4 +192,56 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Up event->timestamp); } +#if ENABLE(TOUCH_EVENTS) +static inline WebEvent::Type typeForTouchEvent(Ewk_Touch_Event_Type type) +{ + if (type == EWK_TOUCH_START) + return WebEvent::TouchStart; + if (type == EWK_TOUCH_MOVE) + return WebEvent::TouchMove; + if (type == EWK_TOUCH_END) + return WebEvent::TouchEnd; + if (type == EWK_TOUCH_CANCEL) + return WebEvent::TouchCancel; + + return WebEvent::NoType; +} + +WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp) +{ + Vector<WebPlatformTouchPoint> touchPoints; + WebPlatformTouchPoint::TouchPointState state; + const Eina_List* list; + void* item; + EINA_LIST_FOREACH(points, list, item) { + Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(item); + + switch (point->state) { + case EVAS_TOUCH_POINT_UP: + state = WebPlatformTouchPoint::TouchReleased; + break; + case EVAS_TOUCH_POINT_MOVE: + state = WebPlatformTouchPoint::TouchMoved; + break; + case EVAS_TOUCH_POINT_DOWN: + state = WebPlatformTouchPoint::TouchPressed; + break; + case EVAS_TOUCH_POINT_STILL: + state = WebPlatformTouchPoint::TouchStationary; + break; + case EVAS_TOUCH_POINT_CANCEL: + state = WebPlatformTouchPoint::TouchCancelled; + break; + default: + ASSERT_NOT_REACHED(); + break; + } + + touchPoints.append(WebPlatformTouchPoint(point->id, state, IntPoint(point->x, point->y), IntPoint(point->x - position->x, point->y - position->y))); + } + + return WebTouchEvent(typeForTouchEvent(type), touchPoints, modifiersForEvent(modifiers), timestamp); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.h b/Source/WebKit2/Shared/efl/WebEventFactory.h index f47a3caed..9a8b1d6bd 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.h +++ b/Source/WebKit2/Shared/efl/WebEventFactory.h @@ -27,6 +27,7 @@ #define WebEventFactory_h #include "WebEvent.h" +#include "ewk_touch.h" #include <Evas.h> namespace WebKit { @@ -39,6 +40,9 @@ public: static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*); static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Down*); static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Up*); +#if ENABLE(TOUCH_EVENTS) + static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp); +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri index 8ff365cc1..81895f04d 100644 --- a/Source/WebKit2/Target.pri +++ b/Source/WebKit2/Target.pri @@ -617,7 +617,6 @@ SOURCES += \ UIProcess/WebUIClient.cpp \ UIProcess/WebVibrationProvider.cpp \ UIProcess/WebVibrationProxy.cpp \ - UIProcess/qt/QtWebContext.cpp \ UIProcess/qt/TextCheckerQt.cpp \ UIProcess/qt/WebContextQt.cpp \ UIProcess/qt/WebFullScreenManagerProxyQt.cpp \ @@ -809,7 +808,6 @@ have?(QTQUICK) { UIProcess/API/qt/qwebpreferences.cpp \ UIProcess/API/qt/qwebkittest.cpp \ UIProcess/qt/PageViewportControllerClientQt.cpp \ - UIProcess/qt/QtWebError.cpp \ UIProcess/qt/QtDialogRunner.cpp \ UIProcess/qt/QtDownloadManager.cpp \ UIProcess/qt/QtPageClient.cpp \ @@ -821,6 +819,8 @@ have?(QTQUICK) { UIProcess/qt/QtPanGestureRecognizer.cpp \ UIProcess/qt/QtPinchGestureRecognizer.cpp \ UIProcess/qt/QtTapGestureRecognizer.cpp \ + UIProcess/qt/QtWebContext.cpp \ + UIProcess/qt/QtWebError.cpp \ UIProcess/qt/WebContextMenuProxyQt.cpp \ UIProcess/qt/WebGeolocationProviderQt.cpp \ UIProcess/qt/WebPopupMenuProxyQt.cpp \ diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index 9e75e0828..f8519ce6b 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -39,6 +39,7 @@ #include "ewk_context_private.h" #include "ewk_download_job.h" #include "ewk_download_job_private.h" +#include "ewk_view.h" #include "ewk_view_private.h" using namespace WebCore; @@ -106,7 +107,12 @@ bool PageClientImpl::isViewInWindow() void PageClientImpl::processDidCrash() { - notImplemented(); + // Check if loading was ongoing, when web process crashed. + double loadProgress = ewk_view_load_progress_get(m_viewWidget); + if (loadProgress >= 0 && loadProgress < 1) + ewk_view_load_progress_changed(m_viewWidget, 1); + + ewk_view_webprocess_crashed(m_viewWidget); } void PageClientImpl::didRelaunchProcess() diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_private.h index 86ca42d4e..96611e20d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_private.h @@ -31,4 +31,6 @@ #define COMPILE_ASSERT_MATCHING_ENUM(ewkName, webcoreName) \ COMPILE_ASSERT(int(ewkName) == int(webcoreName), mismatchingEnums) +extern int _ewk_log_dom; + #endif // ewk_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_touch.h b/Source/WebKit2/UIProcess/API/efl/ewk_touch.h new file mode 100644 index 000000000..1c9cdd59d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_touch.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * 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_touch_h +#define ewk_touch_h + +#include <Evas.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/// Represents types of touch event. +typedef enum { + EWK_TOUCH_START, + EWK_TOUCH_MOVE, + EWK_TOUCH_END, + EWK_TOUCH_CANCEL +} Ewk_Touch_Event_Type; + +/// Creates a type name for _Ewk_Touch_Point. +typedef struct _Ewk_Touch_Point Ewk_Touch_Point; + +/// Represents a touch point. +struct _Ewk_Touch_Point { + int id; /**< identifier of the touch event */ + int x; /**< the horizontal position of the touch event */ + int y; /**< the vertical position of the touch event */ + Evas_Touch_Point_State state; /**< state of the touch event */ +}; + +#ifdef __cplusplus +} +#endif + +#endif // ewk_touch_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index dc77fb2cc..148a5b64c 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -498,7 +498,10 @@ bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv->evasGl, false); + if (priv->evasGl) { + EINA_LOG_DOM_WARN(_ewk_log_dom, "Accelerated compositing mode already entered."); + return false; + } Evas* evas = evas_object_evas_get(ewkView); priv->evasGl = evas_gl_new(evas); @@ -1623,3 +1626,26 @@ Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView) return priv->areMouseEventsEnabled; } + +/** + * @internal + * Web process has crashed. + * + * Emits signal: "webprocess,crashed" with pointer to crash handling boolean. + */ +void ewk_view_webprocess_crashed(Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + bool handled = false; + evas_object_smart_callback_call(ewkView, "webprocess,crashed", &handled); + + if (!handled) { + CString url = priv->pageProxy->urlAtProcessExit().utf8(); + EINA_LOG_DOM_WARN(_ewk_log_dom, "WARNING: The web process experienced a crash on '%s'.\n", url.data()); + + // Display an error page + ewk_view_html_string_load(ewkView, "The web process has crashed.", 0, url.data()); + } +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index b040fdf30..996a2bbf5 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -64,6 +64,7 @@ * - "text,found", unsigned int*: the requested text was found and it gives the number of matches. * - "title,changed", const char*: title of the main frame was changed. * - "uri,changed", const char*: uri of the main frame was changed. + * - "webprocess,crashed", Eina_Bool*: expects a @c EINA_TRUE if web process crash is handled; @c EINA_FALSE, otherwise. */ #ifndef ewk_view_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index fcd65ee0f..88f9aab07 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -101,5 +101,6 @@ bool ewk_view_accelerated_compositing_mode_exit(const Evas_Object* ewkView); #endif void ewk_view_popup_menu_request(Evas_Object* ewkView, WebKit::WebPopupMenuProxyEfl* popupMenu, const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebKit::WebPopupItem>& items, int32_t selectedIndex); +void ewk_view_webprocess_crashed(Evas_Object* ewkView); #endif // ewk_view_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h index fa6abd160..717607897 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h @@ -29,6 +29,8 @@ namespace EWK2UnitTest { class EWK2UnitTestBase : public ::testing::Test { public: + Ecore_Evas* backingStore() { return m_ecoreEvas; } + Evas* canvas() { return ecore_evas_get(m_ecoreEvas); } Evas_Object* webView() { return m_webView; } Ewk_View_Smart_Class* ewkViewClass() { return &m_ewkViewClass; } diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp new file mode 100644 index 000000000..fb6e57269 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp @@ -0,0 +1,134 @@ +/* + * 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include <EWebKit2.h> +#include <Ecore_Evas.h> +#include <Evas.h> +#include <gtest/gtest.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/efl/RefPtrEfl.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +TEST_F(EWK2UnitTestBase, construction) +{ + RefPtr<Evas_Object> nullObject = 0; + ASSERT_FALSE(nullObject); + + RefPtr<Evas_Object> object; + ASSERT_FALSE(object); + + object = adoptRef(evas_object_box_add(canvas())); + ASSERT_TRUE(object); + + object = 0; + ASSERT_FALSE(object); + + object = adoptRef(evas_object_box_add(canvas())); + ASSERT_TRUE(object); + + object.clear(); + ASSERT_FALSE(object); +} + +TEST_F(EWK2UnitTestBase, reffing) +{ + RefPtr<Evas_Object> object = adoptRef(evas_object_box_add(canvas())); + ASSERT_TRUE(object); + // Evas_Objec external ref count is not as you would expect. + ASSERT_EQ(evas_object_ref_get(object.get()), 0); + + { + RefPtr<Evas_Object> aRef = object; + ASSERT_TRUE(object); + ASSERT_TRUE(aRef); + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); + + { + RefPtr<Evas_Object> bRef = object; + + ASSERT_TRUE(object); + ASSERT_TRUE(aRef); + ASSERT_TRUE(bRef); + + ASSERT_EQ(evas_object_ref_get(object.get()), 2); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 2); + + RefPtr<Evas_Object> cRef = bRef; + ASSERT_TRUE(cRef); + + ASSERT_EQ(evas_object_ref_get(object.get()), 3); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 3); + ASSERT_EQ(evas_object_ref_get(bRef.get()), 3); + ASSERT_EQ(evas_object_ref_get(cRef.get()), 3); + + bRef.clear(); + ASSERT_EQ(evas_object_ref_get(object.get()), 2); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 2); + ASSERT_EQ(evas_object_ref_get(cRef.get()), 2); + } + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); + } + ASSERT_EQ(evas_object_ref_get(object.get()), 0); +} + +TEST_F(EWK2UnitTestBase, destruction) +{ + RefPtr<Evas_Object> object = adoptRef(evas_object_box_add(canvas())); + ASSERT_TRUE(object); + ASSERT_EQ(evas_object_ref_get(object.get()), 0); + + RefPtr<Evas_Object> aRef = object; + ASSERT_TRUE(object); + ASSERT_TRUE(aRef); + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); + + object = nullptr; + ASSERT_EQ(evas_object_ref_get(object.get()), 0); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 0); + + object = aRef; + ASSERT_EQ(evas_object_ref_get(object.get()), 1); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 1); + + object = 0; + ASSERT_EQ(evas_object_ref_get(object.get()), 0); + ASSERT_EQ(evas_object_ref_get(aRef.get()), 0); + + aRef.clear(); + ASSERT_FALSE(aRef); + ASSERT_FALSE(object); +} + diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 6fefb652b..e35f603ff 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -1268,6 +1268,8 @@ void webkitWebViewMakePermissionRequest(WebKitWebView* webView, WebKitPermission void webkitWebViewMouseTargetChanged(WebKitWebView* webView, WKHitTestResultRef wkHitTestResult, unsigned modifiers) { + webkitWebViewBaseSetTooltipArea(WEBKIT_WEB_VIEW_BASE(webView), toImpl(wkHitTestResult)->elementBoundingBox()); + WebKitWebViewPrivate* priv = webView->priv; if (priv->mouseTargetHitTestResult && priv->mouseTargetModifiers == modifiers diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index f5bd2ddcc..0482b347e 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -84,6 +84,7 @@ struct _WebKitWebViewBasePrivate { GRefPtr<GtkIMContext> imContext; GtkClickCounter clickCounter; CString tooltipText; + IntRect tooltipArea; GtkDragAndDropHelper dragAndDropHelper; DragIcon dragIcon; IntSize resizerSize; @@ -502,9 +503,13 @@ static gboolean webkitWebViewBaseQueryTooltip(GtkWidget* widget, gint x, gint y, if (priv->tooltipText.length() <= 0) return FALSE; - // TODO: set the tip area when WKPageMouseDidMoveOverElementCallback - // receives a hit test result. + if (!priv->tooltipArea.isEmpty()) { + GdkRectangle area = priv->tooltipArea; + gtk_tooltip_set_tip_area(tooltip, &area); + } else + gtk_tooltip_set_tip_area(tooltip, 0); gtk_tooltip_set_text(tooltip, priv->tooltipText.data()); + return TRUE; } @@ -691,6 +696,11 @@ void webkitWebViewBaseSetTooltipText(WebKitWebViewBase* webViewBase, const char* gtk_widget_trigger_tooltip_query(GTK_WIDGET(webViewBase)); } +void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase* webViewBase, const IntRect& tooltipArea) +{ + webViewBase->priv->tooltipArea = tooltipArea; +} + void webkitWebViewBaseStartDrag(WebKitWebViewBase* webViewBase, const DragData& dragData, PassRefPtr<ShareableBitmap> dragImage) { WebKitWebViewBasePrivate* priv = webViewBase->priv; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h index 70cc72575..1295f3d53 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h @@ -40,6 +40,7 @@ GtkIMContext* webkitWebViewBaseGetIMContext(WebKitWebViewBase*); WebPageProxy* webkitWebViewBaseGetPage(WebKitWebViewBase*); void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, WKContextRef, WKPageGroupRef); void webkitWebViewBaseSetTooltipText(WebKitWebViewBase*, const char*); +void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&); void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*); void webkitWebViewBaseStartDrag(WebKitWebViewBase*, const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage); void webkitWebViewBaseChildMoveResize(WebKitWebViewBase*, GtkWidget*, const WebCore::IntRect&); diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index bacae91ec..80f1ba7f0 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -349,10 +349,6 @@ bool QQuickWebViewPrivate::transparentBackground() const return webPageProxy->drawsTransparentBackground(); } -/*! - \qmlsignal WebView::loadingChanged(WebLoadRequest request) -*/ - void QQuickWebViewPrivate::provisionalLoadDidStart(const WTF::String& url) { Q_Q(QQuickWebView); @@ -1439,7 +1435,6 @@ QQuickWebPage* QQuickWebViewExperimental::page() /*! \page index.html - \title QtWebKit: QML WebView version 3.0 The WebView API allows QML applications to render regions of dynamic @@ -1447,12 +1442,12 @@ QQuickWebPage* QQuickWebViewExperimental::page() QML components or encompass the full screen as specified within the QML application. - QML WebView version 3.0 is incompatible with previous QML WebView API - versions. It allows an application to load pages into the WebView, - either by URL or with an HTML string, and navigate within session - history. By default, links to different pages load within the same - WebView, but applications may intercept requests to delegate links to - other functions. + QML WebView version 3.0 is incompatible with previous QML \l + {QtWebKit1::WebView} {WebView} API versions. It allows an + application to load pages into the WebView, either by URL or with + an HTML string, and navigate within session history. By default, + links to different pages load within the same WebView, but applications + may intercept requests to delegate links to other functions. This sample QML application loads a web page, responds to session history context, and intercepts requests for external links: @@ -1485,6 +1480,7 @@ QQuickWebPage* QQuickWebViewExperimental::page() /*! \qmltype WebView + \instantiates QQuickWebView \inqmlmodule QtWebKit 3.0 \brief A WebView renders web content within a QML application */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp index 39f314c3b..eebf20d76 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebloadrequest.cpp @@ -40,15 +40,16 @@ public: }; /*! - \qmlclass WebLoadRequest QWebLoadRequest + \qmltype WebLoadRequest + \instantiates QWebLoadRequest + \inqmlmodule QtWebKit 3.0 + \brief A utility class for the WebView::loadingChanged signal. This class contains information about a requested load of a web page, like the URL and current loading status (started, finished, failed). - \sa WebView::loadingChanged(WebLoadRequest) - - \inqmlmodule QtWebKit 3.0 + \sa WebView::onLoadingChanged */ QWebLoadRequest::QWebLoadRequest(const QUrl& url, QQuickWebView::LoadStatus status, const QString& errorString, QQuickWebView::ErrorDomain errorDomain, int errorCode, QObject* parent) : QObject(parent) @@ -80,7 +81,8 @@ QUrl QWebLoadRequest::url() const \li WebView::LoadFailedStatus - the page has failed loading. \endlist - \sa WebLoadRequest, WebView::loadingChanged(WebLoadRequest) + \sa WebLoadRequest + \sa WebView::onLoadingChanged */ QQuickWebView::LoadStatus QWebLoadRequest::status() const { diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h index 00af84965..b2f92f4b0 100644 --- a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h @@ -50,7 +50,7 @@ public: void detachChallenge(); private: - AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge); + explicit AuthenticationDecisionListener(AuthenticationChallengeProxy*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/Authentication/WebCredential.h b/Source/WebKit2/UIProcess/Authentication/WebCredential.h index b07a8a6ec..9f42d02e4 100644 --- a/Source/WebKit2/UIProcess/Authentication/WebCredential.h +++ b/Source/WebKit2/UIProcess/Authentication/WebCredential.h @@ -63,8 +63,8 @@ public: const String& user() const; private: - WebCredential(const WebCore::Credential&); - WebCredential(WebCertificateInfo*); + explicit WebCredential(const WebCore::Credential&); + explicit WebCredential(WebCertificateInfo*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h index 604236a62..7c3882aad 100644 --- a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h +++ b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h @@ -51,7 +51,7 @@ public: WebCore::ProtectionSpaceAuthenticationScheme authenticationScheme() const; private: - WebProtectionSpace(const WebCore::ProtectionSpace&); + explicit WebProtectionSpace(const WebCore::ProtectionSpace&); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/GenericCallback.h b/Source/WebKit2/UIProcess/GenericCallback.h index b0d7b9b1c..5b6a0f9bb 100644 --- a/Source/WebKit2/UIProcess/GenericCallback.h +++ b/Source/WebKit2/UIProcess/GenericCallback.h @@ -44,7 +44,7 @@ public: uint64_t callbackID() const { return m_callbackID; } protected: - CallbackBase(void* context) + explicit CallbackBase(void* context) : m_context(context) , m_callbackID(generateCallbackID()) { diff --git a/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h b/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h index 56aa7fb26..ecffaf84f 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h +++ b/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h @@ -51,7 +51,7 @@ class WebSocketServerConnection; class WebSocketServer { public: enum ServerState { Closed, Listening }; - WebSocketServer(WebSocketServerClient*); + explicit WebSocketServer(WebSocketServerClient*); virtual ~WebSocketServer(); // Server operations. diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index 71ec685c2..e9a513af1 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -28,6 +28,8 @@ #include <WebCore/FloatSize.h> #include <wtf/MathExtras.h> +using namespace WebCore; + namespace WebKit { static inline float bound(float min, float value, float max) diff --git a/Source/WebKit2/UIProcess/PageViewportController.h b/Source/WebKit2/UIProcess/PageViewportController.h index 0746ff1df..1820d8d69 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.h +++ b/Source/WebKit2/UIProcess/PageViewportController.h @@ -32,8 +32,6 @@ class IntPoint; class IntSize; } -using namespace WebCore; - namespace WebKit { class WebPageProxy; @@ -76,11 +74,11 @@ public: void suspendContent(); void resumeContent(); - FloatRect positionRangeForContentAtScale(float viewportScale) const; + WebCore::FloatRect positionRangeForContentAtScale(float viewportScale) const; float convertFromViewport(float value) const { return value / m_devicePixelRatio; } float convertToViewport(float value) const { return value * m_devicePixelRatio; } - FloatRect convertToViewport(const FloatRect&) const; + WebCore::FloatRect convertToViewport(const WebCore::FloatRect&) const; float innerBoundedContentsScale(float) const; float outerBoundedContentsScale(float) const; @@ -89,7 +87,7 @@ public: bool hadUserInteraction() const { return m_hadUserInteraction; } bool allowsUserScaling() const { return m_allowsUserScaling; } - FloatSize contentsLayoutSize() const { return m_rawAttributes.layoutSize; } + WebCore::FloatSize contentsLayoutSize() const { return m_rawAttributes.layoutSize; } float devicePixelRatio() const { return m_devicePixelRatio; } float minimumContentsScale() const { return m_minimumScale; } float maximumContentsScale() const { return m_maximumScale; } @@ -98,21 +96,21 @@ public: void setHadUserInteraction(bool didUserInteract) { m_hadUserInteraction = didUserInteract; } // Notifications to the WebProcess. - void setViewportSize(const FloatSize& newSize); - void setVisibleContentsRect(const FloatRect& visibleContentsRect, float viewportScale, const FloatPoint& trajectoryVector = FloatPoint::zero()); + void setViewportSize(const WebCore::FloatSize& newSize); + void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float viewportScale, const WebCore::FloatPoint& trajectoryVector = WebCore::FloatPoint::zero()); // Notifications from the WebProcess. - void didChangeContentsSize(const IntSize& newSize); - void didChangeViewportAttributes(const ViewportAttributes&); - void pageDidRequestScroll(const IntPoint& cssPosition); + void didChangeContentsSize(const WebCore::IntSize& newSize); + void didChangeViewportAttributes(const WebCore::ViewportAttributes&); + void pageDidRequestScroll(const WebCore::IntPoint& cssPosition); private: - void syncVisibleContents(const FloatPoint &trajectoryVector = FloatPoint::zero()); + void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero()); WebPageProxy* const m_webPageProxy; PageViewportControllerClient* m_client; - ViewportAttributes m_rawAttributes; + WebCore::ViewportAttributes m_rawAttributes; bool m_allowsUserScaling; float m_minimumScale; @@ -123,16 +121,16 @@ private: bool m_hasSuspendedContent; bool m_hadUserInteraction; - FloatSize m_viewportSize; - FloatSize m_contentsSize; - FloatRect m_visibleContentsRect; + WebCore::FloatSize m_viewportSize; + WebCore::FloatSize m_contentsSize; + WebCore::FloatRect m_visibleContentsRect; float m_effectiveScale; // Should always be cssScale * devicePixelRatio. friend class ViewportUpdateDeferrer; }; bool fuzzyCompare(float, float, float epsilon); -FloatPoint boundPosition(const FloatPoint minPosition, const FloatPoint& position, const FloatPoint& maxPosition); +WebCore::FloatPoint boundPosition(const WebCore::FloatPoint minPosition, const WebCore::FloatPoint& position, const WebCore::FloatPoint& maxPosition); } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm index 9b86aaed3..29c744ffd 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm @@ -115,8 +115,14 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu const PluginModuleInfo& loadedPlugin = alreadyLoadedPlugins[i]; // If a plug-in with the same bundle identifier already exists, we don't want to load it. - if (loadedPlugin.bundleIdentifier == plugin.bundleIdentifier) - return false; + // However, if the already existing plug-in is blocked we want to replace it with the new plug-in. + if (loadedPlugin.bundleIdentifier == plugin.bundleIdentifier) { + if (!shouldBlockPlugin(loadedPlugin)) + return false; + + alreadyLoadedPlugins.remove(i); + break; + } } // Prefer the Oracle Java plug-in over the Apple java plug-in. diff --git a/Source/WebKit2/UIProcess/ResponsivenessTimer.h b/Source/WebKit2/UIProcess/ResponsivenessTimer.h index 307b3b169..8db2872fd 100644 --- a/Source/WebKit2/UIProcess/ResponsivenessTimer.h +++ b/Source/WebKit2/UIProcess/ResponsivenessTimer.h @@ -40,7 +40,7 @@ public: virtual void didBecomeResponsive(ResponsivenessTimer*) = 0; }; - ResponsivenessTimer(ResponsivenessTimer::Client*); + explicit ResponsivenessTimer(ResponsivenessTimer::Client*); ~ResponsivenessTimer(); void start(); diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h index b3dca15b6..597f8d7e1 100644 --- a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h @@ -68,7 +68,7 @@ public: bool shouldTerminate(WebProcessProxy*) const; private: - WebApplicationCacheManagerProxy(WebContext*); + explicit WebApplicationCacheManagerProxy(WebContext*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.h b/Source/WebKit2/UIProcess/WebBackForwardList.h index d78ed5a67..b6de90b03 100644 --- a/Source/WebKit2/UIProcess/WebBackForwardList.h +++ b/Source/WebKit2/UIProcess/WebBackForwardList.h @@ -85,7 +85,7 @@ public: #endif private: - WebBackForwardList(WebPageProxy*); + explicit WebBackForwardList(WebPageProxy*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h index 5693751e0..ffe322811 100644 --- a/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h +++ b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h @@ -41,7 +41,7 @@ class WebContextUserMessageEncoder : public UserMessageEncoder<WebContextUserMes public: typedef UserMessageEncoder<WebContextUserMessageEncoder> Base; - WebContextUserMessageEncoder(APIObject* root) + explicit WebContextUserMessageEncoder(APIObject* root) : Base(root) { } diff --git a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h index 61435d647..b83af5476 100644 --- a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h @@ -90,7 +90,7 @@ public: void requestExitFullScreen(); private: - WebFullScreenManagerProxy(WebPageProxy*); + explicit WebFullScreenManagerProxy(WebPageProxy*); void supportsFullScreen(bool withKeyboard, bool&); void enterFullScreen(); diff --git a/Source/WebKit2/UIProcess/WebGrammarDetail.h b/Source/WebKit2/UIProcess/WebGrammarDetail.h index ff79b5cce..2fcebc0ec 100644 --- a/Source/WebKit2/UIProcess/WebGrammarDetail.h +++ b/Source/WebKit2/UIProcess/WebGrammarDetail.h @@ -50,7 +50,7 @@ public: private: WebGrammarDetail(int location, int length, ImmutableArray* guesses, const String& userDescription); - WebGrammarDetail(const WebCore::GrammarDetail&); + explicit WebGrammarDetail(const WebCore::GrammarDetail&); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h index 1f53cccf0..b80700429 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.h +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h @@ -144,7 +144,7 @@ public: #endif private: - WebInspectorProxy(WebPageProxy* page); + explicit WebInspectorProxy(WebPageProxy*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h index 79cb03ee9..2be77c351 100644 --- a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h @@ -68,7 +68,7 @@ public: bool shouldTerminate(WebProcessProxy*) const; private: - WebKeyValueStorageManagerProxy(WebContext*); + explicit WebKeyValueStorageManagerProxy(WebContext*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h index 43231e5e6..adc68c4ab 100644 --- a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h @@ -66,7 +66,7 @@ public: bool shouldTerminate(WebProcessProxy*) const; private: - WebMediaCacheManagerProxy(WebContext*); + explicit WebMediaCacheManagerProxy(WebContext*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebNavigationData.h b/Source/WebKit2/UIProcess/WebNavigationData.h index a2788d6bc..c2e20f368 100644 --- a/Source/WebKit2/UIProcess/WebNavigationData.h +++ b/Source/WebKit2/UIProcess/WebNavigationData.h @@ -48,7 +48,7 @@ public: const WebCore::ResourceRequest& originalRequest() const { return m_store.originalRequest; } private: - WebNavigationData(const WebNavigationDataStore&); + explicit WebNavigationData(const WebNavigationDataStore&); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h index ba931dcf3..5ec369c9b 100644 --- a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h +++ b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h @@ -52,7 +52,7 @@ public: void invalidate(); private: - WebOpenPanelResultListenerProxy(WebPageProxy*); + explicit WebOpenPanelResultListenerProxy(WebPageProxy*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h index d5bfa4c5c..0d7788dc4 100644 --- a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h +++ b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h @@ -72,7 +72,7 @@ public: void invalidate() { m_client = 0; } protected: - WebPopupMenuProxy(Client* client) + explicit WebPopupMenuProxy(Client* client) : m_client(client) { } diff --git a/Source/WebKit2/UIProcess/WebPreferences.h b/Source/WebKit2/UIProcess/WebPreferences.h index 1cb9731e1..81d9580a4 100644 --- a/Source/WebKit2/UIProcess/WebPreferences.h +++ b/Source/WebKit2/UIProcess/WebPreferences.h @@ -79,7 +79,7 @@ public: private: WebPreferences(); - WebPreferences(const String& identifier); + explicit WebPreferences(const String&); WebPreferences(const WebPreferences&); void platformInitializeStore(); diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index 3d134ea93..c517023e2 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -32,6 +32,8 @@ #include <WebCore/FloatRect.h> #include <WebCore/FloatSize.h> +using namespace WebCore; + namespace WebKit { static const int kScaleAnimationDurationMillis = 250; diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h index 8b2819ad8..19b27ae9e 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h @@ -47,7 +47,7 @@ public: PageViewportControllerClientQt(QQuickWebView*, QQuickWebPage*); ~PageViewportControllerClientQt(); - virtual void setContentsPosition(const FloatPoint& localPoint); + virtual void setContentsPosition(const WebCore::FloatPoint& localPoint); virtual void setContentsScale(float localScale, bool treatAsInitialValue); virtual void didResumeContent(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index d32b5618c..895be2323 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -182,6 +182,11 @@ void WKBundleFrameClearOpener(WKBundleFrameRef frameRef) coreFrame->loader()->setOpener(0); } +void WKBundleFrameStopLoading(WKBundleFrameRef frameRef) +{ + toImpl(frameRef)->stopLoading(); +} + WKStringRef WKBundleFrameCopyLayerTreeAsText(WKBundleFrameRef frameRef) { return toCopiedAPI(toImpl(frameRef)->layerTreeAsText()); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h index 98722f856..b4710445f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h @@ -49,6 +49,7 @@ WK_EXPORT void WKBundleFrameResumeAnimations(WKBundleFrameRef frame); WK_EXPORT unsigned WKBundleFrameGetPendingUnloadCount(WKBundleFrameRef frame); WK_EXPORT WKStringRef WKBundleFrameCopyLayerTreeAsText(WKBundleFrameRef frame); WK_EXPORT void WKBundleFrameClearOpener(WKBundleFrameRef frame); +WK_EXPORT void WKBundleFrameStopLoading(WKBundleFrameRef frame); WK_EXPORT bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frame); WK_EXPORT void WKBundleFrameSetTextDirection(WKBundleFrameRef frame, WKStringRef); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index 206e1e9c3..04abc86ae 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -237,6 +237,7 @@ typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo); typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo); typedef void (*WKBundlePageReachedAppCacheOriginQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void *clientInfo); +typedef uint64_t (*WKBundlePageExceededDatabaseQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void *clientInfo); struct WKBundlePageUIClient { int version; @@ -258,10 +259,14 @@ struct WKBundlePageUIClient { // Version 1. WKBundlePageReachedAppCacheOriginQuotaCallback didReachApplicationCacheOriginQuota; + + // Version 2. + WKBundlePageExceededDatabaseQuotaCallback didExceedDatabaseQuota; + }; typedef struct WKBundlePageUIClient WKBundlePageUIClient; -enum { kWKBundlePageUIClientCurrentVersion = 1 }; +enum { kWKBundlePageUIClientCurrentVersion = 2 }; // Editor client typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index a7de64e8a..a1ba347f5 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -327,7 +327,9 @@ void InjectedBundle::clearAllDatabases() void InjectedBundle::setDatabaseQuota(uint64_t quota) { #if ENABLE(SQL_DATABASE) - WebDatabaseManager::shared().setQuotaForOrigin("file:///", quota); + // Historically, we've used the following (somewhat non-sensical) string + // for the databaseIdentifier of local files. + WebDatabaseManager::shared().setQuotaForOrigin("file__0", quota); #endif } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp index 2ef9ca76f..62aa2b318 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp @@ -155,4 +155,12 @@ void InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota(WebPage* pa m_client.didReachApplicationCacheOriginQuota(toAPI(page), toAPI(origin), totalBytesNeeded, m_client.clientInfo); } +uint64_t InjectedBundlePageUIClient::didExceedDatabaseQuota(WebPage* page, WebSecurityOrigin* origin, const String& databaseName, const String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes) +{ + if (!m_client.didExceedDatabaseQuota) + return 0; + + return m_client.didExceedDatabaseQuota(toAPI(page), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuotaBytes, currentOriginUsageBytes, currentDatabaseUsageBytes, expectedUsageBytes, m_client.clientInfo); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h index b8a48271f..13c89c67d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h @@ -67,6 +67,7 @@ public: WKBundlePageUIElementVisibility toolbarsAreVisible(WebPage*); void didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded); + uint64_t didExceedDatabaseQuota(WebPage*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes); }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp index 01238cbc1..d67ac9511 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -946,8 +946,24 @@ void NetscapePlugin::contentsScaleFactorChanged(float scaleFactor) #endif } +void NetscapePlugin::storageBlockingStateChanged(bool storageBlockingEnabled) +{ + if (m_storageBlockingState != storageBlockingEnabled) { + m_storageBlockingState = storageBlockingEnabled; + updateNPNPrivateMode(); + } +} + void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled) { + if (m_privateBrowsingState != privateBrowsingEnabled) { + m_privateBrowsingState = privateBrowsingEnabled; + updateNPNPrivateMode(); + } +} + +void NetscapePlugin::updateNPNPrivateMode() +{ ASSERT(m_isStarted); // From https://wiki.mozilla.org/Plugins:PrivateMode @@ -955,7 +971,7 @@ void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled) // (assigned enum value 18) with a pointer to an NPBool value on all applicable instances. // Plugins should check the boolean value pointed to, not the pointer itself. // The value will be true when private mode is on. - NPBool value = privateBrowsingEnabled; + NPBool value = m_privateBrowsingState || m_storageBlockingState; NPP_SetValue(NPNVprivateModeBool, &value); } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h index 2c290c76b..61e2bb798 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h @@ -221,6 +221,7 @@ private: #endif virtual void contentsScaleFactorChanged(float); + virtual void storageBlockingStateChanged(bool); virtual void privateBrowsingStateChanged(bool); virtual bool getFormValue(String& formValue); virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity); @@ -236,6 +237,8 @@ private: // converted (if the transformation matrix isn't invertible). bool convertFromRootView(const WebCore::IntPoint& pointInRootViewCoordinates, WebCore::IntPoint& pointInPluginCoordinates); + void updateNPNPrivateMode(); + #if PLUGIN_ARCHITECTURE(WIN) static BOOL WINAPI hookedTrackPopupMenu(HMENU, UINT uFlags, int x, int y, int nReserved, HWND, const RECT*); void scheduleWindowedGeometryUpdate(); @@ -312,6 +315,9 @@ private: TimerMap m_timers; unsigned m_nextTimerID; + bool m_privateBrowsingState; + bool m_storageBlockingState; + #if PLUGIN_ARCHITECTURE(MAC) NPDrawingModel m_drawingModel; NPEventModel m_eventModel; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h index d58924368..0956cc636 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h @@ -51,7 +51,10 @@ typedef struct _WKNSandboxFunctions { WKN_FileStopAccessingProcPtr fileStopAccessing; } WKNSandboxFunctions; +// FIXME: This header is mostly "API", except for the following two functions. We should +// move the declarations to a seperate header. WKNSandboxFunctions* netscapeSandboxFunctions(); +NPError enterSandbox(const char* sandboxProfile, const char* readOnlyPaths[], const char* readWritePaths[]); #ifdef __cplusplus } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm index afcc6456c..07cd2e708 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm @@ -94,15 +94,11 @@ static CString readSandboxProfile() return result; } -NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths[]) +NPError enterSandbox(const char* sandboxProfile, const char* readOnlyPaths[], const char* readWritePaths[]) { if (enteredSandbox) return NPERR_GENERIC_ERROR; - CString profile = readSandboxProfile(); - if (profile.isNull()) - exit(EX_NOPERM); - #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(); @@ -157,7 +153,7 @@ NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths exit(EX_NOPERM); const char* sandboxParameters[] = { "HOME_DIR", homeDirectory, 0, 0 }; - if (!WKEnterPluginSandbox(profile.data(), sandboxParameters, extendedReadOnlyPaths.data(), extendedReadWritePaths.data())) { + if (!WKEnterPluginSandbox(sandboxProfile, sandboxParameters, extendedReadOnlyPaths.data(), extendedReadWritePaths.data())) { WTFLogAlways("Couldn't initialize sandbox profile\n"); exit(EX_NOPERM); } @@ -169,9 +165,22 @@ NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths free(homeDirectory); enteredSandbox = true; + + RetainPtr<NSDictionary> defaults = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"NSUseRemoteSavePanel", nil]); + [[NSUserDefaults standardUserDefaults] registerDefaults:defaults.get()]; + return NPERR_NO_ERROR; } +NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths[]) +{ + CString profile = readSandboxProfile(); + if (profile.isNull()) + exit(EX_NOPERM); + + return enterSandbox(profile.data(), readOnlyPaths, readWritePaths); +} + NPError WKN_FileStopAccessing(const char* path) { if (!enteredSandbox) diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h index d99d9436d..1c8829d2b 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h @@ -112,6 +112,7 @@ private: virtual void setLayerHostingMode(LayerHostingMode) OVERRIDE; #endif + virtual void storageBlockingStateChanged(bool); virtual void privateBrowsingStateChanged(bool); virtual bool getFormValue(String& formValue); virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity); diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm index 9cf8c887b..8dcaea96c 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm @@ -660,6 +660,10 @@ void BuiltInPDFView::setLayerHostingMode(LayerHostingMode) #endif +void BuiltInPDFView::storageBlockingStateChanged(bool) +{ +} + void BuiltInPDFView::privateBrowsingStateChanged(bool) { } diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.h b/Source/WebKit2/WebProcess/Plugins/Plugin.h index 91d234fe6..d197a6765 100644 --- a/Source/WebKit2/WebProcess/Plugins/Plugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Plugin.h @@ -29,6 +29,7 @@ #include <WebCore/GraphicsLayer.h> #include <WebCore/KURL.h> #include <WebCore/ScrollTypes.h> +#include <WebCore/SecurityOrigin.h> #include <wtf/RefCounted.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> @@ -216,6 +217,9 @@ public: // Tells the plug-in about scale factor changes. virtual void contentsScaleFactorChanged(float) = 0; + // Called when the storage blocking policy for this plug-in changes. + virtual void storageBlockingStateChanged(bool) = 0; + // Called when the private browsing state for this plug-in changes. virtual void privateBrowsingStateChanged(bool) = 0; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp index d3eb28a3b..9c30a5ef4 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -452,6 +452,11 @@ void PluginProxy::contentsScaleFactorChanged(float scaleFactor) geometryDidChange(); } +void PluginProxy::storageBlockingStateChanged(bool isStorageBlockingEnabled) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::StorageBlockingStateChanged(isStorageBlockingEnabled), m_pluginInstanceID); +} + void PluginProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEnabled) { m_connection->connection()->send(Messages::PluginControllerProxy::PrivateBrowsingStateChanged(isPrivateBrowsingEnabled), m_pluginInstanceID); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h index c3183bb2b..7a36c1afd 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h @@ -32,6 +32,7 @@ #include "Plugin.h" #include <WebCore/AffineTransform.h> #include <WebCore/IntRect.h> +#include <WebCore/SecurityOrigin.h> #if PLATFORM(MAC) #include <wtf/RetainPtr.h> @@ -111,6 +112,7 @@ private: #endif virtual void contentsScaleFactorChanged(float); + virtual void storageBlockingStateChanged(bool); virtual void privateBrowsingStateChanged(bool); virtual bool getFormValue(String& formValue); virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index 8f50d8706..fc06486fd 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -570,13 +570,21 @@ JSObject* PluginView::scriptObject(JSGlobalObject* globalObject) #endif } -void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled) +void PluginView::storageBlockingStateChanged() { // The plug-in can be null here if it failed to initialize. if (!m_isInitialized || !m_plugin) return; - if (!privateBrowsingEnabled && !frame()->document()->securityOrigin()->canAccessPluginStorage(frame()->tree()->top()->document()->securityOrigin())) + bool storageBlockingPolicy = !frame()->document()->securityOrigin()->canAccessPluginStorage(frame()->tree()->top()->document()->securityOrigin()); + + m_plugin->storageBlockingStateChanged(storageBlockingPolicy); +} + +void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled) +{ + // The plug-in can be null here if it failed to initialize. + if (!m_isInitialized || !m_plugin) return; m_plugin->privateBrowsingStateChanged(privateBrowsingEnabled); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h index d1d985363..9cc257a98 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h @@ -109,6 +109,7 @@ private: virtual PlatformLayer* platformLayer() const; #endif virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*); + virtual void storageBlockingStateChanged(); virtual void privateBrowsingStateChanged(bool); virtual bool getFormValue(String&); virtual bool scroll(WebCore::ScrollDirection, WebCore::ScrollGranularity); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 4fb65bec3..87b54f5bd 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -536,9 +536,14 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database uint64_t currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin); uint64_t currentOriginUsage = DatabaseTracker::tracker().usageForOrigin(origin); uint64_t newQuota = 0; - WebProcess::shared().connection()->sendSync( - Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()), - Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID()); + RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromDatabaseIdentifier(origin->databaseIdentifier()); + newQuota = m_page->injectedBundleUIClient().didExceedDatabaseQuota(m_page, webSecurityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()); + + if (!newQuota) { + WebProcess::shared().connection()->sendSync( + Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()), + Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID()); + } DatabaseTracker::tracker().setQuota(origin, newQuota); } diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp index 6548a25ed..b3c732819 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp @@ -261,9 +261,15 @@ void DrawingAreaImpl::setPaintingEnabled(bool paintingEnabled) void DrawingAreaImpl::updatePreferences(const WebPreferencesStore& store) { +#if PLATFORM(MAC) + // Soon we want pages with fixed positioned elements to be able to be scrolled by the ScrollingCoordinator. + // As a part of that work, we have to composite fixed position elements, and we have to allow those + // elements to create a stacking context. + m_webPage->corePage()->settings()->setAcceleratedCompositingForFixedPositionEnabled(true); + m_webPage->corePage()->settings()->setFixedPositionCreatesStackingContext(true); + // <rdar://problem/10697417>: It is necessary to force compositing when accelerate drawing // is enabled on Mac so that scrollbars are always in their own layers. -#if PLATFORM(MAC) if (m_webPage->corePage()->settings()->acceleratedDrawingEnabled()) m_webPage->corePage()->settings()->setForceCompositingMode(LayerTreeHost::supportsAcceleratedCompositing()); else diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp index fd6f4c8d2..d04f4db7f 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp @@ -651,6 +651,14 @@ bool WebFrame::containsAnyFormElements() const return false; } +void WebFrame::stopLoading() +{ + if (!m_coreFrame) + return; + + m_coreFrame->loader()->stopForUserCancel(); +} + WebFrame* WebFrame::frameForContext(JSContextRef context) { JSObjectRef globalObjectRef = JSContextGetGlobalObject(context); diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h index bd536372f..6691dce33 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h @@ -113,6 +113,7 @@ public: bool hasVerticalScrollbar() const; bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha); bool containsAnyFormElements() const; + void stopLoading(); static WebFrame* frameForContext(JSContextRef); diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm index 6c723a956..43f6440a8 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm @@ -208,6 +208,12 @@ void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore& bool scrollingPerformanceLoggingEnabled = m_webPage->scrollingPerformanceLoggingEnabled(); ScrollingThread::dispatch(bind(&ScrollingTree::setScrollingPerformanceLoggingEnabled, m_webPage->corePage()->scrollingCoordinator()->scrollingTree(), scrollingPerformanceLoggingEnabled)); + // Soon we want pages with fixed positioned elements to be able to be scrolled by the ScrollingCoordinator. + // As a part of that work, we have to composite fixed position elements, and we have to allow those + // elements to create a stacking context. + m_webPage->corePage()->settings()->setAcceleratedCompositingForFixedPositionEnabled(true); + m_webPage->corePage()->settings()->setFixedPositionCreatesStackingContext(true); + bool showDebugBorders = m_webPage->corePage()->settings()->showDebugBorders(); if (showDebugBorders == !!m_debugInfoLayer) diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index aa3bac015..8aa40371f 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -186,7 +186,6 @@ EXPORTS ?instrumentingAgentsForPage@InspectorInstrumentation@WebCore@@CAPAVInstrumentingAgents@2@PAVPage@2@@Z ?isActiveInsertionPoint@WebCore@@YA_NPBVNode@1@@Z ?isCSSExclusionsEnabled@RuntimeEnabledFeatures@WebCore@@0_NA - ?isLangAttributeAwareFormControlUIEnabled@RuntimeEnabledFeatures@WebCore@@0_NA ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z ?jsArray@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@V?$PassRefPtr@VDOMStringList@WebCore@@@WTF@@@Z ?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ @@ -223,6 +222,7 @@ EXPORTS ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z ?setFantasyFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z ?setFixedFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z + ?setImagesEnabled@Settings@WebCore@@QAEX_N@Z ?setMockScrollbarsEnabled@Settings@WebCore@@SAX_N@Z ?mockScrollbarsEnabled@Settings@WebCore@@SA_NXZ ?setPageScaleFactor@Page@WebCore@@QAEXMABVIntPoint@2@@Z @@ -236,6 +236,7 @@ EXPORTS ?setScrollOffsetFromInternals@ScrollableArea@WebCore@@QAEXABVIntPoint@2@@Z ?setSerifFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z ?setStandardFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z + ?setStorageBlockingPolicy@Settings@WebCore@@QAEXW4StorageBlockingPolicy@SecurityOrigin@2@@Z ?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z ?setEditingValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z ?settings@Document@WebCore@@QBEPAVSettings@2@XZ @@ -264,7 +265,7 @@ EXPORTS ??1ContextDestructionObserver@WebCore@@MAE@XZ ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z - ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N00@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 ?webkitDidEnterFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 3ec5b55f5..100843781 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -179,7 +179,6 @@ EXPORTS ?instrumentingAgentsForPage@InspectorInstrumentation@WebCore@@CAPAVInstrumentingAgents@2@PAVPage@2@@Z ?isActiveInsertionPoint@WebCore@@YA_NPBVNode@1@@Z ?isCSSExclusionsEnabled@RuntimeEnabledFeatures@WebCore@@0_NA - ?isLangAttributeAwareFormControlUIEnabled@RuntimeEnabledFeatures@WebCore@@0_NA ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z ?jsArray@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@V?$PassRefPtr@VDOMStringList@WebCore@@@WTF@@@Z ?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ @@ -216,6 +215,7 @@ EXPORTS ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z ?setFantasyFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z ?setFixedFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z + ?setImagesEnabled@Settings@WebCore@@QAEX_N@Z ?setMockScrollbarsEnabled@Settings@WebCore@@SAX_N@Z ?mockScrollbarsEnabled@Settings@WebCore@@SA_NXZ ?setPageScaleFactor@Page@WebCore@@QAEXMABVIntPoint@2@@Z @@ -229,6 +229,7 @@ EXPORTS ?setScrollOffsetFromInternals@ScrollableArea@WebCore@@QAEXABVIntPoint@2@@Z ?setSerifFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z ?setStandardFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z + ?setStorageBlockingPolicy@Settings@WebCore@@QAEXW4StorageBlockingPolicy@SecurityOrigin@2@@Z ?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z ?setEditingValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z ?settings@Document@WebCore@@QBEPAVSettings@2@XZ @@ -257,7 +258,7 @@ EXPORTS ??1ContextDestructionObserver@WebCore@@MAE@XZ ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z - ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N00@Z + ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z ?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z ?restrictScaleFactorToInitialScaleIfNotUserScalable@WebCore@@YAXAAUViewportAttributes@1@@Z ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@@Z diff --git a/Source/api.pri b/Source/api.pri index 6f3234541..0053268b7 100644 --- a/Source/api.pri +++ b/Source/api.pri @@ -29,7 +29,6 @@ use?(3D_GRAPHICS): WEBKIT += angle load(webkit_modules) MODULE = webkit -MODULE_PRI = ../Tools/qmake/qt_webkit.pri # This is the canonical list of dependencies for the public API of # the QtWebKit library, and will end up in the library's prl file. diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter index 7fd612be8..2af7e7607 100644 --- a/Source/autotools/symbols.filter +++ b/Source/autotools/symbols.filter @@ -145,6 +145,7 @@ _ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE; _ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb; _ZN7WebCore10ScrollView21setDelegatesScrollingEb; _ZN7WebCore4Node14removedLastRefEv; +_ZN7WebCore8Settings16setImagesEnabledEb; _ZN7WebCore8Settings18setFixedFontFamilyERKN3WTF12AtomicStringE11UScriptCode; _ZN7WebCore8Settings18setSerifFontFamilyERKN3WTF12AtomicStringE11UScriptCode; _ZN7WebCore8Settings20setCursiveFontFamilyERKN3WTF12AtomicStringE11UScriptCode; @@ -154,6 +155,7 @@ _ZN7WebCore8Settings21setStandardFontFamilyERKN3WTF12AtomicStringE11UScriptCode; _ZN7WebCore8Settings22setSansSerifFontFamilyERKN3WTF12AtomicStringE11UScriptCode; _ZN7WebCore8Settings23setPictographFontFamilyERKN3WTF12AtomicStringE11UScriptCode; _ZN7WebCore8Settings24setMockScrollbarsEnabledEb; +_ZN7WebCore8Settings24setStorageBlockingPolicyENS_14SecurityOrigin21StorageBlockingPolicyE; _ZN7WebCore8Settings37setFixedElementsLayoutRelativeToFrameEb; _ZN7WebCore9FrameView17paintControlTintsEv; _ZN7WebCore9FrameView19scrollElementToRectEPNS_7ElementERKNS_7IntRectE; @@ -164,7 +166,7 @@ _ZN7WebCore22RuntimeEnabledFeatures22isCSSExclusionsEnabledE; _ZN7WebCore22RuntimeEnabledFeatures40isLangAttributeAwareFormControlUIEnabledE; _ZN7WebCore22RuntimeEnabledFeatures22isDialogElementEnabledE; _ZN7WebCore22RuntimeEnabledFeatures37isAuthorShadowDOMForAnyElementEnabledE; -_ZNK7WebCore8Document13nodesFromRectEiijjjjbbb; +_ZNK7WebCore8Document13nodesFromRectEiijjjjbb; _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE; _ZNK7WebCore6Editor26selectionStartHasMarkerForENS_14DocumentMarker10MarkerTypeEii; _ZN7WebCore8Document33webkitDidExitFullScreenForElementEPNS_7ElementE; diff --git a/Source/cmake/OptionsBlackBerry.cmake b/Source/cmake/OptionsBlackBerry.cmake index 87c7c8b17..b4903124d 100644 --- a/Source/cmake/OptionsBlackBerry.cmake +++ b/Source/cmake/OptionsBlackBerry.cmake @@ -166,6 +166,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_STYLE_SCOPED ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIBRATION ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WORKERS ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XHR_RESPONSE_BLOB ON) diff --git a/Source/cmake/OptionsCommon.cmake b/Source/cmake/OptionsCommon.cmake index 044651e55..43a212f3e 100644 --- a/Source/cmake/OptionsCommon.cmake +++ b/Source/cmake/OptionsCommon.cmake @@ -26,6 +26,13 @@ ENDIF () SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) +STRING(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR) +IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|x86)" AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + # To avoid out of memory when building with debug option in 32bit system. + # See https://bugs.webkit.org/show_bug.cgi?id=77327 + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-keep-memory") +ENDIF () + SET(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)") SET(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Where to install libraries (lib${LIB_SUFFIX})") diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake index e0e6a0a6e..c1fb40323 100644 --- a/Source/cmake/WebKitFeatures.cmake +++ b/Source/cmake/WebKitFeatures.cmake @@ -68,6 +68,7 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_JIT "Enable JustInTime javascript support" ON) WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_NOTIFICATIONS "Toggle Legacy Desktop Notifications Support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_VIEWPORT_ADAPTION "Toogle legacy viewport adaption" OFF) + WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_VENDOR_PREFIXES "Toggle Legacy Vendor Prefix Support" ON) WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_WEBKIT_BLOB_BUILDER "Toggle Legacy WebKit Blob Builder Support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_LINK_PREFETCH "Toggle pre fetching support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_LINK_PRERENDER "Toggle pre rendering support" OFF) diff --git a/Source/cmakeconfig.h.cmake b/Source/cmakeconfig.h.cmake index a685d9450..c58792181 100644 --- a/Source/cmakeconfig.h.cmake +++ b/Source/cmakeconfig.h.cmake @@ -61,6 +61,7 @@ #cmakedefine01 ENABLE_JIT #cmakedefine01 ENABLE_LEGACY_NOTIFICATIONS #cmakedefine01 ENABLE_LEGACY_VIEWPORT_ADAPTION +#cmakedefine01 ENABLE_LEGACY_VENDOR_PREFIXES #cmakedefine01 ENABLE_LEGACY_WEBKIT_BLOB_BUILDER #cmakedefine01 ENABLE_LINK_PREFETCH #cmakedefine01 ENABLE_LINK_PRERENDER diff --git a/Tools/ChangeLog b/Tools/ChangeLog index c801c51c2..1e5b3a11d 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,471 @@ +2012-09-18 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Fix build with some versions of the gold linker + + Reviewed by Tor Arne Vestbø. + + Don't unconditionally pass --no-keep-memory to the linker, some versions might not support it. + Instead run a compile/link test first to see if it works. + + * qmake/config.tests/gnuld/gnuld.pro: Added. + * qmake/config.tests/gnuld/main.cpp: Added. + (main): + * qmake/mkspecs/features/unix/default_post.prf: + +2012-09-18 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Remove forced use of gold. + + Reviewed by Tor Arne Vestbø. + + The choice of what linker to use with WebKit should be taken by Qt's build system and ideally the same for all + modules of Qt. Then in turn it is usually up to the administrator of the machine. Recent Debian based systems + often offer the automatic use of gold through a symlink and a dpkg-diversion when installing the gold package. + + * qmake/mkspecs/features/unix/default_post.prf: + +2012-09-18 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Prospective Qt/Windows cross-compiling fix + + Reviewed by Tor Arne Vestbø. + + The win32 scope is not set when cross-compiling from Linux to Windows. + + * qmake/mkspecs/features/functions.prf: + +2012-09-18 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL] Remove background view on EWebLauncher and MiniBrowser + https://bugs.webkit.org/show_bug.cgi?id=96905 + + Reviewed by Gyuyoung Kim. + + The size of webview was changed after adding url bar. + And the background view is not necessary anymore, since it was used for debugging back in the day. + + * EWebLauncher/main.c: + (_ELauncher): + (on_ecore_evas_resize): + (browserCreate): + * MiniBrowser/efl/main.c: + (_MiniBrowser): + (on_ecore_evas_resize): + (browserCreate): + +2012-09-18 Sergio Villar Senin <svillar@igalia.com> + + [GTK] run-webkit-tests unable to find TestExpectations for WK2 + https://bugs.webkit.org/show_bug.cgi?id=96998 + + Reviewed by Philippe Normand. + + We should look for TestExpectations files in all the locations where + we currently look for Skipped files. This will allow + run-webkit-tests to look for TestExpectations files in + platform/gtk-wk2 and platform/wk2 if the "-2" flag is used. + + * Scripts/webkitpy/layout_tests/port/gtk.py: + (GtkPort.expectations_files): + +2012-09-18 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Fix build without the QtQuick module + + Reviewed by Simon Hausmann. + + * qmake/mkspecs/features/features.prf: + +2012-09-18 Stephanie Lewis <slewis@apple.com> + + Build fix after http://trac.webkit.org/projects/webkit/changeset/128852. + + Unreviewed. + + * DumpRenderTree/mac/DumpRenderTree.mm: + (poseAsClass): + +2012-09-18 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Unreviewed update of email addresses for Berlin QtWebKit office. + + * Scripts/webkitpy/common/config/committers.py: + +2012-09-17 Zan Dobersek <zandobersek@gmail.com> + + [GTK] fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html failing after r128645 + https://bugs.webkit.org/show_bug.cgi?id=96899 + + Reviewed by Martin Robinson. + + When overriding the 'WebKitDisplayImageKey' preference, use the + 'auto-load-images' property of WebKitWebSettings as the property which + should be updated with the corresponding preference value. + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (resetDefaultsToConsistentValues): + * DumpRenderTree/gtk/TestRunnerGtk.cpp: + (TestRunner::overridePreference): + +2012-09-17 Pratik Solanki <psolanki@apple.com> + + DumpRenderTree and WebKitTestRunner should compile with -Wundef on Mac + https://bugs.webkit.org/show_bug.cgi?id=96973 + + Reviewed by Dan Bernstein. + + * DumpRenderTree/mac/Configurations/Base.xcconfig: + * WebKitTestRunner/Configurations/Base.xcconfig: + * WebKitTestRunner/PlatformWebView.h: Use #ifdef __OBJC__ and not #if. + +2012-09-17 Dirk Pranke <dpranke@chromium.org> + + nrwt: remove "unexpected EOF" warnings + https://bugs.webkit.org/show_bug.cgi?id=96970 + + Reviewed by Ojan Vafai. + + After debugging this a bit, it looks like there aren't any cases + that I can reproduce where a read() of zero indicates something + actually wrong; either it is a prelude to a crash, or a false + negative. So, I'm removing these warnings and adding a comment. + + * Scripts/webkitpy/layout_tests/port/server_process.py: + (ServerProcess._wait_for_data_and_update_buffers_using_select): + +2012-09-17 Dirk Pranke <dpranke@chromium.org> + + [chromium] ASAN bot is crashing at the end of the run + https://bugs.webkit.org/show_bug.cgi?id=96967 + + Reviewed by Abhishek Arya. + + The ASAN bot is crashing attempting to decode some output into + UTF-8; there's no reason to do this, so let's not do this and + see if something else is going on as well. + + * Scripts/webkitpy/layout_tests/port/chromium.py: + (ChromiumPort._get_crash_log): + +2012-09-17 Dirk Pranke <dpranke@chromium.org> + + nrwt: --results-directory isn't getting printed properly + https://bugs.webkit.org/show_bug.cgi?id=96965 + + Reviewed by Ojan Vafai. + + options.results_directory isn't actually initialized with the + default values until after we call print_config(), so this + changes things to print the value directly. + + * Scripts/webkitpy/layout_tests/run_webkit_tests.py: + (run): + * Scripts/webkitpy/layout_tests/views/printing.py: + (Printer.print_config): + * Scripts/webkitpy/layout_tests/views/printing_unittest.py: + (Testprinter.test_print_config): + +2012-09-17 Rob Buis <rbuis@rim.com> + + [BlackBerry] Enable VIDEO_TRACK + https://bugs.webkit.org/show_bug.cgi?id=96949 + + Reviewed by Antonio Gomes. + + * Scripts/webkitperl/FeatureList.pm: + +2012-09-17 Rick Byers <rbyers@chromium.org> + + Add handling of new GestureTapCancel in DRT + + https://bugs.webkit.org/show_bug.cgi?id=96183 + + Reviewed by Antonio Gomes. + + * DumpRenderTree/chromium/TestWebPlugin.cpp: + (TestWebPlugin::handleInputEvent): + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::gestureTapCancel): + +2012-09-17 Philip Rogers <pdr@google.com> + + Teach style checker about preprocessor directive indentation rules + https://bugs.webkit.org/show_bug.cgi?id=96874 + + Reviewed by Adam Barth. + + Preprocessor directives (#ifdef, #include, #define, etc.) should not be indented. + This is not explicit in our style guide but is generally followed in our code. + Searching for violations in our codebase shows these are rarely indented: + #include - indented in 6 files + #ifdef - indented in 0 files + #ifndef - indented in 1 file + #define - indented in 11 files + #if - indented in 7 files + + * Scripts/webkitpy/style/checkers/cpp.py: + (check_directive_indentation): + + This is the simple test where we look for spaces followed by a #. + + (check_style): + * Scripts/webkitpy/style/checkers/cpp_unittest.py: + + A few tests needed to be modified because they had unintentionally indented + preprocessor directives. + + (CppStyleTest.test_build_class.Foo): + (CppStyleTest.test_build_class): + (CppStyleTest.test_build_class.DERIVE_FROM_GOO): + (WebKitStyleTest.test_line_breaking): + (WebKitStyleTest.test_directive_indentation): + +2012-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Auto-generate the module pri file for QtWebKit + + Reviewed by Simon Hausmann. + + * qmake/qt_webkit.pri: Removed. + +2012-09-14 Dirk Pranke <dpranke@chromium.org> + + nrwt: --additional-platform-dir is broken on chromium ports + https://bugs.webkit.org/show_bug.cgi?id=96840 + + Reviewed by Ojan Vafai. + + Looks like I broke this when cleaning things up as part of + adding ML support. Fixing and adding a test. + + * Scripts/webkitpy/layout_tests/port/chromium.py: + (ChromiumPort.default_baseline_search_path): + * Scripts/webkitpy/layout_tests/port/chromium_android.py: + (ChromiumAndroidPort.default_baseline_search_path): + * Scripts/webkitpy/layout_tests/port/chromium_linux.py: + (ChromiumLinuxPort.default_baseline_search_path): + * Scripts/webkitpy/layout_tests/port/chromium_mac.py: + (ChromiumMacPort.__init__): + * Scripts/webkitpy/layout_tests/port/chromium_win.py: + (ChromiumWinPort.setup_environ_for_server): + * Scripts/webkitpy/layout_tests/port/port_testcase.py: + (test_check_build): + (test_additional_platform_directory): + +2012-09-13 Stephanie Lewis <slewis@apple.com> + + mac-future ignores previous platform TestExpectations. + https://bugs.webkit.org/show_bug.cgi?id=96718. + + Reviewed by Dirk Pranke. + + TestExpectations match an expectation's configuraton against a list of configurations that are + valid for that port. That list does not contain mac-future so none of the expectations can be + applied. + + * Scripts/webkitpy/layout_tests/port/apple.py: + (ApplePort._generate_all_test_configurations): + +2012-09-14 Adam Barth <abarth@webkit.org> + + Remove webkitPostMessage + https://bugs.webkit.org/show_bug.cgi?id=96577 + + Reviewed by Ojan Vafai. + + Add ENABLE_LEGACY_VENDOR_PREFIXES flag. + + * Scripts/webkitperl/FeatureList.pm: + * qmake/mkspecs/features/features.pri: + +2012-09-14 Alexey Proskuryakov <ap@apple.com> + + [WK2] webarchive/loading/javascript-url-iframe-crash.html fails + https://bugs.webkit.org/show_bug.cgi?id=96817 + + Reviewed by Kenneth Rohde Christiansen. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame): This callback + got overlooked when adding logging elsewhere. + +2012-09-14 Peter Beverloo <peter@chromium.org> + + [Chromium] Build fix for DumpRenderTree following r128628 + https://bugs.webkit.org/show_bug.cgi?id=96808 + + Reviewed by Tony Chang. + + When building DumpRenderTree from the Chromium project, a compile error + shows up because including the header ForwardIOStreamsAndroid.h cannot + be located. TestWebKitAPI does this correctly. + + * DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp: + +2012-09-14 Dana Jansens <danakj@chromium.org> + + Change cc-bugs@google.com watchlist to cc-bugs@chromium.org + https://bugs.webkit.org/show_bug.cgi?id=96805 + + Reviewed by Dirk Pranke. + + * Scripts/webkitpy/common/config/committers.py: + * Scripts/webkitpy/common/config/watchlist: + +2012-09-14 Peter Beverloo <peter@chromium.org> + + [Chromium] Support the --{in,out,err}-fifo arguments on TestWebKitAPI and webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=96687 + + Reviewed by Tony Chang. + + Android's DumpRenderTree currently supports these arguments, implemented + as part of TestShellAndroid: + http://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp?rev=128496 + + They're used by the layout test runner to get the STDOUT and STDERR while + a layout test run is in process, which is a safer alternative to parsing + all the logcat output manually. The implementation can be seen here: + http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py?rev=128496#L590 + + This patch generalizes parsing of and applying the effects of these arguments + so that they can be used for TestWebKitAPI and webkit_unit_tests as well. + After this patch, this will make it possible to pull out the output-reading + code from Android's layout test port and generalize it so it can be re-used + in the new test-runner for the other two test suites. + + This has no effect when compiling and running these tests as part of Chromium + code, which has a much more advanced test-runner that does parse complete log + output, but also directly depends on code licensed under Apache 2. + + * DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp: + * DumpRenderTree/chromium/TestShellAndroid.cpp: + (platformInit): + * TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp: + +2012-09-14 Zoltan Horvath <zoltan@webkit.org> + + check-webkit-style should not warn in case of NONCOPYABLE and FAST_ALLOCATED macros + https://bugs.webkit.org/show_bug.cgi?id=96656 + + Reviewed by Adam Barth. + + We should allow to use WTF_MAKE_NONCOPYABLE(ClassName) and WTF_MAKE_FAST_ALLOCATED + macros in 1 line. + + * Scripts/webkitpy/style/checkers/cpp.py: + (check_style.definitions): + (check_style): Add rule. + * Scripts/webkitpy/style/checkers/cpp_unittest.py: + (WebKitStyleTest.test_line_breaking): Add unittest. + +2012-09-14 Christophe Dumez <christophe.dumez@intel.com> + + WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks + https://bugs.webkit.org/show_bug.cgi?id=57570 + + Reviewed by Kenneth Rohde Christiansen. + + Implement testRunner.dumpDatabaseCallbacks in WebKitTestRunner + and dump the information expected by the test cases. + + * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::beginTesting): Explicitly set the default + database quota. + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::securityOriginToStr): New convenience function to convert + a security origin to the string expected in test results. + (WTR): + (WTR::InjectedBundlePage::InjectedBundlePage): + (WTR::InjectedBundlePage::didExceedDatabaseQuota): + (WTR::InjectedBundlePage::didReachApplicationCacheOriginQuota): Minor + refactoring to share code with didExceedDatabaseQuota. + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: + (InjectedBundlePage): + * WebKitTestRunner/InjectedBundle/TestRunner.cpp: + (WTR::TestRunner::TestRunner): + * WebKitTestRunner/InjectedBundle/TestRunner.h: + (WTR::TestRunner::dumpDatabaseCallbacks): + (WTR::TestRunner::shouldDumpDatabaseCallbacks): + (TestRunner): + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Set force_static_libs_as_shared early enough to be caught by configure + + Rubber-stamped by Simon Hausmann. + + * qmake/mkspecs/features/default_post.prf: + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Remove old cruft from the qmake build system + + Rubber-stamped by Simon Hausmann. + + * DumpRenderTree/qt/DumpRenderTree.pro: + * qmake/mkspecs/features/default_post.prf: + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Enable force_static_libs_as_shared for development + + Not enabled for buildbots or production-builds (part of Qt5) + + Reviewed by Simon Hausmann. + + * qmake/mkspecs/features/default_post.prf: + +2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Make force_static_libs_as_shared work on Mac OS + + We had to move a few LIBS += around that were in the wrong place, + and not caught when everything was just linked into the final + QtWebKit library. + + Reviewed by Simon Hausmann. + + * qmake/mkspecs/features/default_post.prf: + * qmake/mkspecs/features/force_static_libs_as_shared.prf: + +2012-09-14 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Fix build of WTR on Windows + + Reviewed by Tor Arne Vestbø. + + WTR/qt/main.cpp includes TestController.h, which lives in just WTR/ + With qmake's unix makefile generator as well as with the MingW generator, + the directory where the pro file lives (WTR/) is automatically added to + the include search path, but not so with MSVC. Instead of relying on qmake's + implicit feature here, add WTR/ explicitly to the include search path. + + * WebKitTestRunner/Target.pri: + +2012-09-14 Christophe Dumez <christophe.dumez@intel.com> + + WebKitTestRunner needs layoutTestController.setStopProvisionalFrameLoads + https://bugs.webkit.org/show_bug.cgi?id=42691 + + Reviewed by Kenneth Rohde Christiansen. + + Add implementation for testrunner.setStopProvisionalFrameLoads() + in WebKitTestRunner. + + Original patch by Alexey Proskuryakov. + + * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame): + * WebKitTestRunner/InjectedBundle/TestRunner.cpp: + (WTR::TestRunner::TestRunner): + * WebKitTestRunner/InjectedBundle/TestRunner.h: + (TestRunner): + (WTR::TestRunner::setStopProvisionalFrameLoads): + (WTR::TestRunner::shouldStopProvisionalFrameLoads): + 2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> [Qt] Fix handling of debug/release/debug_and_release/build_all diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp index 8e3347ca8..131d40f02 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp @@ -285,12 +285,21 @@ '<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code', '<(chromium_src_dir)/tools/android/forwarder/forwarder.gyp:forwarder', '<(chromium_src_dir)/tools/android/md5sum/md5sum.gyp:md5sum', + '<(source_dir)/WebKit/chromium/WebKitUnitTests.gyp:io_stream_forwarder_android', ], 'dependencies!': [ 'ImageDiff', 'copy_TestNetscapePlugIn', '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa', ], + # FIXME: Remove when the io_stream_forwarder_android target is deprecated. + 'conditions': [ + ['inside_chromium_build==1', { + 'include_dirs': [ + '<(source_dir)/WebKit/chromium/', + ], + }], + ], 'copies': [{ 'destination': '<(PRODUCT_DIR)', 'files': [ diff --git a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp index d5eaac4ad..236012865 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp @@ -287,6 +287,7 @@ EventSender::EventSender() bindMethod("gestureScrollUpdate", &EventSender::gestureScrollUpdate); bindMethod("gestureTap", &EventSender::gestureTap); bindMethod("gestureTapDown", &EventSender::gestureTapDown); + bindMethod("gestureTapCancel", &EventSender::gestureTapCancel); bindMethod("gestureLongPress", &EventSender::gestureLongPress); bindMethod("gestureTwoFingerTap", &EventSender::gestureTwoFingerTap); bindMethod("zoomPageIn", &EventSender::zoomPageIn); @@ -1119,6 +1120,12 @@ void EventSender::gestureTapDown(const CppArgumentList& arguments, CppVariant* r gestureEvent(WebInputEvent::GestureTapDown, arguments); } +void EventSender::gestureTapCancel(const CppArgumentList& arguments, CppVariant* result) +{ + result->setNull(); + gestureEvent(WebInputEvent::GestureTapCancel, arguments); +} + void EventSender::gestureLongPress(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); @@ -1182,6 +1189,10 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList& event.x = point.x; event.y = point.y; break; + case WebInputEvent::GestureTapCancel: + event.x = point.x; + event.y = point.y; + break; case WebInputEvent::GestureLongPress: event.x = point.x; event.y = point.y; diff --git a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h index 828e7c842..e6794a077 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/EventSender.h @@ -106,6 +106,7 @@ public: void gestureScrollUpdate(const CppArgumentList&, CppVariant*); void gestureTap(const CppArgumentList&, CppVariant*); void gestureTapDown(const CppArgumentList&, CppVariant*); + void gestureTapCancel(const CppArgumentList&, CppVariant*); void gestureLongPress(const CppArgumentList&, CppVariant*); void gestureTwoFingerTap(const CppArgumentList&, CppVariant*); void gestureEvent(WebKit::WebInputEvent::Type, const CppArgumentList&); diff --git a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp b/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp index 188158440..8f8eedc3d 100644 --- a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp +++ b/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp @@ -32,15 +32,8 @@ #include "TestShell.h" #include "linux/WebFontRendering.h" +#include "tests/ForwardIOStreamsAndroid.h" #include "third_party/skia/include/ports/SkTypeface_android.h" -#include <android/log.h> -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> -#include <wtf/Assertions.h> namespace { @@ -51,46 +44,6 @@ const char fontMainConfigFile[] = DEVICE_DRT_DIR "android_main_fonts.xml"; const char fontFallbackConfigFile[] = DEVICE_DRT_DIR "android_fallback_fonts.xml"; const char fontsDir[] = DEVICE_DRT_DIR "fonts/"; -const char optionInFIFO[] = "--in-fifo="; -const char optionOutFIFO[] = "--out-fifo="; -const char optionErrFIFO[] = "--err-fifo="; - -void androidLogError(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); - -void androidLogError(const char* format, ...) -{ - va_list args; - va_start(args, format); - __android_log_vprint(ANDROID_LOG_ERROR, "DumpRenderTree", format, args); - va_end(args); -} - -void removeArg(int index, int* argc, char*** argv) -{ - for (int i = index; i < *argc; ++i) - (*argv)[i] = (*argv)[i + 1]; - --*argc; -} - -void createFIFO(const char* fifoPath) -{ - unlink(fifoPath); - // 0666 is rw-rw-rw-, to allow adb shell to read/write the fifo. - // Explicitly call chmod to ensure the mode is set despite umask. - if (mkfifo(fifoPath, 0666) || chmod(fifoPath, 0666)) { - androidLogError("Failed to create fifo %s: %s\n", fifoPath, strerror(errno)); - exit(EXIT_FAILURE); - } -} - -void redirect(FILE* stream, const char* path, const char* mode) -{ - if (!freopen(path, mode, stream)) { - androidLogError("Failed to redirect stream to file: %s: %s\n", path, strerror(errno)); - exit(EXIT_FAILURE); - } -} - } // namespace void platformInit(int* argc, char*** argv) @@ -98,38 +51,8 @@ void platformInit(int* argc, char*** argv) // Initialize skia with customized font config files. SkUseTestFontConfigFile(fontMainConfigFile, fontFallbackConfigFile, fontsDir); - const char* inFIFO = 0; - const char* outFIFO = 0; - const char* errFIFO = 0; - for (int i = 1; i < *argc; ) { - const char* argument = (*argv)[i]; - if (strstr(argument, optionInFIFO) == argument) { - inFIFO = argument + WTF_ARRAY_LENGTH(optionInFIFO) - 1; - createFIFO(inFIFO); - removeArg(i, argc, argv); - } else if (strstr(argument, optionOutFIFO) == argument) { - outFIFO = argument + WTF_ARRAY_LENGTH(optionOutFIFO) - 1; - createFIFO(outFIFO); - removeArg(i, argc, argv); - } else if (strstr(argument, optionErrFIFO) == argument) { - errFIFO = argument + WTF_ARRAY_LENGTH(optionErrFIFO) - 1; - createFIFO(errFIFO); - removeArg(i, argc, argv); - } else - ++i; - } - - // The order of createFIFO() and redirectToFIFO() is important to avoid deadlock. - if (outFIFO) - redirect(stdout, outFIFO, "w"); - if (inFIFO) - redirect(stdin, inFIFO, "r"); - if (errFIFO) - redirect(stderr, errFIFO, "w"); - else { - // Redirect stderr to stdout. - dup2(1, 2); - } + // Set up IO stream forwarding if necessary. + WebKit::maybeInitIOStreamForwardingForAndroid(argc, argv); // Disable auto hint and use normal hinting in layout test mode to produce the same font metrics as chromium-linux. WebKit::WebFontRendering::setAutoHint(false); diff --git a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp b/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp index 34d2cc8c0..0929cadf6 100644 --- a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp @@ -776,6 +776,8 @@ void TestRunner::overridePreference(JSStringRef key, JSStringRef value) propertyName = "enable-webgl"; else if (g_str_equal(originalName.get(), "WebKitWebAudioEnabled")) propertyName = "enable-webaudio"; + else if (g_str_equal(originalName.get(), "WebKitDisplayImagesKey")) + propertyName = "auto-load-images"; else if (g_str_equal(originalName.get(), "WebKitTabToLinksPreferenceKey")) { DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(booleanFromValue(valueAsString.get())); return; diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig index b6fe75a3f..140714eac 100644 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -37,7 +37,7 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO GCC_WARN_UNUSED_FUNCTION = YES GCC_WARN_UNUSED_VARIABLE = YES -WARNING_CFLAGS = -Wall -W -Wno-unused-parameter +WARNING_CFLAGS = -Wall -W -Wno-unused-parameter -Wundef LINKER_DISPLAYS_MANGLED_NAMES = YES; CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index baa54ed18..ee82454b5 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -153,7 +153,7 @@ static RetainPtr<CFStringRef> persistentUserStyleSheetLocation; static WebHistoryItem *prevTestBFItem = nil; // current b/f item at the end of the previous test -#if __OBJC2__ +#ifdef __OBJC2__ static void swizzleAllMethods(Class imposter, Class original) { unsigned int imposterMethodCount; @@ -192,7 +192,7 @@ static void poseAsClass(const char* imposter, const char* original) Class imposterClass = objc_getClass(imposter); Class originalClass = objc_getClass(original); -#if !__OBJC2__ +#ifndef __OBJC2__ class_poseAs(imposterClass, originalClass); #else diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro index dd3a22275..baf025aed 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro @@ -9,8 +9,7 @@ TEMPLATE = app TARGET = DumpRenderTree DESTDIR = $$ROOT_BUILD_DIR/bin -WEBKIT += wtf webcore -!v8: WEBKIT += javascriptcore +WEBKIT += wtf javascriptcore webcore INCLUDEPATH += \ $$PWD/ \ diff --git a/Tools/EWebLauncher/main.c b/Tools/EWebLauncher/main.c index 8e6ae0027..dd392e4e1 100644 --- a/Tools/EWebLauncher/main.c +++ b/Tools/EWebLauncher/main.c @@ -155,7 +155,6 @@ typedef struct _User_Arguments { typedef struct _ELauncher { Ecore_Evas *ee; Evas *evas; - Evas_Object *bg; Evas_Object *browser; Url_Bar *url_bar; User_Arguments *userArgs; @@ -242,7 +241,6 @@ on_ecore_evas_resize(Ecore_Evas *ee) { ELauncher *app; Evas_Object *webview; - Evas_Object *bg; int w, h; ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); @@ -251,10 +249,6 @@ on_ecore_evas_resize(Ecore_Evas *ee) app = find_app_from_ee(ee); url_bar_width_set(app->url_bar, w); - bg = evas_object_name_find(ecore_evas_get(ee), "bg"); - evas_object_move(bg, 0, 0); - evas_object_resize(bg, w, h); - webview = evas_object_name_find(ecore_evas_get(ee), "browser"); evas_object_move(webview, 0, URL_BAR_HEIGHT); evas_object_resize(webview, w, h - URL_BAR_HEIGHT); @@ -691,14 +685,6 @@ browserCreate(const char *url, User_Arguments *userArgs) if (!app->evas) return quit(EINA_FALSE, "ERROR: could not get evas from evas-ecore\n"); - app->bg = evas_object_rectangle_add(app->evas); - evas_object_name_set(app->bg, "bg"); - evas_object_color_set(app->bg, 255, 0, 255, 255); - evas_object_move(app->bg, 0, 0); - evas_object_resize(app->bg, geometry.w, geometry.h); - evas_object_layer_set(app->bg, EVAS_LAYER_MIN); - evas_object_show(app->bg); - if (userArgs->backingStore && !strcasecmp(userArgs->backingStore, "tiled")) { app->browser = ewk_view_tiled_add(app->evas); info("backing store: tiled\n"); diff --git a/Tools/MiniBrowser/efl/main.c b/Tools/MiniBrowser/efl/main.c index e3c1929d5..b44e514a1 100644 --- a/Tools/MiniBrowser/efl/main.c +++ b/Tools/MiniBrowser/efl/main.c @@ -41,7 +41,6 @@ static int verbose = 0; typedef struct _MiniBrowser { Ecore_Evas *ee; Evas *evas; - Evas_Object *bg; Evas_Object *browser; Url_Bar *url_bar; } MiniBrowser; @@ -85,7 +84,6 @@ static void closeWindow(Ecore_Evas *ee) static void on_ecore_evas_resize(Ecore_Evas *ee) { Evas_Object *webview; - Evas_Object *bg; int w, h; ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); @@ -93,10 +91,6 @@ static void on_ecore_evas_resize(Ecore_Evas *ee) /* Resize URL bar */ url_bar_width_set(browser->url_bar, w); - bg = evas_object_name_find(ecore_evas_get(ee), "bg"); - evas_object_move(bg, 0, 0); - evas_object_resize(bg, w, h); - webview = evas_object_name_find(ecore_evas_get(ee), "browser"); evas_object_move(webview, 0, URL_BAR_HEIGHT); evas_object_resize(webview, w, h - URL_BAR_HEIGHT); @@ -233,15 +227,6 @@ static MiniBrowser *browserCreate(const char *url, const char *engine) app->evas = ecore_evas_get(app->ee); - app->bg = evas_object_rectangle_add(app->evas); - evas_object_name_set(app->bg, "bg"); - evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - evas_object_move(app->bg, 0, 0); - evas_object_resize(app->bg, DEFAULT_WIDTH, DEFAULT_HEIGHT); - evas_object_color_set(app->bg, 255, 150, 150, 255); - evas_object_show(app->bg); - /* Create webview */ app->browser = ewk_view_add(app->evas); ewk_view_theme_set(app->browser, THEME_DIR"/default.edj"); diff --git a/Tools/Scripts/webkitperl/FeatureList.pm b/Tools/Scripts/webkitperl/FeatureList.pm index ad2304679..102b91ffe 100644 --- a/Tools/Scripts/webkitperl/FeatureList.pm +++ b/Tools/Scripts/webkitperl/FeatureList.pm @@ -90,6 +90,7 @@ my ( $inspectorSupport, $javascriptDebuggerSupport, $legacyNotificationsSupport, + $legacyVendorPrefixSupport, $legacyWebKitBlobBuilderSupport, $linkPrefetchSupport, $linkPrerenderSupport, @@ -281,6 +282,9 @@ my @features = ( { option => "legacy-notifications", desc => "Toggle Legacy Notifications support", define => "ENABLE_LEGACY_NOTIFICATIONS", default => isBlackBerry(), value => \$legacyNotificationsSupport }, + { option => "legacy-vendor-prefixes", desc => "Toggle Legacy Vendor Prefix support", + define => "ENABLE_LEGACY_VENDOR_PREFIXES", default => !isChromium(), value => \$legacyVendorPrefixSupport }, + { option => "legacy-webkit-blob-builder", desc => "Toggle Legacy WebKit Blob Builder support", define => "ENABLE_LEGACY_WEBKIT_BLOB_BUILDER", default => (isGtk() || isChromium() || isBlackBerry() || isEfl()), value => \$legacyWebKitBlobBuilderSupport }, @@ -393,7 +397,7 @@ my @features = ( define => "ENABLE_VIDEO", default => (isAppleWebKit() || isGtk() || isBlackBerry() || isEfl()), value => \$videoSupport }, { option => "video-track", desc => "Toggle Video Track support", - define => "ENABLE_VIDEO_TRACK", default => (isAppleWebKit() || isGtk() || isEfl()), value => \$videoTrackSupport }, + define => "ENABLE_VIDEO_TRACK", default => (isAppleWebKit() || isGtk() || isEfl() || isBlackBerry()), value => \$videoTrackSupport }, { option => "webgl", desc => "Toggle WebGL support", define => "ENABLE_WEBGL", default => (isAppleMacWebKit() || isGtk()), value => \$webglSupport }, diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py index bda102e11..1030de694 100644 --- a/Tools/Scripts/webkitpy/common/config/committers.py +++ b/Tools/Scripts/webkitpy/common/config/committers.py @@ -93,7 +93,7 @@ class Reviewer(Committer): watchers_who_are_not_contributors = [ - Account("Chromium Compositor Bugs", ["cc-bugs@google.com"], ""), + Account("Chromium Compositor Bugs", ["cc-bugs@chromium.org"], ""), Account("Chromium Media Reviews", ["feature-media-reviews@chromium.org"], ""), Account("David Levin", ["levin+threading@chromium.org"], ""), Account("David Levin", ["levin+watchlist@chromium.org"], ""), @@ -189,7 +189,7 @@ committers_unable_to_review = [ Committer("Alexandre Elias", ["aelias@chromium.org", "aelias@google.com"], "aelias"), Committer("Alexandru Chiculita", "achicu@adobe.com", "achicu"), Committer("Alice Boxhall", "aboxhall@chromium.org", "aboxhall"), - Committer("Allan Sandfeld Jensen", ["allan.jensen@nokia.com", "kde@carewolf.com", "sandfeld@kde.org"], "carewolf"), + Committer("Allan Sandfeld Jensen", ["allan.jensen@digia.com", "kde@carewolf.com", "sandfeld@kde.org", "allan.jensen@nokia.com"], "carewolf"), Committer("Alok Priyadarshi", "alokp@chromium.org", "alokp"), Committer("Ami Fischman", ["fischman@chromium.org", "fischman@google.com"], "fischman"), Committer("Amruth Raj", "amruthraj@motorola.com", "amruthraj"), @@ -330,7 +330,7 @@ committers_unable_to_review = [ Committer("Matt Perry", "mpcomplete@chromium.org"), Committer("Maxime Britto", ["maxime.britto@gmail.com", "britto@apple.com"]), Committer("Maxime Simon", ["simon.maxime@gmail.com", "maxime.simon@webkit.org"], "maxime.simon"), - Committer(u"Michael Br\u00fcning", ["michaelbruening@gmail.com", "michael.bruning@nokia.com"], "mibrunin"), + Committer(u"Michael Br\u00fcning", ["michaelbruening@gmail.com", "michael.bruning@digia.com", "michael.bruning@nokia.com"], "mibrunin"), Committer("Michael Nordman", "michaeln@google.com", "michaeln"), Committer("Michelangelo De Simone", "michelangelo@webkit.org", "michelangelo"), Committer("Mihnea Ovidenie", "mihnea@adobe.com", "mihnea"), @@ -479,7 +479,7 @@ reviewers_list = [ Reviewer("Jeremy Orlow", ["jorlow@webkit.org", "jorlow@chromium.org"], "jorlow"), Reviewer("Jessie Berlin", ["jberlin@webkit.org", "jberlin@apple.com"], "jessieberlin"), Reviewer("Jian Li", "jianli@chromium.org", "jianli"), - Reviewer("Jocelyn Turcotte", "jocelyn.turcotte@nokia.com", "jturcotte"), + Reviewer("Jocelyn Turcotte", ["jocelyn.turcotte@digia.com", "jocelyn.turcotte@nokia.com"], "jturcotte"), Reviewer("Jochen Eisinger", "jochen@chromium.org", "jochen__"), Reviewer("John Sullivan", "sullivan@apple.com", "sullivan"), Reviewer("Jon Honeycutt", "jhoneycutt@apple.com", "jhoneycutt"), diff --git a/Tools/Scripts/webkitpy/common/config/watchlist b/Tools/Scripts/webkitpy/common/config/watchlist index 4029fe8d5..2ab16b0c2 100755 --- a/Tools/Scripts/webkitpy/common/config/watchlist +++ b/Tools/Scripts/webkitpy/common/config/watchlist @@ -246,7 +246,7 @@ "BlackBerry": [ "mifenton@rim.com", "rwlbuis@gmail.com" ], "CMake": [ "rakuco@webkit.org", "gyuyoung.kim@samsung.com" ], "CSS": [ "alexis@webkit.org", "macpherson@chromium.org", "cmarcelo@webkit.org" ], - "ChromiumGraphics": [ "jamesr@chromium.org", "cc-bugs@google.com" ], + "ChromiumGraphics": [ "jamesr@chromium.org", "cc-bugs@chromium.org" ], "ChromiumPublicApi": [ "abarth@webkit.org", "dglazkov@chromium.org", "fishd@chromium.org", "jamesr@chromium.org", "tkent+wkapi@chromium.org" ], "DOMAttributes": [ "cmarcelo@webkit.org", ], "EFL": [ "rakuco@webkit.org", "gyuyoung.kim@samsung.com" ], diff --git a/Tools/Scripts/webkitpy/layout_tests/port/apple.py b/Tools/Scripts/webkitpy/layout_tests/port/apple.py index d8e16494b..055419a14 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/apple.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/apple.py @@ -92,7 +92,8 @@ class ApplePort(Port): def _generate_all_test_configurations(self): configurations = [] - for port_name in self.VERSION_FALLBACK_ORDER: + allowed_port_names = self.VERSION_FALLBACK_ORDER + [self.operating_system() + "-future"] + for port_name in allowed_port_names: for build_type in self.ALL_BUILD_TYPES: for architecture in self.ARCHITECTURES: configurations.append(TestConfiguration(version=self._strip_port_name_prefix(port_name), architecture=architecture, build_type=build_type)) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py index feecfbdff..44c98a383 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -114,6 +114,9 @@ class ChromiumPort(Port): def default_pixel_tests(self): return True + def default_baseline_search_path(self): + return map(self._webkit_baseline_path, self.FALLBACK_PATHS[self.version()]) + def default_timeout_ms(self): if self.get_option('configuration') == 'Debug': return 12 * 1000 @@ -351,8 +354,8 @@ class ChromiumPort(Port): if stderr and 'AddressSanitizer' in stderr: asan_filter_path = self.path_from_chromium_base('tools', 'valgrind', 'asan', 'asan_symbolize.py') if self._filesystem.exists(asan_filter_path): - output = self._executive.run_command([asan_filter_path], input=stderr) - stderr = self._executive.run_command(['c++filt'], input=output) + output = self._executive.run_command([asan_filter_path], input=stderr, decode_output=False) + stderr = self._executive.run_command(['c++filt'], input=output, decode_output=False) return super(ChromiumPort, self)._get_crash_log(name, pid, stdout, stderr, newer_than) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py index 4ce18efdd..fcccec15a 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py @@ -187,7 +187,7 @@ class ChromiumAndroidPort(chromium.ChromiumPort): def default_child_processes(self): return len(self._get_devices()) - def baseline_search_path(self): + def default_baseline_search_path(self): return map(self._webkit_baseline_path, self.FALLBACK_PATHS) def check_wdiff(self, logging=True): diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py index d5c2235bf..fa8c274ea 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py @@ -106,7 +106,7 @@ class ChromiumLinuxPort(chromium.ChromiumPort): self._version = 'lucid' # We only support lucid right now. self._architecture = arch - def baseline_search_path(self): + def default_baseline_search_path(self): port_names = self.FALLBACK_PATHS[self._architecture] return map(self._webkit_baseline_path, port_names) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py index 554feca23..db82d5c79 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py @@ -79,10 +79,6 @@ class ChromiumMacPort(chromium.ChromiumPort): self._version = port_name[port_name.index('chromium-mac-') + len('chromium-mac-'):] assert self._version in self.SUPPORTED_OS_VERSIONS - def baseline_search_path(self): - fallback_paths = self.FALLBACK_PATHS - return map(self._webkit_baseline_path, fallback_paths[self._version]) - def _modules_to_search_for_symbols(self): return [self._build_path('ffmpegsumo.so')] diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py index 7d0337acc..1168e407c 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py @@ -99,10 +99,6 @@ class ChromiumWinPort(chromium.ChromiumPort): self._executive.run_command([setup_mount]) # Paths are all absolute, so this does not require a cwd. return env - def baseline_search_path(self): - port_names = self.FALLBACK_PATHS[self.version()] - return map(self._webkit_baseline_path, port_names) - def _modules_to_search_for_symbols(self): # FIXME: we should return the path to the ffmpeg equivalents to detect if we have the mp3 and aac codecs installed. # See https://bugs.webkit.org/show_bug.cgi?id=89706. diff --git a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py b/Tools/Scripts/webkitpy/layout_tests/port/gtk.py index 3cc0ea566..f02d14819 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/gtk.py @@ -38,6 +38,9 @@ from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver class GtkPort(Port, PulseAudioSanitizer): port_name = "gtk" + def expectations_files(self): + return [self._filesystem.join(self._webkit_baseline_path(d), 'TestExpectations') for d in self._skipped_file_search_paths()] + def _port_flag_for_scripts(self): return "--gtk" diff --git a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py index e12b68773..1f75c799a 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py @@ -609,3 +609,7 @@ class PortTestCase(unittest.TestCase): port._build_driver = build_driver_called port.check_build(False) self.assertFalse(self.build_called, None) + + def test_additional_platform_directory(self): + port = self.make_port(options=MockOptions(additional_platform_directory=['/tmp/foo'])) + self.assertEquals(port.baseline_search_path()[0], '/tmp/foo') diff --git a/Tools/Scripts/webkitpy/layout_tests/port/server_process.py b/Tools/Scripts/webkitpy/layout_tests/port/server_process.py index 1cf173975..bfa6aab80 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/server_process.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/server_process.py @@ -228,24 +228,21 @@ class ServerProcess(object): raise try: + # Note that we may get no data during read() even though + # select says we got something; see the select() man page + # on linux. I don't know if this happens on Mac OS and + # other Unixen as well, but we don't bother special-casing + # Linux because it's relatively harmless either way. if out_fd in read_fds: data = self._proc.stdout.read() - if not data and not stopping: - if self._treat_no_data_as_crash or self._proc.poll() is not None: - _log.warning('unexpected EOF of stdout, %s crashed' % self._name) - self._crashed = True - else: - _log.warning('unexpected EOF of stdout, %s is still alive' % self._name) + if not data and not stopping and (self._treat_no_data_as_crash or self._proc.poll()): + self._crashed = True self._output += data if err_fd in read_fds: data = self._proc.stderr.read() - if not data and not stopping: - if self._treat_no_data_as_crash or self._proc.poll() is not None: - _log.warning('unexpected EOF on stderr, %s crashed' % self._name) - self._crashed = True - else: - _log.warning('unexpected EOF on stderr, %s is still alive' % self._name) + if not data and not stopping and (self._treat_no_data_as_crash or self._proc.poll()): + self._crashed = True self._error += data except IOError, e: # We can ignore the IOErrors because we will detect if the subporcess crashed diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index ddb0105c2..a79ab3ce3 100755 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py @@ -105,7 +105,7 @@ def run(port, options, args, regular_output=sys.stderr, buildbot_output=sys.stdo unexpected_result_count = -1 manager = Manager(port, options, printer) - printer.print_config() + printer.print_config(port.results_directory()) unexpected_result_count = manager.run(args) _log.debug("Testing completed, Exit status: %d" % unexpected_result_count) diff --git a/Tools/Scripts/webkitpy/layout_tests/views/printing.py b/Tools/Scripts/webkitpy/layout_tests/views/printing.py index bf0b79ee0..22a55ed2f 100644 --- a/Tools/Scripts/webkitpy/layout_tests/views/printing.py +++ b/Tools/Scripts/webkitpy/layout_tests/views/printing.py @@ -83,10 +83,10 @@ class Printer(object): def __del__(self): self.cleanup() - def print_config(self): + def print_config(self, results_directory): self._print_default("Using port '%s'" % self._port.name()) self._print_default("Test configuration: %s" % self._port.test_configuration()) - self._print_default("Placing test results in %s" % self._options.results_directory) + self._print_default("Placing test results in %s" % results_directory) # FIXME: should these options be in printing_options? if self._options.new_baseline: diff --git a/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py b/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py index fa2af46c3..bc30092f4 100644 --- a/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py @@ -114,17 +114,23 @@ class Testprinter(unittest.TestCase): def test_print_config(self): printer, err, out = self.get_printer() # FIXME: it's lame that i have to set these options directly. - printer._options.results_directory = '/tmp' printer._options.pixel_tests = True printer._options.new_baseline = True printer._options.time_out_ms = 6000 printer._options.slow_time_out_ms = 12000 - printer.print_config() + printer.print_config('/tmp') + self.assertTrue("Using port 'test-mac-leopard'" in err.getvalue()) + self.assertTrue('Test configuration: <leopard, x86, release>' in err.getvalue()) + self.assertTrue('Placing test results in /tmp' in err.getvalue()) self.assertTrue('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic' in err.getvalue()) + self.assertTrue('Using Release build' in err.getvalue()) + self.assertTrue('Pixel tests enabled' in err.getvalue()) + self.assertTrue('Command line:' in err.getvalue()) + self.assertTrue('Regular timeout: ' in err.getvalue()) self.reset(err) printer._options.quiet = True - printer.print_config() + printer.print_config('/tmp') self.assertFalse('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic' in err.getvalue()) def test_print_one_line_summary(self): diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp.py b/Tools/Scripts/webkitpy/style/checkers/cpp.py index c573482c0..a0051c979 100644 --- a/Tools/Scripts/webkitpy/style/checkers/cpp.py +++ b/Tools/Scripts/webkitpy/style/checkers/cpp.py @@ -2040,6 +2040,26 @@ def check_namespace_indentation(clean_lines, line_number, file_extension, file_s break; +def check_directive_indentation(clean_lines, line_number, file_state, error): + """Looks for indentation of preprocessor directives. + + Args: + clean_lines: A CleansedLines instance containing the file. + line_number: The number of the line to check. + file_state: A _FileState instance which maintains information about + the state of things in the file. + error: The function to call with any errors found. + """ + + line = clean_lines.elided[line_number] # Get rid of comments and strings. + + indented_preprocessor_directives = match(r'\s+#', line) + if not indented_preprocessor_directives: + return + + error(line_number, 'whitespace/indent', 4, 'preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.') + + def check_using_std(clean_lines, line_number, file_state, error): """Looks for 'using std::foo;' statements which should be replaced with 'using namespace std;'. @@ -2567,7 +2587,10 @@ def check_style(clean_lines, line_number, file_extension, class_state, file_stat and not (match(r'.*\(.*\).*{.*.}', line) and class_state.classinfo_stack and line.count('{') == line.count('}')) - and not cleansed_line.startswith('#define ')): + and not cleansed_line.startswith('#define ') + # It's ok to use use WTF_MAKE_NONCOPYABLE and WTF_MAKE_FAST_ALLOCATED macros in 1 line + and not (cleansed_line.find("WTF_MAKE_NONCOPYABLE") != -1 + and cleansed_line.find("WTF_MAKE_FAST_ALLOCATED") != -1)): error(line_number, 'whitespace/newline', 4, 'More than one command on the same line') @@ -2578,6 +2601,7 @@ def check_style(clean_lines, line_number, file_extension, class_state, file_stat # Some more style checks check_namespace_indentation(clean_lines, line_number, file_extension, file_state, error) + check_directive_indentation(clean_lines, line_number, file_state, error) check_using_std(clean_lines, line_number, file_state, error) check_max_min_macros(clean_lines, line_number, file_state, error) check_ctype_functions(clean_lines, line_number, file_state, error) diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py index adc5c078b..a1b91f292 100644 --- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py @@ -2086,13 +2086,13 @@ class CppStyleTest(CppStyleTestBase): # Here is an example where the linter gets confused, even though # the code doesn't violate the style guide. self.assert_multi_line_lint( - '''class Foo - #ifdef DERIVE_FROM_GOO - : public Goo { - #else - : public Hoo { - #endif - };''', + 'class Foo\n' + '#ifdef DERIVE_FROM_GOO\n' + ' : public Goo {\n' + '#else\n' + ' : public Hoo {\n' + '#endif\n' + '};', 'Failed to find complete declaration of class Foo' ' [build/class] [5]') @@ -3821,7 +3821,7 @@ class WebKitStyleTest(CppStyleTestBase): 'More than one command on the same line [whitespace/newline] [4]') # Ignore preprocessor if's. self.assert_multi_line_lint( - ' #if (condition) || (condition2)\n', + '#if (condition) || (condition2)\n', '') # 2. An else statement should go on the same line as a preceding @@ -3861,6 +3861,9 @@ class WebKitStyleTest(CppStyleTestBase): # '#define TEST_ASSERT(expression) do { if (!(expression)) { TestsController::shared().testFailed(__FILE__, __LINE__, #expression); return; } } while (0 )\n', # 'Mismatching spaces inside () in if [whitespace/parens] [5]') self.assert_multi_line_lint( + 'WTF_MAKE_NONCOPYABLE(ClassName); WTF_MAKE_FAST_ALLOCATED;\n', + '') + self.assert_multi_line_lint( 'if (condition) {\n' ' doSomething();\n' ' doSomethingAgain();\n' @@ -4388,6 +4391,12 @@ class WebKitStyleTest(CppStyleTestBase): 'if (UNLIKELY(foo == NULL))', 'Use 0 instead of NULL. [readability/null] [5]') + def test_directive_indentation(self): + self.assert_lint( + " #if FOO", + "preprocessor directives (e.g., #ifdef, #define, #import) should never be indented." + " [whitespace/indent] [4]", + "foo.cpp") def test_using_std(self): self.assert_lint( diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp index 28e82ac07..36e30eaa4 100644 --- a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp +++ b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp @@ -87,6 +87,7 @@ 'type': 'shared_library', 'dependencies': [ '<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code', + '<(source_dir)/WebKit/chromium/WebKitUnitTests.gyp:io_stream_forwarder_android', ], }], ], diff --git a/Tools/WebKitTestRunner/Configurations/Base.xcconfig b/Tools/WebKitTestRunner/Configurations/Base.xcconfig index 9f5405967..8bdeee2c5 100644 --- a/Tools/WebKitTestRunner/Configurations/Base.xcconfig +++ b/Tools/WebKitTestRunner/Configurations/Base.xcconfig @@ -37,7 +37,7 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO GCC_WARN_UNUSED_FUNCTION = YES GCC_WARN_UNUSED_VARIABLE = YES -WARNING_CFLAGS = -Wall -W -Wno-unused-parameter +WARNING_CFLAGS = -Wall -W -Wno-unused-parameter -Wundef LINKER_DISPLAYS_MANGLED_NAMES = YES; VALID_ARCHS = i386 x86_64; GCC_PREFIX_HEADER = WebKitTestRunnerPrefix.h diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl index e0079b7f8..a0e3eeda8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl @@ -48,6 +48,7 @@ module WTR { void dumpResourceResponseMIMETypes(); void dumpWillCacheResponse(); void dumpApplicationCacheDelegateCallbacks(); + void dumpDatabaseCallbacks(); // Special options. void keepWebHistory(); @@ -142,6 +143,7 @@ module WTR { void setShouldStayOnPageAfterHandlingBeforeUnload(in boolean flag); void setDefersLoading(in boolean flag); + void setStopProvisionalFrameLoads(); // Web intents testing. void sendWebIntentResponse(in DOMString reply); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index 99f95d65d..4e3be91a0 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -260,6 +260,7 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings) WKBundleClearAllDatabases(m_bundle); WKBundleClearApplicationCache(m_bundle); WKBundleResetOriginAccessWhitelists(m_bundle); + WKBundleSetDatabaseQuota(m_bundle, 5 * 1024 * 1024); } void InjectedBundle::done() diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index cb05a6582..c19d11a5e 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -194,6 +194,20 @@ static WTF::String styleDecToStr(WKBundleCSSStyleDeclarationRef style) return stringBuilder.toString(); } +static WTF::String securityOriginToStr(WKSecurityOriginRef origin) +{ + WTF::StringBuilder stringBuilder; + stringBuilder.append('{'); + stringBuilder.append(toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin)))); + stringBuilder.appendLiteral(", "); + stringBuilder.append(toWTFString(adoptWK(WKSecurityOriginCopyHost(origin)))); + stringBuilder.appendLiteral(", "); + stringBuilder.appendNumber(WKSecurityOriginGetPort(origin)); + stringBuilder.append('}'); + + return stringBuilder.toString(); +} + static WTF::String frameToStr(WKBundleFrameRef frame) { WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); @@ -360,6 +374,7 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) 0, /*menuBarIsVisible*/ 0, /*toolbarsAreVisible*/ didReachApplicationCacheOriginQuota, + didExceedDatabaseQuota, }; WKBundlePageSetUIClient(m_page, &uiClient); @@ -732,9 +747,14 @@ void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame) InjectedBundle::shared().stringBuilder()->appendLiteral(" - didStartProvisionalLoadForFrame\n"); } - if (InjectedBundle::shared().topLoadingFrame()) - return; - InjectedBundle::shared().setTopLoadingFrame(frame); + if (!InjectedBundle::shared().topLoadingFrame()) + InjectedBundle::shared().setTopLoadingFrame(frame); + + if (InjectedBundle::shared().testRunner()->shouldStopProvisionalFrameLoads()) { + dumpFrameDescriptionSuitableForTestResult(frame); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - stopping load in didStartProvisionalLoadForFrame callback\n"); + WKBundleFrameStopLoading(frame); + } } void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame) @@ -754,6 +774,11 @@ void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRe if (!InjectedBundle::shared().isTestRunning()) return; + if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { + dumpFrameDescriptionSuitableForTestResult(frame); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailProvisionalLoadWithError\n"); + } + if (frame != InjectedBundle::shared().topLoadingFrame()) return; InjectedBundle::shared().setTopLoadingFrame(0); @@ -1330,6 +1355,11 @@ void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKBundlePageRef pag static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReachApplicationCacheOriginQuota(origin, totalBytesNeeded); } +uint64_t InjectedBundlePage::didExceedDatabaseQuota(WKBundlePageRef page, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didExceedDatabaseQuota(origin, databaseName, databaseDisplayName, currentQuotaBytes, currentOriginUsageBytes, currentDatabaseUsageBytes, expectedUsageBytes); +} + static WTF::String lastFileURLPathComponent(const WTF::String& path) { size_t pos = path.find("file://"); @@ -1416,24 +1446,19 @@ void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRe void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKSecurityOriginRef origin, int64_t totalBytesNeeded) { - if (!InjectedBundle::shared().testRunner()->shouldDumpApplicationCacheDelegateCallbacks()) - return; - - // For example, numbers from 30000 - 39999 will output as 30000. - // Rounding up or down does not really matter for these tests. It's - // sufficient to just get a range of 10000 to determine if we were - // above or below a threshold. - int64_t truncatedSpaceNeeded = (totalBytesNeeded / 10000) * 10000; - - InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{"); - InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin)))); - InjectedBundle::shared().stringBuilder()->appendLiteral(", "); - InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyHost(origin)))); - InjectedBundle::shared().stringBuilder()->appendLiteral(", "); - InjectedBundle::shared().stringBuilder()->appendNumber(WKSecurityOriginGetPort(origin)); - InjectedBundle::shared().stringBuilder()->appendLiteral("} totalSpaceNeeded:~"); - InjectedBundle::shared().stringBuilder()->appendNumber(truncatedSpaceNeeded); - InjectedBundle::shared().stringBuilder()->append('\n'); + if (InjectedBundle::shared().testRunner()->shouldDumpApplicationCacheDelegateCallbacks()) { + // For example, numbers from 30000 - 39999 will output as 30000. + // Rounding up or down does not really matter for these tests. It's + // sufficient to just get a range of 10000 to determine if we were + // above or below a threshold. + int64_t truncatedSpaceNeeded = (totalBytesNeeded / 10000) * 10000; + + InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:"); + InjectedBundle::shared().stringBuilder()->append(securityOriginToStr(origin)); + InjectedBundle::shared().stringBuilder()->appendLiteral(" totalSpaceNeeded:~"); + InjectedBundle::shared().stringBuilder()->appendNumber(truncatedSpaceNeeded); + InjectedBundle::shared().stringBuilder()->append('\n'); + } if (InjectedBundle::shared().testRunner()->shouldDisallowIncreaseForApplicationCacheQuota()) return; @@ -1442,6 +1467,20 @@ void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKSecurityOriginRef WKBundleResetApplicationCacheOriginQuota(InjectedBundle::shared().bundle(), adoptWK(WKSecurityOriginCopyToString(origin)).get()); } +uint64_t InjectedBundlePage::didExceedDatabaseQuota(WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes) +{ + if (InjectedBundle::shared().testRunner()->shouldDumpDatabaseCallbacks()) { + InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:"); + InjectedBundle::shared().stringBuilder()->append(securityOriginToStr(origin)); + InjectedBundle::shared().stringBuilder()->appendLiteral(" database:"); + InjectedBundle::shared().stringBuilder()->append(toWTFString(databaseName)); + InjectedBundle::shared().stringBuilder()->append('\n'); + } + + static const uint64_t defaultQuota = 5 * 1024 * 1024; + return defaultQuota; +} + // Editor Client Callbacks bool InjectedBundlePage::shouldBeginEditing(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo) diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index 370f427f9..894fb305b 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -125,12 +125,14 @@ private: static void willRunJavaScriptConfirm(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo); static void willRunJavaScriptPrompt(WKBundlePageRef, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo); static void didReachApplicationCacheOriginQuota(WKBundlePageRef, WKSecurityOriginRef, int64_t totalBytesNeeded, const void* clientInfo); + static uint64_t didExceedDatabaseQuota(WKBundlePageRef, WKSecurityOriginRef, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void* clientInfo); void willAddMessageToConsole(WKStringRef message, uint32_t lineNumber); void willSetStatusbarText(WKStringRef statusbarText); void willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef); void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef); void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef); void didReachApplicationCacheOriginQuota(WKSecurityOriginRef, int64_t totalBytesNeeded); + uint64_t didExceedDatabaseQuota(WKSecurityOriginRef, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes); #if ENABLE(FULLSCREEN_API) // Full Screen client diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp index fa2db1b47..892bc215d 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp @@ -81,11 +81,13 @@ TestRunner::TestRunner() , m_dumpResourceResponseMIMETypes(false) , m_dumpWillCacheResponse(false) , m_dumpApplicationCacheDelegateCallbacks(false) + , m_dumpDatabaseCallbacks(false) , m_disallowIncreaseForApplicationCacheQuota(false) , m_waitToDump(false) , m_testRepaint(false) , m_testRepaintSweepHorizontally(false) , m_willSendRequestReturnsNull(false) + , m_shouldStopProvisionalFrameLoads(false) , m_policyDelegateEnabled(false) , m_policyDelegatePermissive(false) , m_globalFlag(false) diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h index 674f19e1b..62ac05f3b 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h @@ -83,6 +83,7 @@ public: void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; } void dumpWillCacheResponse() { m_dumpWillCacheResponse = true; } void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; } + void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; } void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; } void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; } @@ -177,6 +178,7 @@ public: bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; } bool shouldDumpWillCacheResponse() const { return m_dumpWillCacheResponse; } bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; } + bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; } bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; } bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; } @@ -206,6 +208,9 @@ public: void setShouldStayOnPageAfterHandlingBeforeUnload(bool); void setDefersLoading(bool); + + void setStopProvisionalFrameLoads() { m_shouldStopProvisionalFrameLoads = true; } + bool shouldStopProvisionalFrameLoads() const { return m_shouldStopProvisionalFrameLoads; } bool globalFlag() const { return m_globalFlag; } void setGlobalFlag(bool value) { m_globalFlag = value; } @@ -276,12 +281,14 @@ private: bool m_dumpResourceResponseMIMETypes; bool m_dumpWillCacheResponse; bool m_dumpApplicationCacheDelegateCallbacks; + bool m_dumpDatabaseCallbacks; bool m_disallowIncreaseForApplicationCacheQuota; bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called. bool m_testRepaint; bool m_testRepaintSweepHorizontally; bool m_willSendRequestReturnsNull; + bool m_shouldStopProvisionalFrameLoads; bool m_policyDelegateEnabled; bool m_policyDelegatePermissive; diff --git a/Tools/WebKitTestRunner/PlatformWebView.h b/Tools/WebKitTestRunner/PlatformWebView.h index d3ad21a9e..43b79c33e 100644 --- a/Tools/WebKitTestRunner/PlatformWebView.h +++ b/Tools/WebKitTestRunner/PlatformWebView.h @@ -37,7 +37,7 @@ class QQuickWebView; typedef QQuickWebView* PlatformWKView; typedef QQuickView* PlatformWindow; #elif defined(__APPLE__) && __APPLE__ -#if __OBJC__ +#ifdef __OBJC__ @class WKView; @class WebKitTestRunnerWindow; #else diff --git a/Tools/WebKitTestRunner/Target.pri b/Tools/WebKitTestRunner/Target.pri index 7165c1b66..93b68f33a 100644 --- a/Tools/WebKitTestRunner/Target.pri +++ b/Tools/WebKitTestRunner/Target.pri @@ -38,6 +38,7 @@ DEFINES += USE_SYSTEM_MALLOC=1 have?(FONTCONFIG): PKGCONFIG += fontconfig INCLUDEPATH += \ + $$PWD \ $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt PREFIX_HEADER = WebKitTestRunnerPrefix.h diff --git a/Tools/qmake/config.tests/gnuld/gnuld.pro b/Tools/qmake/config.tests/gnuld/gnuld.pro new file mode 100644 index 000000000..c239f13e1 --- /dev/null +++ b/Tools/qmake/config.tests/gnuld/gnuld.pro @@ -0,0 +1,4 @@ +TEMPLATE = app +TARGET = gnuld +SOURCES = main.cpp +QMAKE_LFLAGS += -Wl,--no-keep-memory diff --git a/Tools/qmake/config.tests/gnuld/main.cpp b/Tools/qmake/config.tests/gnuld/main.cpp new file mode 100644 index 000000000..31a133726 --- /dev/null +++ b/Tools/qmake/config.tests/gnuld/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index cbb252328..cdb73a7c0 100644 --- a/Tools/qmake/mkspecs/features/default_post.prf +++ b/Tools/qmake/mkspecs/features/default_post.prf @@ -10,6 +10,9 @@ # or include() and a CONFIG += feature. CONFIG += config_step +# Enable dynamic instead of static libraries for development +!production_build:!buildbot:!win*: CONFIG += force_static_libs_as_shared + root_project_file: finalizeConfigure() # Sanitize build config for single-configuration builds @@ -65,12 +68,6 @@ CONFIG -= warn_on -Winit-self \ $$QMAKE_CXXFLAGS -v8: DEFINES += WTF_USE_V8=1 -else { - contains(JAVASCRIPTCORE_JIT, yes): DEFINES+=ENABLE_JIT=1 - contains(JAVASCRIPTCORE_JIT, no): DEFINES+=ENABLE_JIT=0 -} - # Template configurations contains(TEMPLATE, derived) { # A (mostly) no-op template @@ -187,10 +184,12 @@ contains(QT, webkit) { # In addition to the main shared QtWebKit library we also # need to link to any intermediate shared libraries. force_static_libs_as_shared { - WEBKIT += wtf webcore - !v8: WEBKIT += javascriptcore + WEBKIT += wtf javascriptcore webcore + build?(webkit1): WEBKIT += webkit1 build?(webkit2): WEBKIT += webkit2 } + + # FIXME: Replace this with putting the intermediate libraries in the prl file } contains(TARGET, $$resolveFinalLibraryName($${QT.webkit.name})): CONFIG += creating_module diff --git a/Tools/qmake/mkspecs/features/features.prf b/Tools/qmake/mkspecs/features/features.prf index 2df33e1e4..1d2f88ec3 100644 --- a/Tools/qmake/mkspecs/features/features.prf +++ b/Tools/qmake/mkspecs/features/features.prf @@ -34,6 +34,8 @@ defineTest(detectFeatures) { # haveQtModule(quick): WEBKIT_CONFIG += have_qtquick + else: CONFIGURE_WARNINGS += "QtQuick module not found, QML APIs will not be built" + haveQtModule(printsupport): WEBKIT_CONFIG += have_qtprintsupport haveQtModule(widgets): WEBKIT_CONFIG += have_qstyle haveQtModule(testlib): WEBKIT_CONFIG += have_qttestlib diff --git a/Tools/qmake/mkspecs/features/features.pri b/Tools/qmake/mkspecs/features/features.pri index 9526bf6c1..a36fb2c8e 100644 --- a/Tools/qmake/mkspecs/features/features.pri +++ b/Tools/qmake/mkspecs/features/features.pri @@ -67,6 +67,7 @@ FEATURE_DEFAULTS = \ ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0 \ ENABLE_LEGACY_NOTIFICATIONS=1 \ ENABLE_LEGACY_VIEWPORT_ADAPTION=1 \ + ENABLE_LEGACY_VENDOR_PREFIXES=1 \ ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 \ ENABLE_LINK_PREFETCH=0 \ ENABLE_LINK_PRERENDER=0 \ diff --git a/Tools/qmake/mkspecs/features/force_static_libs_as_shared.prf b/Tools/qmake/mkspecs/features/force_static_libs_as_shared.prf index e8a9978be..c337cda6f 100644 --- a/Tools/qmake/mkspecs/features/force_static_libs_as_shared.prf +++ b/Tools/qmake/mkspecs/features/force_static_libs_as_shared.prf @@ -7,13 +7,16 @@ contains(TEMPLATE, lib) { contains(CONFIG, staticlib) { - CONFIG -= hide_symbols - CONFIG -= staticlib - CONFIG += rpath - QMAKE_CXXFLAGS -= $$QMAKE_CXXFLAGS_HIDESYMS - QMAKE_CFLAGS -= $$QMAKE_CFLAGS_HIDESYMS - QMAKE_LFLAGS -= $$QMAKE_LFLAGS_HIDESYMS - QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_OBJECTIVE_CFLAGS_HIDESYMS - DESTDIR = $${ROOT_BUILD_DIR}/lib + CONFIG -= hide_symbols + CONFIG -= staticlib + CONFIG += rpath + QMAKE_CXXFLAGS -= $$QMAKE_CXXFLAGS_HIDESYMS + QMAKE_CFLAGS -= $$QMAKE_CFLAGS_HIDESYMS + QMAKE_LFLAGS -= $$QMAKE_LFLAGS_HIDESYMS + QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_OBJECTIVE_CFLAGS_HIDESYMS + DESTDIR = $${ROOT_BUILD_DIR}/lib + + # Ensure the install-name of the libraries are correct on Mac OS + macx: QMAKE_LFLAGS_SONAME = $$QMAKE_LFLAGS_SONAME$${DESTDIR}/ } } diff --git a/Tools/qmake/mkspecs/features/functions.prf b/Tools/qmake/mkspecs/features/functions.prf index 588cd42c8..c54a262be 100644 --- a/Tools/qmake/mkspecs/features/functions.prf +++ b/Tools/qmake/mkspecs/features/functions.prf @@ -369,7 +369,7 @@ defineReplace(javascriptFeatureDefines) { defineReplace(setEnvironmentVariable) { variable = $$1 value = $$2 - win32 { + win_cmd_shell { return((set \"$$variable=$$value\")) } return(export \"$$variable=$$value\") diff --git a/Tools/qmake/mkspecs/features/unix/default_post.prf b/Tools/qmake/mkspecs/features/unix/default_post.prf index 82e254eee..585578420 100644 --- a/Tools/qmake/mkspecs/features/unix/default_post.prf +++ b/Tools/qmake/mkspecs/features/unix/default_post.prf @@ -33,15 +33,8 @@ linux-g++*:isEqual(QT_ARCH,i386) { contains(TEMPLATE, app): CONFIG += rpath isEqual(QT_ARCH,i386):CONFIG(debug, debug|release) { - # Make ld don't cache the symbol tables of input files in memory to avoid memory exhaustion during the linking phase. - # We have to use ld, because --no-keep-memory isn't supported by ld.gold. - QMAKE_LFLAGS += -Wl,--no-keep-memory -} else { - # Use gold if available - !scratchbox:!mac:exists(/usr/bin/ld.gold) { - # Upstream gcc 4.7 does not support the -fuse-ld=gold option ( see: http://sourceware.org/ml/binutils/2011-01/msg00178.html ) - isEqual(QT_GCC_MAJOR_VERSION, 4):lessThan(QT_GCC_MINOR_VERSION, 7):QMAKE_LFLAGS += -fuse-ld=gold - } + # Make ld not cache the symbol tables of input files in memory to avoid memory exhaustion during the linking phase. + config_gnuld: QMAKE_LFLAGS += -Wl,--no-keep-memory } load(default_post) diff --git a/Tools/qmake/qt_webkit.pri b/Tools/qmake/qt_webkit.pri deleted file mode 100644 index e221bd26d..000000000 --- a/Tools/qmake/qt_webkit.pri +++ /dev/null @@ -1,28 +0,0 @@ -# These variables define the library version, which is based on the original -# Qt library version. It is not related to the release-version of QtWebKit. -QT.webkit.MAJOR_VERSION = 5 -QT.webkit.MINOR_VERSION = 0 -QT.webkit.PATCH_VERSION = 0 -QT.webkit.VERSION = 5.0.0 - -QT.webkit.name = QtWebKit -QT.webkit.bins = $$QT_MODULE_BIN_BASE -QT.webkit.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtWebKit -QT.webkit.imports = $$QT_MODULE_IMPORT_BASE -QT.webkit.private_includes = $$QT_MODULE_INCLUDE_BASE/$$QT.webkit.name/$$QT.webkit.VERSION $$QT_MODULE_INCLUDE_BASE/$$QT.webkit.name/$$QT.webkit.VERSION/$$QT.webkit.name -QT.webkit.sources = $$QT_MODULE_BASE -QT.webkit.libs = $$QT_MODULE_LIB_BASE -QT.webkit.depends = core gui opengl network - -!contains(QT_CONFIG, modular)|contains(QT_ELIGIBLE_MODULES, webkit) { - QT_CONFIG += webkit -} else { - warning("Attempted to include $$QT.webkit.name in the build, but it was not enabled in configure.") -} - -# This is the old syntax for the WebKit version defines. -# We keep them around in case someone was using them. -QT_WEBKIT_VERSION = $$QT.webkit.VERSION -QT_WEBKIT_MAJOR_VERSION = $$QT.webkit.MAJOR_VERSION -QT_WEBKIT_MINOR_VERSION = $$QT.webkit.MINOR_VERSION -QT_WEBKIT_PATCH_VERSION = $$QT.webkit.PATCH_VERSION diff --git a/configure.ac b/configure.ac index e89179d46..f0196e92b 100644 --- a/configure.ac +++ b/configure.ac @@ -607,38 +607,6 @@ AC_ARG_ENABLE(accelerated_compositing, ]) AC_MSG_RESULT([$enable_accelerated_compositing]) -# check whether to enable channel messaging support -AC_MSG_CHECKING([whether to enable HTML5 Channel Messaging support]) -AC_ARG_ENABLE(channel_messaging, - AC_HELP_STRING([--enable-channel-messaging], - [enable HTML5 channel messaging support [default=yes]]), - [],[enable_channel_messaging="yes"]) -AC_MSG_RESULT([$enable_channel_messaging]) - -# check whether to enable the meter tag -AC_MSG_CHECKING([whether to enable HTML5 meter tag]) -AC_ARG_ENABLE(meter_tag, - AC_HELP_STRING([--enable-meter-tag], - [enable HTML5 meter [default=yes]]), - [],[enable_meter_tag="yes"]) -AC_MSG_RESULT([$enable_meter_tag]) - -# check whether to enable the progress tag -AC_MSG_CHECKING([whether to enable HTML5 progress tag]) -AC_ARG_ENABLE(progress_tag, - AC_HELP_STRING([--enable-progress-tag], - [enable HTML5 progress [default=yes]]), - [],[enable_progress_tag="yes"]) -AC_MSG_RESULT([$enable_progress_tag]) - -# check whether to enable JavaScript debugger/profiler support -AC_MSG_CHECKING([whether to enable JavaScript debugger/profiler support]) -AC_ARG_ENABLE(javascript_debugger, - AC_HELP_STRING([--enable-javascript-debugger], - [enable JavaScript debugger/profiler support [default=yes]]), - [],[enable_javascript_debugger="yes"]) -AC_MSG_RESULT([$enable_javascript_debugger]) - # check whether to enable Gamepad support AC_MSG_CHECKING([whether to enable Gamepad support]) AC_ARG_ENABLE(gamepad, @@ -652,14 +620,6 @@ if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then enable_gamepad=no; fi -# check whether to enable DOM mutation observer support -AC_MSG_CHECKING([whether to enable DOM mutation observer support]) -AC_ARG_ENABLE(mutation_observers, - AC_HELP_STRING([--enable-mutation-observers], - [enable DOM mutation observer support [default=no]]), - [],[enable_mutation_observers=$enable_unstable_features]) -AC_MSG_RESULT([$enable_mutation_observers]) - # check whether to enable the indexed database API AC_MSG_CHECKING([whether to enable the indexed database API]) AC_ARG_ENABLE(indexed_database, @@ -668,30 +628,6 @@ AC_ARG_ENABLE(indexed_database, [],[enable_indexed_database="no"]) AC_MSG_RESULT([$enable_indexed_database]) -# check whether to build with SQL database support -AC_MSG_CHECKING([whether to enable SQL client-side database storage support]) -AC_ARG_ENABLE(sql_database, - AC_HELP_STRING([--enable-sql-database], - [enable SQL client-side database storage support [default=yes]]), - [],[enable_sql_database="yes"]) -AC_MSG_RESULT([$enable_sql_database]) - -# check whether to build with icon database support -AC_MSG_CHECKING([whether to enable icon database support]) -AC_ARG_ENABLE(icon_database, - AC_HELP_STRING([--enable-icon-database], - [enable icon database [default=yes]]), - [],[enable_icon_database="yes"]) -AC_MSG_RESULT([$enable_icon_database]) - -# check whether to enable HTML5 iframe seamless attribute support -AC_MSG_CHECKING([whether to enable HTML5 iframe seamless attribute support]) -AC_ARG_ENABLE(iframe-seamless, - AC_HELP_STRING([--enable-iframe-seamless], - [enable HTML5 iframe seamless attribute support [default=yes]]), - [],[enable_iframe_seamless="yes"]) -AC_MSG_RESULT([$enable_iframe_seamless]) - # check whether to enable HTML5 audio/video support AC_MSG_CHECKING([whether to enable HTML5 video support]) AC_ARG_ENABLE(video, @@ -700,27 +636,6 @@ AC_ARG_ENABLE(video, [],[enable_video="yes"]) AC_MSG_RESULT([$enable_video]) -# turn off video features if --disable-video is requested -if test "$enable_video" = "no"; then - enable_video_track=no -fi - -# check whether to enable HTML5 video track support -AC_MSG_CHECKING([whether to enable HTML5 video track support]) -AC_ARG_ENABLE(video_track, - AC_HELP_STRING([--enable-video-track], - [enable HTML5 video track support [default=no]]), - [],[enable_video_track=$enable_unstable_features]) -AC_MSG_RESULT([$enable_video_track]) - -# check whether to enable Javascript Fullscreen API support -AC_MSG_CHECKING([whether to enable Fullscreen API support]) -AC_ARG_ENABLE(fullscreen_api, - AC_HELP_STRING([--enable-fullscreen-api], - [enable the Fullscreen API support [default=yes]]), - [],[enable_fullscreen_api="yes"]) -AC_MSG_RESULT([$enable_fullscreen_api]) - # check whether to enable media stream support AC_MSG_CHECKING([whether to enable media stream support]) AC_ARG_ENABLE(media_stream, @@ -745,22 +660,6 @@ AC_ARG_ENABLE(geolocation, [],[enable_geolocation="yes"]) AC_MSG_RESULT([$enable_geolocation]) -# check whether to enable MathML support -AC_MSG_CHECKING([whether to enable MathML support]) -AC_ARG_ENABLE(mathml, - AC_HELP_STRING([--enable-mathml], - [enable support for MathML [default=yes]]), - [],[enable_mathml="yes"]) -AC_MSG_RESULT([$enable_mathml]) - -# check whether to enable MHTML support -AC_MSG_CHECKING([whether to enable MHTML support]) -AC_ARG_ENABLE(mhtml, - AC_HELP_STRING([--enable-mhtml], - [enable support for MHTML [default=yes]]), - [],[enable_mhtml="yes"]) -AC_MSG_RESULT([$enable_mhtml]) - # check whether to enable SVG support AC_MSG_CHECKING([whether to enable SVG support]) AC_ARG_ENABLE(svg, @@ -769,43 +668,11 @@ AC_ARG_ENABLE(svg, [],[enable_svg="yes"]) AC_MSG_RESULT([$enable_svg]) -# check whether to enable Shadow DOM support -AC_MSG_CHECKING([whether to enable Shadow DOM support]) -AC_ARG_ENABLE(shadow_dom, - AC_HELP_STRING([--enable-shadow-dom], - [enable support for Shadow DOM [default=yes]]), - [],[enable_shadow_dom="yes"]) -AC_MSG_RESULT([$enable_shadow_dom]) - -# check whether to enable SharedWorkers support -AC_MSG_CHECKING([whether to enable SharedWorkers support]) -AC_ARG_ENABLE(shared_workers, - AC_HELP_STRING([--enable-shared-workers], - [enable support for SharedWorkers [default=yes]]), - [],[enable_shared_workers="yes"]) -AC_MSG_RESULT([$enable_shared_workers]) - -# check whether to enable Web Workers support -AC_MSG_CHECKING([whether to enable Web Workers support]) -AC_ARG_ENABLE(workers, - AC_HELP_STRING([--enable-workers], - [enable support for Web Workers [default=yes]]), - [],[enable_workers="yes"]) -AC_MSG_RESULT([$enable_workers]) - # turn off svg features if --disable-svg is requested if test "$enable_svg" = "no"; then enable_svg_fonts=no fi -# check whether to enable support for CSS box-decoration-break -AC_MSG_CHECKING([whether to enable support for CSS box-decoration-break]) -AC_ARG_ENABLE(css_box_decoration_break, - AC_HELP_STRING([--enable-css-box-decoration-break], - [enable support for CSS box-decoration-break (experimental) [default=yes]]), - [],[enable_css_box_decoration_break="yes"]) -AC_MSG_RESULT([$enable_css_box_decoration_break]) - # check whether to enable support for filters AC_MSG_CHECKING([whether to enable support for filters]) AC_ARG_ENABLE(filters, @@ -844,30 +711,6 @@ AC_ARG_ENABLE(web_audio, [],[enable_web_audio="no"]) AC_MSG_RESULT([$enable_web_audio]) -# check whether to enable Web Timing support -AC_MSG_CHECKING([whether to enable Web Timing support]) -AC_ARG_ENABLE(web_timing, - AC_HELP_STRING([--enable-web-timing], - [enable support for Web Timing [default=no]]), - [],[enable_web_timing=$enable_unstable_features]) -AC_MSG_RESULT([$enable_web_timing]) - -# check whether to enable Blob support -AC_MSG_CHECKING([whether to enable Blob support]) -AC_ARG_ENABLE(blob, - AC_HELP_STRING([--enable-blob], - [enable support for Blob [default=yes]]), - [],[enable_blob="yes"]) -AC_MSG_RESULT([$enable_blob]) - -# check whether to enable Legacy WebKitBlobBuilder support -AC_MSG_CHECKING([whether to enable Legacy WebKitBlobBuilder support]) -AC_ARG_ENABLE(legacy_webkit_blob_builder, - AC_HELP_STRING([--enable-legacy-webkit-blob-builder], - [enable support for Legacy WebKitBlobBuilder [default=yes]]), - [],[enable_legacy_webkit_blob_builder="yes"]) -AC_MSG_RESULT([$legacy_webkit_blob_builder]) - # check whether to enable code coverage AC_MSG_CHECKING([whether to enable code coverage support]) AC_ARG_ENABLE(coverage, @@ -926,13 +769,6 @@ if test "$enable_opcode_stats" = "yes"; then AC_DEFINE([ENABLE_OPCODE_STATS], [1], [Define to enable Opcode statistics]) fi -# Link prefetch -AC_MSG_CHECKING([whether to enable link prefetch support]) -AC_ARG_ENABLE([link-prefetch], - [AS_HELP_STRING([--enable-link-prefetch], [Enable Link prefetch support (default: disabled)])], - [],[enable_link_prefetch=$enable_unstable_features]) -AC_MSG_RESULT([$enable_link_prefetch]) - # GObject Introspection AC_MSG_CHECKING([whether to enable GObject introspection support]) AC_ARG_ENABLE([introspection], @@ -940,30 +776,6 @@ AC_ARG_ENABLE([introspection], [],[enable_introspection=no]) AC_MSG_RESULT([$enable_introspection]) -# check whether to enable requestAnimationFrame support -AC_MSG_CHECKING([whether to enable requestAnimationFrame support]) -AC_ARG_ENABLE(request_animation_frame, - AC_HELP_STRING([--enable-request-animation-frame], - [enable support for requestAnimationFrame (experimental) [default=yes]]), - [],[enable_request_animation_frame="yes"]) -AC_MSG_RESULT([$enable_request_animation_frame]) - -# check whether to enable CSS Exclusions support -AC_MSG_CHECKING([whether to enable CSS Exclusions]) -AC_ARG_ENABLE(css_exclusions, - AC_HELP_STRING([--enable-css-exclusions], - [enable support for CSS Exclusions [default=yes]]), - [],[enable_css_exclusions="yes"]) -AC_MSG_RESULT([$enable_css_exclusions]) - -# check whether to enable CSS Regions support -AC_MSG_CHECKING([whether to enable CSS Regions]) -AC_ARG_ENABLE(css_regions, - AC_HELP_STRING([--enable-css-regions], - [enable support for CSS Regions [default=yes]]), - [],[enable_css_regions="yes"]) -AC_MSG_RESULT([$enable_css_regions]) - # Enable css shaders if unstable_features, css_filters and # accelerated_compositing are turned on. AC_MSG_CHECKING([whether to enable CSS Shaders]) @@ -1247,45 +1059,21 @@ AM_CONDITIONAL([USE_FARSTREAM], [test "$have_farstream" = "yes"]) AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug_features" = "yes"]) AM_CONDITIONAL([ENABLE_UNSTABLE_FEATURES],[test "$enable_unstable_features" = "yes"]) AM_CONDITIONAL([ENABLE_WEBGL],[test "$enable_webgl" = "yes"]) -AM_CONDITIONAL([ENABLE_BLOB],[test "$enable_blob" = "yes"]) -AM_CONDITIONAL([ENABLE_LEGACY_WEBKIT_BLOB_BUILDER],[test "$enable_legacy_webkit_blob_builder" = "yes"]) -AM_CONDITIONAL([ENABLE_METER_ELEMENT],[test "$enable_meter_tag" = "yes"]) -AM_CONDITIONAL([ENABLE_PROGRESS_ELEMENT],[test "$enable_progress_tag" = "yes"]) -AM_CONDITIONAL([ENABLE_CHANNEL_MESSAGING],[test "$enable_channel_messaging" = "yes"]) -AM_CONDITIONAL([ENABLE_JAVASCRIPT_DEBUGGER],[test "$enable_javascript_debugger" = "yes"]) AM_CONDITIONAL([ENABLE_GAMEPAD],[test "$enable_gamepad" = "yes"]) -AM_CONDITIONAL([ENABLE_SQL_DATABASE],[test "$enable_sql_database" = "yes"]) -AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"]) AM_CONDITIONAL([ENABLE_XSLT],[test "$enable_xslt" = "yes"]) -AM_CONDITIONAL([ENABLE_CSS_BOX_DECORATION_BREAK],[test "$enable_css_box_decoration_break" = "yes"]) AM_CONDITIONAL([ENABLE_FILTERS],[test "$enable_filters" = "yes"]) AM_CONDITIONAL([ENABLE_GEOLOCATION], [test "$enable_geolocation" = "yes"]) -AM_CONDITIONAL([ENABLE_MATHML], [test "$enable_mathml" = "yes"]) -AM_CONDITIONAL([ENABLE_MHTML], [test "$enable_mhtml" = "yes"]) AM_CONDITIONAL([ENABLE_VIDEO],[test "$enable_video" = "yes"]) -AM_CONDITIONAL([ENABLE_VIDEO_TRACK],[test "$enable_video_track" = "yes"]) -AM_CONDITIONAL([ENABLE_FULLSCREEN_API],[test "$enable_fullscreen_api" = "yes"]) AM_CONDITIONAL([ENABLE_MEDIA_STREAM],[test "$enable_media_stream" = "yes"]) AM_CONDITIONAL([ENABLE_SVG],[test "$enable_svg" = "yes"]) AM_CONDITIONAL([ENABLE_SVG_FONTS],[test "$enable_svg_fonts" = "yes"]) AM_CONDITIONAL([ENABLE_COVERAGE],[test "$enable_coverage" = "yes"]) AM_CONDITIONAL([ENABLE_FAST_MALLOC],[test "$enable_fast_malloc" = "yes"]) -AM_CONDITIONAL([ENABLE_WORKERS],[test "$enable_workers" = "yes"]) -AM_CONDITIONAL([ENABLE_SHADOW_DOM],[test "$enable_shadow_dom" = "yes"]) -AM_CONDITIONAL([ENABLE_SHARED_WORKERS],[test "$enable_shared_workers" = "yes"]) -AM_CONDITIONAL([ENABLE_WEB_SOCKETS],[test "$enable_web_sockets" = "yes"]) AM_CONDITIONAL([ENABLE_WEB_AUDIO],[test "$enable_web_audio" = "yes"]) -AM_CONDITIONAL([ENABLE_WEB_TIMING],[test "$enable_web_timing" = "yes"]) AM_CONDITIONAL([ENABLE_OPCODE_STATS],[test "$enable_opcode_stats" = "yes"]) AM_CONDITIONAL([ENABLE_WEBKIT2],[test "$enable_webkit2" = "yes"]) AM_CONDITIONAL([ENABLE_PLUGIN_PROCESS],[test "$enable_plugin_process" = "yes"]) AM_CONDITIONAL([ENABLE_SPELLCHECK],[test "$enable_spellcheck" = "yes"]) -AM_CONDITIONAL([ENABLE_LINK_PREFETCH],[test "$enable_link_prefetch" = "yes"]) -AM_CONDITIONAL([ENABLE_REQUEST_ANIMATION_FRAME],[test "$enable_request_animation_frame" = "yes"]) -AM_CONDITIONAL([ENABLE_MUTATION_OBSERVERS],[test "$enable_mutation_observers" = "yes"]) -AM_CONDITIONAL([ENABLE_IFRAME_SEAMLESS],[test "$enable_iframe_seamless" = "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"]) AM_CONDITIONAL([ENABLE_CSS_SHADERS],[test "$enable_css_shaders" = "yes"]) @@ -1342,41 +1130,17 @@ Build configuration: Features: ======= Accelerated Compositing : $enable_accelerated_compositing - Blob support : $enable_blob - CSS Exclusions support : $enable_css_exclusions - CSS Regions support : $enable_css_regions - CSS box-decoration-break support : $enable_css_box_decoration_break - DOM mutation observer support : $enable_mutation_observers Filters support : $enable_filters - Fullscreen API support : $enable_fullscreen_api Gamepad support : $enable_gamepad Geolocation support : $enable_geolocation - HTML5 channel messaging support : $enable_channel_messaging - HTML5 iframe seamless attribute support : $enable_iframe_seamless - HTML5 meter element support : $enable_meter_tag - HTML5 progress element support : $enable_progress_tag - HTML5 track element support : $enable_video_track HTML5 video element support : $enable_video - Icon database support : $enable_icon_database JIT compilation : $enable_jit - JavaScript debugger/profiler support : $enable_javascript_debugger - Legacy WebKitBlobBuilder support : $enable_legacy_webkit_blob_builder - Link prefetch support : $enable_link_prefetch - MHTML support : $enable_mhtml - MathML support : $enable_mathml Media stream support : $enable_media_stream Opcode stats : $enable_opcode_stats - RequestAnimationFrame support : $enable_request_animation_frame - SQL client-side database storage support : $enable_sql_database SVG fonts support : $enable_svg_fonts SVG support : $enable_svg - Shadow DOM support : $enable_shadow_dom - SharedWorkers support : $enable_shared_workers Spellcheck support : $enable_spellcheck Web Audio support : $enable_web_audio - Web Sockets support : $enable_web_sockets - Web Timing support : $enable_web_timing - Web Workers support : $enable_workers WebGL : $enable_webgl XSLT support : $enable_xslt |