diff options
Diffstat (limited to 'Source')
926 files changed, 28175 insertions, 7507 deletions
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 2fcbec387..dc002d41c 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,20 +1,315 @@ -2012-06-13 Patrick Gansterer <paroga@webkit.org> +2012-07-29 Filip Pizlo <fpizlo@apple.com> - [WIN] Remove dependency on pthread from MachineStackMarker - https://bugs.webkit.org/show_bug.cgi?id=68429 + PropertyNameArray::m_shouldCache is only assigned and never used + https://bugs.webkit.org/show_bug.cgi?id=92598 - Reviewed by NOBODY (OOPS!). + Reviewed by Dan Bernstein. - Implement pthread TLS functionality with native windows functions. + * runtime/PropertyNameArray.h: + (JSC::PropertyNameArray::PropertyNameArray): + (PropertyNameArray): - * heap/MachineStackMarker.cpp: Use the new functions instead of pthread directly. - * heap/MachineStackMarker.h: - * wtf/ThreadSpecific.h: - (WTF::ThreadSpecificKeyCreate): Added wrapper around pthread_key_create. - (WTF::ThreadSpecificKeyDelete): Added wrapper around pthread_key_delete. - (WTF::ThreadSpecificSet): Added wrapper around pthread_setspecific. - (WTF::ThreadSpecificGet): Added wrapper around pthread_getspecific. - * wtf/ThreadSpecificWin.cpp: +2012-07-29 Rik Cabanier <cabanier@adobe.com> + + Add ENABLE_CSS_COMPOSITING flag + https://bugs.webkit.org/show_bug.cgi?id=92553 + + Reviewed by Dirk Schulze. + + Adds compiler flag CSS_COMPOSITING to build systems to enable CSS blending and compositing. See spec https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html + + * Configurations/FeatureDefines.xcconfig: + +2012-07-27 Mark Hahnenberg <mhahnenberg@apple.com> + + Split functionality of MarkedAllocator::m_currentBlock + https://bugs.webkit.org/show_bug.cgi?id=92550 + + Reviewed by Filip Pizlo. + + MarkedAllocator::m_currentBlock serves two purposes right now; it indicates the block that is currently + being used for allocation and the beginning of the list of blocks that need to be swept. We should split + these two functionalities into two separate fields. + + * heap/MarkedAllocator.cpp: + (JSC::MarkedAllocator::tryAllocateHelper): Use m_blocksToSweep instead of m_currentBlock as the + initializer/reference of the loop. Only change m_currentBlock when we know what the result will be. + (JSC::MarkedAllocator::addBlock): When we add a new block we know that both m_blocksToSweep and + m_currentBlock are null. In order to preserve the invariant that m_currentBlock <= m_blocksToSweep, + we assign both of them to point to the new block. + (JSC::MarkedAllocator::removeBlock): We need a separate check to see if the block we're removing is + m_blocksToSweep and if so, advance it to the next block in the list. + * heap/MarkedAllocator.h: + (MarkedAllocator): Initialize m_blocksToSweep. + (JSC::MarkedAllocator::MarkedAllocator): + (JSC::MarkedAllocator::reset): We set m_blocksToSweep to be the head of our list. This function is called + at the end of a collection, so all of the blocks in our allocator need to be swept. We need to sweep a + block before we can start allocating, so m_currentBlock is set to null. We also set the freeList to + the empty FreeList to emphasize the fact that we can't start allocating until we do some sweeping. + +2012-07-27 Mark Hahnenberg <mhahnenberg@apple.com> + + Increase inline storage for JSFinalObjects by one + https://bugs.webkit.org/show_bug.cgi?id=92526 + + Reviewed by Geoffrey Garen. + + Now that we've removed the inheritorID from objects, we can increase our inline storage for JSFinalObjects on + 64-bit platforms by 1. + + * llint/LowLevelInterpreter.asm: Change the constant. + * runtime/PropertyOffset.h: Change the constant. + (JSC): + +2012-07-27 Jer Noble <jer.noble@apple.com> + + Support a rational time class for use by media elements. + https://bugs.webkit.org/show_bug.cgi?id=88787 + + Re-export WTF::MediaTime from JavaScriptCore. + + Reviewed by Eric Carlson. + + * JavaScriptCore.order: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2012-07-26 Filip Pizlo <fpizlo@apple.com> + + JSObject::reallocateStorageIfNecessary is neither used nor defined + https://bugs.webkit.org/show_bug.cgi?id=92417 + + Reviewed by Mark Rowe. + + * runtime/JSObject.h: + (JSObject): + +2012-07-26 Mark Hahnenberg <mhahnenberg@apple.com> + + Allocate Structures in a separate part of the Heap + https://bugs.webkit.org/show_bug.cgi?id=92420 + + Reviewed by Filip Pizlo. + + To fix our issue with destruction/finalization of Structures before their objects, we can move Structures to a separate + part of the Heap that will be swept after all other objects. This first patch will just be separating Structures + out into their own separate MarkedAllocator. Everything else will behave identically. + + * heap/Heap.h: New function to allocate Structures in the Heap. + (Heap): + (JSC): + (JSC::Heap::allocateStructure): + * heap/MarkedAllocator.cpp: Pass whether or not we're allocated Structures to the MarkedBlock. + (JSC::MarkedAllocator::allocateBlock): + * heap/MarkedAllocator.h: Add tracking for whether or not we're allocating only Structures. + (JSC::MarkedAllocator::onlyContainsStructures): + (MarkedAllocator): + (JSC::MarkedAllocator::MarkedAllocator): + (JSC::MarkedAllocator::init): + * heap/MarkedBlock.cpp: Add tracking for whether or not we're allocating only Structures. We need this to be able to + distinguish the various MarkedBlock types in MarkedSpace::allocatorFor(MarkedBlock*). + (JSC::MarkedBlock::create): + (JSC::MarkedBlock::MarkedBlock): + * heap/MarkedBlock.h: + (MarkedBlock): + (JSC::MarkedBlock::onlyContainsStructures): + (JSC): + * heap/MarkedSpace.cpp: Include the new Structure allocator in all the places that all the other allocators are used/modified. + (JSC::MarkedSpace::MarkedSpace): + (JSC::MarkedSpace::resetAllocators): + (JSC::MarkedSpace::canonicalizeCellLivenessData): + (JSC::MarkedSpace::isPagedOut): + * heap/MarkedSpace.h: Add new MarkedAllocator just for Structures. + (MarkedSpace): + (JSC::MarkedSpace::allocatorFor): + (JSC::MarkedSpace::allocateStructure): + (JSC): + (JSC::MarkedSpace::forEachBlock): + * runtime/Structure.h: Move all of the functions that call allocateCell<Structure> down below the explicit template specialization + for allocateCell<Structure>. The new inline specialization for allocateCell directly calls the allocateStructure() function in the + Heap. + (Structure): + (JSC::Structure): + (JSC): + (JSC::Structure::create): + (JSC::Structure::createStructure): + +2012-07-26 Filip Pizlo <fpizlo@apple.com> + + JSArray has methods that are neither used nor defined + https://bugs.webkit.org/show_bug.cgi?id=92416 + + Reviewed by Simon Fraser. + + * runtime/JSArray.h: + (JSArray): + +2012-07-26 Zoltan Herczeg <zherczeg@webkit.org> + + [Qt][ARM]ARMAssembler needs buildfix afert r123417 + https://bugs.webkit.org/show_bug.cgi?id=92086 + + Reviewed by Csaba Osztrogonác. + + The ARM implementation of this should be optimized code path + is covered by a non-optimized code path. This patch fixes this, + and adds a new function which returns with the offset range. + + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::readPointer): + (ARMAssembler): + (JSC::ARMAssembler::repatchInt32): + (JSC::ARMAssembler::repatchCompact): + * assembler/MacroAssemblerARM.h: + (MacroAssemblerARM): + (JSC::MacroAssemblerARM::isCompactPtrAlignedAddressOffset): + (JSC::MacroAssemblerARM::load32WithCompactAddressOffsetPatch): + +2012-07-25 Mark Hahnenberg <mhahnenberg@apple.com> + + Build fix for 32-bit after r123682 + + * runtime/JSObject.h: Need to pad out JSObjects on 32-bit so that they're the correct size since + we only removed one 4-byte word and we need to be 8-byte aligned. + (JSObject): + +2012-07-25 Filip Pizlo <fpizlo@apple.com> + + JSC GC object copying APIs should allow for greater flexibility + https://bugs.webkit.org/show_bug.cgi?id=92316 + + Reviewed by Mark Hahnenberg. + + It's now the case that visitChildren() methods can directly pin and allocate in new space during copying. + They can also do the copying and marking themselves. This new API is only used for JSObjects for now. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * heap/MarkStack.cpp: + (JSC::SlotVisitor::allocateNewSpaceSlow): + (JSC::SlotVisitor::allocateNewSpaceOrPin): + (JSC): + (JSC::SlotVisitor::copyAndAppend): + * heap/MarkStack.h: + (MarkStack): + (JSC::MarkStack::appendUnbarrieredValue): + (JSC): + * heap/SlotVisitor.h: + * heap/SlotVisitorInlineMethods.h: Added. + (JSC): + (JSC::SlotVisitor::checkIfShouldCopyAndPinOtherwise): + (JSC::SlotVisitor::allocateNewSpace): + * runtime/JSObject.cpp: + (JSC::JSObject::visitOutOfLineStorage): + (JSC): + (JSC::JSObject::visitChildren): + (JSC::JSFinalObject::visitChildren): + * runtime/JSObject.h: + (JSObject): + +2012-07-25 Mark Hahnenberg <mhahnenberg@apple.com> + + Remove JSObject::m_inheritorID + https://bugs.webkit.org/show_bug.cgi?id=88378 + + Reviewed by Filip Pizlo. + + This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction), + and most objects don't need an inheritorID (this value is only used if the object is used as a prototype). + Instead use a private named value in the object's property storage. + + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize! + * jit/JITInlineMethods.h: + (JSC::JIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize! + * llint/LowLevelInterpreter.asm: No need m_inheritorID to initialize! + * runtime/JSGlobalData.h: + (JSGlobalData): Added private name 'm_inheritorIDKey'. + * runtime/JSGlobalThis.cpp: + (JSC::JSGlobalThis::setUnwrappedObject): resetInheritorID is now passed a JSGlobalData&. + * runtime/JSObject.cpp: + (JSC::JSObject::visitChildren): No m_inheritorID to be marked. + (JSC::JSFinalObject::visitChildren): No m_inheritorID to be marked. + (JSC::JSObject::createInheritorID): Store the newly created inheritorID in the property map. Make sure + it's got the DontEnum attribute!! + * runtime/JSObject.h: + (JSObject): + (JSC::JSObject::resetInheritorID): Remove the inheritorID from property storage. + (JSC): + (JSC::JSObject::inheritorID): Read the inheritorID from property storage. + +2012-07-25 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Create a specialized pair for use in HashMap iterators + https://bugs.webkit.org/show_bug.cgi?id=92137 + + Reviewed by Ryosuke Niwa. + + Update a couple of sites that relied on the fact that "contents" of iterators were + std::pairs. + + * profiler/Profile.cpp: + (JSC): This code kept a vector of the pairs that were the "contents" of the iterators. This + is changed to use a KeyValuePair. We make use HashCount's ValueType (which represents only + the key) to get the proper key parameter for KeyValuePair. + * tools/ProfileTreeNode.h: + (ProfileTreeNode): Use HashMap::ValueType to declare the type of the contents of the hash + instead of declaring it manually. This will make use of the new KeyValuePair. + +2012-07-25 Patrick Gansterer <paroga@webkit.org> + + REGRESSION(r123505): Date.getYear() returns the same as Date.getFullYear() + https://bugs.webkit.org/show_bug.cgi?id=92218 + + Reviewed by Csaba Osztrogonác. + + * runtime/DatePrototype.cpp: + (JSC::dateProtoFuncGetYear): Added the missing offset of 1900 to the return value. + +2012-07-24 Filip Pizlo <fpizlo@apple.com> + + REGRESSION(r123417): It made tests assert/crash on 32 bit + https://bugs.webkit.org/show_bug.cgi?id=92088 + + Reviewed by Mark Hahnenberg. + + The pointer arithmetic was wrong, because negative numbers are hard to think about. + + * dfg/DFGRepatch.cpp: + (JSC::DFG::emitPutTransitionStub): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): + +2012-07-24 Patrick Gansterer <paroga@webkit.org> + + Store the full year in GregorianDateTime + https://bugs.webkit.org/show_bug.cgi?id=92067 + + Reviewed by Geoffrey Garen. + + Use the full year instead of the offset from year 1900 + for the year member variable of GregorianDateTime. + + * runtime/DateConstructor.cpp: + (JSC::constructDate): + (JSC::dateUTC): + * runtime/DateConversion.cpp: + (JSC::formatDate): + (JSC::formatDateUTCVariant): + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + (JSC::fillStructuresUsingDateArgs): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncSetYear): + * runtime/JSDateMath.cpp: + (JSC::gregorianDateTimeToMS): + (JSC::msToGregorianDateTime): + +2012-07-24 Patrick Gansterer <paroga@webkit.org> + + [WIN] Build fix after r123417. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2012-07-23 Patrick Gansterer <paroga@webkit.org> diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 0a26e46ff..b5f24899f 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -43,6 +43,7 @@ ENABLE_CSS_IMAGE_ORIENTATION = ; ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_SHADERS = ENABLE_CSS_SHADERS; +ENABLE_CSS_COMPOSITING = ; ENABLE_CSS_STICKY_POSITION = ENABLE_CSS_STICKY_POSITION; ENABLE_CSS_VARIABLES = ; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; @@ -135,4 +136,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(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_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +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_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(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_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/JavaScriptCore.order b/Source/JavaScriptCore/JavaScriptCore.order index 3a450075a..0742a0a0e 100644 --- a/Source/JavaScriptCore/JavaScriptCore.order +++ b/Source/JavaScriptCore/JavaScriptCore.order @@ -2494,3 +2494,16 @@ __ZN3WTF6VectorIN3JSC10ASTBuilder14AssignmentInfoELm10EE14expandCapacityEm _cti_op_put_by_id_direct_generic __ZN3WTF9HashTableIPN3JSC16FunctionBodyNodeESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTraitsIS3_EENSB_IjEEEESC_E4findIS3_NS_22IdentityHashTranslatorIS3_S5_S9_EEEENS_17HashTableIteratorIS3_S5_S7_S9_SE_SC_EERKT_ __ZN3WTF9HashTableIPN3JSC16FunctionBodyNodeESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTraitsIS3_EENSB_IjEEEESC_E6expandEv +__ZN3WTF3absERKNS_9MediaTimeE +__ZN3WTF9MediaTime11invalidTimeEv +__ZN3WTF9MediaTime14indefiniteTimeEv +__ZN3WTF9MediaTime15createWithFloatEfi +__ZN3WTF9MediaTime16createWithDoubleEdi +__ZN3WTF9MediaTime20negativeInfiniteTimeEv +__ZN3WTF9MediaTime20positiveInfiniteTimeEv +__ZN3WTF9MediaTimeD1Ev +__ZNK3WTF9MediaTimegtERKS0_ +__ZNK3WTF9MediaTimeltERKS0_ +__ZNK3WTF9MediaTimemiERKS0_ +__ZNK3WTF9MediaTimeplERKS0_ + diff --git a/Source/JavaScriptCore/JavaScriptCore.pri b/Source/JavaScriptCore/JavaScriptCore.pri index f6580c51f..380bbaf1b 100644 --- a/Source/JavaScriptCore/JavaScriptCore.pri +++ b/Source/JavaScriptCore/JavaScriptCore.pri @@ -34,6 +34,12 @@ INCLUDEPATH += \ win32-* { LIBS += -lwinmm + + win32-g++* { + LIBS += -lpthreadGC2 + } else:win32-msvc* { + LIBS += -lpthreadVC2 + } } wince* { diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index d8f838e87..5f27859d8 100755 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -151,6 +151,7 @@ EXPORTS ?deleteProperty@JSSymbolTableObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@VPropertyName@2@@Z ?deletePropertyByIndex@JSObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@I@Z ?deleteTable@HashTable@JSC@@QBEXXZ + ?description@JSValue@JSC@@QBEPADXZ ?despecifyDictionaryFunction@Structure@JSC@@QAEXAAVJSGlobalData@2@VPropertyName@2@@Z ?despecifyFunctionTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@VPropertyName@2@@Z ?destroy@JSCell@JSC@@KAXPAV12@@Z @@ -378,6 +379,23 @@ EXPORTS ?writable@PropertyDescriptor@JSC@@QBE_NXZ ?writeBarrier@HandleSet@JSC@@QAEXPAVJSValue@2@ABV32@@Z ?yield@WTF@@YAXXZ + ?toDouble@MediaTime@WTF@@QBENXZ + ?toFloat@MediaTime@WTF@@QBEMXZ + ?createWithDouble@MediaTime@WTF@@SA?AV12@NH@Z + ?createWithFloat@MediaTime@WTF@@SA?AV12@MH@Z + ?abs@WTF@@YA?AVMediaTime@1@ABV21@@Z + ?zeroTime@MediaTime@WTF@@SAABV12@XZ + ??GMediaTime@WTF@@QBE?AV01@ABV01@@Z + ??HMediaTime@WTF@@QBE?AV01@ABV01@@Z + ??1MediaTime@WTF@@QAE@XZ + ??0MediaTime@WTF@@QAE@_JHI@Z + ?indefiniteTime@MediaTime@WTF@@SAABV12@XZ + ?invalidTime@MediaTime@WTF@@SAABV12@XZ + ??8MediaTime@WTF@@QBE_NABV01@@Z + ??MMediaTime@WTF@@QBE_NABV01@@Z + ??OMediaTime@WTF@@QBE_NABV01@@Z + ?positiveInfiniteTime@MediaTime@WTF@@SAABV12@XZ + ?negativeInfiniteTime@MediaTime@WTF@@SAABV12@XZ WTFGetBacktrace WTFInvokeCrashHook WTFLog diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index a81416659..6caa07e6e 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -949,6 +949,7 @@ 0FC8150914043BD200CFA603 /* WriteBarrierSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WriteBarrierSupport.h; sourceTree = "<group>"; }; 0FC815121405118600CFA603 /* VTableSpectrum.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VTableSpectrum.cpp; sourceTree = "<group>"; }; 0FC815141405118D00CFA603 /* VTableSpectrum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTableSpectrum.h; sourceTree = "<group>"; }; + 0FCB408515C0A3C30048932B /* SlotVisitorInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlotVisitorInlineMethods.h; sourceTree = "<group>"; }; 0FD3C82014115CF800FD81CB /* DFGDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDriver.cpp; path = dfg/DFGDriver.cpp; sourceTree = "<group>"; }; 0FD3C82214115D0E00FD81CB /* DFGDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGDriver.h; path = dfg/DFGDriver.h; sourceTree = "<group>"; }; 0FD81ACF154FB4EB00983E72 /* DFGDominators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDominators.cpp; path = dfg/DFGDominators.cpp; sourceTree = "<group>"; }; @@ -1800,6 +1801,7 @@ 142D6F0F13539A4100B02E86 /* MarkStack.h */, 1497209014EB831500FEB1B7 /* PassWeak.h */, 14BA78F013AAB88F005B7C2C /* SlotVisitor.h */, + 0FCB408515C0A3C30048932B /* SlotVisitorInlineMethods.h */, 142E3132134FF0A600AFADB5 /* Strong.h */, 145722851437E140005FDE26 /* StrongInlines.h */, 141448CC13A1783700F5BA1A /* TinyBloomFilter.h */, diff --git a/Source/JavaScriptCore/assembler/ARMAssembler.h b/Source/JavaScriptCore/assembler/ARMAssembler.h index a0d7d27c3..87aed853e 100644 --- a/Source/JavaScriptCore/assembler/ARMAssembler.h +++ b/Source/JavaScriptCore/assembler/ARMAssembler.h @@ -817,11 +817,11 @@ namespace JSC { // Read pointers static void* readPointer(void* from) { - ARMWord* insn = reinterpret_cast<ARMWord*>(from); - ARMWord* addr = getLdrImmAddress(insn); - return *reinterpret_cast<void**>(addr); + ARMWord* instruction = reinterpret_cast<ARMWord*>(from); + ARMWord* address = getLdrImmAddress(instruction); + return *reinterpret_cast<void**>(address); } - + // Patch pointers static void linkPointer(void* code, AssemblerLabel from, void* to) @@ -829,14 +829,20 @@ namespace JSC { patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to); } - static void repatchInt32(void* from, int32_t to) + static void repatchInt32(void* where, int32_t to) { - patchPointerInternal(reinterpret_cast<intptr_t>(from), reinterpret_cast<void*>(to)); + patchPointerInternal(reinterpret_cast<intptr_t>(where), reinterpret_cast<void*>(to)); } - + static void repatchCompact(void* where, int32_t value) { - repatchInt32(where, value); + ARMWord* instruction = reinterpret_cast<ARMWord*>(where); + ASSERT((*instruction & 0x0f700000) == LoadUint32); + if (value >= 0) + *instruction = (*instruction & 0xff7ff000) | DT_UP | value; + else + *instruction = (*instruction & 0xff7ff000) | -value; + cacheFlush(instruction, sizeof(ARMWord)); } static void repatchPointer(void* from, void* to) diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARM.h b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h index 2773b022c..530f62b86 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -41,7 +41,6 @@ class MacroAssemblerARM : public AbstractMacroAssembler<ARMAssembler> { COMPILE_ASSERT(!(DoubleConditionBitSpecial & DoubleConditionMask), DoubleConditionBitSpecial_should_not_interfere_with_ARMAssembler_Condition_codes); public: typedef ARMRegisters::FPRegisterID FPRegisterID; - static const int MaximumCompactPtrAlignedAddressOffset = 0x7FFFFFFF; enum RelationalCondition { Equal = ARMAssembler::EQ, @@ -408,11 +407,20 @@ public: m_assembler.dtr_ur(ARMAssembler::LoadUint32, dest, address.base, ARMRegisters::S0); return dataLabel; } - + + static bool isCompactPtrAlignedAddressOffset(ptrdiff_t value) + { + return value >= -4095 && value <= 4095; + } + DataLabelCompact load32WithCompactAddressOffsetPatch(Address address, RegisterID dest) { DataLabelCompact dataLabel(this); - load32WithAddressOffsetPatch(address, dest); + ASSERT(isCompactPtrAlignedAddressOffset(address.offset)); + if (address.offset >= 0) + m_assembler.dtr_u(ARMAssembler::LoadUint32, dest, address.base, address.offset); + else + m_assembler.dtr_d(ARMAssembler::LoadUint32, dest, address.base, address.offset); return dataLabel; } diff --git a/Source/JavaScriptCore/dfg/DFGRepatch.cpp b/Source/JavaScriptCore/dfg/DFGRepatch.cpp index ee0c590a8..23e8db03b 100644 --- a/Source/JavaScriptCore/dfg/DFGRepatch.cpp +++ b/Source/JavaScriptCore/dfg/DFGRepatch.cpp @@ -839,8 +839,8 @@ static void emitPutTransitionStub( stubJit.addPtr(MacroAssembler::TrustedImm32(sizeof(JSValue)), scratchGPR1); // We have scratchGPR1 = new storage, scratchGPR3 = old storage, scratchGPR2 = available for (ptrdiff_t offset = 0; offset < static_cast<ptrdiff_t>(oldSize); offset += sizeof(void*)) { - stubJit.loadPtr(MacroAssembler::Address(scratchGPR3, -(offset + sizeof(JSValue) * 2)), scratchGPR2); - stubJit.storePtr(scratchGPR2, MacroAssembler::Address(scratchGPR1, -(offset + sizeof(JSValue) * 2))); + stubJit.loadPtr(MacroAssembler::Address(scratchGPR3, -(offset + sizeof(JSValue) + sizeof(void*))), scratchGPR2); + stubJit.storePtr(scratchGPR2, MacroAssembler::Address(scratchGPR1, -(offset + sizeof(JSValue) + sizeof(void*)))); } } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index 875ac39f0..179ad45fa 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -3197,8 +3197,8 @@ void SpeculativeJIT::compileReallocatePropertyStorage(Node& node) slowPathCall(slowPath, this, operationAllocatePropertyStorage, scratchGPR2, newSize)); // We have scratchGPR2 = new storage, scratchGPR1 = scratch for (ptrdiff_t offset = 0; offset < static_cast<ptrdiff_t>(oldSize); offset += sizeof(void*)) { - m_jit.loadPtr(JITCompiler::Address(oldStorageGPR, -(offset + sizeof(JSValue) * 2)), scratchGPR1); - m_jit.storePtr(scratchGPR1, JITCompiler::Address(scratchGPR2, -(offset + sizeof(JSValue) * 2))); + m_jit.loadPtr(JITCompiler::Address(oldStorageGPR, -(offset + sizeof(JSValue) + sizeof(void*))), scratchGPR1); + m_jit.storePtr(scratchGPR1, JITCompiler::Address(scratchGPR2, -(offset + sizeof(JSValue) + sizeof(void*)))); } m_jit.storePtr(scratchGPR2, JITCompiler::Address(baseGPR, JSObject::offsetOfOutOfLineStorage())); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index 0e412a199..f43323afd 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -2144,9 +2144,6 @@ public: // Initialize the object's classInfo pointer m_jit.storePtr(MacroAssembler::TrustedImmPtr(&ClassType::s_info), MacroAssembler::Address(resultGPR, JSCell::classInfoOffset())); - // Initialize the object's inheritorID. - m_jit.storePtr(MacroAssembler::TrustedImmPtr(0), MacroAssembler::Address(resultGPR, JSObject::offsetOfInheritorID())); - // Initialize the object's property storage pointer. m_jit.storePtr(MacroAssembler::TrustedImmPtr(0), MacroAssembler::Address(resultGPR, ClassType::offsetOfOutOfLineStorage())); } diff --git a/Source/JavaScriptCore/heap/Heap.h b/Source/JavaScriptCore/heap/Heap.h index a43be3df0..595e937ce 100644 --- a/Source/JavaScriptCore/heap/Heap.h +++ b/Source/JavaScriptCore/heap/Heap.h @@ -183,6 +183,7 @@ namespace JSC { void* allocateWithDestructor(size_t); void* allocateWithoutDestructor(size_t); + void* allocateStructure(); static const size_t minExtraCost = 256; static const size_t maxExtraCost = 1024 * 1024; @@ -367,7 +368,12 @@ namespace JSC { ASSERT(isValidAllocation(bytes)); return m_objectSpace.allocateWithoutDestructor(bytes); } - + + inline void* Heap::allocateStructure() + { + return m_objectSpace.allocateStructure(); + } + inline CheckedBoolean Heap::tryAllocateStorage(size_t bytes, void** outPtr) { return m_storageSpace.tryAllocate(bytes, outPtr); diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/Source/JavaScriptCore/heap/MachineStackMarker.cpp index 8e0c57b6a..7eb57479b 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.cpp +++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp @@ -141,8 +141,10 @@ MachineThreads::MachineThreads(Heap* heap) MachineThreads::~MachineThreads() { - if (m_threadSpecific) - ThreadSpecificKeyDelete(m_threadSpecific); + if (m_threadSpecific) { + int error = pthread_key_delete(m_threadSpecific); + ASSERT_UNUSED(error, !error); + } MutexLocker registeredThreadsLock(m_registeredThreadsMutex); for (Thread* t = m_registeredThreads; t;) { @@ -179,17 +181,19 @@ void MachineThreads::makeUsableFromMultipleThreads() if (m_threadSpecific) return; - ThreadSpecificKeyCreate(&m_threadSpecific, removeThread); + int error = pthread_key_create(&m_threadSpecific, removeThread); + if (error) + CRASH(); } void MachineThreads::addCurrentThread() { ASSERT(!m_heap->globalData()->exclusiveThread || m_heap->globalData()->exclusiveThread == currentThread()); - if (!m_threadSpecific || ThreadSpecificGet(m_threadSpecific)) + if (!m_threadSpecific || pthread_getspecific(m_threadSpecific)) return; - ThreadSpecificSet(m_threadSpecific, this); + pthread_setspecific(m_threadSpecific, this); Thread* thread = new Thread(getCurrentPlatformThread(), wtfThreadData().stack().origin()); MutexLocker lock(m_registeredThreadsMutex); diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.h b/Source/JavaScriptCore/heap/MachineStackMarker.h index 3d4aa22d4..5c7705fcf 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.h +++ b/Source/JavaScriptCore/heap/MachineStackMarker.h @@ -22,8 +22,8 @@ #ifndef MachineThreads_h #define MachineThreads_h +#include <pthread.h> #include <wtf/Noncopyable.h> -#include <wtf/ThreadSpecific.h> #include <wtf/ThreadingPrimitives.h> namespace JSC { @@ -55,7 +55,7 @@ namespace JSC { Heap* m_heap; Mutex m_registeredThreadsMutex; Thread* m_registeredThreads; - WTF::ThreadSpecificKey m_threadSpecific; + pthread_key_t m_threadSpecific; }; } // namespace JSC diff --git a/Source/JavaScriptCore/heap/MarkStack.cpp b/Source/JavaScriptCore/heap/MarkStack.cpp index 9c679b0ed..02a13077d 100644 --- a/Source/JavaScriptCore/heap/MarkStack.cpp +++ b/Source/JavaScriptCore/heap/MarkStack.cpp @@ -35,6 +35,7 @@ #include "JSCell.h" #include "JSObject.h" #include "ScopeChain.h" +#include "SlotVisitorInlineMethods.h" #include "Structure.h" #include "UString.h" #include "WriteBarrier.h" @@ -518,28 +519,25 @@ void SlotVisitor::startCopying() ASSERT(!m_copiedAllocator.isValid()); } -void* SlotVisitor::allocateNewSpace(void* ptr, size_t bytes) +void* SlotVisitor::allocateNewSpaceSlow(size_t bytes) { - if (CopiedSpace::isOversize(bytes)) { - m_shared.m_copiedSpace->pin(CopiedSpace::oversizeBlockFor(ptr)); - return 0; - } - - if (m_shared.m_copiedSpace->isPinned(ptr)) - return 0; - - void* result = 0; // Compilers don't realize that this will be assigned. - if (m_copiedAllocator.tryAllocate(bytes, &result)) - return result; - m_shared.m_copiedSpace->doneFillingBlock(m_copiedAllocator.resetCurrentBlock()); m_copiedAllocator.setCurrentBlock(m_shared.m_copiedSpace->allocateBlockForCopyingPhase()); + void* result = 0; CheckedBoolean didSucceed = m_copiedAllocator.tryAllocate(bytes, &result); ASSERT(didSucceed); return result; } +void* SlotVisitor::allocateNewSpaceOrPin(void* ptr, size_t bytes) +{ + if (!checkIfShouldCopyAndPinOtherwise(ptr, bytes)) + return 0; + + return allocateNewSpace(bytes); +} + ALWAYS_INLINE bool JSString::tryHashConstLock() { #if ENABLE(PARALLEL_GC) @@ -616,7 +614,7 @@ ALWAYS_INLINE void MarkStack::internalAppend(JSValue* slot) void SlotVisitor::copyAndAppend(void** ptr, size_t bytes, JSValue* values, unsigned length) { void* oldPtr = *ptr; - void* newPtr = allocateNewSpace(oldPtr, bytes); + void* newPtr = allocateNewSpaceOrPin(oldPtr, bytes); if (newPtr) { size_t jsValuesOffset = static_cast<size_t>(reinterpret_cast<char*>(values) - static_cast<char*>(oldPtr)); diff --git a/Source/JavaScriptCore/heap/MarkStack.h b/Source/JavaScriptCore/heap/MarkStack.h index ff25531a4..467a5bf46 100644 --- a/Source/JavaScriptCore/heap/MarkStack.h +++ b/Source/JavaScriptCore/heap/MarkStack.h @@ -253,6 +253,7 @@ namespace JSC { template<typename T> void appendUnbarrieredPointer(T**); + void appendUnbarrieredValue(JSValue*); void addOpaqueRoot(void*); bool containsOpaqueRoot(void*); @@ -453,6 +454,12 @@ namespace JSC { internalAppend(*slot); } + ALWAYS_INLINE void MarkStack::appendUnbarrieredValue(JSValue* slot) + { + ASSERT(slot); + internalAppend(*slot); + } + ALWAYS_INLINE void MarkStack::append(JSCell** slot) { ASSERT(slot); diff --git a/Source/JavaScriptCore/heap/MarkedAllocator.cpp b/Source/JavaScriptCore/heap/MarkedAllocator.cpp index 972728637..465e3a72a 100644 --- a/Source/JavaScriptCore/heap/MarkedAllocator.cpp +++ b/Source/JavaScriptCore/heap/MarkedAllocator.cpp @@ -29,15 +29,19 @@ bool MarkedAllocator::isPagedOut(double deadline) inline void* MarkedAllocator::tryAllocateHelper() { if (!m_freeList.head) { - for (MarkedBlock*& block = m_currentBlock; block; block = static_cast<MarkedBlock*>(block->next())) { + for (MarkedBlock*& block = m_blocksToSweep; block; block = static_cast<MarkedBlock*>(block->next())) { m_freeList = block->sweep(MarkedBlock::SweepToFreeList); - if (m_freeList.head) + if (m_freeList.head) { + m_currentBlock = block; break; + } block->didConsumeFreeList(); } - if (!m_freeList.head) + if (!m_freeList.head) { + m_currentBlock = 0; return 0; + } } MarkedBlock::FreeCell* head = m_freeList.head; @@ -92,7 +96,7 @@ void* MarkedAllocator::allocateSlowCase() MarkedBlock* MarkedAllocator::allocateBlock() { - MarkedBlock* block = MarkedBlock::create(m_heap->blockAllocator().allocate(), m_heap, m_cellSize, m_cellsNeedDestruction); + MarkedBlock* block = MarkedBlock::create(m_heap->blockAllocator().allocate(), m_heap, m_cellSize, m_cellsNeedDestruction, m_onlyContainsStructures); m_markedSpace->didAddBlock(block); return block; } @@ -100,10 +104,11 @@ MarkedBlock* MarkedAllocator::allocateBlock() void MarkedAllocator::addBlock(MarkedBlock* block) { ASSERT(!m_currentBlock); + ASSERT(!m_blocksToSweep); ASSERT(!m_freeList.head); m_blockList.append(block); - m_currentBlock = block; + m_blocksToSweep = m_currentBlock = block; m_freeList = block->sweep(MarkedBlock::SweepToFreeList); } @@ -113,6 +118,8 @@ void MarkedAllocator::removeBlock(MarkedBlock* block) m_currentBlock = static_cast<MarkedBlock*>(m_currentBlock->next()); m_freeList = MarkedBlock::FreeList(); } + if (m_blocksToSweep == block) + m_blocksToSweep = static_cast<MarkedBlock*>(m_blocksToSweep->next()); m_blockList.remove(block); } diff --git a/Source/JavaScriptCore/heap/MarkedAllocator.h b/Source/JavaScriptCore/heap/MarkedAllocator.h index 8b3620f08..47bae9451 100644 --- a/Source/JavaScriptCore/heap/MarkedAllocator.h +++ b/Source/JavaScriptCore/heap/MarkedAllocator.h @@ -24,6 +24,7 @@ public: void zapFreeList(); size_t cellSize() { return m_cellSize; } bool cellsNeedDestruction() { return m_cellsNeedDestruction; } + bool onlyContainsStructures() { return m_onlyContainsStructures; } void* allocate(); Heap* heap() { return m_heap; } @@ -31,7 +32,7 @@ public: void addBlock(MarkedBlock*); void removeBlock(MarkedBlock*); - void init(Heap*, MarkedSpace*, size_t cellSize, bool cellsNeedDestruction); + void init(Heap*, MarkedSpace*, size_t cellSize, bool cellsNeedDestruction, bool onlyContainsStructures); bool isPagedOut(double deadline); @@ -45,28 +46,33 @@ private: MarkedBlock::FreeList m_freeList; MarkedBlock* m_currentBlock; + MarkedBlock* m_blocksToSweep; DoublyLinkedList<HeapBlock> m_blockList; size_t m_cellSize; bool m_cellsNeedDestruction; + bool m_onlyContainsStructures; Heap* m_heap; MarkedSpace* m_markedSpace; }; inline MarkedAllocator::MarkedAllocator() : m_currentBlock(0) + , m_blocksToSweep(0) , m_cellSize(0) , m_cellsNeedDestruction(true) + , m_onlyContainsStructures(false) , m_heap(0) , m_markedSpace(0) { } -inline void MarkedAllocator::init(Heap* heap, MarkedSpace* markedSpace, size_t cellSize, bool cellsNeedDestruction) +inline void MarkedAllocator::init(Heap* heap, MarkedSpace* markedSpace, size_t cellSize, bool cellsNeedDestruction, bool onlyContainsStructures) { m_heap = heap; m_markedSpace = markedSpace; m_cellSize = cellSize; m_cellsNeedDestruction = cellsNeedDestruction; + m_onlyContainsStructures = onlyContainsStructures; } inline void* MarkedAllocator::allocate() @@ -82,7 +88,9 @@ inline void* MarkedAllocator::allocate() inline void MarkedAllocator::reset() { - m_currentBlock = static_cast<MarkedBlock*>(m_blockList.head()); + m_currentBlock = 0; + m_freeList = MarkedBlock::FreeList(); + m_blocksToSweep = static_cast<MarkedBlock*>(m_blockList.head()); } inline void MarkedAllocator::zapFreeList() diff --git a/Source/JavaScriptCore/heap/MarkedBlock.cpp b/Source/JavaScriptCore/heap/MarkedBlock.cpp index 01e4237cb..8ede87927 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.cpp +++ b/Source/JavaScriptCore/heap/MarkedBlock.cpp @@ -32,9 +32,9 @@ namespace JSC { -MarkedBlock* MarkedBlock::create(const PageAllocationAligned& allocation, Heap* heap, size_t cellSize, bool cellsNeedDestruction) +MarkedBlock* MarkedBlock::create(const PageAllocationAligned& allocation, Heap* heap, size_t cellSize, bool cellsNeedDestruction, bool onlyContainsStructures) { - return new (NotNull, allocation.base()) MarkedBlock(allocation, heap, cellSize, cellsNeedDestruction); + return new (NotNull, allocation.base()) MarkedBlock(allocation, heap, cellSize, cellsNeedDestruction, onlyContainsStructures); } PageAllocationAligned MarkedBlock::destroy(MarkedBlock* block) @@ -46,11 +46,12 @@ PageAllocationAligned MarkedBlock::destroy(MarkedBlock* block) return allocation; } -MarkedBlock::MarkedBlock(const PageAllocationAligned& allocation, Heap* heap, size_t cellSize, bool cellsNeedDestruction) +MarkedBlock::MarkedBlock(const PageAllocationAligned& allocation, Heap* heap, size_t cellSize, bool cellsNeedDestruction, bool onlyContainsStructures) : HeapBlock(allocation) , m_atomsPerCell((cellSize + atomSize - 1) / atomSize) , m_endAtom(atomsPerBlock - m_atomsPerCell + 1) , m_cellsNeedDestruction(cellsNeedDestruction) + , m_onlyContainsStructures(onlyContainsStructures) , m_state(New) // All cells start out unmarked. , m_weakSet(heap) { diff --git a/Source/JavaScriptCore/heap/MarkedBlock.h b/Source/JavaScriptCore/heap/MarkedBlock.h index c3c43752b..ff7840632 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.h +++ b/Source/JavaScriptCore/heap/MarkedBlock.h @@ -113,7 +113,7 @@ namespace JSC { ReturnType m_count; }; - static MarkedBlock* create(const PageAllocationAligned&, Heap*, size_t cellSize, bool cellsNeedDestruction); + static MarkedBlock* create(const PageAllocationAligned&, Heap*, size_t cellSize, bool cellsNeedDestruction, bool onlyContainsStructures); static PageAllocationAligned destroy(MarkedBlock*); static bool isAtomAligned(const void*); @@ -145,6 +145,7 @@ namespace JSC { size_t cellSize(); bool cellsNeedDestruction(); + bool onlyContainsStructures(); size_t size(); size_t capacity(); @@ -195,7 +196,7 @@ namespace JSC { typedef char Atom[atomSize]; - MarkedBlock(const PageAllocationAligned&, Heap*, size_t cellSize, bool cellsNeedDestruction); + MarkedBlock(const PageAllocationAligned&, Heap*, size_t cellSize, bool cellsNeedDestruction, bool onlyContainsStructures); Atom* atoms(); size_t atomNumber(const void*); void callDestructor(JSCell*); @@ -213,6 +214,7 @@ namespace JSC { WTF::Bitmap<atomsPerBlock, WTF::BitmapNotAtomic> m_marks; #endif bool m_cellsNeedDestruction; + bool m_onlyContainsStructures; BlockState m_state; WeakSet m_weakSet; }; @@ -322,6 +324,11 @@ namespace JSC { return m_cellsNeedDestruction; } + inline bool MarkedBlock::onlyContainsStructures() + { + return m_onlyContainsStructures; + } + inline size_t MarkedBlock::size() { return markCount() * cellSize(); diff --git a/Source/JavaScriptCore/heap/MarkedSpace.cpp b/Source/JavaScriptCore/heap/MarkedSpace.cpp index a742d8d9a..a9e9ef64d 100644 --- a/Source/JavaScriptCore/heap/MarkedSpace.cpp +++ b/Source/JavaScriptCore/heap/MarkedSpace.cpp @@ -80,14 +80,16 @@ MarkedSpace::MarkedSpace(Heap* heap) : m_heap(heap) { for (size_t cellSize = preciseStep; cellSize <= preciseCutoff; cellSize += preciseStep) { - allocatorFor(cellSize).init(heap, this, cellSize, false); - destructorAllocatorFor(cellSize).init(heap, this, cellSize, true); + allocatorFor(cellSize).init(heap, this, cellSize, false, false); + destructorAllocatorFor(cellSize).init(heap, this, cellSize, true, false); } for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) { - allocatorFor(cellSize).init(heap, this, cellSize, false); - destructorAllocatorFor(cellSize).init(heap, this, cellSize, true); + allocatorFor(cellSize).init(heap, this, cellSize, false, false); + destructorAllocatorFor(cellSize).init(heap, this, cellSize, true, false); } + + m_structureAllocator.init(heap, this, WTF::roundUpToMultipleOf(32, sizeof(Structure)), true, true); } MarkedSpace::~MarkedSpace() @@ -117,6 +119,8 @@ void MarkedSpace::resetAllocators() allocatorFor(cellSize).reset(); destructorAllocatorFor(cellSize).reset(); } + + m_structureAllocator.reset(); } void MarkedSpace::visitWeakSets(HeapRootVisitor& heapRootVisitor) @@ -141,6 +145,8 @@ void MarkedSpace::canonicalizeCellLivenessData() allocatorFor(cellSize).zapFreeList(); destructorAllocatorFor(cellSize).zapFreeList(); } + + m_structureAllocator.zapFreeList(); } bool MarkedSpace::isPagedOut(double deadline) @@ -155,6 +161,9 @@ bool MarkedSpace::isPagedOut(double deadline) return true; } + if (m_structureAllocator.isPagedOut(deadline)) + return true; + return false; } diff --git a/Source/JavaScriptCore/heap/MarkedSpace.h b/Source/JavaScriptCore/heap/MarkedSpace.h index 62d4e5d9e..d2a0688f1 100644 --- a/Source/JavaScriptCore/heap/MarkedSpace.h +++ b/Source/JavaScriptCore/heap/MarkedSpace.h @@ -80,7 +80,8 @@ public: MarkedAllocator& destructorAllocatorFor(size_t); void* allocateWithDestructor(size_t); void* allocateWithoutDestructor(size_t); - + void* allocateStructure(); + void resetAllocators(); void visitWeakSets(HeapRootVisitor&); @@ -132,6 +133,7 @@ private: Subspace m_destructorSpace; Subspace m_normalSpace; + MarkedAllocator m_structureAllocator; Heap* m_heap; MarkedBlockSet m_blocks; @@ -168,8 +170,12 @@ inline MarkedAllocator& MarkedSpace::allocatorFor(size_t bytes) inline MarkedAllocator& MarkedSpace::allocatorFor(MarkedBlock* block) { + if (block->onlyContainsStructures()) + return m_structureAllocator; + if (block->cellsNeedDestruction()) return destructorAllocatorFor(block->cellSize()); + return allocatorFor(block->cellSize()); } @@ -191,6 +197,11 @@ inline void* MarkedSpace::allocateWithDestructor(size_t bytes) return destructorAllocatorFor(bytes).allocate(); } +inline void* MarkedSpace::allocateStructure() +{ + return m_structureAllocator.allocate(); +} + template <typename Functor> inline typename Functor::ReturnType MarkedSpace::forEachBlock(Functor& functor) { for (size_t i = 0; i < preciseCount; ++i) { @@ -203,6 +214,8 @@ template <typename Functor> inline typename Functor::ReturnType MarkedSpace::for m_destructorSpace.impreciseAllocators[i].forEachBlock(functor); } + m_structureAllocator.forEachBlock(functor); + return functor.returnValue(); } diff --git a/Source/JavaScriptCore/heap/SlotVisitor.h b/Source/JavaScriptCore/heap/SlotVisitor.h index d16602f15..a31e88c08 100644 --- a/Source/JavaScriptCore/heap/SlotVisitor.h +++ b/Source/JavaScriptCore/heap/SlotVisitor.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -62,11 +62,23 @@ public: void finalizeUnconditionalFinalizers(); void startCopying(); + + // High-level API for copying, appropriate for cases where the object's heap references + // fall into a contiguous region of the storage chunk and if the object for which you're + // doing copying does not occur frequently. void copyAndAppend(void**, size_t, JSValue*, unsigned); + + // Low-level API for copying, appropriate for cases where the object's heap references + // are discontiguous or if the object occurs frequently enough that you need to focus on + // performance. Use this with care as it is easy to shoot yourself in the foot. + bool checkIfShouldCopyAndPinOtherwise(void* oldPtr, size_t); + void* allocateNewSpace(size_t); + void doneCopying(); private: - void* allocateNewSpace(void*, size_t); + void* allocateNewSpaceOrPin(void*, size_t); + void* allocateNewSpaceSlow(size_t); void donateKnownParallel(); diff --git a/Source/JavaScriptCore/heap/SlotVisitorInlineMethods.h b/Source/JavaScriptCore/heap/SlotVisitorInlineMethods.h new file mode 100644 index 000000000..f02564e10 --- /dev/null +++ b/Source/JavaScriptCore/heap/SlotVisitorInlineMethods.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SlotVisitorInlineMethods_h +#define SlotVisitorInlineMethods_h + +#include "CopiedSpaceInlineMethods.h" +#include "SlotVisitor.h" + +namespace JSC { + +ALWAYS_INLINE bool SlotVisitor::checkIfShouldCopyAndPinOtherwise(void* oldPtr, size_t bytes) +{ + if (CopiedSpace::isOversize(bytes)) { + m_shared.m_copiedSpace->pin(CopiedSpace::oversizeBlockFor(oldPtr)); + return false; + } + + if (m_shared.m_copiedSpace->isPinned(oldPtr)) + return false; + + return true; +} + +ALWAYS_INLINE void* SlotVisitor::allocateNewSpace(size_t bytes) +{ + void* result = 0; // Compilers don't realize that this will be assigned. + if (LIKELY(m_copiedAllocator.tryAllocate(bytes, &result))) + return result; + + result = allocateNewSpaceSlow(bytes); + ASSERT(result); + return result; +} + +} // namespace JSC + +#endif // SlotVisitorInlineMethods_h + diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h index 42a61ecdb..32bc1837d 100644 --- a/Source/JavaScriptCore/jit/JITInlineMethods.h +++ b/Source/JavaScriptCore/jit/JITInlineMethods.h @@ -425,9 +425,6 @@ template <typename ClassType, bool destructor, typename StructureType> inline vo // initialize the object's classInfo pointer storePtr(TrustedImmPtr(&ClassType::s_info), Address(result, JSCell::classInfoOffset())); - // initialize the inheritor ID - storePtr(TrustedImmPtr(0), Address(result, JSObject::offsetOfInheritorID())); - // initialize the object's property storage pointer storePtr(TrustedImmPtr(0), Address(result, ClassType::offsetOfOutOfLineStorage())); } diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter.asm index 492535bb2..2ae3e0cb2 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter.asm @@ -86,7 +86,7 @@ const HashFlags8BitBuffer = 64 # Property storage constants if JSVALUE64 - const InlineStorageCapacity = 4 + const InlineStorageCapacity = 5 else const InlineStorageCapacity = 6 end @@ -318,7 +318,6 @@ macro allocateBasicJSObject(sizeClassIndex, classInfoOffset, structure, result, loadp classInfoOffset[scratch1], scratch2 storep scratch2, [result] storep structure, JSCell::m_structure[result] - storep 0, JSObject::m_inheritorID[result] storep 0, JSObject::m_outOfLineStorage[result] end end diff --git a/Source/JavaScriptCore/profiler/Profile.cpp b/Source/JavaScriptCore/profiler/Profile.cpp index 49d6de97a..92e32c4ba 100644 --- a/Source/JavaScriptCore/profiler/Profile.cpp +++ b/Source/JavaScriptCore/profiler/Profile.cpp @@ -107,7 +107,7 @@ void Profile::debugPrintData() const m_head->debugPrintData(0); } -typedef pair<StringImpl*, unsigned> NameCountPair; +typedef WTF::KeyValuePair<FunctionCallHashCount::ValueType, unsigned> NameCountPair; static inline bool functionNameCountPairComparator(const NameCountPair& a, const NameCountPair& b) { diff --git a/Source/JavaScriptCore/runtime/DateConstructor.cpp b/Source/JavaScriptCore/runtime/DateConstructor.cpp index 0325080f6..5984bbf97 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.cpp +++ b/Source/JavaScriptCore/runtime/DateConstructor.cpp @@ -136,7 +136,7 @@ JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const Arg else { GregorianDateTime t; int year = JSC::toInt32(doubleArguments[0]); - t.setYear((year >= 0 && year <= 99) ? year : year - 1900); + t.setYear((year >= 0 && year <= 99) ? (year + 1900) : year); t.setMonth(JSC::toInt32(doubleArguments[1])); t.setMonthDay((numArgs >= 3) ? JSC::toInt32(doubleArguments[2]) : 1); t.setHour(JSC::toInt32(doubleArguments[3])); @@ -214,7 +214,7 @@ static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec) GregorianDateTime t; int year = JSC::toInt32(doubleArguments[0]); - t.setYear((year >= 0 && year <= 99) ? year : year - 1900); + t.setYear((year >= 0 && year <= 99) ? (year + 1900) : year); t.setMonth(JSC::toInt32(doubleArguments[1])); t.setMonthDay((n >= 3) ? JSC::toInt32(doubleArguments[2]) : 1); t.setHour(JSC::toInt32(doubleArguments[3])); diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp index e8714c14c..706ffe9a2 100644 --- a/Source/JavaScriptCore/runtime/DateConversion.cpp +++ b/Source/JavaScriptCore/runtime/DateConversion.cpp @@ -59,14 +59,14 @@ void formatDate(const GregorianDateTime &t, DateConversionBuffer& buffer) { snprintf(buffer, DateConversionBufferSize, "%s %s %02d %04d", weekdayName[(t.weekDay() + 6) % 7], - monthName[t.month()], t.monthDay(), t.year() + 1900); + monthName[t.month()], t.monthDay(), t.year()); } void formatDateUTCVariant(const GregorianDateTime &t, DateConversionBuffer& buffer) { snprintf(buffer, DateConversionBufferSize, "%s, %02d %s %04d", weekdayName[(t.weekDay() + 6) % 7], - t.monthDay(), monthName[t.month()], t.year() + 1900); + t.monthDay(), monthName[t.month()], t.year()); } void formatTime(const GregorianDateTime &t, DateConversionBuffer& buffer) diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp index aa65acd05..7cbab0497 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.cpp +++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp @@ -222,7 +222,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L #if OS(WINDOWS) SYSTEMTIME systemTime; memset(&systemTime, 0, sizeof(systemTime)); - systemTime.wYear = gdt.year() + 1900; + systemTime.wYear = gdt.year(); systemTime.wMonth = gdt.month() + 1; systemTime.wDay = gdt.monthDay(); systemTime.wDayOfWeek = gdt.weekDay(); @@ -265,7 +265,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L // Offset year if needed struct tm localTM = gdt; - int year = gdt.year() + 1900; + int year = gdt.year(); bool yearNeedsOffset = year < 1900 || year > 2038; if (yearNeedsOffset) localTM.tm_year = equivalentYearForDST(year) - 1900; @@ -412,7 +412,7 @@ static bool fillStructuresUsingDateArgs(ExecState *exec, int maxArgs, double *ms if (maxArgs >= 3 && idx < numArgs) { double years = exec->argument(idx++).toIntegerPreserveNaN(exec); ok = isfinite(years); - t->setYear(toInt32(years - 1900)); + t->setYear(toInt32(years)); } // months if (maxArgs >= 2 && idx < numArgs && ok) { @@ -567,10 +567,10 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec) int ms = static_cast<int>(fmod(thisDateObj->internalNumber(), msPerSecond)); if (ms < 0) ms += msPerSecond; - if (gregorianDateTime->year() > 8099 || gregorianDateTime->year() < -1900) - snprintf(buffer, sizeof(buffer) - 1, "%+07d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); + if (gregorianDateTime->year() > 9999 || gregorianDateTime->year() < 0) + snprintf(buffer, sizeof(buffer) - 1, "%+07d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); else - snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); + snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); buffer[sizeof(buffer) - 1] = 0; return JSValue::encode(jsNontrivialString(exec, buffer)); } @@ -657,7 +657,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) return JSValue::encode(jsNaN()); - return JSValue::encode(jsNumber(1900 + gregorianDateTime->year())); + return JSValue::encode(jsNumber(gregorianDateTime->year())); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec) @@ -671,7 +671,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) return JSValue::encode(jsNaN()); - return JSValue::encode(jsNumber(1900 + gregorianDateTime->year())); + return JSValue::encode(jsNumber(gregorianDateTime->year())); } EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec) @@ -1116,7 +1116,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec) return JSValue::encode(result); } - gregorianDateTime.setYear(toInt32((year > 99 || year < 0) ? year - 1900 : year)); + gregorianDateTime.setYear(toInt32((year >= 0 && year <= 99) ? (year + 1900) : year)); JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, false)); thisDateObj->setInternalValue(exec->globalData(), result); return JSValue::encode(result); @@ -1135,7 +1135,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec) return JSValue::encode(jsNaN()); // NOTE: IE returns the full year even in getYear. - return JSValue::encode(jsNumber(gregorianDateTime->year())); + return JSValue::encode(jsNumber(gregorianDateTime->year() - 1900)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec) diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h index 52c591324..c0b9916d1 100644 --- a/Source/JavaScriptCore/runtime/JSArray.h +++ b/Source/JavaScriptCore/runtime/JSArray.h @@ -287,9 +287,6 @@ namespace JSC { static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - JS_EXPORT_PRIVATE void* subclassData() const; - JS_EXPORT_PRIVATE void setSubclassData(void*); - private: static size_t storageSize(unsigned vectorLength); bool isLengthWritable() @@ -304,7 +301,6 @@ namespace JSC { void allocateSparseMap(JSGlobalData&); void deallocateSparseMap(); - bool getOwnPropertySlotSlowCase(ExecState*, unsigned propertyName, PropertySlot&); void putByIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); JS_EXPORT_PRIVATE bool putDirectIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); diff --git a/Source/JavaScriptCore/runtime/JSDateMath.cpp b/Source/JavaScriptCore/runtime/JSDateMath.cpp index a7840938c..fcf1c4345 100644 --- a/Source/JavaScriptCore/runtime/JSDateMath.cpp +++ b/Source/JavaScriptCore/runtime/JSDateMath.cpp @@ -203,7 +203,7 @@ double getUTCOffset(ExecState* exec) double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double milliSeconds, bool inputIsUTC) { - double day = dateToDaysFrom1970(t.year() + 1900, t.month(), t.monthDay()); + double day = dateToDaysFrom1970(t.year(), t.month(), t.monthDay()); double ms = timeToMS(t.hour(), t.minute(), t.second(), milliSeconds); double result = (day * WTF::msPerDay) + ms; @@ -235,7 +235,7 @@ void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, Gregori tm.setYearDay(dayInYear(ms, year)); tm.setMonthDay(dayInMonthFromDayInYear(tm.yearDay(), isLeapYear(year))); tm.setMonth(monthFromDayInYear(tm.yearDay(), isLeapYear(year))); - tm.setYear(year - 1900); + tm.setYear(year); tm.setIsDST(dstOff != 0.0); tm.setUtcOffset(static_cast<long>((dstOff + utcOff) / WTF::msPerSecond)); } diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h index 59a672f67..4604737d2 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.h +++ b/Source/JavaScriptCore/runtime/JSGlobalData.h @@ -39,6 +39,7 @@ #include "JSValue.h" #include "LLIntData.h" #include "NumericStrings.h" +#include "PrivateName.h" #include "SmallStrings.h" #include "Strong.h" #include "Terminator.h" @@ -293,6 +294,8 @@ namespace JSC { bool canUseRegExpJIT() { return m_canUseAssembler; } #endif + PrivateName m_inheritorIDKey; + OwnPtr<ParserArena> parserArena; OwnPtr<Keywords> keywords; Interpreter* interpreter; diff --git a/Source/JavaScriptCore/runtime/JSGlobalThis.cpp b/Source/JavaScriptCore/runtime/JSGlobalThis.cpp index abd31ac14..b2bbae5d7 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalThis.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalThis.cpp @@ -53,7 +53,7 @@ void JSGlobalThis::setUnwrappedObject(JSGlobalData& globalData, JSGlobalObject* ASSERT_ARG(globalObject, globalObject); m_unwrappedObject.set(globalData, this, globalObject); setPrototype(globalData, globalObject->prototype()); - resetInheritorID(); + resetInheritorID(globalData); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index a84597f8b..c40c625e1 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -38,6 +38,7 @@ #include "Operations.h" #include "PropertyDescriptor.h" #include "PropertyNameArray.h" +#include "SlotVisitorInlineMethods.h" #include <math.h> #include <wtf/Assertions.h> @@ -85,6 +86,31 @@ static inline void getClassPropertyNames(ExecState* exec, const ClassInfo* class } } +ALWAYS_INLINE void JSObject::visitOutOfLineStorage(SlotVisitor& visitor, PropertyStorage storage, size_t storageSize) +{ + ASSERT(storage); + ASSERT(storageSize); + + size_t capacity = structure()->outOfLineCapacity(); + ASSERT(capacity); + size_t capacityInBytes = capacity * sizeof(WriteBarrierBase<Unknown>); + PropertyStorage baseOfStorage = storage - capacity - 1; + if (visitor.checkIfShouldCopyAndPinOtherwise(baseOfStorage, capacityInBytes)) { + PropertyStorage newBaseOfStorage = static_cast<PropertyStorage>(visitor.allocateNewSpace(capacityInBytes)); + PropertyStorage currentTarget = newBaseOfStorage + capacity; + PropertyStorage newStorage = currentTarget + 1; + PropertyStorage currentSource = storage - 1; + for (size_t count = storageSize; count--;) { + JSValue value = (--currentSource)->get(); + ASSERT(value); + visitor.appendUnbarrieredValue(&value); + (--currentTarget)->setWithoutWriteBarrier(value); + } + m_outOfLineStorage.set(newStorage, StorageBarrier::Unchecked); + } else + visitor.appendValues(storage - storageSize - 1, storageSize); +} + void JSObject::visitChildren(JSCell* cell, SlotVisitor& visitor) { JSObject* thisObject = jsCast<JSObject*>(cell); @@ -97,18 +123,8 @@ void JSObject::visitChildren(JSCell* cell, SlotVisitor& visitor) JSCell::visitChildren(thisObject, visitor); PropertyStorage storage = thisObject->outOfLineStorage(); - if (storage) { - size_t storageSize = thisObject->structure()->outOfLineSizeForKnownNonFinalObject(); - size_t capacity = thisObject->structure()->outOfLineCapacity(); - // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. - void* temp = storage - capacity - 1; - visitor.copyAndAppend(&temp, capacity * sizeof(WriteBarrierBase<Unknown>), (storage - storageSize - 1)->slot(), storageSize); - storage = static_cast<PropertyStorage>(temp) + capacity + 1; - thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked); - } - - if (thisObject->m_inheritorID) - visitor.append(&thisObject->m_inheritorID); + if (storage) + thisObject->visitOutOfLineStorage(visitor, storage, thisObject->structure()->outOfLineSizeForKnownNonFinalObject()); #if !ASSERT_DISABLED visitor.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation; @@ -127,18 +143,8 @@ void JSFinalObject::visitChildren(JSCell* cell, SlotVisitor& visitor) JSCell::visitChildren(thisObject, visitor); PropertyStorage storage = thisObject->outOfLineStorage(); - if (storage) { - size_t storageSize = thisObject->structure()->outOfLineSizeForKnownFinalObject(); - size_t capacity = thisObject->structure()->outOfLineCapacity(); - // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. - void* temp = storage - capacity - 1; - visitor.copyAndAppend(&temp, thisObject->structure()->outOfLineCapacity() * sizeof(WriteBarrierBase<Unknown>), (storage - storageSize - 1)->slot(), storageSize); - storage = static_cast<PropertyStorage>(temp) + capacity + 1; - thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked); - } - - if (thisObject->m_inheritorID) - visitor.append(&thisObject->m_inheritorID); + if (storage) + thisObject->visitOutOfLineStorage(visitor, storage, thisObject->structure()->outOfLineSizeForKnownFinalObject()); size_t storageSize = thisObject->structure()->inlineSizeForKnownFinalObject(); visitor.appendValues(thisObject->inlineStorage(), storageSize); @@ -580,15 +586,21 @@ NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, WriteBarr Structure* JSObject::createInheritorID(JSGlobalData& globalData) { + ASSERT(!getDirectLocation(globalData, globalData.m_inheritorIDKey)); + JSGlobalObject* globalObject; if (isGlobalThis()) globalObject = static_cast<JSGlobalThis*>(this)->unwrappedObject(); else globalObject = structure()->globalObject(); ASSERT(globalObject); - m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, globalObject, this)); - ASSERT(m_inheritorID->isEmpty()); - return m_inheritorID.get(); + + Structure* inheritorID = createEmptyObjectStructure(globalData, globalObject, this); + ASSERT(inheritorID->isEmpty()); + + PutPropertySlot slot; + putDirectInternal<PutModeDefineOwnProperty>(globalData, globalData.m_inheritorIDKey, inheritorID, DontEnum, slot, 0); + return inheritorID; } PropertyStorage JSObject::growOutOfLineStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize) diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h index cc43440ab..82da5eef9 100644 --- a/Source/JavaScriptCore/runtime/JSObject.h +++ b/Source/JavaScriptCore/runtime/JSObject.h @@ -272,7 +272,6 @@ namespace JSC { JS_EXPORT_PRIVATE PropertyStorage growOutOfLineStorage(JSGlobalData&, size_t oldSize, size_t newSize); void setOutOfLineStorage(JSGlobalData&, PropertyStorage, Structure*); - bool reallocateStorageIfNecessary(JSGlobalData&, unsigned oldCapacity, Structure*); void setStructureAndReallocateStorageIfNecessary(JSGlobalData&, unsigned oldCapacity, Structure*); void setStructureAndReallocateStorageIfNecessary(JSGlobalData&, Structure*); @@ -295,7 +294,6 @@ namespace JSC { static size_t offsetOfInlineStorage(); static size_t offsetOfOutOfLineStorage(); - static size_t offsetOfInheritorID(); static JS_EXPORTDATA const ClassInfo s_info; @@ -322,10 +320,12 @@ namespace JSC { // To create derived types you likely want JSNonFinalObject, below. JSObject(JSGlobalData&, Structure*); - void resetInheritorID() + void resetInheritorID(JSGlobalData& globalData) { - m_inheritorID.clear(); + removeDirect(globalData, globalData.m_inheritorIDKey); } + + void visitOutOfLineStorage(SlotVisitor&, PropertyStorage, size_t storageSize); private: friend class LLIntOffsetsExtractor; @@ -348,7 +348,9 @@ namespace JSC { Structure* createInheritorID(JSGlobalData&); StorageBarrier m_outOfLineStorage; - WriteBarrier<Structure> m_inheritorID; +#if USE(JSVALUE32_64) + void* m_padding; +#endif }; @@ -461,11 +463,6 @@ inline size_t JSObject::offsetOfOutOfLineStorage() return OBJECT_OFFSETOF(JSObject, m_outOfLineStorage); } -inline size_t JSObject::offsetOfInheritorID() -{ - return OBJECT_OFFSETOF(JSObject, m_inheritorID); -} - inline bool JSObject::isGlobalObject() const { return structure()->typeInfo().type() == GlobalObjectType; @@ -564,9 +561,10 @@ inline void JSObject::setPrototype(JSGlobalData& globalData, JSValue prototype) inline Structure* JSObject::inheritorID(JSGlobalData& globalData) { - if (m_inheritorID) { - ASSERT(m_inheritorID->isEmpty()); - return m_inheritorID.get(); + if (WriteBarrierBase<Unknown>* location = getDirectLocation(globalData, globalData.m_inheritorIDKey)) { + Structure* inheritorID = jsCast<Structure*>(location->get()); + ASSERT(inheritorID->isEmpty()); + return inheritorID; } return createInheritorID(globalData); } diff --git a/Source/JavaScriptCore/runtime/PropertyNameArray.h b/Source/JavaScriptCore/runtime/PropertyNameArray.h index dabda945b..89b1af00b 100644 --- a/Source/JavaScriptCore/runtime/PropertyNameArray.h +++ b/Source/JavaScriptCore/runtime/PropertyNameArray.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 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 @@ -55,14 +55,12 @@ namespace JSC { PropertyNameArray(JSGlobalData* globalData) : m_data(PropertyNameArrayData::create()) , m_globalData(globalData) - , m_shouldCache(true) { } PropertyNameArray(ExecState* exec) : m_data(PropertyNameArrayData::create()) , m_globalData(&exec->globalData()) - , m_shouldCache(true) { } @@ -91,7 +89,6 @@ namespace JSC { RefPtr<PropertyNameArrayData> m_data; IdentifierSet m_set; JSGlobalData* m_globalData; - bool m_shouldCache; }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/PropertyOffset.h b/Source/JavaScriptCore/runtime/PropertyOffset.h index 3883d910f..511c5e334 100644 --- a/Source/JavaScriptCore/runtime/PropertyOffset.h +++ b/Source/JavaScriptCore/runtime/PropertyOffset.h @@ -36,7 +36,7 @@ namespace JSC { #if USE(JSVALUE32_64) #define INLINE_STORAGE_CAPACITY 6 #else -#define INLINE_STORAGE_CAPACITY 4 +#define INLINE_STORAGE_CAPACITY 5 #endif typedef int PropertyOffset; diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index 712ea6bb5..8e41781e2 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -68,14 +68,7 @@ namespace JSC { typedef JSCell Base; - static Structure* create(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo) - { - ASSERT(globalData.structureStructure); - ASSERT(classInfo); - Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo); - structure->finishCreation(globalData); - return structure; - } + static Structure* create(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*); protected: void finishCreation(JSGlobalData& globalData) @@ -330,13 +323,7 @@ namespace JSC { return OBJECT_OFFSETOF(Structure, m_typeInfo) + TypeInfo::typeOffset(); } - static Structure* createStructure(JSGlobalData& globalData) - { - ASSERT(!globalData.structureStructure); - Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData); - structure->finishCreation(globalData, CreatingEarlyCell); - return structure; - } + static Structure* createStructure(JSGlobalData&); bool transitionWatchpointSetHasBeenInvalidated() const { @@ -368,13 +355,7 @@ namespace JSC { Structure(JSGlobalData&); Structure(JSGlobalData&, const Structure*); - static Structure* create(JSGlobalData& globalData, const Structure* structure) - { - ASSERT(globalData.structureStructure); - Structure* newStructure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, structure); - newStructure->finishCreation(globalData); - return newStructure; - } + static Structure* create(JSGlobalData&, const Structure*); typedef enum { NoneDictionaryKind = 0, @@ -461,6 +442,42 @@ namespace JSC { unsigned m_staticFunctionReified; }; + template <> inline void* allocateCell<Structure>(Heap& heap) + { +#if ENABLE(GC_VALIDATION) + ASSERT(!heap.globalData()->isInitializingObject()); + heap.globalData()->setInitializingObjectClass(&Structure::s_info); +#endif + JSCell* result = static_cast<JSCell*>(heap.allocateStructure()); + result->clearStructure(); + return result; + } + + inline Structure* Structure::create(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo) + { + ASSERT(globalData.structureStructure); + ASSERT(classInfo); + Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo); + structure->finishCreation(globalData); + return structure; + } + + inline Structure* Structure::createStructure(JSGlobalData& globalData) + { + ASSERT(!globalData.structureStructure); + Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData); + structure->finishCreation(globalData, CreatingEarlyCell); + return structure; + } + + inline Structure* Structure::create(JSGlobalData& globalData, const Structure* structure) + { + ASSERT(globalData.structureStructure); + Structure* newStructure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, structure); + newStructure->finishCreation(globalData); + return newStructure; + } + inline PropertyOffset Structure::get(JSGlobalData& globalData, PropertyName propertyName) { ASSERT(structure()->classInfo() == &s_info); diff --git a/Source/JavaScriptCore/tools/ProfileTreeNode.h b/Source/JavaScriptCore/tools/ProfileTreeNode.h index 9de39ad8a..7b51efb85 100644 --- a/Source/JavaScriptCore/tools/ProfileTreeNode.h +++ b/Source/JavaScriptCore/tools/ProfileTreeNode.h @@ -30,7 +30,7 @@ namespace JSC { class ProfileTreeNode { typedef HashMap<String, ProfileTreeNode> Map; - typedef std::pair<String, ProfileTreeNode> MapEntry; + typedef Map::ValueType MapEntry; public: ProfileTreeNode() diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index 9eefd2bb3..442098c96 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,82 @@ +2012-07-25 Min Qin <qinmin@chromium.org> + + Upstream declaration of WebGraphicsContext3D::createStreamTextureCHROMIUM() for android + https://bugs.webkit.org/show_bug.cgi?id=92308 + + Reviewed by Adam Barth. + + For android, we need 2 calls to create and destroy the stream texture. + This change adds the interface for these 2 calls. + The actual implementation will be in webgraphicscontext3d_in_process_impl and webgraphicscontext3d_command_buffer_impl. + + * chromium/public/WebGraphicsContext3D.h: + (WebGraphicsContext3D): + (WebKit::WebGraphicsContext3D::createStreamTextureCHROMIUM): + (WebKit::WebGraphicsContext3D::destroyStreamTextureCHROMIUM): + +2012-07-25 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Update MediaStreamTrack to match the specification + https://bugs.webkit.org/show_bug.cgi?id=90180 + + Reviewed by Adam Barth. + + * chromium/public/WebMediaStreamDescriptor.h: + (WebMediaStreamDescriptor): + * chromium/public/WebMediaStreamSource.h: + (WebMediaStreamSource): + +2012-07-24 Dave Tu <dtu@chromium.org> + + [chromium] Add time spent painting to GPU benchmarking renderingStats() API. + https://bugs.webkit.org/show_bug.cgi?id=90019 + + Reviewed by Adrienne Walker. + + * chromium/public/WebRenderingStats.h: + (WebRenderingStats): + (WebKit::WebRenderingStats::WebRenderingStats): + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123499. + http://trac.webkit.org/changeset/123499 + https://bugs.webkit.org/show_bug.cgi?id=92161 + + Android fails to compile (Requested by zhenyao on #webkit). + + * chromium/public/WebMediaStreamDescriptor.h: + (WebMediaStreamDescriptor): + * chromium/public/WebMediaStreamSource.h: + (WebMediaStreamSource): + +2012-07-24 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Enable conversion between WebFloatRect and gfx::RectF. + https://bugs.webkit.org/show_bug.cgi?id=92117 + + Reviewed by Adam Barth. + + Introduce WebFloatRect <--> gfx::RectF conversion as we already do with WebRect <--> gfx::Rect. + + * chromium/public/WebFloatRect.h: + (WebKit::WebFloatRect::WebFloatRect): + (WebFloatRect): + (WebKit::WebFloatRect::operator=): + (WebKit::WebFloatRect::operator gfx::RectF): + +2012-07-24 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Update MediaStreamTrack to match the specification + https://bugs.webkit.org/show_bug.cgi?id=90180 + + Reviewed by Adam Barth. + + * chromium/public/WebMediaStreamDescriptor.h: + (WebMediaStreamDescriptor): + * chromium/public/WebMediaStreamSource.h: + (WebMediaStreamSource): + 2012-07-23 Dave Tu <dtu@chromium.org> [chromium] Add droppedFrameCount to renderingStats. diff --git a/Source/Platform/chromium/public/WebFloatRect.h b/Source/Platform/chromium/public/WebFloatRect.h index a883513fc..9fece4d56 100644 --- a/Source/Platform/chromium/public/WebFloatRect.h +++ b/Source/Platform/chromium/public/WebFloatRect.h @@ -35,6 +35,8 @@ #if WEBKIT_IMPLEMENTATION #include "FloatRect.h" +#else +#include <ui/gfx/rect_f.h> #endif namespace WebKit { @@ -48,10 +50,10 @@ struct WebFloatRect { bool isEmpty() const { return width <= 0 || height <= 0; } WebFloatRect() - : x(0.0f) - , y(0.0f) - , width(0.0f) - , height(0.0f) + : x(0) + , y(0) + , width(0) + , height(0) { } @@ -85,6 +87,28 @@ struct WebFloatRect { { return WebCore::FloatRect(x, y, width, height); } +#else + WebFloatRect(const gfx::RectF& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebFloatRect& operator=(const gfx::RectF& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator gfx::RectF() const + { + return gfx::RectF(x, y, width, height); + } #endif }; diff --git a/Source/Platform/chromium/public/WebGraphicsContext3D.h b/Source/Platform/chromium/public/WebGraphicsContext3D.h index e7d7a64b4..ae71c9a65 100644 --- a/Source/Platform/chromium/public/WebGraphicsContext3D.h +++ b/Source/Platform/chromium/public/WebGraphicsContext3D.h @@ -221,6 +221,12 @@ public: // GL_CHROMIUM_rate_limit_offscreen_context virtual void rateLimitOffscreenContextCHROMIUM() { } + // GL_CHROMIUM_stream_texture + // Returns the stream end point identifier created for the given texture. + virtual WebGLId createStreamTextureCHROMIUM(WebGLId texture) { return 0; } + // Destroys the stream for the given texture. + virtual void destroyStreamTextureCHROMIUM(WebGLId texture) { } + // The entry points below map directly to the OpenGL ES 2.0 API. // See: http://www.khronos.org/registry/gles/ // and: http://www.khronos.org/opengles/sdk/docs/man/ diff --git a/Source/Platform/chromium/public/WebMediaStreamDescriptor.h b/Source/Platform/chromium/public/WebMediaStreamDescriptor.h index c25f42e1b..d1b385367 100644 --- a/Source/Platform/chromium/public/WebMediaStreamDescriptor.h +++ b/Source/Platform/chromium/public/WebMediaStreamDescriptor.h @@ -68,9 +68,6 @@ public: WEBKIT_EXPORT WebString label() const; - // DEPRECATED - WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const; - WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamComponent>&) const; WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamComponent>&) const; diff --git a/Source/Platform/chromium/public/WebMediaStreamSource.h b/Source/Platform/chromium/public/WebMediaStreamSource.h index 142d59866..01aa8cf7f 100644 --- a/Source/Platform/chromium/public/WebMediaStreamSource.h +++ b/Source/Platform/chromium/public/WebMediaStreamSource.h @@ -50,6 +50,12 @@ public: TypeVideo }; + enum ReadyState { + ReadyStateLive = 0, + ReadyStateMuted = 1, + ReadyStateEnded = 2 + }; + WebMediaStreamSource() { } WebMediaStreamSource(const WebMediaStreamSource& other) { assign(other); } ~WebMediaStreamSource() { reset(); } @@ -70,6 +76,9 @@ public: WEBKIT_EXPORT Type type() const; WEBKIT_EXPORT WebString name() const; + WEBKIT_EXPORT void setReadyState(ReadyState); + WEBKIT_EXPORT ReadyState readyState() const; + #if WEBKIT_IMPLEMENTATION WebMediaStreamSource(const WTF::PassRefPtr<WebCore::MediaStreamSource>&); WebMediaStreamSource& operator=(WebCore::MediaStreamSource*); diff --git a/Source/Platform/chromium/public/WebRenderingStats.h b/Source/Platform/chromium/public/WebRenderingStats.h index e24af2b69..404776378 100644 --- a/Source/Platform/chromium/public/WebRenderingStats.h +++ b/Source/Platform/chromium/public/WebRenderingStats.h @@ -32,11 +32,15 @@ struct WebRenderingStats { int numAnimationFrames; int numFramesSentToScreen; int droppedFrameCount; + double totalPaintTimeInSeconds; + double totalRasterizeTimeInSeconds; WebRenderingStats() : numAnimationFrames(0) , numFramesSentToScreen(0) , droppedFrameCount(0) + , totalPaintTimeInSeconds(0) + , totalRasterizeTimeInSeconds(0) { } }; diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 72543899f..0c6d5d430 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,487 @@ +2012-07-28 Patrick Gansterer <paroga@webkit.org> + + [WIN] Add missing export macro to friend decleration. + + Since the __declspec is part of the function signature + on windows, we need it at all friend declerations too. + + * wtf/MediaTime.h: + +2012-07-28 Patrick Gansterer <paroga@webkit.org> + + [CMake] Add missing MediaTime files after r123878. + + * wtf/CMakeLists.txt: + +2012-07-28 Patrick Gansterer <paroga@webkit.org> + + Remove obsolete functions from WTF::Unicode + https://bugs.webkit.org/show_bug.cgi?id=92571 + + Reviewed by Kentaro Hara. + + Remove hasLineBreakingPropertyComplexContextOrIdeographic() and digitValue(), + since they are never used and defined for a few Unicode backends only. + + * wtf/unicode/glib/UnicodeGLib.h: + * wtf/unicode/icu/UnicodeIcu.h: + +2012-07-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123679. + http://trac.webkit.org/changeset/123679 + https://bugs.webkit.org/show_bug.cgi?id=92565 + + Slowed down HTML parsing by 3.6% (Requested by abarth on + #webkit). + + * wtf/text/WTFString.h: + +2012-07-27 Arnaud Renevier <a.renevier@sisa.samsung.com> + + use createUninitialized when creating TypedArray from another array + https://bugs.webkit.org/show_bug.cgi?id=92518 + + Reviewed by Kenneth Russell. + + Expose a createUninitialized static method on TypedArray classes. + + * wtf/Float32Array.h: + (Float32Array): + (WTF::Float32Array::createUninitialized): + (WTF): + * wtf/Float64Array.h: + (Float64Array): + (WTF::Float64Array::createUninitialized): + (WTF): + * wtf/Int16Array.h: + (Int16Array): + (WTF::Int16Array::createUninitialized): + (WTF): + * wtf/Int32Array.h: + (Int32Array): + (WTF::Int32Array::createUninitialized): + (WTF): + * wtf/Int8Array.h: + (Int8Array): + (WTF::Int8Array::createUninitialized): + (WTF): + * wtf/Uint16Array.h: + (Uint16Array): + (WTF::Uint16Array::createUninitialized): + (WTF): + * wtf/Uint32Array.h: + (Uint32Array): + (WTF::Uint32Array::createUninitialized): + (WTF): + * wtf/Uint8Array.h: + (Uint8Array): + (WTF::Uint8Array::createUninitialized): + (WTF): + * wtf/Uint8ClampedArray.h: + (Uint8ClampedArray): + +2012-07-27 Patrick Gansterer <paroga@webkit.org> + + [WINCE] Use macros from ICU instead of defining the same functionality again + https://bugs.webkit.org/show_bug.cgi?id=92530 + + Reviewed by Ryosuke Niwa. + + Replace isHighSurrogate() with U16_IS_LEAD(), isLowSurrogate() with + U16_IS_TRAIL() and surrogateToUcs4() with U16_GET_SUPPLEMENTARY(). + + * wtf/unicode/wince/UnicodeWinCE.h: + +2012-07-27 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] Fix build after r123917 + https://bugs.webkit.org/show_bug.cgi?id=92555 + + Unreviewed. + + * wtf/GregorianDateTime.h: Needs string.h for memset(). + +2012-07-27 Paweł Forysiuk <tuxator@o2.pl> + + MinGW build fails because of missing header in GregorianDateTime.h + https://bugs.webkit.org/show_bug.cgi?id=92531 + + * wtf/GregorianDateTime.h: Include time.h + +2012-07-27 Jer Noble <jer.noble@apple.com> + + Unreviewed build fix. + + Use MathExtras.h and the non std:: versions of isnan and signbit. + + * wtf/MediaTime.cpp: + (WTF::MediaTime::createWithFloat): + (WTF::MediaTime::createWithDouble): + +2012-07-27 Jer Noble <jer.noble@apple.com> + + Support a rational time class for use by media elements. + https://bugs.webkit.org/show_bug.cgi?id=88787 + + Reviewed by Eric Carlson. + + Add a new MediaTime class which implements rational math operations. + + Add common constructors and assignment operators: + * wtf/MediaTime.cpp: Added. + (WTF::MediaTime::MediaTime): + (WTF::MediaTime::~MediaTime): + (WTF::MediaTime::operator=): + + Add common math operators: + * wtf/MediaTime.cpp: + (WTF::MediaTime::operator+): + (WTF::MediaTime::operator-): + (WTF::MediaTime::operator<): + (WTF::MediaTime::operator>): + (WTF::MediaTime::operator==): + (WTF::MediaTime::operator>=): + (WTF::MediaTime::operator<=): + + Add functions to check the MeiaTime time type flags: + * wtf/MediaTime.h: + (WTF::MediaTime::isValid): + (WTF::MediaTime::isInvalid): + (WTF::MediaTime::hasBeenRounde): + (WTF::MediaTime::isPositiveInfinite): + (WTF::MediaTime::isNegativeInfinite): + (WTF::MediaTime::isIndefinite): + + Add constants for commonly used MediaTime values: + (WTF::MediaTime::zeroTime): + (WTF::MediaTime::invalidTime): + (WTF::MediaTime::positiveInfiniteTime): + (WTF::MediaTime::negativeInfiniteTime): + (WTF::MediaTime::indefiniteTime): + + Add explicit conversion functions to convert to and from floating point values. + * wtf/MediaTime.cpp: + (WTF::MediaTime::createWithFloat): + (WTF::MediaTime::createWithDouble): + (WTF::MediaTime::toFloat): + (WTF::MediaTime::toDouble): + + Add some useful exported functions: + * wtf/MediaTime.cpp: + (WTF::MediaTime::compare): Master function for the comparison operators above. + (WTF::MediaTime::setTimeScale): Rescale the time value to a new time scale. + (WTF::abs): Return an absolute value for the current MediaTime. + + Static utility functions to implement the above: + * wtf/MediaTime.cpp: + (WTF::greatestCommonDivisor): + (WTF::leastCommonMultiple): + (WTF::signum): + + Windows-only implementations of isinf and signbit: + * wtf/MediaTime.cpp: + (std::isinf): + (std::signbit): + + Add the new class to platform build files: + * GNUmakefile.list.am: + * WTF.gypi: + * WTF.pro: + * WTF.vcproj/WTF.vcproj: + * WTF.xcodeproj/project.pbxproj: + +2012-07-27 Wei James <james.wei@intel.com> + + set WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED for chromium android + https://bugs.webkit.org/show_bug.cgi?id=91746 + + Reviewed by Adam Barth. + + This patch is part of efforts to enable web audio for chromium android. + Web audio component needs to use atomicIncrement and atomicDecrement, + which are enabled by this MACRO. + + As mentioned in https://bugs.webkit.org/show_bug.cgi?id=89428#c19, make + this patch standalone. + + * wtf/Atomics.h: + (WTF): + +2012-07-27 Wei James <james.wei@intel.com> + + set WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED for chromium android + https://bugs.webkit.org/show_bug.cgi?id=91746 + + Reviewed by Adam Barth. + + This patch is part of efforts to enable web audio for chromium android. + Web audio component needs to use atomicIncrement and atomicDecrement, + which are enabled by this MACRO. + + As mentioned in https://bugs.webkit.org/show_bug.cgi?id=89428#c19, make + this patch standalone. + + * wtf/Atomics.h: + (WTF): + +2012-07-26 Arnaud Renevier <a.renevier@sisa.samsung.com> + + constructing TypedArray from another TypedArray is slow + https://bugs.webkit.org/show_bug.cgi?id=90838 + + Reviewed by Kenneth Russell. + + Introduce virtual method getType on ArrayBufferView. It returns the actual + type of the view. This method replaces previous is<Type>Array() methods. + + * wtf/ArrayBufferView.h: + * wtf/Float32Array.h: + (WTF::Float32Array::getType): + (Float32Array): + * wtf/Float64Array.h: + (WTF::Float64Array::getType): + (Float64Array): + * wtf/Int16Array.h: + (WTF::Int16Array::getType): + (Int16Array): + * wtf/Int32Array.h: + (WTF::Int32Array::getType): + (Int32Array): + * wtf/Int8Array.h: + (WTF::Int8Array::getType): + (Int8Array): + * wtf/IntegralTypedArrayBase.h: + * wtf/TypedArrayBase.h: + (TypedArrayBase): + (WTF::TypedArrayBase::item): + * wtf/Uint16Array.h: + (WTF::Uint16Array::getType): + (Uint16Array): + * wtf/Uint32Array.h: + (WTF::Uint32Array::getType): + (Uint32Array): + * wtf/Uint8Array.h: + (WTF::Uint8Array::getType): + (Uint8Array): + * wtf/Uint8ClampedArray.h: + (WTF::Uint8ClampedArray::getType): + (Uint8ClampedArray): + +2012-07-26 Zeno Albisser <zeno@webkit.org> + + [Qt] requestAnimationFrame should only trigger when a new frame can be displayed. + https://bugs.webkit.org/show_bug.cgi?id=88638 + + Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie + the servicing of scripted animations to layer syncing for WK2. + For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation. + + Reviewed by Jocelyn Turcotte. + + * wtf/Platform.h: + +2012-07-26 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Revert r123740 as it breaks AppleMac compilation. + + * wtf/text/StringImpl.cpp: + * wtf/text/StringImpl.h: + +2012-07-26 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: move StringImpl size calculation to StringImpl + https://bugs.webkit.org/show_bug.cgi?id=92359 + + Reviewed by Pavel Feldman. + + Moved stringSize(StringImpl*) implementation from InspectorMemoryAgent to + StringImpl::sizeInBytes(); + + * wtf/text/StringImpl.cpp: + (WTF::StringImpl::sizeInBytes): + (WTF): + * wtf/text/StringImpl.h: + (StringImpl): + +2012-07-25 Benjamin Poulain <bpoulain@apple.com> + + Initialize QualifiedName's strings from the read only data segment + https://bugs.webkit.org/show_bug.cgi?id=92226 + + Reviewed by Anders Carlsson. + + Add constructors for StringImpl and AtomicString to be able to create + the strings from the literal in read only memory. + + * wtf/text/AtomicString.cpp: + (HashTranslatorCharBuffer): + (WTF::LCharBufferFromLiteralDataTranslator::hash): + (LCharBufferFromLiteralDataTranslator): + (WTF::LCharBufferFromLiteralDataTranslator::equal): + (WTF::LCharBufferFromLiteralDataTranslator::translate): + (WTF::AtomicString::addFromLiteralData): + * wtf/text/AtomicString.h: + (WTF::AtomicString::AtomicString): + (AtomicString): + * wtf/text/StringImpl.cpp: + (WTF::StringImpl::createFromLiteral): + * wtf/text/StringImpl.h: + (WTF): + (StringImpl): + (WTF::StringImpl::createFromLiteral): + +2012-07-25 Michael Saboff <msaboff@apple.com> + + Convert HTML parser to handle 8-bit resources without converting to UChar* + https://bugs.webkit.org/show_bug.cgi?id=90321 + + Reviewed by Geoffrey Garen. + + * wtf/text/WTFString.h: + (WTF::String::dataSize): New method to return the number of bytes + the string requires. This replaces a harcoded calculation based on + length and sizeof(UChar). + +2012-07-25 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Create a specialized pair for use in HashMap iterators + https://bugs.webkit.org/show_bug.cgi?id=92137 + + Reviewed by Ryosuke Niwa. + + The type used for internal storage in HashMap is exposed in its interface as iterator + "contents". Currently HashMap uses std::pair<>, which this patch replaces with + KeyValuePair. + + Having this specialized structure will allow us to customize the members to be called + key/value, improving readability in code using HashMap iterators. They are still called + first/second to separate this change from the mechanical change of updating callsites. + + * wtf/HashIterators.h: + (HashTableConstKeysIterator): + (HashTableConstValuesIterator): + (HashTableKeysIterator): + (HashTableValuesIterator): + Use KeyValuePair instead of std::pair when defining the iterators. + + * wtf/HashMap.h: + (WTF): + (WTF::KeyValuePairKeyExtractor::extract): + (HashMap): + Remove PairFirstExtractor. Add and use the KeyValuePair corresponding extractor. + + (WTF::HashMapValueTraits::isEmptyValue): Use KeyValuePairHashTraits for HashMaps. + (WTF::HashMapTranslator::translate): + (WTF::HashMapTranslatorAdapter::translate): + The traits of the mapped value is now called ValueTraits instead of SecondTraits. + + * wtf/HashTable.h: + (WTF::hashTableSwap): Add specialization for swapping KeyValuePairs. + (WTF): Remove now unneeded specialization for std::pairs. + + * wtf/HashTraits.h: + (KeyValuePair): + (WTF::KeyValuePair::KeyValuePair): + (WTF): + Specialized pair. In the future difference from pair should be the member names. + + (KeyValuePairHashTraits): + (WTF::KeyValuePairHashTraits::emptyValue): + (WTF::KeyValuePairHashTraits::constructDeletedValue): + (WTF::KeyValuePairHashTraits::isDeletedValue): + These traits are analogous to PairHashTraits but for KeyValuePair. + + * wtf/RefPtrHashMap.h: Use KeyValuePairHashTraits. + +2012-07-25 Andrew Wilson <atwilson@chromium.org> + + Unreviewed, rolling out r123560. + http://trac.webkit.org/changeset/123560 + https://bugs.webkit.org/show_bug.cgi?id=90321 + + Breaks chromium valgrind tests. + + * wtf/text/WTFString.h: + +2012-07-25 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] There are parallel GC related crashes regularly + https://bugs.webkit.org/show_bug.cgi?id=90957 + + Rubber-stamped by Zoltan Herczeg. + + * wtf/Platform.h: Disable parallel GC temporarily on Qt until proper fix. + +2012-07-24 Benjamin Poulain <bpoulain@apple.com> && Joseph Pecoraro <pecoraro@apple.com> + + QualifiedName's HashSet should be big enough to hold at least all the static names + https://bugs.webkit.org/show_bug.cgi?id=91891 + + Reviewed by Darin Adler. + + Add a static struct to compute the HashTable capacity for any given size at compile time. + This allow us to create HashTraits giving the minimumSize without hardcoding the values. + + * wtf/HashTable.h: + (OneifyLowBits): + (UpperPowerOfTwoBound): + (HashTableCapacityForSize): Compute the HashTable capacity at compile time. + +2012-07-24 Michael Saboff <msaboff@apple.com> + + Convert HTML parser to handle 8-bit resources without converting to UChar* + https://bugs.webkit.org/show_bug.cgi?id=90321 + + Reviewed by Geoffrey Garen. + + * wtf/text/WTFString.h: + (WTF::String::dataSize): New method to return the number of bytes + the string requires. This replaces a harcoded calculation based on + length and sizeof(UChar). + +2012-07-24 Sam Weinig <sam@webkit.org> + + Add per-HashTable stats + https://bugs.webkit.org/show_bug.cgi?id=92185 + + Reviewed by Anders Carlsson. + + Add per-HashTable stats, so we can look at the effectiveness of an individual HashTable. + + * wtf/HashTable.h: + (WTF::HashTable::Stats::Stats): + Add a HashTable::Stats to hold the stats. + + (WTF::HashTable::Stats::recordCollisionAtCount): + (WTF::HashTable::Stats::dumpStats): + Add versions of recordCollisionAtCount and dumpStats for per-HashTable version. + + (WTF::HashTable): + Keep the stats, if enabled, in an OwnPtr, to not blow JSCell max size restrictions. + + (WTF::lookup): + (WTF::lookupForWriting): + (WTF::fullLookupForWriting): + (WTF::add): + (WTF::reinsert): + (WTF::remove): + (WTF::rehash): + Keep track of the stats as the table is used. + +2012-07-24 Patrick Gansterer <paroga@webkit.org> + + Store the full year in GregorianDateTime + https://bugs.webkit.org/show_bug.cgi?id=92067 + + Reviewed by Geoffrey Garen. + + Use the full year instead of the offset from year 1900 + for the year member variable of GregorianDateTime. + + * wtf/GregorianDateTime.h: + (WTF::GregorianDateTime::operator tm): + 2012-07-23 Patrick Gansterer <paroga@webkit.org> Move GregorianDateTime from JSC to WTF namespace diff --git a/Source/WTF/GNUmakefile.list.am b/Source/WTF/GNUmakefile.list.am index bb68bc268..2b844af25 100644 --- a/Source/WTF/GNUmakefile.list.am +++ b/Source/WTF/GNUmakefile.list.am @@ -76,6 +76,8 @@ wtf_sources += \ Source/WTF/wtf/MainThread.h \ Source/WTF/wtf/MallocZoneSupport.h \ Source/WTF/wtf/MathExtras.h \ + Source/WTF/wtf/MediaTime.h \ + Source/WTF/wtf/MediaTime.cpp \ Source/WTF/wtf/MessageQueue.h \ Source/WTF/wtf/MetaAllocator.cpp \ Source/WTF/wtf/MetaAllocator.h \ diff --git a/Source/WTF/WTF.gypi b/Source/WTF/WTF.gypi index ebb41a454..59c74b311 100644 --- a/Source/WTF/WTF.gypi +++ b/Source/WTF/WTF.gypi @@ -152,6 +152,8 @@ 'wtf/MD5.cpp', 'wtf/MainThread.cpp', 'wtf/MallocZoneSupport.h', + 'wtf/MediaTime.h', + 'wtf/MediaTime.cpp', 'wtf/NullPtr.cpp', 'wtf/NumberOfCores.cpp', 'wtf/NumberOfCores.h', diff --git a/Source/WTF/WTF.pro b/Source/WTF/WTF.pro index 68d847112..72d1d712a 100644 --- a/Source/WTF/WTF.pro +++ b/Source/WTF/WTF.pro @@ -80,6 +80,7 @@ HEADERS += \ MallocZoneSupport.h \ MathExtras.h \ MD5.h \ + MediaTime.h \ MessageQueue.h \ MetaAllocator.h \ MetaAllocatorHandle.h \ @@ -194,6 +195,7 @@ SOURCES += \ HashTable.cpp \ MD5.cpp \ MainThread.cpp \ + MediaTime.cpp \ MetaAllocator.cpp \ NullPtr.cpp \ NumberOfCores.cpp \ diff --git a/Source/WTF/WTF.vcproj/WTF.vcproj b/Source/WTF/WTF.vcproj/WTF.vcproj index 1ac32b4d6..94e8326f3 100644 --- a/Source/WTF/WTF.vcproj/WTF.vcproj +++ b/Source/WTF/WTF.vcproj/WTF.vcproj @@ -885,6 +885,14 @@ > </File> <File + RelativePath="..\wtf\MediaTime.h" + > + </File> + <File + RelativePath="..\wtf\MediaTime.cpp" + > + </File> + <File RelativePath="..\wtf\MessageQueue.h" > </File> diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj index 372c15ec0..f5347b24d 100644 --- a/Source/WTF/WTF.xcodeproj/project.pbxproj +++ b/Source/WTF/WTF.xcodeproj/project.pbxproj @@ -245,6 +245,8 @@ A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4737A151A825B004123FF /* WTFThreadData.cpp */; }; A8A47487151A825B004123FF /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4737B151A825B004123FF /* WTFThreadData.h */; }; A8A4748C151A8264004123FF /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4748B151A8264004123FF /* config.h */; }; + CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; }; + CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5497AB15857D0300B5BC30 /* MediaTime.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -496,6 +498,8 @@ A8A4737A151A825B004123FF /* WTFThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFThreadData.cpp; sourceTree = "<group>"; }; A8A4737B151A825B004123FF /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = "<group>"; }; A8A4748B151A8264004123FF /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; }; + CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; }; + CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -634,6 +638,8 @@ A8A472C9151A825B004123FF /* MathExtras.h */, A8A472CA151A825B004123FF /* MD5.cpp */, A8A472CB151A825B004123FF /* MD5.h */, + CD5497AA15857D0300B5BC30 /* MediaTime.cpp */, + CD5497AB15857D0300B5BC30 /* MediaTime.h */, A8A472CC151A825B004123FF /* MessageQueue.h */, A8A472CD151A825B004123FF /* MetaAllocator.cpp */, A8A472CE151A825B004123FF /* MetaAllocator.h */, @@ -954,6 +960,7 @@ A8A473E7151A825B004123FF /* MallocZoneSupport.h in Headers */, A8A473E8151A825B004123FF /* MathExtras.h in Headers */, A8A473EA151A825B004123FF /* MD5.h in Headers */, + CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */, A8A473EB151A825B004123FF /* MessageQueue.h in Headers */, A8A473ED151A825B004123FF /* MetaAllocator.h in Headers */, A8A473EE151A825B004123FF /* MetaAllocatorHandle.h in Headers */, @@ -1168,6 +1175,7 @@ A8A473D8151A825B004123FF /* HashTable.cpp in Sources */, A8A473E5151A825B004123FF /* MainThread.cpp in Sources */, A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */, + CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */, A8A473E9151A825B004123FF /* MD5.cpp in Sources */, A8A473EC151A825B004123FF /* MetaAllocator.cpp in Sources */, A8A473F2151A825B004123FF /* NullPtr.cpp in Sources */, diff --git a/Source/WTF/wtf/ArrayBufferView.h b/Source/WTF/wtf/ArrayBufferView.h index 5ef482908..451c1b6ed 100644 --- a/Source/WTF/wtf/ArrayBufferView.h +++ b/Source/WTF/wtf/ArrayBufferView.h @@ -38,16 +38,19 @@ namespace WTF { class WTF_EXPORT_PRIVATE_RTTI ArrayBufferView : public RefCounted<ArrayBufferView> { public: - virtual bool isByteArray() const { return false; } - virtual bool isUnsignedByteArray() const { return false; } - virtual bool isUnsignedByteClampedArray() const { return false; } - virtual bool isShortArray() const { return false; } - virtual bool isUnsignedShortArray() const { return false; } - virtual bool isIntArray() const { return false; } - virtual bool isUnsignedIntArray() const { return false; } - virtual bool isFloatArray() const { return false; } - virtual bool isDoubleArray() const { return false; } - virtual bool isDataView() const { return false; } + enum ViewType { + TypeInt8, + TypeUint8, + TypeUint8Clamped, + TypeInt16, + TypeUint16, + TypeInt32, + TypeUint32, + TypeFloat32, + TypeFloat64, + TypeDataView + }; + virtual ViewType getType() const = 0; PassRefPtr<ArrayBuffer> buffer() const { diff --git a/Source/WTF/wtf/Atomics.h b/Source/WTF/wtf/Atomics.h index 958abd2fa..a2efd948c 100644 --- a/Source/WTF/wtf/Atomics.h +++ b/Source/WTF/wtf/Atomics.h @@ -106,6 +106,7 @@ inline int atomicIncrement(int volatile* addend) { return static_cast<int>(atomi inline int atomicDecrement(int volatile* addend) { return static_cast<int>(atomic_sub_value(reinterpret_cast<unsigned volatile*>(addend), 1)) - 1; } #elif OS(ANDROID) +#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1 inline int atomicIncrement(int volatile* addend) { return __atomic_inc(addend); } inline int atomicDecrement(int volatile* addend) { return __atomic_dec(addend); } diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt index bd2914971..4636b5e52 100644 --- a/Source/WTF/wtf/CMakeLists.txt +++ b/Source/WTF/wtf/CMakeLists.txt @@ -44,6 +44,7 @@ SET(WTF_HEADERS MainThread.h MallocZoneSupport.h MathExtras.h + MediaTime.h MessageQueue.h MetaAllocator.h MetaAllocatorHandle.h @@ -149,6 +150,7 @@ SET(WTF_SOURCES HashTable.cpp MD5.cpp MainThread.cpp + MediaTime.cpp MetaAllocator.cpp OSRandomSource.cpp NumberOfCores.cpp diff --git a/Source/WTF/wtf/Float32Array.h b/Source/WTF/wtf/Float32Array.h index 55e61e006..47204ec78 100644 --- a/Source/WTF/wtf/Float32Array.h +++ b/Source/WTF/wtf/Float32Array.h @@ -38,6 +38,10 @@ public: static inline PassRefPtr<Float32Array> create(const float* array, unsigned length); static inline PassRefPtr<Float32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Float32Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<float>* array, unsigned offset) { return TypedArrayBase<float>::set(array, offset); } @@ -48,27 +52,20 @@ public: TypedArrayBase<float>::data()[index] = static_cast<float>(value); } - // Invoked by the indexed getter. Does not perform range checks; caller - // is responsible for doing so and returning undefined as necessary. - float item(unsigned index) const - { - ASSERT(index < TypedArrayBase<float>::m_length); - float result = TypedArrayBase<float>::data()[index]; - return result; - } - inline PassRefPtr<Float32Array> subarray(int start) const; inline PassRefPtr<Float32Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeFloat32; + } + private: inline Float32Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<float>; - - // Overridden from ArrayBufferView. - virtual bool isFloatArray() const { return true; } }; PassRefPtr<Float32Array> Float32Array::create(unsigned length) @@ -86,6 +83,11 @@ PassRefPtr<Float32Array> Float32Array::create(PassRefPtr<ArrayBuffer> buffer, un return TypedArrayBase<float>::create<Float32Array>(buffer, byteOffset, length); } +PassRefPtr<Float32Array> Float32Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<float>::createUninitialized<Float32Array>(length); +} + Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : TypedArrayBase<float>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/Float64Array.h b/Source/WTF/wtf/Float64Array.h index 30633dbec..1d9a9c82e 100644 --- a/Source/WTF/wtf/Float64Array.h +++ b/Source/WTF/wtf/Float64Array.h @@ -38,6 +38,10 @@ public: static inline PassRefPtr<Float64Array> create(const double* array, unsigned length); static inline PassRefPtr<Float64Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Float64Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<double>* array, unsigned offset) { return TypedArrayBase<double>::set(array, offset); } @@ -48,27 +52,20 @@ public: TypedArrayBase<double>::data()[index] = static_cast<double>(value); } - // Invoked by the indexed getter. Does not perform range checks; caller - // is responsible for doing so and returning undefined as necessary. - double item(unsigned index) const - { - ASSERT(index < TypedArrayBase<double>::m_length); - double result = TypedArrayBase<double>::data()[index]; - return result; - } - inline PassRefPtr<Float64Array> subarray(int start) const; inline PassRefPtr<Float64Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeFloat64; + } + private: inline Float64Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<double>; - - // Overridden from ArrayBufferView. - virtual bool isDoubleArray() const { return true; } }; PassRefPtr<Float64Array> Float64Array::create(unsigned length) @@ -86,6 +83,11 @@ PassRefPtr<Float64Array> Float64Array::create(PassRefPtr<ArrayBuffer> buffer, un return TypedArrayBase<double>::create<Float64Array>(buffer, byteOffset, length); } +PassRefPtr<Float64Array> Float64Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<double>::createUninitialized<Float64Array>(length); +} + Float64Array::Float64Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : TypedArrayBase<double>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/GregorianDateTime.h b/Source/WTF/wtf/GregorianDateTime.h index 2b4fc352f..37300f089 100644 --- a/Source/WTF/wtf/GregorianDateTime.h +++ b/Source/WTF/wtf/GregorianDateTime.h @@ -25,7 +25,9 @@ #ifndef WTF_GregorianDateTime_h #define WTF_GregorianDateTime_h -#include <wtf/text/CString.h> +#include <string.h> +#include <time.h> +#include <wtf/Noncopyable.h> namespace WTF { @@ -73,7 +75,7 @@ public: tm ret; memset(&ret, 0, sizeof(ret)); - ret.tm_year = m_year; + ret.tm_year = m_year - 1900; ret.tm_mon = m_month; ret.tm_yday = m_yearDay; ret.tm_mday = m_monthDay; diff --git a/Source/WTF/wtf/HashIterators.h b/Source/WTF/wtf/HashIterators.h index 6afa2fa57..639ff7250 100644 --- a/Source/WTF/wtf/HashIterators.h +++ b/Source/WTF/wtf/HashIterators.h @@ -33,9 +33,9 @@ namespace WTF { template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator; template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > { private: - typedef std::pair<KeyType, MappedType> ValueType; + typedef KeyValuePair<KeyType, MappedType> ValueType; public: typedef HashTableConstKeysIterator<HashTableType, KeyType, MappedType> Keys; typedef HashTableConstValuesIterator<HashTableType, KeyType, MappedType> Values; @@ -56,9 +56,9 @@ namespace WTF { typename HashTableType::const_iterator m_impl; }; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > { private: - typedef std::pair<KeyType, MappedType> ValueType; + typedef KeyValuePair<KeyType, MappedType> ValueType; public: typedef HashTableKeysIterator<HashTableType, KeyType, MappedType> Keys; typedef HashTableValuesIterator<HashTableType, KeyType, MappedType> Values; @@ -86,7 +86,7 @@ namespace WTF { template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator { private: - typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator; + typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator; public: HashTableConstKeysIterator(const ConstIterator& impl) : m_impl(impl) {} @@ -103,7 +103,7 @@ namespace WTF { template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator { private: - typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator; + typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator; public: HashTableConstValuesIterator(const ConstIterator& impl) : m_impl(impl) {} @@ -120,8 +120,8 @@ namespace WTF { template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator { private: - typedef HashTableIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > Iterator; - typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator; + typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > Iterator; + typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator; public: HashTableKeysIterator(const Iterator& impl) : m_impl(impl) {} @@ -143,8 +143,8 @@ namespace WTF { template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator { private: - typedef HashTableIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > Iterator; - typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator; + typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > Iterator; + typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator; public: HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {} diff --git a/Source/WTF/wtf/HashMap.h b/Source/WTF/wtf/HashMap.h index f597ec333..9010474c8 100644 --- a/Source/WTF/wtf/HashMap.h +++ b/Source/WTF/wtf/HashMap.h @@ -26,7 +26,6 @@ namespace WTF { template<typename KeyTraits, typename MappedTraits> struct HashMapValueTraits; - template<typename PairType> struct PairFirstExtractor; template<typename T> struct ReferenceTypeMaker { typedef T& ReferenceType; @@ -35,6 +34,10 @@ namespace WTF { typedef T& ReferenceType; }; + template<typename T> struct KeyValuePairKeyExtractor { + static const typename T::KeyType& extract(const T& p) { return p.first; } + }; + template<typename KeyArg, typename MappedArg, typename HashArg = typename DefaultHash<KeyArg>::Hash, typename KeyTraitsArg = HashTraits<KeyArg>, typename MappedTraitsArg = HashTraits<MappedArg> > class HashMap { @@ -58,7 +61,7 @@ namespace WTF { typedef HashArg HashFunctions; - typedef HashTable<KeyType, ValueType, PairFirstExtractor<ValueType>, + typedef HashTable<KeyType, ValueType, KeyValuePairKeyExtractor<ValueType>, HashFunctions, ValueTraits, KeyTraits> HashTableType; class HashMapKeysProxy; @@ -204,18 +207,14 @@ namespace WTF { HashTableType m_impl; }; - template<typename KeyTraits, typename MappedTraits> struct HashMapValueTraits : PairHashTraits<KeyTraits, MappedTraits> { + template<typename KeyTraits, typename MappedTraits> struct HashMapValueTraits : KeyValuePairHashTraits<KeyTraits, MappedTraits> { static const bool hasIsEmptyValueFunction = true; - static bool isEmptyValue(const typename PairHashTraits<KeyTraits, MappedTraits>::TraitType& value) + static bool isEmptyValue(const typename KeyValuePairHashTraits<KeyTraits, MappedTraits>::TraitType& value) { return isHashTraitsEmptyValue<KeyTraits>(value.first); } }; - template<typename PairType> struct PairFirstExtractor { - static const typename PairType::first_type& extract(const PairType& p) { return p.first; } - }; - template<typename ValueTraits, typename HashFunctions> struct HashMapTranslator { template<typename T> static unsigned hash(const T& key) { return HashFunctions::hash(key); } @@ -223,7 +222,7 @@ namespace WTF { template<typename T, typename U, typename V> static void translate(T& location, const U& key, const V& mapped) { location.first = key; - ValueTraits::SecondTraits::store(mapped, location.second); + ValueTraits::ValueTraits::store(mapped, location.second); } }; @@ -234,7 +233,7 @@ namespace WTF { template<typename T, typename U, typename V> static void translate(T& location, const U& key, const V& mapped, unsigned hashCode) { Translator::translate(location.first, key, hashCode); - ValueTraits::SecondTraits::store(mapped, location.second); + ValueTraits::ValueTraits::store(mapped, location.second); } }; diff --git a/Source/WTF/wtf/HashTable.h b/Source/WTF/wtf/HashTable.h index ccf62dc00..1ce3c5cf6 100644 --- a/Source/WTF/wtf/HashTable.h +++ b/Source/WTF/wtf/HashTable.h @@ -24,6 +24,7 @@ #include <wtf/Alignment.h> #include <wtf/Assertions.h> +#include <wtf/DataLog.h> #include <wtf/FastMalloc.h> #include <wtf/HashTraits.h> #include <wtf/StdLibExtras.h> @@ -39,6 +40,7 @@ namespace WTF { #define DUMP_HASHTABLE_STATS 0 +#define DUMP_HASHTABLE_STATS_PER_TABLE 0 // Enables internal WTF consistency checks that are invoked automatically. Non-WTF callers can call checkTableConsistency() even if internal checks are disabled. #define CHECK_HASHTABLE_CONSISTENCY 0 @@ -54,8 +56,6 @@ namespace WTF { #if DUMP_HASHTABLE_STATS struct HashTableStats { - // All of the variables are accessed in ~HashTableStats when the static struct is destroyed. - // The following variables are all atomically incremented when modified. WTF_EXPORTDATA static int numAccesses; WTF_EXPORTDATA static int numRehashes; @@ -284,8 +284,7 @@ namespace WTF { swap(a, b); } - // Swap pairs by component, in case of pair members that specialize swap. - template<typename T, typename U> inline void hashTableSwap(std::pair<T, U>& a, std::pair<T, U>& b) + template<typename T, typename U> inline void hashTableSwap(KeyValuePair<T, U>& a, KeyValuePair<T, U>& b) { swap(a.first, b.first); swap(a.second, b.second); @@ -319,6 +318,51 @@ namespace WTF { typedef IdentityHashTranslator<HashFunctions> IdentityTranslatorType; typedef HashTableAddResult<iterator> AddResult; +#if DUMP_HASHTABLE_STATS_PER_TABLE + struct Stats { + Stats() + : numAccesses(0) + , numRehashes(0) + , numRemoves(0) + , numReinserts(0) + , maxCollisions(0) + , numCollisions(0) + , collisionGraph() + { + } + + int numAccesses; + int numRehashes; + int numRemoves; + int numReinserts; + + int maxCollisions; + int numCollisions; + int collisionGraph[4096]; + + void recordCollisionAtCount(int count) + { + if (count > maxCollisions) + maxCollisions = count; + numCollisions++; + collisionGraph[count]++; + } + + void dumpStats() + { + dataLog("\nWTF::HashTable::Stats dump\n\n"); + dataLog("%d accesses\n", numAccesses); + dataLog("%d total collisions, average %.2f probes per access\n", numCollisions, 1.0 * (numAccesses + numCollisions) / numAccesses); + dataLog("longest collision chain: %d\n", maxCollisions); + for (int i = 1; i <= maxCollisions; i++) { + dataLog(" %d lookups with exactly %d collisions (%.2f%% , %.2f%% with this many or more)\n", collisionGraph[i], i, 100.0 * (collisionGraph[i] - collisionGraph[i+1]) / numAccesses, 100.0 * collisionGraph[i] / numAccesses); + } + dataLog("%d rehashes\n", numRehashes); + dataLog("%d reinserts\n", numReinserts); + } + }; +#endif + HashTable(); ~HashTable() { @@ -453,6 +497,49 @@ namespace WTF { // Use OwnPtr so HashTable can still be memmove'd or memcpy'ed. mutable OwnPtr<Mutex> m_mutex; #endif + +#if DUMP_HASHTABLE_STATS_PER_TABLE + public: + mutable OwnPtr<Stats> m_stats; +#endif + }; + + // Set all the bits to one after the most significant bit: 00110101010 -> 00111111111. + template<unsigned size> struct OneifyLowBits; + template<> + struct OneifyLowBits<0> { + static const unsigned value = 0; + }; + template<unsigned number> + struct OneifyLowBits { + static const unsigned value = number | OneifyLowBits<(number >> 1)>::value; + }; + // Compute the first power of two integer that is an upper bound of the parameter 'number'. + template<unsigned number> + struct UpperPowerOfTwoBound { + static const unsigned value = (OneifyLowBits<number - 1>::value + 1) * 2; + }; + + // Because power of two numbers are the limit of maxLoad, their capacity is twice the + // UpperPowerOfTwoBound, or 4 times their values. + template<unsigned size, bool isPowerOfTwo> struct HashTableCapacityForSizeSplitter; + template<unsigned size> + struct HashTableCapacityForSizeSplitter<size, true> { + static const unsigned value = size * 4; + }; + template<unsigned size> + struct HashTableCapacityForSizeSplitter<size, false> { + static const unsigned value = UpperPowerOfTwoBound<size>::value; + }; + + // HashTableCapacityForSize computes the upper power of two capacity to hold the size parameter. + // This is done at compile time to initialize the HashTraits. + template<unsigned size> + struct HashTableCapacityForSize { + static const unsigned value = HashTableCapacityForSizeSplitter<size, !(size & (size - 1))>::value; + COMPILE_ASSERT(size > 0, HashTableNonZeroMinimumCapacity); + COMPILE_ASSERT(!static_cast<int>(value >> 31), HashTableNoCapacityOverflow); + COMPILE_ASSERT(value > (2 * size), HashTableCapacityHoldsContentSize); }; template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> @@ -466,6 +553,9 @@ namespace WTF { , m_iterators(0) , m_mutex(adoptPtr(new Mutex)) #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + , m_stats(adoptPtr(new Stats)) +#endif { } @@ -525,6 +615,11 @@ namespace WTF { int probeCount = 0; #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++m_stats->numAccesses; + int perTableProbeCount = 0; +#endif + while (1) { ValueType* entry = table + i; @@ -546,6 +641,12 @@ namespace WTF { ++probeCount; HashTableStats::recordCollisionAtCount(probeCount); #endif + +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++perTableProbeCount; + m_stats->recordCollisionAtCount(perTableProbeCount); +#endif + if (k == 0) k = 1 | doubleHash(h); i = (i + k) & sizeMask; @@ -570,6 +671,11 @@ namespace WTF { int probeCount = 0; #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++m_stats->numAccesses; + int perTableProbeCount = 0; +#endif + ValueType* deletedEntry = 0; while (1) { @@ -598,6 +704,12 @@ namespace WTF { ++probeCount; HashTableStats::recordCollisionAtCount(probeCount); #endif + +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++perTableProbeCount; + m_stats->recordCollisionAtCount(perTableProbeCount); +#endif + if (k == 0) k = 1 | doubleHash(h); i = (i + k) & sizeMask; @@ -622,6 +734,11 @@ namespace WTF { int probeCount = 0; #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++m_stats->numAccesses; + int perTableProbeCount = 0; +#endif + ValueType* deletedEntry = 0; while (1) { @@ -650,6 +767,12 @@ namespace WTF { ++probeCount; HashTableStats::recordCollisionAtCount(probeCount); #endif + +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++perTableProbeCount; + m_stats->recordCollisionAtCount(perTableProbeCount); +#endif + if (k == 0) k = 1 | doubleHash(h); i = (i + k) & sizeMask; @@ -707,6 +830,11 @@ namespace WTF { int probeCount = 0; #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++m_stats->numAccesses; + int perTableProbeCount = 0; +#endif + ValueType* deletedEntry = 0; ValueType* entry; while (1) { @@ -735,6 +863,12 @@ namespace WTF { ++probeCount; HashTableStats::recordCollisionAtCount(probeCount); #endif + +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++perTableProbeCount; + m_stats->recordCollisionAtCount(perTableProbeCount); +#endif + if (k == 0) k = 1 | doubleHash(h); i = (i + k) & sizeMask; @@ -820,6 +954,9 @@ namespace WTF { #if DUMP_HASHTABLE_STATS atomicIncrement(&HashTableStats::numReinserts); #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++m_stats->numReinserts; +#endif Mover<ValueType, Traits::needsDestruction>::move(entry, *lookupForWriting(Extractor::extract(entry)).first); } @@ -883,6 +1020,9 @@ namespace WTF { #if DUMP_HASHTABLE_STATS atomicIncrement(&HashTableStats::numRemoves); #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + ++m_stats->numRemoves; +#endif deleteBucket(*pos); ++m_deletedCount; @@ -979,6 +1119,11 @@ namespace WTF { atomicIncrement(&HashTableStats::numRehashes); #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + if (oldTableSize != 0) + ++m_stats->numRehashes; +#endif + m_tableSize = newTableSize; m_tableSizeMask = newTableSize - 1; m_table = allocateTable(newTableSize); @@ -1019,6 +1164,9 @@ namespace WTF { , m_iterators(0) , m_mutex(adoptPtr(new Mutex)) #endif +#if DUMP_HASHTABLE_STATS_PER_TABLE + , m_stats(adoptPtr(new Stats(*other.m_stats))) +#endif { // Copy the hash table the dumb way, by adding each element to the new table. // It might be more efficient to copy the table slots, but it's not clear that efficiency is needed. @@ -1052,6 +1200,10 @@ namespace WTF { int tmp_deletedCount = m_deletedCount; m_deletedCount = other.m_deletedCount; other.m_deletedCount = tmp_deletedCount; + +#if DUMP_HASHTABLE_STATS_PER_TABLE + m_stats.swap(other.m_stats); +#endif } template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits> diff --git a/Source/WTF/wtf/HashTraits.h b/Source/WTF/wtf/HashTraits.h index 21ffdbb45..ebe795eb1 100644 --- a/Source/WTF/wtf/HashTraits.h +++ b/Source/WTF/wtf/HashTraits.h @@ -163,8 +163,6 @@ namespace WTF { return HashTraitsEmptyValueChecker<Traits, Traits::hasIsEmptyValueFunction>::isEmptyValue(value); } - // special traits for pairs, helpful for their use in HashMap implementation - template<typename FirstTraitsArg, typename SecondTraitsArg> struct PairHashTraits : GenericHashTraits<std::pair<typename FirstTraitsArg::TraitType, typename SecondTraitsArg::TraitType> > { typedef FirstTraitsArg FirstTraits; @@ -186,6 +184,53 @@ namespace WTF { template<typename First, typename Second> struct HashTraits<std::pair<First, Second> > : public PairHashTraits<HashTraits<First>, HashTraits<Second> > { }; + template<typename KeyTypeArg, typename ValueTypeArg> + struct KeyValuePair { + typedef KeyTypeArg KeyType; + + KeyValuePair() + { + } + + KeyValuePair(const KeyTypeArg& key, const ValueTypeArg& value) + : first(key) + , second(value) + { + } + + template <typename OtherKeyType, typename OtherValueType> + KeyValuePair(const KeyValuePair<OtherKeyType, OtherValueType>& other) + : first(other.first) + , second(other.second) + { + } + + // TODO: Rename these to key and value. See https://bugs.webkit.org/show_bug.cgi?id=82784. + KeyTypeArg first; + ValueTypeArg second; + }; + + template<typename KeyTraitsArg, typename ValueTraitsArg> + struct KeyValuePairHashTraits : GenericHashTraits<KeyValuePair<typename KeyTraitsArg::TraitType, typename ValueTraitsArg::TraitType> > { + typedef KeyTraitsArg KeyTraits; + typedef ValueTraitsArg ValueTraits; + typedef KeyValuePair<typename KeyTraits::TraitType, typename ValueTraits::TraitType> TraitType; + typedef KeyValuePair<typename KeyTraits::EmptyValueType, typename ValueTraits::EmptyValueType> EmptyValueType; + + static const bool emptyValueIsZero = KeyTraits::emptyValueIsZero && ValueTraits::emptyValueIsZero; + static EmptyValueType emptyValue() { return KeyValuePair<typename KeyTraits::EmptyValueType, typename ValueTraits::EmptyValueType>(KeyTraits::emptyValue(), ValueTraits::emptyValue()); } + + static const bool needsDestruction = KeyTraits::needsDestruction || ValueTraits::needsDestruction; + + static const int minimumTableSize = KeyTraits::minimumTableSize; + + static void constructDeletedValue(TraitType& slot) { KeyTraits::constructDeletedValue(slot.first); } + static bool isDeletedValue(const TraitType& value) { return KeyTraits::isDeletedValue(value.first); } + }; + + template<typename Key, typename Value> + struct HashTraits<KeyValuePair<Key, Value> > : public KeyValuePairHashTraits<HashTraits<Key>, HashTraits<Value> > { }; + } // namespace WTF using WTF::HashTraits; diff --git a/Source/WTF/wtf/Int16Array.h b/Source/WTF/wtf/Int16Array.h index 26bbe8a92..be9858388 100644 --- a/Source/WTF/wtf/Int16Array.h +++ b/Source/WTF/wtf/Int16Array.h @@ -38,6 +38,10 @@ public: static inline PassRefPtr<Int16Array> create(const short* array, unsigned length); static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Int16Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<short>* array, unsigned offset) { return TypedArrayBase<short>::set(array, offset); } void set(unsigned index, double value) { IntegralTypedArrayBase<short>::set(index, value); } @@ -45,15 +49,17 @@ public: inline PassRefPtr<Int16Array> subarray(int start) const; inline PassRefPtr<Int16Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeInt16; + } + private: inline Int16Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<short>; - - // Overridden from ArrayBufferView. - virtual bool isShortArray() const { return true; } }; PassRefPtr<Int16Array> Int16Array::create(unsigned length) @@ -71,6 +77,11 @@ PassRefPtr<Int16Array> Int16Array::create(PassRefPtr<ArrayBuffer> buffer, unsign return TypedArrayBase<short>::create<Int16Array>(buffer, byteOffset, length); } +PassRefPtr<Int16Array> Int16Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<short>::createUninitialized<Int16Array>(length); +} + Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : IntegralTypedArrayBase<short>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/Int32Array.h b/Source/WTF/wtf/Int32Array.h index ce6868cc2..99bce1ad2 100644 --- a/Source/WTF/wtf/Int32Array.h +++ b/Source/WTF/wtf/Int32Array.h @@ -37,6 +37,10 @@ public: static inline PassRefPtr<Int32Array> create(const int* array, unsigned length); static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Int32Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<int>* array, unsigned offset) { return TypedArrayBase<int>::set(array, offset); } void set(unsigned index, double value) { IntegralTypedArrayBase<int>::set(index, value); } @@ -44,15 +48,17 @@ public: inline PassRefPtr<Int32Array> subarray(int start) const; inline PassRefPtr<Int32Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeInt32; + } + private: inline Int32Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<int>; - - // Overridden from ArrayBufferView. - virtual bool isIntArray() const { return true; } }; PassRefPtr<Int32Array> Int32Array::create(unsigned length) @@ -70,6 +76,11 @@ PassRefPtr<Int32Array> Int32Array::create(PassRefPtr<ArrayBuffer> buffer, unsign return TypedArrayBase<int>::create<Int32Array>(buffer, byteOffset, length); } +PassRefPtr<Int32Array> Int32Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<int>::createUninitialized<Int32Array>(length); +} + Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : IntegralTypedArrayBase<int>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/Int8Array.h b/Source/WTF/wtf/Int8Array.h index 554f4acc9..bb3e37e35 100644 --- a/Source/WTF/wtf/Int8Array.h +++ b/Source/WTF/wtf/Int8Array.h @@ -39,6 +39,10 @@ public: static inline PassRefPtr<Int8Array> create(const signed char* array, unsigned length); static inline PassRefPtr<Int8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Int8Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<signed char>* array, unsigned offset) { return TypedArrayBase<signed char>::set(array, offset); } void set(unsigned index, double value) { IntegralTypedArrayBase<signed char>::set(index, value); } @@ -46,15 +50,17 @@ public: inline PassRefPtr<Int8Array> subarray(int start) const; inline PassRefPtr<Int8Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeInt8; + } + private: inline Int8Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<signed char>; - - // Overridden from ArrayBufferView. - virtual bool isByteArray() const { return true; } }; PassRefPtr<Int8Array> Int8Array::create(unsigned length) @@ -72,6 +78,11 @@ PassRefPtr<Int8Array> Int8Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned return TypedArrayBase<signed char>::create<Int8Array>(buffer, byteOffset, length); } +PassRefPtr<Int8Array> Int8Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<signed char>::createUninitialized<Int8Array>(length); +} + Int8Array::Int8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : IntegralTypedArrayBase<signed char>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/IntegralTypedArrayBase.h b/Source/WTF/wtf/IntegralTypedArrayBase.h index f276400f8..23dbdde5d 100644 --- a/Source/WTF/wtf/IntegralTypedArrayBase.h +++ b/Source/WTF/wtf/IntegralTypedArrayBase.h @@ -50,14 +50,6 @@ class IntegralTypedArrayBase : public TypedArrayBase<T> { TypedArrayBase<T>::data()[index] = static_cast<T>(static_cast<int64_t>(value)); } - // Invoked by the indexed getter. Does not perform range checks; caller - // is responsible for doing so and returning undefined as necessary. - T item(unsigned index) const - { - ASSERT(index < TypedArrayBase<T>::m_length); - return TypedArrayBase<T>::data()[index]; - } - protected: IntegralTypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : TypedArrayBase<T>(buffer, byteOffset, length) diff --git a/Source/WTF/wtf/MediaTime.cpp b/Source/WTF/wtf/MediaTime.cpp new file mode 100644 index 000000000..6eb2bb09b --- /dev/null +++ b/Source/WTF/wtf/MediaTime.cpp @@ -0,0 +1,352 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "MediaTime.h" + +#include <algorithm> +#include <wtf/CheckedArithmetic.h> +#include <wtf/MathExtras.h> + +using namespace std; + +namespace WTF { + +static int32_t greatestCommonDivisor(int32_t a, int32_t b) +{ + // Euclid's Algorithm + int32_t temp = 0; + while (b) { + temp = b; + b = a % b; + a = temp; + } + return a; +} + +static int32_t leastCommonMultiple(int32_t a, int32_t b, int32_t &result) +{ + return safeMultiply(a, b / greatestCommonDivisor(a, b), result); +} + +const int32_t MediaTime::MaximumTimeScale = 0x7fffffffL; + +MediaTime::MediaTime() + : m_timeValue(0) + , m_timeScale(DefaultTimeScale) + , m_timeFlags(Valid) +{ +} + +MediaTime::MediaTime(int64_t value, int32_t scale, uint32_t flags) + : m_timeValue(value) + , m_timeScale(scale) + , m_timeFlags(flags) +{ +} + +MediaTime::~MediaTime() +{ +} + +MediaTime::MediaTime(const MediaTime& rhs) +{ + *this = rhs; +} + +MediaTime MediaTime::createWithFloat(float floatTime, int32_t timeScale) +{ + if (floatTime != floatTime) + return invalidTime(); + if (isinf(floatTime)) + return signbit(floatTime) ? negativeInfiniteTime() : positiveInfiniteTime(); + if (floatTime > numeric_limits<int64_t>::max()) + return positiveInfiniteTime(); + if (floatTime < numeric_limits<int64_t>::min()) + return negativeInfiniteTime(); + + while (floatTime * timeScale > numeric_limits<int64_t>::max()) + timeScale /= 2; + return MediaTime(static_cast<int64_t>(floatTime * timeScale), timeScale, Valid); +} + +MediaTime MediaTime::createWithDouble(double doubleTime, int32_t timeScale) +{ + if (doubleTime != doubleTime) + return invalidTime(); + if (isinf(doubleTime)) + return signbit(doubleTime) ? negativeInfiniteTime() : positiveInfiniteTime(); + if (doubleTime > numeric_limits<int64_t>::max()) + return positiveInfiniteTime(); + if (doubleTime < numeric_limits<int64_t>::min()) + return negativeInfiniteTime(); + + while (doubleTime * timeScale > numeric_limits<int64_t>::max()) + timeScale /= 2; + return MediaTime(static_cast<int64_t>(doubleTime * timeScale), timeScale, Valid); +} + +float MediaTime::toFloat() const +{ + if (isInvalid() || isIndefinite()) + return std::numeric_limits<float>::quiet_NaN(); + if (isPositiveInfinite()) + return std::numeric_limits<float>::infinity(); + if (isNegativeInfinite()) + return -std::numeric_limits<float>::infinity(); + return static_cast<float>(m_timeValue) / m_timeScale; +} + +double MediaTime::toDouble() const +{ + if (isInvalid() || isIndefinite()) + return std::numeric_limits<double>::quiet_NaN(); + if (isPositiveInfinite()) + return std::numeric_limits<double>::infinity(); + if (isNegativeInfinite()) + return -std::numeric_limits<double>::infinity(); + return static_cast<double>(m_timeValue) / m_timeScale; +} + +MediaTime& MediaTime::operator=(const MediaTime& rhs) +{ + m_timeValue = rhs.m_timeValue; + m_timeScale = rhs.m_timeScale; + m_timeFlags = rhs.m_timeFlags; + return *this; +} + +MediaTime MediaTime::operator+(const MediaTime& rhs) const +{ + if (rhs.isInvalid() || isInvalid()) + return invalidTime(); + + if (rhs.isIndefinite() || isIndefinite()) + return indefiniteTime(); + + if (isPositiveInfinite()) { + if (rhs.isNegativeInfinite()) + return invalidTime(); + return positiveInfiniteTime(); + } + + if (isNegativeInfinite()) { + if (rhs.isPositiveInfinite()) + return invalidTime(); + return negativeInfiniteTime(); + } + + int32_t commonTimeScale; + if (!leastCommonMultiple(this->m_timeScale, rhs.m_timeScale, commonTimeScale) || commonTimeScale > MaximumTimeScale) + commonTimeScale = MaximumTimeScale; + MediaTime a = *this; + MediaTime b = rhs; + a.setTimeScale(commonTimeScale); + b.setTimeScale(commonTimeScale); + while (!safeAdd(a.m_timeValue, b.m_timeValue, a.m_timeValue)) { + if (commonTimeScale == 1) + return a.m_timeValue > 0 ? positiveInfiniteTime() : negativeInfiniteTime(); + commonTimeScale /= 2; + a.setTimeScale(commonTimeScale); + b.setTimeScale(commonTimeScale); + } + return a; +} + +MediaTime MediaTime::operator-(const MediaTime& rhs) const +{ + if (rhs.isInvalid() || isInvalid()) + return invalidTime(); + + if (rhs.isIndefinite() || isIndefinite()) + return indefiniteTime(); + + if (isPositiveInfinite()) { + if (rhs.isPositiveInfinite()) + return invalidTime(); + return positiveInfiniteTime(); + } + + if (isNegativeInfinite()) { + if (rhs.isNegativeInfinite()) + return invalidTime(); + return negativeInfiniteTime(); + } + + int32_t commonTimeScale; + if (!leastCommonMultiple(this->m_timeScale, rhs.m_timeScale, commonTimeScale) || commonTimeScale > MaximumTimeScale) + commonTimeScale = MaximumTimeScale; + MediaTime a = *this; + MediaTime b = rhs; + a.setTimeScale(commonTimeScale); + b.setTimeScale(commonTimeScale); + while (!safeSub(a.m_timeValue, b.m_timeValue, a.m_timeValue)) { + if (commonTimeScale == 1) + return a.m_timeValue > 0 ? positiveInfiniteTime() : negativeInfiniteTime(); + commonTimeScale /= 2; + a.setTimeScale(commonTimeScale); + b.setTimeScale(commonTimeScale); + } + return a; +} + +bool MediaTime::operator<(const MediaTime& rhs) const +{ + return compare(rhs) == LessThan; +} + +bool MediaTime::operator>(const MediaTime& rhs) const +{ + return compare(rhs) == GreaterThan; +} + +bool MediaTime::operator==(const MediaTime& rhs) const +{ + return compare(rhs) == EqualTo; +} + +bool MediaTime::operator>=(const MediaTime& rhs) const +{ + return compare(rhs) >= EqualTo; +} + +bool MediaTime::operator<=(const MediaTime& rhs) const +{ + return compare(rhs) <= EqualTo; +} + +MediaTime::ComparisonFlags MediaTime::compare(const MediaTime& rhs) const +{ + if ((isPositiveInfinite() && rhs.isPositiveInfinite()) + || (isNegativeInfinite() && rhs.isNegativeInfinite()) + || (isInvalid() && rhs.isInvalid()) + || (isIndefinite() && rhs.isIndefinite())) + return EqualTo; + + if (isInvalid()) + return GreaterThan; + + if (rhs.isInvalid()) + return LessThan; + + if (rhs.isNegativeInfinite() || isPositiveInfinite()) + return GreaterThan; + + if (rhs.isPositiveInfinite() || isNegativeInfinite()) + return LessThan; + + if (isIndefinite()) + return GreaterThan; + + if (rhs.isIndefinite()) + return LessThan; + + int64_t rhsWhole = rhs.m_timeValue / rhs.m_timeScale; + int64_t lhsWhole = m_timeValue / m_timeScale; + if (lhsWhole > rhsWhole) + return GreaterThan; + if (lhsWhole < rhsWhole) + return LessThan; + + int64_t rhsRemain = rhs.m_timeValue % rhs.m_timeScale; + int64_t lhsRemain = m_timeValue % m_timeScale; + int64_t lhsFactor = lhsRemain * rhs.m_timeScale; + int64_t rhsFactor = rhsRemain * m_timeScale; + + if (lhsFactor == rhsFactor) + return EqualTo; + return lhsFactor > rhsFactor ? GreaterThan : LessThan; +} + +const MediaTime& MediaTime::zeroTime() +{ + static const MediaTime* time = new MediaTime(0, 1, Valid); + return *time; +} + +const MediaTime& MediaTime::invalidTime() +{ + static const MediaTime* time = new MediaTime(-1, 1, 0); + return *time; +} + +const MediaTime& MediaTime::positiveInfiniteTime() +{ + static const MediaTime* time = new MediaTime(0, 1, PositiveInfinite | Valid); + return *time; +} + +const MediaTime& MediaTime::negativeInfiniteTime() +{ + static const MediaTime* time = new MediaTime(-1, 1, NegativeInfinite | Valid); + return *time; +} + +const MediaTime& MediaTime::indefiniteTime() +{ + static const MediaTime* time = new MediaTime(0, 1, Indefinite | Valid); + return *time; +} + +void MediaTime::setTimeScale(int32_t timeScale) +{ + if (timeScale == m_timeScale) + return; + timeScale = std::min(MaximumTimeScale, timeScale); + int64_t wholePart = m_timeValue / m_timeScale; + + // If setting the time scale will cause an overflow, divide the + // timescale by two until the number will fit, and round the + // result. + int64_t newWholePart; + while (!safeMultiply(wholePart, timeScale, newWholePart)) + timeScale /= 2; + + int64_t remainder = m_timeValue % m_timeScale; + m_timeValue = newWholePart + (remainder * timeScale) / m_timeScale; + m_timeScale = timeScale; +} + +static int32_t signum(int64_t val) +{ + return (0 < val) - (val < 0); +} + +MediaTime abs(const MediaTime& rhs) +{ + if (rhs.isInvalid()) + return MediaTime::invalidTime(); + if (rhs.isNegativeInfinite() || rhs.isPositiveInfinite()) + return MediaTime::positiveInfiniteTime(); + MediaTime val = rhs; + val.m_timeValue *= signum(rhs.m_timeScale) * signum(rhs.m_timeValue); + return val; +} + +} + diff --git a/Source/WTF/wtf/MediaTime.h b/Source/WTF/wtf/MediaTime.h new file mode 100644 index 000000000..61d1e41c5 --- /dev/null +++ b/Source/WTF/wtf/MediaTime.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <cmath> +#include <limits> +#include <math.h> +#include <stdint.h> + +namespace WTF { + +class WTF_EXPORT_PRIVATE MediaTime { +public: + enum { + Valid = 1 << 0, + HasBeenRounded = 1 << 1, + PositiveInfinite = 1 << 2, + NegativeInfinite = 1 << 3, + Indefinite = 1 << 4, + }; + + MediaTime(); + MediaTime(int64_t value, int32_t scale = DefaultTimeScale, uint32_t flags = Valid); + MediaTime(const MediaTime& rhs); + ~MediaTime(); + + static MediaTime createWithFloat(float floatTime, int32_t timeScale = DefaultTimeScale); + static MediaTime createWithDouble(double doubleTime, int32_t timeScale = DefaultTimeScale); + + float toFloat() const; + double toDouble() const; + + MediaTime& operator=(const MediaTime& rhs); + MediaTime operator+(const MediaTime& rhs) const; + MediaTime operator-(const MediaTime& rhs) const; + bool operator<(const MediaTime& rhs) const; + bool operator>(const MediaTime& rhs) const; + bool operator==(const MediaTime& rhs) const; + bool operator>=(const MediaTime& rhs) const; + bool operator<=(const MediaTime& rhs) const; + + typedef enum { + LessThan = -1, + EqualTo = 0, + GreaterThan = 1, + } ComparisonFlags; + + ComparisonFlags compare(const MediaTime& rhs) const; + + bool isValid() const { return m_timeFlags & Valid; } + bool isInvalid() const { return !isValid(); } + bool hasBeenRounded() const { return m_timeFlags & HasBeenRounded; } + bool isPositiveInfinite() const { return m_timeFlags & PositiveInfinite; } + bool isNegativeInfinite() const { return m_timeFlags & NegativeInfinite; } + bool isIndefinite() const { return m_timeFlags & Indefinite; } + + static const MediaTime& zeroTime(); + static const MediaTime& invalidTime(); + static const MediaTime& positiveInfiniteTime(); + static const MediaTime& negativeInfiniteTime(); + static const MediaTime& indefiniteTime(); + + const int64_t& timeValue() const { return m_timeValue; } + const int32_t& timeScale() const { return m_timeScale; } + + friend WTF_EXPORT_PRIVATE MediaTime abs(const MediaTime& rhs); +private: + static const int32_t DefaultTimeScale = 6000; + static const int32_t MaximumTimeScale; + + void setTimeScale(int32_t); + + int64_t m_timeValue; + int32_t m_timeScale; + uint32_t m_timeFlags; +}; + +WTF_EXPORT_PRIVATE extern MediaTime abs(const MediaTime& rhs); +} + +using WTF::MediaTime; +using WTF::abs; diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index a25893685..f99c4c8ab 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -1086,8 +1086,11 @@ #define ENABLE_OBJECT_MARK_LOGGING 0 -#if !defined(ENABLE_PARALLEL_GC) && !ENABLE(OBJECT_MARK_LOGGING) && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(QT) || PLATFORM(BLACKBERRY) || PLATFORM(GTK)) && ENABLE(COMPARE_AND_SWAP) +#if !defined(ENABLE_PARALLEL_GC) && !ENABLE(OBJECT_MARK_LOGGING) && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(BLACKBERRY) || PLATFORM(GTK)) && ENABLE(COMPARE_AND_SWAP) #define ENABLE_PARALLEL_GC 1 +#elif PLATFORM(QT) +// Parallel GC is temporarily disabled on Qt because of regular crashes, see https://bugs.webkit.org/show_bug.cgi?id=90957 for details +#define ENABLE_PARALLEL_GC 0 #endif #if !defined(ENABLE_GC_VALIDATION) && !defined(NDEBUG) @@ -1102,7 +1105,7 @@ #define WTF_USE_COREMEDIA 1 #endif -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(QT) || PLATFORM(BLACKBERRY) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(BLACKBERRY) #define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1 #endif diff --git a/Source/WTF/wtf/RefPtrHashMap.h b/Source/WTF/wtf/RefPtrHashMap.h index 0af36be60..5fae90e8c 100644 --- a/Source/WTF/wtf/RefPtrHashMap.h +++ b/Source/WTF/wtf/RefPtrHashMap.h @@ -34,7 +34,7 @@ namespace WTF { private: typedef KeyTraitsArg KeyTraits; typedef MappedTraitsArg MappedTraits; - typedef PairHashTraits<KeyTraits, MappedTraits> ValueTraits; + typedef KeyValuePairHashTraits<KeyTraits, MappedTraits> ValueTraits; public: typedef typename KeyTraits::TraitType KeyType; @@ -51,7 +51,7 @@ namespace WTF { typedef HashArg HashFunctions; - typedef HashTable<KeyType, ValueType, PairFirstExtractor<ValueType>, + typedef HashTable<KeyType, ValueType, KeyValuePairKeyExtractor<ValueType>, HashFunctions, ValueTraits, KeyTraits> HashTableType; typedef HashMapTranslator<ValueTraits, HashFunctions> diff --git a/Source/WTF/wtf/ThreadSpecific.h b/Source/WTF/wtf/ThreadSpecific.h index 60c9907bd..f51ab4cf2 100644 --- a/Source/WTF/wtf/ThreadSpecific.h +++ b/Source/WTF/wtf/ThreadSpecific.h @@ -1,7 +1,6 @@ /* * Copyright (C) 2008 Apple Inc. All rights reserved. * Copyright (C) 2009 Jian Li <jianli@chromium.org> - * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -103,33 +102,6 @@ private: }; #if USE(PTHREADS) - -typedef pthread_key_t ThreadSpecificKey; - -inline void ThreadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *)) -{ - int error = pthread_key_create(key, destructor); - if (error) - CRASH(); -} - -inline void ThreadSpecificKeyDelete(ThreadSpecificKey key) -{ - int error = pthread_key_delete(key); - if (error) - CRASH(); -} - -inline void ThreadSpecificSet(ThreadSpecificKey key, void* value) -{ - pthread_setspecific(key, value); -} - -inline void* ThreadSpecificGet(ThreadSpecificKey key) -{ - return pthread_getspecific(key); -} - template<typename T> inline ThreadSpecific<T>::ThreadSpecific() { @@ -167,14 +139,6 @@ const int kMaxTlsKeySize = 256; WTF_EXPORT_PRIVATE long& tlsKeyCount(); WTF_EXPORT_PRIVATE DWORD* tlsKeys(); -class ThreadSpecificKeyValue; -typedef ThreadSpecificKeyValue* ThreadSpecificKey; - -void ThreadSpecificKeyCreate(ThreadSpecificKey*, void (*)(void *)); -void ThreadSpecificKeyDelete(ThreadSpecificKey); -void ThreadSpecificSet(ThreadSpecificKey, void*); -void* ThreadSpecificGet(ThreadSpecificKey); - template<typename T> inline ThreadSpecific<T>::ThreadSpecific() : m_index(-1) diff --git a/Source/WTF/wtf/ThreadSpecificWin.cpp b/Source/WTF/wtf/ThreadSpecificWin.cpp index 61a594251..d72996a7a 100644 --- a/Source/WTF/wtf/ThreadSpecificWin.cpp +++ b/Source/WTF/wtf/ThreadSpecificWin.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2009 Jian Li <jianli@chromium.org> - * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,72 +19,15 @@ */ #include "config.h" -#include "ThreadSpecific.h" -#include "StdLibExtras.h" -#include "ThreadingPrimitives.h" +#include "ThreadSpecific.h" -#if !USE(PTHREADS) +#if USE(PTHREADS) +#error This file should not be compiled by ports that do not use Windows native ThreadSpecific implementation. +#endif namespace WTF { -static Mutex& destructorsMutex() -{ - DEFINE_STATIC_LOCAL(Mutex, staticMutex, ()); - return staticMutex; -} - -class ThreadSpecificKeyValue { -public: - ThreadSpecificKeyValue(void (*destructor)(void *)) - : m_destructor(destructor) - { - m_tlsKey = TlsAlloc(); - if (m_tlsKey == TLS_OUT_OF_INDEXES) - CRASH(); - - MutexLocker locker(destructorsMutex()); - m_next = m_first; - m_first = this; - } - - ~ThreadSpecificKeyValue() - { - MutexLocker locker(destructorsMutex()); - ThreadSpecificKeyValue** next = &m_first; - while (*next != this) { - ASSERT(*next); - next = &(*next)->m_next; - } - *next = (*next)->m_next; - - TlsFree(m_tlsKey); - } - - void setValue(void* data) { TlsSetValue(m_tlsKey, data); } - void* value() { return TlsGetValue(m_tlsKey); } - - static void callDestructors() - { - MutexLocker locker(destructorsMutex()); - ThreadSpecificKeyValue* next = m_first; - while (next) { - if (void* data = next->value()) - next->m_destructor(data); - next = next->m_next; - } - } - -private: - void (*m_destructor)(void *); - DWORD m_tlsKey; - ThreadSpecificKeyValue* m_next; - - static ThreadSpecificKeyValue* m_first; -}; - -ThreadSpecificKeyValue* ThreadSpecificKeyValue::m_first = 0; - long& tlsKeyCount() { static long count; @@ -98,26 +40,6 @@ DWORD* tlsKeys() return keys; } -void ThreadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *)) -{ - *key = new ThreadSpecificKeyValue(destructor); -} - -void ThreadSpecificKeyDelete(ThreadSpecificKey key) -{ - delete key; -} - -void ThreadSpecificSet(ThreadSpecificKey key, void* data) -{ - key->setValue(data); -} - -void* ThreadSpecificGet(ThreadSpecificKey key) -{ - return key->value(); -} - void ThreadSpecificThreadExit() { for (long i = 0; i < tlsKeyCount(); i++) { @@ -126,10 +48,6 @@ void ThreadSpecificThreadExit() if (data) data->destructor(data); } - - ThreadSpecificKeyValue::callDestructors(); } } // namespace WTF - -#endif // !USE(PTHREADS) diff --git a/Source/WTF/wtf/TypedArrayBase.h b/Source/WTF/wtf/TypedArrayBase.h index 5ec7a198a..185cf7762 100644 --- a/Source/WTF/wtf/TypedArrayBase.h +++ b/Source/WTF/wtf/TypedArrayBase.h @@ -65,6 +65,14 @@ class TypedArrayBase : public ArrayBufferView { return m_length * sizeof(T); } + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. + T item(unsigned index) const + { + ASSERT(index < TypedArrayBase<T>::m_length); + return TypedArrayBase<T>::data()[index]; + } + protected: TypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : ArrayBufferView(buffer, byteOffset) diff --git a/Source/WTF/wtf/Uint16Array.h b/Source/WTF/wtf/Uint16Array.h index c7f812c00..144469386 100644 --- a/Source/WTF/wtf/Uint16Array.h +++ b/Source/WTF/wtf/Uint16Array.h @@ -39,6 +39,10 @@ public: static inline PassRefPtr<Uint16Array> create(const unsigned short* array, unsigned length); static inline PassRefPtr<Uint16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Uint16Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<unsigned short>* array, unsigned offset) { return TypedArrayBase<unsigned short>::set(array, offset); } void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned short>::set(index, value); } @@ -46,15 +50,17 @@ public: inline PassRefPtr<Uint16Array> subarray(int start) const; inline PassRefPtr<Uint16Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeUint16; + } + private: inline Uint16Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<unsigned short>; - - // Overridden from ArrayBufferView. - virtual bool isUnsignedShortArray() const { return true; } }; PassRefPtr<Uint16Array> Uint16Array::create(unsigned length) @@ -72,6 +78,11 @@ PassRefPtr<Uint16Array> Uint16Array::create(PassRefPtr<ArrayBuffer> buffer, unsi return TypedArrayBase<unsigned short>::create<Uint16Array>(buffer, byteOffset, length); } +PassRefPtr<Uint16Array> Uint16Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<unsigned short>::createUninitialized<Uint16Array>(length); +} + Uint16Array::Uint16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : IntegralTypedArrayBase<unsigned short>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/Uint32Array.h b/Source/WTF/wtf/Uint32Array.h index a9cf6b152..1e5b02823 100644 --- a/Source/WTF/wtf/Uint32Array.h +++ b/Source/WTF/wtf/Uint32Array.h @@ -39,6 +39,10 @@ public: static inline PassRefPtr<Uint32Array> create(const unsigned int* array, unsigned length); static inline PassRefPtr<Uint32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Uint32Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<unsigned int>* array, unsigned offset) { return TypedArrayBase<unsigned int>::set(array, offset); } void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned int>::set(index, value); } @@ -46,15 +50,17 @@ public: inline PassRefPtr<Uint32Array> subarray(int start) const; inline PassRefPtr<Uint32Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeUint32; + } + private: inline Uint32Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<unsigned int>; - - // Overridden from ArrayBufferView. - virtual bool isUnsignedIntArray() const { return true; } }; PassRefPtr<Uint32Array> Uint32Array::create(unsigned length) @@ -72,6 +78,11 @@ PassRefPtr<Uint32Array> Uint32Array::create(PassRefPtr<ArrayBuffer> buffer, unsi return TypedArrayBase<unsigned int>::create<Uint32Array>(buffer, byteOffset, length); } +PassRefPtr<Uint32Array> Uint32Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<unsigned int>::createUninitialized<Uint32Array>(length); +} + Uint32Array::Uint32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : IntegralTypedArrayBase<unsigned int>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/Uint8Array.h b/Source/WTF/wtf/Uint8Array.h index be91729d6..a23d1eb50 100644 --- a/Source/WTF/wtf/Uint8Array.h +++ b/Source/WTF/wtf/Uint8Array.h @@ -39,6 +39,10 @@ public: static inline PassRefPtr<Uint8Array> create(const unsigned char* array, unsigned length); static inline PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. + static inline PassRefPtr<Uint8Array> createUninitialized(unsigned length); + // Can’t use "using" here due to a bug in the RVCT compiler. bool set(TypedArrayBase<unsigned char>* array, unsigned offset) { return TypedArrayBase<unsigned char>::set(array, offset); } void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned char>::set(index, value); } @@ -46,15 +50,17 @@ public: inline PassRefPtr<Uint8Array> subarray(int start) const; inline PassRefPtr<Uint8Array> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeUint8; + } + protected: inline Uint8Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<unsigned char>; - - // Overridden from ArrayBufferView. - virtual bool isUnsignedByteArray() const { return true; } }; PassRefPtr<Uint8Array> Uint8Array::create(unsigned length) @@ -72,6 +78,11 @@ PassRefPtr<Uint8Array> Uint8Array::create(PassRefPtr<ArrayBuffer> buffer, unsign return TypedArrayBase<unsigned char>::create<Uint8Array>(buffer, byteOffset, length); } +PassRefPtr<Uint8Array> Uint8Array::createUninitialized(unsigned length) +{ + return TypedArrayBase<unsigned char>::createUninitialized<Uint8Array>(length); +} + Uint8Array::Uint8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : IntegralTypedArrayBase<unsigned char>(buffer, byteOffset, length) { diff --git a/Source/WTF/wtf/Uint8ClampedArray.h b/Source/WTF/wtf/Uint8ClampedArray.h index d9f82490a..d63a4e6f5 100644 --- a/Source/WTF/wtf/Uint8ClampedArray.h +++ b/Source/WTF/wtf/Uint8ClampedArray.h @@ -38,9 +38,8 @@ public: static inline PassRefPtr<Uint8ClampedArray> create(const unsigned char* array, unsigned length); static inline PassRefPtr<Uint8ClampedArray> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); - // Should only be used for WebCore-internal use (like filters and - // getImageData) when it is known the entire array will be filled. - // Do not return these results directly to JavaScript. + // Should only be used when it is known the entire array will be filled. Do + // not return these results directly to JavaScript without filling first. static inline PassRefPtr<Uint8ClampedArray> createUninitialized(unsigned length); // It's only needed to potentially call this method if the array @@ -55,15 +54,17 @@ public: inline PassRefPtr<Uint8ClampedArray> subarray(int start) const; inline PassRefPtr<Uint8ClampedArray> subarray(int start, int end) const; + virtual ViewType getType() const + { + return TypeUint8Clamped; + } + private: inline Uint8ClampedArray(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length); // Make constructor visible to superclass. friend class TypedArrayBase<unsigned char>; - - // Overridden from ArrayBufferView. - virtual bool isUnsignedByteClampedArray() const { return true; } }; PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::create(unsigned length) diff --git a/Source/WTF/wtf/text/AtomicString.cpp b/Source/WTF/wtf/text/AtomicString.cpp index 66bd7851a..6477c45b8 100644 --- a/Source/WTF/wtf/text/AtomicString.cpp +++ b/Source/WTF/wtf/text/AtomicString.cpp @@ -114,11 +114,13 @@ PassRefPtr<StringImpl> AtomicString::add(const LChar* c) return addToStringTable<const LChar*, CStringTranslator>(c); } -struct UCharBuffer { - const UChar* s; +template<typename CharacterType> +struct HashTranslatorCharBuffer { + const CharacterType* s; unsigned length; }; +typedef HashTranslatorCharBuffer<UChar> UCharBuffer; struct UCharBufferTranslator { static unsigned hash(const UCharBuffer& buf) { @@ -295,6 +297,35 @@ PassRefPtr<StringImpl> AtomicString::add(StringImpl* baseString, unsigned start, return addToStringTable<SubstringLocation, SubstringTranslator>(buffer); } +typedef HashTranslatorCharBuffer<LChar> LCharBuffer; +struct LCharBufferFromLiteralDataTranslator { + static unsigned hash(const LCharBuffer& buf) + { + return StringHasher::computeHash(buf.s, buf.length); + } + + static bool equal(StringImpl* const& str, const LCharBuffer& buf) + { + return WTF::equal(str, buf.s, buf.length); + } + + static void translate(StringImpl*& location, const LCharBuffer& buf, unsigned hash) + { + location = StringImpl::createFromLiteral(buf.s, buf.length).leakRef(); + location->setHash(hash); + location->setIsAtomic(true); + } +}; + +PassRefPtr<StringImpl> AtomicString::addFromLiteralData(const LChar *characters, unsigned length) +{ + ASSERT(characters); + ASSERT(length); + + LCharBuffer buffer = { characters, length }; + return addToStringTable<LCharBuffer, LCharBufferFromLiteralDataTranslator>(buffer); +} + PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r) { if (!r->length()) diff --git a/Source/WTF/wtf/text/AtomicString.h b/Source/WTF/wtf/text/AtomicString.h index 73a855997..e75830ee5 100644 --- a/Source/WTF/wtf/text/AtomicString.h +++ b/Source/WTF/wtf/text/AtomicString.h @@ -51,6 +51,19 @@ public: ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl())) { } AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_string(add(baseString, start, length)) { } + enum ConstructFromLiteralTag { ConstructFromLiteral }; + AtomicString(const char* characters, unsigned length, ConstructFromLiteralTag) + : m_string(addFromLiteralData(reinterpret_cast<const LChar*>(characters), length)) + { + } + template<unsigned charactersCount> + ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], ConstructFromLiteralTag) + : m_string(addFromLiteralData(reinterpret_cast<const LChar*>(characters), charactersCount - 1)) + { + COMPILE_ASSERT(charactersCount > 1, AtomicStringFromLiteralNotEmpty); + COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), AtomicStringFromLiteralCannotOverflow); + } + #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) // We have to declare the copy constructor and copy assignment operator as well, otherwise // they'll be implicitly deleted by adding the move constructor and move assignment operator. @@ -156,6 +169,7 @@ private: return r; return addSlowCase(r); } + WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> addFromLiteralData(const LChar *characters, unsigned length); WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> addSlowCase(StringImpl*); WTF_EXPORT_PRIVATE static AtomicString fromUTF8Internal(const char*, const char*); }; diff --git a/Source/WTF/wtf/text/StringImpl.cpp b/Source/WTF/wtf/text/StringImpl.cpp index c4359c113..88369a850 100644 --- a/Source/WTF/wtf/text/StringImpl.cpp +++ b/Source/WTF/wtf/text/StringImpl.cpp @@ -82,6 +82,12 @@ StringImpl::~StringImpl() m_substringBuffer->deref(); } +PassRefPtr<StringImpl> StringImpl::createFromLiteral(const LChar* characters, unsigned length) +{ + ASSERT(charactersAreAllASCII<LChar>(characters, length)); + return adoptRef(new StringImpl(characters, length)); +} + PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, LChar*& data) { if (!length) { diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h index d0060c470..2afa4e20b 100644 --- a/Source/WTF/wtf/text/StringImpl.h +++ b/Source/WTF/wtf/text/StringImpl.h @@ -58,6 +58,7 @@ namespace WTF { struct CStringTranslator; struct HashAndCharactersTranslator; struct HashAndUTF8CharactersTranslator; +struct LCharBufferFromLiteralDataTranslator; struct SubstringTranslator; struct UCharBufferTranslator; @@ -75,6 +76,7 @@ class StringImpl { friend struct WTF::CStringTranslator; friend struct WTF::HashAndCharactersTranslator; friend struct WTF::HashAndUTF8CharactersTranslator; + friend struct WTF::LCharBufferFromLiteralDataTranslator; friend struct WTF::SubstringTranslator; friend struct WTF::UCharBufferTranslator; friend class AtomicStringImpl; @@ -282,6 +284,16 @@ public: return adoptRef(new StringImpl(rep->m_data16 + offset, length, ownerRep)); } + WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> createFromLiteral(const LChar* characters, unsigned length); + template<unsigned charactersCount> + ALWAYS_INLINE static PassRefPtr<StringImpl> createFromLiteral(const char (&characters)[charactersCount]) + { + COMPILE_ASSERT(charactersCount > 1, StringImplFromLiteralNotEmpty); + COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), StringImplFromLiteralCannotOverflow); + + return createFromLiteral(reinterpret_cast<const LChar*>(characters), charactersCount - 1); + } + WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> createUninitialized(unsigned length, LChar*& data); WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> createUninitialized(unsigned length, UChar*& data); template <typename T> static ALWAYS_INLINE PassRefPtr<StringImpl> tryCreateUninitialized(unsigned length, T*& output) diff --git a/Source/WTF/wtf/unicode/glib/UnicodeGLib.h b/Source/WTF/wtf/unicode/glib/UnicodeGLib.h index 8ad532917..89c9b1fb7 100644 --- a/Source/WTF/wtf/unicode/glib/UnicodeGLib.h +++ b/Source/WTF/wtf/unicode/glib/UnicodeGLib.h @@ -189,12 +189,6 @@ inline bool hasLineBreakingPropertyComplexContext(UChar32 c) return false; } -inline bool hasLineBreakingPropertyComplexContextOrIdeographic(UChar32 c) -{ - // FIXME - return false; -} - inline UChar32 mirroredChar(UChar32 c) { gunichar mirror = 0; @@ -217,11 +211,6 @@ inline bool isLower(UChar32 c) return g_unichar_islower(c); } -inline int digitValue(UChar32 c) -{ - return g_unichar_digit_value(c); -} - inline uint8_t combiningClass(UChar32 c) { // FIXME diff --git a/Source/WTF/wtf/unicode/icu/UnicodeIcu.h b/Source/WTF/wtf/unicode/icu/UnicodeIcu.h index fe524b2a2..962e7320a 100644 --- a/Source/WTF/wtf/unicode/icu/UnicodeIcu.h +++ b/Source/WTF/wtf/unicode/icu/UnicodeIcu.h @@ -190,12 +190,6 @@ inline bool hasLineBreakingPropertyComplexContext(UChar32 c) return u_getIntPropertyValue(c, UCHAR_LINE_BREAK) == U_LB_COMPLEX_CONTEXT; } -inline bool hasLineBreakingPropertyComplexContextOrIdeographic(UChar32 c) -{ - int32_t prop = u_getIntPropertyValue(c, UCHAR_LINE_BREAK); - return prop == U_LB_COMPLEX_CONTEXT || prop == U_LB_IDEOGRAPHIC; -} - inline UChar32 mirroredChar(UChar32 c) { return u_charMirror(c); diff --git a/Source/WTF/wtf/unicode/wince/UnicodeWinCE.h b/Source/WTF/wtf/unicode/wince/UnicodeWinCE.h index 1663fc969..d61bb469d 100644 --- a/Source/WTF/wtf/unicode/wince/UnicodeWinCE.h +++ b/Source/WTF/wtf/unicode/wince/UnicodeWinCE.h @@ -129,8 +129,6 @@ bool isPunct(UChar); bool isDigit(UChar); bool isAlphanumeric(UChar); inline bool isSeparatorSpace(UChar c) { return category(c) == Separator_Space; } -inline bool isHighSurrogate(UChar c) { return (c & 0xfc00) == 0xd800; } -inline bool isLowSurrogate(UChar c) { return (c & 0xfc00) == 0xdc00; } UChar toLower(UChar); UChar toUpper(UChar); @@ -167,11 +165,6 @@ inline int umemcasecmp(const UChar* a, const UChar* b, int len) return 0; } -inline UChar32 surrogateToUcs4(UChar high, UChar low) -{ - return (UChar32(high) << 10) + low - 0x35fdc00; -} - } // namespace Unicode } // namespace WTF diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 352b54e6d..6f8ff65e2 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -48,6 +48,8 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/graphics" "${WEBCORE_DIR}/platform/graphics/filters" "${WEBCORE_DIR}/platform/graphics/filters/arm" + "${WEBCORE_DIR}/platform/graphics/harfbuzz" + "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng" "${WEBCORE_DIR}/platform/graphics/transforms" "${WEBCORE_DIR}/platform/image-decoders" "${WEBCORE_DIR}/platform/image-decoders/bmp" @@ -189,7 +191,6 @@ SET(WebCore_IDL_FILES Modules/intents/IntentResultCallback.idl Modules/intents/NavigatorIntents.idl - Modules/mediastream/DeprecatedPeerConnection.idl Modules/mediastream/DOMWindowMediaStream.idl Modules/mediastream/IceCallback.idl Modules/mediastream/IceCandidate.idl @@ -206,7 +207,6 @@ SET(WebCore_IDL_FILES Modules/mediastream/NavigatorUserMediaSuccessCallback.idl Modules/mediastream/PeerConnection00.idl Modules/mediastream/SessionDescription.idl - Modules/mediastream/SignalingCallback.idl Modules/networkinfo/NavigatorNetworkInfoConnection.idl Modules/networkinfo/NetworkInfoConnection.idl @@ -532,6 +532,7 @@ SET(WebCore_IDL_FILES page/Console.idl page/Coordinates.idl page/Crypto.idl + page/DOMSecurityPolicy.idl page/DOMSelection.idl page/DOMWindow.idl page/EventSource.idl @@ -813,7 +814,6 @@ SET(WebCore_SOURCES Modules/intents/IntentRequest.cpp Modules/intents/NavigatorIntents.cpp - Modules/mediastream/DeprecatedPeerConnection.cpp Modules/mediastream/IceCandidate.cpp Modules/mediastream/LocalMediaStream.cpp Modules/mediastream/MediaStream.cpp @@ -1624,6 +1624,8 @@ SET(WebCore_SOURCES page/ContentSecurityPolicy.cpp page/ContextMenuController.cpp page/Crypto.cpp + page/DiagnosticLoggingKeys.cpp + page/DOMSecurityPolicy.cpp page/DOMSelection.cpp page/DOMTimer.cpp page/DOMWindow.cpp @@ -1792,6 +1794,8 @@ SET(WebCore_SOURCES platform/graphics/Gradient.cpp platform/graphics/GraphicsContext.cpp platform/graphics/GraphicsLayer.cpp + platform/graphics/GraphicsLayerAnimation.cpp + platform/graphics/GraphicsLayerTransform.cpp platform/graphics/GraphicsTypes.cpp platform/graphics/Image.cpp platform/graphics/ImageBuffer.cpp @@ -1810,6 +1814,7 @@ SET(WebCore_SOURCES platform/graphics/SurrogatePairAwareTextIterator.cpp platform/graphics/SVGGlyph.cpp platform/graphics/TextRun.cpp + platform/graphics/TiledBackingStore.cpp platform/graphics/WidthIterator.cpp platform/graphics/filters/CustomFilterGlobalContext.cpp @@ -1851,6 +1856,11 @@ SET(WebCore_SOURCES platform/graphics/filters/arm/FELightingNEON.cpp platform/graphics/filters/arm/FELightingNEON.h + platform/graphics/texmap/TextureMapper.cpp + platform/graphics/texmap/TextureMapperBackingStore.cpp + platform/graphics/texmap/TextureMapperImageBuffer.cpp + platform/graphics/texmap/TextureMapperLayer.cpp + platform/graphics/transforms/AffineTransform.cpp platform/graphics/transforms/Matrix3DTransformOperation.cpp platform/graphics/transforms/MatrixTransformOperation.cpp @@ -2081,6 +2091,7 @@ SET(WebCore_SOURCES rendering/style/StyleVisualData.cpp rendering/style/SVGRenderStyle.cpp rendering/style/SVGRenderStyleDefs.cpp + rendering/style/WrapShapes.cpp rendering/svg/RenderSVGBlock.cpp rendering/svg/RenderSVGContainer.cpp @@ -2627,6 +2638,7 @@ SET(WebCoreTestSupport_IDL_INCLUDES ) SET(WebCoreTestSupport_IDL_FILES + testing/FastMallocStatistics.idl testing/Internals.idl testing/InternalSettings.idl ) @@ -2636,6 +2648,20 @@ SET(WebCoreTestSupport_SOURCES testing/InternalSettings.cpp ) +IF (ENABLE_MEDIA_SOURCE) + LIST(APPEND WebCore_INCLUDE_DIRECTORIES + ${WEBCORE_DIR}/Modules/mediasource + ) + LIST(APPEND WebCore_IDL_FILES + Modules/mediasource/SourceBuffer.idl + Modules/mediasource/SourceBufferList.idl + ) + LIST(APPEND WebCore_SOURCES + Modules/mediasource/SourceBuffer.cpp + Modules/mediasource/SourceBufferList.cpp + ) +ENDIF() + # Modules that the bindings generator scripts may use SET(SCRIPTS_RESOLVE_SUPPLEMENTAL ${WEBCORE_DIR}/bindings/scripts/IDLParser.pm diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 9b673e1dd..883cb25e9 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,7156 @@ +2012-07-29 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Resource agent's reference to cached resources should be weak. + https://bugs.webkit.org/show_bug.cgi?id=92108 + + Reviewed by Pavel Feldman. + + NetworkResourcesData now stores a raw pointer to CachedResource. + CachedResource now notifies InspectorInstrumentation that it will be destroyed. + InspectorInstrumentation stores a set of InstrumentingAgents and broadcasts willDestroyCachedResource event to all available resourceAgents. + Destroyed resources content is saved to NetworkResourcesData. + + Tests: http/tests/inspector/network/cached-resource-destroyed-moved-to-storage.html + http/tests/inspector/network/cached-resource-destroyed-too-big-discarded.html + + * WebCore.exp.in: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::inspectedPageDestroyed): + * inspector/InspectorInstrumentation.cpp: + (WebCore): + (WebCore::InspectorInstrumentation::willDestroyCachedResourceImpl): + (WebCore::InspectorInstrumentation::registerInstrumentingAgents): + (WebCore::InspectorInstrumentation::unregisterInstrumentingAgents): + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + (WebCore::InspectorInstrumentation::willDestroyCachedResource): + (WebCore): + * inspector/InspectorResourceAgent.cpp: + (WebCore::InspectorResourceAgent::didReceiveData): + (WebCore::InspectorResourceAgent::willDestroyCachedResource): + (WebCore): + (WebCore::InspectorResourceAgent::getResponseBody): + * inspector/InspectorResourceAgent.h: + (InspectorResourceAgent): + * inspector/NetworkResourcesData.cpp: + (WebCore::NetworkResourcesData::ResourceData::ResourceData): + (WebCore::NetworkResourcesData::ResourceData::setContent): + (WebCore::NetworkResourcesData::setResourceContent): + (WebCore::NetworkResourcesData::removeCachedResource): + (WebCore): + * inspector/NetworkResourcesData.h: + (ResourceData): + (WebCore::NetworkResourcesData::ResourceData::base64Encoded): + (WebCore::NetworkResourcesData::ResourceData::cachedResource): + (NetworkResourcesData): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::~CachedResource): + (WebCore::CachedResource::removeClient): + (WebCore::CachedResource::deleteIfPossible): + (WebCore): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::garbageCollectDocumentResourcesTimerFired): + (WebCore::CachedResourceLoader::garbageCollectDocumentResources): + (WebCore::CachedResourceLoader::clearPreloads): + * loader/cache/CachedResourceLoader.h: + (CachedResourceLoader): + * loader/cache/MemoryCache.cpp: + (WebCore::MemoryCache::evict): + * testing/InternalSettings.cpp: + * testing/Internals.cpp: + (WebCore::Internals::garbageCollectDocumentResources): + (WebCore): + * testing/Internals.h: + (Internals): + * testing/Internals.idl: + +2012-07-29 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] Accelerated compositing support using TextureMapper on Efl WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=91583 + + Reviewed by Noam Rosenthal. + + This patch is a subset of Efl's UI_SIDE_COMPOSITING implementation. + This patch adds Texture Mapper related files to PlatformEfl.cmake. + And wrapped TextureMapperLayer and TextureMapperBackingStore with USE(ACCELERATED_COMPOSITING) for fixing building error when disable ACCELERATED_COMPOSITING. + + * CMakeLists.txt: + * PlatformEfl.cmake: + * platform/graphics/GraphicsLayer.cpp: + (WebCore): + * platform/graphics/GraphicsLayer.h: + (GraphicsLayer): + * platform/graphics/GraphicsLayerAnimation.cpp: + * platform/graphics/GraphicsLayerAnimation.h: + * platform/graphics/PlatformLayer.h: + (WebCore): + * platform/graphics/texmap/TextureMapperBackingStore.cpp: + * platform/graphics/texmap/TextureMapperBackingStore.h: + * platform/graphics/texmap/TextureMapperLayer.h: + +2012-07-29 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] TILED_BACKING_STORE support on Efl WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=91582 + + Reviewed by Noam Rosenthal. + + This patch is a subset of Efl's UI_SIDE_COMPOSITING implementation. + This patch adds TILED_BACKING_STORE related files to CMakeLists.txt and PlatformEfl.cmake + + * CMakeLists.txt: + * PlatformEfl.cmake: + +2012-07-29 Keishi Hattori <keishi@webkit.org> + + Fix removing invalid values from color input suggestions + https://bugs.webkit.org/show_bug.cgi?id=92502 + + Reviewed by Kent Tamura. + + Make ColorInputType::typeMismatchFor() return false for invalid color + values so that they don't appear in the list of suggestions that + ColorInputType::suggestions() returns. + + No new tests. Tests to be added in Bug 92075. + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::typeMismatchFor): + (WebCore): + * html/ColorInputType.h: + (ColorInputType): + +2012-07-29 Li Yin <li.yin@intel.com> + + getChannelData should raise exception when index is more than numberOfChannels. + https://bugs.webkit.org/show_bug.cgi?id=92223 + + Reviewed by Kentaro Hara. + + Spec: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AudioBuffer-section + In getChannelData function, the index value MUST be less than numberOfChannels + or an exception will be thrown. + + Test: webaudio/audiobuffer.html + + * Modules/webaudio/AudioBuffer.cpp: + (WebCore::AudioBuffer::getChannelData): + (WebCore): + * Modules/webaudio/AudioBuffer.h: + (WebCore): + (AudioBuffer): + * Modules/webaudio/AudioBuffer.idl: raise exception when index is not less than numberOfChannels. + +2012-07-29 Sukolsak Sakshuwong <sukolsak@google.com> + + forward-delete in the last cell of a table moves the caret after the table + https://bugs.webkit.org/show_bug.cgi?id=24250 + + Reviewed by Ryosuke Niwa. + + The ForwardDelete command moved the cursor after the table when it's invoked + in an empty cell that is the last cell of a table. It also removed the break + element when invoked in an empty cell that is not the last cell of a table. + Make it do nothing inside an empty table cell. + + Test: editing/deleting/forward-delete-empty-table-cell.html + + * editing/TypingCommand.cpp: + (WebCore::TypingCommand::forwardDeleteKeyPressed): + +2012-07-29 Kwang Yul Seo <skyul@company100.net> + + Remove unused method HTMLConstructionSiteTask::take(HTMLConstructionSiteTask&) + https://bugs.webkit.org/show_bug.cgi?id=92601 + + Reviewed by Adam Barth. + + This method was introduced in r104000, but has never been used from the beginning. + + No functional change. + + * html/parser/HTMLConstructionSite.h: + +2012-07-29 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] HarfBuzzShaper can't handle segmented text run + https://bugs.webkit.org/show_bug.cgi?id=92445 + + Reviewed by Tony Chang. + + Pass the range to be displayed to HarfBuzzShaper. The shaper calculates positions and advances of each glyph + regardless of the range, but only add glyphs which are in the range. + + No new tests. platform/chromium-linux/fast/text/international/draw-complex-text-from-to.html should + work as expected once we move to use harfbuzz-ng on linux. Note that the current expectation will need to be rebaselined + because the old hb shaper (ComplexTextController) mishandles the range. |to| should be exclusive. I'll rebaseline + the expectation later. + + * platform/graphics/harfbuzz/FontHarfBuzz.cpp: + (WebCore::Font::drawComplexText): Call shaper.setDrawRange(). + * platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp: + (WebCore::HarfBuzzShaper::HarfBuzzShaper): + (WebCore::HarfBuzzShaper::setDrawRange): Added. + (WebCore): + (WebCore::HarfBuzzShaper::shouldDrawCharacterAt): Added. + (WebCore::HarfBuzzShaper::shapeHarfBuzzRuns): Added variables that hold pending advances. + (WebCore::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun): Add only glyphs which are in the given range to glyphBuffer. + * platform/graphics/harfbuzz/ng/HarfBuzzShaper.h: + (HarfBuzzShaper): + * platform/graphics/mac/FontComplexTextMac.cpp: + (WebCore::Font::drawComplexText): Call shaper.setDrawRange(). + +2012-07-29 Dan Bernstein <mitz@apple.com> + + Hit testing in the gap between pages returns incorrect results in flipped blocks writing modes + https://bugs.webkit.org/show_bug.cgi?id=92600 + + Reviewed by Simon Fraser. + + Test: fast/multicol/hit-test-gap-between-pages-flipped.html + + * rendering/RenderBlock.h: + (WebCore::RenderBlock): Promoted offsetForContents() from private to protected, and demoted + adjustPointToColumnContents() back to private. + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hitTest): Changed to flip the point passed to updateHitTestResults(). + * rendering/RenderView.cpp: + (WebCore::RenderView::updateHitTestResult): Changed to call offsetForContents(), which, as + of r123977, correctly accounts for flippedness. + +2012-07-29 Dan Bernstein <mitz@apple.com> + + In flipped blocks, a point on the top edge of a text box is considered outside the box (and vice versa) + https://bugs.webkit.org/show_bug.cgi?id=92597 + + Reviewed by Ryosuke Niwa. + + This is similar to <http://webkit.org/b/92593> except for RenderText. Fixing this required + fixing some code that creates a point inside a box by setting its y coordinate to the + logical top of the box. In a flipped block, this would be just outside the box. + + Enhanced fast/writing-mode/flipped-blocks-hit-test-line-edges.html to cover this. + + * editing/visible_units.cpp: + (WebCore::absoluteLineDirectionPointToLocalPointInBlock): Changed to use + RootInlineBox::blockDirectionPointInLine in the vertical case as well. + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::positionForPointWithInlineChildren): Changed to use + RootInlineBox::blockDirectionPointInLine. + * rendering/RenderText.cpp: + (WebCore::RenderText::positionForPoint): Changed the strictness of y inequalities based on + the flippedness of the block. This fixes the bug. + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::blockDirectionPointInLine): Moved the implementation here from the + header, and made it return the bottom in the flipped block case, so that the returned point + is inside the line in that case as well. + * rendering/RootInlineBox.h: + +2012-07-29 Rik Cabanier <cabanier@adobe.com> + + ENABLE_CSS_COMPOSITING flag + https://bugs.webkit.org/show_bug.cgi?id=92553 + + Reviewed by Dirk Schulze. + + Adds compiler flag CSS_COMPOSITING to build systems to enable CSS blending and compositing. See spec https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html + + * GNUmakefile.am: + * Configurations/FeatureDefines.xcconfig: + +2012-07-29 Dan Bernstein <mitz@apple.com> + + In flipped blocks, a point on the top edge of a box is considered outside the box (and vice versa) + https://bugs.webkit.org/show_bug.cgi?id=92593 + + Reviewed by Simon Fraser. + + With respect to hit testing, boxes should always behave as half-open intervals which include + the physical top and left edges and not the bottom and right edges. + RenderBlock::positionForPoint was not adhering to this, since it was comparing flipped + coordinates. + + Tests: fast/writing-mode/flipped-blocks-hit-test-box-edges.html + fast/writing-mode/flipped-blocks-hit-test-line-edges.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::positionForPointWithInlineChildren): When blocks are flipped, changed + strict inequalities of y coordinates into non-strict ones and non-strict inequalities into + strict ones. + (WebCore::RenderBlock::positionForPoint): Ditto, except for the test for being under the top + of the last candidate box, which was made non-strict in the unflipped case and remained + strict. + +2012-07-28 Dan Bernstein <mitz@apple.com> + + RenderBlock::offsetForContents() is wrong in flipped blocks writing modes + https://bugs.webkit.org/show_bug.cgi?id=92588 + + Reviewed by Sam Weinig. + + Tests: fast/multicol/hit-test-block-axis-flipped.html + fast/writing-mode/flipped-blocks-hit-test-overflow-scroll.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::offsetForContents): Flip the point, which puts it back in unflipped + coordinates, before adding the scroll offset and adjusting for columns, then flip it back. + (WebCore::RenderBlock::adjustPointToColumnContents): Changed the inline-axis cases to + work with an unflipped point. + +2012-07-28 Dan Bernstein <mitz@apple.com> + + In flipped lines writing modes, hit testing at the beginning of a column may return a result from the previous column + https://bugs.webkit.org/show_bug.cgi?id=92566 + + Reviewed by Simon Fraser. + + Enhanced the fix for <http://webkit.org/b/92524> to work with flipped lines. + + Extended fast/multicol/hit-test-end-of-column-with-line-height.html. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::positionForPointWithInlineChildren): For flipped lines, check if the + hit line is the last one before a page break, and in that case, check if the hit point was + after the break. + +2012-07-28 Simon Fraser <simon.fraser@apple.com> + + Size changes on a layer with negative z-index children don't repaint correctly + https://bugs.webkit.org/show_bug.cgi?id=92583 + + Reviewed by Dean Jackson. + + Negative z-index descendants cause a composited layer to have a separate + layer for foreground content. If something caused that foreground layer + to change size (like toggling visibility on a descendant), we failed to + repaint the foreground layer, resulting in stretched content. + + Test: compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Repaint the foreground + layer if its size changes, like we do for the main layer. + +2012-07-28 Simon Fraser <simon.fraser@apple.com> + + Ignore visibility:hidden elements when computing compositing layer bounds + https://bugs.webkit.org/show_bug.cgi?id=92569 + + Reviewed by Dan Bernstein. + + When computing the bounds of compositing layers, we would take into account + layers with no visible content (visibility:hidden, and no non-hidden descendants). + This caused some huge layers in mobile Google maps. + + Tests: compositing/geometry/bounds-ignores-hidden-composited-descendant.html + compositing/geometry/bounds-ignores-hidden-dynamic.html + compositing/geometry/bounds-ignores-hidden.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::calculateLayerBounds): If the ExcludeHiddenDescendants flag is set, return + the empty rect for layers with no visible content or descendants, as long as the layer is not + the root of the subtree whose bounds are being computed. + calculateLayerBounds() currently (I think incorrectly) passes the default flags to the recursive calls. + It should probably just pass 'flags', but to make this change safe, OR in the ExcludeHiddenDescendants + flag. + * rendering/RenderLayer.h: Add an ExcludeHiddenDescendants flag to the CalculateLayerBoundsFlags. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::calculateCompositedBounds): Pass the ExcludeHiddenDescendants + flag. + +2012-07-28 Min Qin <qinmin@chromium.org> + + Add an overlay play button to media controls on android + https://bugs.webkit.org/show_bug.cgi?id=92132 + + Reviewed by Adam Barth. + + This change adds an overlay play button to the media controls for android. + No tests for now as this setting is not being used by other port. + Will add a test and adjust all the test expectations when we upstream the layout tests for android. + + * WebCore.gypi: + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSValueKeywords.in: + * css/mediaControls.css: + (audio::-webkit-media-controls-overlay-play-button, video::-webkit-media-controls-overlay-play-button): + * css/mediaControlsChromiumAndroid.css: + (audio::-webkit-media-controls-overlay-enclosure): + (video::-webkit-media-controls-overlay-enclosure): + (audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button): + (video::-webkit-media-controls-overlay-play-button): + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement): + (WebCore): + (WebCore::MediaControlOverlayPlayButtonElement::create): + (WebCore::MediaControlOverlayPlayButtonElement::defaultEventHandler): + (WebCore::MediaControlOverlayPlayButtonElement::updateDisplayType): + (WebCore::MediaControlOverlayPlayButtonElement::shadowPseudoId): + * html/shadow/MediaControlElements.h: + (MediaControlOverlayPlayButtonElement): + (WebCore): + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement): + (WebCore::MediaControlPanelEnclosureElement::create): + (WebCore): + (WebCore::MediaControlPanelEnclosureElement::shadowPseudoId): + (WebCore::MediaControlRootElementChromium::create): + (WebCore::MediaControlRootElementChromium::initializeControls): + * html/shadow/MediaControlRootElementChromium.h: + (MediaControlChromiumEnclosureElement): + (WebCore): + (MediaControlPanelEnclosureElement): + (MediaControlRootElementChromium): + * html/shadow/MediaControlRootElementChromiumAndroid.cpp: Added. + (WebCore): + (WebCore::MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement): + (WebCore::MediaControlOverlayEnclosureElement::create): + (WebCore::MediaControlOverlayEnclosureElement::shadowPseudoId): + (WebCore::MediaControlRootElementChromiumAndroid::MediaControlRootElementChromiumAndroid): + (WebCore::MediaControls::create): + (WebCore::MediaControlRootElementChromiumAndroid::create): + (WebCore::MediaControlRootElementChromiumAndroid::setMediaController): + (WebCore::MediaControlRootElementChromiumAndroid::playbackStarted): + (WebCore::MediaControlRootElementChromiumAndroid::playbackStopped): + * html/shadow/MediaControlRootElementChromiumAndroid.h: Added. + (WebCore): + (MediaControlOverlayEnclosureElement): + (MediaControlRootElementChromiumAndroid): + * platform/ThemeTypes.h: + * rendering/RenderMediaControlsChromium.cpp: + (WebCore::paintMediaOverlayPlayButton): + (WebCore): + (WebCore::RenderMediaControlsChromium::paintMediaControlsPart): + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::paint): + * rendering/RenderTheme.h: + (WebCore::RenderTheme::paintMediaOverlayPlayButton): + * rendering/RenderThemeChromiumAndroid.cpp: + (WebCore::RenderThemeChromiumAndroid::paintMediaOverlayPlayButton): + (WebCore): + * rendering/RenderThemeChromiumAndroid.h: + +2012-07-28 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] Add a new and reusable enchant-based spellchecker in WebCore + https://bugs.webkit.org/show_bug.cgi?id=90269 + + Reviewed by Martin Robinson. + + Move enchant specific code down to WebCore, into a new class + TextCheckerEnchant, that we can use from WK1 and WK2. + + * GNUmakefile.am: Add flags to handle the SPELLCHECK feature. + * GNUmakefile.list.am: Added new files. + * platform/text/gtk/TextCheckerEnchant.cpp: Added. + (getAvailableDictionariesCallback): + (TextCheckerEnchant::TextCheckerEnchant): + (TextCheckerEnchant::~TextCheckerEnchant): + (TextCheckerEnchant::ignoreWord): + (TextCheckerEnchant::learnWord): + (TextCheckerEnchant::checkSpellingOfString): + (TextCheckerEnchant::getGuessesForWord): + (TextCheckerEnchant::updateSpellCheckingLanguages): + (TextCheckerEnchant::freeEnchantBrokerDictionaries): + * platform/text/gtk/TextCheckerEnchant.h: Added. + (WebCore): + (TextCheckerEnchant): + (WebCore::TextCheckerEnchant::create): + +2012-07-28 Vineet Chaudhary <rgf748@motorola.com> + + [Clamp] support in binding generator. + https://bugs.webkit.org/show_bug.cgi?id=77605 + + Reviewed by Kentaro Hara. + + Currently [Clamp] extended attribute in IDL files. + Spec: http://www.w3.org/TR/2012/CR-WebIDL-20120419/#Clamp + + Tests: TestObj.idl + + * bindings/scripts/CodeGeneratorCPP.pm: + (SkipFunction): Skips methods with [Clamp] parameters. + * bindings/scripts/CodeGeneratorGObject.pm: + (SkipFunction): Skips methods with [Clamp] parameters. + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateParametersCheck): Support [Clamp] for JSBindings. + * bindings/scripts/CodeGeneratorObjC.pm: + (SkipFunction): Skips methods with [Clamp] parameters. + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateParametersCheck): Support [Clamp] for V8Bindings. + * bindings/scripts/IDLAttributes.txt: Added [Clamp] to attributes list. + * bindings/scripts/test/JS/JSTestObj.cpp: Test. + (WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::classMethodWithClampCallback): + (TestObjV8Internal): + +2012-07-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123908. + http://trac.webkit.org/changeset/123908 + https://bugs.webkit.org/show_bug.cgi?id=92572 + + Broke Chromium Linux compile (Requested by pkasting on + #webkit). + + * WebCore.gypi: + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSValueKeywords.in: + * css/mediaControls.css: + * css/mediaControlsChromiumAndroid.css: + (audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button): + * html/shadow/MediaControlElements.cpp: + (WebCore): + * html/shadow/MediaControlElements.h: + (WebCore): + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlChromiumEnclosureElement::create): + (WebCore): + (WebCore::MediaControlChromiumEnclosureElement::shadowPseudoId): + (WebCore::MediaControls::create): + (WebCore::MediaControlRootElementChromium::create): + * html/shadow/MediaControlRootElementChromium.h: + (MediaControlChromiumEnclosureElement): + (MediaControlRootElementChromium): + * html/shadow/MediaControlRootElementChromiumAndroid.cpp: Removed. + * html/shadow/MediaControlRootElementChromiumAndroid.h: Removed. + * platform/ThemeTypes.h: + * rendering/RenderMediaControlsChromium.cpp: + (WebCore::RenderMediaControlsChromium::paintMediaControlsPart): + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::paint): + * rendering/RenderTheme.h: + * rendering/RenderThemeChromiumAndroid.cpp: + * rendering/RenderThemeChromiumAndroid.h: + +2012-07-27 Eli Fidler <efidler@rim.com> + + [BlackBerry] Use new LocaleHandler. + https://bugs.webkit.org/show_bug.cgi?id=92548 + + Reviewed by Yong Li. + + RIM PR 128381 + + * platform/blackberry/LocalizedStringsBlackBerry.cpp: + (WebCore::platformLanguage): + * platform/network/blackberry/ResourceRequestBlackBerry.cpp: + (WebCore::ResourceRequest::initializePlatformRequest): + * platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp: + (WebCore::currentSearchLocaleID): + (WebCore::currentTextBreakLocaleID): + +2012-07-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Change constructor with explicit constructor in WebCore/Modules + https://bugs.webkit.org/show_bug.cgi?id=92529 + + Reviewed by Kentaro Hara. + + As a step to let *explicit* keyword add to constructors which have a parameter, + *explicit* keyword is added to Source/WebCore/Modules in order to avoid implicit + type conversion. + + No new tests. Covered by existing tests. + + * Modules/filesystem/LocalFileSystem.h: + (WebCore::LocalFileSystem::LocalFileSystem): + * Modules/filesystem/Metadata.h: + (WebCore::Metadata::Metadata): + * Modules/filesystem/SyncCallbackHelper.h: + (WebCore::SyncCallbackHelper::SuccessCallbackImpl::SuccessCallbackImpl): + (WebCore::SyncCallbackHelper::ErrorCallbackImpl::ErrorCallbackImpl): + * Modules/mediastream/IceCandidate.h: + (IceCandidate): + * Modules/mediastream/NavigatorUserMediaError.h: + (WebCore::NavigatorUserMediaError::NavigatorUserMediaError): + * Modules/mediastream/SessionDescription.h: + (SessionDescription): + * Modules/mediastream/UserMediaController.h: + (UserMediaController): + * Modules/notifications/NotificationController.h: + (NotificationController): + * Modules/speech/SpeechRecognition.h: + (SpeechRecognition): + * Modules/speech/SpeechRecognitionController.h: + (SpeechRecognitionController): + * Modules/speech/SpeechRecognitionEvent.h: + (SpeechRecognitionEvent): + * Modules/speech/SpeechRecognitionResultList.h: + (SpeechRecognitionResultList): + * Modules/vibration/Vibration.h: + (Vibration): + * Modules/webaudio/AudioBuffer.h: + (AudioBuffer): + * Modules/webaudio/AudioContext.h: + (AudioContext): + * Modules/webaudio/AudioNodeInput.h: + (AudioNodeInput): + * Modules/webaudio/AudioSummingJunction.h: + (AudioSummingJunction): + * Modules/webaudio/BiquadDSPKernel.h: + (WebCore::BiquadDSPKernel::BiquadDSPKernel): + * Modules/webaudio/DefaultAudioDestinationNode.h: + (DefaultAudioDestinationNode): + * Modules/webaudio/DelayDSPKernel.h: + (DelayDSPKernel): + * Modules/webaudio/OfflineAudioCompletionEvent.h: + (OfflineAudioCompletionEvent): + * Modules/webaudio/WaveShaperDSPKernel.h: + (WebCore::WaveShaperDSPKernel::WaveShaperDSPKernel): + * Modules/webaudio/WaveShaperNode.h: + (WaveShaperNode): + * Modules/webaudio/WaveTable.h: + (WaveTable): + * Modules/webdatabase/DatabaseAuthorizer.h: + (DatabaseAuthorizer): + * Modules/webdatabase/DatabaseTask.h: + (Database::DatabaseTransactionTask): + * Modules/webdatabase/DatabaseTracker.h: + (DatabaseTracker): + * Modules/webdatabase/SQLCallbackWrapper.h: + (WebCore::SQLCallbackWrapper::SafeReleaseTask::SafeReleaseTask): + * Modules/webdatabase/SQLException.h: + (WebCore::SQLException::SQLException): + * Modules/websockets/WebSocket.h: + * Modules/websockets/WebSocketExtensionProcessor.h: + (WebCore::WebSocketExtensionProcessor::WebSocketExtensionProcessor): + +2012-07-27 Kentaro Hara <haraken@chromium.org> + + [V8] Optimize Element::getAttributeNS() by replacing String with AtomicString + https://bugs.webkit.org/show_bug.cgi?id=90276 + + Reviewed by Adam Barth. + + In r121439, we changed the argument type of Element::getAttribute() + from String to AtomicString for optimization. This patch changes the + argument type of Element::getAttributeNS() from String to AtomicString. + + Actually this change affects V8 performance only. + + [JSC without the patch] + The binding code converts a given JavaScript string to a String + -> the String is passed to getAttributeNS() + -> the String is converted to an AtomicString when it is passed to + QualifiedName() constructor. + + [JSC with the patch] + The binding code converts a given JavaScript string to a String + -> the String is converted to an AtomicString when it is passed to + getAttributeNS() + -> the AtomicString is passed to QualifiedName() constructor. + + [V8 without the patch] + The binding code retrieves a cached external String for a given + JavaScript string + -> the String is passed to getAttributeNS() + -> the String is converted to AtomicString when it is passed to + QualifiedName() constructor. + + [V8 with the patch] + The binding code retrieves a cached external AtomicString for a given + JavaScript string + -> the AtomicString is passed to getAttributeNS() + -> the AtomicString is passed to QualifiedName() constructor. + + In this way, in JSC, the change affects where a String is converted to + an AtomicString. On the other hand, in V8, (since the AtomicString is already + cached,) we can skip the conversion step. + + Performance test: https://bugs.webkit.org/attachment.cgi?id=150158 + + getAttributeNS (Chromium/Linux): + 577.80ms => 454.60ms + + * dom/Element.cpp: + (WebCore::Element::getAttributeNS): + * dom/Element.h: + (Element): + +2012-07-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123679. + http://trac.webkit.org/changeset/123679 + https://bugs.webkit.org/show_bug.cgi?id=92565 + + Slowed down HTML parsing by 3.6% (Requested by abarth on + #webkit). + + * html/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocumentParser::append): + * html/parser/HTMLEntityParser.cpp: + (WebCore::HTMLEntityParser::consumeNamedEntity): + * html/parser/HTMLParserIdioms.cpp: + (WebCore::stripLeadingAndTrailingHTMLSpaces): + * html/parser/HTMLSourceTracker.cpp: + (WebCore::HTMLSourceTracker::sourceForToken): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::script): + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::operator=): + (WebCore::SegmentedString::clear): + (WebCore::SegmentedString::append): + (WebCore::SegmentedString::prepend): + (WebCore::SegmentedString::advanceSubstring): + (WebCore::SegmentedString::advance): + (WebCore::SegmentedString::advanceSlowCase): + (WebCore::SegmentedString::advanceAndUpdateLineNumberSlowCase): + * platform/text/SegmentedString.h: + (WebCore::SegmentedSubstring::SegmentedSubstring): + (WebCore::SegmentedSubstring::clear): + (WebCore::SegmentedSubstring::appendTo): + (SegmentedSubstring): + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::push): + (WebCore::SegmentedString::isEmpty): + (WebCore::SegmentedString::lookAhead): + (WebCore::SegmentedString::lookAheadIgnoringCase): + (WebCore::SegmentedString::advance): + (WebCore::SegmentedString::advanceAndASSERT): + (WebCore::SegmentedString::advanceAndASSERTIgnoringCase): + (WebCore::SegmentedString::advancePastNewlineAndUpdateLineNumber): + (SegmentedString): + (WebCore::SegmentedString::advancePastNonNewline): + (WebCore::SegmentedString::advanceAndUpdateLineNumber): + (WebCore::SegmentedString::operator*): + (WebCore::SegmentedString::operator->): + (WebCore::SegmentedString::current): + (WebCore::SegmentedString::equalsLiterally): + (WebCore::SegmentedString::equalsIgnoringCase): + (WebCore::SegmentedString::lookAheadInline): + (WebCore::SegmentedString::lookAheadSlowCase): + * xml/parser/CharacterReferenceParserInlineMethods.h: + (WebCore::consumeCharacterReference): + * xml/parser/MarkupTokenizerBase.h: + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::nextInputCharacter): + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::peek): + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::advance): + +2012-07-27 Jer Noble <jer.noble@apple.com> + + Reset the set of "seen" plugins when the main frame load is committed. + https://bugs.webkit.org/show_bug.cgi?id=92564 + + Reviewed by Anders Carlsson. + + Because the Page object is re-used across navigation and reload, reset the list + of seen plugins when the main frame load commits. This gives a good baseline to + compare against the number of pages loaded. + + No new tests; the "seen" plugin list is for diagnostic purposes only. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::dispatchDidCommitLoad): + * page/Page.cpp: + (WebCore::Page::resetSeenPlugins): + * page/Page.h: + +2012-07-27 Sukolsak Sakshuwong <sukolsak@google.com> + + execCommand copies the backgroung-color of the enclosing element to the element being edited. + https://bugs.webkit.org/show_bug.cgi?id=91783 + + Reviewed by Ryosuke Niwa. + + InsertListCommand and some other edit commands remove redundant + style properties after their DOM modification by using + StylePropertySet::removeEquivalentProperties. However, this method + does not remove redundant background-color properties such as + "background-color: white" and "background-color: #fff" because + it compares them using cssText and thus treats them as different. + Add code to convert background colors to RGBA and then compare them. + + Test: editing/style/redundant-background-color.html + + * editing/EditingStyle.cpp: + (WebCore::getRGBABackgroundColor): + (WebCore): + (WebCore::getPropertiesNotIn): + +2012-07-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Return 0 when network is offline + https://bugs.webkit.org/show_bug.cgi?id=92454 + + Reviewed by Kenneth Rohde Christiansen. + + Network Info latest spec says 0 is returned when network is offline. + r123769 modified to return infinity value when network is offiline. + + * platform/efl/NetworkInfoProviderEfl.cpp: + (WebCore::NetworkInfoProviderEfl::bandwidth): + +2012-07-27 Scott Graham <scottmg@chromium.org> + + Change navigator.webkitGamepads[] to navigator.webkitGetGamepads() + https://bugs.webkit.org/show_bug.cgi?id=92533 + + Reviewed by Adam Barth. + + Per discussion on public-webapps. Pages that enumerate navigator were + causing background resources to be created to poll hardware + unintentionally. By changing to an explicit function call, this is + avoided (and the API becomes more clear too). This change updates the + implementation to match the current ED spec. + + * Modules/gamepad/NavigatorGamepad.cpp: + (WebCore::NavigatorGamepad::webkitGetGamepads): + * Modules/gamepad/NavigatorGamepad.h: + (NavigatorGamepad): + * Modules/gamepad/NavigatorGamepad.idl: + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::setWebkitGetGamepadsEnabled): + (WebCore::RuntimeEnabledFeatures::webkitGetGamepadsEnabled): + +2012-07-27 Brady Eidson <beidson@apple.com> + + Plugins should not be allowed to override standard properties/attributes in non-standard worlds + <rdar://problem/11975252> and https://bugs.webkit.org/show_bug.cgi?id=92519 + + Reviewed by Anders Carlsson. + + Change the 3 plugin-owning element's custom bindings to prefer built-in properties if they exist. + When they do they don't give the plugin a chance to override. + + Test: plugins/npruntime/overrides-all-properties.html + + Add plugin custom functions to prefer built-in properties over plugin scriptable object properties: + * bindings/js/JSPluginElementFunctions.h: + (WebCore::pluginElementCustomGetOwnPropertySlot): + (WebCore::pluginElementCustomGetOwnPropertyDescriptor): + + Use those new custom functions for getting properties: + * bindings/js/JSHTMLAppletElementCustom.cpp: + (WebCore::JSHTMLAppletElement::getOwnPropertySlotDelegate): + (WebCore::JSHTMLAppletElement::getOwnPropertyDescriptorDelegate): + * bindings/js/JSHTMLEmbedElementCustom.cpp: + (WebCore::JSHTMLEmbedElement::getOwnPropertySlotDelegate): + (WebCore::JSHTMLEmbedElement::getOwnPropertyDescriptorDelegate): + * bindings/js/JSHTMLObjectElementCustom.cpp: + (WebCore::JSHTMLObjectElement::getOwnPropertySlotDelegate): + (WebCore::JSHTMLObjectElement::getOwnPropertyDescriptorDelegate): + +2012-07-27 Arnaud Renevier <a.renevier@sisa.samsung.com> + + use createUninitialized when creating TypedArray from another array + https://bugs.webkit.org/show_bug.cgi?id=92518 + + Reviewed by Kenneth Russell. + + When creating a Typed Array from another array, we fill it with values + from the source array. So, we can create it uninitialized. This is + make constructor about 35% faster when constructed with another typed + array. + + Test: fast/canvas/webgl/array-constructor.html + + * bindings/js/JSArrayBufferViewHelper.h: + (WebCore::constructArrayBufferViewWithTypedArrayArgument): + (WebCore::constructArrayBufferView): + +2012-07-27 Eli Fidler <efidler@rim.com> + + [BlackBerry] Adapt to change in the FontInfo platform API. + https://bugs.webkit.org/show_bug.cgi?id=92547 + + Reviewed by Yong Li + + RIM PR 161263 + + * page/blackberry/SettingsBlackBerry.cpp: + (WebCore::Settings::initializeDefaultFontFamilies): + +2012-07-27 Antoine Labour <piman@chromium.org> + + [chromium] Fix color matrix filter computation so that filters that don't need clamping are correctly detected as such + https://bugs.webkit.org/show_bug.cgi?id=92452 + + Reviewed by Stephen White. + + Because of precision issues, some filters were returning true to + matrixNeedsClamping when they can return false. This fixes it. + + No new tests in this CL, a follow-up change refactors the code to add + several tests. + + * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp: + +2012-07-27 Jer Noble <jer.noble@apple.com> + + Add diagnostic logging for plugins-per-page. + https://bugs.webkit.org/show_bug.cgi?id=92538 + + Reviewed by Anders Carlsson. + + Add some diagnostic logging for whether a page has seen a plugin, and + whether a page has seen a plugin of a specific type. + + Move the diagnostic logging out of the elemements themselves: + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::updateWidget): + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::updateWidget): + + Instead, log when the plugin is requested, thereby catching plugins which are + rejected because, e.g., Java is disabled or not installed: + * loader/SubframeLoader.cpp: + (WebCore::logPluginRequest): + (WebCore::SubframeLoader::requestObject): + (WebCore::SubframeLoader::createJavaAppletWidget): + + Add new diagnostic key values: + * page/DiagnosticLoggingKeys.cpp: + (WebCore::DiagnosticLoggingKeys::pageContainsPluginKey): + (WebCore::DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey): + * page/DiagnosticLoggingKeys.h: + + Add a map of plugin types seen per-page for diagnostic purposes: + * page/Page.cpp: + (WebCore::Page::hasSeenAnyPlugin): + (WebCore::Page::hasSeenPlugin): + (WebCore::Page::sawPlugin): + * page/Page.h: + +2012-07-27 Patrick Gansterer <paroga@webkit.org> + + [WINCE] Use macros from ICU instead of defining the same functionality again + https://bugs.webkit.org/show_bug.cgi?id=92530 + + Reviewed by Ryosuke Niwa. + + Replace isHighSurrogate() with U16_IS_LEAD(), isLowSurrogate() with + U16_IS_TRAIL() and surrogateToUcs4() with U16_GET_SUPPLEMENTARY(). + + * html/FTPDirectoryDocument.cpp: + (WebCore::processFileDateString): + * loader/archive/mhtml/MHTMLArchive.cpp: + (WebCore::MHTMLArchive::generateMHTMLData): + * platform/graphics/wince/FontWinCE.cpp: + (WebCore::generateComponents): + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + Build warning in CSSPrimitiveValueMappings.h when CSS_STICKY_POSITION is disabled + https://bugs.webkit.org/show_bug.cgi?id=92523 + + Reviewed by Simon Fraser. + + Move #ifdef in CSSPrimitiveValueMappings.h to silent compilation warning + when CSS_STICKY_POSITION is disabled. + + No new tests, no behavior change. + + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + +2012-07-27 Vivek Galatage <vivekgalatage@gmail.com> + + DragController should ascertain dragClient to be non-null + https://bugs.webkit.org/show_bug.cgi?id=92474 + + Reviewed by Tony Chang. + + The DragController must always ensure a valid dragClient object. Hence + adding the ASSERT to assure that. + + No new tests. Added assertion for PageClient.dragClient. + + * page/DragController.cpp: + (WebCore::DragController::DragController): + +2012-07-27 Adrienne Walker <enne@google.com> + + [chromium] Clean up LayerRendererChromium::drawTexturedQuad + https://bugs.webkit.org/show_bug.cgi?id=91823 + + Reviewed by James Robinson. + + LayerRendererChromium::drawTexturedQuad has been around forever and + over time has developed several problems: + - Confusingly named relative to drawTextureQuad + - All but one callers identically manipulate the transform matrix + - Lots of optional parameters that only few functions use + + This patch breaks up drawTexturedQuad into setShaderOpacity (for + optional opacity values sent to the shader), setShaderFloatQuad (the + full FloatQuad used by AA shaders), and drawQuadGeometry (actually + draw the geometry, and wrap the transform logic that was duplicated + everywhere). + + No new tests; no change in functionality. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawCheckerboardQuad): + (WebCore::LayerRendererChromium::drawBackgroundFilters): + (WebCore::LayerRendererChromium::drawRenderPassQuad): + (WebCore::LayerRendererChromium::drawSolidColorQuad): + (WebCore::LayerRendererChromium::drawTileQuad): + (WebCore::LayerRendererChromium::drawYUVVideoQuad): + (WebCore::LayerRendererChromium::drawStreamVideoQuad): + (WebCore::LayerRendererChromium::drawTextureQuad): + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): + (WebCore::LayerRendererChromium::drawHeadsUpDisplay): + (WebCore::LayerRendererChromium::setShaderFloatQuad): + (WebCore::LayerRendererChromium::setShaderOpacity): + (WebCore::LayerRendererChromium::drawQuadGeometry): + (WebCore::LayerRendererChromium::copyTextureToFramebuffer): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + +2012-07-27 Shawn Singh <shawnsingh@chromium.org> + + [chromium] CCLayerTreeHost placeholder scissor should be deviceViewportSize instead of viewportSize + https://bugs.webkit.org/show_bug.cgi?id=92469 + + Reviewed by Adrienne Walker. + + We were accidentally using viewportSize instead of + deviceViewportSize in a particular place in code. Recent + refactoring to use tighter scissor rects exposed this problem. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::updateLayers): + +2012-07-27 Kevin Ellis <kevers@chromium.org> + + Search cancel button is hard to activate with a tap gesture even if touch adjustment is enabled. + https://bugs.webkit.org/show_bug.cgi?id=91894 + + Reviewed by Antonio Gomes. + + Update check for determining if a node responds to tap gestures. + Previously, the cancel button was being discarded as a candidate for + touch adjustment if the touch area clipped the text input region + because the candidate pruning process failed to account for the cancel + button having a default mouse handler. Possibly an interim fix, + depending on resolution to 92093. + + Test: touchadjustment/search-cancel.html + + * page/TouchAdjustment.cpp: + (TouchAdjustment): + (WebCore::TouchAdjustment::nodeRespondsToTapGesture): + +2012-07-27 Varun Jain <varunjain@chromium.org> + + Animated SVGs do not clear previous frame completely in hidpi mode. + https://bugs.webkit.org/show_bug.cgi?id=92395 + + Reviewed by Darin Adler. + + The rect thats is cleared in subsequent frames needed to be scaled with device scale. + + Test: svg/as-image/animated-svg-repaints-completely-in-hidpi.html + + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImage::drawSVGToImageBuffer): + +2012-07-27 Scott Graham <scottmg@chromium.org> + + Fix COMPILE_ASSERT for InlineFlowBox growing + https://bugs.webkit.org/show_bug.cgi?id=92541 + + Reviewed by Dan Bernstein. + + Use unsigned instead of bool to keep size small on Windows. + + No new tests. + + * rendering/InlineFlowBox.h: + (InlineFlowBox): + +2012-07-27 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=92327 + -webkit-background-clip:text is blurry in WebKit 1 apps when + deviceScaleFactor > 1 + -and corresponding- + <rdar://problem/11683788> + + Reviewed by Simon Fraser. + + The bug here is that the code to make createCompatibleBuffer() HiDPI-savvy + assumed that the deviceScaleFactor would always be baked into the CTM of the + GraphicsContext. But that is NOT the case in WebKit 1. + + createCompatibleBuffer() is used for clip text and gradients. + + Now getCTM() takes a parameter indicating whether the result should definitely + include the device scale, or if it should possibly included the device scale, + which is the option that matches old behavior. + * platform/graphics/GraphicsContext.h: + (GraphicsContext): + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::getCTM): + * platform/graphics/openvg/GraphicsContextOpenVG.cpp: + (WebCore::GraphicsContext::getCTM): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::getCTM): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::getCTM): + * platform/graphics/wince/GraphicsContextWinCE.cpp: + (WebCore::GraphicsContext::getCTM): + * platform/graphics/wx/GraphicsContextWx.cpp: + (WebCore::GraphicsContext::getCTM): + + Actually use the new parameter in the CG implementation. Use CG API to get a + matrix that definitely includes the device scale when that is required. + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::getCTM): + + Remove some symbol cruft that doesn't seem to require a replacement. + * WebCore.exp.in: + + Use DefinitelyIncludeDeviceScale when getting the CTM in the buggy spot. + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::createCompatibleBuffer): + + The ImageBuffer for gradients is created using createCompatibleBuffer(), and since + createCompatibleBuffer() now uses getCTM(DefinitelyIncludeDeviceScale) to + determine appropriate sizing, drawPattern() should use that same matrix to + determine pattern sizing. + * platform/graphics/GeneratorGeneratedImage.cpp: + (WebCore::GeneratorGeneratedImage::drawPattern): + +2012-07-27 Tony Chang <tony@chromium.org> + + flex-wrap: wrap not wrapping for % sized items in column flow + https://bugs.webkit.org/show_bug.cgi?id=92324 + + Reviewed by Ojan Vafai. + + We were using trying to use the value of contentLogicalHeight() before having called computeLogicalHeight() + in a few places. Fix this in mainAxisContentExtent() rather than at the callers. + + Test: css3/flexbox/percentage-heights.html + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::mainAxisContentExtent): + (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): If we haven't called computeLogicalHeight, we try to compute + the height based on the fixed flexbox value. min/max don't matter here since percent values are only based on height/width. + * rendering/RenderFlexibleBox.h: Drop const because computeContentLogicalHeightUsing is not const. I can + try making computeContentLogicalHeightUsing const in a follow up change (might be non-trivial). + +2012-07-27 Min Qin <qinmin@chromium.org> + + Add an overlay play button to media controls on android + https://bugs.webkit.org/show_bug.cgi?id=92132 + + Reviewed by Adam Barth. + + This change adds an overlay play button to the media controls for android. + No tests for now as this setting is not being used by other port. + Will add a test and adjust all the test expectations when we upstream the layout tests for android. + + * WebCore.gypi: + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSValueKeywords.in: + * css/mediaControls.css: + (audio::-webkit-media-controls-overlay-play-button, video::-webkit-media-controls-overlay-play-button): + * css/mediaControlsChromiumAndroid.css: + (audio::-webkit-media-controls-overlay-enclosure): + (video::-webkit-media-controls-overlay-enclosure): + (audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button): + (video::-webkit-media-controls-overlay-play-button): + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement): + (WebCore): + (WebCore::MediaControlOverlayPlayButtonElement::create): + (WebCore::MediaControlOverlayPlayButtonElement::defaultEventHandler): + (WebCore::MediaControlOverlayPlayButtonElement::updateDisplayType): + (WebCore::MediaControlOverlayPlayButtonElement::shadowPseudoId): + * html/shadow/MediaControlElements.h: + (MediaControlOverlayPlayButtonElement): + (WebCore): + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement): + (WebCore::MediaControlPanelEnclosureElement::create): + (WebCore): + (WebCore::MediaControlPanelEnclosureElement::shadowPseudoId): + (WebCore::MediaControlRootElementChromium::create): + (WebCore::MediaControlRootElementChromium::initializeControls): + * html/shadow/MediaControlRootElementChromium.h: + (MediaControlChromiumEnclosureElement): + (WebCore): + (MediaControlPanelEnclosureElement): + (MediaControlRootElementChromium): + * html/shadow/MediaControlRootElementChromiumAndroid.cpp: Added. + (WebCore): + (WebCore::MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement): + (WebCore::MediaControlOverlayEnclosureElement::create): + (WebCore::MediaControlOverlayEnclosureElement::shadowPseudoId): + (WebCore::MediaControlRootElementChromiumAndroid::MediaControlRootElementChromiumAndroid): + (WebCore::MediaControls::create): + (WebCore::MediaControlRootElementChromiumAndroid::create): + (WebCore::MediaControlRootElementChromiumAndroid::setMediaController): + (WebCore::MediaControlRootElementChromiumAndroid::playbackStarted): + (WebCore::MediaControlRootElementChromiumAndroid::playbackStopped): + * html/shadow/MediaControlRootElementChromiumAndroid.h: Added. + (WebCore): + (MediaControlOverlayEnclosureElement): + (MediaControlRootElementChromiumAndroid): + * platform/ThemeTypes.h: + * rendering/RenderMediaControlsChromium.cpp: + (WebCore::paintMediaOverlayPlayButton): + (WebCore): + (WebCore::RenderMediaControlsChromium::paintMediaControlsPart): + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::paint): + * rendering/RenderTheme.h: + (WebCore::RenderTheme::paintMediaOverlayPlayButton): + * rendering/RenderThemeChromiumAndroid.cpp: + (WebCore::RenderThemeChromiumAndroid::paintMediaOverlayPlayButton): + (WebCore): + * rendering/RenderThemeChromiumAndroid.h: + +2012-07-27 Anders Carlsson <andersca@apple.com> + + Show the unavailable plug-in indicator for Java applets as well + https://bugs.webkit.org/show_bug.cgi?id=92521 + + Reviewed by Sam Weinig. + + Now that <applet> behaves more like <embed> and <object>, make sure that we show the unavailable plug-in indicator + and call the correct error callbacks if we fail to instantiate the plug-in. + + * WebCore.exp.in: + Export a symbol needed by WebKit2. + + * html/HTMLAppletElement.cpp: + (WebCore::HTMLAppletElement::HTMLAppletElement): + Set the correct service type. + + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::createJavaAppletWidget): + Enable the unavailable plug-in indicator if we fail to create the java applet widget. + +2012-07-27 Dan Bernstein <mitz@apple.com> + + Hit testing near a column break can return a result from an adjacent column when there is leading + https://bugs.webkit.org/show_bug.cgi?id=92524 + + Reviewed by Anders Carlsson. + + The fix for <http://webkit.org/b/92311> relied on the existence of a pagination strut for + detecting that a line was at the beginning of a new column. However, when a line naturally + falls at the beginning of a column, there is no pagination strut, and the check failed. + + Test: fast/multicol/hit-test-end-of-column-with-line-height.html + + * rendering/InlineFlowBox.h: + (WebCore::InlineFlowBox::InlineFlowBox): Added initializer for new member variable. + (InlineFlowBox): Added m_isFirstAfterPageBreak member variable. + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::positionForPointWithInlineChildren): Changed the test for whether a + line was at the beginning of a column from relying on a pagination strut to checking + isFirstAfterPageBreak(). Also refined the hit test itself to include the leading above such + a line. + (WebCore::RenderBlock::adjustLinePositionForPagination): Added calls to + setIsFirstAfterPageBreak() to first reset this flag, then set it to true if necessary. + * rendering/RootInlineBox.h: + (WebCore::RootInlineBox::isFirstAfterPageBreak): Added this accessor. + (WebCore::RootInlineBox::setIsFirstAfterPageBreak): Ditto. + +2012-07-27 John J. Barton <johnjbarton@johnjbarton.com> + + Web Inspector: Allow front_end to be loaded into an iframe + https://bugs.webkit.org/show_bug.cgi?id=92437 + + Reviewed by Pavel Feldman. + + This change only affects 'embedders' of the inspector/front_end. No change of function for WebKit ports. + + * inspector/front-end/ExtensionAPI.js: + Replace window.top with window.parent two places. When WebInspector is loaded as the main window content, + then extension iframes have window.top === window.parent; when WebInspector is loaded as an iframe, then + extensions are iframes in iframes and we need to use a relative address window.parent. + (injectedExtensionAPI.ExtensionViewImpl.dispatchShowEvent): + (injectedExtensionAPI.ExtensionViewImpl): + (injectedExtensionAPI.ExtensionServerClient): + WebKit/chromium/scripts/generate_devtools_extension_api.py: + The current number of frames is used in a dynamically created identifier. Again we replace 'top' by + window.parent. + +2012-07-27 John J. Barton <johnjbarton@johnjbarton.com> + + Web Inspector: Allow front_end to be loaded into an iframe + https://bugs.webkit.org/show_bug.cgi?id=92437 + + Reviewed by Pavel Feldman. + + This change only affects 'embedders' of the inspector/front_end. No change of function for WebKit ports. + + * inspector/front-end/ExtensionAPI.js: + Replace window.top with window.parent two places. When WebInspector is loaded as the main window content, + then extension iframes have window.top === window.parent; when WebInspector is loaded as an iframe, then + extensions are iframes in iframes and we need to use a relative address window.parent. + (injectedExtensionAPI.ExtensionViewImpl.dispatchShowEvent): + (injectedExtensionAPI.ExtensionViewImpl): + (injectedExtensionAPI.ExtensionServerClient): + WebKit/chromium/scripts/generate_devtools_extension_api.py: + The current number of frames is used in a dynamically created identifier. Again we replace 'top' by + window.parent. + +2012-07-27 Vivek Galatage <vivekgalatage@gmail.com> + + Web Inspector: InspectorPageAgent should ascertain document to be non-null in updateViewMetrics() + https://bugs.webkit.org/show_bug.cgi?id=92476 + + Reviewed by Pavel Feldman. + + InspectorPageAgent should check for document object being null. As pages created with blank URL might + not have the document object, this causes a crash. + + No new tests as added null check. + + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::updateViewMetrics): + +2012-07-27 Mike West <mkwst@chromium.org> + + CSP directives containing invalid characters should log an error. + https://bugs.webkit.org/show_bug.cgi?id=92487 + + Reviewed by Adam Barth. + + Unknown directive names are currently logged, but we exit the directive + parser early without logging if we hit an invalid character inside a + directive. `script-src: ...`, for example, was ignored without letting + the developer know what happened. This patch changes that behavior, + logging the whole name (in this case `script-src:`) as an unknown + directive. + + Test: http/tests/security/contentSecurityPolicy/directive-parsing-04.html + + * page/ContentSecurityPolicy.cpp: + (WebCore::CSPDirectiveList::parseDirective): + +2012-07-27 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Texmap] Performance regression in texture uploads after r121223 + https://bugs.webkit.org/show_bug.cgi?id=91897 + + Reviewed by Jocelyn Turcotte. + + Rolling out r121223, with some conflict fixes. + + * platform/graphics/texmap/TextureMapperGL.cpp: + (WebCore::swizzleBGRAToRGBA): + (WebCore): + (WebCore::driverSupportsBGRASwizzling): + (WebCore::BitmapTextureGL::didReset): + (WebCore::BitmapTextureGL::updateContents): + +2012-07-27 Joe Mason <jmason@rim.com> + + [BlackBerry] Update NetworkJob::sendRequestWithCredentials to use new getProxyAddress API + https://bugs.webkit.org/show_bug.cgi?id=92457 + + Reviewed by Yong Li. + + getProxyAddress now returns "host:port", and getProxyPort is gone. Update NetworkJob to use + the new interface. + + RIM PR: 176166 + Internally reviewed by Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::sendRequestWithCredentials): + +2012-07-27 Kevin Ellis <kevers@chromium.org> + + Improve touch adjustment for targetting small controls. + https://bugs.webkit.org/show_bug.cgi?id=92293 + + Reviewed by Antonio Gomes. + + Modifies the touch adjustment algorithm to better discriminate small targets without introducing + a bias towards shorter links. The revised scoring algorihtm uses a normalized distance to + center-line score and a normalized overlap score. The better of the two scores is used for + determining the best candidate for target adjustment. The center-line score works well + for discriminating elements with partial overlaps, where relying solely on percent overlap + could bias towards the smaller element. Conversely, a high percentage in overlap provides a + strong measure of confidence in a candidate target. An additonal tie-break algorithm is + introduced to minimize the adjustment distance if two equally suitable candidates are found. + + Test: touchadjustment/small-target-test.html + + * page/TouchAdjustment.cpp: + (TouchAdjustment): + (WebCore::TouchAdjustment::nodeRespondsToTapGesture): + (WebCore::TouchAdjustment::hybridDistanceFunction): + (WebCore::TouchAdjustment::findNodeWithLowestDistanceMetric): + (WebCore::findBestClickableCandidate): + +2012-07-27 Kevin Ellis <kevers@chromium.org> + + [chromium] Calendar for input type=date should be larger on devices that support touch input. + https://bugs.webkit.org/show_bug.cgi?id=92424 + + Reviewed by Kent Tamura. + + Adds touch specific CSS rules to enlarge entries in the calendar on + screens that support touch input. + + Manually tested with touch support enabled/disabled. + + * Resources/calendarPicker.css: + (@media (pointer:coarse)): + * html/shadow/CalendarPickerElement.cpp: + (WebCore::CalendarPickerElement::contentSize): + +2012-07-28 Chris Fleizach <cfleizach@apple.com> + + WebKit should expose @title as label (AXTitle or AXDescription) sometimes instead of AXHelp, according to the ARIA text alt computation + https://bugs.webkit.org/show_bug.cgi?id=91911 + + Reviewed by Darin Adler. + + Update comments around code to explain rationale. + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::helpText): + (WebCore::AccessibilityRenderObject::accessibilityDescription): + +2012-07-27 Zoltan Horvath <zoltan@webkit.org> + + Add runtime flag to enable/disable JS memory information + https://bugs.webkit.org/show_bug.cgi?id=92479 + + Reviewed by Simon Hausmann. + + We need console.memory JS object to be accessible because of the memory consumption + measurements of the performance tests, so I added a toggle to InternalSettings. + + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::setMemoryInfoEnabled): + (WebCore): + * testing/InternalSettings.h: + (InternalSettings): + * testing/InternalSettings.idl: + +2012-07-27 Arko Saha <arko@motorola.com> + + Microdata: Remove toJs() and toV8Object() custom methods from JSHTMLElementCustom.cpp and V8HTMLElementCustom.cpp respectively. + https://bugs.webkit.org/show_bug.cgi?id=92482 + + Reviewed by Kentaro Hara. + + Removed custom methods toJS() and toV8Object(). We should use toJS() method defined in + JSMicroDataItemValueCustom.cpp and toV8() method defined in V8MicroDataItemValueCustom.cpp + in place of custom toJs() and toV8Object(). + + Existing tests : + fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html + fast/dom/MicroData/itemvalue-reflects-href-attr.html + fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html + fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html + fast/dom/MicroData/itemvalue-reflects-the-src-attr.html + fast/dom/MicroData/itemvalue-returns-element-itself.html + fast/dom/MicroData/itemvalue-returns-null.html + fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html + fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html + + * bindings/js/JSHTMLElementCustom.cpp: + (WebCore): + * bindings/v8/custom/V8HTMLElementCustom.cpp: + (WebCore): + (WebCore::V8HTMLElement::itemValueAccessorGetter): + +2012-07-27 Thiago Marcos P. Santos <thiago.santos@intel.com> + + REGRESSION(r123856): Breaks the build when disabling inspector + https://bugs.webkit.org/show_bug.cgi?id=92493 + + Reviewed by Kentaro Hara. + + * bindings/js/ScriptGCEvent.h: + (WebCore): + * bindings/v8/ScriptGCEvent.h: + (WebCore): + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add API to Ewk_Cookie_Manager to watch for cookie changes + https://bugs.webkit.org/show_bug.cgi?id=92484 + + Reviewed by Kenneth Rohde Christiansen. + + Make use of soup/CookieStorageSoup.cpp for EFL port instead + of defining empty implementations for cookie storage + functions. + + No new tests, no behavior change. + + * PlatformEfl.cmake: + * platform/efl/TemporaryLinkStubs.cpp: + +2012-07-27 Keishi Hattori <keishi@webkit.org> + + Replace ColorChooserClient::elementRectRelativeToWindow with elementRectRelativeToRootView + https://bugs.webkit.org/show_bug.cgi?id=92488 + + Reviewed by Kent Tamura. + + Changing ColorChooserClient interface to return element rectangle that is relative to root view instead of window. + + No new tests. Method is not used yet. + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::elementRectRelativeToRootView): Replaced elementRectRelativeToWindow. Returns element rectangle relative to root view. + * html/ColorInputType.h: + (ColorInputType): + * platform/ColorChooserClient.h: + (ColorChooserClient): + +2012-07-27 Dominik Röttsches <dominik.rottsches@intel.com> + + [Cairo] Add complex font drawing using HarfbuzzNG + https://bugs.webkit.org/show_bug.cgi?id=91864 + + Reviewed by Simon Hausmann and Martin Robinson. + + Adding Harfbuzz support to EFL by implementing it with the help of cairo and cairo-ft. + Reusing Chromium's Harfbuzz-NG support. + + No new tests, complex font support is covered by existing tests. + + * CMakeLists.txt: Adding new cairo based implementations, removing emtpy FontEfl.cpp + * WebCore.gypi: Removing FontEfl.cpp + * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: Added. New implementation that implements cairo & harfbuzz-ng based complex font drawing. + (WebCore): + (WebCore::Font::drawComplexText): + (WebCore::Font::drawEmphasisMarksForComplexText): + (WebCore::Font::canReturnFallbackFontsForComplexText): + (WebCore::Font::canExpandAroundIdeographsInComplexText): + (WebCore::Font::floatWidthForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/efl/FontEfl.cpp: Removed. + * platform/graphics/freetype/FontPlatformData.h: Adding a getter that retrieves a harfbuzz face. + (FontPlatformData): + * platform/graphics/freetype/FontPlatformDataFreeType.cpp: Adding a getter that retrieves a harfbuzz face. + (WebCore::FontPlatformData::operator=): + (WebCore::FontPlatformData::FontPlatformData): + (WebCore): + (WebCore::FontPlatformData::harfbuzzFace): + * platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp: Added. Cairo-freetype based approach to get complex font metrics. + (WebCore): + (CairoFtFaceLocker): + (WebCore::CairoFtFaceLocker::CairoFtFaceLocker): + (WebCore::CairoFtFaceLocker::lock): + (WebCore::CairoFtFaceLocker::~CairoFtFaceLocker): + (WebCore::floatToHarfBuzzPosition): + (WebCore::doubleToHarfBuzzPosition): + (WebCore::CairoGetGlyphWidthAndExtents): + (WebCore::harfbuzzGetGlyph): + (WebCore::harfbuzzGetGlyphHorizontalAdvance): + (WebCore::harfbuzzGetGlyphHorizontalOrigin): + (WebCore::harfbuzzGetGlyphExtents): + (WebCore::harfbuzzCairoTextGetFontFuncs): + (WebCore::harfbuzzCairoGetTable): + (WebCore::HarfBuzzNGFace::createFace): + (WebCore::HarfBuzzNGFace::createFont): + (WebCore::HarfBuzzShaper::createGlyphBufferAdvance): + +2012-07-27 Adam Barth <abarth@webkit.org> + + Add a Setting to expose quantized, rate-limited MemoryInfo values + https://bugs.webkit.org/show_bug.cgi?id=80444 + + Reviewed by Eric Seidel. + + We do not currently expose real MemoryInfo objects to the web unless + the user opts in because we're worried that this memory information + could be used in side-channel attacks. + + We've gotten feedback from a number of web app developers that this + information is very useful in tracking the performance of their + applications. These developers use the setting in their testing labs + and regression harnesses to catch memory leaks and regressiosn early in + their development cycle. + + Some of these developers have experimented with enabling this feature + within their enterprise and have found the memory data from the field + extremely useful in tracking down memory issues that slip through their + testing. + + Based on this experience, they've asked whether we can enable this + functionality on a wider scale so they catch even more problems + including problems that don't manifest within their enterprise. + Because we're still worried about side-channel attacks, we don't want + to expose the raw data, so we've talked with these folks in more detail + to understand what information they find most valuable. + + This patch is the result of those discussions. In particular, this + patch adds an option to expose quantized and rate-limited memory + information to web pages. Web pages can only learn new data every 20 + minutes, which helps mitigate attacks where the attacker compares two + or readings to extract side-channel information. The patch also only + reports 100 distinct memory values, which (combined with the rate + limts) makes it difficult for attackers to learn about small changes in + memory use. + + * page/MemoryInfo.cpp: + (WebCore): + (HeapSizeCache): + (WebCore::HeapSizeCache::HeapSizeCache): + (WebCore::HeapSizeCache::getCachedHeapSize): + (WebCore::HeapSizeCache::maybeUpdate): + (WebCore::HeapSizeCache::update): + (WebCore::HeapSizeCache::quantize): + (WebCore::MemoryInfo::MemoryInfo): + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (WebCore::Settings::setQuantizedMemoryInfoEnabled): + (WebCore::Settings::quantizedMemoryInfoEnabled): + (Settings): + +2012-07-27 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Move formatting support from JavaScriptSource to UISourceCode. + https://bugs.webkit.org/show_bug.cgi?id=92373 + + Reviewed by Pavel Feldman. + + Moved formatting support from JavaScriptSource to UISourceCode. + Extracted Formatter interface from ScriptFormatter and created IdentityFormatter + implememntation and Formatter.createFormatter(contentType) formatter factory. + Introduced virtual formattedChanged() method on UISourceCode. + + * inspector/front-end/JavaScriptSource.js: + (WebInspector.JavaScriptSource): + (WebInspector.JavaScriptSource.prototype.uiLocationToRawLocation): + (WebInspector.JavaScriptSource.prototype.breakpointStorageId): + (WebInspector.JavaScriptSource.prototype.searchInContent): + (WebInspector.JavaScriptSource.prototype.formattedChanged): + * inspector/front-end/ScriptFormatter.js: + (WebInspector.Formatter): + (WebInspector.Formatter.createFormatter): + (WebInspector.Formatter.locationToPosition): + (WebInspector.Formatter.positionToLocation): + (WebInspector.Formatter.prototype.formatContent): + (WebInspector.ScriptFormatter): + (WebInspector.IdentityFormatter): + (WebInspector.IdentityFormatter.prototype.formatContent): + (WebInspector.FormatterSourceMappingImpl.prototype.originalToFormatted): + (WebInspector.FormatterSourceMappingImpl.prototype.formattedToOriginal): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode): + (WebInspector.UISourceCode.prototype.requestContent): + (WebInspector.UISourceCode.prototype._fireContentAvailable): + (WebInspector.UISourceCode.prototype.uiLocationToRawLocation): + (WebInspector.UISourceCode.prototype.overrideLocation): + (WebInspector.UISourceCode.prototype.togglingFormatter): + (WebInspector.UISourceCode.prototype.formatted): + (WebInspector.UISourceCode.prototype.setFormatted.if): + (WebInspector.UISourceCode.prototype.setFormatted.didGetContent.formattedChanged): + (WebInspector.UISourceCode.prototype.setFormatted.didGetContent): + (WebInspector.UISourceCode.prototype.setFormatted): + (WebInspector.UISourceCode.prototype.createFormatter): + (WebInspector.UISourceCode.prototype.formattedChanged): + +2012-07-27 Vivek Galatage <vivekgalatage@gmail.com> + + Page object should ascertain EditorClient to be non-null + https://bugs.webkit.org/show_bug.cgi?id=92458 + + Reviewed by Ryosuke Niwa. + + The EditorClient should always be available in Page object. Added the assertion to ascertain this. + + No new tests. Added assertion to make sure EditorClient always exist. + + * page/Page.cpp: + (WebCore::Page::Page): + +2012-07-27 Huang Dongsung <luxtella@company100.net> + + Gather the duplicated timer code into CachedResource. + https://bugs.webkit.org/show_bug.cgi?id=92332 + + Reviewed by Nate Chapin. + + Internal review by Jae Hyun Park. + + When all clients are removed, CachedImage, CachedScript and CachedCSSStyleSheet + start the timer to destroy decoded data. Those three classes have their own + timer. + Changed CachedCSSStyleSheet::didAddClient to call super class method in order to + stop the timer. This change does not have any side effect because + CachedResource::didAddClient only stops the timer in this case. + + No new tests - no new testable functionality. + + * loader/cache/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet): + (WebCore::CachedCSSStyleSheet::didAddClient): + * loader/cache/CachedCSSStyleSheet.h: + (CachedCSSStyleSheet): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::CachedImage): + (WebCore::CachedImage::didAddClient): + (WebCore::CachedImage::allClientsRemoved): + * loader/cache/CachedImage.h: + (CachedImage): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::CachedResource): + (WebCore::CachedResource::didAddClient): + (WebCore::CachedResource::removeClient): + (WebCore::CachedResource::destroyDecodedDataIfNeeded): + (WebCore): + (WebCore::CachedResource::decodedDataDeletionTimerFired): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::CachedScript): + * loader/cache/CachedScript.h: + (CachedScript): + +2012-07-27 Huang Dongsung <luxtella@company100.net> + + Gather the duplicated timer code into CachedResource. + https://bugs.webkit.org/show_bug.cgi?id=92332 + + Reviewed by Nate Chapin. + + Internal review by Jae Hyun Park. + + When all clients are removed, CachedImage, CachedScript and CachedCSSStyleSheet + start the timer to destroy decoded data. Those three classes have their own + timer. + Changed CachedCSSStyleSheet::didAddClient to call super class method in order to + stop the timer. This change does not have any side effect because + CachedResource::didAddClient only stops the timer in this case. + + No new tests - no new testable functionality. + + * loader/cache/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet): + (WebCore::CachedCSSStyleSheet::didAddClient): + * loader/cache/CachedCSSStyleSheet.h: + (CachedCSSStyleSheet): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::CachedImage): + (WebCore::CachedImage::didAddClient): + (WebCore::CachedImage::allClientsRemoved): + * loader/cache/CachedImage.h: + (CachedImage): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::CachedResource): + (WebCore::CachedResource::didAddClient): + (WebCore::CachedResource::removeClient): + (WebCore::CachedResource::destroyDecodedDataIfNeeded): + (WebCore): + (WebCore::CachedResource::decodedDataDeletionTimerFired): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::CachedScript): + * loader/cache/CachedScript.h: + (CachedScript): + +2012-07-27 Dana Jansens <danakj@chromium.org> + + [chromium] Don't add a HUD layer when there is no rootLayer + https://bugs.webkit.org/show_bug.cgi?id=92442 + + Reviewed by Adrienne Walker. + + When the compositor is shutting down in threaded mode, it does a commit + without a root layer. We should not try stick the hud layer onto the + null root layer. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::willCommit): + +2012-07-27 Alec Flett <alecflett@chromium.org> + + IndexedDB: inject index keys on cursor/objectstore/index get success handlers + https://bugs.webkit.org/show_bug.cgi?id=91123 + + Reviewed by Tony Chang. + + Move key-injection into the frontend, by injecting the key into + the value on get rather than set for autoincremented keys. This + gives a potential performance win by avoiding an IPC call to the + V8 utility process on chromium, and generally cleans up the key + management. + + Note that this duplicates the logic of generateIndexKeys into the + frontend until that method can be expunged from the backend. This + will be cleaned up in a later patch. + + In order to account for both old data (which has the duplicate + primary key already injected and serialized) and any new data, an + assertion was removed from IDBBindingUtilities. + + This also includes some minor refactoring such as the deprecation + of IDBCursorBackendInterface::update in favor of a direct call to + IDBObjectStoreBackendImpl::put, and removal of the now-defunct + IDBBackingStore::getObjectViaIndex. + + Tests: storage/indexdb/index-duplicate-keypaths.html + + * Modules/indexeddb/IDBBackingStore.h: + (IDBBackingStore): + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::update): + (WebCore::IDBCursor::setValueReady): + * Modules/indexeddb/IDBCursorBackendImpl.cpp: + (WebCore::IDBCursorBackendImpl::update): + * Modules/indexeddb/IDBIndexBackendImpl.cpp: + (WebCore::IDBIndexBackendImpl::getInternal): + * Modules/indexeddb/IDBLevelDBBackingStore.cpp: + * Modules/indexeddb/IDBLevelDBBackingStore.h: + (IDBLevelDBBackingStore): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::generateIndexKeysForValue): + (WebCore): + (WebCore::IDBObjectStore::add): + (WebCore::IDBObjectStore::put): + * Modules/indexeddb/IDBObjectStore.h: + (IDBObjectStore): + * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::put): + (WebCore::IDBObjectStoreBackendImpl::putWithIndexKeys): + (WebCore): + (WebCore::IDBObjectStoreBackendImpl::putInternal): + * Modules/indexeddb/IDBRequest.cpp: + (WebCore::IDBRequest::onSuccess): + * bindings/v8/IDBBindingUtilities.cpp: + (WebCore): + +2012-07-27 Tony Chang <tony@chromium.org> + + changing -webkit-order should change the paint order of flex items + https://bugs.webkit.org/show_bug.cgi?id=92041 + + Reviewed by Ojan Vafai. + + Override paintChildren and use the flex order iterator to determine the order to paint the children. + + Test: css3/flexbox/order-painting.html + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutBlock): Save a reference to the order iterator. + (WebCore::RenderFlexibleBox::paintChildren): + * rendering/RenderFlexibleBox.h: + (RenderFlexibleBox): Hold a reference to the order iterator so we don't have to recreate it at paint time. + Also mark all the virtual methods with OVERRIDE. + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123820. + http://trac.webkit.org/changeset/123820 + https://bugs.webkit.org/show_bug.cgi?id=92465 + + It made all tests crash on all port (Requested by Ossy_home on + #webkit). + + * dom/EventNames.cpp: + (WebCore): + +2012-07-26 Ryosuke Niwa <rniwa@webkit.org> + + Qt build fix after r123788. Fixed the typo. + + * xml/parser/XMLDocumentParserQt.cpp: + (WebCore::handleElementAttributes): + +2012-07-26 Hironori Bono <hbono@chromium.org> + + [Qt] Build fix for Qt after r123811 + https://bugs.webkit.org/show_bug.cgi?id=92460 + + Reviewed by Ryosuke Niwa. + + This change explicitly converts from AtomicString to String to avoid ambiguities + when compiling HTMLAppletWidget.cpp on Qt. + + No new tests because it is a build fix. + + * html/HTMLAppletElement.cpp: + (WebCore::HTMLAppletElement::updateWidget): + +2012-07-26 Mike Lawther <mikelawther@chromium.org> + + Make transitions work between different Length types + https://bugs.webkit.org/show_bug.cgi?id=92220 + + Reviewed by Simon Fraser. + + Use the existing CSS calc machinery for blending between two calculations + to blend between two Lengths of differing types. + + Test: transitions/mixed-type.html + + * platform/Length.cpp: + (WebCore::Length::blendMixedTypes): + * platform/Length.h: + (WebCore::Length::blend): + (Length): + +2012-07-26 Dan Bernstein <mitz@apple.com> + + Blocks with reverse column progression don’t have layout overflow for overflowing columns + https://bugs.webkit.org/show_bug.cgi?id=92440 + + Reviewed by Sam Weinig. + + Test: fast/multicol/progression-reverse-overflow.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::addLayoutOverflow): If column progression is reversed, then allow + layout overflow to go in the opposite direction than it would normally be allowed to go. + For example, in a block with writing-mode: horizontal-tb, direction: ltr and + column-progression: reverse, columns overflow to the left, so layout overflow would go on + the left. + +2012-07-26 Keishi Hattori <keishi@webkit.org> + + Implement ColorSuggestionPicker page popup + https://bugs.webkit.org/show_bug.cgi?id=92109 + + Reviewed by Kent Tamura. + + Implements ColorSuggestionPicker page popup. This will be used in + certain ports as the datalist UI for <input type=color>. + + No new tests because there is no way to open the popup yet. + + * Resources/colorSuggestionPicker.css: Added. + (body): + (#main): + (.color-swatch): + (.color-swatch:hover): + (.color-swatch-container): + (.other-color): + * Resources/colorSuggestionPicker.js: Added. + (getScrollbarWidth):When there are more than 20 colors we need to + increase the window width to accommodate the scroll bar. + (createElement): + (handleMessage): + (initialize): + (handleArgumentsTimeout): + (validateArguments): + (submitValue): Calls setValueAndClosePopup with a numValue of 0. + (handleCancel): Calls setValueAndClosePopup with a numValue of -1. + (chooseOtherColor): Calls setValueAndClosePopup with a numValue of -2. + (ColorPicker): + (ColorPicker.prototype._layout): Lays out the color swatches in a 5x4 + grid. + (ColorPicker.prototype._handleSwatchClick): + * WebCore.gyp/WebCore.gyp: Added ColorSuggestionPicker action. + * make-file-arrays.py: + (main): Windows gets confused when "&&" is in the command, so we will replace " AND " with " && " internally. + +2012-07-26 Anish Bhayani <anish.bhayani@gmail.com> + + De-virtualize WrapShape classes + https://bugs.webkit.org/show_bug.cgi?id=90998 + + Reviewed by Andreas Kling. + + The destructor for WrapShapes classes did not need to use a virtual + pointer. WrapShapes.cpp is created to cast the WrapShape destructor + to the subclass type saving memory and avoiding virtual calls. + + There are existing tests that cover the validity of shapes. The + added changes merely change the destructor of the shape objects + which is also tested by LayoutTests/fast/exclusions. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * rendering/style/WrapShapes.cpp: Added. + (WebCore): + (WebCore::WrapShape::destroy): + * rendering/style/WrapShapes.h: + (WebCore::WrapShape::deref): + (WrapShape): + (WebCore::WrapShape::type): + (WebCore::WrapShape::setType): + (WrapShapeRectangle): + (WebCore::WrapShapeRectangle::WrapShapeRectangle): + (WebCore::WrapShapeCircle::WrapShapeCircle): + (WebCore::WrapShapeEllipse::WrapShapeEllipse): + (WebCore::WrapShapePolygon::WrapShapePolygon): + (WrapShapePolygon): + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123808. + http://trac.webkit.org/changeset/123808 + https://bugs.webkit.org/show_bug.cgi?id=92443 + + Broke Apple Mac debug tests ASSERTION FAILED: !hasClients() + (Requested by msaboff_ on #webkit). + + * loader/cache/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet): + (WebCore::CachedCSSStyleSheet::didAddClient): + (WebCore::CachedCSSStyleSheet::allClientsRemoved): + (WebCore::CachedCSSStyleSheet::decodedDataDeletionTimerFired): + (WebCore): + * loader/cache/CachedCSSStyleSheet.h: + (CachedCSSStyleSheet): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::CachedImage): + (WebCore::CachedImage::decodedDataDeletionTimerFired): + (WebCore): + (WebCore::CachedImage::didAddClient): + (WebCore::CachedImage::allClientsRemoved): + * loader/cache/CachedImage.h: + (CachedImage): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::CachedResource): + (WebCore::CachedResource::didAddClient): + (WebCore::CachedResource::removeClient): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::CachedScript): + (WebCore::CachedScript::didAddClient): + (WebCore): + (WebCore::CachedScript::allClientsRemoved): + (WebCore::CachedScript::decodedDataDeletionTimerFired): + * loader/cache/CachedScript.h: + (CachedScript): + +2012-07-26 Tony Chang <tony@chromium.org> + + [chromium] Remove some unreachable code in ClipboardChromium.cpp + https://bugs.webkit.org/show_bug.cgi?id=92427 + + Reviewed by Adam Barth. + + convertURIListToURL does the same thing (implementation in ClipboardUtilitiesChromium.*). + + No new tests, just deleting unused code. + + * platform/chromium/ClipboardChromium.cpp: + (WebCore::ClipboardChromium::getData): + +2012-07-26 Sukolsak Sakshuwong <sukolsak@google.com> + + Implement undoscope attribute. + https://bugs.webkit.org/show_bug.cgi?id=88793 + + Reviewed by Ryosuke Niwa. + + undoscope attribute support as specified at + http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html + + Test: editing/undomanager/undoscope-attribute.html + + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * dom/Document.cpp: + (WebCore::Document::~Document): + * dom/Element.cpp: + (WebCore): + (WebCore::Element::undoScope): + (WebCore::Element::setUndoScope): + (WebCore::Element::undoManager): + (WebCore::Element::disconnectUndoManager): + (WebCore::Element::disconnectUndoManagersInSubtree): + * dom/Element.h: + (Element): + * dom/Element.idl: + * dom/ElementRareData.h: + (ElementRareData): + * editing/UndoManager.cpp: + (WebCore::UndoManager::disconnect): + (WebCore::UndoManager::transact): + (WebCore::UndoManager::undo): + (WebCore::UndoManager::redo): + (WebCore::UndoManager::clearUndo): + (WebCore): + (WebCore::UndoManager::clearRedo): + (WebCore::UndoManager::clearUndoRedo): + (WebCore::UndoManager::isConnected): + * editing/UndoManager.h: + (WebCore): + (UndoManager): + (WebCore::UndoManager::length): + * editing/UndoManager.idl: + * html/HTMLAttributeNames.in: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::parseAttribute): + (WebCore::HTMLElement::setContentEditable): + +2012-07-26 Yoshifumi Inoue <yosin@chromium.org> + + [Forms] Introduce runtime feature flags for input type datetime, datetimelocal, month, time, week + https://bugs.webkit.org/show_bug.cgi?id=92339 + + Reviewed by Kent Tamura. + + To detect compilation errors and test failure earlier, I would like + build and run tests for input type datetime, datetime-local, month, + time and week with runtime feature flags to avoid behavior changes + other than test shell. + + This patch adds runtime features for input types, datetime, datetime-local, + month, time and week and integrates them into InputType::createInputTypeFactoryMap + to follow runtime feature flags. + + At this time, these runtime features are enabled by default for all + ports define ENABLE_INPUT_TYPE_XXX except for Chromium port other than + Android. I'll remove these #if after I update Chromium browser for + disabling them for non-Android. + + No new tests. Enabling disabled tests (fast/forms/datetime, fast/forms/dattimelocal, + fast/forms/month, fast/forms/time, fast/forms/week) + + * bindings/generic/RuntimeEnabledFeatures.cpp: Added initializations of + variables for runtime features of input types. + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::inputTypeDateTimeEnabled): Added. + (WebCore::RuntimeEnabledFeatures::setInputTypeDateTimeEnabled): Added. + (WebCore::RuntimeEnabledFeatures::inputTypeDateTimeLocalEnabled): Added. + (WebCore::RuntimeEnabledFeatures::setInputTypeDateTimeLocalEnabled): Added. + (WebCore::RuntimeEnabledFeatures::inputTypeMonthEnabled): Added. + (WebCore::RuntimeEnabledFeatures::setInputTypeMonthEnabled): Added. + (WebCore::RuntimeEnabledFeatures::inputTypeTimeEnabled): Added. + (WebCore::RuntimeEnabledFeatures::setInputTypeTimeEnabled): Added. + (WebCore::RuntimeEnabledFeatures::inputTypeWeekEnabled): Added. + (WebCore::RuntimeEnabledFeatures::setInputTypeWeekEnabled): Added. + * html/InputType.cpp: + (WebCore::createInputTypeFactoryMap): Register input types datetime, + datetime-local, month, time and week if corresponding runtime feature + flag is enabled. + * html/InputType.h: Changed indentation to force building *InputType.cpp for + making Chromium-win bots to be happy. + +2012-07-26 Xianzhu Wang <wangxianzhu@chromium.org> + + [Chromium-Android] Don't overlay scrollbars in layout test mode + https://bugs.webkit.org/show_bug.cgi?id=92419 + + Reviewed by Adam Barth. + + No new tests. This fixes failures of existing tests, e.g. css1/box_properties/border.html and many others. + + * platform/chromium/ScrollbarThemeChromiumAndroid.cpp: + (WebCore::ScrollbarThemeChromiumAndroid::usesOverlayScrollbars): Returns false in layout test mode. + (WebCore): + (WebCore::ScrollbarThemeChromiumAndroid::hasThumb): Returns false in layout test mode (to match pixel test expectations). + * platform/chromium/ScrollbarThemeChromiumAndroid.h: + (ScrollbarThemeChromiumAndroid): + +2012-07-26 Jeffrey Pfau <jpfau@apple.com> + + Reloading substitute-data/alternate html string for unreachableURL will add an item to the back-forward-history for each reload + https://bugs.webkit.org/show_bug.cgi?id=84041 + + Reviewed by Brady Eidson. + + Previously, loadAlternateHTMLString:baseURL:forUnreachableURL: would insert a new history item, regardless of + the load type of the original frame load. This could cause navigation to a broken website to make back and + forward navigation difficult to use. This change ensures that a reload type makes it through all the way. + + Added API test 'mac/BackForwardList.mm'. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::load): Prevent m_loadType from being overwritten early and check if it's a reload. + * loader/HistoryController.cpp: + (WebCore::HistoryController::updateForCommit): Amend check when committing the provisional item for a reload. + (WebCore::HistoryController::isReloadTypeWithProvisionalItem): Check that a reload type has a provisional item. + (WebCore): + * loader/HistoryController.h: + (HistoryController): Add prototype for isReloadTypeWithProvisionalItem. + +2012-07-26 Silvia Pfeiffer <silviapf@chromium.org> + + [Chromium] Regression: Global-buffer-overflow in WebCore::mediaControlElementType + https://bugs.webkit.org/show_bug.cgi?id=91333 + + Reviewed by Eric Seidel. + + MediaControlChromiumEnclosureElement now is a subclass of MediaControlElement, which + fixes the broken cast detected in the bug. + The displayType() of MediaControlChromiumEnclosureElement is set to 'MediaControlsPanel', + since the Panel element is sufficiently close in functionality to the Enclosure element. + By reusing this type, we do not need to introduce a Chromium-specific constant into + the generally used MediaControlElementType. + + Test: accessibility/media-controls.html + + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlChromiumEnclosureElement::MediaControlChromiumEnclosureElement): + Subclass MediaControlChromiumEnclosureElement from MediaControlElement. + (WebCore::MediaControlChromiumEnclosureElement::displayType): + Give the enclosure the MediaPanels type. + * html/shadow/MediaControlRootElementChromium.h: + Add the MediaControlElement.h header file. + (MediaControlChromiumEnclosureElement): + Subclass MediaControlChromiumEnclosureElement from MediaControlElement. + +2012-07-26 Arnaud Renevier <arno@renevier.net> + + [GTK] avoid unneeded object creation when calling Vector::append + https://bugs.webkit.org/show_bug.cgi?id=88805 + + Reviewed by Alexey Proskuryakov. + + No new tests: no change in functionality. + + * platform/gtk/ContextMenuGtk.cpp: + (WebCore::contextMenuItemVector): + * platform/gtk/KeyBindingTranslator.h: + (WebCore::KeyBindingTranslator::addPendingEditorCommand): + +2012-07-26 Benjamin Poulain <bpoulain@apple.com> + + Initialize the Event Names' strings from read only memory + https://bugs.webkit.org/show_bug.cgi?id=92435 + + Reviewed by Anders Carlsson. + + Similarily to r123689, we can initialize the event names' strings from memory without copying the data. + This saves us memory and initialization time. + + * dom/EventNames.cpp: + (WebCore): + +2012-07-26 Arnaud Renevier <a.renevier@sisa.samsung.com> + + constructing TypedArray from another TypedArray is slow + https://bugs.webkit.org/show_bug.cgi?id=90838 + + Reviewed by Kenneth Russell. + + When constructing a typed array from an array like element, try to + determine if the argument is a typed array. If so, cast the argument + to a typed array, and read each element with .item() method. That + avoid reading the value as a JSValue, and speedups construction by + approximatively 3x (even 30x if TypedArrays are both the same type). + + In order to achieve that, we use virtual getType method. We can use + this information to cast the TypedArray to the actual type, and then + read the values from the source. + + Introduce constructArrayBufferViewWithTypedArrayArgument template + function which returns a new typed array if first argument is a typed + array, or 0 otherwise. + + This patch also replaces previous is<Type>Array() calls with new + getType method. + + * bindings/js/JSArrayBufferViewHelper.h: + (WebCore::constructArrayBufferViewWithTypedArrayArgument): + (WebCore): + (WebCore::constructArrayBufferView): + * bindings/v8/SerializedScriptValue.cpp: + * html/canvas/DataView.h: + (DataView): + (WebCore::DataView::getType): + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::readPixels): + (WebCore::WebGLRenderingContext::validateTexFuncData): + * page/Crypto.cpp: + +2012-07-26 Max Vujovic <mvujovic@adobe.com> + + Added binding and updated chromium tests. + + [CSS Filters] Add V8 binding for WebKitCSSFilterValue + https://bugs.webkit.org/show_bug.cgi?id=92391 + + Reviewed by Adam Barth. + + No new tests. This fixes test cases in: + platform/chromium/css3/filters/custom/custom-filter-property-computed-style-expected.txt + platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt + platform/chromium/css3/filters/filter-property-computed-style-expected.txt + platform/chromium/css3/filters/filter-property-parsing-expected.txt + + * bindings/v8/custom/V8CSSValueCustom.cpp: + (WebCore::toV8): + +2012-07-26 Nayan Kumar K <nayankk@motorola.com> + + [WebGL] Initial size of canvas can be larger than MAX_VIEWPORT_DIMS. + https://bugs.webkit.org/show_bug.cgi?id=91976 + + Reviewed by Kenneth Russell. + + From section 2.2 of the spec the WebGL implementation says initial size of + the canvas can be larger than MAX_VIEWPORT_DIMS. With the current WebGL + implementation, we get error when initial size if greater than MAX_VIEWPORT_DIMS. + This change limits the width and height of drawingbuffer to MAX_VIEWPORT_DIMS + when given initial size exceeds it. + + Added tests to LayoutTests/fast/canvas/webgl/drawingbuffer-test.html + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::WebGLRenderingContext): + (WebCore::WebGLRenderingContext::initializeNewContext): + (WebCore::WebGLRenderingContext::markContextChanged): + +2012-07-26 Adrienne Walker <enne@google.com> + + [chromium] When computing surface content scale, use top level device scale + https://bugs.webkit.org/show_bug.cgi?id=92328 + + Reviewed by Kenneth Russell. + + Previously, surface scale was calculated with layer->contentsScale(), + however this value is 1 for any layer that is not ContentLayerChromium + because of layer->needsContentsScale(). This would cause any surface + created with a non-content owner layer to look fuzzy on a high DPI + device. Fix by using the top level device scale. + + Additionally, remove contentsScale from CCLayerImpl as it is no longer + used. + + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::pushPropertiesTo): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateDrawTransformsInternal): + (WebCore::CCLayerTreeHostCommon::calculateDrawTransforms): + +2012-07-26 Anders Carlsson <andersca@apple.com> + + HTMLAppletElement should inherit from HTMLPlugInImageElement + https://bugs.webkit.org/show_bug.cgi?id=92320 + + Reviewed by Eric Seidel. + + In order to simplify the class hierarchy and eventually merge HTMLPlugInImageElement and HMTLPlugInElement, + make HTMLAppletElement inherit from HTMLPlugInImageElement. While this does mean that HTMLAppletElement will grow by + a couple of words, in practice it won't matter. + + Also, make RenderApplet inherit from RenderEmbeddedObject and move the plug-in instantiation to HTMLAppletElement which matches + both HTMLEmbedElement and HTMLObjectElement. + + * html/HTMLAppletElement.cpp: + (WebCore::HTMLAppletElement::HTMLAppletElement): + (WebCore::HTMLAppletElement::create): + (WebCore::HTMLAppletElement::parseAttribute): + (WebCore::HTMLAppletElement::rendererIsNeeded): + (WebCore::HTMLAppletElement::createRenderer): + (WebCore): + (WebCore::HTMLAppletElement::renderWidgetForJSBindings): + (WebCore::HTMLAppletElement::updateWidget): + * html/HTMLAppletElement.h: + (HTMLAppletElement): + * html/HTMLTagNames.in: + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::createJavaAppletWidget): + * loader/SubframeLoader.h: + (SubframeLoader): + * page/FrameView.cpp: + (WebCore::FrameView::updateWidget): + * rendering/RenderApplet.cpp: + (WebCore::RenderApplet::RenderApplet): + * rendering/RenderApplet.h: + (RenderApplet): + * rendering/RenderEmbeddedObject.h: + (WebCore::toRenderEmbeddedObject): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::shouldBeNormalFlowOnly): + (WebCore::RenderLayer::shouldBeSelfPaintingLayer): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::requiresCompositingForPlugin): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::setStyle): + * rendering/RenderObject.h: + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123799. + http://trac.webkit.org/changeset/123799 + https://bugs.webkit.org/show_bug.cgi?id=92431 + + broke the Apple Mac build (Requested by bweinstein on + #webkit). + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * dom/EventNames.h: + (WebCore): + * dom/GestureEvent.cpp: Removed. + * dom/GestureEvent.h: Removed. + * dom/Node.cpp: + * dom/Node.h: + (WebCore): + (Node): + * page/EventHandler.cpp: + (WebCore::EventHandler::clear): + (WebCore::EventHandler::handleGestureEvent): + * page/EventHandler.h: + +2012-07-26 Nima Ghanavatian <nghanavatian@rim.com> + + [BlackBerry] Support async spellcheck for the blackberry port + https://bugs.webkit.org/show_bug.cgi?id=92160 + + Set USE_UNIFIED_TEXT_CHECKING for PLATFORM(BLACKBERRY) to use the + asynchronous spellchecking code path. + + Reviewed by Rob Buis. + + Internally reviewed by Mike Fenton. + + * platform/text/TextChecking.h: + (WebCore): + +2012-07-26 Huang Dongsung <luxtella@company100.net> + + Gather the duplicated timer code into CachedResource. + https://bugs.webkit.org/show_bug.cgi?id=92332 + + Reviewed by Nate Chapin. + + Internal review by Jae Hyun Park. + + When all clients are removed, CachedImage, CachedScript and CachedCSSStyleSheet + start the timer to destroy decoded data. Those three classes have their own + timer. + Changed CachedCSSStyleSheet::didAddClient to call super class method in order to + stop the timer. This change does not have any side effect because + CachedResource::didAddClient only stops the timer in this case. + + No new tests - no new testable functionality. + + * loader/cache/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet): + (WebCore::CachedCSSStyleSheet::didAddClient): + * loader/cache/CachedCSSStyleSheet.h: + (CachedCSSStyleSheet): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::CachedImage): + (WebCore::CachedImage::didAddClient): + (WebCore::CachedImage::allClientsRemoved): + * loader/cache/CachedImage.h: + (CachedImage): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::CachedResource): + (WebCore::CachedResource::didAddClient): + (WebCore::CachedResource::removeClient): + (WebCore::CachedResource::destroyDecodedDataIfNeeded): + (WebCore): + (WebCore::CachedResource::decodedDataDeletionTimerFired): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::CachedScript): + * loader/cache/CachedScript.h: + (CachedScript): + +2012-07-26 Benjamin Poulain <bpoulain@apple.com> + + Use the constant count of Tags/Attributes names instead of getting the size when obtaining the tags/attributes + https://bugs.webkit.org/show_bug.cgi?id=92411 + + Reviewed by Julien Chaffraix. + + Since r123582, the number of tags and attributes per "namespace" is exposed in a constant in the header file. + This makes it possible to access this value through two ways: + 1) The constant. + 2) The first parameter of the tags/attributes getter function. + + Having two ways to access the value is error prone. This patches changes the code to have all accesses done + through the constant. + + * dom/make_names.pl: + (printNamesHeaderFile): + (printNamesCppFile): + Change the code generator to not provide the size in the getter function. + + * html/HTMLObjectElement.cpp: + (WebCore::isRecognizedTagName): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::adjustSVGTagNameCase): + (WebCore): + (WebCore::adjustAttributes): + (WebCore::adjustSVGAttributes): + (WebCore::adjustMathMLAttributes): + (WebCore::adjustForeignAttributes): + +2012-07-26 Chang Shu <cshu@webkit.org> + + Support constructor-type static readonly attribute for CodeGenerator. + https://bugs.webkit.org/show_bug.cgi?id=92413. + + Reviewed by Adam Barth. + + Added support for constructor-type static readonly attribute for CodeGenerator. + This is achieved by putting the attribute entry in the table where static properties + belong to but leave the implementation same as a non-static constructor-type attribute. + + Tested by running run-bindings-tests. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + * bindings/scripts/test/JS/JSTestInterface.cpp: + (WebCore::jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr): + (WebCore::jsTestInterfaceConstructorSupplementalStaticAttr): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + (WebCore::jsTestObjConstructorStaticReadOnlyLongAttr): + (WebCore::jsTestObjConstructorStaticStringAttr): + (WebCore::jsTestObjConstructorTestSubObj): + * bindings/scripts/test/JS/JSTestObj.h: + (WebCore): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore): + +2012-07-26 Sadrul Habib Chowdhury <sadrul@chromium.org> + + Propagate gesture events to plugins. + https://bugs.webkit.org/show_bug.cgi?id=92281 + + Reviewed by Adam Barth. + + Propagate gesture events to plugins. This change does not expose the gesture events + to JavaScript, since there is no spec for that at the moment. Exposing gesture events + to JavaScript will be done separately, once there is a spec for it. + + Test: platform/chromium/plugins/gesture-events.html + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * dom/EventNames.h: + (WebCore): + (WebCore::EventNames::isGestureEventType): + (EventNames): + * dom/GestureEvent.cpp: Added. + (WebCore): + (WebCore::GestureEvent::create): + (WebCore::GestureEvent::initGestureEvent): + (WebCore::GestureEvent::interfaceName): + (WebCore::GestureEvent::GestureEvent): + (WebCore::GestureEventDispatchMediator::GestureEventDispatchMediator): + (WebCore::GestureEventDispatchMediator::event): + (WebCore::GestureEventDispatchMediator::dispatchEvent): + * dom/GestureEvent.h: Added. + (WebCore): + (GestureEvent): + (WebCore::GestureEvent::~GestureEvent): + (WebCore::GestureEvent::deltaX): + (WebCore::GestureEvent::deltaY): + (WebCore::GestureEvent::GestureEvent): + (GestureEventDispatchMediator): + (WebCore::GestureEventDispatchMediator::create): + * dom/Node.cpp: + (WebCore): + (WebCore::Node::dispatchGestureEvent): + * dom/Node.h: + (WebCore): + (Node): + * page/EventHandler.cpp: + (WebCore::EventHandler::clear): + (WebCore::EventHandler::handleGestureEvent): + * page/EventHandler.h: + +2012-07-26 Gavin Peters <gavinp@chromium.org> + + Guard Prerenderer against inserting prerenders into detached documents. + https://bugs.webkit.org/show_bug.cgi?id=92401 + + Reviewed by Adam Barth. + + If the document is detached, we should not launch a prerender. + + Test: fast/dom/HTMLLinkElement/prerender-insert-after-stop.html + + * loader/Prerenderer.cpp: + (WebCore::Prerenderer::render): + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123525. + http://trac.webkit.org/changeset/123525 + https://bugs.webkit.org/show_bug.cgi?id=92421 + + it needed to be rolled out after r123779 too (Requested by + jchaffraix on #webkit). + + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::insertChildNode): + +2012-07-26 Pravin D <pravind.2k4@gmail.com> + + Outline is always painted on the first table row regardless of the row it's set on + https://bugs.webkit.org/show_bug.cgi?id=92389 + + Reviewed by Eric Seidel. + + The outlines of all the rows are drawn on the row instead of their respective rows. + The paint offset for the outlines does not take the row location into account. + + Test: fast/table/table-row-outline-paint.html + + * rendering/RenderTableRow.cpp: + (WebCore::RenderTableRow::paintOutlineForRowIfNeeded): + The row's location is taken into account for calculating the correct paint offset + for its outline. + +2012-07-26 Antoine Labour <piman@chromium.org> + + [chromium] Combine color matrix filters and apply them in a single pass. + https://bugs.webkit.org/show_bug.cgi?id=92059 + + Reviewed by Stephen White. + + Sequential color matrix filters can easily be combined, by simply + multiplying the color matrices and applying it in a single pass. This + helps dramatically with performance (bandwidth savings by avoiding extra + copy & clear, also saves fragment shader processing). + + Covered by css3/filters layout tests, added effect-brightness-clamping + and effect-brightness-clamping-hw. + + * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp: + (WebCore::CCRenderSurfaceFilters::apply): + +2012-07-26 Ryosuke Niwa <rniwa@webkit.org> + + Href attribute with javascript protocol is stripped when content is pasted into a XML doucment + https://bugs.webkit.org/show_bug.cgi?id=92310 + + Reviewed by Adam Barth. + + The bug was caused by setAttributeNS's stripping attributes for which isAttributeToRemove + return true instead of setting an empty string. Changing this in setAttributeNS is problematic + because it will trigger a logic, in HTMLAnchorElement for example, to resolve the URL. + + Fixed the bug by making XML parsers call parserSetAttributes instead of setAttributeNS. + After this patch, handleNamespaceAttributes and handleElementAttributes simply fills up a Vector + with which startElementNs (or parseStartElement in Qt) calls parserSetAttributes. + + * dom/Element.cpp: + (WebCore::Element::parserSetAttributes): Sets emptyAtom instead of nullAtom as nullAtom can be + turned into "null". + (WebCore::Element::parseAttributeName): Extracted from setAttributeNS. + (WebCore::Element::setAttributeNS): No longer takes FragmentScriptingPermission. + * dom/Element.h: + (Element): + * editing/markup.cpp: + (WebCore::completeURLs): Don't resolve URLs when it's empty since empty attribute has a canonical + meaning in some cases. e.g. <frame src=""></iframe> + * xml/parser/XMLDocumentParserLibxml2.cpp: + (WebCore::handleNamespaceAttributes): Renamed from handleElementNamespaces. Call + parserSetAttributes even when exiting early to be maintain the same behavior. + (WebCore::handleElementAttributes): + (WebCore::XMLDocumentParser::startElementNs): + * xml/parser/XMLDocumentParserQt.cpp: + (WebCore::handleNamespaceAttributes): Use XMLNSNames::xmlnsNamespaceURI. Call parserSetAttributes + even when exiting early to be maintain the same behavior. + (WebCore::handleElementAttributes): + (WebCore::XMLDocumentParser::parseStartElement): + +2012-07-26 Dan Bernstein <mitz@apple.com> + + <svg> element with no intrinsic size and max-width gets sized incorrectly + https://bugs.webkit.org/show_bug.cgi?id=92410 + + Reviewed by Dean Jackson. + + Test: svg/css/max-width-2.html + + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeReplacedLogicalWidth): The rule for computing the width for + elements whose computed width and height are both auto and which have no intrinsic size, but + have an intrinsic ratio was applied only to elements with a content renderer (such as <img> + with an SVG source). Removed the requirement to have a content renderer, so that it will + apply to all elements including <svg>. + +2012-07-26 Tony Chang <tony@chromium.org> + + Regression: r123696 made css3/flexbox tests failing + https://bugs.webkit.org/show_bug.cgi?id=92352 + + Reviewed by Levi Weintraub. + + Use roundedLayoutUnit so ports without subpixel layout still pass existing tests. + + Covered by css3/flexbox/flex-algorithm-min-max.html which should pass again. + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::resolveFlexibleLengths): + +2012-07-26 Emil A Eklund <eae@chromium.org> + + Contained div with right 0 sometimes overlaps parent div + https://bugs.webkit.org/show_bug.cgi?id=91521 + + Reviewed by Levi Weintraub. + + Due to unnecessary rounding in clientLogicalWidth and clientLogicalHeight + we lost precision when computing the width and position of render boxes. + Change clientLogicalWidth/Height to return values with subpixel precision + to avoid this. + + Test: fast/sub-pixel/position-right-aligns-with-container.html + + * rendering/RenderBox.h: + (WebCore::RenderBox::clientLogicalWidth): + (WebCore::RenderBox::clientLogicalHeight): + Remove unnecessary rounding. + +2012-07-26 Chang Shu <cshu@webkit.org> + + Build broken when svg is disabled. + https://bugs.webkit.org/show_bug.cgi?id=92393. + + Reviewed by Laszlo Gombos. + + Need to surpress unused parameters warning. + + * rendering/FilterEffectRenderer.cpp: + (WebCore::FilterEffectRenderer::buildReferenceFilter): + +2012-07-25 Jer Noble <jer.noble@apple.com> + + Add diagnostic messages when media and plugins load or fail to load. + https://bugs.webkit.org/show_bug.cgi?id=92341 + + Reviewed by Anders Carlsson. + + Send diagnostic messages when a media or plugin element loads or fails to load. Include in + the trace the media engine description, error code, or plugin mime type. + + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::updateWidget): Send a diagnostic message. + * html/HTMLMediaElement.cpp: + (WebCore::stringForNetworkState): Added convenience function to stringify network states. + (WebCore::HTMLMediaElement::mediaLoadingFailed): Send a diagnostic message. + (WebCore::HTMLMediaElement::setReadyState): Send a diagnostic message. + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::updateWidget): Send a diagnostic message. + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123159, r123165, r123168, r123492, + and r123650. + http://trac.webkit.org/changeset/123159 + http://trac.webkit.org/changeset/123165 + http://trac.webkit.org/changeset/123168 + http://trac.webkit.org/changeset/123492 + http://trac.webkit.org/changeset/123650 + https://bugs.webkit.org/show_bug.cgi?id=92406 + + allowing inline-table anonymous wrappers is a bad idea due to + tons of corner cases that should be properly handled + (Requested by jchaffraix on #webkit). + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::addChildIgnoringContinuation): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::createAnonymousWithParentRenderer): + +2012-07-26 Jer Noble <jer.noble@apple.com> + + Add a ChromeClient method to send diagnostic logging messages from WebCore to the client. + https://bugs.webkit.org/show_bug.cgi?id=92340 + + Reviewed by Anders Carlsson. + + Add a new ChromeClient menthod, to be implemented by WebKit and WebKit2, which sends + a diagnostic logging message up to the client. + + * page/ChromeClient.h: + (WebCore::ChromeClient::logDiagnosticMessage): + * page/ChromeClient.h: + (WebCore::ChromeClient::logDiagnosticMessage): + (ChromeClient): + * page/DiagnosticLoggingKeys.cpp: Added. + (WebCore::DiagnosticLoggingKeys::mediaLoadedKey): + (WebCore::DiagnosticLoggingKeys::mediaLoadingFailedKey): + (WebCore::DiagnosticLoggingKeys::pluginLoadedKey): + (WebCore::DiagnosticLoggingKeys::pluginLoadingFailedKey): + (WebCore::DiagnosticLoggingKeys::passKey): + (WebCore::DiagnosticLoggingKeys::failKey): + (WebCore::DiagnosticLoggingKeys::noopKey): + * page/DiagnosticLoggingKeys.h: Added. + (DiagnosticLoggingKeys): + + Add the new files DiagnosticLoggingKeys.cpp,h to the project: + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + +2012-07-25 Jer Noble <jer.noble@apple.com> + + Add setting to enable and disable diagnostic logging. + https://bugs.webkit.org/show_bug.cgi?id=92337 + + Reviewed by Anders Carlsson. + + Add a new entry in Settings, defaulting to false. + + * page/Settings.cpp: + (WebCore::Settings::Settings): Default the new setting to false. + * page/Settings.h: + (WebCore::Settings::setDiagnosticLoggingEnabled): Simple accessor. + (WebCore::Settings::diagnosticLoggingEnabled): Ditto. + +2012-07-26 Olivier Blin <olivier.blin@softathome.com> + + Add FastMalloc statistics in window.internals + https://bugs.webkit.org/show_bug.cgi?id=91274 + + Reviewed by Ryosuke Niwa. + + Test: fast/harness/fastmallocstatistics-object.html + + * CMakeLists.txt: + * DerivedSources.make: + * DerivedSources.pri: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.vcproj/WebCoreTestSupport.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * testing/FastMallocStatistics.h: Added. + (WebCore): + (FastMallocStatistics): + (WebCore::FastMallocStatistics::create): + (WebCore::FastMallocStatistics::reservedVMBytes): + (WebCore::FastMallocStatistics::committedVMBytes): + (WebCore::FastMallocStatistics::freeListBytes): + (WebCore::FastMallocStatistics::FastMallocStatistics): + * testing/FastMallocStatistics.idl: Added. + * testing/Internals.cpp: + (WebCore::Internals::fastMallocStatistics): + (WebCore): + * testing/Internals.h: + (WebCore): + (Internals): + * testing/Internals.idl: + +2012-07-26 Adrienne Walker <enne@google.com> + + [chromium] Remove redundant surface origin transforms + https://bugs.webkit.org/show_bug.cgi?id=91815 + + Reviewed by Stephen White. + + Bug 91417 changed draw transforms to become equivalent to origin + transforms for surfaces. This change removes them as they are no + longer needed for anything. + + No new tests. Just a refactoring. + + * platform/graphics/chromium/RenderSurfaceChromium.h: + (RenderSurfaceChromium): + * platform/graphics/chromium/cc/CCDamageTracker.cpp: + (WebCore::CCDamageTracker::extendDamageForRenderSurface): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::computeScrollCompensationMatrixForChildren): + (WebCore::calculateDrawTransformsInternal): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::::leaveToRenderTarget): + (WebCore::::unoccludedContributingSurfaceContentRect): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::createSharedQuadState): + (WebCore::CCRenderSurface::createReplicaSharedQuadState): + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + +2012-07-25 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: simplify handling of status bar items + https://bugs.webkit.org/show_bug.cgi?id=92143 + + Reviewed by Pavel Feldman. + + - split status bars into "global" (always in the bottom) and "panel" + (on top of the drawer when drawer is shown) + - use "inner" status bar section in global status bar to display either + panel status bar items or drawer view items (depending on drawer visibility) + - let panels/views manage their counters as part of their status bar + items, not through special interface members; + - get rid of absolute positioning in the status bars where possible; + + * inspector/front-end/AdvancedSearchController.js: + (WebInspector.SearchView.prototype.get statusBarItems): + * inspector/front-end/Drawer.js: + (WebInspector.Drawer): + (WebInspector.Drawer.prototype.show.animationFinished): + (WebInspector.Drawer.prototype.show): + (WebInspector.Drawer.prototype.hide.animationFinished): + (WebInspector.Drawer.prototype.hide): + (WebInspector.Drawer.prototype._startStatusBarDragging): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.wasShown): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype.get statusBarItems): + (WebInspector.TimelinePanel.prototype.willHide): + * inspector/front-end/elementsPanel.css: + (.crumbs): + * inspector/front-end/inspector.css: + (#main): + (body.drawer-visible #main-panels): + (.status-bar): + (.status-bar-item): + (#panel-status-bar-placeholder): + (body.drawer-visible #panel-status-bar-placeholder): + (#panel-status-bar-resizer): + (#panel-status-bar): + (#panel-status-bar > div): + (#error-warning-count): + (#drawer): + (#drawer-contents): + (.status-bar-items): + (.drawer-header): + (#inner-status-bar): + (.search-status-bar-item): + (.search-status-bar-message): + (.search-status-bar-progress): + (body:not(.platform-mac) .search-status-bar-progress): + (body.platform-mac .search-status-bar-progress): + (.search-status-bar-stop-button-item): + (.search-status-bar-stop-button .glyph): + (.search-results-status-bar-message): + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector._createGlobalStatusBarItems): + (WebInspector.showViewInDrawer): + (WebInspector._closePreviousDrawerView): + * inspector/front-end/timelinePanel.css: + (.timeline-records-counter): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + Moved Network Information provider code from WebKit1 + to WebCore so that it can be shared with WebKit2. + + No new tests, no behavior change. + + * PlatformEfl.cmake: + * platform/efl/NetworkInfoProviderEfl.cpp: Copied from Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp. + (WebCore): + (WebCore::NetworkInfoProviderEfl::NetworkInfoProviderEfl): + (WebCore::NetworkInfoProviderEfl::startUpdating): + (WebCore::NetworkInfoProviderEfl::stopUpdating): + (WebCore::NetworkInfoProviderEfl::bandwidth): + * platform/efl/NetworkInfoProviderEfl.h: Added. + (WebCore): + (NetworkInfoProviderEfl): + +2012-07-25 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: SASS source mapping straw man (behind experiment) + https://bugs.webkit.org/show_bug.cgi?id=92265 + + Reviewed by Vsevolod Vlasov. + + This change introduces SASS mapping support (behind the experiment). + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/compile-front-end.py: + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleModel): + (WebInspector.CSSStyleModel.prototype.resourceBinding): + (WebInspector.CSSStyleModel.prototype.setSourceMapping): + (WebInspector.CSSStyleModel.prototype.resetSourceMappings): + (WebInspector.CSSStyleModel.prototype._rawLocationToUILocation): + (WebInspector.CSSLocation): + (WebInspector.CSSRule): + (WebInspector.CSSRule.prototype.get isRegular): + (WebInspector.CSSRule.prototype.uiLocation): + * inspector/front-end/ContentProviders.js: + (WebInspector.StaticContentProvider.prototype.contentType): + * inspector/front-end/SASSSourceMapping.js: Added. + (WebInspector.SASSSourceMapping): + (WebInspector.SASSSourceMapping.prototype._populate): + (WebInspector.SASSSourceMapping.prototype._resourceAdded.didRequestContent): + (WebInspector.SASSSourceMapping.prototype._resourceAdded): + (rawLocationToUILocation): + (uiLocationToRawLocation): + (uiSourceCodes): + (reset): + (WebInspector.SASSSource): + (WebInspector.SASSSource.prototype.isEditable): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._createSourceFrame): + * inspector/front-end/Settings.js: + (WebInspector.ExperimentsSettings): + * inspector/front-end/StylesPanel.js: + (WebInspector.StylesUISourceCodeProvider): + (WebInspector.StylesUISourceCodeProvider.prototype.rawLocationToUILocation): + (WebInspector.StylesUISourceCodeProvider.prototype.uiLocationToRawLocation): + (WebInspector.StylesUISourceCodeProvider.prototype._resourceAdded): + (WebInspector.StylesUISourceCodeProvider.prototype.reset): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype): + * inspector/front-end/UISourceCode.js: + (WebInspector.UILocation.prototype.uiLocationToRawLocation): + (WebInspector.UILocation.prototype.url): + * inspector/front-end/Workspace.js: + (WebInspector.Workspace): + * inspector/front-end/inspector.html: + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r123761 follow-up, inspector closure compilation fix. + + * inspector/front-end/Script.js: + (WebInspector.Script.Location.prototype.uiLocation): + * inspector/front-end/ScriptSnippetModel.js: + +2012-07-26 Patrick Gansterer <paroga@webkit.org> + + Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext) + https://bugs.webkit.org/show_bug.cgi?id=92113 + + Reviewed by Simon Hausmann. + + Cleanup the definition of the two methods across different ports and + replace the calls to them with LocalWindowsContext where possible. + + * platform/graphics/GraphicsContext.h: + (GraphicsContext): + * platform/win/ScrollbarThemeWin.cpp: + (WebCore::ScrollbarThemeWin::paintThumb): + +2012-07-27 Chris Fleizach <cfleizach@apple.com> + + WebKit should expose @title as label (AXTitle or AXDescription) sometimes instead of AXHelp, according to the ARIA text alt computation + https://bugs.webkit.org/show_bug.cgi?id=91911 + + Reviewed by Anders Carlsson. + + The ARIA spec states that the title attribute should be used as the last resort for a description of an element. WebKit needs to honor that. + + Test: platform/mac/accessibility/title-attribute-used-as-last-resort.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::helpText): + (WebCore::AccessibilityRenderObject::accessibilityDescription): + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r123761 follow-up, inspector closure compilation fix. + + * inspector/front-end/Script.js: + (WebInspector.Script.Location.prototype.uiLocation): + * inspector/front-end/ScriptSnippetModel.js: + +2012-07-26 Patrick Gansterer <paroga@webkit.org> + + Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext) + https://bugs.webkit.org/show_bug.cgi?id=92113 + + Reviewed by Simon Hausmann. + + Cleanup the definition of the two methods across different ports and + replace the calls to them with LocalWindowsContext where possible. + + * platform/graphics/GraphicsContext.h: + (GraphicsContext): + * platform/win/ScrollbarThemeWin.cpp: + (WebCore::ScrollbarThemeWin::paintThumb): + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r123761 follow-up, inspector closure compilation fix. + + * inspector/front-end/Script.js: + (WebInspector.Script.Location.prototype.uiLocation): + * inspector/front-end/ScriptSnippetModel.js: + +2012-07-26 Patrick Gansterer <paroga@webkit.org> + + Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext) + https://bugs.webkit.org/show_bug.cgi?id=92113 + + Reviewed by Simon Hausmann. + + Cleanup the definition of the two methods across different ports and + replace the calls to them with LocalWindowsContext where possible. + + * platform/graphics/GraphicsContext.h: + (GraphicsContext): + * platform/win/ScrollbarThemeWin.cpp: + (WebCore::ScrollbarThemeWin::paintThumb): + +2012-07-26 Olivier Blin <olivier.blin@softathome.com> + + Add FastMalloc statistics in window.internals + https://bugs.webkit.org/show_bug.cgi?id=91274 + + Reviewed by Ryosuke Niwa. + + Test: fast/harness/fastmallocstatistics-object.html + + * CMakeLists.txt: + * DerivedSources.make: + * DerivedSources.pri: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.vcproj/WebCoreTestSupport.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * testing/FastMallocStatistics.h: Added. + (WebCore): + (FastMallocStatistics): + (WebCore::FastMallocStatistics::create): + (WebCore::FastMallocStatistics::reservedVMBytes): + (WebCore::FastMallocStatistics::committedVMBytes): + (WebCore::FastMallocStatistics::freeListBytes): + (WebCore::FastMallocStatistics::FastMallocStatistics): + * testing/FastMallocStatistics.idl: Added. + * testing/Internals.cpp: + (WebCore::Internals::fastMallocStatistics): + (WebCore): + * testing/Internals.h: + (WebCore): + (Internals): + * testing/Internals.idl: + +2012-07-26 Adrienne Walker <enne@google.com> + + [chromium] Remove redundant surface origin transforms + https://bugs.webkit.org/show_bug.cgi?id=91815 + + Reviewed by Stephen White. + + Bug 91417 changed draw transforms to become equivalent to origin + transforms for surfaces. This change removes them as they are no + longer needed for anything. + + No new tests. Just a refactoring. + + * platform/graphics/chromium/RenderSurfaceChromium.h: + (RenderSurfaceChromium): + * platform/graphics/chromium/cc/CCDamageTracker.cpp: + (WebCore::CCDamageTracker::extendDamageForRenderSurface): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::computeScrollCompensationMatrixForChildren): + (WebCore::calculateDrawTransformsInternal): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::::leaveToRenderTarget): + (WebCore::::unoccludedContributingSurfaceContentRect): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::createSharedQuadState): + (WebCore::CCRenderSurface::createReplicaSharedQuadState): + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + +2012-07-25 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: simplify handling of status bar items + https://bugs.webkit.org/show_bug.cgi?id=92143 + + Reviewed by Pavel Feldman. + + - split status bars into "global" (always in the bottom) and "panel" + (on top of the drawer when drawer is shown) + - use "inner" status bar section in global status bar to display either + panel status bar items or drawer view items (depending on drawer visibility) + - let panels/views manage their counters as part of their status bar + items, not through special interface members; + - get rid of absolute positioning in the status bars where possible; + + * inspector/front-end/AdvancedSearchController.js: + (WebInspector.SearchView.prototype.get statusBarItems): + * inspector/front-end/Drawer.js: + (WebInspector.Drawer): + (WebInspector.Drawer.prototype.show.animationFinished): + (WebInspector.Drawer.prototype.show): + (WebInspector.Drawer.prototype.hide.animationFinished): + (WebInspector.Drawer.prototype.hide): + (WebInspector.Drawer.prototype._startStatusBarDragging): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.wasShown): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype.get statusBarItems): + (WebInspector.TimelinePanel.prototype.willHide): + * inspector/front-end/elementsPanel.css: + (.crumbs): + * inspector/front-end/inspector.css: + (#main): + (body.drawer-visible #main-panels): + (.status-bar): + (.status-bar-item): + (#panel-status-bar-placeholder): + (body.drawer-visible #panel-status-bar-placeholder): + (#panel-status-bar-resizer): + (#panel-status-bar): + (#panel-status-bar > div): + (#error-warning-count): + (#drawer): + (#drawer-contents): + (.status-bar-items): + (.drawer-header): + (#inner-status-bar): + (.search-status-bar-item): + (.search-status-bar-message): + (.search-status-bar-progress): + (body:not(.platform-mac) .search-status-bar-progress): + (body.platform-mac .search-status-bar-progress): + (.search-status-bar-stop-button-item): + (.search-status-bar-stop-button .glyph): + (.search-results-status-bar-message): + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector._createGlobalStatusBarItems): + (WebInspector.showViewInDrawer): + (WebInspector._closePreviousDrawerView): + * inspector/front-end/timelinePanel.css: + (.timeline-records-counter): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + Moved Network Information provider code from WebKit1 + to WebCore so that it can be shared with WebKit2. + + No new tests, no behavior change. + + * PlatformEfl.cmake: + * platform/efl/NetworkInfoProviderEfl.cpp: Copied from Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp. + (WebCore): + (WebCore::NetworkInfoProviderEfl::NetworkInfoProviderEfl): + (WebCore::NetworkInfoProviderEfl::startUpdating): + (WebCore::NetworkInfoProviderEfl::stopUpdating): + (WebCore::NetworkInfoProviderEfl::bandwidth): + * platform/efl/NetworkInfoProviderEfl.h: Added. + (WebCore): + (NetworkInfoProviderEfl): + +2012-07-25 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: SASS source mapping straw man (behind experiment) + https://bugs.webkit.org/show_bug.cgi?id=92265 + + Reviewed by Vsevolod Vlasov. + + This change introduces SASS mapping support (behind the experiment). + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/compile-front-end.py: + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleModel): + (WebInspector.CSSStyleModel.prototype.resourceBinding): + (WebInspector.CSSStyleModel.prototype.setSourceMapping): + (WebInspector.CSSStyleModel.prototype.resetSourceMappings): + (WebInspector.CSSStyleModel.prototype._rawLocationToUILocation): + (WebInspector.CSSLocation): + (WebInspector.CSSRule): + (WebInspector.CSSRule.prototype.get isRegular): + (WebInspector.CSSRule.prototype.uiLocation): + * inspector/front-end/ContentProviders.js: + (WebInspector.StaticContentProvider.prototype.contentType): + * inspector/front-end/SASSSourceMapping.js: Added. + (WebInspector.SASSSourceMapping): + (WebInspector.SASSSourceMapping.prototype._populate): + (WebInspector.SASSSourceMapping.prototype._resourceAdded.didRequestContent): + (WebInspector.SASSSourceMapping.prototype._resourceAdded): + (rawLocationToUILocation): + (uiLocationToRawLocation): + (uiSourceCodes): + (reset): + (WebInspector.SASSSource): + (WebInspector.SASSSource.prototype.isEditable): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._createSourceFrame): + * inspector/front-end/Settings.js: + (WebInspector.ExperimentsSettings): + * inspector/front-end/StylesPanel.js: + (WebInspector.StylesUISourceCodeProvider): + (WebInspector.StylesUISourceCodeProvider.prototype.rawLocationToUILocation): + (WebInspector.StylesUISourceCodeProvider.prototype.uiLocationToRawLocation): + (WebInspector.StylesUISourceCodeProvider.prototype._resourceAdded): + (WebInspector.StylesUISourceCodeProvider.prototype.reset): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype): + * inspector/front-end/UISourceCode.js: + (WebInspector.UILocation.prototype.uiLocationToRawLocation): + (WebInspector.UILocation.prototype.url): + * inspector/front-end/Workspace.js: + (WebInspector.Workspace): + * inspector/front-end/inspector.html: + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r123761 follow-up, inspector closure compilation fix. + + * inspector/front-end/Script.js: + (WebInspector.Script.Location.prototype.uiLocation): + * inspector/front-end/ScriptSnippetModel.js: + +2012-07-26 Patrick Gansterer <paroga@webkit.org> + + Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext) + https://bugs.webkit.org/show_bug.cgi?id=92113 + + Reviewed by Simon Hausmann. + + Cleanup the definition of the two methods across different ports and + replace the calls to them with LocalWindowsContext where possible. + + * platform/graphics/GraphicsContext.h: + (GraphicsContext): + * platform/win/ScrollbarThemeWin.cpp: + (WebCore::ScrollbarThemeWin::paintThumb): + +2012-07-27 Chris Fleizach <cfleizach@apple.com> + + WebKit should expose @title as label (AXTitle or AXDescription) sometimes instead of AXHelp, according to the ARIA text alt computation + https://bugs.webkit.org/show_bug.cgi?id=91911 + + Reviewed by Anders Carlsson. + + The ARIA spec states that the title attribute should be used as the last resort for a description of an element. WebKit needs to honor that. + + Test: platform/mac/accessibility/title-attribute-used-as-last-resort.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::helpText): + (WebCore::AccessibilityRenderObject::accessibilityDescription): + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r123761 follow-up, inspector closure compilation fix. + + * inspector/front-end/Script.js: + (WebInspector.Script.Location.prototype.uiLocation): + * inspector/front-end/ScriptSnippetModel.js: + +2012-07-26 Patrick Gansterer <paroga@webkit.org> + + Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext) + https://bugs.webkit.org/show_bug.cgi?id=92113 + + Reviewed by Simon Hausmann. + + Cleanup the definition of the two methods across different ports and + replace the calls to them with LocalWindowsContext where possible. + + * platform/graphics/GraphicsContext.h: + (GraphicsContext): + * platform/win/ScrollbarThemeWin.cpp: + (WebCore::ScrollbarThemeWin::paintThumb): + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r123761 follow-up, inspector closure compilation fix. + + * inspector/front-end/Script.js: + (WebInspector.Script.Location.prototype.uiLocation): + * inspector/front-end/ScriptSnippetModel.js: + +2012-07-26 Patrick Gansterer <paroga@webkit.org> + + Cleanup GraphicsContext::(getWindowsContext|releaseWindowsContext) + https://bugs.webkit.org/show_bug.cgi?id=92113 + + Reviewed by Simon Hausmann. + + Cleanup the definition of the two methods across different ports and + replace the calls to them with LocalWindowsContext where possible. + + * platform/graphics/GraphicsContext.h: + (GraphicsContext): + * platform/win/ScrollbarThemeWin.cpp: + (WebCore::ScrollbarThemeWin::paintThumb): + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Introduce generic LiveLocation, make Script.Location inherit it. + https://bugs.webkit.org/show_bug.cgi?id=92388 + + Reviewed by Pavel Feldman. + + Introduced abstract LiveLocation implemented by Script.Location. + + * inspector/front-end/Script.js: + (WebInspector.Script.Location): + (WebInspector.Script.Location.prototype.uiLocation): + (WebInspector.Script.Location.prototype.dispose): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode): + (WebInspector.LiveLocation): + (WebInspector.LiveLocation.prototype.update): + (WebInspector.LiveLocation.prototype.rawLocation): + (WebInspector.LiveLocation.prototype.uiLocation): + (WebInspector.LiveLocation.prototype.dispose): + * inspector/front-end/inspector.html: + +2012-07-26 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] readPixels on FBOs are limited to canvas size on SGX platforms + https://bugs.webkit.org/show_bug.cgi?id=92301 + + Reviewed by Rob Buis. + + This fixes fast/canvas/webgl/uninitialized-test.html on BlackBerry, no new tests. + + * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: + (WebCore::GraphicsContext3D::readPixels): + (WebCore::GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary): + +2012-07-26 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: reduce auto refresh rate of the live native memory diagram + https://bugs.webkit.org/show_bug.cgi?id=92372 + + Reviewed by Pavel Feldman. + + * inspector/front-end/NativeMemorySnapshotView.js: + (WebInspector.NativeMemoryBarChart.prototype.wasShown): + +2012-07-26 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: add GC button to the profiles panel toolbar. + https://bugs.webkit.org/show_bug.cgi?id=92369 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype.get statusBarItems): + (WebInspector.ProfilesPanel.prototype._garbageCollectButtonClicked): + * inspector/front-end/profilesPanel.css: + (.garbage-collect-status-bar-item .glyph): + +2012-07-26 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Move region from HitTestResult to HitTestPoint. + https://bugs.webkit.org/show_bug.cgi?id=92367 + + Reviewed by Antonio Gomes. + + Moves the region to HitTestPoint where it makes more sense, and use this + change to simplify hit-testing a new region in RenderFlowThread. + + No new functionality. No new tests. + + * rendering/HitTestResult.cpp: + (WebCore::HitTestPoint::HitTestPoint): + (WebCore::HitTestPoint::operator=): + (WebCore::HitTestResult::HitTestResult): + (WebCore::HitTestResult::operator=): + * rendering/HitTestResult.h: + (HitTestPoint): + (WebCore::HitTestPoint::region): + (HitTestResult): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::nodeAtPoint): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::nodeAtPoint): + * rendering/RenderFlowThread.cpp: + (WebCore::RenderFlowThread::hitTestRegion): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hitTestLayer): + * rendering/RenderRegion.cpp: + (WebCore::RenderRegion::nodeAtPoint): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::nodeAtPoint): + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::nodeAtPoint): + +2012-07-26 Jan Keromnes <janx@linux.com> + + Web Inspector: ExtensionView constructor shouldn't take parent argument + https://bugs.webkit.org/show_bug.cgi?id=92326 + + Reviewed by Pavel Feldman. + + ExtensionView's constructor took a parent element parameter and auto- + showed itself in the constructor. This didn't allow lazy showing and + was confusing because it didn't work like a classic View object. Fixed. + + No new tests needed: Refactoring with no behavior changes. + + * inspector/front-end/ExtensionPanel.js: + (WebInspector.ExtensionPanel): + (WebInspector.ExtensionSidebarPane.prototype.setPage): + * inspector/front-end/ExtensionView.js: + (WebInspector.ExtensionView): + +2012-07-26 Joshua Netterfield <jnetterfield@rim.com> + + [WebGL] ANGLEWebKitBridge should support ESSL platforms + https://bugs.webkit.org/show_bug.cgi?id=92295 + + Reviewed by Rob Buis. + + This tells ANGLEWebKitBridge to output ESSL code for the BlackBerry + platform. This eliminates the need for a previous hack. In addition, + some (GLSL) ANGLE output that could not be compiled (for example, + glsl-mat4-to-mat3.html) now compiles. + + * platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp: + (WebCore::GraphicsContext3D::GraphicsContext3D): + * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: + (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE): + +2012-07-26 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: replace "textInput" keyboard event listener breakpoint with "input" + https://bugs.webkit.org/show_bug.cgi?id=92384 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/BreakpointsSidebarPane.js: + (WebInspector.EventListenerBreakpointsSidebarPane): + +2012-07-26 Jer Noble <jer.noble@apple.com> + + Add a MediaPlayer API to retrieve the description of the current media engine. + https://bugs.webkit.org/show_bug.cgi?id=92336 + + Reviewed by Eric Carlson. + + Add a utility function which retrieves, for diagnostic purposes, a brief description + of the current media engine. Stubs have been added for each of the MediaPlayerPrivate + subclasses which return the name of the class. + + * platform/graphics/MediaPlayer.cpp: + (WebCore::MediaPlayer::engineDescription): + * platform/graphics/MediaPlayer.h: + * platform/graphics/MediaPlayerPrivate.h: + (WebCore::MediaPlayerPrivateInterface::engineDescription): + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: + (WebCore::MediaPlayerPrivateAVFoundation::engineDescription): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h: + (WebCore::MediaPlayerPrivate::engineDescription): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: + (WebCore::MediaPlayerPrivateGStreamer::engineDescription): + * platform/graphics/mac/MediaPlayerPrivateQTKit.h: + (WebCore::MediaPlayerPrivateQTKit::engineDescription): + * platform/graphics/qt/MediaPlayerPrivateQt.h: + (WebCore::MediaPlayerPrivateQt::engineDescription): + * platform/graphics/wince/MediaPlayerPrivateWinCE.h: + (WebCore::MediaPlayerPrivate::engineDescription): + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h: + (WebCore::MediaPlayerPrivateQuickTimeVisualContext::engineDescription): + +2012-07-26 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: Edits of styles declared after invalid selector are not applied + https://bugs.webkit.org/show_bug.cgi?id=92382 + + Reviewed by Vsevolod Vlasov. + + Now popping selectorless rules as well. + + Test: inspector/styles/styles-edit-property-after-invalid-rule.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::createStyleRule): + +2012-07-26 Joshua Netterfield <jnetterfield@rim.com> + + [WebGL] GraphicsContext3D::readPixels has extraneous code from GraphicsContext3D::readPixelsIMG + https://bugs.webkit.org/show_bug.cgi?id=92302 + + Reviewed by Noam Rosenthal. + + This undoes a mistake from https://bugs.webkit.org/show_bug.cgi?id=90567. + + No new tests, because it introduces no new functionality, but it makes the WebGL aquarium demo + run quite a bit smoother on SGX :) + + * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: + (WebCore::GraphicsContext3D::readPixels): + +2012-07-26 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Revert r123740 as it breaks AppleMac compilation. + + * WebCore.exp.in: + * inspector/InspectorMemoryAgent.cpp: + (WebCore): + +2012-07-26 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Fix AppleMac compilation after r123740. + + * WebCore.exp.in: Added missing symbol. + +2012-07-26 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: move StringImpl size calculation to StringImpl + https://bugs.webkit.org/show_bug.cgi?id=92359 + + Reviewed by Pavel Feldman. + + Moved stringSize(StringImpl*) implementation from InspectorMemoryAgent to + StringImpl::sizeInBytes(); + + * inspector/InspectorMemoryAgent.cpp: + (WebCore): + +2012-07-26 Charles Wei <charles.wei@torchmobile.com.cn> + + Remove redundant include of PageGroup.h in FrameLoader.cpp + https://bugs.webkit.org/show_bug.cgi?id=92357 + + Reviewed by Kentaro Hara. + + + No new tests, just remove redundant include file. + + * loader/FrameLoader.cpp: + +2012-07-26 Eric Seidel <eric@webkit.org> + + 2% of all samples running grid demo show up in StyleResolver::canShareStyleWithElement, 20% of those due to getAttribute instead of fastGetAttribute + https://bugs.webkit.org/show_bug.cgi?id=92257 + + Reviewed by Andreas Kling. + + This check was added 7 years ago by hyatt in: + http://trac.webkit.org/changeset/10984 + And then later made slow after triggering an ASSERT added: + http://trac.webkit.org/changeset/97670 + + SVG uses a "type" attribute (and it is animatable), but only when + used on filter elements: + http://www.w3.org/TR/SVG/attindex.html + In any case, this does not apply here, and is certainly not what + this check was originally intended for. + + I've moved the check to canShareStyleWithControl + as it is only needed when the elements in question are both input elements. + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + +2012-07-26 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: add memory reporting routine to StyleResolver + https://bugs.webkit.org/show_bug.cgi?id=92259 + + Reviewed by Vsevolod Vlasov. + + SyleResolver::reportMemoryUsage is added for estimating StyleResolver + memory footprint. + + * css/StyleResolver.cpp: + (RuleData): + (RuleSet): + (RuleSetSelectorPair): + (WebCore::StyleResolver::Features::reportMemoryUsage): + (WebCore): + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/StyleResolver.h: + (Features): + (StyleResolver): + * dom/Document.cpp: + (WebCore::Document::reportMemoryUsage): + * dom/MemoryInstrumentation.h: + (MemoryInstrumentation): + (WebCore::MemoryClassInfo::addInstrumentedHashSet): + (WebCore::MemoryClassInfo::addInstrumentedVector): + (WebCore::MemoryInstrumentation::addHashMap): + (WebCore): + (WebCore::MemoryInstrumentation::addInstrumentedCollection): + +2012-07-26 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Remove DeprecatedPeerConnection + https://bugs.webkit.org/show_bug.cgi?id=92106 + + Reviewed by Adam Barth. + + Since we are getting ready to add an updated PeerConnection + the old DeprecatedPeerConnection will have to go. + + No new tests, and old tests converted to use PeerConnection00. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Modules/mediastream/DOMWindowMediaStream.idl: + * Modules/mediastream/DeprecatedPeerConnection.cpp: Removed. + * Modules/mediastream/DeprecatedPeerConnection.h: Removed. + * Modules/mediastream/DeprecatedPeerConnection.idl: Removed. + * Modules/mediastream/SignalingCallback.h: Removed. + * Modules/mediastream/SignalingCallback.idl: Removed. + * PlatformBlackBerry.cmake: + * PlatformEfl.cmake: + * UseJSC.cmake: + * WebCore.gypi: + * bindings/generic/RuntimeEnabledFeatures.h: + * bindings/js/JSDeprecatedPeerConnectionCustom.cpp: Removed. + * dom/EventTargetFactory.in: + * platform/mediastream/DeprecatedPeerConnectionHandler.h: Removed. + * platform/mediastream/DeprecatedPeerConnectionHandlerClient.h: Removed. + * platform/mediastream/blackberry/DeprecatedPeerConnectionHandler.cpp: Removed. + * platform/mediastream/chromium/DeprecatedPeerConnectionHandler.cpp: Removed. + * platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.cpp: Removed. + * platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.h: Removed. + * platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp: Removed. + +2012-07-26 Mike West <mkwst@chromium.org> + + CSP 1.1: Implement the Content Security Policy script interface. + https://bugs.webkit.org/show_bug.cgi?id=91707 + + Reviewed by Adam Barth. + + The CSP 1.1 editor's draft defines a script interface that gives + developers the ability to query a document regarding the restrictions + set by it's currently active content security policy[1]. This patch + exposes that API in terms of a new DOMSecurityPolicy object. + + Data for the API is gathered from the existing ContentSecurityPolicy + object on the containing document. CSP's various methods have been + extended with a `reportingStatus` parameter which, unsurprisingly, + determines whether a violation report should be sent for blocked + resources. This allows us to reuse the same codepaths by simply using + ContentSecurityPolicy::SuppressReport when querying on behalf of the + API, and ContentSecurityPolicy::SendReport when checking resources a + page wants to load. + + This feature is gated on the CSP_NEXT flag, which is currently disabled + for all ports other than Chromium. + + [1]: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces--experimental + + Tests: http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowconnectionto.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-alloweval.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowfontfrom.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowframefrom.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowimagefrom.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowmediafrom.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowobjectfrom.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowscriptfrom.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-allowstylefrom.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-isactive.html + http/tests/security/contentSecurityPolicy/1.1/securitypolicy-reporturi.html + + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * DerivedSources.pri: + * GNUmakefile.list.am: + * WebCore.gypi: + * bindings/gobject/GNUmakefile.am: + * WebCore.xcodeproj/project.pbxproj: + We added a new object, so let's tell _everyone!_ + * dom/Document.cpp: + (WebCore::Document::securityPolicy): + Expose the SecurityPolicy object via Document, gated on CSP_NEXT. + (WebCore): + * dom/Document.h: + (WebCore): + (Document): + * dom/Document.idl: + Adding the SecurityPolicy object to the document, gated on CSP_NEXT. + * page/ContentSecurityPolicy.cpp: + (CSPDirectiveList): + (WebCore::CSPDirectiveList::checkInline): + (WebCore::CSPDirectiveList::checkNonce): + (WebCore::CSPDirectiveList::checkSource): + Extracting the core checks out into separate methods. + (WebCore::CSPDirectiveList::checkEvalAndReportViolation): + Use checkEval. + (WebCore::CSPDirectiveList::checkNonceAndReportViolation): + Use checkNonce. + (WebCore::CSPDirectiveList::checkInlineAndReportViolation): + Use checkInline. + (WebCore::CSPDirectiveList::checkSourceAndReportViolation): + Use checkSource. + (WebCore::CSPDirectiveList::allowJavaScriptURLs): + (WebCore::CSPDirectiveList::allowInlineEventHandlers): + (WebCore::CSPDirectiveList::allowInlineScript): + (WebCore::CSPDirectiveList::allowInlineStyle): + (WebCore::CSPDirectiveList::allowEval): + (WebCore::CSPDirectiveList::allowScriptFromSource): + (WebCore::CSPDirectiveList::allowObjectFromSource): + (WebCore::CSPDirectiveList::allowChildFrameFromSource): + (WebCore::CSPDirectiveList::allowImageFromSource): + (WebCore::CSPDirectiveList::allowStyleFromSource): + (WebCore::CSPDirectiveList::allowFontFromSource): + (WebCore::CSPDirectiveList::allowMediaFromSource): + (WebCore::CSPDirectiveList::allowConnectToSource): + These methods now branch on `reportingStatus`: if `SendReoport`, + they call `checkXAndReportViolation`, otherwise, they call `checkX`. + (WebCore::CSPDirectiveList::gatherReportURIs): + New method that gathers the violation report URIs into a DOMStringList. + (WebCore::isAllowedByAllWithCallStack): + (WebCore::isAllowedByAllWithContext): + (WebCore::isAllowedByAllWithURL): + These now pass reportingStatus through to the various `allowX` methods. + (WebCore::ContentSecurityPolicy::allowJavaScriptURLs): + (WebCore::ContentSecurityPolicy::allowInlineEventHandlers): + (WebCore::ContentSecurityPolicy::allowInlineScript): + (WebCore::ContentSecurityPolicy::allowInlineStyle): + (WebCore::ContentSecurityPolicy::allowEval): + (WebCore::ContentSecurityPolicy::allowScriptFromSource): + (WebCore::ContentSecurityPolicy::allowObjectFromSource): + (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): + (WebCore::ContentSecurityPolicy::allowImageFromSource): + (WebCore::ContentSecurityPolicy::allowStyleFromSource): + (WebCore::ContentSecurityPolicy::allowFontFromSource): + (WebCore::ContentSecurityPolicy::allowMediaFromSource): + (WebCore::ContentSecurityPolicy::allowConnectToSource): + These accept a new `reportingStatus` parameter, which is passed through + to the CSPDirectiveList methods. + (WebCore::ContentSecurityPolicy::isActive): + New method that returns `true` if policy is active. + (WebCore::ContentSecurityPolicy::gatherReportURIs): + New method that returns a DOMStringList of violation report URIs. + * page/ContentSecurityPolicy.h: + (WebCore): + * page/DOMSecurityPolicy.cpp: Added. + (WebCore::DOMSecurityPolicy::DOMSecurityPolicy): + (WebCore): + (WebCore::DOMSecurityPolicy::~DOMSecurityPolicy): + (WebCore::DOMSecurityPolicy::isActive): + (WebCore::DOMSecurityPolicy::reportURIs): + (WebCore::DOMSecurityPolicy::allowsInlineScript): + (WebCore::DOMSecurityPolicy::allowsInlineStyle): + (WebCore::DOMSecurityPolicy::allowsEval): + (WebCore::DOMSecurityPolicy::allowsConnectionTo): + (WebCore::DOMSecurityPolicy::allowsFontFrom): + (WebCore::DOMSecurityPolicy::allowsFrameFrom): + (WebCore::DOMSecurityPolicy::allowsImageFrom): + (WebCore::DOMSecurityPolicy::allowsMediaFrom): + (WebCore::DOMSecurityPolicy::allowsObjectFrom): + (WebCore::DOMSecurityPolicy::allowsScriptFrom): + (WebCore::DOMSecurityPolicy::allowsStyleFrom): + * page/DOMSecurityPolicy.h: Added. + (WebCore): + (DOMSecurityPolicy): + (WebCore::DOMSecurityPolicy::create): + * page/DOMSecurityPolicy.idl: Added. + +2012-07-26 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed. Fix build break on mac win port by r123716. + + * platform/KURL.h: + (KURL): + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123715. + http://trac.webkit.org/changeset/123715 + https://bugs.webkit.org/show_bug.cgi?id=92356 + + Breaks compilation on multiple platforms (Requested by vsevik + on #webkit). + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::inspectedPageDestroyed): + * inspector/InspectorInstrumentation.cpp: + (WebCore): + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + * inspector/InspectorResourceAgent.cpp: + (WebCore::InspectorResourceAgent::didReceiveData): + (WebCore::InspectorResourceAgent::getResponseBody): + * inspector/InspectorResourceAgent.h: + (InspectorResourceAgent): + * inspector/NetworkResourcesData.cpp: + (WebCore::NetworkResourcesData::ResourceData::ResourceData): + (WebCore::NetworkResourcesData::ResourceData::setContent): + (WebCore::NetworkResourcesData::ResourceData::dataLength): + (WebCore::NetworkResourcesData::ResourceData::appendData): + (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent): + (WebCore::NetworkResourcesData::setResourceContent): + (WebCore::NetworkResourcesData::maybeAddResourceData): + (WebCore::NetworkResourcesData::maybeDecodeDataToContent): + (WebCore::NetworkResourcesData::setResourcesDataSizeLimits): + (WebCore::NetworkResourcesData::ensureFreeSpace): + * inspector/NetworkResourcesData.h: + (ResourceData): + (WebCore::NetworkResourcesData::ResourceData::cachedResource): + (NetworkResourcesData): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::~CachedResource): + (WebCore::CachedResource::removeClient): + (WebCore::CachedResource::deleteIfPossible): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::garbageCollectDocumentResourcesTimerFired): + (WebCore::CachedResourceLoader::clearPreloads): + * loader/cache/CachedResourceLoader.h: + (CachedResourceLoader): + * loader/cache/MemoryCache.cpp: + (WebCore::MemoryCache::evict): + * testing/InternalSettings.cpp: + * testing/Internals.cpp: + * testing/Internals.h: + (Internals): + +2012-07-26 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Add *explicit* keyword to constructors in WebCore/platform + https://bugs.webkit.org/show_bug.cgi?id=92238 + + Reviewed by Kentaro Hara. + + As a step to let *explicit* keyword add to constructors which have a parameter, + *explicit* keyword is added to Source/WebCore/platform in order to avoid implicit + type conversion. + + Some files in platform directory can't use explicit keyword because of build breaks. + + No new tests. Covered by existing tests. + + * platform/AutodrainedPool.h: + (AutodrainedPool): + * platform/ContentType.h: + (ContentType): + * platform/ContextMenu.h: + (ContextMenu): + * platform/ContextMenuItem.h: + (ContextMenuItem): + * platform/Cursor.h: + (WebCore::SharedCursor::SharedCursor): + (Cursor): + * platform/KURL.h: + (WebCore::KURL::KURL): + (KURL): + * platform/KURLGooglePrivate.h: + (KURLGooglePrivate): + * platform/PODRedBlackTree.h: + (WebCore::PODRedBlackTree::PODRedBlackTree): + * platform/Pasteboard.h: + (Pasteboard): + * platform/PlatformEvent.h: + (WebCore::PlatformEvent::PlatformEvent): + * platform/PlatformKeyboardEvent.h: + (PlatformKeyboardEvent): + * platform/PlatformMouseEvent.h: + (PlatformMouseEvent): + * platform/PlatformPasteboard.h: + (PlatformPasteboard): + * platform/PlatformTouchEvent.h: + (PlatformTouchEvent): + * platform/PlatformWheelEvent.h: + (PlatformWheelEvent): + * platform/RunLoop.h: + (TimerBase): + * platform/ScrollAnimator.h: + (ScrollAnimator): + * platform/ScrollAnimatorNone.h: + (ScrollAnimatorNone): + * platform/SharedBuffer.h: + (SharedBuffer): + * platform/WheelFlingPlatformGestureCurve.h: + (WheelFlingPlatformGestureCurve): + * platform/Widget.h: + (Widget): + +2012-07-26 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Resource agent's reference to cached resources should be weak. + https://bugs.webkit.org/show_bug.cgi?id=92108 + + Reviewed by Pavel Feldman. + + NetworkResourcesData now stores a raw pointer to CachedResource. + CachedResource now notifies InspectorInstrumentation that it will be destroyed. + InspectorInstrumentation stores a set of InstrumentingAgents and broadcasts willDestroyCachedResource event to all available resourceAgents. + Destroyed resources content is saved to NetworkResourcesData. + Changed content size variables type in NetworkResourcesData from int to size_t. + + Tests: http/tests/inspector/network/cached-resource-destroyed-moved-to-storage.html + http/tests/inspector/network/cached-resource-destroyed-too-big-discarded.html + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::inspectedPageDestroyed): + * inspector/InspectorInstrumentation.cpp: + (WebCore): + (WebCore::InspectorInstrumentation::willDestroyCachedResourceImpl): + (WebCore::InspectorInstrumentation::registerInstrumentingAgents): + (WebCore::InspectorInstrumentation::unregisterInstrumentingAgents): + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + (WebCore::InspectorInstrumentation::willDestroyCachedResource): + (WebCore): + * inspector/InspectorResourceAgent.cpp: + (WebCore::InspectorResourceAgent::didReceiveData): + (WebCore::InspectorResourceAgent::willDestroyCachedResource): + (WebCore): + (WebCore::InspectorResourceAgent::getResponseBody): + * inspector/InspectorResourceAgent.h: + (InspectorResourceAgent): + * inspector/NetworkResourcesData.cpp: + (WebCore::NetworkResourcesData::ResourceData::ResourceData): + (WebCore::NetworkResourcesData::ResourceData::setContent): + (WebCore::NetworkResourcesData::ResourceData::dataLength): + (WebCore::NetworkResourcesData::ResourceData::appendData): + (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent): + (WebCore::NetworkResourcesData::setResourceContent): + (WebCore::NetworkResourcesData::maybeAddResourceData): + (WebCore::NetworkResourcesData::maybeDecodeDataToContent): + (WebCore::NetworkResourcesData::removeCachedResource): + (WebCore): + (WebCore::NetworkResourcesData::setResourcesDataSizeLimits): + (WebCore::NetworkResourcesData::ensureFreeSpace): + * inspector/NetworkResourcesData.h: + (ResourceData): + (WebCore::NetworkResourcesData::ResourceData::base64Encoded): + (WebCore::NetworkResourcesData::ResourceData::cachedResource): + (NetworkResourcesData): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::~CachedResource): + (WebCore::CachedResource::removeClient): + (WebCore::CachedResource::deleteIfPossible): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::garbageCollectDocumentResourcesTimerFired): + (WebCore::CachedResourceLoader::garbageCollectDocumentResources): + (WebCore::CachedResourceLoader::clearPreloads): + * loader/cache/CachedResourceLoader.h: + (CachedResourceLoader): + * loader/cache/MemoryCache.cpp: + (WebCore::MemoryCache::evict): + * testing/InternalSettings.cpp: + * testing/Internals.cpp: + (WebCore::Internals::garbageCollectDocumentResources): + (WebCore): + * testing/Internals.h: + (Internals): + +2012-07-26 Luke Macpherson <macpherson@chromium.org> + + Fix null ptr deref in CSSParser::storeVariableDeclaration(). + https://bugs.webkit.org/show_bug.cgi?id=92333 + + Reviewed by Andreas Kling. + + Fix null pointer deref that occurs if the CSSParserValue couldn't be converted to a CSSValue. + + Test fast/css/variables/variable-unparseable-value-crash.html added. + + * css/CSSParser.cpp: + (WebCore::CSSParser::storeVariableDeclaration): + +2012-07-26 Shinya Kawanaka <shinyak@chromium.org> + + Add UserAgentShadowDOM to FormControlElement just before adding AuthorShadowDOM + https://bugs.webkit.org/show_bug.cgi?id=90866 + + Reviewed by Hajime Morita. + + It ensures that UserAgentShadowDOM is the oldest ShadowDOM. + + To show ValidationMessage, WebKit adds a Shadow DOM to some of FormControlElements. + ValidationMessage assumes that the added Shadow DOM is the oldest, however, there was a case + that a page author might add a Shadow DOM before ValidationMessage adds a Shadow DOM. + It will break the assumption that the Shadow DOM added by ValidationMessage is the oldest. + So we have prohibited a page author adding a Shadow DOM to FormControlElement. + + To add UserAgentShadowDOM, we use a callback which is called before a page author adding a Shadow DOM. + It adds a UserAgentShadowDOM if it does not exist, so we can ensure that UserAgentShadowDOM is the oldest. + + Tests: fast/dom/shadow/input-with-validation-without-shadow.html + fast/dom/shadow/input-with-validation.html + fast/dom/shadow/shadowdom-for-button-complex-shadow.html + fast/dom/shadow/shadowdom-for-button-only-shadow.html + fast/dom/shadow/shadowdom-for-button-without-shadow.html + fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html + fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html + fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html + fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html + fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html + fast/dom/shadow/shadowdom-for-keygen-only-shadow.html + fast/dom/shadow/shadowdom-for-keygen-without-shadow.html + fast/dom/shadow/shadowdom-for-object-complex-shadow.html + fast/dom/shadow/shadowdom-for-object-only-shadow.html + fast/dom/shadow/shadowdom-for-object-without-shadow.html + fast/dom/shadow/shadowdom-for-output-complex-shadow.html + fast/dom/shadow/shadowdom-for-output-only-shadow.html + fast/dom/shadow/shadowdom-for-output-without-shadow.html + fast/dom/shadow/shadowdom-for-select-complex-shadow.html + fast/dom/shadow/shadowdom-for-select-only-shadow.html + fast/dom/shadow/shadowdom-for-select-without-shadow.html + fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html + fast/dom/shadow/shadowdom-for-textarea-only-shadow.html + fast/dom/shadow/shadowdom-for-textarea-without-shadow.html + + * dom/ShadowRoot.cpp: + (WebCore::allowsAuthorShadowRoot): + * html/FormAssociatedElement.cpp: + (WebCore::FormAssociatedElement::ensureUserAgentShadowRoot): Ensures the existence of a UserAgentShadowRoot. + If it does not exist, we create it with empty content. + (WebCore): + * html/FormAssociatedElement.h: + (FormAssociatedElement): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::willAddAuthorShadowRoot): + (WebCore): + * html/HTMLFormControlElement.h: + (HTMLFormControlElement): + * html/ValidationMessage.cpp: + (WebCore::adjustBubblePosition): When AuthroShadowRoot does not a shadow element, ValidationMessage + does not have a renderer. So we have to check the existence of renderer. + (WebCore::ValidationMessage::buildBubbleTree): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + Covered by existing test cases. + + * testing/Internals.cpp: + (WebCore::Internals::counterValue): + (WebCore): + (WebCore::Internals::pageNumber): + * testing/Internals.h: + (Internals): + (WebCore::Internals::pageNumber): + * testing/Internals.idl: + +2012-07-25 MORITA Hajime <morrita@google.com> + + [Chromium][Win] <progress> animation on RTL direction is reverse + https://bugs.webkit.org/show_bug.cgi?id=92236 + + Reviewed by Kent Tamura. + + This change modfies the way to handle RTL progress bar painting. + Originally it computes the flipped coordinates. This change uses transformation for the flip. + DirectionFlippingScope handles it. + + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore::RenderThemeChromiumLinux::paintProgressBar): Applied DirectionFlippingScope + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::determinateProgressValueRectFor): + - Deleted RTL handling in favor of DirectionFlippingScope + (WebCore::RenderThemeChromiumSkia::DirectionFlippingScope::DirectionFlippingScope): + (WebCore): + (WebCore::RenderThemeChromiumSkia::DirectionFlippingScope::~DirectionFlippingScope): + * rendering/RenderThemeChromiumSkia.h: + (RenderThemeChromiumSkia): + (DirectionFlippingScope): Added. + * rendering/RenderThemeChromiumWin.cpp: + (WebCore): + (WebCore::RenderThemeChromiumWin::paintProgressBar): Applied DirectionFlippingScope + +2012-07-25 Vineet Chaudhary <rgf748@motorola.com> + + https://bugs.webkit.org/show_bug.cgi?id=92260 + Repalce "int" with "long" from WebCore/*.idls + + Reviewed by Adam Barth. + + As per the WebIDL spec IDL shouldn't have int attributes but long instead. + Repalced attributes types int with long from WebCore/*.idls. + + No new tests. TestObj.idl already covers this. + There should be no behavioural changes. + + * dom/Touch.idl: Repalce int with long. + * dom/WebKitNamedFlow.idl: Ditto. + * html/canvas/ArrayBuffer.idl: Ditto. + * html/canvas/WebGLActiveInfo.idl: Ditto. + * html/canvas/WebGLShaderPrecisionFormat.idl: Ditto. + * page/WebKitAnimation.idl: Ditto. + +2012-07-25 Shinya Kawanaka <shinyak@chromium.org> + + The elements in ShadowDOM of meter or progress should not be modifiable. + https://bugs.webkit.org/show_bug.cgi?id=92199 + + Reviewed by Hajime Morita. + + A user can set -webkit-user-modify: read-write to the elements in Shadow DOM in a meter or progress element. + This might cause a undesired crash like Bug 65738. They should be unmodifiable. + + We add default css values to elements in ShadowDOM of meter or progress to prohibit editing them. + + Tests: fast/html/meter-user-modify.html + fast/html/progress-user-modify.html + + * css/html.css: + Added -webkit-user-modify: read-only !important; for these elements so that they won't be + changed by a user. + (meter::-webkit-meter-bar): + (meter::-webkit-meter-optimum-value): + (meter::-webkit-meter-suboptimum-value): + (meter::-webkit-meter-even-less-good-value): + (progress::-webkit-progress-bar): + (progress::-webkit-progress-value): + +2012-07-25 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] GraphicsContext3D::paintToCanvas should not swap 0th and 2nd components of color + https://bugs.webkit.org/show_bug.cgi?id=92314 + + Reviewed by Rob Buis. + + No new tests, because it corrects existing functionality, but it makes BlackBerry + pass canvas-text.html and others. + + * platform/graphics/GraphicsContext3D.h: + * platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp: + (WebCore::GraphicsContext3D::paintToCanvas): + * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: + (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): + +2012-07-25 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] GraphicsContext3D::reshapeFBOs does not report when bound FBOs should be restored + https://bugs.webkit.org/show_bug.cgi?id=92304 + + Reviewed by Rob Buis. + + No new tests, because it corrects existing functionality, but it makes BlackBerry + pass framebuffer-bindings-unaffected-on-resize.html. + + * platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp: + (WebCore::GraphicsContext3D::reshapeFBOs): + +2012-07-25 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] readPixels should set alpha to 255 instead of 0 when alpha is disabled + https://bugs.webkit.org/show_bug.cgi?id=92303 + + Reviewed by Rob Buis. + + No new tests, because it corrects existing functionality, but it makes BlackBerry + pass context-attributes-alpha-depth-stencil-antialias.html. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::readPixels): + +2012-07-25 Joshua Netterfield <jnetterfield@rim.com> + + [WebGL] fast/canvas/webgl/framebuffer-object-attachment.html fails on certain platforms + https://bugs.webkit.org/show_bug.cgi?id=92296 + + Reviewed by Rob Buis. + + No new tests, because it introduces no new functionality, only fixes the above mentioned test. + + * html/canvas/WebGLFramebuffer.cpp: + (WebCore::WebGLFramebuffer::checkStatus): + +2012-07-25 Xingnan Wang <xingnan.wang@intel.com> + + IndexedDB: IDBTransaction::abort() should throw DOMException + https://bugs.webkit.org/show_bug.cgi?id=92069 + + Reviewed by Kentaro Hara. + + Keep aligned with the W3C spec. + http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBTransaction-abort-void + + Test: storage/indexeddb/transaction-abort.html. + + * Modules/indexeddb/IDBTransaction.cpp: + (WebCore::IDBTransaction::abort): + (WebCore): + * Modules/indexeddb/IDBTransaction.h: + (IDBTransaction): + * Modules/indexeddb/IDBTransaction.idl: + +2012-07-25 Tony Chang <tony@chromium.org> + + flexitems can overflow the flexbox due to rounding + https://bugs.webkit.org/show_bug.cgi?id=92163 + + Reviewed by Levi Weintraub. + + Don't round flex item sizes and use LayoutPoint for the location of flex items. + + Test: css3/flexbox/flex-rounding.html + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::resolveFlexibleLengths): + (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): + (WebCore::RenderFlexibleBox::layoutColumnReverse): + +2012-07-25 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Integrate certmgr with CredentialBackingStore + https://bugs.webkit.org/show_bug.cgi?id=92183 + + Reviewed by George Staikos. + + Integrated BlackBerry::Platform::CertMgrWrapper with + CredentialBackingStore, when certmgr is ready we save + the password in certmgr and retrieve it from certmgr. + + RIM PR: 171991 + Internally reviewed by Joe Mason <jmason@rim.com>. + + No new tests since there's no functional change. + + * platform/network/blackberry/CredentialBackingStore.cpp: + (WebCore::hashCredentialInfo): + (WebCore): + (WebCore::CredentialBackingStore::CredentialBackingStore): + (WebCore::CredentialBackingStore::open): + (WebCore::CredentialBackingStore::addLogin): + (WebCore::CredentialBackingStore::updateLogin): + (WebCore::CredentialBackingStore::getLogin): + * platform/network/blackberry/CredentialBackingStore.h: + (CredentialBackingStore): + +2012-07-25 Kent Tamura <tkent@chromium.org> + + REGRESSION(r121420): Performance regression of form state saving for pages with multiple forms + https://bugs.webkit.org/show_bug.cgi?id=91804 + + Reviewed by Hajime Morita. + + The complexity of FormKeyGenerator::formKey() was O(N) where N is the + number form elements with an identical action URL, and formKey() is + called for every form. So, it's O(N^2). A page in www.reddit.com + contains hundreds of form elements with action="#". So FormController:: + formElementsState() took a few seconds on a slow machine. + + In order to avoid O(N^2) operation, storing a map from form signatures + to next index numbers, instead of storing existing formKey strings. + + No new tests. Just a performance improvement. + + Note: This is a re-landing of r123191. We rolled it out because of + suspicion of a performance regression. However it was innocent. + + * html/FormController.cpp: + (FormKeyGenerator): Remove m_existingKeys. Add a map from a form + signature string to the next index number. + (WebCore::formSignature): Returns a signature string for a form, without + an index number. This is like "actionURL [name1 name2 ]" + (WebCore::FormKeyGenerator::formKey): + Creates a formKey string by concatenating a formSignature and #n. N is + obtained from m_formSignatureToNextIndexMap in O(1). + (WebCore::FormKeyGenerator::willDeleteForm): + Remove the code for m_existingKeys. + +2012-07-25 Benjamin Poulain <bpoulain@apple.com> + + Initialize QualifiedName's strings from the read only data segment + https://bugs.webkit.org/show_bug.cgi?id=92226 + + Reviewed by Anders Carlsson. + + Modify the initialization of static QualifiedName to initialize the AtomicString + with the data from the read only memory. + + Overall, HTMLNames::init() gets 10% faster. + + * dom/QualifiedName.cpp: + (WebCore::QualifiedName::QualifiedName): + * dom/QualifiedName.h: + (QualifiedName): + Remove the useless constructor taking a char* and get rid of the init() function. + The AtomicString representing the name should be constructed by the caller of QualifiedName. + + Because the init() code is relatively large and is only executed once, it is important to + keep the AtomicString construction separate. The function createQualifiedName() was added + to improve the cache use. The short version let us reduce the code one more instruction per + call. + + * dom/make_names.pl: + (printQualifiedNameMaker): + (printShortQualifiedNameMaker): + (printNamesCppFile): + (printDefinitions): + +2012-07-25 Yoshifumi Inoue <yosin@chromium.org> + + [Forms] Move HTMLInputElement::updateInnerTextValue to InputType class + https://bugs.webkit.org/show_bug.cgi?id=92230 + + Reviewed by Kent Tamura. + + This patch moves implementaion of HTMLInputElement::updateInnerTextValue() + into input type classes, removes updateInnerTextValue() from HTMLInputElement, + and updates call site of updateInnerTextValue(). + + No new tests. This patch doesn't change behavior. + + * html/DateInputType.cpp: + (WebCore::DateInputType::handleBlurEvent): Updated call site of updateInnerTextValue(). + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::updateType): Updated call site of updateInnerTextValue(). + (WebCore::HTMLInputElement::parseAttribute): Updated call site of updateInnerTextValue(). + (WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement): Updated call site of updateInnerTextValue(). + (WebCore::HTMLInputElement::setSuggestedValue): Updated call site of updateInnerTextValue(). + * html/HTMLInputElement.h: + (HTMLInputElement): Removed updateInnerTextValue(). + * html/InputType.cpp: + (WebCore::InputType::updateInnerTextValue): Added default implementaion. + * html/InputType.h: + (InputType): Added declaration of updateInnerTextValue(). + * html/NumberInputType.cpp: + (WebCore::NumberInputType::handleBlurEvent): Updated call site of updateInnerTextValue(). + * html/TextFieldInputType.cpp: + (WebCore::TextFieldInputType::setValue): Updated call site of updateInnerTextValue(). + (WebCore::TextFieldInputType::updateInnerTextValue): Moved implementaion from HTMLInputElement. + * html/TextFieldInputType.h: + (TextFieldInputType): Added declaration of updateInnerTextValue(). + +2012-07-25 Dana Jansens <danakj@chromium.org> + + [chromium] Move ephemeral data for a single frame in LayerRendererChromium into a structure with a scoped lifetime equal to the frame + https://bugs.webkit.org/show_bug.cgi?id=92294 + + Reviewed by Adrienne Walker. + + The LayerRendererChromium class has a number of member variables that are used + while drawing a single frame. Because they are member variables, their lifetimes + are not clear, and some are even updated between frames, which is not needed. + + This change creates a LRC::DrawingFrame structure that holds the data used + while drawing the current frame, and an instance of this structure is held + and passed around to functions in LayerRendererChromium, moving all of the + data out from being member variables on the class to being function + arguments on the relevant methods. + + The projection and window matrices are a part of this frame data, and are not + used externally, so they are removed from the CCRenderer interface and included + within the DrawingFrame structure. + + Covered by existing tests, no change in behaviour intended. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::LayerRendererChromium): + (WebCore::LayerRendererChromium::viewportChanged): + (WebCore::LayerRendererChromium::clearFramebuffer): + (WebCore::LayerRendererChromium::drawFrame): + (WebCore::LayerRendererChromium::drawRenderPass): + (WebCore::LayerRendererChromium::drawQuad): + (WebCore::LayerRendererChromium::drawCheckerboardQuad): + (WebCore::LayerRendererChromium::drawDebugBorderQuad): + (WebCore::LayerRendererChromium::drawBackgroundFilters): + (WebCore::LayerRendererChromium::drawRenderPassQuad): + (WebCore::LayerRendererChromium::drawSolidColorQuad): + (WebCore::LayerRendererChromium::drawTileQuad): + (WebCore::LayerRendererChromium::drawYUVVideoQuad): + (WebCore::LayerRendererChromium::drawStreamVideoQuad): + (WebCore::LayerRendererChromium::drawTextureQuad): + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): + (WebCore::LayerRendererChromium::finishDrawingFrame): + (WebCore::LayerRendererChromium::drawTexturedQuad): + (WebCore::LayerRendererChromium::copyTextureToFramebuffer): + (WebCore::LayerRendererChromium::isCurrentRenderPass): + (WebCore::LayerRendererChromium::useRenderPass): + (WebCore::LayerRendererChromium::useScopedTexture): + (WebCore::LayerRendererChromium::bindFramebufferToTexture): + (WebCore::LayerRendererChromium::setScissorToRect): + (WebCore::LayerRendererChromium::setDrawFramebufferRect): + * platform/graphics/chromium/LayerRendererChromium.h: + (DrawingFrame): + (WebCore::LayerRendererChromium::DrawingFrame::DrawingFrame): + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCRenderer.h: + (CCRenderer): + +2012-07-19 Adrienne Walker <enne@google.com> + + [chromium] Make all compositor screen space transforms operate on content rects + https://bugs.webkit.org/show_bug.cgi?id=91807 + + Reviewed by Kenneth Russell. + + Previously, surface screen space transforms operated on surface + content space but layer screen space transforms operated on layer + space. For the purpose of consistency, unify these two so that they + both operate on content space. + + No tests, because no change in behavior expected. Just a refactoring. + + * platform/graphics/chromium/LayerChromium.h: + (LayerChromium): + * platform/graphics/chromium/cc/CCDebugRectHistory.cpp: + (WebCore::CCDebugRectHistory::savePaintRects): + (WebCore::CCDebugRectHistory::savePropertyChangedRects): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateDrawTransformsInternal): + (WebCore::CCLayerTreeHostCommon::findLayerThatIsHitByPoint): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::::markOccludedBehindLayer): + (WebCore::::occluded): + (WebCore::::unoccludedContentRect): + +2012-07-25 Dan Bernstein <mitz@apple.com> + + Hit testing in one column or in the gap between cloumns along the block axis can return a result from the wrong column + https://bugs.webkit.org/show_bug.cgi?id=92311 + + Reviewed by Anders Carlsson. + + Tests: fast/multicol/hit-test-end-of-column.html + fast/multicol/hit-test-gap-block-axis.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::positionForPointWithInlineChildren): To prevent hits after the last + line on a given column from returning the next line in the next column, added a check if + the hit occurred within the pagination strut of a line. Covered by the first test. + (WebCore::RenderBlock::adjustPointToColumnContents): Added clamp-to-column logic for the + block-axis case. This prevents hits near the bottom of the top half of the gap from bleeding + into the top of the next column. Covered by the second test. + +2012-07-25 David Grogan <dgrogan@chromium.org> + + IndexedDB: Make db.version return an integer if appropriate + https://bugs.webkit.org/show_bug.cgi?id=92195 + + Reviewed by Tony Chang. + + Make use of the existing IDBAny mechanism to return an integer if + integer versions have been used. + + No new tests - no change in behavior expected. + + * Modules/indexeddb/IDBDatabase.cpp: + (WebCore::IDBDatabase::version): + (WebCore): + * Modules/indexeddb/IDBDatabase.h: + (IDBDatabase): + * Modules/indexeddb/IDBDatabase.idl: + +2012-07-25 Michael Saboff <msaboff@apple.com> + + Convert HTML parser to handle 8-bit resources without converting to UChar* + https://bugs.webkit.org/show_bug.cgi?id=90321 + + Reviewed by Geoffrey Garen. + + No new tests, no new functionality therefore covered by existing tests. + + Changed the parsing of HTML to handle 8-bit strings without converting the + whole string to 16-bits. Primary change was to use the appropriate + character pointer type (LChar* or UChar*) depending on the source string. + This access is abstracted in SegmentedSubstring by getCurrentChar{8,16} and + incrementAndGetCurrentChar{8,16} methods. In SegmentedString, the advance() + and advanceAndUpdateLineNumber() methods have been refactored into a + state machine managed pair of function pointers. The possible functions + have not only the 8 and 16 bitness factored out, they also have the + "exclude line numbers" logic factored out for advanceAndUpdateLineNumber(). + This provides a net speed-up even with the 8/16 bit testing. + Other changes involve using String methods to access and compare with the + source data. + + * html/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocumentParser::append): Changed to use currentChar() + instead of SegmentedString '*' operator. + * html/parser/HTMLEntityParser.cpp: Changed to use currentChar() instead of + SegmentedString '*' operator. + * html/parser/HTMLParserIdioms.cpp: + (WebCore::stripLeadingAndTrailingHTMLSpaces): Added 8-bit fast path. + * html/parser/HTMLSourceTracker.cpp: + (WebCore::HTMLSourceTracker::sourceForToken): Changed to use currentChar() instead of + SegmentedString '*' operator. + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::script): Updated to use new String::dataSize() method. + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::operator=): + (WebCore::SegmentedString::clear): + (WebCore::SegmentedString::append): + (WebCore::SegmentedString::prepend): + (WebCore::SegmentedString::advanceSubstring): + (WebCore::SegmentedString::advance): Changed to be a wrapper that invokes current + advance function. + (WebCore::SegmentedString::advance8): Fast path advance function for 8 bit data. + (WebCore::SegmentedString::advance16): Fast path advance function for 16 bit data. + (WebCore::SegmentedString::advanceAndUpdateLineNumber8IncludeLineNumbers): Fast + path advanceAndUpdateLineNumber for 8 bit data when we need to update the line number. + (WebCore::SegmentedString::advanceAndUpdateLineNumber16IncludeLineNumbers): Fast + path advanceAndUpdateLineNumber for 16 bit data when we need to update the line number. + (WebCore::SegmentedString::advanceSlowCase): Slow case advance function for both + 8 and 16 bit advance. + (WebCore::SegmentedString::advanceAndUpdateLineNumberSlowCase): Slow case + advanceAndUpdateLineNumber function for both 8 and 16 bit data. + (WebCore::SegmentedString::advanceEmpty): Advance function when input has been exhausted. + * platform/text/SegmentedString.h: + (WebCore::SegmentedSubstring::SegmentedSubstring): + (WebCore::SegmentedSubstring::clear): + (SegmentedSubstring): + (WebCore::SegmentedSubstring::is8Bit): New getter. + (WebCore::SegmentedSubstring::appendTo): + (WebCore::SegmentedSubstring::getCurrentChar8): New getter for the 8 bit case. + (WebCore::SegmentedSubstring::getCurrentChar16): New getter for the 16 bit case. + (WebCore::SegmentedSubstring::incrementAndGetCurrentChar8): New wrapper functions + that pre-increments the 8 bit pointer and returns the next character. + (WebCore::SegmentedSubstring::incrementAndGetCurrentChar16): New wrapper functions + that pre-increments the 16 bit pointer and returns the next character. + (WebCore::SegmentedSubstring::currentSubString): + (WebCore::SegmentedSubstring::getCurrentChar): + (WebCore::SegmentedSubstring::incrementAndGetCurrentChar): + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::push): + (WebCore::SegmentedString::isEmpty): + (WebCore::SegmentedString::lookAhead): + (WebCore::SegmentedString::lookAheadIgnoringCase): + (WebCore::SegmentedString::advance): + (WebCore::SegmentedString::advanceAndUpdateLineNumber): + (WebCore::SegmentedString::advanceAndASSERT): + (WebCore::SegmentedString::advanceAndASSERTIgnoringCase): + (WebCore::SegmentedString::advancePastNonNewline): + (WebCore::SegmentedString::advancePastNewlineAndUpdateLineNumber): + (WebCore::SegmentedString::currentChar): + (WebCore::SegmentedString::setSlowCase): Set advance function pointers to slow case + functions. + (WebCore::SegmentedString::decrementAndCheckLength): Decrement substring length and + change to slow case functions when only one character left. + (WebCore::SegmentedString::setAdvanceFunctionPointers): Select appropriate advance + functions based on current substring. + (WebCore::SegmentedString::lookAheadInline): Changed to use String::startsWith(). + (WebCore::SegmentedString::lookAheadSlowCase): + * xml/parser/CharacterReferenceParserInlineMethods.h: + (WebCore::consumeCharacterReference): Changed to use currentChar() instead of + SegmentedString '*' operator. + * xml/parser/MarkupTokenizerBase.h: + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::nextInputCharacter): + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::peek): Changed to use + currentChar() instead of SegmentedString '*' operator. + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::advance): + +2012-07-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123625 and r123672. + http://trac.webkit.org/changeset/123625 + http://trac.webkit.org/changeset/123672 + https://bugs.webkit.org/show_bug.cgi?id=92315 + + Broke Windows and gcc builds (Requested by rniwa on #webkit). + + * platform/AutodrainedPool.h: + (AutodrainedPool): + * platform/ContentType.h: + (ContentType): + * platform/ContextMenu.h: + (ContextMenu): + * platform/ContextMenuItem.h: + (ContextMenuItem): + * platform/Cursor.h: + (WebCore::SharedCursor::SharedCursor): + (Cursor): + * platform/KURL.h: + (WebCore::KURL::KURL): + (KURL): + * platform/KURLGooglePrivate.h: + (KURLGooglePrivate): + * platform/PODRedBlackTree.h: + (WebCore::PODRedBlackTree::PODRedBlackTree): + * platform/Pasteboard.h: + (Pasteboard): + * platform/PlatformEvent.h: + (WebCore::PlatformEvent::PlatformEvent): + * platform/PlatformKeyboardEvent.h: + (PlatformKeyboardEvent): + * platform/PlatformMouseEvent.h: + (PlatformMouseEvent): + * platform/PlatformPasteboard.h: + (PlatformPasteboard): + * platform/PlatformTouchEvent.h: + (PlatformTouchEvent): + * platform/PlatformWheelEvent.h: + (PlatformWheelEvent): + * platform/RunLoop.h: + (TimerBase): + * platform/ScrollAnimator.h: + (ScrollAnimator): + * platform/ScrollAnimatorNone.h: + (ScrollAnimatorNone): + * platform/SharedBuffer.h: + (SharedBuffer): + * platform/WheelFlingPlatformGestureCurve.h: + (WheelFlingPlatformGestureCurve): + * platform/Widget.h: + (Widget): + * platform/network/cf/ResourceRequestCFNet.cpp: + (WebCore::ResourceRequest::doUpdateResourceRequest): + +2012-07-25 Ryosuke Niwa <rniwa@webkit.org> + + Windows build fix attempt after r123625. + + * platform/network/cf/ResourceRequestCFNet.cpp: + (WebCore::ResourceRequest::doUpdateResourceRequest): + +2012-07-25 Kwang Yul Seo <skyul@company100.net> + + Read tag names and attributes from the saved tokens in HTMLTreeBuilder::resetInsertionModeAppropriately. + https://bugs.webkit.org/show_bug.cgi?id=92240 + + Reviewed by Adam Barth. + + This is a follow-up patch for r123577. Added ItemType enum to HTMLStackItem to handle + the context element case. + + No new tests, covered by existing tests. + + * html/parser/HTMLStackItem.h: + (WebCore::HTMLStackItem::create): + (WebCore::HTMLStackItem::HTMLStackItem): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + (WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately): + +2012-07-25 Nico Weber <thakis@chromium.org> + + [chromium/mac] Remove mac_bundle_resources section from WebCore.gyp + https://bugs.webkit.org/show_bug.cgi?id=92207 + + Reviewed by Tony Chang. + + It's no longer needed after http://crrev.com/148290 and + http://crrev.com/148187. + + * WebCore.gyp/WebCore.gyp: + +2012-07-25 Dana Jansens <danakj@chromium.org> + + [chromium] Move WebFilterOperations from RenderPassDrawQuad to RenderPass + https://bugs.webkit.org/show_bug.cgi?id=91885 + + Reviewed by Adrienne Walker. + + We move the filter operations to CCRenderPass to avoid having + variable-length data in a WebCompositorQuad in order to serialize, + and also to avoid requiring a virtual destructor for the quad + classes. + + The drawFrame method now takes a CCRenderPassIdHashMap in order + to connect RenderPass quads to their source RenderPass. + + Covered by existing tests. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame): + (WebCore::LayerRendererChromium::drawFrame): + (WebCore::LayerRendererChromium::beginDrawingFrame): + (WebCore::LayerRendererChromium::drawBackgroundFilters): + (WebCore::LayerRendererChromium::drawRenderPassQuad): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::CCLayerTreeHostImpl::drawLayers): + * platform/graphics/chromium/cc/CCRenderPass.h: + (WebCore::CCRenderPass::filters): + (WebCore::CCRenderPass::setFilters): + (CCRenderPass): + (WebCore::CCRenderPass::backgroundFilters): + (WebCore::CCRenderPass::setBackgroundFilters): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderer.h: + (CCRenderer): + +2012-07-25 Mike Reed <reed@google.com> + + fix test in beginLayerClippedToImage to check for immutability if we're going to do a shallow-copy + https://bugs.webkit.org/show_bug.cgi?id=92276 + + Reviewed by Stephen White. + + PlatformContextSkia::beginLayerClippedToImage + + This function wants to apply the provided ImageBuffer as a clip. Skia does not support this natively yet, + so the code makes a "copy" of that imageBuffer, to be applied later. The old code, wanting to avoid a + deep copy if possible, checked for the presence of a SkPixelRef. If it found one, it made a shallow copy. + This is flawed, since the contents of a pixelref are not guaranteed to be immutable. The new code checks + against this attribute: if the bitmap is "immutable" then we can make a shallow-copy, else we make a + deep copy. + + No new tests. Existing svg layouttests work w/ or w/out this change, but at the next Skia deps roll, we see + failures w/o this change. The change is more "correct", though the problem case does not exhibit itself until + Skia rev. 4722 or later lands. + + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::beginLayerClippedToImage): + +2012-07-25 Li Yin <li.yin@intel.com> + + It is invalid when both numberOfInputChannels and numberOfOutputChannels to be zero in JavaScriptAudioNode. + https://bugs.webkit.org/show_bug.cgi?id=91364 + + Reviewed by Kenneth Russell. + + Spec: http://www.w3.org/TR/webaudio/#JavaScriptAudioNode-section + It is invalid for both numberOfInputChannels and numberOfOutputChannels to be zero. + + Test: webaudio/javascriptaudionode.html + + * Modules/webaudio/JavaScriptAudioNode.cpp: + (WebCore::JavaScriptAudioNode::create): + +2012-07-24 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Refactor CCLayerTreeHostCommon: move root layer special case initialization into internal code. + https://bugs.webkit.org/show_bug.cgi?id=88953 + + Reviewed by Adrienne Walker. + + This is part 1 of trying to reduce the root layer special + case. This tries to reduce the special-ness of the root layer from + the perspective of outside code. + + After this patch, code that uses calcDrawTransforms() no longer + needs to initialize the root layer's surface, and no longer needs + to manually append the root layer to the renderSurfaceLayerList. + + Unit tests were also updated (much cleaner!) to account for this change. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::updateLayers): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore): + (WebCore::setupRootLayerAndSurfaceForRecursion): + (WebCore::CCLayerTreeHostCommon::calculateDrawTransforms): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.h: + (CCLayerTreeHostCommon): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList): + +2012-07-25 Taiju Tsuiki <tzik@chromium.org> + + FileSystem should provide a way to delete filesystem. + https://bugs.webkit.org/show_bug.cgi?id=91861 + + Reviewed by Adam Barth. + + We will add a test when we wire-up the feature to Inspector. + + * Modules/filesystem/LocalFileSystem.cpp: Add deleteFileSystem + (WebCore::deleteFileSystem): + (WebCore): + (WebCore::LocalFileSystem::deleteFileSystem): + * Modules/filesystem/LocalFileSystem.h: + (LocalFileSystem): + * platform/AsyncFileSystem.cpp: Add deleteFileSystem + (WebCore): + (WebCore::AsyncFileSystem::deleteFileSystem): + * platform/AsyncFileSystem.h: + (AsyncFileSystem): + * platform/blackberry/AsyncFileSystemBlackBerry.cpp: Add deleteFileSystem + (WebCore::AsyncFileSystem::deleteFileSystem): + (WebCore): + * platform/gtk/AsyncFileSystemGtk.cpp: Add deleteFileSystem + (WebCore::AsyncFileSystem::deleteFileSystem): + (WebCore): + +2012-07-25 Andrey Adaikin <aandrey@chromium.org> + + Web Inspector: Add more jsdocs to InjectedScriptSource.js + https://bugs.webkit.org/show_bug.cgi?id=92255 + + Reviewed by Pavel Feldman. + + * inspector/InjectedScriptSource.js: + +2012-07-24 Dana Jansens <danakj@chromium.org> + + [chromium] Turn the debug HUD into a layer so that it can be drawn as a WebCompositorQuad + https://bugs.webkit.org/show_bug.cgi?id=92182 + + Reviewed by Adrienne Walker. + + By changing the HUD into a quad, we are able to create a HUD and pass + it to the host compositor, allowing the HUD to be used for renderers + under Ubercompositor. + + This also removes the special drawing code for the HUD from + LayerRendererChromium, allowing us to move finishDrawingFrame + into LayerRendererChromium as a private method and remove it + from the CCRenderer interface. + + Finally, we can remove the CCFontAtlas transport code from CCProxy + and its implementations as the atlas can be synced to impl thread + through the usual layer commit mechanism. + + The debug HUD is not covered by tests. + + * WebCore.gypi: + * platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp: Added. + (WebCore): + (WebCore::HeadsUpDisplayLayerChromium::create): + (WebCore::HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium): + (WebCore::HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium): + (WebCore::HeadsUpDisplayLayerChromium::createCCLayerImpl): + * platform/graphics/chromium/HeadsUpDisplayLayerChromium.h: Added. + (WebCore): + (HeadsUpDisplayLayerChromium): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawFrame): + (WebCore::LayerRendererChromium::cleanupSharedObjects): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCDebugRectHistory.cpp: + (WebCore::CCDebugRectHistory::savePropertyChangedRects): + * platform/graphics/chromium/cc/CCDebugRectHistory.h: + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp. + (WebCore): + (WebCore::CCHeadsUpDisplayLayerImpl::CCHeadsUpDisplayLayerImpl): + (WebCore::CCHeadsUpDisplayLayerImpl::~CCHeadsUpDisplayLayerImpl): + (WebCore::CCHeadsUpDisplayLayerImpl::willDraw): + (WebCore::CCHeadsUpDisplayLayerImpl::appendQuads): + (WebCore::CCHeadsUpDisplayLayerImpl::didDraw): + (WebCore::CCHeadsUpDisplayLayerImpl::didLoseContext): + (WebCore::CCHeadsUpDisplayLayerImpl::drawHudContents): + (WebCore::CCHeadsUpDisplayLayerImpl::drawFPSCounter): + (WebCore::CCHeadsUpDisplayLayerImpl::drawFPSCounterText): + (WebCore::CCHeadsUpDisplayLayerImpl::drawDebugRects): + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h. + (WebCore): + (CCHeadsUpDisplayLayerImpl): + (WebCore::CCHeadsUpDisplayLayerImpl::create): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore::CCLayerImpl::layerIsAlwaysDamaged): + This flag is used to mark the HUD as always damaged, so that it is + continually drawn on the impl thread. It is also used as a hint by + the CCDebugRectHistory class to not include the layer in the display + of damage, since always damaged is not interesting damage. + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::create): + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::initialize): + (WebCore::CCLayerTreeHost::willCommit): + (WebCore::CCLayerTreeHost::didCommit): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (CCLayerTreeSettings): + (WebCore::CCLayerTreeSettings::showDebugInfo): + (WebCore::CCLayerTreeSettings::showDebugRects): + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): + (WebCore::CCLayerTreeHostImpl::drawLayers): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (WebCore): + (CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCProxy.h: + (CCProxy): + * platform/graphics/chromium/cc/CCRenderer.h: + (CCRenderer): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + * platform/graphics/chromium/cc/CCSingleThreadProxy.h: + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + +2012-07-25 'Pavel Feldman' <pfeldman@chromium.org> + + Web Inspector: follow up to r123612, fixing CSS value suggest. + + Not reviewed, minor JS fix. + + * inspector/front-end/CSSCompletions.js: + (WebInspector.CSSCompletions): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype): + +2012-07-25 Michael Saboff <msaboff@apple.com> + + Unreviewed build fix after r123624. + + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::clearGeolocationOverride): + Changed ASSERT_UNUSED() to UNUSED_PARAM(). + +2012-07-25 Pavel Feldman <pfeldman@chromium.org> + + Web inspector auto-completes "optimizequality" but then complains + https://bugs.webkit.org/show_bug.cgi?id=92262 + + Reviewed by Timothy Hatcher. + + Fixed optimizeSpeed, optimizeLegibility, geometricPrecision. + + * inspector/front-end/CSSKeywordCompletions.js: + +2012-07-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=89114 + REGRESSION (r112919): Setting scrollTop after setting display from none to block + fails + -and corresponding- + <rdar://problem/11656050> + + Reviewed by Simon Fraser. + + ScrollAnimatorMac::immediateScrollTo() and ScrollAnimatorMac::immediateScrollBy() + both have an optimization in place so that they do not call + notifyPositionChanged() if the new scroll offset matches the ScrollAnimator's + cached m_currentPosX and m_currentPosY. So revision 112919 caused troubled with + this optimization because it allowed RenderLayers to restore a scrollOffset from + the Element if there is one cached there. This caused the RenderLayer to have a + scrollOffset that is improperly out-of-synch with the ScrollAnimator's + currentPosition (which will just be 0,0 since it is being re-created like the + RenderLayer). This fix makes sure they are in synch by calling + setCurrentPosition() on the ScrollAnimator when the cached position is non-zero. + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::RenderLayer): + +2012-07-25 Andreas Kling <kling@webkit.org> + + Make ElementAttributeData a variable-sized object to reduce memory use. + <http://webkit.org/b/88240> + + Reviewed by Ryosuke Niwa. + + Take advantage of the fact that we know at ElementAttributeData construction time how many attributes + it needs to accomodate and allocate exactly as much space as needed instead of using a Vector. + For elements that never have their attribute list mutated (the vast majority), this saves a lot of + memory and removes the indirection to Vector<Attribute>'s heap-allocated storage. + + Introduced a mutability flag to ElementAttributeData and sprinkled assertions all over to make sure + that nothing tries to mutate an element with a raw attribute array. + + When an Element's attribute(s) are mutated, we reconstruct the ElementAttributeData, this time using + a Vector as backing instead. This is triggered when calling Element::mutableAttributeData(). + + This reduces memory consumption by 3.2MB when viewing the full HTML5 spec at <http://whatwg.org/c/>. + That is a ~35% reduction in DOM attribute memory use. + + Furthermore, that page ends up promoting 27% of the elements to mutable attribute storage due to dynamic + adding of "class" attributes. For more static pages, savings are even greater. + + Also did away with ElementAttributeData::removeAttribute(name) and do separate index lookup where + needed. Not a big deal but avoids double lookup of attributes when removing them. + + * dom/Element.cpp: + (WebCore::Element::detachAttribute): + (WebCore::Element::removeAttribute): + (WebCore::Element::attributes): + (WebCore::Element::setAttributeInternal): + (WebCore::Element::parserSetAttributes): + (WebCore::Element::hasEquivalentAttributes): + (WebCore::Element::setAttributeNode): + (WebCore::Element::removeAttributeNode): + (WebCore::Element::getAttributeNode): + (WebCore::Element::getAttributeNodeNS): + (WebCore::Element::hasAttribute): + (WebCore::Element::hasAttributeNS): + (WebCore::Element::cloneAttributesFromElement): + + Sprinkle const on ElementAttributeData* pointers. + Switch to using mutableAttributeData() in code paths that modify attributes. + + (WebCore::Element::normalizeAttributes): + + Cleaner iteration over attributes, I removed ElementAttributeData::attributeVector() since that + was just incurring a bunch of extra Vector copying. Since ElementAttributeData already exposes + length() and attributeItem(index), use those to iterate directly over the attributes. + + (WebCore::Element::createMutableAttributeData): + + Added, converts existing ElementAttributeData to a mutable object. Otherwise creates a new + ElementAttributeData (mutable and empty.) + + * dom/Element.h: + (WebCore::Element::attributeData): + (WebCore::Element::updatedAttributeData): + (WebCore::Element::ensureAttributeData): + (WebCore::Element::ensureUpdatedAttributeData): + + Made all of these return "const ElementAttributeData*" to ensure at compile-time that nothing + attempts to modify an ElementAttributeData that may be immutable. + + ensureUpdatedAttributeData() is still const, despite possibly calling mutableAttributeData(). + The goal of having methods be const is to prevent conversion from one ElementAttributeData + object to another, so that pointers remain intact and no unnecessary work gets done. + + (WebCore::Element::mutableAttributeData): + + Added, returns a guaranteed mutable ElementAttributeData* pointer. + + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::createImmutable): + + Creates a new ElementAttributeData tailored to fit the provided Vector<Attribute>. + + (WebCore::ElementAttributeData::ElementAttributeData): + + Moved constructors out-of-line, getting too complex for header files. + + ElementAttributeData(const Vector<Attribute>&) creates an immutable ElementAttributeData + containing the provided attributes in an array tacked onto the end of the object. + + (WebCore::ElementAttributeData::~ElementAttributeData): + + Free the attribute vector if mutable. + For immutable objects, manually invoke destructor on each Attribute object, + since these won't be destroyed automatically by ~ElementAttributeData. + + (WebCore::ElementAttributeData::attrIfExists): + + (WebCore::ElementAttributeData::ensureAttr): + (WebCore::ElementAttributeData::setAttr): + (WebCore::ElementAttributeData::removeAttr): + + Make these const, as they should always have been- they don't affect the ElementAttributeData, + only the global DOM Attr <-> ElementAttributeData mappings. + + (WebCore::ElementAttributeData::ensureInlineStyle): + (WebCore::ElementAttributeData::ensureMutableInlineStyle): + + Sprinkle ASSERT(isMutable()). This doesn't mean that all Elements with inline styles automatically + have mutable attribute data. There's still inlineStyle() for that, which may return null. + These are only for use where you need a valid StylePropertySet*, even if there is no inline style + attribute, e.g in editing code that wants to add style. + + (WebCore::ElementAttributeData::updateInlineStyleAvoidingMutation): + (WebCore::ElementAttributeData::destroyInlineStyle): + + Make these const. While destroyInlineStyle() doesn't sound very const-y, immutable objects that + contain a style attribute will have a valid inlineStyle() with that style data. This is just + an interface for ~StyledElement to destroy the style object. + It'd be nice to do that in ~ElementAttributeData(), but we need a StyledElement* pointer to + clean up properly and we don't store one in this class. + + (WebCore::ElementAttributeData::addAttribute): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::clearAttributes): + (WebCore::ElementAttributeData::replaceAttribute): + + Sprinkle ASSERT(isMutable()). + Always go straight for m_mutableAttributeVector since we know that's the storage being used. + + (WebCore::ElementAttributeData::isEquivalent): + (WebCore::ElementAttributeData::detachAttrObjectsFromElement): + (WebCore::ElementAttributeData::getAttributeItemIndexSlowCase): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::getAttributeItem): + (WebCore::ElementAttributeData::getAttributeItemIndex): + + Use length() and attributeItem(index) to iterate over the attributes. + + (WebCore::ElementAttributeData::cloneDataFrom): + + Sprinkle ASSERT(isMutable()). Added a FIXME that cloning elements could create immutable + attribute data. I'm not sure this optimization is worthwhile, as cloning elements is already + a semi-rare occurrence. + + Updated code to handle both immutable and mutable source objects. This could + + (WebCore::ElementAttributeData::getAttributeNode): + + Const correctness. + + * dom/ElementAttributeData.h: + (ElementAttributeData): + + Turn attribute storage into what's effectively union { OwnPtr<Vector<Attribute>>; Attribute[]; } + The new m_isMutable bit determines which union member should be used for access. + + (WebCore::ElementAttributeData::create): + (WebCore::ElementAttributeData::createImmutable): + + Added createImmutable(const Vector<Attribute>&) as a complement to create(). + + (WebCore::ElementAttributeData::setClass): + (WebCore::ElementAttributeData::setIdForStyleResolution): + (WebCore::ElementAttributeData::inlineStyle): + (WebCore::ElementAttributeData::setAttributeStyle): + + Make these const, and their data member counterparts 'mutable'. + An immutable ElementAttributeData object still has m_classNames, m_idForStyleResolution, + m_inlineStyleDecl and m_attributeStyle. + + (WebCore::ElementAttributeData::reportMemoryUsage): + + Updated for isMutable(). + + (WebCore::ElementAttributeData::makeMutable): + + Returns a mutable clone of itself. + + (WebCore::ElementAttributeData::isEmpty): + (WebCore::ElementAttributeData::length): + (WebCore::ElementAttributeData::attributeItem): + + Check isMutable() to know how to access attribute storage. + + * dom/StyledElement.cpp: + (WebCore::StyledElement::style): + (WebCore::StyledElement::setInlineStyleProperty): + + Simplify by using StyledElement::ensureInlineStyle(). + + (WebCore::StyledElement::classAttributeChanged): + + Use mutableAttributeData() if the attribute is being removed completely. + In other cases, tiptoe around without causing the attribute data to go mutable. + + (WebCore::StyledElement::removeInlineStyleProperty): + + Use mutableAttributeData() if/when actually removing something. + + (WebCore::StyledElement::addSubresourceAttributeURLs): + + Const correctness. + + * dom/StyledElement.h: + (WebCore::StyledElement::ensureInlineStyle): + + This now implies conversion to mutable attribute data. Used by codepaths that add/remove + properties, so conversion is inevitable. + + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement): + (WebCore::HTMLConstructionSite::createHTMLElementFromSavedElement): + * svg/properties/SVGAnimatedPropertyMacros.h: + (WebCore::SVGSynchronizableAnimatedProperty::synchronize): + + Use mutableAttributeData() as appropriate. + + * xml/parser/XMLDocumentParserQt.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + + Const correctness. + +2012-07-25 Andrew Wilson <atwilson@chromium.org> + + Unreviewed, rolling out r123560. + http://trac.webkit.org/changeset/123560 + https://bugs.webkit.org/show_bug.cgi?id=90321 + + Breaks chromium valgrind tests. + + * html/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocumentParser::append): + * html/parser/HTMLEntityParser.cpp: + (WebCore::HTMLEntityParser::consumeNamedEntity): + * html/parser/HTMLParserIdioms.cpp: + (WebCore::stripLeadingAndTrailingHTMLSpaces): + * html/parser/HTMLSourceTracker.cpp: + (WebCore::HTMLSourceTracker::sourceForToken): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::script): + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::operator=): + (WebCore::SegmentedString::clear): + (WebCore::SegmentedString::append): + (WebCore::SegmentedString::prepend): + (WebCore::SegmentedString::advanceSubstring): + (WebCore::SegmentedString::advance): + (WebCore::SegmentedString::advanceSlowCase): + (WebCore::SegmentedString::advanceAndUpdateLineNumberSlowCase): + * platform/text/SegmentedString.h: + (WebCore::SegmentedSubstring::SegmentedSubstring): + (WebCore::SegmentedSubstring::clear): + (WebCore::SegmentedSubstring::appendTo): + (SegmentedSubstring): + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::push): + (WebCore::SegmentedString::isEmpty): + (WebCore::SegmentedString::lookAhead): + (WebCore::SegmentedString::lookAheadIgnoringCase): + (WebCore::SegmentedString::advance): + (WebCore::SegmentedString::advanceAndASSERT): + (WebCore::SegmentedString::advanceAndASSERTIgnoringCase): + (WebCore::SegmentedString::advancePastNewlineAndUpdateLineNumber): + (SegmentedString): + (WebCore::SegmentedString::advancePastNonNewline): + (WebCore::SegmentedString::advanceAndUpdateLineNumber): + (WebCore::SegmentedString::operator*): + (WebCore::SegmentedString::operator->): + (WebCore::SegmentedString::current): + (WebCore::SegmentedString::equalsLiterally): + (WebCore::SegmentedString::equalsIgnoringCase): + (WebCore::SegmentedString::lookAheadInline): + (WebCore::SegmentedString::lookAheadSlowCase): + * xml/parser/CharacterReferenceParserInlineMethods.h: + (WebCore::consumeCharacterReference): + * xml/parser/MarkupTokenizerBase.h: + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::nextInputCharacter): + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::peek): + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::advance): + +2012-07-25 Konrad Piascik <kpiascik@rim.com> + + Web Inspector: Geolocation override + https://bugs.webkit.org/show_bug.cgi?id=89365 + + Reviewed by Pavel Feldman. + + Re-added the m_page member variable for GeolocationController since + it's now being used by InspectorInstrumentaiton. + + Added a way to override the GeolocationPosition and GeolocationError + using Web Inspector. Curretnly only PositionError can be set. + + This will be hidden behind the experiments flag for now. + + Tests: inspector/geolocation-error.html + inspector/geolocation-success.html + inspector/geolocation-watchPosition.html + + * English.lproj/localizedStrings.js: + * Modules/geolocation/GeolocationController.cpp: + (WebCore::GeolocationController::GeolocationController): + (WebCore::GeolocationController::positionChanged): + * Modules/geolocation/GeolocationController.h: + (GeolocationController): + * inspector/Inspector.json: + * inspector/InspectorInstrumentation.cpp: + (WebCore): + (WebCore::InspectorInstrumentation::overrideGeolocationPositionImpl): + * inspector/InspectorInstrumentation.h: + (WebCore): + (InspectorInstrumentation): + (WebCore::InspectorInstrumentation::overrideGeolocationPosition): + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::InspectorPageAgent): + (WebCore::InspectorPageAgent::setGeolocationOverride): + (WebCore): + (WebCore::InspectorPageAgent::clearGeolocationOverride): + (WebCore::InspectorPageAgent::canOverrideGeolocation): + (WebCore::InspectorPageAgent::overrideGeolocationPosition): + * inspector/InspectorPageAgent.h: + * inspector/front-end/Settings.js: + * inspector/front-end/SettingsScreen.js: + (WebInspector.UserAgentSettingsTab): + (WebInspector.UserAgentSettingsTab.prototype._createDeviceMetricsElement): + (WebInspector.UserAgentSettingsTab.prototype._onGeolocationOverrideCheckboxClicked): + (WebInspector.UserAgentSettingsTab.prototype._applyGeolocationUserInput): + (WebInspector.UserAgentSettingsTab.prototype._setGeolocationPosition.set if): + (WebInspector.UserAgentSettingsTab.prototype._setGeolocationPosition): + (WebInspector.UserAgentSettingsTab.prototype._createGeolocationOverrideElement.createInput): + (WebInspector.UserAgentSettingsTab.prototype._createGeolocationOverrideElement): + * inspector/front-end/UserAgentSupport.js: + (WebInspector.UserAgentSupport.GeolocationPosition): + (WebInspector.UserAgentSupport.GeolocationPosition.prototype.toSetting): + (WebInspector.UserAgentSupport.GeolocationPosition.parseSetting): + (WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput): + (WebInspector.UserAgentSupport.GeolocationPosition.clearGeolocationOverride): + * inspector/front-end/inspector.js: + (WebInspector.doLoadedDone): + +2012-07-25 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Build fix for clang builds after r123628 + https://bugs.webkit.org/show_bug.cgi?id=92266 + + Reviewed by Adrienne Walker. + + An un-used variable was causing build failures for clang builds + after the refactoring in r123628. It is correct to simply remove + this value. + + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateDrawTransformsInternal): + +2012-07-25 Hans Wennborg <hans@chromium.org> + + Speech JavaScript API: extract function from SpeechRecognitionResult::emma() + https://bugs.webkit.org/show_bug.cgi?id=92232 + + Reviewed by Adam Barth. + + Extract code for creating emma-qualified names to a helper function. + + Just a refactoring; covered by the existing test. + + * Modules/speech/SpeechRecognitionResult.cpp: + (WebCore::emmaQualifiedName): + (WebCore): + (WebCore::SpeechRecognitionResult::emma): + +2012-07-25 Adrienne Walker <enne@google.com> + + [chromium] Unify compositor quadTransform/drawTransform/originTransform + https://bugs.webkit.org/show_bug.cgi?id=91417 + + Reviewed by Kenneth Russell. + + drawTransform used to operate on centered layer rects. To unify quad + transforms, draw transforms, and origin transforms, make draw + transforms operate on content rects with the origin in the top left. + + This essentially eliminates the need for surface origin transforms, + which will be eliminated in a future patch. + + Also, remove the unused CCLayerImpl::getDrawRect function. + + No-op refactoring. Tested by existing tests. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawRenderPassQuad): + * platform/graphics/chromium/RenderSurfaceChromium.cpp: + (WebCore::RenderSurfaceChromium::drawableContentRect): + * platform/graphics/chromium/cc/CCDamageTracker.cpp: + (WebCore::CCDamageTracker::extendDamageForLayer): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::createSharedQuadState): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerSorter.cpp: + (WebCore::CCLayerSorter::LayerShape::LayerShape): + (WebCore::CCLayerSorter::createGraphNodes): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateVisibleContentRect): + (WebCore::calculateDrawTransformsInternal): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::::markOccludedBehindLayer): + (WebCore::::occluded): + (WebCore::::unoccludedContentRect): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsToFillScreen): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::drawableContentRect): + +2012-07-25 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Update MediaStreamTrack to match the specification + https://bugs.webkit.org/show_bug.cgi?id=90180 + + Reviewed by Adam Barth. + + MediaStreamTracks are now required to show the status of the underlying source, + and trigger events when that status changes. + + Test: fast/mediastream/MediaStreamTrack.html + + * GNUmakefile.list.am: + * Modules/mediastream/MediaStream.cpp: + (WebCore::MediaStream::MediaStream): + (WebCore::MediaStream::addTrack): + * Modules/mediastream/MediaStreamTrack.cpp: + (WebCore::MediaStreamTrack::create): + (WebCore::MediaStreamTrack::MediaStreamTrack): + (WebCore::MediaStreamTrack::~MediaStreamTrack): + (WebCore::MediaStreamTrack::setEnabled): + (WebCore::MediaStreamTrack::readyState): + (WebCore): + (WebCore::MediaStreamTrack::sourceChangedState): + (WebCore::MediaStreamTrack::stop): + (WebCore::MediaStreamTrack::interfaceName): + (WebCore::MediaStreamTrack::scriptExecutionContext): + (WebCore::MediaStreamTrack::eventTargetData): + (WebCore::MediaStreamTrack::ensureEventTargetData): + * Modules/mediastream/MediaStreamTrack.h: + * Modules/mediastream/MediaStreamTrack.idl: + * WebCore.gypi: + * dom/EventNames.h: + (WebCore): + * dom/EventTargetFactory.in: + * platform/chromium/support/WebMediaStreamDescriptor.cpp: + * platform/chromium/support/WebMediaStreamSource.cpp: + (WebKit::WebMediaStreamSource::setReadyState): + (WebKit): + (WebKit::WebMediaStreamSource::readyState): + * platform/mediastream/MediaStreamSource.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamSource.h. + (WebCore): + (WebCore::MediaStreamSource::create): + (WebCore::MediaStreamSource::MediaStreamSource): + (WebCore::MediaStreamSource::setReadyState): + (WebCore::MediaStreamSource::addObserver): + (WebCore::MediaStreamSource::removeObserver): + * platform/mediastream/MediaStreamSource.h: + (Observer): + (WebCore::MediaStreamSource::Observer::~Observer): + (MediaStreamSource): + (WebCore::MediaStreamSource::readyState): + * platform/mediastream/chromium/MediaStreamCenterChromium.cpp: + (WebCore::MediaStreamCenterChromium::queryMediaStreamSources): + (WebCore::MediaStreamCenterChromium::didCreateMediaStream): + +2012-07-25 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Incorrect rounding in ceiledLayoutUnit and roundedLayoutUnit. + https://bugs.webkit.org/show_bug.cgi?id=91061 + + Reviewed by Adam Barth. + + The two functions are currently both returning the flooredLayoutUnit when subpixel + layout is enabled. This patch changes them to return the correct fractional rounded + value. + + * platform/FractionalLayoutUnit.h: + (WebCore::FractionalLayoutUnit::fromFloatCeil): + (FractionalLayoutUnit): + (WebCore::FractionalLayoutUnit::fromFloatRound): + * rendering/LayoutTypes.h: + (WebCore::roundedLayoutUnit): + (WebCore::ceiledLayoutUnit): + * rendering/RenderBlock.cpp: + (WebCore::updatePreferredWidth): + +2012-07-25 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Add *explicit* keyword to constructors in WebCore/platform + https://bugs.webkit.org/show_bug.cgi?id=92238 + + Reviewed by Kentaro Hara. + + As a step to let *explicit* keyword add to constructors which have a parameter, + *explicit* keyword is added to Source/WebCore/platform in order to avoid implicit + type conversion. + + Some files in platform directory can't use explicit keyword because of build breaks. + + No new tests. Covered by existing tests. + + * platform/AutodrainedPool.h: + (AutodrainedPool): + * platform/ContentType.h: + (ContentType): + * platform/ContextMenu.h: + (ContextMenu): + * platform/ContextMenuItem.h: + (ContextMenuItem): + * platform/Cursor.h: + (WebCore::SharedCursor::SharedCursor): + (Cursor): + * platform/KURL.h: + (WebCore::KURL::KURL): + (KURL): + * platform/KURLGooglePrivate.h: + (KURLGooglePrivate): + * platform/PODRedBlackTree.h: + (WebCore::PODRedBlackTree::PODRedBlackTree): + * platform/Pasteboard.h: + (Pasteboard): + * platform/PlatformEvent.h: + (WebCore::PlatformEvent::PlatformEvent): + * platform/PlatformKeyboardEvent.h: + (PlatformKeyboardEvent): + * platform/PlatformMouseEvent.h: + (PlatformMouseEvent): + * platform/PlatformPasteboard.h: + (PlatformPasteboard): + * platform/PlatformTouchEvent.h: + (PlatformTouchEvent): + * platform/PlatformWheelEvent.h: + (PlatformWheelEvent): + * platform/RunLoop.h: + (TimerBase): + * platform/ScrollAnimator.h: + (ScrollAnimator): + * platform/ScrollAnimatorNone.h: + (ScrollAnimatorNone): + * platform/SharedBuffer.h: + (SharedBuffer): + * platform/WheelFlingPlatformGestureCurve.h: + (WheelFlingPlatformGestureCurve): + * platform/Widget.h: + (Widget): + +2012-07-25 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + NodesFromRect and area-based hit-testing can not handle CSS transforms. + https://bugs.webkit.org/show_bug.cgi?id=85792 + + Reviewed by Eric Seidel. + + To support the combination of CSS transforms and rect based hit testing, + we need to test against the transformed rect, instead of the original rect. + + This patch makes HitTestPoint store the exact transformed FloatPoint and + FloatQuad, and modifies the intersection methods so that they will use a + new FloatQuad based intersection when transforms requires it. + + Tests: fast/dom/nodesFromRect/nodesFromRect-rotate.html + fast/dom/nodesFromRect/nodesFromRect-scale.html + + * platform/graphics/FloatQuad.cpp: + (WebCore::determinant): + (WebCore::rightMostCornerToVector): + (WebCore::FloatQuad::intersectsRect): + (WebCore::FloatQuad::isCounterclockwise): + * platform/graphics/FloatQuad.h: + (FloatQuad): + * rendering/HitTestResult.cpp: + (WebCore::HitTestPoint::HitTestPoint): + (WebCore::HitTestPoint::operator=): + (WebCore::HitTestPoint::move): + (WebCore::HitTestPoint::intersectsRect): + (WebCore::HitTestPoint::intersects): + * rendering/HitTestResult.h: + (HitTestPoint): + (WebCore::HitTestPoint::isRectilinear): + (WebCore::HitTestPoint::transformedPoint): + (WebCore::HitTestPoint::transformedRect): + * rendering/HitTestingTransformState.cpp: + (WebCore::HitTestingTransformState::flattenWithTransform): + (WebCore::HitTestingTransformState::mappedArea): + (WebCore::HitTestingTransformState::boundsOfMappedArea): + * rendering/HitTestingTransformState.h: + (WebCore::HitTestingTransformState::create): + (WebCore::HitTestingTransformState::HitTestingTransformState): + * rendering/RenderFlowThread.cpp: + (WebCore::RenderFlowThread::hitTestRegion): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hitTest): + (WebCore::RenderLayer::createLocalTransformState): + (WebCore::RenderLayer::hitTestLayer): + (WebCore::RenderLayer::hitTestChildLayerColumns): + * rendering/RenderLayer.h: + * rendering/svg/RenderSVGText.cpp: + (WebCore::RenderSVGText::nodeAtFloatPoint): + +2012-07-25 Kwang Yul Seo <skyul@company100.net> + + Add HTMLStackItem.h to project files + https://bugs.webkit.org/show_bug.cgi?id=92221 + + Reviewed by Adam Barth. + + Added HTMLStackItem.h introduced in r123399 to project files. + + Project file changes only, no change in behavior thus no new tests. + + * GNUmakefile.list.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + +2012-07-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123606. + http://trac.webkit.org/changeset/123606 + https://bugs.webkit.org/show_bug.cgi?id=92247 + + broke Windows build of Chromium (Requested by tomhudson on + #webkit). + + * Resources/colorSuggestionPicker.css: Removed. + * Resources/colorSuggestionPicker.js: Removed. + * WebCore.gyp/WebCore.gyp: + +2012-07-25 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: disabling property should remove "overriden" decoration from overriden UA shorthand. + https://bugs.webkit.org/show_bug.cgi?id=92253 + + Reviewed by Vsevolod Vlasov. + + Bug fix with a test and more compilation markup. + + Test: inspector/styles/styles-disable-then-enable-overriden-ua.html + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection.prototype.update): + (WebInspector.StylePropertyTreeElement): + (WebInspector.StylePropertyTreeElement.prototype): + +2012-07-25 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Improve ObjectPropertiesSection UI by adding a tooltip for the value. + https://bugs.webkit.org/show_bug.cgi?id=92225 + + Reviewed by Pavel Feldman. + + Added tooltip with property value description on the property's valueElement. + + * inspector/front-end/ObjectPropertiesSection.js: + (WebInspector.ObjectPropertyTreeElement.prototype.update): + +2012-07-25 Pavel Feldman <pfeldman@chromium.org> + + https://bugs.webkit.org/show_bug.cgi?id=91931 + + Reviewed by Vsevolod Vlasov. + + - Synthetic shorthand values are now only returned for source-less styles + - CSSAgents reports longhands along with the property names in getSupportedCSSProperties + - StylesSidebarPane now has two paths: for source-enabled styles and for CSSOM-based ones (UA styles) + - CSSStyleModel uses style metainfo as a source of shorthand / longhand relationship now + + Test: inspector/styles/styles-overriden-properties.html + + * inspector/Inspector.json: + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::getSupportedCSSProperties): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyle::styleWithProperties): + * inspector/front-end/CSSCompletions.js: + (WebInspector.CSSCompletions): + (WebInspector.CSSCompletions.requestCSSNameCompletions): + (WebInspector.CSSCompletions.prototype._closest): + (WebInspector.CSSCompletions.prototype.longhands): + (WebInspector.CSSCompletions.prototype.shorthands): + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleDeclaration): + (WebInspector.CSSStyleDeclaration.prototype.longhandProperties): + (WebInspector.CSSStyleDeclaration.prototype.shorthandValue): + (WebInspector.CSSStyleDeclaration.prototype.newBlankProperty): + (WebInspector.CSSProperty): + (WebInspector.CSSProperty.parsePayload): + * inspector/front-end/SourceCSSTokenizer.js: + (WebInspector.SourceCSSTokenizer): + * inspector/front-end/SourceCSSTokenizer.re2js: + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded): + (WebInspector.StylePropertiesSection.prototype.update): + (WebInspector.StylePropertiesSection.prototype.onpopulate): + (WebInspector.StylePropertyTreeElement.prototype): + +2012-07-25 Keishi Hattori <keishi@webkit.org> + + Implement ColorSuggestionPicker page popup + https://bugs.webkit.org/show_bug.cgi?id=92109 + + Reviewed by Kent Tamura. + + Implements ColorSuggestionPicker page popup. This will be used in + certain ports as the datalist UI for <input type=color>. + + No new tests because there is no way to open the popup yet. + + * Resources/colorSuggestionPicker.css: Added. + (body): + (#main): + (.color-swatch): + (.color-swatch:hover): + (.color-swatch-container): + (.other-color): + * Resources/colorSuggestionPicker.js: Added. + (getScrollbarWidth):When there are more than 20 colors we need to + increase the window width to accommodate the scroll bar. + (createElement): + (handleMessage): + (initialize): + (handleArgumentsTimeout): + (validateArguments): + (submitValue): Calls setValueAndClosePopup with a numValue of 0. + (handleCancel): Calls setValueAndClosePopup with a numValue of -1. + (chooseOtherColor): Calls setValueAndClosePopup with a numValue of -2. + (ColorPicker): + (ColorPicker.prototype._layout): Lays out the color swatches in a 5x4 + grid. + (ColorPicker.prototype._handleSwatchClick): + * WebCore.gyp/WebCore.gyp: + +2012-07-25 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Fix arithmetic composite filter for auto-vectorization + https://bugs.webkit.org/show_bug.cgi?id=92123 + + Reviewed by Nikolas Zimmermann. + + Since only clamping of the result prevents GCC from auto-vectorizing the inner loop, this patch + adds a faster version of the inner loop to handle cases where clamping is unnecessary, + + * platform/graphics/filters/FEComposite.cpp: + (WebCore::computeArithmeticPixelsUnclamped): + (WebCore::arithmeticSoftware): + +2012-07-25 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Fix blend filter for autovectorizing + https://bugs.webkit.org/show_bug.cgi?id=91398 + + Reviewed by Nikolas Zimmermann. + + Get rid of wrapper classes, and use functions directly as template argument. + + * platform/graphics/filters/FEBlend.cpp: + (WebCore::feBlendNormal): + (WebCore::feBlendMultiply): + (WebCore::feBlendScreen): + (WebCore::feBlendDarken): + (WebCore::feBlendLighten): + (WebCore::feBlendUnknown): + (WebCore::platformApply): + (WebCore::FEBlend::platformApplyGeneric): + +2012-07-25 Keishi Hattori <keishi@webkit.org> + + Add methods to ColorChooserClient so the color chooser can show suggestions + https://bugs.webkit.org/show_bug.cgi?id=92114 + + Reviewed by Kent Tamura. + + Added methods to ColorChooserClient so the color chooser can ask the + client for suggestions and current color. + + No new tests. The methods are not used yet. + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::currentColor): Returns what color the color + chooser should display. + (WebCore): + (WebCore::ColorInputType::shouldShowSuggestions): Returns if the UI for + suggestions should be shown. + (WebCore::ColorInputType::suggestions): Returns a list of colors to be + suggested to the user. + * html/ColorInputType.h: + (ColorInputType): + * html/HTMLInputElement.h: + (HTMLInputElement): Made dataList() public. + * platform/ColorChooserClient.h: + (ColorChooserClient): + +2012-07-25 Kentaro Hara <haraken@chromium.org> + + Replace int with long in test IDL files + https://bugs.webkit.org/show_bug.cgi?id=92181 + + Reviewed by Adam Barth. + + int is not a valid type in WebIDL. It should be long. + We should replace int with long in bindings/scripts/test/*.idl. + This is a follow-up patch for r123550. + + Test: bindings/scripts/test/TestObj.idl + + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::readOnlyLongAttr): + (WebDOMTestObj::Attr): + (WebDOMTestObj::setAttr): + (WebDOMTestObj::voidMethodWithArgs): + (WebDOMTestObj::Method): + (WebDOMTestObj::MethodWithArgs): + (WebDOMTestObj::objMethodWithArgs): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + (webkit_dom_test_obj_void_method_with_args): + (webkit_dom_test_obj_method): + (webkit_dom_test_obj_method_with_args): + (webkit_dom_test_obj_obj_method_with_args): + (webkit_dom_test_obj_get_read_only_long_attr): + (webkit_dom_test_obj_get_attr): + (webkit_dom_test_obj_set_attr): + (webkit_dom_test_obj_get_strawberry): + (webkit_dom_test_obj_set_strawberry): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + (WebCore::jsTestObjReadOnlyLongAttr): + (WebCore::jsTestObjConstructorStaticReadOnlyLongAttr): + (WebCore::jsTestObjAttr): + (WebCore::setJSTestObjAttr): + (WebCore::setJSTestObjStrawberry): + (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethod): + (WebCore::jsTestObjPrototypeFunctionMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): + * bindings/scripts/test/JS/JSTestObj.h: + (WebCore): + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj readOnlyLongAttr]): + (-[DOMTestObj Attr]): + (-[DOMTestObj setAttr:]): + (-[DOMTestObj voidMethodWithArgs:strArg:objArg:]): + (-[DOMTestObj Method]): + (-[DOMTestObj MethodWithArgs:strArg:objArg:]): + (-[DOMTestObj objMethodWithArgs:strArg:objArg:]): + (-[DOMTestObj customMethodWithArgs:strArg:objArg:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::readOnlyLongAttrAttrGetter): + (WebCore::TestObjV8Internal::staticReadOnlyLongAttrAttrGetter): + (WebCore::TestObjV8Internal::AttrAttrGetter): + (WebCore::TestObjV8Internal::AttrAttrSetter): + (WebCore::TestObjV8Internal::strawberryAttrSetter): + (WebCore::TestObjV8Internal::voidMethodWithArgsCallback): + (WebCore::TestObjV8Internal::MethodCallback): + (WebCore::TestObjV8Internal::MethodWithArgsCallback): + (WebCore::TestObjV8Internal::objMethodWithArgsCallback): + (WebCore::TestObjV8Internal::methodReturningSequenceCallback): + (WebCore::TestObjV8Internal::overloadedMethod2Callback): + (WebCore::TestObjV8Internal::overloadedMethod4Callback): + (WebCore): + (WebCore::ConfigureV8TestObjTemplate): + +2012-07-25 Shinya Kawanaka <shinyak@chromium.org> + + A validation bubble should not be modifiable. + https://bugs.webkit.org/show_bug.cgi?id=92217 + + Reviewed by Kent Tamura. + + A user can set -webkit-user-modify: read-write to validation message elements. + This might cause a undesired crash like Bug 65738. They should be unmodifiable. + + Test: fast/forms/validation-user-modify.html + + * css/html.css: + Added -webkit-user-modify: read-only !important; for these elements so that they won't be + changed by a user. + (::-webkit-validation-bubble): + (::-webkit-validation-bubble-message): + (::-webkit-validation-bubble-text-block): + (::-webkit-validation-bubble-heading): + (::-webkit-validation-bubble-arrow): + (::-webkit-validation-bubble-arrow-clipper): + +2012-07-25 Zeno Albisser <zeno@webkit.org> + + [Qt][WK2] Disable CopyToTexture for GraphicsSurfaceMac. + https://bugs.webkit.org/show_bug.cgi?id=92159 + + Disable CopyToTexture feature for GraphicsSurface on Mac. + While this is actually working, it is currently used for Tiles + that are single buffered, and therefore requires a call to glFlush. + This call blocks the GPU for about 40ms which would make smooth animations impossible. + + Reviewed by Noam Rosenthal. + + * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp: + (WebCore::GraphicsSurface::platformCreate): + (WebCore::GraphicsSurface::platformImport): + +2012-07-25 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] Fix up includes in HarfBuzzNGFace.h + https://bugs.webkit.org/show_bug.cgi?id=92127 + + Reviewed by Hajime Morita. + + Move constructors of FontPlatformData from headers to corresponding cpp files + so that we can use forward declaration for HarfBuzzNGFace instead of including HarfBuzzNGFace.h. + This way we can include hb.h in HarfBuzzNGFace.h. + + No new tests. No changes in behavior. + + * platform/graphics/FontPlatformData.cpp: + (WebCore::FontPlatformData::FontPlatformData): Moved from header file. + (WebCore): + * platform/graphics/FontPlatformData.h: + (WebCore): + (FontPlatformData): Moved to cpp file. + * platform/graphics/cocoa/FontPlatformDataCocoa.mm: Include HarfBuzzNGFace.h + * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: + (WebCore::FontPlatformData::FontPlatformData): Moved from header file. + (WebCore): + * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h: + (WebCore): + (FontPlatformData): Moved to cpp file. + * platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h: Include hb.h. + +2012-07-24 Benjamin Poulain <bpoulain@apple.com> && Joseph Pecoraro <pecoraro@apple.com> + + QualifiedName's HashSet should be big enough to hold at least all the static names + https://bugs.webkit.org/show_bug.cgi?id=91891 + + Reviewed by Darin Adler. + + QualifiedName's table has a standard size of 64 buckets. When initializing WebKit, + we create 850 static QualifiedName for the standard names (HTMLNames, SVGNames etc). + + The small base size forces us to grow and rehash the table several time on startup. + + This patch solves the issue by defining the initial table size to the minimum size that + can hold all the static QualifiedName. + + * dom/QualifiedName.cpp: + (QualifiedNameHashTraits): + * dom/make_names.pl: + (printNamesHeaderFile): + +2012-07-24 Kwang Yul Seo <skyul@company100.net> + + Remove anonymous namespace and make functions static. + https://bugs.webkit.org/show_bug.cgi?id=92214 + + Reviewed by Adam Barth. + + Mark functions as static instead of enclosing them in anonymous namespaces. + One exception to this rule is when a function is passed as a template argument. + In this case, the function must have an external linkage. + + No functional change. Covered by existing tests. + + * html/parser/HTMLConstructionSite.cpp: + (WebCore::hasImpliedEndTag): + (WebCore::causesFosterParenting): + (WebCore::isAllWhitespace): + * html/parser/HTMLDocumentParser.cpp: + (WebCore): + (WebCore::tokenizerStateForContextElement): + * html/parser/HTMLElementStack.cpp: + (WebCore::isNumberedHeaderElement): + (WebCore::isRootNode): + (WebCore): + * html/parser/HTMLEntityParser.cpp: + (WebCore::isAlphaNumeric): + * html/parser/HTMLEntitySearch.cpp: + (WebCore::halfway): + * html/parser/HTMLPreloadScanner.cpp: + (WebCore): + * html/parser/HTMLTokenizer.cpp: + (WebCore::toLowerCase): + (WebCore::vectorEqualsString): + (WebCore::isEndTagBufferingState): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore): + (WebCore::uninitializedPositionValue1): + (WebCore::isAllWhitespace): + (WebCore::isAllWhitespaceOrReplacementCharacters): + (WebCore::isNumberedHeaderTag): + (WebCore::isCaptionColOrColgroupTag): + (WebCore::isTableCellContextTag): + (WebCore::isTableBodyContextTag): + (WebCore::isSpecialNode): + (WebCore::isNonAnchorNonNobrFormattingTag): + (WebCore::isNonAnchorFormattingTag): + (WebCore::isFormattingTag): + (WebCore::closestFormAncestor): + (WebCore::mapLoweredLocalNameToName): + (WebCore::adjustSVGTagNameCase): + (WebCore::adjustAttributes): + (WebCore::adjustSVGAttributes): + (WebCore::adjustMathMLAttributes): + (WebCore::addNamesWithPrefix): + (WebCore::adjustForeignAttributes): + +2012-07-24 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r123494 follow-up: fixed inspector undock icon. + + * inspector/front-end/Images/statusbarButtonGlyphs.png: + +2012-07-24 Kwang Yul Seo <skyul@company100.net> + + Read tag names and attributes from the saved tokens where possible. + https://bugs.webkit.org/show_bug.cgi?id=92079 + + Reviewed by Adam Barth. + + Read tag names and attributes from the saved tokens, not from the DOM. + Also added convenient methods such as hasLocalName, hasTagName, localName, + isElementNode and isDocumentFragmentNode to HTMLStackItem class. + + No new tests, covered by existing tests. + + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLNames::hasImpliedEndTag): + (WebCore::HTMLNames::causesFosterParenting): + (WebCore::HTMLConstructionSite::generateImpliedEndTagsWithExclusion): + (WebCore::HTMLConstructionSite::generateImpliedEndTags): + (WebCore::HTMLConstructionSite::shouldFosterParent): + * html/parser/HTMLConstructionSite.h: + (WebCore::HTMLConstructionSite::currentStackItem): + * html/parser/HTMLElementStack.cpp: + (WebCore::HTMLNames::isNumberedHeaderElement): + (WebCore::HTMLNames::isRootNode): + (WebCore::HTMLNames::isScopeMarker): + (WebCore::HTMLNames::isListItemScopeMarker): + (WebCore::HTMLNames::isTableScopeMarker): + (WebCore::HTMLNames::isTableBodyScopeMarker): + (WebCore::HTMLNames::isTableRowScopeMarker): + (WebCore::HTMLNames::isForeignContentScopeMarker): + (WebCore::HTMLNames::isButtonScopeMarker): + (WebCore::HTMLNames::isSelectScopeMarker): + (WebCore::HTMLElementStack::ElementRecord::replaceElement): + (WebCore::HTMLElementStack::popUntilNumberedHeaderElementPopped): + (WebCore::HTMLElementStack::popUntilTableScopeMarker): + (WebCore::HTMLElementStack::popUntilTableBodyScopeMarker): + (WebCore::HTMLElementStack::popUntilTableRowScopeMarker): + (WebCore::HTMLElementStack::isMathMLTextIntegrationPoint): + (WebCore::HTMLElementStack::isHTMLIntegrationPoint): + (WebCore::HTMLElementStack::popUntilForeignContentScopeMarker): + (WebCore::HTMLElementStack::pushRootNode): + (WebCore::HTMLElementStack::oneBelowTop): + (WebCore::HTMLElementStack::topmost): + (WebCore): + (WebCore::inScopeCommon): + (WebCore::HTMLElementStack::hasNumberedHeaderElementInScope): + (WebCore::HTMLElementStack::inScope): + * html/parser/HTMLElementStack.h: + (WebCore::HTMLElementStack::topStackItem): + (HTMLElementStack): + (WebCore::isInHTMLNamespace): + * html/parser/HTMLStackItem.h: + (WebCore::HTMLStackItem::isDocumentFragmentNode): + (WebCore::HTMLStackItem::isElementNode): + (HTMLStackItem): + (WebCore::HTMLStackItem::hasLocalName): + (WebCore::HTMLStackItem::hasTagName): + (WebCore::HTMLStackItem::HTMLStackItem): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore): + (WebCore::HTMLTreeBuilder::constructTreeFromAtomicToken): + (WebCore::HTMLTreeBuilder::processFakeEndTag): + (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): + (WebCore::HTMLTreeBuilder::processStartTagForInBody): + (WebCore::HTMLTreeBuilder::processStartTag): + (WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody): + (WebCore::HTMLTreeBuilder::furthestBlockForFormattingElement): + (WebCore::HTMLTreeBuilder::callTheAdoptionAgency): + (WebCore::HTMLTreeBuilder::processEndTagForInTableBody): + (WebCore::HTMLTreeBuilder::processEndTagForInCell): + (WebCore::HTMLTreeBuilder::processEndTagForInBody): + (WebCore::HTMLTreeBuilder::processCaptionEndTagForInCaption): + (WebCore::HTMLTreeBuilder::processTrEndTagForInRow): + (WebCore::HTMLTreeBuilder::processEndTag): + (WebCore::HTMLTreeBuilder::processCharacterBuffer): + (WebCore::HTMLTreeBuilder::processEndOfFile): + (WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent): + (WebCore::HTMLTreeBuilder::processTokenInForeignContent): + * html/parser/HTMLTreeBuilder.h: + +2012-07-24 Hironori Bono <hbono@chromium.org> + + Avoid moving child objects multiple times when vertical scrollbar are shown at the left side. + https://bugs.webkit.org/show_bug.cgi?id=91756 + + Reviewed by Tony Chang. + + My r123067 moves the top-left origin of an RTL element right when its vertical + scrollbar is shown at its left side. (That is, r123067 moves all child objects + in the RTL element right.) This change also increases RenderBox::clientLeft() + at the same time, i.e. it also moves child objects right. Furthermore, my r109512 + moves positioned objects in an RTL element right at the same time. This makes + WebKit move objects in an RTL element up to three times by the scrollbar width. + (Moving an absolute object right increases the scrollWidth value and it causes + this bug.) This change removes unnecessary code that moves objects right in my + r109512 and RenderBox::clientLeft(). + + Test: scrollbars/rtl/div-absolute.html + fast/block/float/026.html + fast/block/float/028.html + fast/overflow/unreachable-overflow-rtl-bug.html + + * dom/Element.cpp: + (WebCore::Element::clientLeft): Increase clientLeft value by the width of a vertical scrollbar as written in the CSSOM specification. + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::addOverflowFromPositionedObjects): Removed unnecessary code. + (WebCore::RenderBlock::determineLogicalLeftPositionForChild): Removed unnecessary code. + * rendering/RenderBox.h: + (WebCore::RenderBox::clientLeft): Removed unnecessary code. + +2012-07-24 Dan Bernstein <mitz@apple.com> + + RenderBlock::positionForPoint can fail when the block or its children have a vertical writing mode + https://bugs.webkit.org/show_bug.cgi?id=92202 + + Reviewed by Beth Dakin. + + Test: fast/writing-mode/positionForPoint.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::positionForPoint): Fixed two issues, each of which are covered by + one of the sub-tests in the new regression test: (1) changed to compare children’s logical + bounds against pointInLogicalContents, i.e. compare childern’s horizontal bounds to the + point’s horizontal component; and (2) changed to use logicalTopForChild and + logicalHeightForChild, which account for this block’s writing mode, instead of logicalTop + and logicalBottom, which are based on the child’s writing mode. + +2012-07-24 MORITA Hajime <morrita@google.com> + + https://bugs.webkit.org/show_bug.cgi?id=89179 + Rendering LI having Shadow DOM seems weird + + Reviewed by Dimitri Glazkov. + + This incorrect rendering happend because HTMLLIElement::attach() + wasn't aware of composed shadow subtree. This change makes it + aware of that using ComposedShadowTreeParentWalker. + + Test: fast/dom/shadow/shadow-and-list-elements.html + + * html/HTMLLIElement.cpp: + (WebCore::HTMLLIElement::attach): + +2012-07-24 Alec Flett <alecflett@chromium.org> + + IndexedDB: fix #include dependencies so IDBRequest isn't an include root + https://bugs.webkit.org/show_bug.cgi?id=92167 + + Reviewed by Tony Chang. + + Remove implicit dependencies due to using IDBRequest.h, and fix all + places that break as a result. + + * Modules/indexeddb/IDBCallbacks.h: + (WebCore): + * Modules/indexeddb/IDBObjectStore.cpp: + * Modules/indexeddb/IDBRequest.h: + * inspector/InspectorIndexedDBAgent.cpp: + +2012-07-24 Keishi Hattori <keishi@webkit.org> + + Move PagePopupClient helper functions so they can be shared + https://bugs.webkit.org/show_bug.cgi?id=92096 + + Reviewed by Kent Tamura. + + Move PagePopupClient helper functions to a separate file, + so they can be shared with new PagePopupClients. + + No new tests. Covered by fast/forms/date/calendar-picker-appearance.html + + * WebCore.gypi: Added PagePopupClient.cpp + * html/shadow/CalendarPickerElement.cpp: + (WebCore::CalendarPickerElement::writeDocument): Modified to use PagePopupClient. + * page/PagePopupClient.cpp: Added. + (WebCore): + (WebCore::PagePopupClient::addJavaScriptString): + (WebCore::PagePopupClient::addProperty): + * page/PagePopupClient.h: + (WebCore::PagePopupClient::addString): + +2012-07-24 Jer Noble <jer.noble@apple.com> + + setting playbackRate on a MediaController doesn't change the playbackRate for slaved media + https://bugs.webkit.org/show_bug.cgi?id=92035 + + Reviewed by Darin Adler. + + Allow updatePlaybackRate() to change the MediaPlayer rate when the media element has a + current media controller. + + Test: media/media-controller-playbackrate.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::updatePlaybackRate): + +2012-07-24 Hayato Ito <hayato@chromium.org> + + Rename FocusScope to FocusNavigationScope. + https://bugs.webkit.org/show_bug.cgi?id=92062 + + Reviewed by Dimitri Glazkov. + + FocusNavagationScope is better name than FocusScope since the + class is only used for controlling focus navigation. + + No new tests - no functional changes. + + * page/FocusController.cpp: + (WebCore::FocusNavigationScope::FocusNavigationScope): + (WebCore::FocusNavigationScope::rootNode): + (WebCore::FocusNavigationScope::owner): + (WebCore::FocusNavigationScope::focusNavigationScopeOf): + (WebCore::FocusNavigationScope::focusNavigationScopeOwnedByShadowHost): + (WebCore::FocusNavigationScope::focusNavigationScopeOwnedByIFrame): + (WebCore::FocusController::findFocusableNodeDecendingDownIntoFrameDocument): + (WebCore::FocusController::advanceFocusInDocumentOrder): + (WebCore::FocusController::findFocusableNodeAcrossFocusScope): + (WebCore::FocusController::findFocusableNodeRecursively): + (WebCore::FocusController::findFocusableNode): + (WebCore::FocusController::nextFocusableNode): + (WebCore::FocusController::previousFocusableNode): + * page/FocusController.h: + (FocusNavigationScope): + (FocusController): + +2012-07-24 Michael Saboff <msaboff@apple.com> + + Convert HTML parser to handle 8-bit resources without converting to UChar* + https://bugs.webkit.org/show_bug.cgi?id=90321 + + Reviewed by Geoffrey Garen. + + No new tests, no new functionality therefore covered by existing tests. + + Changed the parsing of HTML to handle 8-bit strings without converting the + whole string to 16-bits. Primary change was to use the appropriate + character pointer type (LChar* or UChar*) depending on the source string. + This access is abstracted in SegmentedSubstring by getCurrentChar{8,16} and + incrementAndGetCurrentChar{8,16} methods. In SegmentedString, the advance() + and advanceAndUpdateLineNumber() methods have been refactored into a + state machine managed pair of function pointers. The possible functions + have not only the 8 and 16 bitness factored out, they also have the + "exclude line numbers" logic factored out for advanceAndUpdateLineNumber(). + This provides a net speed-up even with the 8/16 bit testing. + Other changes involve using String methods to access and compare with the + source data. + + * html/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocumentParser::append): Changed to use currentChar() + instead of SegmentedString '*' operator. + * html/parser/HTMLEntityParser.cpp: Changed to use currentChar() instead of + SegmentedString '*' operator. + * html/parser/HTMLParserIdioms.cpp: + (WebCore::stripLeadingAndTrailingHTMLSpaces): Added 8-bit fast path. + * html/parser/HTMLSourceTracker.cpp: + (WebCore::HTMLSourceTracker::sourceForToken): Changed to use currentChar() instead of + SegmentedString '*' operator. + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::script): Updated to use new String::dataSize() method. + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::operator=): + (WebCore::SegmentedString::clear): + (WebCore::SegmentedString::append): + (WebCore::SegmentedString::prepend): + (WebCore::SegmentedString::advanceSubstring): + (WebCore::SegmentedString::advance): Changed to be a wrapper that invokes current + advance function. + (WebCore::SegmentedString::advance8): Fast path advance function for 8 bit data. + (WebCore::SegmentedString::advance16): Fast path advance function for 16 bit data. + (WebCore::SegmentedString::advanceAndUpdateLineNumber8IncludeLineNumbers): Fast + path advanceAndUpdateLineNumber for 8 bit data when we need to update the line number. + (WebCore::SegmentedString::advanceAndUpdateLineNumber16IncludeLineNumbers): Fast + path advanceAndUpdateLineNumber for 16 bit data when we need to update the line number. + (WebCore::SegmentedString::advanceSlowCase): Slow case advance function for both + 8 and 16 bit advance. + (WebCore::SegmentedString::advanceAndUpdateLineNumberSlowCase): Slow case + advanceAndUpdateLineNumber function for both 8 and 16 bit data. + (WebCore::SegmentedString::advanceEmpty): Advance function when input has been exhausted. + * platform/text/SegmentedString.h: + (WebCore::SegmentedSubstring::SegmentedSubstring): + (WebCore::SegmentedSubstring::clear): + (SegmentedSubstring): + (WebCore::SegmentedSubstring::is8Bit): New getter. + (WebCore::SegmentedSubstring::appendTo): + (WebCore::SegmentedSubstring::getCurrentChar8): New getter for the 8 bit case. + (WebCore::SegmentedSubstring::getCurrentChar16): New getter for the 16 bit case. + (WebCore::SegmentedSubstring::incrementAndGetCurrentChar8): New wrapper functions + that pre-increments the 8 bit pointer and returns the next character. + (WebCore::SegmentedSubstring::incrementAndGetCurrentChar16): New wrapper functions + that pre-increments the 16 bit pointer and returns the next character. + (WebCore::SegmentedSubstring::currentSubString): + (WebCore::SegmentedSubstring::getCurrentChar): + (WebCore::SegmentedSubstring::incrementAndGetCurrentChar): + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::push): + (WebCore::SegmentedString::isEmpty): + (WebCore::SegmentedString::lookAhead): + (WebCore::SegmentedString::lookAheadIgnoringCase): + (WebCore::SegmentedString::advance): + (WebCore::SegmentedString::advanceAndUpdateLineNumber): + (WebCore::SegmentedString::advanceAndASSERT): + (WebCore::SegmentedString::advanceAndASSERTIgnoringCase): + (WebCore::SegmentedString::advancePastNonNewline): + (WebCore::SegmentedString::advancePastNewlineAndUpdateLineNumber): + (WebCore::SegmentedString::currentChar): + (WebCore::SegmentedString::setSlowCase): Set advance function pointers to slow case + functions. + (WebCore::SegmentedString::decrementAndCheckLength): Decrement substring length and + change to slow case functions when only one character left. + (WebCore::SegmentedString::setAdvanceFunctionPointers): Select appropriate advance + functions based on current substring. + (WebCore::SegmentedString::lookAheadInline): Changed to use String::startsWith(). + (WebCore::SegmentedString::lookAheadSlowCase): + * xml/parser/CharacterReferenceParserInlineMethods.h: + (WebCore::consumeCharacterReference): Changed to use currentChar() instead of + SegmentedString '*' operator. + * xml/parser/MarkupTokenizerBase.h: + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::nextInputCharacter): + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::peek): Changed to use + currentChar() instead of SegmentedString '*' operator. + (WebCore::MarkupTokenizerBase::InputStreamPreprocessor::advance): + +2012-07-24 Kenneth Russell <kbr@google.com> + + [chromium] Hint garbage collector to run if page uses Canvas contexts + https://bugs.webkit.org/show_bug.cgi?id=76225 + + Reviewed by Kentaro Hara. + + Upon creating a canvas context, set a hint in the current isolate + indicating that a full GC should be done upon the next page + navigation. + + This improves Chrome's robustness on some WebGL stress tests which + simulate real-world behavior by repeatedly navigating among + several samples. More general measures are being investigated, but + this change makes V8 behave the same as JSC on these stress tests. + JSC doesn't currently use generational garbage collection, so it + has more opportunities to discover unreferenced canvas contexts. + + Test: fast/canvas/webgl/context-creation-and-destruction.html + + * bindings/v8/V8Binding.cpp: + (WebCore::V8BindingPerIsolateData::V8BindingPerIsolateData): + Initialize per-isolate low memory hint. + * bindings/v8/V8Binding.h: + (V8BindingPerIsolateData): + (WebCore::V8BindingPerIsolateData::setLowMemoryNotificationHint): + Set a per-isolate hint to signal a low memory condition upon the next page navigation. + (WebCore::V8BindingPerIsolateData::clearLowMemoryNotificationHint): + Clear the previously set hint. + (WebCore::V8BindingPerIsolateData::isLowMemoryNotificationHint): + Get the previously set hint. + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::hintForGCIfNecessary): + If necessary, send V8 a hint that it should GC. + (WebCore): + (WebCore::V8Proxy::clearForClose): + (WebCore::V8Proxy::clearForNavigation): + Call hintForGCIfNecessary. + * bindings/v8/V8Proxy.h: + (V8Proxy): + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + (WebCore::V8HTMLCanvasElement::getContextCallback): + Set a hint that we should GC upon the next page navigation. + +2012-07-24 Dave Tu <dtu@chromium.org> + + [chromium] Add time spent painting to GPU benchmarking renderingStats() API. + https://bugs.webkit.org/show_bug.cgi?id=90019 + + Reviewed by Adrienne Walker. + + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapCanvasLayerTextureUpdater::prepareToUpdate): + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: + (BitmapCanvasLayerTextureUpdater): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect): + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate): + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: + (Texture): + (BitmapSkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/CanvasLayerTextureUpdater.cpp: + (WebCore::CanvasLayerTextureUpdater::paintContents): + * platform/graphics/chromium/CanvasLayerTextureUpdater.h: + (CanvasLayerTextureUpdater): + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::update): + * platform/graphics/chromium/ContentLayerChromium.h: + (ContentLayerChromium): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::update): + * platform/graphics/chromium/ImageLayerChromium.h: + (ImageLayerChromium): + * platform/graphics/chromium/LayerChromium.h: + (WebCore): + (WebCore::LayerChromium::update): + * platform/graphics/chromium/LayerTextureUpdater.h: + (WebCore): + (WebCore::LayerTextureUpdater::Texture::prepareRect): + (WebCore::LayerTextureUpdater::prepareToUpdate): + * platform/graphics/chromium/ScrollbarLayerChromium.cpp: + (WebCore::ScrollbarLayerChromium::updatePart): + (WebCore::ScrollbarLayerChromium::update): + * platform/graphics/chromium/ScrollbarLayerChromium.h: + (ScrollbarLayerChromium): + * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::SkPictureCanvasLayerTextureUpdater::prepareToUpdate): + * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h: + (SkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::updateTiles): + (WebCore::TiledLayerChromium::updateContentRect): + * platform/graphics/chromium/TiledLayerChromium.h: + (TiledLayerChromium): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::updateAnimations): + (WebCore::CCLayerTreeHost::renderingStats): + (WebCore::CCLayerTreeHost::paintMasksForRenderSurface): + (WebCore::CCLayerTreeHost::paintLayerContents): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore): + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCRenderingStats.h: + (CCRenderingStats): + (WebCore::CCRenderingStats::CCRenderingStats): + +2012-07-24 Jian Li <jianli@chromium.org> + + [V8] Correct WebIDL type should be used in the testing IDL file + https://bugs.webkit.org/show_bug.cgi?id=92168 + + Reviewed by Kentaro Hara. + + Updated bindings test. + + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_strict_function): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionStrictFunction): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::enabledAtRuntimeMethod1Callback): + (WebCore::TestObjV8Internal::enabledAtRuntimeMethod2Callback): + (WebCore::TestObjV8Internal::enabledPerContextMethod1Callback): + (WebCore::TestObjV8Internal::enabledPerContextMethod2Callback): + (WebCore::TestObjV8Internal::strictFunctionCallback): + +2012-07-24 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r123191. + http://trac.webkit.org/changeset/123191 + https://bugs.webkit.org/show_bug.cgi?id=91804 + + It might cause another performance regression. + http://code.google.com/p/chromium/issues/detail?id=138410 + + * html/FormController.cpp: + (FormKeyGenerator): + (WebCore::createKey): + (WebCore::FormKeyGenerator::formKey): + (WebCore::FormKeyGenerator::willDeleteForm): + +2012-07-24 Vineet Chaudhary <rgf748@motorola.com> + + [JSBinding] Merging jsUnsignedLongArrayToVector() to toNativeArray() using traits. + https://bugs.webkit.org/show_bug.cgi?id=90381 + + Reviewed by Kentaro Hara. + + We can remove jsUnsignedLongArrayToVector() implementaion + merging it to current and toNativeArray() traits. + + Tests: TestObj.idl + There should be no behavoiral changes as just refactoring. + + * Modules/vibration/NavigatorVibration.idl: Use sequence<T> as method param than T[] + * bindings/js/JSDOMBinding.cpp: Moved toJSSequence() to header file. + * bindings/js/JSDOMBinding.h: + (WebCore::toJSSequence): Moved toJSSequence() to header file. + (WebCore::jsArray): Renamed Traits to JSValueTraits + (WebCore::toNativeArray): Using traits. + * bindings/js/JSDictionary.cpp: + (WebCore::JSDictionary::convertValue): + * bindings/js/JSMessagePortCustom.cpp: + (WebCore::fillMessagePortArray): + * bindings/scripts/CodeGeneratorJS.pm: Removed unsigned long[] specific binding code. + (AddIncludesForType): + (GenerateParametersCheckExpression): + (JSValueToNative): + (NativeToJSValue): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateParametersCheckExpression): Added check sequence<T> check for overloaded methods. + * bindings/scripts/test/JS/JSTestObj.cpp: Rebased binding test. + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): + (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence): + * bindings/scripts/test/JS/JSTestObj.h: Rebased binding test. + * bindings/scripts/test/TestObj.idl: Added test for sequence<T> as method parameter. + * bindings/scripts/test/V8/V8TestObj.cpp: Rebased binding test. + (WebCore::TestObjV8Internal::overloadedMethod10Callback): + (TestObjV8Internal): + (WebCore::TestObjV8Internal::overloadedMethodCallback): + +2012-07-24 Kwang Yul Seo <skyul@company100.net> + + Remove an invalid assertion introduced in r123536. Unreviewed. + + * xml/parser/MarkupTokenBase.h: + (WebCore::AtomicMarkupTokenBase::clearExternalCharacters): + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123504. + http://trac.webkit.org/changeset/123504 + https://bugs.webkit.org/show_bug.cgi?id=92169 + + broke a bunch of text-related tests in chromium mac debug + (Requested by zhenyao on #webkit). + + * platform/text/cf/StringCF.cpp: + (WTF::String::createCFString): + * platform/text/cf/StringImplCF.cpp: + (WTF::StringImpl::createCFString): + +2012-07-24 Kwang Yul Seo <skyul@company100.net> + + Ensure Noah's ark without reading the DOM tree. + https://bugs.webkit.org/show_bug.cgi?id=92065 + + Reviewed by Adam Barth. + + Technically we shouldn't read attributes back from the DOM. If JavaScript changes + the attributes values, we could get a slightly wrong output here. + + Read attributes from tokens saved in the active formatting element list. + + No new tests, covered by existing tests. + + * html/parser/HTMLFormattingElementList.cpp: + (WebCore::attributeCount): + (WebCore::HTMLFormattingElementList::append): + (WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly): + (WebCore::HTMLFormattingElementList::ensureNoahsArkCondition): + * html/parser/HTMLFormattingElementList.h: + (HTMLFormattingElementList): + * html/parser/HTMLStackItem.h: + (WebCore::HTMLStackItem::localName): + (HTMLStackItem): + +2012-07-23 Kwang Yul Seo <skyul@company100.net> + + Clear the external characters pointer of an AtomicHTMLToken before the raw token is cleared. + https://bugs.webkit.org/show_bug.cgi?id=92056 + + Reviewed by Adam Barth. + + AtomicHTMLToken keeps a pointer to the HTMLToken's buffer instead of copying the + characters for performance. Clear the external characters pointer before the raw token + is cleared to make sure that we won't have a dangling pointer. + + No new tests - no functional changes. + + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::constructTreeFromToken): + * xml/parser/MarkupTokenBase.h: + (WebCore::AtomicMarkupTokenBase::clearExternalCharacters): + (AtomicMarkupTokenBase): + +2012-07-24 Jian Li <jianli@chromium.org> + + Add per-context setting for html notifications + https://bugs.webkit.org/show_bug.cgi?id=91295 + + Reviewed by Adam Barth. + + Added a new per-context setting to control the enabling of html notifications. + For chromium port, we're going to disable html notifications for web + pages, but still keep it enabled for extensions. + + Also enhance V8 code generator to support V8EnabledPerContext attribute + for methods. + + Updated the binding tests. + + * Modules/notifications/NotificationCenter.cpp: + (WebCore::NotificationCenter::document): Expose document for being used by installPerContextProperties. + (WebCore): + * Modules/notifications/NotificationCenter.h: + (NotificationCenter): + * Modules/notifications/NotificationCenter.idl: Add V8EnabledPerContext attribute. + * bindings/scripts/CodeGeneratorV8.pm: V8EnabledPerContext now supports methods. + (GenerateHeader): + (IsStandardFunction): + (GenerateNonStandardFunction): + (GenerateImplementation): + (GenerateToV8Converters): + (GetContextEnableFunction): + * bindings/scripts/test/TestObj.idl: Add test case for V8EnabledPerContext methods. + * bindings/scripts/test/V8/V8TestObj.cpp: Update test result. + (WebCore::TestObjV8Internal::enabledAtContextMethod1Callback): + (TestObjV8Internal): + (WebCore::TestObjV8Internal::enabledAtContextMethod2Callback): + (WebCore::V8TestObj::installPerContextProperties): + (WebCore::V8TestObj::wrapSlow): + * dom/ContextFeatures.cpp: Add a new per-context feature. + (WebCore::ContextFeatures::htmlNotificationsEnabled): + (WebCore): + * dom/ContextFeatures.h: Add a new per-context feature. + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123499. + http://trac.webkit.org/changeset/123499 + https://bugs.webkit.org/show_bug.cgi?id=92161 + + Android fails to compile (Requested by zhenyao on #webkit). + + * GNUmakefile.list.am: + * Modules/mediastream/MediaStream.cpp: + (WebCore::MediaStream::MediaStream): + (WebCore::MediaStream::addTrack): + * Modules/mediastream/MediaStreamTrack.cpp: + (WebCore::MediaStreamTrack::create): + (WebCore::MediaStreamTrack::MediaStreamTrack): + (WebCore::MediaStreamTrack::~MediaStreamTrack): + (WebCore::MediaStreamTrack::setEnabled): + * Modules/mediastream/MediaStreamTrack.h: + (MediaStreamTrack): + * Modules/mediastream/MediaStreamTrack.idl: + * WebCore.gypi: + * dom/EventNames.h: + (WebCore): + * dom/EventTargetFactory.in: + * platform/chromium/support/WebMediaStreamDescriptor.cpp: + (WebKit): + (WebKit::WebMediaStreamDescriptor::sources): + * platform/chromium/support/WebMediaStreamSource.cpp: + * platform/mediastream/MediaStreamSource.cpp: Removed. + * platform/mediastream/MediaStreamSource.h: + (WebCore::MediaStreamSource::create): + (WebCore::MediaStreamSource::muted): + (WebCore::MediaStreamSource::setMuted): + (WebCore::MediaStreamSource::MediaStreamSource): + (MediaStreamSource): + * platform/mediastream/chromium/MediaStreamCenterChromium.cpp: + (WebCore::MediaStreamCenterChromium::queryMediaStreamSources): + (WebCore::MediaStreamCenterChromium::didCreateMediaStream): + +2012-07-24 Julien Chaffraix <jchaffraix@webkit.org> + + Crash in RenderTableSection::layoutRows + https://bugs.webkit.org/show_bug.cgi?id=92145 + + Reviewed by Abhishek Arya. + + The crash came from the insertChildNode logic being confused and choosing the wrong + renderer for insertion. This is because after r123159, table anonymous wrappers can + be created as 'inline-table' and wouldn't pass the isAnonymousBlock() check. + + This change also aligns the ancestor iteration with RenderBlock::addChildToAnonymousColumnBlocks. + + Test: fast/table/crash-table-section-layoutRows.html + + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::insertChildNode): + Changed the code to always get the right child. There is no justification to not + walking up to the |owner|'s direct child in all cases. + +2012-07-24 Tony Chang <tony@chromium.org> + + Make RenderBlock::paintChildren virtual so sub classes can change the paint order + https://bugs.webkit.org/show_bug.cgi?id=92042 + + Reviewed by Ojan Vafai. + + The flexbox spec says that the order property should change the paint order of flex children. + To make that possible, make paintChildren virtual so RenderFlexibleBox can override it. + + No new tests, this is just a refactoring. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintContents): Move some code out of paintChildren into paintContents. + (WebCore::RenderBlock::paintChildren): Make virtual and just have it be a simple for loop. + (WebCore::RenderBlock::paintChild): Move code out of paintChildren so subclasses can reuse. + * rendering/RenderBlock.h: + (RenderBlock): Make paintChildren virtual and protected so sub classes can call paintChild. + +2012-07-24 Anna Cavender <annacc@chromium.org> + + Create SourceBuffer and SourceBufferList objects + https://bugs.webkit.org/show_bug.cgi?id=91771 + + Reviewed by Eric Carlson. + + SourceBuffer and SourceBufferList objects are needed in order to + implement the new object-oriented MediaSource API: + http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html + + No new tests - will be able to test after landing BUGWK91775 + + Adding new files to build files: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * DerivedSources.pri: + * GNUmakefile.am: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/copyForwardingHeaders.cmd: + * WebCore.xcodeproj/project.pbxproj: + + New objects: + * Modules/mediasource/SourceBuffer.cpp: Added. + * Modules/mediasource/SourceBuffer.h: Added. + * Modules/mediasource/SourceBuffer.idl: Added. + * Modules/mediasource/SourceBufferList.cpp: Added. + * Modules/mediasource/SourceBufferList.h: Added. + * Modules/mediasource/SourceBufferList.idl: Added. + + New events: + * dom/EventNames.h: + (WebCore): + * dom/EventTarget.h: + (WebCore): + * dom/EventTargetFactory.in: + + Object constructors: + * page/DOMWindow.idl: + +2012-07-24 Patrick Gansterer <paroga@webkit.org> + + Store the full year in GregorianDateTime + https://bugs.webkit.org/show_bug.cgi?id=92067 + + Reviewed by Geoffrey Garen. + + Use the full year instead of the offset from year 1900 + for the year member variable of GregorianDateTime. + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + (JSC::Bindings::convertQVariantToValue): + * bridge/qt/qt_runtime_qt4.cpp: + (JSC::Bindings::convertValueToQVariant): + (JSC::Bindings::convertQVariantToValue): + +2012-07-24 Benjamin Poulain <bpoulain@apple.com> + + Do not perform 8 to 16bits characters conversion when converting a WTFString to NSString/CFString + https://bugs.webkit.org/show_bug.cgi?id=90720 + + Reviewed by Geoffrey Garen. + + In most String to CFString conversion, we should be able to use the "NoCopy" constructor and have + a relatively cheap conversion from WTF::String to CFString. + + When the String is 8 bits, it was converted to 16 bits by getData16SlowCase() because of the call + to String::characters(). + + This patch adds a path for creating a CFString from a 8bits string using CFStringCreateWithBytes. + + This is covered by existing tests. + + * platform/text/cf/StringCF.cpp: + (WTF::String::createCFString): CFSTR() create static CFString, it is unecessary to retain it. + * platform/text/cf/StringImplCF.cpp: + (WTF::StringImpl::createCFString): The logic to avoid the StringWrapperCFAllocator has also been simplified. + The allocator creation is now closer to where it is useful. + +2012-07-24 Kentaro Hara <haraken@chromium.org> + + [V8] String wrappers should be marked Independent + https://bugs.webkit.org/show_bug.cgi?id=91251 + + Reviewed by Adam Barth. + + Currently V8 String wrappers are not marked Independent. + By marking them Independent, they can be reclaimed by the scavenger GC. + Although I couldn't find a case where this change reduces memory usage, + this change would be important for upcoming changes in string conversion + between V8 and WebKit (https://bugs.webkit.org/show_bug.cgi?id=91850). + + 'm_lastStringImpl = 0' in StringCache::remove() is important. + Look at the following code: + + static void cachedStringCallback(v8::Persistent<v8::Value> wrapper, void* parameter) + { + ...; + stringCache()->remove(stringImpl); + wrapper.Dispose(); + } + + void StringCache::remove(StringImpl* stringImpl) + { + ... + if (m_lastStringImpl.get() == stringImpl) + m_lastStringImpl = 0; + } + + v8::Local<v8::String> v8ExternalString(StringImpl* stringImpl, v8::Isolate* isolate) + { + if (m_lastStringImpl.get() == stringImpl) { + return v8::Local<v8::String>::New(m_lastV8String); // m_lastV8String points to a wrapper object that was accessed most recently. + } + return v8ExternalStringSlow(stringImpl, isolate); + } + + Without 'm_lastStringImpl = 0', already disposed m_lastV8String can be used + in v8ExternalString(). This was a cause of the crashes of r122614. + + Tests: At the initial commit of this patch (r122614), + the following tests had been broken due to missing 'm_lastStringImpl = 0'. + fast/workers/worker-location.html + Dromaeo/cssquery-jquery.html + Dromaeo/jslib-event-jquery.html + Dromaeo/jslib-style-jquery.html + Dromaeo/jslib-style-prototype.html + + * bindings/v8/V8Binding.cpp: + (WebCore::StringCache::remove): + (WebCore::StringCache::v8ExternalStringSlow): + +2012-07-24 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Update MediaStreamTrack to match the specification + https://bugs.webkit.org/show_bug.cgi?id=90180 + + Reviewed by Adam Barth. + + MediaStreamTracks are now required to show the status of the underlying source, + and trigger events when that status changes. + + Test: fast/mediastream/MediaStreamTrack.html + + * GNUmakefile.list.am: + * Modules/mediastream/MediaStream.cpp: + (WebCore::MediaStream::MediaStream): + (WebCore::MediaStream::addTrack): + * Modules/mediastream/MediaStreamTrack.cpp: + (WebCore::MediaStreamTrack::create): + (WebCore::MediaStreamTrack::MediaStreamTrack): + (WebCore::MediaStreamTrack::~MediaStreamTrack): + (WebCore::MediaStreamTrack::setEnabled): + (WebCore::MediaStreamTrack::readyState): + (WebCore): + (WebCore::MediaStreamTrack::sourceChangedState): + (WebCore::MediaStreamTrack::stop): + (WebCore::MediaStreamTrack::interfaceName): + (WebCore::MediaStreamTrack::scriptExecutionContext): + (WebCore::MediaStreamTrack::eventTargetData): + (WebCore::MediaStreamTrack::ensureEventTargetData): + * Modules/mediastream/MediaStreamTrack.h: + * Modules/mediastream/MediaStreamTrack.idl: + * WebCore.gypi: + * dom/EventNames.h: + (WebCore): + * dom/EventTargetFactory.in: + * platform/chromium/support/WebMediaStreamDescriptor.cpp: + * platform/chromium/support/WebMediaStreamSource.cpp: + (WebKit::WebMediaStreamSource::setReadyState): + (WebKit): + (WebKit::WebMediaStreamSource::readyState): + * platform/mediastream/MediaStreamSource.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamSource.h. + (WebCore): + (WebCore::MediaStreamSource::create): + (WebCore::MediaStreamSource::MediaStreamSource): + (WebCore::MediaStreamSource::setReadyState): + (WebCore::MediaStreamSource::addObserver): + (WebCore::MediaStreamSource::removeObserver): + * platform/mediastream/MediaStreamSource.h: + (Observer): + (WebCore::MediaStreamSource::Observer::~Observer): + (MediaStreamSource): + (WebCore::MediaStreamSource::readyState): + * platform/mediastream/chromium/MediaStreamCenterChromium.cpp: + (WebCore::MediaStreamCenterChromium::queryMediaStreamSources): + (WebCore::MediaStreamCenterChromium::didCreateMediaStream): + +2012-07-24 Scott Graham <scottmg@chromium.org> + + Use native (non-cygwin) binaries for perl, gperf, and bison in Chromium + https://bugs.webkit.org/show_bug.cgi?id=91667 + + Reviewed by Tony Chang. + + Using native tools instead of cygwin version improves build time + performance by roughly 50% (on top of previous cl-instead-of-gcc + change). + + Also, use - instead of / for cl flags, otherwise preprocessing fails + very slowly (due to retry loop). And, replace \ with / in gperf + command line. Without this, gperf emits the filename literally in + #line directives which causes VS to error with "unescaped \ in + string". Bizarrely, building ColorData.cpp with those \ in place + causes the IDE to exit with no error message, which was the cause of + the previous canary failures. + + No new tests. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gyp/scripts/rule_bison.py: + * bindings/scripts/preprocessor.pm: + (applyPreprocessor): + * make-hash-tools.pl: + +2012-07-24 Daniel Cheng <dcheng@chromium.org> + + Files from drag and file <input> should use getMIMETypeForExtension to determine content type. + https://bugs.webkit.org/show_bug.cgi?id=91702 + + Reviewed by Jian Li. + + Awhile back, we changed File to only use getWellKnownMIMETypeForExtension to prevent web + pages from being able to detect what applications a user has installed indirectly through + the MIME types. However, some sites like YouTube's drag and drop uploader use MIME types + that aren't in WebKit's internal list, so we relax the restriction for Files that originate + from an user action. + + * fileapi/File.cpp: + (WebCore::getContentTypeFromFileName): + (WebCore::createBlobDataForFile): + (WebCore::createBlobDataForFileWithName): + (WebCore::createBlobDataForFileWithMetadata): + (WebCore::File::createWithRelativePath): + (WebCore::File::File): + * fileapi/File.h: + (File): + (WebCore::File::create): + (WebCore::File::createWithName): + * html/FileInputType.cpp: + (WebCore::FileInputType::createFileList): + * platform/chromium/ChromiumDataObject.cpp: + (WebCore::ChromiumDataObject::addFilename): + * platform/gtk/ClipboardGtk.cpp: + (WebCore::ClipboardGtk::files): + * platform/mac/ClipboardMac.mm: + (WebCore::ClipboardMac::files): + * platform/qt/ClipboardQt.cpp: + (WebCore::ClipboardQt::files): + * platform/win/ClipboardWin.cpp: + (WebCore::ClipboardWin::files): + +2012-07-24 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Snippets UI polish + https://bugs.webkit.org/show_bug.cgi?id=92142 + + Reviewed by Pavel Feldman. + + Changed snippets context menu items. + Added run snippet status bar button. + Removed unused edit source button. + + * English.lproj/localizedStrings.js: + * inspector/front-end/Images/statusbarButtonGlyphs.png: + * inspector/front-end/ScriptSnippetModel.js: + (WebInspector.SnippetJavaScriptSourceFrame): + (WebInspector.SnippetJavaScriptSourceFrame.prototype.statusBarItems): + (WebInspector.SnippetJavaScriptSourceFrame.prototype._runButtonClicked): + * inspector/front-end/ScriptsNavigator.js: + (WebInspector.SnippetsNavigatorView.prototype.getOrCreateFolderTreeElement): + (WebInspector.SnippetsNavigatorView.prototype.handleContextMenu): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._updateScriptViewStatusBarItems): + (WebInspector.ScriptsPanel.prototype._createSourceFrame): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype.statusBarItems): + * inspector/front-end/inspector.css: + * inspector/front-end/scriptsPanel.css: + (.evaluate-snippet-status-bar-item .glyph): + (.evaluate-snippet-status-bar-item.toggled .glyph): + +2012-07-24 Nico Weber <thakis@chromium.org> + + [chromium/mac] Remove webcore_resource_files from WebCore.gypi + https://bugs.webkit.org/show_bug.cgi?id=92129 + + Reviewed by Adam Barth. + + It was added in http://trac.webkit.org/changeset/81706/trunk/Source/WebCore/WebCore.gypi . + The changes in that revision were mostly reverted in http://trac.webkit.org/changeset/119921 , + but this block was forgotten. Since it just confused me for a bit, remove it. + + * WebCore.gyp/WebCore.gyp: + +2012-07-24 Julien Chaffraix <jchaffraix@webkit.org> + + inline-table wrapper should be generated for display: inline element only + https://bugs.webkit.org/show_bug.cgi?id=92054 + + Reviewed by Abhishek Arya. + + CSS 2.1 only takes into account the display when determining if we should generate + an inline-table. My misreading of the spec would make us generate an inline-table + wrapper for any inline formatting context. + + Test: fast/table/inline-block-generates-table-wrapper.html + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::createAnonymousWithParentRenderer): + Changed to use display instead of isInline to properly match the spec. + +2012-07-24 Alec Flett <alecflett@chromium.org> + + IndexedDB: Temporarily continue generating backend keys for empty key lists + https://bugs.webkit.org/show_bug.cgi?id=92012 + + Reviewed by Tony Chang. + + Temporarily change key behavior to allow chromium in_process_webkit + to call putWithIndexKeys without inadvertently preventing index + key generation. Note this is temporary until frontend key generation + patch lands. + + No new tests, this is part of a refactor that doesn't change behavior. + + * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::putInternal): + +2012-07-24 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: introduce UISourceCodeFrame. + https://bugs.webkit.org/show_bug.cgi?id=92124 + + Reviewed by Vsevolod Vlasov. + + Generic implementation of SourceFrame over UISourceCode added. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/compile-front-end.py: + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._createSourceFrame): + * inspector/front-end/StylesPanel.js: + * inspector/front-end/UISourceCodeFrame.js: Added. + (WebInspector.UISourceCodeFrame): + (WebInspector.UISourceCodeFrame.prototype.canEditSource): + (WebInspector.UISourceCodeFrame.prototype.commitEditing): + (WebInspector.UISourceCodeFrame.prototype.afterTextChanged): + (WebInspector.UISourceCodeFrame.prototype._didEditContent): + (WebInspector.UISourceCodeFrame.prototype._onContentChanged): + (WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2012-07-24 Dan Bernstein <mitz@apple.com> + + <rdar://problem/11945102> REGRESSION (r109451): Overlay scrollbars always use the default style, regardless of background color + https://bugs.webkit.org/show_bug.cgi?id=92115 + + Reviewed by Mark Rowe. + + * platform/Scrollbar.cpp: + (WebCore::Scrollbar::scrollbarOverlayStyle): Reversed an incorrect null check. + +2012-07-24 Andrew Wilson <atwilson@chromium.org> + + Another prospective build fix for Chromium. Unreviewed. + + * platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h: + +2012-07-24 Andrew Wilson <atwilson@chromium.org> + + Unreviewed prospective build fix for Chromium. Changed include of hb.h in HarfBuzzNGFace.h + + * platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h: + 2012-07-24 Dominik Röttsches <dominik.rottsches@intel.com> HarfBuzzFaceNG.h forward declarations conflict with newer versions of Harfbuzz diff --git a/Source/WebCore/Configurations/FeatureDefines.xcconfig b/Source/WebCore/Configurations/FeatureDefines.xcconfig index 49182f3a0..70cf60c23 100644 --- a/Source/WebCore/Configurations/FeatureDefines.xcconfig +++ b/Source/WebCore/Configurations/FeatureDefines.xcconfig @@ -44,6 +44,7 @@ ENABLE_CSS_IMAGE_ORIENTATION = ; ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_SHADERS = ENABLE_CSS_SHADERS; +ENABLE_CSS_COMPOSITING = ; ENABLE_CSS_STICKY_POSITION = ENABLE_CSS_STICKY_POSITION; ENABLE_CSS_VARIABLES = ; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; @@ -136,4 +137,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(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_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +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_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(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_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebCore/DerivedSources.cpp b/Source/WebCore/DerivedSources.cpp index a4d374152..f80a9e20b 100644 --- a/Source/WebCore/DerivedSources.cpp +++ b/Source/WebCore/DerivedSources.cpp @@ -94,6 +94,7 @@ #include "JSDOMParser.cpp" #include "JSDOMPlugin.cpp" #include "JSDOMPluginArray.cpp" +#include "JSDOMSecurityPolicy.cpp" #include "JSDOMSelection.cpp" #include "JSDOMSettableTokenList.cpp" #include "JSDOMStringList.cpp" @@ -280,6 +281,10 @@ #include "JSShadowRoot.cpp" #include "JSSharedWorker.cpp" #include "JSSharedWorkerContext.cpp" +#if ENABLE(MEDIA_SOURCE) +#include "JSSourceBuffer.cpp" +#include "JSSourceBufferList.cpp" +#endif #include "JSSQLError.cpp" #include "JSSQLException.cpp" #include "JSSQLResultSet.cpp" diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index 50e630af2..32e692625 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -31,6 +31,7 @@ VPATH = \ $(WebCore)/Modules/filesystem \ $(WebCore)/Modules/geolocation \ $(WebCore)/Modules/indexeddb \ + $(WebCore)/Modules/mediasource \ $(WebCore)/Modules/notifications \ $(WebCore)/Modules/quota \ $(WebCore)/Modules/webaudio \ @@ -105,6 +106,8 @@ BINDING_IDLS = \ $(WebCore)/Modules/indexeddb/IDBVersionChangeEvent.idl \ $(WebCore)/Modules/indexeddb/IDBVersionChangeRequest.idl \ $(WebCore)/Modules/indexeddb/WorkerContextIndexedDatabase.idl \ + $(WebCore)/Modules/mediasource/SourceBuffer.idl \ + $(WebCore)/Modules/mediasource/SourceBufferList.idl \ $(WebCore)/Modules/notifications/DOMWindowNotifications.idl \ $(WebCore)/Modules/notifications/Notification.idl \ $(WebCore)/Modules/notifications/NotificationCenter.idl \ @@ -408,6 +411,7 @@ BINDING_IDLS = \ $(WebCore)/page/Console.idl \ $(WebCore)/page/Coordinates.idl \ $(WebCore)/page/Crypto.idl \ + $(WebCore)/page/DOMSecurityPolicy.idl \ $(WebCore)/page/DOMSelection.idl \ $(WebCore)/page/DOMWindow.idl \ $(WebCore)/page/EventSource.idl \ @@ -585,6 +589,7 @@ BINDING_IDLS = \ $(WebCore)/svg/SVGViewSpec.idl \ $(WebCore)/svg/SVGZoomAndPan.idl \ $(WebCore)/svg/SVGZoomEvent.idl \ + $(WebCore)/testing/FastMallocStatistics.idl \ $(WebCore)/testing/Internals.idl \ $(WebCore)/testing/InternalSettings.idl \ $(WebCore)/workers/AbstractWorker.idl \ @@ -946,6 +951,7 @@ IDL_INCLUDES = \ $(WebCore)/fileapi \ $(WebCore)/html \ $(WebCore)/css \ + $(WebCore)/Modules/mediasource \ $(WebCore)/Modules/notifications \ $(WebCore)/page \ $(WebCore)/xml \ diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri index 97178edf7..93f3dda6a 100644 --- a/Source/WebCore/DerivedSources.pri +++ b/Source/WebCore/DerivedSources.pri @@ -415,6 +415,7 @@ IDL_BINDINGS += \ $$PWD/page/Console.idl \ $$PWD/page/Coordinates.idl \ $$PWD/page/Crypto.idl \ + $$PWD/page/DOMSecurityPolicy.idl \ $$PWD/page/DOMSelection.idl \ $$PWD/page/DOMWindow.idl \ $$PWD/page/EventSource.idl \ @@ -442,6 +443,7 @@ IDL_BINDINGS += \ $$PWD/plugins/DOMMimeTypeArray.idl \ $$PWD/storage/Storage.idl \ $$PWD/storage/StorageEvent.idl \ + $$PWD/testing/FastMallocStatistics.idl \ $$PWD/testing/Internals.idl \ $$PWD/testing/InternalSettings.idl \ $$PWD/workers/AbstractWorker.idl \ @@ -620,6 +622,12 @@ contains(DEFINES, ENABLE_VIDEO_TRACK=1) { $$PWD/html/track/TrackEvent.idl \ } +contains(DEFINES, ENABLE_MEDIA_SOURCE=1) { + IDL_BINDINGS += \ + $$PWD/Modules/mediasource/SourceBuffer.idl \ + $$PWD/Modules/mediasource/SourceBufferList.idl +} + mathmlnames.output = MathMLNames.cpp mathmlnames.input = MATHML_NAMES mathmlnames.depends = $$PWD/mathml/mathattrs.in diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 70a18a05e..79694bec7 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -674,14 +674,10 @@ localizedStrings["Show each event category as a horizontal strip in overview"] = localizedStrings["Show each event as a vertical bar in overview"] = "Show each event as a vertical bar in overview"; localizedStrings["Evaluated snippets"] = "Evaluated snippets"; localizedStrings["An error happend when a call for method '%s' was requested"] = "An error happened when a call for method '%s' was requested"; -localizedStrings["Evaluate snippet"] = "Evaluate snippet"; -localizedStrings["Evaluate Snippet"] = "Evaluate Snippet"; -localizedStrings["Rename snippet"] = "Rename snippet"; -localizedStrings["Rename Snippet"] = "Rename Snippet"; -localizedStrings["Remove snippet"] = "Remove snippet"; -localizedStrings["Remove Snippet"] = "Remove Snippet"; -localizedStrings["Create snippet"] = "Create snippet"; -localizedStrings["Create Snippet"] = "Create Snippet"; +localizedStrings["Run"] = "Run"; +localizedStrings["Rename"] = "Rename"; +localizedStrings["Remove"] = "Remove"; +localizedStrings["New"] = "New"; localizedStrings["Frame"] = "Frame"; localizedStrings["FPS"] = "FPS"; localizedStrings["Continuation Frame"] = "Continuation Frame"; @@ -726,3 +722,6 @@ localizedStrings["Replace"] = "Replace"; localizedStrings["Replace All"] = "Replace All"; localizedStrings["Previous"] = "Previous"; localizedStrings["Paused in debugger"] = "Paused in debugger"; +localizedStrings["Emulate position unavailable"] = "Emulate position unavailable"; +localizedStrings["Override Geolocation"] = "Override Geolocation"; +localizedStrings["Geolocation Position"] = "Geolocation Position"; diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index 5871c6bcb..32af5c37c 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -15,6 +15,7 @@ webcore_cppflags += \ -I$(srcdir)/Source/WebCore/Modules/gamepad \ -I$(srcdir)/Source/WebCore/Modules/geolocation \ -I$(srcdir)/Source/WebCore/Modules/indexeddb \ + -I$(srcdir)/Source/WebCore/Modules/mediasource \ -I$(srcdir)/Source/WebCore/Modules/mediastream \ -I$(srcdir)/Source/WebCore/Modules/notifications \ -I$(srcdir)/Source/WebCore/Modules/protocolhandler \ @@ -116,7 +117,8 @@ webcoregtk_cppflags += \ -I$(srcdir)/Source/WebCore/platform/graphics/gstreamer \ -I$(srcdir)/Source/WebCore/platform/graphics/gtk \ -I$(srcdir)/Source/WebCore/platform/gtk \ - -I$(srcdir)/Source/WebCore/platform/network/soup + -I$(srcdir)/Source/WebCore/platform/network/soup \ + -I$(srcdir)/Source/WebCore/platform/text/gtk # --- # Features enabled by default at compilation time @@ -497,6 +499,18 @@ webcore_cppflags += -DENABLE_CSS_FILTERS=1 endif # END ENABLE_CSS_FILTERS # ---- +# Compositing +# ---- +if ENABLE_CSS_COMPOSITING +FEATURE_DEFINES += ENABLE_CSS_COMPOSITING=1 +webcore_cppflags += -DENABLE_CSS_COMPOSITING=1 +if ENABLE_SVG +SVG_FEATURES += ENABLE_CSS_COMPOSITING=1 +endif + +endif # END ENABLE_CSS_COMPOSITING + +# ---- # Exclusions # ---- if ENABLE_CSS_EXCLUSIONS @@ -735,6 +749,14 @@ FEATURE_DEFINES += ENABLE_LINK_PREFETCH=1 webcore_cppflags += -DENABLE_LINK_PREFETCH=1 endif # END ENABLE_LINK_PREFETCH +# --- +# Spell check support +# --- +if ENABLE_SPELLCHECK +FEATURE_DEFINES += ENABLE_SPELLCHECK=1 +webcore_cppflags += -DENABLE_SPELLCHECK=1 +endif # END ENABLE_SPELLCHECK + DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h DerivedSources/WebCore/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/makeprop.pl $(AM_V_GEN) @@ -881,6 +903,7 @@ IDL_PATH := \ $(WebCore)/Modules/gamepad \ $(WebCore)/Modules/geolocation \ $(WebCore)/Modules/indexeddb \ + $(WebCore)/Modules/mediasource \ $(WebCore)/Modules/mediastream \ $(WebCore)/Modules/notifications \ $(WebCore)/Modules/webaudio \ @@ -1049,6 +1072,7 @@ EXTRA_DIST += \ $(shell ls $(srcdir)/Source/WebCore/Modules/gamepad/*.idl) \ $(shell ls $(srcdir)/Source/WebCore/Modules/geolocation/*.idl) \ $(shell ls $(srcdir)/Source/WebCore/Modules/indexeddb/*.idl) \ + $(shell ls $(srcdir)/Source/WebCore/Modules/mediasource/*.idl) \ $(shell ls $(srcdir)/Source/WebCore/Modules/mediastream/*.idl) \ $(shell ls $(srcdir)/Source/WebCore/Modules/notifications/*.idl) \ $(shell ls $(srcdir)/Source/WebCore/Modules/protocolhandler/*.idl) \ diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index 9698d6f58..c9e923090 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -110,8 +110,6 @@ webcore_built_sources += \ DerivedSources/WebCore/JSDataView.h \ DerivedSources/WebCore/JSDedicatedWorkerContext.cpp \ DerivedSources/WebCore/JSDedicatedWorkerContext.h \ - DerivedSources/WebCore/JSDeprecatedPeerConnection.cpp \ - DerivedSources/WebCore/JSDeprecatedPeerConnection.h \ DerivedSources/WebCore/JSDeviceMotionEvent.cpp \ DerivedSources/WebCore/JSDeviceMotionEvent.h \ DerivedSources/WebCore/JSDeviceOrientationEvent.cpp \ @@ -142,6 +140,8 @@ webcore_built_sources += \ DerivedSources/WebCore/JSDOMPluginArray.h \ DerivedSources/WebCore/JSDOMPlugin.cpp \ DerivedSources/WebCore/JSDOMPlugin.h \ + DerivedSources/WebCore/JSDOMSecurityPolicy.cpp \ + DerivedSources/WebCore/JSDOMSecurityPolicy.h \ DerivedSources/WebCore/JSDOMSelection.cpp \ DerivedSources/WebCore/JSDOMSelection.h \ DerivedSources/WebCore/JSDOMSettableTokenList.cpp \ @@ -505,8 +505,10 @@ webcore_built_sources += \ DerivedSources/WebCore/JSSharedWorkerContext.h \ DerivedSources/WebCore/JSSharedWorker.cpp \ DerivedSources/WebCore/JSSharedWorker.h \ - DerivedSources/WebCore/JSSignalingCallback.cpp \ - DerivedSources/WebCore/JSSignalingCallback.h \ + DerivedSources/WebCore/JSSourceBuffer.cpp \ + DerivedSources/WebCore/JSSourceBuffer.h \ + DerivedSources/WebCore/JSSourceBufferList.cpp \ + DerivedSources/WebCore/JSSourceBufferList.h \ DerivedSources/WebCore/JSSpeechInputEvent.cpp \ DerivedSources/WebCore/JSSpeechInputEvent.h \ DerivedSources/WebCore/JSSpeechInputResult.cpp \ @@ -696,7 +698,8 @@ dom_binding_idls += \ $(WebCore)/Modules/geolocation/PositionCallback.idl \ $(WebCore)/Modules/geolocation/PositionError.idl \ $(WebCore)/Modules/geolocation/PositionErrorCallback.idl \ - $(WebCore)/Modules/mediastream/DeprecatedPeerConnection.idl \ + $(WebCore)/Modules/mediasource/SourceBuffer.idl \ + $(WebCore)/Modules/mediasource/SourceBufferList.idl \ $(WebCore)/Modules/mediastream/DOMWindowMediaStream.idl \ $(WebCore)/Modules/mediastream/IceCallback.idl \ $(WebCore)/Modules/mediastream/IceCandidate.idl \ @@ -713,7 +716,6 @@ dom_binding_idls += \ $(WebCore)/Modules/mediastream/NavigatorUserMediaSuccessCallback.idl \ $(WebCore)/Modules/mediastream/PeerConnection00.idl \ $(WebCore)/Modules/mediastream/SessionDescription.idl \ - $(WebCore)/Modules/mediastream/SignalingCallback.idl \ $(WebCore)/Modules/notifications/Notification.idl \ $(WebCore)/Modules/notifications/NotificationCenter.idl \ $(WebCore)/Modules/notifications/NotificationPermissionCallback.idl \ @@ -963,6 +965,7 @@ dom_binding_idls += \ $(WebCore)/page/Console.idl \ $(WebCore)/page/Coordinates.idl \ $(WebCore)/page/Crypto.idl \ + $(WebCore)/page/DOMSecurityPolicy.idl \ $(WebCore)/page/DOMSelection.idl \ $(WebCore)/page/DOMWindow.idl \ $(WebCore)/page/EventSource.idl \ @@ -990,6 +993,7 @@ dom_binding_idls += \ $(WebCore)/plugins/DOMPluginArray.idl \ $(WebCore)/storage/Storage.idl \ $(WebCore)/storage/StorageEvent.idl \ + $(WebCore)/testing/FastMallocStatistics.idl \ $(WebCore)/testing/Internals.idl \ $(WebCore)/testing/InternalSettings.idl \ $(WebCore)/workers/AbstractWorker.idl \ @@ -1165,8 +1169,10 @@ webcore_modules_sources += \ Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h \ Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp \ Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h \ - Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.cpp \ - Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.h \ + Source/WebCore/Modules/mediasource/SourceBuffer.cpp \ + Source/WebCore/Modules/mediasource/SourceBuffer.h \ + Source/WebCore/Modules/mediasource/SourceBufferList.cpp \ + Source/WebCore/Modules/mediasource/SourceBufferList.h \ Source/WebCore/Modules/mediastream/IceCallback.h \ Source/WebCore/Modules/mediastream/IceCandidate.cpp \ Source/WebCore/Modules/mediastream/IceCandidate.h \ @@ -1195,7 +1201,6 @@ webcore_modules_sources += \ Source/WebCore/Modules/mediastream/PeerConnection00.h \ Source/WebCore/Modules/mediastream/SessionDescription.cpp \ Source/WebCore/Modules/mediastream/SessionDescription.h \ - Source/WebCore/Modules/mediastream/SignalingCallback.h \ Source/WebCore/Modules/mediastream/UserMediaClient.h \ Source/WebCore/Modules/mediastream/UserMediaController.h \ Source/WebCore/Modules/mediastream/UserMediaController.cpp \ @@ -1423,7 +1428,6 @@ webcore_sources += \ Source/WebCore/bindings/js/JSDOMWrapper.h \ Source/WebCore/bindings/js/JSDataViewCustom.cpp \ Source/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp \ - Source/WebCore/bindings/js/JSDeprecatedPeerConnectionCustom.cpp \ Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp \ Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp \ Source/WebCore/bindings/js/JSDirectoryEntryCustom.cpp \ @@ -2573,6 +2577,7 @@ webcore_sources += \ Source/WebCore/html/parser/HTMLScriptRunnerHost.h \ Source/WebCore/html/parser/HTMLSourceTracker.cpp \ Source/WebCore/html/parser/HTMLSourceTracker.h \ + Source/WebCore/html/parser/HTMLStackItem.h \ Source/WebCore/html/parser/HTMLToken.h \ Source/WebCore/html/parser/HTMLTokenizer.cpp \ Source/WebCore/html/parser/HTMLTokenizer.h \ @@ -3019,6 +3024,10 @@ webcore_sources += \ Source/WebCore/page/Coordinates.h \ Source/WebCore/page/Crypto.cpp \ Source/WebCore/page/Crypto.h \ + Source/WebCore/page/DiagnosticLoggingKeys.cpp \ + Source/WebCore/page/DiagnosticLoggingKeys.h \ + Source/WebCore/page/DOMSecurityPolicy.cpp \ + Source/WebCore/page/DOMSecurityPolicy.h \ Source/WebCore/page/DOMSelection.cpp \ Source/WebCore/page/DOMSelection.h \ Source/WebCore/page/DOMTimer.cpp \ @@ -3523,8 +3532,6 @@ webcore_sources += \ Source/WebCore/platform/LayoutTestSupport.h \ Source/WebCore/platform/linux/GamepadDeviceLinux.cpp \ Source/WebCore/platform/linux/GamepadDeviceLinux.h \ - Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandler.h \ - Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandlerClient.h \ Source/WebCore/platform/mediastream/IceCandidateDescriptor.cpp \ Source/WebCore/platform/mediastream/IceCandidateDescriptor.h \ Source/WebCore/platform/mediastream/IceOptions.cpp \ @@ -3535,6 +3542,7 @@ webcore_sources += \ Source/WebCore/platform/mediastream/MediaStreamCenter.h \ Source/WebCore/platform/mediastream/MediaStreamComponent.h \ Source/WebCore/platform/mediastream/MediaStreamDescriptor.h \ + Source/WebCore/platform/mediastream/MediaStreamSource.cpp \ Source/WebCore/platform/mediastream/MediaStreamSource.h \ Source/WebCore/platform/mediastream/MediaStreamSourcesQueryClient.h \ Source/WebCore/platform/mediastream/PeerConnection00Handler.cpp \ @@ -3542,7 +3550,6 @@ webcore_sources += \ Source/WebCore/platform/mediastream/PeerConnection00HandlerClient.h \ Source/WebCore/platform/mediastream/SessionDescriptionDescriptor.cpp \ Source/WebCore/platform/mediastream/SessionDescriptionDescriptor.h \ - Source/WebCore/platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp \ Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp \ Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h \ Source/WebCore/platform/mock/DeviceMotionClientMock.cpp \ @@ -4124,6 +4131,7 @@ webcore_sources += \ Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp \ Source/WebCore/rendering/style/SVGRenderStyleDefs.h \ Source/WebCore/rendering/style/SVGRenderStyle.h \ + Source/WebCore/rendering/style/WrapShapes.cpp \ Source/WebCore/rendering/style/WrapShapes.h \ Source/WebCore/rendering/svg/RenderSVGBlock.cpp \ Source/WebCore/rendering/svg/RenderSVGBlock.h \ @@ -6281,3 +6289,13 @@ dom_binding_idls += \ $(WebCore)/Modules/quota/StorageInfoUsageCallback.idl endif # END ENABLE_QUOTA + +# ---- +# Spell check support +# ---- +if ENABLE_SPELLCHECK +webcore_sources += \ + Source/WebCore/platform/text/gtk/TextCheckerEnchant.h \ + Source/WebCore/platform/text/gtk/TextCheckerEnchant.cpp +endif # END ENABLE_SPELLCHECK + diff --git a/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp b/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp index 664352184..968f44b0b 100644 --- a/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp +++ b/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp @@ -77,11 +77,17 @@ String LocalFileSystem::fileSystemBasePath() const return m_basePath; } +// FIXME: Add FileSystemType parameter. static void openFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, bool create, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { AsyncFileSystem::openFileSystem(basePath, identifier, create, callbacks); } +static void deleteFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + AsyncFileSystem::deleteFileSystem(basePath, identifier, type, callbacks); +} + void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType) { // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously. @@ -90,10 +96,17 @@ void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystem void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSystemType, long long, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType) { + // FIXME: Pass FileSystemType parameter. // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously. context->postTask(createCallbackTask(&openFileSystem, fileSystemBasePath(), context->securityOrigin()->databaseIdentifier(), true, callbacks)); } +void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSystemType type, PassRefPtr<ErrorCallback> callbacks) +{ + // AsyncFileSystem::deleteFileSystem calls callbacks synchronously, so the method needs to be called asynchronously. + context->postTask(createCallbackTask(&deleteFileSystem, filesystemBasePath(), context->securityOrigin()->databaseIdentifier(), type, callbacks); +} + } // namespace #endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/Modules/filesystem/LocalFileSystem.h b/Source/WebCore/Modules/filesystem/LocalFileSystem.h index bd71e3e44..cdb2f9c81 100644 --- a/Source/WebCore/Modules/filesystem/LocalFileSystem.h +++ b/Source/WebCore/Modules/filesystem/LocalFileSystem.h @@ -59,6 +59,8 @@ public: void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, FileSystemSynchronousType = AsynchronousFileSystem); + void deleteFileSystem(ScriptExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>); + #if !PLATFORM(CHROMIUM) // This call is not thread-safe; must be called before any worker threads are created. static void initializeLocalFileSystem(const String&); @@ -67,7 +69,7 @@ public: #endif private: - LocalFileSystem(const String& basePath) + explicit LocalFileSystem(const String& basePath) : m_basePath(basePath) { } diff --git a/Source/WebCore/Modules/filesystem/Metadata.h b/Source/WebCore/Modules/filesystem/Metadata.h index 7d1253a12..fa26f4c8e 100644 --- a/Source/WebCore/Modules/filesystem/Metadata.h +++ b/Source/WebCore/Modules/filesystem/Metadata.h @@ -55,7 +55,7 @@ public: unsigned long long size() const { return static_cast<unsigned long long>(m_platformMetadata.length); } private: - Metadata(const FileMetadata& platformMetadata) + explicit Metadata(const FileMetadata& platformMetadata) : m_platformMetadata(platformMetadata) { } diff --git a/Source/WebCore/Modules/filesystem/SyncCallbackHelper.h b/Source/WebCore/Modules/filesystem/SyncCallbackHelper.h index 950adf470..51ae04d8f 100644 --- a/Source/WebCore/Modules/filesystem/SyncCallbackHelper.h +++ b/Source/WebCore/Modules/filesystem/SyncCallbackHelper.h @@ -109,7 +109,7 @@ private: } private: - SuccessCallbackImpl(HelperType* helper) + explicit SuccessCallbackImpl(HelperType* helper) : m_helper(helper) { } @@ -131,7 +131,7 @@ private: } private: - ErrorCallbackImpl(HelperType* helper) + explicit ErrorCallbackImpl(HelperType* helper) : m_helper(helper) { } diff --git a/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp b/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp index 9ad62ad9c..462d3d5b9 100644 --- a/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp +++ b/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp @@ -54,7 +54,7 @@ NavigatorGamepad* NavigatorGamepad::from(Navigator* navigator) return supplement; } -GamepadList* NavigatorGamepad::webkitGamepads(Navigator* navigator) +GamepadList* NavigatorGamepad::webkitGetGamepads(Navigator* navigator) { return NavigatorGamepad::from(navigator)->gamepads(); } diff --git a/Source/WebCore/Modules/gamepad/NavigatorGamepad.h b/Source/WebCore/Modules/gamepad/NavigatorGamepad.h index 87e4d8ae8..d4d400a6d 100644 --- a/Source/WebCore/Modules/gamepad/NavigatorGamepad.h +++ b/Source/WebCore/Modules/gamepad/NavigatorGamepad.h @@ -40,7 +40,7 @@ public: virtual ~NavigatorGamepad(); static NavigatorGamepad* from(Navigator*); - static GamepadList* webkitGamepads(Navigator*); + static GamepadList* webkitGetGamepads(Navigator*); GamepadList* gamepads(); diff --git a/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl b/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl index e8a945db6..3e4985b4e 100644 --- a/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl +++ b/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl @@ -23,7 +23,7 @@ module window { Conditional=GAMEPAD, Supplemental=Navigator ] NavigatorGamepad { - readonly attribute [V8EnabledAtRuntime] GamepadList webkitGamepads; + [V8EnabledAtRuntime] GamepadList webkitGetGamepads(); }; } diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.cpp b/Source/WebCore/Modules/geolocation/GeolocationController.cpp index e1ace93a5..7abf83181 100644 --- a/Source/WebCore/Modules/geolocation/GeolocationController.cpp +++ b/Source/WebCore/Modules/geolocation/GeolocationController.cpp @@ -29,12 +29,15 @@ #if ENABLE(GEOLOCATION) #include "GeolocationClient.h" +#include "GeolocationError.h" #include "GeolocationPosition.h" +#include "InspectorInstrumentation.h" namespace WebCore { -GeolocationController::GeolocationController(Page*, GeolocationClient* client) +GeolocationController::GeolocationController(Page* page, GeolocationClient* client) : m_client(client) + , m_page(page) { } @@ -98,6 +101,11 @@ void GeolocationController::cancelPermissionRequest(Geolocation* geolocation) void GeolocationController::positionChanged(GeolocationPosition* position) { + position = InspectorInstrumentation::overrideGeolocationPosition(m_page, position); + if (!position) { + errorOccurred(GeolocationError::create(GeolocationError::PositionUnavailable, "PositionUnavailable").get()); + return; + } m_lastPosition = position; Vector<RefPtr<Geolocation> > observersVector; copyToVector(m_observers, observersVector); diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.h b/Source/WebCore/Modules/geolocation/GeolocationController.h index fc3b513b3..bc61b9e4d 100644 --- a/Source/WebCore/Modules/geolocation/GeolocationController.h +++ b/Source/WebCore/Modules/geolocation/GeolocationController.h @@ -68,6 +68,7 @@ private: GeolocationController(Page*, GeolocationClient*); GeolocationClient* m_client; + Page* m_page; RefPtr<GeolocationPosition> m_lastPosition; typedef HashSet<RefPtr<Geolocation> > ObserversSet; diff --git a/Source/WebCore/Modules/indexeddb/IDBBackingStore.h b/Source/WebCore/Modules/indexeddb/IDBBackingStore.h index 78a9f667a..f8de68202 100644 --- a/Source/WebCore/Modules/indexeddb/IDBBackingStore.h +++ b/Source/WebCore/Modules/indexeddb/IDBBackingStore.h @@ -83,7 +83,6 @@ public: virtual void deleteIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId) = 0; virtual bool putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*) = 0; virtual bool deleteIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*) = 0; - virtual String getObjectViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) = 0; virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) = 0; virtual bool keyExistsInIndex(int64_t databaseid, int64_t objectStoreId, int64_t indexId, const IDBKey& indexKey, RefPtr<IDBKey>& foundPrimaryKey) = 0; diff --git a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h index 0b34b6886..853ffc72d 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h +++ b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h @@ -30,19 +30,19 @@ #define IDBCallbacks_h #include "DOMStringList.h" -#include "IDBCursorBackendInterface.h" -#include "IDBDatabaseBackendInterface.h" #include "IDBDatabaseError.h" #include "IDBKey.h" #include "IDBKeyPath.h" -#include "IDBObjectStoreBackendInterface.h" -#include "IDBTransactionBackendInterface.h" #include "SerializedScriptValue.h" #include <wtf/Threading.h> #if ENABLE(INDEXED_DATABASE) namespace WebCore { +class IDBCursorBackendInterface; +class IDBDatabaseBackendInterface; +class IDBObjectStoreBackendInterface; +class IDBTransactionBackendInterface; // FIXME: All child classes need to be made threadsafe. class IDBCallbacks : public ThreadSafeRefCounted<IDBCallbacks> { diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp index ef34cb8c7..05ddb251e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp @@ -159,13 +159,7 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRe } } - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); - m_backend->update(value, request, ec); - if (ec) { - request->markEarlyDeath(); - return 0; - } - return request.release(); + return objectStore->put(IDBObjectStoreBackendInterface::CursorUpdate, IDBAny::create(this), context, value, m_currentPrimaryKey, ec); } void IDBCursor::advance(unsigned long count, ExceptionCode& ec) @@ -259,18 +253,21 @@ void IDBCursor::setValueReady() m_currentPrimaryKey = m_backend->primaryKey(); RefPtr<SerializedScriptValue> value = m_backend->value(); -#ifndef NDEBUG if (!isKeyCursor()) { - // FIXME: Actually inject the primaryKey at the keyPath. RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); - if (objectStore->autoIncrement() && !objectStore->metadata().keyPath.isNull()) { - const IDBKeyPath& keyPath = objectStore->metadata().keyPath; - RefPtr<IDBKey> expectedKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath); - ASSERT(m_currentPrimaryKey); - ASSERT(expectedKey->isEqual(m_currentPrimaryKey.get())); + const IDBObjectStoreMetadata metadata = objectStore->metadata(); + if (metadata.autoIncrement && !metadata.keyPath.isNull()) { +#ifndef NDEBUG + RefPtr<IDBKey> expectedKey = createIDBKeyFromSerializedValueAndKeyPath(value, metadata.keyPath); + ASSERT(!expectedKey || expectedKey->isEqual(m_currentPrimaryKey.get())); +#endif + RefPtr<SerializedScriptValue> valueAfterInjection = injectIDBKeyIntoSerializedValue(m_currentPrimaryKey, value, metadata.keyPath); + ASSERT(valueAfterInjection); + // 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; } } -#endif m_currentValue = IDBAny::create(value.release()); m_gotValue = true; diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp index ae27af8a3..0a39a8fbc 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp @@ -83,17 +83,6 @@ PassRefPtr<SerializedScriptValue> IDBCursorBackendImpl::value() const return SerializedScriptValue::createFromWire(m_cursor->value()); } -void IDBCursorBackendImpl::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) -{ - IDB_TRACE("IDBCursorBackendImpl::update"); - ASSERT(m_transaction->mode() != IDBTransaction::READ_ONLY); - - ASSERT(m_cursor); - ASSERT(m_cursorType != IndexKeyCursor); - - m_objectStore->put(value, m_cursor->primaryKey(), IDBObjectStoreBackendInterface::CursorUpdate, callbacks, m_transaction.get(), ec); -} - void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec) { IDB_TRACE("IDBCursorBackendImpl::continue"); diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h index 043c40352..5097c5387 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h @@ -57,7 +57,6 @@ public: virtual PassRefPtr<IDBKey> key() const; virtual PassRefPtr<IDBKey> primaryKey() const; virtual PassRefPtr<SerializedScriptValue> value() const; - virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void advance(unsigned long, PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&); diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBCursorBackendInterface.h index 48d3a1829..1df28456a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendInterface.h +++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendInterface.h @@ -57,7 +57,6 @@ public: virtual PassRefPtr<IDBKey> primaryKey() const = 0; virtual PassRefPtr<SerializedScriptValue> value() const = 0; - virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0; virtual void advance(unsigned long count, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0; virtual void continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0; virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp index 2f9c8932e..5c3dfcb6b 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp @@ -111,6 +111,14 @@ PassRefPtr<DOMStringList> IDBDatabase::objectStoreNames() const return objectStoreNames.release(); } +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)); +} + PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const Dictionary& options, ExceptionCode& ec) { if (!m_versionChangeTransaction) { diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.h b/Source/WebCore/Modules/indexeddb/IDBDatabase.h index a248cd80d..64cbb326a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.h @@ -59,7 +59,7 @@ public: // Implement the IDL const String name() const { return m_metadata.name; } - const String version() const { return m_metadata.version; } + PassRefPtr<IDBAny> version() const; PassRefPtr<DOMStringList> objectStoreNames() const; // FIXME: Try to modify the code generator so this is unneeded. diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.idl b/Source/WebCore/Modules/indexeddb/IDBDatabase.idl index 95f6c2360..d253e4df7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.idl +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.idl @@ -32,7 +32,7 @@ module storage { EventTarget ] IDBDatabase { readonly attribute DOMString name; - readonly attribute DOMString version; + readonly attribute IDBAny version; readonly attribute DOMStringList objectStoreNames; attribute EventListener onabort; diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp index 9f5ff3baf..134008491 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp @@ -172,11 +172,19 @@ void IDBIndexBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBInd backingStoreCursor->close(); } - String value = index->backingStore()->getObjectViaIndex(index->databaseId(), index->m_objectStoreBackend->id(), index->id(), *key); + RefPtr<IDBKey> primaryKey = index->backingStore()->getPrimaryKeyViaIndex(index->databaseId(), index->m_objectStoreBackend->id(), index->id(), *key); + + String value = index->backingStore()->getObjectStoreRecord(index->databaseId(), index->m_objectStoreBackend->id(), *primaryKey); + if (value.isNull()) { callbacks->onSuccess(SerializedScriptValue::undefinedValue()); return; } + if (index->m_objectStoreBackend->autoIncrement() && !index->m_objectStoreBackend->keyPath().isNull()) { + callbacks->onSuccess(SerializedScriptValue::createFromWire(value), + primaryKey, index->m_objectStoreBackend->keyPath()); + return; + } callbacks->onSuccess(SerializedScriptValue::createFromWire(value)); } diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp b/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp index 0c35d20d6..8c7b84f9e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp @@ -236,6 +236,48 @@ IDBKeyPath::operator PassRefPtr<IDBAny>() const return 0; } +bool IDBKeyPath::operator==(PassRefPtr<IDBAny> other) const +{ + if (!isValid()) + return false; + + switch (m_type) { + case NullType: + return other->type() == IDBAny::NullType; + case StringType: + return other->type() == IDBAny::StringType && other->string() == string(); + case ArrayType: + if (other->type() != IDBAny::DOMStringListType) + return false; + + RefPtr<DOMStringList> otherList = other->domStringList(); + for (size_t i = 0; i < m_array.size(); ++i) { + if (otherList->item(i) != m_array[i]) + return false; + } + return true; + } + ASSERT_NOT_REACHED(); + return false; +} + +bool IDBKeyPath::operator==(const IDBKeyPath& other) const +{ + if (m_type != other.m_type) + return false; + + switch (m_type) { + case NullType: + return true; + case StringType: + return m_string == other.m_string; + case ArrayType: + return m_array == other.m_array; + } + ASSERT_NOT_REACHED(); + return false; +} + } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyPath.h b/Source/WebCore/Modules/indexeddb/IDBKeyPath.h index f5236c152..df31e2abc 100644 --- a/Source/WebCore/Modules/indexeddb/IDBKeyPath.h +++ b/Source/WebCore/Modules/indexeddb/IDBKeyPath.h @@ -72,6 +72,8 @@ public: bool isNull() const { return m_type == NullType; } bool isValid() const; operator PassRefPtr<IDBAny>() const; + bool operator==(PassRefPtr<IDBAny> other) const; + bool operator==(const IDBKeyPath& other) const; private: Type m_type; diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp index 32e2f6815..0513c3533 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp @@ -967,15 +967,6 @@ bool IDBLevelDBBackingStore::deleteIndexDataForRecord(int64_t, int64_t, int64_t, return true; } -String IDBLevelDBBackingStore::getObjectViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key) -{ - RefPtr<IDBKey> primaryKey = getPrimaryKeyViaIndex(databaseId, objectStoreId, indexId, key); - if (!primaryKey) - return String(); - - return getObjectStoreRecord(databaseId, objectStoreId, *primaryKey); -} - static bool versionExists(LevelDBTransaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t version, const Vector<char>& encodedPrimaryKey) { const Vector<char> key = ExistsEntryKey::encode(databaseId, objectStoreId, encodedPrimaryKey); diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h index c5a9e2ee3..0be934ffd 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h @@ -69,7 +69,6 @@ public: virtual void deleteIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId); virtual bool putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*); virtual bool deleteIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*); - virtual String getObjectViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&); virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&); virtual bool keyExistsInIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& indexKey, RefPtr<IDBKey>& foundPrimaryKey); diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp index e27ca827b..7f7cd74bb 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp @@ -31,6 +31,7 @@ #include "DOMStringList.h" #include "IDBAny.h" #include "IDBBindingUtilities.h" +#include "IDBCursorBackendInterface.h" #include "IDBDatabase.h" #include "IDBDatabaseException.h" #include "IDBIndex.h" @@ -101,19 +102,44 @@ PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, Pass return get(context, keyRange.release(), ec); } +static void generateIndexKeysForValue(const IDBIndexMetadata& indexMetadata, + PassRefPtr<SerializedScriptValue> objectValue, + IDBObjectStore::IndexKeys* indexKeys) +{ + ASSERT(indexKeys); + RefPtr<IDBKey> indexKey = createIDBKeyFromSerializedValueAndKeyPath(objectValue, indexMetadata.keyPath); + + if (!indexKey) + return; + + if (!indexMetadata.multiEntry || indexKey->type() != IDBKey::ArrayType) { + if (!indexKey->isValid()) + return; + + indexKeys->append(indexKey); + } else { + ASSERT(indexMetadata.multiEntry); + ASSERT(indexKey->type() == IDBKey::ArrayType); + indexKey = IDBKey::createMultiEntryArray(indexKey->array()); + + for (size_t i = 0; i < indexKey->array().size(); ++i) + indexKeys->append(indexKey->array()[i]); + } +} + PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::add"); - return put(IDBObjectStoreBackendInterface::AddOnly, context, value, key, ec); + return put(IDBObjectStoreBackendInterface::AddOnly, IDBAny::create(this), context, value, key, ec); } PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::put"); - return put(IDBObjectStoreBackendInterface::AddOrUpdate, context, value, key, ec); + return put(IDBObjectStoreBackendInterface::AddOrUpdate, IDBAny::create(this), context, value, key, ec); } -PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMode putMode, ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec) +PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::put"); RefPtr<SerializedScriptValue> value = prpValue; @@ -140,7 +166,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMo const bool usesInLineKeys = !keyPath.isNull(); const bool hasKeyGenerator = autoIncrement(); - if (usesInLineKeys && key) { + if (putMode != IDBObjectStoreBackendInterface::CursorUpdate && usesInLineKeys && key) { ec = IDBDatabaseException::DATA_ERR; return 0; } @@ -166,15 +192,26 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMo return 0; } } + if (keyPathKey) + key = keyPathKey; } if (key && !key->isValid()) { ec = IDBDatabaseException::DATA_ERR; return 0; } - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); - // FIXME: Pass through keyPathKey as key to simplify back end implementation. - m_backend->put(value.release(), key.release(), putMode, request, m_transaction->backend(), ec); + Vector<String> indexNames; + Vector<IndexKeys> indexKeys; + for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) { + IndexKeys keys; + generateIndexKeysForValue(it->second, value, &keys); + indexNames.append(it->first); + indexKeys.append(keys); + } + ASSERT(indexKeys.size() == indexNames.size()); + + RefPtr<IDBRequest> request = IDBRequest::create(context, source, m_transaction.get()); + m_backend->putWithIndexKeys(value.release(), key.release(), putMode, request, m_transaction->backend(), indexNames, indexKeys, ec); if (ec) { request->markEarlyDeath(); return 0; diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h index ef7c063b8..6fefc4e2b 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h @@ -95,7 +95,7 @@ public: PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&); PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&); - PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&); + PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, PassRefPtr<IDBAny> source, ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&); void markDeleted() { m_deleted = true; } void transactionFinished(); diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp index 8d3b803cb..746933ef0 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp @@ -120,48 +120,6 @@ void IDBObjectStoreBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr< callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData)); } -static PassRefPtr<IDBKey> fetchKeyFromKeyPath(SerializedScriptValue* value, const IDBKeyPath& keyPath) -{ - IDB_TRACE("IDBObjectStoreBackendImpl::fetchKeyFromKeyPath"); - ASSERT(!keyPath.isNull()); - - Vector<RefPtr<SerializedScriptValue> > values; - values.append(value); - Vector<RefPtr<IDBKey> > keys; - IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(values, keyPath, keys); - if (keys.isEmpty()) - return 0; - ASSERT(keys.size() == 1); - return keys[0].release(); -} - -static PassRefPtr<SerializedScriptValue> injectKeyIntoKeyPath(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const IDBKeyPath& keyPath) -{ - IDB_TRACE("IDBObjectStoreBackendImpl::injectKeyIntoKeyPath"); - return IDBKeyPathBackendImpl::injectIDBKeyIntoSerializedValue(key, value, keyPath); -} - -// FIXME: Remove this method when get-side key injection is the norm. -void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) -{ - IDB_TRACE("IDBObjectStoreBackendImpl::put"); - IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); - - RefPtr<IDBObjectStoreBackendImpl> objectStore = this; - RefPtr<SerializedScriptValue> value = prpValue; - RefPtr<IDBKey> key = prpKey; - RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); - ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); - - // Null pointers here signify that index keys should be generated as a part of this put. - OwnPtr<Vector<String> > nullIndexNames; - OwnPtr<Vector<IndexKeys> > nullIndexKeys; - if (!transaction->scheduleTask( - createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction, nullIndexNames.release(), nullIndexKeys.release()))) - ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; -} - void IDBObjectStoreBackendImpl::putWithIndexKeys(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); @@ -176,6 +134,8 @@ void IDBObjectStoreBackendImpl::putWithIndexKeys(PassRefPtr<SerializedScriptValu OwnPtr<Vector<String> > newIndexNames = adoptPtr(new Vector<String>(indexNames)); OwnPtr<Vector<IndexKeys> > newIndexKeys = adoptPtr(new Vector<IndexKeys>(indexKeys)); + ASSERT(autoIncrement() || key); + if (!transaction->scheduleTask( createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction, newIndexNames.release(), newIndexKeys.release()))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; @@ -194,18 +154,19 @@ public: , m_indexKeys(indexKeys) { } - bool generateIndexKeysForValue(SerializedScriptValue* objectValue) + // FIXME: remove this once createIndex() generates these in the renderer. + void generateIndexKeysForValue(SerializedScriptValue* objectValue) { m_indexKeys.clear(); - RefPtr<IDBKey> indexKey = fetchKeyFromKeyPath(objectValue, m_indexMetadata.keyPath); + RefPtr<IDBKey> indexKey = fetchKeyFromKeyPath(objectValue); if (!indexKey) - return true; + return; if (!m_indexMetadata.multiEntry || indexKey->type() != IDBKey::ArrayType) { if (!indexKey->isValid()) - return true; + return; m_indexKeys.append(indexKey); } else { @@ -213,11 +174,9 @@ public: ASSERT(indexKey->type() == IDBKey::ArrayType); indexKey = IDBKey::createMultiEntryArray(indexKey->array()); - for (size_t i = 0; i < indexKey->array().size(); ++i) { + for (size_t i = 0; i < indexKey->array().size(); ++i) m_indexKeys.append(indexKey->array()[i]); - } } - return true; } bool verifyIndexKeys(IDBBackingStore& backingStore, @@ -266,6 +225,21 @@ private: return true; return false; } + + PassRefPtr<IDBKey> fetchKeyFromKeyPath(SerializedScriptValue* value) + { + IDB_TRACE("IndexWriter::fetchKeyFromKeyPath"); + + Vector<RefPtr<SerializedScriptValue> > values; + values.append(value); + Vector<RefPtr<IDBKey> > keys; + IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(values, m_indexMetadata.keyPath, keys); + if (keys.isEmpty()) + return 0; + ASSERT(keys.size() == 1); + return keys[0].release(); + } + const IDBIndexMetadata m_indexMetadata; IDBObjectStoreBackendInterface::IndexKeys m_indexKeys; }; @@ -279,40 +253,18 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< RefPtr<IDBKey> key = prpKey; OwnPtr<Vector<String> > indexNames = popIndexNames; OwnPtr<Vector<IndexKeys> > indexKeys = popIndexKeys; - ASSERT((!indexNames && !indexKeys) || indexNames->size() == indexKeys->size()); + ASSERT(indexNames && indexKeys && indexNames->size() == indexKeys->size()); const bool autoIncrement = objectStore->autoIncrement(); bool keyWasGenerated = false; - if (putMode != CursorUpdate) { - const bool hasKeyPath = !objectStore->m_keyPath.isNull(); - if (hasKeyPath) { - ASSERT(!key); - RefPtr<IDBKey> keyPathKey = fetchKeyFromKeyPath(value.get(), objectStore->m_keyPath); - if (keyPathKey) - key = keyPathKey; - } - if (autoIncrement) { - if (!key) { - RefPtr<IDBKey> autoIncKey = objectStore->generateKey(); - keyWasGenerated = true; - if (!autoIncKey->isValid()) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "Maximum key generator value reached.")); - return; - } - // FIXME: Remove this when get-side key injection is the norm. - if (hasKeyPath) { - RefPtr<SerializedScriptValue> valueAfterInjection = injectKeyIntoKeyPath(autoIncKey, value, objectStore->m_keyPath); - ASSERT(valueAfterInjection); - if (!valueAfterInjection) { - // Checks in put() ensure this should only happen if I/O error occurs. - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error inserting generated key into the object.")); - return; - } - value = valueAfterInjection; - } - key = autoIncKey; - } + if (putMode != CursorUpdate && autoIncrement && !key) { + RefPtr<IDBKey> autoIncKey = objectStore->generateKey(); + keyWasGenerated = true; + if (!autoIncKey->isValid()) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "Maximum key generator value reached.")); + return; } + key = autoIncKey; } ASSERT(key && key->isValid()); @@ -325,9 +277,17 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< Vector<OwnPtr<IndexWriter> > indexWriters; HashMap<String, IndexKeys> indexKeyMap; - if (indexKeys) { - for (size_t i = 0; i < indexNames->size(); ++i) - indexKeyMap.add(indexNames->at(i), indexKeys->at(i)); + for (size_t i = 0; i < indexNames->size(); ++i) { + IndexKeys keys = indexKeys->at(i); + + // If the objectStore is using autoIncrement, then any indexes with an identical keyPath need to also use the primary (generated) key as a key. + if (keyWasGenerated) { + const IDBKeyPath& indexKeyPath = objectStore->m_indexes.get(indexNames->at(i))->keyPath(); + if (indexKeyPath == objectStore->keyPath()) + keys.append(key); + } + + indexKeyMap.add(indexNames->at(i), keys); } for (IndexMap::iterator it = objectStore->m_indexes.begin(); it != objectStore->m_indexes.end(); ++it) { @@ -337,13 +297,8 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< continue; // The index object has been created, but does not exist in the database yet. OwnPtr<IndexWriter> indexWriter; - // FIXME: Turn this into an ASSERT(indexKeys) when get-side key injection is the norm. - if (indexKeys) - indexWriter = adoptPtr(new IndexWriter(index->metadata(), indexKeyMap.get(it->first))); - else { - indexWriter = adoptPtr(new IndexWriter(index->metadata())); - indexWriter->generateIndexKeysForValue(value.get()); - } + indexWriter = adoptPtr(new IndexWriter(index->metadata(), indexKeyMap.get(it->first))); + String errorMessage; if (!indexWriter->verifyIndexKeys(*objectStore->backingStore(), objectStore->databaseId(), diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h index 647bc2978..5b1b54fc2 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h @@ -66,7 +66,6 @@ public: // IDBObjectStoreBackendInterface virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); - virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void putWithIndexKeys(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, const Vector<String>&, const Vector<IndexKeys>&, ExceptionCode&); virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void clear(PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h index 37d3ee0f9..f2fd088c1 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h @@ -57,7 +57,6 @@ public: }; typedef Vector<RefPtr<IDBKey> > IndexKeys; - virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0; virtual void putWithIndexKeys(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, const Vector<String>&, const Vector<IndexKeys>&, ExceptionCode&) = 0; virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0; diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp index a1eaf2930..cd25c3102 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp @@ -339,24 +339,42 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal enqueueEvent(createSuccessEvent()); } +#ifndef NDEBUG +static PassRefPtr<IDBObjectStore> effectiveObjectStore(PassRefPtr<IDBAny> source) +{ + if (source->type() == IDBAny::IDBObjectStoreType) + return source->idbObjectStore(); + if (source->type() == IDBAny::IDBIndexType) + return source->idbIndex()->objectStore(); + + ASSERT_NOT_REACHED(); + return 0; +} +#endif void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScriptValue, PassRefPtr<IDBKey> prpPrimaryKey, const IDBKeyPath& keyPath) { - LOG_ERROR("CHECKING: onSuccess(value, key, keypath)"); - ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; - ASSERT(m_readyState == PENDING); - RefPtr<SerializedScriptValue> serializedScriptValue = prpSerializedScriptValue; #ifndef NDEBUG - // FIXME: Assert until we can actually inject the right value. + ASSERT(keyPath == effectiveObjectStore(m_source)->keyPath()); +#endif + RefPtr<SerializedScriptValue> value = prpSerializedScriptValue; + RefPtr<IDBKey> primaryKey = prpPrimaryKey; - RefPtr<IDBKey> expectedKey = - createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, keyPath); - ASSERT(primaryKey); - ASSERT(expectedKey->isEqual(primaryKey.get())); +#ifndef NDEBUG + RefPtr<IDBKey> expectedKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath); + ASSERT(!expectedKey || expectedKey->isEqual(primaryKey.get())); #endif - onSuccess(serializedScriptValue.release()); + 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()); } void IDBRequest::onSuccessWithContinuation() @@ -458,7 +476,8 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) if (m_transaction) { if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) { m_transaction->setError(m_error); - m_transaction->abort(); + ExceptionCode unused; + m_transaction->abort(unused); } if (event->type() != eventNames().blockedEvent) @@ -475,7 +494,8 @@ void IDBRequest::uncaughtExceptionInEventHandler() { if (m_transaction && !m_requestAborted) { m_transaction->setError(DOMError::create(IDBDatabaseException::getErrorName(IDBDatabaseException::IDB_ABORT_ERR))); - m_transaction->abort(); + ExceptionCode unused; + m_transaction->abort(unused); } } diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index aa9b3f58e..a804c2bd5 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -41,6 +41,7 @@ #include "IDBAny.h" #include "IDBCallbacks.h" #include "IDBCursor.h" +#include "IDBCursorBackendInterface.h" namespace WebCore { diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp index f5e761e6a..761234701 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp @@ -193,10 +193,13 @@ void IDBTransaction::setActive(bool active) m_backend->commit(); } -void IDBTransaction::abort() +void IDBTransaction::abort(ExceptionCode& ec) { - if (m_state == Finishing || m_state == Finished) + if (m_state == Finishing || m_state == Finished) { + ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; return; + } + m_state = Finishing; m_active = false; @@ -387,7 +390,8 @@ void IDBTransaction::stop() ActiveDOMObject::stop(); m_contextStopped = true; - abort(); + ExceptionCode unused; + abort(unused); } void IDBTransaction::enqueueEvent(PassRefPtr<Event> event) diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.h b/Source/WebCore/Modules/indexeddb/IDBTransaction.h index 30378627f..1f7af7dad 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.h +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.h @@ -78,7 +78,7 @@ public: IDBDatabase* db() const { return m_database.get(); } PassRefPtr<DOMError> error() const { return m_error; } PassRefPtr<IDBObjectStore> objectStore(const String& name, ExceptionCode&); - void abort(); + void abort(ExceptionCode&); class OpenCursorNotifier { public: diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.idl b/Source/WebCore/Modules/indexeddb/IDBTransaction.idl index dfa9ed9a1..b5c207dee 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.idl +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.idl @@ -44,7 +44,8 @@ module storage { // Methods IDBObjectStore objectStore (in DOMString name) raises (IDBDatabaseException); - void abort (); + void abort () + raises (IDBDatabaseException); // Events attribute EventListener onabort; diff --git a/Source/WebCore/Modules/mediasource/SourceBuffer.cpp b/Source/WebCore/Modules/mediasource/SourceBuffer.cpp new file mode 100644 index 000000000..7b368216a --- /dev/null +++ b/Source/WebCore/Modules/mediasource/SourceBuffer.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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SourceBuffer.h" + +#if ENABLE(MEDIA_SOURCE) + +#include "TimeRanges.h" +#include <wtf/Uint8Array.h> + +namespace WebCore { + +SourceBuffer::SourceBuffer(const String& id) + : m_id(id) +{ +} + +SourceBuffer::~SourceBuffer() +{ +} + +PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionCode&) const +{ + // FIXME(91773): return buffered data from media source. + return 0; +} + +void SourceBuffer::append(PassRefPtr<Uint8Array>, ExceptionCode&) +{ + // FIXME(91773): append the data to the media source. +} + +void SourceBuffer::abort(ExceptionCode&) +{ + // FIXME(91773): signal the media source to abort this source buffer. +} + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/Modules/mediasource/SourceBuffer.h b/Source/WebCore/Modules/mediasource/SourceBuffer.h new file mode 100644 index 000000000..0cbff3e13 --- /dev/null +++ b/Source/WebCore/Modules/mediasource/SourceBuffer.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SourceBuffer_h +#define SourceBuffer_h + +#if ENABLE(MEDIA_SOURCE) + +#include "ExceptionCode.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class TimeRanges; + +class SourceBuffer : public RefCounted<SourceBuffer> { +public: + static PassRefPtr<SourceBuffer> create(const String& id) + { + return adoptRef(new SourceBuffer(id)); + } + + virtual ~SourceBuffer(); + + PassRefPtr<TimeRanges> buffered(ExceptionCode&) const; + + void append(PassRefPtr<Uint8Array> data, ExceptionCode&); + + void abort(ExceptionCode&); + + const String& id() const { return m_id; } + + void clear() { } + +private: + explicit SourceBuffer(const String& id); + + String m_id; +}; + +} // namespace WebCore + +#endif +#endif diff --git a/Source/WebCore/Modules/mediasource/SourceBuffer.idl b/Source/WebCore/Modules/mediasource/SourceBuffer.idl new file mode 100644 index 000000000..412b9cb61 --- /dev/null +++ b/Source/WebCore/Modules/mediasource/SourceBuffer.idl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + Conditional=MEDIA_SOURCE, + V8EnabledAtRuntime=mediaSource + ] SourceBuffer { + + // Returns the time ranges buffered. + readonly attribute TimeRanges buffered + getter raises(DOMException); + + // Append segment data. + void append(in Uint8Array data) raises (DOMException); + + // Abort the current segment append sequence. + void abort() raises (DOMException); + }; + +} diff --git a/Source/WebCore/Modules/mediasource/SourceBufferList.cpp b/Source/WebCore/Modules/mediasource/SourceBufferList.cpp new file mode 100644 index 000000000..3cc467831 --- /dev/null +++ b/Source/WebCore/Modules/mediasource/SourceBufferList.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SourceBufferList.h" + +#if ENABLE(MEDIA_SOURCE) + +#include "Event.h" + +namespace WebCore { + +SourceBufferList::SourceBufferList(ScriptExecutionContext* context) + : m_scriptExecutionContext(context) +{ +} + +unsigned long SourceBufferList::length() const +{ + return m_list.size(); +} + +SourceBuffer* SourceBufferList::item(unsigned index) const +{ + if (index >= m_list.size()) + return 0; + return m_list[index].get(); +} + +void SourceBufferList::add(PassRefPtr<SourceBuffer> buffer) +{ + m_list.append(buffer); + createAndFireEvent(eventNames().webkitaddsourcebufferEvent); +} + +bool SourceBufferList::remove(SourceBuffer* buffer) +{ + size_t index = m_list.find(buffer); + if (index == notFound) + return false; + + m_list.remove(index); + buffer->clear(); + createAndFireEvent(eventNames().webkitremovesourcebufferEvent); + return true; +} + +void SourceBufferList::clear() +{ + for (size_t i = 0; i < m_list.size(); ++i) + remove(m_list[i].get()); +} + +void SourceBufferList::createAndFireEvent(const AtomicString& eventName) +{ + RefPtr<Event> event = Event::create(eventName, false, false); + event->setTarget(this); + + EventTarget::dispatchEvent(event); +} + +const AtomicString& SourceBufferList::interfaceName() const +{ + return eventNames().interfaceForSourceBufferList; +} + +ScriptExecutionContext* SourceBufferList::scriptExecutionContext() const +{ + return m_scriptExecutionContext; +} + +EventTargetData* SourceBufferList::eventTargetData() +{ + return &m_eventTargetData; +} + +EventTargetData* SourceBufferList::ensureEventTargetData() +{ + return &m_eventTargetData; +} + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/Modules/mediasource/SourceBufferList.h b/Source/WebCore/Modules/mediasource/SourceBufferList.h new file mode 100644 index 000000000..7e9f83152 --- /dev/null +++ b/Source/WebCore/Modules/mediasource/SourceBufferList.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SourceBufferList_h +#define SourceBufferList_h + +#if ENABLE(MEDIA_SOURCE) + +#include "EventTarget.h" +#include "SourceBuffer.h" +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class SourceBufferList : public RefCounted<SourceBufferList>, public EventTarget { +public: + static PassRefPtr<SourceBufferList> create(ScriptExecutionContext* context) + { + return adoptRef(new SourceBufferList(context)); + } + virtual ~SourceBufferList() { } + + unsigned long length() const; + SourceBuffer* item(unsigned index) const; + + void add(PassRefPtr<SourceBuffer>); + bool remove(SourceBuffer*); + void clear(); + + // EventTarget interface + virtual const AtomicString& interfaceName() const OVERRIDE; + virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; + + using RefCounted<SourceBufferList>::ref; + using RefCounted<SourceBufferList>::deref; + +protected: + virtual EventTargetData* eventTargetData() OVERRIDE; + virtual EventTargetData* ensureEventTargetData() OVERRIDE; + +private: + explicit SourceBufferList(ScriptExecutionContext*); + + void createAndFireEvent(const AtomicString&); + + virtual void refEventTarget() OVERRIDE { ref(); } + virtual void derefEventTarget() OVERRIDE { deref(); } + + EventTargetData m_eventTargetData; + ScriptExecutionContext* m_scriptExecutionContext; + + Vector<RefPtr<SourceBuffer> > m_list; +}; + +} // namespace WebCore + +#endif +#endif diff --git a/Source/WebCore/Modules/mediasource/SourceBufferList.idl b/Source/WebCore/Modules/mediasource/SourceBufferList.idl new file mode 100644 index 000000000..39eddcaa8 --- /dev/null +++ b/Source/WebCore/Modules/mediasource/SourceBufferList.idl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + Conditional=MEDIA_SOURCE, + V8EnabledAtRuntime=mediaSource, + IndexedGetter, + EventTarget, + CallWith=ScriptExecutionContext + ] SourceBufferList { + readonly attribute unsigned long length; + SourceBuffer item(in unsigned long index); + + // EventTarget interface + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event event) + raises(EventException); + }; + +} diff --git a/Source/WebCore/Modules/mediastream/DOMWindowMediaStream.idl b/Source/WebCore/Modules/mediastream/DOMWindowMediaStream.idl index 970d10644..742a62463 100644 --- a/Source/WebCore/Modules/mediastream/DOMWindowMediaStream.idl +++ b/Source/WebCore/Modules/mediastream/DOMWindowMediaStream.idl @@ -30,7 +30,6 @@ module window { Conditional=MEDIA_STREAM, Supplemental=DOMWindow ] DOMWindowMediaStream { - attribute [V8EnabledAtRuntime] DeprecatedPeerConnectionConstructor webkitDeprecatedPeerConnection; attribute [V8EnabledAtRuntime] MediaStreamConstructor webkitMediaStream; attribute [V8EnabledAtRuntime] PeerConnection00Constructor webkitPeerConnection00; attribute SessionDescriptionConstructor SessionDescription; diff --git a/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.cpp b/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.cpp deleted file mode 100644 index 9d0469045..000000000 --- a/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * Copyright (C) 2011 Ericsson AB. 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 "DeprecatedPeerConnection.h" - -#if ENABLE(MEDIA_STREAM) - -#include "ExceptionCode.h" -#include "MediaStreamEvent.h" -#include "MessageEvent.h" -#include "ScriptExecutionContext.h" -#include "SecurityOrigin.h" - -namespace WebCore { - -PassRefPtr<DeprecatedPeerConnection> DeprecatedPeerConnection::create(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<SignalingCallback> signalingCallback) -{ - RefPtr<DeprecatedPeerConnection> connection = adoptRef(new DeprecatedPeerConnection(context, serverConfiguration, signalingCallback)); - connection->setPendingActivity(connection.get()); - connection->scheduleInitialNegotiation(); - connection->suspendIfNeeded(); - - return connection.release(); -} - -DeprecatedPeerConnection::DeprecatedPeerConnection(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<SignalingCallback> signalingCallback) - : ActiveDOMObject(context, this) - , m_signalingCallback(signalingCallback) - , m_readyState(NEW) - , m_iceStarted(false) - , m_localStreams(MediaStreamList::create()) - , m_remoteStreams(MediaStreamList::create()) - , m_initialNegotiationTimer(this, &DeprecatedPeerConnection::initialNegotiationTimerFired) - , m_streamChangeTimer(this, &DeprecatedPeerConnection::streamChangeTimerFired) - , m_readyStateChangeTimer(this, &DeprecatedPeerConnection::readyStateChangeTimerFired) - , m_peerHandler(DeprecatedPeerConnectionHandler::create(this, serverConfiguration, context->securityOrigin()->toString())) -{ -} - -DeprecatedPeerConnection::~DeprecatedPeerConnection() -{ -} - -void DeprecatedPeerConnection::processSignalingMessage(const String& message, ExceptionCode& ec) -{ - if (m_readyState == CLOSED) { - ec = INVALID_STATE_ERR; - return; - } - - if (!message.startsWith("SDP\n")) - return; - - String sdp = message.substring(4); - - if (m_iceStarted) { - if (m_peerHandler) - m_peerHandler->processSDP(sdp); - return; - } - - if (m_peerHandler) - m_peerHandler->handleInitialOffer(sdp); - - ensureStreamChangeScheduled(); - m_iceStarted = true; - scheduleReadyStateChange(NEGOTIATING); -} - -DeprecatedPeerConnection::ReadyState DeprecatedPeerConnection::readyState() const -{ - return m_readyState; -} - -void DeprecatedPeerConnection::send(const String& text, ExceptionCode& ec) -{ - if (m_readyState == CLOSED) { - ec = INVALID_STATE_ERR; - return; - } - - CString data = text.utf8(); - unsigned length = data.length(); - - if (length > 504) { - ec = INVALID_ACCESS_ERR; - return; - } - - if (m_peerHandler) - m_peerHandler->sendDataStreamMessage(data.data(), length); -} - -void DeprecatedPeerConnection::addStream(PassRefPtr<MediaStream> prpStream, ExceptionCode& ec) -{ - RefPtr<MediaStream> stream = prpStream; - if (!stream) { - ec = TYPE_MISMATCH_ERR; - return; - } - - if (m_readyState == CLOSED) { - ec = INVALID_STATE_ERR; - return; - } - - if (m_localStreams->contains(stream.get())) - return; - - m_localStreams->append(stream); - - MediaStreamDescriptor* streamDescriptor = stream->descriptor(); - size_t i = m_pendingRemoveStreams.find(streamDescriptor); - if (i != notFound) { - m_pendingRemoveStreams.remove(i); - return; - } - - m_pendingAddStreams.append(streamDescriptor); - if (m_iceStarted) - ensureStreamChangeScheduled(); -} - -void DeprecatedPeerConnection::removeStream(MediaStream* stream, ExceptionCode& ec) -{ - if (m_readyState == CLOSED) { - ec = INVALID_STATE_ERR; - return; - } - - if (!stream) { - ec = TYPE_MISMATCH_ERR; - return; - } - - if (!m_localStreams->contains(stream)) - return; - - m_localStreams->remove(stream); - - MediaStreamDescriptor* streamDescriptor = stream->descriptor(); - size_t i = m_pendingAddStreams.find(streamDescriptor); - if (i != notFound) { - m_pendingAddStreams.remove(i); - return; - } - - m_pendingRemoveStreams.append(streamDescriptor); - if (m_iceStarted) - ensureStreamChangeScheduled(); -} - -MediaStreamList* DeprecatedPeerConnection::localStreams() const -{ - return m_localStreams.get(); -} - -MediaStreamList* DeprecatedPeerConnection::remoteStreams() const -{ - return m_remoteStreams.get(); -} - -void DeprecatedPeerConnection::close(ExceptionCode& ec) -{ - if (m_readyState == CLOSED) { - ec = INVALID_STATE_ERR; - return; - } - - stop(); -} - -void DeprecatedPeerConnection::didCompleteICEProcessing() -{ - ASSERT(scriptExecutionContext()->isContextThread()); - changeReadyState(ACTIVE); -} - -void DeprecatedPeerConnection::didGenerateSDP(const String& sdp) -{ - ASSERT(scriptExecutionContext()->isContextThread()); - m_signalingCallback->handleEvent("SDP\n" + sdp, this); -} - -void DeprecatedPeerConnection::didReceiveDataStreamMessage(const char* data, size_t length) -{ - ASSERT(scriptExecutionContext()->isContextThread()); - const String& message = String::fromUTF8(data, length); - dispatchEvent(MessageEvent::create(PassOwnPtr<MessagePortArray>(), SerializedScriptValue::create(message))); -} - -void DeprecatedPeerConnection::didAddRemoteStream(PassRefPtr<MediaStreamDescriptor> streamDescriptor) -{ - ASSERT(scriptExecutionContext()->isContextThread()); - - if (m_readyState == CLOSED) - return; - - RefPtr<MediaStream> stream = MediaStream::create(scriptExecutionContext(), streamDescriptor); - m_remoteStreams->append(stream); - - dispatchEvent(MediaStreamEvent::create(eventNames().addstreamEvent, false, false, stream.release())); -} - -void DeprecatedPeerConnection::didRemoveRemoteStream(MediaStreamDescriptor* streamDescriptor) -{ - ASSERT(scriptExecutionContext()->isContextThread()); - ASSERT(streamDescriptor->owner()); - - RefPtr<MediaStream> stream = static_cast<MediaStream*>(streamDescriptor->owner()); - stream->streamEnded(); - - if (m_readyState == CLOSED) - return; - - ASSERT(m_remoteStreams->contains(stream.get())); - m_remoteStreams->remove(stream.get()); - - dispatchEvent(MediaStreamEvent::create(eventNames().removestreamEvent, false, false, stream.release())); -} - -const AtomicString& DeprecatedPeerConnection::interfaceName() const -{ - return eventNames().interfaceForDeprecatedPeerConnection; -} - -ScriptExecutionContext* DeprecatedPeerConnection::scriptExecutionContext() const -{ - return ActiveDOMObject::scriptExecutionContext(); -} - -void DeprecatedPeerConnection::stop() -{ - if (m_readyState == CLOSED) - return; - - m_initialNegotiationTimer.stop(); - m_streamChangeTimer.stop(); - m_readyStateChangeTimer.stop(); - - if (m_peerHandler) - m_peerHandler->stop(); - - unsetPendingActivity(this); - m_peerHandler.clear(); - - changeReadyState(CLOSED); -} - -EventTargetData* DeprecatedPeerConnection::eventTargetData() -{ - return &m_eventTargetData; -} - -EventTargetData* DeprecatedPeerConnection::ensureEventTargetData() -{ - return &m_eventTargetData; -} - -void DeprecatedPeerConnection::scheduleInitialNegotiation() -{ - ASSERT(!m_initialNegotiationTimer.isActive()); - - m_initialNegotiationTimer.startOneShot(0); -} - -void DeprecatedPeerConnection::initialNegotiationTimerFired(Timer<DeprecatedPeerConnection>* timer) -{ - ASSERT_UNUSED(timer, timer == &m_initialNegotiationTimer); - - if (m_iceStarted) - return; - - MediaStreamDescriptorVector pendingAddStreams; - m_pendingAddStreams.swap(pendingAddStreams); - if (m_peerHandler) - m_peerHandler->produceInitialOffer(pendingAddStreams); - - m_iceStarted = true; - - changeReadyState(NEGOTIATING); -} - -void DeprecatedPeerConnection::ensureStreamChangeScheduled() -{ - if (!m_streamChangeTimer.isActive()) - m_streamChangeTimer.startOneShot(0); -} - -void DeprecatedPeerConnection::streamChangeTimerFired(Timer<DeprecatedPeerConnection>* timer) -{ - ASSERT_UNUSED(timer, timer == &m_streamChangeTimer); - - if (!m_pendingAddStreams.isEmpty() && !m_pendingRemoveStreams.isEmpty()) - return; - - MediaStreamDescriptorVector pendingAddStreams; - MediaStreamDescriptorVector pendingRemoveStreams; - - m_pendingAddStreams.swap(pendingAddStreams); - m_pendingRemoveStreams.swap(pendingRemoveStreams); - - if (m_peerHandler) - m_peerHandler->processPendingStreams(pendingAddStreams, pendingRemoveStreams); - - if (!pendingAddStreams.isEmpty()) - changeReadyState(NEGOTIATING); -} - -void DeprecatedPeerConnection::scheduleReadyStateChange(ReadyState readyState) -{ - m_pendingReadyStates.append(readyState); - if (!m_readyStateChangeTimer.isActive()) - m_readyStateChangeTimer.startOneShot(0); -} - -void DeprecatedPeerConnection::readyStateChangeTimerFired(Timer<DeprecatedPeerConnection>* timer) -{ - ASSERT_UNUSED(timer, timer == &m_readyStateChangeTimer); - - Vector<ReadyState> pendingReadyStates; - m_pendingReadyStates.swap(pendingReadyStates); - - for (size_t i = 0; i < pendingReadyStates.size(); i++) - changeReadyState(pendingReadyStates[i]); -} - -void DeprecatedPeerConnection::changeReadyState(ReadyState readyState) -{ - if (readyState == m_readyState) - return; - - m_readyState = readyState; - - switch (m_readyState) { - case NEW: - ASSERT_NOT_REACHED(); - break; - case NEGOTIATING: - dispatchEvent(Event::create(eventNames().connectingEvent, false, false)); - break; - case ACTIVE: - dispatchEvent(Event::create(eventNames().openEvent, false, false)); - break; - case CLOSED: - break; - } - - dispatchEvent(Event::create(eventNames().statechangeEvent, false, false)); -} - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.h b/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.h deleted file mode 100644 index d452848b7..000000000 --- a/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * Copyright (C) 2011 Ericsson AB. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DeprecatedPeerConnection_h -#define DeprecatedPeerConnection_h - -#if ENABLE(MEDIA_STREAM) - -#include "ActiveDOMObject.h" -#include "DeprecatedPeerConnectionHandler.h" -#include "DeprecatedPeerConnectionHandlerClient.h" -#include "EventTarget.h" -#include "ExceptionBase.h" -#include "MediaStream.h" -#include "MediaStreamList.h" -#include "SignalingCallback.h" -#include "Timer.h" -#include <wtf/OwnPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -// Note: -// SDP stands for Session Description Protocol, which is intended for describing -// multimedia sessions for the purposes of session announcement, session -// invitation, and other forms of multimedia session initiation. -// -// More information can be found here: -// http://tools.ietf.org/html/rfc4566 -// http://en.wikipedia.org/wiki/Session_Description_Protocol - -class DeprecatedPeerConnection : public RefCounted<DeprecatedPeerConnection>, public DeprecatedPeerConnectionHandlerClient, public EventTarget, public ActiveDOMObject { -public: - static PassRefPtr<DeprecatedPeerConnection> create(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<SignalingCallback>); - ~DeprecatedPeerConnection(); - - void processSignalingMessage(const String& message, ExceptionCode&); - - ReadyState readyState() const; - - void send(const String& text, ExceptionCode&); - void addStream(const PassRefPtr<MediaStream>, ExceptionCode&); - void removeStream(MediaStream*, ExceptionCode&); - MediaStreamList* localStreams() const; - MediaStreamList* remoteStreams() const; - void close(ExceptionCode&); - - DEFINE_ATTRIBUTE_EVENT_LISTENER(connecting); - DEFINE_ATTRIBUTE_EVENT_LISTENER(open); - DEFINE_ATTRIBUTE_EVENT_LISTENER(message); - DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); - DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); - DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); - - // PeerConnectionHandlerClient - virtual void didCompleteICEProcessing(); - virtual void didGenerateSDP(const String& sdp); - virtual void didReceiveDataStreamMessage(const char* data, size_t length); - virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>); - virtual void didRemoveRemoteStream(MediaStreamDescriptor*); - virtual void didChangeState(ReadyState state) { changeReadyState(state); } - - // EventTarget - virtual const AtomicString& interfaceName() const; - virtual ScriptExecutionContext* scriptExecutionContext() const; - - // ActiveDOMObject - virtual void stop(); - - using RefCounted<DeprecatedPeerConnection>::ref; - using RefCounted<DeprecatedPeerConnection>::deref; - -private: - DeprecatedPeerConnection(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<SignalingCallback>); - - // EventTarget implementation. - virtual EventTargetData* eventTargetData(); - virtual EventTargetData* ensureEventTargetData(); - virtual void refEventTarget() { ref(); } - virtual void derefEventTarget() { deref(); } - - void scheduleInitialNegotiation(); - void initialNegotiationTimerFired(Timer<DeprecatedPeerConnection>*); - void ensureStreamChangeScheduled(); - void streamChangeTimerFired(Timer<DeprecatedPeerConnection>*); - void scheduleReadyStateChange(ReadyState); - void readyStateChangeTimerFired(Timer<DeprecatedPeerConnection>*); - - void changeReadyState(ReadyState); - - RefPtr<SignalingCallback> m_signalingCallback; - - ReadyState m_readyState; - bool m_iceStarted; - - RefPtr<MediaStreamList> m_localStreams; - RefPtr<MediaStreamList> m_remoteStreams; - - // EventTarget implementation. - EventTargetData m_eventTargetData; - - Timer<DeprecatedPeerConnection> m_initialNegotiationTimer; - Timer<DeprecatedPeerConnection> m_streamChangeTimer; - Timer<DeprecatedPeerConnection> m_readyStateChangeTimer; - - MediaStreamDescriptorVector m_pendingAddStreams; - MediaStreamDescriptorVector m_pendingRemoveStreams; - Vector<ReadyState> m_pendingReadyStates; - - OwnPtr<DeprecatedPeerConnectionHandler> m_peerHandler; -}; - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) - -#endif // DeprecatedPeerConnection_h diff --git a/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.idl b/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.idl deleted file mode 100644 index 01d9d51f5..000000000 --- a/Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.idl +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module p2p { - - interface [ - Conditional=MEDIA_STREAM, - ActiveDOMObject, - ConstructorParameters=2, - Constructor(in DOMString serverConfiguration, in [Callback] SignalingCallback signalingCallback), - CallWith=ScriptExecutionContext, - JSCustomConstructor, - EventTarget - ] DeprecatedPeerConnection { - void processSignalingMessage(in DOMString message) - raises(DOMException); - - const unsigned short NEW = 0; - const unsigned short NEGOTIATING = 1; - const unsigned short ACTIVE = 2; - const unsigned short CLOSED = 3; - readonly attribute unsigned short readyState; - - void send(in DOMString text) - raises(DOMException); - [StrictTypeChecking] void addStream(in MediaStream stream) - raises(DOMException); - [StrictTypeChecking] void removeStream(in MediaStream stream) - raises(DOMException); - - readonly attribute MediaStreamList localStreams; - readonly attribute MediaStreamList remoteStreams; - - void close() - raises(DOMException); - - attribute EventListener onconnecting; - attribute EventListener onopen; - attribute EventListener onmessage; - attribute EventListener onstatechange; - attribute EventListener onaddstream; - attribute EventListener onremovestream; - - // EventTarget interface - void addEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - void removeEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - boolean dispatchEvent(in Event event) - raises(EventException); - }; - -} diff --git a/Source/WebCore/Modules/mediastream/IceCandidate.h b/Source/WebCore/Modules/mediastream/IceCandidate.h index c5ef120b1..810beb52d 100644 --- a/Source/WebCore/Modules/mediastream/IceCandidate.h +++ b/Source/WebCore/Modules/mediastream/IceCandidate.h @@ -56,7 +56,7 @@ public: IceCandidateDescriptor* descriptor(); private: - IceCandidate(PassRefPtr<IceCandidateDescriptor>); + explicit IceCandidate(PassRefPtr<IceCandidateDescriptor>); RefPtr<IceCandidateDescriptor> m_descriptor; }; diff --git a/Source/WebCore/Modules/mediastream/MediaStream.cpp b/Source/WebCore/Modules/mediastream/MediaStream.cpp index e4efc49b7..ce8e2655e 100644 --- a/Source/WebCore/Modules/mediastream/MediaStream.cpp +++ b/Source/WebCore/Modules/mediastream/MediaStream.cpp @@ -94,14 +94,14 @@ MediaStream::MediaStream(ScriptExecutionContext* context, PassRefPtr<MediaStream size_t numberOfAudioTracks = m_descriptor->numberOfAudioComponents(); audioTrackVector.reserveCapacity(numberOfAudioTracks); for (size_t i = 0; i < numberOfAudioTracks; i++) - audioTrackVector.append(MediaStreamTrack::create(m_descriptor, m_descriptor->audioComponent(i))); + audioTrackVector.append(MediaStreamTrack::create(context, m_descriptor, m_descriptor->audioComponent(i))); m_audioTracks = MediaStreamTrackList::create(this, audioTrackVector); MediaStreamTrackVector videoTrackVector; size_t numberOfVideoTracks = m_descriptor->numberOfVideoComponents(); videoTrackVector.reserveCapacity(numberOfVideoTracks); for (size_t i = 0; i < numberOfVideoTracks; i++) - videoTrackVector.append(MediaStreamTrack::create(m_descriptor, m_descriptor->videoComponent(i))); + videoTrackVector.append(MediaStreamTrack::create(context, m_descriptor, m_descriptor->videoComponent(i))); m_videoTracks = MediaStreamTrackList::create(this, videoTrackVector); } @@ -151,7 +151,7 @@ EventTargetData* MediaStream::ensureEventTargetData() void MediaStream::addTrack(MediaStreamComponent* component) { - RefPtr<MediaStreamTrack> track = MediaStreamTrack::create(m_descriptor, component); + RefPtr<MediaStreamTrack> track = MediaStreamTrack::create(scriptExecutionContext(), m_descriptor, component); ExceptionCode ec = 0; switch (component->source()->type()) { case MediaStreamSource::TypeAudio: diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp index f2277496c..fa071fef2 100644 --- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp +++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp @@ -28,24 +28,31 @@ #if ENABLE(MEDIA_STREAM) +#include "Event.h" #include "MediaStreamCenter.h" #include "MediaStreamComponent.h" namespace WebCore { -PassRefPtr<MediaStreamTrack> MediaStreamTrack::create(PassRefPtr<MediaStreamDescriptor> streamDescriptor, MediaStreamComponent* component) +PassRefPtr<MediaStreamTrack> MediaStreamTrack::create(ScriptExecutionContext* context, PassRefPtr<MediaStreamDescriptor> streamDescriptor, MediaStreamComponent* component) { - return adoptRef(new MediaStreamTrack(streamDescriptor, component)); + RefPtr<MediaStreamTrack> track = adoptRef(new MediaStreamTrack(context, streamDescriptor, component)); + track->suspendIfNeeded(); + return track.release(); } -MediaStreamTrack::MediaStreamTrack(PassRefPtr<MediaStreamDescriptor> streamDescriptor, MediaStreamComponent* component) - : m_streamDescriptor(streamDescriptor) +MediaStreamTrack::MediaStreamTrack(ScriptExecutionContext* context, PassRefPtr<MediaStreamDescriptor> streamDescriptor, MediaStreamComponent* component) + : ActiveDOMObject(context, this) + , m_stopped(false) + , m_streamDescriptor(streamDescriptor) , m_component(component) { + m_component->source()->addObserver(this); } MediaStreamTrack::~MediaStreamTrack() { + m_component->source()->removeObserver(this); } String MediaStreamTrack::kind() const @@ -76,7 +83,7 @@ bool MediaStreamTrack::enabled() const void MediaStreamTrack::setEnabled(bool enabled) { - if (enabled == m_component->enabled()) + if (m_stopped || enabled == m_component->enabled()) return; m_component->setEnabled(enabled); @@ -87,11 +94,72 @@ void MediaStreamTrack::setEnabled(bool enabled) MediaStreamCenter::instance().didSetMediaStreamTrackEnabled(m_streamDescriptor.get(), m_component.get()); } +MediaStreamTrack::ReadyState MediaStreamTrack::readyState() const +{ + if (m_stopped) + return ENDED; + + switch (m_component->source()->readyState()) { + case MediaStreamSource::ReadyStateLive: + return LIVE; + case MediaStreamSource::ReadyStateMuted: + return MUTED; + case MediaStreamSource::ReadyStateEnded: + return ENDED; + } + + ASSERT_NOT_REACHED(); + return ENDED; +} + +void MediaStreamTrack::sourceChangedState() +{ + if (m_stopped) + return; + + switch (m_component->source()->readyState()) { + case MediaStreamSource::ReadyStateLive: + dispatchEvent(Event::create(eventNames().unmuteEvent, false, false)); + break; + case MediaStreamSource::ReadyStateMuted: + dispatchEvent(Event::create(eventNames().muteEvent, false, false)); + break; + case MediaStreamSource::ReadyStateEnded: + dispatchEvent(Event::create(eventNames().endedEvent, false, false)); + break; + } +} + MediaStreamComponent* MediaStreamTrack::component() { return m_component.get(); } +void MediaStreamTrack::stop() +{ + m_stopped = true; +} + +const AtomicString& MediaStreamTrack::interfaceName() const +{ + return eventNames().interfaceForMediaStreamTrack; +} + +ScriptExecutionContext* MediaStreamTrack::scriptExecutionContext() const +{ + return ActiveDOMObject::scriptExecutionContext(); +} + +EventTargetData* MediaStreamTrack::eventTargetData() +{ + return &m_eventTargetData; +} + +EventTargetData* MediaStreamTrack::ensureEventTargetData() +{ + return &m_eventTargetData; +} + } // namespace WebCore #endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h index c45be18c7..724a120dc 100644 --- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h +++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h @@ -28,7 +28,10 @@ #if ENABLE(MEDIA_STREAM) +#include "ActiveDOMObject.h" +#include "EventTarget.h" #include "MediaStreamDescriptor.h" +#include "MediaStreamSource.h" #include "PlatformString.h" #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -38,9 +41,15 @@ namespace WebCore { class MediaStreamComponent; -class MediaStreamTrack : public RefCounted<MediaStreamTrack> { +class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ActiveDOMObject, public EventTarget, public MediaStreamSource::Observer { public: - static PassRefPtr<MediaStreamTrack> create(PassRefPtr<MediaStreamDescriptor>, MediaStreamComponent*); + enum ReadyState { + LIVE = 0, + MUTED = 1, + ENDED = 2 + }; + + static PassRefPtr<MediaStreamTrack> create(ScriptExecutionContext*, PassRefPtr<MediaStreamDescriptor>, MediaStreamComponent*); virtual ~MediaStreamTrack(); String kind() const; @@ -49,11 +58,38 @@ public: bool enabled() const; void setEnabled(bool); + ReadyState readyState() const; + + DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); + DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); + DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); + MediaStreamComponent* component(); + // EventTarget + virtual const AtomicString& interfaceName() const OVERRIDE; + virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; + + // ActiveDOMObject + virtual void stop() OVERRIDE; + + using RefCounted<MediaStreamTrack>::ref; + using RefCounted<MediaStreamTrack>::deref; + private: - MediaStreamTrack(PassRefPtr<MediaStreamDescriptor>, MediaStreamComponent*); + MediaStreamTrack(ScriptExecutionContext*, PassRefPtr<MediaStreamDescriptor>, MediaStreamComponent*); + + // EventTarget + virtual EventTargetData* eventTargetData() OVERRIDE; + virtual EventTargetData* ensureEventTargetData() OVERRIDE; + virtual void refEventTarget() OVERRIDE { ref(); } + virtual void derefEventTarget() OVERRIDE { deref(); } + EventTargetData m_eventTargetData; + + // MediaStreamSourceObserver + virtual void sourceChangedState() OVERRIDE; + bool m_stopped; RefPtr<MediaStreamDescriptor> m_streamDescriptor; RefPtr<MediaStreamComponent> m_component; }; diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl b/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl index 79875975e..e103ce23b 100644 --- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl +++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl @@ -26,10 +26,31 @@ module core { interface [ Conditional=MEDIA_STREAM, + EventTarget, + ActiveDOMObject ] MediaStreamTrack { readonly attribute DOMString kind; readonly attribute DOMString label; attribute boolean enabled; + + const unsigned short LIVE = 0; + const unsigned short MUTED = 1; + const unsigned short ENDED = 2; + readonly attribute unsigned short readyState; + + attribute EventListener onmute; + attribute EventListener onunmute; + attribute EventListener onended; + + // EventTarget interface + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event event) + raises(EventException); }; } diff --git a/Source/WebCore/Modules/mediastream/NavigatorUserMediaError.h b/Source/WebCore/Modules/mediastream/NavigatorUserMediaError.h index 5edd97d90..d5089c818 100644 --- a/Source/WebCore/Modules/mediastream/NavigatorUserMediaError.h +++ b/Source/WebCore/Modules/mediastream/NavigatorUserMediaError.h @@ -49,7 +49,7 @@ public: ErrorCode code() const { return m_code; } private: - NavigatorUserMediaError(ErrorCode code) : m_code(code) { } + explicit NavigatorUserMediaError(ErrorCode code) : m_code(code) { } ErrorCode m_code; }; diff --git a/Source/WebCore/Modules/mediastream/SessionDescription.h b/Source/WebCore/Modules/mediastream/SessionDescription.h index 011585376..f8f92cba9 100644 --- a/Source/WebCore/Modules/mediastream/SessionDescription.h +++ b/Source/WebCore/Modules/mediastream/SessionDescription.h @@ -55,7 +55,7 @@ public: SessionDescriptionDescriptor* descriptor(); private: - SessionDescription(PassRefPtr<SessionDescriptionDescriptor>); + explicit SessionDescription(PassRefPtr<SessionDescriptionDescriptor>); RefPtr<SessionDescriptionDescriptor> m_descriptor; }; diff --git a/Source/WebCore/Modules/mediastream/UserMediaController.h b/Source/WebCore/Modules/mediastream/UserMediaController.h index dd85c0341..e595338a2 100644 --- a/Source/WebCore/Modules/mediastream/UserMediaController.h +++ b/Source/WebCore/Modules/mediastream/UserMediaController.h @@ -46,7 +46,7 @@ public: static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(Supplement<Page>::from(page, supplementName())); } protected: - UserMediaController(UserMediaClient*); + explicit UserMediaController(UserMediaClient*); private: UserMediaClient* m_client; diff --git a/Source/WebCore/Modules/notifications/NotificationCenter.cpp b/Source/WebCore/Modules/notifications/NotificationCenter.cpp index 0ebb54740..1d2136d84 100644 --- a/Source/WebCore/Modules/notifications/NotificationCenter.cpp +++ b/Source/WebCore/Modules/notifications/NotificationCenter.cpp @@ -56,6 +56,13 @@ NotificationCenter::NotificationCenter(ScriptExecutionContext* context, Notifica } #if ENABLE(LEGACY_NOTIFICATIONS) +Document* NotificationCenter::document() const { + ScriptExecutionContext* context = scriptExecutionContext(); + return context->isDocument() ? static_cast<Document*>(context) : 0; +} +#endif + +#if ENABLE(LEGACY_NOTIFICATIONS) int NotificationCenter::checkPermission() { if (!client() || !scriptExecutionContext()) diff --git a/Source/WebCore/Modules/notifications/NotificationCenter.h b/Source/WebCore/Modules/notifications/NotificationCenter.h index 3f6d68902..05fcfb30e 100644 --- a/Source/WebCore/Modules/notifications/NotificationCenter.h +++ b/Source/WebCore/Modules/notifications/NotificationCenter.h @@ -84,6 +84,7 @@ public: #if ENABLE(LEGACY_NOTIFICATIONS) int checkPermission(); void requestPermission(PassRefPtr<VoidCallback>); + Document* document() const; #endif virtual void stop() OVERRIDE; diff --git a/Source/WebCore/Modules/notifications/NotificationCenter.idl b/Source/WebCore/Modules/notifications/NotificationCenter.idl index da99ba9ff..60651da4c 100644 --- a/Source/WebCore/Modules/notifications/NotificationCenter.idl +++ b/Source/WebCore/Modules/notifications/NotificationCenter.idl @@ -37,7 +37,7 @@ module threads { OmitConstructor ] NotificationCenter { #if !defined(ENABLE_TEXT_NOTIFICATIONS_ONLY) || !ENABLE_TEXT_NOTIFICATIONS_ONLY - [V8Custom] Notification createHTMLNotification(in DOMString url) raises(DOMException); + [V8Custom, V8EnabledPerContext=htmlNotifications] Notification createHTMLNotification(in DOMString url) raises(DOMException); #endif [V8Custom] Notification createNotification(in DOMString iconUrl, in DOMString title, in DOMString body) raises(DOMException); diff --git a/Source/WebCore/Modules/notifications/NotificationController.h b/Source/WebCore/Modules/notifications/NotificationController.h index fd1968ed4..73dc8ad41 100644 --- a/Source/WebCore/Modules/notifications/NotificationController.h +++ b/Source/WebCore/Modules/notifications/NotificationController.h @@ -49,7 +49,7 @@ public: NotificationClient* client() { return m_client; } private: - NotificationController(NotificationClient*); + explicit NotificationController(NotificationClient*); NotificationClient* m_client; }; diff --git a/Source/WebCore/Modules/speech/SpeechRecognition.h b/Source/WebCore/Modules/speech/SpeechRecognition.h index 86966f67c..fe4bd085f 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognition.h +++ b/Source/WebCore/Modules/speech/SpeechRecognition.h @@ -104,7 +104,7 @@ public: private: friend class RefCounted<SpeechRecognition>; - SpeechRecognition(ScriptExecutionContext*); + explicit SpeechRecognition(ScriptExecutionContext*); // EventTarget diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionController.h b/Source/WebCore/Modules/speech/SpeechRecognitionController.h index 6e3fcceb6..9c4a119da 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionController.h +++ b/Source/WebCore/Modules/speech/SpeechRecognitionController.h @@ -51,7 +51,7 @@ public: static SpeechRecognitionController* from(Page* page) { return static_cast<SpeechRecognitionController*>(Supplement<Page>::from(page, supplementName())); } private: - SpeechRecognitionController(SpeechRecognitionClient*); + explicit SpeechRecognitionController(SpeechRecognitionClient*); SpeechRecognitionClient* m_client; }; diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h index afa6f6370..fdcc93de9 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h +++ b/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h @@ -68,7 +68,7 @@ private: SpeechRecognitionEvent(); SpeechRecognitionEvent(const AtomicString&, const SpeechRecognitionEventInit&); SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory); - SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError>); + explicit SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError>); RefPtr<SpeechRecognitionResult> m_result; short m_resultIndex; diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp b/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp index 968ab1843..d54f2bf74 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp +++ b/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp @@ -52,6 +52,12 @@ SpeechRecognitionAlternative* SpeechRecognitionResult::item(unsigned long index) return m_alternatives[index].get(); } +static QualifiedName emmaQualifiedName(const char* localName) +{ + const char emmaNamespaceUrl[] = "http://www.w3.org/2003/04/emma"; + return QualifiedName("emma", localName, emmaNamespaceUrl); +} + Document* SpeechRecognitionResult::emma() { if (m_emma) @@ -59,27 +65,26 @@ Document* SpeechRecognitionResult::emma() RefPtr<Document> document = Document::create(0, KURL()); - const char emmaNamespaceUrl[] = "http://www.w3.org/2003/04/emma"; - RefPtr<Element> emmaElement = document->createElement(QualifiedName("emma", "emma", emmaNamespaceUrl), false); + RefPtr<Element> emmaElement = document->createElement(emmaQualifiedName("emma"), false); ExceptionCode ec = 0; emmaElement->setAttribute("version", "1.0", ec); ASSERT(!ec); if (ec) return 0; - RefPtr<Element> oneOf = document->createElement(QualifiedName("emma", "one-of", emmaNamespaceUrl), false); - oneOf->setAttribute(QualifiedName("emma", "medium", emmaNamespaceUrl), "acoustic"); - oneOf->setAttribute(QualifiedName("emma", "mode", emmaNamespaceUrl), "voice"); + RefPtr<Element> oneOf = document->createElement(emmaQualifiedName("one-of"), false); + oneOf->setAttribute(emmaQualifiedName("medium"), "acoustic"); + oneOf->setAttribute(emmaQualifiedName("mode"), "voice"); oneOf->setIdAttribute("one-of"); for (size_t i = 0; i < m_alternatives.size(); ++i) { const RefPtr<SpeechRecognitionAlternative>& alternative = m_alternatives[i]; - RefPtr<Element> interpretation = document->createElement(QualifiedName("emma", "interpretation", emmaNamespaceUrl), false); + RefPtr<Element> interpretation = document->createElement(emmaQualifiedName("interpretation"), false); interpretation->setIdAttribute(String::number(i + 1)); - interpretation->setAttribute(QualifiedName("emma", "confidence", emmaNamespaceUrl), String::number(alternative->confidence())); + interpretation->setAttribute(emmaQualifiedName("confidence"), String::number(alternative->confidence())); - RefPtr<Element> literal = document->createElement(QualifiedName("emma", "literal", emmaNamespaceUrl), false); + RefPtr<Element> literal = document->createElement(emmaQualifiedName("literal"), false); literal->appendChild(document->createTextNode(alternative->transcript())); interpretation->appendChild(literal.release()); oneOf->appendChild(interpretation.release()); diff --git a/Source/WebCore/Modules/speech/SpeechRecognitionResultList.h b/Source/WebCore/Modules/speech/SpeechRecognitionResultList.h index 22e3d4f19..e5dc0e56e 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognitionResultList.h +++ b/Source/WebCore/Modules/speech/SpeechRecognitionResultList.h @@ -42,7 +42,7 @@ public: SpeechRecognitionResult* item(unsigned long index); private: - SpeechRecognitionResultList(const Vector<RefPtr<SpeechRecognitionResult> >&); + explicit SpeechRecognitionResultList(const Vector<RefPtr<SpeechRecognitionResult> >&); Vector<RefPtr<SpeechRecognitionResult> > m_results; }; diff --git a/Source/WebCore/Modules/vibration/NavigatorVibration.idl b/Source/WebCore/Modules/vibration/NavigatorVibration.idl index 164849bab..0e9974fd9 100644 --- a/Source/WebCore/Modules/vibration/NavigatorVibration.idl +++ b/Source/WebCore/Modules/vibration/NavigatorVibration.idl @@ -23,7 +23,7 @@ module window { Conditional=VIBRATION, Supplemental=Navigator ] NavigatorVibration { - void webkitVibrate(in unsigned long[]? pattern) raises(DOMException); + void webkitVibrate(in sequence<unsigned long> pattern) raises(DOMException); void webkitVibrate(in unsigned long time) raises(DOMException); }; diff --git a/Source/WebCore/Modules/vibration/Vibration.h b/Source/WebCore/Modules/vibration/Vibration.h index 9b01086a6..361586bc1 100644 --- a/Source/WebCore/Modules/vibration/Vibration.h +++ b/Source/WebCore/Modules/vibration/Vibration.h @@ -36,7 +36,7 @@ class Vibration : public Supplement<Page> { public: typedef Vector<unsigned long> VibrationPattern; - Vibration(VibrationClient*); + explicit Vibration(VibrationClient*); ~Vibration(); static PassOwnPtr<Vibration> create(VibrationClient*); diff --git a/Source/WebCore/Modules/webaudio/AudioBuffer.cpp b/Source/WebCore/Modules/webaudio/AudioBuffer.cpp index 0453fbc5d..2c27a3c8d 100644 --- a/Source/WebCore/Modules/webaudio/AudioBuffer.cpp +++ b/Source/WebCore/Modules/webaudio/AudioBuffer.cpp @@ -90,6 +90,16 @@ void AudioBuffer::releaseMemory() m_channels.clear(); } +Float32Array* AudioBuffer::getChannelData(unsigned channelIndex, ExceptionCode& ec) +{ + if (channelIndex >= m_channels.size()) { + ec = SYNTAX_ERR; + return 0; + } + + return m_channels[channelIndex].get(); +} + Float32Array* AudioBuffer::getChannelData(unsigned channelIndex) { if (channelIndex >= m_channels.size()) diff --git a/Source/WebCore/Modules/webaudio/AudioBuffer.h b/Source/WebCore/Modules/webaudio/AudioBuffer.h index 4aeadca57..d21cee495 100644 --- a/Source/WebCore/Modules/webaudio/AudioBuffer.h +++ b/Source/WebCore/Modules/webaudio/AudioBuffer.h @@ -38,7 +38,9 @@ namespace WebCore { class AudioBus; - + +typedef int ExceptionCode; + class AudioBuffer : public RefCounted<AudioBuffer> { public: static PassRefPtr<AudioBuffer> create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate); @@ -53,6 +55,7 @@ public: // Channel data access unsigned numberOfChannels() const { return m_channels.size(); } + Float32Array* getChannelData(unsigned channelIndex, ExceptionCode&); Float32Array* getChannelData(unsigned channelIndex); void zero(); @@ -67,7 +70,7 @@ public: protected: AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate); - AudioBuffer(AudioBus* bus); + explicit AudioBuffer(AudioBus*); double m_gain; // scalar gain float m_sampleRate; diff --git a/Source/WebCore/Modules/webaudio/AudioBuffer.idl b/Source/WebCore/Modules/webaudio/AudioBuffer.idl index 8a734e28f..92d838497 100644 --- a/Source/WebCore/Modules/webaudio/AudioBuffer.idl +++ b/Source/WebCore/Modules/webaudio/AudioBuffer.idl @@ -38,6 +38,7 @@ module audio { // Channel access readonly attribute unsigned long numberOfChannels; - Float32Array getChannelData(in unsigned long channelIndex); + Float32Array getChannelData(in unsigned long channelIndex) + raises(DOMException); }; } diff --git a/Source/WebCore/Modules/webaudio/AudioContext.h b/Source/WebCore/Modules/webaudio/AudioContext.h index 66806a62b..e6fa12dc5 100644 --- a/Source/WebCore/Modules/webaudio/AudioContext.h +++ b/Source/WebCore/Modules/webaudio/AudioContext.h @@ -243,7 +243,7 @@ public: static unsigned s_hardwareContextCount; private: - AudioContext(Document*); + explicit AudioContext(Document*); AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate); void constructCommon(); diff --git a/Source/WebCore/Modules/webaudio/AudioNodeInput.h b/Source/WebCore/Modules/webaudio/AudioNodeInput.h index 76a416102..ebe4504cf 100644 --- a/Source/WebCore/Modules/webaudio/AudioNodeInput.h +++ b/Source/WebCore/Modules/webaudio/AudioNodeInput.h @@ -42,7 +42,7 @@ class AudioNodeOutput; class AudioNodeInput : public AudioSummingJunction { public: - AudioNodeInput(AudioNode*); + explicit AudioNodeInput(AudioNode*); // AudioSummingJunction virtual bool canUpdateState() OVERRIDE { return !node()->isMarkedForDeletion(); } diff --git a/Source/WebCore/Modules/webaudio/AudioSummingJunction.h b/Source/WebCore/Modules/webaudio/AudioSummingJunction.h index dd5e4427d..b3b4f35fe 100644 --- a/Source/WebCore/Modules/webaudio/AudioSummingJunction.h +++ b/Source/WebCore/Modules/webaudio/AudioSummingJunction.h @@ -38,7 +38,7 @@ class AudioNodeOutput; class AudioSummingJunction { public: - AudioSummingJunction(AudioContext*); + explicit AudioSummingJunction(AudioContext*); virtual ~AudioSummingJunction(); // Can be called from any thread. diff --git a/Source/WebCore/Modules/webaudio/BiquadDSPKernel.h b/Source/WebCore/Modules/webaudio/BiquadDSPKernel.h index 0775559b4..ebd58dde2 100644 --- a/Source/WebCore/Modules/webaudio/BiquadDSPKernel.h +++ b/Source/WebCore/Modules/webaudio/BiquadDSPKernel.h @@ -37,7 +37,7 @@ class BiquadProcessor; class BiquadDSPKernel : public AudioDSPKernel { public: - BiquadDSPKernel(BiquadProcessor* processor) + explicit BiquadDSPKernel(BiquadProcessor* processor) : AudioDSPKernel(processor) { } diff --git a/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h b/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h index e7ac1cdba..299e1173d 100644 --- a/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h +++ b/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h @@ -48,7 +48,7 @@ public: virtual void startRendering(); private: - DefaultAudioDestinationNode(AudioContext*); + explicit DefaultAudioDestinationNode(AudioContext*); OwnPtr<AudioDestination> m_destination; }; diff --git a/Source/WebCore/Modules/webaudio/DelayDSPKernel.h b/Source/WebCore/Modules/webaudio/DelayDSPKernel.h index 62421eab5..a25242593 100644 --- a/Source/WebCore/Modules/webaudio/DelayDSPKernel.h +++ b/Source/WebCore/Modules/webaudio/DelayDSPKernel.h @@ -35,7 +35,7 @@ class DelayProcessor; class DelayDSPKernel : public AudioDSPKernel { public: - DelayDSPKernel(DelayProcessor*); + explicit DelayDSPKernel(DelayProcessor*); DelayDSPKernel(double maxDelayTime, float sampleRate); virtual void process(const float* source, float* destination, size_t framesToProcess); diff --git a/Source/WebCore/Modules/webaudio/JavaScriptAudioNode.cpp b/Source/WebCore/Modules/webaudio/JavaScriptAudioNode.cpp index a6eb60146..be60af887 100644 --- a/Source/WebCore/Modules/webaudio/JavaScriptAudioNode.cpp +++ b/Source/WebCore/Modules/webaudio/JavaScriptAudioNode.cpp @@ -58,10 +58,13 @@ PassRefPtr<JavaScriptAudioNode> JavaScriptAudioNode::create(AudioContext* contex return 0; } + if (!numberOfInputChannels && !numberOfOutputChannels) + return 0; + if (numberOfInputChannels > AudioContext::maxNumberOfChannels()) return 0; - if (!numberOfOutputChannels || numberOfOutputChannels > AudioContext::maxNumberOfChannels()) + if (numberOfOutputChannels > AudioContext::maxNumberOfChannels()) return 0; return adoptRef(new JavaScriptAudioNode(context, sampleRate, bufferSize, numberOfInputChannels, numberOfOutputChannels)); diff --git a/Source/WebCore/Modules/webaudio/OfflineAudioCompletionEvent.h b/Source/WebCore/Modules/webaudio/OfflineAudioCompletionEvent.h index 409aeaf67..c61deada1 100644 --- a/Source/WebCore/Modules/webaudio/OfflineAudioCompletionEvent.h +++ b/Source/WebCore/Modules/webaudio/OfflineAudioCompletionEvent.h @@ -47,7 +47,7 @@ public: private: OfflineAudioCompletionEvent(); - OfflineAudioCompletionEvent(PassRefPtr<AudioBuffer> renderedBuffer); + explicit OfflineAudioCompletionEvent(PassRefPtr<AudioBuffer> renderedBuffer); RefPtr<AudioBuffer> m_renderedBuffer; }; diff --git a/Source/WebCore/Modules/webaudio/WaveShaperDSPKernel.h b/Source/WebCore/Modules/webaudio/WaveShaperDSPKernel.h index 8d8e41760..52322af75 100644 --- a/Source/WebCore/Modules/webaudio/WaveShaperDSPKernel.h +++ b/Source/WebCore/Modules/webaudio/WaveShaperDSPKernel.h @@ -36,7 +36,7 @@ class WaveShaperProcessor; class WaveShaperDSPKernel : public AudioDSPKernel { public: - WaveShaperDSPKernel(WaveShaperProcessor* processor) + explicit WaveShaperDSPKernel(WaveShaperProcessor* processor) : AudioDSPKernel(processor) { } diff --git a/Source/WebCore/Modules/webaudio/WaveShaperNode.h b/Source/WebCore/Modules/webaudio/WaveShaperNode.h index cb1ccf603..f2ef6da22 100644 --- a/Source/WebCore/Modules/webaudio/WaveShaperNode.h +++ b/Source/WebCore/Modules/webaudio/WaveShaperNode.h @@ -44,7 +44,7 @@ public: Float32Array* curve(); private: - WaveShaperNode(AudioContext*); + explicit WaveShaperNode(AudioContext*); WaveShaperProcessor* waveShaperProcessor() { return static_cast<WaveShaperProcessor*>(processor()); } }; diff --git a/Source/WebCore/Modules/webaudio/WaveTable.h b/Source/WebCore/Modules/webaudio/WaveTable.h index a84eb9374..e351efadc 100644 --- a/Source/WebCore/Modules/webaudio/WaveTable.h +++ b/Source/WebCore/Modules/webaudio/WaveTable.h @@ -64,7 +64,7 @@ public: float sampleRate() const { return m_sampleRate; } private: - WaveTable(float sampleRate); + explicit WaveTable(float sampleRate); void generateBasicWaveform(int); diff --git a/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h b/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h index 939b409eb..104d9c0ff 100644 --- a/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h +++ b/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h @@ -104,7 +104,7 @@ public: bool hadDeletes() const { return m_hadDeletes; } private: - DatabaseAuthorizer(const String& databaseInfoTableName); + explicit DatabaseAuthorizer(const String& databaseInfoTableName); void addWhitelistedFunctions(); int denyBasedOnTableName(const String&) const; int updateDeletesBasedOnTableName(const String&); diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTask.h b/Source/WebCore/Modules/webdatabase/DatabaseTask.h index 82d51f03f..b8414a3ef 100644 --- a/Source/WebCore/Modules/webdatabase/DatabaseTask.h +++ b/Source/WebCore/Modules/webdatabase/DatabaseTask.h @@ -146,7 +146,7 @@ public: SQLTransaction* transaction() const { return m_transaction.get(); } private: - DatabaseTransactionTask(PassRefPtr<SQLTransaction>); + explicit DatabaseTransactionTask(PassRefPtr<SQLTransaction>); virtual void doPerformTask(); #if !LOG_DISABLED diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTracker.h b/Source/WebCore/Modules/webdatabase/DatabaseTracker.h index d94a41578..4ff7fa2c9 100644 --- a/Source/WebCore/Modules/webdatabase/DatabaseTracker.h +++ b/Source/WebCore/Modules/webdatabase/DatabaseTracker.h @@ -82,7 +82,7 @@ public: void interruptAllDatabasesForContext(const ScriptExecutionContext*); private: - DatabaseTracker(const String& databasePath); + explicit DatabaseTracker(const String& databasePath); #if !PLATFORM(CHROMIUM) public: diff --git a/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h b/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h index 3cb0e2dbc..c184a3738 100644 --- a/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h +++ b/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h @@ -105,7 +105,7 @@ private: virtual bool isCleanupTask() const { return true; } private: - SafeReleaseTask(T* callbackToRelease) + explicit SafeReleaseTask(T* callbackToRelease) : m_callbackToRelease(callbackToRelease) { } diff --git a/Source/WebCore/Modules/webdatabase/SQLException.h b/Source/WebCore/Modules/webdatabase/SQLException.h index be968cf05..7ea09982a 100644 --- a/Source/WebCore/Modules/webdatabase/SQLException.h +++ b/Source/WebCore/Modules/webdatabase/SQLException.h @@ -61,7 +61,7 @@ public: static bool initializeDescription(ExceptionCode, ExceptionCodeDescription*); private: - SQLException(const ExceptionCodeDescription& description) + explicit SQLException(const ExceptionCodeDescription& description) : ExceptionBase(description) { } diff --git a/Source/WebCore/Modules/websockets/WebSocket.h b/Source/WebCore/Modules/websockets/WebSocket.h index cfb61fb60..54d027e38 100644 --- a/Source/WebCore/Modules/websockets/WebSocket.h +++ b/Source/WebCore/Modules/websockets/WebSocket.h @@ -113,7 +113,7 @@ public: virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) OVERRIDE; private: - WebSocket(ScriptExecutionContext*); + explicit WebSocket(ScriptExecutionContext*); virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } diff --git a/Source/WebCore/Modules/websockets/WebSocketExtensionProcessor.h b/Source/WebCore/Modules/websockets/WebSocketExtensionProcessor.h index ee3d53d41..167460c76 100644 --- a/Source/WebCore/Modules/websockets/WebSocketExtensionProcessor.h +++ b/Source/WebCore/Modules/websockets/WebSocketExtensionProcessor.h @@ -58,7 +58,7 @@ public: virtual String failureReason() { return "Extension " + m_extensionToken + " failed"; } protected: - WebSocketExtensionProcessor(const String& extensionToken) + explicit WebSocketExtensionProcessor(const String& extensionToken) : m_extensionToken(extensionToken) { } diff --git a/Source/WebCore/PlatformBlackBerry.cmake b/Source/WebCore/PlatformBlackBerry.cmake index 20048510a..1ae5fe690 100644 --- a/Source/WebCore/PlatformBlackBerry.cmake +++ b/Source/WebCore/PlatformBlackBerry.cmake @@ -236,7 +236,6 @@ ENDIF () if (ENABLE_MEDIA_STREAM) LIST(APPEND WebCore_SOURCES - platform/mediastream/blackberry/DeprecatedPeerConnectionHandler.cpp platform/mediastream/blackberry/MediaStreamCenterBlackBerry.cpp ) ENDIF () diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake index a9a4f1122..e8c32d830 100644 --- a/Source/WebCore/PlatformEfl.cmake +++ b/Source/WebCore/PlatformEfl.cmake @@ -42,6 +42,7 @@ LIST(APPEND WebCore_SOURCES platform/efl/LocalizedStringsEfl.cpp platform/efl/LoggingEfl.cpp platform/efl/MIMETypeRegistryEfl.cpp + platform/efl/NetworkInfoProviderEfl.cpp platform/efl/PasteboardEfl.cpp platform/efl/PlatformKeyboardEventEfl.cpp platform/efl/PlatformMouseEventEfl.cpp @@ -64,7 +65,6 @@ LIST(APPEND WebCore_SOURCES platform/efl/TemporaryLinkStubs.cpp platform/efl/WidgetEfl.cpp platform/graphics/ImageSource.cpp - platform/graphics/efl/GraphicsLayerEfl.cpp platform/graphics/efl/IconEfl.cpp platform/graphics/efl/ImageEfl.cpp platform/graphics/efl/IntPointEfl.cpp @@ -79,9 +79,9 @@ LIST(APPEND WebCore_SOURCES platform/image-decoders/png/PNGImageDecoder.cpp platform/image-decoders/webp/WEBPImageDecoder.cpp platform/linux/GamepadDeviceLinux.cpp - platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp platform/network/soup/CookieJarSoup.cpp + platform/network/soup/CookieStorageSoup.cpp platform/network/soup/CredentialStorageSoup.cpp platform/network/soup/DNSSoup.cpp platform/network/soup/GOwnPtrSoup.cpp @@ -134,6 +134,7 @@ IF (WTF_USE_CAIRO) platform/graphics/cairo/GraphicsContextCairo.cpp platform/graphics/cairo/ImageBufferCairo.cpp platform/graphics/cairo/ImageCairo.cpp + platform/graphics/cairo/IntRectCairo.cpp platform/graphics/cairo/NativeImageCairo.cpp platform/graphics/cairo/OwnPtrCairo.cpp platform/graphics/cairo/PathCairo.cpp @@ -141,6 +142,8 @@ IF (WTF_USE_CAIRO) platform/graphics/cairo/PlatformContextCairo.cpp platform/graphics/cairo/PlatformPathCairo.cpp platform/graphics/cairo/RefPtrCairo.cpp + platform/graphics/cairo/TileCairo.cpp + platform/graphics/cairo/TiledBackingStoreBackendCairo.cpp platform/graphics/cairo/TransformationMatrixCairo.cpp platform/image-decoders/cairo/ImageDecoderCairo.cpp @@ -149,15 +152,24 @@ IF (WTF_USE_CAIRO) IF (WTF_USE_FREETYPE) LIST(APPEND WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/graphics/freetype" + "${WEBCORE_DIR}/platform/graphics/harfbuzz/" + "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng" ) LIST(APPEND WebCore_SOURCES platform/graphics/WOFFFileFormat.cpp - platform/graphics/efl/FontEfl.cpp + platform/graphics/cairo/FontCairoHarfbuzzNG.cpp platform/graphics/freetype/FontCacheFreeType.cpp platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp platform/graphics/freetype/FontPlatformDataFreeType.cpp platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp platform/graphics/freetype/SimpleFontDataFreeType.cpp + platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp + platform/graphics/harfbuzz/ng/HarfBuzzNGFace.cpp + platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp + platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp + ) + LIST(APPEND WebCore_LIBRARIES + ${HARFBUZZ_LIBRARIES} ) ENDIF () @@ -191,6 +203,16 @@ IF (WTF_USE_ICU_UNICODE) ) ENDIF () +IF (WTF_USE_TEXTURE_MAPPER) + LIST(APPEND WebCore_SOURCES + platform/graphics/texmap/GraphicsLayerTextureMapper.cpp + ) +ELSE () + LIST(APPEND WebCore_SOURCES + platform/graphics/efl/GraphicsLayerEfl.cpp + ) +ENDIF () + LIST(APPEND WebCore_LIBRARIES ${CAIRO_LIBRARIES} ${ECORE_X_LIBRARIES} @@ -319,7 +341,7 @@ IF (ENABLE_WEB_AUDIO) ADD_DEFINITIONS(-DUNINSTALLED_AUDIO_RESOURCES_DIR="${WEBCORE_DIR}/platform/audio/resources") ENDIF () -IF (ENABLE_GAMEPAD) +IF (ENABLE_GAMEPAD OR ENABLE_NETWORK_INFO) LIST(APPEND WebCore_INCLUDE_DIRECTORIES ${EEZE_INCLUDE_DIRS} ) diff --git a/Source/WebCore/Resources/calendarPicker.css b/Source/WebCore/Resources/calendarPicker.css index eef0b106d..e4a624aed 100644 --- a/Source/WebCore/Resources/calendarPicker.css +++ b/Source/WebCore/Resources/calendarPicker.css @@ -139,6 +139,13 @@ body { -webkit-box-sizing: border-box; } +@media (pointer:coarse) { + .day { + min-width: 28px; + line-height: 28px; + } +} + .available { cursor: default; font-weight: 700; diff --git a/Source/WebCore/Resources/colorSuggestionPicker.css b/Source/WebCore/Resources/colorSuggestionPicker.css new file mode 100644 index 000000000..580dc9a5f --- /dev/null +++ b/Source/WebCore/Resources/colorSuggestionPicker.css @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +body { + -webkit-user-select: none; + background-color: white; + font: -webkit-small-control; + margin: 0; + overflow: hidden; +} + +#main { + background-color: white; + border: solid 1px #8899aa; + box-shadow: inset 2px 2px 2px white, + inset -2px -2px 1px rgba(0,0,0,0.1); + padding: 6px; + float: left; +} + +.color-swatch { + float: left; + width: 20px; + height: 20px; + margin: 1px; + border: 1px solid #e0e0e0; +} + +.color-swatch:hover { + border: 1px solid #000000; + margin: 1px; +} + +.color-swatch-container { + width: 100%; + max-height: 104px; + overflow: auto; +} + +.other-color { + width: 100%; + margin: 4px 0 0 0; +} diff --git a/Source/WebCore/Resources/colorSuggestionPicker.js b/Source/WebCore/Resources/colorSuggestionPicker.js new file mode 100644 index 000000000..be2048451 --- /dev/null +++ b/Source/WebCore/Resources/colorSuggestionPicker.js @@ -0,0 +1,192 @@ +"use strict"; +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var global = { + argumentsReceived: false, + scrollbarWidth: null +}; + +/** + * @param {!string} id + */ +function $(id) { + return document.getElementById(id); +} + +function bind(func, context) { + return function() { + return func.apply(context, arguments); + }; +} + +function getScrollbarWidth() { + if (gloabal.scrollbarWidth === null) { + var scrollDiv = document.createElement("div"); + scrollDiv.style.opacity = "0"; + scrollDiv.style.overflow = "scroll"; + scrollDiv.style.width = "50px"; + scrollDiv.style.height = "50px"; + document.body.appendChild(scrollDiv); + gloabal.scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; + scrollDiv.parentNode.removeChild(scrollDiv); + } + return gloabal.scrollbarWidth; +} + +/** + * @param {!string} tagName + * @param {string=} opt_class + * @param {string=} opt_text + * @return {!Element} + */ +function createElement(tagName, opt_class, opt_text) { + var element = document.createElement(tagName); + if (opt_class) + element.setAttribute("class", opt_class); + if (opt_text) + element.appendChild(document.createTextNode(opt_text)); + return element; +} + +/** + * @param {Event} event + */ +function handleMessage(event) { + initialize(JSON.parse(event.data)); + global.argumentsReceived = true; +} + +/** + * @param {!Object} args + */ +function initialize(args) { + var main = $("main"); + main.innerHTML = ""; + var errorString = validateArguments(args); + if (errorString) + main.textContent = "Internal error: " + errorString; + else + new ColorPicker(main, args); +} + +// The DefaultColorPalette is used when the list of values are empty. +var DefaultColorPalette = ["#000000", "#404040", "#808080", "#c0c0c0", + "#ffffff", "#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", + "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"]; + +function handleArgumentsTimeout() { + if (global.argumentsReceived) + return; + var args = { + values : DefaultColorPalette, + otherColorLabel: "Other..." + }; + initialize(args); +} + +/** + * @param {!Object} args + * @return {?string} An error message, or null if the argument has no errors. + */ +function validateArguments(args) { + if (!args.values) + return "No values."; + if (!args.otherColorLabel) + return "No otherColorLabel."; + return null; +} + +var Actions = { + ChooseOtherColor: -2, + Cancel: -1, + SetValue: 0 +}; + +/** + * @param {string} value + */ +function submitValue(value) { + window.pagePopupController.setValueAndClosePopup(Actions.SetValue, value); +} + +function handleCancel() { + window.pagePopupController.setValueAndClosePopup(Actions.Cancel, ""); +} + +function chooseOtherColor() { + window.pagePopupController.setValueAndClosePopup(Actions.ChooseOtherColor, ""); +} + +function ColorPicker(element, config) { + this._element = element; + this._config = config; + if (this._config.values.length === 0) + this._config.values = DefaultColorPalette; + this._layout(); +} + +var SwatchBorderBoxWidth = 24; // keep in sync with CSS +var SwatchBorderBoxHeight = 24; // keep in sync with CSS +var SwatchesPerRow = 5; +var SwatchesMaxRow = 4; + +ColorPicker.prototype._layout = function() { + var container = createElement("div", "color-swatch-container"); + container.addEventListener("click", bind(this._handleSwatchClick, this), false); + for (var i = 0; i < this._config.values.length; ++i) { + var swatch = createElement("div", "color-swatch"); + swatch.dataset.value = this._config.values[i]; + swatch.title = this._config.values[i]; + swatch.style.backgroundColor = this._config.values[i]; + container.appendChild(swatch); + } + var containerWidth = SwatchBorderBoxWidth * SwatchesPerRow; + if (this._config.values.length > SwatchesPerRow * SwatchesMaxRow) + containerWidth += getScrollbarWidth(); + container.style.width = containerWidth + "px"; + container.style.maxHeight = (SwatchBorderBoxHeight * SwatchesMaxRow) + "px"; + this._element.appendChild(container); + var otherButton = createElement("button", "other-color", this._config.otherColorLabel); + otherButton.addEventListener("click", chooseOtherColor, false); + this._element.appendChild(otherButton); + if (window.frameElement) { + window.frameElement.style.width = this._element.offsetWidth + "px"; + window.frameElement.style.height = this._element.offsetHeight + "px"; + } else { + window.resizeTo(this._element.offsetWidth, this._element.offsetHeight); + } +}; + +ColorPicker.prototype._handleSwatchClick = function(event) { + if (event.target.classList.contains("color-swatch")) + submitValue(event.target.dataset.value); +}; + +if (window.dialogArguments) { + initialize(dialogArguments); +} else { + window.addEventListener("message", handleMessage, false); + window.setTimeout(handleArgumentsTimeout, 1000); +} diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index d86719516..0e908eb00 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -861,6 +861,7 @@ SOURCES += \ page/ContentSecurityPolicy.cpp \ page/ContextMenuController.cpp \ page/Crypto.cpp \ + page/DiagnosticLoggingKeys.cpp \ page/DOMSelection.cpp \ page/DOMTimer.cpp \ page/DOMWindow.cpp \ @@ -1206,6 +1207,7 @@ SOURCES += \ rendering/style/StyleSurroundData.cpp \ rendering/style/StyleTransformData.cpp \ rendering/style/StyleVisualData.cpp \ + rendering/style/WrapShapes.cpp \ storage/StorageTask.cpp \ storage/StorageThread.cpp \ storage/Storage.cpp \ @@ -1954,6 +1956,7 @@ HEADERS += \ page/ContextMenuController.h \ page/ContextMenuProvider.h \ page/Coordinates.h \ + page/DiagnosticLoggingKeys.h \ page/DOMSelection.h \ page/DOMTimer.h \ page/DOMWindow.h \ @@ -2382,6 +2385,7 @@ HEADERS += \ rendering/style/StyleVisualData.h \ rendering/style/SVGRenderStyleDefs.h \ rendering/style/SVGRenderStyle.h \ + rendering/style/WrapShapes.h \ rendering/svg/RenderSVGBlock.h \ rendering/svg/RenderSVGContainer.h \ rendering/svg/RenderSVGEllipse.h \ @@ -2642,6 +2646,7 @@ HEADERS += \ svg/SVGVKernElement.h \ svg/SVGZoomAndPan.h \ svg/SVGZoomEvent.h \ + testing/FastMallocStatistics.h \ testing/Internals.h \ testing/InternalSettings.h \ workers/AbstractWorker.h \ @@ -3008,6 +3013,15 @@ contains(DEFINES, ENABLE_FILE_SYSTEM=1) { platform/AsyncFileSystem.cpp } +contains(DEFINES, ENABLE_MEDIA_SOURCE=1) { + HEADERS += \ + Modules/mediasource/SourceBuffer.h \ + Modules/mediasource/SourceBufferList.h + SOURCES += \ + Modules/mediasource/SourceBuffer.cpp \ + Modules/mediasource/SourceBufferList.cpp +} + contains(DEFINES, ENABLE_ICONDATABASE=1) { SOURCES += \ loader/icon/IconDatabase.cpp \ @@ -3907,6 +3921,13 @@ contains(DEFINES, ENABLE_MHTML=1) { page/PageSerializer.cpp } +contains(DEFINES, ENABLE_UNDO_MANAGER=1) { + SOURCES += \ + editing/UndoManager.cpp + HEADERS += \ + editing/UndoManager.h +} + contains(DEFINES, WTF_USE_LIBPNG=1) { SOURCES += platform/image-decoders/ico/ICOImageDecoder.cpp \ platform/image-decoders/png/PNGImageDecoder.cpp diff --git a/Source/WebCore/UseJSC.cmake b/Source/WebCore/UseJSC.cmake index c4c908848..00f1be102 100644 --- a/Source/WebCore/UseJSC.cmake +++ b/Source/WebCore/UseJSC.cmake @@ -49,7 +49,6 @@ LIST(APPEND WebCore_SOURCES bindings/js/JSCoordinatesCustom.cpp bindings/js/JSCustomVoidCallback.cpp bindings/js/JSCustomXPathNSResolver.cpp - bindings/js/JSDeprecatedPeerConnectionCustom.cpp bindings/js/JSDictionary.cpp bindings/js/JSDOMBinding.cpp bindings/js/JSDOMFormDataCustom.cpp diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 1658a432e..53677310e 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -518,6 +518,7 @@ __ZN7WebCore19TextResourceDecoder5flushEv __ZN7WebCore19TextResourceDecoder6decodeEPKcm __ZN7WebCore19TextResourceDecoderC1ERKN3WTF6StringERKNS_12TextEncodingEb __ZN7WebCore19TextResourceDecoderD1Ev +__ZN7WebCore20CachedResourceLoader31garbageCollectDocumentResourcesEv __ZN7WebCore20DictationAlternativeC1Ejjy __ZN7WebCore20DictationAlternativeC1Ev __ZN7WebCore20DisplaySleepDisablerC1EPKc @@ -997,6 +998,7 @@ __ZN7WebCore9HTMLNames8hrefAttrE __ZN7WebCore9HTMLNames8inputTagE __ZN7WebCore9HTMLNames8nameAttrE __ZN7WebCore9HTMLNames8videoTagE +__ZN7WebCore9HTMLNames9appletTagE __ZN7WebCore9HTMLNames9iframeTagE __ZN7WebCore9HTMLNames9objectTagE __ZN7WebCore9HTMLNames9scriptTagE @@ -1177,7 +1179,6 @@ __ZNK7WebCore15FocusController18focusedOrMainFrameEv __ZNK7WebCore15GraphicsContext15platformContextEv __ZNK7WebCore15GraphicsContext16paintingDisabledEv __ZNK7WebCore15GraphicsContext20updatingControlTintsEv -__ZNK7WebCore15GraphicsContext6getCTMEv __ZNK7WebCore15ProgressTracker17estimatedProgressEv __ZNK7WebCore15ProtectionSpace10serverTypeEv __ZNK7WebCore15ProtectionSpace26receivesCredentialSecurelyEv diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index 70243cc54..4070766e9 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -60,6 +60,7 @@ '../Modules/geolocation', '../Modules/intents', '../Modules/indexeddb', + '../Modules/mediasource', '../Modules/mediastream', '../Modules/notifications', '../Modules/protocolhandler', @@ -224,10 +225,23 @@ '../platform/text/win', '../platform/win', ], + # Using native perl rather than cygwin perl cuts execution time of idl + # preprocessing rules by a bit more than 50%. + 'perl_exe': '<(DEPTH)/third_party/perl/perl/bin/perl.exe', + 'gperf_exe': '<(DEPTH)/third_party/gperf/bin/gperf.exe', + 'bison_exe': '<(DEPTH)/third_party/bison/bin/bison.exe', + # Using cl instead of cygwin gcc cuts the processing time from + # 1m58s to 0m52s. + 'preprocessor': '--preprocessor "cl.exe -nologo -EP -TP"', },{ # enable -Wall and -Werror, just for Mac and Linux builds for now # FIXME: Also enable this for Windows after verifying no warnings 'chromium_code': 1, + 'perl_exe': 'perl', + 'gperf_exe': 'gperf', + 'bison_exe': 'bison', + # Without one specified, the scripts default to 'gcc'. + 'preprocessor': '', }], ['use_x11==1 or OS=="android"', { 'webcore_include_dirs': [ @@ -433,8 +447,9 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptSource.h', ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '../inspector/xxd.pl', 'InjectedScriptSource_js', '<@(_inputs)', @@ -456,8 +471,9 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptWebGLModuleSource.h', ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '../inspector/xxd.pl', 'InjectedScriptWebGLModuleSource_js', '<@(_inputs)', @@ -479,8 +495,9 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/DebuggerScriptSource.h', ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '../inspector/xxd.pl', 'DebuggerScriptSource_js', '<@(_inputs)', @@ -511,19 +528,9 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp', ], - 'conditions': [ - ['OS=="win"', { - 'variables': { - # Using cl instead of cygwin gcc cuts the processing time from - # 1m58s to 0m52s. - 'preprocessor': '--preprocessor "cl.exe /nologo /EP /TP"', - }, - }, { - 'variables': { 'preprocessor': '', } - }], - ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '-w', '-I../bindings/scripts', '../bindings/scripts/preprocess-idls.pl', @@ -575,8 +582,9 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/V8ArrayBufferViewCustomScript.h', ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '../inspector/xxd.pl', 'V8ArrayBufferViewCustomScript_js', '<@(_inputs)', @@ -592,8 +600,9 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerCSS.h', ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '../inspector/xxd.pl', 'XMLViewer_css', '<@(_inputs)', @@ -608,8 +617,9 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerJS.h', ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '../inspector/xxd.pl', 'XMLViewer_js', '<@(_inputs)', @@ -927,6 +937,25 @@ ], }, { + 'action_name': 'ColorSuggestionPicker', + 'inputs': [ + '../Resources/colorSuggestionPicker.css', + '../Resources/colorSuggestionPicker.js', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorSuggestionPicker.h', + '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorSuggestionPicker.cpp', + ], + 'action': [ + 'python', + '../make-file-arrays.py', + '--condition=ENABLE(INPUT_TYPE_COLOR) AND ENABLE(DATALIST_ELEMENT) AND ENABLE(PAGE_POPUP)', + '--out-h=<(SHARED_INTERMEDIATE_DIR)/webkit/ColorSuggestionPicker.h', + '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/webkit/ColorSuggestionPicker.cpp', + '<@(_inputs)', + ], + }, + { 'action_name': 'XLinkNames', 'inputs': [ '../dom/make_names.pl', @@ -1017,7 +1046,8 @@ 'python', 'scripts/rule_bison.py', '<(RULE_INPUT_PATH)', - '<(SHARED_INTERMEDIATE_DIR)/webkit' + '<(SHARED_INTERMEDIATE_DIR)/webkit', + '<(bison_exe)', ], }, { @@ -1032,11 +1062,13 @@ 'inputs': [ '../make-hash-tools.pl', ], + 'msvs_cygwin_shell': 0, 'action': [ - 'perl', + '<(perl_exe)', '../make-hash-tools.pl', '<(SHARED_INTERMEDIATE_DIR)/webkit', '<(RULE_INPUT_PATH)', + '<(gperf_exe)', ], }, # Rule to build generated JavaScript (V8) bindings from .idl source. @@ -1066,6 +1098,7 @@ '--include', '../Modules/filesystem', '--include', '../Modules/indexeddb', '--include', '../Modules/intents', + '--include', '../Modules/mediasource', '--include', '../Modules/mediastream', '--include', '../Modules/notifications', '--include', '../Modules/protocolhandler', @@ -1084,13 +1117,14 @@ '--include', '../xml', ], }, + 'msvs_cygwin_shell': 0, # FIXME: Note that we put the .cpp files in webcore/bindings # but the .h files in webkit/bindings. This is to work around # the unfortunate fact that GYP strips duplicate arguments # from lists. When we have a better GYP way to suppress that # behavior, change the output location. 'action': [ - 'perl', + '<(perl_exe)', '-w', '-I../bindings/scripts', '../bindings/scripts/generate-bindings.pl', @@ -1108,6 +1142,7 @@ '--additionalIdlFilesList', '<(additional_idl_files_list)', '<(RULE_INPUT_PATH)', + '<@(preprocessor)', ], 'message': 'Generating binding from <(RULE_INPUT_PATH)', }, @@ -1168,6 +1203,7 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/CalendarPicker.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorSuggestionPicker.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/EventFactory.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/EventHeaders.h', '<(SHARED_INTERMEDIATE_DIR)/webkit/EventInterfaces.h', @@ -1503,6 +1539,13 @@ 'sources/': [ ['exclude', 'AllInOne\\.cpp$'], ], + 'conditions': [ + ['OS!="android"', { + 'sources/': [ + ['exclude', 'Android\\.cpp$'], + ], + }], + ], }, { 'target_name': 'webcore_svg', @@ -1591,7 +1634,6 @@ 'sources/': [ ['exclude', 'platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz\\.cpp$'], ['exclude', 'platform/graphics/harfbuzz/HarfBuzzSkia\\.cpp$'], - ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzNGFace\\.(cpp|h)$'], ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzNGFaceSkia\\.cpp$'], ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzShaper\\.(cpp|h)$'], @@ -1972,37 +2014,6 @@ ['include', 'loader/appcache/ApplicationCacheHost\.h$'], ['include', 'loader/appcache/DOMApplicationCache\.(cpp|h)$'], ], - 'link_settings': { - 'mac_bundle_resources': [ - '../Resources/aliasCursor.png', - '../Resources/cellCursor.png', - '../Resources/contextMenuCursor.png', - '../Resources/copyCursor.png', - '../Resources/eastResizeCursor.png', - '../Resources/eastWestResizeCursor.png', - '../Resources/helpCursor.png', - '../Resources/linkCursor.png', - '../Resources/missingImage.png', - '../Resources/moveCursor.png', - '../Resources/noDropCursor.png', - '../Resources/noneCursor.png', - '../Resources/northEastResizeCursor.png', - '../Resources/northEastSouthWestResizeCursor.png', - '../Resources/northResizeCursor.png', - '../Resources/northSouthResizeCursor.png', - '../Resources/northWestResizeCursor.png', - '../Resources/northWestSouthEastResizeCursor.png', - '../Resources/progressCursor.png', - '../Resources/southEastResizeCursor.png', - '../Resources/southResizeCursor.png', - '../Resources/southWestResizeCursor.png', - '../Resources/verticalTextCursor.png', - '../Resources/waitCursor.png', - '../Resources/westResizeCursor.png', - '../Resources/zoomInCursor.png', - '../Resources/zoomOutCursor.png', - ], - }, 'conditions': [ # Shard this taret into ten parts to work around linker limitations. # on link time code generation builds. @@ -2145,6 +2156,8 @@ ], 'sources': [ '<@(webcore_test_support_files)', + '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8FastMallocStatistics.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8FastMallocStatistics.h', '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8Internals.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8Internals.h', '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8InternalSettings.cpp', diff --git a/Source/WebCore/WebCore.gyp/scripts/rule_bison.py b/Source/WebCore/WebCore.gyp/scripts/rule_bison.py index eb85a4ba6..952165a67 100644 --- a/Source/WebCore/WebCore.gyp/scripts/rule_bison.py +++ b/Source/WebCore/WebCore.gyp/scripts/rule_bison.py @@ -32,7 +32,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# usage: rule_bison.py INPUT_FILE OUTPUT_DIR +# usage: rule_bison.py INPUT_FILE OUTPUT_DIR [BISON_EXE] # INPUT_FILE is a path to either CSSGrammar.y or XPathGrammar.y. # OUTPUT_DIR is where the bison-generated .cpp and .h files should be placed. @@ -42,10 +42,13 @@ import os.path import subprocess import sys -assert len(sys.argv) == 3 +assert len(sys.argv) == 3 or len(sys.argv) == 4 inputFile = sys.argv[1] outputDir = sys.argv[2] +bisonExe = 'bison' +if len(sys.argv) > 3: + bisonExe = sys.argv[3] inputName = os.path.basename(inputFile) assert inputName == 'CSSGrammar.y' or inputName == 'XPathGrammar.y' @@ -69,7 +72,7 @@ for outputHTry in outputHTries: outputCpp = os.path.join(outputDir, inputRoot + '.cpp') -returnCode = subprocess.call(['bison', '-d', '-p', prefix, inputFile, '-o', outputCpp]) +returnCode = subprocess.call([bisonExe, '-d', '-p', prefix, inputFile, '-o', outputCpp]) assert returnCode == 0 # Find the name that bison used for the generated header file. diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 395e27856..3ec84f4b5 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -223,6 +223,7 @@ 'page/ContextMenuClient.h', 'page/ContextMenuController.h', 'page/Coordinates.h', + 'page/DOMSecurityPolicy.h', 'page/DOMWindow.h', 'page/DOMWindowExtension.h', 'page/DragActions.h', @@ -243,7 +244,6 @@ 'page/Page.h', 'page/PageGroup.h', 'page/PagePopup.h', - 'page/PagePopupClient.h', 'page/PagePopupDriver.h', 'page/PageSerializer.h', 'page/PageVisibilityState.h', @@ -436,8 +436,6 @@ 'platform/mac/WebCoreSystemInterface.h', 'platform/mac/WebCoreView.h', 'platform/mac/WebFontCache.h', - 'platform/mediastream/DeprecatedPeerConnectionHandler.h', - 'platform/mediastream/DeprecatedPeerConnectionHandlerClient.h', 'platform/mediastream/IceCandidateDescriptor.cpp', 'platform/mediastream/IceCandidateDescriptor.h', 'platform/mediastream/IceOptions.cpp', @@ -448,14 +446,12 @@ 'platform/mediastream/MediaStreamCenter.h', 'platform/mediastream/MediaStreamComponent.h', 'platform/mediastream/MediaStreamDescriptor.h', + 'platform/mediastream/MediaStreamSource.cpp', 'platform/mediastream/MediaStreamSource.h', 'platform/mediastream/PeerConnection00Handler.h', 'platform/mediastream/PeerConnection00HandlerClient.h', 'platform/mediastream/SessionDescriptionDescriptor.cpp', 'platform/mediastream/SessionDescriptionDescriptor.h', - 'platform/mediastream/chromium/DeprecatedPeerConnectionHandler.cpp', - 'platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.cpp', - 'platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.h', 'platform/mediastream/chromium/MediaStreamCenterChromium.cpp', 'platform/mediastream/chromium/MediaStreamCenterChromium.h', 'platform/mediastream/chromium/PeerConnection00Handler.cpp', @@ -609,6 +605,7 @@ 'rendering/style/StyleTransformData.h', 'rendering/style/StyleVariableData.h', 'rendering/style/StyleVisualData.h', + 'rendering/style/WrapShapes.h', 'rendering/svg/SVGResourcesCache.h', 'workers/WorkerRunLoop.h', 'workers/WorkerThread.h', @@ -827,7 +824,8 @@ 'Modules/intents/Intent.idl', 'Modules/intents/IntentResultCallback.idl', 'Modules/intents/NavigatorIntents.idl', - 'Modules/mediastream/DeprecatedPeerConnection.idl', + 'Modules/mediasource/SourceBuffer.idl', + 'Modules/mediasource/SourceBufferList.idl', 'Modules/mediastream/DOMWindowMediaStream.idl', 'Modules/mediastream/IceCallback.idl', 'Modules/mediastream/IceCandidate.idl', @@ -844,7 +842,6 @@ 'Modules/mediastream/NavigatorUserMediaSuccessCallback.idl', 'Modules/mediastream/PeerConnection00.idl', 'Modules/mediastream/SessionDescription.idl', - 'Modules/mediastream/SignalingCallback.idl', 'Modules/notifications/DOMWindowNotifications.idl', 'Modules/notifications/Notification.idl', 'Modules/notifications/NotificationCenter.idl', @@ -1163,6 +1160,7 @@ 'page/Console.idl', 'page/Coordinates.idl', 'page/Crypto.idl', + 'page/DOMSecurityPolicy.idl', 'page/DOMSelection.idl', 'page/DOMWindow.idl', 'page/DOMWindowPagePopup.idl', @@ -1539,8 +1537,10 @@ 'Modules/intents/IntentResultCallback.h', 'Modules/intents/NavigatorIntents.cpp', 'Modules/intents/NavigatorIntents.h', - 'Modules/mediastream/DeprecatedPeerConnection.cpp', - 'Modules/mediastream/DeprecatedPeerConnection.h', + 'Modules/mediasource/SourceBuffer.cpp', + 'Modules/mediasource/SourceBuffer.h', + 'Modules/mediasource/SourceBufferList.cpp', + 'Modules/mediasource/SourceBufferList.h', 'Modules/mediastream/IceCallback.h', 'Modules/mediastream/IceCandidate.cpp', 'Modules/mediastream/IceCandidate.h', @@ -1569,7 +1569,6 @@ 'Modules/mediastream/PeerConnection00.h', 'Modules/mediastream/SessionDescription.cpp', 'Modules/mediastream/SessionDescription.h', - 'Modules/mediastream/SignalingCallback.h', 'Modules/mediastream/UserMediaClient.h', 'Modules/mediastream/UserMediaController.cpp', 'Modules/mediastream/UserMediaController.h', @@ -1969,7 +1968,6 @@ 'bindings/js/JSDOMWrapper.cpp', 'bindings/js/JSDataViewCustom.cpp', 'bindings/js/JSDedicatedWorkerContextCustom.cpp', - 'bindings/js/JSDeprecatedPeerConnectionCustom.cpp', 'bindings/js/JSDesktopNotificationsCustom.cpp', 'bindings/js/JSDeviceMotionEventCustom.cpp', 'bindings/js/JSDeviceOrientationEventCustom.cpp', @@ -2703,6 +2701,8 @@ 'editing/TextInsertionBaseCommand.h', 'editing/TextIterator.cpp', 'editing/TypingCommand.cpp', + 'editing/UndoManager.cpp', + 'editing/UndoManager.h', 'editing/UndoStep.h', 'editing/UnlinkCommand.cpp', 'editing/UnlinkCommand.h', @@ -3041,6 +3041,9 @@ 'page/ContextMenuProvider.h', 'page/Crypto.cpp', 'page/Crypto.h', + 'page/DiagnosticLoggingKeys.cpp', + 'page/DiagnosticLoggingKeys.h', + 'page/DOMSecurityPolicy.cpp', 'page/DOMSelection.cpp', 'page/DOMSelection.h', 'page/DOMTimer.cpp', @@ -3084,6 +3087,8 @@ 'page/PageGroupLoadDeferrer.h', 'page/PagePopupController.cpp', 'page/PagePopupController.h', + 'page/PagePopupClient.cpp', + 'page/PagePopupClient.h', 'page/PageSerializer.cpp', 'page/PageVisibilityState.cpp', 'page/Performance.cpp', @@ -3653,7 +3658,6 @@ 'platform/graphics/chromium/VDMXParser.cpp', 'platform/graphics/chromium/VDMXParser.h', 'platform/graphics/cocoa/FontPlatformDataCocoa.mm', - 'platform/graphics/efl/FontEfl.cpp', 'platform/graphics/efl/IconEfl.cpp', 'platform/graphics/efl/ImageEfl.cpp', 'platform/graphics/efl/IntPointEfl.cpp', @@ -4886,6 +4890,7 @@ 'rendering/style/StyleSurroundData.cpp', 'rendering/style/StyleTransformData.cpp', 'rendering/style/StyleVisualData.cpp', + 'rendering/style/WrapShapes.cpp', 'rendering/svg/SVGInlineFlowBox.cpp', 'rendering/svg/SVGInlineFlowBox.h', 'rendering/svg/SVGInlineTextBox.cpp', @@ -5698,6 +5703,7 @@ 'html/parser/HTMLScriptRunnerHost.h', 'html/parser/HTMLSourceTracker.cpp', 'html/parser/HTMLSourceTracker.h', + 'html/parser/HTMLStackItem.h', 'html/parser/HTMLToken.h', 'html/parser/HTMLTokenizer.cpp', 'html/parser/HTMLTokenizer.h', @@ -5734,6 +5740,8 @@ 'html/shadow/MediaControlElements.h', 'html/shadow/MediaControlRootElementChromium.cpp', 'html/shadow/MediaControlRootElementChromium.h', + 'html/shadow/MediaControlRootElementChromiumAndroid.cpp', + 'html/shadow/MediaControlRootElementChromiumAndroid.h', 'html/shadow/MeterShadowElement.cpp', 'html/shadow/MeterShadowElement.h', 'html/shadow/ProgressShadowElement.cpp', @@ -6195,6 +6203,7 @@ 'svg/properties/SVGPathSegListPropertyTearOff.cpp', ], 'webcore_test_support_idl_files': [ + 'testing/FastMallocStatistics.idl', 'testing/Internals.idl', 'testing/InternalSettings.idl', ], @@ -6203,6 +6212,7 @@ 'testing/v8/WebCoreTestSupport.h', 'testing/js/WebCoreTestSupport.cpp', 'testing/js/WebCoreTestSupport.h', + 'testing/FastMallocStatistics.h', 'testing/Internals.cpp', 'testing/Internals.h', 'testing/InternalSettings.cpp', @@ -6210,43 +6220,6 @@ 'testing/MockPagePopupDriver.cpp', 'testing/MockPagePopupDriver.h', ], - 'webcore_resource_files': [ - 'English.lproj/Localizable.strings', - 'English.lproj/localizedStrings.js', - 'Resources/aliasCursor.png', - 'Resources/cellCursor.png', - 'Resources/contextMenuCursor.png', - 'Resources/copyCursor.png', - 'Resources/crossHairCursor.png', - 'Resources/deleteButton.tiff', - 'Resources/deleteButtonPressed.tiff', - 'Resources/eastResizeCursor.png', - 'Resources/eastWestResizeCursor.png', - 'Resources/helpCursor.png', - 'Resources/inputSpeech.tiff', - 'Resources/linkCursor.png', - 'Resources/missingImage.tiff', - 'Resources/moveCursor.png', - 'Resources/noDropCursor.png', - 'Resources/noneCursor.png', - 'Resources/northEastResizeCursor.png', - 'Resources/northEastSouthWestResizeCursor.png', - 'Resources/northResizeCursor.png', - 'Resources/northSouthResizeCursor.png', - 'Resources/northWestResizeCursor.png', - 'Resources/northWestSouthEastResizeCursor.png', - 'Resources/notAllowedCursor.png', - 'Resources/progressCursor.png', - 'Resources/southEastResizeCursor.png', - 'Resources/southResizeCursor.png', - 'Resources/southWestResizeCursor.png', - 'Resources/textAreaResizeCorner.tiff', - 'Resources/verticalTextCursor.png', - 'Resources/waitCursor.png', - 'Resources/westResizeCursor.png', - 'Resources/zoomInCursor.png', - 'Resources/zoomOutCursor.png', - ], 'webinspector_files': [ 'inspector/front-end/inspector.html', 'inspector/front-end/AdvancedSearchController.js', @@ -6381,6 +6354,7 @@ 'inspector/front-end/ResourceWebSocketFrameView.js', 'inspector/front-end/ResourcesPanel.js', 'inspector/front-end/RevisionHistoryView.js', + 'inspector/front-end/SASSSourceMapping.js', 'inspector/front-end/ScopeChainSidebarPane.js', 'inspector/front-end/Script.js', 'inspector/front-end/ScriptFormatter.js', @@ -6429,6 +6403,7 @@ 'inspector/front-end/TopDownProfileDataGridTree.js', 'inspector/front-end/treeoutline.js', 'inspector/front-end/UISourceCode.js', + 'inspector/front-end/UISourceCodeFrame.js', 'inspector/front-end/UIUtils.js', 'inspector/front-end/UserAgentSupport.js', 'inspector/front-end/UserMetrics.js', @@ -7272,6 +7247,8 @@ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMPlugin.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMPluginArray.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMPluginArray.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMSecurityPolicy.cpp', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMSecurityPolicy.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMSelection.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMSelection.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSDOMSettableTokenList.cpp', @@ -8259,6 +8236,8 @@ 'platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h', 'platform/graphics/chromium/GeometryBinding.cpp', 'platform/graphics/chromium/GeometryBinding.h', + 'platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp', + 'platform/graphics/chromium/HeadsUpDisplayLayerChromium.h', 'platform/graphics/chromium/IOSurfaceLayerChromium.cpp', 'platform/graphics/chromium/IOSurfaceLayerChromium.h', 'platform/graphics/chromium/ImageLayerChromium.cpp', @@ -8324,8 +8303,8 @@ 'platform/graphics/chromium/cc/CCFrameRateCounter.cpp', 'platform/graphics/chromium/cc/CCFrameRateCounter.h', 'platform/graphics/chromium/cc/CCGestureCurve.h', - 'platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp', - 'platform/graphics/chromium/cc/CCHeadsUpDisplay.h', + 'platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp', + 'platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h', 'platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h', 'platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp', 'platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index f284098f5..642029359 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -25083,6 +25083,26 @@ </File> </Filter> <Filter + Name="mediasource" + > + <File + RelativePath="..\Modules\mediasource\SourceBuffer.cpp" + > + </File> + <File + RelativePath="..\Modules\mediasource\SourceBuffer.h" + > + </File> + <File + RelativePath="..\Modules\mediasource\SourceBufferList.cpp" + > + </File> + <File + RelativePath="..\Modules\mediasource\SourceBufferList.h" + > + </File> + </Filter> + <Filter Name="notifications" > <File @@ -26747,6 +26767,14 @@ > </File> <File + RelativePath="..\page\DiagnosticLoggingKeys.cpp" + > + </File> + <File + RelativePath="..\page\DiagnosticLoggingKeys.h" + > + </File> + <File RelativePath="..\page\DOMSelection.cpp" > </File> @@ -46239,6 +46267,14 @@ RelativePath="..\rendering\style\SVGRenderStyleDefs.h" > </File> + <File + RelativePath="..\rendering\style\WrapShapes.cpp" + > + </File> + <File + RelativePath="..\rendering\style\WrapShapes.h" + > + </File> </Filter> <Filter Name="svg" @@ -58123,6 +58159,62 @@ > </File> <File + RelativePath="..\editing\UndoManager.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\editing\UndoManager.h" + > + </File> + <File RelativePath="..\editing\UndoStep.h" > </File> @@ -63374,6 +63466,10 @@ > </File> <File + RelativePath="..\html\parser\HTMLStackItem.h" + > + </File> + <File RelativePath="..\html\parser\HTMLToken.h" > </File> @@ -75714,6 +75810,10 @@ > </File> <File + RelativePath="..\inspector\front-end\SASSSourceMapping.js" + > + </File> + <File RelativePath="..\inspector\front-end\ScopeChainSidebarPane.js" > </File> @@ -75934,6 +76034,10 @@ > </File> <File + RelativePath="..\inspector\front-end\UISourceCodeFrame.js" + > + </File> + <File RelativePath="..\inspector\front-end\UIUtils.js" > </File> diff --git a/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops index 12e87676c..15aa9bf0a 100644 --- a/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops +++ b/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops @@ -7,7 +7,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\Modules\filesystem";"$(ProjectDir)..\Modules\geolocation";"$(ProjectDir)..\Modules\indexeddb";"$(ProjectDir)..\Modules\protocolhandler";"$(ProjectDir)..\Modules\quota";"$(ProjectDir)..\Modules\notifications";"$(ProjectDir)..\Modules\webdatabase";"$(ProjectDir)..\Modules\websockets";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\mathml";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\rendering\svg";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\bindings\js\specialization";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\html\shadow";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\cache";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\scrolling";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\ca";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\filters\arm";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(ProjectDir)..\xml\parser";"$(ConfigurationBuildDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\properties";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\testing";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib"" + AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\Modules\filesystem";"$(ProjectDir)..\Modules\geolocation";"$(ProjectDir)..\Modules\indexeddb";"$(ProjectDir)..\Modules\mediasource";"$(ProjectDir)..\Modules\protocolhandler";"$(ProjectDir)..\Modules\quota";"$(ProjectDir)..\Modules\notifications";"$(ProjectDir)..\Modules\webdatabase";"$(ProjectDir)..\Modules\websockets";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\mathml";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\rendering\svg";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\bindings\js\specialization";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\html\shadow";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\cache";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\scrolling";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\ca";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\filters\arm";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(ProjectDir)..\xml\parser";"$(ConfigurationBuildDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\properties";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\testing";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib"" PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS" UsePrecompiledHeader="2" PrecompiledHeaderThrough="WebCorePrefix.h" diff --git a/Source/WebCore/WebCore.vcproj/WebCoreTestSupport.vcproj b/Source/WebCore/WebCore.vcproj/WebCoreTestSupport.vcproj index b07d1a7fd..afc4deb2e 100644 --- a/Source/WebCore/WebCore.vcproj/WebCoreTestSupport.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCoreTestSupport.vcproj @@ -348,6 +348,74 @@ Name="DerivedSources" > <File + RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSFastMallocStatistics.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4065;4273;4565;4701;4702" + ForcedIncludeFiles="$(NOINHERIT)" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4065;4273;4565;4701;4702" + ForcedIncludeFiles="$(NOINHERIT)" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4065;4273;4565;4701;4702" + ForcedIncludeFiles="$(NOINHERIT)" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4065;4273;4565;4701;4702" + ForcedIncludeFiles="$(NOINHERIT)" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4065;4273;4565;4701;4702" + ForcedIncludeFiles="$(NOINHERIT)" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4065;4273;4565;4701;4702" + ForcedIncludeFiles="$(NOINHERIT)" + /> + </FileConfiguration> + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSFastMallocStatistics.h" + > + </File> + <File RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSInternals.cpp" > <FileConfiguration @@ -488,6 +556,10 @@ Name="testing" > <File + RelativePath="..\testing\FastMallocStatistics.h" + > + </File> + <File RelativePath="..\testing\Internals.cpp" > <FileConfiguration diff --git a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd index 0917cd791..79c362061 100755 --- a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd +++ b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd @@ -21,6 +21,7 @@ xcopy /y /d "%ProjectDir%..\config.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%CONFIGURATIONBUILDDIR%\obj\WebCore\DerivedSources\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\filesystem\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\geolocation\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\Modules\mediasource\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\notifications\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\protocolhandler\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\quota\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 1066ce6df..c3ca34e43 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -781,6 +781,12 @@ 2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */; }; 2D9066060BE141D400956998 /* LayoutState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9066040BE141D400956998 /* LayoutState.cpp */; }; 2D9066070BE141D400956998 /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 2D9A246E15B9BD0000D34527 /* DOMSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9A246B15B9BBDD00D34527 /* DOMSecurityPolicy.h */; }; + 2D9A246F15B9BD2F00D34527 /* DOMSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9A246A15B9BBDD00D34527 /* DOMSecurityPolicy.cpp */; }; + 2D9A247315B9C2D100D34527 /* DOMDOMSecurityPolicy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D9A247215B9C2C700D34527 /* DOMDOMSecurityPolicy.mm */; }; + 2D9A247415B9C2E300D34527 /* DOMDOMSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9A247015B9C29500D34527 /* DOMDOMSecurityPolicy.h */; }; + 2D9A247515B9C2E300D34527 /* DOMDOMSecurityPolicyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9A247115B9C29500D34527 /* DOMDOMSecurityPolicyInternal.h */; }; + 2D9A247615B9C2F400D34527 /* DOMDOMSecurityPolicy.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 2D9A247015B9C29500D34527 /* DOMDOMSecurityPolicy.h */; }; 2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; }; 2E0888D41148848A00AF4265 /* JSDOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */; }; 2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0888D31148848A00AF4265 /* JSDOMFormData.h */; }; @@ -3788,6 +3794,8 @@ A72EA3BB1585CF55004FAA26 /* RefCountedSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = A72EA3BA1585CF55004FAA26 /* RefCountedSupplement.h */; settings = {ATTRIBUTES = (Private, ); }; }; A73F95FE12C97BFE0031AAF9 /* RoundedRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */; }; A73F95FF12C97BFE0031AAF9 /* RoundedRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A740B59514C935AB00A77FA4 /* JSFastMallocStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B4EA6914C9348400C8F5BF /* JSFastMallocStatistics.h */; }; + A740B59714C935AF00A77FA4 /* JSFastMallocStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B4EA6814C9348400C8F5BF /* JSFastMallocStatistics.cpp */; }; A740B5A514C935AB00A77FA4 /* JSInternalSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B4EA7914C9348400C8F5BF /* JSInternalSettings.h */; }; A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B4EA7814C9348400C8F5BF /* JSInternalSettings.cpp */; }; A74BB76B13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -3826,6 +3834,7 @@ A7B6E69F0B291A9600D0529F /* DragData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B6E69D0B291A9600D0529F /* DragData.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7BBE26611AFB3F20005EA03 /* JSHTMLMeterElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */; }; A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */; }; + A7BE7EDF14C9175A0014489D /* FastMallocStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BE7EDC14C9175A0014489D /* FastMallocStatistics.cpp */; }; A7BF7EDF14C9175A0014489D /* InternalSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BF7EDC14C9175A0014489D /* InternalSettings.cpp */; }; A7BF7EE014C9175A0014489D /* InternalSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A7BF7EDD14C9175A0014489D /* InternalSettings.h */; }; A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */; }; @@ -5810,6 +5819,7 @@ CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; CD27F6E51457685A0078207D /* JSMediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E2145767580078207D /* JSMediaController.cpp */; }; CD27F6E7145770D30078207D /* MediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E6145770D30078207D /* MediaController.cpp */; }; + CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */; }; CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; }; CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */; settings = {ATTRIBUTES = (Private, ); }; }; CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; settings = {COMPILER_FLAGS = "-Wno-undef"; }; }; @@ -6183,6 +6193,7 @@ F5122C901547FA1B0028A93B /* PagePopupDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */; }; F5142C69123F12B000F5BD4C /* LocalizedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = F5142C68123F12B000F5BD4C /* LocalizedNumber.h */; }; F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; }; + F553B89315BE26C000B134C9 /* WrapShapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F553B89215BE26C000B134C9 /* WrapShapes.cpp */; }; F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; }; F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */; }; F55B3DAF1251F12D003EF269 /* ButtonInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */; }; @@ -6552,6 +6563,7 @@ dstSubfolderSpec = 1; files = ( 5DF7F5C20F01F92A00526B4B /* CSSPropertyNames.h in Copy Generated Headers */, + 2D9A247615B9C2F400D34527 /* DOMDOMSecurityPolicy.h in Copy Generated Headers */, 8538F0300AD71CDB006A81D1 /* DOMAbstractView.h in Copy Generated Headers */, 1C11CCBC0AA6093700DADB20 /* DOMAttr.h in Copy Generated Headers */, 2E2D99EB10E2BD3900496337 /* DOMBlob.h in Copy Generated Headers */, @@ -7812,6 +7824,11 @@ 2D9066050BE141D400956998 /* LayoutState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LayoutState.h; sourceTree = "<group>"; }; 2D90660B0665D937006B6F1A /* ClipboardMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2D90660C0665D937006B6F1A /* ClipboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClipboardMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 2D9A246A15B9BBDD00D34527 /* DOMSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMSecurityPolicy.cpp; sourceTree = "<group>"; }; + 2D9A246B15B9BBDD00D34527 /* DOMSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSecurityPolicy.h; sourceTree = "<group>"; }; + 2D9A247015B9C29500D34527 /* DOMDOMSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMSecurityPolicy.h; sourceTree = "<group>"; }; + 2D9A247115B9C29500D34527 /* DOMDOMSecurityPolicyInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMSecurityPolicyInternal.h; sourceTree = "<group>"; }; + 2D9A247215B9C2C700D34527 /* DOMDOMSecurityPolicy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMDOMSecurityPolicy.mm; sourceTree = "<group>"; }; 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */ = {isa = PBXFileReference; lastKnownFileType = file; path = linearSRGB.icc; sourceTree = "<group>"; }; 2E0888C3114883A900AF4265 /* DOMFormData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFormData.idl; sourceTree = "<group>"; }; 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormData.cpp; sourceTree = "<group>"; }; @@ -10796,6 +10813,7 @@ 97BC84B112371180000C6161 /* TextDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextDocument.cpp; sourceTree = "<group>"; }; 97BC84B212371180000C6161 /* TextDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextDocument.h; sourceTree = "<group>"; }; 97C0784F1165D5BE003A32EF /* SuffixTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuffixTree.h; sourceTree = "<group>"; }; + 97C1F552122855CB00EDE615 /* HTMLStackItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLStackItem.h; path = parser/HTMLStackItem.h; sourceTree = "<group>"; }; 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>"; }; @@ -10987,12 +11005,16 @@ A7AD2F860EC89D07008AB002 /* LinkHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkHash.h; sourceTree = "<group>"; }; A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameActionScheduler.cpp; sourceTree = "<group>"; }; A7B070D1130A409C00A3763C /* FrameActionScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameActionScheduler.h; sourceTree = "<group>"; }; + A7B4EA6814C9348400C8F5BF /* JSFastMallocStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFastMallocStatistics.cpp; sourceTree = "<group>"; }; + A7B4EA6914C9348400C8F5BF /* JSFastMallocStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFastMallocStatistics.h; sourceTree = "<group>"; }; A7B4EA7814C9348400C8F5BF /* JSInternalSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInternalSettings.cpp; sourceTree = "<group>"; }; A7B4EA7914C9348400C8F5BF /* JSInternalSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInternalSettings.h; sourceTree = "<group>"; }; A7B6E69D0B291A9600D0529F /* DragData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragData.h; sourceTree = "<group>"; }; A7B7749614CF6353004044BB /* HTMLContentElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLContentElement.idl; sourceTree = "<group>"; }; A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMeterElement.cpp; sourceTree = "<group>"; }; A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLMeterElement.h; sourceTree = "<group>"; }; + A7BE7EDD14C9175A0014489D /* FastMallocStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastMallocStatistics.h; sourceTree = "<group>"; }; + A7BE7EDE14C9175A0014489D /* FastMallocStatistics.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FastMallocStatistics.idl; sourceTree = "<group>"; }; A7BF7EDC14C9175A0014489D /* InternalSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InternalSettings.cpp; sourceTree = "<group>"; }; A7BF7EDD14C9175A0014489D /* InternalSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalSettings.h; sourceTree = "<group>"; }; A7BF7EDE14C9175A0014489D /* InternalSettings.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = InternalSettings.idl; sourceTree = "<group>"; }; @@ -11584,6 +11606,12 @@ B10B697E140C174000BC1C26 /* WebVTTTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebVTTTokenizer.cpp; sourceTree = "<group>"; }; B10B697F140C174000BC1C26 /* WebVTTTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVTTTokenizer.h; sourceTree = "<group>"; }; B1827492134CA4C100B98C2D /* CallbackFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallbackFunction.cpp; sourceTree = "<group>"; }; + B1A942E315B5CE2200D525D1 /* SourceBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceBuffer.cpp; sourceTree = "<group>"; }; + B1A942E415B5CE2200D525D1 /* SourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBuffer.h; sourceTree = "<group>"; }; + B1A942E515B5CE2200D525D1 /* SourceBuffer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBuffer.idl; sourceTree = "<group>"; }; + B1A942E615B5CE2200D525D1 /* SourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceBufferList.cpp; sourceTree = "<group>"; }; + B1A942E715B5CE2200D525D1 /* SourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferList.h; sourceTree = "<group>"; }; + B1A942E815B5CE2200D525D1 /* SourceBufferList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBufferList.idl; sourceTree = "<group>"; }; B1AD4E7113A12A4600846B27 /* TextTrackLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextTrackLoader.cpp; path = loader/TextTrackLoader.cpp; sourceTree = SOURCE_ROOT; }; B1AD4E7213A12A4600846B27 /* TextTrackLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextTrackLoader.h; path = loader/TextTrackLoader.h; sourceTree = SOURCE_ROOT; }; B1D5ECB4134B58DA0087C78F /* CallbackFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackFunction.h; sourceTree = "<group>"; }; @@ -13061,6 +13089,8 @@ CD27F6E3145767580078207D /* JSMediaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaController.h; sourceTree = "<group>"; }; CD27F6E4145767870078207D /* MediaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaController.h; sourceTree = "<group>"; }; CD27F6E6145770D30078207D /* MediaController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaController.cpp; sourceTree = "<group>"; }; + CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiagnosticLoggingKeys.cpp; sourceTree = "<group>"; }; + CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingKeys.h; sourceTree = "<group>"; }; CD4AC5281496AE2F0087C4EF /* Composite.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = Composite.wav; path = platform/audio/resources/Composite.wav; sourceTree = SOURCE_ROOT; }; CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; }; CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; }; @@ -13495,6 +13525,7 @@ F523D30302DE4476018635CA /* Range.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Range.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D30402DE4476018635CA /* Range.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmptyClients.cpp; sourceTree = "<group>"; }; + F553B89215BE26C000B134C9 /* WrapShapes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WrapShapes.cpp; path = style/WrapShapes.cpp; sourceTree = "<group>"; }; F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseTextInputType.cpp; sourceTree = "<group>"; }; F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTextInputType.h; sourceTree = "<group>"; }; F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ButtonInputType.cpp; sourceTree = "<group>"; }; @@ -14869,6 +14900,8 @@ isa = PBXGroup; children = ( 41815C1B138319630057AAA4 /* js */, + A7BE7EDD14C9175A0014489D /* FastMallocStatistics.h */, + A7BE7EDE14C9175A0014489D /* FastMallocStatistics.idl */, 417DA4CF13734326007C57FB /* Internals.cpp */, 417DA4CE13734326007C57FB /* Internals.h */, 41813F9113818AD60057AAA4 /* Internals.idl */, @@ -14882,6 +14915,8 @@ 417DA71213735D90007C57FB /* Testing */ = { isa = PBXGroup; children = ( + A7B4EA6814C9348400C8F5BF /* JSFastMallocStatistics.cpp */, + A7B4EA6914C9348400C8F5BF /* JSFastMallocStatistics.h */, 417DA71B13735DFA007C57FB /* JSInternals.cpp */, 417DA71C13735DFA007C57FB /* JSInternals.h */, A7B4EA7814C9348400C8F5BF /* JSInternalSettings.cpp */, @@ -15592,6 +15627,8 @@ 65BF02180974806300C43196 /* page */ = { isa = PBXGroup; children = ( + 2D9A246A15B9BBDD00D34527 /* DOMSecurityPolicy.cpp */, + 2D9A246B15B9BBDD00D34527 /* DOMSecurityPolicy.h */, 316FE1060E6E1D8400BF6088 /* animation */, 93C09A820B064F05005ABD4D /* mac */, 1AF62EE114DA22A70041556C /* scrolling */, @@ -15763,6 +15800,8 @@ E1271A130EEEC80400F61213 /* WorkerNavigator.cpp */, E1271A0A0EEEC77A00F61213 /* WorkerNavigator.h */, E1271A510EEECD1C00F61213 /* WorkerNavigator.idl */, + CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */, + CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */, ); path = page; sourceTree = "<group>"; @@ -15865,6 +15904,9 @@ 85967D9F0AA8BB59005FEDEE /* Core */ = { isa = PBXGroup; children = ( + 2D9A247215B9C2C700D34527 /* DOMDOMSecurityPolicy.mm */, + 2D9A247015B9C29500D34527 /* DOMDOMSecurityPolicy.h */, + 2D9A247115B9C29500D34527 /* DOMDOMSecurityPolicyInternal.h */, 85D389B00A991A7F00282145 /* DOMAttr.h */, 85D389B10A991A7F00282145 /* DOMAttr.mm */, 85089CCF0A98C42700A275AA /* DOMCDATASection.h */, @@ -17554,6 +17596,7 @@ 971145FE14EF006E00674FD9 /* Modules */ = { isa = PBXGroup; children = ( + B1A942DD15B5CE2200D525D1 /* mediasource */, 971145FF14EF007900674FD9 /* geolocation */, 9712A55315004E3C0048AF10 /* indexeddb */, 333F703D0FB49C16008E12A6 /* notifications */, @@ -17956,6 +17999,7 @@ 977B385D122883E900B81FF8 /* HTMLScriptRunnerHost.h */, 977E2DCB12F0E28300C13379 /* HTMLSourceTracker.cpp */, 977E2DCC12F0E28300C13379 /* HTMLSourceTracker.h */, + 97C1F552122855CB00EDE615 /* HTMLStackItem.h */, 97C1F552122855CB00EDE616 /* HTMLToken.h */, 977B385E122883E900B81FF8 /* HTMLTokenizer.cpp */, 977B385F122883E900B81FF8 /* HTMLTokenizer.h */, @@ -18992,6 +19036,20 @@ name = Plugins; sourceTree = "<group>"; }; + B1A942DD15B5CE2200D525D1 /* mediasource */ = { + isa = PBXGroup; + children = ( + B1A942E315B5CE2200D525D1 /* SourceBuffer.cpp */, + B1A942E415B5CE2200D525D1 /* SourceBuffer.h */, + B1A942E515B5CE2200D525D1 /* SourceBuffer.idl */, + B1A942E615B5CE2200D525D1 /* SourceBufferList.cpp */, + B1A942E715B5CE2200D525D1 /* SourceBufferList.h */, + B1A942E815B5CE2200D525D1 /* SourceBufferList.idl */, + ); + name = mediasource; + path = Modules/mediasource; + sourceTree = "<group>"; + }; B1AD4E7713A12A7200846B27 /* track */ = { isa = PBXGroup; children = ( @@ -20321,6 +20379,7 @@ BC2274750E8366E200E7F975 /* SVGRenderStyle.h */, BC2274760E8366E200E7F975 /* SVGRenderStyleDefs.cpp */, BC2274770E8366E200E7F975 /* SVGRenderStyleDefs.h */, + F553B89215BE26C000B134C9 /* WrapShapes.cpp */, FDB51CF4159CD70300E227C5 /* WrapShapes.h */, ); name = style; @@ -22003,8 +22062,10 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + A7BE7EE014C9175A0014489D /* FastMallocStatistics.h in Headers */, 417DA6DA13734E6E007C57FB /* Internals.h in Headers */, A7BF7EE014C9175A0014489D /* InternalSettings.h in Headers */, + A740B59514C935AB00A77FA4 /* JSFastMallocStatistics.h in Headers */, 417DA71E13735DFA007C57FB /* JSInternals.h in Headers */, A740B5A514C935AB00A77FA4 /* JSInternalSettings.h in Headers */, 41815C1F138319830057AAA4 /* WebCoreTestSupport.h in Headers */, @@ -22801,6 +22862,8 @@ 8502AB5A0AD438C000378540 /* DOMSVGFEImageElement.h in Headers */, 8502AB9B0AD4394E00378540 /* DOMSVGFEImageElementInternal.h in Headers */, 8502AB5C0AD438C000378540 /* DOMSVGFEMergeElement.h in Headers */, + 2D9A247415B9C2E300D34527 /* DOMDOMSecurityPolicy.h in Headers */, + 2D9A247515B9C2E300D34527 /* DOMDOMSecurityPolicyInternal.h in Headers */, 8502AB9C0AD4394E00378540 /* DOMSVGFEMergeElementInternal.h in Headers */, 8502AB5E0AD438C000378540 /* DOMSVGFEMergeNodeElement.h in Headers */, 8502AB9D0AD4394E00378540 /* DOMSVGFEMergeNodeElementInternal.h in Headers */, @@ -23315,6 +23378,7 @@ 977B386D122883E900B81FF8 /* HTMLEntityTable.h in Headers */, A81369D4097374F600D74463 /* HTMLFieldSetElement.h in Headers */, A8CFF7A60A156978000A4234 /* HTMLFontElement.h in Headers */, + 2D9A246E15B9BD0000D34527 /* DOMSecurityPolicy.h in Headers */, 977B386F122883E900B81FF8 /* HTMLFormattingElementList.h in Headers */, A8DF3FCE097FA0FC0052981B /* HTMLFormCollection.h in Headers */, A81369CE097374F600D74463 /* HTMLFormControlElement.h in Headers */, @@ -25611,6 +25675,7 @@ files = ( 417DA6D913734E6E007C57FB /* Internals.cpp in Sources */, A7BF7EDF14C9175A0014489D /* InternalSettings.cpp in Sources */, + A740B59714C935AF00A77FA4 /* JSFastMallocStatistics.cpp in Sources */, 417DA71D13735DFA007C57FB /* JSInternals.cpp in Sources */, A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */, 41815C1E138319830057AAA4 /* WebCoreTestSupport.cpp in Sources */, @@ -25630,6 +25695,7 @@ buildActionMask = 2147483647; files = ( FDE6860215B0A93B00BB480C /* WrapShapeFunctions.cpp in Sources */, + 2D9A247315B9C2D100D34527 /* DOMDOMSecurityPolicy.mm in Sources */, 97BC69DA1505F076001B74AC /* AbstractDatabase.cpp in Sources */, 41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */, 0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */, @@ -26087,6 +26153,7 @@ 8538F05C0AD722F1006A81D1 /* DOMRange.mm in Sources */, 858C38A80AA8F20400B187A4 /* DOMRect.mm in Sources */, BCAEFCAE1016CE4A0040D34E /* DOMRGBColor.mm in Sources */, + 2D9A246F15B9BD2F00D34527 /* DOMSecurityPolicy.cpp in Sources */, BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */, 4ACBC0C312713CCA0094F9B2 /* DOMSettableTokenList.cpp in Sources */, C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */, @@ -28332,10 +28399,12 @@ FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */, C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */, + F553B89315BE26C000B134C9 /* WrapShapes.cpp in Sources */, 1059457315B42953004D37FD /* JSMicroDataItemValueCustom.cpp in Sources */, 1059457715B42A0D004D37FD /* JSMicroDataItemValue.cpp in Sources */, 1059459715B42A8E004D37FD /* PropertyNodeList.cpp in Sources */, 1059459D15B42B0C004D37FD /* JSPropertyNodeList.cpp in Sources */, + CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 1d68ae50c..e06f9e8ac 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -1036,13 +1036,16 @@ String AccessibilityRenderObject::helpText() const if (!describedBy.isEmpty()) return describedBy; + String description = accessibilityDescription(); for (RenderObject* curr = m_renderer; curr; curr = curr->parent()) { if (curr->node() && curr->node()->isHTMLElement()) { const AtomicString& summary = static_cast<Element*>(curr->node())->getAttribute(summaryAttr); if (!summary.isEmpty()) return summary; + + // The title attribute should be used as help text unless it is already being used as descriptive text. const AtomicString& title = static_cast<Element*>(curr->node())->getAttribute(titleAttr); - if (!title.isEmpty()) + if (!title.isEmpty() && description != title) return title; } @@ -1498,6 +1501,13 @@ String AccessibilityRenderObject::accessibilityDescription() const if (isWebArea()) return webAreaAccessibilityDescription(); + // An element's descriptive text is comprised of title() (what's visible on the screen) and accessibilityDescription() (other descriptive text). + // Both are used to generate what a screen reader speaks. + // If this point is reached (i.e. there's no accessibilityDescription) and there's no title(), we should fallback to using the title attribute. + // The title attribute is normally used as help text (because it is a tooltip), but if there is nothing else available, this should be used (according to ARIA). + if (title().isEmpty()) + return getAttribute(titleAttr); + return String(); } diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index 494f866b0..a22f44501 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -198,6 +198,46 @@ bool RuntimeEnabledFeatures::isStyleScopedEnabled = false; bool RuntimeEnabledFeatures::isInputTypeDateEnabled = true; #endif +#if ENABLE(INPUT_TYPE_DATETIME) +#if PLATFORM(CHROMIUM) && !OS(ANDROID) +bool RuntimeEnabledFeatures::isInputTypeDateTimeEnabled = false; +#else +bool RuntimeEnabledFeatures::isInputTypeDateTimeEnabled = true; +#endif +#endif + +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) +#if PLATFORM(CHROMIUM) && !OS(ANDROID) +bool RuntimeEnabledFeatures::isInputTypeDateTimeLocalEnabled = false; +#else +bool RuntimeEnabledFeatures::isInputTypeDateTimeLocalEnabled = true; +#endif +#endif + +#if ENABLE(INPUT_TYPE_MONTH) +#if PLATFORM(CHROMIUM) && !OS(ANDROID) +bool RuntimeEnabledFeatures::isInputTypeMonthEnabled = false; +#else +bool RuntimeEnabledFeatures::isInputTypeMonthEnabled = true; +#endif +#endif + +#if ENABLE(INPUT_TYPE_TIME) +#if PLATFORM(CHROMIUM) && !OS(ANDROID) +bool RuntimeEnabledFeatures::isInputTypeTimeEnabled = false; +#else +bool RuntimeEnabledFeatures::isInputTypeTimeEnabled = true; +#endif +#endif + +#if ENABLE(INPUT_TYPE_WEEK) +#if PLATFORM(CHROMIUM) && !OS(ANDROID) +bool RuntimeEnabledFeatures::isInputTypeWeekEnabled = false; +#else +bool RuntimeEnabledFeatures::isInputTypeWeekEnabled = true; +#endif +#endif + #if ENABLE(DIALOG_ELEMENT) bool RuntimeEnabledFeatures::isDialogElementEnabled = false; #endif diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h index b66d1ae46..684c57d8b 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -187,13 +187,12 @@ public: static bool peerConnectionEnabled() { return isMediaStreamEnabled && isPeerConnectionEnabled; } static void setPeerConnectionEnabled(bool isEnabled) { isPeerConnectionEnabled = isEnabled; } - static bool webkitDeprecatedPeerConnectionEnabled() { return peerConnectionEnabled(); } static bool webkitPeerConnection00Enabled() { return peerConnectionEnabled(); } #endif #if ENABLE(GAMEPAD) - static void setWebkitGamepadsEnabled(bool isEnabled) { isGamepadEnabled = isEnabled; } - static bool webkitGamepadsEnabled() { return isGamepadEnabled; } + static void setWebkitGetGamepadsEnabled(bool isEnabled) { isGamepadEnabled = isEnabled; } + static bool webkitGetGamepadsEnabled() { return isGamepadEnabled; } #endif #if ENABLE(QUOTA) @@ -231,6 +230,31 @@ public: static void setInputTypeDateEnabled(bool isEnabled) { isInputTypeDateEnabled = isEnabled; } #endif +#if ENABLE(INPUT_TYPE_DATETIME) + static bool inputTypeDateTimeEnabled() { return isInputTypeDateTimeEnabled; } + static void setInputTypeDateTimeEnabled(bool isEnabled) { isInputTypeDateTimeEnabled = isEnabled; } +#endif + +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + static bool inputTypeDateTimeLocalEnabled() { return isInputTypeDateTimeLocalEnabled; } + static void setInputTypeDateTimeLocalEnabled(bool isEnabled) { isInputTypeDateTimeLocalEnabled = isEnabled; } +#endif + +#if ENABLE(INPUT_TYPE_MONTH) + static bool inputTypeMonthEnabled() { return isInputTypeMonthEnabled; } + static void setInputTypeMonthEnabled(bool isEnabled) { isInputTypeMonthEnabled = isEnabled; } +#endif + +#if ENABLE(INPUT_TYPE_TIME) + static bool inputTypeTimeEnabled() { return isInputTypeTimeEnabled; } + static void setInputTypeTimeEnabled(bool isEnabled) { isInputTypeTimeEnabled = isEnabled; } +#endif + +#if ENABLE(INPUT_TYPE_WEEK) + static bool inputTypeWeekEnabled() { return isInputTypeWeekEnabled; } + static void setInputTypeWeekEnabled(bool isEnabled) { isInputTypeWeekEnabled = isEnabled; } +#endif + #if ENABLE(DIALOG_ELEMENT) static bool dialogElementEnabled() { return isDialogElementEnabled; } static void setDialogElementEnabled(bool isEnabled) { isDialogElementEnabled = isEnabled; } @@ -310,6 +334,26 @@ private: static bool isInputTypeDateEnabled; #endif +#if ENABLE(INPUT_TYPE_DATETIME) + static bool isInputTypeDateTimeEnabled; +#endif + +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + static bool isInputTypeDateTimeLocalEnabled; +#endif + +#if ENABLE(INPUT_TYPE_MONTH) + static bool isInputTypeMonthEnabled; +#endif + +#if ENABLE(INPUT_TYPE_TIME) + static bool isInputTypeTimeEnabled; +#endif + +#if ENABLE(INPUT_TYPE_WEEK) + static bool isInputTypeWeekEnabled; +#endif + #if ENABLE(DIALOG_ELEMENT) static bool isDialogElementEnabled; #endif diff --git a/Source/WebCore/bindings/gobject/GNUmakefile.am b/Source/WebCore/bindings/gobject/GNUmakefile.am index 400ff9a6a..8ef9663cb 100644 --- a/Source/WebCore/bindings/gobject/GNUmakefile.am +++ b/Source/WebCore/bindings/gobject/GNUmakefile.am @@ -43,6 +43,8 @@ webkitgtk_gdom_built_sources += \ DerivedSources/webkit/WebKitDOMDOMPluginArrayPrivate.h \ DerivedSources/webkit/WebKitDOMDOMPlugin.cpp \ DerivedSources/webkit/WebKitDOMDOMPluginPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMSecurityPolicy.cpp \ + DerivedSources/webkit/WebKitDOMDOMSecurityPolicyPrivate.h \ DerivedSources/webkit/WebKitDOMDOMSelection.cpp \ DerivedSources/webkit/WebKitDOMDOMSelectionPrivate.h \ DerivedSources/webkit/WebKitDOMDOMStringList.cpp \ @@ -278,6 +280,7 @@ webkitgtk_built_h_api += \ DerivedSources/webkit/WebKitDOMDocumentType.h \ DerivedSources/webkit/WebKitDOMDOMImplementation.h \ DerivedSources/webkit/WebKitDOMDOMSettableTokenList.h \ + DerivedSources/webkit/WebKitDOMDOMSecurityPolicy.h \ DerivedSources/webkit/WebKitDOMDOMStringList.h \ DerivedSources/webkit/WebKitDOMDOMStringMap.h \ DerivedSources/webkit/WebKitDOMDOMTokenList.h \ diff --git a/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h b/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h index df9e43906..8c6f42677 100644 --- a/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h +++ b/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h @@ -29,6 +29,7 @@ #include "ExceptionCode.h" #include "JSArrayBuffer.h" +#include "JSArrayBufferView.h" #include "JSDOMBinding.h" #include <interpreter/CallFrame.h> #include <runtime/ArgList.h> @@ -36,6 +37,7 @@ #include <runtime/JSObject.h> #include <runtime/JSValue.h> #include <wtf/ArrayBufferView.h> +#include <wtf/TypedArrayBase.h> namespace WebCore { @@ -86,6 +88,72 @@ JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionF // Template function used by XXXArrayConstructors. // If this returns 0, it will already have thrown a JavaScript exception. template<class C, typename T> +PassRefPtr<C> constructArrayBufferViewWithTypedArrayArgument(JSC::ExecState* exec) +{ + RefPtr<ArrayBufferView> source = toArrayBufferView(exec->argument(0)); + if (!source) + return 0; + + ArrayBufferView::ViewType sourceType = source->getType(); + if (sourceType == ArrayBufferView::TypeDataView) + return 0; + + uint32_t length = asObject(exec->argument(0))->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec); + RefPtr<C> array = C::createUninitialized(length); + if (!array) { + setDOMException(exec, INDEX_SIZE_ERR); + return array; + } + + if (array->getType() == sourceType) { + memcpy(array->baseAddress(), source->baseAddress(), length * sizeof(T)); + return array; + } + + switch (sourceType) { + case ArrayBufferView::TypeInt8: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<signed char> *>(source.get())->item(i))); + break; + case ArrayBufferView::TypeUint8: + case ArrayBufferView::TypeUint8Clamped: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<unsigned char> *>(source.get())->item(i))); + break; + case ArrayBufferView::TypeInt16: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<signed short> *>(source.get())->item(i))); + break; + case ArrayBufferView::TypeUint16: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<unsigned short> *>(source.get())->item(i))); + break; + case ArrayBufferView::TypeInt32: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<int> *>(source.get())->item(i))); + break; + case ArrayBufferView::TypeUint32: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<unsigned int> *>(source.get())->item(i))); + break; + case ArrayBufferView::TypeFloat32: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<float> *>(source.get())->item(i))); + break; + case ArrayBufferView::TypeFloat64: + for (unsigned i = 0; i < length; ++i) + array->set(i, (T)(static_cast<TypedArrayBase<double> *>(source.get())->item(i))); + break; + default: + return 0; + } + + return array; +} + +// Template function used by XXXArrayConstructors. +// If this returns 0, it will already have thrown a JavaScript exception. +template<class C, typename T> PassRefPtr<C> constructArrayBufferViewWithArrayBufferArgument(JSC::ExecState* exec) { RefPtr<ArrayBuffer> buffer = toArrayBuffer(exec->argument(0)); @@ -138,9 +206,13 @@ PassRefPtr<C> constructArrayBufferView(JSC::ExecState* exec) if (view) return view; + view = constructArrayBufferViewWithTypedArrayArgument<C, T>(exec); + if (view) + return view; + JSC::JSObject* srcArray = asObject(exec->argument(0)); uint32_t length = srcArray->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec); - RefPtr<C> array = C::create(length); + RefPtr<C> array = C::createUninitialized(length); if (!array) { setDOMException(exec, INDEX_SIZE_ERR); return array; diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp index cf21aae66..31f25daf0 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.cpp +++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp @@ -277,27 +277,4 @@ Structure* cacheDOMStructure(JSDOMGlobalObject* globalObject, Structure* structu return structures.set(classInfo, WriteBarrier<Structure>(globalObject->globalData(), globalObject, structure)).iterator->second.get(); } -JSC::JSObject* toJSSequence(ExecState* exec, JSValue value, unsigned& length) -{ - JSObject* object = value.getObject(); - if (!object) { - throwTypeError(exec); - return 0; - } - JSValue lengthValue = object->get(exec, exec->propertyNames().length); - if (exec->hadException()) - return 0; - - if (lengthValue.isUndefinedOrNull()) { - throwTypeError(exec); - return 0; - } - - length = lengthValue.toUInt32(exec); - if (exec->hadException()) - return 0; - - return object; -} - } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h index c60e07d61..67badd236 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.h +++ b/Source/WebCore/bindings/js/JSDOMBinding.h @@ -34,6 +34,7 @@ #include "StylePropertySet.h" #include "StyledElement.h" #include <heap/Weak.h> +#include <runtime/Error.h> #include <runtime/FunctionPrototype.h> #include <runtime/JSArray.h> #include <runtime/Lookup.h> @@ -275,6 +276,31 @@ enum ParameterDefaultPolicy { // NaN if the value can't be converted to a date. double valueToDate(JSC::ExecState*, JSC::JSValue); + // Validates that the passed object is a sequence type per section 4.1.13 of the WebIDL spec. + inline JSC::JSObject* toJSSequence(JSC::ExecState* exec, JSC::JSValue value, unsigned& length) + { + JSC::JSObject* object = value.getObject(); + if (!object) { + throwTypeError(exec); + return 0; + } + + JSC::JSValue lengthValue = object->get(exec, exec->propertyNames().length); + if (exec->hadException()) + return 0; + + if (lengthValue.isUndefinedOrNull()) { + throwTypeError(exec); + return 0; + } + + length = lengthValue.toUInt32(exec); + if (exec->hadException()) + return 0; + + return object; + } + template <typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<T> ptr) { @@ -282,7 +308,7 @@ enum ParameterDefaultPolicy { } template <class T> - struct Traits { + struct JSValueTraits { static inline JSC::JSValue arrayJSValue(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const T& value) { return toJS(exec, globalObject, WTF::getPtr(value)); @@ -290,7 +316,7 @@ enum ParameterDefaultPolicy { }; template<> - struct Traits<String> { + struct JSValueTraits<String> { static inline JSC::JSValue arrayJSValue(JSC::ExecState* exec, JSDOMGlobalObject*, const String& value) { return jsString(exec, stringToUString(value)); @@ -298,7 +324,7 @@ enum ParameterDefaultPolicy { }; template<> - struct Traits<float> { + struct JSValueTraits<float> { static inline JSC::JSValue arrayJSValue(JSC::ExecState*, JSDOMGlobalObject*, const float& value) { return JSC::jsNumber(value); @@ -306,7 +332,7 @@ enum ParameterDefaultPolicy { }; template<> - struct Traits<unsigned long> { + struct JSValueTraits<unsigned long> { static inline JSC::JSValue arrayJSValue(JSC::ExecState*, JSDOMGlobalObject*, const unsigned long& value) { return JSC::jsNumber(value); @@ -318,7 +344,7 @@ enum ParameterDefaultPolicy { { JSC::MarkedArgumentBuffer list; typename Vector<T, inlineCapacity>::const_iterator end = iterator.end(); - typedef Traits<T> TraitsType; + typedef JSValueTraits<T> TraitsType; for (typename Vector<T, inlineCapacity>::const_iterator iter = iterator.begin(); iter != end; ++iter) list.append(TraitsType::arrayJSValue(exec, globalObject, *iter)); @@ -328,25 +354,55 @@ enum ParameterDefaultPolicy { JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<DOMStringList>); + template<class T> struct NativeValueTraits; + + template<> + struct NativeValueTraits<String> { + static inline bool arrayNativeValue(JSC::ExecState* exec, JSC::JSValue jsValue, String& indexedValue) + { + indexedValue = ustringToString(jsValue.toString(exec)->value(exec)); + return true; + } + }; + + template<> + struct NativeValueTraits<unsigned long> { + static inline bool arrayNativeValue(JSC::ExecState* exec, JSC::JSValue jsValue, unsigned long& indexedValue) + { + if (!jsValue.isNumber()) + return false; + + indexedValue = jsValue.toUInt32(exec); + if (exec->hadException()) + return false; + + return true; + } + }; + template <class T> Vector<T> toNativeArray(JSC::ExecState* exec, JSC::JSValue value) { - if (!isJSArray(value)) - return Vector<T>(); - + unsigned length = 0; + if (isJSArray(value)) { + JSC::JSArray* array = asArray(value); + length = array->length(); + } else + toJSSequence(exec, value, length); + + JSC::JSObject* object = value.getObject(); Vector<T> result; - JSC::JSArray* array = asArray(value); + typedef NativeValueTraits<T> TraitsType; - for (unsigned i = 0; i < array->length(); ++i) { - String indexedValue = ustringToString(array->getIndex(i).toString(exec)->value(exec)); - result.append(indexedValue); + for (unsigned i = 0; i < length; ++i) { + T indexValue; + if (!TraitsType::arrayNativeValue(exec, object->get(exec, i), indexValue)) + return Vector<T>(); + result.append(indexValue); } return result; } - // Validates that the passed object is a sequence type per section 4.1.13 of the WebIDL spec. - JSC::JSObject* toJSSequence(JSC::ExecState*, JSC::JSValue, unsigned&); - // FIXME: Implement allowAccessToContext(JSC::ExecState*, ScriptExecutionContext*); bool shouldAllowAccessToNode(JSC::ExecState*, Node*); bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*); @@ -403,23 +459,6 @@ enum ParameterDefaultPolicy { return AtomicString(propertyName.publicName()); } - inline Vector<unsigned long> jsUnsignedLongArrayToVector(JSC::ExecState* exec, JSC::JSValue value) - { - unsigned length; - JSC::JSObject* object = toJSSequence(exec, value, length); - if (exec->hadException()) - return Vector<unsigned long>(); - - Vector<unsigned long> result; - for (unsigned i = 0; i < length; i++) { - JSC::JSValue indexedValue; - indexedValue = object->get(exec, i); - if (exec->hadException() || indexedValue.isUndefinedOrNull() || !indexedValue.isNumber()) - return Vector<unsigned long>(); - result.append(indexedValue.toUInt32(exec)); - } - return result; - } } // namespace WebCore #endif // JSDOMBinding_h diff --git a/Source/WebCore/bindings/js/JSDeprecatedPeerConnectionCustom.cpp b/Source/WebCore/bindings/js/JSDeprecatedPeerConnectionCustom.cpp deleted file mode 100644 index 56d5ee7c0..000000000 --- a/Source/WebCore/bindings/js/JSDeprecatedPeerConnectionCustom.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * Copyright (C) 2011 Ericsson AB. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(MEDIA_STREAM) - -#include "JSDeprecatedPeerConnection.h" - -#include "CallbackFunction.h" -#include "DeprecatedPeerConnection.h" -#include "JSSignalingCallback.h" -#include <runtime/Error.h> - -using namespace JSC; - -namespace WebCore { - -EncodedJSValue JSC_HOST_CALL JSDeprecatedPeerConnectionConstructor::constructJSDeprecatedPeerConnection(ExecState* exec) -{ - JSDeprecatedPeerConnectionConstructor* jsConstructor = static_cast<JSDeprecatedPeerConnectionConstructor*>(exec->callee()); - ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); - if (!context) - return throwVMError(exec, createReferenceError(exec, "DeprecatedPeerConnection constructor associated document is unavailable")); - - if (exec->argumentCount() < 2) - return throwVMError(exec, createNotEnoughArgumentsError(exec)); - - String serverConfiguration = ustringToString(exec->argument(0).toString(exec)->value(exec)); - if (exec->hadException()) - return JSValue::encode(JSValue()); - - RefPtr<SignalingCallback> signalingCallback = createFunctionOnlyCallback<JSSignalingCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(1)); - if (exec->hadException()) - return JSValue::encode(JSValue()); - - RefPtr<DeprecatedPeerConnection> peerConnection = DeprecatedPeerConnection::create(context, serverConfiguration, signalingCallback.release()); - return JSValue::encode(CREATE_DOM_WRAPPER(exec, jsConstructor->globalObject(), DeprecatedPeerConnection, peerConnection.get())); -} - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/bindings/js/JSDictionary.cpp b/Source/WebCore/bindings/js/JSDictionary.cpp index 938867ff8..1f398820b 100644 --- a/Source/WebCore/bindings/js/JSDictionary.cpp +++ b/Source/WebCore/bindings/js/JSDictionary.cpp @@ -107,7 +107,7 @@ void JSDictionary::convertValue(ExecState* exec, JSValue value, Vector<String>& if (value.isUndefinedOrNull()) return; - unsigned length; + unsigned length = 0; JSObject* object = toJSSequence(exec, value, length); if (exec->hadException()) return; @@ -171,7 +171,7 @@ void JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicSt if (value.isUndefinedOrNull()) return; - unsigned length; + unsigned length = 0; JSObject* object = toJSSequence(exec, value, length); if (exec->hadException()) return; diff --git a/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp index 28713498c..c1c2897ce 100644 --- a/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp @@ -35,12 +35,12 @@ using namespace JSC; bool JSHTMLAppletElement::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { - return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, this); + return pluginElementCustomGetOwnPropertySlot<JSHTMLAppletElement, Base>(exec, propertyName, slot, this); } bool JSHTMLAppletElement::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { - return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, this); + return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLAppletElement, Base>(exec, propertyName, descriptor, this); } bool JSHTMLAppletElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) diff --git a/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp index dc160d61b..d0df62044 100644 --- a/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp @@ -30,24 +30,13 @@ #include "HTMLFormElement.h" #if ENABLE(MICRODATA) -#include "MicroDataItemValue.h" +#include "JSMicroDataItemValue.h" #endif namespace WebCore { using namespace JSC; -#if ENABLE(MICRODATA) -static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, MicroDataItemValue* itemValue) -{ - if (!itemValue) - return jsNull(); - if (itemValue->isNode()) - return toJS(exec, globalObject, itemValue->getNode()); - return jsString(exec, itemValue->getString()); -} -#endif - ScopeChainNode* JSHTMLElement::pushEventHandlerScope(ExecState* exec, ScopeChainNode* scope) const { HTMLElement* element = impl(); diff --git a/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp index 878e21301..8b97603f8 100644 --- a/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp @@ -35,12 +35,12 @@ using namespace JSC; bool JSHTMLEmbedElement::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { - return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, this); + return pluginElementCustomGetOwnPropertySlot<JSHTMLEmbedElement, Base>(exec, propertyName, slot, this); } bool JSHTMLEmbedElement::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { - return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, this); + return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLEmbedElement, Base>(exec, propertyName, descriptor, this); } bool JSHTMLEmbedElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) diff --git a/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp index f311071b6..b3bf44098 100644 --- a/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp @@ -35,12 +35,12 @@ using namespace JSC; bool JSHTMLObjectElement::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { - return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, this); + return pluginElementCustomGetOwnPropertySlot<JSHTMLObjectElement, Base>(exec, propertyName, slot, this); } bool JSHTMLObjectElement::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { - return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, this); + return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLObjectElement, Base>(exec, propertyName, descriptor, this); } bool JSHTMLObjectElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) diff --git a/Source/WebCore/bindings/js/JSMessagePortCustom.cpp b/Source/WebCore/bindings/js/JSMessagePortCustom.cpp index 76a8c0f48..f44bbb7b4 100644 --- a/Source/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/Source/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -79,7 +79,7 @@ void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortA } // Validation of sequence types, per WebIDL spec 4.1.13. - unsigned length; + unsigned length = 0; JSObject* object = toJSSequence(exec, value, length); if (exec->hadException()) return; diff --git a/Source/WebCore/bindings/js/JSPluginElementFunctions.h b/Source/WebCore/bindings/js/JSPluginElementFunctions.h index 8e9be6e89..7d6fdba2c 100644 --- a/Source/WebCore/bindings/js/JSPluginElementFunctions.h +++ b/Source/WebCore/bindings/js/JSPluginElementFunctions.h @@ -44,6 +44,34 @@ namespace WebCore { bool runtimeObjectCustomPut(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSHTMLElement*, JSC::PutPropertySlot&); JSC::CallType runtimeObjectGetCallData(JSHTMLElement*, JSC::CallData&); + template <class Type, class Base> bool pluginElementCustomGetOwnPropertySlot(JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertySlot& slot, Type* element) + { + if (!element->globalObject()->world()->isNormal()) { + if (JSC::getStaticValueSlot<Type, Base>(exec, element->s_info.staticPropHashTable, element, propertyName, slot)) + return true; + + JSC::JSValue proto = element->prototype(); + if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName)) + return false; + } + + return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, element); + } + + template <class Type, class Base> bool pluginElementCustomGetOwnPropertyDescriptor(JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertyDescriptor& descriptor, Type* element) + { + if (!element->globalObject()->world()->isNormal()) { + if (JSC::getStaticValueDescriptor<Type, Base>(exec, element->s_info.staticPropHashTable, element, propertyName, descriptor)) + return true; + + JSC::JSValue proto = element->prototype(); + if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName)) + return false; + } + + return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, element); + } + } // namespace WebCore #endif // JSPluginElementFunctions_h diff --git a/Source/WebCore/bindings/js/ScriptGCEvent.cpp b/Source/WebCore/bindings/js/ScriptGCEvent.cpp index 9fe0c2e08..65c626a4d 100644 --- a/Source/WebCore/bindings/js/ScriptGCEvent.cpp +++ b/Source/WebCore/bindings/js/ScriptGCEvent.cpp @@ -43,12 +43,12 @@ namespace WebCore { using namespace JSC; -void ScriptGCEvent::getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize, size_t& heapSizeLimit) +void ScriptGCEvent::getHeapSize(HeapInfo& info) { JSGlobalData* globalData = JSDOMWindow::commonJSGlobalData(); - totalHeapSize = globalData->heap.capacity(); - usedHeapSize = globalData->heap.size(); - heapSizeLimit = 0; + info.totalJSHeapSize = globalData->heap.capacity(); + info.usedJSHeapSize = globalData->heap.size(); + info.jsHeapSizeLimit = 0; } } // namespace WebCore diff --git a/Source/WebCore/bindings/js/ScriptGCEvent.h b/Source/WebCore/bindings/js/ScriptGCEvent.h index 6614b8e00..126650160 100644 --- a/Source/WebCore/bindings/js/ScriptGCEvent.h +++ b/Source/WebCore/bindings/js/ScriptGCEvent.h @@ -31,10 +31,23 @@ #ifndef ScriptGCEvent_h #define ScriptGCEvent_h -#if ENABLE(INSPECTOR) - namespace WebCore { +struct HeapInfo { + HeapInfo() + : usedJSHeapSize(0) + , totalJSHeapSize(0) + , jsHeapSizeLimit(0) + { + } + + size_t usedJSHeapSize; + size_t totalJSHeapSize; + size_t jsHeapSizeLimit; +}; + +#if ENABLE(INSPECTOR) + class ScriptGCEventListener; class ScriptGCEvent @@ -42,10 +55,11 @@ class ScriptGCEvent public: static void addEventListener(ScriptGCEventListener*) { } static void removeEventListener(ScriptGCEventListener*) { } - static void getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize, size_t& heapSizeLimit); + static void getHeapSize(HeapInfo&); }; +#endif // ENABLE(INSPECTOR) + } // namespace WebCore -#endif // !ENABLE(INSPECTOR) #endif // !defined(ScriptGCEvent_h) diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm index ed90de825..b82344910 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -206,6 +206,7 @@ sub SkipFunction foreach my $param (@{$function->parameters}) { return 1 if $codeGenerator->GetSequenceType($param->type); + return 1 if $param->extendedAttributes->{"Clamp"}; } # FIXME: This is typically used to add script execution state arguments to the method. diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm index d74f4633e..e122fd4e8 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -247,6 +247,7 @@ sub SkipFunction { # code generator doesn't know how to auto-generate MediaQueryListListener or sequence<T>. foreach my $param (@{$function->parameters}) { if ($param->extendedAttributes->{"Callback"} || + $param->extendedAttributes->{"Clamp"} || $param->type eq "MediaQueryListListener" || $codeGenerator->GetSequenceType($param->type)) { return 1; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 03cc4e730..c3d9ad479 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -260,8 +260,6 @@ sub AddIncludesForType } elsif ($type eq "DOMString[]") { # FIXME: Add proper support for T[], T[]?, sequence<T> $includesRef->{"JSDOMStringList.h"} = 1; - } elsif ($type eq "unsigned long[]") { - $includesRef->{"<wtf/Vector.h>"} = 1; } elsif ($type eq "SerializedScriptValue") { $includesRef->{"SerializedScriptValue.h"} = 1; } elsif ($isCallback) { @@ -1277,7 +1275,7 @@ sub GenerateParametersCheckExpression # For Callbacks only checks if the value is null or object. push(@andExpression, "(${value}.isNull() || ${value}.isFunction())"); $usedArguments{$parameterIndex} = 1; - } elsif (IsArrayType($type)) { + } elsif (IsArrayType($type) || $codeGenerator->GetSequenceType($type)) { # FIXME: Add proper support for T[], T[]?, sequence<T> if ($parameter->isNullable) { push(@andExpression, "(${value}.isNull() || (${value}.isObject() && isJSArray(${value})))"); @@ -1766,13 +1764,13 @@ sub GenerateImplementation my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute->signature); push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString; - push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue"); - push(@implContent, " slotBase") if !$attribute->isStatic; - push(@implContent, ", PropertyName)\n"); + push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue slotBase, PropertyName)\n"); push(@implContent, "{\n"); - if (!$attribute->isStatic) { + if (!$attribute->isStatic || $attribute->signature->type =~ /Constructor$/) { push(@implContent, " ${className}* castedThis = jsCast<$className*>(asObject(slotBase));\n"); + } else { + push(@implContent, " UNUSED_PARAM(slotBase);\n"); } if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) { @@ -2609,6 +2607,14 @@ sub GenerateParametersCheck push(@$outputArray, " }\n"); push(@$outputArray, " RefPtr<$argType> $name = ${callbackClassName}::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n"); } + } elsif ($parameter->extendedAttributes->{"Clamp"}) { + my $nativeValue = "${name}NativeValue"; + push(@$outputArray, " $argType $name = 0;\n"); + push(@$outputArray, " double $nativeValue = exec->argument($argsIndex).toNumber(exec);\n"); + push(@$outputArray, " if (exec->hadException())\n"); + push(@$outputArray, " return JSValue::encode(jsUndefined());\n\n"); + push(@$outputArray, " if (!isnan(objArgsShortNativeValue))\n"); + push(@$outputArray, " $name = clampTo<$argType>($nativeValue);\n\n"); } else { # If the "StrictTypeChecking" extended attribute is present, and the argument's type is an # interface type, then if the incoming value does not implement that interface, a TypeError @@ -2924,8 +2930,7 @@ my %nativeType = ( "long long" => "long long", "unsigned long long" => "unsigned long long", "MediaQueryListListener" => "RefPtr<MediaQueryListListener>", - "DOMTimeStamp" => "DOMTimeStamp", - "unsigned long[]" => "Vector<unsigned long>" + "DOMTimeStamp" => "DOMTimeStamp", ); sub GetNativeType @@ -3072,11 +3077,6 @@ sub JSValueToNative return "toDOMStringList(exec, $value)"; } - if ($type eq "unsigned long[]") { - AddToImplIncludes("JSDOMBinding.h", $conditional); - return "jsUnsignedLongArrayToVector(exec, $value)"; - } - AddToImplIncludes("HTMLOptionElement.h", $conditional) if $type eq "HTMLOptionElement"; AddToImplIncludes("JSCustomVoidCallback.h", $conditional) if $type eq "VoidCallback"; AddToImplIncludes("Event.h", $conditional) if $type eq "Event"; @@ -3187,8 +3187,6 @@ sub NativeToJSValue } elsif ($type eq "SerializedScriptValue" or $type eq "any") { AddToImplIncludes("SerializedScriptValue.h", $conditional); return "$value ? $value->deserialize(exec, castedThis->globalObject(), 0) : jsNull()"; - } elsif ($type eq "unsigned long[]") { - AddToImplIncludes("<wrt/Vector.h>", $conditional); } elsif ($type eq "MessagePortArray") { AddToImplIncludes("MessagePort.h", $conditional); AddToImplIncludes("JSMessagePort.h", $conditional); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 269792ff0..cbb211395 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -457,6 +457,7 @@ sub SkipFunction foreach my $param (@{$function->parameters}) { return 1 if $codeGenerator->GetSequenceType($param->type); return 1 if $codeGenerator->GetArrayType($param->type); + return 1 if $param->extendedAttributes->{"Clamp"}; } return 0; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 7ac3e562a..3a0f7d5aa 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -422,6 +422,9 @@ END END push(@headerContent, "#endif // ${conditionalString}\n") if $conditionalString; } + if ($attrExt->{"V8EnabledPerContext"}) { + push(@enabledPerContext, $function); + } } if (IsConstructable($dataNode)) { @@ -1364,7 +1367,7 @@ sub GenerateParametersCheckExpression } elsif ($parameter->extendedAttributes->{"Callback"}) { # For Callbacks only checks if the value is null or object. push(@andExpression, "(${value}->IsNull() || ${value}->IsFunction())"); - } elsif (IsArrayType($type)) { + } elsif (IsArrayType($type) || $codeGenerator->GetSequenceType($type)) { # FIXME: Add proper support for T[], T[]?, sequence<T>. if ($parameter->isNullable) { push(@andExpression, "(${value}->IsNull() || ${value}->IsArray())"); @@ -1677,6 +1680,13 @@ sub GenerateParametersCheck $parameterCheckString .= " return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());\n"; $parameterCheckString .= " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n"; } + } elsif ($parameter->extendedAttributes->{"Clamp"}) { + my $nativeValue = "${parameterName}NativeValue"; + my $paramType = $parameter->type; + $parameterCheckString .= " $paramType $parameterName = 0\n"; + $parameterCheckString .= " EXCEPTION_BLOCK(double, $nativeValue, args[$paramIndex]->NumberValue());\n"; + $parameterCheckString .= " if (!isnan($nativeValue))\n"; + $parameterCheckString .= " $parameterName = clampTo<$paramType>($nativeValue);\n"; } elsif ($parameter->type eq "SerializedScriptValue") { AddToImplIncludes("SerializedScriptValue.h"); my $useTransferList = 0; @@ -2187,6 +2197,7 @@ sub IsStandardFunction return 0 if $attrExt->{"V8Unforgeable"}; return 0 if $function->isStatic; return 0 if $attrExt->{"V8EnabledAtRuntime"}; + return 0 if $attrExt->{"V8EnabledPerContext"}; return 0 if RequiresCustomSignature($function); return 0 if $attrExt->{"V8DoNotCheckSignature"}; return 0 if ($attrExt->{"DoNotCheckSecurity"} && ($dataNode->extendedAttributes->{"CheckSecurity"} || $interfaceName eq "DOMWindow")); @@ -2228,6 +2239,11 @@ sub GenerateNonStandardFunction my $enable_function = GetRuntimeEnableFunctionName($function->signature); $conditional = "if (${enable_function}())\n "; } + if ($attrExt->{"V8EnabledPerContext"}) { + # Only call Set()/SetAccessor() if this method should be enabled + my $enable_function = GetContextEnableFunction($function->signature); + $conditional = "if (${enable_function}(impl->document()))\n "; + } if ($attrExt->{"DoNotCheckSecurity"} && ($dataNode->extendedAttributes->{"CheckSecurity"} || $interfaceName eq "DOMWindow")) { @@ -2580,6 +2596,8 @@ sub GenerateImplementation my $indexer; my $namedPropertyGetter; + my @enabledPerContextFunctions; + my @normalFunctions; # Generate methods for functions. foreach my $function (@{$dataNode->functions}) { my $isCustom = $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"V8Custom"}; @@ -2606,6 +2624,13 @@ sub GenerateImplementation GenerateDomainSafeFunctionGetter($function, $implClassName); } } + + # Separate out functions that are enabled per context so we can process them specially. + if ($function->signature->extendedAttributes->{"V8EnabledPerContext"}) { + push(@enabledPerContextFunctions, $function); + } else { + push(@normalFunctions, $function); + } } # Attributes @@ -2615,22 +2640,22 @@ sub GenerateImplementation # ones that disallows shadowing and the rest. my @disallowsShadowing; # Also separate out attributes that are enabled at runtime so we can process them specially. - my @enabledAtRuntime; - my @enabledPerContext; - my @normal; + my @enabledAtRuntimeAttributes; + my @enabledPerContextAttributes; + my @normalAttributes; foreach my $attribute (@$attributes) { if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttributes->{"V8Unforgeable"}) { push(@disallowsShadowing, $attribute); } elsif ($attribute->signature->extendedAttributes->{"V8EnabledAtRuntime"}) { - push(@enabledAtRuntime, $attribute); + push(@enabledAtRuntimeAttributes, $attribute); } elsif ($attribute->signature->extendedAttributes->{"V8EnabledPerContext"}) { - push(@enabledPerContext, $attribute); + push(@enabledPerContextAttributes, $attribute); } else { - push(@normal, $attribute); + push(@normalAttributes, $attribute); } } - $attributes = \@normal; + $attributes = \@normalAttributes; # Put the attributes that disallow shadowing on the shadow object. if (@disallowsShadowing) { push(@implContent, "static const BatchedAttribute shadowAttrs[] = {\n"); @@ -2649,7 +2674,7 @@ sub GenerateImplementation # Setup table of standard callback functions my $num_callbacks = 0; my $has_callbacks = 0; - foreach my $function (@{$dataNode->functions}) { + foreach my $function (@normalFunctions) { # Only one table entry is needed for overloaded methods: next if $function->{overloadIndex} > 1; # Don't put any nonstandard functions into this table: @@ -2793,7 +2818,7 @@ END END } - if ($access_check or @enabledAtRuntime or @{$dataNode->functions} or $has_constants) { + if ($access_check or @enabledAtRuntimeAttributes or @normalFunctions or $has_constants) { push(@implContent, <<END); v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); @@ -2805,7 +2830,7 @@ END push(@implContent, " $access_check\n"); # Setup the enable-at-runtime attrs if we have them - foreach my $runtime_attr (@enabledAtRuntime) { + foreach my $runtime_attr (@enabledAtRuntimeAttributes) { my $enable_function = GetRuntimeEnableFunctionName($runtime_attr->signature); my $conditionalString = $codeGenerator->GenerateConditionalString($runtime_attr->signature); push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString; @@ -2842,7 +2867,7 @@ END # Define our functions with Set() or SetAccessor() my $total_functions = 0; - foreach my $function (@{$dataNode->functions}) { + foreach my $function (@normalFunctions) { # Only one accessor is needed for overloaded methods: next if $function->{overloadIndex} > 1; @@ -2931,7 +2956,7 @@ bool ${className}::HasInstance(v8::Handle<v8::Value> value) END - if (@enabledPerContext) { + if (@enabledPerContextAttributes or @enabledPerContextFunctions) { push(@implContent, <<END); void ${className}::installPerContextProperties(v8::Handle<v8::Object> instance, ${implClassName}* impl) { @@ -2939,19 +2964,44 @@ void ${className}::installPerContextProperties(v8::Handle<v8::Object> instance, // When building QtWebkit with V8 this variable is unused when none of the features are enabled. UNUSED_PARAM(proto); END - # Setup the enable-by-settings attrs if we have them - foreach my $runtimeAttr (@enabledPerContext) { - my $enableFunction = GetContextEnableFunction($runtimeAttr->signature); - my $conditionalString = $codeGenerator->GenerateConditionalString($runtimeAttr->signature); - push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString; - push(@implContent, " if (ContextFeatures::${enableFunction}(impl->document())) {\n"); - push(@implContent, " static const BatchedAttribute attrData =\\\n"); - GenerateSingleBatchedAttribute($interfaceName, $runtimeAttr, ";", " "); - push(@implContent, <<END); + + if (@enabledPerContextAttributes) { + # Setup the enable-by-settings attrs if we have them + foreach my $runtimeAttr (@enabledPerContextAttributes) { + my $enableFunction = GetContextEnableFunction($runtimeAttr->signature); + my $conditionalString = $codeGenerator->GenerateConditionalString($runtimeAttr->signature); + push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString; + push(@implContent, " if (${enableFunction}(impl->document())) {\n"); + push(@implContent, " static const BatchedAttribute attrData =\\\n"); + GenerateSingleBatchedAttribute($interfaceName, $runtimeAttr, ";", " "); + push(@implContent, <<END); configureAttribute(instance, proto, attrData); END - push(@implContent, " }\n"); - push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString; + push(@implContent, " }\n"); + push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString; + } + } + + # Setup the enable-by-settings functions if we have them + if (@enabledPerContextFunctions) { + push(@implContent, <<END); + v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate()); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. +END + + foreach my $runtimeFunc (@enabledPerContextFunctions) { + my $enableFunction = GetContextEnableFunction($runtimeFunc->signature); + my $conditionalString = $codeGenerator->GenerateConditionalString($runtimeFunc->signature); + push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString; + push(@implContent, " if (${enableFunction}(impl->document())) {\n"); + my $name = $runtimeFunc->signature->name; + my $callback = GetFunctionTemplateCallbackName($runtimeFunc, $interfaceName); + push(@implContent, <<END); + proto->Set(v8::String::New("${name}"), v8::FunctionTemplate::New(${callback}, v8::Handle<v8::Value>(), defaultSignature)->GetFunction()); +END + push(@implContent, " }\n"); + push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString; + } } push(@implContent, <<END); @@ -3307,6 +3357,21 @@ END push(@implContent, <<END); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; +END + + my $hasEnabledPerContextFunctions = 0; + foreach my $function (@{$dataNode->functions}) { + if ($function->signature->extendedAttributes->{"V8EnabledPerContext"}) { + $hasEnabledPerContextFunctions = 1; + } + } + if ($hasEnabledPerContextFunctions) { + push(@implContent, <<END); + installPerContextProperties(wrapper, impl.get()); +END + } + + push(@implContent, <<END); v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); @@ -4084,12 +4149,12 @@ sub GetContextEnableFunction # If a parameter is given (e.g. "V8EnabledPerContext=FeatureName") return the {FeatureName}Allowed() method. if ($signature->extendedAttributes->{"V8EnabledPerContext"} && $signature->extendedAttributes->{"V8EnabledPerContext"} ne "VALUE_IS_MISSING") { - return $codeGenerator->WK_lcfirst($signature->extendedAttributes->{"V8EnabledPerContext"}) . "Enabled"; + return "ContextFeatures::" . $codeGenerator->WK_lcfirst($signature->extendedAttributes->{"V8EnabledPerContext"}) . "Enabled"; } # Or it fallbacks to the attribute name if the parameter value is missing. my $attributeName = $signature->name; - return $codeGenerator->WK_lcfirst($attributeName) . "Enabled"; + return "ContextFeatures::" . $codeGenerator->WK_lcfirst($attributeName) . "Enabled"; } sub GetPassRefPtrType diff --git a/Source/WebCore/bindings/scripts/IDLAttributes.txt b/Source/WebCore/bindings/scripts/IDLAttributes.txt index b6d890e72..d80522232 100644 --- a/Source/WebCore/bindings/scripts/IDLAttributes.txt +++ b/Source/WebCore/bindings/scripts/IDLAttributes.txt @@ -25,6 +25,7 @@ CallWith=ScriptExecutionContext|ScriptState|ScriptArguments|CallStack Callback CheckSecurity CheckSecurityForNode +Clamp Conditional=* Constructor ConstructorParameters=* diff --git a/Source/WebCore/bindings/scripts/preprocessor.pm b/Source/WebCore/bindings/scripts/preprocessor.pm index 3b4cec191..95995f00a 100644 --- a/Source/WebCore/bindings/scripts/preprocessor.pm +++ b/Source/WebCore/bindings/scripts/preprocessor.pm @@ -63,7 +63,7 @@ sub applyPreprocessor @macros = map { "-D$_" } @macros; my $pid = 0; - if ($Config{osname} eq "cygwin") { + if ($Config{osname} eq "cygwin" || $Config{osname} eq 'MSWin32') { # This call can fail if Windows rebases cygwin, so retry a few times until it succeeds. for (my $tries = 0; !$pid && ($tries < 20); $tries++) { eval { diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index 013f9097f..a93f968e4 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -97,12 +97,12 @@ WebDOMTestObj::~WebDOMTestObj() m_impl = 0; } -int WebDOMTestObj::readOnlyIntAttr() const +int WebDOMTestObj::readOnlyLongAttr() const { if (!impl()) return 0; - return impl()->readOnlyIntAttr(); + return impl()->readOnlyLongAttr(); } WebDOMString WebDOMTestObj::readOnlyStringAttr() const @@ -153,20 +153,20 @@ void WebDOMTestObj::setUnsignedShortAttr(unsigned short newUnsignedShortAttr) impl()->setUnsignedShortAttr(newUnsignedShortAttr); } -int WebDOMTestObj::intAttr() const +long long WebDOMTestObj::Attr() const { if (!impl()) return 0; - return impl()->intAttr(); + return impl()->attr(); } -void WebDOMTestObj::setIntAttr(int newIntAttr) +void WebDOMTestObj::setAttr(long long newAttr) { if (!impl()) return; - impl()->setIntAttr(newIntAttr); + impl()->setAttr(newAttr); } long long WebDOMTestObj::longLongAttr() const @@ -661,28 +661,28 @@ void WebDOMTestObj::voidMethod() impl()->voidMethod(); } -void WebDOMTestObj::voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +void WebDOMTestObj::voidMethodWithArgs(long long Arg, const WebDOMString& strArg, const WebDOMTestObj& objArg) { if (!impl()) return; - impl()->voidMethodWithArgs(intArg, strArg, toWebCore(objArg)); + impl()->voidMethodWithArgs(Arg, strArg, toWebCore(objArg)); } -int WebDOMTestObj::intMethod() +long long WebDOMTestObj::Method() { if (!impl()) return 0; - return impl()->intMethod(); + return impl()->method(); } -int WebDOMTestObj::intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +long long WebDOMTestObj::MethodWithArgs(long long Arg, const WebDOMString& strArg, const WebDOMTestObj& objArg) { if (!impl()) return 0; - return impl()->intMethodWithArgs(intArg, strArg, toWebCore(objArg)); + return impl()->methodWithArgs(Arg, strArg, toWebCore(objArg)); } WebDOMTestObj WebDOMTestObj::objMethod() @@ -693,12 +693,12 @@ WebDOMTestObj WebDOMTestObj::objMethod() return toWebKit(WTF::getPtr(impl()->objMethod())); } -WebDOMTestObj WebDOMTestObj::objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +WebDOMTestObj WebDOMTestObj::objMethodWithArgs(long long Arg, const WebDOMString& strArg, const WebDOMTestObj& objArg) { if (!impl()) return WebDOMTestObj(); - return toWebKit(WTF::getPtr(impl()->objMethodWithArgs(intArg, strArg, toWebCore(objArg)))); + return toWebKit(WTF::getPtr(impl()->objMethodWithArgs(Arg, strArg, toWebCore(objArg)))); } WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg) diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index fc7da9bca..bd373d837 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -70,15 +70,15 @@ public: WEBDOM_CONST_JAVASCRIPT = 15 }; - int readOnlyIntAttr() const; + int readOnlyLongAttr() const; WebDOMString readOnlyStringAttr() const; WebDOMTestObj readOnlyTestObjAttr() const; short shortAttr() const; void setShortAttr(short); unsigned short unsignedShortAttr() const; void setUnsignedShortAttr(unsigned short); - int intAttr() const; - void setIntAttr(int); + long long Attr() const; + void setAttr(long long); long long longLongAttr() const; void setLongLongAttr(long long); unsigned long long unsignedLongLongAttr() const; @@ -145,11 +145,11 @@ public: int replaceableAttribute() const; void voidMethod(); - void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); - int intMethod(); - int intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + void voidMethodWithArgs(long long Arg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + long long Method(); + long long MethodWithArgs(long long Arg, const WebDOMString& strArg, const WebDOMTestObj& objArg); WebDOMTestObj objMethod(); - WebDOMTestObj objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebDOMTestObj objMethodWithArgs(long long Arg, const WebDOMString& strArg, const WebDOMTestObj& objArg); WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg); void serializedValue(const WebDOMString& serializedArg); void idbKey(const WebDOMIDBKey& key); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 3b6253cbe..5e2bde4a0 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -100,12 +100,12 @@ G_DEFINE_TYPE(WebKitDOMTestObj, webkit_dom_test_obj, WEBKIT_TYPE_DOM_OBJECT) enum { PROP_0, - PROP_READ_ONLY_INT_ATTR, + PROP_READ_ONLY_LONG_ATTR, PROP_READ_ONLY_STRING_ATTR, PROP_READ_ONLY_TEST_OBJ_ATTR, PROP_SHORT_ATTR, PROP_UNSIGNED_SHORT_ATTR, - PROP_INT_ATTR, + PROP_ATTR, PROP_LONG_LONG_ATTR, PROP_UNSIGNED_LONG_LONG_ATTR, PROP_STRING_ATTR, @@ -177,10 +177,6 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint propertyId, coreSelf->setUnsignedShortAttr((g_value_get_uint(value))); break; } - case PROP_INT_ATTR: { - coreSelf->setIntAttr((g_value_get_long(value))); - break; - } case PROP_UNSIGNED_LONG_LONG_ATTR: { coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value))); break; @@ -283,6 +279,10 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint propertyId, #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ break; } + case PROP_STRAWBERRY: { + coreSelf->setBlueberry((g_value_get_long(value))); + break; + } case PROP_STRICT_FLOAT: { coreSelf->setStrictFloat((g_value_get_float(value))); break; @@ -306,8 +306,8 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint propertyId, WebCore::TestObj* coreSelf = WebKit::core(self); switch (propertyId) { - case PROP_READ_ONLY_INT_ATTR: { - g_value_set_long(value, coreSelf->readOnlyIntAttr()); + case PROP_READ_ONLY_LONG_ATTR: { + g_value_set_long(value, coreSelf->readOnlyLongAttr()); break; } case PROP_READ_ONLY_STRING_ATTR: { @@ -327,8 +327,8 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint propertyId, g_value_set_uint(value, coreSelf->unsignedShortAttr()); break; } - case PROP_INT_ATTR: { - g_value_set_long(value, coreSelf->intAttr()); + case PROP_ATTR: { + g_value_set_int64(value, coreSelf->attr()); break; } case PROP_LONG_LONG_ATTR: { @@ -499,7 +499,7 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint propertyId, break; } case PROP_STRAWBERRY: { - g_value_set_int(value, coreSelf->blueberry()); + g_value_set_long(value, coreSelf->blueberry()); break; } case PROP_STRICT_FLOAT: { @@ -545,10 +545,10 @@ static void webkit_dom_test_obj_class_init(WebKitDOMTestObjClass* requestClass) gobjectClass->constructed = webkit_dom_test_obj_constructed; g_object_class_install_property(gobjectClass, - PROP_READ_ONLY_INT_ATTR, - g_param_spec_long("read-only-int-attr", /* name */ - "test_obj_read-only-int-attr", /* short description */ - "read-only glong TestObj.read-only-int-attr", /* longer - could do with some extra doc stuff here */ + PROP_READ_ONLY_LONG_ATTR, + g_param_spec_long("read-only-long-attr", /* name */ + "test_obj_read-only-long-attr", /* short description */ + "read-only glong TestObj.read-only-long-attr", /* longer - could do with some extra doc stuff here */ G_MINLONG, /* min */ G_MAXLONG, /* max */ 0, /* default */ @@ -586,12 +586,12 @@ G_MAXUINT, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, - PROP_INT_ATTR, - g_param_spec_long("int-attr", /* name */ - "test_obj_int-attr", /* short description */ - "read-write glong TestObj.int-attr", /* longer - could do with some extra doc stuff here */ - G_MINLONG, /* min */ -G_MAXLONG, /* max */ + PROP_ATTR, + g_param_spec_int64("attr", /* name */ + "test_obj_attr", /* short description */ + "read-write gint64 TestObj.attr", /* longer - could do with some extra doc stuff here */ + G_MININT64, /* min */ +G_MAXINT64, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, @@ -849,11 +849,11 @@ G_MAXLONG, /* max */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, PROP_STRAWBERRY, - g_param_spec_int("strawberry", /* name */ + g_param_spec_long("strawberry", /* name */ "test_obj_strawberry", /* short description */ - "read-write gint TestObj.strawberry", /* longer - could do with some extra doc stuff here */ - G_MININT, /* min */ -G_MAXINT, /* max */ + "read-write glong TestObj.strawberry", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, @@ -917,7 +917,7 @@ webkit_dom_test_obj_void_method(WebKitDOMTestObj* self) } void -webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong intArg, const gchar* strArg, WebKitDOMTestObj* objArg) +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, gint64 Arg, const gchar* strArg, WebKitDOMTestObj* objArg) { g_return_if_fail(self); WebCore::JSMainThreadNullState state; @@ -930,21 +930,21 @@ webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong intArg, convertedObjArg = WebKit::core(objArg); g_return_if_fail(convertedObjArg); } - item->voidMethodWithArgs(intArg, convertedStrArg, convertedObjArg); + item->voidMethodWithArgs(Arg, convertedStrArg, convertedObjArg); } -glong -webkit_dom_test_obj_int_method(WebKitDOMTestObj* self) +gint64 +webkit_dom_test_obj_method(WebKitDOMTestObj* self) { g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; WebCore::TestObj* item = WebKit::core(self); - glong result = item->intMethod(); + gint64 result = item->Method(); return result; } -glong -webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong intArg, const gchar* strArg, WebKitDOMTestObj* objArg) +gint64 +webkit_dom_test_obj_method_with_args(WebKitDOMTestObj* self, gint64 Arg, const gchar* strArg, WebKitDOMTestObj* objArg) { g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; @@ -957,7 +957,7 @@ webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong intArg, c convertedObjArg = WebKit::core(objArg); g_return_val_if_fail(convertedObjArg, 0); } - glong result = item->intMethodWithArgs(intArg, convertedStrArg, convertedObjArg); + gint64 result = item->MethodWithArgs(Arg, convertedStrArg, convertedObjArg); return result; } @@ -973,7 +973,7 @@ webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) } WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong intArg, const gchar* strArg, WebKitDOMTestObj* objArg) +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, gint64 Arg, const gchar* strArg, WebKitDOMTestObj* objArg) { g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; @@ -986,7 +986,7 @@ webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong intArg, c convertedObjArg = WebKit::core(objArg); g_return_val_if_fail(convertedObjArg, 0); } - RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->objMethodWithArgs(intArg, convertedStrArg, convertedObjArg)); + RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->objMethodWithArgs(Arg, convertedStrArg, convertedObjArg)); WebKitDOMTestObj* result = WebKit::kit(gobjectResult.get()); return result; } @@ -1436,7 +1436,7 @@ webkit_dom_test_obj_orange(WebKitDOMTestObj* self) } WebKitDOMbool* -webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gfloat a, gint b, GError** error) +webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gfloat a, glong b, GError** error) { g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; @@ -1454,12 +1454,12 @@ webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gf } glong -webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) +webkit_dom_test_obj_get_read_only_long_attr(WebKitDOMTestObj* self) { g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; WebCore::TestObj* item = WebKit::core(self); - glong result = item->readOnlyIntAttr(); + glong result = item->readOnlyLongAttr(); return result; } @@ -1522,23 +1522,23 @@ webkit_dom_test_obj_set_unsigned_short_attr(WebKitDOMTestObj* self, gushort valu item->setUnsignedShortAttr(value); } -glong -webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self) +gint64 +webkit_dom_test_obj_get_attr(WebKitDOMTestObj* self) { g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; WebCore::TestObj* item = WebKit::core(self); - glong result = item->intAttr(); + gint64 result = item->attr(); return result; } void -webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value) +webkit_dom_test_obj_set_attr(WebKitDOMTestObj* self, gint64 value) { g_return_if_fail(self); WebCore::JSMainThreadNullState state; WebCore::TestObj* item = WebKit::core(self); - item->setIntAttr(value); + item->setAttr(value); } gint64 @@ -2320,18 +2320,18 @@ webkit_dom_test_obj_set_immutable_point(WebKitDOMTestObj* self, WebKitDOMSVGPoin item->setImmutablePoint(convertedValue); } -gint +glong webkit_dom_test_obj_get_strawberry(WebKitDOMTestObj* self) { g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; WebCore::TestObj* item = WebKit::core(self); - gint result = item->blueberry(); + glong result = item->blueberry(); return result; } void -webkit_dom_test_obj_set_strawberry(WebKitDOMTestObj* self, gint value) +webkit_dom_test_obj_set_strawberry(WebKitDOMTestObj* self, glong value) { g_return_if_fail(self); WebCore::JSMainThreadNullState state; diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index 727a534e5..b8d57de16 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -58,7 +58,7 @@ webkit_dom_test_obj_void_method(WebKitDOMTestObj* self); /** * webkit_dom_test_obj_void_method_with_args: * @self: A #WebKitDOMTestObj - * @intArg: A #glong + * @Arg: A #gint64 * @strArg: A #gchar * @objArg: A #WebKitDOMTestObj * @@ -66,30 +66,30 @@ webkit_dom_test_obj_void_method(WebKitDOMTestObj* self); * **/ WEBKIT_API void -webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong intArg, const gchar* strArg, WebKitDOMTestObj* objArg); +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, gint64 Arg, const gchar* strArg, WebKitDOMTestObj* objArg); /** - * webkit_dom_test_obj_int_method: + * webkit_dom_test_obj_method: * @self: A #WebKitDOMTestObj * * Returns: * **/ -WEBKIT_API glong -webkit_dom_test_obj_int_method(WebKitDOMTestObj* self); +WEBKIT_API gint64 +webkit_dom_test_obj_method(WebKitDOMTestObj* self); /** - * webkit_dom_test_obj_int_method_with_args: + * webkit_dom_test_obj_method_with_args: * @self: A #WebKitDOMTestObj - * @intArg: A #glong + * @Arg: A #gint64 * @strArg: A #gchar * @objArg: A #WebKitDOMTestObj * * Returns: * **/ -WEBKIT_API glong -webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong intArg, const gchar* strArg, WebKitDOMTestObj* objArg); +WEBKIT_API gint64 +webkit_dom_test_obj_method_with_args(WebKitDOMTestObj* self, gint64 Arg, const gchar* strArg, WebKitDOMTestObj* objArg); /** * webkit_dom_test_obj_obj_method: @@ -104,7 +104,7 @@ webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self); /** * webkit_dom_test_obj_obj_method_with_args: * @self: A #WebKitDOMTestObj - * @intArg: A #glong + * @Arg: A #gint64 * @strArg: A #gchar * @objArg: A #WebKitDOMTestObj * @@ -112,7 +112,7 @@ webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self); * **/ WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong intArg, const gchar* strArg, WebKitDOMTestObj* objArg); +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, gint64 Arg, const gchar* strArg, WebKitDOMTestObj* objArg); /** * webkit_dom_test_obj_method_that_requires_all_args_and_throws: @@ -487,24 +487,24 @@ webkit_dom_test_obj_orange(WebKitDOMTestObj* self); * @self: A #WebKitDOMTestObj * @str: A #gchar * @a: A #gfloat - * @b: A #gint + * @b: A #glong * @error: #GError * * Returns: (transfer none): * **/ WEBKIT_API WebKitDOMbool* -webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gfloat a, gint b, GError** error); +webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gfloat a, glong b, GError** error); /** - * webkit_dom_test_obj_get_read_only_int_attr: + * webkit_dom_test_obj_get_read_only_long_attr: * @self: A #WebKitDOMTestObj * * Returns: * **/ WEBKIT_API glong -webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self); +webkit_dom_test_obj_get_read_only_long_attr(WebKitDOMTestObj* self); /** * webkit_dom_test_obj_get_read_only_string_attr: @@ -569,25 +569,25 @@ WEBKIT_API void webkit_dom_test_obj_set_unsigned_short_attr(WebKitDOMTestObj* self, gushort value); /** - * webkit_dom_test_obj_get_int_attr: + * webkit_dom_test_obj_get_attr: * @self: A #WebKitDOMTestObj * * Returns: * **/ -WEBKIT_API glong -webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self); +WEBKIT_API gint64 +webkit_dom_test_obj_get_attr(WebKitDOMTestObj* self); /** - * webkit_dom_test_obj_set_int_attr: + * webkit_dom_test_obj_set_attr: * @self: A #WebKitDOMTestObj - * @value: A #glong + * @value: A #gint64 * * Returns: * **/ WEBKIT_API void -webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value); +webkit_dom_test_obj_set_attr(WebKitDOMTestObj* self, gint64 value); /** * webkit_dom_test_obj_get_long_long_attr: @@ -1269,19 +1269,19 @@ webkit_dom_test_obj_set_immutable_point(WebKitDOMTestObj* self, WebKitDOMSVGPoin * Returns: * **/ -WEBKIT_API gint +WEBKIT_API glong webkit_dom_test_obj_get_strawberry(WebKitDOMTestObj* self); /** * webkit_dom_test_obj_set_strawberry: * @self: A #WebKitDOMTestObj - * @value: A #gint + * @value: A #glong * * Returns: * **/ WEBKIT_API void -webkit_dom_test_obj_set_strawberry(WebKitDOMTestObj* self, gint value); +webkit_dom_test_obj_set_strawberry(WebKitDOMTestObj* self, glong value); /** * webkit_dom_test_obj_get_strict_float: diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 268c90341..0e39c41ee 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -242,8 +242,9 @@ bool JSTestInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec } #if ENABLE(Condition11) || ENABLE(Condition12) -JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* exec, JSValue, PropertyName) +JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* exec, JSValue slotBase, PropertyName) { + UNUSED_PARAM(slotBase); UNUSED_PARAM(exec); JSValue result = jsNumber(TestSupplemental::supplementalStaticReadOnlyAttr()); return result; @@ -252,8 +253,9 @@ JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* exec #endif #if ENABLE(Condition11) || ENABLE(Condition12) -JSValue jsTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSValue, PropertyName) +JSValue jsTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSValue slotBase, PropertyName) { + UNUSED_PARAM(slotBase); UNUSED_PARAM(exec); JSValue result = jsString(exec, TestSupplemental::supplementalStaticAttr()); return result; diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 01fd88856..b1d6c6017 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -43,7 +43,6 @@ #include "JSc.h" #include "JSd.h" #include "JSe.h" -#include "JSint.h" #include "KURL.h" #include "SVGDocument.h" #include "SVGStaticPropertyTearOff.h" @@ -80,12 +79,12 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); static const HashTableValue JSTestObjTableValues[] = { - { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0, NoIntrinsic }, + { "readOnlyLongAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyLongAttr), (intptr_t)0, NoIntrinsic }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0, NoIntrinsic }, { "readOnlyTestObjAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyTestObjAttr), (intptr_t)0, NoIntrinsic }, { "shortAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjShortAttr), (intptr_t)setJSTestObjShortAttr, NoIntrinsic }, { "unsignedShortAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedShortAttr), (intptr_t)setJSTestObjUnsignedShortAttr, NoIntrinsic }, - { "intAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjIntAttr), (intptr_t)setJSTestObjIntAttr, NoIntrinsic }, + { "Attr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttr), (intptr_t)setJSTestObjAttr, NoIntrinsic }, { "longLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongLongAttr), (intptr_t)setJSTestObjLongLongAttr, NoIntrinsic }, { "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr, NoIntrinsic }, { "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr, NoIntrinsic }, @@ -147,7 +146,7 @@ static const HashTableValue JSTestObjTableValues[] = { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjTable = { 139, 127, JSTestObjTableValues, 0 }; +static const HashTable JSTestObjTable = { 140, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestObjConstructorTableValues[] = @@ -167,8 +166,9 @@ static const HashTableValue JSTestObjConstructorTableValues[] = { "CONST_VALUE_13", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_13), (intptr_t)0, NoIntrinsic }, { "CONST_VALUE_14", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_14), (intptr_t)0, NoIntrinsic }, { "CONST_JAVASCRIPT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_JAVASCRIPT), (intptr_t)0, NoIntrinsic }, - { "staticReadOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticReadOnlyIntAttr), (intptr_t)0, NoIntrinsic }, + { "staticReadOnlyLongAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticReadOnlyLongAttr), (intptr_t)0, NoIntrinsic }, { "staticStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticStringAttr), (intptr_t)setJSTestObjConstructorStaticStringAttr, NoIntrinsic }, + { "TestSubObj", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorTestSubObj), (intptr_t)0, NoIntrinsic }, { "classMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionClassMethod), (intptr_t)0, NoIntrinsic }, { "classMethodWithOptional", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionClassMethodWithOptional), (intptr_t)1, NoIntrinsic }, { "classMethod2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionClassMethod2), (intptr_t)1, NoIntrinsic }, @@ -178,7 +178,7 @@ static const HashTableValue JSTestObjConstructorTableValues[] = { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjConstructorTable = { 36, 31, JSTestObjConstructorTableValues, 0 }; +static const HashTable JSTestObjConstructorTable = { 37, 31, JSTestObjConstructorTableValues, 0 }; #if ENABLE(Condition1) COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants); @@ -262,8 +262,8 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = { "CONST_JAVASCRIPT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_JAVASCRIPT), (intptr_t)0, NoIntrinsic }, { "voidMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0, NoIntrinsic }, { "voidMethodWithArgs", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3, NoIntrinsic }, - { "intMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIntMethod), (intptr_t)0, NoIntrinsic }, - { "intMethodWithArgs", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIntMethodWithArgs), (intptr_t)3, NoIntrinsic }, + { "Method", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethod), (intptr_t)0, NoIntrinsic }, + { "MethodWithArgs", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithArgs), (intptr_t)3, NoIntrinsic }, { "objMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethod), (intptr_t)0, NoIntrinsic }, { "objMethodWithArgs", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethodWithArgs), (intptr_t)3, NoIntrinsic }, { "methodWithSequenceArg", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithSequenceArg), (intptr_t)1, NoIntrinsic }, @@ -305,7 +305,8 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = { "conditionalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod3), (intptr_t)0, NoIntrinsic }, #endif { "overloadedMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2, NoIntrinsic }, - { "methodWithUnsignedLongArray", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongArray), (intptr_t)1, NoIntrinsic }, + { "classMethodWithClamp", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithClamp), (intptr_t)2, NoIntrinsic }, + { "methodWithUnsignedLongSequence", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence), (intptr_t)1, NoIntrinsic }, { "stringArrayFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionStringArrayFunction), (intptr_t)1, NoIntrinsic }, { "getSVGDocument", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionGetSVGDocument), (intptr_t)0, NoIntrinsic }, { "convert1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert1), (intptr_t)1, NoIntrinsic }, @@ -320,7 +321,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjPrototypeTable = { 266, 255, JSTestObjPrototypeTableValues, 0 }; +static const HashTable JSTestObjPrototypeTable = { 267, 255, JSTestObjPrototypeTableValues, 0 }; const ClassInfo JSTestObjPrototype::s_info = { "TestObjectPrototype", &Base::s_info, &JSTestObjPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestObjPrototype) }; JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) @@ -384,12 +385,12 @@ bool JSTestObj::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, Prop return getStaticValueDescriptor<JSTestObj, Base>(exec, &JSTestObjTable, thisObject, propertyName, descriptor); } -JSValue jsTestObjReadOnlyIntAttr(ExecState* exec, JSValue slotBase, PropertyName) +JSValue jsTestObjReadOnlyLongAttr(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(impl->readOnlyIntAttr()); + JSValue result = jsNumber(impl->readOnlyLongAttr()); return result; } @@ -414,22 +415,31 @@ JSValue jsTestObjReadOnlyTestObjAttr(ExecState* exec, JSValue slotBase, Property } -JSValue jsTestObjConstructorStaticReadOnlyIntAttr(ExecState* exec, JSValue, PropertyName) +JSValue jsTestObjConstructorStaticReadOnlyLongAttr(ExecState* exec, JSValue slotBase, PropertyName) { + UNUSED_PARAM(slotBase); UNUSED_PARAM(exec); - JSValue result = jsNumber(TestObj::staticReadOnlyIntAttr()); + JSValue result = jsNumber(TestObj::staticReadOnlyLongAttr()); return result; } -JSValue jsTestObjConstructorStaticStringAttr(ExecState* exec, JSValue, PropertyName) +JSValue jsTestObjConstructorStaticStringAttr(ExecState* exec, JSValue slotBase, PropertyName) { + UNUSED_PARAM(slotBase); UNUSED_PARAM(exec); JSValue result = jsString(exec, TestObj::staticStringAttr()); return result; } +JSValue jsTestObjConstructorTestSubObj(ExecState* exec, JSValue slotBase, PropertyName) +{ + JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); + return JSTestSubObj::getConstructor(exec, castedThis); +} + + JSValue jsTestObjShortAttr(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); @@ -450,12 +460,12 @@ JSValue jsTestObjUnsignedShortAttr(ExecState* exec, JSValue slotBase, PropertyNa } -JSValue jsTestObjIntAttr(ExecState* exec, JSValue slotBase, PropertyName) +JSValue jsTestObjAttr(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(impl->intAttr()); + JSValue result = jsNumber(impl->attr()); return result; } @@ -968,12 +978,12 @@ void setJSTestObjUnsignedShortAttr(ExecState* exec, JSObject* thisObject, JSValu } -void setJSTestObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value) +void setJSTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setIntAttr(value.toInt32(exec)); + impl->setAttr(static_cast<long long>(value.toInteger(exec))); } @@ -1343,7 +1353,7 @@ void setJSTestObjStrawberry(ExecState* exec, JSObject* thisObject, JSValue value UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setBlueberry(toint(value)); + impl->setBlueberry(value.toInt32(exec)); } @@ -1400,7 +1410,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecSt TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 3) return throwVMError(exec, createNotEnoughArgumentsError(exec)); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec)); + long long Arg(static_cast<long long>(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInteger(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toString(exec)->value(exec))); @@ -1409,11 +1419,11 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecSt TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - impl->voidMethodWithArgs(intArg, strArg, objArg); + impl->voidMethodWithArgs(Arg, strArg, objArg); return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) @@ -1422,11 +1432,11 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - JSC::JSValue result = jsNumber(impl->intMethod()); + JSC::JSValue result = jsNumber(impl->method()); return JSValue::encode(result); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) @@ -1436,7 +1446,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecSta TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 3) return throwVMError(exec, createNotEnoughArgumentsError(exec)); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec)); + long long Arg(static_cast<long long>(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInteger(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toString(exec)->value(exec))); @@ -1446,7 +1456,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecSta if (exec->hadException()) return JSValue::encode(jsUndefined()); - JSC::JSValue result = jsNumber(impl->intMethodWithArgs(intArg, strArg, objArg)); + JSC::JSValue result = jsNumber(impl->methodWithArgs(Arg, strArg, objArg)); return JSValue::encode(result); } @@ -1473,7 +1483,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecSta TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 3) return throwVMError(exec, createNotEnoughArgumentsError(exec)); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec)); + long long Arg(static_cast<long long>(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInteger(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toString(exec)->value(exec))); @@ -1483,7 +1493,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecSta if (exec->hadException()) return JSValue::encode(jsUndefined()); - JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->objMethodWithArgs(intArg, strArg, objArg))); + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->objMethodWithArgs(Arg, strArg, objArg))); return JSValue::encode(result); } @@ -1514,11 +1524,11 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodReturningSequence(E TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec)); + long long Arg(static_cast<long long>(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInteger(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl->methodReturningSequence(intArg)); + JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl->methodReturningSequence(Arg)); return JSValue::encode(result); } @@ -2093,10 +2103,10 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2( return JSValue::encode(jsUndefined()); } - int intArg(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toInt32(exec)); + long long Arg(static_cast<long long>(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toInteger(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - impl->overloadedMethod(objArg, intArg); + impl->overloadedMethod(objArg, Arg); return JSValue::encode(jsUndefined()); } @@ -2127,10 +2137,10 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4( TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec)); + long long Arg(static_cast<long long>(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInteger(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - impl->overloadedMethod(intArg); + impl->overloadedMethod(Arg); return JSValue::encode(jsUndefined()); } @@ -2221,6 +2231,23 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod9( return JSValue::encode(jsUndefined()); } +static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod10(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createNotEnoughArgumentsError(exec)); + Vector<unsigned long> arrayArg(toNativeArray<unsigned long>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->overloadedMethod(arrayArg); + return JSValue::encode(jsUndefined()); +} + EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { size_t argsCount = exec->argumentCount(); @@ -2244,6 +2271,8 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecStat return jsTestObjPrototypeFunctionOverloadedMethod8(exec); if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0)))) return jsTestObjPrototypeFunctionOverloadedMethod9(exec); + if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0)))) + return jsTestObjPrototypeFunctionOverloadedMethod10(exec); return throwVMTypeError(exec); } @@ -2317,7 +2346,37 @@ EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(ExecS #endif -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongArray(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithClamp(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 2) + return throwVMError(exec, createNotEnoughArgumentsError(exec)); + unsigned short objArgsShort = 0; + double objArgsShortNativeValue = exec->argument(0).toNumber(exec); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + if (!isnan(objArgsShortNativeValue)) + objArgsShort = clampTo<unsigned short>(objArgsShortNativeValue); + + unsigned long objArgsLong = 0; + double objArgsLongNativeValue = exec->argument(1).toNumber(exec); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + if (!isnan(objArgsShortNativeValue)) + objArgsLong = clampTo<unsigned long>(objArgsLongNativeValue); + + impl->classMethodWithClamp(objArgsShort, objArgsLong); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) @@ -2327,10 +2386,10 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongArr TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); - Vector<unsigned long> unsignedLongArray(jsUnsignedLongArrayToVector(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined))); + Vector<unsigned long> unsignedLongSequence(toNativeArray<unsigned long>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - impl->methodWithUnsignedLongArray(unsignedLongArray); + impl->methodWithUnsignedLongSequence(unsignedLongSequence); return JSValue::encode(jsUndefined()); } @@ -2511,9 +2570,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStrictFunction(ExecState* float a(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toFloat(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - if (exec->argumentCount() > 2 && !exec->argument(2).isUndefinedOrNull() && !exec->argument(2).inherits(&JSint::s_info)) - return throwVMTypeError(exec); - int* b(toint(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined))); + int b(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h index 306fad8f4..3a7e9cc27 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -154,8 +154,8 @@ protected: JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithArgs(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithSequenceArg(JSC::ExecState*); @@ -203,7 +203,8 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod2(JSC:: #if ENABLE(Condition1) JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(JSC::ExecState*); #endif -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongArray(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithClamp(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStringArrayFunction(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert1(JSC::ExecState*); @@ -217,18 +218,19 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOrange(JSC::ExecStat JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStrictFunction(JSC::ExecState*); // Attributes -JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +JSC::JSValue jsTestObjReadOnlyLongAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); JSC::JSValue jsTestObjReadOnlyStringAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); JSC::JSValue jsTestObjReadOnlyTestObjAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); -JSC::JSValue jsTestObjConstructorStaticReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +JSC::JSValue jsTestObjConstructorStaticReadOnlyLongAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); JSC::JSValue jsTestObjConstructorStaticStringAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); void setJSTestObjConstructorStaticStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjConstructorTestSubObj(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); JSC::JSValue jsTestObjShortAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); void setJSTestObjShortAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjUnsignedShortAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); void setJSTestObjUnsignedShortAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsTestObjIntAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); -void setJSTestObjIntAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +void setJSTestObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjLongLongAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); void setJSTestObjLongLongAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjUnsignedLongLongAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 1c42af006..42e54ca2f 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -65,15 +65,15 @@ enum { }; @interface DOMTestObj : DOMObject -- (int)readOnlyIntAttr; +- (int)readOnlyLongAttr; - (NSString *)readOnlyStringAttr; - (DOMTestObj *)readOnlyTestObjAttr; - (short)shortAttr; - (void)setShortAttr:(short)newShortAttr; - (unsigned short)unsignedShortAttr; - (void)setUnsignedShortAttr:(unsigned short)newUnsignedShortAttr; -- (int)intAttr; -- (void)setIntAttr:(int)newIntAttr; +- (long long)Attr; +- (void)setAttr:(long long)newAttr; - (long long)longLongAttr; - (void)setLongLongAttr:(long long)newLongLongAttr; - (unsigned long long)unsignedLongLongAttr; @@ -170,18 +170,18 @@ enum { - (int)replaceableAttribute; - (void)setReplaceableAttribute:(int)newReplaceableAttribute; - (void)voidMethod; -- (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; -- (int)intMethod; -- (int)intMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (void)voidMethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (long long)Method; +- (long long)MethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (DOMTestObj *)objMethod; -- (DOMTestObj *)objMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (DOMTestObj *)objMethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (void)serializedValue:(NSString *)serializedArg; - (void)idbKey:(DOMIDBKey *)key; - (void)optionsObject:(DOMDictionary *)oo ooo:(DOMDictionary *)ooo; - (void)methodWithException; - (void)customMethod; -- (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (void)customMethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture; - (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture; - (void)withScriptStateVoid; diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index fc0937f84..d08611cf6 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -98,10 +98,10 @@ [super finalize]; } -- (int)readOnlyIntAttr +- (int)readOnlyLongAttr { WebCore::JSMainThreadNullState state; - return IMPL->readOnlyIntAttr(); + return IMPL->readOnlyLongAttr(); } - (NSString *)readOnlyStringAttr @@ -140,16 +140,16 @@ IMPL->setUnsignedShortAttr(newUnsignedShortAttr); } -- (int)intAttr +- (long long)Attr { WebCore::JSMainThreadNullState state; - return IMPL->intAttr(); + return IMPL->attr(); } -- (void)setIntAttr:(int)newIntAttr +- (void)setAttr:(long long)newAttr { WebCore::JSMainThreadNullState state; - IMPL->setIntAttr(newIntAttr); + IMPL->setAttr(newAttr); } - (long long)longLongAttr @@ -725,22 +725,22 @@ IMPL->voidMethod(); } -- (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +- (void)voidMethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg { WebCore::JSMainThreadNullState state; - IMPL->voidMethodWithArgs(intArg, strArg, core(objArg)); + IMPL->voidMethodWithArgs(Arg, strArg, core(objArg)); } -- (int)intMethod +- (long long)Method { WebCore::JSMainThreadNullState state; - return IMPL->intMethod(); + return IMPL->method(); } -- (int)intMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +- (long long)MethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg { WebCore::JSMainThreadNullState state; - return IMPL->intMethodWithArgs(intArg, strArg, core(objArg)); + return IMPL->methodWithArgs(Arg, strArg, core(objArg)); } - (DOMTestObj *)objMethod @@ -749,10 +749,10 @@ return kit(WTF::getPtr(IMPL->objMethod())); } -- (DOMTestObj *)objMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +- (DOMTestObj *)objMethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg { WebCore::JSMainThreadNullState state; - return kit(WTF::getPtr(IMPL->objMethodWithArgs(intArg, strArg, core(objArg)))); + return kit(WTF::getPtr(IMPL->objMethodWithArgs(Arg, strArg, core(objArg)))); } - (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg @@ -796,10 +796,10 @@ IMPL->customMethod(); } -- (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +- (void)customMethodWithArgs:(long long)Arg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg { WebCore::JSMainThreadNullState state; - IMPL->customMethodWithArgs(intArg, strArg, core(objArg)); + IMPL->customMethodWithArgs(Arg, strArg, core(objArg)); } - (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index c1ea6f564..c8a7a02a9 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -35,16 +35,17 @@ module test { InterfaceName=TestObject ] TestObj { // Attributes - readonly attribute long readOnlyIntAttr; + readonly attribute long readOnlyLongAttr; readonly attribute DOMString readOnlyStringAttr; readonly attribute TestObj readOnlyTestObjAttr; #if defined(TESTING_JS) || defined(TESTING_V8) - static readonly attribute long staticReadOnlyIntAttr; + static readonly attribute long staticReadOnlyLongAttr; static attribute DOMString staticStringAttr; + static readonly attribute TestSubObjConstructor TestSubObj; #endif attribute short shortAttr; attribute unsigned short unsignedShortAttr; - attribute long intAttr; + attribute long longAttr; attribute long long longLongAttr; attribute unsigned long long unsignedLongLongAttr; attribute DOMString stringAttr; @@ -68,14 +69,14 @@ module test { // Methods void voidMethod(); - void voidMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); - long intMethod(); - long intMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); + 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(); - TestObj objMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); + TestObj objMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); void methodWithSequenceArg(in sequence<ScriptProfile> sequenceArg); - sequence<ScriptProfile> methodReturningSequence(in long intArg); + sequence<ScriptProfile> methodReturningSequence(in long longArg); TestObj methodThatRequiresAllArgsAndThrows(in DOMString strArg, in TestObj objArg) raises(DOMException); @@ -94,7 +95,7 @@ module test { // 'Custom' extended attribute attribute [Custom] long customAttr; [Custom] void customMethod(); - [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); + [Custom] void customMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); void addEventListener(in DOMString type, in EventListener listener, @@ -168,14 +169,15 @@ module test { #if defined(TESTING_V8) || defined(TESTING_JS) // Overloads void overloadedMethod(in TestObj? objArg, in DOMString strArg); - void overloadedMethod(in TestObj? objArg, in [Optional] long intArg); + void overloadedMethod(in TestObj? objArg, in [Optional] long longArg); void overloadedMethod(in DOMString strArg); - void overloadedMethod(in long intArg); + void overloadedMethod(in long longArg); void overloadedMethod(in [Callback] TestCallback callback); void overloadedMethod(in DOMStringList? listArg); void overloadedMethod(in DOMString[]? arrayArg); void overloadedMethod(in TestObj objArg); void overloadedMethod(in DOMString[] arrayArg); + void overloadedMethod(in sequence<unsigned long> arrayArg); #endif // Class methods within JavaScript (like what's used for IDBKeyRange). @@ -187,15 +189,19 @@ module test { [Conditional=Condition1] static void overloadedMethod1(in long arg); [Conditional=Condition1] static void overloadedMethod1(in DOMString type); + void classMethodWithClamp(in [Clamp] unsigned short objArgsShort, in [Clamp] unsigned long objArgsLong); + #if defined(TESTING_V8) // 'V8EnabledAtRuntime' methods and attributes. - [V8EnabledAtRuntime] void enabledAtRuntimeMethod1(in int intArg); - [V8EnabledAtRuntime=FeatureName] void enabledAtRuntimeMethod2(in int intArg); + [V8EnabledAtRuntime] void enabledAtRuntimeMethod1(in long longArg); + [V8EnabledAtRuntime=FeatureName] void enabledAtRuntimeMethod2(in long longArg); attribute [V8EnabledAtRuntime] long enabledAtRuntimeAttr1; attribute [V8EnabledAtRuntime=FeatureName] long enabledAtRuntimeAttr2; - // V8EnabledPerContext currently only supports attributes. - attribute [V8EnabledPerContext] long enabledAtContextAttr1; - attribute [V8EnabledPerContext=FeatureName] long enabledAtContextAttr2; + // 'V8EnabledPerContext' methods and attributes. + [V8EnabledPerContext] void enabledPerContextMethod1(in long longArg); + [V8EnabledPerContext=FeatureName] void enabledPerContextMethod2(in long longArg); + attribute [V8EnabledPerContext] long enabledPerContextAttr1; + attribute [V8EnabledPerContext=FeatureName] long enabledPerContextAttr2; #endif @@ -205,7 +211,7 @@ module test { #endif #if defined(TESTING_JS) - void methodWithUnsignedLongArray(in unsigned long[] unsignedLongArray); + void methodWithUnsignedLongSequence(in sequence<unsigned long> unsignedLongSequence); #endif #if defined(TESTING_V8) || defined(TESTING_JS) DOMString[] stringArrayFunction(in DOMString[] values) raises(DOMException); @@ -227,10 +233,10 @@ module test { [Immutable] SVGPoint immutablePointFunction(); [ImplementedAs=banana] void orange(); - attribute [ImplementedAs=blueberry] int strawberry; + attribute [ImplementedAs=blueberry] long strawberry; attribute [StrictTypeChecking] float strictFloat; - [StrictTypeChecking] bool strictFunction(in DOMString str, in float a, in int b) + [StrictTypeChecking] bool strictFunction(in DOMString str, in float a, in long b) raises(DOMException); // ObjectiveC reserved words. diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index c47e6ae6c..1f0773d81 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -48,6 +48,7 @@ #include "V8SVGPoint.h" #include "V8ScriptProfile.h" #include "V8TestCallback.h" +#include "V8TestSubObj.h" #include "V8a.h" #include "V8any.h" #include "V8b.h" @@ -55,7 +56,6 @@ #include "V8c.h" #include "V8d.h" #include "V8e.h" -#include "V8int.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -81,11 +81,11 @@ namespace TestObjV8Internal { template <typename T> void V8_USE(T) { } -static v8::Handle<v8::Value> readOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> readOnlyLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.readOnlyIntAttr._get"); + INC_STATS("DOM.TestObj.readOnlyLongAttr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8Integer(imp->readOnlyIntAttr(), info.GetIsolate()); + return v8Integer(imp->readOnlyLongAttr(), info.GetIsolate()); } static v8::Handle<v8::Value> readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -109,10 +109,10 @@ static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> return wrapper; } -static v8::Handle<v8::Value> staticReadOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> staticReadOnlyLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.staticReadOnlyIntAttr._get"); - return v8Integer(TestObj::staticReadOnlyIntAttr(), info.GetIsolate()); + INC_STATS("DOM.TestObj.staticReadOnlyLongAttr._get"); + return v8Integer(TestObj::staticReadOnlyLongAttr(), info.GetIsolate()); } static v8::Handle<v8::Value> staticStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -161,19 +161,19 @@ static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8 return; } -static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> AttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.intAttr._get"); + INC_STATS("DOM.TestObj.Attr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8Integer(imp->intAttr(), info.GetIsolate()); + return v8::Number::New(static_cast<double>(imp->attr())); } -static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +static void AttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.intAttr._set"); + INC_STATS("DOM.TestObj.Attr._set"); TestObj* imp = V8TestObj::toNative(info.Holder()); - int v = toInt32(value); - imp->setIntAttr(v); + long long v = toInt64(value); + imp->setAttr(WTF::getPtr(v)); return; } @@ -862,35 +862,35 @@ static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Loca return; } -static v8::Handle<v8::Value> enabledAtContextAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> enabledPerContextAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.enabledAtContextAttr1._get"); + INC_STATS("DOM.TestObj.enabledPerContextAttr1._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8Integer(imp->enabledAtContextAttr1(), info.GetIsolate()); + return v8Integer(imp->enabledPerContextAttr1(), info.GetIsolate()); } -static void enabledAtContextAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +static void enabledPerContextAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.enabledAtContextAttr1._set"); + INC_STATS("DOM.TestObj.enabledPerContextAttr1._set"); TestObj* imp = V8TestObj::toNative(info.Holder()); int v = toInt32(value); - imp->setEnabledAtContextAttr1(v); + imp->setEnabledPerContextAttr1(v); return; } -static v8::Handle<v8::Value> enabledAtContextAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> enabledPerContextAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.enabledAtContextAttr2._get"); + INC_STATS("DOM.TestObj.enabledPerContextAttr2._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8Integer(imp->enabledAtContextAttr2(), info.GetIsolate()); + return v8Integer(imp->enabledPerContextAttr2(), info.GetIsolate()); } -static void enabledAtContextAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +static void enabledPerContextAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.enabledAtContextAttr2._set"); + INC_STATS("DOM.TestObj.enabledPerContextAttr2._set"); TestObj* imp = V8TestObj::toNative(info.Holder()); int v = toInt32(value); - imp->setEnabledAtContextAttr2(v); + imp->setEnabledPerContextAttr2(v); return; } @@ -979,7 +979,7 @@ static void strawberryAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value { INC_STATS("DOM.TestObj.strawberry._set"); TestObj* imp = V8TestObj::toNative(info.Holder()); - int v = V8int::HasInstance(value) ? V8int::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + int v = toInt32(value); imp->setBlueberry(v); return; } @@ -1065,30 +1065,30 @@ static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& arg if (args.Length() < 3) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)); EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0); - imp->voidMethodWithArgs(intArg, strArg, objArg); + imp->voidMethodWithArgs(Arg, strArg, objArg); return v8::Handle<v8::Value>(); } -static v8::Handle<v8::Value> intMethodCallback(const v8::Arguments& args) +static v8::Handle<v8::Value> MethodCallback(const v8::Arguments& args) { - INC_STATS("DOM.TestObj.intMethod"); + INC_STATS("DOM.TestObj.Method"); TestObj* imp = V8TestObj::toNative(args.Holder()); - return v8Integer(imp->intMethod(), args.GetIsolate()); + return v8::Number::New(static_cast<double>(imp->Method())); } -static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args) +static v8::Handle<v8::Value> MethodWithArgsCallback(const v8::Arguments& args) { - INC_STATS("DOM.TestObj.intMethodWithArgs"); + INC_STATS("DOM.TestObj.MethodWithArgs"); if (args.Length() < 3) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)); EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0); - return v8Integer(imp->intMethodWithArgs(intArg, strArg, objArg), args.GetIsolate()); + return v8::Number::New(static_cast<double>(imp->MethodWithArgs(Arg, strArg, objArg))); } static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args) @@ -1104,10 +1104,10 @@ static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args if (args.Length() < 3) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)); EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0); - return toV8(imp->objMethodWithArgs(intArg, strArg, objArg), args.GetIsolate()); + return toV8(imp->objMethodWithArgs(Arg, strArg, objArg), args.GetIsolate()); } static v8::Handle<v8::Value> methodWithSequenceArgCallback(const v8::Arguments& args) @@ -1127,8 +1127,8 @@ static v8::Handle<v8::Value> methodReturningSequenceCallback(const v8::Arguments if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); - return v8Array(imp->methodReturningSequence(intArg), args.GetIsolate()); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + return v8Array(imp->methodReturningSequence(Arg), args.GetIsolate()); } static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8::Arguments& args) @@ -1542,8 +1542,8 @@ static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args imp->overloadedMethod(objArg); return v8::Handle<v8::Value>(); } - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined))); - imp->overloadedMethod(objArg, intArg); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined))); + imp->overloadedMethod(objArg, Arg); return v8::Handle<v8::Value>(); } @@ -1564,8 +1564,8 @@ static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); - imp->overloadedMethod(intArg); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + imp->overloadedMethod(Arg); return v8::Handle<v8::Value>(); } @@ -1626,6 +1626,17 @@ static v8::Handle<v8::Value> overloadedMethod9Callback(const v8::Arguments& args return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> overloadedMethod10Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.overloadedMethod10"); + if (args.Length() < 1) + return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(Vector<unsigned long>, arrayArg, toNativeArray<unsigned long>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + imp->overloadedMethod(arrayArg); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.overloadedMethod"); @@ -1647,6 +1658,8 @@ static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args) return overloadedMethod8Callback(args); if ((args.Length() == 1 && (args[0]->IsArray()))) return overloadedMethod9Callback(args); + if ((args.Length() == 1 && (args[0]->IsArray()))) + return overloadedMethod10Callback(args); return V8Proxy::throwTypeError(0, args.GetIsolate()); } @@ -1709,14 +1722,32 @@ static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args #endif // ENABLE(Condition1) +static v8::Handle<v8::Value> classMethodWithClampCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.classMethodWithClamp"); + if (args.Length() < 2) + return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); + TestObj* imp = V8TestObj::toNative(args.Holder()); + unsigned short objArgsShort = 0 + EXCEPTION_BLOCK(double, objArgsShortNativeValue, args[0]->NumberValue()); + if (!isnan(objArgsShortNativeValue)) + objArgsShort = clampTo<unsigned short>(objArgsShortNativeValue); + unsigned long objArgsLong = 0 + EXCEPTION_BLOCK(double, objArgsLongNativeValue, args[1]->NumberValue()); + if (!isnan(objArgsLongNativeValue)) + objArgsLong = clampTo<unsigned long>(objArgsLongNativeValue); + imp->classMethodWithClamp(objArgsShort, objArgsLong); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> enabledAtRuntimeMethod1Callback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.enabledAtRuntimeMethod1"); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0); - imp->enabledAtRuntimeMethod1(intArg); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + imp->enabledAtRuntimeMethod1(Arg); return v8::Handle<v8::Value>(); } @@ -1726,8 +1757,30 @@ static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0); - imp->enabledAtRuntimeMethod2(intArg); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + imp->enabledAtRuntimeMethod2(Arg); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> enabledPerContextMethod1Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.enabledPerContextMethod1"); + if (args.Length() < 1) + return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + imp->enabledPerContextMethod1(Arg); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> enabledPerContextMethod2Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.enabledPerContextMethod2"); + if (args.Length() < 1) + return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + imp->enabledPerContextMethod2(Arg); return v8::Handle<v8::Value>(); } @@ -1853,7 +1906,7 @@ static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args) { STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)); EXCEPTION_BLOCK(float, a, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->NumberValue())); - EXCEPTION_BLOCK(int, b, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0); + EXCEPTION_BLOCK(int, b, toInt32(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))); RefPtr<bool> result = imp->strictFunction(str, a, b, ec); if (UNLIKELY(ec)) goto fail; @@ -1866,22 +1919,24 @@ static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args) } // namespace TestObjV8Internal static const BatchedAttribute TestObjAttrs[] = { - // Attribute 'readOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '') - {"readOnlyIntAttr", TestObjV8Internal::readOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'readOnlyLongAttr' (Type: 'readonly attribute' ExtAttr: '') + {"readOnlyLongAttr", TestObjV8Internal::readOnlyLongAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '') {"readOnlyStringAttr", TestObjV8Internal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '') {"readOnlyTestObjAttr", TestObjV8Internal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'staticReadOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '') - {"staticReadOnlyIntAttr", TestObjV8Internal::staticReadOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'staticReadOnlyLongAttr' (Type: 'readonly attribute' ExtAttr: '') + {"staticReadOnlyLongAttr", TestObjV8Internal::staticReadOnlyLongAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'staticStringAttr' (Type: 'attribute' ExtAttr: '') {"staticStringAttr", TestObjV8Internal::staticStringAttrAttrGetter, TestObjV8Internal::staticStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'TestSubObj' (Type: 'readonly attribute' ExtAttr: '') + {"TestSubObj", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestSubObj::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '') {"shortAttr", TestObjV8Internal::shortAttrAttrGetter, TestObjV8Internal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '') {"unsignedShortAttr", TestObjV8Internal::unsignedShortAttrAttrGetter, TestObjV8Internal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '') - {"intAttr", TestObjV8Internal::intAttrAttrGetter, TestObjV8Internal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'Attr' (Type: 'attribute' ExtAttr: '') + {"Attr", TestObjV8Internal::AttrAttrGetter, TestObjV8Internal::AttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '') {"longLongAttr", TestObjV8Internal::longLongAttrAttrGetter, TestObjV8Internal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '') @@ -1992,7 +2047,7 @@ static const BatchedAttribute TestObjAttrs[] = { static const BatchedCallback TestObjCallbacks[] = { {"voidMethod", TestObjV8Internal::voidMethodCallback}, - {"intMethod", TestObjV8Internal::intMethodCallback}, + {"Method", TestObjV8Internal::MethodCallback}, {"objMethod", TestObjV8Internal::objMethodCallback}, {"methodReturningSequence", TestObjV8Internal::methodReturningSequenceCallback}, {"serializedValue", TestObjV8Internal::serializedValueCallback}, @@ -2031,6 +2086,7 @@ static const BatchedCallback TestObjCallbacks[] = { {"conditionalMethod3", TestObjV8Internal::conditionalMethod3Callback}, #endif {"overloadedMethod", TestObjV8Internal::overloadedMethodCallback}, + {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampCallback}, {"stringArrayFunction", TestObjV8Internal::stringArrayFunctionCallback}, {"getSVGDocument", TestObjV8Internal::getSVGDocumentCallback}, {"mutablePointFunction", TestObjV8Internal::mutablePointFunctionCallback}, @@ -2131,11 +2187,11 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv); proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::voidMethodWithArgsCallback, v8::Handle<v8::Value>(), voidMethodWithArgsSignature)); - // Custom Signature 'intMethodWithArgs' - const int intMethodWithArgsArgc = 3; - v8::Handle<v8::FunctionTemplate> intMethodWithArgsArgv[intMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() }; - v8::Handle<v8::Signature> intMethodWithArgsSignature = v8::Signature::New(desc, intMethodWithArgsArgc, intMethodWithArgsArgv); - proto->Set(v8::String::New("intMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::intMethodWithArgsCallback, v8::Handle<v8::Value>(), intMethodWithArgsSignature)); + // Custom Signature 'MethodWithArgs' + const int MethodWithArgsArgc = 3; + v8::Handle<v8::FunctionTemplate> MethodWithArgsArgv[MethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() }; + v8::Handle<v8::Signature> MethodWithArgsSignature = v8::Signature::New(desc, MethodWithArgsArgc, MethodWithArgsArgv); + proto->Set(v8::String::New("MethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::MethodWithArgsCallback, v8::Handle<v8::Value>(), MethodWithArgsSignature)); // Custom Signature 'objMethodWithArgs' const int objMethodWithArgsArgc = 3; @@ -2238,18 +2294,26 @@ void V8TestObj::installPerContextProperties(v8::Handle<v8::Object> instance, Tes v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetPrototype()); // When building QtWebkit with V8 this variable is unused when none of the features are enabled. UNUSED_PARAM(proto); - if (ContextFeatures::enabledAtContextAttr1Enabled(impl->document())) { + if (ContextFeatures::enabledPerContextAttr1Enabled(impl->document())) { static const BatchedAttribute attrData =\ - // Attribute 'enabledAtContextAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledPerContext') - {"enabledAtContextAttr1", TestObjV8Internal::enabledAtContextAttr1AttrGetter, TestObjV8Internal::enabledAtContextAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; + // Attribute 'enabledPerContextAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledPerContext') + {"enabledPerContextAttr1", TestObjV8Internal::enabledPerContextAttr1AttrGetter, TestObjV8Internal::enabledPerContextAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; configureAttribute(instance, proto, attrData); } if (ContextFeatures::featureNameEnabled(impl->document())) { static const BatchedAttribute attrData =\ - // Attribute 'enabledAtContextAttr2' (Type: 'attribute' ExtAttr: 'V8EnabledPerContext') - {"enabledAtContextAttr2", TestObjV8Internal::enabledAtContextAttr2AttrGetter, TestObjV8Internal::enabledAtContextAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; + // Attribute 'enabledPerContextAttr2' (Type: 'attribute' ExtAttr: 'V8EnabledPerContext') + {"enabledPerContextAttr2", TestObjV8Internal::enabledPerContextAttr2AttrGetter, TestObjV8Internal::enabledPerContextAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; configureAttribute(instance, proto, attrData); } + v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate()); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. + if (ContextFeatures::enabledPerContextMethod1Enabled(impl->document())) { + proto->Set(v8::String::New("enabledPerContextMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod1Callback, v8::Handle<v8::Value>(), defaultSignature)->GetFunction()); + } + if (ContextFeatures::featureNameEnabled(impl->document())) { + proto->Set(v8::String::New("enabledPerContextMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod2Callback, v8::Handle<v8::Value>(), defaultSignature)->GetFunction()); + } } v8::Handle<v8::Object> V8TestObj::wrapSlow(PassRefPtr<TestObj> impl, v8::Isolate* isolate) @@ -2259,6 +2323,7 @@ v8::Handle<v8::Object> V8TestObj::wrapSlow(PassRefPtr<TestObj> impl, v8::Isolate wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; + installPerContextProperties(wrapper, impl.get()); v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); diff --git a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp index 661ff0159..22f8315b2 100644 --- a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp +++ b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp @@ -101,7 +101,6 @@ template<typename T> bool setValue(v8::Handle<v8::Value>& v8Object, T indexOrName, const v8::Handle<v8::Value>& v8Value) { v8::Local<v8::Object> object = v8Object->ToObject(); - ASSERT(!object->Has(indexOrName)); return object->Set(indexOrName, v8Value); } diff --git a/Source/WebCore/bindings/v8/ScriptGCEvent.cpp b/Source/WebCore/bindings/v8/ScriptGCEvent.cpp index 622f22bcd..37dd85e55 100644 --- a/Source/WebCore/bindings/v8/ScriptGCEvent.cpp +++ b/Source/WebCore/bindings/v8/ScriptGCEvent.cpp @@ -71,13 +71,13 @@ void ScriptGCEvent::removeEventListener(ScriptGCEventListener* eventListener) } } -void ScriptGCEvent::getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize, size_t& heapSizeLimit) +void ScriptGCEvent::getHeapSize(HeapInfo& info) { v8::HeapStatistics heapStatistics; v8::V8::GetHeapStatistics(&heapStatistics); - usedHeapSize = heapStatistics.used_heap_size(); - totalHeapSize = heapStatistics.total_heap_size(); - heapSizeLimit = heapStatistics.heap_size_limit(); + info.usedJSHeapSize = heapStatistics.used_heap_size(); + info.totalJSHeapSize = heapStatistics.total_heap_size(); + info.jsHeapSizeLimit = heapStatistics.heap_size_limit(); } size_t ScriptGCEvent::getUsedHeapSize() diff --git a/Source/WebCore/bindings/v8/ScriptGCEvent.h b/Source/WebCore/bindings/v8/ScriptGCEvent.h index f2ba49525..3b6246356 100644 --- a/Source/WebCore/bindings/v8/ScriptGCEvent.h +++ b/Source/WebCore/bindings/v8/ScriptGCEvent.h @@ -31,13 +31,26 @@ #ifndef ScriptGCEvent_h #define ScriptGCEvent_h -#if ENABLE(INSPECTOR) - #include "v8.h" #include <wtf/Vector.h> namespace WebCore { +struct HeapInfo { + HeapInfo() + : usedJSHeapSize(0) + , totalJSHeapSize(0) + , jsHeapSizeLimit(0) + { + } + + size_t usedJSHeapSize; + size_t totalJSHeapSize; + size_t jsHeapSizeLimit; +}; + +#if ENABLE(INSPECTOR) + class ScriptGCEventListener; class ScriptGCEvent @@ -45,14 +58,16 @@ class ScriptGCEvent public: static void addEventListener(ScriptGCEventListener*); static void removeEventListener(ScriptGCEventListener*); - static void getHeapSize(size_t&, size_t&, size_t&); + static void getHeapSize(HeapInfo&); + private: static void gcEpilogueCallback(v8::GCType type, v8::GCCallbackFlags flags); static void gcPrologueCallback(v8::GCType type, v8::GCCallbackFlags flags); static size_t getUsedHeapSize(); }; +#endif // ENABLE(INSPECTOR) + } // namespace WebCore -#endif // !ENABLE(INSPECTOR) #endif // !defined(ScriptGCEvent_h) diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp index de22e29ee..9f1e3298f 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -412,25 +412,27 @@ public: ASSERT(static_cast<const uint8_t*>(arrayBuffer.data()) + arrayBufferView.byteOffset() == static_cast<const uint8_t*>(arrayBufferView.baseAddress())); #endif - if (arrayBufferView.isByteArray()) + ArrayBufferView::ViewType type = arrayBufferView.getType(); + + if (type == ArrayBufferView::TypeInt8) append(ByteArrayTag); - else if (arrayBufferView.isUnsignedByteClampedArray()) + else if (type == ArrayBufferView::TypeUint8Clamped) append(UnsignedByteClampedArrayTag); - else if (arrayBufferView.isUnsignedByteArray()) + else if (type == ArrayBufferView::TypeUint8) append(UnsignedByteArrayTag); - else if (arrayBufferView.isShortArray()) + else if (type == ArrayBufferView::TypeInt16) append(ShortArrayTag); - else if (arrayBufferView.isUnsignedShortArray()) + else if (type == ArrayBufferView::TypeUint16) append(UnsignedShortArrayTag); - else if (arrayBufferView.isIntArray()) + else if (type == ArrayBufferView::TypeInt32) append(IntArrayTag); - else if (arrayBufferView.isUnsignedIntArray()) + else if (type == ArrayBufferView::TypeUint32) append(UnsignedIntArrayTag); - else if (arrayBufferView.isFloatArray()) + else if (type == ArrayBufferView::TypeFloat32) append(FloatArrayTag); - else if (arrayBufferView.isDoubleArray()) + else if (type == ArrayBufferView::TypeFloat64) append(DoubleArrayTag); - else if (arrayBufferView.isDataView()) + else if (type == ArrayBufferView::TypeDataView) append(DataViewTag); else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index d282b0dbe..b1142271b 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -60,6 +60,7 @@ V8BindingPerIsolateData::V8BindingPerIsolateData(v8::Isolate* isolate) #ifndef NDEBUG , m_internalScriptRecursionLevel(0) #endif + , m_lowMemoryNotificationHint(false) { } @@ -467,6 +468,10 @@ void StringCache::remove(StringImpl* stringImpl) { ASSERT(m_stringCache.contains(stringImpl)); m_stringCache.remove(stringImpl); + // Make sure that already disposed m_lastV8String is not used in + // StringCache::v8ExternalString(). + if (m_lastStringImpl.get() == stringImpl) + m_lastStringImpl = 0; } v8::Local<v8::String> StringCache::v8ExternalStringSlow(StringImpl* stringImpl, v8::Isolate* isolate) @@ -493,6 +498,7 @@ v8::Local<v8::String> StringCache::v8ExternalStringSlow(StringImpl* stringImpl, return newString; stringImpl->ref(); + wrapper.MarkIndependent(); wrapper.MakeWeak(stringImpl, cachedStringCallback); m_stringCache.set(stringImpl, *wrapper); diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index c63bf21b8..25f5a54e1 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -220,6 +220,14 @@ namespace WebCore { void reportMemoryUsage(MemoryObjectInfo*) const; + // Gives the system a hint that we should send a low memory + // notification upon the next close or navigation event, + // because some expensive objects have been allocated that we + // want to take every opportunity to collect. + void setLowMemoryNotificationHint() { m_lowMemoryNotificationHint = true; } + void clearLowMemoryNotificationHint() { m_lowMemoryNotificationHint = false; } + bool isLowMemoryNotificationHint() const { return m_lowMemoryNotificationHint; } + private: explicit V8BindingPerIsolateData(v8::Isolate*); ~V8BindingPerIsolateData(); @@ -248,6 +256,8 @@ namespace WebCore { int m_internalScriptRecursionLevel; #endif GCEventData m_gcEventData; + + bool m_lowMemoryNotificationHint; }; class ConstructorMode { diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp index e4079cdd1..081f75f81 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/bindings/v8/V8Proxy.cpp @@ -559,15 +559,26 @@ void V8Proxy::resetIsolatedWorlds() m_isolatedWorldSecurityOrigins.clear(); } +void V8Proxy::hintForGCIfNecessary() +{ + V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); + if (data->isLowMemoryNotificationHint()) { + data->clearLowMemoryNotificationHint(); + v8::V8::LowMemoryNotification(); + } +} + void V8Proxy::clearForClose() { resetIsolatedWorlds(); + hintForGCIfNecessary(); windowShell()->clearForClose(); } void V8Proxy::clearForNavigation() { resetIsolatedWorlds(); + hintForGCIfNecessary(); windowShell()->clearForNavigation(); } diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h index 64fc4e669..7d40077ec 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.h +++ b/Source/WebCore/bindings/v8/V8Proxy.h @@ -271,6 +271,8 @@ namespace WebCore { private: void resetIsolatedWorlds(); + void hintForGCIfNecessary(); + PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*); static const char* rangeExceptionName(int exceptionCode); diff --git a/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp index cb5d2febf..5b8a8c645 100644 --- a/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp @@ -35,6 +35,10 @@ #include "V8CSSValueList.h" #include "V8WebKitCSSTransformValue.h" +#if ENABLE(CSS_FILTERS) +#include "V8WebKitCSSFilterValue.h" +#endif + #if ENABLE(SVG) #include "V8SVGColor.h" #include "V8SVGPaint.h" @@ -48,6 +52,10 @@ v8::Handle<v8::Value> toV8(CSSValue* impl, v8::Isolate* isolate) return v8NullWithCheck(isolate); if (impl->isWebKitCSSTransformValue()) return toV8(static_cast<WebKitCSSTransformValue*>(impl), isolate); +#if ENABLE(CSS_FILTERS) + if (impl->isWebKitCSSFilterValue()) + return toV8(static_cast<WebKitCSSFilterValue*>(impl), isolate); +#endif if (impl->isValueList()) return toV8(static_cast<CSSValueList*>(impl), isolate); if (impl->isPrimitiveValue()) diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index e19896fee..110ae9b86 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -86,6 +86,13 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument CanvasRenderingContext* result = imp->getContext(contextId, attrs.get()); if (!result) return v8::Null(args.GetIsolate()); + + // Both 2D and 3D canvas contexts can hold on to lots of GPU resources, and we + // want to take an opportunity to get rid of them as soon as possible when we + // navigate away from pages using them. + V8BindingPerIsolateData* perIsolateData = V8BindingPerIsolateData::current(args.GetIsolate()); + perIsolateData->setLowMemoryNotificationHint(); + if (result->is2d()) return toV8(static_cast<CanvasRenderingContext2D*>(result), args.GetIsolate()); #if ENABLE(WEBGL) diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp index 695cb052e..b9c0b06e4 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp @@ -34,8 +34,8 @@ #include "V8HTMLElementWrapperFactory.h" #if ENABLE(MICRODATA) -#include "MicroDataItemValue.h" #include "V8Binding.h" +#include "V8MicroDataItemValue.h" #endif namespace WebCore { @@ -48,21 +48,10 @@ v8::Handle<v8::Value> toV8(HTMLElement* impl, v8::Isolate* isolate, bool forceNe } #if ENABLE(MICRODATA) -static v8::Handle<v8::Value> toV8Object(MicroDataItemValue* itemValue, v8::Isolate* isolate) -{ - if (!itemValue) - return v8::Null(isolate); - - if (itemValue->isNode()) - return toV8(itemValue->getNode(), isolate); - - return v8String(itemValue->getString(), isolate); -} - v8::Handle<v8::Value> V8HTMLElement::itemValueAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { HTMLElement* impl = V8HTMLElement::toNative(info.Holder()); - return toV8Object(impl->itemValue().get(), info.GetIsolate()); + return toV8(impl->itemValue().get(), info.GetIsolate()); } void V8HTMLElement::itemValueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp index f3aab2175..61025ea30 100644 --- a/Source/WebCore/bridge/qt/qt_runtime.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime.cpp @@ -504,10 +504,10 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type GregorianDateTime gdt; msToGregorianDateTime(exec, date->internalNumber(), true, gdt); if (hint == QMetaType::QDateTime) { - ret = QDateTime(QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); + ret = QDateTime(QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); dist = 0; } else if (hint == QMetaType::QDate) { - ret = QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()); + ret = QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()); dist = 1; } else { ret = QTime(gdt.hour(), gdt.minute(), gdt.second()); @@ -518,10 +518,10 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type GregorianDateTime gdt; msToGregorianDateTime(exec, b, true, gdt); if (hint == QMetaType::QDateTime) { - ret = QDateTime(QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); + ret = QDateTime(QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); dist = 6; } else if (hint == QMetaType::QDate) { - ret = QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()); + ret = QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()); dist = 8; } else { ret = QTime(gdt.hour(), gdt.minute(), gdt.second()); @@ -874,7 +874,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con // Dates specified this way are in local time (we convert DateTimes above) GregorianDateTime dt; - dt.setYear(date.year() - 1900); + dt.setYear(date.year()); dt.setMonth(date.month() - 1); dt.setMonthDay(date.day()); dt.setHour(time.hour()); diff --git a/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp b/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp index 0e936bd89..e9e6f5afd 100644 --- a/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp @@ -504,10 +504,10 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type GregorianDateTime gdt; msToGregorianDateTime(exec, date->internalNumber(), true, gdt); if (hint == QMetaType::QDateTime) { - ret = QDateTime(QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); + ret = QDateTime(QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); dist = 0; } else if (hint == QMetaType::QDate) { - ret = QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()); + ret = QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()); dist = 1; } else { ret = QTime(gdt.hour(), gdt.minute(), gdt.second()); @@ -518,10 +518,10 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type GregorianDateTime gdt; msToGregorianDateTime(exec, b, true, gdt); if (hint == QMetaType::QDateTime) { - ret = QDateTime(QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); + ret = QDateTime(QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()), QTime(gdt.hour(), gdt.minute(), gdt.second()), Qt::UTC); dist = 6; } else if (hint == QMetaType::QDate) { - ret = QDate(gdt.year() + 1900, gdt.month() + 1, gdt.monthDay()); + ret = QDate(gdt.year(), gdt.month() + 1, gdt.monthDay()); dist = 8; } else { ret = QTime(gdt.hour(), gdt.minute(), gdt.second()); @@ -874,7 +874,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con // Dates specified this way are in local time (we convert DateTimes above) GregorianDateTime dt; - dt.setYear(date.year() - 1900); + dt.setYear(date.year()); dt.setMonth(date.month() - 1); dt.setMonthDay(date.day()); dt.setHour(time.hour()); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 650844060..c3ff2ab57 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -3022,7 +3022,10 @@ void CSSParser::storeVariableDeclaration(const CSSParserString& name, PassOwnPtr for (unsigned i = 0, size = value->size(); i < size; i++) { if (i) builder.append(' '); - builder.append(value->valueAt(i)->createCSSValue()->cssText()); + RefPtr<CSSValue> cssValue = value->valueAt(i)->createCSSValue(); + if (!cssValue) + return; + builder.append(cssValue->cssText()); } addProperty(CSSPropertyVariable, CSSVariableValue::create(variableName, builder.toString()), important, false); } @@ -9541,7 +9544,8 @@ StyleRuleBase* CSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector> >* se result = rule.get(); m_parsedRules.append(rule.release()); processAndAddNewRuleToSourceTreeIfNeeded(); - } + } else + popRuleData(); clearProperties(); return result; } diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index a88f49cda..e8638456a 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -383,6 +383,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case MediaPlayButtonPart: m_value.ident = CSSValueMediaPlayButton; break; + case MediaOverlayPlayButtonPart: + m_value.ident = CSSValueMediaOverlayPlayButton; + break; case MediaMuteButtonPart: m_value.ident = CSSValueMediaMuteButton; break; @@ -2032,11 +2035,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e) case FixedPosition: m_value.ident = CSSValueFixed; break; -#if ENABLE(CSS_STICKY_POSITION) case StickyPosition: +#if ENABLE(CSS_STICKY_POSITION) m_value.ident = CSSValueWebkitSticky; - break; #endif + break; } } diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index 6e0db28f7..b6350722b 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -644,6 +644,7 @@ media-fullscreen-volume-slider media-fullscreen-volume-slider-thumb media-mute-button media-play-button +media-overlay-play-button media-seek-back-button media-seek-forward-button media-rewind-button diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp index 006014e61..8a0afd6e8 100644 --- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp +++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp @@ -403,6 +403,7 @@ CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const StylePropertySet* InlineCSSStyleDeclaration::ensureMutablePropertySet() { ASSERT(m_propertySet); + ASSERT(m_propertySet->isMutable()); return m_propertySet; } diff --git a/Source/WebCore/css/SelectorChecker.cpp b/Source/WebCore/css/SelectorChecker.cpp index 299e075d5..ef6ea8236 100644 --- a/Source/WebCore/css/SelectorChecker.cpp +++ b/Source/WebCore/css/SelectorChecker.cpp @@ -622,7 +622,7 @@ bool htmlAttributeHasCaseInsensitiveValue(const QualifiedName& attr) return isPossibleHTMLAttr && htmlCaseInsensitiveAttributesSet->contains(attr.localName().impl()); } -static bool attributeValueMatches(Attribute* attributeItem, CSSSelector::Match match, const AtomicString& selectorValue, bool caseSensitive) +static bool attributeValueMatches(const Attribute* attributeItem, CSSSelector::Match match, const AtomicString& selectorValue, bool caseSensitive) { const AtomicString& value = attributeItem->value(); if (value.isNull()) @@ -689,7 +689,7 @@ static bool anyAttributeMatches(Element* element, CSSSelector::Match match, cons { ASSERT(element->hasAttributesWithoutUpdate()); for (size_t i = 0; i < element->attributeCount(); ++i) { - Attribute* attributeItem = element->attributeItem(i); + const Attribute* attributeItem = element->attributeItem(i); if (!SelectorChecker::attributeNameMatches(attributeItem, selectorAttr)) continue; diff --git a/Source/WebCore/css/SelectorChecker.h b/Source/WebCore/css/SelectorChecker.h index 3219dea96..ce7213b80 100644 --- a/Source/WebCore/css/SelectorChecker.h +++ b/Source/WebCore/css/SelectorChecker.h @@ -214,7 +214,7 @@ inline bool SelectorChecker::checkExactAttribute(const Element* element, const Q return false; unsigned size = element->attributeCount(); for (unsigned i = 0; i < size; ++i) { - Attribute* attribute = element->attributeItem(i); + const Attribute* attribute = element->attributeItem(i); if (attributeNameMatches(attribute, selectorAttributeName) && (!value || attribute->value().impl() == value)) return true; } diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index e55e40c58..92b925ca2 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -82,6 +82,7 @@ #include "MatrixTransformOperation.h" #include "MediaList.h" #include "MediaQueryEvaluator.h" +#include "MemoryInstrumentation.h" #include "NodeRenderStyle.h" #include "NodeRenderingContext.h" #include "Page.h" @@ -216,6 +217,8 @@ public: static const unsigned maximumIdentifierCount = 4; const unsigned* descendantSelectorIdentifierHashes() const { return m_descendantSelectorIdentifierHashes; } + void reportMemoryUsage(MemoryObjectInfo*) const; + private: StyleRule* m_rule; CSSSelector* m_selector; @@ -272,6 +275,8 @@ public: const Vector<RuleData>* universalRules() const { return &m_universalRules; } const Vector<StyleRulePage*>& pageRules() const { return m_pageRules; } + void reportMemoryUsage(MemoryObjectInfo*) const; + public: RuleSet(); @@ -290,6 +295,8 @@ public: struct RuleSetSelectorPair { RuleSetSelectorPair(CSSSelector* selector, PassOwnPtr<RuleSet> ruleSet) : selector(selector), ruleSet(ruleSet) { } RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selector), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } + void reportMemoryUsage(MemoryObjectInfo*) const; + CSSSelector* selector; OwnPtr<RuleSet> ruleSet; }; @@ -728,6 +735,15 @@ void StyleResolver::Features::clear() usesLinkRules = false; } +void StyleResolver::Features::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo<StyleResolver::Features> info(memoryObjectInfo, this, MemoryInstrumentation::CSS); + info.addHashSet(idsInRules); + info.addHashSet(attrsInRules); + info.addVector(siblingRules); + info.addVector(uncommonAttributeRules); +} + static StyleSheetContents* parseUASheet(const String& str) { StyleSheetContents* sheet = StyleSheetContents::create().leakRef(); // leak the sheet on purpose @@ -1296,6 +1312,9 @@ bool StyleResolver::canShareStyleWithControl(StyledElement* element) const if (!thisInputElement || !otherInputElement) return false; + if (thisInputElement->fastGetAttribute(typeAttr) != otherInputElement->fastGetAttribute(typeAttr)) + return false; + if (thisInputElement->isAutofilled() != otherInputElement->isAutofilled()) return false; if (thisInputElement->shouldAppearChecked() != otherInputElement->shouldAppearChecked()) @@ -1356,8 +1375,9 @@ static inline bool attributeStylesEqual(StylePropertySet* a, StylePropertySet* b return true; } -inline bool elementHasDirectionAuto(Element* element) +static inline bool elementHasDirectionAuto(Element* element) { + // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver. return element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto(); } @@ -1401,8 +1421,6 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const return false; if (m_element == m_element->document()->cssTarget()) return false; - if (element->getAttribute(typeAttr) != m_element->getAttribute(typeAttr)) - return false; if (element->fastGetAttribute(XMLNames::langAttr) != m_element->fastGetAttribute(XMLNames::langAttr)) return false; if (element->fastGetAttribute(langAttr) != m_element->fastGetAttribute(langAttr)) @@ -2481,12 +2499,45 @@ RuleData::RuleData(StyleRule* rule, CSSSelector* selector, unsigned position, bo SelectorChecker::collectIdentifierHashes(m_selector, m_descendantSelectorIdentifierHashes, maximumIdentifierCount); } +void RuleData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo<RuleData> info(memoryObjectInfo, this, MemoryInstrumentation::CSS); +} + RuleSet::RuleSet() : m_ruleCount(0) , m_autoShrinkToFitEnabled(true) { } + +static void reportAtomRuleMap(MemoryClassInfo<RuleSet>* info, const RuleSet::AtomRuleMap& atomicRuleMap) +{ + info->addHashMap(atomicRuleMap); + for (RuleSet::AtomRuleMap::const_iterator it = atomicRuleMap.begin(); it != atomicRuleMap.end(); ++it) + info->addInstrumentedVector(*it->second); +} + +void RuleSet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo<RuleSet> info(memoryObjectInfo, this, MemoryInstrumentation::CSS); + reportAtomRuleMap(&info, m_idRules); + reportAtomRuleMap(&info, m_classRules); + reportAtomRuleMap(&info, m_tagRules); + reportAtomRuleMap(&info, m_shadowPseudoElementRules); + info.addInstrumentedVector(m_linkPseudoClassRules); + info.addInstrumentedVector(m_focusPseudoClassRules); + info.addInstrumentedVector(m_universalRules); + info.addVector(m_pageRules); + info.addInstrumentedVector(m_regionSelectorsAndRuleSets); +} + +void RuleSet::RuleSetSelectorPair::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo<RuleSet::RuleSetSelectorPair> info(memoryObjectInfo, this, MemoryInstrumentation::CSS); + info.addInstrumentedMember(ruleSet); +} + static inline void collectFeaturesFromSelector(StyleResolver::Features& features, const CSSSelector* selector) { if (selector->m_match == CSSSelector::Id) @@ -5578,4 +5629,36 @@ void StyleResolver::loadPendingResources() #endif } +void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo<StyleResolver> info(memoryObjectInfo, this, MemoryInstrumentation::CSS); + info.addMember(m_style); + info.addInstrumentedMember(m_authorStyle); + info.addInstrumentedMember(m_userStyle); + info.addInstrumentedMember(m_siblingRuleSet); + info.addInstrumentedMember(m_uncommonAttributeRuleSet); + info.addHashMap(m_keyframesRuleMap); + info.addHashMap(m_matchedPropertiesCache); + info.addVector(m_matchedRules); + + // FIXME: Instrument StaticCSSRuleList and add m_ruleList here. + info.addHashSet(m_pendingImageProperties); + info.addVector(m_viewportDependentMediaQueryResults); + info.addHashMap(m_styleRuleToCSSOMWrapperMap); + info.addHashSet(m_styleSheetCSSOMWrapperSet); +#if ENABLE(CSS_FILTERS) && ENABLE(SVG) + info.addHashMap(m_pendingSVGDocuments); +#endif +#if ENABLE(STYLE_SCOPED) + info.addHashMap(m_scopedAuthorStyles); + info.addVector(m_scopeStack); +#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); +} + } // namespace WebCore diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h index 1e7643898..f181eb60e 100644 --- a/Source/WebCore/css/StyleResolver.h +++ b/Source/WebCore/css/StyleResolver.h @@ -65,6 +65,7 @@ class KURL; class KeyframeList; class KeyframeValue; class MediaQueryEvaluator; +class MemoryObjectInfo; class Node; class RenderRegion; class RuleData; @@ -287,6 +288,7 @@ public: ~Features(); void add(const StyleResolver::Features&); void clear(); + void reportMemoryUsage(MemoryObjectInfo*) const; HashSet<AtomicStringImpl*> idsInRules; HashSet<AtomicStringImpl*> attrsInRules; Vector<RuleFeature> siblingRules; @@ -420,6 +422,8 @@ public: static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1); CSSToStyleMap* styleMap() { return &m_styleMap; } + + void reportMemoryUsage(MemoryObjectInfo*) const; private: static RenderStyle* s_styleNotYetAvailable; diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index 9f61bafa2..e5ad78cff 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -745,6 +745,7 @@ output { margin: 0; -webkit-text-security: none; -webkit-transition: opacity 05.5s ease; + -webkit-user-modify: read-only !important; } ::-webkit-validation-bubble-message { @@ -762,6 +763,7 @@ output { -webkit-box-shadow: 4px 4px 4px rgba(100,100,100,0.6), inset -2px -2px 1px #d0c4c4, inset 2px 2px 1px white; + -webkit-user-modify: read-only !important; line-height: normal; white-space: normal; z-index: 2147483644; @@ -769,10 +771,12 @@ output { ::-webkit-validation-bubble-text-block { -webkit-box-flex: 1; + -webkit-user-modify: read-only !important; } ::-webkit-validation-bubble-heading { font-weight: bold; + -webkit-user-modify: read-only !important; } ::-webkit-validation-bubble-arrow { @@ -788,6 +792,7 @@ output { box-shadow: inset 2px 2px 1px white; -webkit-transform-origin: 0 0; -webkit-transform: rotate(45deg); + -webkit-user-modify: read-only !important; z-index: 2147483645; } @@ -795,6 +800,7 @@ output { display: block; overflow: hidden; height: 16px; + -webkit-user-modify: read-only !important; } #if defined(ENABLE_METER_ELEMENT) && ENABLE_METER_ELEMENT @@ -813,24 +819,28 @@ meter::-webkit-meter-bar { background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc)); height: 100%; width: 100%; + -webkit-user-modify: read-only !important; -webkit-box-sizing: border-box; } meter::-webkit-meter-optimum-value { background: -webkit-gradient(linear, left top, left bottom, from(#ad7), to(#ad7), color-stop(0.20, #cea), color-stop(0.45, #7a3), color-stop(0.55, #7a3)); height: 100%; + -webkit-user-modify: read-only !important; -webkit-box-sizing: border-box; } meter::-webkit-meter-suboptimum-value { background: -webkit-gradient(linear, left top, left bottom, from(#fe7), to(#fe7), color-stop(0.20, #ffc), color-stop(0.45, #db3), color-stop(0.55, #db3)); height: 100%; + -webkit-user-modify: read-only !important; -webkit-box-sizing: border-box; } meter::-webkit-meter-even-less-good-value { background: -webkit-gradient(linear, left top, left bottom, from(#f77), to(#f77), color-stop(0.20, #fcc), color-stop(0.45, #d44), color-stop(0.55, #d44)); height: 100%; + -webkit-user-modify: read-only !important; -webkit-box-sizing: border-box; } #endif @@ -851,6 +861,7 @@ progress::-webkit-progress-bar { background-color: gray; height: 100%; width: 100%; + -webkit-user-modify: read-only !important; -webkit-box-sizing: border-box; } @@ -858,6 +869,7 @@ progress::-webkit-progress-value { background-color: green; height: 100%; width: 50%; /* should be removed later */ + -webkit-user-modify: read-only !important; -webkit-box-sizing: border-box; } #endif diff --git a/Source/WebCore/css/mediaControls.css b/Source/WebCore/css/mediaControls.css index da1e6c832..9d8221e47 100644 --- a/Source/WebCore/css/mediaControls.css +++ b/Source/WebCore/css/mediaControls.css @@ -81,6 +81,10 @@ audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-bu color: inherit; } +audio::-webkit-media-controls-overlay-play-button, video::-webkit-media-controls-overlay-play-button { + display: none; +} + audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { -webkit-appearance: media-play-button; display: -webkit-box; diff --git a/Source/WebCore/css/mediaControlsChromiumAndroid.css b/Source/WebCore/css/mediaControlsChromiumAndroid.css index 21b647c38..10f7f1e64 100644 --- a/Source/WebCore/css/mediaControlsChromiumAndroid.css +++ b/Source/WebCore/css/mediaControlsChromiumAndroid.css @@ -75,6 +75,22 @@ video::-webkit-media-controls-enclosure { height: 35px; } +audio::-webkit-media-controls-overlay-enclosure { + display: none; +} + +video::-webkit-media-controls-overlay-enclosure { + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-pack:center; + -webkit-box-align:center; + -webkit-box-flex:1; + width: 100%; + max-width: 800px; + text-indent: 0; + box-sizing: border-box; +} + audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { display: none; } @@ -92,6 +108,18 @@ audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-bu padding: 0; } +video::-webkit-media-controls-overlay-play-button { + -webkit-appearance: media-overlay-play-button; + -webkit-box-align: center; + display: -webkit-box; + border: none; + box-sizing: border-box; + background-color: transparent; + width: 80px; + height: 80px; + padding: 0; +} + audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display, audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display { -webkit-appearance: media-current-time-display; diff --git a/Source/WebCore/dom/ContextFeatures.cpp b/Source/WebCore/dom/ContextFeatures.cpp index 7e3daa671..0f2273029 100644 --- a/Source/WebCore/dom/ContextFeatures.cpp +++ b/Source/WebCore/dom/ContextFeatures.cpp @@ -99,6 +99,18 @@ bool ContextFeatures::pagePopupEnabled(Document* document) #endif } +bool ContextFeatures::htmlNotificationsEnabled(Document* document) +{ +#if ENABLE(LEGACY_NOTIFICATIONS) + if (!document) + return false; + return document->contextFeatures()->isEnabled(document, HTMLNotifications, false); +#else + UNUSED_PARAM(document); + return false; +#endif +} + void provideContextFeaturesTo(Page* page, ContextFeaturesClient* client) { RefCountedSupplement<Page, ContextFeatures>::provideTo(page, ContextFeatures::supplementName(), ContextFeatures::create(client)); diff --git a/Source/WebCore/dom/ContextFeatures.h b/Source/WebCore/dom/ContextFeatures.h index 31dda92df..b32fbbf6e 100644 --- a/Source/WebCore/dom/ContextFeatures.h +++ b/Source/WebCore/dom/ContextFeatures.h @@ -43,6 +43,7 @@ public: ShadowDOM, StyleScoped, PagePopup, + HTMLNotifications, FeatureTypeSize // Should be the last entry. }; @@ -54,6 +55,7 @@ public: static bool shadowDOMEnabled(Document*); static bool styleScopedEnabled(Document*); static bool pagePopupEnabled(Document*); + static bool htmlNotificationsEnabled(Document*); bool isEnabled(Document*, FeatureType, bool) const; void urlDidChange(Document*); diff --git a/Source/WebCore/dom/DatasetDOMStringMap.cpp b/Source/WebCore/dom/DatasetDOMStringMap.cpp index 382022ecd..d82c8bc0a 100644 --- a/Source/WebCore/dom/DatasetDOMStringMap.cpp +++ b/Source/WebCore/dom/DatasetDOMStringMap.cpp @@ -146,7 +146,7 @@ void DatasetDOMStringMap::getNames(Vector<String>& names) unsigned length = m_element->attributeCount(); for (unsigned i = 0; i < length; i++) { - Attribute* attribute = m_element->attributeItem(i); + const Attribute* attribute = m_element->attributeItem(i); if (isValidAttributeName(attribute->localName())) names.append(convertAttributeNameToPropertyName(attribute->localName())); } @@ -159,7 +159,7 @@ String DatasetDOMStringMap::item(const String& name) unsigned length = m_element->attributeCount(); for (unsigned i = 0; i < length; i++) { - Attribute* attribute = m_element->attributeItem(i); + const Attribute* attribute = m_element->attributeItem(i); if (propertyNameMatchesAttributeName(name, attribute->localName())) return attribute->value(); } @@ -174,7 +174,7 @@ bool DatasetDOMStringMap::contains(const String& name) unsigned length = m_element->attributeCount(); for (unsigned i = 0; i < length; i++) { - Attribute* attribute = m_element->attributeItem(i); + const Attribute* attribute = m_element->attributeItem(i); if (propertyNameMatchesAttributeName(name, attribute->localName())) return true; } diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index f0b0b65cd..169d8a5a0 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -222,6 +222,10 @@ #include "TextAutosizer.h" #endif +#if ENABLE(CSP_NEXT) +#include "DOMSecurityPolicy.h" +#endif + using namespace std; using namespace WTF; using namespace Unicode; @@ -662,7 +666,7 @@ Document::~Document() #if ENABLE(UNDO_MANAGER) if (m_undoManager) - m_undoManager->undoScopeHostDestroyed(); + m_undoManager->disconnect(); #endif // We must call clearRareData() here since a Document class inherits TreeScope @@ -1643,6 +1647,15 @@ void Document::dispatchVisibilityStateChangeEvent() } #endif +#if ENABLE(CSP_NEXT) +DOMSecurityPolicy* Document::securityPolicy() +{ + if (!m_domSecurityPolicy) + m_domSecurityPolicy = DOMSecurityPolicy::create(this); + return m_domSecurityPolicy.get(); +} +#endif + String Document::nodeName() const { return "#document"; @@ -6075,6 +6088,7 @@ void Document::setContextFeatures(PassRefPtr<ContextFeatures> features) void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { MemoryClassInfo<Document> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + info.addInstrumentedMember(m_styleResolver); info.visitBaseClass<ContainerNode>(this); info.addVector(m_customFonts); info.addString(m_documentURI); diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index d9eb6703d..017eb8c85 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -179,6 +179,10 @@ class Prerenderer; class TextAutosizer; #endif +#if ENABLE(CSP_NEXT) +class DOMSecurityPolicy; +#endif + typedef int ExceptionCode; enum PageshowEventPersistence { @@ -416,6 +420,10 @@ public: void dispatchVisibilityStateChangeEvent(); #endif +#if ENABLE(CSP_NEXT) + DOMSecurityPolicy* securityPolicy(); +#endif + PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&); PassRefPtr<HTMLCollection> images(); @@ -1539,6 +1547,10 @@ private: RefPtr<WebKitNamedFlowCollection> m_namedFlows; +#if ENABLE(CSP_NEXT) + RefPtr<DOMSecurityPolicy> m_domSecurityPolicy; +#endif + #ifndef NDEBUG bool m_didDispatchViewportPropertiesChanged; #endif diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl index 7c1c4839c..742381f2a 100644 --- a/Source/WebCore/dom/Document.idl +++ b/Source/WebCore/dom/Document.idl @@ -375,6 +375,9 @@ module core { readonly attribute [Conditional=PAGE_VISIBILITY_API] DOMString webkitVisibilityState; readonly attribute [Conditional=PAGE_VISIBILITY_API] boolean webkitHidden; + // Security Policy API: http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces + readonly attribute [Conditional=CSP_NEXT] DOMSecurityPolicy SecurityPolicy; + }; } diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 3499447ed..c323fa10d 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -201,7 +201,7 @@ PassRefPtr<Attr> Element::detachAttribute(size_t index) { ASSERT(attributeData()); - Attribute* attribute = attributeData()->attributeItem(index); + const Attribute* attribute = attributeData()->attributeItem(index); ASSERT(attribute); RefPtr<Attr> attr = attrIfExists(attribute->name()); @@ -210,7 +210,7 @@ PassRefPtr<Attr> Element::detachAttribute(size_t index) else attr = Attr::create(document(), attribute->name(), attribute->value()); - attributeData()->removeAttribute(index, this); + mutableAttributeData()->removeAttribute(index, this); return attr.release(); } @@ -222,7 +222,11 @@ void Element::removeAttribute(const QualifiedName& name) if (RefPtr<Attr> attr = attrIfExists(name)) attr->detachFromElementWithValue(attr->value()); - attributeData()->removeAttribute(name, this); + size_t index = attributeData()->getAttributeItemIndex(name); + if (index == notFound) + return; + + mutableAttributeData()->removeAttribute(index, this); } void Element::setBooleanAttribute(const QualifiedName& name, bool value) @@ -264,8 +268,8 @@ const AtomicString& Element::getAttribute(const QualifiedName& name) const updateAnimatedSVGAttribute(name); #endif - if (m_attributeData) { - if (Attribute* attribute = getAttributeItem(name)) + if (attributeData()) { + if (const Attribute* attribute = getAttributeItem(name)) return attribute->value(); } return nullAtom; @@ -412,8 +416,12 @@ int Element::clientLeft() { document()->updateLayoutIgnorePendingStylesheets(); - if (RenderBox* renderer = renderBox()) - return adjustForAbsoluteZoom(roundToInt(renderer->clientLeft()), renderer); + if (RenderBox* renderer = renderBox()) { + LayoutUnit clientLeft = renderer->clientLeft(); + if (renderer->style() && renderer->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + clientLeft += renderer->verticalScrollbarWidth(); + return adjustForAbsoluteZoom(roundToInt(clientLeft), renderer); + } return 0; } @@ -624,15 +632,15 @@ const AtomicString& Element::getAttribute(const AtomicString& name) const } #endif - if (m_attributeData) { - if (Attribute* attribute = m_attributeData->getAttributeItem(name, ignoreCase)) + if (attributeData()) { + if (const Attribute* attribute = attributeData()->getAttributeItem(name, ignoreCase)) return attribute->value(); } return nullAtom; } -const AtomicString& Element::getAttributeNS(const String& namespaceURI, const String& localName) const +const AtomicString& Element::getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const { return getAttribute(QualifiedName(nullAtom, localName, namespaceURI)); } @@ -658,15 +666,17 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value, inline void Element::setAttributeInternal(size_t index, const QualifiedName& name, const AtomicString& value, EInUpdateStyleAttribute inUpdateStyleAttribute) { - Attribute* old = index != notFound ? m_attributeData->attributeItem(index) : 0; + ElementAttributeData* attributeData = mutableAttributeData(); + + Attribute* old = index != notFound ? attributeData->attributeItem(index) : 0; if (value.isNull()) { if (old) - m_attributeData->removeAttribute(index, this, inUpdateStyleAttribute); + attributeData->removeAttribute(index, this, inUpdateStyleAttribute); return; } if (!old) { - m_attributeData->addAttribute(Attribute(name, value), this, inUpdateStyleAttribute); + attributeData->addAttribute(Attribute(name, value), this, inUpdateStyleAttribute); return; } @@ -760,44 +770,44 @@ void Element::parserSetAttributes(const Vector<Attribute>& attributeVector, Frag if (attributeVector.isEmpty()) return; - createAttributeData(); - m_attributeData->m_attributes = attributeVector; - m_attributeData->m_attributes.shrinkToFit(); + Vector<Attribute> filteredAttributes = attributeVector; // If the element is created as result of a paste or drag-n-drop operation // we want to remove all the script and event handlers. if (scriptingPermission == DisallowScriptingContent) { unsigned i = 0; - while (i < m_attributeData->length()) { - const QualifiedName& attributeName = m_attributeData->m_attributes[i].name(); - if (isEventHandlerAttribute(attributeName)) { - m_attributeData->m_attributes.remove(i); + while (i < filteredAttributes.size()) { + Attribute& attribute = filteredAttributes[i]; + if (isEventHandlerAttribute(attribute.name())) { + filteredAttributes.remove(i); continue; } - if (isAttributeToRemove(attributeName, m_attributeData->m_attributes[i].value())) - m_attributeData->m_attributes[i].setValue(nullAtom); + if (isAttributeToRemove(attribute.name(), attribute.value())) + attribute.setValue(emptyAtom); i++; } } - // Store the set of attributes that changed on the stack in case + m_attributeData = ElementAttributeData::createImmutable(filteredAttributes); + + // Iterate over the set of attributes we already have on the stack in case // attributeChanged mutates m_attributeData. - Vector<Attribute> clonedAttributes = m_attributeData->clonedAttributeVector(); - for (unsigned i = 0; i < clonedAttributes.size(); ++i) - attributeChanged(clonedAttributes[i]); + // FIXME: Find a way so we don't have to do this. + for (unsigned i = 0; i < filteredAttributes.size(); ++i) + attributeChanged(filteredAttributes[i]); } bool Element::hasAttributes() const { updateInvalidAttributes(); - return m_attributeData && m_attributeData->length(); + return attributeData() && attributeData()->length(); } bool Element::hasEquivalentAttributes(const Element* other) const { - ElementAttributeData* attributeData = updatedAttributeData(); - ElementAttributeData* otherAttributeData = other->updatedAttributeData(); + const ElementAttributeData* attributeData = updatedAttributeData(); + const ElementAttributeData* otherAttributeData = other->updatedAttributeData(); if (attributeData) return attributeData->isEquivalent(otherAttributeData); if (otherAttributeData) @@ -843,11 +853,6 @@ KURL Element::baseURI() const return KURL(parentBase, baseAttribute); } -void Element::createAttributeData() const -{ - m_attributeData = ElementAttributeData::create(); -} - const QualifiedName& Element::imageSourceAttributeName() const { return srcAttr; @@ -1394,8 +1399,6 @@ PassRefPtr<Attr> Element::setAttributeNode(Attr* attr, ExceptionCode& ec) return 0; } - ElementAttributeData* attributeData = ensureUpdatedAttributeData(); - RefPtr<Attr> oldAttr = attrIfExists(attr->qualifiedName()); if (oldAttr.get() == attr) return attr; // This Attr is already attached to the element. @@ -1407,6 +1410,9 @@ PassRefPtr<Attr> Element::setAttributeNode(Attr* attr, ExceptionCode& ec) return 0; } + updateInvalidAttributes(); + ElementAttributeData* attributeData = mutableAttributeData(); + size_t index = attributeData->getAttributeItemIndex(attr->qualifiedName()); Attribute* oldAttribute = index != notFound ? attributeData->attributeItem(index) : 0; @@ -1444,7 +1450,7 @@ PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionCode& ec) ASSERT(document() == attr->document()); - ElementAttributeData* attributeData = updatedAttributeData(); + const ElementAttributeData* attributeData = updatedAttributeData(); ASSERT(attributeData); size_t index = attributeData->getAttributeItemIndex(attr->qualifiedName()); @@ -1456,44 +1462,50 @@ PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionCode& ec) return detachAttribute(index); } -void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) +bool Element::parseAttributeName(QualifiedName& out, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode& ec) { String prefix, localName; if (!Document::parseQualifiedName(qualifiedName, prefix, localName, ec)) - return; + return false; + ASSERT(!ec); QualifiedName qName(prefix, localName, namespaceURI); if (!Document::hasValidNamespaceForAttributes(qName)) { ec = NAMESPACE_ERR; - return; + return false; } - if (scriptingPermission == DisallowScriptingContent && (isEventHandlerAttribute(qName) || isAttributeToRemove(qName, value))) - return; + out = qName; + return true; +} - setAttribute(qName, value); +void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec) +{ + QualifiedName parsedName = anyName; + if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, ec)) + return; + setAttribute(parsedName, value); } void Element::removeAttribute(size_t index) { ASSERT(attributeData()); ASSERT(index <= attributeCount()); - attributeData()->removeAttribute(index, this); + mutableAttributeData()->removeAttribute(index, this); } void Element::removeAttribute(const String& name) { - ElementAttributeData* attributeData = this->attributeData(); - if (!attributeData) + if (!attributeData()) return; String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name; - size_t index = attributeData->getAttributeItemIndex(localName, false); + size_t index = attributeData()->getAttributeItemIndex(localName, false); if (index == notFound) return; - attributeData->removeAttribute(index, this); + mutableAttributeData()->removeAttribute(index, this); } void Element::removeAttributeNS(const String& namespaceURI, const String& localName) @@ -1503,7 +1515,7 @@ void Element::removeAttributeNS(const String& namespaceURI, const String& localN PassRefPtr<Attr> Element::getAttributeNode(const String& name) { - ElementAttributeData* attributeData = updatedAttributeData(); + const ElementAttributeData* attributeData = updatedAttributeData(); if (!attributeData) return 0; return attributeData->getAttributeNode(name, shouldIgnoreAttributeCase(this), this); @@ -1511,7 +1523,7 @@ PassRefPtr<Attr> Element::getAttributeNode(const String& name) PassRefPtr<Attr> Element::getAttributeNodeNS(const String& namespaceURI, const String& localName) { - ElementAttributeData* attributeData = updatedAttributeData(); + const ElementAttributeData* attributeData = updatedAttributeData(); if (!attributeData) return 0; return attributeData->getAttributeNode(QualifiedName(nullAtom, localName, namespaceURI), this); @@ -1519,19 +1531,18 @@ PassRefPtr<Attr> Element::getAttributeNodeNS(const String& namespaceURI, const S bool Element::hasAttribute(const String& name) const { - ElementAttributeData* attributeData = updatedAttributeData(); - if (!attributeData) + if (!attributeData()) return false; // This call to String::lower() seems to be required but // there may be a way to remove it. String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name; - return attributeData->getAttributeItem(localName, false); + return updatedAttributeData()->getAttributeItem(localName, false); } bool Element::hasAttributeNS(const String& namespaceURI, const String& localName) const { - ElementAttributeData* attributeData = updatedAttributeData(); + const ElementAttributeData* attributeData = updatedAttributeData(); if (!attributeData) return false; return attributeData->getAttributeItem(QualifiedName(nullAtom, localName, namespaceURI)); @@ -1738,12 +1749,11 @@ void Element::normalizeAttributes() if (!hasAttrList()) return; - ElementAttributeData* attributeData = updatedAttributeData(); + const ElementAttributeData* attributeData = updatedAttributeData(); ASSERT(attributeData); - const Vector<Attribute>& attributes = attributeData->attributeVector(); - for (size_t i = 0; i < attributes.size(); ++i) { - if (RefPtr<Attr> attr = attrIfExists(attributes[i].name())) + for (size_t i = 0; i < attributeData->length(); ++i) { + if (RefPtr<Attr> attr = attrIfExists(attributeData->attributeItem(i)->name())) attr->normalize(); } } @@ -1812,8 +1822,8 @@ DOMStringMap* Element::dataset() KURL Element::getURLAttribute(const QualifiedName& name) const { #if !ASSERT_DISABLED - if (m_attributeData) { - if (Attribute* attribute = getAttributeItem(name)) + if (attributeData()) { + if (const Attribute* attribute = getAttributeItem(name)) ASSERT(isURLAttribute(*attribute)); } #endif @@ -1823,8 +1833,8 @@ KURL Element::getURLAttribute(const QualifiedName& name) const KURL Element::getNonEmptyURLAttribute(const QualifiedName& name) const { #if !ASSERT_DISABLED - if (m_attributeData) { - if (Attribute* attribute = getAttributeItem(name)) + if (attributeData()) { + if (const Attribute* attribute = getAttributeItem(name)) ASSERT(isURLAttribute(*attribute)); } #endif @@ -2168,8 +2178,8 @@ PassRefPtr<RenderStyle> Element::customStyleForRenderer() void Element::cloneAttributesFromElement(const Element& other) { - if (ElementAttributeData* attributeData = other.updatedAttributeData()) - ensureUpdatedAttributeData()->cloneDataFrom(*attributeData, other, *this); + if (const ElementAttributeData* attributeData = other.updatedAttributeData()) + mutableAttributeData()->cloneDataFrom(*attributeData, other, *this); else if (m_attributeData) { m_attributeData->clearAttributes(this); m_attributeData.clear(); @@ -2182,4 +2192,70 @@ void Element::cloneDataFromElement(const Element& other) copyNonAttributePropertiesFromElement(other); } +void Element::createMutableAttributeData() +{ + if (!m_attributeData) + m_attributeData = ElementAttributeData::create(); + else + m_attributeData = m_attributeData->makeMutable(); +} + +#if ENABLE(UNDO_MANAGER) +bool Element::undoScope() const +{ + return hasRareData() && elementRareData()->m_undoScope; +} + +void Element::setUndoScope(bool undoScope) +{ + ElementRareData* data = ensureElementRareData(); + data->m_undoScope = undoScope; + if (!undoScope) + disconnectUndoManager(); +} + +PassRefPtr<UndoManager> Element::undoManager() +{ + if (!undoScope() || (isContentEditable() && !isRootEditableElement())) { + disconnectUndoManager(); + return 0; + } + ElementRareData* data = ensureElementRareData(); + if (!data->m_undoManager) + data->m_undoManager = UndoManager::create(this); + return data->m_undoManager; +} + +void Element::disconnectUndoManager() +{ + if (!hasRareData()) + return; + ElementRareData* data = elementRareData(); + UndoManager* undoManager = data->m_undoManager.get(); + if (!undoManager) + return; + undoManager->clearUndoRedo(); + undoManager->disconnect(); + data->m_undoManager.clear(); +} + +void Element::disconnectUndoManagersInSubtree() +{ + Node* node = firstChild(); + while (node) { + if (node->isElementNode()) { + Element* element = toElement(node); + if (element->hasRareData() && element->elementRareData()->m_undoManager) { + if (!node->isContentEditable()) { + node = node->traverseNextSibling(this); + continue; + } + element->disconnectUndoManager(); + } + } + node = node->traverseNextNode(this); + } +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index b5b22512f..01590217c 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -143,10 +143,11 @@ public: bool hasAttributeNS(const String& namespaceURI, const String& localName) const; const AtomicString& getAttribute(const AtomicString& name) const; - const AtomicString& getAttributeNS(const String& namespaceURI, const String& localName) const; + const AtomicString& getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const; void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&); - void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&, FragmentScriptingPermission = AllowScriptingContent); + static bool parseAttributeName(QualifiedName&, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode&); + void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&); bool isIdAttributeName(const QualifiedName&) const; const AtomicString& getIdAttribute() const; @@ -162,8 +163,9 @@ public: // Internal methods that assume the existence of attribute storage, one should use hasAttributes() // before calling them. size_t attributeCount() const; - Attribute* attributeItem(unsigned index) const; - Attribute* getAttributeItem(const QualifiedName&) const; + const Attribute* attributeItem(unsigned index) const; + const Attribute* getAttributeItem(const QualifiedName&) const; + Attribute* getAttributeItem(const QualifiedName&); size_t getAttributeItemIndex(const QualifiedName& name) const { return attributeData()->getAttributeItemIndex(name); } size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const { return attributeData()->getAttributeItemIndex(name, shouldIgnoreAttributeCase); } @@ -246,10 +248,11 @@ public: // Only called by the parser immediately after element construction. void parserSetAttributes(const Vector<Attribute>&, FragmentScriptingPermission); - ElementAttributeData* attributeData() const { return m_attributeData.get(); } - ElementAttributeData* ensureAttributeData() const; - ElementAttributeData* updatedAttributeData() const; - ElementAttributeData* ensureUpdatedAttributeData() const; + const ElementAttributeData* attributeData() const { return m_attributeData.get(); } + ElementAttributeData* mutableAttributeData(); + const ElementAttributeData* ensureAttributeData(); + const ElementAttributeData* updatedAttributeData() const; + const ElementAttributeData* ensureUpdatedAttributeData() const; // Clones attributes only. void cloneAttributesFromElement(const Element&); @@ -434,9 +437,17 @@ public: MemoryClassInfo<Element> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); info.visitBaseClass<ContainerNode>(this); info.addInstrumentedMember(m_tagName); - info.addInstrumentedMember(m_attributeData.get()); + info.addInstrumentedMember(attributeData()); } +#if ENABLE(UNDO_MANAGER) + bool undoScope() const; + void setUndoScope(bool); + PassRefPtr<UndoManager> undoManager(); + void disconnectUndoManager(); + void disconnectUndoManagersInSubtree(); +#endif + protected: Element(const QualifiedName& tagName, Document* document, ConstructionType type) : ContainerNode(document, type) @@ -475,8 +486,6 @@ private: bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle); - void createAttributeData() const; - virtual void updateStyleAttribute() const { } #if ENABLE(SVG) @@ -505,11 +514,13 @@ private: void unregisterNamedFlowContentNode(); + void createMutableAttributeData(); + private: ElementRareData* elementRareData() const; ElementRareData* ensureElementRareData(); - mutable OwnPtr<ElementAttributeData> m_attributeData; + OwnPtr<ElementAttributeData> m_attributeData; }; inline Element* toElement(Node* node) @@ -569,23 +580,25 @@ inline Element* Element::nextElementSibling() const return static_cast<Element*>(n); } -inline ElementAttributeData* Element::ensureAttributeData() const +inline const ElementAttributeData* Element::updatedAttributeData() const { - if (!m_attributeData) - createAttributeData(); - return m_attributeData.get(); + updateInvalidAttributes(); + return attributeData(); } -inline ElementAttributeData* Element::updatedAttributeData() const +inline const ElementAttributeData* Element::ensureAttributeData() { - updateInvalidAttributes(); - return attributeData(); + if (attributeData()) + return attributeData(); + return mutableAttributeData(); } -inline ElementAttributeData* Element::ensureUpdatedAttributeData() const +inline const ElementAttributeData* Element::ensureUpdatedAttributeData() const { updateInvalidAttributes(); - return ensureAttributeData(); + if (attributeData()) + return attributeData(); + return const_cast<Element*>(this)->mutableAttributeData(); } inline void Element::updateName(const AtomicString& oldName, const AtomicString& newName) @@ -634,14 +647,14 @@ inline void Element::willRemoveAttribute(const QualifiedName& name, const Atomic inline bool Element::fastHasAttribute(const QualifiedName& name) const { ASSERT(fastAttributeLookupAllowed(name)); - return m_attributeData && getAttributeItem(name); + return attributeData() && getAttributeItem(name); } inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name) const { ASSERT(fastAttributeLookupAllowed(name)); - if (m_attributeData) { - if (Attribute* attribute = getAttributeItem(name)) + if (attributeData()) { + if (const Attribute* attribute = getAttributeItem(name)) return attribute->value(); } return nullAtom; @@ -649,13 +662,13 @@ inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name) inline bool Element::hasAttributesWithoutUpdate() const { - return m_attributeData && !m_attributeData->isEmpty(); + return attributeData() && !attributeData()->isEmpty(); } inline const AtomicString& Element::idForStyleResolution() const { ASSERT(hasID()); - return m_attributeData->idForStyleResolution(); + return attributeData()->idForStyleResolution(); } inline bool Element::isIdAttributeName(const QualifiedName& attributeName) const @@ -684,20 +697,26 @@ inline void Element::setIdAttribute(const AtomicString& value) inline size_t Element::attributeCount() const { - ASSERT(m_attributeData); - return m_attributeData->length(); + ASSERT(attributeData()); + return attributeData()->length(); +} + +inline const Attribute* Element::attributeItem(unsigned index) const +{ + ASSERT(attributeData()); + return attributeData()->attributeItem(index); } -inline Attribute* Element::attributeItem(unsigned index) const +inline const Attribute* Element::getAttributeItem(const QualifiedName& name) const { - ASSERT(m_attributeData); - return m_attributeData->attributeItem(index); + ASSERT(attributeData()); + return attributeData()->getAttributeItem(name); } -inline Attribute* Element::getAttributeItem(const QualifiedName& name) const +inline Attribute* Element::getAttributeItem(const QualifiedName& name) { - ASSERT(m_attributeData); - return m_attributeData->getAttributeItem(name); + ASSERT(attributeData()); + return mutableAttributeData()->getAttributeItem(name); } inline void Element::updateInvalidAttributes() const @@ -730,6 +749,13 @@ inline bool Element::hasClass() const return attributeData() && attributeData()->hasClass(); } +inline ElementAttributeData* Element::mutableAttributeData() +{ + if (!attributeData() || !attributeData()->isMutable()) + createMutableAttributeData(); + return m_attributeData.get(); +} + // Put here to make them inline. inline bool Node::hasID() const { diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl index fdf6f3606..17a4a7ec4 100644 --- a/Source/WebCore/dom/Element.idl +++ b/Source/WebCore/dom/Element.idl @@ -142,6 +142,11 @@ module core { // CSS Regions API readonly attribute DOMString webkitRegionOverflow; +#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT + readonly attribute [Conditional=UNDO_MANAGER] UndoManager undoManager; + attribute [Conditional=UNDO_MANAGER, Reflect] boolean undoScope; +#endif + #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler DOM attributes attribute [NotEnumerable] EventListener onabort; diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index ab2768e66..6fb53d5d3 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -32,6 +32,57 @@ namespace WebCore { +PassOwnPtr<ElementAttributeData> ElementAttributeData::createImmutable(const Vector<Attribute>& attributes) +{ + void* slot = WTF::fastMalloc(sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * attributes.size()); + return adoptPtr(new (slot) ElementAttributeData(attributes)); +} + +ElementAttributeData::ElementAttributeData() + : m_isMutable(true) + , m_arraySize(0) + , m_mutableAttributeVector(new Vector<Attribute, 4>) +{ +} + +ElementAttributeData::ElementAttributeData(const Vector<Attribute>& attributes) + : m_isMutable(false) + , m_arraySize(attributes.size()) +{ + Attribute* buffer = reinterpret_cast<Attribute*>(&m_attributes); + for (unsigned i = 0; i < attributes.size(); ++i) + new (&buffer[i]) Attribute(attributes[i]); +} + +ElementAttributeData::ElementAttributeData(const ElementAttributeData& other) + : m_inlineStyleDecl(other.m_inlineStyleDecl) + , m_attributeStyle(other.m_attributeStyle) + , m_classNames(other.m_classNames) + , m_idForStyleResolution(other.m_idForStyleResolution) + , m_isMutable(true) + , m_arraySize(0) + , m_mutableAttributeVector(new Vector<Attribute, 4>) +{ + // This copy constructor should only be used by makeMutable() to go from immutable to mutable. + ASSERT(!other.m_isMutable); + + const Attribute* otherBuffer = reinterpret_cast<const Attribute*>(&other.m_attributes); + for (unsigned i = 0; i < other.m_arraySize; ++i) + m_mutableAttributeVector->append(otherBuffer[i]); +} + +ElementAttributeData::~ElementAttributeData() +{ + if (isMutable()) { + ASSERT(!m_arraySize); + delete m_mutableAttributeVector; + } else { + Attribute* buffer = reinterpret_cast<Attribute*>(&m_attributes); + for (unsigned i = 0; i < m_arraySize; ++i) + buffer[i].~Attribute(); + } +} + typedef Vector<RefPtr<Attr> > AttrList; typedef HashMap<Element*, OwnPtr<AttrList> > AttrListMap; @@ -81,14 +132,14 @@ static Attr* findAttrInList(AttrList* attrList, const QualifiedName& name) return 0; } -PassRefPtr<Attr> ElementAttributeData::attrIfExists(Element* element, const QualifiedName& name) +PassRefPtr<Attr> ElementAttributeData::attrIfExists(Element* element, const QualifiedName& name) const { if (AttrList* attrList = attrListForElement(element)) return findAttrInList(attrList, name); return 0; } -PassRefPtr<Attr> ElementAttributeData::ensureAttr(Element* element, const QualifiedName& name) +PassRefPtr<Attr> ElementAttributeData::ensureAttr(Element* element, const QualifiedName& name) const { AttrList* attrList = ensureAttrListForElement(element); RefPtr<Attr> attr = findAttrInList(attrList, name); @@ -99,7 +150,7 @@ PassRefPtr<Attr> ElementAttributeData::ensureAttr(Element* element, const Qualif return attr.release(); } -void ElementAttributeData::setAttr(Element* element, const QualifiedName& name, Attr* attr) +void ElementAttributeData::setAttr(Element* element, const QualifiedName& name, Attr* attr) const { AttrList* attrList = ensureAttrListForElement(element); @@ -110,7 +161,7 @@ void ElementAttributeData::setAttr(Element* element, const QualifiedName& name, attr->attachToElement(element); } -void ElementAttributeData::removeAttr(Element* element, const QualifiedName& name) +void ElementAttributeData::removeAttr(Element* element, const QualifiedName& name) const { AttrList* attrList = attrListForElement(element); ASSERT(attrList); @@ -127,13 +178,9 @@ void ElementAttributeData::removeAttr(Element* element, const QualifiedName& nam ASSERT_NOT_REACHED(); } -void ElementAttributeData::setClass(const String& className, bool shouldFoldCase) -{ - m_classNames.set(className, shouldFoldCase); -} - StylePropertySet* ElementAttributeData::ensureInlineStyle(StyledElement* element) { + ASSERT(isMutable()); if (!m_inlineStyleDecl) { ASSERT(element->isStyledElement()); m_inlineStyleDecl = StylePropertySet::create(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); @@ -143,6 +190,7 @@ StylePropertySet* ElementAttributeData::ensureInlineStyle(StyledElement* element StylePropertySet* ElementAttributeData::ensureMutableInlineStyle(StyledElement* element) { + ASSERT(isMutable()); if (m_inlineStyleDecl && !m_inlineStyleDecl->isMutable()) { m_inlineStyleDecl = m_inlineStyleDecl->copy(); return m_inlineStyleDecl.get(); @@ -150,7 +198,7 @@ StylePropertySet* ElementAttributeData::ensureMutableInlineStyle(StyledElement* return ensureInlineStyle(element); } -void ElementAttributeData::updateInlineStyleAvoidingMutation(StyledElement* element, const String& text) +void ElementAttributeData::updateInlineStyleAvoidingMutation(StyledElement* element, const String& text) const { // We reconstruct the property set instead of mutating if there is no CSSOM wrapper. // This makes wrapperless property sets immutable and so cacheable. @@ -161,7 +209,7 @@ void ElementAttributeData::updateInlineStyleAvoidingMutation(StyledElement* elem m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents()); } -void ElementAttributeData::destroyInlineStyle(StyledElement* element) +void ElementAttributeData::destroyInlineStyle(StyledElement* element) const { if (!m_inlineStyleDecl) return; @@ -171,10 +219,12 @@ void ElementAttributeData::destroyInlineStyle(StyledElement* element) void ElementAttributeData::addAttribute(const Attribute& attribute, Element* element, EInUpdateStyleAttribute inUpdateStyleAttribute) { + ASSERT(isMutable()); + if (element && inUpdateStyleAttribute == NotInUpdateStyleAttribute) element->willModifyAttribute(attribute.name(), nullAtom, attribute.value()); - m_attributes.append(attribute); + m_mutableAttributeVector->append(attribute); if (element && inUpdateStyleAttribute == NotInUpdateStyleAttribute) element->didAddAttribute(attribute); @@ -182,9 +232,10 @@ void ElementAttributeData::addAttribute(const Attribute& attribute, Element* ele void ElementAttributeData::removeAttribute(size_t index, Element* element, EInUpdateStyleAttribute inUpdateStyleAttribute) { + ASSERT(isMutable()); ASSERT(index < length()); - Attribute& attribute = m_attributes[index]; + Attribute& attribute = m_mutableAttributeVector->at(index); QualifiedName name = attribute.name(); if (element && inUpdateStyleAttribute == NotInUpdateStyleAttribute) @@ -193,7 +244,7 @@ void ElementAttributeData::removeAttribute(size_t index, Element* element, EInUp if (RefPtr<Attr> attr = attrIfExists(element, name)) attr->detachFromElementWithValue(attribute.value()); - m_attributes.remove(index); + m_mutableAttributeVector->remove(index); if (element && inUpdateStyleAttribute == NotInUpdateStyleAttribute) element->didRemoveAttribute(name); @@ -209,21 +260,23 @@ bool ElementAttributeData::isEquivalent(const ElementAttributeData* other) const return false; for (unsigned i = 0; i < len; i++) { - Attribute* otherAttr = other->getAttributeItem(m_attributes[i].name()); - if (!otherAttr || m_attributes[i].value() != otherAttr->value()) + const Attribute* attribute = attributeItem(i); + const Attribute* otherAttr = other->getAttributeItem(attribute->name()); + if (!otherAttr || attribute->value() != otherAttr->value()) return false; } return true; } -void ElementAttributeData::detachAttrObjectsFromElement(Element* element) +void ElementAttributeData::detachAttrObjectsFromElement(Element* element) const { ASSERT(element->hasAttrList()); - for (unsigned i = 0; i < m_attributes.size(); ++i) { - if (RefPtr<Attr> attr = attrIfExists(element, m_attributes[i].name())) - attr->detachFromElementWithValue(m_attributes[i].value()); + for (unsigned i = 0; i < length(); ++i) { + const Attribute* attribute = attributeItem(i); + if (RefPtr<Attr> attr = attrIfExists(element, attribute->name())) + attr->detachFromElementWithValue(attribute->value()); } // The loop above should have cleaned out this element's Attr map. @@ -233,15 +286,16 @@ void ElementAttributeData::detachAttrObjectsFromElement(Element* element) size_t ElementAttributeData::getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const { // Continue to checking case-insensitively and/or full namespaced names if necessary: - for (unsigned i = 0; i < m_attributes.size(); ++i) { - if (!m_attributes[i].name().hasPrefix()) { - if (shouldIgnoreAttributeCase && equalIgnoringCase(name, m_attributes[i].localName())) + for (unsigned i = 0; i < length(); ++i) { + const Attribute* attribute = attributeItem(i); + if (!attribute->name().hasPrefix()) { + if (shouldIgnoreAttributeCase && equalIgnoringCase(name, attribute->localName())) return i; } else { // FIXME: Would be faster to do this comparison without calling toString, which // generates a temporary string by concatenation. But this branch is only reached // if the attribute name has a prefix, which is rare in HTML. - if (equalPossiblyIgnoringCase(name, m_attributes[i].name().toString(), shouldIgnoreAttributeCase)) + if (equalPossiblyIgnoringCase(name, attribute->name().toString(), shouldIgnoreAttributeCase)) return i; } } @@ -250,6 +304,9 @@ size_t ElementAttributeData::getAttributeItemIndexSlowCase(const AtomicString& n void ElementAttributeData::cloneDataFrom(const ElementAttributeData& sourceData, const Element& sourceElement, Element& targetElement) { + // FIXME: Cloned elements could start out with immutable attribute data. + ASSERT(isMutable()); + const AtomicString& oldID = targetElement.getIdAttribute(); const AtomicString& newID = sourceElement.getIdAttribute(); @@ -263,13 +320,24 @@ void ElementAttributeData::cloneDataFrom(const ElementAttributeData& sourceData, targetElement.updateName(oldName, newName); clearAttributes(&targetElement); - m_attributes = sourceData.m_attributes; - for (unsigned i = 0; i < m_attributes.size(); ++i) { - if (targetElement.isStyledElement() && m_attributes[i].name() == HTMLNames::styleAttr) { - static_cast<StyledElement&>(targetElement).styleAttributeChanged(m_attributes[i].value(), StyledElement::DoNotReparseStyleAttribute); + + if (sourceData.isMutable()) + *m_mutableAttributeVector = *sourceData.m_mutableAttributeVector; + else { + ASSERT(m_mutableAttributeVector->isEmpty()); + m_mutableAttributeVector->reserveInitialCapacity(sourceData.m_arraySize); + const Attribute* sourceBuffer = reinterpret_cast<const Attribute*>(&sourceData.m_attributes); + for (unsigned i = 0; i < sourceData.m_arraySize; ++i) + m_mutableAttributeVector->uncheckedAppend(sourceBuffer[i]); + } + + for (unsigned i = 0; i < length(); ++i) { + const Attribute& attribute = m_mutableAttributeVector->at(i); + if (targetElement.isStyledElement() && attribute.name() == HTMLNames::styleAttr) { + static_cast<StyledElement&>(targetElement).styleAttributeChanged(attribute.value(), StyledElement::DoNotReparseStyleAttribute); continue; } - targetElement.attributeChanged(m_attributes[i]); + targetElement.attributeChanged(attribute); } if (targetElement.isStyledElement() && sourceData.m_inlineStyleDecl) { @@ -282,40 +350,42 @@ void ElementAttributeData::cloneDataFrom(const ElementAttributeData& sourceData, void ElementAttributeData::clearAttributes(Element* element) { + ASSERT(isMutable()); + if (element->hasAttrList()) detachAttrObjectsFromElement(element); clearClass(); - m_attributes.clear(); + m_mutableAttributeVector->clear(); } void ElementAttributeData::replaceAttribute(size_t index, const Attribute& attribute, Element* element) { + ASSERT(isMutable()); ASSERT(element); ASSERT(index < length()); - element->willModifyAttribute(attribute.name(), m_attributes[index].value(), attribute.value()); - m_attributes[index] = attribute; + element->willModifyAttribute(attribute.name(), m_mutableAttributeVector->at(index).value(), attribute.value()); + (*m_mutableAttributeVector)[index] = attribute; element->didModifyAttribute(attribute); } PassRefPtr<Attr> ElementAttributeData::getAttributeNode(const String& name, bool shouldIgnoreAttributeCase, Element* element) const { ASSERT(element); - Attribute* attribute = getAttributeItem(name, shouldIgnoreAttributeCase); + const Attribute* attribute = getAttributeItem(name, shouldIgnoreAttributeCase); if (!attribute) return 0; - return const_cast<ElementAttributeData*>(this)->ensureAttr(element, attribute->name()); + return ensureAttr(element, attribute->name()); } PassRefPtr<Attr> ElementAttributeData::getAttributeNode(const QualifiedName& name, Element* element) const { ASSERT(element); - Attribute* attribute = getAttributeItem(name); + const Attribute* attribute = getAttributeItem(name); if (!attribute) return 0; - return const_cast<ElementAttributeData*>(this)->ensureAttr(element, attribute->name()); + return ensureAttr(element, attribute->name()); } - } diff --git a/Source/WebCore/dom/ElementAttributeData.h b/Source/WebCore/dom/ElementAttributeData.h index 57cf368e1..1c2b2fea3 100644 --- a/Source/WebCore/dom/ElementAttributeData.h +++ b/Source/WebCore/dom/ElementAttributeData.h @@ -37,50 +37,43 @@ namespace WebCore { class Attr; class Element; -inline Attribute* findAttributeInVector(const Vector<Attribute>& attributes, const QualifiedName& name) -{ - for (unsigned i = 0; i < attributes.size(); ++i) { - if (attributes.at(i).name().matches(name)) - return &const_cast<Vector<Attribute>& >(attributes).at(i); - } - return 0; -} - enum EInUpdateStyleAttribute { NotInUpdateStyleAttribute, InUpdateStyleAttribute }; class ElementAttributeData { WTF_MAKE_FAST_ALLOCATED; public: - static PassOwnPtr<ElementAttributeData> create() - { - return adoptPtr(new ElementAttributeData); - } + static PassOwnPtr<ElementAttributeData> create() { return adoptPtr(new ElementAttributeData); } + static PassOwnPtr<ElementAttributeData> createImmutable(const Vector<Attribute>&); + ~ElementAttributeData(); void clearClass() { m_classNames.clear(); } - void setClass(const String& className, bool shouldFoldCase); + void setClass(const AtomicString& className, bool shouldFoldCase) const { m_classNames.set(className, shouldFoldCase); } const SpaceSplitString& classNames() const { return m_classNames; } const AtomicString& idForStyleResolution() const { return m_idForStyleResolution; } - void setIdForStyleResolution(const AtomicString& newId) { m_idForStyleResolution = newId; } + void setIdForStyleResolution(const AtomicString& newId) const { m_idForStyleResolution = newId; } + const StylePropertySet* inlineStyle() const { return m_inlineStyleDecl.get(); } StylePropertySet* inlineStyle() { return m_inlineStyleDecl.get(); } StylePropertySet* ensureInlineStyle(StyledElement*); StylePropertySet* ensureMutableInlineStyle(StyledElement*); - void updateInlineStyleAvoidingMutation(StyledElement*, const String& text); - void destroyInlineStyle(StyledElement*); + void updateInlineStyleAvoidingMutation(StyledElement*, const String& text) const; + void destroyInlineStyle(StyledElement*) const; StylePropertySet* attributeStyle() const { return m_attributeStyle.get(); } - void setAttributeStyle(PassRefPtr<StylePropertySet> style) { m_attributeStyle = style; } + void setAttributeStyle(PassRefPtr<StylePropertySet> style) const { m_attributeStyle = style; } - size_t length() const { return m_attributes.size(); } - bool isEmpty() const { return m_attributes.isEmpty(); } + size_t length() const; + bool isEmpty() const { return !length(); } PassRefPtr<Attr> getAttributeNode(const String&, bool shouldIgnoreAttributeCase, Element*) const; PassRefPtr<Attr> getAttributeNode(const QualifiedName&, Element*) const; // Internal interface. - Attribute* attributeItem(unsigned index) const { return &const_cast<ElementAttributeData*>(this)->m_attributes[index]; } - Attribute* getAttributeItem(const QualifiedName& name) const { return findAttributeInVector(m_attributes, name); } + const Attribute* attributeItem(unsigned index) const; + const Attribute* getAttributeItem(const QualifiedName&) const; + Attribute* attributeItem(unsigned index); + Attribute* getAttributeItem(const QualifiedName&); size_t getAttributeItemIndex(const QualifiedName&) const; size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const; @@ -95,46 +88,62 @@ public: bool isEquivalent(const ElementAttributeData* other) const; - void setAttr(Element*, const QualifiedName&, Attr*); - void removeAttr(Element*, const QualifiedName&); - PassRefPtr<Attr> attrIfExists(Element*, const QualifiedName&); - PassRefPtr<Attr> ensureAttr(Element*, const QualifiedName&); + void setAttr(Element*, const QualifiedName&, Attr*) const; + void removeAttr(Element*, const QualifiedName&) const; + PassRefPtr<Attr> attrIfExists(Element*, const QualifiedName&) const; + PassRefPtr<Attr> ensureAttr(Element*, const QualifiedName&) const; + void detachAttrObjectsFromElement(Element*) const; void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo<ElementAttributeData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + MemoryClassInfo<ElementAttributeData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM, m_arraySize * sizeof(Attribute)); info.addInstrumentedMember(m_inlineStyleDecl.get()); info.addInstrumentedMember(m_attributeStyle.get()); info.addMember(m_classNames); info.addString(m_idForStyleResolution); - info.addVector(m_attributes); + if (m_isMutable) + info.addVector(*m_mutableAttributeVector); } private: friend class Element; friend class HTMLConstructionSite; - ElementAttributeData() - { - } - - const Vector<Attribute>& attributeVector() const { return m_attributes; } - Vector<Attribute> clonedAttributeVector() const { return m_attributes; } + ElementAttributeData(); + ElementAttributeData(const ElementAttributeData&); + ElementAttributeData(const Vector<Attribute>&); - void detachAttrObjectsFromElement(Element*); - Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const; + Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase); + const Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const; size_t getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const; void cloneDataFrom(const ElementAttributeData& sourceData, const Element& sourceElement, Element& targetElement); void clearAttributes(Element*); void replaceAttribute(size_t index, const Attribute&, Element*); - RefPtr<StylePropertySet> m_inlineStyleDecl; - RefPtr<StylePropertySet> m_attributeStyle; - SpaceSplitString m_classNames; - AtomicString m_idForStyleResolution; - Vector<Attribute> m_attributes; + bool isMutable() const { return m_isMutable; } + PassOwnPtr<ElementAttributeData> makeMutable() const { return adoptPtr(new ElementAttributeData(*this)); } + + mutable RefPtr<StylePropertySet> m_inlineStyleDecl; + mutable RefPtr<StylePropertySet> m_attributeStyle; + mutable SpaceSplitString m_classNames; + mutable AtomicString m_idForStyleResolution; + + unsigned m_isMutable : 1; + unsigned m_arraySize : 31; + + union { + Vector<Attribute, 4>* m_mutableAttributeVector; + void* m_attributes; + }; }; +inline size_t ElementAttributeData::length() const +{ + if (isMutable()) + return m_mutableAttributeVector->size(); + return m_arraySize; +} + inline void ElementAttributeData::removeAttribute(const QualifiedName& name, Element* element) { size_t index = getAttributeItemIndex(name); @@ -142,21 +151,28 @@ inline void ElementAttributeData::removeAttribute(const QualifiedName& name, Ele return; removeAttribute(index, element); - return; } -inline Attribute* ElementAttributeData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const +inline Attribute* ElementAttributeData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) +{ + size_t index = getAttributeItemIndex(name, shouldIgnoreAttributeCase); + if (index != notFound) + return attributeItem(index); + return 0; +} + +inline const Attribute* ElementAttributeData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const { size_t index = getAttributeItemIndex(name, shouldIgnoreAttributeCase); if (index != notFound) - return &const_cast<ElementAttributeData*>(this)->m_attributes[index]; + return attributeItem(index); return 0; } inline size_t ElementAttributeData::getAttributeItemIndex(const QualifiedName& name) const { - for (unsigned i = 0; i < m_attributes.size(); ++i) { - if (m_attributes.at(i).name().matches(name)) + for (unsigned i = 0; i < length(); ++i) { + if (attributeItem(i)->name().matches(name)) return i; } return notFound; @@ -171,8 +187,9 @@ inline size_t ElementAttributeData::getAttributeItemIndex(const AtomicString& na // Optimize for the case where the attribute exists and its name exactly matches. for (unsigned i = 0; i < len; ++i) { - if (!m_attributes[i].name().hasPrefix()) { - if (name == m_attributes[i].localName()) + const Attribute* attribute = attributeItem(i); + if (!attribute->name().hasPrefix()) { + if (name == attribute->localName()) return i; } else doSlowCheck = true; @@ -183,6 +200,40 @@ inline size_t ElementAttributeData::getAttributeItemIndex(const AtomicString& na return notFound; } +inline const Attribute* ElementAttributeData::getAttributeItem(const QualifiedName& name) const +{ + for (unsigned i = 0; i < length(); ++i) { + if (attributeItem(i)->name().matches(name)) + return attributeItem(i); + } + return 0; +} + +inline Attribute* ElementAttributeData::getAttributeItem(const QualifiedName& name) +{ + for (unsigned i = 0; i < length(); ++i) { + if (attributeItem(i)->name().matches(name)) + return attributeItem(i); + } + return 0; +} + +inline const Attribute* ElementAttributeData::attributeItem(unsigned index) const +{ + ASSERT(index < length()); + if (isMutable()) + return &m_mutableAttributeVector->at(index); + const Attribute* buffer = reinterpret_cast<const Attribute*>(&m_attributes); + return &buffer[index]; +} + +inline Attribute* ElementAttributeData::attributeItem(unsigned index) +{ + ASSERT(isMutable()); + ASSERT(index < length()); + return &m_mutableAttributeVector->at(index); +} + } #endif // ElementAttributeData_h diff --git a/Source/WebCore/dom/ElementRareData.h b/Source/WebCore/dom/ElementRareData.h index 07394ebd1..666cc4607 100644 --- a/Source/WebCore/dom/ElementRareData.h +++ b/Source/WebCore/dom/ElementRareData.h @@ -29,6 +29,7 @@ #include "HTMLCollection.h" #include "NamedNodeMap.h" #include "NodeRareData.h" +#include "UndoManager.h" #include <wtf/OwnPtr.h> namespace WebCore { @@ -118,6 +119,11 @@ public: #if ENABLE(FULLSCREEN_API) bool m_containsFullScreenElement; #endif + +#if ENABLE(UNDO_MANAGER) + RefPtr<UndoManager> m_undoManager; + bool m_undoScope; +#endif }; inline IntSize defaultMinimumSizeForResizing() diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h index 836e6308b..b0efbe765 100644 --- a/Source/WebCore/dom/EventNames.h +++ b/Source/WebCore/dom/EventNames.h @@ -157,6 +157,8 @@ namespace WebCore { macro(webkitbeginfullscreen) \ macro(webkitendfullscreen) \ \ + macro(webkitaddsourcebuffer) \ + macro(webkitremovesourcebuffer) \ macro(webkitsourceopen) \ macro(webkitsourceended) \ macro(webkitsourceclose) \ @@ -217,6 +219,8 @@ namespace WebCore { macro(removestream) \ macro(statechange) \ macro(removetrack) \ + macro(mute) \ + macro(unmute) \ \ macro(show) \ \ diff --git a/Source/WebCore/dom/EventTarget.h b/Source/WebCore/dom/EventTarget.h index f387e4273..ab0d7c7f1 100644 --- a/Source/WebCore/dom/EventTarget.h +++ b/Source/WebCore/dom/EventTarget.h @@ -64,6 +64,7 @@ namespace WebCore { class ScriptExecutionContext; class SharedWorker; class SharedWorkerContext; + class SourceBufferList; class TextTrack; class TextTrackCue; class WebSocket; diff --git a/Source/WebCore/dom/EventTargetFactory.in b/Source/WebCore/dom/EventTargetFactory.in index 821717b0d..ff60aad4d 100644 --- a/Source/WebCore/dom/EventTargetFactory.in +++ b/Source/WebCore/dom/EventTargetFactory.in @@ -5,7 +5,6 @@ BatteryManager conditional=BATTERY_STATUS DedicatedWorkerContext conditional=WORKERS DOMApplicationCache DOMWindow -DeprecatedPeerConnection conditional=MEDIA_STREAM EventSource FileReader conditional=BLOB FileWriter conditional=FILE_SYSTEM @@ -17,6 +16,7 @@ JavaScriptAudioNode conditional=WEB_AUDIO LocalMediaStream conditional=MEDIA_STREAM MediaController conditional=VIDEO MediaStream conditional=MEDIA_STREAM +MediaStreamTrack conditional=MEDIA_STREAM MediaStreamTrackList conditional=MEDIA_STREAM MessagePort NetworkInfoConnection conditional=NETWORK_INFO @@ -26,6 +26,7 @@ PeerConnection00 conditional=MEDIA_STREAM Performance conditional=WEB_TIMING SharedWorker conditional=SHARED_WORKERS SharedWorkerContext conditional=SHARED_WORKERS +SourceBufferList conditional=MEDIA_SOURCE SpeechRecognition conditional=SCRIPTED_SPEECH SVGElementInstance conditional=SVG TextTrack conditional=VIDEO_TRACK diff --git a/Source/WebCore/dom/MemoryInstrumentation.h b/Source/WebCore/dom/MemoryInstrumentation.h index ea7fe2edf..96c017887 100644 --- a/Source/WebCore/dom/MemoryInstrumentation.h +++ b/Source/WebCore/dom/MemoryInstrumentation.h @@ -67,7 +67,7 @@ public: template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false); template <typename HashSetType> void addHashSet(const HashSetType&, ObjectType, bool contentOnly = false); - template <typename HashSetType> void addInstrumentedHashSet(const HashSetType&, ObjectType, bool contentOnly = false); + template <typename CollectionType> void addInstrumentedCollection(const CollectionType&, ObjectType, bool contentOnly = false); template <typename ListHashSetType> void addListHashSet(const ListHashSetType&, ObjectType, bool contentOnly = false); template <typename VectorType> void addVector(const VectorType&, ObjectType, bool contentOnly = false); void addRawBuffer(const void* const& buffer, ObjectType objectType, size_t size) @@ -206,7 +206,8 @@ public: template <typename HashMapType> void addHashMap(const HashMapType& map) { m_memoryInstrumentation->addHashMap(map, m_objectType, true); } template <typename HashSetType> void addHashSet(const HashSetType& set) { m_memoryInstrumentation->addHashSet(set, m_objectType, true); } - template <typename HashSetType> void addInstrumentedHashSet(const HashSetType& set) { m_memoryInstrumentation->addInstrumentedHashSet(set, m_objectType, true); } + template <typename HashSetType> void addInstrumentedHashSet(const HashSetType& set) { m_memoryInstrumentation->addInstrumentedCollection(set, m_objectType, true); } + template <typename VectorType> void addInstrumentedVector(const VectorType& vector) { m_memoryInstrumentation->addInstrumentedCollection(vector, m_objectType, true); } template <typename ListHashSetType> void addListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->addListHashSet(set, m_objectType, true); } template <typename VectorType> void addVector(const VectorType& vector) { m_memoryInstrumentation->addVector(vector, m_objectType, true); } void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); } @@ -223,6 +224,8 @@ private: template<typename HashMapType> void MemoryInstrumentation::addHashMap(const HashMapType& hashMap, ObjectType objectType, bool contentOnly) { + if (visited(&hashMap)) + return; countObjectSize(objectType, calculateContainerSize(hashMap, contentOnly)); } @@ -234,13 +237,14 @@ void MemoryInstrumentation::addHashSet(const HashSetType& hashSet, ObjectType ob countObjectSize(objectType, calculateContainerSize(hashSet, contentOnly)); } -template<typename HashSetType> -void MemoryInstrumentation::addInstrumentedHashSet(const HashSetType& hashSet, ObjectType objectType, bool contentOnly) +template <typename CollectionType> +void MemoryInstrumentation::addInstrumentedCollection(const CollectionType& collection, ObjectType objectType, bool contentOnly) { - if (visited(&hashSet)) + if (visited(&collection)) return; - countObjectSize(objectType, calculateContainerSize(hashSet, contentOnly)); - for (typename HashSetType::const_iterator i = hashSet.begin(); i != hashSet.end(); ++i) + countObjectSize(objectType, calculateContainerSize(collection, contentOnly)); + typename CollectionType::const_iterator end = collection.end(); + for (typename CollectionType::const_iterator i = collection.begin(); i != end; ++i) addInstrumentedMember(*i); } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 2e3f41342..f30c3fcbf 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -1703,7 +1703,7 @@ bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const if (elem->hasAttributes()) { for (unsigned i = 0; i < elem->attributeCount(); i++) { - Attribute* attr = elem->attributeItem(i); + const Attribute* attr = elem->attributeItem(i); if (attr->localName() == xmlnsAtom) return attr->value() == namespaceURI; @@ -1787,7 +1787,7 @@ String Node::lookupNamespaceURI(const String &prefix) const if (elem->hasAttributes()) { for (unsigned i = 0; i < elem->attributeCount(); i++) { - Attribute* attr = elem->attributeItem(i); + const Attribute* attr = elem->attributeItem(i); if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) { if (!attr->value().isEmpty()) @@ -1842,7 +1842,7 @@ String Node::lookupNamespacePrefix(const AtomicString &_namespaceURI, const Elem const Element* thisElement = toElement(this); if (thisElement->hasAttributes()) { for (unsigned i = 0; i < thisElement->attributeCount(); i++) { - Attribute* attr = thisElement->attributeItem(i); + const Attribute* attr = thisElement->attributeItem(i); if (attr->prefix() == xmlnsAtom && attr->value() == _namespaceURI && originalElement->lookupNamespaceURI(attr->localName()) == _namespaceURI) @@ -1991,7 +1991,7 @@ unsigned short Node::compareDocumentPosition(Node* otherNode) // the same nodeType are inserted into or removed from the direct container. This would be the case, for example, // when comparing two attributes of the same element, and inserting or removing additional attributes might change // the order between existing attributes. - Attribute* attribute = owner1->attributeItem(i); + const Attribute* attribute = owner1->attributeItem(i); if (attr1->qualifiedName() == attribute->name()) return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING; if (attr2->qualifiedName() == attribute->name()) diff --git a/Source/WebCore/dom/QualifiedName.cpp b/Source/WebCore/dom/QualifiedName.cpp index e0855070a..fb2f320fe 100644 --- a/Source/WebCore/dom/QualifiedName.cpp +++ b/Source/WebCore/dom/QualifiedName.cpp @@ -26,13 +26,40 @@ #endif #include "QualifiedName.h" +#include "HTMLNames.h" +#include "XLinkNames.h" +#include "XMLNSNames.h" +#include "XMLNames.h" #include <wtf/Assertions.h> #include <wtf/HashSet.h> #include <wtf/StaticConstructors.h> +#if ENABLE(MATHML) +#include "MathMLNames.h" +#endif + +#if ENABLE(SVG) +#include "SVGNames.h" +#endif + namespace WebCore { -typedef HashSet<QualifiedName::QualifiedNameImpl*, QualifiedNameHash> QNameSet; +static const int staticQualifiedNamesCount = HTMLNames::HTMLTagsCount + HTMLNames::HTMLAttrsCount +#if ENABLE(MATHML) + + MathMLNames::MathMLTagsCount + MathMLNames::MathMLAttrsCount +#endif +#if ENABLE(SVG) + + SVGNames::SVGTagsCount + SVGNames::SVGAttrsCount +#endif + + XLinkNames::XLinkAttrsCount + + XMLNSNames::XMLNSAttrsCount + + XMLNames::XMLAttrsCount; + +struct QualifiedNameHashTraits : public HashTraits<QualifiedName::QualifiedNameImpl*> { + static const int minimumTableSize = WTF::HashTableCapacityForSize<staticQualifiedNamesCount>::value; +}; + +typedef HashSet<QualifiedName::QualifiedNameImpl*, QualifiedNameHash, QualifiedNameHashTraits> QNameSet; struct QNameComponentsTranslator { static unsigned hash(const QualifiedNameComponents& components) @@ -51,7 +78,7 @@ struct QNameComponentsTranslator { static QNameSet* gNameCache; -void QualifiedName::init(const AtomicString& p, const AtomicString& l, const AtomicString& n) +QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n) { if (!gNameCache) gNameCache = new QNameSet; @@ -62,16 +89,6 @@ void QualifiedName::init(const AtomicString& p, const AtomicString& l, const Ato m_impl->ref(); } -QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n) -{ - init(p, l, n); -} - -QualifiedName::QualifiedName(const AtomicString& p, const char* l, const AtomicString& n) -{ - init(p, AtomicString(l), n); -} - QualifiedName::~QualifiedName() { deref(); @@ -124,4 +141,16 @@ const AtomicString& QualifiedName::localNameUpper() const return m_impl->m_localNameUpper; } +void createQualifiedName(void* targetAddress, const char* name, unsigned nameLength, const AtomicString& nameNamespace) +{ + AtomicString atomicName(name, nameLength, AtomicString::ConstructFromLiteral); + new (reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, atomicName, nameNamespace); +} + +void createQualifiedName(void* targetAddress, const char* name, unsigned nameLength) +{ + AtomicString atomicName(name, nameLength, AtomicString::ConstructFromLiteral); + new (reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, atomicName, nullAtom); +} + } diff --git a/Source/WebCore/dom/QualifiedName.h b/Source/WebCore/dom/QualifiedName.h index 0fc651721..de3827175 100644 --- a/Source/WebCore/dom/QualifiedName.h +++ b/Source/WebCore/dom/QualifiedName.h @@ -69,7 +69,6 @@ public: }; QualifiedName(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI); - QualifiedName(const AtomicString& prefix, const char* localName, const AtomicString& namespaceURI); QualifiedName(WTF::HashTableDeletedValueType) : m_impl(hashTableDeletedValue()) { } bool isHashTableDeletedValue() const { return m_impl == hashTableDeletedValue(); } ~QualifiedName(); @@ -108,7 +107,6 @@ public: info.addInstrumentedMember(m_impl); } private: - void init(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI); void ref() const { m_impl->ref(); } void deref(); @@ -147,6 +145,9 @@ struct QualifiedNameHash { static const bool safeToCompareToEmptyOrDeleted = false; }; +void createQualifiedName(void* targetAddress, const char* name, unsigned nameLength); +void createQualifiedName(void* targetAddress, const char* name, unsigned nameLength, const AtomicString& nameNamespace); + } namespace WTF { diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 67bb8618e..9e82ab2b4 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -75,13 +75,6 @@ ShadowRoot::~ShadowRoot() static bool allowsAuthorShadowRoot(Element* element) { - // FIXME: ValidationMessage recreates shadow root dynamically. - // https://bugs.webkit.org/show_bug.cgi?id=77937 - // Especially, INPUT recreates shadow root dynamically. - // https://bugs.webkit.org/show_bug.cgi?id=77930 - if (element->isFormControlElement()) - return false; - // FIXME: We disable multiple shadow subtrees for SVG for while, because there will be problems to support it. // https://bugs.webkit.org/show_bug.cgi?id=78205 // Especially SVG TREF recreates shadow root dynamically. diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index d1265d93f..9ae672fa3 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -142,7 +142,7 @@ StyledElement::~StyledElement() CSSStyleDeclaration* StyledElement::style() { - return ensureAttributeData()->ensureMutableInlineStyle(this)->ensureInlineCSSStyleDeclaration(this); + return ensureInlineStyle()->ensureInlineCSSStyleDeclaration(this); } void StyledElement::attributeChanged(const Attribute& attribute) @@ -173,7 +173,7 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString) if (DOMTokenList* classList = optionalClassList()) static_cast<ClassList*>(classList)->reset(newClassString); } else if (attributeData()) - attributeData()->clearClass(); + mutableAttributeData()->clearClass(); setNeedsStyleRecalc(); } @@ -210,21 +210,21 @@ void StyledElement::inlineStyleChanged() bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, int identifier, bool important) { - ensureAttributeData()->ensureMutableInlineStyle(this)->setProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important); + ensureInlineStyle()->setProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important); inlineStyleChanged(); return true; } bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important) { - ensureAttributeData()->ensureMutableInlineStyle(this)->setProperty(propertyID, cssValuePool().createValue(value, unit), important); + ensureInlineStyle()->setProperty(propertyID, cssValuePool().createValue(value, unit), important); inlineStyleChanged(); return true; } bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, const String& value, bool important) { - bool changes = ensureAttributeData()->ensureMutableInlineStyle(this)->setProperty(propertyID, value, important, document()->elementSheet()->contents()); + bool changes = ensureInlineStyle()->setProperty(propertyID, value, important, document()->elementSheet()->contents()); if (changes) inlineStyleChanged(); return changes; @@ -232,10 +232,9 @@ bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, const Strin bool StyledElement::removeInlineStyleProperty(CSSPropertyID propertyID) { - StylePropertySet* inlineStyle = attributeData() ? attributeData()->inlineStyle() : 0; - if (!inlineStyle) + if (!attributeData() || !attributeData()->inlineStyle()) return false; - bool changes = inlineStyle->removeProperty(propertyID); + bool changes = ensureInlineStyle()->removeProperty(propertyID); if (changes) inlineStyleChanged(); return changes; @@ -243,7 +242,7 @@ bool StyledElement::removeInlineStyleProperty(CSSPropertyID propertyID) void StyledElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const { - if (StylePropertySet* inlineStyle = attributeData() ? attributeData()->inlineStyle() : 0) + if (const StylePropertySet* inlineStyle = attributeData() ? attributeData()->inlineStyle() : 0) inlineStyle->addSubresourceStyleURLs(urls, document()->elementSheet()->contents()); } @@ -263,7 +262,7 @@ void StyledElement::makePresentationAttributeCacheKey(PresentationAttributeCache return; unsigned size = attributeCount(); for (unsigned i = 0; i < size; ++i) { - Attribute* attribute = attributeItem(i); + const Attribute* attribute = attributeItem(i); if (!isPresentationAttribute(attribute->name())) continue; if (!attribute->namespaceURI().isNull()) @@ -313,7 +312,7 @@ void StyledElement::updateAttributeStyle() style = StylePropertySet::create(isSVGElement() ? SVGAttributeMode : CSSQuirksMode); unsigned size = attributeCount(); for (unsigned i = 0; i < size; ++i) { - Attribute* attribute = attributeItem(i); + const Attribute* attribute = attributeItem(i); collectStyleForAttribute(*attribute, style.get()); } } diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h index abd49adc7..0f61d1c66 100644 --- a/Source/WebCore/dom/StyledElement.h +++ b/Source/WebCore/dom/StyledElement.h @@ -41,7 +41,7 @@ public: void invalidateStyleAttribute(); const StylePropertySet* inlineStyle() const { return attributeData() ? attributeData()->inlineStyle() : 0; } - const StylePropertySet* ensureInlineStyle() { return ensureAttributeData()->ensureInlineStyle(this); } + StylePropertySet* ensureInlineStyle() { return mutableAttributeData()->ensureMutableInlineStyle(this); } // Unlike StylePropertySet setters, these implement invalidation. bool setInlineStyleProperty(CSSPropertyID, int identifier, bool important = false); diff --git a/Source/WebCore/dom/Touch.idl b/Source/WebCore/dom/Touch.idl index d2937b34e..634a45c83 100644 --- a/Source/WebCore/dom/Touch.idl +++ b/Source/WebCore/dom/Touch.idl @@ -36,8 +36,8 @@ module events { readonly attribute long pageY; readonly attribute EventTarget target; readonly attribute unsigned long identifier; - readonly attribute int webkitRadiusX; - readonly attribute int webkitRadiusY; + readonly attribute long webkitRadiusX; + readonly attribute long webkitRadiusY; readonly attribute float webkitRotationAngle; readonly attribute float webkitForce; }; diff --git a/Source/WebCore/dom/WebKitNamedFlow.idl b/Source/WebCore/dom/WebKitNamedFlow.idl index f586a9d08..4d4e99b7e 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.idl +++ b/Source/WebCore/dom/WebKitNamedFlow.idl @@ -33,7 +33,7 @@ module core { ] WebKitNamedFlow { readonly attribute DOMString name; readonly attribute boolean overset; - readonly attribute int firstEmptyRegionIndex; + readonly attribute long firstEmptyRegionIndex; NodeList getRegionsByContent(in Node contentNode); NodeList getContent(); }; diff --git a/Source/WebCore/dom/make_names.pl b/Source/WebCore/dom/make_names.pl index 6e0a061c8..5bd5e97d9 100755 --- a/Source/WebCore/dom/make_names.pl +++ b/Source/WebCore/dom/make_names.pl @@ -116,7 +116,7 @@ if (length($fontNamesIn)) { printCppHead($F, "CSS", $familyNamesFileBase, "WTF"); while ( my ($name, $identifier) = each %parameters ) { - print F "DEFINE_GLOBAL(AtomicString, $name, \"$identifier\")\n"; + print F "DEFINE_GLOBAL(AtomicString, $name)\n"; } printInit($F, 0); @@ -600,11 +600,13 @@ sub printNamesHeaderFile print F "#endif\n\n"; if (keys %allTags) { - print F "WebCore::QualifiedName** get$parameters{namespace}Tags(size_t* size);\n"; + print F "const unsigned $parameters{namespace}TagsCount = ", scalar(keys %allTags), ";\n"; + print F "WebCore::QualifiedName** get$parameters{namespace}Tags();\n"; } if (keys %allAttrs) { - print F "WebCore::QualifiedName** get$parameters{namespace}Attrs(size_t* size);\n"; + print F "const unsigned $parameters{namespace}AttrsCount = ", scalar(keys %allAttrs), ";\n"; + print F "WebCore::QualifiedName** get$parameters{namespace}Attrs();\n"; } printInit($F, 1); @@ -622,21 +624,20 @@ sub printNamesCppFile my $lowerNamespace = lc($parameters{namespacePrefix}); - print F "DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{namespaceURI}\")\n\n"; + print F "DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI)\n\n"; if (keys %allTags) { print F "// Tags\n"; for my $name (sort keys %allTags) { - print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Tag, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI)\n"; + print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Tag)\n"; } - print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Tags(size_t* size)\n"; + print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Tags()\n"; print F "{\n static WebCore::QualifiedName* $parameters{namespace}Tags[] = {\n"; for my $name (sort keys %allTags) { print F " (WebCore::QualifiedName*)&${name}Tag,\n"; } print F " };\n"; - print F " *size = ", scalar(keys %allTags), ";\n"; print F " return $parameters{namespace}Tags;\n"; print F "}\n"; } @@ -644,22 +645,21 @@ sub printNamesCppFile if (keys %allAttrs) { print F "\n// Attributes\n"; for my $name (sort keys %allAttrs) { - print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Attr, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI)\n"; + print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Attr)\n"; } - print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Attrs(size_t* size)\n"; + print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Attrs()\n"; print F "{\n static WebCore::QualifiedName* $parameters{namespace}Attr[] = {\n"; for my $name (sort keys %allAttrs) { print F " (WebCore::QualifiedName*)&${name}Attr,\n"; } print F " };\n"; - print F " *size = ", scalar(keys %allAttrs), ";\n"; print F " return $parameters{namespace}Attr;\n"; print F "}\n"; } printInit($F, 0); - - print(F " AtomicString ${lowerNamespace}NS(\"$parameters{namespaceURI}\");\n\n"); + + print(F " AtomicString ${lowerNamespace}NS(\"$parameters{namespaceURI}\", AtomicString::ConstructFromLiteral);\n\n"); print(F " // Namespace\n"); print(F " new ((void*)&${lowerNamespace}NamespaceURI) AtomicString(${lowerNamespace}NS);\n\n"); @@ -769,7 +769,13 @@ sub printDefinitions $realName = $name; $realName =~ s/_/-/g; } - print F " new ((void*)&$name","${shortCamelType}) QualifiedName(nullAtom, \"$realName\", $namespaceURI);\n"; + + # To generate less code in init(), the common case of nullAtom for the namespace, we call createQualifiedName() without passing $namespaceURI. + if ($namespaceURI eq "nullAtom") { + print F " createQualifiedName((void*)&$name","${shortCamelType}, \"$realName\", ", length $realName ,");\n"; + } else { + print F " createQualifiedName((void*)&$name","${shortCamelType}, \"$realName\", ", length $realName ,", $namespaceURI);\n"; + } } } diff --git a/Source/WebCore/editing/EditingStyle.cpp b/Source/WebCore/editing/EditingStyle.cpp index 0ea0a254f..eaf16341b 100644 --- a/Source/WebCore/editing/EditingStyle.cpp +++ b/Source/WebCore/editing/EditingStyle.cpp @@ -368,6 +368,16 @@ static inline RGBA32 getRGBAFontColor(StylePropertySet* style) return cssValueToRGBA(style->getPropertyCSSValue(CSSPropertyColor).get()); } +static inline RGBA32 getRGBABackgroundColor(CSSStyleDeclaration* style) +{ + return cssValueToRGBA(style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor).get()); +} + +static inline RGBA32 getRGBABackgroundColor(StylePropertySet* style) +{ + return cssValueToRGBA(style->getPropertyCSSValue(CSSPropertyBackgroundColor).get()); +} + static inline RGBA32 rgbaBackgroundColorInEffect(Node* node) { return cssValueToRGBA(backgroundColorInEffect(node).get()); @@ -1505,6 +1515,9 @@ PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedun && textAlignResolvingStartAndEnd(result.get()) == textAlignResolvingStartAndEnd(baseStyle)) result->removeProperty(CSSPropertyTextAlign); + if (baseStyle->getPropertyCSSValueInternal(CSSPropertyBackgroundColor) && getRGBABackgroundColor(result.get()) == getRGBABackgroundColor(baseStyle)) + result->removeProperty(CSSPropertyBackgroundColor); + return result; } diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp index 219473694..1c0aa7897 100644 --- a/Source/WebCore/editing/TypingCommand.cpp +++ b/Source/WebCore/editing/TypingCommand.cpp @@ -554,6 +554,8 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool ki Position downstreamEnd = endingSelection().end().downstream(); VisiblePosition visibleEnd = endingSelection().visibleEnd(); + if (isEmptyTableCell(visibleEnd.deepEquivalent().containerNode())) + return; if (visibleEnd == endOfParagraph(visibleEnd)) downstreamEnd = visibleEnd.next(CannotCrossEditingBoundary).deepEquivalent().downstream(); // When deleting tables: Select the table first, then perform the deletion diff --git a/Source/WebCore/editing/UndoManager.cpp b/Source/WebCore/editing/UndoManager.cpp index 9357a1e78..55c550992 100644 --- a/Source/WebCore/editing/UndoManager.cpp +++ b/Source/WebCore/editing/UndoManager.cpp @@ -33,6 +33,7 @@ #if ENABLE(UNDO_MANAGER) +#include "Element.h" #include "Node.h" namespace WebCore { @@ -47,25 +48,74 @@ UndoManager::UndoManager(Node* host) { } -void UndoManager::undoScopeHostDestroyed() +void UndoManager::disconnect() { m_undoScopeHost = 0; } -void UndoManager::undo() +void UndoManager::transact(const Dictionary&, bool, ExceptionCode& ec) { + if (!isConnected()) { + ec = INVALID_ACCESS_ERR; + return; + } + RefPtr<UndoStep> step; + m_undoStack.append(step); } -void UndoManager::redo() +void UndoManager::undo(ExceptionCode& ec) { + if (!isConnected()) { + ec = INVALID_ACCESS_ERR; + return; + } } -void UndoManager::clearUndo() +void UndoManager::redo(ExceptionCode& ec) { + if (!isConnected()) { + ec = INVALID_ACCESS_ERR; + return; + } } -void UndoManager::clearRedo() +void UndoManager::clearUndo(ExceptionCode& ec) { + if (!isConnected()) { + ec = INVALID_ACCESS_ERR; + return; + } + m_undoStack.clear(); +} + +void UndoManager::clearRedo(ExceptionCode& ec) +{ + if (!isConnected()) { + ec = INVALID_ACCESS_ERR; + return; + } + m_redoStack.clear(); +} + +void UndoManager::clearUndoRedo() +{ + m_undoStack.clear(); + m_redoStack.clear(); +} + +bool UndoManager::isConnected() +{ + if (!m_undoScopeHost) + return false; + if (!m_undoScopeHost->isElementNode()) + return true; + Element* element = toElement(m_undoScopeHost); + ASSERT(element->undoScope()); + if (element->isContentEditable() && !element->isRootEditableElement()) { + element->disconnectUndoManager(); + return false; + } + return true; } } diff --git a/Source/WebCore/editing/UndoManager.h b/Source/WebCore/editing/UndoManager.h index 56638cdfc..c318c9eca 100644 --- a/Source/WebCore/editing/UndoManager.h +++ b/Source/WebCore/editing/UndoManager.h @@ -33,28 +33,41 @@ #if ENABLE(UNDO_MANAGER) +#include "ExceptionCode.h" +#include "UndoStep.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/Vector.h> namespace WebCore { +class Dictionary; class Node; class UndoManager : public RefCounted<UndoManager> { public: static PassRefPtr<UndoManager> create(Node* host); - void undoScopeHostDestroyed(); + void disconnect(); - void undo(); - void redo(); + void transact(const Dictionary& transaction, bool merge, ExceptionCode&); - void clearUndo(); - void clearRedo(); + void undo(ExceptionCode&); + void redo(ExceptionCode&); + + unsigned length() const { return m_undoStack.size() + m_redoStack.size(); } + + void clearUndo(ExceptionCode&); + void clearRedo(ExceptionCode&); + void clearUndoRedo(); private: explicit UndoManager(Node* host); + bool isConnected(); + Node* m_undoScopeHost; + Vector<RefPtr<UndoStep> > m_undoStack; + Vector<RefPtr<UndoStep> > m_redoStack; }; } diff --git a/Source/WebCore/editing/UndoManager.idl b/Source/WebCore/editing/UndoManager.idl index 5ee7bea18..b4d0f8133 100644 --- a/Source/WebCore/editing/UndoManager.idl +++ b/Source/WebCore/editing/UndoManager.idl @@ -33,11 +33,20 @@ module core { interface [ Conditional=UNDO_MANAGER ] UndoManager { - void undo(); - void redo(); + void transact(in Dictionary transaction, in boolean merge) + raises(DOMException); - void clearUndo(); - void clearRedo(); + void undo() + raises(DOMException); + void redo() + raises(DOMException); + + readonly attribute unsigned long length; + + void clearUndo() + raises(DOMException); + void clearRedo() + raises(DOMException); }; } diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp index f0ba766ab..5d9ba2dee 100644 --- a/Source/WebCore/editing/markup.cpp +++ b/Source/WebCore/editing/markup.cpp @@ -110,8 +110,8 @@ static void completeURLs(Node* node, const String& baseURL) continue; unsigned length = e->attributeCount(); for (unsigned i = 0; i < length; i++) { - Attribute* attribute = e->attributeItem(i); - if (e->isURLAttribute(*attribute)) + const Attribute* attribute = e->attributeItem(i); + if (e->isURLAttribute(*attribute) && !attribute->value().isEmpty()) changes.append(AttributeChange(e, attribute->name(), KURL(parsedBaseURL, attribute->value()).string())); } } @@ -294,7 +294,7 @@ void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element* element const bool shouldAnnotateOrForceInline = element->isHTMLElement() && (shouldAnnotate() || addDisplayInline); const bool shouldOverrideStyleAttr = shouldAnnotateOrForceInline || shouldApplyWrappingStyle(element); for (unsigned int i = 0; i < length; i++) { - Attribute* attribute = element->attributeItem(i); + const Attribute* attribute = element->attributeItem(i); // We'll handle the style attribute separately, below. if (attribute->name() == styleAttr && shouldOverrideStyleAttr) continue; diff --git a/Source/WebCore/editing/visible_units.cpp b/Source/WebCore/editing/visible_units.cpp index 1f1f85d53..b42af2645 100644 --- a/Source/WebCore/editing/visible_units.cpp +++ b/Source/WebCore/editing/visible_units.cpp @@ -919,7 +919,7 @@ static inline IntPoint absoluteLineDirectionPointToLocalPointInBlock(RootInlineB if (root->block()->isHorizontalWritingMode()) return IntPoint(lineDirectionPoint - absoluteBlockPoint.x(), root->blockDirectionPointInLine()); - return IntPoint(root->selectionTop(), lineDirectionPoint - absoluteBlockPoint.y()); + return IntPoint(root->blockDirectionPointInLine(), lineDirectionPoint - absoluteBlockPoint.y()); } VisiblePosition previousLinePosition(const VisiblePosition &visiblePosition, int lineDirectionPoint, EditableType editableType) diff --git a/Source/WebCore/fileapi/File.cpp b/Source/WebCore/fileapi/File.cpp index 5f8b93b78..087895710 100644 --- a/Source/WebCore/fileapi/File.cpp +++ b/Source/WebCore/fileapi/File.cpp @@ -34,12 +34,18 @@ namespace WebCore { -static String getContentTypeFromFileName(const String& name) +static String getContentTypeFromFileName(const String& name, File::ContentTypeLookupPolicy policy) { String type; int index = name.reverseFind('.'); - if (index != -1) - type = MIMETypeRegistry::getWellKnownMIMETypeForExtension(name.substring(index + 1)); + if (index != -1) { + if (policy == File::WellKnownContentTypes) + type = MIMETypeRegistry::getWellKnownMIMETypeForExtension(name.substring(index + 1)); + else { + ASSERT(policy == File::AllContentTypes); + type = MIMETypeRegistry::getMIMETypeForExtension(name.substring(index + 1)); + } + } return type; } @@ -51,21 +57,21 @@ static PassOwnPtr<BlobData> createBlobDataForFileWithType(const String& path, co return blobData.release(); } -static PassOwnPtr<BlobData> createBlobDataForFile(const String& path) +static PassOwnPtr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy) { - return createBlobDataForFileWithType(path, getContentTypeFromFileName(path)); + return createBlobDataForFileWithType(path, getContentTypeFromFileName(path, policy)); } -static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName) +static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy) { - return createBlobDataForFileWithType(path, getContentTypeFromFileName(fileSystemName)); + return createBlobDataForFileWithType(path, getContentTypeFromFileName(fileSystemName, policy)); } #if ENABLE(FILE_SYSTEM) static PassOwnPtr<BlobData> createBlobDataForFileWithMetadata(const String& fileSystemName, const FileMetadata& metadata) { OwnPtr<BlobData> blobData = BlobData::create(); - blobData->setContentType(getContentTypeFromFileName(fileSystemName)); + blobData->setContentType(getContentTypeFromFileName(fileSystemName, File::WellKnownContentTypes)); blobData->appendFile(metadata.platformPath, 0, metadata.length, metadata.modificationTime); return blobData.release(); } @@ -74,14 +80,14 @@ static PassOwnPtr<BlobData> createBlobDataForFileWithMetadata(const String& file #if ENABLE(DIRECTORY_UPLOAD) PassRefPtr<File> File::createWithRelativePath(const String& path, const String& relativePath) { - RefPtr<File> file = adoptRef(new File(path)); + RefPtr<File> file = adoptRef(new File(path, AllContentTypes)); file->m_relativePath = relativePath; return file.release(); } #endif -File::File(const String& path) - : Blob(createBlobDataForFile(path), -1) +File::File(const String& path, ContentTypeLookupPolicy policy) + : Blob(createBlobDataForFile(path, policy), -1) , m_path(path) , m_name(pathGetFileName(path)) #if ENABLE(FILE_SYSTEM) @@ -105,8 +111,8 @@ File::File(const String& path, const KURL& url, const String& type) // See SerializedScriptValue.cpp for js and v8. } -File::File(const String& path, const String& name) - : Blob(createBlobDataForFileWithName(path, name), -1) +File::File(const String& path, const String& name, ContentTypeLookupPolicy policy) + : Blob(createBlobDataForFileWithName(path, name, policy), -1) , m_path(path) , m_name(name) #if ENABLE(FILE_SYSTEM) diff --git a/Source/WebCore/fileapi/File.h b/Source/WebCore/fileapi/File.h index e3ca2a5a8..864c4388a 100644 --- a/Source/WebCore/fileapi/File.h +++ b/Source/WebCore/fileapi/File.h @@ -38,9 +38,16 @@ class KURL; class File : public Blob { public: - static PassRefPtr<File> create(const String& path) + // AllContentTypes should only be used when the full path/name are trusted; otherwise, it could + // allow arbitrary pages to determine what applications an user has installed. + enum ContentTypeLookupPolicy { + WellKnownContentTypes, + AllContentTypes, + }; + + static PassRefPtr<File> create(const String& path, ContentTypeLookupPolicy policy = WellKnownContentTypes) { - return adoptRef(new File(path)); + return adoptRef(new File(path, policy)); } // For deserialization. @@ -64,11 +71,11 @@ public: #endif // Create a file with a name exposed to the author (via File.name and associated DOM properties) that differs from the one provided in the path. - static PassRefPtr<File> createWithName(const String& path, const String& name) + static PassRefPtr<File> createWithName(const String& path, const String& name, ContentTypeLookupPolicy policy = WellKnownContentTypes) { if (name.isEmpty()) - return adoptRef(new File(path)); - return adoptRef(new File(path, name)); + return adoptRef(new File(path, policy)); + return adoptRef(new File(path, name, policy)); } virtual unsigned long long size() const; @@ -89,11 +96,11 @@ public: void captureSnapshot(long long& snapshotSize, double& snapshotModificationTime) const; private: - File(const String& path); + File(const String& path, ContentTypeLookupPolicy); // For deserialization. File(const String& path, const KURL& srcURL, const String& type); - File(const String& path, const String& name); + File(const String& path, const String& name, ContentTypeLookupPolicy); # if ENABLE(FILE_SYSTEM) File(const String& name, const FileMetadata&); diff --git a/Source/WebCore/html/ColorInputType.cpp b/Source/WebCore/html/ColorInputType.cpp index ea2151c1e..3e75c6e65 100644 --- a/Source/WebCore/html/ColorInputType.cpp +++ b/Source/WebCore/html/ColorInputType.cpp @@ -35,8 +35,10 @@ #include "Chrome.h" #include "Color.h" #include "ElementShadow.h" +#include "HTMLDataListElement.h" #include "HTMLDivElement.h" #include "HTMLInputElement.h" +#include "HTMLOptionElement.h" #include "MouseEvent.h" #include "RenderObject.h" #include "RenderView.h" @@ -50,6 +52,8 @@ namespace WebCore { +using namespace HTMLNames; + static bool isValidColorString(const String& value) { if (value.isEmpty()) @@ -162,6 +166,11 @@ bool ColorInputType::shouldRespectListAttribute() return InputType::themeSupportsDataListUI(this); } +bool ColorInputType::typeMismatchFor(const String& value) const +{ + return isValidColorString(value); +} + void ColorInputType::didChooseColor(const Color& color) { if (element()->disabled() || element()->readOnly() || color == valueAsColor()) @@ -197,11 +206,41 @@ HTMLElement* ColorInputType::shadowColorSwatch() const return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0; } -IntRect ColorInputType::elementRectRelativeToWindow() const +IntRect ColorInputType::elementRectRelativeToRootView() const +{ + return element()->document()->view()->contentsToRootView(element()->getPixelSnappedRect()); +} + +Color ColorInputType::currentColor() +{ + return valueAsColor(); +} + +bool ColorInputType::shouldShowSuggestions() const +{ +#if ENABLE(DATALIST_ELEMENT) + return element()->fastHasAttribute(listAttr); +#endif +} + +Vector<Color> ColorInputType::suggestions() const { - RenderObject* renderer = element()->renderer(); - ASSERT(renderer); - return pixelSnappedIntRect(renderer->view()->frameView()->contentsToWindow(renderer->absoluteBoundingBoxRect())); + Vector<Color> suggestions; +#if ENABLE(DATALIST_ELEMENT) + HTMLDataListElement* dataList = element()->dataList(); + if (dataList) { + RefPtr<HTMLCollection> options = dataList->options(); + for (unsigned i = 0; HTMLOptionElement* option = static_cast<HTMLOptionElement*>(options->item(i)); i++) { + if (!element()->isValidValue(option->value())) + continue; + Color color(option->value()); + if (!color.isValid()) + continue; + suggestions.append(color); + } + } +#endif + return suggestions; } } // namespace WebCore diff --git a/Source/WebCore/html/ColorInputType.h b/Source/WebCore/html/ColorInputType.h index e03cb2242..1f08133fe 100644 --- a/Source/WebCore/html/ColorInputType.h +++ b/Source/WebCore/html/ColorInputType.h @@ -46,7 +46,10 @@ public: // ColorChooserClient implementation. virtual void didChooseColor(const Color&) OVERRIDE; virtual void didEndChooser() OVERRIDE; - virtual IntRect elementRectRelativeToWindow() const OVERRIDE; + virtual IntRect elementRectRelativeToRootView() const OVERRIDE; + virtual Color currentColor() OVERRIDE; + virtual bool shouldShowSuggestions() const OVERRIDE; + virtual Vector<Color> suggestions() const OVERRIDE; private: ColorInputType(HTMLInputElement* element) : BaseClickableWithKeyInputType(element) { } @@ -60,6 +63,7 @@ private: virtual void handleDOMActivateEvent(Event*) OVERRIDE; virtual void detach() OVERRIDE; virtual bool shouldRespectListAttribute() OVERRIDE; + virtual bool typeMismatchFor(const String&) const OVERRIDE; Color valueAsColor() const; void endColorChooser(); diff --git a/Source/WebCore/html/DateInputType.cpp b/Source/WebCore/html/DateInputType.cpp index f5d1a0293..962046a42 100644 --- a/Source/WebCore/html/DateInputType.cpp +++ b/Source/WebCore/html/DateInputType.cpp @@ -144,7 +144,7 @@ void DateInputType::handleBlurEvent() element()->setFormControlValueMatchesRenderer(false); // We need to reset the renderer value explicitly because an unacceptable // renderer value should be purged before style calculation. - element()->updateInnerTextValue(); + updateInnerTextValue(); } bool DateInputType::supportsPlaceholder() const diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp index 7a75e13c1..d08fe2451 100644 --- a/Source/WebCore/html/FileInputType.cpp +++ b/Source/WebCore/html/FileInputType.cpp @@ -284,7 +284,7 @@ PassRefPtr<FileList> FileInputType::createFileList(const Vector<FileChooserFileI #endif for (size_t i = 0; i < size; i++) - fileList->append(File::createWithName(files[i].path, files[i].displayName)); + fileList->append(File::createWithName(files[i].path, files[i].displayName, File::AllContentTypes)); return fileList; } diff --git a/Source/WebCore/html/FormAssociatedElement.cpp b/Source/WebCore/html/FormAssociatedElement.cpp index f05177c1a..99377df34 100644 --- a/Source/WebCore/html/FormAssociatedElement.cpp +++ b/Source/WebCore/html/FormAssociatedElement.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "FormAssociatedElement.h" +#include "ElementShadow.h" #include "FormController.h" #include "HTMLFormControlElement.h" #include "HTMLFormElement.h" @@ -66,6 +67,15 @@ ValidityState* FormAssociatedElement::validity() return m_validityState.get(); } +ShadowRoot* FormAssociatedElement::ensureUserAgentShadowRoot() +{ + Element* element = toHTMLElement(this); + if (ShadowRoot* shadowRoot = element->userAgentShadowRoot()) + return shadowRoot; + + return ShadowRoot::create(element, ShadowRoot::UserAgentShadowRoot, ASSERT_NO_EXCEPTION).get(); +} + void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument) { HTMLElement* element = toHTMLElement(this); diff --git a/Source/WebCore/html/FormAssociatedElement.h b/Source/WebCore/html/FormAssociatedElement.h index b135df1fa..f98106316 100644 --- a/Source/WebCore/html/FormAssociatedElement.h +++ b/Source/WebCore/html/FormAssociatedElement.h @@ -46,6 +46,8 @@ public: HTMLFormElement* form() const { return m_form; } ValidityState* validity(); + ShadowRoot* ensureUserAgentShadowRoot(); + virtual bool isFormControlElement() const = 0; virtual bool isFormControlElementWithState() const; virtual bool isEnumeratable() const = 0; diff --git a/Source/WebCore/html/HTMLAppletElement.cpp b/Source/WebCore/html/HTMLAppletElement.cpp index 9c7eb5d55..5bd5fd5aa 100644 --- a/Source/WebCore/html/HTMLAppletElement.cpp +++ b/Source/WebCore/html/HTMLAppletElement.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Stefan Schimanski (1Stein@gmx.de) - * Copyright (C) 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * * This library is free software; you can redistribute it and/or @@ -25,8 +25,10 @@ #include "HTMLAppletElement.h" #include "Attribute.h" +#include "Frame.h" #include "HTMLDocument.h" #include "HTMLNames.h" +#include "HTMLParamElement.h" #include "RenderApplet.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -36,15 +38,17 @@ namespace WebCore { using namespace HTMLNames; -inline HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document* document) - : HTMLPlugInElement(tagName, document) +HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document* document, bool createdByParser) + : HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages) { ASSERT(hasTagName(appletTag)); + + m_serviceType = "application/x-java-applet"; } -PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document* document) +PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) { - return adoptRef(new HTMLAppletElement(tagName, document)); + return adoptRef(new HTMLAppletElement(tagName, document, createdByParser)); } void HTMLAppletElement::parseAttribute(const Attribute& attribute) @@ -56,71 +60,99 @@ void HTMLAppletElement::parseAttribute(const Attribute& attribute) || attribute.name() == mayscriptAttr || attribute.name() == objectAttr) { // Do nothing. - } else - HTMLPlugInElement::parseAttribute(attribute); + return; + } + + HTMLPlugInImageElement::parseAttribute(attribute); } bool HTMLAppletElement::rendererIsNeeded(const NodeRenderingContext& context) { if (!fastHasAttribute(codeAttr)) return false; - return HTMLPlugInElement::rendererIsNeeded(context); + return HTMLPlugInImageElement::rendererIsNeeded(context); } RenderObject* HTMLAppletElement::createRenderer(RenderArena*, RenderStyle* style) { - if (canEmbedJava()) { - HashMap<String, String> args; + if (!canEmbedJava()) + return RenderObject::createObject(this, style); - args.set("code", getAttribute(codeAttr)); + return new (document()->renderArena()) RenderApplet(this); +} - const AtomicString& codeBase = getAttribute(codebaseAttr); - if (!codeBase.isNull()) - args.set("codeBase", codeBase); +RenderWidget* HTMLAppletElement::renderWidgetForJSBindings() +{ + if (!canEmbedJava()) + return 0; - const AtomicString& name = document()->isHTMLDocument() ? getNameAttribute() : getIdAttribute(); - if (!name.isNull()) - args.set("name", name); - const AtomicString& archive = getAttribute(archiveAttr); - if (!archive.isNull()) - args.set("archive", archive); + document()->updateLayoutIgnorePendingStylesheets(); + return renderPart(); +} + +void HTMLAppletElement::updateWidget(PluginCreationOption) +{ + setNeedsWidgetUpdate(false); + // FIXME: This should ASSERT isFinishedParsingChildren() instead. + if (!isFinishedParsingChildren()) + return; + + RenderEmbeddedObject* renderer = renderEmbeddedObject(); - args.set("baseURL", document()->baseURL().string()); + LayoutUnit contentWidth = renderer->style()->width().isFixed() ? LayoutUnit(renderer->style()->width().value()) : + renderer->width() - renderer->borderAndPaddingWidth(); + LayoutUnit contentHeight = renderer->style()->height().isFixed() ? LayoutUnit(renderer->style()->height().value()) : + renderer->height() - renderer->borderAndPaddingHeight(); - const AtomicString& mayScript = getAttribute(mayscriptAttr); - if (!mayScript.isNull()) - args.set("mayScript", mayScript); + Vector<String> paramNames; + Vector<String> paramValues; - // Other arguments (from <PARAM> tags) are added later. - - return new (document()->renderArena()) RenderApplet(this, args); + paramNames.append("code"); + paramValues.append(getAttribute(codeAttr).string()); + + const AtomicString& codeBase = getAttribute(codebaseAttr); + if (!codeBase.isNull()) { + paramNames.append("codeBase"); + paramValues.append(codeBase.string()); } - return RenderObject::createObject(this, style); -} + const AtomicString& name = document()->isHTMLDocument() ? getNameAttribute() : getIdAttribute(); + if (!name.isNull()) { + paramNames.append("name"); + paramValues.append(name.string()); + } -void HTMLAppletElement::defaultEventHandler(Event* event) -{ - RenderObject* r = renderer(); - if (!r || !r->isWidget()) - return; - Widget* widget = toRenderWidget(r)->widget(); - if (!widget) - return; - widget->handleEvent(event); -} + const AtomicString& archive = getAttribute(archiveAttr); + if (!archive.isNull()) { + paramNames.append("archive"); + paramValues.append(archive.string()); + } -RenderWidget* HTMLAppletElement::renderWidgetForJSBindings() -{ - if (!canEmbedJava()) - return 0; + paramNames.append("baseURL"); + paramValues.append(document()->baseURL().string()); - if (!renderer() || !renderer()->isApplet()) - return 0; + const AtomicString& mayScript = getAttribute(mayscriptAttr); + if (!mayScript.isNull()) { + paramNames.append("mayScript"); + paramValues.append(mayScript.string()); + } + + for (Node* child = firstChild(); child; child = child->nextSibling()) { + if (!child->hasTagName(paramTag)) + continue; + + HTMLParamElement* param = static_cast<HTMLParamElement*>(child); + if (param->name().isEmpty()) + continue; + + paramNames.append(param->name()); + paramValues.append(param->value()); + } - RenderApplet* applet = toRenderApplet(renderer()); - applet->createWidgetIfNecessary(); - return applet; + Frame* frame = document()->frame(); + ASSERT(frame); + + renderer->setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(roundedIntSize(LayoutSize(contentWidth, contentHeight)), this, paramNames, paramValues)); } bool HTMLAppletElement::canEmbedJava() const @@ -141,12 +173,4 @@ bool HTMLAppletElement::canEmbedJava() const return true; } -void HTMLAppletElement::finishParsingChildren() -{ - // The parser just reached </applet>, so all the params are available now. - HTMLPlugInElement::finishParsingChildren(); - if (renderer()) - renderer()->setNeedsLayout(true); // This will cause it to create its widget & the Java applet -} - } diff --git a/Source/WebCore/html/HTMLAppletElement.h b/Source/WebCore/html/HTMLAppletElement.h index d3ff6438f..ee4e30cf0 100644 --- a/Source/WebCore/html/HTMLAppletElement.h +++ b/Source/WebCore/html/HTMLAppletElement.h @@ -23,28 +23,25 @@ #ifndef HTMLAppletElement_h #define HTMLAppletElement_h -#include "HTMLPlugInElement.h" +#include "HTMLPlugInImageElement.h" namespace WebCore { -class HTMLAppletElement : public HTMLPlugInElement { +class HTMLAppletElement : public HTMLPlugInImageElement { public: - static PassRefPtr<HTMLAppletElement> create(const QualifiedName&, Document*); + static PassRefPtr<HTMLAppletElement> create(const QualifiedName&, Document*, bool createdByParser); private: - HTMLAppletElement(const QualifiedName&, Document*); + HTMLAppletElement(const QualifiedName&, Document*, bool createdByParser); virtual void parseAttribute(const Attribute&) OVERRIDE; - virtual bool rendererIsNeeded(const NodeRenderingContext&); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void finishParsingChildren(); - - virtual void defaultEventHandler(Event*); + virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE; + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; virtual RenderWidget* renderWidgetForJSBindings(); + virtual void updateWidget(PluginCreationOption) OVERRIDE; - void setupApplet() const; bool canEmbedJava() const; virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; } diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in index 459078f64..9bc1fa42b 100644 --- a/Source/WebCore/html/HTMLAttributeNames.in +++ b/Source/WebCore/html/HTMLAttributeNames.in @@ -319,6 +319,7 @@ topmargin translate truespeed type +undoscope usemap valign value diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index 8633f3fd4..d873d9b7f 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -235,6 +235,10 @@ void HTMLElement::parseAttribute(const Attribute& attribute) } else if (attribute.name() == itemtypeAttr) { setItemType(attribute.value()); #endif +#if ENABLE(UNDO_MANAGER) + } else if (attribute.name() == undoscopeAttr) { + setUndoScope(!attribute.isNull()); +#endif } // standard events else if (attribute.name() == onclickAttr) { @@ -659,8 +663,14 @@ void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec) setAttribute(contenteditableAttr, "plaintext-only"); else if (equalIgnoringCase(enabled, "inherit")) removeAttribute(contenteditableAttr); - else + else { ec = SYNTAX_ERR; + return; + } +#if ENABLE(UNDO_MANAGER) + if (isContentEditable()) + disconnectUndoManagersInSubtree(); +#endif } bool HTMLElement::draggable() const diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp index b9c6e41da..15e32eef7 100644 --- a/Source/WebCore/html/HTMLEmbedElement.cpp +++ b/Source/WebCore/html/HTMLEmbedElement.cpp @@ -120,9 +120,9 @@ void HTMLEmbedElement::parametersForPlugin(Vector<String>& paramNames, Vector<St return; for (unsigned i = 0; i < attributeCount(); ++i) { - Attribute* it = attributeItem(i); - paramNames.append(it->localName().string()); - paramValues.append(it->value().string()); + const Attribute* attribute = attributeItem(i); + paramNames.append(attribute->localName().string()); + paramValues.append(attribute->value().string()); } } diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index 913c4ddb0..d52d0ba85 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -69,6 +69,11 @@ HTMLFormControlElement::~HTMLFormControlElement() { } +void HTMLFormControlElement::willAddAuthorShadowRoot() +{ + ensureUserAgentShadowRoot(); +} + String HTMLFormControlElement::formEnctype() const { return FormSubmission::Attributes::parseEncodingType(fastGetAttribute(formenctypeAttr)); diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h index b82d4ee9e..b132cbe0b 100644 --- a/Source/WebCore/html/HTMLFormControlElement.h +++ b/Source/WebCore/html/HTMLFormControlElement.h @@ -45,6 +45,8 @@ public: HTMLFormElement* form() const { return FormAssociatedElement::form(); } + void willAddAuthorShadowRoot() OVERRIDE; + String formEnctype() const; void setFormEnctype(const String&); String formMethod() const; diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 407c1233b..59c6205a8 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -456,7 +456,7 @@ void HTMLInputElement::updateType() updateValueIfNeeded(); setFormControlValueMatchesRenderer(false); - updateInnerTextValue(); + m_inputType->updateInnerTextValue(); m_wasModifiedByUser = false; @@ -489,22 +489,6 @@ void HTMLInputElement::updateType() notifyFormStateChanged(); } -void HTMLInputElement::updateInnerTextValue() -{ - if (!isTextField()) - return; - - if (!suggestedValue().isNull()) { - setInnerTextValue(suggestedValue()); - updatePlaceholderVisibility(false); - } else if (!formControlValueMatchesRenderer()) { - // Update the renderer value if the formControlValueMatchesRenderer() flag is false. - // It protects an unacceptable renderer value from being overwritten with the DOM value. - setInnerTextValue(visibleValue()); - updatePlaceholderVisibility(false); - } -} - void HTMLInputElement::subtreeHasChanged() { ASSERT(isTextField()); @@ -727,7 +711,7 @@ void HTMLInputElement::parseAttribute(const Attribute& attribute) #endif else HTMLTextFormControlElement::parseAttribute(attribute); - updateInnerTextValue(); + m_inputType->updateInnerTextValue(); } void HTMLInputElement::finishParsingChildren() @@ -902,7 +886,7 @@ void HTMLInputElement::copyNonAttributePropertiesFromElement(const Element& sour HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); setFormControlValueMatchesRenderer(false); - updateInnerTextValue(); + m_inputType->updateInnerTextValue(); } String HTMLInputElement::value() const @@ -950,7 +934,7 @@ void HTMLInputElement::setSuggestedValue(const String& value) setFormControlValueMatchesRenderer(false); m_suggestedValue = sanitizeValue(value); setNeedsStyleRecalc(); - updateInnerTextValue(); + m_inputType->updateInnerTextValue(); } void HTMLInputElement::setEditingValue(const String& value) diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 3fd66c9e4..fa4aa9153 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -153,8 +153,6 @@ public: String localizeValue(const String&) const; - void updateInnerTextValue(); - // The value which is drawn by a renderer. String visibleValue() const; String convertFromVisibleValue(const String&) const; @@ -236,6 +234,7 @@ public: #if ENABLE(DATALIST_ELEMENT) HTMLElement* list() const; + HTMLDataListElement* dataList() const; void listAttributeTargetChanged(); #endif @@ -363,7 +362,6 @@ private: virtual void subtreeHasChanged(); #if ENABLE(DATALIST_ELEMENT) - HTMLDataListElement* dataList() const; void resetListAttributeTargetObserver(); #endif void parseMaxLengthAttribute(const Attribute&); diff --git a/Source/WebCore/html/HTMLLIElement.cpp b/Source/WebCore/html/HTMLLIElement.cpp index c3400a579..65f65dc9e 100644 --- a/Source/WebCore/html/HTMLLIElement.cpp +++ b/Source/WebCore/html/HTMLLIElement.cpp @@ -26,6 +26,7 @@ #include "Attribute.h" #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" +#include "ComposedShadowTreeWalker.h" #include "HTMLNames.h" #include "RenderListItem.h" @@ -95,10 +96,13 @@ void HTMLLIElement::attach() // Find the enclosing list node. Node* listNode = 0; - Node* n = this; - while (!listNode && (n = n->parentNode())) { - if (n->hasTagName(ulTag) || n->hasTagName(olTag)) - listNode = n; + ComposedShadowTreeParentWalker walker(this); + while (!listNode) { + walker.parentIncludingInsertionPointAndShadowRoot(); + if (!walker.get()) + break; + if (walker.get()->hasTagName(ulTag) || walker.get()->hasTagName(olTag)) + listNode = walker.get(); } // If we are not in a list, tell the renderer so it can position us inside. diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 909ef7610..cc025c12b 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -39,6 +39,7 @@ #include "ContentType.h" #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" +#include "DiagnosticLoggingKeys.h" #include "DocumentLoader.h" #include "ElementShadow.h" #include "Event.h" @@ -1507,6 +1508,20 @@ void HTMLMediaElement::mediaPlayerNetworkStateChanged(MediaPlayer*) endProcessingMediaPlayerCallback(); } +static String stringForNetworkState(MediaPlayer::NetworkState state) +{ + switch (state) { + case MediaPlayer::Empty: return "Empty"; + case MediaPlayer::Idle: return "Idle"; + case MediaPlayer::Loading: return "Loading"; + case MediaPlayer::Loaded: return "Loaded"; + case MediaPlayer::FormatError: return "FormatError"; + case MediaPlayer::NetworkError: return "NetworkError"; + case MediaPlayer::DecodeError: return "DecodeError"; + default: return emptyString(); + } +} + void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error) { stopPeriodicTimers(); @@ -1543,6 +1558,9 @@ void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error) mediaControls()->reset(); mediaControls()->reportedError(); } + + if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled()) + document()->page()->chrome()->client()->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadingFailedKey(), stringForNetworkState(error), DiagnosticLoggingKeys::failKey()); } void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) @@ -1671,6 +1689,9 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) mediaControls()->loadedMetadata(); if (renderer()) renderer()->updateFromElement(); + + if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled()) + document()->page()->chrome()->client()->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadedKey(), m_player->engineDescription(), DiagnosticLoggingKeys::noopKey()); } bool shouldUpdateDisplayState = false; @@ -2200,7 +2221,7 @@ void HTMLMediaElement::setPlaybackRate(float rate) void HTMLMediaElement::updatePlaybackRate() { float effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate; - if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate && !m_mediaController) + if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate) m_player->setRate(effectiveRate); } diff --git a/Source/WebCore/html/HTMLObjectElement.cpp b/Source/WebCore/html/HTMLObjectElement.cpp index 8c5b817a2..5715d2382 100644 --- a/Source/WebCore/html/HTMLObjectElement.cpp +++ b/Source/WebCore/html/HTMLObjectElement.cpp @@ -26,6 +26,8 @@ #include "Attribute.h" #include "CSSValueKeywords.h" +#include "Chrome.h" +#include "ChromeClient.h" #include "EventNames.h" #include "ExceptionCode.h" #include "FormDataList.h" @@ -192,11 +194,11 @@ void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S // Turn the attributes of the <object> element into arrays, but don't override <param> values. if (hasAttributes()) { for (unsigned i = 0; i < attributeCount(); ++i) { - Attribute* it = attributeItem(i); - const AtomicString& name = it->name().localName(); + const Attribute* attribute = attributeItem(i); + const AtomicString& name = attribute->name().localName(); if (!uniqueParamNames.contains(name.impl())) { paramNames.append(name.string()); - paramValues.append(it->value().string()); + paramValues.append(attribute->value().string()); } } } @@ -392,9 +394,8 @@ static bool isRecognizedTagName(const QualifiedName& tagName) { DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, tagList, ()); if (tagList.isEmpty()) { - size_t tagCount = 0; - QualifiedName** tags = HTMLNames::getHTMLTags(&tagCount); - for (size_t i = 0; i < tagCount; i++) { + QualifiedName** tags = HTMLNames::getHTMLTags(); + for (size_t i = 0; i < HTMLNames::HTMLTagsCount; i++) { if (*tags[i] == bgsoundTag || *tags[i] == commandTag || *tags[i] == detailsTag diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in index c40672863..3660ab948 100644 --- a/Source/WebCore/html/HTMLTagNames.in +++ b/Source/WebCore/html/HTMLTagNames.in @@ -7,7 +7,7 @@ a interfaceName=HTMLAnchorElement abbr interfaceName=HTMLElement acronym interfaceName=HTMLElement address interfaceName=HTMLElement -applet +applet constructorNeedsCreatedByParser area article interfaceName=HTMLElement aside interfaceName=HTMLElement diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index d9097c4de..09a895b50 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -98,17 +98,20 @@ static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap() map->add(InputTypeNames::date(), DateInputType::create); #endif #if ENABLE(INPUT_TYPE_DATETIME) - map->add(InputTypeNames::datetime(), DateTimeInputType::create); + if (RuntimeEnabledFeatures::inputTypeDateTimeEnabled()) + map->add(InputTypeNames::datetime(), DateTimeInputType::create); #endif #if ENABLE(INPUT_TYPE_DATETIMELOCAL) - map->add(InputTypeNames::datetimelocal(), DateTimeLocalInputType::create); + if (RuntimeEnabledFeatures::inputTypeDateTimeLocalEnabled()) + map->add(InputTypeNames::datetimelocal(), DateTimeLocalInputType::create); #endif map->add(InputTypeNames::email(), EmailInputType::create); map->add(InputTypeNames::file(), FileInputType::create); map->add(InputTypeNames::hidden(), HiddenInputType::create); map->add(InputTypeNames::image(), ImageInputType::create); #if ENABLE(INPUT_TYPE_MONTH) - map->add(InputTypeNames::month(), MonthInputType::create); + if (RuntimeEnabledFeatures::inputTypeMonthEnabled()) + map->add(InputTypeNames::month(), MonthInputType::create); #endif map->add(InputTypeNames::number(), NumberInputType::create); map->add(InputTypeNames::password(), PasswordInputType::create); @@ -119,11 +122,13 @@ static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap() map->add(InputTypeNames::submit(), SubmitInputType::create); map->add(InputTypeNames::telephone(), TelephoneInputType::create); #if ENABLE(INPUT_TYPE_TIME) - map->add(InputTypeNames::time(), TimeInputType::create); + if (RuntimeEnabledFeatures::inputTypeTimeEnabled()) + map->add(InputTypeNames::time(), TimeInputType::create); #endif map->add(InputTypeNames::url(), URLInputType::create); #if ENABLE(INPUT_TYPE_WEEK) - map->add(InputTypeNames::week(), WeekInputType::create); + if (RuntimeEnabledFeatures::inputTypeWeekEnabled()) + map->add(InputTypeNames::week(), WeekInputType::create); #endif // No need to register "text" because it is the default type. return map.release(); @@ -863,6 +868,10 @@ String InputType::fixedPlaceholder() return String(); } +void InputType::updateInnerTextValue() +{ +} + void InputType::updatePlaceholderText() { } diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 348148b10..0245ba888 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -79,7 +79,9 @@ public: // Do not expose instances of InputType and classes derived from it to classes // other than HTMLInputElement. class InputType { - WTF_MAKE_NONCOPYABLE(InputType); WTF_MAKE_FAST_ALLOCATED; + WTF_MAKE_NONCOPYABLE(InputType); + WTF_MAKE_FAST_ALLOCATED; + public: static PassOwnPtr<InputType> create(HTMLInputElement*, const String&); static PassOwnPtr<InputType> createText(HTMLInputElement*); @@ -271,6 +273,7 @@ public: virtual bool supportsPlaceholder() const; virtual bool usesFixedPlaceholder() const; virtual String fixedPlaceholder(); + virtual void updateInnerTextValue(); virtual void updatePlaceholderText(); virtual void multipleAttributeChanged(); virtual void disabledAttributeChanged(); diff --git a/Source/WebCore/html/NumberInputType.cpp b/Source/WebCore/html/NumberInputType.cpp index eb157f10c..8beff28af 100644 --- a/Source/WebCore/html/NumberInputType.cpp +++ b/Source/WebCore/html/NumberInputType.cpp @@ -224,7 +224,7 @@ void NumberInputType::handleBlurEvent() // We need to reset the renderer value explicitly because an unacceptable // renderer value should be purged before style calculation. - element()->updateInnerTextValue(); + updateInnerTextValue(); } static bool isE(UChar ch) diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp index 10ed8fb0a..f114eeb5e 100644 --- a/Source/WebCore/html/TextFieldInputType.cpp +++ b/Source/WebCore/html/TextFieldInputType.cpp @@ -103,7 +103,7 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent); if (valueChanged) - input->updateInnerTextValue(); + updateInnerTextValue(); unsigned max = visibleValue().length(); if (input->focused()) @@ -450,5 +450,17 @@ void TextFieldInputType::spinButtonStepUp() stepUpFromRenderer(1); } +void TextFieldInputType::updateInnerTextValue() +{ + if (!element()->suggestedValue().isNull()) { + element()->setInnerTextValue(element()->suggestedValue()); + element()->updatePlaceholderVisibility(false); + } else if (!element()->formControlValueMatchesRenderer()) { + // Update the renderer value if the formControlValueMatchesRenderer() flag is false. + // It protects an unacceptable renderer value from being overwritten with the DOM value. + element()->setInnerTextValue(visibleValue()); + element()->updatePlaceholderVisibility(false); + } +} } // namespace WebCore diff --git a/Source/WebCore/html/TextFieldInputType.h b/Source/WebCore/html/TextFieldInputType.h index 4c7a9bac4..be6c666e4 100644 --- a/Source/WebCore/html/TextFieldInputType.h +++ b/Source/WebCore/html/TextFieldInputType.h @@ -66,6 +66,7 @@ protected: virtual void disabledAttributeChanged() OVERRIDE; virtual void readonlyAttributeChanged() OVERRIDE; virtual void handleBlurEvent() OVERRIDE; + virtual void updateInnerTextValue() OVERRIDE; private: virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE; diff --git a/Source/WebCore/html/ValidationMessage.cpp b/Source/WebCore/html/ValidationMessage.cpp index 1901f46ce..79d8c57b9 100644 --- a/Source/WebCore/html/ValidationMessage.cpp +++ b/Source/WebCore/html/ValidationMessage.cpp @@ -114,10 +114,12 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble return; double hostX = hostRect.x(); double hostY = hostRect.y(); - if (RenderBox* container = bubble->renderer()->containingBlock()) { - FloatPoint containerLocation = container->localToAbsolute(); - hostX -= containerLocation.x() + container->borderLeft(); - hostY -= containerLocation.y() + container->borderTop(); + if (RenderObject* renderer = bubble->renderer()) { + if (RenderBox* container = renderer->containingBlock()) { + FloatPoint containerLocation = container->localToAbsolute(); + hostX -= containerLocation.x() + container->borderLeft(); + hostY -= containerLocation.y() + container->borderTop(); + } } bubble->setInlineStyleProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX); @@ -132,6 +134,7 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*) { HTMLElement* host = toHTMLElement(m_element); + ShadowRoot* shadowRoot = m_element->ensureUserAgentShadowRoot(); Document* doc = host->document(); m_bubble = HTMLDivElement::create(doc); @@ -140,7 +143,7 @@ void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*) // contains non-absolute or non-fixed renderers as children. m_bubble->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute); ExceptionCode ec = 0; - host->ensureShadowRoot()->appendChild(m_bubble.get(), ec); + shadowRoot->appendChild(m_bubble.get(), ec); ASSERT(!ec); host->document()->updateLayout(); adjustBubblePosition(host->getRect(), m_bubble.get()); diff --git a/Source/WebCore/html/canvas/ArrayBuffer.idl b/Source/WebCore/html/canvas/ArrayBuffer.idl index 26dd341bb..6e7663dba 100644 --- a/Source/WebCore/html/canvas/ArrayBuffer.idl +++ b/Source/WebCore/html/canvas/ArrayBuffer.idl @@ -31,7 +31,7 @@ module html { ConstructorParameters=1, JSNoStaticTables ] ArrayBuffer { - readonly attribute int byteLength; + readonly attribute unsigned long byteLength; ArrayBuffer slice(in long begin, in [Optional] long end); }; diff --git a/Source/WebCore/html/canvas/DataView.h b/Source/WebCore/html/canvas/DataView.h index 63b156d3d..00d56d8f1 100644 --- a/Source/WebCore/html/canvas/DataView.h +++ b/Source/WebCore/html/canvas/DataView.h @@ -38,7 +38,6 @@ public: static PassRefPtr<DataView> create(unsigned length); static PassRefPtr<DataView> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned byteLength); - virtual bool isDataView() const { return true; } virtual unsigned length() const { return m_byteLength; } virtual unsigned byteLength() const { return m_byteLength; } virtual PassRefPtr<ArrayBufferView> slice(int, int) const { return 0; } @@ -73,6 +72,11 @@ public: void setFloat64(unsigned byteOffset, double value, ExceptionCode& ec) { setFloat64(byteOffset, value, false, ec); } void setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionCode&); + virtual ViewType getType() const + { + return TypeDataView; + } + protected: virtual void neuter(); diff --git a/Source/WebCore/html/canvas/WebGLActiveInfo.idl b/Source/WebCore/html/canvas/WebGLActiveInfo.idl index 20ab8af90..e9fef93b3 100644 --- a/Source/WebCore/html/canvas/WebGLActiveInfo.idl +++ b/Source/WebCore/html/canvas/WebGLActiveInfo.idl @@ -28,8 +28,8 @@ module html { interface [ Conditional=WEBGL, ] WebGLActiveInfo { - readonly attribute int size; - readonly attribute unsigned int type; + readonly attribute long size; + readonly attribute unsigned long type; readonly attribute DOMString name; }; diff --git a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp index a037ab8b6..b91ae506e 100644 --- a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp +++ b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp @@ -435,7 +435,7 @@ GC3Denum WebGLFramebuffer::checkStatus(const char** reason) const haveDepth = true; break; case GraphicsContext3D::STENCIL_ATTACHMENT: - haveDepth = true; + haveStencil = true; break; case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: haveDepthStencil = true; diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp index 76f6be085..c0abf0fba 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -441,11 +441,14 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa m_contextGroup = WebGLContextGroup::create(); m_contextGroup->addContext(this); + m_maxViewportDims[0] = m_maxViewportDims[1] = 0; + m_context->getIntegerv(GraphicsContext3D::MAX_VIEWPORT_DIMS, m_maxViewportDims); + #if PLATFORM(CHROMIUM) // Create the DrawingBuffer and initialize the platform layer. DrawingBuffer::PreserveDrawingBuffer preserve = m_attributes.preserveDrawingBuffer ? DrawingBuffer::Preserve : DrawingBuffer::Discard; DrawingBuffer::AlphaRequirement alpha = m_attributes.alpha ? DrawingBuffer::Alpha : DrawingBuffer::Opaque; - m_drawingBuffer = DrawingBuffer::create(m_context.get(), IntSize(canvas()->size()), preserve, alpha); + m_drawingBuffer = DrawingBuffer::create(m_context.get(), clampedCanvasSize(), preserve, alpha); #endif if (m_drawingBuffer) @@ -504,8 +507,6 @@ void WebGLRenderingContext::initializeNewContext() m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextureSize, m_maxCubeMapTextureSize); m_maxRenderbufferSize = 0; m_context->getIntegerv(GraphicsContext3D::MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize); - m_maxViewportDims[0] = m_maxViewportDims[1] = 0; - m_context->getIntegerv(GraphicsContext3D::MAX_VIEWPORT_DIMS, m_maxViewportDims); m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVertexArrayObjectOES::VaoTypeDefault); addContextObject(m_defaultVertexArrayObject.get()); @@ -518,11 +519,12 @@ void WebGLRenderingContext::initializeNewContext() if (!isGLES2Compliant()) initVertexAttrib0(); + IntSize canvasSize = clampedCanvasSize(); if (m_drawingBuffer) - m_drawingBuffer->reset(IntSize(canvas()->width(), canvas()->height())); + m_drawingBuffer->reset(canvasSize); - m_context->reshape(canvas()->width(), canvas()->height()); - m_context->viewport(0, 0, canvas()->width(), canvas()->height()); + m_context->reshape(canvasSize.width(), canvasSize.height()); + m_context->viewport(0, 0, canvasSize.width(), canvasSize.height()); m_context->setContextLostCallback(adoptPtr(new WebGLRenderingContextLostCallback(this))); m_context->setErrorMessageCallback(adoptPtr(new WebGLRenderingContextErrorMessageCallback(this))); @@ -605,7 +607,7 @@ void WebGLRenderingContext::markContextChanged() #endif if (!m_markedCanvasDirty) { m_markedCanvasDirty = true; - canvas()->didDraw(FloatRect(0, 0, canvas()->width(), canvas()->height())); + canvas()->didDraw(FloatRect(FloatPoint(0, 0), clampedCanvasSize())); } #if USE(ACCELERATED_COMPOSITING) } @@ -3278,7 +3280,7 @@ void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC return; } // Validate array type against pixel type. - if (!pixels->isUnsignedByteArray()) { + if (pixels->getType() != ArrayBufferView::TypeUint8) { synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "readPixels", "ArrayBufferView not Uint8Array"); return; } @@ -3307,9 +3309,10 @@ void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC m_context->readPixels(x, y, width, height, format, type, data); } -#if OS(DARWIN) - // FIXME: remove this section when GL driver bug on Mac is fixed, i.e., - // when alpha is off, readPixels should set alpha to 255 instead of 0. +#if OS(DARWIN) || OS(QNX) + // FIXME: remove this section when GL driver bug on Mac AND the GLES driver bug + // on QC & Imagination QNX is fixed, i.e., when alpha is off, readPixels should + // set alpha to 255 instead of 0. if (!m_framebufferBinding && !m_context->getContextAttributes().alpha) { unsigned char* pixels = reinterpret_cast<unsigned char*>(data); for (GC3Dsizei iy = 0; iy < height; ++iy) { @@ -4934,7 +4937,7 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GC3Din switch (type) { case GraphicsContext3D::UNSIGNED_BYTE: - if (!pixels->isUnsignedByteArray()) { + if (pixels->getType() != ArrayBufferView::TypeUint8) { synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type UNSIGNED_BYTE but ArrayBufferView not Uint8Array"); return false; } @@ -4942,13 +4945,13 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GC3Din case GraphicsContext3D::UNSIGNED_SHORT_5_6_5: case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4: case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1: - if (!pixels->isUnsignedShortArray()) { + if (pixels->getType() != ArrayBufferView::TypeUint16) { synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type UNSIGNED_SHORT but ArrayBufferView not Uint16Array"); return false; } break; case GraphicsContext3D::FLOAT: // OES_texture_float - if (!pixels->isFloatArray()) { + if (pixels->getType() != ArrayBufferView::TypeFloat32) { synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type FLOAT but ArrayBufferView not Float32Array"); return false; } @@ -5665,6 +5668,12 @@ void WebGLRenderingContext::enableOrDisable(GC3Denum capability, bool enable) m_context->disable(capability); } +IntSize WebGLRenderingContext::clampedCanvasSize() +{ + return IntSize(clamp(canvas()->width(), 1, m_maxViewportDims[0]), + clamp(canvas()->height(), 1, m_maxViewportDims[1])); +} + } // namespace WebCore #endif // ENABLE(WEBGL) diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h index 7270ec15f..4c890ea21 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.h +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h @@ -721,6 +721,9 @@ public: // Helper for enabling or disabling a capability. void enableOrDisable(GC3Denum capability, bool enable); + // Clamp the width and height to GL_MAX_VIEWPORT_DIMS. + IntSize clampedCanvasSize(); + friend class WebGLStateRestorer; }; diff --git a/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl b/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl index 7cfb80e6e..95294f942 100644 --- a/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl +++ b/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl @@ -29,9 +29,9 @@ module html { interface [ Conditional=WEBGL, ] WebGLShaderPrecisionFormat { - readonly attribute int rangeMin; - readonly attribute int rangeMax; - readonly attribute int precision; + readonly attribute long rangeMin; + readonly attribute long rangeMax; + readonly attribute long precision; }; } diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp index cc8bc29d2..62678722c 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp +++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp @@ -58,36 +58,32 @@ namespace WebCore { using namespace HTMLNames; -namespace { - -bool hasImpliedEndTag(ContainerNode* node) +static bool hasImpliedEndTag(const HTMLStackItem* item) { - return node->hasTagName(ddTag) - || node->hasTagName(dtTag) - || node->hasTagName(liTag) - || node->hasTagName(optionTag) - || node->hasTagName(optgroupTag) - || node->hasTagName(pTag) - || node->hasTagName(rpTag) - || node->hasTagName(rtTag); + return item->hasTagName(ddTag) + || item->hasTagName(dtTag) + || item->hasTagName(liTag) + || item->hasTagName(optionTag) + || item->hasTagName(optgroupTag) + || item->hasTagName(pTag) + || item->hasTagName(rpTag) + || item->hasTagName(rtTag); } -bool causesFosterParenting(const QualifiedName& tagName) +static bool causesFosterParenting(const HTMLStackItem* item) { - return tagName == tableTag - || tagName == tbodyTag - || tagName == tfootTag - || tagName == theadTag - || tagName == trTag; + return item->hasTagName(tableTag) + || item->hasTagName(tbodyTag) + || item->hasTagName(tfootTag) + || item->hasTagName(theadTag) + || item->hasTagName(trTag); } -inline bool isAllWhitespace(const String& string) +static inline bool isAllWhitespace(const String& string) { return string.isAllSpecialCharacters<isHTMLSpace>(); } -} // namespace - static inline void executeTask(HTMLConstructionSiteTask& task) { if (task.nextChild) @@ -210,7 +206,7 @@ void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken* if (token->attributes().isEmpty()) return; - ElementAttributeData* elementAttributeData = element->ensureAttributeData(); + ElementAttributeData* elementAttributeData = element->mutableAttributeData(); for (unsigned i = 0; i < token->attributes().size(); ++i) { const Attribute& tokenAttribute = token->attributes().at(i); @@ -465,13 +461,13 @@ void HTMLConstructionSite::reconstructTheActiveFormattingElements() void HTMLConstructionSite::generateImpliedEndTagsWithExclusion(const AtomicString& tagName) { - while (hasImpliedEndTag(currentNode()) && !currentNode()->hasLocalName(tagName)) + while (hasImpliedEndTag(currentStackItem()) && !currentStackItem()->hasLocalName(tagName)) m_openElements.pop(); } void HTMLConstructionSite::generateImpliedEndTags() { - while (hasImpliedEndTag(currentNode())) + while (hasImpliedEndTag(currentStackItem())) m_openElements.pop(); } @@ -495,8 +491,8 @@ void HTMLConstructionSite::findFosterSite(HTMLConstructionSiteTask& task) bool HTMLConstructionSite::shouldFosterParent() const { return m_redirectAttachToFosterParent - && currentNode()->isElementNode() - && causesFosterParenting(currentElement()->tagQName()); + && currentStackItem()->isElementNode() + && causesFosterParenting(currentStackItem()); } void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node) diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.h b/Source/WebCore/html/parser/HTMLConstructionSite.h index a43668b1a..656e7987b 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.h +++ b/Source/WebCore/html/parser/HTMLConstructionSite.h @@ -44,14 +44,6 @@ struct HTMLConstructionSiteTask { { } - void take(HTMLConstructionSiteTask& other) - { - parent = other.parent.release(); - nextChild = other.nextChild.release(); - child = other.child.release(); - selfClosing = other.selfClosing; - } - RefPtr<ContainerNode> parent; RefPtr<Node> nextChild; RefPtr<Node> child; @@ -121,6 +113,7 @@ public: HTMLElementStack::ElementRecord* currentElementRecord() const { return m_openElements.topRecord(); } Element* currentElement() const { return m_openElements.top(); } ContainerNode* currentNode() const { return m_openElements.topNode(); } + HTMLStackItem* currentStackItem() const { return m_openElements.topStackItem(); } Element* oneBelowTop() const { return m_openElements.oneBelowTop(); } HTMLElementStack* openElements() const { return &m_openElements; } diff --git a/Source/WebCore/html/parser/HTMLDocumentParser.cpp b/Source/WebCore/html/parser/HTMLDocumentParser.cpp index 3363287ef..88646e4f5 100644 --- a/Source/WebCore/html/parser/HTMLDocumentParser.cpp +++ b/Source/WebCore/html/parser/HTMLDocumentParser.cpp @@ -45,11 +45,9 @@ namespace WebCore { using namespace HTMLNames; -namespace { - // This is a direct transcription of step 4 from: // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case -HTMLTokenizerState::State tokenizerStateForContextElement(Element* contextElement, bool reportErrors) +static HTMLTokenizerState::State tokenizerStateForContextElement(Element* contextElement, bool reportErrors) { if (!contextElement) return HTMLTokenizerState::DataState; @@ -72,8 +70,6 @@ HTMLTokenizerState::State tokenizerStateForContextElement(Element* contextElemen return HTMLTokenizerState::DataState; } -} // namespace - HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors) : ScriptableDocumentParser(document) , m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(document))) diff --git a/Source/WebCore/html/parser/HTMLElementStack.cpp b/Source/WebCore/html/parser/HTMLElementStack.cpp index 7acab9ae7..df074ffd3 100644 --- a/Source/WebCore/html/parser/HTMLElementStack.cpp +++ b/Source/WebCore/html/parser/HTMLElementStack.cpp @@ -38,89 +38,89 @@ namespace WebCore { using namespace HTMLNames; -namespace { - -inline bool isNumberedHeaderElement(ContainerNode* node) +static inline bool isNumberedHeaderElement(HTMLStackItem* item) { - return node->hasTagName(h1Tag) - || node->hasTagName(h2Tag) - || node->hasTagName(h3Tag) - || node->hasTagName(h4Tag) - || node->hasTagName(h5Tag) - || node->hasTagName(h6Tag); + return item->hasTagName(h1Tag) + || item->hasTagName(h2Tag) + || item->hasTagName(h3Tag) + || item->hasTagName(h4Tag) + || item->hasTagName(h5Tag) + || item->hasTagName(h6Tag); } -inline bool isRootNode(ContainerNode* node) +static inline bool isRootNode(HTMLStackItem* item) { - return node->nodeType() == Node::DOCUMENT_FRAGMENT_NODE - || node->hasTagName(htmlTag); + return item->isDocumentFragmentNode() + || item->hasTagName(htmlTag); } -inline bool isScopeMarker(ContainerNode* node) +namespace { + +inline bool isScopeMarker(HTMLStackItem* item) { - return node->hasTagName(appletTag) - || node->hasTagName(captionTag) - || node->hasTagName(marqueeTag) - || node->hasTagName(objectTag) - || node->hasTagName(tableTag) - || node->hasTagName(tdTag) - || node->hasTagName(thTag) - || node->hasTagName(MathMLNames::miTag) - || node->hasTagName(MathMLNames::moTag) - || node->hasTagName(MathMLNames::mnTag) - || node->hasTagName(MathMLNames::msTag) - || node->hasTagName(MathMLNames::mtextTag) - || node->hasTagName(MathMLNames::annotation_xmlTag) - || node->hasTagName(SVGNames::foreignObjectTag) - || node->hasTagName(SVGNames::descTag) - || node->hasTagName(SVGNames::titleTag) - || isRootNode(node); + return item->hasTagName(appletTag) + || item->hasTagName(captionTag) + || item->hasTagName(marqueeTag) + || item->hasTagName(objectTag) + || item->hasTagName(tableTag) + || item->hasTagName(tdTag) + || item->hasTagName(thTag) + || item->hasTagName(MathMLNames::miTag) + || item->hasTagName(MathMLNames::moTag) + || item->hasTagName(MathMLNames::mnTag) + || item->hasTagName(MathMLNames::msTag) + || item->hasTagName(MathMLNames::mtextTag) + || item->hasTagName(MathMLNames::annotation_xmlTag) + || item->hasTagName(SVGNames::foreignObjectTag) + || item->hasTagName(SVGNames::descTag) + || item->hasTagName(SVGNames::titleTag) + || isRootNode(item); } -inline bool isListItemScopeMarker(ContainerNode* node) +inline bool isListItemScopeMarker(HTMLStackItem* item) { - return isScopeMarker(node) - || node->hasTagName(olTag) - || node->hasTagName(ulTag); + return isScopeMarker(item) + || item->hasTagName(olTag) + || item->hasTagName(ulTag); } -inline bool isTableScopeMarker(ContainerNode* node) +inline bool isTableScopeMarker(HTMLStackItem* item) { - return node->hasTagName(tableTag) - || isRootNode(node); + return item->hasTagName(tableTag) + || isRootNode(item); } -inline bool isTableBodyScopeMarker(ContainerNode* node) +inline bool isTableBodyScopeMarker(HTMLStackItem* item) { - return node->hasTagName(tbodyTag) - || node->hasTagName(tfootTag) - || node->hasTagName(theadTag) - || isRootNode(node); + return item->hasTagName(tbodyTag) + || item->hasTagName(tfootTag) + || item->hasTagName(theadTag) + || isRootNode(item); } -inline bool isTableRowScopeMarker(ContainerNode* node) +inline bool isTableRowScopeMarker(HTMLStackItem* item) { - return node->hasTagName(trTag) - || isRootNode(node); + return item->hasTagName(trTag) + || isRootNode(item); } -inline bool isForeignContentScopeMarker(ContainerNode* node) +inline bool isForeignContentScopeMarker(HTMLStackItem* item) { - return HTMLElementStack::isMathMLTextIntegrationPoint(node) - || HTMLElementStack::isHTMLIntegrationPoint(node) - || isInHTMLNamespace(node); + return HTMLElementStack::isMathMLTextIntegrationPoint(item) + || HTMLElementStack::isHTMLIntegrationPoint(item) + || isInHTMLNamespace(item); } -inline bool isButtonScopeMarker(ContainerNode* node) +inline bool isButtonScopeMarker(HTMLStackItem* item) { - return isScopeMarker(node) - || node->hasTagName(buttonTag); + return isScopeMarker(item) + || item->hasTagName(buttonTag); } -inline bool isSelectScopeMarker(ContainerNode* node) +inline bool isSelectScopeMarker(HTMLStackItem* item) { - return !node->hasTagName(optgroupTag) - && !node->hasTagName(optionTag); + return !item->hasTagName(optgroupTag) + && !item->hasTagName(optionTag); } } @@ -139,7 +139,7 @@ HTMLElementStack::ElementRecord::~ElementRecord() void HTMLElementStack::ElementRecord::replaceElement(PassRefPtr<HTMLStackItem> item) { ASSERT(item); - ASSERT(!m_item || m_item->node()->isElementNode()); + ASSERT(!m_item || m_item->isElementNode()); // FIXME: Should this call finishParsingChildren? m_item = item; } @@ -231,7 +231,7 @@ void HTMLElementStack::popUntilPopped(const AtomicString& tagName) void HTMLElementStack::popUntilNumberedHeaderElementPopped() { - while (!isNumberedHeaderElement(topNode())) + while (!isNumberedHeaderElement(topStackItem())) pop(); pop(); } @@ -251,65 +251,64 @@ void HTMLElementStack::popUntilPopped(Element* element) void HTMLElementStack::popUntilTableScopeMarker() { // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#clear-the-stack-back-to-a-table-context - while (!isTableScopeMarker(topNode())) + while (!isTableScopeMarker(topStackItem())) pop(); } void HTMLElementStack::popUntilTableBodyScopeMarker() { // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#clear-the-stack-back-to-a-table-body-context - while (!isTableBodyScopeMarker(topNode())) + while (!isTableBodyScopeMarker(topStackItem())) pop(); } void HTMLElementStack::popUntilTableRowScopeMarker() { // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#clear-the-stack-back-to-a-table-row-context - while (!isTableRowScopeMarker(topNode())) + while (!isTableRowScopeMarker(topStackItem())) pop(); } // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#mathml-text-integration-point -bool HTMLElementStack::isMathMLTextIntegrationPoint(ContainerNode* node) +bool HTMLElementStack::isMathMLTextIntegrationPoint(HTMLStackItem* item) { - if (!node->isElementNode()) + if (!item->isElementNode()) return false; - Element* element = static_cast<Element*>(node); - return element->hasTagName(MathMLNames::miTag) - || element->hasTagName(MathMLNames::moTag) - || element->hasTagName(MathMLNames::mnTag) - || element->hasTagName(MathMLNames::msTag) - || element->hasTagName(MathMLNames::mtextTag); + return item->hasTagName(MathMLNames::miTag) + || item->hasTagName(MathMLNames::moTag) + || item->hasTagName(MathMLNames::mnTag) + || item->hasTagName(MathMLNames::msTag) + || item->hasTagName(MathMLNames::mtextTag); } // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#html-integration-point -bool HTMLElementStack::isHTMLIntegrationPoint(ContainerNode* node) +bool HTMLElementStack::isHTMLIntegrationPoint(HTMLStackItem* item) { - if (!node->isElementNode()) + if (!item->isElementNode()) + return false; + if (item->hasTagName(MathMLNames::annotation_xmlTag)) { + Attribute* encodingAttr = item->token()->getAttributeItem(MathMLNames::encodingAttr); + if (encodingAttr) { + const String& encoding = encodingAttr->value(); + return equalIgnoringCase(encoding, "text/html") + || equalIgnoringCase(encoding, "application/xhtml+xml"); + } return false; - Element* element = static_cast<Element*>(node); - if (element->hasTagName(MathMLNames::annotation_xmlTag)) { - // FIXME: Technically we shouldn't read back from the DOM here. - // Instead, we're supposed to track this information in the element - // stack, which lets the parser run on its own thread. - String encoding = element->fastGetAttribute(MathMLNames::encodingAttr); - return equalIgnoringCase(encoding, "text/html") - || equalIgnoringCase(encoding, "application/xhtml+xml"); } - return element->hasTagName(SVGNames::foreignObjectTag) - || element->hasTagName(SVGNames::descTag) - || element->hasTagName(SVGNames::titleTag); + return item->hasTagName(SVGNames::foreignObjectTag) + || item->hasTagName(SVGNames::descTag) + || item->hasTagName(SVGNames::titleTag); } void HTMLElementStack::popUntilForeignContentScopeMarker() { - while (!isForeignContentScopeMarker(topNode())) + while (!isForeignContentScopeMarker(topStackItem())) pop(); } void HTMLElementStack::pushRootNode(PassRefPtr<HTMLStackItem> rootItem) { - ASSERT(rootItem->node()->nodeType() == Node::DOCUMENT_FRAGMENT_NODE); + ASSERT(rootItem->isDocumentFragmentNode()); pushRootNodeCommon(rootItem); } @@ -389,7 +388,7 @@ Element* HTMLElementStack::oneBelowTop() const // We should never call this if there are fewer than 2 elements on the stack. ASSERT(m_top); ASSERT(m_top->next()); - if (m_top->next()->node()->isElementNode()) + if (m_top->next()->stackItem()->isElementNode()) return m_top->next()->element(); return 0; } @@ -432,7 +431,7 @@ HTMLElementStack::ElementRecord* HTMLElementStack::find(Element* element) const HTMLElementStack::ElementRecord* HTMLElementStack::topmost(const AtomicString& tagName) const { for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { - if (pos->node()->hasLocalName(tagName)) + if (pos->stackItem()->hasLocalName(tagName)) return pos; } return 0; @@ -448,14 +447,14 @@ bool HTMLElementStack::contains(const AtomicString& tagName) const return !!topmost(tagName); } -template <bool isMarker(ContainerNode*)> +template <bool isMarker(HTMLStackItem*)> bool inScopeCommon(HTMLElementStack::ElementRecord* top, const AtomicString& targetTag) { for (HTMLElementStack::ElementRecord* pos = top; pos; pos = pos->next()) { - ContainerNode* node = pos->node(); - if (node->hasLocalName(targetTag)) + HTMLStackItem* item = pos->stackItem().get(); + if (item->hasLocalName(targetTag)) return true; - if (isMarker(node)) + if (isMarker(item)) return false; } ASSERT_NOT_REACHED(); // <html> is always on the stack and is a scope marker. @@ -465,10 +464,10 @@ bool inScopeCommon(HTMLElementStack::ElementRecord* top, const AtomicString& tar bool HTMLElementStack::hasNumberedHeaderElementInScope() const { for (ElementRecord* record = m_top.get(); record; record = record->next()) { - ContainerNode* node = record->node(); - if (isNumberedHeaderElement(node)) + HTMLStackItem* item = record->stackItem().get(); + if (isNumberedHeaderElement(item)) return true; - if (isScopeMarker(node)) + if (isScopeMarker(item)) return false; } ASSERT_NOT_REACHED(); // <html> is always on the stack and is a scope marker. @@ -478,10 +477,10 @@ bool HTMLElementStack::hasNumberedHeaderElementInScope() const bool HTMLElementStack::inScope(Element* targetElement) const { for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) { - ContainerNode* node = pos->node(); - if (node == targetElement) + HTMLStackItem* item = pos->stackItem().get(); + if (item->node() == targetElement) return true; - if (isScopeMarker(node)) + if (isScopeMarker(item)) return false; } ASSERT_NOT_REACHED(); // <html> is always on the stack and is a scope marker. diff --git a/Source/WebCore/html/parser/HTMLElementStack.h b/Source/WebCore/html/parser/HTMLElementStack.h index 6e3125130..f19bc3001 100644 --- a/Source/WebCore/html/parser/HTMLElementStack.h +++ b/Source/WebCore/html/parser/HTMLElementStack.h @@ -92,6 +92,12 @@ public: return m_top->node(); } + HTMLStackItem* topStackItem() const + { + ASSERT(m_top->stackItem()); + return m_top->stackItem().get(); + } + Element* oneBelowTop() const; ElementRecord* topRecord() const; Element* bottom() const; @@ -120,8 +126,8 @@ public: void popHTMLBodyElement(); void popAll(); - static bool isMathMLTextIntegrationPoint(ContainerNode*); - static bool isHTMLIntegrationPoint(ContainerNode*); + static bool isMathMLTextIntegrationPoint(HTMLStackItem*); + static bool isHTMLIntegrationPoint(HTMLStackItem*); void remove(Element*); void removeHTMLHeadElement(Element*); @@ -175,12 +181,12 @@ private: unsigned m_stackDepth; }; -inline bool isInHTMLNamespace(Node* node) +inline bool isInHTMLNamespace(const HTMLStackItem* item) { // A DocumentFragment takes the place of the document element when parsing // fragments and should be considered in the HTML namespace. - return node->namespaceURI() == HTMLNames::xhtmlNamespaceURI - || node->nodeType() == Node::DOCUMENT_FRAGMENT_NODE; // FIXME: Does this also apply to ShadowRoot? + return item->namespaceURI() == HTMLNames::xhtmlNamespaceURI + || item->isDocumentFragmentNode(); // FIXME: Does this also apply to ShadowRoot? } diff --git a/Source/WebCore/html/parser/HTMLEntityParser.cpp b/Source/WebCore/html/parser/HTMLEntityParser.cpp index bb32f7f34..442cedbc2 100644 --- a/Source/WebCore/html/parser/HTMLEntityParser.cpp +++ b/Source/WebCore/html/parser/HTMLEntityParser.cpp @@ -37,8 +37,6 @@ using namespace WTF; namespace WebCore { -namespace { - static const UChar windowsLatin1ExtensionArray[32] = { 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F @@ -46,7 +44,7 @@ static const UChar windowsLatin1ExtensionArray[32] = { 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178, // 98-9F }; -inline bool isAlphaNumeric(UChar cc) +static inline bool isAlphaNumeric(UChar cc) { return (cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z'); } @@ -137,8 +135,6 @@ public: } }; -} - bool consumeHTMLEntity(SegmentedString& source, StringBuilder& decodedEntity, bool& notEnoughCharacters, UChar additionalAllowedCharacter) { return consumeCharacterReference<HTMLEntityParser>(source, decodedEntity, notEnoughCharacters, additionalAllowedCharacter); diff --git a/Source/WebCore/html/parser/HTMLEntitySearch.cpp b/Source/WebCore/html/parser/HTMLEntitySearch.cpp index 57bc4e205..6bfb99563 100644 --- a/Source/WebCore/html/parser/HTMLEntitySearch.cpp +++ b/Source/WebCore/html/parser/HTMLEntitySearch.cpp @@ -30,15 +30,11 @@ namespace WebCore { -namespace { - -const HTMLEntityTableEntry* halfway(const HTMLEntityTableEntry* left, const HTMLEntityTableEntry* right) +static const HTMLEntityTableEntry* halfway(const HTMLEntityTableEntry* left, const HTMLEntityTableEntry* right) { return &left[(right - left) / 2]; } -} - HTMLEntitySearch::HTMLEntitySearch() : m_currentLength(0) , m_mostRecentMatch(0) diff --git a/Source/WebCore/html/parser/HTMLFormattingElementList.cpp b/Source/WebCore/html/parser/HTMLFormattingElementList.cpp index b42cebd6b..1a45fb469 100644 --- a/Source/WebCore/html/parser/HTMLFormattingElementList.cpp +++ b/Source/WebCore/html/parser/HTMLFormattingElementList.cpp @@ -40,9 +40,9 @@ namespace WebCore { // Noah's Ark of Formatting Elements can fit three of each element. static const size_t kNoahsArkCapacity = 3; -static inline size_t attributeCountWithoutUpdate(Element* element) +static inline size_t attributeCount(AtomicHTMLToken* token) { - return element->hasAttributesWithoutUpdate() ? element->attributeCount() : 0; + return token->attributes().size(); } HTMLFormattingElementList::HTMLFormattingElementList() @@ -104,7 +104,7 @@ void HTMLFormattingElementList::swapTo(Element* oldElement, PassRefPtr<HTMLStack void HTMLFormattingElementList::append(PassRefPtr<HTMLStackItem> item) { - ensureNoahsArkCondition(item->element()); + ensureNoahsArkCondition(item.get()); m_entries.append(item); } @@ -131,7 +131,7 @@ void HTMLFormattingElementList::clearToLastMarker() } } -void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* newElement, Vector<Element*>& remainingCandidates) +void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(HTMLStackItem* newItem, Vector<HTMLStackItem*>& remainingCandidates) { ASSERT(remainingCandidates.isEmpty()); @@ -140,9 +140,9 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* new // Use a vector with inline capacity to avoid a malloc in the common case // of a quickly ensuring the condition. - Vector<Element*, 10> candidates; + Vector<HTMLStackItem*, 10> candidates; - size_t newElementAttributeCount = attributeCountWithoutUpdate(newElement); + size_t newItemAttributeCount = attributeCount(newItem->token()); for (size_t i = m_entries.size(); i; ) { --i; @@ -151,10 +151,10 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* new break; // Quickly reject obviously non-matching candidates. - Element* candidate = entry.element(); - if (newElement->tagQName() != candidate->tagQName()) + HTMLStackItem* candidate = entry.stackItem().get(); + if (newItem->localName() != candidate->localName() || newItem->namespaceURI() != candidate->namespaceURI()) continue; - if (attributeCountWithoutUpdate(candidate) != newElementAttributeCount) + if (attributeCount(candidate->token()) != newItemAttributeCount) continue; candidates.append(candidate); @@ -166,38 +166,31 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* new remainingCandidates.append(candidates); } -void HTMLFormattingElementList::ensureNoahsArkCondition(Element* newElement) +void HTMLFormattingElementList::ensureNoahsArkCondition(HTMLStackItem* newItem) { - Vector<Element*> candidates; - tryToEnsureNoahsArkConditionQuickly(newElement, candidates); + Vector<HTMLStackItem*> candidates; + tryToEnsureNoahsArkConditionQuickly(newItem, candidates); if (candidates.isEmpty()) return; // We pre-allocate and re-use this second vector to save one malloc per // attribute that we verify. - Vector<Element*> remainingCandidates; + Vector<HTMLStackItem*> remainingCandidates; remainingCandidates.reserveInitialCapacity(candidates.size()); - size_t newElementAttributeCount = attributeCountWithoutUpdate(newElement); - - for (size_t i = 0; i < newElementAttributeCount; ++i) { - Attribute* attribute = newElement->attributeItem(i); + const Vector<Attribute>& attributes = newItem->token()->attributes(); + for (size_t i = 0; i < attributes.size(); ++i) { + const Attribute& attribute = attributes[i]; for (size_t j = 0; j < candidates.size(); ++j) { - Element* candidate = candidates[j]; + HTMLStackItem* candidate = candidates[j]; // These properties should already have been checked by tryToEnsureNoahsArkConditionQuickly. - ASSERT(newElement->attributeCount() == candidate->attributeCount()); - ASSERT(newElement->tagQName() == candidate->tagQName()); - - // FIXME: Technically we shouldn't read this information back from - // the DOM. Instead, the parser should keep a copy of the information. - // This isn't really much of a problem for our implementation because - // we run the parser on the main thread, but the spec is written so - // that implementations can run off the main thread. If JavaScript - // changes the attributes values, we could get a slightly wrong - // output here. - if (candidate->fastGetAttribute(attribute->name()) == attribute->value()) + ASSERT(attributeCount(newItem->token()) == attributeCount(candidate->token())); + ASSERT(newItem->localName() == candidate->localName() && newItem->namespaceURI() == candidate->namespaceURI()); + + Attribute* candidateAttribute = candidate->token()->getAttributeItem(attribute.name()); + if (candidateAttribute && candidateAttribute->value() == attribute.value()) remainingCandidates.append(candidate); } @@ -212,7 +205,7 @@ void HTMLFormattingElementList::ensureNoahsArkCondition(Element* newElement) // however, that we wil spin the loop more than once because of how the // formatting element list gets permuted. for (size_t i = kNoahsArkCapacity - 1; i < candidates.size(); ++i) - remove(candidates[i]); + remove(candidates[i]->element()); } #ifndef NDEBUG diff --git a/Source/WebCore/html/parser/HTMLFormattingElementList.h b/Source/WebCore/html/parser/HTMLFormattingElementList.h index 9f3545d25..35ac17cc2 100644 --- a/Source/WebCore/html/parser/HTMLFormattingElementList.h +++ b/Source/WebCore/html/parser/HTMLFormattingElementList.h @@ -130,8 +130,8 @@ private: // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#list-of-active-formatting-elements // These functions enforce the "Noah's Ark" condition, which removes redundant mis-nested elements. - void tryToEnsureNoahsArkConditionQuickly(Element*, Vector<Element*>& remainingCandiates); - void ensureNoahsArkCondition(Element*); + void tryToEnsureNoahsArkConditionQuickly(HTMLStackItem*, Vector<HTMLStackItem*>& remainingCandiates); + void ensureNoahsArkCondition(HTMLStackItem*); Vector<Entry> m_entries; }; diff --git a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp index bbe886728..38061ff6f 100644 --- a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp +++ b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp @@ -43,8 +43,6 @@ namespace WebCore { using namespace HTMLNames; -namespace { - class PreloadTask { public: explicit PreloadTask(const HTMLToken& token) @@ -151,8 +149,6 @@ private: bool m_inputIsImage; }; -} // namespace - HTMLPreloadScanner::HTMLPreloadScanner(Document* document) : m_document(document) , m_cssScanner(document) diff --git a/Source/WebCore/html/parser/HTMLStackItem.h b/Source/WebCore/html/parser/HTMLStackItem.h index 7dc760730..05b221042 100644 --- a/Source/WebCore/html/parser/HTMLStackItem.h +++ b/Source/WebCore/html/parser/HTMLStackItem.h @@ -40,10 +40,15 @@ class ContainerNode; class HTMLStackItem : public RefCounted<HTMLStackItem> { public: - // DocumentFragment case. - static PassRefPtr<HTMLStackItem> create(PassRefPtr<ContainerNode> node) + enum ItemType { + ItemForContextElement, + ItemForDocumentFragmentNode + }; + + // Used by document fragment node and context element. + static PassRefPtr<HTMLStackItem> create(PassRefPtr<ContainerNode> node, ItemType type) { - return adoptRef(new HTMLStackItem(node)); + return adoptRef(new HTMLStackItem(node, type)); } // Used by HTMLElementStack and HTMLFormattingElementList. @@ -55,14 +60,35 @@ public: Element* element() const { return toElement(m_node.get()); } ContainerNode* node() const { return m_node.get(); } + bool isDocumentFragmentNode() const { return m_isDocumentFragmentNode; } + bool isElementNode() const { return !m_isDocumentFragmentNode; } + AtomicHTMLToken* token() { return m_token.get(); } const AtomicString& namespaceURI() const { return m_namespaceURI; } + const AtomicString& localName() const { return m_token->name(); } + + bool hasLocalName(const AtomicString& name) const { return m_token->name() == name; } + bool hasTagName(const QualifiedName& name) const { return m_token->name() == name.localName() && m_namespaceURI == name.namespaceURI(); } private: - HTMLStackItem(PassRefPtr<ContainerNode> node) + HTMLStackItem(PassRefPtr<ContainerNode> node, ItemType type) : m_node(node) - , m_isDocumentFragmentNode(true) { + switch (type) { + case ItemForDocumentFragmentNode: + // Create a fake token for a document fragment node. This looks ugly but required for performance + // because we want to use m_token->name() in localName(), hasLocalName() and hasTagName() without + // checking m_isDocumentFragmentNode flag. + m_token = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, nullAtom); + m_isDocumentFragmentNode = true; + break; + case ItemForContextElement: + // Create a fake token for a context element for the same reason as above. + m_token = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, m_node->localName()); + m_namespaceURI = m_node->namespaceURI(); + m_isDocumentFragmentNode = false; + break; + } } HTMLStackItem(PassRefPtr<ContainerNode> node, PassRefPtr<AtomicHTMLToken> token, const AtomicString& namespaceURI = HTMLNames::xhtmlNamespaceURI) diff --git a/Source/WebCore/html/parser/HTMLTokenizer.cpp b/Source/WebCore/html/parser/HTMLTokenizer.cpp index d703129e7..f1e10852a 100644 --- a/Source/WebCore/html/parser/HTMLTokenizer.cpp +++ b/Source/WebCore/html/parser/HTMLTokenizer.cpp @@ -67,16 +67,14 @@ bool AtomicMarkupTokenBase<HTMLToken>::usesAttributes() const return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag; } -namespace { - -inline UChar toLowerCase(UChar cc) +static inline UChar toLowerCase(UChar cc) { ASSERT(isASCIIUpper(cc)); const int lowerCaseOffset = 0x20; return cc + lowerCaseOffset; } -inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& string) +static inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& string) { if (vector.size() != string.length()) return false; @@ -86,7 +84,7 @@ inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& st return !memcmp(stringData, vectorData, vector.size() * sizeof(UChar)); } -inline bool isEndTagBufferingState(HTMLTokenizerState::State state) +static inline bool isEndTagBufferingState(HTMLTokenizerState::State state) { switch (state) { case HTMLTokenizerState::RCDATAEndTagOpenState: @@ -103,8 +101,6 @@ inline bool isEndTagBufferingState(HTMLTokenizerState::State state) } } -} - #define HTML_BEGIN_STATE(stateName) BEGIN_STATE(HTMLTokenizerState, stateName) #define HTML_RECONSUME_IN(stateName) RECONSUME_IN(HTMLTokenizerState, stateName) #define HTML_ADVANCE_TO(stateName) ADVANCE_TO(HTMLTokenizerState, stateName) diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 729388d58..3526acafc 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -57,11 +57,6 @@ namespace WebCore { using namespace HTMLNames; -static TextPosition uninitializedPositionValue1() -{ - return TextPosition(OrdinalNumber::fromOneBasedInt(-1), OrdinalNumber::first()); -} - namespace { inline bool isHTMLSpaceOrReplacementCharacter(UChar character) @@ -69,17 +64,24 @@ inline bool isHTMLSpaceOrReplacementCharacter(UChar character) return isHTMLSpace(character) || character == replacementCharacter; } -inline bool isAllWhitespace(const String& string) +} + +static TextPosition uninitializedPositionValue1() +{ + return TextPosition(OrdinalNumber::fromOneBasedInt(-1), OrdinalNumber::first()); +} + +static inline bool isAllWhitespace(const String& string) { return string.isAllSpecialCharacters<isHTMLSpace>(); } -inline bool isAllWhitespaceOrReplacementCharacters(const String& string) +static inline bool isAllWhitespaceOrReplacementCharacters(const String& string) { return string.isAllSpecialCharacters<isHTMLSpaceOrReplacementCharacter>(); } -bool isNumberedHeaderTag(const AtomicString& tagName) +static bool isNumberedHeaderTag(const AtomicString& tagName) { return tagName == h1Tag || tagName == h2Tag @@ -89,19 +91,19 @@ bool isNumberedHeaderTag(const AtomicString& tagName) || tagName == h6Tag; } -bool isCaptionColOrColgroupTag(const AtomicString& tagName) +static bool isCaptionColOrColgroupTag(const AtomicString& tagName) { return tagName == captionTag || tagName == colTag || tagName == colgroupTag; } -bool isTableCellContextTag(const AtomicString& tagName) +static bool isTableCellContextTag(const AtomicString& tagName) { return tagName == thTag || tagName == tdTag; } -bool isTableBodyContextTag(const AtomicString& tagName) +static bool isTableBodyContextTag(const AtomicString& tagName) { return tagName == tbodyTag || tagName == tfootTag @@ -109,23 +111,23 @@ bool isTableBodyContextTag(const AtomicString& tagName) } // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#special -bool isSpecialNode(Node* node) -{ - if (node->hasTagName(MathMLNames::miTag) - || node->hasTagName(MathMLNames::moTag) - || node->hasTagName(MathMLNames::mnTag) - || node->hasTagName(MathMLNames::msTag) - || node->hasTagName(MathMLNames::mtextTag) - || node->hasTagName(MathMLNames::annotation_xmlTag) - || node->hasTagName(SVGNames::foreignObjectTag) - || node->hasTagName(SVGNames::descTag) - || node->hasTagName(SVGNames::titleTag)) +static bool isSpecialNode(const HTMLStackItem* item) +{ + if (item->hasTagName(MathMLNames::miTag) + || item->hasTagName(MathMLNames::moTag) + || item->hasTagName(MathMLNames::mnTag) + || item->hasTagName(MathMLNames::msTag) + || item->hasTagName(MathMLNames::mtextTag) + || item->hasTagName(MathMLNames::annotation_xmlTag) + || item->hasTagName(SVGNames::foreignObjectTag) + || item->hasTagName(SVGNames::descTag) + || item->hasTagName(SVGNames::titleTag)) return true; - if (node->nodeType() == Node::DOCUMENT_FRAGMENT_NODE) + if (item->isDocumentFragmentNode()) return true; - if (!isInHTMLNamespace(node)) + if (!isInHTMLNamespace(item)) return false; - const AtomicString& tagName = node->localName(); + const AtomicString& tagName = item->localName(); return tagName == addressTag || tagName == appletTag || tagName == areaTag @@ -200,7 +202,7 @@ bool isSpecialNode(Node* node) || tagName == xmpTag; } -bool isNonAnchorNonNobrFormattingTag(const AtomicString& tagName) +static bool isNonAnchorNonNobrFormattingTag(const AtomicString& tagName) { return tagName == bTag || tagName == bigTag @@ -216,19 +218,19 @@ bool isNonAnchorNonNobrFormattingTag(const AtomicString& tagName) || tagName == uTag; } -bool isNonAnchorFormattingTag(const AtomicString& tagName) +static bool isNonAnchorFormattingTag(const AtomicString& tagName) { return tagName == nobrTag || isNonAnchorNonNobrFormattingTag(tagName); } // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#formatting -bool isFormattingTag(const AtomicString& tagName) +static bool isFormattingTag(const AtomicString& tagName) { return tagName == aTag || isNonAnchorFormattingTag(tagName); } -HTMLFormElement* closestFormAncestor(Element* element) +static HTMLFormElement* closestFormAncestor(Element* element) { while (element) { if (element->hasTagName(formTag)) @@ -241,8 +243,6 @@ HTMLFormElement* closestFormAncestor(Element* element) return 0; } -} // namespace - class HTMLTreeBuilder::ExternalCharacterTokenBuffer { WTF_MAKE_NONCOPYABLE(ExternalCharacterTokenBuffer); public: @@ -381,7 +381,7 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, DocumentFragment* f // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case // For efficiency, we skip step 4.2 ("Let root be a new html element with no attributes") // and instead use the DocumentFragment as a root node. - m_tree.openElements()->pushRootNode(HTMLStackItem::create(fragment)); + m_tree.openElements()->pushRootNode(HTMLStackItem::create(fragment, HTMLStackItem::ItemForDocumentFragmentNode)); resetInsertionModeAppropriately(); m_tree.setForm(closestFormAncestor(contextElement)); } @@ -451,6 +451,12 @@ void HTMLTreeBuilder::constructTreeFromToken(HTMLToken& rawToken) constructTreeFromAtomicToken(token.get()); + // AtomicHTMLToken keeps a pointer to the HTMLToken's buffer instead + // of copying the characters for performance. + // Clear the external characters pointer before the raw token is cleared + // to make sure that we won't have a dangling pointer. + token->clearExternalCharacters(); + if (!rawToken.isUninitialized()) { ASSERT(rawToken.type() == HTMLTokenTypes::Character); rawToken.clear(); @@ -465,9 +471,9 @@ void HTMLTreeBuilder::constructTreeFromAtomicToken(AtomicHTMLToken* token) processToken(token); bool inForeignContent = !m_tree.isEmpty() - && !isInHTMLNamespace(m_tree.currentNode()) - && !HTMLElementStack::isHTMLIntegrationPoint(m_tree.currentNode()) - && !HTMLElementStack::isMathMLTextIntegrationPoint(m_tree.currentNode()); + && !isInHTMLNamespace(m_tree.currentStackItem()) + && !HTMLElementStack::isHTMLIntegrationPoint(m_tree.currentStackItem()) + && !HTMLElementStack::isMathMLTextIntegrationPoint(m_tree.currentStackItem()); m_parser->tokenizer()->setForceNullCharacterReplacement(m_insertionMode == TextMode || inForeignContent); m_parser->tokenizer()->setShouldAllowCDATA(inForeignContent); @@ -531,11 +537,16 @@ void HTMLTreeBuilder::processFakeStartTag(const QualifiedName& tagName, const Ve processStartTag(fakeToken.get()); } +void HTMLTreeBuilder::processFakeEndTag(const AtomicString& tagName) +{ + RefPtr<AtomicHTMLToken> fakeToken = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, tagName); + processEndTag(fakeToken.get()); +} + void HTMLTreeBuilder::processFakeEndTag(const QualifiedName& tagName) { // FIXME: We'll need a fancier conversion than just "localName" for SVG/MathML tags. - RefPtr<AtomicHTMLToken> fakeToken = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, tagName.localName()); - processEndTag(fakeToken.get()); + processFakeEndTag(tagName.localName()); } void HTMLTreeBuilder::processFakeCharacters(const String& characters) @@ -594,32 +605,32 @@ void HTMLTreeBuilder::processIsindexStartTagForInBody(AtomicHTMLToken* token) namespace { -bool isLi(const ContainerNode* element) +bool isLi(const HTMLStackItem* item) { - return element->hasTagName(liTag); + return item->hasTagName(liTag); } -bool isDdOrDt(const ContainerNode* element) +bool isDdOrDt(const HTMLStackItem* item) { - return element->hasTagName(ddTag) - || element->hasTagName(dtTag); + return item->hasTagName(ddTag) + || item->hasTagName(dtTag); } } -template <bool shouldClose(const ContainerNode*)> +template <bool shouldClose(const HTMLStackItem*)> void HTMLTreeBuilder::processCloseWhenNestedTag(AtomicHTMLToken* token) { m_framesetOk = false; HTMLElementStack::ElementRecord* nodeRecord = m_tree.openElements()->topRecord(); while (1) { - RefPtr<ContainerNode> node = nodeRecord->node(); - if (shouldClose(node.get())) { - ASSERT(node->isElementNode()); - processFakeEndTag(toElement(node.get())->tagQName()); + RefPtr<HTMLStackItem> item = nodeRecord->stackItem(); + if (shouldClose(item.get())) { + ASSERT(item->isElementNode()); + processFakeEndTag(item->localName()); break; } - if (isSpecialNode(node.get()) && !node->hasTagName(addressTag) && !node->hasTagName(divTag) && !node->hasTagName(pTag)) + if (isSpecialNode(item.get()) && !item->hasTagName(addressTag) && !item->hasTagName(divTag) && !item->hasTagName(pTag)) break; nodeRecord = nodeRecord->next(); } @@ -627,11 +638,9 @@ void HTMLTreeBuilder::processCloseWhenNestedTag(AtomicHTMLToken* token) m_tree.insertHTMLElement(token); } -namespace { - typedef HashMap<AtomicString, QualifiedName> PrefixedNameToQualifiedNameMap; -void mapLoweredLocalNameToName(PrefixedNameToQualifiedNameMap* map, QualifiedName** names, size_t length) +static void mapLoweredLocalNameToName(PrefixedNameToQualifiedNameMap* map, QualifiedName** names, size_t length) { for (size_t i = 0; i < length; ++i) { const QualifiedName& name = *names[i]; @@ -642,14 +651,13 @@ void mapLoweredLocalNameToName(PrefixedNameToQualifiedNameMap* map, QualifiedNam } } -void adjustSVGTagNameCase(AtomicHTMLToken* token) +static void adjustSVGTagNameCase(AtomicHTMLToken* token) { static PrefixedNameToQualifiedNameMap* caseMap = 0; if (!caseMap) { caseMap = new PrefixedNameToQualifiedNameMap; - size_t length = 0; - QualifiedName** svgTags = SVGNames::getSVGTags(&length); - mapLoweredLocalNameToName(caseMap, svgTags, length); + QualifiedName** svgTags = SVGNames::getSVGTags(); + mapLoweredLocalNameToName(caseMap, svgTags, SVGNames::SVGTagsCount); } const QualifiedName& casedName = caseMap->get(token->name()); @@ -658,14 +666,13 @@ void adjustSVGTagNameCase(AtomicHTMLToken* token) token->setName(casedName.localName()); } -template<QualifiedName** getAttrs(size_t* length)> -void adjustAttributes(AtomicHTMLToken* token) +template<QualifiedName** getAttrs(), unsigned length> +static void adjustAttributes(AtomicHTMLToken* token) { static PrefixedNameToQualifiedNameMap* caseMap = 0; if (!caseMap) { caseMap = new PrefixedNameToQualifiedNameMap; - size_t length = 0; - QualifiedName** attrs = getAttrs(&length); + QualifiedName** attrs = getAttrs(); mapLoweredLocalNameToName(caseMap, attrs, length); } @@ -677,17 +684,17 @@ void adjustAttributes(AtomicHTMLToken* token) } } -void adjustSVGAttributes(AtomicHTMLToken* token) +static void adjustSVGAttributes(AtomicHTMLToken* token) { - adjustAttributes<SVGNames::getSVGAttrs>(token); + adjustAttributes<SVGNames::getSVGAttrs, SVGNames::SVGAttrsCount>(token); } -void adjustMathMLAttributes(AtomicHTMLToken* token) +static void adjustMathMLAttributes(AtomicHTMLToken* token) { - adjustAttributes<MathMLNames::getMathMLAttrs>(token); + adjustAttributes<MathMLNames::getMathMLAttrs, MathMLNames::MathMLAttrsCount>(token); } -void addNamesWithPrefix(PrefixedNameToQualifiedNameMap* map, const AtomicString& prefix, QualifiedName** names, size_t length) +static void addNamesWithPrefix(PrefixedNameToQualifiedNameMap* map, const AtomicString& prefix, QualifiedName** names, size_t length) { for (size_t i = 0; i < length; ++i) { QualifiedName* name = names[i]; @@ -698,17 +705,16 @@ void addNamesWithPrefix(PrefixedNameToQualifiedNameMap* map, const AtomicString& } } -void adjustForeignAttributes(AtomicHTMLToken* token) +static void adjustForeignAttributes(AtomicHTMLToken* token) { static PrefixedNameToQualifiedNameMap* map = 0; if (!map) { map = new PrefixedNameToQualifiedNameMap; - size_t length = 0; - QualifiedName** attrs = XLinkNames::getXLinkAttrs(&length); - addNamesWithPrefix(map, "xlink", attrs, length); + QualifiedName** attrs = XLinkNames::getXLinkAttrs(); + addNamesWithPrefix(map, "xlink", attrs, XLinkNames::XLinkAttrsCount); - attrs = XMLNames::getXMLAttrs(&length); - addNamesWithPrefix(map, "xml", attrs, length); + attrs = XMLNames::getXMLAttrs(); + addNamesWithPrefix(map, "xml", attrs, XMLNames::XMLAttrsCount); map->add("xmlns", XMLNSNames::xmlnsAttr); map->add("xmlns:xlink", QualifiedName("xmlns", "xlink", XMLNSNames::xmlnsNamespaceURI)); @@ -722,8 +728,6 @@ void adjustForeignAttributes(AtomicHTMLToken* token) } } -} - void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) { ASSERT(token->type() == HTMLTokenTypes::StartTag); @@ -801,7 +805,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) } if (isNumberedHeaderTag(token->name())) { processFakePEndTagIfPInButtonScope(); - if (isNumberedHeaderTag(m_tree.currentNode()->localName())) { + if (isNumberedHeaderTag(m_tree.currentStackItem()->localName())) { parseError(token); m_tree.openElements()->pop(); } @@ -981,7 +985,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) return; } if (token->name() == optgroupTag || token->name() == optionTag) { - if (m_tree.currentNode()->hasTagName(optionTag)) { + if (m_tree.currentStackItem()->hasTagName(optionTag)) { RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optionTag.localName()); processEndTag(endOption.get()); } @@ -992,7 +996,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) if (token->name() == rpTag || token->name() == rtTag) { if (m_tree.openElements()->inScope(rubyTag.localName())) { m_tree.generateImpliedEndTags(); - if (!m_tree.currentNode()->hasTagName(rubyTag)) + if (!m_tree.currentStackItem()->hasTagName(rubyTag)) parseError(token); } m_tree.insertHTMLElement(token); @@ -1259,8 +1263,8 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token) return; } m_tree.openElements()->popUntilTableBodyScopeMarker(); - ASSERT(isTableBodyContextTag(m_tree.currentElement()->localName())); - processFakeEndTag(m_tree.currentElement()->tagQName()); + ASSERT(isTableBodyContextTag(m_tree.currentStackItem()->localName())); + processFakeEndTag(m_tree.currentStackItem()->localName()); processStartTag(token); return; } @@ -1393,7 +1397,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token) return; } if (token->name() == optionTag) { - if (m_tree.currentNode()->hasTagName(optionTag)) { + if (m_tree.currentStackItem()->hasTagName(optionTag)) { RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optionTag.localName()); processEndTag(endOption.get()); } @@ -1401,11 +1405,11 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token) return; } if (token->name() == optgroupTag) { - if (m_tree.currentNode()->hasTagName(optionTag)) { + if (m_tree.currentStackItem()->hasTagName(optionTag)) { RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optionTag.localName()); processEndTag(endOption.get()); } - if (m_tree.currentNode()->hasTagName(optgroupTag)) { + if (m_tree.currentStackItem()->hasTagName(optgroupTag)) { RefPtr<AtomicHTMLToken> endOptgroup = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optgroupTag.localName()); processEndTag(endOptgroup.get()); } @@ -1471,15 +1475,15 @@ void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomicHTMLToken* token) ASSERT(token->type() == HTMLTokenTypes::EndTag); HTMLElementStack::ElementRecord* record = m_tree.openElements()->topRecord(); while (1) { - RefPtr<ContainerNode> node = record->node(); - if (node->hasLocalName(token->name())) { + RefPtr<HTMLStackItem> item = record->stackItem(); + if (item->hasLocalName(token->name())) { m_tree.generateImpliedEndTagsWithExclusion(token->name()); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); - m_tree.openElements()->popUntilPopped(toElement(node.get())); + m_tree.openElements()->popUntilPopped(item->element()); return; } - if (isSpecialNode(node.get())) { + if (isSpecialNode(item.get())) { parseError(token); return; } @@ -1495,7 +1499,7 @@ HTMLElementStack::ElementRecord* HTMLTreeBuilder::furthestBlockForFormattingElem for (; record; record = record->next()) { if (record->element() == formattingElement) return furthestBlock; - if (isSpecialNode(record->element())) + if (isSpecialNode(record->stackItem().get())) furthestBlock = record; } ASSERT_NOT_REACHED(); @@ -1591,7 +1595,7 @@ void HTMLTreeBuilder::callTheAdoptionAgency(AtomicHTMLToken* token) m_tree.fosterParent(lastNode->element()); else { commonAncestor->parserAddChild(lastNode->element()); - ASSERT(lastNode->node()->isElementNode()); + ASSERT(lastNode->stackItem()->isElementNode()); ASSERT(lastNode->element()->parentNode()); if (lastNode->element()->parentNode()->attached() && !lastNode->element()->attached()) lastNode->element()->lazyAttach(); @@ -1625,41 +1629,41 @@ void HTMLTreeBuilder::resetInsertionModeAppropriately() bool last = false; HTMLElementStack::ElementRecord* nodeRecord = m_tree.openElements()->topRecord(); while (1) { - ContainerNode* node = nodeRecord->node(); - if (node == m_tree.openElements()->rootNode()) { + RefPtr<HTMLStackItem> item = nodeRecord->stackItem(); + if (item->node() == m_tree.openElements()->rootNode()) { ASSERT(isParsingFragment()); last = true; - node = m_fragmentContext.contextElement(); + item = HTMLStackItem::create(m_fragmentContext.contextElement(), HTMLStackItem::ItemForContextElement); } - if (node->hasTagName(selectTag)) { + if (item->hasTagName(selectTag)) { ASSERT(isParsingFragment()); return setInsertionMode(InSelectMode); } - if (node->hasTagName(tdTag) || node->hasTagName(thTag)) + if (item->hasTagName(tdTag) || item->hasTagName(thTag)) return setInsertionMode(InCellMode); - if (node->hasTagName(trTag)) + if (item->hasTagName(trTag)) return setInsertionMode(InRowMode); - if (node->hasTagName(tbodyTag) || node->hasTagName(theadTag) || node->hasTagName(tfootTag)) + if (item->hasTagName(tbodyTag) || item->hasTagName(theadTag) || item->hasTagName(tfootTag)) return setInsertionMode(InTableBodyMode); - if (node->hasTagName(captionTag)) + if (item->hasTagName(captionTag)) return setInsertionMode(InCaptionMode); - if (node->hasTagName(colgroupTag)) { + if (item->hasTagName(colgroupTag)) { ASSERT(isParsingFragment()); return setInsertionMode(InColumnGroupMode); } - if (node->hasTagName(tableTag)) + if (item->hasTagName(tableTag)) return setInsertionMode(InTableMode); - if (node->hasTagName(headTag)) { + if (item->hasTagName(headTag)) { ASSERT(isParsingFragment()); return setInsertionMode(InBodyMode); } - if (node->hasTagName(bodyTag)) + if (item->hasTagName(bodyTag)) return setInsertionMode(InBodyMode); - if (node->hasTagName(framesetTag)) { + if (item->hasTagName(framesetTag)) { ASSERT(isParsingFragment()); return setInsertionMode(InFramesetMode); } - if (node->hasTagName(htmlTag)) { + if (item->hasTagName(htmlTag)) { ASSERT(isParsingFragment()); return setInsertionMode(BeforeHeadMode); } @@ -1692,8 +1696,8 @@ void HTMLTreeBuilder::processEndTagForInTableBody(AtomicHTMLToken* token) return; } m_tree.openElements()->popUntilTableBodyScopeMarker(); - ASSERT(isTableBodyContextTag(m_tree.currentElement()->localName())); - processFakeEndTag(m_tree.currentElement()->tagQName()); + ASSERT(isTableBodyContextTag(m_tree.currentStackItem()->localName())); + processFakeEndTag(m_tree.currentStackItem()->localName()); processEndTag(token); return; } @@ -1753,7 +1757,7 @@ void HTMLTreeBuilder::processEndTagForInCell(AtomicHTMLToken* token) return; } m_tree.generateImpliedEndTags(); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); m_tree.openElements()->popUntilPopped(token->name()); m_tree.activeFormattingElements()->clearToLastMarker(); @@ -1823,7 +1827,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token) return; } m_tree.generateImpliedEndTags(); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); m_tree.openElements()->popUntilPopped(token->name()); return; @@ -1848,7 +1852,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token) return; } m_tree.generateImpliedEndTagsWithExclusion(token->name()); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); m_tree.openElements()->popUntilPopped(token->name()); return; @@ -1859,7 +1863,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token) return; } m_tree.generateImpliedEndTagsWithExclusion(token->name()); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); m_tree.openElements()->popUntilPopped(token->name()); return; @@ -1871,7 +1875,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token) return; } m_tree.generateImpliedEndTagsWithExclusion(token->name()); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); m_tree.openElements()->popUntilPopped(token->name()); return; @@ -1882,7 +1886,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token) return; } m_tree.generateImpliedEndTags(); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); m_tree.openElements()->popUntilNumberedHeaderElementPopped(); return; @@ -1899,7 +1903,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token) return; } m_tree.generateImpliedEndTags(); - if (!m_tree.currentNode()->hasLocalName(token->name())) + if (!m_tree.currentStackItem()->hasLocalName(token->name())) parseError(token); m_tree.openElements()->popUntilPopped(token->name()); m_tree.activeFormattingElements()->clearToLastMarker(); @@ -1921,7 +1925,7 @@ bool HTMLTreeBuilder::processCaptionEndTagForInCaption() return false; } m_tree.generateImpliedEndTags(); - // FIXME: parse error if (!m_tree.currentElement()->hasTagName(captionTag)) + // FIXME: parse error if (!m_tree.currentStackItem()->hasTagName(captionTag)) m_tree.openElements()->popUntilPopped(captionTag.localName()); m_tree.activeFormattingElements()->clearToLastMarker(); setInsertionMode(InTableMode); @@ -1936,7 +1940,7 @@ bool HTMLTreeBuilder::processTrEndTagForInRow() return false; } m_tree.openElements()->popUntilTableRowScopeMarker(); - ASSERT(m_tree.currentElement()->hasTagName(trTag)); + ASSERT(m_tree.currentStackItem()->hasTagName(trTag)); m_tree.openElements()->pop(); setInsertionMode(InTableBodyMode); return true; @@ -2104,9 +2108,9 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token) case InHeadNoscriptMode: ASSERT(insertionMode() == InHeadNoscriptMode); if (token->name() == noscriptTag) { - ASSERT(m_tree.currentElement()->hasTagName(noscriptTag)); + ASSERT(m_tree.currentStackItem()->hasTagName(noscriptTag)); m_tree.openElements()->pop(); - ASSERT(m_tree.currentElement()->hasTagName(headTag)); + ASSERT(m_tree.currentStackItem()->hasTagName(headTag)); setInsertionMode(InHeadMode); return; } @@ -2120,7 +2124,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token) case TextMode: if (token->name() == scriptTag) { // Pause ourselves so that parsing stops until the script can be processed by the caller. - ASSERT(m_tree.currentElement()->hasTagName(scriptTag)); + ASSERT(m_tree.currentStackItem()->hasTagName(scriptTag)); m_scriptToProcess = m_tree.currentElement(); m_tree.openElements()->pop(); if (isParsingFragment() && m_fragmentContext.scriptingPermission() == DisallowScriptingContent) @@ -2146,7 +2150,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token) return; } m_tree.openElements()->pop(); - if (!isParsingFragment() && !m_tree.currentElement()->hasTagName(framesetTag)) + if (!isParsingFragment() && !m_tree.currentStackItem()->hasTagName(framesetTag)) setInsertionMode(AfterFramesetMode); return; } @@ -2181,9 +2185,9 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token) case InSelectMode: ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode); if (token->name() == optgroupTag) { - if (m_tree.currentNode()->hasTagName(optionTag) && m_tree.oneBelowTop() && m_tree.oneBelowTop()->hasTagName(optgroupTag)) + if (m_tree.currentStackItem()->hasTagName(optionTag) && m_tree.oneBelowTop() && m_tree.oneBelowTop()->hasTagName(optgroupTag)) processFakeEndTag(optionTag); - if (m_tree.currentNode()->hasTagName(optgroupTag)) { + if (m_tree.currentStackItem()->hasTagName(optgroupTag)) { m_tree.openElements()->pop(); return; } @@ -2191,7 +2195,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token) return; } if (token->name() == optionTag) { - if (m_tree.currentNode()->hasTagName(optionTag)) { + if (m_tree.currentStackItem()->hasTagName(optionTag)) { m_tree.openElements()->pop(); return; } @@ -2323,12 +2327,12 @@ ReprocessBuffer: case InRowMode: { ASSERT(insertionMode() == InTableMode || insertionMode() == InTableBodyMode || insertionMode() == InRowMode); ASSERT(m_pendingTableCharacters.isEmpty()); - if (m_tree.currentNode()->isElementNode() - && (m_tree.currentElement()->hasTagName(HTMLNames::tableTag) - || m_tree.currentElement()->hasTagName(HTMLNames::tbodyTag) - || m_tree.currentElement()->hasTagName(HTMLNames::tfootTag) - || m_tree.currentElement()->hasTagName(HTMLNames::theadTag) - || m_tree.currentElement()->hasTagName(HTMLNames::trTag))) { + if (m_tree.currentStackItem()->isElementNode() + && (m_tree.currentStackItem()->hasTagName(HTMLNames::tableTag) + || m_tree.currentStackItem()->hasTagName(HTMLNames::tbodyTag) + || m_tree.currentStackItem()->hasTagName(HTMLNames::tfootTag) + || m_tree.currentStackItem()->hasTagName(HTMLNames::theadTag) + || m_tree.currentStackItem()->hasTagName(HTMLNames::trTag))) { m_originalInsertionMode = m_insertionMode; setInsertionMode(InTableTextMode); // Note that we fall through to the InTableTextMode case below. @@ -2491,7 +2495,7 @@ void HTMLTreeBuilder::processEndOfFile(AtomicHTMLToken* token) return; case TextMode: parseError(token); - if (m_tree.currentNode()->hasTagName(scriptTag)) + if (m_tree.currentStackItem()->hasTagName(scriptTag)) notImplemented(); // mark the script element as "already started". m_tree.openElements()->pop(); ASSERT(m_originalInsertionMode != TextMode); @@ -2645,10 +2649,10 @@ bool HTMLTreeBuilder::shouldProcessTokenInForeignContent(AtomicHTMLToken* token) { if (m_tree.isEmpty()) return false; - ContainerNode* node = m_tree.currentNode(); - if (isInHTMLNamespace(node)) + HTMLStackItem* item = m_tree.currentStackItem(); + if (isInHTMLNamespace(item)) return false; - if (HTMLElementStack::isMathMLTextIntegrationPoint(node)) { + if (HTMLElementStack::isMathMLTextIntegrationPoint(item)) { if (token->type() == HTMLTokenTypes::StartTag && token->name() != MathMLNames::mglyphTag && token->name() != MathMLNames::malignmarkTag) @@ -2656,11 +2660,11 @@ bool HTMLTreeBuilder::shouldProcessTokenInForeignContent(AtomicHTMLToken* token) if (token->type() == HTMLTokenTypes::Character) return false; } - if (node->hasTagName(MathMLNames::annotation_xmlTag) + if (item->hasTagName(MathMLNames::annotation_xmlTag) && token->type() == HTMLTokenTypes::StartTag && token->name() == SVGNames::svgTag) return false; - if (HTMLElementStack::isHTMLIntegrationPoint(node)) { + if (HTMLElementStack::isHTMLIntegrationPoint(item)) { if (token->type() == HTMLTokenTypes::StartTag) return false; if (token->type() == HTMLTokenTypes::Character) @@ -2726,7 +2730,7 @@ void HTMLTreeBuilder::processTokenInForeignContent(AtomicHTMLToken* token) processStartTag(token); return; } - const AtomicString& currentNamespace = m_tree.currentElement()->namespaceURI(); + const AtomicString& currentNamespace = m_tree.currentStackItem()->namespaceURI(); if (currentNamespace == MathMLNames::mathmlNamespaceURI) adjustMathMLAttributes(token); if (currentNamespace == SVGNames::svgNamespaceURI) { @@ -2738,27 +2742,27 @@ void HTMLTreeBuilder::processTokenInForeignContent(AtomicHTMLToken* token) break; } case HTMLTokenTypes::EndTag: { - if (m_tree.currentNode()->namespaceURI() == SVGNames::svgNamespaceURI) + if (m_tree.currentStackItem()->namespaceURI() == SVGNames::svgNamespaceURI) adjustSVGTagNameCase(token); - if (token->name() == SVGNames::scriptTag && m_tree.currentNode()->hasTagName(SVGNames::scriptTag)) { + if (token->name() == SVGNames::scriptTag && m_tree.currentStackItem()->hasTagName(SVGNames::scriptTag)) { m_scriptToProcess = m_tree.currentElement(); m_tree.openElements()->pop(); return; } - if (!isInHTMLNamespace(m_tree.currentNode())) { + if (!isInHTMLNamespace(m_tree.currentStackItem())) { // FIXME: This code just wants an Element* iterator, instead of an ElementRecord* HTMLElementStack::ElementRecord* nodeRecord = m_tree.openElements()->topRecord(); - if (!nodeRecord->node()->hasLocalName(token->name())) + if (!nodeRecord->stackItem()->hasLocalName(token->name())) parseError(token); while (1) { - if (nodeRecord->node()->hasLocalName(token->name())) { + if (nodeRecord->stackItem()->hasLocalName(token->name())) { m_tree.openElements()->popUntilPopped(nodeRecord->element()); return; } nodeRecord = nodeRecord->next(); - if (isInHTMLNamespace(nodeRecord->node())) + if (isInHTMLNamespace(nodeRecord->stackItem().get())) break; } } diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.h b/Source/WebCore/html/parser/HTMLTreeBuilder.h index 3f2114c5a..86d229de0 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.h +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.h @@ -152,6 +152,7 @@ private: void processFakeStartTag(const QualifiedName&, const Vector<Attribute>& attributes = Vector<Attribute>()); void processFakeEndTag(const QualifiedName&); + void processFakeEndTag(const AtomicString&); void processFakeCharacters(const String&); void processFakePEndTagIfPInButtonScope(); @@ -178,7 +179,7 @@ private: void closeTheCell(); - template <bool shouldClose(const ContainerNode*)> + template <bool shouldClose(const HTMLStackItem*)> void processCloseWhenNestedTag(AtomicHTMLToken*); bool m_framesetOk; diff --git a/Source/WebCore/html/shadow/CalendarPickerElement.cpp b/Source/WebCore/html/shadow/CalendarPickerElement.cpp index ea9fbb7b3..b7ea32f28 100644 --- a/Source/WebCore/html/shadow/CalendarPickerElement.cpp +++ b/Source/WebCore/html/shadow/CalendarPickerElement.cpp @@ -37,7 +37,6 @@ #include "Chrome.h" #include "ChromeClient.h" #include "DateComponents.h" -#include "DocumentWriter.h" #include "Event.h" #include "FrameView.h" #include "HTMLInputElement.h" @@ -143,67 +142,6 @@ IntSize CalendarPickerElement::contentSize() return IntSize(100, 100); } -#define addLiteral(literal, writer) writer.addData(literal, sizeof(literal) - 1) - -static inline void addString(const String& str, DocumentWriter& writer) -{ - CString str8 = str.utf8(); - writer.addData(str8.data(), str8.length()); -} - -static void addJavaScriptString(const String& str, DocumentWriter& writer) -{ - addLiteral("\"", writer); - StringBuilder builder; - builder.reserveCapacity(str.length()); - for (unsigned i = 0; i < str.length(); ++i) { - if (str[i] == '\\' || str[i] == '"') - builder.append('\\'); - builder.append(str[i]); - } - addString(builder.toString(), writer); - addLiteral("\"", writer); -} - -static void addProperty(const char* name, const String& value, DocumentWriter& writer) -{ - writer.addData(name, strlen(name)); - addLiteral(": ", writer); - addJavaScriptString(value, writer); - addLiteral(",\n", writer); -} - -static void addProperty(const char* name, unsigned value, DocumentWriter& writer) -{ - writer.addData(name, strlen(name)); - addLiteral(": ", writer); - addString(String::number(value), writer); - addLiteral(",\n", writer); -} - -static void addProperty(const char* name, bool value, DocumentWriter& writer) -{ - writer.addData(name, strlen(name)); - addLiteral(": ", writer); - if (value) - addLiteral("true", writer); - else - addLiteral("false", writer); - addLiteral(",\n", writer); -} - -static void addProperty(const char* name, const Vector<String>& values, DocumentWriter& writer) -{ - writer.addData(name, strlen(name)); - addLiteral(": [", writer); - for (unsigned i = 0; i < values.size(); ++i) { - if (i) - addLiteral(",", writer); - addJavaScriptString(values[i], writer); - } - addLiteral("],\n", writer); -} - void CalendarPickerElement::writeDocument(DocumentWriter& writer) { HTMLInputElement* input = hostInput(); @@ -217,14 +155,14 @@ void CalendarPickerElement::writeDocument(DocumentWriter& writer) if (stepString.isEmpty() || !input->getAllowedValueStep(&step)) stepString = "1"; - addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); + addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); writer.addData(calendarPickerCss, sizeof(calendarPickerCss)); if (document()->page()) { CString extraStyle = document()->page()->theme()->extraCalendarPickerStyleSheet(); if (extraStyle.length()) writer.addData(extraStyle.data(), extraStyle.length()); } - addLiteral("</style></head><body><div id=main>Loading...</div><script>\n" + addString("</style></head><body><div id=main>Loading...</div><script>\n" "window.dialogArguments = {\n", writer); addProperty("min", minString, writer); addProperty("max", maxString, writer); @@ -239,10 +177,10 @@ void CalendarPickerElement::writeDocument(DocumentWriter& writer) addProperty("dayLabels", weekDayShortLabels(), writer); Direction dir = direction(monthLabels()[0][0]); addProperty("isRTL", dir == RightToLeft || dir == RightToLeftArabic, writer); - addLiteral("}\n", writer); + addString("}\n", writer); writer.addData(calendarPickerJs, sizeof(calendarPickerJs)); - addLiteral("</script></body>\n", writer); + addString("</script></body>\n", writer); } void CalendarPickerElement::setValueAndClosePopup(int numValue, const String& stringValue) diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp index 731449610..2c4bd9e91 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -612,6 +612,46 @@ const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const // ---------------------------- +inline MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Document* document) + : MediaControlInputElement(document, MediaOverlayPlayButton) +{ +} + +PassRefPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlayPlayButtonElement::create(Document* document) +{ + RefPtr<MediaControlOverlayPlayButtonElement> button = adoptRef(new MediaControlOverlayPlayButtonElement(document)); + button->createShadowSubtree(); + button->setType("button"); + return button.release(); +} + +void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event) +{ + if (event->type() == eventNames().clickEvent && mediaController()->canPlay()) { + mediaController()->play(); + updateDisplayType(); + event->setDefaultHandled(); + } + HTMLInputElement::defaultEventHandler(event); +} + +void MediaControlOverlayPlayButtonElement::updateDisplayType() +{ + if (mediaController()->canPlay()) { + show(); + setDisplayType(MediaOverlayPlayButton); + } else + hide(); +} + +const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const +{ + DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play-button")); + return id; +} + +// ---------------------------- + inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* document, MediaControlElementType displayType) : MediaControlInputElement(document, displayType) , m_actionOnStop(Nothing) diff --git a/Source/WebCore/html/shadow/MediaControlElements.h b/Source/WebCore/html/shadow/MediaControlElements.h index efdb21f0d..c1514e231 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.h +++ b/Source/WebCore/html/shadow/MediaControlElements.h @@ -74,6 +74,7 @@ enum MediaControlElementType { MediaTextTrackDisplayContainer, MediaTextTrackDisplay, MediaExitFullscreenButton, + MediaOverlayPlayButton, }; HTMLMediaElement* toParentMediaElement(Node*); @@ -271,6 +272,20 @@ private: // ---------------------------- +class MediaControlOverlayPlayButtonElement : public MediaControlInputElement { +public: + static PassRefPtr<MediaControlOverlayPlayButtonElement> create(Document*); + + virtual void defaultEventHandler(Event*); + virtual void updateDisplayType(); + +private: + explicit MediaControlOverlayPlayButtonElement(Document*); + + virtual const AtomicString& shadowPseudoId() const; +}; + +// ---------------------------- class MediaControlSeekButtonElement : public MediaControlInputElement { public: virtual void defaultEventHandler(Event*); diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp index 9f0e8c62e..62f9e8599 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp @@ -49,17 +49,27 @@ namespace WebCore { static const double timeWithoutMouseMovementBeforeHidingControls = 2; MediaControlChromiumEnclosureElement::MediaControlChromiumEnclosureElement(Document* document) - : HTMLDivElement(HTMLNames::divTag, document->document()) - , m_mediaController(0) + : MediaControlElement(document) +{ +} + +MediaControlElementType MediaControlChromiumEnclosureElement::displayType() const { + // Mapping onto same MediaControlElementType as panel element, since it has similar properties. + return MediaControlsPanel; } -PassRefPtr<MediaControlChromiumEnclosureElement> MediaControlChromiumEnclosureElement::create(Document* document) +MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(Document* document) + : MediaControlChromiumEnclosureElement(document) { - return adoptRef(new MediaControlChromiumEnclosureElement(document)); } -const AtomicString& MediaControlChromiumEnclosureElement::shadowPseudoId() const +PassRefPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclosureElement::create(Document* document) +{ + return adoptRef(new MediaControlPanelEnclosureElement(document)); +} + +const AtomicString& MediaControlPanelEnclosureElement::shadowPseudoId() const { DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-enclosure")); return id; @@ -86,10 +96,13 @@ MediaControlRootElementChromium::MediaControlRootElementChromium(Document* docum { } +// MediaControls::create() for Android is defined in MediaControlRootElementChromiumAndroid.cpp. +#if !OS(ANDROID) PassRefPtr<MediaControls> MediaControls::create(Document* document) { return MediaControlRootElementChromium::create(document); } +#endif PassRefPtr<MediaControlRootElementChromium> MediaControlRootElementChromium::create(Document* document) { @@ -98,68 +111,76 @@ PassRefPtr<MediaControlRootElementChromium> MediaControlRootElementChromium::cre RefPtr<MediaControlRootElementChromium> controls = adoptRef(new MediaControlRootElementChromium(document)); + if (controls->initializeControls(document)) + return controls.release(); + + return 0; +} + +bool MediaControlRootElementChromium::initializeControls(Document* document) +{ // Create an enclosing element for the panel so we can visually offset the controls correctly. - RefPtr<MediaControlChromiumEnclosureElement> enclosure = MediaControlChromiumEnclosureElement::create(document); + RefPtr<MediaControlPanelEnclosureElement> enclosure = MediaControlPanelEnclosureElement::create(document); RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(document); ExceptionCode ec; RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonElement::create(document); - controls->m_playButton = playButton.get(); + m_playButton = playButton.get(); panel->appendChild(playButton.release(), ec, true); if (ec) - return 0; + return false; - RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::create(document, controls.get()); - controls->m_timeline = timeline.get(); + RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::create(document, this); + m_timeline = timeline.get(); panel->appendChild(timeline.release(), ec, true); if (ec) - return 0; + return false; RefPtr<MediaControlCurrentTimeDisplayElement> currentTimeDisplay = MediaControlCurrentTimeDisplayElement::create(document); - controls->m_currentTimeDisplay = currentTimeDisplay.get(); - controls->m_currentTimeDisplay->hide(); + m_currentTimeDisplay = currentTimeDisplay.get(); + m_currentTimeDisplay->hide(); panel->appendChild(currentTimeDisplay.release(), ec, true); if (ec) - return 0; + return false; RefPtr<MediaControlTimeRemainingDisplayElement> durationDisplay = MediaControlTimeRemainingDisplayElement::create(document); - controls->m_durationDisplay = durationDisplay.get(); + m_durationDisplay = durationDisplay.get(); panel->appendChild(durationDisplay.release(), ec, true); if (ec) - return 0; + return false; - RefPtr<MediaControlPanelMuteButtonElement> panelMuteButton = MediaControlPanelMuteButtonElement::create(document, controls.get()); - controls->m_panelMuteButton = panelMuteButton.get(); + RefPtr<MediaControlPanelMuteButtonElement> panelMuteButton = MediaControlPanelMuteButtonElement::create(document, this); + m_panelMuteButton = panelMuteButton.get(); panel->appendChild(panelMuteButton.release(), ec, true); if (ec) - return 0; + return false; RefPtr<MediaControlVolumeSliderElement> slider = MediaControlVolumeSliderElement::create(document); - controls->m_volumeSlider = slider.get(); - controls->m_volumeSlider->setClearMutedOnUserInteraction(true); + m_volumeSlider = slider.get(); + m_volumeSlider->setClearMutedOnUserInteraction(true); panel->appendChild(slider.release(), ec, true); if (ec) - return 0; + return false; - RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlFullscreenButtonElement::create(document, controls.get()); - controls->m_fullscreenButton = fullscreenButton.get(); + RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlFullscreenButtonElement::create(document, this); + m_fullscreenButton = fullscreenButton.get(); panel->appendChild(fullscreenButton.release(), ec, true); if (ec) - return 0; + return false; - controls->m_panel = panel.get(); + m_panel = panel.get(); enclosure->appendChild(panel.release(), ec, true); if (ec) - return 0; + return false; - controls->m_enclosure = enclosure.get(); - controls->appendChild(enclosure.release(), ec, true); + m_enclosure = enclosure.get(); + appendChild(enclosure.release(), ec, true); if (ec) - return 0; + return false; - return controls.release(); + return true; } void MediaControlRootElementChromium::setMediaController(MediaControllerInterface* controller) diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h index 2fb4c3cfe..a827f1116 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h @@ -29,6 +29,7 @@ #if ENABLE(VIDEO) +#include "MediaControlElements.h" #include "MediaControls.h" #include <wtf/RefPtr.h> @@ -61,22 +62,21 @@ class MediaControlTextTrackContainerElement; class MediaControlTextTrackDisplayElement; #endif -class MediaControlChromiumEnclosureElement : public HTMLDivElement { -public: - static PassRefPtr<MediaControlChromiumEnclosureElement> create(Document*); - - virtual const AtomicString& shadowPseudoId() const; - - void setMediaController(MediaControllerInterface* controller) { m_mediaController = controller; } - MediaControllerInterface* mediaController() const { return m_mediaController; } - +class MediaControlChromiumEnclosureElement : public MediaControlElement { protected: - MediaControlChromiumEnclosureElement(Document*); + explicit MediaControlChromiumEnclosureElement(Document*); private: - virtual bool isMediaControlElement() const { return true; } + virtual MediaControlElementType displayType() const; +}; - MediaControllerInterface* m_mediaController; +class MediaControlPanelEnclosureElement : public MediaControlChromiumEnclosureElement { +public: + static PassRefPtr<MediaControlPanelEnclosureElement> create(Document*); + +private: + explicit MediaControlPanelEnclosureElement(Document*); + virtual const AtomicString& shadowPseudoId() const; }; class MediaControlRootElementChromium : public MediaControls { @@ -84,7 +84,7 @@ public: static PassRefPtr<MediaControlRootElementChromium> create(Document*); // MediaControls implementation. - void setMediaController(MediaControllerInterface*); + virtual void setMediaController(MediaControllerInterface*); void show(); void hide(); @@ -93,9 +93,9 @@ public: void reset(); - void playbackProgressed(); - void playbackStarted(); - void playbackStopped(); + virtual void playbackProgressed(); + virtual void playbackStarted(); + virtual void playbackStopped(); void changedMute(); void changedVolume(); @@ -122,9 +122,13 @@ public: virtual bool shouldHideControls(); -private: - MediaControlRootElementChromium(Document*); +protected: + explicit MediaControlRootElementChromium(Document*); + + // Returns true if successful, otherwise return false. + bool initializeControls(Document*); +private: virtual void defaultEventHandler(Event*); void hideFullscreenControlsTimerFired(Timer<MediaControlRootElementChromium>*); void startHideFullscreenControlsTimer(); @@ -144,7 +148,8 @@ private: MediaControlVolumeSliderElement* m_volumeSlider; MediaControlFullscreenButtonElement* m_fullscreenButton; MediaControlPanelElement* m_panel; - MediaControlChromiumEnclosureElement* m_enclosure; + MediaControlPanelEnclosureElement* m_enclosure; + #if ENABLE(VIDEO_TRACK) MediaControlTextTrackContainerElement* m_textDisplayContainer; #endif diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromiumAndroid.cpp b/Source/WebCore/html/shadow/MediaControlRootElementChromiumAndroid.cpp new file mode 100644 index 000000000..45634a847 --- /dev/null +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromiumAndroid.cpp @@ -0,0 +1,113 @@ +/* + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(VIDEO) +#include "MediaControlRootElementChromiumAndroid.h" + +#include "MediaControlElements.h" + +namespace WebCore { + +MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement(Document* document) + : MediaControlChromiumEnclosureElement(document) +{ +} + +PassRefPtr<MediaControlOverlayEnclosureElement> MediaControlOverlayEnclosureElement::create(Document* document) +{ + return adoptRef(new MediaControlOverlayEnclosureElement(document)); +} + +const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const +{ + DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclosure")); + return id; +} + +MediaControlRootElementChromiumAndroid::MediaControlRootElementChromiumAndroid(Document* document) + : MediaControlRootElementChromium(document) + , m_overlayPlayButton(0) + , m_overlayEnclosure(0) +{ +} + +PassRefPtr<MediaControls> MediaControls::create(Document* document) +{ + return MediaControlRootElementChromiumAndroid::create(document); +} + +PassRefPtr<MediaControlRootElementChromiumAndroid> MediaControlRootElementChromiumAndroid::create(Document* document) +{ + if (!document->page()) + return 0; + + RefPtr<MediaControlRootElementChromiumAndroid> controls = adoptRef(new MediaControlRootElementChromiumAndroid(document)); + + ExceptionCode ec; + + RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlOverlayEnclosureElement::create(document); + RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaControlOverlayPlayButtonElement::create(document); + controls->m_overlayPlayButton = overlayPlayButton.get(); + overlayEnclosure->appendChild(overlayPlayButton.release(), ec, true); + if (ec) + return 0; + + controls->m_overlayEnclosure = overlayEnclosure.get(); + controls->appendChild(overlayEnclosure.release(), ec, true); + if (ec) + return 0; + + if (controls->initializeControls(document)) + return controls.release(); + + return 0; +} + +void MediaControlRootElementChromiumAndroid::setMediaController(MediaControllerInterface* controller) +{ + if (m_overlayPlayButton) + m_overlayPlayButton->setMediaController(controller); + if (m_overlayEnclosure) + m_overlayEnclosure->setMediaController(controller); + MediaControlRootElementChromium::setMediaController(controller); +} + +void MediaControlRootElementChromiumAndroid::playbackStarted() +{ + m_overlayPlayButton->updateDisplayType(); + MediaControlRootElementChromium::playbackStarted(); +} + +void MediaControlRootElementChromiumAndroid::playbackStopped() +{ + m_overlayPlayButton->updateDisplayType(); + MediaControlRootElementChromium::playbackStopped(); +} + +} + +#endif diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromiumAndroid.h b/Source/WebCore/html/shadow/MediaControlRootElementChromiumAndroid.h new file mode 100644 index 000000000..9c77483f9 --- /dev/null +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromiumAndroid.h @@ -0,0 +1,65 @@ +/* + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef MediaControlRootElementChromiumAndroid_h +#define MediaControlRootElementChromiumAndroid_h + +#if ENABLE(VIDEO) + +#include "MediaControlRootElementChromium.h" + +namespace WebCore { + +class MediaControlOverlayPlayButtonElement; + +class MediaControlOverlayEnclosureElement : public MediaControlChromiumEnclosureElement { +public: + static PassRefPtr<MediaControlOverlayEnclosureElement> create(Document*); + +private: + explicit MediaControlOverlayEnclosureElement(Document*); + virtual const AtomicString& shadowPseudoId() const; +}; + +class MediaControlRootElementChromiumAndroid : public MediaControlRootElementChromium { +public: + static PassRefPtr<MediaControlRootElementChromiumAndroid> create(Document*); + + virtual void setMediaController(MediaControllerInterface*); + virtual void playbackStarted(); + virtual void playbackStopped(); + +private: + explicit MediaControlRootElementChromiumAndroid(Document*); + + MediaControlOverlayPlayButtonElement* m_overlayPlayButton; + MediaControlOverlayEnclosureElement* m_overlayEnclosure; +}; + +} + +#endif + +#endif diff --git a/Source/WebCore/inspector/DOMPatchSupport.cpp b/Source/WebCore/inspector/DOMPatchSupport.cpp index 775c464ec..c03dce471 100644 --- a/Source/WebCore/inspector/DOMPatchSupport.cpp +++ b/Source/WebCore/inspector/DOMPatchSupport.cpp @@ -177,8 +177,8 @@ bool DOMPatchSupport::innerPatchNode(Digest* oldDigest, Digest* newDigest, Excep // FIXME: Create a function in Element for removing all properties. Take in account whether did/willModifyAttribute are important. if (oldElement->hasAttributesWithoutUpdate()) { while (oldElement->attributeCount()) { - Attribute* attr = oldElement->attributeItem(0); - if (!m_domEditor->removeAttribute(oldElement, attr->localName(), ec)) + const Attribute* attribute = oldElement->attributeItem(0); + if (!m_domEditor->removeAttribute(oldElement, attribute->localName(), ec)) return false; } } diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js index 79e6562ae..0335c9868 100644 --- a/Source/WebCore/inspector/InjectedScriptSource.js +++ b/Source/WebCore/inspector/InjectedScriptSource.js @@ -28,6 +28,8 @@ /** * @param {InjectedScriptHost} InjectedScriptHost + * @param {Window} inspectedWindow + * @param {number} injectedScriptId */ (function (InjectedScriptHost, inspectedWindow, injectedScriptId) { @@ -43,6 +45,10 @@ var InjectedScript = function() this._modules = {}; } +/** + * @type {Object.<string, boolean>} + * @const + */ InjectedScript.primitiveTypes = { undefined: true, boolean: true, @@ -51,12 +57,22 @@ InjectedScript.primitiveTypes = { } InjectedScript.prototype = { + /** + * @param {*} object + * @return {boolean} + */ isPrimitiveValue: function(object) { // FIXME(33716): typeof document.all is always 'undefined'. return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllCollection(object); }, + /** + * @param {*} object + * @param {string} groupName + * @param {boolean} canAccessInspectedWindow + * @return {Object} + */ wrapObject: function(object, groupName, canAccessInspectedWindow) { if (canAccessInspectedWindow) @@ -71,11 +87,18 @@ InjectedScript.prototype = { return result; }, + /** + * @param {*} object + */ inspectNode: function(object) { this._inspect(object); }, + /** + * @param {*} object + * @return {*} + */ _inspect: function(object) { if (arguments.length === 0) @@ -100,7 +123,13 @@ InjectedScript.prototype = { return object; }, - // This method cannot throw. + /** + * This method cannot throw. + * @param {*} object + * @param {string=} objectGroupName + * @param {boolean=} forceValueType + * @return {InjectedScript.RemoteObject} + */ _wrapObject: function(object, objectGroupName, forceValueType) { try { @@ -115,6 +144,11 @@ InjectedScript.prototype = { } }, + /** + * @param {*} object + * @param {string=} objectGroupName + * @return {string} + */ _bind: function(object, objectGroupName) { var id = this._lastBoundObjectId++; @@ -132,11 +166,18 @@ InjectedScript.prototype = { return objectId; }, + /** + * @param {string} objectId + * @return {*} + */ _parseObjectId: function(objectId) { return eval("(" + objectId + ")"); }, + /** + * @param {string} objectGroupName + */ releaseObjectGroup: function(objectGroupName) { var group = this._objectGroups[objectGroupName]; @@ -147,6 +188,11 @@ InjectedScript.prototype = { delete this._objectGroups[objectGroupName]; }, + /** + * @param {string} methodName + * @param {string} args + * @return {*} + */ dispatch: function(methodName, args) { var argsArray = eval("(" + args + ")"); @@ -158,6 +204,11 @@ InjectedScript.prototype = { return result; }, + /** + * @param {string} objectId + * @param {boolean} ownProperties + * @return {Array.<Object>|boolean} + */ getProperties: function(objectId, ownProperties) { var parsedObjectId = this._parseObjectId(objectId); @@ -192,6 +243,10 @@ InjectedScript.prototype = { return descriptors; }, + /** + * @param {string} functionId + * @return {Object|string} + */ getFunctionDetails: function(functionId) { var parsedFunctionId = this._parseObjectId(functionId); @@ -211,25 +266,36 @@ InjectedScript.prototype = { return details; }, + /** + * @param {string} objectId + */ releaseObject: function(objectId) { var parsedObjectId = this._parseObjectId(objectId); this._releaseObject(parsedObjectId.id); }, + /** + * @param {string} id + */ _releaseObject: function(id) { delete this._idToWrappedObject[id]; delete this._idToObjectGroupName[id]; }, + /** + * @param {Object} object + * @param {boolean} ownProperties + * @return {Array.<Object>} + */ _propertyDescriptors: function(object, ownProperties) { var descriptors = []; var nameProcessed = {}; nameProcessed["__proto__"] = null; for (var o = object; this._isDefined(o); o = o.__proto__) { - var names = Object.getOwnPropertyNames(o); + var names = Object.getOwnPropertyNames(/** @type {!Object} */ (o)); for (var i = 0; i < names.length; ++i) { var name = names[i]; if (nameProcessed[name]) @@ -237,7 +303,7 @@ InjectedScript.prototype = { try { nameProcessed[name] = true; - var descriptor = Object.getOwnPropertyDescriptor(object, name); + var descriptor = Object.getOwnPropertyDescriptor(/** @type {!Object} */ (object), name); if (!descriptor) { // Not all bindings provide proper descriptors. Fall back to the writable, configurable property. try { @@ -265,11 +331,24 @@ InjectedScript.prototype = { return descriptors; }, + /** + * @param {string} expression + * @param {string} objectGroup + * @param {boolean} injectCommandLineAPI + * @param {boolean} returnByValue + * @return {*} + */ evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue) { return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false, injectCommandLineAPI, returnByValue); }, + /** + * @param {string} objectId + * @param {string} expression + * @param {boolean} returnByValue + * @return {Object|string} + */ callFunctionOn: function(objectId, expression, args, returnByValue) { var parsedObjectId = this._parseObjectId(objectId); @@ -312,6 +391,15 @@ InjectedScript.prototype = { } }, + /** + * @param {Function} evalFunction + * @param {Object} object + * @param {string} objectGroup + * @param {boolean} isEvalOnCallFrame + * @param {boolean} injectCommandLineAPI + * @param {boolean} returnByValue + * @return {*} + */ _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI, returnByValue) { try { @@ -322,6 +410,11 @@ InjectedScript.prototype = { } }, + /** + * @param {*} value + * @param {string} objectGroup + * @return {Object} + */ _createThrownValue: function(value, objectGroup) { var remoteObject = this._wrapObject(value, objectGroup); @@ -332,6 +425,14 @@ InjectedScript.prototype = { result: remoteObject }; }, + /** + * @param {Function} evalFunction + * @param {Object} object + * @param {string} expression + * @param {boolean} isEvalOnCallFrame + * @param {boolean} injectCommandLineAPI + * @return {*} + */ _evaluateOn: function(evalFunction, object, expression, isEvalOnCallFrame, injectCommandLineAPI) { // Only install command line api object for the time of evaluation. @@ -350,6 +451,10 @@ InjectedScript.prototype = { } }, + /** + * @param {Object} callFrame + * @return {Array.<InjectedScript.CallFrameProxy>|boolean} + */ wrapCallFrames: function(callFrame) { if (!callFrame) @@ -364,6 +469,15 @@ InjectedScript.prototype = { return result; }, + /** + * @param {Object} topCallFrame + * @param {string} callFrameId + * @param {string} expression + * @param {string} objectGroup + * @param {boolean} injectCommandLineAPI + * @param {boolean} returnByValue + * @return {*} + */ evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectGroup, injectCommandLineAPI, returnByValue) { var callFrame = this._callFrameForId(topCallFrame, callFrameId); @@ -372,6 +486,11 @@ InjectedScript.prototype = { return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue); }, + /** + * @param {Object} topCallFrame + * @param {string} callFrameId + * @return {*} + */ restartFrame: function(topCallFrame, callFrameId) { var callFrame = this._callFrameForId(topCallFrame, callFrameId); @@ -383,6 +502,11 @@ InjectedScript.prototype = { return result; }, + /** + * @param {Object} topCallFrame + * @param {string} callFrameId + * @return {Object} + */ _callFrameForId: function(topCallFrame, callFrameId) { var parsedCallFrameId = eval("(" + callFrameId + ")"); @@ -393,17 +517,29 @@ InjectedScript.prototype = { return callFrame; }, + /** + * @param {Object} objectId + * @return {Object} + */ _objectForId: function(objectId) { return this._idToWrappedObject[objectId.id]; }, + /** + * @param {string} objectId + * @return {Object} + */ findObjectById: function(objectId) { var parsedObjectId = this._parseObjectId(objectId); return this._objectForId(parsedObjectId); }, + /** + * @param {string} objectId + * @return {Node} + */ nodeForObjectId: function(objectId) { var object = this.findObjectById(objectId); @@ -425,17 +561,29 @@ InjectedScript.prototype = { return module; }, + /** + * @param {*} object + * @return {boolean} + */ _isDefined: function(object) { return object || this._isHTMLAllCollection(object); }, + /** + * @param {*} object + * @return {boolean} + */ _isHTMLAllCollection: function(object) { // document.all is reported as undefined, but we still want to process it. return (typeof object === "undefined") && InjectedScriptHost.isHTMLAllCollection(object); }, + /** + * @param {Object=} obj + * @return {string?} + */ _subtype: function(obj) { if (obj === null) @@ -465,6 +613,10 @@ InjectedScript.prototype = { return null; }, + /** + * @param {*} obj + * @return {string?} + */ _describe: function(obj) { if (this.isPrimitiveValue(obj)) @@ -500,6 +652,10 @@ InjectedScript.prototype = { return className; }, + /** + * @param {*} obj + * @return {string} + */ _toString: function(obj) { // We don't use String(obj) because inspectedWindow.String is undefined if owning frame navigated to another page. @@ -507,6 +663,10 @@ InjectedScript.prototype = { } } +/** + * @type {InjectedScript} + * @const + */ var injectedScript = new InjectedScript(); /** @@ -544,6 +704,7 @@ InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType) /** * @constructor * @param {number} ordinal + * @param {Object} callFrame */ InjectedScript.CallFrameProxy = function(ordinal, callFrame) { @@ -555,6 +716,10 @@ InjectedScript.CallFrameProxy = function(ordinal, callFrame) } InjectedScript.CallFrameProxy.prototype = { + /** + * @param {Object} callFrame + * @return {Array.<Object>} + */ _wrapScopeChain: function(callFrame) { var scopeChain = callFrame.scopeChain; @@ -567,6 +732,12 @@ InjectedScript.CallFrameProxy.prototype = { } } +/** + * @param {number} scopeTypeCode + * @param {*} scopeObject + * @param {string} groupId + * @return {Object} + */ InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId) { const GLOBAL_SCOPE = 0; const LOCAL_SCOPE = 1; @@ -589,9 +760,15 @@ InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeOb /** * @constructor + * @param {CommandLineAPIImpl} commandLineAPIImpl + * @param {Object} callFrame */ function CommandLineAPI(commandLineAPIImpl, callFrame) { + /** + * @param {string} member + * @return {boolean} + */ function inScopeVariables(member) { if (!callFrame) @@ -622,6 +799,10 @@ function CommandLineAPI(commandLineAPIImpl, callFrame) } } +/** + * @type {Array.<string>} + * @const + */ CommandLineAPI.members_ = [ "$", "$$", "$x", "dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "getEventListeners" @@ -698,6 +879,10 @@ CommandLineAPIImpl.prototype = { return console.profileEnd.apply(console, arguments) }, + /** + * @param {Object} object + * @param {Array.<string>|string=} types + */ monitorEvents: function(object, types) { if (!object || !object.addEventListener || !object.removeEventListener) @@ -709,6 +894,10 @@ CommandLineAPIImpl.prototype = { } }, + /** + * @param {Object} object + * @param {Array.<string>|string=} types + */ unmonitorEvents: function(object, types) { if (!object || !object.addEventListener || !object.removeEventListener) @@ -718,6 +907,10 @@ CommandLineAPIImpl.prototype = { object.removeEventListener(types[i], this._logEvent, false); }, + /** + * @param {*} object + * @return {*} + */ inspect: function(object) { return injectedScript._inspect(object); @@ -735,16 +928,26 @@ CommandLineAPIImpl.prototype = { InjectedScriptHost.clearConsoleMessages(); }, + /** + * @param {Node} node + */ getEventListeners: function(node) { return InjectedScriptHost.getEventListeners(node); }, + /** + * @param {number} num + */ _inspectedObject: function(num) { return InjectedScriptHost.inspectedObject(num); }, + /** + * @param {Array.<string>|string=} types + * @return {Array.<string>} + */ _normalizeEventTypes: function(types) { if (typeof types === "undefined") @@ -768,6 +971,9 @@ CommandLineAPIImpl.prototype = { return result; }, + /** + * @param {Event} event + */ _logEvent: function(event) { console.log(event.type, event); diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index e23172764..88e8f3b95 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -350,6 +350,29 @@ "parameters": [ { "name": "value", "type": "boolean", "description": "Whether script execution should be disabled in the page." } ] + }, + { + "name": "setGeolocationOverride", + "description": "Overrides the Geolocation Position or Error.", + "parameters": [ + { "name": "latitude", "type": "number", "optional": true, "description": "Mock longitude"}, + { "name": "longitude", "type": "number", "optional": true, "description": "Mock latitude"}, + { "name": "accuracy", "type": "number", "optional": true, "description": "Mock accuracy"} + ], + "hidden": true + }, + { + "name": "clearGeolocationOverride", + "description": "Clears the overriden Geolocation Position and Error.", + "hidden": true + }, + { + "name": "canOverrideGeolocation", + "description": "Checks if Geolocation can be overridden.", + "returns": [ + { "name": "result", "type": "boolean", "description": "True if browser can ovrride Geolocation." } + ], + "hidden": true } ], "events": [ @@ -2060,13 +2083,21 @@ "type": "object" }, { + "id": "CSSPropertyInfo", + "type": "object", + "properties": [ + { "name": "name", "type": "string", "description": "Property name." }, + { "name": "longhands", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Longhand property names." } + ] + }, + { "id": "CSSComputedStyleProperty", "type": "object", "properties": [ { "name": "name", "type": "string", "description": "Computed style property name." }, { "name": "value", "type": "string", "description": "Computed style property value." } ] - }, + }, { "id": "CSSStyle", "type": "object", @@ -2092,7 +2123,6 @@ { "name": "text", "type": "string", "optional": true, "description": "The full property text as specified in the style." }, { "name": "parsedOk", "type": "boolean", "optional": true, "description": "Whether the property is understood by the browser (implies <code>true</code> if absent)." }, { "name": "status", "type": "string", "enum": ["active", "inactive", "disabled", "style"], "optional": true, "description": "The property status: \"active\" (implied if absent) if the property is effective in the style, \"inactive\" if the property is overridden by a same-named property in this style later on, \"disabled\" if the property is disabled by the user, \"style\" if the property is reported by the browser rather than by the CSS source parser." }, - { "name": "shorthandName", "type": "string", "optional": true, "description": "The related shorthand property name (absent if this property is not a longhand)." }, { "name": "range", "$ref": "SourceRange", "optional": true, "description": "The entire property range in the enclosing style declaration (if available)." } ], "description": "CSS style effective visual dimensions and source offsets." @@ -2272,7 +2302,7 @@ { "name": "getSupportedCSSProperties", "returns": [ - { "name": "cssProperties", "type": "array", "items": { "type": "string" }, "description": "Supported property names." } + { "name": "cssProperties", "type": "array", "items": { "$ref": "CSSPropertyInfo" }, "description": "Supported property metainfo." } ], "description": "Returns all supported CSS property names." }, diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp index e075f3171..4db27b646 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.cpp +++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp @@ -48,6 +48,7 @@ #include "Node.h" #include "NodeList.h" #include "StylePropertySet.h" +#include "StylePropertyShorthand.h" #include "StyleResolver.h" #include "StyleRule.h" #include "StyleSheetList.h" @@ -780,12 +781,27 @@ void InspectorCSSAgent::addRule(ErrorString* errorString, const int contextNodeI result = inspectorStyleSheet->buildObjectForRule(rule); } -void InspectorCSSAgent::getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<String> >& cssProperties) +void InspectorCSSAgent::getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSPropertyInfo> >& cssProperties) { - RefPtr<TypeBuilder::Array<String> > properties = TypeBuilder::Array<String>::create(); - for (int i = 0; i < numCSSProperties; ++i) - properties->addItem(propertyNameStrings[i]); - + RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSPropertyInfo> > properties = TypeBuilder::Array<TypeBuilder::CSS::CSSPropertyInfo>::create(); + for (int i = firstCSSProperty; i <= lastCSSProperty; ++i) { + CSSPropertyID id = convertToCSSPropertyID(i); + RefPtr<TypeBuilder::CSS::CSSPropertyInfo> property = TypeBuilder::CSS::CSSPropertyInfo::create() + .setName(getPropertyName(id)); + + const StylePropertyShorthand& shorthand = shorthandForProperty(id); + if (!shorthand.length()) { + properties->addItem(property.release()); + continue; + } + RefPtr<TypeBuilder::Array<String> > longhands = TypeBuilder::Array<String>::create(); + for (unsigned j = 0; j < shorthand.length(); ++j) { + CSSPropertyID longhandID = shorthand.properties()[j]; + longhands->addItem(getPropertyName(longhandID)); + } + property->setLonghands(longhands); + properties->addItem(property.release()); + } cssProperties = properties.release(); } diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h index 6355e5081..76d87795f 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.h +++ b/Source/WebCore/inspector/InspectorCSSAgent.h @@ -109,7 +109,7 @@ public: virtual void toggleProperty(ErrorString*, const RefPtr<InspectorObject>& styleId, int propertyIndex, bool disable, RefPtr<TypeBuilder::CSS::CSSStyle>& result); virtual void setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result); virtual void addRule(ErrorString*, int contextNodeId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result); - virtual void getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<String> >& result); + virtual void getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSPropertyInfo> >& result); virtual void getNamedFlowCollection(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<String> >& result); virtual void getFlowByName(ErrorString*, int nodeId, const String& flowName, RefPtr<TypeBuilder::CSS::NamedFlow>& result); diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index c3f9f08b3..ab6e377c1 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -165,6 +165,8 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC #if ENABLE(JAVASCRIPT_DEBUGGER) runtimeAgent->setScriptDebugServer(&m_debuggerAgent->scriptDebugServer()); #endif + + InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get()); } InspectorController::~InspectorController() @@ -183,6 +185,7 @@ PassOwnPtr<InspectorController> InspectorController::create(Page* page, Inspecto void InspectorController::inspectedPageDestroyed() { disconnectFrontend(); + InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get()); m_injectedScriptManager->disconnect(); m_inspectorClient->inspectorDestroyed(); m_inspectorClient = 0; diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp index 0fdaca6e2..c584b1e9f 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp @@ -42,6 +42,7 @@ #include "GroupSettings.h" #include "IDBCallbacks.h" #include "IDBCursor.h" +#include "IDBCursorBackendInterface.h" #include "IDBDatabaseBackendInterface.h" #include "IDBDatabaseCallbacks.h" #include "IDBFactoryBackendInterface.h" diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index 296165fd7..0bc16f494 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -80,6 +80,10 @@ static const char* const setTimerEventName = "setTimer"; static const char* const clearTimerEventName = "clearTimer"; static const char* const timerFiredEventName = "timerFired"; +namespace { +static HashSet<InstrumentingAgents*>* instrumentingAgentsSet = 0; +} + int InspectorInstrumentation::s_frontendCounter = 0; static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors) @@ -844,6 +848,18 @@ void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents* inspectorPageAgent->loaderDetachedFromFrame(loader); } +void InspectorInstrumentation::willDestroyCachedResourceImpl(CachedResource* cachedResource) +{ + if (!instrumentingAgentsSet) + return; + HashSet<InstrumentingAgents*>::iterator end = instrumentingAgentsSet->end(); + for (HashSet<InstrumentingAgents*>::iterator it = instrumentingAgentsSet->begin(); it != end; ++it) { + InstrumentingAgents* instrumentingAgents = *it; + if (InspectorResourceAgent* inspectorResourceAgent = instrumentingAgents->inspectorResourceAgent()) + inspectorResourceAgent->willDestroyCachedResource(cachedResource); + } +} + InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InstrumentingAgents* instrumentingAgents, unsigned int length, unsigned int startLine, Frame* frame) { int timelineAgentId = 0; @@ -1141,6 +1157,22 @@ WTF::ThreadSpecific<InspectorTimelineAgent*>& InspectorInstrumentation::threadSp return *instance; } +void InspectorInstrumentation::registerInstrumentingAgents(InstrumentingAgents* instrumentingAgents) +{ + if (!instrumentingAgentsSet) + instrumentingAgentsSet = new HashSet<InstrumentingAgents*>(); + instrumentingAgentsSet->add(instrumentingAgents); +} + +void InspectorInstrumentation::unregisterInstrumentingAgents(InstrumentingAgents* instrumentingAgents) +{ + if (!instrumentingAgentsSet) + return; + instrumentingAgentsSet->remove(instrumentingAgents); + if (!instrumentingAgentsSet->size()) + delete instrumentingAgentsSet; +} + InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie) { if (!cookie.first) @@ -1174,6 +1206,15 @@ InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForNonDocument } #endif +#if ENABLE(GEOLOCATION) +GeolocationPosition* InspectorInstrumentation::overrideGeolocationPositionImpl(InstrumentingAgents* instrumentingAgents, GeolocationPosition* position) +{ + if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent()) + position = pageAgent->overrideGeolocationPosition(position); + return position; +} +#endif + } // namespace WebCore #endif // !ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index fd38b44e2..6147f77de 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -56,6 +56,7 @@ class Database; class Element; class EventContext; class DocumentLoader; +class GeolocationPosition; class GraphicsContext; class HitTestResult; class InspectorCSSAgent; @@ -186,6 +187,7 @@ public: static void frameDetachedFromParent(Frame*); static void didCommitLoad(Frame*, DocumentLoader*); static void loaderDetachedFromFrame(Frame*, DocumentLoader*); + static void willDestroyCachedResource(CachedResource*); static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine); static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned int endLine); @@ -258,6 +260,13 @@ public: static bool collectingHTMLParseErrors(Page*) { return false; } #endif +#if ENABLE(GEOLOCATION) + static GeolocationPosition* overrideGeolocationPosition(Page*, GeolocationPosition*); +#endif + + static void registerInstrumentingAgents(InstrumentingAgents*); + static void unregisterInstrumentingAgents(InstrumentingAgents*); + private: #if ENABLE(INSPECTOR) static WTF::ThreadSpecific<InspectorTimelineAgent*>& threadSpecificTimelineAgentForOrphanEvents(); @@ -354,6 +363,7 @@ private: static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*); static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*); static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*); + static void willDestroyCachedResourceImpl(CachedResource*); static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned int length, unsigned int startLine, Frame*); static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned int endLine); @@ -417,6 +427,10 @@ private: static void cancelPauseOnNativeEvent(InstrumentingAgents*); static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&); +#if ENABLE(GEOLOCATION) + static GeolocationPosition* overrideGeolocationPositionImpl(InstrumentingAgents*, GeolocationPosition*); +#endif + static int s_frontendCounter; #endif }; @@ -1191,6 +1205,14 @@ inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, Docu #endif } +inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource) +{ +#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); + willDestroyCachedResourceImpl(cachedResource); +#endif +} + inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned int length, unsigned int startLine) { #if ENABLE(INSPECTOR) @@ -1364,6 +1386,19 @@ inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstr #endif } + +#if ENABLE(GEOLOCATION) +inline GeolocationPosition* InspectorInstrumentation::overrideGeolocationPosition(Page* page, GeolocationPosition* position) +{ +#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(position); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) + return overrideGeolocationPositionImpl(instrumentingAgents, position); +#endif + return position; +} +#endif + #if ENABLE(INSPECTOR) inline bool InspectorInstrumentation::collectingHTMLParseErrors(Page* page) { diff --git a/Source/WebCore/inspector/InspectorMemoryAgent.cpp b/Source/WebCore/inspector/InspectorMemoryAgent.cpp index bf1d5ae1b..db411458c 100644 --- a/Source/WebCore/inspector/InspectorMemoryAgent.cpp +++ b/Source/WebCore/inspector/InspectorMemoryAgent.cpp @@ -417,17 +417,15 @@ void InspectorMemoryAgent::getDOMNodeCount(ErrorString*, RefPtr<TypeBuilder::Arr static PassRefPtr<InspectorMemoryBlock> jsHeapInfo() { - size_t usedJSHeapSize; - size_t totalJSHeapSize; - size_t jsHeapSizeLimit; - ScriptGCEvent::getHeapSize(usedJSHeapSize, totalJSHeapSize, jsHeapSizeLimit); + HeapInfo info; + ScriptGCEvent::getHeapSize(info); RefPtr<InspectorMemoryBlock> jsHeapAllocated = InspectorMemoryBlock::create().setName(MemoryBlockName::jsHeapAllocated); - jsHeapAllocated->setSize(totalJSHeapSize); + jsHeapAllocated->setSize(static_cast<int>(info.totalJSHeapSize)); RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create(); RefPtr<InspectorMemoryBlock> jsHeapUsed = InspectorMemoryBlock::create().setName(MemoryBlockName::jsHeapUsed); - jsHeapUsed->setSize(usedJSHeapSize); + jsHeapUsed->setSize(static_cast<int>(info.usedJSHeapSize)); children->addItem(jsHeapUsed); jsHeapAllocated->setChildren(children); diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp index 9676d138e..99d02fe27 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/InspectorPageAgent.cpp @@ -50,6 +50,8 @@ #include "DocumentLoader.h" #include "Frame.h" #include "FrameView.h" +#include "GeolocationController.h" +#include "GeolocationError.h" #include "HTMLFrameOwnerElement.h" #include "HTMLNames.h" #include "IdentifiersFactory.h" @@ -319,6 +321,7 @@ InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, , m_lastScriptIdentifier(0) , m_lastPaintContext(0) , m_didLoadEventFire(false) + , m_geolocationOverridden(false) { } @@ -964,10 +967,72 @@ void InspectorPageAgent::updateViewMetrics(int width, int height, double fontSca m_client->overrideDeviceMetrics(width, height, static_cast<float>(fontScaleFactor), fitWindow); Document* document = mainFrame()->document(); - document->styleResolverChanged(RecalcStyleImmediately); + if (document) + document->styleResolverChanged(RecalcStyleImmediately); InspectorInstrumentation::mediaQueryResultChanged(document); } +void InspectorPageAgent::setGeolocationOverride(ErrorString* error, const double* latitude, const double* longitude, const double* accuracy) +{ +#if ENABLE (GEOLOCATION) + GeolocationController* controller = GeolocationController::from(m_page); + GeolocationPosition* position = 0; + if (!controller) { + *error = "Internal error: unable to override geolocation."; + return; + } + position = controller->lastPosition(); + if (!m_geolocationOverridden && position) + m_platformGeolocationPosition = position; + + m_geolocationOverridden = true; + if (latitude && longitude && accuracy) + m_geolocationPosition = GeolocationPosition::create(currentTimeMS(), *latitude, *longitude, *accuracy); + else + m_geolocationPosition.clear(); + + controller->positionChanged(0); // Kick location update. +#else + *error = "Geolocation is not available."; +#endif +} + +void InspectorPageAgent::clearGeolocationOverride(ErrorString* error) +{ + if (!m_geolocationOverridden) + return; +#if ENABLE(GEOLOCATION) + UNUSED_PARAM(error); + m_geolocationOverridden = false; + m_geolocationPosition.clear(); + + GeolocationController* controller = GeolocationController::from(m_page); + if (controller && m_platformGeolocationPosition.get()) + controller->positionChanged(m_platformGeolocationPosition.get()); +#else + *error = "Geolocation is not available."; +#endif +} + +void InspectorPageAgent::canOverrideGeolocation(ErrorString*, bool* out_param) +{ +#if ENABLE(GEOLOCATION) + *out_param = true; +#else + *out_param = false; +#endif +} + +GeolocationPosition* InspectorPageAgent::overrideGeolocationPosition(GeolocationPosition* position) +{ + if (m_geolocationOverridden) { + if (position) + m_platformGeolocationPosition = position; + return m_geolocationPosition.get(); + } + return position; +} + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index c3b9a6d2f..e8a98c56c 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -34,6 +34,7 @@ #if ENABLE(INSPECTOR) #include "Frame.h" +#include "GeolocationPosition.h" #include "InspectorBaseAgent.h" #include "InspectorFrontend.h" #include "PlatformString.h" @@ -109,6 +110,13 @@ public: virtual void setShowPaintRects(ErrorString*, bool show); virtual void getScriptExecutionStatus(ErrorString*, PageCommandHandler::Result::Enum*); virtual void setScriptExecutionDisabled(ErrorString*, bool); + virtual void setGeolocationOverride(ErrorString*, const double*, const double*, const double*); + virtual void clearGeolocationOverride(ErrorString*); + virtual void canOverrideGeolocation(ErrorString*, bool* out_param); + + + // Geolocation override helpers. + GeolocationPosition* overrideGeolocationPosition(GeolocationPosition*); // InspectorInstrumentation API void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*); @@ -158,6 +166,9 @@ private: GraphicsContext* m_lastPaintContext; LayoutRect m_lastPaintRect; bool m_didLoadEventFire; + bool m_geolocationOverridden; + RefPtr<GeolocationPosition> m_geolocationPosition; + RefPtr<GeolocationPosition> m_platformGeolocationPosition; }; diff --git a/Source/WebCore/inspector/InspectorResourceAgent.cpp b/Source/WebCore/inspector/InspectorResourceAgent.cpp index 8776bb855..65148b221 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.cpp +++ b/Source/WebCore/inspector/InspectorResourceAgent.cpp @@ -283,7 +283,7 @@ void InspectorResourceAgent::didReceiveData(unsigned long identifier, const char if (data) { NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->data(requestId); - if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::OtherResource || (resourceData && isErrorStatusCode(resourceData->httpStatusCode()) && (resourceData->cachedResource()))) + if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::OtherResource || (resourceData && isErrorStatusCode(resourceData->httpStatusCode()) && resourceData->cachedResource())) m_resourcesData->maybeAddResourceData(requestId, data, dataLength); } @@ -364,6 +364,21 @@ void InspectorResourceAgent::didLoadXHRSynchronously() m_loadingXHRSynchronously = false; } +void InspectorResourceAgent::willDestroyCachedResource(CachedResource* cachedResource) +{ + Vector<String> requestIds = m_resourcesData->removeCachedResource(cachedResource); + if (!requestIds.size()) + return; + + String content; + bool base64Encoded; + if (!InspectorPageAgent::cachedResourceContent(cachedResource, &content, &base64Encoded)) + return; + Vector<String>::iterator end = requestIds.end(); + for (Vector<String>::iterator it = requestIds.begin(); it != end; ++it) + m_resourcesData->setResourceContent(*it, content, base64Encoded); +} + void InspectorResourceAgent::applyUserAgentOverride(String* userAgent) { String userAgentOverride = m_state->getString(ResourceAgentState::userAgentOverride); @@ -529,7 +544,7 @@ void InspectorResourceAgent::getResponseBody(ErrorString* errorString, const Str } if (resourceData->hasContent()) { - *base64Encoded = false; + *base64Encoded = resourceData->base64Encoded(); *content = resourceData->content(); return; } diff --git a/Source/WebCore/inspector/InspectorResourceAgent.h b/Source/WebCore/inspector/InspectorResourceAgent.h index 54cf48e1f..8dab25308 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.h +++ b/Source/WebCore/inspector/InspectorResourceAgent.h @@ -103,6 +103,7 @@ public: void didReceiveXHRResponse(unsigned long identifier); void willLoadXHRSynchronously(); void didLoadXHRSynchronously(); + void willDestroyCachedResource(CachedResource*); void applyUserAgentOverride(String* userAgent); diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp index b2643992d..6a3de096c 100644 --- a/Source/WebCore/inspector/InspectorStyleSheet.cpp +++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp @@ -544,7 +544,6 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con if (shouldInactivate) { activeIt->second->setStatus(TypeBuilder::CSS::CSSProperty::Status::Inactive); - activeIt->second->remove(TypeBuilder::CSS::CSSProperty::ShorthandName); propertyNameToPreviousActiveProperty.set(canonicalPropertyName, property); } } else { @@ -553,29 +552,23 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con if (implicit) property->setImplicit(true); status = TypeBuilder::CSS::CSSProperty::Status::Style; + + String shorthand = m_style->getPropertyShorthand(name); + if (!shorthand.isEmpty()) { + if (!foundShorthands.contains(shorthand)) { + foundShorthands.add(shorthand); + RefPtr<InspectorObject> shorthandEntry = InspectorObject::create(); + shorthandEntry->setString("name", shorthand); + shorthandEntry->setString("value", shorthandValue(shorthand)); + shorthandEntries->addItem(shorthandEntry.release()); + } + } } } // Default "status" == "style". if (status != TypeBuilder::CSS::CSSProperty::Status::Style) property->setStatus(status); - - if (propertyEntry.parsedOk) { - // Both for style-originated and parsed source properties. - String shorthand = m_style->getPropertyShorthand(name); - if (!shorthand.isEmpty()) { - // Default "shorthandName" == "". - property->setShorthandName(shorthand); - if (!foundShorthands.contains(shorthand)) { - foundShorthands.add(shorthand); - RefPtr<InspectorObject> shorthandEntry = InspectorObject::create(); - shorthandEntry->setString("name", shorthand); - shorthandEntry->setString("value", shorthandValue(shorthand)); - shorthandEntries->addItem(shorthandEntry.release()); - } - } - } - // else shorthandName is not set } RefPtr<TypeBuilder::CSS::CSSStyle> result = TypeBuilder::CSS::CSSStyle::create() diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/InspectorTimelineAgent.cpp index 1d8b1bc7f..5c6bece1d 100644 --- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/Source/WebCore/inspector/InspectorTimelineAgent.cpp @@ -467,12 +467,10 @@ void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<InspectorObject void InspectorTimelineAgent::setHeapSizeStatistics(InspectorObject* record) { - size_t usedHeapSize = 0; - size_t totalHeapSize = 0; - size_t heapSizeLimit = 0; - ScriptGCEvent::getHeapSize(usedHeapSize, totalHeapSize, heapSizeLimit); - record->setNumber("usedHeapSize", usedHeapSize); - record->setNumber("totalHeapSize", totalHeapSize); + HeapInfo info; + ScriptGCEvent::getHeapSize(info); + record->setNumber("usedHeapSize", info.usedJSHeapSize); + record->setNumber("totalHeapSize", info.totalJSHeapSize); if (m_state->getBoolean(TimelineAgentState::includeMemoryDetails)) { RefPtr<InspectorObject> counters = InspectorObject::create(); diff --git a/Source/WebCore/inspector/NetworkResourcesData.cpp b/Source/WebCore/inspector/NetworkResourcesData.cpp index 619a19aa6..7b1fd1746 100644 --- a/Source/WebCore/inspector/NetworkResourcesData.cpp +++ b/Source/WebCore/inspector/NetworkResourcesData.cpp @@ -51,16 +51,19 @@ namespace WebCore { NetworkResourcesData::ResourceData::ResourceData(const String& requestId, const String& loaderId) : m_requestId(requestId) , m_loaderId(loaderId) + , m_base64Encoded(false) , m_isContentPurged(false) , m_type(InspectorPageAgent::OtherResource) + , m_cachedResource(0) { } -void NetworkResourcesData::ResourceData::setContent(const String& content) +void NetworkResourcesData::ResourceData::setContent(const String& content, bool base64Encoded) { ASSERT(!hasData()); ASSERT(!hasContent()); m_content = content; + m_base64Encoded = base64Encoded; } unsigned NetworkResourcesData::ResourceData::removeContent() @@ -171,7 +174,7 @@ InspectorPageAgent::ResourceType NetworkResourcesData::resourceType(const String return resourceData->type(); } -void NetworkResourcesData::setResourceContent(const String& requestId, const String& content) +void NetworkResourcesData::setResourceContent(const String& requestId, const String& content, bool base64Encoded) { ResourceData* resourceData = m_requestIdToResourceDataMap.get(requestId); if (!resourceData) @@ -186,7 +189,7 @@ void NetworkResourcesData::setResourceContent(const String& requestId, const Str if (resourceData->hasContent()) m_contentSize -= resourceData->removeContent(); m_requestIdsDeque.append(requestId); - resourceData->setContent(content); + resourceData->setContent(content, base64Encoded); m_contentSize += dataLength; } } @@ -245,6 +248,22 @@ NetworkResourcesData::ResourceData const* NetworkResourcesData::data(const Strin return m_requestIdToResourceDataMap.get(requestId); } +Vector<String> NetworkResourcesData::removeCachedResource(CachedResource* cachedResource) +{ + Vector<String> result; + ResourceDataMap::iterator it; + ResourceDataMap::iterator end = m_requestIdToResourceDataMap.end(); + for (it = m_requestIdToResourceDataMap.begin(); it != end; ++it) { + ResourceData* resourceData = it->second; + if (resourceData->cachedResource() == cachedResource) { + resourceData->setCachedResource(0); + result.append(it->first); + } + } + + return result; +} + void NetworkResourcesData::clear(const String& preservedLoaderId) { m_requestIdsDeque.clear(); diff --git a/Source/WebCore/inspector/NetworkResourcesData.h b/Source/WebCore/inspector/NetworkResourcesData.h index 1b172e79e..5aa3f4a81 100644 --- a/Source/WebCore/inspector/NetworkResourcesData.h +++ b/Source/WebCore/inspector/NetworkResourcesData.h @@ -29,7 +29,6 @@ #ifndef NetworkResourcesData_h #define NetworkResourcesData_h -#include "CachedResourceHandle.h" #include "InspectorPageAgent.h" #include "TextResourceDecoder.h" @@ -65,7 +64,9 @@ public: bool hasContent() const { return !m_content.isNull(); } String content() const { return m_content; } - void setContent(const String&); + void setContent(const String&, bool base64Encoded); + + bool base64Encoded() const { return m_base64Encoded; } unsigned removeContent(); bool isContentPurged() const { return m_isContentPurged; } @@ -86,7 +87,7 @@ public: PassRefPtr<SharedBuffer> buffer() const { return m_buffer; } void setBuffer(PassRefPtr<SharedBuffer> buffer) { m_buffer = buffer; } - CachedResource* cachedResource() const { return m_cachedResource.get(); } + CachedResource* cachedResource() const { return m_cachedResource; } void setCachedResource(CachedResource* cachedResource) { m_cachedResource = cachedResource; } private: @@ -100,6 +101,7 @@ public: String m_frameId; String m_url; String m_content; + bool m_base64Encoded; RefPtr<SharedBuffer> m_dataBuffer; bool m_isContentPurged; InspectorPageAgent::ResourceType m_type; @@ -109,7 +111,7 @@ public: RefPtr<TextResourceDecoder> m_decoder; RefPtr<SharedBuffer> m_buffer; - CachedResourceHandle<CachedResource> m_cachedResource; + CachedResource* m_cachedResource; }; NetworkResourcesData(); @@ -120,19 +122,20 @@ public: void responseReceived(const String& requestId, const String& frameId, const ResourceResponse&); void setResourceType(const String& requestId, InspectorPageAgent::ResourceType); InspectorPageAgent::ResourceType resourceType(const String& requestId); - void setResourceContent(const String& requestId, const String& content); + void setResourceContent(const String& requestId, const String& content, bool base64Encoded = false); void maybeAddResourceData(const String& requestId, const char* data, int dataLength); void maybeDecodeDataToContent(const String& requestId); void addCachedResource(const String& requestId, CachedResource*); void addResourceSharedBuffer(const String& requestId, PassRefPtr<SharedBuffer>, const String& textEncodingName); ResourceData const* data(const String& requestId); + Vector<String> removeCachedResource(CachedResource*); void clear(const String& preservedLoaderId = String()); void setResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize); private: void ensureNoDataForRequestId(const String& requestId); - bool ensureFreeSpace(int size); + bool ensureFreeSpace(int); Deque<String> m_requestIdsDeque; diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index 37583f78a..4d29f7706 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -87,6 +87,7 @@ modules = [ "Linkifier.js", "NetworkLog.js", "Placard.js", + "SASSSourceMapping.js", "Script.js", "ScriptFormatter.js", "ScriptSnippetModel.js", @@ -171,6 +172,7 @@ modules = [ "PropertiesSidebarPane.js", "SourceFrame.js", "TimelineGrid.js", + "UISourceCodeFrame.js", ] }, { diff --git a/Source/WebCore/inspector/front-end/AdvancedSearchController.js b/Source/WebCore/inspector/front-end/AdvancedSearchController.js index b82f77485..69616280f 100644 --- a/Source/WebCore/inspector/front-end/AdvancedSearchController.js +++ b/Source/WebCore/inspector/front-end/AdvancedSearchController.js @@ -235,15 +235,7 @@ WebInspector.SearchView.prototype = { */ get statusBarItems() { - return [this._searchStatusBarElement]; - }, - - /** - * @return {Element} - */ - get counterElement() - { - return this._searchResultsMessageElement; + return [this._searchStatusBarElement, this._searchResultsMessageElement]; }, /** diff --git a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js index e47b4319c..3ac718f7c 100644 --- a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js @@ -503,7 +503,7 @@ WebInspector.EventListenerBreakpointsSidebarPane = function() this._createCategory(WebInspector.UIString("Clipboard"), true, ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]); this._createCategory(WebInspector.UIString("DOM Mutation"), true, ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]); this._createCategory(WebInspector.UIString("Device"), true, ["deviceorientation", "devicemotion"]); - this._createCategory(WebInspector.UIString("Keyboard"), true, ["keydown", "keyup", "keypress", "textInput"]); + this._createCategory(WebInspector.UIString("Keyboard"), true, ["keydown", "keyup", "keypress", "input"]); this._createCategory(WebInspector.UIString("Load"), true, ["load", "unload", "abort", "error"]); this._createCategory(WebInspector.UIString("Mouse"), true, ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]); this._createCategory(WebInspector.UIString("Timer"), false, ["setTimer", "clearTimer", "timerFired"]); diff --git a/Source/WebCore/inspector/front-end/CSSCompletions.js b/Source/WebCore/inspector/front-end/CSSCompletions.js index 363ef7d40..84d7cae0b 100644 --- a/Source/WebCore/inspector/front-end/CSSCompletions.js +++ b/Source/WebCore/inspector/front-end/CSSCompletions.js @@ -32,10 +32,37 @@ /** * @constructor + * @param {Array.<CSSAgent.CSSPropertyInfo|string>} properties */ -WebInspector.CSSCompletions = function(values, acceptEmptyPrefix) +WebInspector.CSSCompletions = function(properties, acceptEmptyPrefix) { - this._values = values.slice(); + this._values = []; + this._longhands = {}; + this._shorthands = {}; + for (var i = 0; i < properties.length; ++i) { + var property = properties[i]; + if (typeof property === "string") { + this._values.push(property); + continue; + } + + var propertyName = property.name; + this._values.push(propertyName); + + var longhands = properties[i].longhands; + if (longhands) { + this._longhands[propertyName] = longhands; + for (var j = 0; j < longhands.length; ++j) { + var longhandName = longhands[j]; + var shorthands = this._shorthands[longhandName]; + if (!shorthands) { + shorthands = []; + this._shorthands[longhandName] = shorthands; + } + shorthands.push(propertyName); + } + } + } this._values.sort(); this._acceptEmptyPrefix = acceptEmptyPrefix; } @@ -44,14 +71,14 @@ WebInspector.CSSCompletions = function(values, acceptEmptyPrefix) /** * @type {WebInspector.CSSCompletions} */ -WebInspector.CSSCompletions.cssNameCompletions = null; +WebInspector.CSSCompletions.cssPropertiesMetainfo = null; WebInspector.CSSCompletions.requestCSSNameCompletions = function() { - function propertyNamesCallback(error, names) + function propertyNamesCallback(error, properties) { if (!error) - WebInspector.CSSCompletions.cssNameCompletions = new WebInspector.CSSCompletions(names, false); + WebInspector.CSSCompletions.cssPropertiesMetainfo = new WebInspector.CSSCompletions(properties, false); } CSSAgent.getSupportedCSSProperties(propertyNamesCallback); } @@ -142,5 +169,23 @@ WebInspector.CSSCompletions.prototype = { var j = propertiesWithPrefix.indexOf(str); j = (j + propertiesWithPrefix.length + shift) % propertiesWithPrefix.length; return propertiesWithPrefix[j]; + }, + + /** + * @param {string} shorthand + * @return {?Array.<string>} + */ + longhands: function(shorthand) + { + return this._longhands[shorthand]; + }, + + /** + * @param {string} longhand + * @return {?Array.<string>} + */ + shorthands: function(longhand) + { + return this._shorthands[longhand]; } } diff --git a/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js b/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js index b2b934d8d..efa18ee8f 100644 --- a/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js +++ b/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js @@ -225,7 +225,7 @@ WebInspector.CSSKeywordCompletions._propertyKeywordMap = { "hidden", "auto", "visible", "overlay", "scroll" ], "text-rendering": [ - "auto", "optimizespeed", "optimizelegibility", "geometricprecision" + "auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision" ], "text-align": [ "-webkit-auto", "left", "right", "center", "justify", "-webkit-left", "-webkit-right", "-webkit-center" @@ -277,7 +277,7 @@ WebInspector.CSSKeywordCompletions._propertyKeywordMap = { "skip-white-space" ], "color-rendering": [ - "auto", "optimizespeed", "optimizequality" + "auto", "optimizeSpeed", "optimizeQuality" ], "list-style-type": [ "none", "disc", "circle", "square", "decimal", "decimal-leading-zero", "arabic-indic", "binary", "bengali", @@ -320,7 +320,7 @@ WebInspector.CSSKeywordCompletions._propertyKeywordMap = { "over", "under" ], "image-rendering": [ - "auto", "optimizespeed", "optimizequality" + "auto", "optimizeSpeed", "optimizeQuality" ], "alignment-baseline": [ "baseline", "middle", "auto", "before-edge", "after-edge", "central", "text-before-edge", "text-after-edge", diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js index 4c76e3f02..5ae521535 100644 --- a/Source/WebCore/inspector/front-end/CSSStyleModel.js +++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js @@ -35,6 +35,7 @@ WebInspector.CSSStyleModel = function() { this._pendingCommandsMajorState = []; + this._sourceMappings = {}; WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested, this._undoRedoRequested, this); WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this); this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(this); @@ -388,6 +389,30 @@ WebInspector.CSSStyleModel.prototype = { resourceBinding: function() { return this._resourceBinding; + }, + + /** + * @param {string} url + * @param {WebInspector.SourceMapping} sourceMapping + */ + setSourceMapping: function(url, sourceMapping) + { + this._sourceMappings[url] = sourceMapping; + }, + + resetSourceMappings: function() + { + this._sourceMappings = {}; + }, + + /** + * @param {WebInspector.CSSLocation} rawLocation + * @return {?WebInspector.UILocation} + */ + _rawLocationToUILocation: function(rawLocation) + { + var sourceMapping = this._sourceMappings[rawLocation.url]; + return sourceMapping ? sourceMapping.rawLocationToUILocation(rawLocation) : null; } } @@ -395,6 +420,18 @@ WebInspector.CSSStyleModel.prototype.__proto__ = WebInspector.Object.prototype; /** * @constructor + * @implements {WebInspector.RawLocation} + * @param {string} url + * @param {number} lineNumber + */ +WebInspector.CSSLocation = function(url, lineNumber) +{ + this.url = url; + this.lineNumber = lineNumber; +} + +/** + * @constructor * @param {CSSAgent.CSSStyle} payload */ WebInspector.CSSStyleDeclaration = function(payload) @@ -406,7 +443,6 @@ WebInspector.CSSStyleDeclaration = function(payload) this._shorthandValues = WebInspector.CSSStyleDeclaration.buildShorthandValueMap(payload.shorthandEntries); this._livePropertyMap = {}; // LIVE properties (source-based or style-based) : { name -> CSSProperty } this._allProperties = []; // ALL properties: [ CSSProperty ] - this._longhandProperties = {}; // shorthandName -> [ CSSProperty ] this.__disabledProperties = {}; // DISABLED properties: { index -> CSSProperty } var payloadPropertyCount = payload.cssProperties.length; @@ -421,16 +457,6 @@ WebInspector.CSSStyleDeclaration = function(payload) var name = property.name; this[propertyIndex] = name; this._livePropertyMap[name] = property; - - // Index longhand properties. - if (property.shorthand) { // only for parsed - var longhands = this._longhandProperties[property.shorthand]; - if (!longhands) { - longhands = []; - this._longhandProperties[property.shorthand] = longhands; - } - longhands.push(property); - } ++propertyIndex; } this.length = propertyIndex; @@ -521,33 +547,25 @@ WebInspector.CSSStyleDeclaration.prototype = { * @param {string} name * @return {Array.<WebInspector.CSSProperty>} */ - getLonghandProperties: function(name) + longhandProperties: function(name) { - return this._longhandProperties[name] || []; + var longhands = WebInspector.CSSCompletions.cssPropertiesMetainfo.longhands(name); + var result = []; + for (var i = 0; longhands && i < longhands.length; ++i) { + var property = this._livePropertyMap[longhands[i]]; + if (property) + result.push(property); + } + return result; }, /** * @param {string} shorthandProperty * @return {string} */ - getShorthandValue: function(shorthandProperty) - { - var property = this.getLiveProperty(shorthandProperty); - return property ? property.value : this._shorthandValues[shorthandProperty]; - }, - - /** - * @param {string} shorthandProperty - * @return {?string} - */ - getShorthandPriority: function(shorthandProperty) + shorthandValue: function(shorthandProperty) { - var priority = this.getPropertyPriority(shorthandProperty); - if (priority) - return priority; - - var longhands = this._longhandProperties[shorthandProperty]; - return longhands ? this.getPropertyPriority(longhands[0]) : null; + return this._shorthandValues[shorthandProperty]; }, /** @@ -578,7 +596,7 @@ WebInspector.CSSStyleDeclaration.prototype = { newBlankProperty: function(index) { index = (typeof index === "undefined") ? this.pastLastSourcePropertyIndex() : index; - return new WebInspector.CSSProperty(this, index, "", "", "", "active", true, false, "", ""); + return new WebInspector.CSSProperty(this, index, "", "", "", "active", true, false, ""); }, /** @@ -636,6 +654,8 @@ WebInspector.CSSRule = function(payload) this.selectorText = payload.selectorText; this.sourceLine = payload.sourceLine; this.sourceURL = payload.sourceURL; + if (payload.sourceURL) + this._rawLocation = new WebInspector.CSSLocation(payload.sourceURL, payload.sourceLine); this.origin = payload.origin; this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style); this.style.parentRule = this; @@ -672,6 +692,16 @@ WebInspector.CSSRule.prototype = { get isRegular() { return this.origin === "regular"; + }, + + /** + * @return {?WebInspector.UILocation} + */ + uiLocation: function() + { + if (!this._rawLocation) + return null; + return WebInspector.cssModel._rawLocationToUILocation(this._rawLocation); } } @@ -685,10 +715,9 @@ WebInspector.CSSRule.prototype = { * @param {string} status * @param {boolean} parsedOk * @param {boolean} implicit - * @param {string} shorthand * @param {?string=} text */ -WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, shorthand, text) +WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, text) { this.ownerStyle = ownerStyle; this.index = index; @@ -698,7 +727,6 @@ WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, st this.status = status; this.parsedOk = parsedOk; this.implicit = implicit; - this.shorthand = shorthand; this.text = text; } @@ -715,9 +743,8 @@ WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload) // parsedOk: true // implicit: false // status: "style" - // shorthandName: "" var result = new WebInspector.CSSProperty( - ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? !!payload.parsedOk : true, !!payload.implicit, payload.shorthandName || "", payload.text); + ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? !!payload.parsedOk : true, !!payload.implicit, payload.text); return result; } diff --git a/Source/WebCore/inspector/front-end/ContentProviders.js b/Source/WebCore/inspector/front-end/ContentProviders.js index 9da727c81..e1c3996f3 100644 --- a/Source/WebCore/inspector/front-end/ContentProviders.js +++ b/Source/WebCore/inspector/front-end/ContentProviders.js @@ -263,7 +263,7 @@ WebInspector.StaticContentProvider.prototype = { */ contentType: function() { - return WebInspector.resourceTypes.Script; + return this._contentType; }, /** diff --git a/Source/WebCore/inspector/front-end/Drawer.js b/Source/WebCore/inspector/front-end/Drawer.js index 2a56fca38..a362cd20f 100644 --- a/Source/WebCore/inspector/front-end/Drawer.js +++ b/Source/WebCore/inspector/front-end/Drawer.js @@ -36,23 +36,16 @@ WebInspector.Drawer = function() this._savedHeight = 200; // Default. this._mainElement = document.getElementById("main"); this._toolbarElement = document.getElementById("toolbar"); - this._mainStatusBar = document.getElementById("main-status-bar"); - WebInspector.installDragHandle(this._mainStatusBar, this._startStatusBarDragging.bind(this), this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), "row-resize"); - this._counters = document.getElementById("counters"); + this._floatingStatusBarContainer = document.getElementById("floating-status-bar-container"); + WebInspector.installDragHandle(this._floatingStatusBarContainer, this._startStatusBarDragging.bind(this), this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), "row-resize"); this._drawerContentsElement = document.createElement("div"); this._drawerContentsElement.id = "drawer-contents"; this._drawerContentsElement.className = "drawer-contents"; this.element.appendChild(this._drawerContentsElement); - - this._drawerStatusBar = document.createElement("div"); - this._drawerStatusBar.id = "drawer-status-bar"; - this._drawerStatusBar.className = "status-bar"; - this.element.appendChild(this._drawerStatusBar); - this._viewStatusBar = document.createElement("div"); - this._drawerStatusBar.appendChild(this._viewStatusBar); + this._bottomStatusBar = document.getElementById("bottom-status-bar-container"); } WebInspector.Drawer.AnimationType = { @@ -75,8 +68,6 @@ WebInspector.Drawer.prototype = { show: function(view, animationType) { this.immediatelyFinishAnimation(); - if (this._view && this._view.counterElement) - this._view.counterElement.parentNode.removeChild(this._view.counterElement); var drawerWasVisible = this.visible; @@ -92,44 +83,29 @@ WebInspector.Drawer.prototype = { for (var i = 0; i < statusBarItems.length; ++i) this._viewStatusBar.appendChild(statusBarItems[i]); - if (this._view.counterElement) - this._counters.insertBefore(this._view.counterElement, this._counters.firstChild); - document.body.addStyleClass("drawer-visible"); + this._floatingStatusBarContainer.insertBefore(document.getElementById("panel-status-bar"), this._floatingStatusBarContainer.firstElementChild); + this._bottomStatusBar.appendChild(this._viewStatusBar); this._view.markAsRoot(); this._view.show(this._drawerContentsElement); if (drawerWasVisible) return; - var anchoredItems = document.getElementById("anchored-status-bar-items"); var height = this._constrainHeight(this._savedHeight || this.element.offsetHeight); var animations = [ {element: this.element, end: {height: height}}, {element: this._mainElement, end: {bottom: height}}, - {element: this._mainStatusBar, start: {"padding-left": anchoredItems.offsetWidth - 1}, end: {"padding-left": 0}}, + {element: this._floatingStatusBarContainer, start: {"padding-left": this._bottomStatusBar.offsetLeft}, end: {"padding-left": 0}}, {element: this._viewStatusBar, start: {opacity: 0}, end: {opacity: 1}} ]; - this._drawerStatusBar.insertBefore(anchoredItems, this._drawerStatusBar.firstChild); - - if (this._currentPanelCounters) { - var oldRight = this._drawerStatusBar.clientWidth - (this._counters.offsetLeft + this._currentPanelCounters.offsetWidth); - var newRight = WebInspector.Panel.counterRightMargin; - var rightPadding = (oldRight - newRight); - animations.push({element: this._currentPanelCounters, start: {"padding-right": rightPadding}, end: {"padding-right": 0}}); - this._currentPanelCounters.parentNode.removeChild(this._currentPanelCounters); - this._mainStatusBar.appendChild(this._currentPanelCounters); - } - function animationFinished() { WebInspector.inspectorView.currentPanel().doResize(); if (this._view && this._view.afterShow) this._view.afterShow(); delete this._currentAnimation; - if (this._currentPanelCounters) - this._currentPanelCounters.removeAttribute("style"); } this._currentAnimation = WebInspector.animateStyle(animations, this._animationDuration(animationType), animationFinished.bind(this)); @@ -147,45 +123,26 @@ WebInspector.Drawer.prototype = { WebInspector.restoreFocusFromElement(this.element); - var anchoredItems = document.getElementById("anchored-status-bar-items"); - // Temporarily set properties and classes to mimic the post-animation values so panels // like Elements in their updateStatusBarItems call will size things to fit the final location. - this._mainStatusBar.style.setProperty("padding-left", (anchoredItems.offsetWidth - 1) + "px"); document.body.removeStyleClass("drawer-visible"); WebInspector.inspectorView.currentPanel().statusBarResized(); document.body.addStyleClass("drawer-visible"); var animations = [ {element: this._mainElement, end: {bottom: 0}}, - {element: this._mainStatusBar, start: {"padding-left": 0}, end: {"padding-left": anchoredItems.offsetWidth - 1}}, + {element: this.element, end: {height: 0}}, + {element: this._floatingStatusBarContainer, start: {"padding-left": 0}, end: {"padding-left": this._bottomStatusBar.offsetLeft} }, {element: this._viewStatusBar, start: {opacity: 1}, end: {opacity: 0}} ]; - if (this._currentPanelCounters) { - var newRight = this._drawerStatusBar.clientWidth - this._counters.offsetLeft; - var oldRight = this._mainStatusBar.clientWidth - (this._currentPanelCounters.offsetLeft + this._currentPanelCounters.offsetWidth); - var rightPadding = (newRight - oldRight); - animations.push({element: this._currentPanelCounters, start: {"padding-right": 0}, end: {"padding-right": rightPadding}}); - } - function animationFinished() { WebInspector.inspectorView.currentPanel().doResize(); - this._mainStatusBar.insertBefore(anchoredItems, this._mainStatusBar.firstChild); - this._mainStatusBar.style.removeProperty("padding-left"); - - if (this._view.counterElement) - this._view.counterElement.parentNode.removeChild(this._view.counterElement); - - if (this._currentPanelCounters) { - this._currentPanelCounters.setAttribute("style", null); - this._currentPanelCounters.parentNode.removeChild(this._currentPanelCounters); - this._counters.insertBefore(this._currentPanelCounters, this._counters.firstChild); - } - this._view.detach(); delete this._view; + this._bottomStatusBar.removeChildren(); + this._bottomStatusBar.appendChild(document.getElementById("panel-status-bar")); this._drawerContentsElement.removeChildren(); document.body.removeStyleClass("drawer-visible"); delete this._currentAnimation; @@ -214,22 +171,6 @@ WebInspector.Drawer.prototype = { this._currentAnimation.forceComplete(); }, - set currentPanelCounters(x) - { - if (!x) { - if (this._currentPanelCounters) - this._currentPanelCounters.parentElement.removeChild(this._currentPanelCounters); - delete this._currentPanelCounters; - return; - } - - this._currentPanelCounters = x; - if (this.visible) - this._mainStatusBar.appendChild(x); - else - this._counters.insertBefore(x, this._counters.firstChild); - }, - _animationDuration: function(animationType) { switch (animationType) { @@ -247,7 +188,7 @@ WebInspector.Drawer.prototype = { */ _startStatusBarDragging: function(event) { - if (!this.visible || event.target !== this._mainStatusBar) + if (!this.visible || event.target !== this._floatingStatusBarContainer) return false; this._view.storeScrollPositions(); diff --git a/Source/WebCore/inspector/front-end/ExtensionAPI.js b/Source/WebCore/inspector/front-end/ExtensionAPI.js index 9cb2c31f8..4c97f6d2e 100644 --- a/Source/WebCore/inspector/front-end/ExtensionAPI.js +++ b/Source/WebCore/inspector/front-end/ExtensionAPI.js @@ -348,7 +348,7 @@ function ExtensionViewImpl(id) function dispatchShowEvent(message) { var frameIndex = message.arguments[0]; - this._fire(window.top.frames[frameIndex]); + this._fire(window.parent.frames[frameIndex]); } this.onShown = new EventSink(events.ViewShown + id, dispatchShowEvent); this.onHidden = new EventSink(events.ViewHidden + id); @@ -738,7 +738,7 @@ function ExtensionServerClient() this._port.addEventListener("message", this._onMessage.bind(this), false); this._port.start(); - top.postMessage("registerExtension", [ channel.port2 ], "*"); + window.parent.postMessage("registerExtension", [ channel.port2 ], "*"); } ExtensionServerClient.prototype = { diff --git a/Source/WebCore/inspector/front-end/ExtensionPanel.js b/Source/WebCore/inspector/front-end/ExtensionPanel.js index 4cdc81c99..1c696536d 100644 --- a/Source/WebCore/inspector/front-end/ExtensionPanel.js +++ b/Source/WebCore/inspector/front-end/ExtensionPanel.js @@ -47,7 +47,8 @@ WebInspector.ExtensionPanel = function(id, label, pageURL, iconURL) this._addStyleRule(".toolbar-item." + id + " .toolbar-icon", "background-image: url(" + iconURL + ");"); this._addStyleRule(".toolbar-small .toolbar-item." + id + " .toolbar-icon", "background-position-x: -32px;"); } - new WebInspector.ExtensionView(id, this.element, pageURL, "extension panel"); + var extensionView = new WebInspector.ExtensionView(id, pageURL, "extension panel"); + extensionView.show(this.element); } WebInspector.ExtensionPanel.prototype = { @@ -196,7 +197,9 @@ WebInspector.ExtensionSidebarPane.prototype = { if (this._extensionView) this._extensionView.detach(true); - this._extensionView = new WebInspector.ExtensionView(this._id, this.bodyElement, url, "extension fill"); + this._extensionView = new WebInspector.ExtensionView(this._id, url, "extension fill"); + this._extensionView.show(this.bodyElement); + if (!this.bodyElement.style.height) this.setHeight("150px"); }, diff --git a/Source/WebCore/inspector/front-end/ExtensionView.js b/Source/WebCore/inspector/front-end/ExtensionView.js index d79251882..d4cd72c4d 100644 --- a/Source/WebCore/inspector/front-end/ExtensionView.js +++ b/Source/WebCore/inspector/front-end/ExtensionView.js @@ -32,11 +32,10 @@ * @constructor * @extends {WebInspector.View} * @param {string} id - * @param {Element} parent * @param {string} src * @param {string} className */ -WebInspector.ExtensionView = function(id, parent, src, className) +WebInspector.ExtensionView = function(id, src, className) { WebInspector.View.call(this); this.element.className = "fill"; @@ -48,7 +47,6 @@ WebInspector.ExtensionView = function(id, parent, src, className) this._iframe.className = className; this.element.appendChild(this._iframe); - this.show(parent); } WebInspector.ExtensionView.prototype = { diff --git a/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png b/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png Binary files differindex d270e277f..28eb7f6bc 100644 --- a/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png +++ b/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png diff --git a/Source/WebCore/inspector/front-end/JavaScriptSource.js b/Source/WebCore/inspector/front-end/JavaScriptSource.js index 53afc906f..2ac4953ce 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSource.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSource.js @@ -40,127 +40,22 @@ WebInspector.JavaScriptSource = function(url, resource, contentProvider, sourceM { WebInspector.UISourceCode.call(this, url, resource, contentProvider, sourceMapping); this._isEditable = isEditable; - - this._formatterMapping = new WebInspector.IdentityFormatterSourceMapping(); - // FIXME: postpone breakpoints restore to after the mapping has been established. - setTimeout(function() { - if (!this._formatted) - WebInspector.breakpointManager.restoreBreakpoints(this); - }.bind(this), 0); } WebInspector.JavaScriptSource.prototype = { /** - * @param {?string} content - * @param {boolean} contentEncoded - * @param {string} mimeType - */ - fireContentAvailable: function(content, contentEncoded, mimeType) - { - WebInspector.UISourceCode.prototype.fireContentAvailable.call(this, content, contentEncoded, mimeType); - if (this._formatOnLoad) { - delete this._formatOnLoad; - this.setFormatted(true); - } - }, - - /** - * @param {boolean} formatted - * @param {function()=} callback - */ - setFormatted: function(formatted, callback) - { - callback = callback || function() {}; - if (!this.contentLoaded()) { - this._formatOnLoad = formatted; - callback(); - return; - } - - if (this._formatted === formatted) { - callback(); - return; - } - - this._formatted = formatted; - - // Re-request content - this._contentLoaded = false; - this._content = false; - WebInspector.UISourceCode.prototype.requestContent.call(this, didGetContent.bind(this)); - - /** - * @this {WebInspector.UISourceCode} - * @param {?string} content - * @param {boolean} contentEncoded - * @param {string} mimeType - */ - function didGetContent(content, contentEncoded, mimeType) - { - if (!formatted) { - this._togglingFormatter = true; - this.contentChanged(content || "", mimeType); - delete this._togglingFormatter; - this._formatterMapping = new WebInspector.IdentityFormatterSourceMapping(); - this.updateLiveLocations(); - callback(); - return; - } - - var formatter = new WebInspector.ScriptFormatter(); - formatter.formatContent(mimeType, content || "", didFormatContent.bind(this)); - - /** - * @this {WebInspector.UISourceCode} - * @param {string} formattedContent - * @param {WebInspector.FormatterSourceMapping} formatterMapping - */ - function didFormatContent(formattedContent, formatterMapping) - { - this._togglingFormatter = true; - this.contentChanged(formattedContent, mimeType); - delete this._togglingFormatter; - this._formatterMapping = formatterMapping; - this.updateLiveLocations(); - WebInspector.breakpointManager.restoreBreakpoints(this); - callback(); - } - } - }, - - /** - * @return {boolean} - */ - togglingFormatter: function() - { - return this._togglingFormatter; - }, - - /** * @param {number} lineNumber * @param {number} columnNumber * @return {WebInspector.DebuggerModel.Location} */ uiLocationToRawLocation: function(lineNumber, columnNumber) { - var location = this._formatterMapping.formattedToOriginal(lineNumber, columnNumber); - var rawLocation = WebInspector.UISourceCode.prototype.uiLocationToRawLocation.call(this, location[0], location[1]); + var rawLocation = WebInspector.UISourceCode.prototype.uiLocationToRawLocation.call(this, lineNumber, columnNumber); var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Location} */ rawLocation; return debuggerModelLocation; }, /** - * @param {WebInspector.UILocation} uiLocation - */ - overrideLocation: function(uiLocation) - { - var location = this._formatterMapping.originalToFormatted(uiLocation.lineNumber, uiLocation.columnNumber); - uiLocation.lineNumber = location[0]; - uiLocation.columnNumber = location[1]; - return uiLocation; - }, - - /** * @return {boolean} */ supportsEnabledBreakpointsWhileEditing: function() @@ -173,7 +68,7 @@ WebInspector.JavaScriptSource.prototype = { */ breakpointStorageId: function() { - return this._formatted ? "deobfuscated:" + this.url : this.url; + return this.formatted() ? "deobfuscated:" + this.url : this.url; }, /** @@ -223,6 +118,11 @@ WebInspector.JavaScriptSource.prototype = { var content = this.content(); var provider = content ? new WebInspector.StaticContentProvider(this._contentProvider.contentType(), content) : this._contentProvider; provider.searchInContent(query, caseSensitive, isRegex, callback); + }, + + formattedChanged: function() + { + WebInspector.breakpointManager.restoreBreakpoints(this); } } diff --git a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js index b83470a53..92e25dee9 100644 --- a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js +++ b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js @@ -428,7 +428,7 @@ WebInspector.NativeMemoryBarChart.prototype = { */ wasShown: function() { - this._timerId = setInterval(this._updateStats.bind(this), 200); + this._timerId = setInterval(this._updateStats.bind(this), 1000); }, _updateView: function() diff --git a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js index b951a406e..a036f410e 100644 --- a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js +++ b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js @@ -304,6 +304,8 @@ WebInspector.ObjectPropertyTreeElement.prototype = { if (this.property.value.subtype === "node") this.valueElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), false); + this.valueElement.title = description || ""; + this.listItemElement.removeChildren(); this.listItemElement.appendChild(this.nameElement); diff --git a/Source/WebCore/inspector/front-end/Panel.js b/Source/WebCore/inspector/front-end/Panel.js index 7891a0b5f..f65f5ea30 100644 --- a/Source/WebCore/inspector/front-end/Panel.js +++ b/Source/WebCore/inspector/front-end/Panel.js @@ -73,7 +73,7 @@ WebInspector.Panel.prototype = { this._statusBarItemContainer = document.createElement("div"); for (var i = 0; i < statusBarItems.length; ++i) this._statusBarItemContainer.appendChild(statusBarItems[i]); - document.getElementById("main-status-bar").appendChild(this._statusBarItemContainer); + document.getElementById("panel-status-bar").appendChild(this._statusBarItemContainer); } if ("_toolbarItem" in this) diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index ce1229620..ed3370d37 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -225,6 +225,11 @@ WebInspector.ProfilesPanel = function() this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profiles."), "clear-status-bar-item"); this.clearResultsButton.addEventListener("click", this._clearProfiles, this); + if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) { + this.garbageCollectButton = new WebInspector.StatusBarButton(WebInspector.UIString("Collect Garbage"), "garbage-collect-status-bar-item"); + this.garbageCollectButton.addEventListener("click", this._garbageCollectButtonClicked, this); + } + this.profileViewStatusBarItemsContainer = document.createElement("div"); this.profileViewStatusBarItemsContainer.className = "status-bar-items"; @@ -300,7 +305,10 @@ WebInspector.ProfilesPanel.prototype = { get statusBarItems() { - return [this.enableToggleButton.element, this.recordButton.element, this.clearResultsButton.element, this.profileViewStatusBarItemsContainer]; + var statusBarItems = [this.enableToggleButton.element, this.recordButton.element, this.clearResultsButton.element, this.profileViewStatusBarItemsContainer]; + if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) + statusBarItems.splice(3, 0, this.garbageCollectButton.element); + return statusBarItems; }, toggleRecordButton: function() @@ -408,6 +416,11 @@ WebInspector.ProfilesPanel.prototype = { this._reset(); }, + _garbageCollectButtonClicked: function() + { + ProfilerAgent.collectGarbage(); + }, + /** * @param {WebInspector.ProfileType} profileType */ diff --git a/Source/WebCore/inspector/front-end/SASSSourceMapping.js b/Source/WebCore/inspector/front-end/SASSSourceMapping.js new file mode 100644 index 000000000..32d6f80cf --- /dev/null +++ b/Source/WebCore/inspector/front-end/SASSSourceMapping.js @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @constructor + * @extends {WebInspector.Object} + * @implements {WebInspector.SourceMapping} + * @implements {WebInspector.UISourceCodeProvider} + */ +WebInspector.SASSSourceMapping = function() +{ + /** + * @type {Array.<WebInspector.UISourceCode>} + */ + this._uiSourceCodes = []; + this._uiSourceCodeForURL = {}; + this._uiLocations = {}; + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); +} + +WebInspector.SASSSourceMapping.prototype = { + _populate: function() + { + function populateFrame(frame) + { + for (var i = 0; i < frame.childFrames.length; ++i) + populateFrame.call(this, frame.childFrames[i]); + + var resources = frame.resources(); + for (var i = 0; i < resources.length; ++i) + this._resourceAdded({data:resources[i]}); + } + + populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame); + }, + + /** + * @param {WebInspector.Event} event + */ + _resourceAdded: function(event) + { + var resource = /** @type {WebInspector.Resource} */ event.data; + if (resource.type !== WebInspector.resourceTypes.Stylesheet) + return; + + /** + * @param {?string} content + * @param {boolean} contentEncoded + * @param {string} mimeType + */ + function didRequestContent(content, contentEncoded, mimeType) + { + if (!content) + return; + var lines = content.split(/\r?\n/); + var regex = /@media\s\-sass\-debug\-info{filename{font-family:([^}]+)}line{font-family:\\[0]+([^}]*)}}/i; + for (var lineNumber = 0; lineNumber < lines.length; ++lineNumber) { + var match = regex.exec(lines[lineNumber]); + if (!match) + continue; + var url = match[1].replace(/\\(.)/g, "$1"); + var uiSourceCode = this._uiSourceCodeForURL[url]; + if (!uiSourceCode) { + uiSourceCode = new WebInspector.SASSSource(url); + this._uiSourceCodeForURL[url] = uiSourceCode; + this._uiSourceCodes.push(uiSourceCode); + this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode); + WebInspector.cssModel.setSourceMapping(resource.url, this); + } + var line = parseInt(decodeURI(match[2].replace(/(..)/g, "%$1")), 10) - 1; + var rawLocationString = resource.url + ":" + (lineNumber + 1); + this._uiLocations[rawLocationString] = new WebInspector.UILocation(uiSourceCode, line, 0); + } + } + resource.requestContent(didRequestContent.bind(this)); + }, + + /** + * @param {WebInspector.RawLocation} rawLocation + * @return {WebInspector.UILocation} + */ + rawLocationToUILocation: function(rawLocation) + { + var location = /** @type WebInspector.CSSLocation */ rawLocation; + var uiLocation = this._uiLocations[location.url + ":" + location.lineNumber]; + if (!uiLocation) { + var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(location.url); + uiLocation = new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0); + } + return uiLocation; + }, + + /** + * @param {WebInspector.UISourceCode} uiSourceCode + * @param {number} lineNumber + * @param {number} columnNumber + * @return {WebInspector.RawLocation} + */ + uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) + { + // FIXME: Implement this when ui -> raw mapping has clients. + return new WebInspector.CSSLocation(uiSourceCode.contentURL() || "", lineNumber); + }, + + /** + * @return {Array.<WebInspector.UISourceCode>} + */ + uiSourceCodes: function() + { + return this._uiSourceCodes; + }, + + reset: function() + { + this._uiSourceCodes = []; + this._uiSourceCodeForURL = {}; + this._uiLocations = {}; + this._populate(); + } +} + +WebInspector.SASSSourceMapping.prototype.__proto__ = WebInspector.Object.prototype; + +/** + * @constructor + * @extends {WebInspector.UISourceCode} + * @param {string} sassURL + */ +WebInspector.SASSSource = function(sassURL) +{ + var content = InspectorFrontendHost.loadResourceSynchronously(sassURL); + var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content); + WebInspector.UISourceCode.call(this, sassURL, null, contentProvider); +} + +WebInspector.SASSSource.prototype = { + /** + * @return {boolean} + */ + isEditable: function() + { + return true; + } +} + +WebInspector.SASSSource.prototype.__proto__ = WebInspector.UISourceCode.prototype; diff --git a/Source/WebCore/inspector/front-end/Script.js b/Source/WebCore/inspector/front-end/Script.js index e973fc533..920ac2675 100644 --- a/Source/WebCore/inspector/front-end/Script.js +++ b/Source/WebCore/inspector/front-end/Script.js @@ -205,39 +205,32 @@ WebInspector.Script.prototype = { /** * @constructor + * @extends {WebInspector.LiveLocation} * @param {WebInspector.Script} script * @param {WebInspector.DebuggerModel.Location} rawLocation * @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate */ WebInspector.Script.Location = function(script, rawLocation, updateDelegate) { + WebInspector.LiveLocation.call(this, rawLocation, updateDelegate); this._script = script; - this._rawLocation = rawLocation; - this._updateDelegate = updateDelegate; - this._uiSourceCodes = []; } WebInspector.Script.Location.prototype = { - update: function() + /** + * @return {WebInspector.UILocation} + */ + uiLocation: function() { - var uiLocation = this._script.rawLocationToUILocation(this._rawLocation.lineNumber, this._rawLocation.columnNumber); - if (uiLocation) { - var uiSourceCode = uiLocation.uiSourceCode; - if (this._uiSourceCodes.indexOf(uiSourceCode) === -1) { - uiSourceCode.addLiveLocation(this); - this._uiSourceCodes.push(uiSourceCode); - } - var oneTime = this._updateDelegate(uiLocation); - if (oneTime) - this.dispose(); - } + var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Location} */ this.rawLocation(); + return this._script.rawLocationToUILocation(debuggerModelLocation.lineNumber, debuggerModelLocation.columnNumber); }, dispose: function() { - for (var i = 0; i < this._uiSourceCodes.length; ++i) - this._uiSourceCodes[i].removeLiveLocation(this); - this._uiSourceCodes = []; + WebInspector.LiveLocation.prototype.dispose.call(this); this._script._locations.remove(this); } } + +WebInspector.Script.Location.prototype.__proto__ = WebInspector.LiveLocation.prototype; diff --git a/Source/WebCore/inspector/front-end/ScriptFormatter.js b/Source/WebCore/inspector/front-end/ScriptFormatter.js index d7b2f8617..b99eab7cd 100644 --- a/Source/WebCore/inspector/front-end/ScriptFormatter.js +++ b/Source/WebCore/inspector/front-end/ScriptFormatter.js @@ -29,11 +29,21 @@ */ /** - * @constructor + * @interface */ -WebInspector.ScriptFormatter = function() +WebInspector.Formatter = function() { - this._tasks = []; +} + +/** + * @param {WebInspector.ResourceType} contentType + * @return {?WebInspector.Formatter} + */ +WebInspector.Formatter.createFormatter = function(contentType) +{ + if (contentType === WebInspector.resourceTypes.Script || contentType === WebInspector.resourceTypes.Document) + return new WebInspector.ScriptFormatter(); + return new WebInspector.IdentityFormatter(); } /** @@ -42,7 +52,7 @@ WebInspector.ScriptFormatter = function() * @param {number} columnNumber * @return {number} */ -WebInspector.ScriptFormatter.locationToPosition = function(lineEndings, lineNumber, columnNumber) +WebInspector.Formatter.locationToPosition = function(lineEndings, lineNumber, columnNumber) { var position = lineNumber ? lineEndings[lineNumber - 1] + 1 : 0; return position + columnNumber; @@ -53,7 +63,7 @@ WebInspector.ScriptFormatter.locationToPosition = function(lineEndings, lineNumb * @param {number} position * @return {Array.<number>} */ -WebInspector.ScriptFormatter.positionToLocation = function(lineEndings, position) +WebInspector.Formatter.positionToLocation = function(lineEndings, position) { var lineNumber = lineEndings.upperBound(position - 1); if (!lineNumber) @@ -63,10 +73,30 @@ WebInspector.ScriptFormatter.positionToLocation = function(lineEndings, position return [lineNumber, columnNumber]; } +WebInspector.Formatter.prototype = { + /** + * @param {string} mimeType + * @param {string} content + * @param {function(string, WebInspector.FormatterSourceMapping)} callback + */ + formatContent: function(mimeType, content, callback) + { + } +} + +/** + * @constructor + * @implements {WebInspector.Formatter} + */ +WebInspector.ScriptFormatter = function() +{ + this._tasks = []; +} + WebInspector.ScriptFormatter.prototype = { /** * @param {string} mimeType - * @param {?string} content + * @param {string} content * @param {function(string, WebInspector.FormatterSourceMapping)} callback */ formatContent: function(mimeType, content, callback) @@ -103,6 +133,27 @@ WebInspector.ScriptFormatter.prototype = { /** * @constructor + * @implements {WebInspector.Formatter} + */ +WebInspector.IdentityFormatter = function() +{ + this._tasks = []; +} + +WebInspector.IdentityFormatter.prototype = { + /** + * @param {string} mimeType + * @param {string} content + * @param {function(string, WebInspector.FormatterSourceMapping)} callback + */ + formatContent: function(mimeType, content, callback) + { + callback(content, new WebInspector.IdentityFormatterSourceMapping()); + } +} + +/** + * @constructor */ WebInspector.FormatterMappingPayload = function() { @@ -185,9 +236,9 @@ WebInspector.FormatterSourceMappingImpl.prototype = { */ originalToFormatted: function(lineNumber, columnNumber) { - var originalPosition = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, lineNumber, columnNumber || 0); + var originalPosition = WebInspector.Formatter.locationToPosition(this._originalLineEndings, lineNumber, columnNumber || 0); var formattedPosition = this._convertPosition(this._mapping.original, this._mapping.formatted, originalPosition || 0); - return WebInspector.ScriptFormatter.positionToLocation(this._formattedLineEndings, formattedPosition); + return WebInspector.Formatter.positionToLocation(this._formattedLineEndings, formattedPosition); }, /** @@ -197,9 +248,9 @@ WebInspector.FormatterSourceMappingImpl.prototype = { */ formattedToOriginal: function(lineNumber, columnNumber) { - var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(this._formattedLineEndings, lineNumber, columnNumber || 0); + var formattedPosition = WebInspector.Formatter.locationToPosition(this._formattedLineEndings, lineNumber, columnNumber || 0); var originalPosition = this._convertPosition(this._mapping.formatted, this._mapping.original, formattedPosition); - return WebInspector.ScriptFormatter.positionToLocation(this._originalLineEndings, originalPosition || 0); + return WebInspector.Formatter.positionToLocation(this._originalLineEndings, originalPosition || 0); }, /** diff --git a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js index eec340acd..77426ab9d 100644 --- a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js +++ b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js @@ -548,3 +548,35 @@ WebInspector.SnippetContentProvider.prototype.__proto__ = WebInspector.StaticCon * @type {?WebInspector.ScriptSnippetModel} */ WebInspector.scriptSnippetModel = null; + +/** + * @constructor + * @extends {WebInspector.JavaScriptSourceFrame} + * @param {WebInspector.ScriptsPanel} scriptsPanel + * @param {WebInspector.SnippetJavaScriptSource} snippetJavaScriptSource + */ +WebInspector.SnippetJavaScriptSourceFrame = function(scriptsPanel, snippetJavaScriptSource) +{ + WebInspector.JavaScriptSourceFrame.call(this, scriptsPanel, snippetJavaScriptSource); + + this._snippetJavaScriptSource = snippetJavaScriptSource; + this._runButton = new WebInspector.StatusBarButton(WebInspector.UIString("Run"), "evaluate-snippet-status-bar-item"); + this._runButton.addEventListener("click", this._runButtonClicked, this); +} + +WebInspector.SnippetJavaScriptSourceFrame.prototype = { + /** + * @return {Array.<Element>} + */ + statusBarItems: function() + { + return [this._runButton.element]; + }, + + _runButtonClicked: function() + { + this._snippetJavaScriptSource.evaluate(); + } +} + +WebInspector.SnippetJavaScriptSourceFrame.prototype.__proto__ = WebInspector.JavaScriptSourceFrame.prototype; diff --git a/Source/WebCore/inspector/front-end/ScriptsNavigator.js b/Source/WebCore/inspector/front-end/ScriptsNavigator.js index d8caf8416..2eeef73c7 100644 --- a/Source/WebCore/inspector/front-end/ScriptsNavigator.js +++ b/Source/WebCore/inspector/front-end/ScriptsNavigator.js @@ -212,20 +212,7 @@ WebInspector.SnippetsNavigatorView.prototype = { */ getOrCreateFolderTreeElement: function(uiSourceCode) { - if (uiSourceCode.isSnippet) - return this._scriptsTree; - if (uiSourceCode.isSnippetEvaluation) - return this._getOrCreateSnippetEvaluationsFolderTreeElement(); - return WebInspector.NavigatorView.prototype.getOrCreateFolderTreeElement.call(this, uiSourceCode); - }, - - _getOrCreateSnippetEvaluationsFolderTreeElement: function() - { - const snippetEvaluationsFolderIdentifier = "snippetEvaluationsFolder"; - var folderTreeElement = this._folderTreeElements[snippetEvaluationsFolderIdentifier]; - if (folderTreeElement) - return folderTreeElement; - return this.createFolderTreeElement(this._scriptsTree, snippetEvaluationsFolderIdentifier, "", WebInspector.UIString("Evaluated snippets")); + return this._scriptsTree; }, /** @@ -236,12 +223,12 @@ WebInspector.SnippetsNavigatorView.prototype = { { var contextMenu = new WebInspector.ContextMenu(); if (uiSourceCode) { - contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Evaluate snippet" : "Evaluate Snippet"), this._handleEvaluateSnippet.bind(this, uiSourceCode)); - contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Rename snippet" : "Rename Snippet"), this._handleRenameSnippet.bind(this, uiSourceCode)); - contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove snippet" : "Remove Snippet"), this._handleRemoveSnippet.bind(this, uiSourceCode)); + contextMenu.appendItem(WebInspector.UIString("Run"), this._handleEvaluateSnippet.bind(this, uiSourceCode)); + contextMenu.appendItem(WebInspector.UIString("Rename"), this._handleRenameSnippet.bind(this, uiSourceCode)); + contextMenu.appendItem(WebInspector.UIString("Remove"), this._handleRemoveSnippet.bind(this, uiSourceCode)); contextMenu.appendSeparator(); } - contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Create snippet" : "Create Snippet"), this._handleCreateSnippet.bind(this)); + contextMenu.appendItem(WebInspector.UIString("New"), this._handleCreateSnippet.bind(this)); contextMenu.show(event); }, diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index 61758f666..fd29ec9b0 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -382,7 +382,7 @@ WebInspector.ScriptsPanel.prototype = { var sourceFrame = this.visibleView; if (sourceFrame) { - var statusBarItems = sourceFrame.statusBarItems || []; + var statusBarItems = sourceFrame.statusBarItems() || []; for (var i = 0; i < statusBarItems.length; ++i) this._scriptViewStatusBarItemsContainer.appendChild(statusBarItems[i]); } @@ -461,17 +461,14 @@ WebInspector.ScriptsPanel.prototype = { _createSourceFrame: function(uiSourceCode) { var sourceFrame; - if (uiSourceCode instanceof WebInspector.JavaScriptSource) { - var javaScriptSource = /** @type {WebInspector.JavaScriptSource} */ uiSourceCode; - sourceFrame = new WebInspector.JavaScriptSourceFrame(this, javaScriptSource); - } else if (uiSourceCode instanceof WebInspector.StyleSource) { - var styleSource = /** @type {WebInspector.StyleSource} */ uiSourceCode; - sourceFrame = new WebInspector.StyleSourceFrame(styleSource); - } else { - console.assert(false, "Unknown UISourceCode type"); - sourceFrame = new WebInspector.SourceFrame(uiSourceCode); - } - + if (uiSourceCode instanceof WebInspector.SnippetJavaScriptSource) { + var snippetJavaScriptSource = /** @type {WebInspector.SnippetJavaScriptSource} */ uiSourceCode; + sourceFrame = new WebInspector.SnippetJavaScriptSourceFrame(this, snippetJavaScriptSource); + } else if (uiSourceCode instanceof WebInspector.JavaScriptSource) { + var javaScriptSource = /** @type {WebInspector.JavaScriptSource} */ uiSourceCode; + sourceFrame = new WebInspector.JavaScriptSourceFrame(this, javaScriptSource); + } else + sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); return sourceFrame; }, diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index fc6938a41..fc8332502 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -56,6 +56,7 @@ var Capabilities = { heapProfilerPresent: false, canOverrideDeviceMetrics: false, timelineSupportsFrameInstrumentation: false, + canOverrideGeolocation: false, } /** @@ -98,6 +99,7 @@ WebInspector.Settings = function() this.zoomLevel = this.createSetting("zoomLevel", 0); this.savedURLs = this.createSetting("savedURLs", {}); this.javaScriptDisabled = this.createSetting("javaScriptDisabled", false); + this.geolocationOverride = this.createSetting("geolocationOverride", ""); // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused // periodical breakpoints duplication leading to inspector slowness. @@ -187,6 +189,8 @@ WebInspector.ExperimentsSettings = function() this.liveNativeMemoryChart = this._createExperiment("liveNativeMemoryChart", "Live native memory chart"); this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection"); this.mainThreadMonitoring = this._createExperiment("mainThreadMonitoring", "Show CPU activity in Timeline"); + this.geolocationOverride = this._createExperiment("geolocationOverride", "Override Device Geolocation"); + this.sass = this._createExperiment("sass", "Support for SASS"); this._cleanUpSetting(); } diff --git a/Source/WebCore/inspector/front-end/SettingsScreen.js b/Source/WebCore/inspector/front-end/SettingsScreen.js index 6876e86cb..ff6e313fe 100644 --- a/Source/WebCore/inspector/front-end/SettingsScreen.js +++ b/Source/WebCore/inspector/front-end/SettingsScreen.js @@ -349,6 +349,8 @@ WebInspector.UserAgentSettingsTab = function() p.appendChild(this._createUserAgentControl()); if (Capabilities.canOverrideDeviceMetrics) p.appendChild(this._createDeviceMetricsControl()); + if (Capabilities.canOverrideGeolocation && WebInspector.experimentsSettings.geolocationOverride.isEnabled()) + p.appendChild(this._createGeolocationOverrideControl()); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents)); } @@ -649,6 +651,116 @@ WebInspector.UserAgentSettingsTab.prototype = { cellElement.appendChild(this._createCheckboxSetting(WebInspector.UIString("Fit in window"), WebInspector.settings.deviceFitWindow, true, this._fitWindowCheckboxElement)); return fieldsetElement; + }, + + _createGeolocationOverrideControl: function() + { + const geolocationSetting = WebInspector.settings.geolocationOverride.get(); + var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseSetting(geolocationSetting); + var p = document.createElement("p"); + var labelElement = p.createChild("label"); + var checkboxElement = labelElement.createChild("input"); + checkboxElement.id = "geolocation-override-checkbox"; + checkboxElement.type = "checkbox"; + checkboxElement.checked = !geolocation || (((typeof geolocation.latitude === "number") && (typeof geolocation.longitude === "number")) || geolocation.error); + checkboxElement.addEventListener("click", this._onGeolocationOverrideCheckboxClicked.bind(this), false); + this._geolocationOverrideCheckboxElement = checkboxElement; + labelElement.appendChild(document.createTextNode(WebInspector.UIString("Override Geolocation"))); + + var geolocationSectionElement = this._createGeolocationOverrideElement(geolocation); + p.appendChild(geolocationSectionElement); + this._geolocationSectionElement = geolocationSectionElement; + this._setGeolocationPosition(geolocation, false, true); + return p; + }, + + _onGeolocationOverrideCheckboxClicked: function() + { + var controlsDisabled = !this._geolocationOverrideCheckboxElement.checked; + this._latitudeElement.disabled = controlsDisabled; + this._longitudeElement.disabled = controlsDisabled; + this._geolocationErrorElement.disabled = controlsDisabled; + + if (this._geolocationOverrideCheckboxElement.checked) { + var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value, this._longitudeElement.value, this._geolocationErrorElement.checked); + if (geolocation) + this._setGeolocationPosition(geolocation, false, false); + if (!this._latitudeElement.value) + this._latitudeElement.focus(); + } else + WebInspector.UserAgentSupport.GeolocationPosition.clearGeolocationOverride(); + }, + + _applyGeolocationUserInput: function() + { + this._setGeolocationPosition(WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value.trim(), this._longitudeElement.value.trim(), this._geolocationErrorElement.checked), true, false); + }, + + /** + * @param {?WebInspector.UserAgentSupport.GeolocationPosition} geolocation + * @param {boolean} userInputModified + * @param {boolean} updateCheckbox + */ + _setGeolocationPosition: function(geolocation, userInputModified, updateCheckbox) + { + if (!geolocation) + return; + + if (!userInputModified) { + this._latitudeElement.value = geolocation.latitude; + this._longitudeElement.value = geolocation.longitude; + } + + var value = geolocation.toSetting(); + WebInspector.settings.geolocationOverride.set(value); + + if (this._geolocationOverrideCheckboxElement && updateCheckbox) { + this._geolocationOverrideCheckboxElement.checked = !!geolocation.toSetting(); + this._onGeolocationOverrideCheckboxClicked(); + } + }, + + /** + * @param {WebInspector.UserAgentSupport.GeolocationPosition} geolocation + */ + _createGeolocationOverrideElement: function(geolocation) + { + var fieldsetElement = document.createElement("fieldset"); + fieldsetElement.id = "geolocation-override-section"; + + function createInput(parentElement, id, defaultText) + { + var element = parentElement.createChild("input"); + element.id = id; + element.maxLength = 12; + element.style.width = "80px"; + element.value = defaultText; + element.addEventListener("blur", this._applyGeolocationUserInput.bind(this), false); + return element; + } + + var tableElement = fieldsetElement.createChild("table"); + + var rowElement = tableElement.createChild("tr"); + var cellElement = rowElement.createChild("td"); + cellElement.appendChild(document.createTextNode(WebInspector.UIString("Geolocation Position") + ":")); + cellElement = rowElement.createChild("td"); + this._latitudeElement = createInput.call(this, cellElement, "geolocation-override-latitude", String(geolocation.latitude)); + cellElement.appendChild(document.createTextNode(" , ")); + this._longitudeElement = createInput.call(this, cellElement, "geolocation-override-longitude", String(geolocation.longitude)); + rowElement = tableElement.createChild("tr"); + cellElement = rowElement.createChild("td"); + var geolocationErrorLabelElement = document.createElement("label"); + var geolocationErrorCheckboxElement = geolocationErrorLabelElement.createChild("input"); + geolocationErrorCheckboxElement.id = "geolocation-error"; + geolocationErrorCheckboxElement.type = "checkbox"; + geolocationErrorCheckboxElement.checked = !geolocation || geolocation.error; + geolocationErrorCheckboxElement.addEventListener("click", this._applyGeolocationUserInput.bind(this), false); + geolocationErrorLabelElement.appendChild(document.createTextNode(WebInspector.UIString("Emulate position unavailable"))); + this._geolocationErrorElement = geolocationErrorCheckboxElement; + cellElement.appendChild(geolocationErrorLabelElement); + + return fieldsetElement; } } diff --git a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js index 42638b312..8d5b8de82 100644 --- a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js +++ b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js @@ -52,7 +52,7 @@ WebInspector.SourceCSSTokenizer = function() { WebInspector.SourceTokenizer.call(this); - this._propertyKeywords = WebInspector.CSSCompletions.cssNameCompletions.keySet(); + this._propertyKeywords = WebInspector.CSSCompletions.cssPropertiesMetainfo.keySet(); this._colorKeywords = WebInspector.CSSKeywordCompletions.colors(); this._valueKeywords = [ diff --git a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js index 017d59063..9e7b3ff22 100644 --- a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js +++ b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js @@ -51,7 +51,7 @@ WebInspector.SourceCSSTokenizer = function() { WebInspector.SourceTokenizer.call(this); - this._propertyKeywords = WebInspector.CSSCompletions.cssNameCompletions.keySet(); + this._propertyKeywords = WebInspector.CSSCompletions.cssPropertiesMetainfo.keySet(); this._colorKeywords = WebInspector.CSSKeywordCompletions.colors(); this._valueKeywords = [ diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index 203718612..29464dfee 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -103,6 +103,14 @@ WebInspector.SourceFrame.prototype = { this._clearLineToReveal(); }, + /** + * @return {Array.<Element>} + */ + statusBarItems: function() + { + return []; + }, + defaultFocusedElement: function() { return this._textEditor.defaultFocusedElement(); diff --git a/Source/WebCore/inspector/front-end/StylesPanel.js b/Source/WebCore/inspector/front-end/StylesPanel.js index d3ee08f0b..c41dc7faf 100644 --- a/Source/WebCore/inspector/front-end/StylesPanel.js +++ b/Source/WebCore/inspector/front-end/StylesPanel.js @@ -30,6 +30,7 @@ * @constructor * @extends {WebInspector.Object} * @implements {WebInspector.UISourceCodeProvider} + * @implements {WebInspector.SourceMapping} */ WebInspector.StylesUISourceCodeProvider = function() { @@ -37,6 +38,7 @@ WebInspector.StylesUISourceCodeProvider = function() * @type {Array.<WebInspector.UISourceCode>} */ this._uiSourceCodes = []; + this._uiSourceCodeForURL = {}; WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); } @@ -49,6 +51,28 @@ WebInspector.StylesUISourceCodeProvider.prototype = { return this._uiSourceCodes; }, + /** + * @param {WebInspector.RawLocation} rawLocation + * @return {WebInspector.UILocation} + */ + rawLocationToUILocation: function(rawLocation) + { + var location = /** @type WebInspector.CSSLocation */ rawLocation; + var uiSourceCode = this._uiSourceCodeForURL[location.url]; + return new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0); + }, + + /** + * @param {WebInspector.UISourceCode} uiSourceCode + * @param {number} lineNumber + * @param {number} columnNumber + * @return {WebInspector.RawLocation} + */ + uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) + { + return new WebInspector.CSSLocation(uiSourceCode.contentURL() || "", lineNumber); + }, + _populate: function() { function populateFrame(frame) @@ -64,19 +88,26 @@ WebInspector.StylesUISourceCodeProvider.prototype = { populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame); }, + /** + * @param {WebInspector.Event} event + */ _resourceAdded: function(event) { - var resource = event.data; + var resource = /** @type {WebInspector.Resource} */ event.data; if (resource.type !== WebInspector.resourceTypes.Stylesheet) return; var uiSourceCode = new WebInspector.StyleSource(resource); this._uiSourceCodes.push(uiSourceCode); + this._uiSourceCodeForURL[resource.url] = uiSourceCode; + WebInspector.cssModel.setSourceMapping(resource.url, this); this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode); }, reset: function() { this._uiSourceCodes = []; + this._uiSourceCodeForURL = {}; + WebInspector.cssModel.resetSourceMappings(); this._populate(); } } @@ -168,73 +199,6 @@ WebInspector.InspectorStyleSource.prototype.__proto__ = WebInspector.UISourceCod /** * @constructor - * @extends {WebInspector.SourceFrame} - * @param {WebInspector.StyleSource} styleSource - */ -WebInspector.StyleSourceFrame = function(styleSource) -{ - this._styleSource = styleSource; - WebInspector.SourceFrame.call(this, this._styleSource); - this._styleSource.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this); -} - -WebInspector.StyleSourceFrame.prototype = { - /** - * @return {boolean} - */ - canEditSource: function() - { - return true; - }, - - /** - * @param {string} text - */ - commitEditing: function(text) - { - if (!this._styleSource.isDirty()) - return; - - this._isCommittingEditing = true; - this._styleSource.commitWorkingCopy(this._didEditContent.bind(this)); - }, - - afterTextChanged: function(oldRange, newRange) - { - this._styleSource.setWorkingCopy(this.textModel.text()); - }, - - _didEditContent: function(error) - { - if (error) { - WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true); - return; - } - delete this._isCommittingEditing; - }, - - /** - * @param {WebInspector.Event} event - */ - _onContentChanged: function(event) - { - if (!this._isCommittingEditing) - this.setContent(this._styleSource.content() || "", false, "text/css"); - }, - - populateTextAreaContextMenu: function(contextMenu, lineNumber) - { - WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber); - var scriptsPanel = WebInspector.panels.scripts; - contextMenu.appendApplicableItems(this._styleSource); - contextMenu.appendSeparator(); - } -} - -WebInspector.StyleSourceFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype; - -/** - * @constructor * @implements {WebInspector.SelectionDialogContentProvider} * @param {WebInspector.View} view * @param {WebInspector.StyleSource} styleSource diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js index 40d3416b9..7415f1cd6 100644 --- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js @@ -984,7 +984,11 @@ WebInspector.StylePropertiesSection.prototype = { return false; }, - isPropertyOverloaded: function(propertyName, shorthand) + /** + * @param {string} propertyName + * @param {boolean=} isShorthand + */ + isPropertyOverloaded: function(propertyName, isShorthand) { if (!this._usedProperties || this.noAffect) return false; @@ -996,12 +1000,12 @@ WebInspector.StylePropertiesSection.prototype = { var canonicalName = WebInspector.StylesSidebarPane.canonicalPropertyName(propertyName); var used = (canonicalName in this._usedProperties); - if (used || !shorthand) + if (used || !isShorthand) return !used; // Find out if any of the individual longhand properties of the shorthand // are used, if none are then the shorthand is overloaded too. - var longhandProperties = this.styleRule.style.getLonghandProperties(propertyName); + var longhandProperties = this.styleRule.style.longhandProperties(propertyName); for (var j = 0; j < longhandProperties.length; ++j) { var individualProperty = longhandProperties[j]; if (WebInspector.StylesSidebarPane.canonicalPropertyName(individualProperty.name) in this._usedProperties) @@ -1051,7 +1055,7 @@ WebInspector.StylePropertiesSection.prototype = { } else { var child = this.propertiesTreeOutline.children[0]; while (child) { - child.overloaded = this.isPropertyOverloaded(child.name, child.shorthand); + child.overloaded = this.isPropertyOverloaded(child.name, child.isShorthand); child = child.traverseNextTreeElement(false, null, true); } } @@ -1069,52 +1073,66 @@ WebInspector.StylePropertiesSection.prototype = { onpopulate: function() { var style = this.styleRule.style; - - var handledProperties = {}; - var shorthandNames = {}; - - this.uniqueProperties = []; var allProperties = style.allProperties; - for (var i = 0; i < allProperties.length; ++i) - this.uniqueProperties.push(allProperties[i]); + this.uniqueProperties = []; - // Collect all shorthand names. - for (var i = 0; i < this.uniqueProperties.length; ++i) { - var property = this.uniqueProperties[i]; - if (property.disabled) - continue; - if (property.shorthand) - shorthandNames[property.shorthand] = true; + var styleHasEditableSource = this.editable && !!style.range; + if (styleHasEditableSource) { + for (var i = 0; i < allProperties.length; ++i) { + var property = allProperties[i]; + this.uniqueProperties.push(property); + if (property.styleBased) + continue; + + var isShorthand = !!WebInspector.CSSCompletions.cssPropertiesMetainfo.longhands(property.name); + var inherited = this.isPropertyInherited(property.name); + var overloaded = this.isPropertyOverloaded(property.name); + var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded); + this.propertiesTreeOutline.appendChild(item); + } + return; } - // Create property tree elements. - for (var i = 0; i < this.uniqueProperties.length; ++i) { - var property = this.uniqueProperties[i]; - var shorthand = !property.disabled && !property.inactive ? property.shorthand : null; + var generatedShorthands = {}; + // For style-based properties, generate shorthands with values when possible. + for (var i = 0; i < allProperties.length; ++i) { + var property = allProperties[i]; + this.uniqueProperties.push(property); + var isShorthand = !!WebInspector.CSSCompletions.cssPropertiesMetainfo.longhands(property.name); + + // For style-based properties, try generating shorthands. + var shorthands = isShorthand ? null : WebInspector.CSSCompletions.cssPropertiesMetainfo.shorthands(property.name); + var shorthandPropertyAvailable = false; + for (var j = 0; shorthands && !shorthandPropertyAvailable && j < shorthands.length; ++j) { + var shorthand = shorthands[j]; + if (shorthand in generatedShorthands) { + shorthandPropertyAvailable = true; + continue; // There already is a shorthand this longhands falls under. + } + if (style.getLiveProperty(shorthand)) { + shorthandPropertyAvailable = true; + continue; // There is an explict shorthand property this longhands falls under. + } + if (!style.shorthandValue(shorthand)) { + shorthandPropertyAvailable = false; + continue; // Never generate synthetic shorthands when no value is available. + } - if (shorthand) { - if (shorthand in handledProperties) - continue; - // We should only create synthetic shorthands if they are not present in the style source (i.e. we are dealing with a source-less style). - if (!style.getLiveProperty(shorthand)) - property = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.getShorthandValue(shorthand), style.getShorthandPriority(shorthand), "style", true, true, "", undefined); - else - shorthand = null; + // Generate synthetic shorthand we have a value for. + var shorthandProperty = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.shorthandValue(shorthand), "", "style", true, true, undefined); + var overloaded = this.isPropertyOverloaded(property.name, true); + var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, shorthandProperty, /* isShorthand */ true, /* inherited */ false, overloaded); + this.propertiesTreeOutline.appendChild(item); + generatedShorthands[shorthand] = shorthandProperty; + shorthandPropertyAvailable = true; } + if (shorthandPropertyAvailable) + continue; // Shorthand for the property found. - // BUG71275: Never show purely style-based properties in editable rules. - if (!shorthand && this.editable && property.styleBased) - continue; - - var isShorthand = !!(property.isLive && (shorthand || shorthandNames[property.name])); - if (isShorthand && (property.name in handledProperties)) - continue; var inherited = this.isPropertyInherited(property.name); var overloaded = this.isPropertyOverloaded(property.name, isShorthand); - var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded); this.propertiesTreeOutline.appendChild(item); - handledProperties[property.name] = property; } }, @@ -1162,6 +1180,10 @@ WebInspector.StylePropertiesSection.prototype = { _createRuleOriginNode: function() { + /** + * @param {string} url + * @param {number} line + */ function linkifyUncopyable(url, line) { var link = WebInspector.linkifyResourceAsNode(url, line, "", url + ":" + (line + 1)); @@ -1172,8 +1194,13 @@ WebInspector.StylePropertiesSection.prototype = { return link; } - if (this.styleRule.sourceURL) - return linkifyUncopyable(this.styleRule.sourceURL, this.rule.sourceLine); + if (this.styleRule.sourceURL) { + var uiLocation = this.rule.uiLocation(); + if (uiLocation) + return linkifyUncopyable(uiLocation.url(), uiLocation.lineNumber); + else + return linkifyUncopyable(this.styleRule.sourceURL, this.rule.sourceLine); + } if (!this.rule) return document.createTextNode(""); @@ -1512,21 +1539,28 @@ WebInspector.BlankStylePropertiesSection.prototype.__proto__ = WebInspector.Styl /** * @constructor * @extends {TreeElement} + * @param {WebInspector.StylePropertiesSection|WebInspector.ComputedStylePropertiesSection} section * @param {?WebInspector.StylesSidebarPane} parentPane + * @param {Object} styleRule + * @param {WebInspector.CSSStyleDeclaration} style + * @param {WebInspector.CSSProperty} property + * @param {boolean} isShorthand + * @param {boolean} inherited + * @param {boolean} overloaded */ -WebInspector.StylePropertyTreeElement = function(section, parentPane, styleRule, style, property, shorthand, inherited, overloaded) +WebInspector.StylePropertyTreeElement = function(section, parentPane, styleRule, style, property, isShorthand, inherited, overloaded) { this.section = section; this._parentPane = parentPane; this._styleRule = styleRule; this.style = style; this.property = property; - this.shorthand = shorthand; + this.isShorthand = isShorthand; this._inherited = inherited; this._overloaded = overloaded; // Pass an empty title, the title gets made later in onattach. - TreeElement.call(this, "", null, shorthand); + TreeElement.call(this, "", null, isShorthand); this.selectable = false; } @@ -1897,7 +1931,7 @@ WebInspector.StylePropertyTreeElement.prototype = { // Add a separate exclamation mark IMG element with a tooltip. var exclamationElement = document.createElement("img"); exclamationElement.className = "exclamation-mark"; - exclamationElement.title = WebInspector.CSSCompletions.cssNameCompletions.keySet()[this.property.name.toLowerCase()] ? WebInspector.UIString("Invalid property value.") : WebInspector.UIString("Unknown property name."); + exclamationElement.title = WebInspector.CSSCompletions.cssPropertiesMetainfo.keySet()[this.property.name.toLowerCase()] ? WebInspector.UIString("Invalid property value.") : WebInspector.UIString("Unknown property name."); this.listItemElement.insertBefore(exclamationElement, this.listItemElement.firstChild); } if (this.property.inactive) @@ -1968,21 +2002,23 @@ WebInspector.StylePropertyTreeElement.prototype = { onpopulate: function() { // Only populate once and if this property is a shorthand. - if (this.children.length || !this.shorthand) + if (this.children.length || !this.isShorthand) return; - var longhandProperties = this.style.getLonghandProperties(this.name); + var longhandProperties = this.style.longhandProperties(this.name); for (var i = 0; i < longhandProperties.length; ++i) { var name = longhandProperties[i].name; - if (this.treeOutline.section) { var inherited = this.treeOutline.section.isPropertyInherited(name); var overloaded = this.treeOutline.section.isPropertyOverloaded(name); } var liveProperty = this.style.getLiveProperty(name); - var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded); + if (!liveProperty) + continue; + + var item = new WebInspector.StylePropertyTreeElement(this.section, this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded); this.appendChild(item); } }, @@ -2029,7 +2065,7 @@ WebInspector.StylePropertyTreeElement.prototype = { startEditing: function(selectElement) { // FIXME: we don't allow editing of longhand properties under a shorthand right now. - if (this.parent.shorthand) + if (this.parent.isShorthand) return; if (selectElement === this._expandElement) @@ -2112,7 +2148,7 @@ WebInspector.StylePropertyTreeElement.prototype = { selectElement.parentElement.scrollIntoViewIfNeeded(false); var applyItemCallback = !isEditingName ? this._applyFreeFlowStyleTextEdit.bind(this, true) : undefined; - this._prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(isEditingName ? WebInspector.CSSCompletions.cssNameCompletions : WebInspector.CSSKeywordCompletions.forProperty(this.nameElement.textContent), this, isEditingName); + this._prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(isEditingName ? WebInspector.CSSCompletions.cssPropertiesMetainfo : WebInspector.CSSKeywordCompletions.forProperty(this.nameElement.textContent), this, isEditingName); if (applyItemCallback) { this._prompt.addEventListener(WebInspector.TextPrompt.Events.ItemApplied, applyItemCallback, this); this._prompt.addEventListener(WebInspector.TextPrompt.Events.ItemAccepted, applyItemCallback, this); diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index d7cc9cb3e..f9a7f81a0 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -202,7 +202,14 @@ WebInspector.TimelinePanel.prototype = { get statusBarItems() { - var statusBarItems = [ this.toggleFilterButton.element, this.toggleTimelineButton.element, this.clearButton.element, this.garbageCollectButton.element, this._glueParentButton.element, this.statusBarFilters ]; + var statusBarItems = [ + this.toggleFilterButton.element, + this.toggleTimelineButton.element, + this.clearButton.element, this.garbageCollectButton.element, + this._glueParentButton.element, + this.statusBarFilters, + this.recordsCounter + ]; return statusBarItems; }, @@ -592,13 +599,11 @@ WebInspector.TimelinePanel.prototype = { } this._overviewPane.setMode(this._overviewModeSetting.get()); this._refresh(); - WebInspector.drawer.currentPanelCounters = this.recordsCounter; }, willHide: function() { this._closeRecordDetails(); - WebInspector.drawer.currentPanelCounters = null; WebInspector.Panel.prototype.willHide.call(this); }, diff --git a/Source/WebCore/inspector/front-end/UISourceCode.js b/Source/WebCore/inspector/front-end/UISourceCode.js index ce2411654..eb08c8d65 100644 --- a/Source/WebCore/inspector/front-end/UISourceCode.js +++ b/Source/WebCore/inspector/front-end/UISourceCode.js @@ -50,6 +50,9 @@ WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMappi * @type Array.<function(?string,boolean,string)> */ this._requestContentCallbacks = []; + /** + * @type Array.<WebInspector.LiveLocation> + */ this._liveLocations = []; /** * @type {Array.<WebInspector.PresentationConsoleMessage>} @@ -61,6 +64,10 @@ WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMappi */ this.history = []; this._restoreRevisionHistory(); + this._formatterMapping = new WebInspector.IdentityFormatterSourceMapping(); + + // FIXME: postpone formattedChanged call to after the mapping has been established. + setTimeout(this.formattedChanged.bind(this), 0); } WebInspector.UISourceCode.Events = { @@ -134,7 +141,7 @@ WebInspector.UISourceCode.prototype = { } this._requestContentCallbacks.push(callback); if (this._requestContentCallbacks.length === 1) - this._contentProvider.requestContent(this.fireContentAvailable.bind(this)); + this._contentProvider.requestContent(this._fireContentAvailable.bind(this)); }, /** @@ -348,7 +355,7 @@ WebInspector.UISourceCode.prototype = { * @param {boolean} contentEncoded * @param {string} mimeType */ - fireContentAvailable: function(content, contentEncoded, mimeType) + _fireContentAvailable: function(content, contentEncoded, mimeType) { this._contentLoaded = true; this._mimeType = mimeType; @@ -358,6 +365,11 @@ WebInspector.UISourceCode.prototype = { this._requestContentCallbacks = []; for (var i = 0; i < callbacks.length; ++i) callbacks[i](content, contentEncoded, mimeType); + + if (this._formatOnLoad) { + delete this._formatOnLoad; + this.setFormatted(true); + } }, /** @@ -375,11 +387,12 @@ WebInspector.UISourceCode.prototype = { */ uiLocationToRawLocation: function(lineNumber, columnNumber) { - return this._sourceMapping.uiLocationToRawLocation(this, lineNumber, columnNumber); + var location = this._formatterMapping.formattedToOriginal(lineNumber, columnNumber); + return this._sourceMapping.uiLocationToRawLocation(this, location[0], location[1]); }, /** - * @param {WebInspector.Script.Location} liveLocation + * @param {WebInspector.LiveLocation} liveLocation */ addLiveLocation: function(liveLocation) { @@ -387,7 +400,7 @@ WebInspector.UISourceCode.prototype = { }, /** - * @param {WebInspector.Script.Location} liveLocation + * @param {WebInspector.LiveLocation} liveLocation */ removeLiveLocation: function(liveLocation) { @@ -403,10 +416,12 @@ WebInspector.UISourceCode.prototype = { /** * @param {WebInspector.UILocation} uiLocation - * @return {WebInspector.UILocation} */ overrideLocation: function(uiLocation) { + var location = this._formatterMapping.originalToFormatted(uiLocation.lineNumber, uiLocation.columnNumber); + uiLocation.lineNumber = location[0]; + uiLocation.columnNumber = location[1]; return uiLocation; }, @@ -443,13 +458,90 @@ WebInspector.UISourceCode.prototype = { }, /** + * @return {boolean} + */ + togglingFormatter: function() + { + return this._togglingFormatter; + }, + + /** + * @return {boolean} + */ + formatted: function() + { + return this._formatted; + }, + + /** * @param {boolean} formatted * @param {function()=} callback */ setFormatted: function(formatted, callback) { - if (callback) + callback = callback || function() {}; + if (!this.contentLoaded()) { + this._formatOnLoad = formatted; + callback(); + return; + } + + if (this._formatted === formatted) { callback(); + return; + } + + this._formatted = formatted; + + // Re-request content + this._contentLoaded = false; + this._content = false; + WebInspector.UISourceCode.prototype.requestContent.call(this, didGetContent.bind(this)); + + /** + * @this {WebInspector.UISourceCode} + * @param {?string} content + * @param {boolean} contentEncoded + * @param {string} mimeType + */ + function didGetContent(content, contentEncoded, mimeType) + { + var formatter; + if (!formatted) + formatter = new WebInspector.IdentityFormatter(); + else + formatter = WebInspector.Formatter.createFormatter(this.contentType()); + formatter.formatContent(mimeType, content || "", formattedChanged.bind(this)); + + /** + * @this {WebInspector.UISourceCode} + * @param {string} content + * @param {WebInspector.FormatterSourceMapping} formatterMapping + */ + function formattedChanged(content, formatterMapping) + { + this._togglingFormatter = true; + this.contentChanged(content, mimeType); + delete this._togglingFormatter; + this._formatterMapping = formatterMapping; + this.updateLiveLocations(); + this.formattedChanged(); + callback(); + } + } + }, + + /** + * @return {WebInspector.Formatter} formatter + */ + createFormatter: function() + { + // overridden by subclasses. + return null; + }, + + formattedChanged: function() + { } } @@ -509,6 +601,14 @@ WebInspector.UILocation.prototype = { uiLocationToRawLocation: function() { return this.uiSourceCode.uiLocationToRawLocation(this.lineNumber, this.columnNumber); + }, + + /** + * @return {?string} + */ + url: function() + { + return this.uiSourceCode.contentURL(); } } @@ -521,6 +621,58 @@ WebInspector.RawLocation = function() /** * @constructor + * @param {WebInspector.RawLocation} rawLocation + * @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate + */ +WebInspector.LiveLocation = function(rawLocation, updateDelegate) +{ + this._rawLocation = rawLocation; + this._updateDelegate = updateDelegate; + this._uiSourceCodes = []; +} + +WebInspector.LiveLocation.prototype = { + update: function() + { + var uiLocation = this.uiLocation(); + if (uiLocation) { + var uiSourceCode = uiLocation.uiSourceCode; + if (this._uiSourceCodes.indexOf(uiSourceCode) === -1) { + uiSourceCode.addLiveLocation(this); + this._uiSourceCodes.push(uiSourceCode); + } + var oneTime = this._updateDelegate(uiLocation); + if (oneTime) + this.dispose(); + } + }, + + /** + * @return {WebInspector.RawLocation} + */ + rawLocation: function() + { + return this._rawLocation; + }, + + /** + * @return {WebInspector.UILocation} + */ + uiLocation: function() + { + // Should be overridden by subclasses. + }, + + dispose: function() + { + for (var i = 0; i < this._uiSourceCodes.length; ++i) + this._uiSourceCodes[i].removeLiveLocation(this); + this._uiSourceCodes = []; + } +} + +/** + * @constructor * @implements {WebInspector.ContentProvider} * @param {WebInspector.UISourceCode} uiSourceCode * @param {?string|undefined} content diff --git a/Source/WebCore/inspector/front-end/UISourceCodeFrame.js b/Source/WebCore/inspector/front-end/UISourceCodeFrame.js new file mode 100644 index 000000000..db98df877 --- /dev/null +++ b/Source/WebCore/inspector/front-end/UISourceCodeFrame.js @@ -0,0 +1,93 @@ +/* + * 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. 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 GOOGLE 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. + */ + +/** + * @constructor + * @extends {WebInspector.SourceFrame} + * @param {WebInspector.UISourceCode} uiSourceCode + */ +WebInspector.UISourceCodeFrame = function(uiSourceCode) +{ + this._uiSourceCode = uiSourceCode; + WebInspector.SourceFrame.call(this, this._uiSourceCode); + this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this); +} + +WebInspector.UISourceCodeFrame.prototype = { + /** + * @return {boolean} + */ + canEditSource: function() + { + return true; + }, + + /** + * @param {string} text + */ + commitEditing: function(text) + { + if (!this._uiSourceCode.isDirty()) + return; + + this._isCommittingEditing = true; + this._uiSourceCode.commitWorkingCopy(this._didEditContent.bind(this)); + }, + + afterTextChanged: function(oldRange, newRange) + { + this._uiSourceCode.setWorkingCopy(this.textModel.text()); + }, + + _didEditContent: function(error) + { + if (error) { + WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true); + return; + } + delete this._isCommittingEditing; + }, + + /** + * @param {WebInspector.Event} event + */ + _onContentChanged: function(event) + { + if (!this._isCommittingEditing) + this.setContent(this._uiSourceCode.content() || "", false, this._uiSourceCode.contentType().canonicalMimeType()); + }, + + populateTextAreaContextMenu: function(contextMenu, lineNumber) + { + WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber); + contextMenu.appendApplicableItems(this._uiSourceCode); + contextMenu.appendSeparator(); + } +} + +WebInspector.UISourceCodeFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype; diff --git a/Source/WebCore/inspector/front-end/UserAgentSupport.js b/Source/WebCore/inspector/front-end/UserAgentSupport.js index 976b507bd..4eabd7b70 100644 --- a/Source/WebCore/inspector/front-end/UserAgentSupport.js +++ b/Source/WebCore/inspector/front-end/UserAgentSupport.js @@ -37,6 +37,7 @@ WebInspector.UserAgentSupport = function() this._deviceMetricsChanged(); WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsChanged, this); WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChanged, this); + WebInspector.settings.geolocationOverride.addChangeListener(this._geolocationPositionChanged, this); } /** @@ -163,11 +164,91 @@ WebInspector.UserAgentSupport.DeviceMetrics.prototype = { } } +/** + * @constructor + * @param {number} latitude + * @param {number} longitude + */ +WebInspector.UserAgentSupport.GeolocationPosition = function(latitude, longitude, error) +{ + this.latitude = latitude; + this.longitude = longitude; + this.error = error; +} + +WebInspector.UserAgentSupport.GeolocationPosition.prototype = { + /** + * @return {string} + */ + toSetting: function() + { + return (typeof this.latitude === "number" && typeof this.longitude === "number" && typeof this.error === "string") ? this.latitude + "@" + this.longitude + ":" + this.error : ""; + } +} + +/** + * @return {WebInspector.UserAgentSupport.GeolocationPosition} + */ +WebInspector.UserAgentSupport.GeolocationPosition.parseSetting = function(value) +{ + if (value) { + var splitError = value.split(":"); + if (splitError.length === 2) { + var splitPosition = splitError[0].split("@") + if (splitPosition.length === 2) + return new WebInspector.UserAgentSupport.GeolocationPosition(parseFloat(splitPosition[0]), parseFloat(splitPosition[1]), splitError[1]); + } + } + return new WebInspector.UserAgentSupport.GeolocationPosition(0, 0, ""); +} + +/** + * @return {?WebInspector.UserAgentSupport.GeolocationPosition} + */ +WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput = function(latitudeString, longitudeString, errorStatus) +{ + function isUserInputValid(value) + { + if (!value) + return true; + return /^[-]?[0-9]*[.]?[0-9]*$/.test(value); + } + + if (!latitudeString ^ !latitudeString) + return null; + + var isLatitudeValid = isUserInputValid(latitudeString); + var isLongitudeValid = isUserInputValid(longitudeString); + + if (!isLatitudeValid && !isLongitudeValid) + return null; + + var latitude = isLatitudeValid ? parseFloat(latitudeString) : -1; + var longitude = isLongitudeValid ? parseFloat(longitudeString) : -1; + + return new WebInspector.UserAgentSupport.GeolocationPosition(latitude, longitude, errorStatus ? "PositionUnavailable" : ""); +} + +WebInspector.UserAgentSupport.GeolocationPosition.clearGeolocationOverride = function() +{ + PageAgent.clearGeolocationOverride(); +} + WebInspector.UserAgentSupport.prototype = { _deviceMetricsChanged: function() { var metrics = WebInspector.UserAgentSupport.DeviceMetrics.parseSetting(WebInspector.settings.deviceMetrics.get()); if (metrics.isValid()) PageAgent.setDeviceMetricsOverride(metrics.width, metrics.height, metrics.fontScaleFactor, WebInspector.settings.deviceFitWindow.get()); + }, + + _geolocationPositionChanged: function() + { + var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseSetting(WebInspector.settings.geolocationOverride.get()); + if (geolocation.error) + PageAgent.setGeolocationOverride(); + else + PageAgent.setGeolocationOverride(geolocation.latitude, geolocation.longitude, 150); } } + diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index 0f137fcfc..b028fd9e1 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -133,6 +133,7 @@ <file>ResourceWebSocketFrameView.js</file> <file>ResourcesPanel.js</file> <file>RevisionHistoryView.js</file> + <file>SASSSourceMapping.js</file> <file>ScopeChainSidebarPane.js</file> <file>Script.js</file> <file>ScriptFormatter.js</file> @@ -181,6 +182,7 @@ <file>TopDownProfileDataGridTree.js</file> <file>treeoutline.js</file> <file>UISourceCode.js</file> + <file>UISourceCodeFrame.js</file> <file>UIUtils.js</file> <file>UserAgentSupport.js</file> <file>UserMetrics.js</file> diff --git a/Source/WebCore/inspector/front-end/Workspace.js b/Source/WebCore/inspector/front-end/Workspace.js index 32182d595..40da8dd29 100644 --- a/Source/WebCore/inspector/front-end/Workspace.js +++ b/Source/WebCore/inspector/front-end/Workspace.js @@ -123,10 +123,12 @@ WebInspector.CompositeUISourceCodeProvider.prototype.__proto__ = WebInspector.Ob WebInspector.Workspace = function() { var scriptMapping = new WebInspector.DebuggerScriptMapping(); - var providers = scriptMapping.uiSourceCodeProviders(); - providers = providers.concat(new WebInspector.StylesUISourceCodeProvider()); + var styleProviders = [new WebInspector.StylesUISourceCodeProvider()]; + if (WebInspector.experimentsSettings.sass.isEnabled()) + styleProviders.push(new WebInspector.SASSSourceMapping()); + var providers = scriptMapping.uiSourceCodeProviders().concat(styleProviders); WebInspector.CompositeUISourceCodeProvider.call(this, providers); - + new WebInspector.PresentationConsoleMessageHelper(this); WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._reset, this); diff --git a/Source/WebCore/inspector/front-end/elementsPanel.css b/Source/WebCore/inspector/front-end/elementsPanel.css index 687a1b8b1..27bd3d814 100644 --- a/Source/WebCore/inspector/front-end/elementsPanel.css +++ b/Source/WebCore/inspector/front-end/elementsPanel.css @@ -61,6 +61,8 @@ .crumbs { display: inline-block; + pointer-events: auto; + cursor: default; font-size: 11px; line-height: 19px; text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index fdebbb998..7d1065c70 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -500,6 +500,10 @@ body.compact #main { overflow: hidden; } +body.drawer-visible #main-panels { + bottom: 24px; +} + #main-status-bar { position: absolute; bottom: 0; @@ -507,27 +511,6 @@ body.compact #main { right: 0; } -body.drawer-visible #main-status-bar { - height: 24px; - border-bottom: 1px solid rgb(202, 202, 202); - cursor: ns-resize; -} - -body.drawer-visible #main-status-bar::after { - position: absolute; - right: 0; - top: 5px; - content: url(Images/statusbarResizerVertical.png); -} - -body.drawer-visible #main-status-bar * { - cursor: default; -} - -body.drawer-visible #main-panels { - bottom: 24px; -} - .status-bar { white-space: nowrap; height: 23px; @@ -535,6 +518,7 @@ body.drawer-visible #main-panels { z-index: 12; background-image: -webkit-linear-gradient(rgb(253,253,253), rgb(230,230,230) 75%, rgb(230,230,230)); border-top: 1px solid rgb(202, 202, 202); + display: -webkit-flex; } .status-bar > div { @@ -545,6 +529,9 @@ body.drawer-visible #main-panels { .status-bar-item { display: inline-block; + pointer-events: auto; + cursor: default; + -webkit-flex: 0; height: 24px; padding: 0; margin-left: -1px; @@ -554,6 +541,37 @@ body.drawer-visible #main-panels { background-color: transparent; } +#floating-status-bar-container { + position: absolute; + left: 0; + right: 0; + bottom: 0; + display: none; + border-bottom: 1px solid rgb(202, 202, 202); + cursor: ns-resize; + height: 24px; +} + +body.drawer-visible #floating-status-bar-container { + display: -webkit-flex; +} + +#floating-status-bar-resizer { + content: url(Images/statusbarResizerVertical.png); + margin-top: 7px; + pointer-events: none; +} + +#panel-status-bar { + -webkit-flex: 1 0; + display: -webkit-flex; + pointer-events: none; +} + +#panel-status-bar > div { + width: 100%; +} + .status-bar-item:active { position: relative; z-index: 200; @@ -673,11 +691,6 @@ button.dock-status-bar-item.status-bar-item.toggled-right .glyph { background-color: rgba(0, 0, 0, 0.75); } -button.settings-status-bar-item { - position: absolute; - right: 0; -} - body.detached .alternate-status-bar-buttons-bar { margin-left: 1px; } @@ -702,6 +715,11 @@ body.detached .alternate-status-bar-buttons-bar { border-bottom: 1px solid transparent; } +button.status-bar-item.settings-status-bar-item, +button.status-bar-item.settings-status-bar-item:active { + border-right: 0 transparent none; +} + .settings-status-bar-item .glyph { -webkit-mask-position: -160px -24px; } @@ -718,18 +736,11 @@ body.port-qt #dock-status-bar-item { -webkit-mask-position: -64px 0; } -#counters { - position: absolute; - right: 32px; - top: 0; - cursor: pointer; +#error-warning-count { padding: 6px 2px 6px 0px; font-size: 10px; height: 19px; -} - -#error-warning-count { - display: inline; + cursor: pointer; } #error-warning-count:hover { @@ -764,11 +775,9 @@ body.port-qt #dock-status-bar-item { right: 0; height: 200px; background-color: white; - background-repeat: repeat-x; - background-position: bottom; } -body.drawer-visible #drawer-contents { +#drawer-contents { position: absolute; top: 0; bottom: 24px; @@ -780,13 +789,6 @@ body.drawer-visible #drawer { display: block; } -#drawer-status-bar { - position: absolute; - bottom: 0; - left: 0; - right: 0; -} - body.platform-mac .monospace, body.platform-mac .source-code { font-family: Monaco, monospace; } @@ -1853,14 +1855,6 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { -webkit-mask-position: -96px -24px; } -button.edit-source-status-bar-item .glyph { - -webkit-mask-position: -64px -48px; -} - -button.edit-source-status-bar-item.toggled-on .glyph { - background-color: rgb(66, 129, 235); -} - #console-messages.console-filter-top { margin-top: 23px; } @@ -2546,6 +2540,7 @@ body.platform-mac .search-drawer-header input[type="checkbox"].search-config-che border-right: 1px solid rgb(197, 197, 197); line-height: 23px; padding-left: 6px; + display: inline-block; } .drawer-header-close-button { @@ -2566,48 +2561,55 @@ body.platform-mac .search-drawer-header input[type="checkbox"].search-config-che opacity: 0.7; } -#drawer-status-bar .search-status-bar-item { +#bottom-status-bar-container { + -webkit-flex: 1 0; +} + +.search-status-bar-item { + display: inline-block; cursor: pointer; font-size: 11px; height: 23px; } -#drawer-status-bar .search-status-bar-message { +.search-status-bar-message { margin-left:5px; margin-right:5px; - margin-top:6px; + margin-top:5px; float:left; } -#drawer-status-bar .search-status-bar-progress { +.search-status-bar-progress { height: 11px; width: 100px; float: left; } -body:not(.platform-mac) #drawer-status-bar .search-status-bar-progress { - margin-top: 8px; +body:not(.platform-mac) .search-status-bar-progress { + margin-top: 7px; } -body.platform-mac #drawer-status-bar .search-status-bar-progress { - margin-top: 7px; +body.platform-mac .search-status-bar-progress { + margin-top: 6px; } -#drawer-status-bar .search-status-bar-stop-button-item { +.search-status-bar-stop-button-item { width: 19px; height: 24px; overflow: hidden; } -#drawer-status-bar .search-status-bar-stop-button .glyph { +.search-status-bar-stop-button .glyph { -webkit-mask-position: -96px -48px; background-color: rgb(216, 0, 0) !important; } -#drawer-status-bar .search-results-status-bar-message { +.search-results-status-bar-message { margin-right: 10px; cursor: default; font-size: 11px; + float: right; + margin-top: 5px; } .search-view .search-results { diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html index 159798baa..b4c36e104 100644 --- a/Source/WebCore/inspector/front-end/inspector.html +++ b/Source/WebCore/inspector/front-end/inspector.html @@ -91,7 +91,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="ApplicationCacheItemsView.js"></script> <script type="text/javascript" src="IndexedDBModel.js"></script> <script type="text/javascript" src="IndexedDBViews.js"></script> - <script type="text/javascript" src="Script.js"></script> <script type="text/javascript" src="Spectrum.js"></script> <script type="text/javascript" src="SidebarPane.js"></script> <script type="text/javascript" src="ElementsTreeOutline.js"></script> @@ -121,6 +120,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="NetworkPanel.js"></script> <script type="text/javascript" src="TextEditor.js"></script> <script type="text/javascript" src="SourceFrame.js"></script> + <script type="text/javascript" src="UISourceCodeFrame.js"></script> <script type="text/javascript" src="ResourceView.js"></script> <script type="text/javascript" src="RequestView.js"></script> <script type="text/javascript" src="JavaScriptSourceFrame.js"></script> @@ -186,6 +186,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="DebuggerModel.js"></script> <script type="text/javascript" src="SourceMapping.js"></script> <script type="text/javascript" src="UISourceCode.js"></script> + <script type="text/javascript" src="Script.js"></script> <script type="text/javascript" src="JavaScriptSource.js"></script> <script type="text/javascript" src="Linkifier.js"></script> <script type="text/javascript" src="DebuggerScriptMapping.js"></script> @@ -196,6 +197,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="RawSourceCode.js"></script> <script type="text/javascript" src="ResourceScriptMapping.js"></script> <script type="text/javascript" src="CompilerScriptMapping.js"></script> + <script type="text/javascript" src="SASSSourceMapping.js"></script> <script type="text/javascript" src="ScriptsSearchScope.js"></script> <script type="text/javascript" src="DOMAgent.js"></script> <script type="text/javascript" src="TimelinePresentationModel.js"></script> @@ -231,8 +233,14 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </div> </div> <div id="main"> - <div id="main-status-bar" class="status-bar"><div id="anchored-status-bar-items"><div id="counters"><div id="error-warning-count" class="hidden"></div></div></div></div> + <div id="floating-status-bar-container" class="status-bar"><div id="floating-status-bar-resizer"></div></div> </div> <div id="drawer"></div> + <div id="main-status-bar" class="status-bar"> + <div id="bottom-status-bar-container"> + <div id="panel-status-bar"></div> + </div> + <div id="error-warning-count" class="hidden"></div> + </div> </body> </html> diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 6db92866a..e4b6dc16d 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -70,21 +70,22 @@ var WebInspector = { _createGlobalStatusBarItems: function() { + var bottomStatusBarContainer = document.getElementById("bottom-status-bar-container"); this._dockToggleButton = new WebInspector.StatusBarButton("", "dock-status-bar-item", 3); this._dockToggleButton.makeLongClickEnabled(this._createDockOptions.bind(this)); this._dockToggleButton.addEventListener("click", this._toggleAttach.bind(this), false); this._updateDockButtonState(); - var anchoredStatusBar = document.getElementById("anchored-status-bar-items"); - anchoredStatusBar.appendChild(this._dockToggleButton.element); + var mainStatusBar = document.getElementById("main-status-bar"); + mainStatusBar.insertBefore(this._dockToggleButton.element, bottomStatusBarContainer); this._toggleConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Show console."), "console-status-bar-item"); this._toggleConsoleButton.addEventListener("click", this._toggleConsoleButtonClicked.bind(this), false); - anchoredStatusBar.appendChild(this._toggleConsoleButton.element); + mainStatusBar.insertBefore(this._toggleConsoleButton.element, bottomStatusBarContainer); if (this.panels.elements) - anchoredStatusBar.appendChild(this.panels.elements.nodeSearchButton.element); - anchoredStatusBar.appendChild(this.settingsController.statusBarItem); + mainStatusBar.insertBefore(this.panels.elements.nodeSearchButton.element, bottomStatusBarContainer); + mainStatusBar.appendChild(this.settingsController.statusBarItem); }, _createDockOptions: function() @@ -180,21 +181,16 @@ var WebInspector = { this._closePreviousDrawerView(); var drawerStatusBarHeader = document.createElement("div"); - drawerStatusBarHeader.className = "drawer-header"; + drawerStatusBarHeader.className = "drawer-header status-bar-item"; drawerStatusBarHeader.appendChild(statusBarElement); drawerStatusBarHeader.onclose = onclose; var closeButton = drawerStatusBarHeader.createChild("span"); closeButton.textContent = WebInspector.UIString("\u00D7"); closeButton.addStyleClass("drawer-header-close-button"); - closeButton.addEventListener("click", closeButtonPressed.bind(this), false); + closeButton.addEventListener("click", this.closeViewInDrawer.bind(this), false); - function closeButtonPressed(event) - { - this.closeViewInDrawer(); - } - - document.getElementById("main-status-bar").appendChild(drawerStatusBarHeader); + document.getElementById("panel-status-bar").firstElementChild.appendChild(drawerStatusBarHeader); this._drawerStatusBarHeader = drawerStatusBarHeader; this.drawer.show(view, WebInspector.Drawer.AnimationType.Immediately); }, @@ -215,7 +211,7 @@ var WebInspector = { _closePreviousDrawerView: function() { if (this._drawerStatusBarHeader) { - document.getElementById("main-status-bar").removeChild(this._drawerStatusBarHeader); + this._drawerStatusBarHeader.parentElement.removeChild(this._drawerStatusBarHeader); if (this._drawerStatusBarHeader.onclose) this._drawerStatusBarHeader.onclose(); delete this._drawerStatusBarHeader; @@ -434,7 +430,8 @@ WebInspector.doLoadedDone = function() ProfilerAgent.isSampling(WebInspector._initializeCapability.bind(WebInspector, "samplingCPUProfiler", null)); ProfilerAgent.hasHeapProfiler(WebInspector._initializeCapability.bind(WebInspector, "heapProfilerPresent", null)); TimelineAgent.supportsFrameInstrumentation(WebInspector._initializeCapability.bind(WebInspector, "timelineSupportsFrameInstrumentation", null)); - PageAgent.canOverrideDeviceMetrics(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceMetrics", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector))); + PageAgent.canOverrideDeviceMetrics(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceMetrics", null)); + PageAgent.canOverrideGeolocation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideGeolocation", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector))); } WebInspector._doLoadedDoneWithCapabilities = function() diff --git a/Source/WebCore/inspector/front-end/profilesPanel.css b/Source/WebCore/inspector/front-end/profilesPanel.css index d70c4a07d..464725f3a 100644 --- a/Source/WebCore/inspector/front-end/profilesPanel.css +++ b/Source/WebCore/inspector/front-end/profilesPanel.css @@ -142,6 +142,10 @@ -webkit-mask-position: 0 0; } +.garbage-collect-status-bar-item .glyph { + -webkit-mask-position: -128px -24px; +} + .profile-launcher-view-content { position: absolute; top: 0; diff --git a/Source/WebCore/inspector/front-end/scriptsPanel.css b/Source/WebCore/inspector/front-end/scriptsPanel.css index 12df13dd5..3ece7eb1f 100644 --- a/Source/WebCore/inspector/front-end/scriptsPanel.css +++ b/Source/WebCore/inspector/front-end/scriptsPanel.css @@ -47,6 +47,14 @@ background-color: rgb(66, 129, 235); } +.evaluate-snippet-status-bar-item .glyph { + -webkit-mask-position: -64px -48px; +} + +.evaluate-snippet-status-bar-item.toggled .glyph { + background-color: rgb(66, 129, 235); +} + #scripts-debug-toolbar { position: relative; margin-top: -1px; diff --git a/Source/WebCore/inspector/front-end/timelinePanel.css b/Source/WebCore/inspector/front-end/timelinePanel.css index 6ff542eae..56c63ea6c 100644 --- a/Source/WebCore/inspector/front-end/timelinePanel.css +++ b/Source/WebCore/inspector/front-end/timelinePanel.css @@ -423,15 +423,10 @@ text-shadow: white 0 1px 0; } -#main-status-bar > .timeline-records-counter { +.timeline-records-counter { float: right; - margin-top: 4px; - margin-right: 25px; -} - -#counters > .timeline-records-counter { - float: left; - margin-top: -1px; + margin-top: 5px; + margin-right: 6px; } #resources-container-content { diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index b76f8c5d8..1efbcdf5f 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -80,7 +80,6 @@ #include "MemoryInstrumentation.h" #include "Page.h" #include "PageCache.h" -#include "PageGroup.h" #include "PageTransitionEvent.h" #include "PluginData.h" #include "PluginDatabase.h" @@ -1235,8 +1234,6 @@ void FrameLoader::load(const ResourceRequest& request, const SubstituteData& sub if (m_inStopAllLoaders) return; - // FIXME: is this the right place to reset loadType? Perhaps this should be done after loading is finished or aborted. - m_loadType = FrameLoadTypeStandard; RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, substituteData); if (lockHistory && m_documentLoader) loader->setClientRedirectSourceForHistory(m_documentLoader->didCreateGlobalHistoryEntry() ? m_documentLoader->urlForHistory().string() : m_documentLoader->clientRedirectSourceForHistory()); @@ -1281,7 +1278,9 @@ void FrameLoader::load(DocumentLoader* newDocumentLoader) if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->originalRequest().url())) { r.setCachePolicy(ReloadIgnoringCacheData); type = FrameLoadTypeSame; - } else + } else if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->unreachableURL()) && m_loadType == FrameLoadTypeReload) + type = FrameLoadTypeReload; + else type = FrameLoadTypeStandard; if (m_documentLoader) @@ -3186,6 +3185,9 @@ void FrameLoader::dispatchDidCommitLoad() m_client->dispatchDidCommitLoad(); + if (isLoadingMainFrame()) + m_frame->page()->resetSeenPlugins(); + InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get()); } diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp index bf8d7c8e2..5e3ce84bb 100644 --- a/Source/WebCore/loader/HistoryController.cpp +++ b/Source/WebCore/loader/HistoryController.cpp @@ -438,7 +438,7 @@ void HistoryController::updateForCommit() FrameLoadType type = frameLoader->loadType(); if (isBackForwardLoadType(type) || isReplaceLoadTypeWithProvisionalItem(type) - || ((type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin) && !frameLoader->provisionalDocumentLoader()->unreachableURL().isEmpty())) { + || (isReloadTypeWithProvisionalItem(type) && !frameLoader->provisionalDocumentLoader()->unreachableURL().isEmpty())) { // Once committed, we want to use current item for saving DocState, and // the provisional item for restoring state. // Note previousItem must be set before we close the URL, which will @@ -465,6 +465,11 @@ bool HistoryController::isReplaceLoadTypeWithProvisionalItem(FrameLoadType type) return type == FrameLoadTypeReplace && m_provisionalItem; } +bool HistoryController::isReloadTypeWithProvisionalItem(FrameLoadType type) +{ + return (type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin) && m_provisionalItem; +} + void HistoryController::recursiveUpdateForCommit() { // The frame that navigated will now have a null provisional item. diff --git a/Source/WebCore/loader/HistoryController.h b/Source/WebCore/loader/HistoryController.h index 91b60a884..ce1ead5f5 100644 --- a/Source/WebCore/loader/HistoryController.h +++ b/Source/WebCore/loader/HistoryController.h @@ -98,6 +98,7 @@ private: void recursiveSetProvisionalItem(HistoryItem*, HistoryItem*, FrameLoadType); void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType); bool isReplaceLoadTypeWithProvisionalItem(FrameLoadType); + bool isReloadTypeWithProvisionalItem(FrameLoadType); void recursiveUpdateForCommit(); void recursiveUpdateForSameDocumentNavigation(); bool itemsAreClones(HistoryItem*, HistoryItem*) const; diff --git a/Source/WebCore/loader/Prerenderer.cpp b/Source/WebCore/loader/Prerenderer.cpp index 75fd8dd8b..b3acb2431 100644 --- a/Source/WebCore/loader/Prerenderer.cpp +++ b/Source/WebCore/loader/Prerenderer.cpp @@ -72,6 +72,10 @@ PassRefPtr<PrerenderHandle> Prerenderer::render(const KURL& url) // Prerenders are unlike requests in most ways (for instance, they pass down fragments, and they don't return data), // but they do have referrers. const ReferrerPolicy referrerPolicy = document()->referrerPolicy(); + + if (!document()->frame()) + return 0; + const String referrer = SecurityPolicy::generateReferrerHeader(referrerPolicy, url, document()->frame()->loader()->outgoingReferrer()); RefPtr<PrerenderHandle> prerenderHandle = PrerenderHandle::create(url, referrer, referrerPolicy); diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp index 5153f4ef4..63cfb3b64 100644 --- a/Source/WebCore/loader/SubframeLoader.cpp +++ b/Source/WebCore/loader/SubframeLoader.cpp @@ -33,7 +33,10 @@ #include "config.h" #include "SubframeLoader.h" +#include "Chrome.h" +#include "ChromeClient.h" #include "ContentSecurityPolicy.h" +#include "DiagnosticLoggingKeys.h" #include "Frame.h" #include "FrameLoaderClient.h" #include "HTMLAppletElement.h" @@ -130,7 +133,24 @@ bool SubframeLoader::requestPlugin(HTMLPlugInImageElement* ownerElement, const K ASSERT(ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag)); return loadPlugin(ownerElement, url, mimeType, paramNames, paramValues, useFallback); } - + +static void logPluginRequest(Page* page, const String& mimeType, bool success) +{ + if (!page || !page->settings()->diagnosticLoggingEnabled()) + return; + + ChromeClient* client = page->chrome()->client(); + client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), mimeType, DiagnosticLoggingKeys::noopKey()); + + if (!page->hasSeenAnyPlugin()) + client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString(), DiagnosticLoggingKeys::noopKey()); + + if (!page->hasSeenPlugin(mimeType)) + client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), mimeType, DiagnosticLoggingKeys::noopKey()); + + page->sawPlugin(mimeType); +} + bool SubframeLoader::requestObject(HTMLPlugInImageElement* ownerElement, const String& url, const AtomicString& frameName, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) { if (url.isEmpty() && mimeType.isEmpty()) @@ -147,8 +167,11 @@ bool SubframeLoader::requestObject(HTMLPlugInImageElement* ownerElement, const S completedURL = completeURL(url); bool useFallback; - if (shouldUsePlugin(completedURL, mimeType, ownerElement->shouldPreferPlugInsForImages(), renderer->hasFallbackContent(), useFallback)) - return requestPlugin(ownerElement, completedURL, mimeType, paramNames, paramValues, useFallback); + if (shouldUsePlugin(completedURL, mimeType, ownerElement->shouldPreferPlugInsForImages(), renderer->hasFallbackContent(), useFallback)) { + bool success = requestPlugin(ownerElement, completedURL, mimeType, paramNames, paramValues, useFallback); + logPluginRequest(document()->page(), mimeType, success); + return success; + } // If the plug-in element already contains a subframe, loadOrRedirectSubframe will re-use it. Otherwise, // it will create a new frame and set it as the RenderPart's widget, causing what was previously @@ -199,20 +222,16 @@ PassRefPtr<Widget> SubframeLoader::loadMediaPlayerProxyPlugin(Node* node, const } #endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) -PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const LayoutSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) +PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const Vector<String>& paramNames, const Vector<String>& paramValues) { String baseURLString; String codeBaseURLString; - Vector<String> paramNames; - Vector<String> paramValues; - HashMap<String, String>::const_iterator end = args.end(); - for (HashMap<String, String>::const_iterator it = args.begin(); it != end; ++it) { - if (equalIgnoringCase(it->first, "baseurl")) - baseURLString = it->second; - else if (equalIgnoringCase(it->first, "codebase")) - codeBaseURLString = it->second; - paramNames.append(it->first); - paramValues.append(it->second); + + for (size_t i = 0; i < paramNames.size(); ++i) { + if (equalIgnoringCase(paramNames[i], "baseurl")) + baseURLString = paramValues[i]; + else if (equalIgnoringCase(paramNames[i], "codebase")) + codeBaseURLString = paramValues[i]; } if (!codeBaseURLString.isEmpty()) { @@ -232,9 +251,17 @@ PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const LayoutSize& size RefPtr<Widget> widget; if (allowPlugins(AboutToInstantiatePlugin)) - widget = m_frame->loader()->client()->createJavaAppletWidget(roundedIntSize(size), element, baseURL, paramNames, paramValues); - if (!widget) + widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); + + logPluginRequest(document()->page(), element->serviceType(), widget); + + if (!widget) { + RenderEmbeddedObject* renderer = element->renderEmbeddedObject(); + + if (!renderer->showsUnavailablePluginIndicator()) + renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginMissing); return 0; + } m_containsPlugins = true; return widget; diff --git a/Source/WebCore/loader/SubframeLoader.h b/Source/WebCore/loader/SubframeLoader.h index 7f65585b6..bcc89025d 100644 --- a/Source/WebCore/loader/SubframeLoader.h +++ b/Source/WebCore/loader/SubframeLoader.h @@ -72,7 +72,7 @@ public: PassRefPtr<Widget> loadMediaPlayerProxyPlugin(Node*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues); #endif - PassRefPtr<Widget> createJavaAppletWidget(const LayoutSize&, HTMLAppletElement*, const HashMap<String, String>& args); + PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const Vector<String>& paramNames, const Vector<String>& paramValues); bool allowPlugins(ReasonForCallingAllowPlugins); diff --git a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp index 61732b115..e1fb02cfa 100644 --- a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp +++ b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp @@ -43,7 +43,6 @@ namespace WebCore { CachedCSSStyleSheet::CachedCSSStyleSheet(const ResourceRequest& resourceRequest, const String& charset) : CachedResource(resourceRequest, CSSStyleSheet) , m_decoder(TextResourceDecoder::create("text/css", charset)) - , m_decodedDataDeletionTimer(this, &CachedCSSStyleSheet::decodedDataDeletionTimerFired) { // Prefer text/css but accept any type (dell.com serves a stylesheet // as text/html; see <http://bugs.webkit.org/show_bug.cgi?id=11451>). @@ -59,17 +58,10 @@ CachedCSSStyleSheet::~CachedCSSStyleSheet() void CachedCSSStyleSheet::didAddClient(CachedResourceClient* c) { ASSERT(c->resourceClientType() == CachedStyleSheetClient::expectedType()); - if (m_decodedDataDeletionTimer.isActive()) - m_decodedDataDeletionTimer.stop(); - if (!isLoading()) static_cast<CachedStyleSheetClient*>(c)->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder->encoding().name(), this); -} -void CachedCSSStyleSheet::allClientsRemoved() -{ - if (double interval = memoryCache()->deadDecodedDataDeletionInterval()) - m_decodedDataDeletionTimer.startOneShot(interval); + CachedResource::didAddClient(c); } void CachedCSSStyleSheet::setEncoding(const String& chs) @@ -172,11 +164,6 @@ void CachedCSSStyleSheet::destroyDecodedData() makePurgeable(true); } -void CachedCSSStyleSheet::decodedDataDeletionTimerFired(Timer<CachedCSSStyleSheet>*) -{ - destroyDecodedData(); -} - PassRefPtr<StyleSheetContents> CachedCSSStyleSheet::restoreParsedStyleSheet(const CSSParserContext& context) { if (!m_parsedStyleSheetCache) diff --git a/Source/WebCore/loader/cache/CachedCSSStyleSheet.h b/Source/WebCore/loader/cache/CachedCSSStyleSheet.h index 9f51f30aa..9ad6f14ba 100644 --- a/Source/WebCore/loader/cache/CachedCSSStyleSheet.h +++ b/Source/WebCore/loader/cache/CachedCSSStyleSheet.h @@ -27,7 +27,6 @@ #define CachedCSSStyleSheet_h #include "CachedResource.h" -#include "Timer.h" #include <wtf/Vector.h> namespace WebCore { @@ -47,8 +46,6 @@ namespace WebCore { virtual void didAddClient(CachedResourceClient*); - virtual void allClientsRemoved(); - virtual void setEncoding(const String&); virtual String encoding() const; virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived); @@ -62,14 +59,12 @@ namespace WebCore { void saveParsedStyleSheet(PassRefPtr<StyleSheetContents>); private: - void decodedDataDeletionTimerFired(Timer<CachedCSSStyleSheet>*); bool canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const; virtual PurgePriority purgePriority() const { return PurgeLast; } protected: RefPtr<TextResourceDecoder> m_decoder; String m_decodedSheetText; - Timer<CachedCSSStyleSheet> m_decodedDataDeletionTimer; RefPtr<StyleSheetContents> m_parsedStyleSheetCache; }; diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp index fb31f1baf..313475ce1 100644 --- a/Source/WebCore/loader/cache/CachedImage.cpp +++ b/Source/WebCore/loader/cache/CachedImage.cpp @@ -57,7 +57,6 @@ namespace WebCore { CachedImage::CachedImage(const ResourceRequest& resourceRequest) : CachedResource(resourceRequest, ImageResource) , m_image(0) - , m_decodedDataDeletionTimer(this, &CachedImage::decodedDataDeletionTimerFired) , m_shouldPaintBrokenImage(true) { setStatus(Unknown); @@ -66,7 +65,6 @@ CachedImage::CachedImage(const ResourceRequest& resourceRequest) CachedImage::CachedImage(Image* image) : CachedResource(ResourceRequest(), ImageResource) , m_image(image) - , m_decodedDataDeletionTimer(this, &CachedImage::decodedDataDeletionTimerFired) , m_shouldPaintBrokenImage(true) { setStatus(Cached); @@ -78,12 +76,6 @@ CachedImage::~CachedImage() clearImage(); } -void CachedImage::decodedDataDeletionTimerFired(Timer<CachedImage>*) -{ - ASSERT(!hasClients()); - destroyDecodedData(); -} - void CachedImage::load(CachedResourceLoader* cachedResourceLoader, const ResourceLoaderOptions& options) { if (!cachedResourceLoader || cachedResourceLoader->autoLoadImages()) @@ -94,9 +86,6 @@ void CachedImage::load(CachedResourceLoader* cachedResourceLoader, const Resourc void CachedImage::didAddClient(CachedResourceClient* c) { - if (m_decodedDataDeletionTimer.isActive()) - m_decodedDataDeletionTimer.stop(); - if (m_data && !m_image && !errorOccurred()) { createImage(); m_image->setData(m_data, true); @@ -124,8 +113,6 @@ void CachedImage::allClientsRemoved() { if (m_image && !errorOccurred()) m_image->resetAnimation(); - if (double interval = memoryCache()->deadDecodedDataDeletionInterval()) - m_decodedDataDeletionTimer.startOneShot(interval); } pair<Image*, float> CachedImage::brokenImage(float deviceScaleFactor) const diff --git a/Source/WebCore/loader/cache/CachedImage.h b/Source/WebCore/loader/cache/CachedImage.h index 9e3921174..b99215173 100644 --- a/Source/WebCore/loader/cache/CachedImage.h +++ b/Source/WebCore/loader/cache/CachedImage.h @@ -28,7 +28,6 @@ #include "SVGImageCache.h" #include "ImageObserver.h" #include "IntRect.h" -#include "Timer.h" #include <wtf/Vector.h> namespace WebCore { @@ -104,7 +103,6 @@ private: size_t maximumDecodedImageSize(); // If not null, changeRect is the changed part of the image. void notifyObservers(const IntRect* changeRect = 0); - void decodedDataDeletionTimerFired(Timer<CachedImage>*); virtual PurgePriority purgePriority() const { return PurgeFirst; } void checkShouldPaintBrokenImage(); @@ -112,7 +110,6 @@ private: #if ENABLE(SVG) OwnPtr<SVGImageCache> m_svgImageCache; #endif - Timer<CachedImage> m_decodedDataDeletionTimer; bool m_shouldPaintBrokenImage; }; diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp index 3998efd32..41cd60189 100755 --- a/Source/WebCore/loader/cache/CachedResource.cpp +++ b/Source/WebCore/loader/cache/CachedResource.cpp @@ -34,6 +34,7 @@ #include "Document.h" #include "Frame.h" #include "FrameLoaderClient.h" +#include "InspectorInstrumentation.h" #include "KURL.h" #include "Logging.h" #include "PurgeableBuffer.h" @@ -136,6 +137,7 @@ CachedResource::CachedResource(const ResourceRequest& request, Type type) : m_resourceRequest(request) , m_loadPriority(defaultPriorityForResourceType(type)) , m_responseTimestamp(currentTime()) + , m_decodedDataDeletionTimer(this, &CachedResource::decodedDataDeletionTimerFired) , m_lastDecodedAccessTime(0) , m_loadFinishTime(0) , m_encodedSize(0) @@ -176,7 +178,7 @@ CachedResource::~CachedResource() ASSERT(!inCache()); ASSERT(!m_deleted); ASSERT(url().isNull() || memoryCache()->resourceForURL(KURL(ParsedURLString, url())) != this); - + #ifndef NDEBUG m_deleted = true; cachedResourceLeakCounter.decrement(); @@ -380,6 +382,9 @@ void CachedResource::addClient(CachedResourceClient* client) void CachedResource::didAddClient(CachedResourceClient* c) { + if (m_decodedDataDeletionTimer.isActive()) + m_decodedDataDeletionTimer.stop(); + if (m_clientsAwaitingCallback.contains(c)) { m_clients.add(c); m_clientsAwaitingCallback.remove(c); @@ -430,12 +435,12 @@ void CachedResource::removeClient(CachedResourceClient* client) didRemoveClient(client); } - if (canDelete() && !inCache()) - delete this; - else if (!hasClients() && inCache()) { + bool deleted = deleteIfPossible(); + if (!deleted && !hasClients() && inCache()) { memoryCache()->removeFromLiveResourcesSize(this); memoryCache()->removeFromLiveDecodedResourcesList(this); allClientsRemoved(); + destroyDecodedDataIfNeeded(); if (response().cacheControlContainsNoStore()) { // RFC2616 14.9.2: // "no-store: ... MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible" @@ -449,12 +454,30 @@ void CachedResource::removeClient(CachedResourceClient* client) // This object may be dead here. } -void CachedResource::deleteIfPossible() +void CachedResource::destroyDecodedDataIfNeeded() +{ + if (!m_decodedSize) + return; + + if (double interval = memoryCache()->deadDecodedDataDeletionInterval()) + m_decodedDataDeletionTimer.startOneShot(interval); +} + +void CachedResource::decodedDataDeletionTimerFired(Timer<CachedResource>*) { - if (canDelete() && !inCache()) + destroyDecodedData(); +} + +bool CachedResource::deleteIfPossible() +{ + if (canDelete() && !inCache()) { + InspectorInstrumentation::willDestroyCachedResource(this); delete this; + return true; + } + return false; } - + void CachedResource::setDecodedSize(unsigned size) { if (size == m_decodedSize) diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h index 7fbf73365..fe3e1fc63 100644 --- a/Source/WebCore/loader/cache/CachedResource.h +++ b/Source/WebCore/loader/cache/CachedResource.h @@ -115,7 +115,7 @@ public: void addClient(CachedResourceClient*); void removeClient(CachedResourceClient*); bool hasClients() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty(); } - void deleteIfPossible(); + bool deleteIfPossible(); enum PreloadResult { PreloadNotReferenced, @@ -128,6 +128,7 @@ public: virtual void didAddClient(CachedResourceClient*); virtual void didRemoveClient(CachedResourceClient*) { } virtual void allClientsRemoved() { } + void destroyDecodedDataIfNeeded(); unsigned count() const { return m_clients.size(); } @@ -286,9 +287,11 @@ protected: RefPtr<SharedBuffer> m_data; OwnPtr<PurgeableBuffer> m_purgeableData; + Timer<CachedResource> m_decodedDataDeletionTimer; private: bool addClientToSet(CachedResourceClient*); + void decodedDataDeletionTimerFired(Timer<CachedResource>*); virtual PurgePriority purgePriority() const { return PurgeDefault; } diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp index e1987c3fe..9a88724a1 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp @@ -676,7 +676,11 @@ void CachedResourceLoader::loadDone() void CachedResourceLoader::garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>* timer) { ASSERT_UNUSED(timer, timer == &m_garbageCollectDocumentResourcesTimer); + garbageCollectDocumentResources(); +} +void CachedResourceLoader::garbageCollectDocumentResources() +{ typedef Vector<String, 10> StringVector; StringVector resourcesToDelete; @@ -813,9 +817,8 @@ void CachedResourceLoader::clearPreloads() for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) { CachedResource* res = *it; res->decreasePreloadCount(); - if (res->canDelete() && !res->inCache()) - delete res; - else if (res->preloadResult() == CachedResource::PreloadNotReferenced) + bool deleted = res->deleteIfPossible(); + if (!deleted && res->preloadResult() == CachedResource::PreloadNotReferenced) memoryCache()->remove(res); } m_preloads.clear(); diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h index d82b3bf42..5eeb3871f 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.h +++ b/Source/WebCore/loader/cache/CachedResourceLoader.h @@ -105,6 +105,7 @@ public: void removeCachedResource(CachedResource*) const; void loadDone(); + void garbageCollectDocumentResources(); void incrementRequestCount(const CachedResource*); void decrementRequestCount(const CachedResource*); diff --git a/Source/WebCore/loader/cache/CachedScript.cpp b/Source/WebCore/loader/cache/CachedScript.cpp index 8c83bca88..a2da74489 100644 --- a/Source/WebCore/loader/cache/CachedScript.cpp +++ b/Source/WebCore/loader/cache/CachedScript.cpp @@ -43,7 +43,6 @@ namespace WebCore { CachedScript::CachedScript(const ResourceRequest& resourceRequest, const String& charset) : CachedResource(resourceRequest, Script) , m_decoder(TextResourceDecoder::create("application/javascript", charset)) - , m_decodedDataDeletionTimer(this, &CachedScript::decodedDataDeletionTimerFired) { // It's javascript we want. // But some websites think their scripts are <some wrong mimetype here> @@ -55,20 +54,6 @@ CachedScript::~CachedScript() { } -void CachedScript::didAddClient(CachedResourceClient* c) -{ - if (m_decodedDataDeletionTimer.isActive()) - m_decodedDataDeletionTimer.stop(); - - CachedResource::didAddClient(c); -} - -void CachedScript::allClientsRemoved() -{ - if (double interval = memoryCache()->deadDecodedDataDeletionInterval()) - m_decodedDataDeletionTimer.startOneShot(interval); -} - void CachedScript::setEncoding(const String& chs) { m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader); @@ -127,11 +112,6 @@ void CachedScript::destroyDecodedData() makePurgeable(true); } -void CachedScript::decodedDataDeletionTimerFired(Timer<CachedScript>*) -{ - destroyDecodedData(); -} - #if USE(JSC) JSC::SourceProviderCache* CachedScript::sourceProviderCache() const { diff --git a/Source/WebCore/loader/cache/CachedScript.h b/Source/WebCore/loader/cache/CachedScript.h index 1a76c18f4..9a4f38ad0 100644 --- a/Source/WebCore/loader/cache/CachedScript.h +++ b/Source/WebCore/loader/cache/CachedScript.h @@ -27,7 +27,6 @@ #define CachedScript_h #include "CachedResource.h" -#include "Timer.h" #if USE(JSC) namespace JSC { @@ -47,9 +46,6 @@ namespace WebCore { const String& script(); - virtual void didAddClient(CachedResourceClient*); - virtual void allClientsRemoved(); - virtual void setEncoding(const String&); virtual String encoding() const; virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived); @@ -62,12 +58,10 @@ namespace WebCore { void sourceProviderCacheSizeChanged(int delta); #endif private: - void decodedDataDeletionTimerFired(Timer<CachedScript>*); virtual PurgePriority purgePriority() const { return PurgeLast; } String m_script; RefPtr<TextResourceDecoder> m_decoder; - Timer<CachedScript> m_decodedDataDeletionTimer; #if USE(JSC) mutable OwnPtr<JSC::SourceProviderCache> m_sourceProviderCache; #endif diff --git a/Source/WebCore/loader/cache/MemoryCache.cpp b/Source/WebCore/loader/cache/MemoryCache.cpp index 299d10a70..5dc047402 100644 --- a/Source/WebCore/loader/cache/MemoryCache.cpp +++ b/Source/WebCore/loader/cache/MemoryCache.cpp @@ -402,8 +402,7 @@ void MemoryCache::evict(CachedResource* resource) } else ASSERT(m_resources.get(resource->url()) != resource); - if (resource->canDelete()) - delete resource; + resource->deleteIfPossible(); } static inline unsigned fastLog2(unsigned i) diff --git a/Source/WebCore/make-file-arrays.py b/Source/WebCore/make-file-arrays.py index ece706b86..2007cc52d 100755 --- a/Source/WebCore/make-file-arrays.py +++ b/Source/WebCore/make-file-arrays.py @@ -88,6 +88,9 @@ def main(): if not options.out_cpp: parser.error("Need to specify --out-cpp=filename") + if options.flag: + options.flag = options.flag.replace(" AND ", " && ") + header_file = open(options.out_header, "w") if options.flag: header_file.write("#if " + options.flag + "\n") diff --git a/Source/WebCore/make-hash-tools.pl b/Source/WebCore/make-hash-tools.pl index ea3a0f507..5f77d2bd6 100644 --- a/Source/WebCore/make-hash-tools.pl +++ b/Source/WebCore/make-hash-tools.pl @@ -29,10 +29,14 @@ my $option = basename($ARGV[0],".gperf"); if ($option eq "ColorData") { my $colorDataGenerated = "$outdir/ColorData.cpp"; - my $colorDataGperf = $ARGV[0]; - shift; + my $colorDataGperf = shift; + my $customGperf = shift; - my $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf"; + # gperf emits this filename literally in #line directives, but VS errors + # out because the filenames then contain unescaped \s, so replace the \ + # with /. + $colorDataGperf =~ s/\\/\//g; + my $gperf = $ENV{GPERF} ? $ENV{GPERF} : ($customGperf ? $customGperf : "gperf"); system("\"$gperf\" --key-positions=\"*\" -D -s 2 $colorDataGperf --output-file=$colorDataGenerated") == 0 || die "calling gperf failed: $?"; } else { diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index dc52acca6..a9c86ed40 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -349,6 +349,8 @@ namespace WebCore { virtual bool isPointerLocked() { return false; } #endif + virtual void logDiagnosticMessage(const String& message, const String& description, const String& status) { UNUSED_PARAM(message); UNUSED_PARAM(description); UNUSED_PARAM(status); } + protected: virtual ~ChromeClient() { } }; diff --git a/Source/WebCore/page/ContentSecurityPolicy.cpp b/Source/WebCore/page/ContentSecurityPolicy.cpp index dac65c336..8431b4c25 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/ContentSecurityPolicy.cpp @@ -27,6 +27,7 @@ #include "ContentSecurityPolicy.h" #include "Console.h" +#include "DOMStringList.h" #include "Document.h" #include "FormData.h" #include "FormDataList.h" @@ -546,21 +547,23 @@ public: const String& header() const { return m_header; } ContentSecurityPolicy::HeaderType headerType() const { return m_reportOnly ? ContentSecurityPolicy::ReportOnly : ContentSecurityPolicy::EnforcePolicy; } - bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowEval(PassRefPtr<ScriptCallStack>) const; + bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const; + bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const; + bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const; + bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const; + bool allowEval(PassRefPtr<ScriptCallStack>, ContentSecurityPolicy::ReportingStatus) const; bool allowScriptNonce(const String& nonce, const String& contextURL, const WTF::OrdinalNumber& contextLine, const KURL&) const; - bool allowScriptFromSource(const KURL&) const; - bool allowObjectFromSource(const KURL&) const; - bool allowChildFrameFromSource(const KURL&) const; - bool allowImageFromSource(const KURL&) const; - bool allowStyleFromSource(const KURL&) const; - bool allowFontFromSource(const KURL&) const; - bool allowMediaFromSource(const KURL&) const; - bool allowConnectToSource(const KURL&) const; + bool allowScriptFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + bool allowObjectFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + bool allowChildFrameFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + bool allowImageFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + bool allowStyleFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + bool allowFontFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + bool allowMediaFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + bool allowConnectToSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const; + + void gatherReportURIs(DOMStringList&) const; private: explicit CSPDirectiveList(ScriptExecutionContext*); @@ -580,11 +583,15 @@ private: void logUnrecognizedDirective(const String& name) const; void logDuplicateDirective(const String& name) const; void logInvalidNonce(const String& nonce) const; + bool checkEval(CSPDirective*) const; + bool checkInline(CSPDirective*) const; + bool checkNonce(const String&) const; + bool checkSource(CSPDirective*, const KURL&) const; + bool checkEvalAndReportViolation(CSPDirective*, const String& consoleMessage, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; bool checkInlineAndReportViolation(CSPDirective*, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const; bool checkNonceAndReportViolation(const String& nonce, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool checkEvalAndReportViolation(CSPDirective*, const String& consoleMessage, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; bool checkSourceAndReportViolation(CSPDirective*, const KURL&, const String& type) const; bool denyIfEnforcingPolicy() const { return m_reportOnly; } @@ -707,74 +714,107 @@ bool CSPDirectiveList::checkEval(CSPDirective* directive) const return !directive || directive->allowEval(); } +bool CSPDirectiveList::checkInline(CSPDirective* directive) const +{ + return !directive || directive->allowInline(); +} + +bool CSPDirectiveList::checkNonce(const String& nonce) const +{ + return (m_scriptNonce.isNull() + || (!m_scriptNonce.isEmpty() + && nonce.stripWhiteSpace() == m_scriptNonce)); +} + +bool CSPDirectiveList::checkSource(CSPDirective* directive, const KURL& url) const +{ + return !directive || directive->allows(url); +} + CSPDirective* CSPDirectiveList::operativeDirective(CSPDirective* directive) const { return directive ? directive : m_defaultSrc.get(); } -bool CSPDirectiveList::checkInlineAndReportViolation(CSPDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool CSPDirectiveList::checkEvalAndReportViolation(CSPDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const { - if (!directive || directive->allowInline()) + if (checkEval(directive)) return true; - reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine); + reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine, callStack); return denyIfEnforcingPolicy(); } bool CSPDirectiveList::checkNonceAndReportViolation(const String& nonce, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const { - if (m_scriptNonce.isNull() || (!m_scriptNonce.isEmpty() && nonce.stripWhiteSpace() == m_scriptNonce)) + if (checkNonce(nonce)) return true; reportViolation(m_scriptNonce, consoleMessage + "\"script-nonce " + m_scriptNonce + "\".\n", KURL(), contextURL, contextLine); return denyIfEnforcingPolicy(); } -bool CSPDirectiveList::checkEvalAndReportViolation(CSPDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const +bool CSPDirectiveList::checkInlineAndReportViolation(CSPDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const { - if (checkEval(directive)) + if (checkInline(directive)) return true; - reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine, callStack); + reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine); return denyIfEnforcingPolicy(); } bool CSPDirectiveList::checkSourceAndReportViolation(CSPDirective* directive, const KURL& url, const String& type) const { - if (!directive || directive->allows(url)) + if (checkSource(directive, url)) return true; String verb = type == "connect" ? "connect to" : "load the"; reportViolation(directive->text(), "Refused to " + verb + " " + type + " '" + url.string() + "' because it violates the following Content Security Policy directive: \"" + directive->text() + "\".\n", url); return denyIfEnforcingPolicy(); } -bool CSPDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool CSPDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute JavaScript URL because it violates the following Content Security Policy directive: ")); - return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) - && checkNonceAndReportViolation(String(), consoleMessage, contextURL, contextLine)); + if (reportingStatus == ContentSecurityPolicy::SendReport) { + return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) + && checkNonceAndReportViolation(String(), consoleMessage, contextURL, contextLine)); + } else { + return (checkInline(operativeDirective(m_scriptSrc.get())) + && checkNonce(String())); + } } -bool CSPDirectiveList::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool CSPDirectiveList::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline event handler because it violates the following Content Security Policy directive: ")); - return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) - && checkNonceAndReportViolation(String(), consoleMessage, contextURL, contextLine)); + if (reportingStatus == ContentSecurityPolicy::SendReport) { + return (checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) + && checkNonceAndReportViolation(String(), consoleMessage, contextURL, contextLine)); + } else { + return (checkInline(operativeDirective(m_scriptSrc.get())) + && checkNonce(String())); + } } -bool CSPDirectiveList::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool CSPDirectiveList::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline script because it violates the following Content Security Policy directive: ")); - return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine) : + checkInline(operativeDirective(m_scriptSrc.get())); } -bool CSPDirectiveList::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool CSPDirectiveList::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to apply inline style because it violates the following Content Security Policy directive: ")); - return checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine) : + checkInline(operativeDirective(m_styleSrc.get())); } -bool CSPDirectiveList::allowEval(PassRefPtr<ScriptCallStack> callStack) const +bool CSPDirectiveList::allowEval(PassRefPtr<ScriptCallStack> callStack, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to evaluate script because it violates the following Content Security Policy directive: ")); - return checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, String(), WTF::OrdinalNumber::beforeFirst(), callStack); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, String(), WTF::OrdinalNumber::beforeFirst(), callStack) : + checkEval(operativeDirective(m_scriptSrc.get())); } bool CSPDirectiveList::allowScriptNonce(const String& nonce, const String& contextURL, const WTF::OrdinalNumber& contextLine, const KURL& url) const @@ -785,56 +825,78 @@ bool CSPDirectiveList::allowScriptNonce(const String& nonce, const String& conte return checkNonceAndReportViolation(nonce, "Refused to load '" + url.string() + "' because it violates the following Content Security Policy directive: ", contextURL, contextLine); } -bool CSPDirectiveList::allowScriptFromSource(const KURL& url) const +bool CSPDirectiveList::allowScriptFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("script")); - return checkSourceAndReportViolation(operativeDirective(m_scriptSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_scriptSrc.get()), url, type) : + checkSource(operativeDirective(m_scriptSrc.get()), url); } -bool CSPDirectiveList::allowObjectFromSource(const KURL& url) const +bool CSPDirectiveList::allowObjectFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("object")); if (url.isBlankURL()) return true; - return checkSourceAndReportViolation(operativeDirective(m_objectSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_objectSrc.get()), url, type) : + checkSource(operativeDirective(m_objectSrc.get()), url); } -bool CSPDirectiveList::allowChildFrameFromSource(const KURL& url) const +bool CSPDirectiveList::allowChildFrameFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("frame")); if (url.isBlankURL()) return true; - return checkSourceAndReportViolation(operativeDirective(m_frameSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_frameSrc.get()), url, type) : + checkSource(operativeDirective(m_frameSrc.get()), url); } -bool CSPDirectiveList::allowImageFromSource(const KURL& url) const +bool CSPDirectiveList::allowImageFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("image")); - return checkSourceAndReportViolation(operativeDirective(m_imgSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_imgSrc.get()), url, type) : + checkSource(operativeDirective(m_imgSrc.get()), url); } -bool CSPDirectiveList::allowStyleFromSource(const KURL& url) const +bool CSPDirectiveList::allowStyleFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("style")); - return checkSourceAndReportViolation(operativeDirective(m_styleSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_styleSrc.get()), url, type) : + checkSource(operativeDirective(m_styleSrc.get()), url); } -bool CSPDirectiveList::allowFontFromSource(const KURL& url) const +bool CSPDirectiveList::allowFontFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("font")); - return checkSourceAndReportViolation(operativeDirective(m_fontSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_fontSrc.get()), url, type) : + checkSource(operativeDirective(m_fontSrc.get()), url); } -bool CSPDirectiveList::allowMediaFromSource(const KURL& url) const +bool CSPDirectiveList::allowMediaFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("media")); - return checkSourceAndReportViolation(operativeDirective(m_mediaSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_mediaSrc.get()), url, type) : + checkSource(operativeDirective(m_mediaSrc.get()), url); } -bool CSPDirectiveList::allowConnectToSource(const KURL& url) const +bool CSPDirectiveList::allowConnectToSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, type, ("connect")); - return checkSourceAndReportViolation(operativeDirective(m_connectSrc.get()), url, type); + return reportingStatus == ContentSecurityPolicy::SendReport ? + checkSourceAndReportViolation(operativeDirective(m_connectSrc.get()), url, type) : + checkSource(operativeDirective(m_connectSrc.get()), url); +} + +void CSPDirectiveList::gatherReportURIs(DOMStringList& list) const +{ + for (size_t i = 0; i < m_reportURIs.size(); ++i) + list.append(m_reportURIs[i].string()); } // policy = directive-list @@ -887,8 +949,11 @@ bool CSPDirectiveList::parseDirective(const UChar* begin, const UChar* end, Stri if (position == end) return true; - if (!skipExactly<isASCIISpace>(position, end)) + if (!skipExactly<isASCIISpace>(position, end)) { + skipWhile<isNotASCIISpace>(position, end); + logUnrecognizedDirective(String(nameBegin, position - nameBegin)); return false; + } skipWhile<isASCIISpace>(position, end); @@ -1082,21 +1147,21 @@ ContentSecurityPolicy::HeaderType ContentSecurityPolicy::deprecatedHeaderType() return m_policies.isEmpty() ? EnforcePolicy : m_policies[0]->headerType(); } -template<bool (CSPDirectiveList::*allowed)(PassRefPtr<ScriptCallStack>) const> -bool isAllowedByAllWithCallStack(const CSPDirectiveListVector& policies, PassRefPtr<ScriptCallStack> callStack) +template<bool (CSPDirectiveList::*allowed)(PassRefPtr<ScriptCallStack>, ContentSecurityPolicy::ReportingStatus) const> +bool isAllowedByAllWithCallStack(const CSPDirectiveListVector& policies, PassRefPtr<ScriptCallStack> callStack, ContentSecurityPolicy::ReportingStatus reportingStatus) { for (size_t i = 0; i < policies.size(); ++i) { - if (!(policies[i].get()->*allowed)(callStack)) + if (!(policies[i].get()->*allowed)(callStack, reportingStatus)) return false; } return true; } -template<bool (CSPDirectiveList::*allowed)(const String&, const WTF::OrdinalNumber&) const> -bool isAllowedByAllWithContext(const CSPDirectiveListVector& policies, const String& contextURL, const WTF::OrdinalNumber& contextLine) +template<bool (CSPDirectiveList::*allowed)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicy::ReportingStatus) const> +bool isAllowedByAllWithContext(const CSPDirectiveListVector& policies, const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) { for (size_t i = 0; i < policies.size(); ++i) { - if (!(policies[i].get()->*allowed)(contextURL, contextLine)) + if (!(policies[i].get()->*allowed)(contextURL, contextLine, reportingStatus)) return false; } return true; @@ -1112,44 +1177,44 @@ bool isAllowedByAllWithNonce(const CSPDirectiveListVector& policies, const Strin return true; } -template<bool (CSPDirectiveList::*allowFromURL)(const KURL&) const> -bool isAllowedByAllWithURL(const CSPDirectiveListVector& policies, const KURL& url) +template<bool (CSPDirectiveList::*allowFromURL)(const KURL&, ContentSecurityPolicy::ReportingStatus) const> +bool isAllowedByAllWithURL(const CSPDirectiveListVector& policies, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) { if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(url.protocol())) return true; for (size_t i = 0; i < policies.size(); ++i) { - if (!(policies[i].get()->*allowFromURL)(url)) + if (!(policies[i].get()->*allowFromURL)(url, reportingStatus)) return false; } return true; } -bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithContext<&CSPDirectiveList::allowJavaScriptURLs>(m_policies, contextURL, contextLine); + return isAllowedByAllWithContext<&CSPDirectiveList::allowJavaScriptURLs>(m_policies, contextURL, contextLine, reportingStatus); } -bool ContentSecurityPolicy::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool ContentSecurityPolicy::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineEventHandlers>(m_policies, contextURL, contextLine); + return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineEventHandlers>(m_policies, contextURL, contextLine, reportingStatus); } -bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineScript>(m_policies, contextURL, contextLine); + return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineScript>(m_policies, contextURL, contextLine, reportingStatus); } -bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const +bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const { if (m_overrideInlineStyleAllowed) return true; - return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine); + return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine, reportingStatus); } -bool ContentSecurityPolicy::allowEval(PassRefPtr<ScriptCallStack> callStack) const +bool ContentSecurityPolicy::allowEval(PassRefPtr<ScriptCallStack> callStack, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithCallStack<&CSPDirectiveList::allowEval>(m_policies, callStack); + return isAllowedByAllWithCallStack<&CSPDirectiveList::allowEval>(m_policies, callStack, reportingStatus); } bool ContentSecurityPolicy::allowScriptNonce(const String& nonce, const String& contextURL, const WTF::OrdinalNumber& contextLine, const KURL& url) const @@ -1157,44 +1222,55 @@ bool ContentSecurityPolicy::allowScriptNonce(const String& nonce, const String& return isAllowedByAllWithNonce<&CSPDirectiveList::allowScriptNonce>(m_policies, nonce, contextURL, contextLine, url); } -bool ContentSecurityPolicy::allowScriptFromSource(const KURL& url) const +bool ContentSecurityPolicy::allowScriptFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const +{ + return isAllowedByAllWithURL<&CSPDirectiveList::allowScriptFromSource>(m_policies, url, reportingStatus); +} + +bool ContentSecurityPolicy::allowObjectFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const +{ + return isAllowedByAllWithURL<&CSPDirectiveList::allowObjectFromSource>(m_policies, url, reportingStatus); +} + +bool ContentSecurityPolicy::allowChildFrameFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowScriptFromSource>(m_policies, url); + return isAllowedByAllWithURL<&CSPDirectiveList::allowChildFrameFromSource>(m_policies, url, reportingStatus); } -bool ContentSecurityPolicy::allowObjectFromSource(const KURL& url) const +bool ContentSecurityPolicy::allowImageFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowObjectFromSource>(m_policies, url); + return isAllowedByAllWithURL<&CSPDirectiveList::allowImageFromSource>(m_policies, url, reportingStatus); } -bool ContentSecurityPolicy::allowChildFrameFromSource(const KURL& url) const +bool ContentSecurityPolicy::allowStyleFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowChildFrameFromSource>(m_policies, url); + return isAllowedByAllWithURL<&CSPDirectiveList::allowStyleFromSource>(m_policies, url, reportingStatus); } -bool ContentSecurityPolicy::allowImageFromSource(const KURL& url) const +bool ContentSecurityPolicy::allowFontFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowImageFromSource>(m_policies, url); + return isAllowedByAllWithURL<&CSPDirectiveList::allowFontFromSource>(m_policies, url, reportingStatus); } -bool ContentSecurityPolicy::allowStyleFromSource(const KURL& url) const +bool ContentSecurityPolicy::allowMediaFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowStyleFromSource>(m_policies, url); + return isAllowedByAllWithURL<&CSPDirectiveList::allowMediaFromSource>(m_policies, url, reportingStatus); } -bool ContentSecurityPolicy::allowFontFromSource(const KURL& url) const +bool ContentSecurityPolicy::allowConnectToSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowFontFromSource>(m_policies, url); + return isAllowedByAllWithURL<&CSPDirectiveList::allowConnectToSource>(m_policies, url, reportingStatus); } -bool ContentSecurityPolicy::allowMediaFromSource(const KURL& url) const +bool ContentSecurityPolicy::isActive() const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowMediaFromSource>(m_policies, url); + return !m_policies.isEmpty(); } -bool ContentSecurityPolicy::allowConnectToSource(const KURL& url) const +void ContentSecurityPolicy::gatherReportURIs(DOMStringList& list) const { - return isAllowedByAllWithURL<&CSPDirectiveList::allowConnectToSource>(m_policies, url); + for (size_t i = 0; i < m_policies.size(); ++i) + m_policies[i].get()->gatherReportURIs(list); } } diff --git a/Source/WebCore/page/ContentSecurityPolicy.h b/Source/WebCore/page/ContentSecurityPolicy.h index cb6bead51..cdb6b5f89 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.h +++ b/Source/WebCore/page/ContentSecurityPolicy.h @@ -40,6 +40,7 @@ namespace WebCore { class CSPDirectiveList; class ScriptCallStack; +class DOMStringList; class ScriptExecutionContext; typedef Vector<OwnPtr<CSPDirectiveList> > CSPDirectiveListVector; @@ -59,31 +60,39 @@ public: EnforcePolicy }; + enum ReportingStatus { + SendReport, + SuppressReport + }; + void didReceiveHeader(const String&, HeaderType); - // These functions are wrong becuase they assume that there is only one header. + // These functions are wrong because they assume that there is only one header. // FIXME: Replace them with functions that return vectors. const String& deprecatedHeader() const; HeaderType deprecatedHeaderType() const; - bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; - bool allowEval(PassRefPtr<ScriptCallStack>) const; + bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; + bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; + bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; + bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; + bool allowEval(PassRefPtr<ScriptCallStack>, ReportingStatus = SendReport) const; bool allowScriptNonce(const String& nonce, const String& contextURL, const WTF::OrdinalNumber& contextLine, const KURL& = KURL()) const; - bool allowScriptFromSource(const KURL&) const; - bool allowObjectFromSource(const KURL&) const; - bool allowChildFrameFromSource(const KURL&) const; - bool allowImageFromSource(const KURL&) const; - bool allowStyleFromSource(const KURL&) const; - bool allowFontFromSource(const KURL&) const; - bool allowMediaFromSource(const KURL&) const; - bool allowConnectToSource(const KURL&) const; + bool allowScriptFromSource(const KURL&, ReportingStatus = SendReport) const; + bool allowObjectFromSource(const KURL&, ReportingStatus = SendReport) const; + bool allowChildFrameFromSource(const KURL&, ReportingStatus = SendReport) const; + bool allowImageFromSource(const KURL&, ReportingStatus = SendReport) const; + bool allowStyleFromSource(const KURL&, ReportingStatus = SendReport) const; + bool allowFontFromSource(const KURL&, ReportingStatus = SendReport) const; + bool allowMediaFromSource(const KURL&, ReportingStatus = SendReport) const; + bool allowConnectToSource(const KURL&, ReportingStatus = SendReport) const; void setOverrideAllowInlineStyle(bool); + bool isActive() const; + void gatherReportURIs(DOMStringList&) const; + private: explicit ContentSecurityPolicy(ScriptExecutionContext*); diff --git a/Source/WebCore/page/Crypto.cpp b/Source/WebCore/page/Crypto.cpp index 986584d18..e38350ab1 100644 --- a/Source/WebCore/page/Crypto.cpp +++ b/Source/WebCore/page/Crypto.cpp @@ -31,7 +31,7 @@ #include "Crypto.h" #include "ExceptionCode.h" -#include <wtf/Uint8Array.h> +#include <wtf/ArrayBufferView.h> #include <wtf/CryptographicallyRandomNumber.h> namespace WebCore { @@ -40,13 +40,14 @@ namespace { bool isIntegerArray(ArrayBufferView* array) { - return array->isByteArray() - || array->isUnsignedByteArray() - || array->isUnsignedByteClampedArray() - || array->isShortArray() - || array->isUnsignedShortArray() - || array->isIntArray() - || array->isUnsignedIntArray(); + ArrayBufferView::ViewType type = array->getType(); + return type == ArrayBufferView::TypeInt8 + || type == ArrayBufferView::TypeUint8 + || type == ArrayBufferView::TypeUint8Clamped + || type == ArrayBufferView::TypeInt16 + || type == ArrayBufferView::TypeUint16 + || type == ArrayBufferView::TypeInt32 + || type == ArrayBufferView::TypeUint32; } } diff --git a/Source/WebCore/page/DOMSecurityPolicy.cpp b/Source/WebCore/page/DOMSecurityPolicy.cpp new file mode 100644 index 000000000..ca504839a --- /dev/null +++ b/Source/WebCore/page/DOMSecurityPolicy.cpp @@ -0,0 +1,157 @@ +/* + * 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 "DOMSecurityPolicy.h" + +#include "ContentSecurityPolicy.h" +#include "ContextDestructionObserver.h" +#include "DOMStringList.h" +#include "Frame.h" +#include "ScriptExecutionContext.h" +#include <wtf/text/TextPosition.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +namespace { + +bool isPolicyActiveInContext(ScriptExecutionContext* context) +{ + // If the ScriptExecutionContext has been destroyed, there's no active policy. + if (!context) + return false; + + return context->contentSecurityPolicy()->isActive(); +} + +template<bool (ContentSecurityPolicy::*allowWithURL)(const KURL&, ContentSecurityPolicy::ReportingStatus) const> +bool isAllowedWithURL(ScriptExecutionContext* context, const String& url) +{ + if (!isPolicyActiveInContext(context)) + return true; + + KURL parsedURL = context->completeURL(url); + if (!parsedURL.isValid()) + return false; // FIXME: Figure out how to throw a JavaScript error. + + return (context->contentSecurityPolicy()->*allowWithURL)(parsedURL, ContentSecurityPolicy::SuppressReport); +} + +template<bool (ContentSecurityPolicy::*allowWithContext)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicy::ReportingStatus) const> +bool isAllowed(ScriptExecutionContext* context) +{ + if (!isPolicyActiveInContext(context)) + return true; + + return (context->contentSecurityPolicy()->*allowWithContext)(KURL(), WTF::OrdinalNumber::beforeFirst(), ContentSecurityPolicy::SuppressReport); +} + +} // namespace + +DOMSecurityPolicy::DOMSecurityPolicy(ScriptExecutionContext* context) + : ContextDestructionObserver(context) +{ +} + +DOMSecurityPolicy::~DOMSecurityPolicy() +{ +} + +bool DOMSecurityPolicy::isActive() const +{ + return isPolicyActiveInContext(scriptExecutionContext()); +} + +PassRefPtr<DOMStringList> DOMSecurityPolicy::reportURIs() const +{ + RefPtr<DOMStringList> result = DOMStringList::create(); + + if (isActive()) + scriptExecutionContext()->contentSecurityPolicy()->gatherReportURIs(*result.get()); + + return result.release(); +} + +bool DOMSecurityPolicy::allowsInlineScript() const +{ + return isAllowed<&ContentSecurityPolicy::allowInlineScript>(scriptExecutionContext()); +} + +bool DOMSecurityPolicy::allowsInlineStyle() const +{ + return isAllowed<&ContentSecurityPolicy::allowInlineStyle>(scriptExecutionContext()); +} + +bool DOMSecurityPolicy::allowsEval() const +{ + if (!isActive()) + return true; + + return scriptExecutionContext()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport); +} + + +bool DOMSecurityPolicy::allowsConnectionTo(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowConnectToSource>(scriptExecutionContext(), url); +} + +bool DOMSecurityPolicy::allowsFontFrom(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowFontFromSource>(scriptExecutionContext(), url); +} + +bool DOMSecurityPolicy::allowsFrameFrom(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowChildFrameFromSource>(scriptExecutionContext(), url); +} + +bool DOMSecurityPolicy::allowsImageFrom(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowImageFromSource>(scriptExecutionContext(), url); +} + +bool DOMSecurityPolicy::allowsMediaFrom(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowMediaFromSource>(scriptExecutionContext(), url); +} + +bool DOMSecurityPolicy::allowsObjectFrom(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowObjectFromSource>(scriptExecutionContext(), url); +} + +bool DOMSecurityPolicy::allowsScriptFrom(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowScriptFromSource>(scriptExecutionContext(), url); +} + +bool DOMSecurityPolicy::allowsStyleFrom(const String& url) const +{ + return isAllowedWithURL<&ContentSecurityPolicy::allowStyleFromSource>(scriptExecutionContext(), url); +} + +} // namespace WebCore diff --git a/Source/WebCore/page/DOMSecurityPolicy.h b/Source/WebCore/page/DOMSecurityPolicy.h new file mode 100644 index 000000000..ce8f4e7f7 --- /dev/null +++ b/Source/WebCore/page/DOMSecurityPolicy.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011 Google, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY 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 DOMSecurityPolicy_h +#define DOMSecurityPolicy_h + +#include "ContextDestructionObserver.h" +#include <wtf/PassOwnPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class ContentSecurityPolicy; +class DOMStringList; +class Frame; + +class DOMSecurityPolicy : public RefCounted<DOMSecurityPolicy>, public ContextDestructionObserver { +public: + static PassRefPtr<DOMSecurityPolicy> create(ScriptExecutionContext* context) + { + return adoptRef(new DOMSecurityPolicy(context)); + } + ~DOMSecurityPolicy(); + + bool isActive() const; + PassRefPtr<DOMStringList> reportURIs() const; + + bool allowsInlineScript() const; + bool allowsInlineStyle() const; + bool allowsEval() const; + + bool allowsConnectionTo(const String& url) const; + bool allowsFontFrom(const String& url) const; + bool allowsFrameFrom(const String& url) const; + bool allowsImageFrom(const String& url) const; + bool allowsMediaFrom(const String& url) const; + bool allowsObjectFrom(const String& url) const; + bool allowsScriptFrom(const String& url) const; + bool allowsStyleFrom(const String& url) const; + +private: + explicit DOMSecurityPolicy(ScriptExecutionContext*); +}; + +} + +#endif diff --git a/Source/WebCore/Modules/mediastream/SignalingCallback.idl b/Source/WebCore/page/DOMSecurityPolicy.idl index 69e4b92f4..fce11b2ee 100644 --- a/Source/WebCore/Modules/mediastream/SignalingCallback.idl +++ b/Source/WebCore/page/DOMSecurityPolicy.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -22,13 +22,30 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module p2p { +module core { interface [ - Conditional=MEDIA_STREAM, - Callback - ] SignalingCallback { - boolean handleEvent(in DOMString message, in DeprecatedPeerConnection source); + Conditional=CSP_NEXT, + OmitConstructor, + InterfaceName=SecurityPolicy + ] DOMSecurityPolicy { + readonly attribute DOMStringList reportURIs; + + boolean isActive(); + + boolean allowsConnectionTo(in DOMString url); + boolean allowsFontFrom(in DOMString url); + boolean allowsFrameFrom(in DOMString url); + boolean allowsImageFrom(in DOMString url); + boolean allowsMediaFrom(in DOMString url); + boolean allowsObjectFrom(in DOMString url); + boolean allowsScriptFrom(in DOMString url); + boolean allowsStyleFrom(in DOMString url); + + boolean allowsEval(); + boolean allowsInlineScript(); + boolean allowsInlineStyle(); }; } + diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 27285766b..a53336a1d 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -782,6 +782,9 @@ module window { attribute [Conditional=MUTATION_OBSERVERS] MutationObserverConstructor WebKitMutationObserver; + attribute [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] SourceBufferConstructor SourceBuffer; + attribute [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] SourceBufferListConstructor SourceBufferList; + #endif // defined(LANGUAGE_JAVASCRIPT) #if defined(V8_BINDING) && V8_BINDING diff --git a/Source/WebCore/page/DiagnosticLoggingKeys.cpp b/Source/WebCore/page/DiagnosticLoggingKeys.cpp new file mode 100644 index 000000000..d71a605a8 --- /dev/null +++ b/Source/WebCore/page/DiagnosticLoggingKeys.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DiagnosticLoggingKeys.h" + +namespace WebCore { + +const String& DiagnosticLoggingKeys::mediaLoadedKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("mediaLoaded")); + return key; +} + +const String& DiagnosticLoggingKeys::mediaLoadingFailedKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("mediaFailedLoading")); + return key; +} + +const String& DiagnosticLoggingKeys::pluginLoadedKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("pluginLoaded")); + return key; +} + +const String& DiagnosticLoggingKeys::pluginLoadingFailedKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("pluginFailedLoading")); + return key; +} + +const String& DiagnosticLoggingKeys::pageContainsPluginKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("pageContainsPlugin")); + return key; +} + +const String& DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("pageContainsAtLeastOnePlugin")); + return key; +} + +const String& DiagnosticLoggingKeys::passKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("pass")); + return key; +} + +const String& DiagnosticLoggingKeys::failKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("fail")); + return key; +} + +const String& DiagnosticLoggingKeys::noopKey() +{ + DEFINE_STATIC_LOCAL(const String, key, ("noop")); + return key; +} + +} diff --git a/Source/WebCore/page/DiagnosticLoggingKeys.h b/Source/WebCore/page/DiagnosticLoggingKeys.h new file mode 100644 index 000000000..951806e57 --- /dev/null +++ b/Source/WebCore/page/DiagnosticLoggingKeys.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DiagnosticLoggingKeys_h +#define DiagnosticLoggingKeys_h + +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class DiagnosticLoggingKeys { +public: + // Message keys + static const String& mediaLoadedKey(); + static const String& mediaLoadingFailedKey(); + static const String& pluginLoadedKey(); + static const String& pluginLoadingFailedKey(); + static const String& pageContainsPluginKey(); + static const String& pageContainsAtLeastOnePluginKey(); + + // Success keys + static const String& passKey(); + static const String& failKey(); + static const String& noopKey(); +}; + +} + +#endif // DiagnosticLoggingKeys_h diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp index dbfb3d783..1ac1ed338 100644 --- a/Source/WebCore/page/DragController.cpp +++ b/Source/WebCore/page/DragController.cpp @@ -101,6 +101,7 @@ DragController::DragController(Page* page, DragClient* client) , m_isHandlingDrag(false) , m_sourceDragOperation(DragOperationNone) { + ASSERT(m_client); } DragController::~DragController() diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp index 4f81b9c88..bf582b473 100644 --- a/Source/WebCore/page/FocusController.cpp +++ b/Source/WebCore/page/FocusController.cpp @@ -94,19 +94,19 @@ static inline Node* previousNode(const Node* node) return walkerFromPrevious(node).get(); } -FocusScope::FocusScope(TreeScope* treeScope) +FocusNavigationScope::FocusNavigationScope(TreeScope* treeScope) : m_rootTreeScope(treeScope) { ASSERT(treeScope); ASSERT(!treeScope->rootNode()->isShadowRoot() || toShadowRoot(treeScope->rootNode())->isYoungest()); } -Node* FocusScope::rootNode() const +Node* FocusNavigationScope::rootNode() const { return m_rootTreeScope->rootNode(); } -Element* FocusScope::owner() const +Element* FocusNavigationScope::owner() const { Node* root = rootNode(); if (root->isShadowRoot()) @@ -116,7 +116,7 @@ Element* FocusScope::owner() const return 0; } -FocusScope FocusScope::focusScopeOf(Node* node) +FocusNavigationScope FocusNavigationScope::focusNavigationScopeOf(Node* node) { ASSERT(node); ComposedShadowTreeWalker walker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary); @@ -127,19 +127,19 @@ FocusScope FocusScope::focusScopeOf(Node* node) } // The result is not always a ShadowRoot nor a DocumentNode since // a starting node is in an orphaned tree in composed shadow tree. - return FocusScope(root->treeScope()); + return FocusNavigationScope(root->treeScope()); } -FocusScope FocusScope::focusScopeOwnedByShadowHost(Node* node) +FocusNavigationScope FocusNavigationScope::focusNavigationScopeOwnedByShadowHost(Node* node) { ASSERT(isShadowHost(node)); - return FocusScope(toElement(node)->shadow()->youngestShadowRoot()); + return FocusNavigationScope(toElement(node)->shadow()->youngestShadowRoot()); } -FocusScope FocusScope::focusScopeOwnedByIFrame(HTMLFrameOwnerElement* frame) +FocusNavigationScope FocusNavigationScope::focusNavigationScopeOwnedByIFrame(HTMLFrameOwnerElement* frame) { ASSERT(frame && frame->contentFrame()); - return FocusScope(frame->contentFrame()->document()); + return FocusNavigationScope(frame->contentFrame()->document()); } static inline void dispatchEventsOnWindowAndFocusedNode(Document* document, bool focused) @@ -268,7 +268,7 @@ Node* FocusController::findFocusableNodeDecendingDownIntoFrameDocument(FocusDire HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(node); if (!owner->contentFrame()) break; - Node* foundNode = findFocusableNode(direction, FocusScope::focusScopeOwnedByIFrame(owner), 0, event); + Node* foundNode = findFocusableNode(direction, FocusNavigationScope::focusNavigationScopeOwnedByIFrame(owner), 0, event); if (!foundNode) break; ASSERT(node != foundNode); @@ -323,7 +323,7 @@ bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, Keyb document->updateLayoutIgnorePendingStylesheets(); - RefPtr<Node> node = findFocusableNodeAcrossFocusScope(direction, FocusScope::focusScopeOf(currentNode ? currentNode : document), currentNode, event); + RefPtr<Node> node = findFocusableNodeAcrossFocusScope(direction, FocusNavigationScope::focusNavigationScopeOf(currentNode ? currentNode : document), currentNode, event); if (!node) { // We didn't find a node to focus, so we should try to pass focus to Chrome. @@ -335,7 +335,7 @@ bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, Keyb } // Chrome doesn't want focus, so we should wrap focus. - node = findFocusableNodeRecursively(direction, FocusScope::focusScopeOf(m_page->mainFrame()->document()), 0, event); + node = findFocusableNodeRecursively(direction, FocusNavigationScope::focusNavigationScopeOf(m_page->mainFrame()->document()), 0, event); node = findFocusableNodeDecendingDownIntoFrameDocument(direction, node.get(), event); if (!node) @@ -388,12 +388,12 @@ bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, Keyb return true; } -Node* FocusController::findFocusableNodeAcrossFocusScope(FocusDirection direction, FocusScope scope, Node* currentNode, KeyboardEvent* event) +Node* FocusController::findFocusableNodeAcrossFocusScope(FocusDirection direction, FocusNavigationScope scope, Node* currentNode, KeyboardEvent* event) { ASSERT(!currentNode || !isNonFocusableShadowHost(currentNode, event)); Node* found; if (currentNode && direction == FocusDirectionForward && isFocusableShadowHost(currentNode, event)) { - Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusScope::focusScopeOwnedByShadowHost(currentNode), 0, event); + Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusNavigationScope::focusNavigationScopeOwnedByShadowHost(currentNode), 0, event); found = foundInInnerFocusScope ? foundInInnerFocusScope : findFocusableNodeRecursively(direction, scope, currentNode, event); } else found = findFocusableNodeRecursively(direction, scope, currentNode, event); @@ -403,7 +403,7 @@ Node* FocusController::findFocusableNodeAcrossFocusScope(FocusDirection directio Node* owner = scope.owner(); if (!owner) break; - scope = FocusScope::focusScopeOf(owner); + scope = FocusNavigationScope::focusNavigationScopeOf(owner); if (direction == FocusDirectionBackward && isFocusableShadowHost(owner, event)) { found = owner; break; @@ -414,7 +414,7 @@ Node* FocusController::findFocusableNodeAcrossFocusScope(FocusDirection directio return found; } -Node* FocusController::findFocusableNodeRecursively(FocusDirection direction, FocusScope scope, Node* start, KeyboardEvent* event) +Node* FocusController::findFocusableNodeRecursively(FocusDirection direction, FocusNavigationScope scope, Node* start, KeyboardEvent* event) { // Starting node is exclusive. Node* found = findFocusableNode(direction, scope, start, event); @@ -423,22 +423,22 @@ Node* FocusController::findFocusableNodeRecursively(FocusDirection direction, Fo if (direction == FocusDirectionForward) { if (!isNonFocusableShadowHost(found, event)) return found; - Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusScope::focusScopeOwnedByShadowHost(found), 0, event); + Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusNavigationScope::focusNavigationScopeOwnedByShadowHost(found), 0, event); return foundInInnerFocusScope ? foundInInnerFocusScope : findFocusableNodeRecursively(direction, scope, found, event); } ASSERT(direction == FocusDirectionBackward); if (isFocusableShadowHost(found, event)) { - Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusScope::focusScopeOwnedByShadowHost(found), 0, event); + Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusNavigationScope::focusNavigationScopeOwnedByShadowHost(found), 0, event); return foundInInnerFocusScope ? foundInInnerFocusScope : found; } if (isNonFocusableShadowHost(found, event)) { - Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusScope::focusScopeOwnedByShadowHost(found), 0, event); + Node* foundInInnerFocusScope = findFocusableNodeRecursively(direction, FocusNavigationScope::focusNavigationScopeOwnedByShadowHost(found), 0, event); return foundInInnerFocusScope ? foundInInnerFocusScope :findFocusableNodeRecursively(direction, scope, found, event); } return found; } -Node* FocusController::findFocusableNode(FocusDirection direction, FocusScope scope, Node* node, KeyboardEvent* event) +Node* FocusController::findFocusableNode(FocusDirection direction, FocusNavigationScope scope, Node* node, KeyboardEvent* event) { return (direction == FocusDirectionForward) ? nextFocusableNode(scope, node, event) @@ -487,7 +487,7 @@ static Node* previousNodeWithLowerTabIndex(Node* start, int tabIndex, KeyboardEv return winner; } -Node* FocusController::nextFocusableNode(FocusScope scope, Node* start, KeyboardEvent* event) +Node* FocusController::nextFocusableNode(FocusNavigationScope scope, Node* start, KeyboardEvent* event) { if (start) { int tabIndex = adjustedTabIndex(start, event); @@ -519,7 +519,7 @@ Node* FocusController::nextFocusableNode(FocusScope scope, Node* start, Keyboard return findNodeWithExactTabIndex(scope.rootNode(), 0, event, FocusDirectionForward); } -Node* FocusController::previousFocusableNode(FocusScope scope, Node* start, KeyboardEvent* event) +Node* FocusController::previousFocusableNode(FocusNavigationScope scope, Node* start, KeyboardEvent* event) { Node* last = 0; for (ComposedShadowTreeWalker walker = walkerFrom(scope.rootNode()); walker.get(); walker.lastChild()) diff --git a/Source/WebCore/page/FocusController.h b/Source/WebCore/page/FocusController.h index 75223d60a..cb90f9694 100644 --- a/Source/WebCore/page/FocusController.h +++ b/Source/WebCore/page/FocusController.h @@ -45,16 +45,16 @@ class Node; class Page; class TreeScope; -class FocusScope { +class FocusNavigationScope { public: Node* rootNode() const; Element* owner() const; - static FocusScope focusScopeOf(Node*); - static FocusScope focusScopeOwnedByShadowHost(Node*); - static FocusScope focusScopeOwnedByIFrame(HTMLFrameOwnerElement*); + static FocusNavigationScope focusNavigationScopeOf(Node*); + static FocusNavigationScope focusNavigationScopeOwnedByShadowHost(Node*); + static FocusNavigationScope focusNavigationScopeOwnedByIFrame(HTMLFrameOwnerElement*); private: - explicit FocusScope(TreeScope*); + explicit FocusNavigationScope(TreeScope*); TreeScope* m_rootTreeScope; }; @@ -87,8 +87,8 @@ private: bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*); bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus); - Node* findFocusableNodeAcrossFocusScope(FocusDirection, FocusScope startScope, Node* start, KeyboardEvent*); - Node* findFocusableNodeRecursively(FocusDirection, FocusScope, Node* start, KeyboardEvent*); + Node* findFocusableNodeAcrossFocusScope(FocusDirection, FocusNavigationScope startScope, Node* start, KeyboardEvent*); + Node* findFocusableNodeRecursively(FocusDirection, FocusNavigationScope, Node* start, KeyboardEvent*); Node* findFocusableNodeDecendingDownIntoFrameDocument(FocusDirection, Node*, KeyboardEvent*); // Searches through the given tree scope, starting from start node, for the next/previous selectable element that comes after/before start node. @@ -100,10 +100,10 @@ private: // @return The focus node that comes after/before start node. // // See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 - inline Node* findFocusableNode(FocusDirection, FocusScope, Node* start, KeyboardEvent*); + inline Node* findFocusableNode(FocusDirection, FocusNavigationScope, Node* start, KeyboardEvent*); - Node* nextFocusableNode(FocusScope, Node* start, KeyboardEvent*); - Node* previousFocusableNode(FocusScope, Node* start, KeyboardEvent*); + Node* nextFocusableNode(FocusNavigationScope, Node* start, KeyboardEvent*); + Node* previousFocusableNode(FocusNavigationScope, Node* start, KeyboardEvent*); Node* findNodeWithExactTabIndex(Node* start, int tabIndex, KeyboardEvent*, FocusDirection); diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index ddc3c242c..931999495 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -2296,7 +2296,7 @@ void FrameView::updateWidget(RenderEmbeddedObject* object) // FIXME: This could turn into a real virtual dispatch if we defined // updateWidget(PluginCreationOption) on HTMLElement. - if (ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag)) { + if (ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag) || ownerElement->hasTagName(appletTag)) { HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(ownerElement); if (pluginElement->needsWidgetUpdate()) pluginElement->updateWidget(CreateAnyWidgetType); diff --git a/Source/WebCore/page/MemoryInfo.cpp b/Source/WebCore/page/MemoryInfo.cpp index 57dae2b40..398c216c3 100644 --- a/Source/WebCore/page/MemoryInfo.cpp +++ b/Source/WebCore/page/MemoryInfo.cpp @@ -34,19 +34,119 @@ #include "Frame.h" #include "ScriptGCEvent.h" #include "Settings.h" +#include <limits> +#include <wtf/CurrentTime.h> +#include <wtf/MainThread.h> namespace WebCore { +#if ENABLE(INSPECTOR) + +class HeapSizeCache { + WTF_MAKE_NONCOPYABLE(HeapSizeCache); +public: + HeapSizeCache() + : m_lastUpdateTime(0) + { + } + + void getCachedHeapSize(HeapInfo& info) + { + maybeUpdate(); + info = m_info; + } + +private: + void maybeUpdate() + { + // We rate-limit queries to once every twenty minutes to make it more difficult + // for attackers to compare memory usage before and after some event. + const double TwentyMinutesInSeconds = 20 * 60; + + double now = monotonicallyIncreasingTime(); + if (now - m_lastUpdateTime >= TwentyMinutesInSeconds) { + update(); + m_lastUpdateTime = now; + } + } + + void update() + { + ScriptGCEvent::getHeapSize(m_info); + m_info.usedJSHeapSize = quantizeMemorySize(m_info.usedJSHeapSize); + m_info.totalJSHeapSize = quantizeMemorySize(m_info.totalJSHeapSize); + m_info.jsHeapSizeLimit = quantizeMemorySize(m_info.jsHeapSizeLimit); + } + + double m_lastUpdateTime; + + HeapInfo m_info; +}; + +// We quantize the sizes to make it more difficult for an attacker to see precise +// impact of operations on memory. The values are used for performance tuning, +// and hence don't need to be as refined when the value is large, so we threshold +// at a list of exponentially separated buckets. +size_t quantizeMemorySize(size_t size) +{ + const int numberOfBuckets = 100; + DEFINE_STATIC_LOCAL(Vector<size_t>, bucketSizeList, ()); + + ASSERT(isMainThread()); + if (bucketSizeList.isEmpty()) { + bucketSizeList.resize(numberOfBuckets); + + float sizeOfNextBucket = 10000000.0; // First bucket size is roughly 10M. + const float largestBucketSize = 4000000000.0; // Roughly 4GB. + // We scale with the Nth root of the ratio, so that we use all the bucktes. + const float scalingFactor = exp(log(largestBucketSize / sizeOfNextBucket) / numberOfBuckets); + + size_t nextPowerOfTen = static_cast<size_t>(pow(10, floor(log10(sizeOfNextBucket)) + 1) + 0.5); + size_t granularity = nextPowerOfTen / 1000; // We want 3 signficant digits. + + for (int i = 0; i < numberOfBuckets; ++i) { + size_t currentBucketSize = static_cast<size_t>(sizeOfNextBucket); + bucketSizeList[i] = currentBucketSize - (currentBucketSize % granularity); + + sizeOfNextBucket *= scalingFactor; + if (sizeOfNextBucket >= nextPowerOfTen) { + if (std::numeric_limits<size_t>::max() / 10 <= nextPowerOfTen) + nextPowerOfTen = std::numeric_limits<size_t>::max(); + else { + nextPowerOfTen *= 10; + granularity *= 10; + } + } + + // Watch out for overflow, if the range is too large for size_t. + if (i > 0 && bucketSizeList[i] < bucketSizeList[i - 1]) + bucketSizeList[i] = std::numeric_limits<size_t>::max(); + } + } + + for (int i = 0; i < numberOfBuckets; ++i) { + if (size <= bucketSizeList[i]) + return bucketSizeList[i]; + } + + return bucketSizeList[numberOfBuckets - 1]; +} + +#endif + MemoryInfo::MemoryInfo(Frame* frame) - : m_totalJSHeapSize(0), - m_usedJSHeapSize(0), - m_jsHeapSizeLimit(0) { - if (frame && frame->settings() && frame->settings()->memoryInfoEnabled()) { + if (!frame || !frame->settings()) + return; + #if ENABLE(INSPECTOR) - ScriptGCEvent::getHeapSize(m_usedJSHeapSize, m_totalJSHeapSize, m_jsHeapSizeLimit); -#endif + if (frame->settings()->memoryInfoEnabled()) + ScriptGCEvent::getHeapSize(m_info); + else if (true || frame->settings()->quantizedMemoryInfoEnabled()) { + DEFINE_STATIC_LOCAL(HeapSizeCache, heapSizeCache, ()); + heapSizeCache.getCachedHeapSize(m_info); } +#endif } } // namespace WebCore diff --git a/Source/WebCore/page/MemoryInfo.h b/Source/WebCore/page/MemoryInfo.h index 79ce4172b..a6557b3b8 100644 --- a/Source/WebCore/page/MemoryInfo.h +++ b/Source/WebCore/page/MemoryInfo.h @@ -31,6 +31,7 @@ #ifndef MemoryInfo_h #define MemoryInfo_h +#include "ScriptGCEvent.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -42,18 +43,18 @@ class MemoryInfo : public RefCounted<MemoryInfo> { public: static PassRefPtr<MemoryInfo> create(Frame* frame) { return adoptRef(new MemoryInfo(frame)); } - size_t totalJSHeapSize() const { return m_totalJSHeapSize; } - size_t usedJSHeapSize() const { return m_usedJSHeapSize; } - size_t jsHeapSizeLimit() const { return m_jsHeapSizeLimit; } + size_t totalJSHeapSize() const { return m_info.totalJSHeapSize; } + size_t usedJSHeapSize() const { return m_info.usedJSHeapSize; } + size_t jsHeapSizeLimit() const { return m_info.jsHeapSizeLimit; } private: explicit MemoryInfo(Frame*); - size_t m_totalJSHeapSize; - size_t m_usedJSHeapSize; - size_t m_jsHeapSizeLimit; + HeapInfo m_info; }; +size_t quantizeMemorySize(size_t); + } // namespace WebCore #endif // MemoryInfo_h diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index c45e532f1..f10677c23 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -167,6 +167,8 @@ Page::Page(PageClients& pageClients) , m_alternativeTextClient(pageClients.alternativeTextClient) , m_scriptedAnimationsSuspended(false) { + ASSERT(m_editorClient); + if (!allPages) { allPages = new HashSet<Page*>; @@ -1156,6 +1158,26 @@ void Page::resumeActiveDOMObjectsAndAnimations() frame->resumeActiveDOMObjectsAndAnimations(); } +bool Page::hasSeenAnyPlugin() const +{ + return !m_seenPlugins.isEmpty(); +} + +bool Page::hasSeenPlugin(const String& serviceType) const +{ + return m_seenPlugins.contains(serviceType); +} + +void Page::sawPlugin(const String& serviceType) +{ + m_seenPlugins.add(serviceType); +} + +void Page::resetSeenPlugins() +{ + m_seenPlugins.clear(); +} + Page::PageClients::PageClients() : alternativeTextClient(0) , chromeClient(0) diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h index d759fb86f..f8b026f73 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h @@ -348,6 +348,11 @@ namespace WebCore { AlternativeTextClient* alternativeTextClient() const { return m_alternativeTextClient; } + bool hasSeenPlugin(const String& serviceType) const; + bool hasSeenAnyPlugin() const; + void sawPlugin(const String& serviceType); + void resetSeenPlugins(); + private: void initGroup(); @@ -451,6 +456,8 @@ namespace WebCore { AlternativeTextClient* m_alternativeTextClient; bool m_scriptedAnimationsSuspended; + + HashSet<String> m_seenPlugins; }; } // namespace WebCore diff --git a/Source/WebCore/page/PagePopupClient.cpp b/Source/WebCore/page/PagePopupClient.cpp new file mode 100644 index 000000000..5b666ea45 --- /dev/null +++ b/Source/WebCore/page/PagePopupClient.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "PagePopupClient.h" + +#if ENABLE(PAGE_POPUP) + +#include <wtf/text/StringBuilder.h> + +namespace WebCore { + +#define addLiteral(literal, writer) writer.addData(literal, sizeof(literal) - 1) + +void PagePopupClient::addJavaScriptString(const String& str, DocumentWriter& writer) +{ + addLiteral("\"", writer); + StringBuilder builder; + builder.reserveCapacity(str.length()); + for (unsigned i = 0; i < str.length(); ++i) { + if (str[i] == '\\' || str[i] == '"') + builder.append('\\'); + builder.append(str[i]); + } + addString(builder.toString(), writer); + addLiteral("\"", writer); +} + +void PagePopupClient::addProperty(const char* name, const String& value, DocumentWriter& writer) +{ + writer.addData(name, strlen(name)); + addLiteral(": ", writer); + addJavaScriptString(value, writer); + addLiteral(",\n", writer); +} + +void PagePopupClient::addProperty(const char* name, unsigned value, DocumentWriter& writer) +{ + writer.addData(name, strlen(name)); + addLiteral(": ", writer); + addString(String::number(value), writer); + addLiteral(",\n", writer); +} + +void PagePopupClient::addProperty(const char* name, bool value, DocumentWriter& writer) +{ + writer.addData(name, strlen(name)); + addLiteral(": ", writer); + if (value) + addLiteral("true", writer); + else + addLiteral("false", writer); + addLiteral(",\n", writer); +} + +void PagePopupClient::addProperty(const char* name, const Vector<String>& values, DocumentWriter& writer) +{ + writer.addData(name, strlen(name)); + addLiteral(": [", writer); + for (unsigned i = 0; i < values.size(); ++i) { + if (i) + addLiteral(",", writer); + addJavaScriptString(values[i], writer); + } + addLiteral("],\n", writer); +} + +} // namespace WebCore + +#endif // ENABLE(PAGE_POPUP) diff --git a/Source/WebCore/page/PagePopupClient.h b/Source/WebCore/page/PagePopupClient.h index d329ada91..02aee3225 100644 --- a/Source/WebCore/page/PagePopupClient.h +++ b/Source/WebCore/page/PagePopupClient.h @@ -33,6 +33,7 @@ #if ENABLE(PAGE_POPUP) +#include "DocumentWriter.h" #include "IntSize.h" #include <wtf/text/WTFString.h> @@ -59,8 +60,22 @@ public: virtual void didClosePopup() = 0; virtual ~PagePopupClient() { } + + // Helper functions to be used in PagePopupClient::writeDocument(). + static void addString(const String&, DocumentWriter&); + static void addJavaScriptString(const String&, DocumentWriter&); + static void addProperty(const char* name, const String& value, DocumentWriter&); + static void addProperty(const char* name, unsigned value, DocumentWriter&); + static void addProperty(const char* name, bool value, DocumentWriter&); + static void addProperty(const char* name, const Vector<String>& values, DocumentWriter&); }; +inline void PagePopupClient::addString(const String& str, DocumentWriter& writer) +{ + CString str8 = str.utf8(); + writer.addData(str8.data(), str8.length()); +} + } #endif #endif diff --git a/Source/WebCore/page/PageSerializer.cpp b/Source/WebCore/page/PageSerializer.cpp index 9fb5d7ebe..c911d54a9 100644 --- a/Source/WebCore/page/PageSerializer.cpp +++ b/Source/WebCore/page/PageSerializer.cpp @@ -73,9 +73,9 @@ static bool isCharsetSpecifyingNode(Node* node) HTMLMetaCharsetParser::AttributeList attributes; if (element->hasAttributes()) { for (unsigned i = 0; i < element->attributeCount(); ++i) { - Attribute* item = element->attributeItem(i); + const Attribute* attribute = element->attributeItem(i); // FIXME: We should deal appropriately with the attribute if they have a namespace. - attributes.append(std::make_pair(item->name().toString(), item->value().string())); + attributes.append(std::make_pair(attribute->name().toString(), attribute->value().string())); } } TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttributes(attributes); diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index d8823bd95..dd5550139 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -242,6 +242,7 @@ Settings::Settings(Page* page) , m_unifiedTextCheckerEnabled(false) #endif , m_memoryInfoEnabled(false) + , m_quantizedMemoryInfoEnabled(false) , m_interactiveFormValidation(false) , m_usePreHTML5ParserQuirks(false) , m_hyperlinkAuditingEnabled(false) @@ -281,6 +282,7 @@ Settings::Settings(Page* page) , m_syncXHRInDocumentsEnabled(true) , m_cookieEnabled(true) , m_windowFocusRestricted(true) + , m_diagnosticLoggingEnabled(false) , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired) , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds) { diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 747af7642..83f64eccc 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -453,6 +453,9 @@ namespace WebCore { void setMemoryInfoEnabled(bool flag) { m_memoryInfoEnabled = flag; } bool memoryInfoEnabled() const { return m_memoryInfoEnabled; } + void setQuantizedMemoryInfoEnabled(bool flag) { m_quantizedMemoryInfoEnabled = flag; } + bool quantizedMemoryInfoEnabled() const { return m_quantizedMemoryInfoEnabled; } + // This setting will be removed when an HTML5 compatibility issue is // resolved and WebKit implementation of interactive validation is // completed. See http://webkit.org/b/40520, http://webkit.org/b/40747, @@ -603,6 +606,9 @@ namespace WebCore { void setCookieEnabled(bool enabled) { m_cookieEnabled = enabled; } bool cookieEnabled() const { return m_cookieEnabled; } + void setDiagnosticLoggingEnabled(bool enabled) { m_diagnosticLoggingEnabled = enabled; } + bool diagnosticLoggingEnabled() const { return m_diagnosticLoggingEnabled; } + private: explicit Settings(Page*); @@ -728,11 +734,12 @@ namespace WebCore { #if ENABLE(FULLSCREEN_API) bool m_fullScreenAPIEnabled : 1; #endif - bool m_asynchronousSpellCheckingEnabled: 1; - bool m_unifiedTextCheckerEnabled: 1; - bool m_memoryInfoEnabled: 1; - bool m_interactiveFormValidation: 1; - bool m_usePreHTML5ParserQuirks: 1; + bool m_asynchronousSpellCheckingEnabled : 1; + bool m_unifiedTextCheckerEnabled : 1; + bool m_memoryInfoEnabled : 1; + bool m_quantizedMemoryInfoEnabled : 1; + bool m_interactiveFormValidation : 1; + bool m_usePreHTML5ParserQuirks : 1; bool m_hyperlinkAuditingEnabled : 1; bool m_crossOriginCheckInGetMatchedCSSRulesDisabled : 1; bool m_forceCompositingMode : 1; @@ -776,6 +783,8 @@ namespace WebCore { bool m_windowFocusRestricted : 1; + bool m_diagnosticLoggingEnabled : 1; + Timer<Settings> m_loadsImagesAutomaticallyTimer; void loadsImagesAutomaticallyTimerFired(Timer<Settings>*); diff --git a/Source/WebCore/page/TouchAdjustment.cpp b/Source/WebCore/page/TouchAdjustment.cpp index cf4ba1bb3..85cb61ed2 100644 --- a/Source/WebCore/page/TouchAdjustment.cpp +++ b/Source/WebCore/page/TouchAdjustment.cpp @@ -25,6 +25,7 @@ #include "FloatPoint.h" #include "FloatQuad.h" #include "FrameView.h" +#include "HTMLInputElement.h" #include "HTMLLabelElement.h" #include "HTMLNames.h" #include "IntPoint.h" @@ -34,11 +35,14 @@ #include "RenderBox.h" #include "RenderObject.h" #include "RenderStyle.h" +#include "ShadowRoot.h" namespace WebCore { namespace TouchAdjustment { +const float zeroTolerance = 1e-6f; + // Class for remembering absolute quads of a target node and what node they represent. class SubtargetGeometry { public: @@ -72,6 +76,13 @@ bool nodeRespondsToTapGesture(Node* node) if (element->hasTagName(HTMLNames::labelTag) && static_cast<HTMLLabelElement*>(element)->control()) return true; } + Element* shadowHost = node->shadowHost(); + if (shadowHost && shadowHost->hasTagName(HTMLNames::inputTag)) { + HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost); + if (!input->readOnly() && !input->disabled()) + return true; + } + // FIXME: Implement hasDefaultEventHandler and use that instead of all of the above checks. if (node->hasEventListeners() && (node->hasEventListeners(eventNames().clickEvent) @@ -219,7 +230,6 @@ float distanceSquaredToTargetCenterLine(const IntPoint& touchHotspot, const IntR return rect.distanceSquaredFromCenterLineToPoint(touchHotspot); } - // This returns quotient of the target area and its intersection with the touch area. // This will prioritize largest intersection and smallest area, while balancing the two against each other. float zoomableIntersectionQuotient(const IntPoint& touchHotspot, const IntRect& touchArea, const SubtargetGeometry& subtarget) @@ -239,6 +249,34 @@ float zoomableIntersectionQuotient(const IntPoint& touchHotspot, const IntRect& return rect.size().area() / (float)intersection.size().area(); } +// Uses a hybrid of distance to center and intersect ratio, normalizing each +// score between 0 and 1 and choosing the better score. The distance to +// centerline works best for disambiguating clicks on targets such as links, +// where the width may be significantly larger than the touch width. Using +// area of overlap in such cases can lead to a bias towards shorter links. +// Conversely, percentage of overlap can provide strong confidence in tapping +// on a small target, where the overlap is often quite high, and works well +// for tightly packed controls. +float hybridDistanceFunction(const IntPoint& touchHotspot, const IntRect& touchArea, const SubtargetGeometry& subtarget) +{ + IntRect rect = subtarget.boundingBox(); + + // Convert from frame coordinates to window coordinates. + rect = subtarget.node()->document()->view()->contentsToWindow(rect); + + float touchWidth = touchArea.width(); + float touchHeight = touchArea.height(); + float distanceScale = touchWidth * touchWidth + touchHeight * touchHeight; + float distanceToCenterScore = rect.distanceSquaredFromCenterLineToPoint(touchHotspot) / distanceScale; + + float targetArea = rect.size().area(); + rect.intersect(touchArea); + float intersectArea = rect.size().area(); + float intersectionScore = 1 - intersectArea / targetArea; + + return intersectionScore < distanceToCenterScore ? intersectionScore : distanceToCenterScore; +} + FloatPoint contentsToWindow(FrameView *view, FloatPoint pt) { int x = static_cast<int>(pt.x() + 0.5f); @@ -320,6 +358,7 @@ bool findNodeWithLowestDistanceMetric(Node*& targetNode, IntPoint& targetPoint, SubtargetGeometryList::const_iterator it = subtargets.begin(); const SubtargetGeometryList::const_iterator end = subtargets.end(); IntPoint adjustedPoint; + for (; it != end; ++it) { Node* node = it->node(); float distanceMetric = distanceFunction(touchHotspot, touchArea, *it); @@ -330,12 +369,27 @@ bool findNodeWithLowestDistanceMetric(Node*& targetNode, IntPoint& targetPoint, targetNode = node; bestDistanceMetric = distanceMetric; } - } else if (distanceMetric == bestDistanceMetric) { - // Try to always return the inner-most element. - if (node->isDescendantOf(targetNode) && snapTo(*it, touchHotspot, touchArea, adjustedPoint)) { - targetPoint = adjustedPoint; - targetNode = node; - targetArea = it->boundingBox(); + } else if (distanceMetric - bestDistanceMetric < zeroTolerance) { + if (snapTo(*it, touchHotspot, touchArea, adjustedPoint)) { + if (node->isDescendantOf(targetNode)) { + // Try to always return the inner-most element. + targetPoint = adjustedPoint; + targetNode = node; + targetArea = it->boundingBox(); + } else { + // Minimize adjustment distance. + float dx = targetPoint.x() - touchHotspot.x(); + float dy = targetPoint.y() - touchHotspot.y(); + float bestDistance = dx * dx + dy * dy; + dx = adjustedPoint.x() - touchHotspot.x(); + dy = adjustedPoint.y() - touchHotspot.y(); + float distance = dx * dx + dy * dy; + if (distance < bestDistance) { + targetPoint = adjustedPoint; + targetNode = node; + targetArea = it->boundingBox(); + } + } } } } @@ -352,7 +406,7 @@ bool findBestClickableCandidate(Node*& targetNode, IntPoint &targetPoint, const IntRect targetArea; TouchAdjustment::SubtargetGeometryList subtargets; TouchAdjustment::compileSubtargetList(nodeList, subtargets, TouchAdjustment::nodeRespondsToTapGesture); - return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetPoint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::distanceSquaredToTargetCenterLine); + return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetPoint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::hybridDistanceFunction); } bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint& touchHotspot, const IntRect& touchArea, const NodeList& nodeList) diff --git a/Source/WebCore/page/WebKitAnimation.idl b/Source/WebCore/page/WebKitAnimation.idl index 4fba2e8fb..4d3cad26d 100644 --- a/Source/WebCore/page/WebKitAnimation.idl +++ b/Source/WebCore/page/WebKitAnimation.idl @@ -36,7 +36,7 @@ module html { attribute double elapsedTime; readonly attribute double delay; - readonly attribute [Custom] int iterationCount; + readonly attribute [Custom] long iterationCount; readonly attribute boolean paused; readonly attribute boolean ended; diff --git a/Source/WebCore/page/blackberry/SettingsBlackBerry.cpp b/Source/WebCore/page/blackberry/SettingsBlackBerry.cpp index 636ad8e4d..e59a59113 100644 --- a/Source/WebCore/page/blackberry/SettingsBlackBerry.cpp +++ b/Source/WebCore/page/blackberry/SettingsBlackBerry.cpp @@ -45,19 +45,19 @@ static const char* languages[] = { void Settings::initializeDefaultFontFamilies() { - setCursiveFontFamily(BlackBerry::Platform::fontFamily("-webkit-cursive", "").c_str()); - setFantasyFontFamily(BlackBerry::Platform::fontFamily("-webkit-fantasy", "").c_str()); - setFixedFontFamily(BlackBerry::Platform::fontFamily("-webkit-monospace", "").c_str()); - setSansSerifFontFamily(BlackBerry::Platform::fontFamily("-webkit-sans-serif", "").c_str()); - setSerifFontFamily(BlackBerry::Platform::fontFamily("-webkit-serif", "").c_str()); - setStandardFontFamily(BlackBerry::Platform::fontFamily("-webkit-standard", "").c_str()); + setCursiveFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-cursive", "").c_str()); + setFantasyFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-fantasy", "").c_str()); + setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-monospace", "").c_str()); + setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-sans-serif", "").c_str()); + setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-serif", "").c_str()); + setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-standard", "").c_str()); for (size_t i = 0; i < WTF_ARRAY_LENGTH(languages); ++i) { UScriptCode script = localeToScriptCodeForFontSelection(languages[i]); - setFixedFontFamily(BlackBerry::Platform::fontFamily("monospace", languages[i]).c_str(), script); - setSansSerifFontFamily(BlackBerry::Platform::fontFamily("sans-serif", languages[i]).c_str(), script); - setSerifFontFamily(BlackBerry::Platform::fontFamily("serif", languages[i]).c_str(), script); - setStandardFontFamily(BlackBerry::Platform::fontFamily("", languages[i]).c_str(), script); + setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("monospace", languages[i]).c_str(), script); + setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("sans-serif", languages[i]).c_str(), script); + setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("serif", languages[i]).c_str(), script); + setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("", languages[i]).c_str(), script); } } diff --git a/Source/WebCore/platform/AsyncFileSystem.cpp b/Source/WebCore/platform/AsyncFileSystem.cpp index a3fb07f86..29f1e232a 100644 --- a/Source/WebCore/platform/AsyncFileSystem.cpp +++ b/Source/WebCore/platform/AsyncFileSystem.cpp @@ -46,11 +46,18 @@ bool AsyncFileSystem::isAvailable() return false; } +// FIXME: Add FileSystemType parameter. void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { notImplemented(); callbacks->didFail(NOT_SUPPORTED_ERR); } + +void AsyncFileSystem::deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + notImplemented(); + callbacks->didFail(NOT_SUPPORTED_ERR); +} #endif } // namespace diff --git a/Source/WebCore/platform/AsyncFileSystem.h b/Source/WebCore/platform/AsyncFileSystem.h index c33d6a0f2..1f5ca5ec0 100644 --- a/Source/WebCore/platform/AsyncFileSystem.h +++ b/Source/WebCore/platform/AsyncFileSystem.h @@ -64,8 +64,12 @@ public: static PassOwnPtr<AsyncFileSystem> create(); // Opens a new file system. The create parameter specifies whether or not to create the path if it does not already exists. + // FIXME: Add FileSystemType parameter. static void openFileSystem(const String& basePath, const String& storageIdentifier, bool create, PassOwnPtr<AsyncFileSystemCallbacks>); + // Deletes the file system. + static void deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>); + // Moves a file or directory from srcPath to destPath. // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully. // AsyncFileSystemCallbacks::didFail() is called otherwise. diff --git a/Source/WebCore/platform/AutodrainedPool.h b/Source/WebCore/platform/AutodrainedPool.h index 207aadcbe..7070c5f55 100644 --- a/Source/WebCore/platform/AutodrainedPool.h +++ b/Source/WebCore/platform/AutodrainedPool.h @@ -38,7 +38,7 @@ namespace WebCore { class AutodrainedPool { WTF_MAKE_NONCOPYABLE(AutodrainedPool); public: - AutodrainedPool(int iterationLimit = 1); + explicit AutodrainedPool(int iterationLimit = 1); ~AutodrainedPool(); void cycle(); diff --git a/Source/WebCore/platform/ColorChooserClient.h b/Source/WebCore/platform/ColorChooserClient.h index b39c037ce..5925334a2 100644 --- a/Source/WebCore/platform/ColorChooserClient.h +++ b/Source/WebCore/platform/ColorChooserClient.h @@ -7,6 +7,7 @@ #include "IntRect.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> namespace WebCore { @@ -18,7 +19,10 @@ public: virtual void didChooseColor(const Color&) = 0; virtual void didEndChooser() = 0; - virtual IntRect elementRectRelativeToWindow() const = 0; + virtual IntRect elementRectRelativeToRootView() const = 0; + virtual Color currentColor() = 0; + virtual bool shouldShowSuggestions() const = 0; + virtual Vector<Color> suggestions() const = 0; }; } // namespace WebCore diff --git a/Source/WebCore/platform/ContentType.h b/Source/WebCore/platform/ContentType.h index 4583232ee..b3857cf7b 100644 --- a/Source/WebCore/platform/ContentType.h +++ b/Source/WebCore/platform/ContentType.h @@ -33,7 +33,7 @@ namespace WebCore { class ContentType { public: - ContentType(const String& type); + explicit ContentType(const String& type); String parameter (const String& parameterName) const; String type() const; diff --git a/Source/WebCore/platform/ContextMenu.h b/Source/WebCore/platform/ContextMenu.h index 6a43b49a6..4700db459 100644 --- a/Source/WebCore/platform/ContextMenu.h +++ b/Source/WebCore/platform/ContextMenu.h @@ -71,7 +71,7 @@ namespace WebCore { void appendItem(const ContextMenuItem& item) { m_items.append(item); } #else - ContextMenu(const PlatformMenuDescription); + explicit ContextMenu(const PlatformMenuDescription); ~ContextMenu(); void insertItem(unsigned position, ContextMenuItem&); diff --git a/Source/WebCore/platform/ContextMenuItem.h b/Source/WebCore/platform/ContextMenuItem.h index 9d367446e..c05519f4d 100644 --- a/Source/WebCore/platform/ContextMenuItem.h +++ b/Source/WebCore/platform/ContextMenuItem.h @@ -277,8 +277,8 @@ namespace WebCore { const Vector<ContextMenuItem>& subMenuItems() const { return m_subMenuItems; } #else public: - ContextMenuItem(PlatformMenuItemDescription); - ContextMenuItem(ContextMenu* subMenu = 0); + explicit ContextMenuItem(PlatformMenuItemDescription); + explicit ContextMenuItem(ContextMenu* subMenu = 0); ContextMenuItem(ContextMenuAction, const String&, bool enabled, bool checked, Vector<ContextMenuItem>& submenuItems); PlatformMenuItemDescription releasePlatformDescription(); diff --git a/Source/WebCore/platform/Cursor.h b/Source/WebCore/platform/Cursor.h index d52f67cad..770b44d2e 100644 --- a/Source/WebCore/platform/Cursor.h +++ b/Source/WebCore/platform/Cursor.h @@ -163,13 +163,13 @@ namespace WebCore { Cursor& operator=(const Cursor&); #if USE(LAZY_NATIVE_CURSOR) - Cursor(Type); + explicit Cursor(Type); Type type() const { return m_type; } Image* image() const { return m_image.get(); } const IntPoint& hotSpot() const { return m_hotSpot; } PlatformCursor platformCursor() const; #else - Cursor(PlatformCursor); + explicit Cursor(PlatformCursor); PlatformCursor impl() const { return m_platformCursor; } #endif diff --git a/Source/WebCore/platform/FractionalLayoutUnit.h b/Source/WebCore/platform/FractionalLayoutUnit.h index 21c526410..b8909167b 100644 --- a/Source/WebCore/platform/FractionalLayoutUnit.h +++ b/Source/WebCore/platform/FractionalLayoutUnit.h @@ -88,10 +88,17 @@ public: static FractionalLayoutUnit fromFloatCeil(float value) { - REPORT_OVERFLOW(isInBounds(value)); - FractionalLayoutUnit v; - v.m_value = ceilf(value * kFixedPointDenominator); - return v; + REPORT_OVERFLOW(isInBounds(value)); + FractionalLayoutUnit v; + v.m_value = ceilf(value * kFixedPointDenominator); + return v; + } + + static FractionalLayoutUnit fromFloatRound(float value) + { + if (value >= 0) + return FractionalLayoutUnit(value + epsilon() / 2.0f); + return FractionalLayoutUnit(value - epsilon() / 2.0f); } #if ENABLE(SUBPIXEL_LAYOUT) diff --git a/Source/WebCore/platform/KURL.h b/Source/WebCore/platform/KURL.h index ee67e16fc..fbf9f8237 100644 --- a/Source/WebCore/platform/KURL.h +++ b/Source/WebCore/platform/KURL.h @@ -69,11 +69,11 @@ public: // It is usually best to avoid repeatedly parsing a string, unless memory saving outweigh the possible slow-downs. KURL(ParsedURLStringTag, const String&); #if USE(GOOGLEURL) - KURL(WTF::HashTableDeletedValueType) : m_url(WTF::HashTableDeletedValue) { } + explicit KURL(WTF::HashTableDeletedValueType) : m_url(WTF::HashTableDeletedValue) { } #elif USE(WTFURL) - KURL(WTF::HashTableDeletedValueType) : m_urlImpl(WTF::HashTableDeletedValue) { } + explicit KURL(WTF::HashTableDeletedValueType) : m_urlImpl(WTF::HashTableDeletedValue) { } #else - KURL(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { } + explicit KURL(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { } #endif #if !USE(WTFURL) bool isHashTableDeletedValue() const { return string().isHashTableDeletedValue(); } diff --git a/Source/WebCore/platform/KURLGooglePrivate.h b/Source/WebCore/platform/KURLGooglePrivate.h index 374d0d726..6953c6fad 100644 --- a/Source/WebCore/platform/KURLGooglePrivate.h +++ b/Source/WebCore/platform/KURLGooglePrivate.h @@ -49,8 +49,8 @@ namespace WebCore { public: KURLGooglePrivate(); KURLGooglePrivate(const url_parse::Parsed&, bool isValid); - KURLGooglePrivate(WTF::HashTableDeletedValueType); - KURLGooglePrivate(const KURLGooglePrivate&); + explicit KURLGooglePrivate(WTF::HashTableDeletedValueType); + explicit KURLGooglePrivate(const KURLGooglePrivate&); KURLGooglePrivate& operator=(const KURLGooglePrivate&); // Initializes the object. This will call through the backend initializer diff --git a/Source/WebCore/platform/Length.cpp b/Source/WebCore/platform/Length.cpp index 110dbcd96..15dbeea80 100644 --- a/Source/WebCore/platform/Length.cpp +++ b/Source/WebCore/platform/Length.cpp @@ -202,7 +202,7 @@ Length::Length(PassRefPtr<CalculationValue> calc) m_intValue = calcHandles().insert(calc); } -Length Length::blendCalculation(const Length& from, double progress) const +Length Length::blendMixedTypes(const Length& from, double progress) const { if (progress <= 0.0) return from; diff --git a/Source/WebCore/platform/Length.h b/Source/WebCore/platform/Length.h index 7171e3494..14cbf066b 100644 --- a/Source/WebCore/platform/Length.h +++ b/Source/WebCore/platform/Length.h @@ -231,10 +231,10 @@ public: { // Blend two lengths to produce a new length that is in between them. Used for animation. if (from.type() == Calculated || type() == Calculated) - return blendCalculation(from, progress); + return blendMixedTypes(from, progress); if (!from.isZero() && !isZero() && from.type() != type()) - return *this; + return blendMixedTypes(from, progress); if (from.isZero() && isZero()) return *this; @@ -292,7 +292,7 @@ private: incrementCalculatedRef(); } - Length blendCalculation(const Length& from, double progress) const; + Length blendMixedTypes(const Length& from, double progress) const; int calculationHandle() const { diff --git a/Source/WebCore/platform/PODRedBlackTree.h b/Source/WebCore/platform/PODRedBlackTree.h index 73835804f..5b5d3e00a 100644 --- a/Source/WebCore/platform/PODRedBlackTree.h +++ b/Source/WebCore/platform/PODRedBlackTree.h @@ -111,7 +111,7 @@ public: // isInitialized will return false in this case. initIfNeeded can be used // to init the structure. This constructor is usefull for creating // lazy initialized tree. - PODRedBlackTree(UninitializedTreeEnum) + explicit PODRedBlackTree(UninitializedTreeEnum) : m_root(0) , m_needsFullOrderingComparisons(false) #ifndef NDEBUG diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h index 1fb84827f..cc0809c67 100644 --- a/Source/WebCore/platform/Pasteboard.h +++ b/Source/WebCore/platform/Pasteboard.h @@ -79,7 +79,7 @@ public: #if PLATFORM(MAC) // This is required to support OS X services. void writeSelectionForTypes(const Vector<String>& pasteboardTypes, bool canSmartCopyOrDelete, Frame*); - Pasteboard(const String& pasteboardName); + explicit Pasteboard(const String& pasteboardName); static String getStringSelection(Frame*); static PassRefPtr<SharedBuffer> getDataSelection(Frame*, const String& pasteboardType); #endif diff --git a/Source/WebCore/platform/PlatformEvent.h b/Source/WebCore/platform/PlatformEvent.h index 5b32f44c2..52c6488b6 100644 --- a/Source/WebCore/platform/PlatformEvent.h +++ b/Source/WebCore/platform/PlatformEvent.h @@ -96,7 +96,7 @@ protected: { } - PlatformEvent(Type type) + explicit PlatformEvent(Type type) : m_type(type) , m_modifiers(0) , m_timestamp(0) diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h index 42577f9e6..06e4f7ec5 100644 --- a/Source/WebCore/platform/PlatformKeyboardEvent.h +++ b/Source/WebCore/platform/PlatformKeyboardEvent.h @@ -178,8 +178,8 @@ namespace WebCore { #endif #if PLATFORM(EFL) - PlatformKeyboardEvent(const Evas_Event_Key_Down*); - PlatformKeyboardEvent(const Evas_Event_Key_Up*); + explicit PlatformKeyboardEvent(const Evas_Event_Key_Down*); + explicit PlatformKeyboardEvent(const Evas_Event_Key_Up*); #endif protected: diff --git a/Source/WebCore/platform/PlatformMouseEvent.h b/Source/WebCore/platform/PlatformMouseEvent.h index 44c9f5d90..12c4eb535 100644 --- a/Source/WebCore/platform/PlatformMouseEvent.h +++ b/Source/WebCore/platform/PlatformMouseEvent.h @@ -103,8 +103,8 @@ namespace WebCore { #if PLATFORM(GTK) - PlatformMouseEvent(GdkEventButton*); - PlatformMouseEvent(GdkEventMotion*); + explicit PlatformMouseEvent(GdkEventButton*); + explicit PlatformMouseEvent(GdkEventMotion*); void setClickCount(int count) { m_clickCount = count; } #endif diff --git a/Source/WebCore/platform/PlatformPasteboard.h b/Source/WebCore/platform/PlatformPasteboard.h index 27ef39122..2fdd77b61 100644 --- a/Source/WebCore/platform/PlatformPasteboard.h +++ b/Source/WebCore/platform/PlatformPasteboard.h @@ -42,7 +42,7 @@ class KURL; class PlatformPasteboard { public: - PlatformPasteboard(const String& pasteboardName); + explicit PlatformPasteboard(const String& pasteboardName); static String uniqueName(); void getTypes(Vector<String>& types); diff --git a/Source/WebCore/platform/PlatformTouchEvent.h b/Source/WebCore/platform/PlatformTouchEvent.h index 019bd2a14..dbfec22da 100644 --- a/Source/WebCore/platform/PlatformTouchEvent.h +++ b/Source/WebCore/platform/PlatformTouchEvent.h @@ -63,7 +63,7 @@ public: #if PLATFORM(EFL) PlatformTouchEvent(const Eina_List*, const IntPoint, PlatformEvent::Type, PlatformEvent::Modifiers); #elif PLATFORM(BLACKBERRY) - PlatformTouchEvent(BlackBerry::Platform::TouchEvent*); + explicit PlatformTouchEvent(BlackBerry::Platform::TouchEvent*); #endif const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; } diff --git a/Source/WebCore/platform/PlatformWheelEvent.h b/Source/WebCore/platform/PlatformWheelEvent.h index 3997255da..8e08884f5 100644 --- a/Source/WebCore/platform/PlatformWheelEvent.h +++ b/Source/WebCore/platform/PlatformWheelEvent.h @@ -152,11 +152,11 @@ namespace WebCore { bool directionInvertedFromDevice() const { return m_directionInvertedFromDevice; } #if PLATFORM(GTK) - PlatformWheelEvent(GdkEventScroll*); + explicit PlatformWheelEvent(GdkEventScroll*); #endif #if PLATFORM(EFL) - PlatformWheelEvent(const Evas_Event_Mouse_Wheel*); + explicit PlatformWheelEvent(const Evas_Event_Mouse_Wheel*); #endif #if PLATFORM(MAC) || PLATFORM(CHROMIUM) @@ -180,7 +180,7 @@ namespace WebCore { #endif #if PLATFORM(HAIKU) - PlatformWheelEvent(BMessage*); + explicit PlatformWheelEvent(BMessage*); #endif protected: diff --git a/Source/WebCore/platform/RunLoop.h b/Source/WebCore/platform/RunLoop.h index 35f33e9e0..ce9845e2a 100644 --- a/Source/WebCore/platform/RunLoop.h +++ b/Source/WebCore/platform/RunLoop.h @@ -67,7 +67,7 @@ public: class TimerBase { friend class RunLoop; public: - TimerBase(RunLoop*); + explicit TimerBase(RunLoop*); virtual ~TimerBase(); void startRepeating(double repeatInterval) { start(repeatInterval, true); } diff --git a/Source/WebCore/platform/ScrollAnimator.h b/Source/WebCore/platform/ScrollAnimator.h index 4e5c42763..0c5f32c05 100644 --- a/Source/WebCore/platform/ScrollAnimator.h +++ b/Source/WebCore/platform/ScrollAnimator.h @@ -95,7 +95,7 @@ public: virtual bool isRubberBandInProgress() const { return false; } protected: - ScrollAnimator(ScrollableArea*); + explicit ScrollAnimator(ScrollableArea*); virtual void notifyPositionChanged(); diff --git a/Source/WebCore/platform/ScrollAnimatorNone.h b/Source/WebCore/platform/ScrollAnimatorNone.h index 3b683f184..ae18c02a0 100644 --- a/Source/WebCore/platform/ScrollAnimatorNone.h +++ b/Source/WebCore/platform/ScrollAnimatorNone.h @@ -53,7 +53,7 @@ struct ScrollAnimatorParameters; class ScrollAnimatorNone : public ScrollAnimator, public PlatformGestureCurveTarget { public: - ScrollAnimatorNone(ScrollableArea*); + explicit ScrollAnimatorNone(ScrollableArea*); virtual ~ScrollAnimatorNone(); virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier); diff --git a/Source/WebCore/platform/Scrollbar.cpp b/Source/WebCore/platform/Scrollbar.cpp index dfd46497a..75a8c2cf0 100644 --- a/Source/WebCore/platform/Scrollbar.cpp +++ b/Source/WebCore/platform/Scrollbar.cpp @@ -114,7 +114,7 @@ Scrollbar::~Scrollbar() ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const { - return m_scrollableArea ? ScrollbarOverlayStyleDefault : m_scrollableArea->scrollbarOverlayStyle(); + return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : ScrollbarOverlayStyleDefault; } void Scrollbar::getTickmarks(Vector<IntRect>& tickmarks) const diff --git a/Source/WebCore/platform/SharedBuffer.h b/Source/WebCore/platform/SharedBuffer.h index 879e4b285..90a2a3578 100644 --- a/Source/WebCore/platform/SharedBuffer.h +++ b/Source/WebCore/platform/SharedBuffer.h @@ -119,7 +119,7 @@ public: private: SharedBuffer(); - SharedBuffer(size_t); + explicit SharedBuffer(size_t); SharedBuffer(const char*, int); SharedBuffer(const unsigned char*, int); @@ -144,7 +144,7 @@ private: unsigned copySomeDataFromDataArray(const char*& someData, unsigned position) const; #endif #if USE(CF) - SharedBuffer(CFDataRef); + explicit SharedBuffer(CFDataRef); RetainPtr<CFDataRef> m_cfData; #endif }; diff --git a/Source/WebCore/platform/ThemeTypes.h b/Source/WebCore/platform/ThemeTypes.h index 1208a9a2e..8ef6b2375 100644 --- a/Source/WebCore/platform/ThemeTypes.h +++ b/Source/WebCore/platform/ThemeTypes.h @@ -48,8 +48,8 @@ typedef unsigned ControlStates; enum ControlPart { NoControlPart, CheckboxPart, RadioPart, PushButtonPart, SquareButtonPart, ButtonPart, ButtonBevelPart, DefaultButtonPart, InnerSpinButtonPart, InputSpeechButtonPart, ListboxPart, ListItemPart, - MediaEnterFullscreenButtonPart, MediaExitFullscreenButtonPart, MediaFullScreenVolumeSliderPart, MediaFullScreenVolumeSliderThumbPart, MediaMuteButtonPart, MediaPlayButtonPart, MediaSeekBackButtonPart, - MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart, MediaToggleClosedCaptionsButtonPart, + MediaEnterFullscreenButtonPart, MediaExitFullscreenButtonPart, MediaFullScreenVolumeSliderPart, MediaFullScreenVolumeSliderThumbPart, MediaMuteButtonPart, MediaPlayButtonPart, + MediaOverlayPlayButtonPart, MediaSeekBackButtonPart, MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart, MediaToggleClosedCaptionsButtonPart, MediaSliderPart, MediaSliderThumbPart, MediaVolumeSliderContainerPart, MediaVolumeSliderPart, MediaVolumeSliderThumbPart, MediaVolumeSliderMuteButtonPart, MediaControlsBackgroundPart, MediaControlsFullscreenBackgroundPart, MediaCurrentTimePart, MediaTimeRemainingPart, MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, MeterPart, ProgressBarPart, ProgressBarValuePart, diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h index a6eeca407..44d552a86 100644 --- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h +++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h @@ -47,7 +47,7 @@ public: virtual bool apply(double time, PlatformGestureCurveTarget*); private: - WheelFlingPlatformGestureCurve(const FloatPoint& velocity); + explicit WheelFlingPlatformGestureCurve(const FloatPoint& velocity); FloatPoint m_velocity; IntPoint m_cumulativeScroll; diff --git a/Source/WebCore/platform/Widget.h b/Source/WebCore/platform/Widget.h index 345b321cf..65f04d993 100644 --- a/Source/WebCore/platform/Widget.h +++ b/Source/WebCore/platform/Widget.h @@ -127,7 +127,7 @@ enum WidgetNotification { WillPaintFlattened, DidPaintFlattened }; // class Widget : public RefCounted<Widget> { public: - Widget(PlatformWidget = 0); + explicit Widget(PlatformWidget = 0); virtual ~Widget(); PlatformWidget platformWidget() const; diff --git a/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp b/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp index 862c783b8..74060a66c 100644 --- a/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp @@ -40,6 +40,7 @@ PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create() return adoptPtr(new AsyncFileSystemBlackBerry()); } +// FIXME: Add FileSystemType parameter. void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { UNUSED_PARAM(basePath); @@ -50,6 +51,16 @@ void AsyncFileSystem::openFileSystem(const String& basePath, const String& stora callbacks->didFail(NOT_SUPPORTED_ERR); } +void AsyncFileSystem::deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + UNUSED_PARAM(basePath); + UNUSED_PARAM(storageIdentifier); + UNUSED_PARAM(type); + + notImplemented(); + callbacks->didFail(NOT_SUPPORTED_ERR); +} + AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry() { notImplemented(); diff --git a/Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp b/Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp index ec9d2e604..9d362dbf1 100644 --- a/Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp @@ -22,7 +22,7 @@ #include "IntSize.h" #include "NotImplemented.h" #include "PlatformString.h" -#include <BlackBerryPlatformClient.h> +#include <LocaleHandler.h> #include <LocalizeResource.h> #include <wtf/Vector.h> @@ -62,7 +62,7 @@ String inputElementAltText() static String platformLanguage() { - String lang = BlackBerry::Platform::Client::get()->getLocale().c_str(); + String lang = BlackBerry::Platform::LocaleHandler::instance()->language().c_str(); // getLocale() returns a POSIX locale which uses '_' to separate language and country. // However, we use '-' instead of '_' in WebCore (e.g. en_us should read en-us) size_t underscorePosition = lang.find('_'); diff --git a/Source/WebCore/platform/chromium/ChromiumDataObject.cpp b/Source/WebCore/platform/chromium/ChromiumDataObject.cpp index 50383b68e..ec7eebe63 100644 --- a/Source/WebCore/platform/chromium/ChromiumDataObject.cpp +++ b/Source/WebCore/platform/chromium/ChromiumDataObject.cpp @@ -209,7 +209,7 @@ Vector<String> ChromiumDataObject::filenames() const void ChromiumDataObject::addFilename(const String& filename, const String& displayName) { - internalAddFileItem(ChromiumDataObjectItem::createFromFile(File::createWithName(filename, displayName))); + internalAddFileItem(ChromiumDataObjectItem::createFromFile(File::createWithName(filename, displayName, File::AllContentTypes))); } void ChromiumDataObject::addSharedBuffer(const String& name, PassRefPtr<SharedBuffer> buffer) diff --git a/Source/WebCore/platform/chromium/ClipboardChromium.cpp b/Source/WebCore/platform/chromium/ClipboardChromium.cpp index 598436df5..b065237b9 100644 --- a/Source/WebCore/platform/chromium/ClipboardChromium.cpp +++ b/Source/WebCore/platform/chromium/ClipboardChromium.cpp @@ -263,27 +263,6 @@ String ClipboardChromium::getData(const String& type) const if (!convertToURL) return data; return convertURIListToURL(data); - - Vector<String> uriList; - // Line separator is \r\n per RFC 2483 - howver, for compatiblity - // reasons we also allow just \n here. - data.split('\n', uriList); - // Process the input and return the first valid RUL. In case no URLs can - // be found, return an empty string. This is in line with the HTML5 - // spec (see "The DragEvent and DataTransfer interfaces"). - for (size_t i = 0; i < uriList.size(); ++i) { - String& line = uriList[i]; - line = line.stripWhiteSpace(); - if (line.isEmpty()) - continue; - if (line[0] == '#') - continue; - KURL url = KURL(ParsedURLString, line); - if (url.isValid()) - return url; - } - - return String(); } bool ClipboardChromium::setData(const String& type, const String& data) diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp index 35ce97833..1b9e571b1 100644 --- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp +++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp @@ -61,6 +61,12 @@ int ScrollbarThemeChromiumAndroid::scrollbarThickness(ScrollbarControlSize contr return scrollbarWidth + scrollbarMargin; } +bool ScrollbarThemeChromiumAndroid::usesOverlayScrollbars() const +{ + // In layout test mode, match Chromium-Linux. + return !isRunningLayoutTest(); +} + int ScrollbarThemeChromiumAndroid::thumbPosition(ScrollbarThemeClient* scrollbar) { if (!scrollbar->totalSize()) @@ -84,6 +90,12 @@ int ScrollbarThemeChromiumAndroid::thumbLength(ScrollbarThemeClient* scrollbar) return length; } +bool ScrollbarThemeChromiumAndroid::hasThumb(ScrollbarThemeClient* scrollbar) +{ + // In layout test mode, match Chromium-Linux. + return !isRunningLayoutTest(); +} + IntRect ScrollbarThemeChromiumAndroid::backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool) { return IntRect(); diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h index 3b40ab9fb..eab501029 100644 --- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h +++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h @@ -33,13 +33,13 @@ namespace WebCore { class ScrollbarThemeChromiumAndroid : public ScrollbarThemeComposite { public: virtual int scrollbarThickness(ScrollbarControlSize); - virtual bool usesOverlayScrollbars() const { return true; } + virtual bool usesOverlayScrollbars() const; virtual int thumbPosition(ScrollbarThemeClient*); virtual int thumbLength(ScrollbarThemeClient*); virtual bool hasButtons(ScrollbarThemeClient*) { return false; }; - virtual bool hasThumb(ScrollbarThemeClient*) { return true; }; + virtual bool hasThumb(ScrollbarThemeClient*); virtual IntRect backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false); virtual IntRect forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false); diff --git a/Source/WebCore/platform/chromium/support/WebMediaStreamDescriptor.cpp b/Source/WebCore/platform/chromium/support/WebMediaStreamDescriptor.cpp index 8e7a3a7e2..36cce7439 100644 --- a/Source/WebCore/platform/chromium/support/WebMediaStreamDescriptor.cpp +++ b/Source/WebCore/platform/chromium/support/WebMediaStreamDescriptor.cpp @@ -91,20 +91,6 @@ void WebMediaStreamDescriptor::setExtraData(ExtraData* extraData) m_private->setExtraData(adoptRef(new ExtraDataContainer(extraData))); } -// FIXME: Cleanup when the chromium code has switched to the split sources implementation. -void WebMediaStreamDescriptor::sources(WebVector<WebMediaStreamSource>& webSources) const -{ - size_t numberOfAudioSources = m_private->numberOfAudioComponents(); - size_t numberOfVideoSources = m_private->numberOfVideoComponents(); - WebVector<WebMediaStreamSource> result(numberOfAudioSources + numberOfVideoSources); - size_t i = 0; - for (size_t j = 0; j < numberOfAudioSources; ++i, ++j) - result[i] = m_private->audioComponent(j)->source(); - for (size_t j = 0; j < numberOfVideoSources; ++i, ++j) - result[i] = m_private->videoComponent(j)->source(); - webSources.swap(result); -} - void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamComponent>& webSources) const { size_t numberOfSources = m_private->numberOfAudioComponents(); diff --git a/Source/WebCore/platform/chromium/support/WebMediaStreamSource.cpp b/Source/WebCore/platform/chromium/support/WebMediaStreamSource.cpp index 3f877f54c..70ef70809 100644 --- a/Source/WebCore/platform/chromium/support/WebMediaStreamSource.cpp +++ b/Source/WebCore/platform/chromium/support/WebMediaStreamSource.cpp @@ -96,6 +96,18 @@ WebString WebMediaStreamSource::name() const return m_private.get()->name(); } +void WebMediaStreamSource::setReadyState(ReadyState state) +{ + ASSERT(!m_private.isNull()); + m_private->setReadyState(static_cast<MediaStreamSource::ReadyState>(state)); +} + +WebMediaStreamSource::ReadyState WebMediaStreamSource::readyState() const +{ + ASSERT(!m_private.isNull()); + return static_cast<ReadyState>(m_private->readyState()); +} + } // namespace WebKit #endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/platform/efl/NetworkInfoProviderEfl.cpp b/Source/WebCore/platform/efl/NetworkInfoProviderEfl.cpp new file mode 100644 index 000000000..e51e967da --- /dev/null +++ b/Source/WebCore/platform/efl/NetworkInfoProviderEfl.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 "NetworkInfoProviderEfl.h" + +#if ENABLE(NETWORK_INFO) + +#include <Eeze.h> +#include <Eeze_Net.h> +#include <limits> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +static const char ethernetInterface[] = "eth0"; + +NetworkInfoProviderEfl::NetworkInfoProviderEfl() +{ +} + +void NetworkInfoProviderEfl::startUpdating() +{ + if (!eeze_init()) + fprintf(stderr, "Fail to start network information client.\n"); +} + +void NetworkInfoProviderEfl::stopUpdating() +{ + eeze_shutdown(); +} + +double NetworkInfoProviderEfl::bandwidth() const +{ + // FIXME : This function should consider cellular network as well. For example, 2G, 3G and 4G. + // See https://bugs.webkit.org/show_bug.cgi?id=89851 for detail. + Eeze_Net* ethNet = eeze_net_new(ethernetInterface); + // FIXME: Ethernet is only supported now. If ethNet is null, network is offline. + if (!ethNet) + return 0; // If network is offline, return 0. + + eeze_net_scan(ethNet); + + // FIXME : The eeze library doesn't support EEZE_NET_ADDR_TYPE_IP type yet. So, EEZE_NET_ADDR_TYPE_BROADCAST + // is used for now. + // See https://bugs.webkit.org/show_bug.cgi?id=89852 for detail. + const char* address = eeze_net_addr_get(ethNet, EEZE_NET_ADDR_TYPE_BROADCAST); + if (!address) + return 0; // If network is offline, return 0. + + double bandwidth; + const char* attribute = eeze_net_attribute_get(ethNet, "speed"); + if (attribute) { + bool ok; + bandwidth = String::fromUTF8(attribute).toUIntStrict(&ok); + } else + bandwidth = std::numeric_limits<double>::infinity(); // If bandwidth is unknown, return infinity value. + + eeze_net_free(ethNet); + + return bandwidth / 8; // MB/s +} + +} // namespace WebCore + +#endif // ENABLE(NETWORK_INFO) diff --git a/Source/WebCore/platform/efl/NetworkInfoProviderEfl.h b/Source/WebCore/platform/efl/NetworkInfoProviderEfl.h new file mode 100644 index 000000000..ec3f8c649 --- /dev/null +++ b/Source/WebCore/platform/efl/NetworkInfoProviderEfl.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NetworkInfoProviderEfl_h +#define NetworkInfoProviderEfl_h + +#if ENABLE(NETWORK_INFO) + +namespace WebCore { + +class NetworkInfoProviderEfl { +public: + NetworkInfoProviderEfl(); + + void startUpdating(); + void stopUpdating(); + + double bandwidth() const; +}; + +} // namespace WebCore + +#endif // ENABLE(NETWORK_INFO) + +#endif // NetworkInfoProviderEfl_h diff --git a/Source/WebCore/platform/efl/TemporaryLinkStubs.cpp b/Source/WebCore/platform/efl/TemporaryLinkStubs.cpp index be38565f2..e90597ba0 100644 --- a/Source/WebCore/platform/efl/TemporaryLinkStubs.cpp +++ b/Source/WebCore/platform/efl/TemporaryLinkStubs.cpp @@ -56,20 +56,5 @@ String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &ch return String(); } -void setCookieStoragePrivateBrowsingEnabled(bool) -{ - notImplemented(); -} - -void startObservingCookieChanges() -{ - notImplemented(); -} - -void stopObservingCookieChanges() -{ - notImplemented(); -} - } diff --git a/Source/WebCore/platform/graphics/FloatQuad.cpp b/Source/WebCore/platform/graphics/FloatQuad.cpp index 1ad787ba2..fc9d613ec 100644 --- a/Source/WebCore/platform/graphics/FloatQuad.cpp +++ b/Source/WebCore/platform/graphics/FloatQuad.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -51,6 +52,11 @@ inline float dot(const FloatSize& a, const FloatSize& b) return a.width() * b.width() + a.height() * b.height(); } +inline float determinant(const FloatSize& a, const FloatSize& b) +{ + return a.width() * b.height() - a.height() * b.width(); +} + inline bool isPointInTriangle(const FloatPoint& p, const FloatPoint& t1, const FloatPoint& t2, const FloatPoint& t3) { // Compute vectors @@ -107,11 +113,74 @@ bool FloatQuad::containsQuad(const FloatQuad& other) const return containsPoint(other.p1()) && containsPoint(other.p2()) && containsPoint(other.p3()) && containsPoint(other.p4()); } +static inline FloatPoint rightMostCornerToVector(const FloatRect& rect, const FloatSize& vector) +{ + // Return the corner of the rectangle that if it is to the left of the vector + // would mean all of the rectangle is to the left of the vector. + // The vector here represents the side between two points in a clockwise convex polygon. + // + // Q XXX + // QQQ XXX If the lower left corner of X is left of the vector that goes from the top corner of Q to + // QQQ the right corner of Q, then all of X is left of the vector, and intersection impossible. + // Q + // + FloatPoint point; + if (vector.width() >= 0) + point.setY(rect.maxY()); + else + point.setY(rect.y()); + if (vector.height() >= 0) + point.setX(rect.x()); + else + point.setX(rect.maxX()); + return point; +} + +bool FloatQuad::intersectsRect(const FloatRect& rect) const +{ + // For each side of the quad clockwise we check if the rectangle is to the left of it + // since only content on the right can onlap with the quad. + // This only works if the quad is convex. + FloatSize v1, v2, v3, v4; + + // Ensure we use clockwise vectors. + if (!isCounterclockwise()) { + v1 = m_p2 - m_p1; + v2 = m_p3 - m_p2; + v3 = m_p4 - m_p3; + v4 = m_p1 - m_p4; + } else { + v1 = m_p4 - m_p1; + v2 = m_p1 - m_p2; + v3 = m_p2 - m_p3; + v4 = m_p3 - m_p4; + } + + FloatPoint p = rightMostCornerToVector(rect, v1); + if (determinant(v1, p - m_p1) < 0) + return false; + + p = rightMostCornerToVector(rect, v2); + if (determinant(v2, p - m_p2) < 0) + return false; + + p = rightMostCornerToVector(rect, v3); + if (determinant(v3, p - m_p3) < 0) + return false; + + p = rightMostCornerToVector(rect, v4); + if (determinant(v4, p - m_p4) < 0) + return false; + + // If not all of the rectangle is outside one of the quad's four sides, then that means at least + // a part of the rectangle is overlapping the quad. + return true; +} + bool FloatQuad::isCounterclockwise() const { - FloatPoint v1 = FloatPoint(m_p2.x() - m_p1.x(), m_p2.y() - m_p1.y()); - FloatPoint v2 = FloatPoint(m_p3.x() - m_p2.x(), m_p3.y() - m_p2.y()); - return (v1.x() * v2.y() - v1.y() * v2.x()) < 0; + // Return if the two first vectors are turning clockwise. If the quad is convex then all following vectors will turn the same way. + return determinant(m_p2 - m_p1, m_p3 - m_p2) < 0; } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/FloatQuad.h b/Source/WebCore/platform/graphics/FloatQuad.h index bfb794def..44d2e9dd9 100644 --- a/Source/WebCore/platform/graphics/FloatQuad.h +++ b/Source/WebCore/platform/graphics/FloatQuad.h @@ -88,6 +88,10 @@ public: // from transformed rects. bool containsQuad(const FloatQuad&) const; + // Tests whether any part of the rectangle intersects with this quad. + // This only works for convex quads. + bool intersectsRect(const FloatRect&) const; + // The center of the quad. If the quad is the result of a affine-transformed rectangle this is the same as the original center transformed. FloatPoint center() const { diff --git a/Source/WebCore/platform/graphics/FontPlatformData.cpp b/Source/WebCore/platform/graphics/FontPlatformData.cpp index a1d274aa8..22cf99ff0 100644 --- a/Source/WebCore/platform/graphics/FontPlatformData.cpp +++ b/Source/WebCore/platform/graphics/FontPlatformData.cpp @@ -27,10 +27,112 @@ #include <wtf/Vector.h> #include <wtf/text/StringHash.h> +#if PLATFORM(CHROMIUM) && OS(DARWIN) +#include "HarfBuzzNGFace.h" +#endif + using namespace std; namespace WebCore { +FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) + : m_syntheticBold(false) + , m_syntheticOblique(false) + , m_orientation(Horizontal) + , m_textOrientation(TextOrientationVerticalRight) + , m_size(0) + , m_widthVariant(RegularWidth) +#if PLATFORM(WIN) + , m_font(WTF::HashTableDeletedValue) +#elif OS(DARWIN) + , m_font(hashTableDeletedFontValue()) +#endif +#if USE(CG) && PLATFORM(WIN) + , m_cgFont(0) +#elif USE(CAIRO) + , m_scaledFont(hashTableDeletedFontValue()) +#endif + , m_isColorBitmapFont(false) + , m_isCompositeFontReference(false) +#if OS(DARWIN) + , m_isPrinterFont(false) +#endif +#if PLATFORM(WIN) + , m_useGDI(false) +#endif +{ +} + +FontPlatformData::FontPlatformData() + : m_syntheticBold(false) + , m_syntheticOblique(false) + , m_orientation(Horizontal) + , m_textOrientation(TextOrientationVerticalRight) + , m_size(0) + , m_widthVariant(RegularWidth) +#if OS(DARWIN) + , m_font(0) +#endif +#if USE(CG) && PLATFORM(WIN) + , m_cgFont(0) +#elif USE(CAIRO) + , m_scaledFont(0) +#endif + , m_isColorBitmapFont(false) + , m_isCompositeFontReference(false) +#if OS(DARWIN) + , m_isPrinterFont(false) +#endif +#if PLATFORM(WIN) + , m_useGDI(false) +#endif +{ +} + +FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, TextOrientation textOrientation, FontWidthVariant widthVariant) + : m_syntheticBold(syntheticBold) + , m_syntheticOblique(syntheticOblique) + , m_orientation(orientation) + , m_textOrientation(textOrientation) + , m_size(size) + , m_widthVariant(widthVariant) +#if OS(DARWIN) + , m_font(0) +#endif +#if USE(CG) && PLATFORM(WIN) + , m_cgFont(0) +#elif USE(CAIRO) + , m_scaledFont(0) +#endif + , m_isColorBitmapFont(false) + , m_isCompositeFontReference(false) +#if OS(DARWIN) + , m_isPrinterFont(false) +#endif +#if PLATFORM(WIN) + , m_useGDI(false) +#endif +{ +} + +#if OS(DARWIN) && (USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)) +FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, + TextOrientation textOrientation, FontWidthVariant widthVariant) + : m_syntheticBold(syntheticBold) + , m_syntheticOblique(syntheticOblique) + , m_orientation(orientation) + , m_textOrientation(textOrientation) + , m_size(size) + , m_widthVariant(widthVariant) + , m_font(0) + , m_cgFont(cgFont) + , m_isColorBitmapFont(false) + , m_isCompositeFontReference(false) + , m_isPrinterFont(false) +{ +} +#endif + FontPlatformData::FontPlatformData(const FontPlatformData& source) : m_syntheticBold(source.m_syntheticBold) , m_syntheticOblique(source.m_syntheticOblique) diff --git a/Source/WebCore/platform/graphics/FontPlatformData.h b/Source/WebCore/platform/graphics/FontPlatformData.h index 8b0dbed9b..984f58c14 100644 --- a/Source/WebCore/platform/graphics/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/FontPlatformData.h @@ -72,7 +72,6 @@ typedef const struct __CTFont* CTFontRef; #if PLATFORM(CHROMIUM) && OS(DARWIN) #include "CrossProcessFontLoading.h" -#include "HarfBuzzNGFace.h" #endif #if PLATFORM(WIN) @@ -94,114 +93,29 @@ namespace WebCore { class FontDescription; class SharedBuffer; +#if PLATFORM(CHROMIUM) && OS(DARWIN) +class HarfBuzzNGFace; +#endif + #if OS(DARWIN) inline CTFontRef toCTFontRef(NSFont *nsFont) { return reinterpret_cast<CTFontRef>(nsFont); } #endif class FontPlatformData { public: - FontPlatformData(WTF::HashTableDeletedValueType) - : m_syntheticBold(false) - , m_syntheticOblique(false) - , m_orientation(Horizontal) - , m_textOrientation(TextOrientationVerticalRight) - , m_size(0) - , m_widthVariant(RegularWidth) -#if PLATFORM(WIN) - , m_font(WTF::HashTableDeletedValue) -#elif OS(DARWIN) - , m_font(hashTableDeletedFontValue()) -#endif -#if USE(CG) && PLATFORM(WIN) - , m_cgFont(0) -#elif USE(CAIRO) - , m_scaledFont(hashTableDeletedFontValue()) -#endif - , m_isColorBitmapFont(false) - , m_isCompositeFontReference(false) -#if OS(DARWIN) - , m_isPrinterFont(false) -#endif -#if PLATFORM(WIN) - , m_useGDI(false) -#endif - { - } - - FontPlatformData() - : m_syntheticBold(false) - , m_syntheticOblique(false) - , m_orientation(Horizontal) - , m_textOrientation(TextOrientationVerticalRight) - , m_size(0) - , m_widthVariant(RegularWidth) -#if OS(DARWIN) - , m_font(0) -#endif -#if USE(CG) && PLATFORM(WIN) - , m_cgFont(0) -#elif USE(CAIRO) - , m_scaledFont(0) -#endif - , m_isColorBitmapFont(false) - , m_isCompositeFontReference(false) -#if OS(DARWIN) - , m_isPrinterFont(false) -#endif -#if PLATFORM(WIN) - , m_useGDI(false) -#endif - { - } - + FontPlatformData(WTF::HashTableDeletedValueType); + FontPlatformData(); FontPlatformData(const FontPlatformData&); FontPlatformData(const FontDescription&, const AtomicString& family); - FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation = Horizontal, - TextOrientation textOrientation = TextOrientationVerticalRight, FontWidthVariant widthVariant = RegularWidth) - : m_syntheticBold(syntheticBold) - , m_syntheticOblique(syntheticOblique) - , m_orientation(orientation) - , m_textOrientation(textOrientation) - , m_size(size) - , m_widthVariant(widthVariant) -#if OS(DARWIN) - , m_font(0) -#endif -#if USE(CG) && PLATFORM(WIN) - , m_cgFont(0) -#elif USE(CAIRO) - , m_scaledFont(0) -#endif - , m_isColorBitmapFont(false) - , m_isCompositeFontReference(false) -#if OS(DARWIN) - , m_isPrinterFont(false) -#endif -#if PLATFORM(WIN) - , m_useGDI(false) -#endif - { - } + FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, FontOrientation = Horizontal, + TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth); #if OS(DARWIN) FontPlatformData(NSFont*, float size, bool isPrinterFont = false, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth); #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM) - FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, - TextOrientation textOrientation, FontWidthVariant widthVariant) - : m_syntheticBold(syntheticBold) - , m_syntheticOblique(syntheticOblique) - , m_orientation(orientation) - , m_textOrientation(textOrientation) - , m_size(size) - , m_widthVariant(widthVariant) - , m_font(0) - , m_cgFont(cgFont) - , m_isColorBitmapFont(false) - , m_isCompositeFontReference(false) - , m_isPrinterFont(false) - { - } + FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, + TextOrientation, FontWidthVariant); #endif #endif #if PLATFORM(WIN) diff --git a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp index e64d16a9c..c98603a41 100644 --- a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp +++ b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp @@ -53,7 +53,7 @@ void GeneratorGeneratedImage::drawPattern(GraphicsContext* destContext, const Fl m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect); // Factor in the destination context's scale to generate at the best resolution - AffineTransform destContextCTM = destContext->getCTM(); + AffineTransform destContextCTM = destContext->getCTM(GraphicsContext::DefinitelyIncludeDeviceScale); double xScale = fabs(destContextCTM.xScale()); double yScale = fabs(destContextCTM.yScale()); AffineTransform adjustedPatternCTM = patternTransform; diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp index 6664b8644..caef7ad2e 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp @@ -769,7 +769,7 @@ PassOwnPtr<ImageBuffer> GraphicsContext::createCompatibleBuffer(const IntSize& s // resolution than one pixel per unit. Also set up a corresponding scale factor on the // graphics context. - AffineTransform transform = getCTM(); + AffineTransform transform = getCTM(DefinitelyIncludeDeviceScale); IntSize scaledSize(static_cast<int>(ceil(size.width() * transform.xScale())), static_cast<int>(ceil(size.height() * transform.yScale()))); OwnPtr<ImageBuffer> buffer = ImageBuffer::create(scaledSize, 1, ColorSpaceDeviceRGB, isAcceleratedContext() ? Accelerated : Unaccelerated); diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h index a2e083924..a2f4d6867 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -413,7 +413,9 @@ namespace WebCore { void concatCTM(const AffineTransform&); void setCTM(const AffineTransform&); - AffineTransform getCTM() const; + + enum IncludeDeviceScale { DefinitelyIncludeDeviceScale, PossiblyIncludeDeviceScale }; + AffineTransform getCTM(IncludeDeviceScale includeScale = PossiblyIncludeDeviceScale) const; #if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER) // This is needed when using accelerated-compositing in software mode, like in TextureMapper. @@ -431,7 +433,11 @@ namespace WebCore { void applyDeviceScaleFactor(float); void platformApplyDeviceScaleFactor(float); -#if OS(WINCE) && !PLATFORM(QT) +#if OS(WINDOWS) + HDC getWindowsContext(const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap); // The passed in rect is used to create a bitmap for compositing inside transparency layers. + void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap); // The passed in HDC should be the one handed back by getWindowsContext. +#if PLATFORM(WIN) +#if OS(WINCE) void setBitmap(PassRefPtr<SharedBitmap>); const AffineTransform& affineTransform() const; AffineTransform& affineTransform(); @@ -444,13 +450,9 @@ namespace WebCore { void drawBitmap(SharedBitmap*, const IntRect& dstRect, const IntRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp); void drawBitmapPattern(SharedBitmap*, const FloatRect& tileRectIn, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, const IntSize& origSourceSize); void drawIcon(HICON icon, const IntRect& dstRect, UINT flags); - HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers. - void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext. void drawRoundCorner(bool newClip, RECT clipRect, RECT rectWin, HDC dc, int width, int height); -#elif PLATFORM(WIN) +#else GraphicsContext(HDC, bool hasAlpha = false); // FIXME: To be removed. - HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers. - void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext. // When set to true, child windows should be rendered into this context // rather than allowing them just to render to the screen. Defaults to @@ -487,12 +489,10 @@ namespace WebCore { // The bitmap should be non-premultiplied. void drawWindowsBitmap(WindowsBitmap*, const IntPoint&); #endif - -#if (PLATFORM(GTK) && OS(WINDOWS)) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS)) - HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); - void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); +#else // PLATFORM(WIN) bool shouldIncludeChildWindows() const { return false; } -#endif +#endif // PLATFORM(WIN) +#endif // OS(WINDOWS) #if PLATFORM(WX) // This is needed because of a bug whereby getting an HDC from a GDI+ context diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index 7433df626..fe1223d78 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -805,6 +805,9 @@ public: #elif PLATFORM(QT) void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, QPainter* context); +#elif PLATFORM(BLACKBERRY) + void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, + int canvasWidth, int canvasHeight, GraphicsContext*); #endif void markContextChanged(); diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.cpp b/Source/WebCore/platform/graphics/GraphicsLayer.cpp index dda637311..4c359d245 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayer.cpp @@ -384,7 +384,7 @@ void GraphicsLayer::distributeOpacity(float accumulatedOpacity) } } -#if PLATFORM(QT) || PLATFORM(GTK) +#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) GraphicsLayer::GraphicsLayerFactory* GraphicsLayer::s_graphicsLayerFactory = 0; void GraphicsLayer::setGraphicsLayerFactory(GraphicsLayer::GraphicsLayerFactory factory) diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h index ccd61fb9e..1556ce845 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayer.h +++ b/Source/WebCore/platform/graphics/GraphicsLayer.h @@ -394,7 +394,7 @@ public: virtual TiledBacking* tiledBacking() { return 0; } -#if PLATFORM(QT) || PLATFORM(GTK) +#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) // This allows several alternative GraphicsLayer implementations in the same port, // e.g. if a different GraphicsLayer implementation is needed in WebKit1 vs. WebKit2. typedef PassOwnPtr<GraphicsLayer> GraphicsLayerFactory(GraphicsLayerClient*); @@ -485,7 +485,7 @@ protected: int m_repaintCount; -#if PLATFORM(QT) || PLATFORM(GTK) +#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) static GraphicsLayer::GraphicsLayerFactory* s_graphicsLayerFactory; #endif }; diff --git a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp index 2fe641476..fc74d4551 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp @@ -18,6 +18,8 @@ */ #include "config.h" + +#if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayerAnimation.h" #include "UnitBezier.h" @@ -295,3 +297,5 @@ void GraphicsLayerAnimations::apply(GraphicsLayerAnimation::Client* client) } } +#endif + diff --git a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h index 2fbc05a12..e49832ef3 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h +++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h @@ -20,6 +20,8 @@ #ifndef GraphicsLayerAnimation_h #define GraphicsLayerAnimation_h +#if USE(ACCELERATED_COMPOSITING) + #include "GraphicsLayer.h" #include "TransformationMatrix.h" #include <wtf/HashMap.h> @@ -78,4 +80,6 @@ private: }; } +#endif + #endif // GraphicsLayerAnimation_h diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp index ec622437e..28c784c03 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.cpp +++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp @@ -1068,6 +1068,14 @@ String MediaPlayer::userAgent() const return m_mediaPlayerClient->mediaPlayerUserAgent(); } +String MediaPlayer::engineDescription() const +{ + if (!m_private) + return String(); + + return m_private->engineDescription(); +} + #if PLATFORM(WIN) && USE(AVFOUNDATION) GraphicsDeviceAdapter* MediaPlayer::graphicsDeviceAdapter() const { diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h index 3b382d83a..c86827b8a 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.h +++ b/Source/WebCore/platform/graphics/MediaPlayer.h @@ -402,6 +402,8 @@ public: String referrer() const; String userAgent() const; + String engineDescription() const; + private: MediaPlayer(MediaPlayerClient*); void loadWithNextMediaEngine(MediaPlayerFactory*); diff --git a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h index f8d40bedd..58f1606d6 100644 --- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h +++ b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h @@ -161,6 +161,7 @@ public: virtual void setPrivateBrowsingMode(bool) { } + virtual String engineDescription() const { return emptyString(); } #if ENABLE(WEB_AUDIO) virtual AudioSourceProvider* audioSourceProvider() { return 0; } diff --git a/Source/WebCore/platform/graphics/PlatformLayer.h b/Source/WebCore/platform/graphics/PlatformLayer.h index 6dc0fe5c3..015406e11 100644 --- a/Source/WebCore/platform/graphics/PlatformLayer.h +++ b/Source/WebCore/platform/graphics/PlatformLayer.h @@ -55,6 +55,13 @@ namespace WebCore { typedef ClutterActor PlatformLayer; }; #endif +#elif PLATFORM(EFL) +#if USE(TEXTURE_MAPPER) +namespace WebCore { +class TextureMapperPlatformLayer; +typedef TextureMapperPlatformLayer PlatformLayer; +}; +#endif #else typedef void* PlatformLayer; #endif diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h index 03694b7f0..b7c3b39af 100644 --- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h +++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h @@ -243,6 +243,8 @@ protected: MediaPlayer* player() { return m_player; } + virtual String engineDescription() const { return "AVFoundation"; } + private: MediaPlayer* m_player; diff --git a/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp index dd4e3f4c8..3698fd25f 100644 --- a/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp +++ b/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp @@ -54,6 +54,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi : m_currentWidth(0) , m_currentHeight(0) , m_context(BlackBerry::Platform::Graphics::createWebGLContext()) + , m_compiler(SH_ESSL_OUTPUT) , m_extensions(adoptPtr(new Extensions3DOpenGLES(this))) , m_attrs(attrs) , m_texture(0) @@ -173,7 +174,11 @@ bool GraphicsContext3D::reshapeFBOs(const IntSize& size) sampleCount = std::min(8, maxSampleCount); } - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); + bool mustRestoreFBO = false; + if (m_boundFBO != m_fbo) { + mustRestoreFBO = true; + ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo); + } ::glBindTexture(GL_TEXTURE_2D, m_texture); ::glTexImage2D(GL_TEXTURE_2D, 0, internalColorFormat, fboWidth, fboHeight, 0, colorFormat, GL_UNSIGNED_BYTE, 0); @@ -211,7 +216,7 @@ bool GraphicsContext3D::reshapeFBOs(const IntSize& size) logFrameBufferStatus(__LINE__); - return true; + return mustRestoreFBO; } void GraphicsContext3D::logFrameBufferStatus(int line) @@ -355,29 +360,16 @@ PlatformLayer* GraphicsContext3D::platformLayer() const #endif void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, - GraphicsContext* context, bool flipY) + GraphicsContext* context) { - // Reorder pixels into BGRA format. unsigned char* tempPixels = new unsigned char[imageWidth * imageHeight * 4]; - if (flipY) { - for (int y = 0; y < imageHeight; y++) { - const unsigned char *srcRow = imagePixels + (imageWidth * 4 * y); - unsigned char *destRow = tempPixels + (imageWidth * 4 * (imageHeight - y - 1)); - for (int i = 0; i < imageWidth * 4; i += 4) { - destRow[i + 0] = srcRow[i + 2]; - destRow[i + 1] = srcRow[i + 1]; - destRow[i + 2] = srcRow[i + 0]; - destRow[i + 3] = srcRow[i + 3]; - } - } - } else { - for (int i = 0; i < imageWidth * imageHeight * 4; i += 4) { - tempPixels[i + 0] = imagePixels[i + 2]; - tempPixels[i + 1] = imagePixels[i + 1]; - tempPixels[i + 2] = imagePixels[i + 0]; - tempPixels[i + 3] = imagePixels[i + 3]; - } + // 3D images have already been converted to BGRA. Don't do it twice!! + for (int y = 0; y < imageHeight; y++) { + const unsigned char *srcRow = imagePixels + (imageWidth * 4 * y); + unsigned char *destRow = tempPixels + (imageWidth * 4 * (imageHeight - y - 1)); + for (int i = 0; i < imageWidth * 4; i += 4) + memcpy(destRow + i, srcRow + i, 4); } SkBitmap canvasBitmap; diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h index 589749c6f..0a062e508 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h @@ -146,6 +146,8 @@ private: void updateStates(); String userAgent(const String&) const; + virtual String engineDescription() const { return "BlackBerry"; } + MediaPlayer* m_webCorePlayer; BlackBerry::Platform::MMRPlayer* m_platformPlayer; diff --git a/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp b/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp new file mode 100644 index 000000000..6ea1a27de --- /dev/null +++ b/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2012 Intel Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Font.h" + +#include "GraphicsContext.h" +#include "HarfBuzzShaper.h" +#include "Logging.h" +#include "NotImplemented.h" +#include "PlatformContextCairo.h" +#include "SimpleFontData.h" +#include <cairo.h> + +namespace WebCore { + +void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const +{ + GlyphBuffer glyphBuffer; + HarfBuzzShaper shaper(this, run); + if (shaper.shape(&glyphBuffer)) + drawGlyphBuffer(context, run, glyphBuffer, point); + else + LOG_ERROR("Shaper couldn't shape glyphBuffer."); +} + +void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const +{ + notImplemented(); +} + +bool Font::canReturnFallbackFontsForComplexText() +{ + return false; +} + +bool Font::canExpandAroundIdeographsInComplexText() +{ + return false; +} + +float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const +{ + HarfBuzzShaper shaper(this, run); + if (shaper.shape()) + return shaper.totalWidth(); + LOG_ERROR("Shaper couldn't shape text run."); + return 0; +} + +int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool) const +{ + HarfBuzzShaper shaper(this, run); + if (shaper.shape()) + return shaper.offsetForPosition(x); + LOG_ERROR("Shaper couldn't shape text run."); + return 0; +} + +FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const +{ + HarfBuzzShaper shaper(this, run); + if (shaper.shape()) + return shaper.selectionRect(point, h, from, to); + LOG_ERROR("Shaper couldn't shape text run."); + return FloatRect(); +} + +} diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index bd1c9bab9..74f0c3a60 100644 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -192,7 +192,7 @@ void GraphicsContext::platformDestroy() delete m_data; } -AffineTransform GraphicsContext::getCTM() const +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const { if (paintingDisabled()) return AffineTransform(); diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index cca3de0af..4d781a94c 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -1411,12 +1411,18 @@ void GraphicsContext::setCTM(const AffineTransform& transform) m_data->m_userToDeviceTransformKnownToBeIdentity = false; } -AffineTransform GraphicsContext::getCTM() const +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale includeScale) const { if (paintingDisabled()) return AffineTransform(); - return AffineTransform(CGContextGetCTM(platformContext())); + // The CTM usually includes the deviceScaleFactor except in WebKit 1 when the + // content is non-composited, since the scale factor is integrated at a lower + // level. To guarantee the deviceScale is included, we can use this CG API. + if (includeScale == DefinitelyIncludeDeviceScale) + return CGContextGetUserSpaceToDeviceSpaceTransform(platformContext()); + + return CGContextGetCTM(platformContext()); } FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode roundingMode) diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp index d244de674..c7f95346d 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp @@ -79,14 +79,14 @@ LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampled LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } -void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) +void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) { if (m_canvasSize != contentRect.size()) { m_canvasSize = contentRect.size(); m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_canvasSize.height(), m_opaque)); } - paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect); + paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats); } void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h index a7f11fa53..a2e6d45cb 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h @@ -60,7 +60,7 @@ public: virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*); virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) OVERRIDE; + virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE; void updateTextureRect(CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); virtual void setOpaque(bool) OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp index 285924253..de01086a8 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp @@ -34,6 +34,8 @@ #include "PlatformColor.h" #include "SkCanvas.h" #include "SkDevice.h" +#include "cc/CCRenderingStats.h" +#include <wtf/CurrentTime.h> namespace WebCore { @@ -43,14 +45,16 @@ BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvas { } -void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRect& sourceRect) +void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRect& sourceRect, CCRenderingStats& stats) { m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height()); m_bitmap.allocPixels(); m_bitmap.setIsOpaque(m_textureUpdater->layerIsOpaque()); SkDevice device(m_bitmap); SkCanvas canvas(&device); - textureUpdater()->paintContentsRect(&canvas, sourceRect); + double paintBeginTime = monotonicallyIncreasingTime(); + textureUpdater()->paintContentsRect(&canvas, sourceRect, stats); + stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginTime; } void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) @@ -87,12 +91,14 @@ LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } -void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect) +void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect, CCRenderingStats& stats) { // Translate the origin of contentRect to that of sourceRect. canvas->translate(contentRect().x() - sourceRect.x(), contentRect().y() - sourceRect.y()); + double rasterizeBeginTime = monotonicallyIncreasingTime(); drawPicture(canvas); + stats.totalRasterizeTimeInSeconds += monotonicallyIncreasingTime() - rasterizeBeginTime; } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h index 855d40585..70bdd5f90 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h @@ -41,7 +41,7 @@ public: public: Texture(BitmapSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<CCPrioritizedTexture>); - virtual void prepareRect(const IntRect& sourceRect) OVERRIDE; + virtual void prepareRect(const IntRect& sourceRect, CCRenderingStats&) OVERRIDE; virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; private: @@ -56,7 +56,7 @@ public: virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; - void paintContentsRect(SkCanvas*, const IntRect& sourceRect); + void paintContentsRect(SkCanvas*, const IntRect& sourceRect, CCRenderingStats&); private: explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp index 782780a40..3f9ee36aa 100644 --- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp @@ -37,6 +37,8 @@ #include "SkRect.h" #include "SkiaUtils.h" #include "TraceEvent.h" +#include "cc/CCRenderingStats.h" +#include <wtf/CurrentTime.h> namespace WebCore { @@ -49,7 +51,7 @@ CanvasLayerTextureUpdater::~CanvasLayerTextureUpdater() { } -void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) +void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) { TRACE_EVENT0("cc", "CanvasLayerTextureUpdater::paintContents"); canvas->save(); @@ -72,7 +74,9 @@ void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& c canvas->clipRect(layerRect); FloatRect opaqueLayerRect; + double paintBeginTime = monotonicallyIncreasingTime(); m_painter->paint(canvas, layerRect, opaqueLayerRect); + stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginTime; canvas->restore(); FloatRect opaqueContentRect = opaqueLayerRect; diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h index b441e4e74..c5a4fc267 100644 --- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h @@ -47,7 +47,7 @@ public: protected: explicit CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); - void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect); + void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&); const IntRect& contentRect() const { return m_contentRect; } private: diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 719f9d899..03d343e80 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -93,7 +93,7 @@ void ContentLayerChromium::setTexturePriorities(const CCPriorityCalculator& prio TiledLayerChromium::setTexturePriorities(priorityCalc); } -void ContentLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) +void ContentLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) { createTextureUpdaterIfNeeded(); @@ -104,7 +104,7 @@ void ContentLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTr if (drawsContent()) contentRect = visibleContentRect(); - updateContentRect(updater, contentRect, occlusion); + updateContentRect(updater, contentRect, occlusion, stats); m_needsDisplay = false; } diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h index d8ea48565..f83993892 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h @@ -77,7 +77,7 @@ public: virtual bool drawsContent() const OVERRIDE; virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; - virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE; + virtual void update(CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; virtual bool needMoreUpdates() OVERRIDE; virtual void setOpaque(bool) OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp new file mode 100644 index 000000000..9ee47d800 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp @@ -0,0 +1,73 @@ +/* + * 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 "HeadsUpDisplayLayerChromium.h" + +#include "TraceEvent.h" +#include "cc/CCHeadsUpDisplayLayerImpl.h" +#include "cc/CCLayerTreeHost.h" + +namespace WebCore { + +PassRefPtr<HeadsUpDisplayLayerChromium> HeadsUpDisplayLayerChromium::create(const CCLayerTreeSettings& settings, int maxTextureSize) +{ + return adoptRef(new HeadsUpDisplayLayerChromium(settings, maxTextureSize)); +} + +HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium(const CCLayerTreeSettings& settings, int maxTextureSize) + : LayerChromium() +{ + OwnPtr<CCFontAtlas> fontAtlas; + + IntSize bounds; + if (settings.showPlatformLayerTree || settings.showDebugRects()) { + bounds.setWidth(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().width())); + bounds.setHeight(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().height())); + } else { + bounds.setWidth(512); + bounds.setHeight(128); + } + setBounds(bounds); + + // Only allocate the font atlas if we have reason to use the heads-up display. + if (settings.showFPSCounter || settings.showPlatformLayerTree) { + TRACE_EVENT0("cc", "HeadsUpDisplayLayerChromium::initializeFontAtlas"); + m_fontAtlas = CCFontAtlas::create(); + m_fontAtlas->initialize(); + } +} + +HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium() +{ +} + +PassOwnPtr<CCLayerImpl> HeadsUpDisplayLayerChromium::createCCLayerImpl() +{ + return CCHeadsUpDisplayLayerImpl::create(m_layerId, m_fontAtlas.release()); +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.h b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.h new file mode 100644 index 000000000..97e310e18 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.h @@ -0,0 +1,54 @@ +/* + * 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 HeadsUpDisplayLayerChromium_h +#define HeadsUpDisplayLayerChromium_h + +#include "LayerChromium.h" +#include "cc/CCFontAtlas.h" + +namespace WebCore { + +struct CCLayerTreeSettings; + +class HeadsUpDisplayLayerChromium : public LayerChromium { +public: + static PassRefPtr<HeadsUpDisplayLayerChromium> create(const CCLayerTreeSettings&, int maxTextureSize); + virtual ~HeadsUpDisplayLayerChromium(); + + virtual bool drawsContent() const OVERRIDE { return true; } + + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + +protected: + HeadsUpDisplayLayerChromium(const CCLayerTreeSettings&, int maxTextureSize); + +private: + OwnPtr<CCFontAtlas> m_fontAtlas; +}; + +} +#endif diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index ba6094379..d47f14b1e 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -141,7 +141,7 @@ void ImageLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori TiledLayerChromium::setTexturePriorities(priorityCalc); } -void ImageLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) +void ImageLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) { createTextureUpdaterIfNeeded(); if (m_needsDisplay) { @@ -151,7 +151,7 @@ void ImageLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTrac m_needsDisplay = false; } - updateContentRect(updater, visibleContentRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion, stats); } void ImageLayerChromium::createTextureUpdaterIfNeeded() diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h index adccce620..0444cd574 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h @@ -49,7 +49,7 @@ public: virtual bool drawsContent() const OVERRIDE; virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; - virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE; + virtual void update(CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; virtual bool needsContentsScale() const OVERRIDE; void setBitmap(const SkBitmap& image); diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp index 24827e946..76c065b52 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -534,7 +534,6 @@ void LayerChromium::pushPropertiesTo(CCLayerImpl* layer) layer->setBackgroundColor(m_backgroundColor); layer->setBounds(m_bounds); layer->setContentBounds(contentBounds()); - layer->setContentsScale(contentsScale()); layer->setDebugBorderColor(m_debugBorderColor); layer->setDebugBorderWidth(m_debugBorderWidth); layer->setDebugName(m_debugName.isolatedCopy()); // We have to use isolatedCopy() here to safely pass ownership to another thread. @@ -615,7 +614,6 @@ void LayerChromium::setDebugName(const String& debugName) setNeedsCommit(); } - void LayerChromium::setContentsScale(float contentsScale) { if (!needsContentsScale() || m_contentsScale == contentsScale) diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h index abd9e36f8..27ce8f10a 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h @@ -56,12 +56,13 @@ namespace WebCore { class CCActiveAnimation; -struct CCAnimationEvent; class CCLayerAnimationDelegate; class CCLayerImpl; class CCLayerTreeHost; class CCTextureUpdater; class ScrollbarLayerChromium; +struct CCAnimationEvent; +struct CCRenderingStats; // Delegate for handling scroll input for a LayerChromium. class LayerChromiumScrollDelegate { @@ -211,7 +212,7 @@ public: // These methods typically need to be overwritten by derived classes. virtual bool drawsContent() const { return m_isDrawable; } - virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) { } + virtual void update(CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&) { } virtual bool needMoreUpdates() { return false; } virtual void setIsMask(bool) { } virtual void bindContentsTexture() { } @@ -246,7 +247,7 @@ public: // root render surface, then this converts to physical pixels). const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_drawTransform = matrix; } - // This moves from layer space, with origin the top left to screen space with origin in the top left. + // This moves from content space, with origin the top left to screen space with origin in the top left. // It converts logical, non-page-scaled pixels to physical pixels. const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index e5637a0fc..c4f138ab7 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -166,13 +166,10 @@ LayerRendererChromium::LayerRendererChromium(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) : CCRenderer(client) - , m_currentRenderPass(0) - , m_currentTexture(0) , m_offscreenFramebufferId(0) , m_sharedGeometryQuad(FloatRect(-0.5f, -0.5f, 1.0f, 1.0f)) , m_resourceProvider(resourceProvider) , m_context(resourceProvider->graphicsContext3D()) - , m_defaultRenderPass(0) , m_isViewportChanged(false) , m_isFramebufferDiscarded(false) , m_isUsingBindUniform(false) @@ -289,31 +286,27 @@ void LayerRendererChromium::releaseRenderPassTextures() void LayerRendererChromium::viewportChanged() { m_isViewportChanged = true; - - // Reset the current RenderPass to force an update of the viewport and - // projection matrix next time useRenderPass is called. - m_currentRenderPass = 0; } -void LayerRendererChromium::clearRenderPass(const CCRenderPass* renderPass, const FloatRect& framebufferDamageRect) +void LayerRendererChromium::clearFramebuffer(DrawingFrame& frame, const FloatRect& framebufferDamageRect) { // On DEBUG builds, opaque render passes are cleared to blue to easily see regions that were not drawn on the screen. If we // are using partial swap / scissor optimization, then the surface should only // clear the damaged region, so that we don't accidentally clear un-changed portions // of the screen. - if (renderPass->hasTransparentBackground()) + if (frame.currentRenderPass->hasTransparentBackground()) GLC(m_context, m_context->clearColor(0, 0, 0, 0)); else GLC(m_context, m_context->clearColor(0, 0, 1, 1)); if (m_capabilities.usingPartialSwap) - setScissorToRect(enclosingIntRect(framebufferDamageRect)); + setScissorToRect(frame, enclosingIntRect(framebufferDamageRect)); else GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); #if defined(NDEBUG) - if (renderPass->hasTransparentBackground()) + if (frame.currentRenderPass->hasTransparentBackground()) #endif m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); @@ -334,14 +327,14 @@ GC3Denum LayerRendererChromium::renderPassTextureFormat(const CCRenderPass*) void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder) { - HashMap<int, const CCRenderPass*> passesInFrame; + HashMap<int, const CCRenderPass*> renderPassesInFrame; for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) - passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]); + renderPassesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]); Vector<int> passesToDelete; HashMap<int, OwnPtr<CachedTexture> >::const_iterator passIterator; for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPassTextures.end(); ++passIterator) { - const CCRenderPass* renderPassInFrame = passesInFrame.get(passIterator->first); + const CCRenderPass* renderPassInFrame = renderPassesInFrame.get(passIterator->first); if (!renderPassInFrame) { passesToDelete.append(passIterator->first); continue; @@ -374,27 +367,32 @@ bool LayerRendererChromium::haveCachedResourcesForRenderPassId(int id) const return texture && texture->id() && texture->isComplete(); } -void LayerRendererChromium::drawFrame(const CCRenderPassList& renderPasses, const FloatRect& rootScissorRect) +void LayerRendererChromium::drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById, const FloatRect& rootScissorRect) { - const CCRenderPass* rootRenderPass = renderPasses.last(); - beginDrawingFrame(rootRenderPass); + const CCRenderPass* rootRenderPass = renderPassesInDrawOrder.last(); + ASSERT(rootRenderPass); + + DrawingFrame frame; + frame.renderPassesById = &renderPassesById; + frame.rootRenderPass = rootRenderPass; - for (size_t i = 0; i < renderPasses.size(); ++i) { - const CCRenderPass* renderPass = renderPasses[i]; + beginDrawingFrame(); + + for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { + const CCRenderPass* renderPass = renderPassesInDrawOrder[i]; FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(rootScissorRect); - drawRenderPass(renderPass, rootScissorRectInCurrentSurface); + drawRenderPass(frame, renderPass, rootScissorRectInCurrentSurface); } + + finishDrawingFrame(); } -void LayerRendererChromium::beginDrawingFrame(const CCRenderPass* rootRenderPass) +void LayerRendererChromium::beginDrawingFrame() { // FIXME: Remove this once framebuffer is automatically recreated on first use ensureFramebuffer(); - m_defaultRenderPass = rootRenderPass; - ASSERT(m_defaultRenderPass); - if (viewportSize().isEmpty()) return; @@ -424,19 +422,19 @@ void LayerRendererChromium::doNoOp() GLC(m_context, m_context->flush()); } -void LayerRendererChromium::drawRenderPass(const CCRenderPass* renderPass, const FloatRect& framebufferDamageRect) +void LayerRendererChromium::drawRenderPass(DrawingFrame& frame, const CCRenderPass* renderPass, const FloatRect& framebufferDamageRect) { - if (!useRenderPass(renderPass)) + if (!useRenderPass(frame, renderPass)) return; - clearRenderPass(renderPass, framebufferDamageRect); + clearFramebuffer(frame, framebufferDamageRect); const CCQuadList& quadList = renderPass->quadList(); for (CCQuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it) - drawQuad(it->get()); + drawQuad(frame, it->get()); } -void LayerRendererChromium::drawQuad(const WebKit::WebCompositorQuad* quad) +void LayerRendererChromium::drawQuad(DrawingFrame& frame, const WebKit::WebCompositorQuad* quad) { IntRect scissorRect = quad->scissorRect(); @@ -444,7 +442,7 @@ void LayerRendererChromium::drawQuad(const WebKit::WebCompositorQuad* quad) if (scissorRect.isEmpty()) return; - setScissorToRect(scissorRect); + setScissorToRect(frame, scissorRect); if (quad->needsBlending()) GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); @@ -456,45 +454,42 @@ void LayerRendererChromium::drawQuad(const WebKit::WebCompositorQuad* quad) ASSERT_NOT_REACHED(); break; case WebKit::WebCompositorQuad::Checkerboard: - drawCheckerboardQuad(CCCheckerboardDrawQuad::materialCast(quad)); + drawCheckerboardQuad(frame, CCCheckerboardDrawQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::DebugBorder: - drawDebugBorderQuad(CCDebugBorderDrawQuad::materialCast(quad)); + drawDebugBorderQuad(frame, CCDebugBorderDrawQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::IOSurfaceContent: - drawIOSurfaceQuad(CCIOSurfaceDrawQuad::materialCast(quad)); + drawIOSurfaceQuad(frame, CCIOSurfaceDrawQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::RenderPass: - drawRenderPassQuad(CCRenderPassDrawQuad::materialCast(quad)); + drawRenderPassQuad(frame, CCRenderPassDrawQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::SolidColor: - drawSolidColorQuad(WebKit::WebCompositorSolidColorQuad::materialCast(quad)); + drawSolidColorQuad(frame, WebKit::WebCompositorSolidColorQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::StreamVideoContent: - drawStreamVideoQuad(CCStreamVideoDrawQuad::materialCast(quad)); + drawStreamVideoQuad(frame, CCStreamVideoDrawQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::TextureContent: - drawTextureQuad(WebKit::WebCompositorTextureQuad::materialCast(quad)); + drawTextureQuad(frame, WebKit::WebCompositorTextureQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::TiledContent: - drawTileQuad(CCTileDrawQuad::materialCast(quad)); + drawTileQuad(frame, CCTileDrawQuad::materialCast(quad)); break; case WebKit::WebCompositorQuad::YUVVideoContent: - drawYUVVideoQuad(CCYUVVideoDrawQuad::materialCast(quad)); + drawYUVVideoQuad(frame, CCYUVVideoDrawQuad::materialCast(quad)); break; } } -void LayerRendererChromium::drawCheckerboardQuad(const CCCheckerboardDrawQuad* quad) +void LayerRendererChromium::drawCheckerboardQuad(DrawingFrame& frame, const CCCheckerboardDrawQuad* quad) { const TileCheckerboardProgram* program = tileCheckerboardProgram(); ASSERT(program && program->initialized()); GLC(context(), context()->useProgram(program->program())); IntRect tileRect = quad->quadRect(); - WebTransformationMatrix tileTransform = quad->quadTransform(); - tileTransform.translate(tileRect.x() + tileRect.width() / 2.0, tileRect.y() + tileRect.height() / 2.0); - float texOffsetX = tileRect.x(); float texOffsetY = tileRect.y(); float texScaleX = tileRect.width(); @@ -506,14 +501,11 @@ void LayerRendererChromium::drawCheckerboardQuad(const CCCheckerboardDrawQuad* q GLC(context(), context()->uniform1f(program->fragmentShader().frequencyLocation(), frequency)); - float opacity = quad->opacity(); - drawTexturedQuad(tileTransform, - tileRect.width(), tileRect.height(), opacity, FloatQuad(), - program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), -1); + setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()); + drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); } -void LayerRendererChromium::drawDebugBorderQuad(const CCDebugBorderDrawQuad* quad) +void LayerRendererChromium::drawDebugBorderQuad(DrawingFrame& frame, const CCDebugBorderDrawQuad* quad) { static float glMatrix[16]; const SolidColorProgram* program = solidColorProgram(); @@ -524,7 +516,7 @@ void LayerRendererChromium::drawDebugBorderQuad(const CCDebugBorderDrawQuad* qua WebTransformationMatrix renderMatrix = quad->quadTransform(); renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y()); renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); - LayerRendererChromium::toGLMatrix(&glMatrix[0], projectionMatrix() * renderMatrix); + LayerRendererChromium::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLocation(), 1, false, &glMatrix[0])); SkColor color = quad->color(); @@ -554,7 +546,7 @@ static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const return source; } -PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* quad, const WebTransformationMatrix& contentsDeviceTransform) +PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(DrawingFrame& frame, const CCRenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform) { // This method draws a background filter, which applies a filter to any pixels behind the quad and seen through its background. // The algorithm works as follows: @@ -572,30 +564,30 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C // FIXME: When this algorithm changes, update CCLayerTreeHost::prioritizeTextures() accordingly. - if (quad->backgroundFilters().isEmpty()) + if (filters.isEmpty()) return nullptr; // FIXME: We only allow background filters on an opaque render surface because other surfaces may contain // translucent pixels, and the contents behind those translucent pixels wouldn't have the filter applied. - if (m_currentRenderPass->hasTransparentBackground()) + if (frame.currentRenderPass->hasTransparentBackground()) return nullptr; - ASSERT(!m_currentTexture); + ASSERT(!frame.currentTexture); // FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused). IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox())); int top, right, bottom, left; - quad->backgroundFilters().getOutsets(top, right, bottom, left); + filters.getOutsets(top, right, bottom, left); deviceRect.move(-left, -top); deviceRect.expand(left + right, top + bottom); - deviceRect.intersect(m_currentRenderPass->framebufferOutputRect()); + deviceRect.intersect(frame.currentRenderPass->framebufferOutputRect()); OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_resourceProvider); if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) return nullptr; - SkBitmap filteredDeviceBackground = applyFilters(this, quad->backgroundFilters(), deviceBackgroundTexture.get()); + SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get()); if (!filteredDeviceBackground.getTexture()) return nullptr; @@ -606,8 +598,8 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer)) return nullptr; - const CCRenderPass* targetRenderPass = m_currentRenderPass; - bool usingBackgroundTexture = useScopedTexture(backgroundTexture.get(), quad->quadRect()); + const CCRenderPass* targetRenderPass = frame.currentRenderPass; + bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(), quad->quadRect()); if (usingBackgroundTexture) { // Copy the readback pixels from device to the background texture for the surface. @@ -615,39 +607,42 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, quad->quadRect().height() / 2.0); deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1); deviceToFramebufferTransform.multiply(contentsDeviceTransform.inverse()); - deviceToFramebufferTransform.translate(deviceRect.width() / 2.0, deviceRect.height() / 2.0); - deviceToFramebufferTransform.translate(deviceRect.x(), deviceRect.y()); - - copyTextureToFramebuffer(filteredDeviceBackgroundTextureId, deviceRect.size(), deviceToFramebufferTransform); + copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, deviceRect, deviceToFramebufferTransform); } - useRenderPass(targetRenderPass); + useRenderPass(frame, targetRenderPass); if (!usingBackgroundTexture) return nullptr; return backgroundTexture.release(); } -void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) +void LayerRendererChromium::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDrawQuad* quad) { CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); if (!contentsTexture || !contentsTexture->id()) return; - WebTransformationMatrix renderTransform = quad->drawTransform(); - // Apply a scaling factor to size the quad from 1x1 to its intended size. - renderTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1); - WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(windowMatrix() * projectionMatrix() * renderTransform).to2dTransform(); + const CCRenderPass* renderPass = frame.renderPassesById->get(quad->renderPassId()); + ASSERT(renderPass); + if (!renderPass) + return; + + WebTransformationMatrix renderMatrix = quad->quadTransform(); + renderMatrix.translate(0.5 * quad->quadRect().width() + quad->quadRect().x(), 0.5 * quad->quadRect().height() + quad->quadRect().y()); + WebTransformationMatrix deviceMatrix = renderMatrix; + deviceMatrix.scaleNonUniform(quad->quadRect().width(), quad->quadRect().height()); + WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(frame.windowMatrix * frame.projectionMatrix * deviceMatrix).to2dTransform(); // Can only draw surface if device matrix is invertible. if (!contentsDeviceTransform.isInvertible()) return; - OwnPtr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(quad, contentsDeviceTransform); + OwnPtr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(frame, quad, renderPass->backgroundFilters(), contentsDeviceTransform); // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. // Apply filters to the contents texture. - SkBitmap filterBitmap = applyFilters(this, quad->filters(), contentsTexture); + SkBitmap filterBitmap = applyFilters(this, renderPass->filters(), contentsTexture); OwnPtr<CCScopedLockResourceForRead> contentsResourceLock; unsigned contentsTextureId = 0; if (filterBitmap.getTexture()) { @@ -662,7 +657,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) if (backgroundTexture) { ASSERT(backgroundTexture->size() == quad->quadRect().size()); CCScopedLockResourceForRead lock(m_resourceProvider, backgroundTexture->id()); - copyTextureToFramebuffer(lock.textureId(), quad->quadRect().size(), quad->drawTransform()); + copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad->quadTransform()); } bool clipped = false; @@ -749,30 +744,23 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped); ASSERT(!clipped); - drawTexturedQuad(quad->drawTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad, - shaderMatrixLocation, shaderAlphaLocation, shaderQuadLocation); + setShaderOpacity(quad->opacity(), shaderAlphaLocation); + setShaderFloatQuad(surfaceQuad, shaderQuadLocation); + drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatrixLocation); } -void LayerRendererChromium::drawSolidColorQuad(const CCSolidColorDrawQuad* quad) +void LayerRendererChromium::drawSolidColorQuad(DrawingFrame& frame, const CCSolidColorDrawQuad* quad) { const SolidColorProgram* program = solidColorProgram(); GLC(context(), context()->useProgram(program->program())); - IntRect tileRect = quad->quadRect(); - - WebTransformationMatrix tileTransform = quad->quadTransform(); - tileTransform.translate(tileRect.x() + tileRect.width() / 2.0, tileRect.y() + tileRect.height() / 2.0); - SkColor color = quad->color(); float opacity = quad->opacity(); float alpha = (SkColorGetA(color) / 255.0) * opacity; GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (SkColorGetB(color) / 255.0) * alpha, alpha)); - drawTexturedQuad(tileTransform, - tileRect.width(), tileRect.height(), 1.0, FloatQuad(), - program->vertexShader().matrixLocation(), - -1, -1); + drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); } struct TileProgramUniforms { @@ -800,7 +788,7 @@ static void tileUniformLocation(T program, TileProgramUniforms& uniforms) uniforms.edgeLocation = program->fragmentShader().edgeLocation(); } -void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) +void LayerRendererChromium::drawTileQuad(DrawingFrame& frame, const CCTileDrawQuad* quad) { const IntRect& tileRect = quad->quadVisibleRect(); @@ -836,7 +824,7 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) FloatQuad localQuad; - WebTransformationMatrix deviceTransform = WebTransformationMatrix(windowMatrix() * projectionMatrix() * quad->quadTransform()).to2dTransform(); + WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.windowMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform(); if (!deviceTransform.isInvertible()) return; @@ -874,9 +862,8 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, quad->textureFilter())); GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, quad->textureFilter())); - - if (!clipped && quad->isAntialiased()) { - + bool useAA = !clipped && quad->isAntialiased(); + if (useAA) { CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceLayerQuad.boundingBox())); deviceLayerBounds.inflateAntiAliasingDistance(); @@ -952,10 +939,19 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) // Normalize to tileRect. localQuad.scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); - drawTexturedQuad(quad->quadTransform(), tileRect.width(), tileRect.height(), quad->opacity(), localQuad, uniforms.matrixLocation, uniforms.alphaLocation, uniforms.pointLocation); + setShaderOpacity(quad->opacity(), uniforms.alphaLocation); + setShaderFloatQuad(localQuad, uniforms.pointLocation); + + // The tile quad shader behaves differently compared to all other shaders. + // The transform and vertex data are used to figure out the extents that the + // un-antialiased quad should have and which vertex this is and the float + // quad passed in via uniform is the actual geometry that gets used to draw + // it. This is why this centered rect is used and not the original quadRect. + FloatRect centeredRect(FloatPoint(-0.5 * tileRect.width(), -0.5 * tileRect.height()), tileRect.size()); + drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrixLocation); } -void LayerRendererChromium::drawYUVVideoQuad(const CCYUVVideoDrawQuad* quad) +void LayerRendererChromium::drawYUVVideoQuad(DrawingFrame& frame, const CCYUVVideoDrawQuad* quad) { const VideoYUVProgram* program = videoYUVProgram(); ASSERT(program && program->initialized()); @@ -1008,18 +1004,14 @@ void LayerRendererChromium::drawYUVVideoQuad(const CCYUVVideoDrawQuad* quad) }; GLC(context(), context()->uniform3fv(program->fragmentShader().yuvAdjLocation(), 1, yuvAdjust)); - WebTransformationMatrix quadTransform = quad->quadTransform(); - IntRect quadRect = quad->quadRect(); - quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); - - drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), FloatQuad(), - program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1); + setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()); + drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); // Reset active texture back to texture 0. GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); } -void LayerRendererChromium::drawStreamVideoQuad(const CCStreamVideoDrawQuad* quad) +void LayerRendererChromium::drawStreamVideoQuad(DrawingFrame& frame, const CCStreamVideoDrawQuad* quad) { static float glMatrix[16]; @@ -1036,12 +1028,8 @@ void LayerRendererChromium::drawStreamVideoQuad(const CCStreamVideoDrawQuad* qua GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); - WebTransformationMatrix quadTransform = quad->quadTransform(); - IntRect quadRect = quad->quadRect(); - quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); - - drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), - program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1); + setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()); + drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); } struct TextureProgramBinding { @@ -1068,7 +1056,7 @@ struct TexTransformTextureProgramBinding : TextureProgramBinding { int texTransformLocation; }; -void LayerRendererChromium::drawTextureQuad(const CCTextureDrawQuad* quad) +void LayerRendererChromium::drawTextureQuad(DrawingFrame& frame, const CCTextureDrawQuad* quad) { ASSERT(CCProxy::isImplThread()); @@ -1105,17 +1093,14 @@ void LayerRendererChromium::drawTextureQuad(const CCTextureDrawQuad* quad) GLC(context(), context()->blendFuncSeparate(GraphicsContext3D::SRC_ALPHA, GraphicsContext3D::ONE_MINUS_SRC_ALPHA, GraphicsContext3D::ZERO, GraphicsContext3D::ONE)); } - WebTransformationMatrix quadTransform = quad->quadTransform(); - IntRect quadRect = quad->quadRect(); - quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); - - drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); + setShaderOpacity(quad->opacity(), binding.alphaLocation); + drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.matrixLocation); if (!quad->premultipliedAlpha()) GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); } -void LayerRendererChromium::drawIOSurfaceQuad(const CCIOSurfaceDrawQuad* quad) +void LayerRendererChromium::drawIOSurfaceQuad(DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) { ASSERT(CCProxy::isImplThread()); TexTransformTextureProgramBinding binding; @@ -1131,43 +1116,14 @@ void LayerRendererChromium::drawIOSurfaceQuad(const CCIOSurfaceDrawQuad* quad) GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, quad->ioSurfaceTextureId())); - WebTransformationMatrix quadTransform = quad->quadTransform(); - IntRect quadRect = quad->quadRect(); - quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); - - drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); + setShaderOpacity(quad->opacity(), binding.alphaLocation); + drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.matrixLocation); GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); } -void LayerRendererChromium::drawHeadsUpDisplay(const CCScopedTexture* hudTexture, const IntSize& hudSize) -{ - ASSERT(hudTexture->id()); - - GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); - GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); - GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); - useRenderPass(m_defaultRenderPass); - - const HeadsUpDisplayProgram* program = headsUpDisplayProgram(); - ASSERT(program && program->initialized()); - GLC(m_context, m_context->activeTexture(GraphicsContext3D::TEXTURE0)); - CCScopedLockResourceForRead lock(m_resourceProvider, hudTexture->id()); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId())); - GLC(m_context, m_context->useProgram(program->program())); - GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0)); - - WebTransformationMatrix matrix; - matrix.translate3d(hudSize.width() * 0.5, hudSize.height() * 0.5, 0); - drawTexturedQuad(matrix, hudSize.width(), hudSize.height(), - 1, sharedGeometryQuad(), program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), - -1); -} - void LayerRendererChromium::finishDrawingFrame() { - m_currentFramebufferLock.clear(); GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); } @@ -1192,42 +1148,43 @@ void LayerRendererChromium::toGLMatrix(float* flattened, const WebTransformation flattened[15] = m.m44(); } -void LayerRendererChromium::drawTexturedQuad(const WebTransformationMatrix& drawMatrix, - float width, float height, float opacity, const FloatQuad& quad, - int matrixLocation, int alphaLocation, int quadLocation) +void LayerRendererChromium::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) { - static float glMatrix[16]; + if (quadLocation == -1) + return; - WebTransformationMatrix renderMatrix = drawMatrix; + float point[8]; + point[0] = quad.p1().x(); + point[1] = quad.p1().y(); + point[2] = quad.p2().x(); + point[3] = quad.p2().y(); + point[4] = quad.p3().x(); + point[5] = quad.p3().y(); + point[6] = quad.p4().x(); + point[7] = quad.p4().y(); + GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); +} - // Apply a scaling factor to size the quad from 1x1 to its intended size. - renderMatrix.scale3d(width, height, 1); +void LayerRendererChromium::setShaderOpacity(float opacity, int alphaLocation) +{ + if (alphaLocation != -1) + GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); +} - // Apply the projection matrix before sending the transform over to the shader. - toGLMatrix(&glMatrix[0], m_projectionMatrix * renderMatrix); +void LayerRendererChromium::drawQuadGeometry(DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation) +{ + WebTransformationMatrix quadMatrix = drawTransform; + quadMatrix.translate(0.5 * quadRect.width() + quadRect.x(), 0.5 * quadRect.height() + quadRect.y()); + quadMatrix.scaleNonUniform(quadRect.width(), quadRect.height()); + static float glMatrix[16]; + toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadMatrix); GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatrix[0])); - if (quadLocation != -1) { - float point[8]; - point[0] = quad.p1().x(); - point[1] = quad.p1().y(); - point[2] = quad.p2().x(); - point[3] = quad.p2().y(); - point[4] = quad.p3().x(); - point[5] = quad.p3().y(); - point[6] = quad.p4().x(); - point[7] = quad.p4().y(); - GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); - } - - if (alphaLocation != -1) - GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); - GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0)); } -void LayerRendererChromium::copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebTransformationMatrix& drawMatrix) +void LayerRendererChromium::copyTextureToFramebuffer(DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) { const RenderPassProgram* program = renderPassProgram(); @@ -1240,10 +1197,8 @@ void LayerRendererChromium::copyTextureToFramebuffer(int textureId, const IntSiz GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); - drawTexturedQuad(drawMatrix, bounds.width(), bounds.height(), 1, sharedGeometryQuad(), - program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), - -1); + setShaderOpacity(1, program->fragmentShader().alphaLocation()); + drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLocation()); } void LayerRendererChromium::finish() @@ -1412,20 +1367,20 @@ bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, cons return true; } -bool LayerRendererChromium::isCurrentRenderPass(const CCRenderPass* renderPass) +bool LayerRendererChromium::isCurrentRenderPass(DrawingFrame& frame, const CCRenderPass* renderPass) { - return m_currentRenderPass == renderPass && !m_currentTexture; + return frame.currentRenderPass == renderPass && !frame.currentTexture; } -bool LayerRendererChromium::useRenderPass(const CCRenderPass* renderPass) +bool LayerRendererChromium::useRenderPass(DrawingFrame& frame, const CCRenderPass* renderPass) { - m_currentRenderPass = renderPass; - m_currentTexture = 0; + frame.currentRenderPass = renderPass; + frame.currentTexture = 0; - if (renderPass == m_defaultRenderPass) { - m_currentFramebufferLock.clear(); + if (renderPass == frame.rootRenderPass) { + frame.currentFramebufferLock.clear(); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); - setDrawFramebufferRect(renderPass->framebufferOutputRect(), true); + setDrawFramebufferRect(frame, renderPass->framebufferOutputRect(), true); return true; } @@ -1437,25 +1392,26 @@ bool LayerRendererChromium::useRenderPass(const CCRenderPass* renderPass) if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass), CCResourceProvider::TextureUsageFramebuffer)) return false; - return bindFramebufferToTexture(texture, renderPass->framebufferOutputRect()); + return bindFramebufferToTexture(frame, texture, renderPass->framebufferOutputRect()); } -bool LayerRendererChromium::useScopedTexture(const CCScopedTexture* texture, const IntRect& viewportRect) +bool LayerRendererChromium::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) { ASSERT(texture->id()); - m_currentRenderPass = 0; - m_currentTexture = texture; + frame.currentRenderPass = 0; + frame.currentTexture = texture; - return bindFramebufferToTexture(texture, viewportRect); + return bindFramebufferToTexture(frame, texture, viewportRect); } -bool LayerRendererChromium::bindFramebufferToTexture(const CCScopedTexture* texture, const IntRect& framebufferRect) +bool LayerRendererChromium::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) { ASSERT(texture->id()); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId)); - m_currentFramebufferLock = adoptPtr(new CCScopedLockResourceForWrite(m_resourceProvider, texture->id())); - GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_currentFramebufferLock->textureId(), 0)); + frame.currentFramebufferLock = adoptPtr(new CCScopedLockResourceForWrite(m_resourceProvider, texture->id())); + unsigned textureId = frame.currentFramebufferLock->textureId(); + GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId, 0)); #if !defined ( NDEBUG ) if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { @@ -1464,16 +1420,16 @@ bool LayerRendererChromium::bindFramebufferToTexture(const CCScopedTexture* text } #endif - setDrawFramebufferRect(framebufferRect, false); + setDrawFramebufferRect(frame, framebufferRect, false); return true; } // Sets the scissor region to the given rectangle. The coordinate system for the // scissorRect has its origin at the top left corner of the current visible rect. -void LayerRendererChromium::setScissorToRect(const IntRect& scissorRect) +void LayerRendererChromium::setScissorToRect(DrawingFrame& frame, const IntRect& scissorRect) { - IntRect framebufferOutputRect = (m_currentRenderPass ? m_currentRenderPass->framebufferOutputRect() : m_defaultRenderPass->framebufferOutputRect()); + IntRect framebufferOutputRect = frame.currentRenderPass->framebufferOutputRect(); GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST)); @@ -1484,7 +1440,7 @@ void LayerRendererChromium::setScissorToRect(const IntRect& scissorRect) // of the GL scissor is the bottom of our layer. // But, if rendering to offscreen texture, we reverse our sense of 'upside down'. int scissorY; - if (isCurrentRenderPass(m_defaultRenderPass)) + if (isCurrentRenderPass(frame, frame.rootRenderPass)) scissorY = framebufferOutputRect.height() - (scissorRect.maxY() - framebufferOutputRect.y()); else scissorY = scissorRect.y() - framebufferOutputRect.y(); @@ -1499,14 +1455,14 @@ bool LayerRendererChromium::makeContextCurrent() // Sets the coordinate range of content that ends being drawn onto the target render surface. // The target render surface is assumed to have an origin at 0, 0 and the width and height of // of the drawRect. -void LayerRendererChromium::setDrawFramebufferRect(const IntRect& drawRect, bool flipY) +void LayerRendererChromium::setDrawFramebufferRect(DrawingFrame& frame, const IntRect& drawRect, bool flipY) { if (flipY) - m_projectionMatrix = orthoMatrix(drawRect.x(), drawRect.maxX(), drawRect.maxY(), drawRect.y()); + frame.projectionMatrix = orthoMatrix(drawRect.x(), drawRect.maxX(), drawRect.maxY(), drawRect.y()); else - m_projectionMatrix = orthoMatrix(drawRect.x(), drawRect.maxX(), drawRect.y(), drawRect.maxY()); + frame.projectionMatrix = orthoMatrix(drawRect.x(), drawRect.maxX(), drawRect.y(), drawRect.maxY()); GLC(m_context, m_context->viewport(0, 0, drawRect.width(), drawRect.height())); - m_windowMatrix = screenMatrix(0, 0, drawRect.width(), drawRect.height()); + frame.windowMatrix = screenMatrix(0, 0, drawRect.width(), drawRect.height()); } @@ -1558,17 +1514,6 @@ const LayerRendererChromium::SolidColorProgram* LayerRendererChromium::solidColo return m_solidColorProgram.get(); } -const LayerRendererChromium::HeadsUpDisplayProgram* LayerRendererChromium::headsUpDisplayProgram() -{ - if (!m_headsUpDisplayProgram) - m_headsUpDisplayProgram = adoptPtr(new HeadsUpDisplayProgram(m_context)); - if (!m_headsUpDisplayProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::headsUpDisplayProgram::initialize"); - m_headsUpDisplayProgram->initialize(m_context, m_isUsingBindUniform); - } - return m_headsUpDisplayProgram.get(); -} - const LayerRendererChromium::RenderPassProgram* LayerRendererChromium::renderPassProgram() { ASSERT(m_renderPassProgram); @@ -1776,9 +1721,6 @@ void LayerRendererChromium::cleanupSharedObjects() if (m_solidColorProgram) m_solidColorProgram->cleanup(m_context); - if (m_headsUpDisplayProgram) - m_headsUpDisplayProgram->cleanup(m_context); - if (m_offscreenFramebufferId) GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId)); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 198aef9a3..6842f0cc5 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -80,10 +80,7 @@ public: virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) OVERRIDE; virtual bool haveCachedResourcesForRenderPassId(int id) const OVERRIDE; - virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) OVERRIDE; - virtual void finishDrawingFrame() OVERRIDE; - - virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) OVERRIDE; + virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&, const FloatRect& rootScissorRect) OVERRIDE; // waits for rendering to finish virtual void finish() OVERRIDE; @@ -106,10 +103,6 @@ public: virtual void setVisible(bool) OVERRIDE; - void drawTexturedQuad(const WebKit::WebTransformationMatrix& layerMatrix, - float width, float height, float opacity, const FloatQuad&, - int matrixLocation, int alphaLocation, int quadLocation); - void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebKit::WebTransformationMatrix& drawMatrix); CCResourceProvider* resourceProvider() const { return m_resourceProvider; } protected: @@ -122,35 +115,59 @@ protected: void releaseRenderPassTextures(); private: + struct DrawingFrame { + const CCRenderPassIdHashMap* renderPassesById; + const CCRenderPass* rootRenderPass; + const CCRenderPass* currentRenderPass; + const CCScopedTexture* currentTexture; + OwnPtr<CCScopedLockResourceForWrite> currentFramebufferLock; + + WebKit::WebTransformationMatrix projectionMatrix; + WebKit::WebTransformationMatrix windowMatrix; + + DrawingFrame() + : rootRenderPass(0) + , currentRenderPass(0) + , currentTexture(0) + { } + }; + static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); - void beginDrawingFrame(const CCRenderPass* rootRenderPass); - void drawRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect); + void beginDrawingFrame(); + void drawRenderPass(DrawingFrame&, const CCRenderPass*, const FloatRect& framebufferDamageRect); + void finishDrawingFrame(); + + void drawQuad(DrawingFrame&, const CCDrawQuad*); + void drawCheckerboardQuad(DrawingFrame&, const CCCheckerboardDrawQuad*); + void drawDebugBorderQuad(DrawingFrame&, const CCDebugBorderDrawQuad*); + PassOwnPtr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRenderPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformationMatrix& deviceTransform); + void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*); + void drawSolidColorQuad(DrawingFrame&, const CCSolidColorDrawQuad*); + void drawStreamVideoQuad(DrawingFrame&, const CCStreamVideoDrawQuad*); + void drawTextureQuad(DrawingFrame&, const CCTextureDrawQuad*); + void drawIOSurfaceQuad(DrawingFrame&, const CCIOSurfaceDrawQuad*); + void drawTileQuad(DrawingFrame&, const CCTileDrawQuad*); + void drawYUVVideoQuad(DrawingFrame&, const CCYUVVideoDrawQuad*); + + void setShaderOpacity(float opacity, int alphaLocation); + void setShaderFloatQuad(const FloatQuad&, int quadLocation); + void drawQuadGeometry(DrawingFrame&, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation); - void drawQuad(const CCDrawQuad*); - void drawCheckerboardQuad(const CCCheckerboardDrawQuad*); - void drawDebugBorderQuad(const CCDebugBorderDrawQuad*); - PassOwnPtr<CCScopedTexture> drawBackgroundFilters(const CCRenderPassDrawQuad*, const WebKit::WebTransformationMatrix& deviceTransform); - void drawRenderPassQuad(const CCRenderPassDrawQuad*); - void drawSolidColorQuad(const CCSolidColorDrawQuad*); - void drawStreamVideoQuad(const CCStreamVideoDrawQuad*); - void drawTextureQuad(const CCTextureDrawQuad*); - void drawIOSurfaceQuad(const CCIOSurfaceDrawQuad*); - void drawTileQuad(const CCTileDrawQuad*); - void drawYUVVideoQuad(const CCYUVVideoDrawQuad*); + void copyTextureToFramebuffer(DrawingFrame&, int textureId, const IntRect&, const WebKit::WebTransformationMatrix& drawMatrix); - void setScissorToRect(const IntRect&); + void setScissorToRect(DrawingFrame&, const IntRect&); - void setDrawFramebufferRect(const IntRect&, bool flipY); + void setDrawFramebufferRect(DrawingFrame&, const IntRect&, bool flipY); // The current drawing target is either a RenderPass or ScopedTexture. Use these functions to switch to a new drawing target. - bool useRenderPass(const CCRenderPass*); - bool useScopedTexture(const CCScopedTexture*, const IntRect& viewportRect); - bool isCurrentRenderPass(const CCRenderPass*); + bool useRenderPass(DrawingFrame&, const CCRenderPass*); + bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& viewportRect); + bool isCurrentRenderPass(DrawingFrame&, const CCRenderPass*); - bool bindFramebufferToTexture(const CCScopedTexture*, const IntRect& viewportRect); + bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& viewportRect); - void clearRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect); + void clearFramebuffer(DrawingFrame&, const FloatRect& framebufferDamageRect); bool makeContextCurrent(); @@ -174,9 +191,6 @@ private: LayerRendererCapabilities m_capabilities; - const CCRenderPass* m_currentRenderPass; - const CCScopedTexture* m_currentTexture; - OwnPtr<CCScopedLockResourceForWrite> m_currentFramebufferLock; unsigned m_offscreenFramebufferId; OwnPtr<GeometryBinding> m_sharedGeometry; @@ -213,10 +227,6 @@ private: // Special purpose / effects shaders. typedef ProgramBinding<VertexShaderPos, FragmentShaderColor> SolidColorProgram; - // Debugging shaders. - typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexSwizzleAlpha> HeadsUpDisplayProgram; - - const TileProgram* tileProgram(); const TileProgramOpaque* tileProgramOpaque(); const TileProgramAA* tileProgramAA(); @@ -239,8 +249,6 @@ private: const SolidColorProgram* solidColorProgram(); - const HeadsUpDisplayProgram* headsUpDisplayProgram(); - OwnPtr<TileProgram> m_tileProgram; OwnPtr<TileProgramOpaque> m_tileProgramOpaque; OwnPtr<TileProgramAA> m_tileProgramAA; @@ -262,7 +270,6 @@ private: OwnPtr<VideoStreamTextureProgram> m_videoStreamTextureProgram; OwnPtr<SolidColorProgram> m_solidColorProgram; - OwnPtr<HeadsUpDisplayProgram> m_headsUpDisplayProgram; CCResourceProvider* m_resourceProvider; OwnPtr<AcceleratedTextureCopier> m_textureCopier; @@ -272,8 +279,6 @@ private: WebKit::WebGraphicsContext3D* m_context; - const CCRenderPass* m_defaultRenderPass; - bool m_isViewportChanged; bool m_isFramebufferDiscarded; bool m_isUsingBindUniform; diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h index 189942e25..e3ac49945 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h @@ -38,6 +38,7 @@ namespace WebCore { class IntRect; class IntSize; class TextureManager; +struct CCRenderingStats; class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> { public: @@ -48,7 +49,7 @@ public: CCPrioritizedTexture* texture() { return m_texture.get(); } void swapTextureWith(OwnPtr<CCPrioritizedTexture>& texture) { m_texture.swap(texture); } - virtual void prepareRect(const IntRect& /* sourceRect */) { } + virtual void prepareRect(const IntRect& /* sourceRect */, CCRenderingStats&) { } virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) = 0; protected: explicit Texture(PassOwnPtr<CCPrioritizedTexture> texture) : m_texture(texture) { } @@ -72,7 +73,7 @@ public: virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0; // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater, // then this region should be ignored in preference for the entire layer's area. - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) { } + virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) { } // Set true by the layer when it is known that the entire output is going to be opaque. virtual void setOpaque(bool) { } diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp index f7aebeee8..7c280a0ae 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp @@ -54,12 +54,9 @@ RenderSurfaceChromium::~RenderSurfaceChromium() FloatRect RenderSurfaceChromium::drawableContentRect() const { - FloatRect localContentRect(-0.5 * m_contentRect.width(), -0.5 * m_contentRect.height(), - m_contentRect.width(), m_contentRect.height()); - FloatRect drawableContentRect = CCMathUtil::mapClippedRect(m_drawTransform, localContentRect); - if (m_owningLayer->replicaLayer()) - drawableContentRect.unite(CCMathUtil::mapClippedRect(m_replicaDrawTransform, localContentRect)); - + FloatRect drawableContentRect = CCMathUtil::mapClippedRect(m_drawTransform, m_contentRect); + if (m_owningLayer->hasReplica()) + drawableContentRect.unite(CCMathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect)); return drawableContentRect; } diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index 4749c130e..034be58a4 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -62,18 +62,12 @@ public: const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; } - const WebKit::WebTransformationMatrix& originTransform() const { return m_originTransform; } - void setOriginTransform(const WebKit::WebTransformationMatrix& originTransform) { m_originTransform = originTransform; } - const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; } const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; } void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; } - const WebKit::WebTransformationMatrix& replicaOriginTransform() const { return m_replicaOriginTransform; } - void setReplicaOriginTransform(const WebKit::WebTransformationMatrix& replicaOriginTransform) { m_replicaOriginTransform = replicaOriginTransform; } - const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; } void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; } @@ -104,10 +98,8 @@ private: float m_drawOpacity; bool m_drawOpacityIsAnimating; WebKit::WebTransformationMatrix m_drawTransform; - WebKit::WebTransformationMatrix m_originTransform; WebKit::WebTransformationMatrix m_screenSpaceTransform; WebKit::WebTransformationMatrix m_replicaDrawTransform; - WebKit::WebTransformationMatrix m_replicaOriginTransform; WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; bool m_targetSurfaceTransformsAreAnimating; bool m_screenSpaceTransformsAreAnimating; diff --git a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp index 4988b327f..06c6079fe 100644 --- a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp @@ -226,7 +226,7 @@ void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } -void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUpdater& updater) +void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUpdater& updater, CCRenderingStats& stats) { // Skip painting and uploading if there are no invalidations and // we already have valid texture data. @@ -242,8 +242,8 @@ void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextu // Paint and upload the entire part. IntRect paintedOpaqueRect; - painter->prepareToUpdate(rect, rect.size(), 1, 1, paintedOpaqueRect); - texture->prepareRect(rect); + painter->prepareToUpdate(rect, rect.size(), 1, 1, paintedOpaqueRect, stats); + texture->prepareRect(rect, stats); IntRect destRect(IntPoint(), rect.size()); updater.appendFullUpdate(texture, rect, destRect); @@ -273,7 +273,7 @@ void ScrollbarLayerChromium::setTexturePriorities(const CCPriorityCalculator&) } } -void ScrollbarLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker*) +void ScrollbarLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker*, CCRenderingStats& stats) { if (contentBounds().isEmpty()) return; @@ -282,14 +282,14 @@ void ScrollbarLayerChromium::update(CCTextureUpdater& updater, const CCOcclusion IntPoint scrollbarOrigin(m_scrollbar->x(), m_scrollbar->y()); IntRect contentRect(scrollbarOrigin, contentBounds()); - updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, updater); + updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, updater, stats); if (m_foreTrack && m_foreTrackUpdater) - updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, updater); + updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, updater, stats); // Consider the thumb to be at the origin when painting. IntRect thumbRect = IntRect(IntPoint(), theme()->thumbRect(m_scrollbar.get()).size()); if (!thumbRect.isEmpty()) - updatePart(m_thumbUpdater.get(), m_thumb.get(), thumbRect, updater); + updatePart(m_thumbUpdater.get(), m_thumb.get(), thumbRect, updater, stats); } } diff --git a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h index 0a8a2a13b..17a7ace82 100644 --- a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h @@ -45,7 +45,7 @@ public: // LayerChromium interface virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; - virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE; + virtual void update(CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; @@ -59,7 +59,7 @@ protected: private: ScrollbarThemeComposite* theme() const; - void updatePart(LayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, CCTextureUpdater&); + void updatePart(LayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, CCTextureUpdater&, CCRenderingStats&); void createTextureUpdaterIfNeeded(); RefPtr<Scrollbar> m_scrollbar; diff --git a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp index f7bdb6f36..d45c9892b 100644 --- a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp @@ -46,10 +46,10 @@ SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() { } -void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) +void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) { SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height()); - paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect); + paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats); m_picture.endRecording(); } diff --git a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h index a51f44f59..9287ca01d 100644 --- a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h @@ -52,7 +52,7 @@ public: protected: explicit SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) OVERRIDE; + virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE; void drawPicture(SkCanvas*); bool layerIsOpaque() const { return m_layerIsOpaque; } diff --git a/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp index 859864e62..90bc70ea9 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp @@ -129,7 +129,7 @@ bool TextureLayerChromium::drawsContent() const return (m_client || m_textureId) && !m_contextLost && LayerChromium::drawsContent(); } -void TextureLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker*) +void TextureLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker*, CCRenderingStats&) { if (m_client) { m_textureId = m_client->prepareTexture(updater); diff --git a/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h index 8272ec595..13f5cb849 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h @@ -87,7 +87,7 @@ public: virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; virtual bool drawsContent() const OVERRIDE; - virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE; + virtual void update(CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; protected: diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index 8e489195e..68740ef50 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -345,7 +345,7 @@ bool TiledLayerChromium::tileNeedsBufferedUpdate(UpdatableTile* tile) return true; } -void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, int bottom, CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) +void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, int bottom, CCTextureUpdater& updater, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) { createTextureUpdaterIfNeeded(); @@ -437,7 +437,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in // so we grab a local reference here to hold the updater alive until the paint completes. RefPtr<LayerTextureUpdater> protector(textureUpdater()); IntRect paintedOpaqueRect; - textureUpdater()->prepareToUpdate(paintRect, m_tiler->tileSize(), 1 / widthScale, 1 / heightScale, paintedOpaqueRect); + textureUpdater()->prepareToUpdate(paintRect, m_tiler->tileSize(), 1 / widthScale, 1 / heightScale, paintedOpaqueRect, stats); m_didPaint = true; for (int j = top; j <= bottom; ++j) { @@ -482,7 +482,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in if (sourceRect.isEmpty()) continue; - tile->texture()->prepareRect(sourceRect); + tile->texture()->prepareRect(sourceRect, stats); if (occlusion) occlusion->overdrawMetrics().didUpload(WebTransformationMatrix(), sourceRect, tile->opaqueRect()); @@ -610,7 +610,7 @@ void TiledLayerChromium::resetUpdateState() } } -void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion) +void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) { m_skipsDraw = false; m_skipsIdlePaint = false; @@ -625,7 +625,7 @@ void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntR if (!contentRect.isEmpty()) { int left, top, right, bottom; m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); - updateTiles(false, left, top, right, bottom, updater, occlusion); + updateTiles(false, left, top, right, bottom, updater, occlusion, stats); } // Abort if we have already painted or run out of memory. @@ -642,16 +642,16 @@ void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntR // If the layer is not visible, we have nothing to expand from, so instead we prepaint the outer-most set of tiles. if (contentRect.isEmpty()) { - updateTiles(true, prepaintLeft, prepaintTop, prepaintRight, prepaintTop, updater, 0); + updateTiles(true, prepaintLeft, prepaintTop, prepaintRight, prepaintTop, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) return; - updateTiles(true, prepaintLeft, prepaintBottom, prepaintRight, prepaintBottom, updater, 0); + updateTiles(true, prepaintLeft, prepaintBottom, prepaintRight, prepaintBottom, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) return; - updateTiles(true, prepaintLeft, prepaintTop, prepaintLeft, prepaintBottom, updater, 0); + updateTiles(true, prepaintLeft, prepaintTop, prepaintLeft, prepaintBottom, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) return; - updateTiles(true, prepaintRight, prepaintTop, prepaintRight, prepaintBottom, updater, 0); + updateTiles(true, prepaintRight, prepaintTop, prepaintRight, prepaintBottom, updater, 0, stats); return; } @@ -659,7 +659,7 @@ void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntR m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); // Otherwise, prepaint anything that was occluded but inside the layer's visible region. - updateTiles(true, left, top, right, bottom, updater, 0); + updateTiles(true, left, top, right, bottom, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) return; @@ -667,25 +667,25 @@ void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntR while (!m_skipsIdlePaint && (left > prepaintLeft || top > prepaintTop || right < prepaintRight || bottom < prepaintBottom)) { if (bottom < prepaintBottom) { ++bottom; - updateTiles(true, left, bottom, right, bottom, updater, 0); + updateTiles(true, left, bottom, right, bottom, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) break; } if (top > prepaintTop) { --top; - updateTiles(true, left, top, right, top, updater, 0); + updateTiles(true, left, top, right, top, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) break; } if (left > prepaintLeft) { --left; - updateTiles(true, left, top, left, bottom, updater, 0); + updateTiles(true, left, top, left, bottom, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) break; } if (right < prepaintRight) { ++right; - updateTiles(true, right, top, right, bottom, updater, 0); + updateTiles(true, right, top, right, bottom, updater, 0, stats); if (m_didPaint || m_skipsIdlePaint) break; } diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h index c80c422f9..67e4f02cf 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h @@ -83,7 +83,7 @@ protected: void resetUpdateState(); // Prepare data needed to update textures that intersect with contentRect. - void updateContentRect(CCTextureUpdater&, const IntRect& contentRect, const CCOcclusionTracker*); + void updateContentRect(CCTextureUpdater&, const IntRect& contentRect, const CCOcclusionTracker*, CCRenderingStats&); // After preparing an update, returns true if more painting is needed. bool needsIdlePaint(const IntRect& visibleContentRect); @@ -106,7 +106,7 @@ private: void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleContentRect); - void updateTiles(bool idle, int left, int top, int right, int bottom, CCTextureUpdater&, const CCOcclusionTracker*); + void updateTiles(bool idle, int left, int top, int right, int bottom, CCTextureUpdater&, const CCOcclusionTracker*, CCRenderingStats&); UpdatableTile* tileAt(int, int) const; UpdatableTile* createTile(int, int); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp index da9942663..5d5855c07 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp @@ -270,27 +270,28 @@ void CCDamageTracker::extendDamageForLayer(CCLayerImpl* layer, FloatRect& target // To consider how a layer's targetSurface contributes to the ancestorSurface, // extendDamageForRenderSurface() must be called instead. - // Compute the layer's "originTransform" by translating the drawTransform. - WebTransformationMatrix originTransform = layer->drawTransform(); - originTransform.translate(-0.5 * layer->bounds().width(), -0.5 * layer->bounds().height()); - bool layerIsNew = false; - FloatRect oldLayerRect = removeRectFromCurrentFrame(layer->id(), layerIsNew); + FloatRect oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), layerIsNew); - FloatRect layerRectInTargetSpace = CCMathUtil::mapClippedRect(originTransform, FloatRect(FloatPoint::zero(), layer->bounds())); - saveRectForNextFrame(layer->id(), layerRectInTargetSpace); + FloatRect rectInTargetSpace = CCMathUtil::mapClippedRect(layer->drawTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())); + saveRectForNextFrame(layer->id(), rectInTargetSpace); if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) { // If a layer is new or has changed, then its entire layer rect affects the target surface. - targetDamageRect.uniteIfNonZero(layerRectInTargetSpace); + targetDamageRect.uniteIfNonZero(rectInTargetSpace); // The layer's old region is now exposed on the target surface, too. - // Note oldLayerRect is already in target space. - targetDamageRect.uniteIfNonZero(oldLayerRect); + // Note oldRectInTargetSpace is already in target space. + targetDamageRect.uniteIfNonZero(oldRectInTargetSpace); } else if (!layer->updateRect().isEmpty()) { // If the layer properties havent changed, then the the target surface is only // affected by the layer's update area, which could be empty. - FloatRect updateRectInTargetSpace = CCMathUtil::mapClippedRect(originTransform, layer->updateRect()); + FloatRect updateContentRect = layer->updateRect(); + float widthScale = layer->contentBounds().width() / static_cast<float>(layer->bounds().width()); + float heightScale = layer->contentBounds().height() / static_cast<float>(layer->bounds().height()); + updateContentRect.scale(widthScale, heightScale); + + FloatRect updateRectInTargetSpace = CCMathUtil::mapClippedRect(layer->drawTransform(), updateContentRect); targetDamageRect.uniteIfNonZero(updateRectInTargetSpace); } } @@ -331,13 +332,13 @@ void CCDamageTracker::extendDamageForRenderSurface(CCLayerImpl* layer, FloatRect // If there was damage, transform it to target space, and possibly contribute its reflection if needed. if (!damageRectInLocalSpace.isEmpty()) { - const WebTransformationMatrix& originTransform = renderSurface->originTransform(); - FloatRect damageRectInTargetSpace = CCMathUtil::mapClippedRect(originTransform, damageRectInLocalSpace); + const WebTransformationMatrix& drawTransform = renderSurface->drawTransform(); + FloatRect damageRectInTargetSpace = CCMathUtil::mapClippedRect(drawTransform, damageRectInLocalSpace); targetDamageRect.uniteIfNonZero(damageRectInTargetSpace); if (layer->replicaLayer()) { - const WebTransformationMatrix& replicaOriginTransform = renderSurface->replicaOriginTransform(); - targetDamageRect.uniteIfNonZero(CCMathUtil::mapClippedRect(replicaOriginTransform, damageRectInLocalSpace)); + const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform(); + targetDamageRect.uniteIfNonZero(CCMathUtil::mapClippedRect(replicaDrawTransform, damageRectInLocalSpace)); } } @@ -348,9 +349,8 @@ void CCDamageTracker::extendDamageForRenderSurface(CCLayerImpl* layer, FloatRect bool replicaIsNew = false; removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); - // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space. - const WebTransformationMatrix& replicaOriginTransform = renderSurface->replicaOriginTransform(); - FloatRect replicaMaskLayerRect = CCMathUtil::mapClippedRect(replicaOriginTransform, FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height()))); + const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform(); + FloatRect replicaMaskLayerRect = CCMathUtil::mapClippedRect(replicaDrawTransform, FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height()))); saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); // In the current implementation, a change in the replica mask damages the entire replica region. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.cpp index c6132178e..857d71f52 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.cpp @@ -38,11 +38,6 @@ CCDebugRectHistory::CCDebugRectHistory() { } -bool CCDebugRectHistory::enabled(const CCLayerTreeSettings& settings) -{ - return settings.showPaintRects || settings.showPropertyChangedRects || settings.showSurfaceDamageRects || settings.showScreenSpaceRects || settings.showReplicaScreenSpaceRects || settings.showOccludingRects; -} - void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings& settings) { // For now, clear all rects from previous frames. In the future we may want to store @@ -72,8 +67,11 @@ void CCDebugRectHistory::savePaintRects(CCLayerImpl* layer) // regardless of whether this layer is skipped for actual drawing or not. Therefore // we traverse recursively over all layers, not just the render surface list. - if (!layer->updateRect().isEmpty() && layer->drawsContent()) - m_debugRects.append(CCDebugRect(PaintRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), layer->updateRect()))); + if (!layer->updateRect().isEmpty() && layer->drawsContent()) { + FloatRect updateContentRect = layer->updateRect(); + updateContentRect.scale(layer->contentBounds().width() / static_cast<float>(layer->bounds().width()), layer->contentBounds().height() / static_cast<float>(layer->bounds().height())); + m_debugRects.append(CCDebugRect(PaintRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), updateContentRect))); + } for (unsigned i = 0; i < layer->children().size(); ++i) savePaintRects(layer->children()[i].get()); @@ -93,8 +91,11 @@ void CCDebugRectHistory::savePropertyChangedRects(const Vector<CCLayerImpl*>& re if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<CCLayerImpl>(layer, renderSurfaceLayer->id())) continue; - if (layer->layerPropertyChanged()) - m_debugRects.append(CCDebugRect(PropertyChangedRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->bounds())))); + if (layer->layerIsAlwaysDamaged()) + continue; + + if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged()) + m_debugRects.append(CCDebugRect(PropertyChangedRectType, CCMathUtil::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())))); } } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.h b/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.h index 7fd00c3f6..2405aa0e2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDebugRectHistory.h @@ -79,8 +79,6 @@ public: return adoptPtr(new CCDebugRectHistory()); } - bool enabled(const CCLayerTreeSettings&); - // Note: Saving debug rects must happen before layers' change tracking is reset. void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp index 0f6f6ee0e..066fdc84d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp @@ -1,113 +1,126 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#if USE(ACCELERATED_COMPOSITING) -#include "cc/CCHeadsUpDisplay.h" +#include "cc/CCHeadsUpDisplayLayerImpl.h" #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" #include "PlatformCanvas.h" #include "cc/CCDebugRectHistory.h" +#include "cc/CCFontAtlas.h" #include "cc/CCFrameRateCounter.h" #include "cc/CCLayerTreeHostImpl.h" +#include "cc/CCQuadSink.h" +#include <public/WebCompositorTextureQuad.h> #include <wtf/text/WTFString.h> -namespace WebCore { +using WebKit::WebCompositorTextureQuad; -using namespace std; +namespace WebCore { -CCHeadsUpDisplay::~CCHeadsUpDisplay() +CCHeadsUpDisplayLayerImpl::CCHeadsUpDisplayLayerImpl(int id, PassOwnPtr<CCFontAtlas> fontAtlas) + : CCLayerImpl(id), + m_fontAtlas(fontAtlas) { } -void CCHeadsUpDisplay::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) +CCHeadsUpDisplayLayerImpl::~CCHeadsUpDisplayLayerImpl() { - m_fontAtlas = fontAtlas; } -bool CCHeadsUpDisplay::enabled(const CCLayerTreeSettings& settings) const +void CCHeadsUpDisplayLayerImpl::willDraw(CCResourceProvider* resourceProvider) { - return showPlatformLayerTree(settings) || settings.showFPSCounter || showDebugRects(settings); -} + CCLayerImpl::willDraw(resourceProvider); -bool CCHeadsUpDisplay::showPlatformLayerTree(const CCLayerTreeSettings& settings) const -{ - return settings.showPlatformLayerTree; -} + if (!m_hudTexture) + m_hudTexture = CCScopedTexture::create(resourceProvider); -bool CCHeadsUpDisplay::showDebugRects(const CCLayerTreeSettings& settings) const -{ - return settings.showPaintRects || settings.showPropertyChangedRects || settings.showSurfaceDamageRects || settings.showScreenSpaceRects || settings.showReplicaScreenSpaceRects || settings.showOccludingRects; -} + // FIXME: Scale the HUD by deviceScale to make it more friendly under high DPI. -void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) -{ - CCRenderer* layerRenderer = layerTreeHostImpl->layerRenderer(); - if (!m_hudTexture) - m_hudTexture = CCScopedTexture::create(layerTreeHostImpl->resourceProvider()); - - const CCLayerTreeSettings& settings = layerTreeHostImpl->settings(); - // Use a fullscreen texture only if we need to... - IntSize hudSize; - if (showPlatformLayerTree(settings) || showDebugRects(settings)) { - hudSize.setWidth(min(2048, layerTreeHostImpl->deviceViewportSize().width())); - hudSize.setHeight(min(2048, layerTreeHostImpl->deviceViewportSize().height())); - } else { - hudSize.setWidth(512); - hudSize.setHeight(128); - } + if (m_hudTexture->size() != bounds()) + m_hudTexture->free(); - if (!m_hudTexture->id() && !m_hudTexture->allocate(CCRenderer::ImplPool, hudSize, GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) + if (!m_hudTexture->id() && !m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) return; // Render pixels into the texture. PlatformCanvas canvas; - canvas.resize(hudSize); + canvas.resize(bounds()); { PlatformCanvas::Painter painter(&canvas, PlatformCanvas::Painter::GrayscaleText); - painter.context()->clearRect(FloatRect(0, 0, hudSize.width(), hudSize.height())); - drawHudContents(painter.context(), layerTreeHostImpl, settings, hudSize); + painter.context()->clearRect(FloatRect(0, 0, bounds().width(), bounds().height())); + drawHudContents(painter.context()); } - // Upload to GL. { PlatformCanvas::AutoLocker locker(&canvas); - IntRect rect(IntPoint(0, 0), hudSize); - layerTreeHostImpl->resourceProvider()->upload(m_hudTexture->id(), locker.pixels(), rect, rect, rect); + IntRect layerRect(IntPoint(), bounds()); + resourceProvider->upload(m_hudTexture->id(), locker.pixels(), layerRect, layerRect, layerRect); } +} - layerRenderer->drawHeadsUpDisplay(m_hudTexture.get(), hudSize); +void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +{ + if (!m_hudTexture->id()) + return; + + IntRect quadRect(IntPoint(), bounds()); + bool premultipliedAlpha = true; + FloatRect uvRect(0, 0, 1, 1); + bool flipped = false; + quadList.append(WebCompositorTextureQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped)); } -void CCHeadsUpDisplay::drawHudContents(GraphicsContext* context, CCLayerTreeHostImpl* layerTreeHostImpl, const CCLayerTreeSettings& settings, const IntSize& hudSize) +void CCHeadsUpDisplayLayerImpl::didDraw(CCResourceProvider* resourceProvider) { - if (showPlatformLayerTree(settings)) { + CCLayerImpl::didDraw(resourceProvider); + + if (!m_hudTexture->id()) + return; + + // FIXME: the following assert will not be true when sending resources to a + // parent compositor. We will probably need to hold on to m_hudTexture for + // longer, and have several HUD textures in the pipeline. + ASSERT(!resourceProvider->inUseByConsumer(m_hudTexture->id())); +} + +void CCHeadsUpDisplayLayerImpl::didLoseContext() +{ + m_hudTexture->leak(); +} + +void CCHeadsUpDisplayLayerImpl::drawHudContents(GraphicsContext* context) +{ + const CCLayerTreeSettings& settings = layerTreeHostImpl()->settings(); + + if (settings.showPlatformLayerTree) { context->setFillColor(Color(0, 0, 0, 192), ColorSpaceDeviceRGB); - context->fillRect(FloatRect(0, 0, hudSize.width(), hudSize.height())); + context->fillRect(FloatRect(0, 0, bounds().width(), bounds().height())); } int fpsCounterHeight = 40; @@ -120,18 +133,18 @@ void CCHeadsUpDisplay::drawHudContents(GraphicsContext* context, CCLayerTreeHost platformLayerTreeTop = 0; if (settings.showFPSCounter) - drawFPSCounter(context, layerTreeHostImpl->fpsCounter(), fpsCounterTop, fpsCounterHeight); + drawFPSCounter(context, layerTreeHostImpl()->fpsCounter(), fpsCounterTop, fpsCounterHeight); - if (showPlatformLayerTree(settings) && m_fontAtlas) { - String layerTree = layerTreeHostImpl->layerTreeAsText(); - m_fontAtlas->drawText(context, layerTree, IntPoint(2, platformLayerTreeTop), hudSize); + if (settings.showPlatformLayerTree && m_fontAtlas) { + String layerTree = layerTreeHostImpl()->layerTreeAsText(); + m_fontAtlas->drawText(context, layerTree, IntPoint(2, platformLayerTreeTop), bounds()); } - if (showDebugRects(settings)) - drawDebugRects(context, layerTreeHostImpl->debugRectHistory(), settings); + if (settings.showDebugRects()) + drawDebugRects(context, layerTreeHostImpl()->debugRectHistory()); } -void CCHeadsUpDisplay::drawFPSCounter(GraphicsContext* context, CCFrameRateCounter* fpsCounter, int top, int height) +void CCHeadsUpDisplayLayerImpl::drawFPSCounter(GraphicsContext* context, CCFrameRateCounter* fpsCounter, int top, int height) { float textWidth = 170; // so text fits on linux. float graphWidth = fpsCounter->timeStampHistorySize(); @@ -182,7 +195,7 @@ void CCHeadsUpDisplay::drawFPSCounter(GraphicsContext* context, CCFrameRateCount } } -void CCHeadsUpDisplay::drawFPSCounterText(GraphicsContext* context, CCFrameRateCounter* fpsCounter, int top, int width, int height) +void CCHeadsUpDisplayLayerImpl::drawFPSCounterText(GraphicsContext* context, CCFrameRateCounter* fpsCounter, int top, int width, int height) { double averageFPS, stdDeviation; fpsCounter->getAverageFPSAndStandardDeviation(averageFPS, stdDeviation); @@ -196,7 +209,7 @@ void CCHeadsUpDisplay::drawFPSCounterText(GraphicsContext* context, CCFrameRateC m_fontAtlas->drawText(context, String::format("FPS: %4.1f +/- %3.1f", averageFPS, stdDeviation), IntPoint(10, height / 3), IntSize(width, height)); } -void CCHeadsUpDisplay::drawDebugRects(GraphicsContext* context, CCDebugRectHistory* debugRectHistory, const CCLayerTreeSettings& settings) +void CCHeadsUpDisplayLayerImpl::drawDebugRects(GraphicsContext* context, CCDebugRectHistory* debugRectHistory) { const Vector<CCDebugRect>& debugRects = debugRectHistory->debugRects(); for (size_t i = 0; i < debugRects.size(); ++i) { @@ -246,5 +259,3 @@ void CCHeadsUpDisplay::drawDebugRects(GraphicsContext* context, CCDebugRectHisto } } - -#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h index 266bf51e1..78378a5fe 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h @@ -1,78 +1,71 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CCHeadsUpDisplay_h -#define CCHeadsUpDisplay_h - -#if USE(ACCELERATED_COMPOSITING) +#ifndef CCHeadsUpDisplayLayerImpl_h +#define CCHeadsUpDisplayLayerImpl_h -#include "cc/CCFontAtlas.h" +#include "cc/CCLayerImpl.h" #include "cc/CCScopedTexture.h" namespace WebCore { class CCDebugRectHistory; +class CCFontAtlas; class CCFrameRateCounter; -class CCLayerTreeHostImpl; class GraphicsContext; -class TexureAllocator; -struct CCLayerTreeSettings; - -// Class that handles drawing of composited render layers using GL. -class CCHeadsUpDisplay { - WTF_MAKE_NONCOPYABLE(CCHeadsUpDisplay); +class CCHeadsUpDisplayLayerImpl : public CCLayerImpl { public: - static PassOwnPtr<CCHeadsUpDisplay> create() + static PassOwnPtr<CCHeadsUpDisplayLayerImpl> create(int id, PassOwnPtr<CCFontAtlas> fontAtlas) { - return adoptPtr(new CCHeadsUpDisplay()); + return adoptPtr(new CCHeadsUpDisplayLayerImpl(id, fontAtlas)); } + virtual ~CCHeadsUpDisplayLayerImpl(); - ~CCHeadsUpDisplay(); + virtual void willDraw(CCResourceProvider*) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void didDraw(CCResourceProvider*) OVERRIDE; - void setFontAtlas(PassOwnPtr<CCFontAtlas>); + virtual void didLoseContext() OVERRIDE; - bool enabled(const CCLayerTreeSettings&) const; - void draw(CCLayerTreeHostImpl*); + virtual bool layerIsAlwaysDamaged() const OVERRIDE { return true; } private: - CCHeadsUpDisplay() { }; + CCHeadsUpDisplayLayerImpl(int, PassOwnPtr<CCFontAtlas>); + + virtual const char* layerTypeAsString() const OVERRIDE { return "HeadsUpDisplayLayer"; } - void drawHudContents(GraphicsContext*, CCLayerTreeHostImpl*, const CCLayerTreeSettings&, const IntSize& hudSize); + void drawHudContents(GraphicsContext*); void drawFPSCounter(GraphicsContext*, CCFrameRateCounter*, int top, int height); void drawFPSCounterText(GraphicsContext*, CCFrameRateCounter*, int top, int width, int height); - void drawDebugRects(GraphicsContext*, CCDebugRectHistory*, const CCLayerTreeSettings&); + void drawDebugRects(GraphicsContext*, CCDebugRectHistory*); - bool showPlatformLayerTree(const CCLayerTreeSettings&) const; - bool showDebugRects(const CCLayerTreeSettings&) const; - - OwnPtr<CCScopedTexture> m_hudTexture; OwnPtr<CCFontAtlas> m_fontAtlas; + OwnPtr<CCScopedTexture> m_hudTexture; }; } -#endif // USE(ACCELERATED_COMPOSITING) - -#endif +#endif // CCHeadsUpDisplayLayerImpl_h diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 8a05a8807..2b6ef9177 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -50,7 +50,6 @@ CCLayerImpl::CCLayerImpl(int id) , m_layerTreeHostImpl(0) , m_anchorPoint(0.5, 0.5) , m_anchorPointZ(0) - , m_contentsScale(1) , m_scrollable(false) , m_shouldScrollOnMainThread(false) , m_haveWheelEventHandlers(false) @@ -146,14 +145,7 @@ bool CCLayerImpl::descendantDrawsContent() PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState(int id) const { - WebTransformationMatrix quadTransformation = drawTransform(); - if (!contentBounds().isEmpty() && !bounds().isEmpty()) { - quadTransformation.scaleNonUniform(bounds().width() / static_cast<double>(contentBounds().width()), - bounds().height() / static_cast<double>(contentBounds().height())); - quadTransformation.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0); - } - - return CCSharedQuadState::create(id, quadTransformation, m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); + return CCSharedQuadState::create(id, m_drawTransform, m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); } void CCLayerImpl::willDraw(CCResourceProvider*) @@ -232,15 +224,6 @@ CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo return CCInputHandlerClient::ScrollStarted; } -const IntRect CCLayerImpl::getDrawRect() const -{ - // Form the matrix used by the shader to map the corners of the layer's - // bounds into the view space. - FloatRect layerRect(-0.5 * bounds().width(), -0.5 * bounds().height(), bounds().width(), bounds().height()); - IntRect mappedRect = enclosingIntRect(CCMathUtil::mapClippedRect(drawTransform(), layerRect)); - return mappedRect; -} - void CCLayerImpl::writeIndent(TextStream& ts, int indent) { for (int i = 0; i != indent; ++i) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index 25bedc220..decddff7a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -187,9 +187,6 @@ public: const IntSize& contentBounds() const { return m_contentBounds; } void setContentBounds(const IntSize&); - void setContentsScale(float contentsScale) { m_contentsScale = contentsScale; } - float contentsScale() const { return m_contentsScale; } - const IntPoint& scrollPosition() const { return m_scrollPosition; } void setScrollPosition(const IntPoint&); @@ -230,9 +227,6 @@ public: bool doubleSided() const { return m_doubleSided; } void setDoubleSided(bool); - // Returns the rect containtaining this layer in the current view's coordinate system. - const IntRect getDrawRect() const; - void setTransform(const WebKit::WebTransformationMatrix&); bool transformIsAnimating() const; @@ -255,11 +249,13 @@ public: void setStackingOrderChanged(bool); - bool layerPropertyChanged() const { return m_layerPropertyChanged; } + bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIsAlwaysDamaged(); } bool layerSurfacePropertyChanged() const; void resetAllChangeTrackingForSubtree(); + virtual bool layerIsAlwaysDamaged() const { return false; } + CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); } virtual Region visibleContentOpaqueRegion() const; @@ -305,7 +301,6 @@ private: float m_anchorPointZ; IntSize m_bounds; IntSize m_contentBounds; - float m_contentsScale; IntPoint m_scrollPosition; bool m_scrollable; bool m_shouldScrollOnMainThread; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp index fdf3c7bb2..48802d667 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp @@ -154,10 +154,7 @@ CCLayerSorter::ABCompareResult CCLayerSorter::checkOverlap(LayerShape* a, LayerS CCLayerSorter::LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& drawTransform) { - FloatQuad layerQuad(FloatPoint(-width * 0.5, height * 0.5), - FloatPoint(width * 0.5, height * 0.5), - FloatPoint(width * 0.5, -height * 0.5), - FloatPoint(-width * 0.5, -height * 0.5)); + FloatQuad layerQuad(FloatRect(0, 0, width, height)); // Compute the projection of the layer quad onto the z = 0 plane. @@ -245,8 +242,8 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera layerHeight = renderSurface->contentRect().height(); } else { drawTransform = node.layer->drawTransform(); - layerWidth = node.layer->bounds().width(); - layerHeight = node.layer->bounds().height(); + layerWidth = node.layer->contentBounds().width(); + layerHeight = node.layer->contentBounds().height(); } node.shape = LayerShape(layerWidth, layerHeight, drawTransform); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index d2a79eb1b..ff97cf3c4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -26,6 +26,7 @@ #include "cc/CCLayerTreeHost.h" +#include "HeadsUpDisplayLayerChromium.h" #include "LayerChromium.h" #include "Region.h" #include "TraceEvent.h" @@ -38,7 +39,6 @@ #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCOcclusionTracker.h" #include "cc/CCOverdrawMetrics.h" -#include "cc/CCRenderingStats.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" #include "cc/CCThreadProxy.h" @@ -72,8 +72,8 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre , m_animating(false) , m_needsAnimateLayers(false) , m_client(client) - , m_animationFrameNumber(0) , m_commitNumber(0) + , m_renderingStats() , m_layerRendererInitialized(false) , m_contextLost(false) , m_numTimesRecreateShouldFail(0) @@ -106,14 +106,6 @@ bool CCLayerTreeHost::initialize() if (!m_proxy->initializeContext()) return false; - // Only allocate the font atlas if we have reason to use the heads-up display. - if (m_settings.showFPSCounter || m_settings.showPlatformLayerTree) { - TRACE_EVENT0("cc", "CCLayerTreeHost::initialize::initializeFontAtlas"); - OwnPtr<CCFontAtlas> fontAtlas(CCFontAtlas::create()); - fontAtlas->initialize(); - m_proxy->setFontAtlas(fontAtlas.release()); - } - m_compositorIdentifier = m_proxy->compositorIdentifier(); return true; } @@ -217,7 +209,7 @@ void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) animateLayers(monotonicFrameBeginTime); m_animating = false; - m_animationFrameNumber++; + m_renderingStats.numAnimationFrames++; } void CCLayerTreeHost::layout() @@ -259,8 +251,20 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) m_commitNumber++; } +void CCLayerTreeHost::willCommit() +{ + m_client->willCommit(); + if (m_rootLayer && m_settings.showDebugInfo()) { + if (!m_hudLayer) + m_hudLayer = HeadsUpDisplayLayerChromium::create(m_settings, layerRendererCapabilities().maxTextureSize); + m_rootLayer->addChild(m_hudLayer); + } +} + void CCLayerTreeHost::commitComplete() { + if (m_hudLayer) + m_hudLayer->removeFromParent(); m_deleteTextureAfterCommitList.clear(); m_client->didCommit(); } @@ -303,8 +307,8 @@ void CCLayerTreeHost::finishAllRendering() void CCLayerTreeHost::renderingStats(CCRenderingStats& stats) const { + stats = m_renderingStats; m_proxy->implSideRenderingStats(stats); - stats.numAnimationFrames = animationFrameNumber(); } const LayerRendererCapabilities& CCLayerTreeHost::layerRendererCapabilities() const @@ -463,24 +467,13 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u { TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); - if (!rootLayer->renderSurface()) - rootLayer->createRenderSurface(); - rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(0, 0), deviceViewportSize())); - LayerList updateList; - updateList.append(rootLayer); - - RenderSurfaceChromium* rootRenderSurface = rootLayer->renderSurface(); - rootRenderSurface->clearLayerList(); { TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); - WebTransformationMatrix identityMatrix; - WebTransformationMatrix deviceScaleTransform; - deviceScaleTransform.scale(m_deviceScaleFactor); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, updateList, rootRenderSurface->layerList(), layerRendererCapabilities().maxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, layerRendererCapabilities().maxTextureSize, updateList); - FloatRect rootScissorRect(FloatPoint(0, 0), viewportSize()); + FloatRect rootScissorRect(FloatPoint(0, 0), deviceViewportSize()); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(updateList, rootScissorRect); } @@ -572,13 +565,13 @@ bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLay bool needMoreUpdates = false; LayerChromium* maskLayer = renderSurfaceLayer->maskLayer(); if (maskLayer) { - maskLayer->update(updater, 0); + maskLayer->update(updater, 0, m_renderingStats); needMoreUpdates |= maskLayer->needMoreUpdates(); } LayerChromium* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0; if (replicaMaskLayer) { - replicaMaskLayer->update(updater, 0); + replicaMaskLayer->update(updater, 0, m_renderingStats); needMoreUpdates |= replicaMaskLayer->needMoreUpdates(); } return needMoreUpdates; @@ -605,7 +598,7 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList needMoreUpdates |= paintMasksForRenderSurface(*it, updater); } else if (it.representsItself()) { ASSERT(!it->bounds().isEmpty()); - it->update(updater, &occlusionTracker); + it->update(updater, &occlusionTracker, m_renderingStats); needMoreUpdates |= it->needMoreUpdates(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index 839785905..8a228f1a2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -36,6 +36,7 @@ #include "cc/CCOcclusionTracker.h" #include "cc/CCPrioritizedTextureManager.h" #include "cc/CCProxy.h" +#include "cc/CCRenderingStats.h" #include <limits> @@ -53,7 +54,6 @@ class CCLayerTreeHostImplClient; class CCTextureUpdater; class Region; class CCPrioritizedTextureManager; -struct CCRenderingStats; struct CCScrollAndScaleSet; class CCLayerTreeHostClient { @@ -112,6 +112,9 @@ struct CCLayerTreeSettings { IntSize defaultTileSize; IntSize maxUntiledLayerSize; IntSize minimumOcclusionTrackingSize; + + bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter || showDebugRects(); } + bool showDebugRects() const { return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects; } }; // Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost @@ -168,6 +171,7 @@ public: void layout(); void beginCommitOnImplThread(CCLayerTreeHostImpl*); void finishCommitOnImplThread(CCLayerTreeHostImpl*); + void willCommit(); void commitComplete(); PassOwnPtr<CCGraphicsContext> createContext(); virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*); @@ -178,7 +182,6 @@ public: RecreateFailedAndGaveUp, }; RecreateResult recreateContext(); - void willCommit() { m_client->willCommit(); } void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } void deleteContentsTexturesOnImplThread(CCResourceProvider*); @@ -202,8 +205,6 @@ public: void finishAllRendering(); - int animationFrameNumber() const { return m_animationFrameNumber; } - int commitNumber() const { return m_commitNumber; } void renderingStats(CCRenderingStats&) const; @@ -278,7 +279,7 @@ private: void initializeLayerRenderer(); - static void update(LayerChromium*, CCTextureUpdater&, const CCOcclusionTracker*); + void update(LayerChromium*, CCTextureUpdater&, const CCOcclusionTracker*); bool paintLayerContents(const LayerList&, CCTextureUpdater&); bool paintMasksForRenderSurface(LayerChromium*, CCTextureUpdater&); @@ -300,8 +301,8 @@ private: CCLayerTreeHostClient* m_client; - int m_animationFrameNumber; int m_commitNumber; + CCRenderingStats m_renderingStats; OwnPtr<CCProxy> m_proxy; bool m_layerRendererInitialized; @@ -310,6 +311,7 @@ private: int m_numFailedRecreateAttempts; RefPtr<LayerChromium> m_rootLayer; + RefPtr<LayerChromium> m_hudLayer; OwnPtr<CCPrioritizedTextureManager> m_contentsTextureManager; OwnPtr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp index 343766a6a..1836f6315 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp @@ -177,18 +177,8 @@ static IntRect calculateVisibleContentRect(LayerType* layer) if (targetSurfaceRect.isEmpty() || layer->contentBounds().isEmpty()) return IntRect(); - // Note carefully these are aliases - const IntSize& bounds = layer->bounds(); - const IntSize& contentBounds = layer->contentBounds(); - - const IntRect layerBoundRect = IntRect(IntPoint(), contentBounds); - WebTransformationMatrix transform = layer->drawTransform(); - - transform.scaleNonUniform(bounds.width() / static_cast<double>(contentBounds.width()), - bounds.height() / static_cast<double>(contentBounds.height())); - transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); - - IntRect visibleContentRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform); + const IntRect contentRect = IntRect(IntPoint(), layer->contentBounds()); + IntRect visibleContentRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, contentRect, layer->drawTransform()); return visibleContentRect; } @@ -394,11 +384,25 @@ WebTransformationMatrix computeScrollCompensationMatrixForChildren(CCLayerImpl* // Step 2: apply the scroll compensation // Step 3: transform back to the new surface. if (layer->renderSurface() && !nextScrollCompensationMatrix.isIdentity()) - nextScrollCompensationMatrix = layer->renderSurface()->originTransform().inverse() * nextScrollCompensationMatrix * layer->renderSurface()->originTransform(); + nextScrollCompensationMatrix = layer->renderSurface()->drawTransform().inverse() * nextScrollCompensationMatrix * layer->renderSurface()->drawTransform(); return nextScrollCompensationMatrix; } +// Should be called just before the recursive calculateDrawTransformsInternal(). +template<typename LayerType, typename LayerList> +void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& renderSurfaceLayerList, const IntSize& deviceViewportSize) +{ + if (!rootLayer->renderSurface()) + rootLayer->createRenderSurface(); + + rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceViewportSize)); + rootLayer->renderSurface()->clearLayerList(); + + ASSERT(renderSurfaceLayerList.isEmpty()); + renderSurfaceLayerList.append(rootLayer); +} + // Recursively walks the layer tree starting at the given node and computes all the // necessary transformations, clipRects, render surfaces, etc. template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter> @@ -406,7 +410,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix, const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList, - LayerSorter* layerSorter, int maxTextureSize, IntRect& drawableContentRectOfSubtree) + LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, IntRect& drawableContentRectOfSubtree) { // This function computes the new matrix transformations recursively for this // layer and all its descendants. It also computes the appropriate render surfaces. @@ -433,6 +437,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // M[layer] is the layer's matrix (applied at the anchor point) // M[sublayer] is the layer's sublayer transform (applied at the layer's center) // Tr[anchor2center] is the translation offset from the anchor point and the center of the layer + // S[content2layer] is the ratio of a layer's contentBounds() to its bounds(). // // Some shortcuts and substitutions are used in the code to reduce matrix multiplications: // Tr[anchor2center] = Tr[origin2anchor].inverse() * Tr[origin2center] @@ -453,16 +458,16 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // Using these definitions, then: // // The draw transform for the layer is: - // M[draw] = M[parent] * Tr[origin] * compositeLayerTransform * Tr[origin2center] - // = M[parent] * Tr[layer->position()] * M[layer] * Tr[anchor2center] + // M[draw] = M[parent] * Tr[origin] * compositeLayerTransform * S[content2layer] + // = M[parent] * Tr[layer->position()] * M[layer] * Tr[anchor2origin] * S[content2layer] // - // Interpreting the math left-to-right, this transforms from the layer's render surface to the center of the layer. + // Interpreting the math left-to-right, this transforms from the layer's render surface to the origin of the layer in content space. // // The screen space transform is: - // M[screenspace] = M[root] * Tr[origin] * compositeLayerTransform - // = M[root] * Tr[layer->position()] * M[layer] * Tr[origin2anchor].inverse() + // M[screenspace] = M[root] * Tr[origin] * compositeLayerTransform * S[content2layer] + // = M[root] * Tr[layer->position()] * M[layer] * Tr[origin2anchor].inverse() * S[content2layer] // - // Interpreting the math left-to-right, this transforms from the root layer space to the local layer's origin. + // Interpreting the math left-to-right, this transforms from the root render surface's content space to the local layer's origin in layer space. // // The transform hierarchy that is passed on to children (i.e. the child's parentMatrix) is: // M[parent]_for_child = M[parent] * Tr[origin] * compositeLayerTransform * compositeSublayerTransform @@ -479,22 +484,18 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // When a render surface has a replica layer, that layer's transform is used to draw a second copy of the surface. // Transforms named here are relative to the surface, unless they specify they are relative to the replica layer. // - // We will denote a scale by contents scale S[contentsScale] + // We will denote a scale by device scale S[deviceScale] // - // The render surface origin transform to its target surface origin is: - // M[surfaceOrigin] = M[owningLayer->Draw] * S[contentsScale].inverse() * Tr[origin2centerInScreenSpace].inverse() + // The render surface draw transform to its target surface origin is: + // M[surfaceDraw] = M[owningLayer->Draw] // // The render surface origin transform to its the root (screen space) origin is: - // M[surface2root] = M[owningLayer->screenspace] * S[contentsScale].inverse() + // M[surface2root] = M[owningLayer->screenspace] * S[deviceScale].inverse() // - // The replica draw transform is: - // M[replicaDraw] = M[surfaceOrigin] * S[contentsScale] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[anchor2center] * S[contentsScale].inverse() - // = M[owningLayer->draw] * Tr[origin2center].inverse() * S[contentsScale] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[anchor2clippedCenter] * S[contentsScale].inverse() + // The replica draw transform to its target surface origin is: + // M[replicaDraw] = S[deviceScale] * M[surfaceDraw] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].inverse() // - // The replica origin transform to its target surface origin is: - // M[replicaOrigin] = S[contentsScale] * M[surfaceOrigin] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].invers() - // - // The replica origin transform to the root (screen space) origin is: + // The replica draw transform to the root (screen space) origin is: // M[replica2root] = M[surface2root] * Tr[replica->position()] * Tr[replica] * Tr[origin2anchor].inverse() // @@ -532,8 +533,6 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // LT = S[pageScaleDelta] * Tr[origin] * Tr[origin2anchor] * M[layer] * Tr[anchor2center] layerLocalTransform.translate3d(centerOffsetX, centerOffsetY, -layer->anchorPointZ()); - // The combinedTransform that gets computed below is effectively the layer's drawTransform, unless - // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms. WebTransformationMatrix combinedTransform = parentMatrix; combinedTransform.multiply(layerLocalTransform); @@ -544,6 +543,22 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay combinedTransform = currentScrollCompensationMatrix * combinedTransform; } + // The drawTransform that gets computed below is effectively the layer's drawTransform, unless + // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms. + WebTransformationMatrix drawTransform = combinedTransform; + if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { + // M[draw] = M[parent] * LT * Tr[anchor2center] * Tr[center2anchor] + drawTransform.translate(-layer->bounds().width() / 2.0, -layer->bounds().height() / 2.0); + // M[draw] = M[parent] * LT * Tr[anchor2origin] * S[content2layer] + drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()), + layer->bounds().height() / static_cast<double>(layer->contentBounds().height())); + } + + // layerScreenSpaceTransform represents the transform between root layer's "screen space" and local content space. + WebTransformationMatrix layerScreenSpaceTransform = fullHierarchyMatrix; + layerScreenSpaceTransform.multiply(drawTransform); + layer->setScreenSpaceTransform(layerScreenSpaceTransform); + bool animatingTransformToTarget = layer->transformIsAnimating(); bool animatingTransformToScreen = animatingTransformToTarget; if (layer->parent()) { @@ -551,14 +566,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating(); } - float contentsScale = layer->contentsScale(); - - FloatRect layerRect(-0.5 * layer->bounds().width(), -0.5 * layer->bounds().height(), layer->bounds().width(), layer->bounds().height()); - IntRect transformedLayerRect; + FloatRect contentRect(FloatPoint(), layer->contentBounds()); // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurface's space. // nextHierarchyMatrix will only change if this layer uses a new RenderSurface, otherwise remains the same. WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix; + WebTransformationMatrix sublayerMatrix; if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combinedTransform))) { // Check back-face visibility before continuing with this surface and its subtree @@ -572,12 +585,20 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay renderSurface->clearLayerList(); // The origin of the new surface is the upper left corner of the layer. - WebTransformationMatrix drawTransform; - drawTransform.scale(contentsScale); - drawTransform.translate3d(0.5 * bounds.width(), 0.5 * bounds.height(), 0); - layer->setDrawTransform(drawTransform); + renderSurface->setDrawTransform(drawTransform); + WebTransformationMatrix layerDrawTransform; + layerDrawTransform.scale(deviceScaleFactor); + if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { + layerDrawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()), + layer->bounds().height() / static_cast<double>(layer->contentBounds().height())); + } + layer->setDrawTransform(layerDrawTransform); - transformedLayerRect = IntRect(0, 0, contentsScale * bounds.width(), contentsScale * bounds.height()); + // The sublayer matrix transforms centered layer rects into target + // surface content space. + sublayerMatrix.makeIdentity(); + sublayerMatrix.scale(deviceScaleFactor); + sublayerMatrix.translate(0.5 * bounds.width(), 0.5 * bounds.height()); // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity. renderSurface->setDrawOpacity(drawOpacity); @@ -585,27 +606,15 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay layer->setDrawOpacity(1); layer->setDrawOpacityIsAnimating(false); - WebTransformationMatrix surfaceOriginTransform = combinedTransform; - // The surfaceOriginTransform transforms points in the surface's content space - // to its parent's content space. Distances in these spaces are both in physical - // pixels, so we need to 'undo' the scale by contentsScale. Ultimately, the - // transform should map (0, 0) to contentsScale * position, and preserve distances. - // Note, the following two lines are not equivalent to translating by (bounds.width(), - // bounds.height). The effect on m41 and m42 would be identical, but the scale - // affects the entire matrix. We need to scale these other entries to avoid - // double scaling; we must remain in physical pixels. - surfaceOriginTransform.scale(1 / contentsScale); - surfaceOriginTransform.translate3d(-0.5 * transformedLayerRect.width(), -0.5 * transformedLayerRect.height(), 0); - renderSurface->setOriginTransform(surfaceOriginTransform); - renderSurface->setTargetSurfaceTransformsAreAnimating(animatingTransformToTarget); renderSurface->setScreenSpaceTransformsAreAnimating(animatingTransformToScreen); animatingTransformToTarget = false; layer->setDrawTransformIsAnimating(animatingTransformToTarget); layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); - // Update the aggregate hierarchy matrix to include the transform of the newly created RenderSurface. - nextHierarchyMatrix.multiply(surfaceOriginTransform); + // Update the aggregate hierarchy matrix to include the transform of the + // newly created RenderSurface. + nextHierarchyMatrix.multiply(renderSurface->drawTransform()); // The new renderSurface here will correctly clip the entire subtree. So, we do // not need to continue propagating the clipping state further down the tree. This @@ -626,10 +635,10 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay renderSurfaceLayerList.append(layer); } else { - layer->setDrawTransform(combinedTransform); + layer->setDrawTransform(drawTransform); layer->setDrawTransformIsAnimating(animatingTransformToTarget); layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); - transformedLayerRect = enclosingIntRect(CCMathUtil::mapClippedRect(layer->drawTransform(), layerRect)); + sublayerMatrix = combinedTransform; layer->setDrawOpacity(drawOpacity); layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating); @@ -642,7 +651,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay subtreeShouldBeClipped = ancestorClipsSubtree; if (ancestorClipsSubtree) clipRectForSubtree = clipRectFromAncestor; - + // Layers that are not their own renderTarget will render into the target of their nearest ancestor. layer->setRenderTarget(layer->parent()->renderTarget()); } else { @@ -658,24 +667,17 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay } } + IntRect rectInTargetSpace = enclosingIntRect(CCMathUtil::mapClippedRect(layer->drawTransform(), contentRect)); + if (layerClipsSubtree(layer)) { subtreeShouldBeClipped = true; if (ancestorClipsSubtree && !layer->renderSurface()) { clipRectForSubtree = clipRectFromAncestor; - clipRectForSubtree.intersect(transformedLayerRect); + clipRectForSubtree.intersect(rectInTargetSpace); } else - clipRectForSubtree = transformedLayerRect; + clipRectForSubtree = rectInTargetSpace; } - // Note that at this point, layer->drawTransform() is not necessarily the same as local variable drawTransform. - // layerScreenSpaceTransform represents the transform between root layer's "screen space" and local layer space. - WebTransformationMatrix layerScreenSpaceTransform = nextHierarchyMatrix; - layerScreenSpaceTransform.multiply(layer->drawTransform()); - layerScreenSpaceTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.height(), 0); - layer->setScreenSpaceTransform(layerScreenSpaceTransform); - - WebTransformationMatrix sublayerMatrix = layer->drawTransform(); - // Flatten to 2D if the layer doesn't preserve 3D. if (!layer->preserves3D()) { sublayerMatrix.setM13(0); @@ -709,7 +711,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay IntRect drawableContentRectOfChildSubtree; calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels, - renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, drawableContentRectOfChildSubtree); + renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, drawableContentRectOfChildSubtree); if (!drawableContentRectOfChildSubtree.isEmpty()) { accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOfChildSubtree); if (child->renderSurface()) @@ -720,12 +722,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // Compute the total drawableContentRect for this subtree (the rect is in targetSurface space) IntRect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOfChildren; if (layer->drawsContent()) - localDrawableContentRectOfSubtree.unite(transformedLayerRect); + localDrawableContentRectOfSubtree.unite(rectInTargetSpace); if (subtreeShouldBeClipped) localDrawableContentRectOfSubtree.intersect(clipRectForSubtree); // Compute the layer's drawable content rect (the rect is in targetSurface space) - IntRect drawableContentRectOfLayer = transformedLayerRect; + IntRect drawableContentRectOfLayer = rectInTargetSpace; if (subtreeShouldBeClipped) drawableContentRectOfLayer.intersect(clipRectForSubtree); layer->setDrawableContentRect(drawableContentRectOfLayer); @@ -734,7 +736,6 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay if (layer->renderSurface() && layer != rootLayer) { RenderSurfaceType* renderSurface = layer->renderSurface(); IntRect clippedContentRect = localDrawableContentRectOfSubtree; - FloatPoint surfaceCenter = FloatRect(clippedContentRect).center(); // The render surface clipRect is expressed in the space where this surface draws, i.e. the same space as clipRectFromAncestor. if (ancestorClipsSubtree) @@ -742,9 +743,6 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay else renderSurface->setClipRect(IntRect()); - // Restrict the RenderSurface size to the portion that's visible. - FloatSize centerOffsetDueToClipping; - // Don't clip if the layer is reflected as the reflection shouldn't be // clipped. If the layer is animating, then the surface's transform to // its target is not known on the main thread, and we should not use it @@ -752,11 +750,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay if (!layer->replicaLayer() && transformToParentIsKnown(layer)) { // Note, it is correct to use ancestorClipsSubtree here, because we are looking at this layer's renderSurface, not the layer itself. if (ancestorClipsSubtree && !clippedContentRect.isEmpty()) { - IntRect surfaceClipRect = CCLayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->originTransform()); + IntRect surfaceClipRect = CCLayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->drawTransform()); clippedContentRect.intersect(surfaceClipRect); } - FloatPoint clippedSurfaceCenter = FloatRect(clippedContentRect).center(); - centerOffsetDueToClipping = clippedSurfaceCenter - surfaceCenter; } // The RenderSurface backing texture cannot exceed the maximum supported @@ -768,45 +764,20 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay renderSurface->clearLayerList(); renderSurface->setContentRect(clippedContentRect); - - // Adjust the origin of the transform to be the center of the render surface. - WebTransformationMatrix drawTransform = renderSurface->originTransform(); - drawTransform.translate3d(surfaceCenter.x() + centerOffsetDueToClipping.width(), surfaceCenter.y() + centerOffsetDueToClipping.height(), 0); - renderSurface->setDrawTransform(drawTransform); - - WebTransformationMatrix screenSpaceTransform = layer->screenSpaceTransform(); - // The layer's screen space transform operates on layer rects, but the surfaces - // screen space transform operates on surface rects, which are in physical pixels, - // so we have to 'undo' the scale here. - screenSpaceTransform.scale(1 / contentsScale); - renderSurface->setScreenSpaceTransform(screenSpaceTransform); + renderSurface->setScreenSpaceTransform(layer->screenSpaceTransform()); if (layer->replicaLayer()) { - // Compute the transformation matrix used to draw the surface's replica to the target surface. - WebTransformationMatrix replicaDrawTransform = renderSurface->originTransform(); - - replicaDrawTransform.scale(contentsScale); - replicaDrawTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), - layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); - replicaDrawTransform.multiply(layer->replicaLayer()->transform()); - FloatPoint layerSpaceSurfaceCenter = surfaceCenter; - layerSpaceSurfaceCenter.scale(1 / contentsScale, 1 / contentsScale); - replicaDrawTransform.translate(layerSpaceSurfaceCenter.x() - layer->replicaLayer()->anchorPoint().x() * bounds.width(), layerSpaceSurfaceCenter.y() - layer->replicaLayer()->anchorPoint().y() * bounds.height()); - replicaDrawTransform.scale(1 / contentsScale); - - renderSurface->setReplicaDrawTransform(replicaDrawTransform); - WebTransformationMatrix surfaceOriginToReplicaOriginTransform; - surfaceOriginToReplicaOriginTransform.scale(contentsScale); + surfaceOriginToReplicaOriginTransform.scale(deviceScaleFactor); surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer()->transform()); surfaceOriginToReplicaOriginTransform.translate(-layer->replicaLayer()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y() * bounds.height()); - surfaceOriginToReplicaOriginTransform.scale(1 / contentsScale); + surfaceOriginToReplicaOriginTransform.scale(1 / deviceScaleFactor); // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space. - WebTransformationMatrix replicaOriginTransform = layer->renderSurface()->originTransform() * surfaceOriginToReplicaOriginTransform; - renderSurface->setReplicaOriginTransform(replicaOriginTransform); + WebTransformationMatrix replicaOriginTransform = layer->renderSurface()->drawTransform() * surfaceOriginToReplicaOriginTransform; + renderSurface->setReplicaDrawTransform(replicaOriginTransform); // Compute the replica's "screenSpaceTransform" that maps from the replica's origin space to the screen's origin space. WebTransformationMatrix replicaScreenSpaceTransform = layer->renderSurface()->screenSpaceTransform() * surfaceOriginToReplicaOriginTransform; @@ -880,22 +851,32 @@ static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfa } } -void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* layer, LayerChromium* rootLayer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize) +void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList) { - WebTransformationMatrix scrollCompensationMatrix; - IntRect drawableContentRect; - WebCore::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, scrollCompensationMatrix, + IntRect totalDrawableContentRect; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix deviceScaleTransform; + deviceScaleTransform.scale(deviceScaleFactor); + + setupRootLayerAndSurfaceForRecursion<LayerChromium, Vector<RefPtr<LayerChromium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize); + + WebCore::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, - layerList, 0, maxTextureSize, drawableContentRect); + rootLayer->renderSurface()->layerList(), 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); } -void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* layer, CCLayerImpl* rootLayer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter* layerSorter, int maxTextureSize) +void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSorter, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList) { - WebTransformationMatrix scrollCompensationMatrix; - IntRect drawableContentRect; - WebCore::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, scrollCompensationMatrix, + IntRect totalDrawableContentRect; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix deviceScaleTransform; + deviceScaleTransform.scale(deviceScaleFactor); + + setupRootLayerAndSurfaceForRecursion<CCLayerImpl, Vector<CCLayerImpl*> >(rootLayer, renderSurfaceLayerList, deviceViewportSize); + + WebCore::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList, - layerList, layerSorter, maxTextureSize, drawableContentRect); + rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); } void CCLayerTreeHostCommon::calculateVisibleAndScissorRects(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, const FloatRect& rootScissorRect) @@ -961,8 +942,8 @@ CCLayerImpl* CCLayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& vi CCLayerImpl* currentLayer = (*it); - FloatRect layerRect(FloatPoint::zero(), currentLayer->bounds()); - if (!pointHitsRect(viewportPoint, currentLayer->screenSpaceTransform(), layerRect)) + FloatRect contentRect(FloatPoint::zero(), currentLayer->contentBounds()); + if (!pointHitsRect(viewportPoint, currentLayer->screenSpaceTransform(), contentRect)) continue; // At this point, we think the point does hit the layer, but we need to walk up diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h index e5a4fec9c..b6e2a07c5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h @@ -41,8 +41,8 @@ class CCLayerTreeHostCommon { public: static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&); - static void calculateDrawTransforms(LayerChromium*, LayerChromium* rootLayer, const WebKit::WebTransformationMatrix& parentMatrix, const WebKit::WebTransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize); - static void calculateDrawTransforms(CCLayerImpl*, CCLayerImpl* rootLayer, const WebKit::WebTransformationMatrix& parentMatrix, const WebKit::WebTransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter*, int maxTextureSize); + static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList); + static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList); static void calculateVisibleAndScissorRects(Vector<CCLayerImpl*>& renderSurfaceLayerList, const FloatRect& rootScissorRect); static void calculateVisibleAndScissorRects(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, const FloatRect& rootScissorRect); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 598ec6397..493f35a27 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -35,7 +35,6 @@ #include "cc/CCDelayBasedTimeSource.h" #include "cc/CCFontAtlas.h" #include "cc/CCFrameRateCounter.h" -#include "cc/CCHeadsUpDisplay.h" #include "cc/CCLayerIterator.h" #include "cc/CCLayerTreeHost.h" #include "cc/CCLayerTreeHostCommon.h" @@ -123,7 +122,6 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC , m_visible(true) , m_contentsTexturesWerePurgedSinceLastCommit(false) , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) - , m_headsUpDisplay(CCHeadsUpDisplay::create()) , m_pageScale(1) , m_pageScaleDelta(1) , m_sentPageScaleDelta(1) @@ -252,19 +250,9 @@ void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSur ASSERT(renderSurfaceLayerList.isEmpty()); ASSERT(m_rootLayerImpl); - renderSurfaceLayerList.append(m_rootLayerImpl.get()); - - if (!m_rootLayerImpl->renderSurface()) - m_rootLayerImpl->createRenderSurface(); - m_rootLayerImpl->renderSurface()->clearLayerList(); - m_rootLayerImpl->renderSurface()->setContentRect(IntRect(IntPoint(), deviceViewportSize())); - { TRACE_EVENT0("cc", "CCLayerTreeHostImpl::calcDrawEtc"); - WebTransformationMatrix identityMatrix; - WebTransformationMatrix deviceScaleTransform; - deviceScaleTransform.scale(m_deviceScaleFactor); - CCLayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), m_rootLayerImpl.get(), deviceScaleTransform, identityMatrix, renderSurfaceLayerList, m_rootLayerImpl->renderSurface()->layerList(), &m_layerSorter, layerRendererCapabilities().maxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), deviceViewportSize(), m_deviceScaleFactor, &m_layerSorter, layerRendererCapabilities().maxTextureSize, renderSurfaceLayerList); trackDamageForAllSurfaces(m_rootLayerImpl.get(), renderSurfaceLayerList); @@ -295,6 +283,9 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) int renderPassId = renderSurfaceLayer->id(); OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, renderPassId); + pass->setFilters(renderSurfaceLayer->filters()); + pass->setBackgroundFilters(renderSurfaceLayer->backgroundFilters()); + surfacePassMap.add(renderSurface, pass.get()); frame.renderPasses.append(pass.get()); frame.renderPassesById.add(renderPassId, pass.release()); @@ -551,15 +542,12 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) // RenderWidget. m_fpsCounter->markBeginningOfFrame(currentTime()); - m_layerRenderer->drawFrame(frame.renderPasses, m_rootScissorRect); - if (m_headsUpDisplay->enabled(settings())) - m_headsUpDisplay->draw(this); - m_layerRenderer->finishDrawingFrame(); + m_layerRenderer->drawFrame(frame.renderPasses, frame.renderPassesById, m_rootScissorRect); for (unsigned int i = 0; i < frame.renderPasses.size(); i++) frame.renderPasses[i]->targetSurface()->damageTracker()->didDrawDamagedArea(); - if (m_debugRectHistory->enabled(settings())) + if (m_settings.showDebugRects()) m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, settings()); // The next frame should start by assuming nothing has changed, and changes are noted as they occur. @@ -1158,11 +1146,6 @@ String CCLayerTreeHostImpl::layerTreeAsText() const return ts.release(); } -void CCLayerTreeHostImpl::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) -{ - m_headsUpDisplay->setFontAtlas(fontAtlas); -} - void CCLayerTreeHostImpl::dumpRenderSurfaces(TextStream& ts, int indent, const CCLayerImpl* layer) const { if (layer->renderSurface()) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index 5587b3462..0458e2811 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -39,9 +39,7 @@ namespace WebCore { class CCActiveGestureAnimation; class CCCompletionEvent; class CCDebugRectHistory; -class CCFontAtlas; class CCFrameRateCounter; -class CCHeadsUpDisplay; class CCLayerImpl; class CCLayerTreeHostImplTimeSourceAdapter; class CCPageScaleAnimation; @@ -119,7 +117,6 @@ public: CCGraphicsContext* context() const; String layerTreeAsText() const; - void setFontAtlas(PassOwnPtr<CCFontAtlas>); void finishAllRendering(); int sourceAnimationFrameNumber() const; @@ -268,8 +265,6 @@ private: bool m_contentsTexturesWerePurgedSinceLastCommit; size_t m_memoryAllocationLimitBytes; - OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay; - float m_pageScale; float m_pageScaleDelta; float m_sentPageScaleDelta; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp index 39461578f..1b5d39726 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp @@ -235,9 +235,9 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(c const LayerType* oldTarget = m_stack[lastIndex].target; const RenderSurfaceType* oldSurface = oldTarget->renderSurface(); - Region oldTargetOcclusionInNewTarget = transformSurfaceOpaqueRegion<RenderSurfaceType>(oldSurface, m_stack[lastIndex].occlusionInTarget, oldSurface->originTransform()); + Region oldTargetOcclusionInNewTarget = transformSurfaceOpaqueRegion<RenderSurfaceType>(oldSurface, m_stack[lastIndex].occlusionInTarget, oldSurface->drawTransform()); if (oldTarget->hasReplica() && !oldTarget->replicaHasMask()) - oldTargetOcclusionInNewTarget.unite(transformSurfaceOpaqueRegion<RenderSurfaceType>(oldSurface, m_stack[lastIndex].occlusionInTarget, oldSurface->replicaOriginTransform())); + oldTargetOcclusionInNewTarget.unite(transformSurfaceOpaqueRegion<RenderSurfaceType>(oldSurface, m_stack[lastIndex].occlusionInTarget, oldSurface->replicaDrawTransform())); IntRect unoccludedSurfaceRect; IntRect unoccludedReplicaRect; @@ -259,53 +259,12 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(c } if (oldTarget->backgroundFilters().hasFilterThatMovesPixels()) { - reduceOcclusionBelowSurface(oldTarget, unoccludedSurfaceRect, oldSurface->originTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen); + reduceOcclusionBelowSurface(oldTarget, unoccludedSurfaceRect, oldSurface->drawTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen); if (oldTarget->hasReplica()) - reduceOcclusionBelowSurface(oldTarget, unoccludedReplicaRect, oldSurface->replicaOriginTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen); + reduceOcclusionBelowSurface(oldTarget, unoccludedReplicaRect, oldSurface->replicaDrawTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen); } } -template<typename LayerType> -static inline WebTransformationMatrix contentToScreenSpaceTransform(const LayerType* layer) -{ - ASSERT(layerTransformsToScreenKnown(layer)); - IntSize boundsInLayerSpace = layer->bounds(); - IntSize boundsInContentSpace = layer->contentBounds(); - - WebTransformationMatrix transform = layer->screenSpaceTransform(); - - if (boundsInContentSpace.isEmpty()) - return transform; - - // Scale from content space to layer space - transform.scaleNonUniform(boundsInLayerSpace.width() / static_cast<double>(boundsInContentSpace.width()), - boundsInLayerSpace.height() / static_cast<double>(boundsInContentSpace.height())); - - return transform; -} - -template<typename LayerType> -static inline WebTransformationMatrix contentToTargetSurfaceTransform(const LayerType* layer) -{ - ASSERT(layerTransformsToTargetKnown(layer)); - IntSize boundsInLayerSpace = layer->bounds(); - IntSize boundsInContentSpace = layer->contentBounds(); - - WebTransformationMatrix transform = layer->drawTransform(); - - if (boundsInContentSpace.isEmpty()) - return transform; - - // Scale from content space to layer space - transform.scaleNonUniform(boundsInLayerSpace.width() / static_cast<double>(boundsInContentSpace.width()), - boundsInLayerSpace.height() / static_cast<double>(boundsInContentSpace.height())); - - // The draw transform expects the origin to be in the middle of the layer. - transform.translate(-boundsInContentSpace.width() / 2.0, -boundsInContentSpace.height() / 2.0); - - return transform; -} - // FIXME: Remove usePaintTracking when paint tracking is on for paint culling. template<typename LayerType> static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const IntRect& scissorRect, const IntSize& minimumTrackingSize, Vector<IntRect>* occludingScreenSpaceRects) @@ -351,7 +310,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLay IntRect scissorInTarget = layerScissorRectInTargetSurface(layer); if (layerTransformsToTargetKnown(layer)) - addOcclusionBehindLayer<LayerType>(m_stack.last().occlusionInTarget, layer, contentToTargetSurfaceTransform<LayerType>(layer), opaqueContents, scissorInTarget, m_minimumTrackingSize, 0); + addOcclusionBehindLayer<LayerType>(m_stack.last().occlusionInTarget, layer, layer->drawTransform(), opaqueContents, scissorInTarget, m_minimumTrackingSize, 0); // We must clip the occlusion within the layer's scissorInTarget within screen space as well. If the scissor rect can't be moved to screen space and // remain rectilinear, then we don't add any occlusion in screen space. @@ -364,7 +323,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLay if (clipped || !scissorInScreenQuad.isRectilinear()) return; IntRect scissorInScreenRect = intersection(m_scissorRectInScreenSpace, enclosedIntRect(scissorInScreenQuad.boundingBox())); - addOcclusionBehindLayer<LayerType>(m_stack.last().occlusionInScreen, layer, contentToScreenSpaceTransform<LayerType>(layer), opaqueContents, scissorInScreenRect, m_minimumTrackingSize, m_occludingScreenSpaceRects); + addOcclusionBehindLayer<LayerType>(m_stack.last().occlusionInScreen, layer, layer->screenSpaceTransform(), opaqueContents, scissorInScreenRect, m_minimumTrackingSize, m_occludingScreenSpaceRects); } } @@ -390,10 +349,10 @@ bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerT ASSERT(layer->renderTarget() == m_stack.last().target); - if (layerTransformsToTargetKnown(layer) && testContentRectOccluded(contentRect, contentToTargetSurfaceTransform<LayerType>(layer), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget)) + if (layerTransformsToTargetKnown(layer) && testContentRectOccluded(contentRect, layer->drawTransform(), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget)) return true; - if (layerTransformsToScreenKnown(layer) && testContentRectOccluded(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen)) { + if (layerTransformsToScreenKnown(layer) && testContentRectOccluded(contentRect, layer->screenSpaceTransform(), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen)) { if (hasOcclusionFromOutsideTargetSurface) *hasOcclusionFromOutsideTargetSurface = true; return true; @@ -440,11 +399,11 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentR IntRect unoccludedInScreen = contentRect; if (layerTransformsToScreenKnown(layer)) - unoccludedInScreen = computeUnoccludedContentRect(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen); + unoccludedInScreen = computeUnoccludedContentRect(contentRect, layer->screenSpaceTransform(), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen); IntRect unoccludedInTarget = contentRect; if (layerTransformsToTargetKnown(layer)) - unoccludedInTarget = computeUnoccludedContentRect(contentRect, contentToTargetSurfaceTransform<LayerType>(layer), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget); + unoccludedInTarget = computeUnoccludedContentRect(contentRect, layer->drawTransform(), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget); if (hasOcclusionFromOutsideTargetSurface) *hasOcclusionFromOutsideTargetSurface = (intersection(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget); @@ -481,7 +440,7 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu bool hasOcclusion = m_stack.size() > 1; const WebTransformationMatrix& transformToScreen = forReplica ? surface->replicaScreenSpaceTransform() : surface->screenSpaceTransform(); - const WebTransformationMatrix& transformToTarget = forReplica ? surface->replicaOriginTransform() : surface->originTransform(); + const WebTransformationMatrix& transformToTarget = forReplica ? surface->replicaDrawTransform() : surface->drawTransform(); IntRect unoccludedInScreen = contentRect; if (surfaceTransformsToScreenKnown(surface)) { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h index f19032abb..3b6dc7f9c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h @@ -33,7 +33,6 @@ namespace WebCore { -class CCFontAtlas; class CCThread; class CCGraphicsContext; struct CCRenderingStats; @@ -106,8 +105,6 @@ public: virtual void acquireLayerTextures() = 0; - virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) = 0; - // Debug hooks #ifndef NDEBUG static bool isMainThread(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 75b4e2d67..c1af9d140 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -107,6 +107,7 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree // Manually create the quad state for the gutter quads, as the root layer // doesn't have any bounds and so can't generate this itself. OwnPtr<CCSharedQuadState> sharedQuadState = rootLayer->createSharedQuadState(m_sharedQuadStateList.size()); + ASSERT(rootLayer->screenSpaceTransform().isInvertible()); WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 816481c97..71582128c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -30,6 +30,7 @@ #include "cc/CCDrawQuad.h" #include "cc/CCOcclusionTracker.h" #include "cc/CCSharedQuadState.h" +#include <public/WebFilterOperations.h> #include <wtf/HashMap.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> @@ -68,6 +69,12 @@ public: // This denotes the bounds in physical pixels of the output generated by this RenderPass. const IntRect& framebufferOutputRect() const { return m_framebufferOutputRect; } + const WebKit::WebFilterOperations& filters() const { return m_filters; } + void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; } + + const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } + void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; } + bool hasTransparentBackground() const { return m_hasTransparentBackground; } void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; } @@ -83,6 +90,8 @@ protected: Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList; bool m_hasTransparentBackground; bool m_hasOcclusionFromOutsideTargetSurface; + WebKit::WebFilterOperations m_filters; + WebKit::WebFilterOperations m_backgroundFilters; }; typedef Vector<CCRenderPass*> CCRenderPassList; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp index 2d74a2278..60e35396a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp @@ -31,18 +31,15 @@ using WebKit::WebCompositorQuad; namespace WebCore { -PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) +PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) { - return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame)); + return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, maskResourceId, contentsChangedSinceLastFrame)); } -CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) +CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::RenderPass, quadRect) , m_renderPassId(renderPassId) , m_isReplica(isReplica) - , m_drawTransform(drawTransform) - , m_filters(filters) - , m_backgroundFilters(backgroundFilters) , m_maskResourceId(maskResourceId) , m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame) { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h index 6f399be67..9e033b42c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h @@ -28,8 +28,6 @@ #include "cc/CCResourceProvider.h" #include <public/WebCompositorQuad.h> -#include <public/WebFilterOperations.h> -#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> namespace WebCore { @@ -39,28 +37,19 @@ class CCRenderPass; class CCRenderPassDrawQuad : public WebKit::WebCompositorQuad { WTF_MAKE_NONCOPYABLE(CCRenderPassDrawQuad); public: - static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); + static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); int renderPassId() const { return m_renderPassId; } bool isReplica() const { return m_isReplica; } CCResourceProvider::ResourceId maskResourceId() const { return m_maskResourceId; } const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; } - // FIXME: This should be removed and we should draw the RenderPass with the quadTransform. - const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } - - const WebKit::WebFilterOperations& filters() const { return m_filters; } - const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } - static const CCRenderPassDrawQuad* materialCast(const WebKit::WebCompositorQuad*); private: - CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); + CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); int m_renderPassId; bool m_isReplica; - WebKit::WebTransformationMatrix m_drawTransform; - WebKit::WebFilterOperations m_filters; - WebKit::WebFilterOperations m_backgroundFilters; CCResourceProvider::ResourceId m_maskResourceId; IntRect m_contentsChangedSinceLastFrame; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index 22434c203..425d72788 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -75,11 +75,9 @@ CCRenderSurface::~CCRenderSurface() FloatRect CCRenderSurface::drawableContentRect() const { - FloatRect localContentRect(-0.5 * m_contentRect.width(), -0.5 * m_contentRect.height(), - m_contentRect.width(), m_contentRect.height()); - FloatRect drawableContentRect = CCMathUtil::mapClippedRect(m_drawTransform, localContentRect); + FloatRect drawableContentRect = CCMathUtil::mapClippedRect(m_drawTransform, m_contentRect); if (m_owningLayer->hasReplica()) - drawableContentRect.unite(CCMathUtil::mapClippedRect(m_replicaDrawTransform, localContentRect)); + drawableContentRect.unite(CCMathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect)); return drawableContentRect; } @@ -166,13 +164,13 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState(int id) const { bool isOpaque = false; - return CCSharedQuadState::create(id, m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); + return CCSharedQuadState::create(id, m_drawTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState(int id) const { bool isOpaque = false; - return CCSharedQuadState::create(id, m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); + return CCSharedQuadState::create(id, m_replicaDrawTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const @@ -210,13 +208,9 @@ void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* share } CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0; - WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); - const WebKit::WebFilterOperations& filters = m_owningLayer->filters(); - const WebKit::WebFilterOperations& backgroundFilters = m_owningLayer->backgroundFilters(); - - quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame)); + quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame)); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index 16d8fa194..283cbfa45 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -71,18 +71,12 @@ public: void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; } const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } - void setOriginTransform(const WebKit::WebTransformationMatrix& originTransform) { m_originTransform = originTransform; } - const WebKit::WebTransformationMatrix& originTransform() const { return m_originTransform; } - void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; } const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; } void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; } const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; } - void setReplicaOriginTransform(const WebKit::WebTransformationMatrix& replicaOriginTransform) { m_replicaOriginTransform = replicaOriginTransform; } - const WebKit::WebTransformationMatrix& replicaOriginTransform() const { return m_replicaOriginTransform; } - void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; } const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; } @@ -130,10 +124,8 @@ private: float m_drawOpacity; bool m_drawOpacityIsAnimating; WebKit::WebTransformationMatrix m_drawTransform; - WebKit::WebTransformationMatrix m_originTransform; WebKit::WebTransformationMatrix m_screenSpaceTransform; WebKit::WebTransformationMatrix m_replicaDrawTransform; - WebKit::WebTransformationMatrix m_replicaOriginTransform; WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; bool m_targetSurfaceTransformsAreAnimating; bool m_screenSpaceTransformsAreAnimating; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp index 9b62946bd..f1a21faa8 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp @@ -67,17 +67,19 @@ void getContrastMatrix(float amount, SkScalar matrix[20]) void getSaturateMatrix(float amount, SkScalar matrix[20]) { + // Note, these values are computed to ensure matrixNeedsClamping is false + // for amount in [0..1] matrix[0] = 0.213f + 0.787f * amount; matrix[1] = 0.715f - 0.715f * amount; - matrix[2] = 0.072f - 0.072f * amount; + matrix[2] = 1.f - (matrix[0] + matrix[1]); matrix[3] = matrix[4] = 0; matrix[5] = 0.213f - 0.213f * amount; matrix[6] = 0.715f + 0.285f * amount; - matrix[7] = 0.072f - 0.072f * amount; + matrix[7] = 1.f - (matrix[5] + matrix[6]); matrix[8] = matrix[9] = 0; matrix[10] = 0.213f - 0.213f * amount; matrix[11] = 0.715f - 0.715f * amount; - matrix[12] = 0.072f + 0.928f * amount; + matrix[12] = 1.f - (matrix[10] + matrix[11]); matrix[13] = matrix[14] = 0; matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; matrix[18] = 1; @@ -121,19 +123,21 @@ void getOpacityMatrix(float amount, SkScalar matrix[20]) void getGrayscaleMatrix(float amount, SkScalar matrix[20]) { + // Note, these values are computed to ensure matrixNeedsClamping is false + // for amount in [0..1] matrix[0] = 0.2126f + 0.7874f * amount; matrix[1] = 0.7152f - 0.7152f * amount; - matrix[2] = 0.0722f - 0.0722f * amount; + matrix[2] = 1.f - (matrix[0] + matrix[1]); matrix[3] = matrix[4] = 0; matrix[5] = 0.2126f - 0.2126f * amount; matrix[6] = 0.7152f + 0.2848f * amount; - matrix[7] = 0.0722f - 0.0722f * amount; + matrix[7] = 1.f - (matrix[5] + matrix[6]); matrix[8] = matrix[9] = 0; matrix[10] = 0.2126f - 0.2126f * amount; matrix[11] = 0.7152f - 0.7152f * amount; - matrix[12] = 0.0722f + 0.9278f * amount; + matrix[12] = 1.f - (matrix[10] + matrix[11]); matrix[13] = matrix[14] = 0; matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; @@ -161,11 +165,169 @@ void getSepiaMatrix(float amount, SkScalar matrix[20]) matrix[18] = 1; } -bool applyColorMatrix(SkCanvas* canvas, SkBitmap source, SkScalar matrix[20]) +// The 5x4 matrix is really a "compressed" version of a 5x5 matrix that'd have +// (0 0 0 0 1) as a last row, and that would be applied to a 5-vector extended +// from the 4-vector color with a 1. +void multColorMatrix(SkScalar a[20], SkScalar b[20], SkScalar out[20]) { + for (int j = 0; j < 4; ++j) { + for (int i = 0; i < 5; ++i) { + out[i+j*5] = i == 4 ? a[4+j*5] : 0; + for (int k = 0; k < 4; ++k) + out[i+j*5] += a[k+j*5] * b[i+k*5]; + } + } +} + +// To detect if we need to apply clamping after applying a matrix, we check if +// any output component might go outside of [0, 255] for any combination of +// input components in [0..255]. +// Each output component is an affine transformation of the input component, so +// the minimum and maximum values are for any combination of minimum or maximum +// values of input components (i.e. 0 or 255). +// E.g. if R' = x*R + y*G + z*B + w*A + t +// Then the maximum value will be for R=255 if x>0 or R=0 if x<0, and the +// minimum value will be for R=0 if x>0 or R=255 if x<0. +// Same goes for all components. +bool componentNeedsClamping(SkScalar row[5]) +{ + SkScalar maxValue = row[4] / 255; + SkScalar minValue = row[4] / 255; + for (int i = 0; i < 4; ++i) { + if (row[i] > 0) + maxValue += row[i]; + else + minValue += row[i]; + } + return (maxValue > 1) || (minValue < 0); +} + +bool matrixNeedsClamping(SkScalar matrix[20]) +{ + return componentNeedsClamping(matrix) + || componentNeedsClamping(matrix+5) + || componentNeedsClamping(matrix+10) + || componentNeedsClamping(matrix+15); +} + +bool getColorMatrix(const WebKit::WebFilterOperation& op, SkScalar matrix[20]) +{ + switch (op.type()) { + case WebKit::WebFilterOperation::FilterTypeBrightness: { + getBrightnessMatrix(op.amount(), matrix); + return true; + } + case WebKit::WebFilterOperation::FilterTypeContrast: { + getContrastMatrix(op.amount(), matrix); + return true; + } + case WebKit::WebFilterOperation::FilterTypeGrayscale: { + getGrayscaleMatrix(1 - op.amount(), matrix); + return true; + } + case WebKit::WebFilterOperation::FilterTypeSepia: { + getSepiaMatrix(1 - op.amount(), matrix); + return true; + } + case WebKit::WebFilterOperation::FilterTypeSaturate: { + getSaturateMatrix(op.amount(), matrix); + return true; + } + case WebKit::WebFilterOperation::FilterTypeHueRotate: { + getHueRotateMatrix(op.amount(), matrix); + return true; + } + case WebKit::WebFilterOperation::FilterTypeInvert: { + getInvertMatrix(op.amount(), matrix); + return true; + } + case WebKit::WebFilterOperation::FilterTypeOpacity: { + getOpacityMatrix(op.amount(), matrix); + return true; + } + default: + return false; + } +} + +class FilterBufferState { +public: + FilterBufferState(GrContext* grContext, const WebCore::FloatSize& size, unsigned textureId) + : m_grContext(grContext) + { + // Wrap the source texture in a Ganesh platform texture. + GrPlatformTextureDesc platformTextureDescription; + platformTextureDescription.fWidth = size.width(); + platformTextureDescription.fHeight = size.height(); + platformTextureDescription.fConfig = kSkia8888_PM_GrPixelConfig; + platformTextureDescription.fTextureHandle = textureId; + SkAutoTUnref<GrTexture> texture(grContext->createPlatformTexture(platformTextureDescription)); + // Place the platform texture inside an SkBitmap. + m_source.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); + m_source.setPixelRef(new SkGrTexturePixelRef(texture.get()))->unref(); + } + + ~FilterBufferState() { } + + SkCanvas* canvas() + { + if (!m_canvas.get()) + createCanvas(); + return m_canvas.get(); + } + + const SkBitmap& source() { return m_source; } + + void swap() + { + m_canvas.reset(0); + m_device.reset(0); + + m_source.setPixelRef(new SkGrTexturePixelRef(m_destinationTexture.get()))->unref(); + + SkAutoTUnref<GrTexture> temp; + temp.reset(m_freeTexture.detach()); + m_freeTexture.reset(m_destinationTexture.detach()); + m_destinationTexture.reset(temp.detach()); + } + +private: + void createCanvas() + { + if (!m_destinationTexture.get()) { + GrTextureDesc desc; + desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; + desc.fSampleCnt = 0; + desc.fWidth = m_source.width(); + desc.fHeight = m_source.height(); + desc.fConfig = kSkia8888_PM_GrPixelConfig; + GrAutoScratchTexture scratchTexture(m_grContext, desc, GrContext::kExact_ScratchTexMatch); + m_destinationTexture.reset(scratchTexture.detach()); + if (!m_destinationTexture.get()) + return; + } + m_device.reset(new SkGpuDevice(m_grContext, m_destinationTexture.get())); + m_canvas.reset(new SkCanvas(m_device.get())); + m_canvas->clear(0x0); + } + + GrContext* m_grContext; + SkBitmap m_source; + SkAutoTUnref<GrTexture> m_destinationTexture; + SkAutoTUnref<GrTexture> m_freeTexture; + SkAutoTUnref<SkGpuDevice> m_device; + SkAutoTUnref<SkCanvas> m_canvas; +}; + +bool applyColorMatrix(FilterBufferState* state, SkScalar matrix[20]) +{ + SkCanvas* canvas = state->canvas(); + if (!canvas) + return false; SkPaint paint; paint.setColorFilter(new SkColorMatrixFilter(matrix))->unref(); - canvas->drawBitmap(source, 0, 0, &paint); + canvas->drawBitmap(state->source(), 0, 0, &paint); + state->swap(); return true; } @@ -175,120 +337,87 @@ namespace WebCore { SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize& size, GraphicsContext3D* context3D) { - SkBitmap source; if (!context3D) - return source; - - GrContext* gr = context3D->grContext(); - if (!gr) - return source; - // Wrap the RenderSurface's texture in a Ganesh platform texture. - GrPlatformTextureDesc platformTexDesc; - platformTexDesc.fWidth = size.width(); - platformTexDesc.fHeight = size.height(); - platformTexDesc.fConfig = kSkia8888_PM_GrPixelConfig; - platformTexDesc.fTextureHandle = textureId; - SkAutoTUnref<GrTexture> texture(gr->createPlatformTexture(platformTexDesc)); - // Place the platform texture inside an SkBitmap. - source.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); - source.setPixelRef(new SkGrTexturePixelRef(texture.get()))->unref(); + return SkBitmap(); + + GrContext* grContext = context3D->grContext(); + if (!grContext) + return SkBitmap(); + FilterBufferState state(grContext, size, textureId); + SkScalar accumulatedColorMatrix[20]; + bool haveAccumulatedColorMatrix = false; for (unsigned i = 0; i < filters.size(); ++i) { const WebKit::WebFilterOperation& op = filters.at(i); - // Allocate a destination texture. - GrTextureDesc desc; - desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; - desc.fSampleCnt = 0; - desc.fWidth = size.width(); - desc.fHeight = size.height(); - desc.fConfig = kSkia8888_PM_GrPixelConfig; - // FIXME: could we use approximate match, and fix texcoords on draw - GrAutoScratchTexture scratchTexture(gr, desc, GrContext::kExact_ScratchTexMatch); - SkAutoTUnref<GrTexture> destination(scratchTexture.detach()); - if (!destination.get()) + + // If the filter is a color matrix, we may be able to combine it with + // following filter(s) that also are color matrices. + SkScalar matrix[20]; + if (getColorMatrix(op, matrix)) { + if (haveAccumulatedColorMatrix) { + SkScalar newMatrix[20]; + multColorMatrix(matrix, accumulatedColorMatrix, newMatrix); + memcpy(accumulatedColorMatrix, newMatrix, sizeof(accumulatedColorMatrix)); + } else { + memcpy(accumulatedColorMatrix, matrix, sizeof(accumulatedColorMatrix)); + haveAccumulatedColorMatrix = true; + } + + // We can only combine matrices if clamping of color components + // would have no effect. + if (!matrixNeedsClamping(accumulatedColorMatrix)) + continue; + } + + if (haveAccumulatedColorMatrix && !applyColorMatrix(&state, accumulatedColorMatrix)) return SkBitmap(); - SkGpuDevice device(gr, destination.get()); - SkCanvas canvas(&device); - canvas.clear(0x0); + haveAccumulatedColorMatrix = false; + switch (op.type()) { - case WebKit::WebFilterOperation::FilterTypeBrightness: { - SkScalar matrix[20]; - getBrightnessMatrix(op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } - case WebKit::WebFilterOperation::FilterTypeContrast: { - SkScalar matrix[20]; - getContrastMatrix(op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } - case WebKit::WebFilterOperation::FilterTypeGrayscale: { - SkScalar matrix[20]; - getGrayscaleMatrix(1 - op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } - case WebKit::WebFilterOperation::FilterTypeSepia: { - SkScalar matrix[20]; - getSepiaMatrix(1 - op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } - case WebKit::WebFilterOperation::FilterTypeSaturate: { - SkScalar matrix[20]; - getSaturateMatrix(op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } - case WebKit::WebFilterOperation::FilterTypeHueRotate: { - SkScalar matrix[20]; - getHueRotateMatrix(op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } - case WebKit::WebFilterOperation::FilterTypeInvert: { - SkScalar matrix[20]; - getInvertMatrix(op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } - case WebKit::WebFilterOperation::FilterTypeOpacity: { - SkScalar matrix[20]; - getOpacityMatrix(op.amount(), matrix); - applyColorMatrix(&canvas, source, matrix); - break; - } case WebKit::WebFilterOperation::FilterTypeBlur: { + SkCanvas* canvas = state.canvas(); + if (!canvas) + return SkBitmap(); float stdDeviation = op.amount(); SkAutoTUnref<SkImageFilter> filter(new SkBlurImageFilter(stdDeviation, stdDeviation)); SkPaint paint; paint.setImageFilter(filter.get()); - canvas.drawSprite(source, 0, 0, &paint); + canvas->drawSprite(state.source(), 0, 0, &paint); + state.swap(); break; } case WebKit::WebFilterOperation::FilterTypeDropShadow: { + SkCanvas* canvas = state.canvas(); + if (!canvas) + return SkBitmap(); SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(op.amount(), op.amount())); SkAutoTUnref<SkColorFilter> colorFilter(SkColorFilter::CreateModeFilter(op.dropShadowColor(), SkXfermode::kSrcIn_Mode)); SkPaint paint; paint.setImageFilter(blurFilter.get()); paint.setColorFilter(colorFilter.get()); paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); - canvas.saveLayer(0, &paint); - canvas.drawBitmap(source, op.dropShadowOffset().x, -op.dropShadowOffset().y); - canvas.restore(); - canvas.drawBitmap(source, 0, 0); + canvas->saveLayer(0, &paint); + canvas->drawBitmap(state.source(), op.dropShadowOffset().x, -op.dropShadowOffset().y); + canvas->restore(); + canvas->drawBitmap(state.source(), 0, 0); + state.swap(); break; } - default: - canvas.drawBitmap(source, 0, 0); + case WebKit::WebFilterOperation::FilterTypeBrightness: + case WebKit::WebFilterOperation::FilterTypeContrast: + case WebKit::WebFilterOperation::FilterTypeGrayscale: + case WebKit::WebFilterOperation::FilterTypeSepia: + case WebKit::WebFilterOperation::FilterTypeSaturate: + case WebKit::WebFilterOperation::FilterTypeHueRotate: + case WebKit::WebFilterOperation::FilterTypeInvert: + case WebKit::WebFilterOperation::FilterTypeOpacity: break; } - // Dest texture from this filter becomes source bitmap for next filter. - source.setPixelRef(new SkGrTexturePixelRef(destination.get()))->unref(); } + if (haveAccumulatedColorMatrix && !applyColorMatrix(&state, accumulatedColorMatrix)) + return SkBitmap(); context3D->flush(); - return source; + return state.source(); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h index d931022dc..9080564c0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h @@ -74,16 +74,10 @@ public: virtual void viewportChanged() { } - const WebKit::WebTransformationMatrix& projectionMatrix() const { return m_projectionMatrix; } - const WebKit::WebTransformationMatrix& windowMatrix() const { return m_windowMatrix; } - virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) { } virtual bool haveCachedResourcesForRenderPassId(int) const { return false; } - virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) = 0; - virtual void finishDrawingFrame() { } - - virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) = 0; + virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&, const FloatRect& rootScissorRect) = 0; // waits for rendering to finish virtual void finish() = 0; @@ -108,8 +102,6 @@ protected: } CCRendererClient* m_client; - WebKit::WebTransformationMatrix m_projectionMatrix; - WebKit::WebTransformationMatrix m_windowMatrix; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderingStats.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderingStats.h index d8075aac2..cabaa8b39 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderingStats.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderingStats.h @@ -32,11 +32,15 @@ struct CCRenderingStats { int numAnimationFrames; int numFramesSentToScreen; int droppedFrameCount; + double totalPaintTimeInSeconds; + double totalRasterizeTimeInSeconds; CCRenderingStats() : numAnimationFrames(0) , numFramesSentToScreen(0) , droppedFrameCount(0) + , totalPaintTimeInSeconds(0) + , totalRasterizeTimeInSeconds(0) { } }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp index 3550346ba..26b0a7186 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp @@ -28,7 +28,6 @@ #include "TraceEvent.h" #include "cc/CCDrawQuad.h" -#include "cc/CCFontAtlas.h" #include "cc/CCGraphicsContext.h" #include "cc/CCLayerTreeHost.h" #include "cc/CCTextureUpdater.h" @@ -267,13 +266,6 @@ void CCSingleThreadProxy::stop() m_layerTreeHost = 0; } -void CCSingleThreadProxy::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) -{ - ASSERT(isMainThread()); - DebugScopedSetImplThread impl; - m_layerTreeHostImpl->setFontAtlas(fontAtlas); -} - void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector> events, double wallClockTime) { ASSERT(CCProxy::isImplThread()); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h index e8aa75515..6dce1c35e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h @@ -63,7 +63,6 @@ public: virtual void stop() OVERRIDE; virtual size_t maxPartialTextureUpdates() const OVERRIDE { return std::numeric_limits<size_t>::max(); } virtual void acquireLayerTextures() OVERRIDE { } - virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) OVERRIDE; virtual void forceSerializeOnSwapBuffers() OVERRIDE; // CCLayerTreeHostImplClient implementation diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp index e09d94c61..9a455ffb0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp @@ -31,7 +31,6 @@ #include "TraceEvent.h" #include "cc/CCDelayBasedTimeSource.h" #include "cc/CCDrawQuad.h" -#include "cc/CCFontAtlas.h" #include "cc/CCFrameRateController.h" #include "cc/CCGraphicsContext.h" #include "cc/CCInputHandler.h" @@ -865,19 +864,6 @@ size_t CCThreadProxy::maxPartialTextureUpdates() const return textureUpdatesPerFrame; } -void CCThreadProxy::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas) -{ - ASSERT(isMainThread()); - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setFontAtlasOnImplThread, fontAtlas)); - -} - -void CCThreadProxy::setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas> fontAtlas) -{ - ASSERT(isImplThread()); - m_layerTreeHostImpl->setFontAtlas(fontAtlas); -} - void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, LayerRendererCapabilities* capabilities) { TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h index 0f8a35404..860a20173 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h @@ -71,7 +71,6 @@ public: virtual void stop() OVERRIDE; virtual size_t maxPartialTextureUpdates() const OVERRIDE; virtual void acquireLayerTextures() OVERRIDE; - virtual void setFontAtlas(PassOwnPtr<CCFontAtlas>) OVERRIDE; virtual void forceSerializeOnSwapBuffers() OVERRIDE; // CCLayerTreeHostImplClient implementation @@ -144,7 +143,6 @@ private: void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, LayerRendererCapabilities*); void implSideRenderingStatsOnImplThread(CCCompletionEvent*, CCRenderingStats*); CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw); - void setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas>); void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*); void setNeedsForcedCommitOnImplThread(); diff --git a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm index 4bb0951da..8a0c32c4f 100644 --- a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm +++ b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm @@ -28,6 +28,10 @@ #import "WebCoreSystemInterface.h" #import <AppKit/NSFont.h> +#if PLATFORM(CHROMIUM) && OS(DARWIN) +#import "HarfBuzzNGFace.h" +#endif + namespace WebCore { // These CoreText Text Spacing feature selectors are not defined in CoreText. diff --git a/Source/WebCore/platform/graphics/efl/FontEfl.cpp b/Source/WebCore/platform/graphics/efl/FontEfl.cpp deleted file mode 100644 index 83cc7ffe3..000000000 --- a/Source/WebCore/platform/graphics/efl/FontEfl.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2006 Apple Inc. All rights reserved. - * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia - * Copyright (C) 2009-2010 ProFUSION embedded systems - * Copyright (C) 2009-2010 Samsung Electronics - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" -#include "Font.h" - -#include "GraphicsContext.h" -#include "NotImplemented.h" -#include "SimpleFontData.h" - -#include <cairo.h> - -namespace WebCore { - -void Font::drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const -{ - notImplemented(); -} - -void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const -{ - notImplemented(); -} - -bool Font::canReturnFallbackFontsForComplexText() -{ - return false; -} - -bool Font::canExpandAroundIdeographsInComplexText() -{ - return false; -} - -float Font::floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>*, GlyphOverflow*) const -{ - notImplemented(); - return 0.0f; -} - -int Font::offsetForPositionForComplexText(const TextRun&, float, bool) const -{ - notImplemented(); - return 0; -} - -FloatRect Font::selectionRectForComplexText(const TextRun&, const FloatPoint&, int, int, int) const -{ - notImplemented(); - return FloatRect(); -} - -} diff --git a/Source/WebCore/platform/graphics/filters/FEBlend.cpp b/Source/WebCore/platform/graphics/filters/FEBlend.cpp index f6dcf6396..d5897c392 100644 --- a/Source/WebCore/platform/graphics/filters/FEBlend.cpp +++ b/Source/WebCore/platform/graphics/filters/FEBlend.cpp @@ -71,55 +71,37 @@ static inline unsigned char fastDivideBy255(uint16_t value) return quotient + (remainder >> 8); } -class BlendNormal { -public: - static unsigned char apply(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char) - { - return fastDivideBy255((255 - alphaA) * colorB + colorA * 255); - } -}; +inline unsigned char feBlendNormal(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char) +{ + return fastDivideBy255((255 - alphaA) * colorB + colorA * 255); +} -class BlendMultiply { -public: - static unsigned char apply(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) - { - return fastDivideBy255((255 - alphaA) * colorB + (255 - alphaB + colorB) * colorA); - } -}; +inline unsigned char feBlendMultiply(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) +{ + return fastDivideBy255((255 - alphaA) * colorB + (255 - alphaB + colorB) * colorA); +} -class BlendScreen { -public: - static unsigned char apply(unsigned char colorA, unsigned char colorB, unsigned char, unsigned char) - { - return fastDivideBy255((colorB + colorA) * 255 - colorA * colorB); - } -}; +inline unsigned char feBlendScreen(unsigned char colorA, unsigned char colorB, unsigned char, unsigned char) +{ + return fastDivideBy255((colorB + colorA) * 255 - colorA * colorB); +} -class BlendDarken { -public: - static unsigned char apply(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) - { - return fastDivideBy255(std::min((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)); - } -}; +inline unsigned char feBlendDarken(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) +{ + return fastDivideBy255(std::min((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)); +} -class BlendLighten { -public: - static unsigned char apply(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) - { - return fastDivideBy255(std::max((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)); - } -}; +inline unsigned char feBlendLighten(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) +{ + return fastDivideBy255(std::max((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)); +} -class BlendUnknown { -public: - static unsigned char apply(unsigned char, unsigned char, unsigned char, unsigned char) - { - return 0; - } -}; +inline unsigned char feBlendUnknown(unsigned char, unsigned char, unsigned char, unsigned char) +{ + return 0; +} -template<typename BlendFunctor> +template<BlendType BlendFunction> static void platformApply(unsigned char* sourcePixelA, unsigned char* sourcePixelB, unsigned char* destinationPixel, unsigned pixelArrayLength) { @@ -127,9 +109,9 @@ static void platformApply(unsigned char* sourcePixelA, unsigned char* sourcePixe for (unsigned pixelOffset = 0; pixelOffset < len; pixelOffset++) { unsigned char alphaA = sourcePixelA[3]; unsigned char alphaB = sourcePixelB[3]; - destinationPixel[0] = BlendFunctor::apply(sourcePixelA[0], sourcePixelB[0], alphaA, alphaB); - destinationPixel[1] = BlendFunctor::apply(sourcePixelA[1], sourcePixelB[1], alphaA, alphaB); - destinationPixel[2] = BlendFunctor::apply(sourcePixelA[2], sourcePixelB[2], alphaA, alphaB); + destinationPixel[0] = BlendFunction(sourcePixelA[0], sourcePixelB[0], alphaA, alphaB); + destinationPixel[1] = BlendFunction(sourcePixelA[1], sourcePixelB[1], alphaA, alphaB); + destinationPixel[2] = BlendFunction(sourcePixelA[2], sourcePixelB[2], alphaA, alphaB); destinationPixel[3] = 255 - fastDivideBy255((255 - alphaA) * (255 - alphaB)); sourcePixelA += 4; sourcePixelB += 4; @@ -142,22 +124,22 @@ void FEBlend::platformApplyGeneric(unsigned char* sourcePixelA, unsigned char* s { switch (m_mode) { case FEBLEND_MODE_NORMAL: - platformApply<BlendNormal>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); + platformApply<feBlendNormal>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); break; case FEBLEND_MODE_MULTIPLY: - platformApply<BlendMultiply>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); + platformApply<feBlendMultiply>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); break; case FEBLEND_MODE_SCREEN: - platformApply<BlendScreen>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); + platformApply<feBlendScreen>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); break; case FEBLEND_MODE_DARKEN: - platformApply<BlendDarken>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); + platformApply<feBlendDarken>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); break; case FEBLEND_MODE_LIGHTEN: - platformApply<BlendLighten>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); + platformApply<feBlendLighten>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); break; case FEBLEND_MODE_UNKNOWN: - platformApply<BlendUnknown>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); + platformApply<feBlendUnknown>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); break; } } diff --git a/Source/WebCore/platform/graphics/filters/FEComposite.cpp b/Source/WebCore/platform/graphics/filters/FEComposite.cpp index ddfa1e419..9d566ed92 100644 --- a/Source/WebCore/platform/graphics/filters/FEComposite.cpp +++ b/Source/WebCore/platform/graphics/filters/FEComposite.cpp @@ -131,9 +131,9 @@ static inline void computeArithmeticPixels(unsigned char* source, unsigned char* float scaledK1; float scaledK4; if (b1) - scaledK1 = k1 / 255.f; + scaledK1 = k1 / 255.0f; if (b4) - scaledK4 = k4 * 255.f; + scaledK4 = k4 * 255.0f; while (--pixelArrayLength >= 0) { unsigned char i1 = *source; @@ -155,24 +155,63 @@ static inline void computeArithmeticPixels(unsigned char* source, unsigned char* } } -static inline void arithmeticSoftware(unsigned char* source, unsigned char* destination, int pixelArrayLength, - float k1, float k2, float k3, float k4) +// computeArithmeticPixelsUnclamped is a faster version of computeArithmeticPixels for the common case where clamping +// is not necessary. This enables aggresive compiler optimizations such as auto-vectorization. +template <int b1, int b4> +static inline void computeArithmeticPixelsUnclamped(unsigned char* source, unsigned char* destination, int pixelArrayLength, float k1, float k2, float k3, float k4) { - if (!k4) { - if (!k1) { - computeArithmeticPixels<0, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4); - return; - } + float scaledK1; + float scaledK4; + if (b1) + scaledK1 = k1 / 255.0f; + if (b4) + scaledK4 = k4 * 255.0f; - computeArithmeticPixels<1, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4); - return; + while (--pixelArrayLength >= 0) { + unsigned char i1 = *source; + unsigned char i2 = *destination; + float result = k2 * i1 + k3 * i2; + if (b1) + result += scaledK1 * i1 * i2; + if (b4) + result += scaledK4; + + *destination = result; + ++source; + ++destination; } +} - if (!k1) { - computeArithmeticPixels<0, 1>(source, destination, pixelArrayLength, k1, k2, k3, k4); +static inline void arithmeticSoftware(unsigned char* source, unsigned char* destination, int pixelArrayLength, float k1, float k2, float k3, float k4) +{ + float upperLimit = std::max(0.0f, k1) + std::max(0.0f, k2) + std::max(0.0f, k3) + k4; + float lowerLimit = std::min(0.0f, k1) + std::min(0.0f, k2) + std::min(0.0f, k3) + k4; + if ((k4 >= 0.0f && k4 <= 1.0f) && (upperLimit >= 0.0f && upperLimit <= 1.0f) && (lowerLimit >= 0.0f && lowerLimit <= 1.0f)) { + if (k4) { + if (k1) + computeArithmeticPixelsUnclamped<1, 1>(source, destination, pixelArrayLength, k1, k2, k3, k4); + else + computeArithmeticPixelsUnclamped<0, 1>(source, destination, pixelArrayLength, k1, k2, k3, k4); + } else { + if (k1) + computeArithmeticPixelsUnclamped<1, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4); + else + computeArithmeticPixelsUnclamped<0, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4); + } return; } - computeArithmeticPixels<1, 1>(source, destination, pixelArrayLength, k1, k2, k3, k4); + + if (k4) { + if (k1) + computeArithmeticPixels<1, 1>(source, destination, pixelArrayLength, k1, k2, k3, k4); + else + computeArithmeticPixels<0, 1>(source, destination, pixelArrayLength, k1, k2, k3, k4); + } else { + if (k1) + computeArithmeticPixels<1, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4); + else + computeArithmeticPixels<0, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4); + } } inline void FEComposite::platformArithmeticSoftware(Uint8ClampedArray* source, Uint8ClampedArray* destination, diff --git a/Source/WebCore/platform/graphics/freetype/FontPlatformData.h b/Source/WebCore/platform/graphics/freetype/FontPlatformData.h index 206653ddf..6a62c6c7c 100644 --- a/Source/WebCore/platform/graphics/freetype/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/freetype/FontPlatformData.h @@ -29,11 +29,15 @@ #include "FontDescription.h" #include "FontOrientation.h" #include "GlyphBuffer.h" +#if USE(HARFBUZZ_NG) +#include "HarfBuzzNGFace.h" +#endif #include "RefPtrCairo.h" #include <wtf/Forward.h> #include <wtf/HashFunctions.h> typedef struct _FcFontSet FcFontSet; +class HarfBuzzNGFace; namespace WebCore { @@ -63,6 +67,10 @@ public: ~FontPlatformData(); +#if USE(HARFBUZZ_NG) + HarfBuzzNGFace* harfbuzzFace() const; +#endif + bool isFixedPitch(); float size() const { return m_size; } void setSize(float size) { m_size = size; } @@ -98,6 +106,9 @@ public: bool m_syntheticOblique; bool m_fixedWidth; cairo_scaled_font_t* m_scaledFont; +#if USE(HARFBUZZ_NG) + mutable RefPtr<HarfBuzzNGFace> m_harfbuzzFace; +#endif private: void initializeWithFontFace(cairo_font_face_t*, const FontDescription& = FontDescription()); diff --git a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp index 98ae5ed66..803ec3fe0 100644 --- a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp +++ b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp @@ -186,17 +186,27 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other) cairo_scaled_font_destroy(m_scaledFont); m_scaledFont = cairo_scaled_font_reference(other.m_scaledFont); +#if USE(HARFBUZZ_NG) + m_harfbuzzFace = other.m_harfbuzzFace; +#endif + return *this; } FontPlatformData::FontPlatformData(const FontPlatformData& other) : m_fallbacks(0) , m_scaledFont(0) +#if USE(HARFBUZZ_NG) + , m_harfbuzzFace(other.m_harfbuzzFace) +#endif { *this = other; } FontPlatformData::FontPlatformData(const FontPlatformData& other, float size) +#if USE(HARFBUZZ_NG) + : m_harfbuzzFace(other.m_harfbuzzFace) +#endif { *this = other; @@ -217,6 +227,16 @@ FontPlatformData::~FontPlatformData() cairo_scaled_font_destroy(m_scaledFont); } +#if USE(HARFBUZZ_NG) +HarfBuzzNGFace* FontPlatformData::harfbuzzFace() const +{ + if (!m_harfbuzzFace) + m_harfbuzzFace = HarfBuzzNGFace::create(const_cast<FontPlatformData*>(this), hash()); + + return m_harfbuzzFace.get(); +} +#endif + bool FontPlatformData::isFixedPitch() { return m_fixedWidth; diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h index 9e277ccf2..f454fe312 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h @@ -150,6 +150,8 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface { void processBufferingStats(GstMessage*); + virtual String engineDescription() const { return "GStreamer"; } + private: MediaPlayer* m_player; GstElement* m_playBin; diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp index 19a0b9a6d..97add6225 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp @@ -185,6 +185,7 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run, #if USE(HARFBUZZ_NG) GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); + shaper.setDrawRange(from, to); if (!shaper.shape(&glyphBuffer)) return; FloatPoint adjustedPoint = shaper.adjustStartPoint(point); diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp index e6ff322b4..63da5cc3d 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp @@ -42,6 +42,12 @@ #include <wtf/text/StringImpl.h> +#if USE(HARFBUZZ_NG) +#include "HarfBuzzNGFace.h" +#else +#include "HarfBuzzSkia.h" +#endif + namespace WebCore { static SkPaint::Hinting skiaHinting = SkPaint::kNormal_Hinting; @@ -81,6 +87,39 @@ void FontPlatformData::setSubpixelPositioning(bool useSubpixelPositioning) useSkiaSubpixelPositioning = useSubpixelPositioning; } +FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) + : m_typeface(hashTableDeletedFontValue()) + , m_textSize(0) + , m_emSizeInFontUnits(0) + , m_fakeBold(false) + , m_fakeItalic(false) + , m_orientation(Horizontal) + , m_textOrientation(TextOrientationVerticalRight) +{ +} + +FontPlatformData::FontPlatformData() + : m_typeface(0) + , m_textSize(0) + , m_emSizeInFontUnits(0) + , m_fakeBold(false) + , m_fakeItalic(false) + , m_orientation(Horizontal) + , m_textOrientation(TextOrientationVerticalRight) +{ +} + +FontPlatformData::FontPlatformData(float textSize, bool fakeBold, bool fakeItalic) + : m_typeface(0) + , m_textSize(textSize) + , m_emSizeInFontUnits(0) + , m_fakeBold(fakeBold) + , m_fakeItalic(fakeItalic) + , m_orientation(Horizontal) + , m_textOrientation(TextOrientationVerticalRight) +{ +} + FontPlatformData::FontPlatformData(const FontPlatformData& src) : m_typeface(src.m_typeface) , m_family(src.m_family) diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h index 5c6faa64a..2c2f64bbc 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h +++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h @@ -33,11 +33,6 @@ #include "FontOrientation.h" #include "FontRenderStyle.h" -#if USE(HARFBUZZ_NG) -#include "HarfBuzzNGFace.h" -#else -#include "HarfBuzzSkia.h" -#endif #include "SkPaint.h" #include "TextOrientation.h" #include <wtf/Forward.h> @@ -52,6 +47,12 @@ namespace WebCore { class FontDescription; +#if USE(HARFBUZZ_NG) +class HarfBuzzNGFace; +#else +class HarfbuzzFace; +#endif + // ----------------------------------------------------------------------------- // FontPlatformData is the handle which WebKit has on a specific face. A face // is the tuple of (font, size, ...etc). Here we are just wrapping a Skia @@ -64,36 +65,9 @@ public: // to this "Deleted" one. It expects the Deleted one to be differentiable // from the 0 one (created with the empty constructor), so we can't just // set everything to 0. - FontPlatformData(WTF::HashTableDeletedValueType) - : m_typeface(hashTableDeletedFontValue()) - , m_textSize(0) - , m_emSizeInFontUnits(0) - , m_fakeBold(false) - , m_fakeItalic(false) - , m_orientation(Horizontal) - , m_textOrientation(TextOrientationVerticalRight) - { } - - FontPlatformData() - : m_typeface(0) - , m_textSize(0) - , m_emSizeInFontUnits(0) - , m_fakeBold(false) - , m_fakeItalic(false) - , m_orientation(Horizontal) - , m_textOrientation(TextOrientationVerticalRight) - { } - - FontPlatformData(float textSize, bool fakeBold, bool fakeItalic) - : m_typeface(0) - , m_textSize(textSize) - , m_emSizeInFontUnits(0) - , m_fakeBold(fakeBold) - , m_fakeItalic(fakeItalic) - , m_orientation(Horizontal) - , m_textOrientation(TextOrientationVerticalRight) - { } - + FontPlatformData(WTF::HashTableDeletedValueType); + FontPlatformData(); + FontPlatformData(float textSize, bool fakeBold, bool fakeItalic); FontPlatformData(const FontPlatformData&); FontPlatformData(SkTypeface*, const char* name, float textSize, bool fakeBold, bool fakeItalic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight); FontPlatformData(const FontPlatformData& src, float textSize); diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h index b6e91e2eb..cbc8f8ed4 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h @@ -32,6 +32,7 @@ #define HarfBuzzNGFace_h #include <hb.h> + #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp new file mode 100644 index 000000000..8c56f2a79 --- /dev/null +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2012 Google Inc. All rights reserved. + * Copyright (c) 2012 Intel Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HarfBuzzNGFace.h" + +#include "FontPlatformData.h" +#include "GlyphBuffer.h" +#include "HarfBuzzShaper.h" +#include "SimpleFontData.h" +#include "TextEncoding.h" +#include <cairo-ft.h> +#include <cairo.h> +#include <freetype/freetype.h> +#include <freetype/tttables.h> +#include <hb.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +class CairoFtFaceLocker { +public: + CairoFtFaceLocker(cairo_scaled_font_t* cairoScaledFont) : m_scaledFont(cairoScaledFont) { }; + FT_Face lock() + { + return cairo_ft_scaled_font_lock_face(m_scaledFont); + }; + ~CairoFtFaceLocker() + { + cairo_ft_scaled_font_unlock_face(m_scaledFont); + } +private: + cairo_scaled_font_t* m_scaledFont; +}; + +static hb_position_t floatToHarfBuzzPosition(float value) +{ + return static_cast<hb_position_t>(value * (1 << 16)); +} + +static hb_position_t doubleToHarfBuzzPosition(double value) +{ + return static_cast<hb_position_t>(value * (1 << 16)); +} + +static void CairoGetGlyphWidthAndExtents(cairo_scaled_font_t* scaledFont, hb_codepoint_t codepoint, hb_position_t* advance, hb_glyph_extents_t* extents) +{ + cairo_text_extents_t glyphExtents; + cairo_glyph_t glyph; + glyph.index = codepoint; + glyph.x = 0; + glyph.y = 0; + cairo_scaled_font_glyph_extents(scaledFont, &glyph, 1, &glyphExtents); + + if (advance) + *advance = doubleToHarfBuzzPosition(glyphExtents.x_advance); + if (extents) { + extents->x_bearing = doubleToHarfBuzzPosition(glyphExtents.x_bearing); + extents->y_bearing = doubleToHarfBuzzPosition(glyphExtents.y_bearing); + extents->width = doubleToHarfBuzzPosition(glyphExtents.width); + extents->height = doubleToHarfBuzzPosition(glyphExtents.height); + } +} + +static hb_bool_t harfbuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoint_t unicode, hb_codepoint_t variationSelector, hb_codepoint_t* glyph, void* userData) +{ + FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData); + cairo_scaled_font_t* scaledFont = platformData->scaledFont(); + ASSERT(scaledFont); + CairoFtFaceLocker cairoFtFaceLocker(scaledFont); + FT_Face ftFace = cairoFtFaceLocker.lock(); + ASSERT(ftFace); + *glyph = FT_Get_Char_Index(ftFace, unicode); + return !!*glyph; +} + +static hb_position_t harfbuzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, void* userData) +{ + FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData); + cairo_scaled_font_t* scaledFont = platformData->scaledFont(); + ASSERT(scaledFont); + + hb_position_t advance = 0; + CairoGetGlyphWidthAndExtents(scaledFont, glyph, &advance, 0); + return advance; +} + +static hb_bool_t harfbuzzGetGlyphHorizontalOrigin(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_position_t* x, hb_position_t* y, void* userData) +{ + // Just return true, following the way that Harfbuzz-FreeType + // implementation does. + return true; +} + +static hb_bool_t harfbuzzGetGlyphExtents(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_glyph_extents_t* extents, void* userData) +{ + FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData); + cairo_scaled_font_t* scaledFont = platformData->scaledFont(); + ASSERT(scaledFont); + + CairoGetGlyphWidthAndExtents(scaledFont, glyph, 0, extents); + return true; +} + +static hb_font_funcs_t* harfbuzzCairoTextGetFontFuncs() +{ + static hb_font_funcs_t* harfbuzzCairoFontFuncs = 0; + + // We don't set callback functions which we can't support. + // Harfbuzz will use the fallback implementation if they aren't set. + if (!harfbuzzCairoFontFuncs) { + harfbuzzCairoFontFuncs = hb_font_funcs_create(); + hb_font_funcs_set_glyph_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyph, 0, 0); + hb_font_funcs_set_glyph_h_advance_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyphHorizontalAdvance, 0, 0); + hb_font_funcs_set_glyph_h_origin_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyphHorizontalOrigin, 0, 0); + hb_font_funcs_set_glyph_extents_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyphExtents, 0, 0); + hb_font_funcs_make_immutable(harfbuzzCairoFontFuncs); + } + return harfbuzzCairoFontFuncs; +} + +static hb_blob_t* harfbuzzCairoGetTable(hb_face_t* face, hb_tag_t tag, void* userData) +{ + FontPlatformData* font = reinterpret_cast<FontPlatformData*>(userData); + + cairo_scaled_font_t* scaledFont = font->scaledFont(); + if (!scaledFont) + return 0; + + CairoFtFaceLocker cairoFtFaceLocker(scaledFont); + FT_Face ftFont = cairoFtFaceLocker.lock(); + if (!ftFont) + return 0; + + FT_ULong tableSize = 0; + FT_Error error = FT_Load_Sfnt_Table(ftFont, tag, 0, 0, &tableSize); + if (error) + return 0; + + FT_Byte* buffer = reinterpret_cast<FT_Byte*>(fastMalloc(tableSize)); + if (!buffer) + return 0; + FT_ULong expectedTableSize = tableSize; + error = FT_Load_Sfnt_Table(ftFont, tag, 0, buffer, &tableSize); + if (error || tableSize != expectedTableSize) { + fastFree(buffer); + return 0; + } + + return hb_blob_create(reinterpret_cast<const char*>(buffer), tableSize, HB_MEMORY_MODE_WRITABLE, buffer, fastFree); +} + +hb_face_t* HarfBuzzNGFace::createFace() +{ + hb_face_t* face = hb_face_create_for_tables(harfbuzzCairoGetTable, m_platformData, 0); + ASSERT(face); + return face; +} + +hb_font_t* HarfBuzzNGFace::createFont() +{ + hb_font_t* font = hb_font_create(m_face); + hb_font_set_funcs(font, harfbuzzCairoTextGetFontFuncs(), m_platformData, 0); + const float size = m_platformData->size(); + if (floorf(size) == size) + hb_font_set_ppem(font, size, size); + int scale = floatToHarfBuzzPosition(size); + hb_font_set_scale(font, scale, scale); + hb_font_make_immutable(font); + return font; +} + +GlyphBufferAdvance HarfBuzzShaper::createGlyphBufferAdvance(float width, float height) +{ + return GlyphBufferAdvance(width, height); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp index eaf3099fd..17ad2b69b 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp @@ -167,6 +167,8 @@ static void normalizeCharacters(const UChar* source, UChar* destination, int len HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run) : HarfBuzzShaperBase(font, run) + , m_fromIndex(0) + , m_toIndex(m_run.length()) { m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); m_normalizedBufferLength = m_run.length(); @@ -179,6 +181,19 @@ HarfBuzzShaper::~HarfBuzzShaper() { } +void HarfBuzzShaper::setDrawRange(int from, int to) +{ + ASSERT(from >= 0); + ASSERT(to <= m_run.length()); + m_fromIndex = from; + m_toIndex = to; +} + +bool HarfBuzzShaper::shouldDrawCharacterAt(int index) +{ + return m_fromIndex <= index && index < m_toIndex; +} + void HarfBuzzShaper::setFontFeatures() { FontFeatureSettings* settings = m_font->fontDescription().featureSettings(); @@ -254,6 +269,9 @@ bool HarfBuzzShaper::collectHarfBuzzRuns() bool HarfBuzzShaper::shapeHarfBuzzRuns(GlyphBuffer* glyphBuffer) { HarfBuzzScopedPtr<hb_buffer_t> harfbuzzBuffer(hb_buffer_create(), hb_buffer_destroy); + float pendingGlyphAdvanceX = 0; + float pendingGlyphAdvanceY = 0; + hb_buffer_set_unicode_funcs(harfbuzzBuffer.get(), hb_icu_get_unicode_funcs()); if (m_run.directionalOverride()) hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); @@ -279,7 +297,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns(GlyphBuffer* glyphBuffer) hb_shape(harfbuzzFont.get(), harfbuzzBuffer.get(), m_features.isEmpty() ? 0 : m_features.data(), m_features.size()); currentRun->applyShapeResult(harfbuzzBuffer.get()); - setGlyphPositionsForHarfBuzzRun(currentRun, i, harfbuzzBuffer.get(), glyphBuffer); + setGlyphPositionsForHarfBuzzRun(currentRun, i, harfbuzzBuffer.get(), glyphBuffer, pendingGlyphAdvanceX, pendingGlyphAdvanceY); hb_buffer_reset(harfbuzzBuffer.get()); if (m_run.directionalOverride()) @@ -288,7 +306,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns(GlyphBuffer* glyphBuffer) return true; } -void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, unsigned runIndexInVisualOrder, hb_buffer_t* harfbuzzBuffer, GlyphBuffer* glyphBuffer) +void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, unsigned runIndexInVisualOrder, hb_buffer_t* harfbuzzBuffer, GlyphBuffer* glyphBuffer, float& pendingGlyphAdvanceX, float& pendingGlyphAdvanceY) { const SimpleFontData* currentFontData = currentRun->fontData(); hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfbuzzBuffer, 0); @@ -317,7 +335,7 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, un if (currentFontData->isZeroWidthSpaceGlyph(glyph)) { currentRun->setGlyphAndAdvance(i, glyph, 0); - if (glyphBuffer) + if (glyphBuffer && shouldDrawCharacterAt(currentCharacterIndex)) glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(0, 0)); continue; } @@ -330,7 +348,16 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, un m_startOffset.set(offsetX, offsetY); float glyphAdvanceX = advance + nextOffsetX - offsetX; float glyphAdvanceY = nextOffsetY - offsetY; - glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY)); + if (shouldDrawCharacterAt(currentCharacterIndex)) { + glyphAdvanceX += pendingGlyphAdvanceX; + glyphAdvanceY += pendingGlyphAdvanceY; + pendingGlyphAdvanceX = 0; + pendingGlyphAdvanceY = 0; + glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY)); + } else { + pendingGlyphAdvanceX += glyphAdvanceX; + pendingGlyphAdvanceY += glyphAdvanceY; + } } totalAdvance += advance; diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h index eb3935db1..87844cc7f 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h @@ -51,6 +51,7 @@ public: HarfBuzzShaper(const Font*, const TextRun&); virtual ~HarfBuzzShaper(); + void setDrawRange(int from, int to); bool shape(GlyphBuffer* = 0); FloatPoint adjustStartPoint(const FloatPoint&); float totalWidth() { return m_totalWidth; } @@ -96,11 +97,12 @@ private: float m_width; }; + bool shouldDrawCharacterAt(int index); void setFontFeatures(); bool collectHarfBuzzRuns(); bool shapeHarfBuzzRuns(GlyphBuffer*); - void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, unsigned runIndexInVisualOrder, hb_buffer_t*, GlyphBuffer*); + void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, unsigned runIndexInVisualOrder, hb_buffer_t*, GlyphBuffer*, float& pendingGlyphAdvanceX, float& pendingGlyphAdvanceY); GlyphBufferAdvance createGlyphBufferAdvance(float, float); @@ -109,6 +111,9 @@ private: FloatPoint m_startOffset; + int m_fromIndex; + int m_toIndex; + float m_totalWidth; }; diff --git a/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp b/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp index a726dc34c..13c88bbdc 100644 --- a/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp +++ b/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp @@ -105,6 +105,7 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F if (preferHarfBuzz(this)) { GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); + shaper.setDrawRange(from, to); if (shaper.shape(&glyphBuffer)) { drawGlyphBuffer(context, run, glyphBuffer, point); return; diff --git a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h index d38265fa5..436160718 100644 --- a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h +++ b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h @@ -187,6 +187,8 @@ private: NSMutableDictionary* commonMovieAttributes(); + virtual String engineDescription() const { return "QTKit"; } + MediaPlayer* m_player; RetainPtr<QTMovie> m_qtMovie; RetainPtr<QTMovieView> m_qtMovieView; diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp index 58fc7f7de..5a628810d 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp @@ -130,16 +130,6 @@ String Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE(Platform3DObject if (!isValid) return ""; -#if PLATFORM(BLACKBERRY) - // Our hardware really likes being told what precision to have (i.e., with "precision * float") - // ANGLE strips this information. - if (entry.source.contains("precision lowp float")) - translatedShaderSource = "precision lowp float;\n" + translatedShaderSource; - else if (entry.source.contains("precision mediump float")) - translatedShaderSource = "precision mediump float;\n" + translatedShaderSource; - else - translatedShaderSource = "precision highp float;\n" + translatedShaderSource; -#endif return translatedShaderSource; } diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp index a4d1eb4cd..225628248 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp @@ -122,7 +122,7 @@ void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, #if PLATFORM(BLACKBERRY) paintToCanvas(pixels.get(), m_currentWidth, m_currentHeight, - imageBuffer->internalSize().width(), imageBuffer->internalSize().height(), imageBuffer->context(), true); + imageBuffer->internalSize().width(), imageBuffer->internalSize().height(), imageBuffer->context()); #else paintToCanvas(pixels.get(), m_currentWidth, m_currentHeight, imageBuffer->internalSize().width(), imageBuffer->internalSize().height(), imageBuffer->context()->platformContext()); diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp index 79ddcbbfd..9dbb48335 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp @@ -50,64 +50,25 @@ void GraphicsContext3D::releaseShaderCompiler() void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, void* data) { - // Currently only format=RGBA, type=UNSIGNED_BYTE is supported by the specification: http://www.khronos.org/registry/webgl/specs/latest/ - // If this ever changes, this code will need to be updated. - - // Calculate the strides of our data and canvas - unsigned int formatSize = 4; // RGBA UNSIGNED_BYTE - unsigned int dataStride = width * formatSize; - unsigned int canvasStride = m_currentWidth * formatSize; - - // If we are using a pack alignment of 8, then we need to align our strides to 8 byte boundaries - // See: http://en.wikipedia.org/wiki/Data_structure_alignment (computing padding) - int packAlignment; - glGetIntegerv(GL_PACK_ALIGNMENT, &packAlignment); - if (8 == packAlignment) { - dataStride = (dataStride + 7) & ~7; - canvasStride = (canvasStride + 7) & ~7; - } - - unsigned char* canvasData = new unsigned char[canvasStride * m_currentHeight]; - ::glReadPixels(0, 0, m_currentWidth, m_currentHeight, format, type, canvasData); - - // If we failed to read our canvas data due to a GL error, don't continue - int error = glGetError(); - if (GL_NO_ERROR != error) { - synthesizeGLError(error); - return; - } - - // Clear our data in case some of it lies outside the bounds of our canvas - // TODO: don't do this if all of the data lies inside the bounds of the canvas - memset(data, 0, dataStride * height); - - // Calculate the intersection of our canvas and data bounds - IntRect dataRect(x, y, width, height); - IntRect canvasRect(0, 0, m_currentWidth, m_currentHeight); - IntRect nonZeroDataRect = intersection(dataRect, canvasRect); - - unsigned int xDataOffset = x < 0 ? -x * formatSize : 0; - unsigned int yDataOffset = y < 0 ? -y * dataStride : 0; - unsigned int xCanvasOffset = nonZeroDataRect.x() * formatSize; - unsigned int yCanvasOffset = nonZeroDataRect.y() * canvasStride; - unsigned char* dst = static_cast<unsigned char*>(data) + xDataOffset + yDataOffset; - unsigned char* src = canvasData + xCanvasOffset + yCanvasOffset; - for (int row = 0; row < nonZeroDataRect.height(); row++) { - memcpy(dst, src, nonZeroDataRect.width() * formatSize); - dst += dataStride; - src += canvasStride; - } - - delete [] canvasData; + makeContextCurrent(); + // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., + // all previous rendering calls should be done before reading pixels. + ::glFlush(); #if PLATFORM(BLACKBERRY) - // Imagination specific fix - if (m_isImaginationHardware) + if (m_isImaginationHardware && m_fbo == m_boundFBO) { + // FIXME: This workaround should always be used until the + // driver alignment bug is fixed, even when we aren't + // drawing to the canvas. readPixelsIMG(x, y, width, height, format, type, data); - else + } else ::glReadPixels(x, y, width, height, format, type, data); - - // Note: BlackBerries have a different anti-aliasing pipeline. #else + if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) { + resolveMultisamplingIfNecessary(IntRect(x, y, width, height)); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + ::glFlush(); + } + ::glReadPixels(x, y, width, height, format, type, data); if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) @@ -117,7 +78,17 @@ void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsi void GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary(int x, int y, int width, int height, unsigned char* pixels) { +#if PLATFORM(BLACKBERRY) + if (m_isImaginationHardware && m_fbo == m_boundFBO) { + // FIXME: This workaround should always be used until the + // driver alignment bug is fixed, even when we aren't + // drawing to the canvas. + readPixelsIMG(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + } else + ::glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); +#else ::glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); +#endif int totalBytes = width * height * 4; if (isGLES2Compliant()) { for (int i = 0; i < totalBytes; i += 4) diff --git a/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp index b7dfc2fbe..babaa0ff4 100644 --- a/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp +++ b/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp @@ -67,7 +67,7 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const return m_data->baseSurface(); } -AffineTransform GraphicsContext::getCTM() const +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const { if (paintingDisabled()) return AffineTransform(); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 6a3effacb..d3f507dd3 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -287,7 +287,7 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const return m_data->p(); } -AffineTransform GraphicsContext::getCTM() const +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const { if (paintingDisabled()) return AffineTransform(); diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h index 0e2cf0b92..e217ef5e1 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h @@ -131,6 +131,8 @@ private slots: private: void updateStates(); + virtual String engineDescription() const { return "Qt"; } + private: MediaPlayerPrivateQt(MediaPlayer*); diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 0af779c51..24f664522 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -754,7 +754,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, platformContext()->didDrawPath(path, paint); } -AffineTransform GraphicsContext::getCTM() const +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const { if (paintingDisabled()) return AffineTransform(); diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index 4784c3789..50df71146 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -284,17 +284,12 @@ void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect, } // Copy off the image as |imageBuffer| may be deleted before restore is invoked. - if (!bitmap->pixelRef()) { - // The bitmap owns it's pixels. This happens when we've allocated the - // pixels in some way and assigned them directly to the bitmap (as - // happens when we allocate a DIB). In this case the assignment operator - // does not copy the pixels, rather the copied bitmap ends up - // referencing the same pixels. As the pixels may not live as long as we - // need it to, we copy the image. - bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config); - } else { - // If there is a pixel ref, we can safely use the assignment operator. + if (bitmap->isImmutable()) m_state->m_imageBufferClip = *bitmap; + else { + // We need to make a deep-copy of the pixels themselves, so they don't + // change on us between now and when we want to apply them in restore() + bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config); } } diff --git a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp index 7131b8276..544e94d32 100644 --- a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp +++ b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp @@ -122,6 +122,12 @@ void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntR PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags) { + // We currently disable support for CopyToTexture on Mac, because this is used for single buffered Tiles. + // The single buffered nature of this requires a call to glFlush, as described in platformCopyToTexture. + // This call blocks the GPU for about 40ms, which makes smooth animations impossible. + if (flags & SupportsCopyToTexture) + return PassRefPtr<GraphicsSurface>(); + unsigned pixelFormat = 'BGRA'; unsigned bytesPerElement = 4; int width = size.width(); @@ -165,6 +171,12 @@ PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token) { + // We currently disable support for CopyToTexture on Mac, because this is used for single buffered Tiles. + // The single buffered nature of this requires a call to glFlush, as described in platformCopyToTexture. + // This call blocks the GPU for about 40ms, which makes smooth animations impossible. + if (flags & SupportsCopyToTexture) + return PassRefPtr<GraphicsSurface>(); + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); surface->m_platformSurface = IOSurfaceLookup(token); if (!surface->m_platformSurface) diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp index efa659f84..8d60c7b5e 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp @@ -18,6 +18,8 @@ */ #include "config.h" + +#if USE(ACCELERATED_COMPOSITING) #include "TextureMapperBackingStore.h" #include "GraphicsLayer.h" @@ -222,3 +224,4 @@ void TextureMapperTiledBackingStore::setDebugBorder(const Color& color, float wi } } +#endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h index 0f71c45b0..4123066b8 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h @@ -20,6 +20,8 @@ #ifndef TextureMapperBackingStore_h #define TextureMapperBackingStore_h +#if USE(ACCELERATED_COMPOSITING) + #include "FloatRect.h" #include "Image.h" #include "TextureMapper.h" @@ -128,4 +130,6 @@ private: }; } +#endif + #endif // TextureMapperBackingStore_h diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp index 688e26f4e..86704bc15 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp @@ -22,7 +22,6 @@ #include "TextureMapperGL.h" #include "GraphicsContext.h" -#include "GraphicsContext3D.h" #include "Image.h" #include "NotImplemented.h" #include "TextureMapperShaderManager.h" @@ -52,6 +51,12 @@ #include <GL/glx.h> #endif +#if USE(CAIRO) +#include "CairoUtilities.h" +#include "RefPtrCairo.h" +#include <cairo.h> +#endif + #define GL_CMD(...) do { __VA_ARGS__; ASSERT_ARG(__VA_ARGS__, !glGetError()); } while (0) namespace WebCore { struct TextureMapperGLData { @@ -622,6 +627,26 @@ bool BitmapTextureGL::canReuseWith(const IntSize& contentsSize, Flags) #define DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE GL_UNSIGNED_BYTE #endif +static void swizzleBGRAToRGBA(uint32_t* data, const IntRect& rect, int stride = 0) +{ + stride = stride ? stride : rect.width(); + for (int y = rect.y(); y < rect.maxY(); ++y) { + uint32_t* p = data + y * stride; + for (int x = rect.x(); x < rect.maxX(); ++x) + p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00); + } +} + +static bool driverSupportsBGRASwizzling() +{ +#if defined(TEXMAP_OPENGL_ES_2) + // FIXME: Implement reliable detection. See also https://bugs.webkit.org/show_bug.cgi?id=81103. + return false; +#else + return true; +#endif +} + static bool driverSupportsSubImage() { #if defined(TEXMAP_OPENGL_ES_2) @@ -641,23 +666,31 @@ void BitmapTextureGL::didReset() if (m_textureSize == contentSize()) return; + GLuint format = driverSupportsBGRASwizzling() ? GL_BGRA : GL_RGBA; + m_textureSize = contentSize(); GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)); GL_CMD(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); GL_CMD(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); GL_CMD(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); GL_CMD(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); - GL_CMD(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_textureSize.width(), m_textureSize.height(), 0, GL_RGBA, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, 0)); + GL_CMD(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_textureSize.width(), m_textureSize.height(), 0, format, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, 0)); } void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine) { + GLuint glFormat = GL_RGBA; GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)); const unsigned bytesPerPixel = 4; - if (bytesPerLine == targetRect.width() * bytesPerPixel && sourceOffset == IntPoint::zero()) { - GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), GL_RGBA, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data)); + if (driverSupportsBGRASwizzling()) + glFormat = GL_BGRA; + else + swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(const_cast<void*>(data)), IntRect(sourceOffset, targetRect.size()), bytesPerLine / bytesPerPixel); + + if (bytesPerLine == targetRect.width() / 4 && sourceOffset == IntPoint::zero()) { + GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data)); return; } @@ -675,7 +708,7 @@ void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect dst += targetBytesPerLine; } - GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), GL_RGBA, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, temporaryData.data())); + GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, temporaryData.data())); return; } @@ -684,7 +717,7 @@ void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect GL_CMD(glPixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel)); GL_CMD(glPixelStorei(GL_UNPACK_SKIP_ROWS, sourceOffset.y())); GL_CMD(glPixelStorei(GL_UNPACK_SKIP_PIXELS, sourceOffset.x())); - GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), GL_RGBA, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data)); + GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data)); GL_CMD(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)); GL_CMD(glPixelStorei(GL_UNPACK_SKIP_ROWS, 0)); GL_CMD(glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0)); @@ -695,12 +728,23 @@ void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co { if (!image) return; + NativeImagePtr frameImage = image->nativeImageForCurrentFrame(); + if (!frameImage) + return; - Vector<uint8_t> imageData; - GraphicsContext3D::extractImageData(image, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, false /* flipY */, true /* premultiplyAlpha */, false /* ignoreGammaAndColorProfile */, imageData); + int bytesPerLine; + const char* imageData; - const unsigned bytesPerPixel = 4; - updateContents(imageData.data(), targetRect, offset, image->width() * bytesPerPixel); +#if PLATFORM(QT) + imageData = reinterpret_cast<const char*>(frameImage->constBits()); + bytesPerLine = frameImage->bytesPerLine(); +#elif USE(CAIRO) + cairo_surface_t* surface = frameImage->surface(); + imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(surface)); + bytesPerLine = cairo_image_surface_get_stride(surface); +#endif + + updateContents(imageData, targetRect, offset, bytesPerLine); } #if ENABLE(CSS_FILTERS) diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h index 45042ca8d..de0da3856 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h @@ -20,6 +20,8 @@ #ifndef TextureMapperLayer_h #define TextureMapperLayer_h +#if USE(ACCELERATED_COMPOSITING) + #include "FilterOperations.h" #include "FloatRect.h" #include "GraphicsContext.h" @@ -245,4 +247,6 @@ private: TextureMapperLayer* toTextureMapperLayer(GraphicsLayer*); } +#endif + #endif // TextureMapperLayer_h diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h index eb52ef64d..66334f244 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h @@ -156,6 +156,8 @@ private: virtual void setPrivateBrowsingMode(bool); + virtual String engineDescription() const { return "QuickTime"; } + class MovieClient; friend class MovieClient; OwnPtr<MovieClient> m_movieClient; diff --git a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp index b46bf1170..50880a97e 100644 --- a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp @@ -138,9 +138,9 @@ static int generateComponents(TextRunComponents* components, const Font &font, c } for (int i = 1; i < run.length(); ++i) { uint ch = run[i]; - if (isHighSurrogate(ch) && isLowSurrogate(run[i-1])) - ch = surrogateToUcs4(ch, run[i-1]); - if (isLowSurrogate(ch) || category(ch) == Mark_NonSpacing) + if (U16_IS_LEAD(ch) && U16_IS_TRAIL(run[i-1])) + ch = U16_GET_SUPPLEMENTARY(ch, run[i-1]); + if (U16_IS_TRAIL(ch) || category(ch) == Mark_NonSpacing) continue; if (Font::treatAsSpace(run[i])) { int add = 0; diff --git a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp index 92e02a056..46e2ce800 100644 --- a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp @@ -1492,7 +1492,7 @@ void GraphicsContext::fillRect(const FloatRect& r, const Gradient* gradient) GradientFill(dc, tv.data(), tv.size(), mesh.data(), mesh.size(), vertical ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H); } -AffineTransform GraphicsContext::getCTM() const +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const { if (paintingDisabled()) return AffineTransform(); diff --git a/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h b/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h index ab4ec4d05..009f0d431 100644 --- a/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h +++ b/Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h @@ -103,6 +103,8 @@ namespace WebCore { static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs, const KURL&); static bool isAvailable(); + virtual String engineDescription() const { return "WinCE"; } + MediaPlayer* m_player; float m_seekTo; float m_endTime; diff --git a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 78e608993..9d5487011 100644 --- a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -477,7 +477,7 @@ void GraphicsContext::canvasClip(const Path& path) clip(path); } -AffineTransform GraphicsContext::getCTM() const +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const { if (paintingDisabled()) return AffineTransform(); diff --git a/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp b/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp index f2cfa877f..8c0413efc 100644 --- a/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp +++ b/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp @@ -40,12 +40,19 @@ PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create() return adoptPtr(new AsyncFileSystemGtk()); } +// FIXME: Add FileSystemType parameter. void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { notImplemented(); callbacks->didFail(NOT_SUPPORTED_ERR); } +void AsyncFileSystem::deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + notImplemented(); + callbacks->didFail(NOT_SUPPORTED_ERR); +} + AsyncFileSystemGtk::AsyncFileSystemGtk() { notImplemented(); diff --git a/Source/WebCore/platform/gtk/ClipboardGtk.cpp b/Source/WebCore/platform/gtk/ClipboardGtk.cpp index b22adf4a4..891126d5b 100644 --- a/Source/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/Source/WebCore/platform/gtk/ClipboardGtk.cpp @@ -224,7 +224,7 @@ PassRefPtr<FileList> ClipboardGtk::files() const RefPtr<FileList> fileList = FileList::create(); const Vector<String>& filenames = m_dataObject->filenames(); for (size_t i = 0; i < filenames.size(); i++) - fileList->append(File::create(filenames[i])); + fileList->append(File::create(filenames[i], File::AllContentTypes)); return fileList.release(); } diff --git a/Source/WebCore/platform/gtk/ContextMenuGtk.cpp b/Source/WebCore/platform/gtk/ContextMenuGtk.cpp index 8916525db..8c002c4d9 100644 --- a/Source/WebCore/platform/gtk/ContextMenuGtk.cpp +++ b/Source/WebCore/platform/gtk/ContextMenuGtk.cpp @@ -103,7 +103,7 @@ Vector<ContextMenuItem> contextMenuItemVector(const PlatformMenuDescription menu GtkWidget* widget = static_cast<GtkWidget*>(item->data); if (!GTK_IS_MENU_ITEM(widget)) continue; - menuItemVector.append(ContextMenuItem(GTK_MENU_ITEM(widget))); + menuItemVector.append(GTK_MENU_ITEM(widget)); } return menuItemVector; diff --git a/Source/WebCore/platform/gtk/KeyBindingTranslator.h b/Source/WebCore/platform/gtk/KeyBindingTranslator.h index 0991a44b2..bc4a3ff4a 100644 --- a/Source/WebCore/platform/gtk/KeyBindingTranslator.h +++ b/Source/WebCore/platform/gtk/KeyBindingTranslator.h @@ -33,7 +33,7 @@ public: enum EventType { KeyDown, KeyPress }; void getEditorCommandsForKeyEvent(GdkEventKey*, EventType, Vector<WTF::String>&); - void addPendingEditorCommand(const char* command) { m_pendingEditorCommands.append(WTF::String(command)); } + void addPendingEditorCommand(const char* command) { m_pendingEditorCommands.append(command); } private: GRefPtr<GtkWidget> m_nativeWidget; diff --git a/Source/WebCore/platform/mac/ClipboardMac.mm b/Source/WebCore/platform/mac/ClipboardMac.mm index 20ec2fba2..7004d23b0 100644 --- a/Source/WebCore/platform/mac/ClipboardMac.mm +++ b/Source/WebCore/platform/mac/ClipboardMac.mm @@ -321,7 +321,7 @@ PassRefPtr<FileList> ClipboardMac::files() const for (size_t i = 0; i < absoluteURLs.size(); i++) { NSURL *absoluteURL = [NSURL URLWithString:absoluteURLs[i]]; ASSERT([absoluteURL isFileURL]); - fileList->append(File::create([absoluteURL path])); + fileList->append(File::create([absoluteURL path], File::AllContentTypes)); } return fileList.release(); // We will always return a FileList, sometimes empty } diff --git a/Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandler.h b/Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandler.h deleted file mode 100644 index 6e34de56d..000000000 --- a/Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandler.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2011 Ericsson AB. 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. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DeprecatedPeerConnectionHandler_h -#define DeprecatedPeerConnectionHandler_h - -#if ENABLE(MEDIA_STREAM) - -#include "MediaStreamDescriptor.h" -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { - -class DeprecatedPeerConnectionHandlerClient; - -#if PLATFORM(CHROMIUM) -class DeprecatedPeerConnectionHandlerInternal; -#endif - -class DeprecatedPeerConnectionHandler { - WTF_MAKE_NONCOPYABLE(DeprecatedPeerConnectionHandler); - WTF_MAKE_FAST_ALLOCATED; -public: - static PassOwnPtr<DeprecatedPeerConnectionHandler> create(DeprecatedPeerConnectionHandlerClient*, const String& serverConfiguration, const String& username); - ~DeprecatedPeerConnectionHandler(); - - void produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams); - void handleInitialOffer(const String& sdp); - void processSDP(const String& sdp); - void processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams); - void sendDataStreamMessage(const char* data, size_t length); - - void stop(); - -private: - DeprecatedPeerConnectionHandler(DeprecatedPeerConnectionHandlerClient*, const String& serverConfiguration, const String& username); - -#if PLATFORM(CHROMIUM) - OwnPtr<DeprecatedPeerConnectionHandlerInternal> m_private; -#elif USE(GSTREAMER) - DeprecatedPeerConnectionHandlerClient* m_client; -#endif -}; - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) - -#endif // DeprecatedPeerConnectionHandler_h diff --git a/Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandlerClient.h b/Source/WebCore/platform/mediastream/MediaStreamSource.cpp index 86c7f09ea..1720487dc 100644 --- a/Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandlerClient.h +++ b/Source/WebCore/platform/mediastream/MediaStreamSource.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google AB. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,7 +11,7 @@ * notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors + * 3. Neither the name of Google Inc. nor the names of its contributors * may be used to endorse or promote products derived from this * software without specific prior written permission. * @@ -28,40 +28,49 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DeprecatedPeerConnectionHandlerClient_h -#define DeprecatedPeerConnectionHandlerClient_h +#include "config.h" #if ENABLE(MEDIA_STREAM) -#include <wtf/PassRefPtr.h> -#include <wtf/text/WTFString.h> +#include "MediaStreamSource.h" namespace WebCore { -class MediaStreamDescriptor; +PassRefPtr<MediaStreamSource> MediaStreamSource::create(const String& id, Type type, const String& name, ReadyState readyState) +{ + return adoptRef(new MediaStreamSource(id, type, name, readyState)); +} -class DeprecatedPeerConnectionHandlerClient { -public: - // Name and values of the enum must match the corressponding constants in the PeerConnection.idl file. - enum ReadyState { - NEW = 0, - NEGOTIATING = 1, - ACTIVE = 2, - CLOSED = 3 - }; +MediaStreamSource::MediaStreamSource(const String& id, Type type, const String& name, ReadyState readyState) + : m_id(id) + , m_type(type) + , m_name(name) + , m_readyState(readyState) +{ +} - virtual ~DeprecatedPeerConnectionHandlerClient() { } +void MediaStreamSource::setReadyState(ReadyState readyState) +{ + ASSERT(m_readyState != ReadyStateEnded); + if (m_readyState != readyState) { + m_readyState = readyState; + for (Vector<Observer*>::iterator i = m_observers.begin(); i != m_observers.end(); ++i) + (*i)->sourceChangedState(); + } +} - virtual void didCompleteICEProcessing() = 0; - virtual void didGenerateSDP(const String& sdp) = 0; - virtual void didReceiveDataStreamMessage(const char* data, size_t length) = 0; - virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>) = 0; - virtual void didRemoveRemoteStream(MediaStreamDescriptor*) = 0; - virtual void didChangeState(ReadyState) = 0; -}; +void MediaStreamSource::addObserver(MediaStreamSource::Observer* observer) +{ + m_observers.append(observer); +} + +void MediaStreamSource::removeObserver(MediaStreamSource::Observer* observer) +{ + size_t pos = m_observers.find(observer); + if (pos != notFound) + m_observers.remove(pos); +} } // namespace WebCore #endif // ENABLE(MEDIA_STREAM) - -#endif // DeprecatedPeerConnectionHandlerClient_h diff --git a/Source/WebCore/platform/mediastream/MediaStreamSource.h b/Source/WebCore/platform/mediastream/MediaStreamSource.h index 7634e40a5..c45b57142 100644 --- a/Source/WebCore/platform/mediastream/MediaStreamSource.h +++ b/Source/WebCore/platform/mediastream/MediaStreamSource.h @@ -41,36 +41,43 @@ namespace WebCore { class MediaStreamSource : public RefCounted<MediaStreamSource> { public: + class Observer { + public: + virtual ~Observer() { } + virtual void sourceChangedState() = 0; + }; + enum Type { TypeAudio, TypeVideo }; - static PassRefPtr<MediaStreamSource> create(const String& id, Type type, const String& name) - { - return adoptRef(new MediaStreamSource(id, type, name)); - } + enum ReadyState { + ReadyStateLive = 0, + ReadyStateMuted = 1, + ReadyStateEnded = 2 + }; + + static PassRefPtr<MediaStreamSource> create(const String& id, Type, const String& name, ReadyState = ReadyStateLive); const String& id() const { return m_id; } Type type() const { return m_type; } const String& name() const { return m_name; } - bool muted() const { return m_muted; } - void setMuted(bool muted) { m_muted = muted; } + void setReadyState(ReadyState); + ReadyState readyState() const { return m_readyState; } + + void addObserver(Observer*); + void removeObserver(Observer*); private: - MediaStreamSource(const String& id, Type type, const String& name) - : m_id(id) - , m_type(type) - , m_name(name) - , m_muted(false) - { - } + MediaStreamSource(const String& id, Type, const String& name, ReadyState); String m_id; Type m_type; String m_name; - bool m_muted; + ReadyState m_readyState; + Vector<Observer*> m_observers; }; typedef Vector<RefPtr<MediaStreamSource> > MediaStreamSourceVector; diff --git a/Source/WebCore/platform/mediastream/blackberry/DeprecatedPeerConnectionHandler.cpp b/Source/WebCore/platform/mediastream/blackberry/DeprecatedPeerConnectionHandler.cpp deleted file mode 100644 index d6e3d5866..000000000 --- a/Source/WebCore/platform/mediastream/blackberry/DeprecatedPeerConnectionHandler.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2011 Ericsson AB. 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. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(MEDIA_STREAM) - -#include "DeprecatedPeerConnectionHandler.h" - -#include "DeprecatedPeerConnectionHandlerClient.h" - -namespace WebCore { - -PassOwnPtr<DeprecatedPeerConnectionHandler> DeprecatedPeerConnectionHandler::create(DeprecatedPeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username) -{ - return adoptPtr(new DeprecatedPeerConnectionHandler(client, serverConfiguration, username)); -} - -// Empty implementations for ports that build with MEDIA_STREAM enabled by default. -DeprecatedPeerConnectionHandler::DeprecatedPeerConnectionHandler(DeprecatedPeerConnectionHandlerClient*, const String&, const String&) -{ -} - -DeprecatedPeerConnectionHandler::~DeprecatedPeerConnectionHandler() -{ -} - -void DeprecatedPeerConnectionHandler::produceInitialOffer(const MediaStreamDescriptorVector&) -{ -} - -void DeprecatedPeerConnectionHandler::handleInitialOffer(const String&) -{ -} - -void DeprecatedPeerConnectionHandler::processSDP(const String&) -{ -} - -void DeprecatedPeerConnectionHandler::processPendingStreams(const MediaStreamDescriptorVector&, const MediaStreamDescriptorVector&) -{ -} - -void DeprecatedPeerConnectionHandler::sendDataStreamMessage(const char*, size_t) -{ -} - -void DeprecatedPeerConnectionHandler::stop() -{ -} - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandler.cpp b/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandler.cpp deleted file mode 100644 index 10d5f17e3..000000000 --- a/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandler.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(MEDIA_STREAM) - -#include "DeprecatedPeerConnectionHandler.h" - -#include "DeprecatedPeerConnectionHandlerClient.h" -#include "DeprecatedPeerConnectionHandlerInternal.h" - -namespace WebCore { - -PassOwnPtr<DeprecatedPeerConnectionHandler> DeprecatedPeerConnectionHandler::create(DeprecatedPeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username) -{ - return adoptPtr(new DeprecatedPeerConnectionHandler(client, serverConfiguration, username)); -} - -DeprecatedPeerConnectionHandler::DeprecatedPeerConnectionHandler(DeprecatedPeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username) - : m_private(adoptPtr(new DeprecatedPeerConnectionHandlerInternal(client, serverConfiguration, username))) -{ -} - -DeprecatedPeerConnectionHandler::~DeprecatedPeerConnectionHandler() -{ -} - -void DeprecatedPeerConnectionHandler::produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams) -{ - m_private->produceInitialOffer(pendingAddStreams); -} - -void DeprecatedPeerConnectionHandler::handleInitialOffer(const String& sdp) -{ - m_private->handleInitialOffer(sdp); -} - -void DeprecatedPeerConnectionHandler::processSDP(const String& sdp) -{ - m_private->processSDP(sdp); -} - -void DeprecatedPeerConnectionHandler::processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams) -{ - m_private->processPendingStreams(pendingAddStreams, pendingRemoveStreams); -} - -void DeprecatedPeerConnectionHandler::sendDataStreamMessage(const char* data, size_t length) -{ - m_private->sendDataStreamMessage(data, length); -} - -void DeprecatedPeerConnectionHandler::stop() -{ - m_private->stop(); -} - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.cpp b/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.cpp deleted file mode 100644 index d5e963811..000000000 --- a/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(MEDIA_STREAM) - -#include "DeprecatedPeerConnectionHandlerInternal.h" - -#include "DeprecatedPeerConnectionHandlerClient.h" -#include <public/Platform.h> -#include <public/WebMediaStreamDescriptor.h> -#include <public/WebPeerConnectionHandler.h> -#include <public/WebPeerConnectionHandlerClient.h> -#include <wtf/PassOwnPtr.h> - -namespace WebCore { - -DeprecatedPeerConnectionHandlerInternal::DeprecatedPeerConnectionHandlerInternal(DeprecatedPeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username) - : m_client(client) -{ - ASSERT(m_client); - m_webHandler = adoptPtr(WebKit::Platform::current()->createPeerConnectionHandler(this)); - // FIXME: When there is some error reporting avaliable in the PeerConnection object report - // if we didn't get a WebPeerConnectionHandler instance. - - if (m_webHandler) - m_webHandler->initialize(serverConfiguration, username); -} - -DeprecatedPeerConnectionHandlerInternal::~DeprecatedPeerConnectionHandlerInternal() -{ -} - -void DeprecatedPeerConnectionHandlerInternal::produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams) -{ - if (m_webHandler) - m_webHandler->produceInitialOffer(pendingAddStreams); -} - -void DeprecatedPeerConnectionHandlerInternal::handleInitialOffer(const String& sdp) -{ - if (m_webHandler) - m_webHandler->handleInitialOffer(sdp); -} - -void DeprecatedPeerConnectionHandlerInternal::processSDP(const String& sdp) -{ - if (m_webHandler) - m_webHandler->processSDP(sdp); -} - -void DeprecatedPeerConnectionHandlerInternal::processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams) -{ - if (m_webHandler) - m_webHandler->processPendingStreams(pendingAddStreams, pendingRemoveStreams); -} - -void DeprecatedPeerConnectionHandlerInternal::sendDataStreamMessage(const char* data, size_t length) -{ - if (m_webHandler) - m_webHandler->sendDataStreamMessage(data, length); -} - -void DeprecatedPeerConnectionHandlerInternal::stop() -{ - if (m_webHandler) - m_webHandler->stop(); -} - -void DeprecatedPeerConnectionHandlerInternal::didCompleteICEProcessing() -{ - if (m_webHandler) - m_client->didCompleteICEProcessing(); -} - -void DeprecatedPeerConnectionHandlerInternal::didGenerateSDP(const WebKit::WebString& sdp) -{ - if (m_webHandler) - m_client->didGenerateSDP(sdp); -} - -void DeprecatedPeerConnectionHandlerInternal::didReceiveDataStreamMessage(const char* data, size_t length) -{ - if (m_webHandler) - m_client->didReceiveDataStreamMessage(data, length); -} - -void DeprecatedPeerConnectionHandlerInternal::didAddRemoteStream(const WebKit::WebMediaStreamDescriptor& webMediaStreamDescriptor) -{ - if (m_webHandler) - m_client->didAddRemoteStream(webMediaStreamDescriptor); -} - -void DeprecatedPeerConnectionHandlerInternal::didRemoveRemoteStream(const WebKit::WebMediaStreamDescriptor& webMediaStreamDescriptor) -{ - if (m_webHandler) - m_client->didRemoveRemoteStream(webMediaStreamDescriptor); -} - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.h b/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.h deleted file mode 100644 index 17fcb93b4..000000000 --- a/Source/WebCore/platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DeprecatedPeerConnectionHandlerInternal_h -#define DeprecatedPeerConnectionHandlerInternal_h - -#if ENABLE(MEDIA_STREAM) - -#include "MediaStreamDescriptor.h" -#include <public/WebPeerConnectionHandlerClient.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> -#include <wtf/text/WTFString.h> - -namespace WebKit { -class WebPeerConnectionHandler; -class WebString; -class WebMediaStreamDescriptor; -} - -namespace WebCore { - -class DeprecatedPeerConnectionHandlerClient; - -class DeprecatedPeerConnectionHandlerInternal : public WebKit::WebPeerConnectionHandlerClient { -public: - DeprecatedPeerConnectionHandlerInternal(DeprecatedPeerConnectionHandlerClient*, const String& serverConfiguration, const String& username); - ~DeprecatedPeerConnectionHandlerInternal(); - - virtual void produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams); - virtual void handleInitialOffer(const String& sdp); - virtual void processSDP(const String& sdp); - virtual void processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams); - virtual void sendDataStreamMessage(const char* data, size_t length); - virtual void stop(); - - // WebKit::WebPeerConnectionHandlerClient implementation. - virtual void didCompleteICEProcessing(); - virtual void didGenerateSDP(const WebKit::WebString& sdp); - virtual void didReceiveDataStreamMessage(const char* data, size_t length); - virtual void didAddRemoteStream(const WebKit::WebMediaStreamDescriptor&); - virtual void didRemoveRemoteStream(const WebKit::WebMediaStreamDescriptor&); - -private: - OwnPtr<WebKit::WebPeerConnectionHandler> m_webHandler; - DeprecatedPeerConnectionHandlerClient* m_client; -}; - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) - -#endif // DeprecatedPeerConnectionHandlerInternal_h diff --git a/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp b/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp index 3c82f5f8b..925807442 100644 --- a/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp +++ b/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp @@ -68,9 +68,12 @@ MediaStreamCenterChromium::~MediaStreamCenterChromium() void MediaStreamCenterChromium::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client) { - // FIXME: Remove this "short-circuit" and forward to m_private when Chrome and DumpRenderTree has implemented WebMediaStreamCenter. - MediaStreamSourceVector audioSources, videoSources; - client->didCompleteQuery(audioSources, videoSources); + if (m_private) + m_private->queryMediaStreamSources(client); + else { + MediaStreamSourceVector audioSources, videoSources; + client->didCompleteQuery(audioSources, videoSources); + } } void MediaStreamCenterChromium::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component) @@ -100,9 +103,6 @@ void MediaStreamCenterChromium::didStopLocalMediaStream(MediaStreamDescriptor* s void MediaStreamCenterChromium::didCreateMediaStream(MediaStreamDescriptor* stream) { if (m_private) { - // FIXME: Remove when Chromium have switched to the new API. - m_private->didConstructMediaStream(stream); - WebKit::WebMediaStreamDescriptor webStream(stream); m_private->didCreateMediaStream(webStream); } diff --git a/Source/WebCore/platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp b/Source/WebCore/platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp deleted file mode 100644 index d6e3d5866..000000000 --- a/Source/WebCore/platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2011 Ericsson AB. 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. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(MEDIA_STREAM) - -#include "DeprecatedPeerConnectionHandler.h" - -#include "DeprecatedPeerConnectionHandlerClient.h" - -namespace WebCore { - -PassOwnPtr<DeprecatedPeerConnectionHandler> DeprecatedPeerConnectionHandler::create(DeprecatedPeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username) -{ - return adoptPtr(new DeprecatedPeerConnectionHandler(client, serverConfiguration, username)); -} - -// Empty implementations for ports that build with MEDIA_STREAM enabled by default. -DeprecatedPeerConnectionHandler::DeprecatedPeerConnectionHandler(DeprecatedPeerConnectionHandlerClient*, const String&, const String&) -{ -} - -DeprecatedPeerConnectionHandler::~DeprecatedPeerConnectionHandler() -{ -} - -void DeprecatedPeerConnectionHandler::produceInitialOffer(const MediaStreamDescriptorVector&) -{ -} - -void DeprecatedPeerConnectionHandler::handleInitialOffer(const String&) -{ -} - -void DeprecatedPeerConnectionHandler::processSDP(const String&) -{ -} - -void DeprecatedPeerConnectionHandler::processPendingStreams(const MediaStreamDescriptorVector&, const MediaStreamDescriptorVector&) -{ -} - -void DeprecatedPeerConnectionHandler::sendDataStreamMessage(const char*, size_t) -{ -} - -void DeprecatedPeerConnectionHandler::stop() -{ -} - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp b/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp index 42ad91fcd..ce203eae7 100644 --- a/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp +++ b/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp @@ -29,6 +29,7 @@ #include "SQLiteStatement.h" #include <BlackBerryPlatformClient.h> #include <BlackBerryPlatformEncryptor.h> +#include <CertMgrWrapper.h> #define HANDLE_SQL_EXEC_FAILURE(statement, returnValue, ...) \ if (statement) { \ @@ -38,6 +39,17 @@ namespace WebCore { +static unsigned hashCredentialInfo(const String& url, const ProtectionSpace& space, const String& username) +{ + String hashString = String::format("%s@%s@%s@%d@%d@%s@%d", + username.utf8().data(), url.utf8().data(), + space.host().utf8().data(), space.port(), + static_cast<int>(space.serverType()), + space.realm().utf8().data(), + static_cast<int>(space.authenticationScheme())); + return StringHasher::computeHash(hashString.characters(), hashString.length()); +} + CredentialBackingStore& credentialBackingStore() { DEFINE_STATIC_LOCAL(CredentialBackingStore, backingStore, ()); @@ -57,6 +69,7 @@ CredentialBackingStore::CredentialBackingStore() , m_hasNeverRememberStatement(0) , m_getNeverRememberStatement(0) , m_removeNeverRememberStatement(0) + , m_usingCertManager(BlackBerry::Platform::CertMgrWrapper::instance()->isReady()) { } @@ -125,11 +138,11 @@ bool CredentialBackingStore::open(const String& dbPath) HANDLE_SQL_EXEC_FAILURE(m_hasLoginStatement->prepare() != SQLResultOk, false, "Failed to prepare hasLogin statement"); - m_getLoginStatement = new SQLiteStatement(m_database, "SELECT username, password FROM logins WHERE host = ? AND port = ? AND service_type = ? AND realm = ? AND auth_scheme = ?"); + m_getLoginStatement = new SQLiteStatement(m_database, "SELECT username, password, origin_url FROM logins WHERE host = ? AND port = ? AND service_type = ? AND realm = ? AND auth_scheme = ?"); HANDLE_SQL_EXEC_FAILURE(m_getLoginStatement->prepare() != SQLResultOk, false, "Failed to prepare getLogin statement"); - m_getLoginByURLStatement = new SQLiteStatement(m_database, "SELECT username, password FROM logins WHERE origin_url = ?"); + m_getLoginByURLStatement = new SQLiteStatement(m_database, "SELECT username, password, host, port, service_type, realm, auth_scheme FROM logins WHERE origin_url = ?"); HANDLE_SQL_EXEC_FAILURE(m_getLoginByURLStatement->prepare() != SQLResultOk, false, "Failed to prepare getLoginByURL statement"); @@ -171,14 +184,17 @@ bool CredentialBackingStore::addLogin(const KURL& url, const ProtectionSpace& pr m_addLoginStatement->bindText(5, protectionSpace.realm()); m_addLoginStatement->bindInt(6, static_cast<int>(protectionSpace.authenticationScheme())); m_addLoginStatement->bindText(7, credential.user()); - m_addLoginStatement->bindBlob(8, encryptedString(credential.password())); + m_addLoginStatement->bindBlob(8, m_usingCertManager ? "" : encryptedString(credential.password())); int result = m_addLoginStatement->step(); m_addLoginStatement->reset(); HANDLE_SQL_EXEC_FAILURE(result != SQLResultDone, false, "Failed to add login info into table logins - %i", result); - return true; + if (!m_usingCertManager) + return true; + unsigned hash = hashCredentialInfo(url.string(), protectionSpace, credential.user()); + return BlackBerry::Platform::CertMgrWrapper::instance()->savePassword(hash, encryptedString(credential.password()).latin1().data()); } bool CredentialBackingStore::updateLogin(const KURL& url, const ProtectionSpace& protectionSpace, const Credential& credential) @@ -190,7 +206,7 @@ bool CredentialBackingStore::updateLogin(const KURL& url, const ProtectionSpace& return false; m_updateLoginStatement->bindText(1, credential.user()); - m_updateLoginStatement->bindBlob(2, encryptedString(credential.password())); + m_updateLoginStatement->bindBlob(2, m_usingCertManager ? "" : encryptedString(credential.password())); m_updateLoginStatement->bindText(3, url.string()); m_updateLoginStatement->bindText(4, protectionSpace.host()); m_updateLoginStatement->bindInt(5, protectionSpace.port()); @@ -203,7 +219,10 @@ bool CredentialBackingStore::updateLogin(const KURL& url, const ProtectionSpace& HANDLE_SQL_EXEC_FAILURE(result != SQLResultDone, false, "Failed to update login info in table logins - %i", result); - return true; + if (!m_usingCertManager) + return true; + unsigned hash = hashCredentialInfo(url.string(), protectionSpace, credential.user()); + return BlackBerry::Platform::CertMgrWrapper::instance()->savePassword(hash, encryptedString(credential.password()).latin1().data()); } bool CredentialBackingStore::hasLogin(const KURL& url, const ProtectionSpace& protectionSpace) @@ -248,12 +267,20 @@ Credential CredentialBackingStore::getLogin(const ProtectionSpace& protectionSpa int result = m_getLoginStatement->step(); String username = m_getLoginStatement->getColumnText(0); - String password = m_getLoginStatement->getColumnBlobAsString(1); + String password = m_usingCertManager ? "" : m_getLoginStatement->getColumnBlobAsString(1); + String url = m_getLoginStatement->getColumnText(2); m_getLoginStatement->reset(); HANDLE_SQL_EXEC_FAILURE(result != SQLResultRow, Credential(), "Failed to execute select login info from table logins in getLogin - %i", result); - return Credential(username, decryptedString(password), CredentialPersistencePermanent); + if (!m_usingCertManager) + return Credential(username, decryptedString(password), CredentialPersistencePermanent); + + unsigned hash = hashCredentialInfo(url, protectionSpace, username); + std::string passwordBlob; + if (!BlackBerry::Platform::CertMgrWrapper::instance()->getPassword(hash, passwordBlob)) + return Credential(); + return Credential(username, decryptedString(passwordBlob.c_str()), CredentialPersistencePermanent); } Credential CredentialBackingStore::getLogin(const KURL& url) @@ -268,12 +295,26 @@ Credential CredentialBackingStore::getLogin(const KURL& url) int result = m_getLoginByURLStatement->step(); String username = m_getLoginByURLStatement->getColumnText(0); - String password = m_getLoginByURLStatement->getColumnBlobAsString(1); + String password = m_usingCertManager ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1); + String host = m_getLoginByURLStatement->getColumnText(2); + int port = m_getLoginByURLStatement->getColumnInt(3); + int serviceType = m_getLoginByURLStatement->getColumnInt(4); + String realm = m_getLoginByURLStatement->getColumnText(5); + int authenticationScheme = m_getLoginByURLStatement->getColumnInt(6); m_getLoginByURLStatement->reset(); HANDLE_SQL_EXEC_FAILURE(result != SQLResultRow, Credential(), - "Failed to execute select login info from table logins in getLogin - %i", result); + "Failed to execute select login info from table logins in getLoginByURL - %i", result); + + if (!m_usingCertManager) + return Credential(username, decryptedString(password), CredentialPersistencePermanent); - return Credential(username, decryptedString(password), CredentialPersistencePermanent); + ProtectionSpace protectionSpace(host, port, static_cast<ProtectionSpaceServerType>(serviceType), + realm, static_cast<ProtectionSpaceAuthenticationScheme>(authenticationScheme)); + unsigned hash = hashCredentialInfo(url, protectionSpace, username); + std::string passwordBlob; + if (!BlackBerry::Platform::CertMgrWrapper::instance()->getPassword(hash, passwordBlob)) + return Credential(); + return Credential(username, decryptedString(passwordBlob.c_str()), CredentialPersistencePermanent); } bool CredentialBackingStore::removeLogin(const KURL& url, const ProtectionSpace& protectionSpace) diff --git a/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h b/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h index 7cd49e22c..12af13cf8 100644 --- a/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h +++ b/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h @@ -64,6 +64,8 @@ private: SQLiteStatement* m_hasNeverRememberStatement; SQLiteStatement* m_getNeverRememberStatement; SQLiteStatement* m_removeNeverRememberStatement; + + bool m_usingCertManager; }; CredentialBackingStore& credentialBackingStore(); diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index e01bdc155..a6dd1a8ae 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -684,15 +684,19 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot if (!newURL.isValid()) return false; - int port = 0; + String host; + int port; if (type == ProtectionSpaceProxyHTTP) { - std::stringstream toPort(BlackBerry::Platform::Client::get()->getProxyPort()); - toPort >> port; - } else + String proxyAddress = BlackBerry::Platform::Client::get()->getProxyAddress(newURL.string().ascii().data()).c_str(); + KURL proxyURL(KURL(), proxyAddress); + host = proxyURL.host(); + port = proxyURL.port(); + } else { + host = m_response.url().host(); port = m_response.url().port(); + } - ProtectionSpace protectionSpace((type == ProtectionSpaceProxyHTTP) ? BlackBerry::Platform::Client::get()->getProxyAddress().c_str() : m_response.url().host() - , port, type, realm, scheme); + ProtectionSpace protectionSpace(host, port, type, realm, scheme); // We've got the scheme and realm. Now we need a username and password. // First search the CredentialStorage. diff --git a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp index 3c439d91f..3d8d4c691 100644 --- a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp +++ b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp @@ -21,7 +21,7 @@ #include "BlobRegistryImpl.h" #include "CookieManager.h" -#include <BlackBerryPlatformClient.h> +#include <LocaleHandler.h> #include <network/NetworkRequest.h> #include <wtf/HashMap.h> #include <wtf/text/CString.h> @@ -218,7 +218,7 @@ void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest, if (!httpHeaderFields().contains("Accept-Language")) { // Locale has the form "en-US". Construct accept language like "en-US, en;q=0.8". - std::string locale = BlackBerry::Platform::Client::get()->getLocale(); + std::string locale = BlackBerry::Platform::LocaleHandler::instance()->language(); // POSIX locale has '_' instead of '-'. // Replace to conform to HTTP spec. size_t underscore = locale.find('_'); diff --git a/Source/WebCore/platform/qt/ClipboardQt.cpp b/Source/WebCore/platform/qt/ClipboardQt.cpp index 8e4c5800d..8edbbe384 100644 --- a/Source/WebCore/platform/qt/ClipboardQt.cpp +++ b/Source/WebCore/platform/qt/ClipboardQt.cpp @@ -208,7 +208,7 @@ PassRefPtr<FileList> ClipboardQt::files() const QUrl url = urls[i]; if (url.scheme() != QLatin1String("file")) continue; - fileList->append(File::create(url.toLocalFile())); + fileList->append(File::create(url.toLocalFile(), File::AllContentTypes)); } return fileList.release(); diff --git a/Source/WebCore/platform/text/TextChecking.h b/Source/WebCore/platform/text/TextChecking.h index 53364397f..13da5e973 100644 --- a/Source/WebCore/platform/text/TextChecking.h +++ b/Source/WebCore/platform/text/TextChecking.h @@ -39,8 +39,10 @@ namespace WebCore { #define WTF_USE_GRAMMAR_CHECKING 1 -#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) +#if (PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)) || PLATFORM(BLACKBERRY) #define WTF_USE_UNIFIED_TEXT_CHECKING 1 +#endif +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) #define WTF_USE_AUTOMATIC_TEXT_REPLACEMENT 1 #endif diff --git a/Source/WebCore/platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp b/Source/WebCore/platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp index b14b3106b..04e29470b 100644 --- a/Source/WebCore/platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp +++ b/Source/WebCore/platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp @@ -19,20 +19,18 @@ #include "config.h" #include "TextBreakIteratorInternalICU.h" -#include "NotImplemented.h" +#include <LocaleHandler.h> namespace WebCore { const char* currentSearchLocaleID() { - notImplemented(); - return ""; + return BlackBerry::Platform::LocaleHandler::instance()->region().c_str(); } const char* currentTextBreakLocaleID() { - notImplemented(); - return "en_us"; + return BlackBerry::Platform::LocaleHandler::instance()->region().c_str(); } } diff --git a/Source/WebCore/platform/text/gtk/TextCheckerEnchant.cpp b/Source/WebCore/platform/text/gtk/TextCheckerEnchant.cpp new file mode 100644 index 000000000..d0d99c0fc --- /dev/null +++ b/Source/WebCore/platform/text/gtk/TextCheckerEnchant.cpp @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "TextCheckerEnchant.h" + +#if ENABLE(SPELLCHECK) + +#include <pango/pango.h> +#include <wtf/gobject/GOwnPtr.h> +#include <wtf/text/CString.h> + +using namespace WebCore; + +static const size_t maximumNumberOfSuggestions = 10; + +static void getAvailableDictionariesCallback(const char* const languageTag, const char* const, const char* const, const char* const, void* data) +{ + Vector<CString>* dictionaries = static_cast<Vector<CString>*>(data); + dictionaries->append(languageTag); +} + +static bool wordEndIsAContractionApostrophe(const char* string, long offset) +{ + if (g_utf8_get_char(g_utf8_offset_to_pointer(string, offset)) != g_utf8_get_char("'")) + return false; + + // If this is the last character in the string, it cannot be the apostrophe part of a contraction. + if (offset == g_utf8_strlen(string, -1)) + return false; + + return g_unichar_isalpha(g_utf8_get_char(g_utf8_offset_to_pointer(string, offset + 1))); +} + +TextCheckerEnchant::TextCheckerEnchant() + : m_broker(enchant_broker_init()) + , m_enchantDictionaries(0) +{ +} + +TextCheckerEnchant::~TextCheckerEnchant() +{ + if (!m_broker) + return; + + freeEnchantBrokerDictionaries(); + enchant_broker_free(m_broker); +} + +void TextCheckerEnchant::ignoreWord(const String& word) +{ + for (Vector<EnchantDict*>::const_iterator iter = m_enchantDictionaries.begin(); iter != m_enchantDictionaries.end(); ++iter) + enchant_dict_add_to_session(*iter, word.utf8().data(), -1); +} + +void TextCheckerEnchant::learnWord(const String& word) +{ + for (Vector<EnchantDict*>::const_iterator iter = m_enchantDictionaries.begin(); iter != m_enchantDictionaries.end(); ++iter) + enchant_dict_add_to_personal(*iter, word.utf8().data(), -1); +} + +void TextCheckerEnchant::checkSpellingOfString(const String& string, int& misspellingLocation, int& misspellingLength) +{ + if (m_enchantDictionaries.isEmpty()) + return; + Vector<EnchantDict*>::const_iterator dictIter = m_enchantDictionaries.begin(); + + GOwnPtr<gchar> cString(g_strdup(string.utf8().data())); + size_t length = string.utf8().length(); + + PangoLanguage* language(pango_language_get_default()); + GOwnPtr<PangoLogAttr> attrs(g_new(PangoLogAttr, length + 1)); + + // pango_get_log_attrs uses an aditional position at the end of the text. + pango_get_log_attrs(cString.get(), -1, -1, language, attrs.get(), length + 1); + + for (size_t i = 0; i < length + 1; i++) { + // We go through each character until we find an is_word_start, + // then we get into an inner loop to find the is_word_end corresponding + // to it. + if (attrs.get()[i].is_word_start) { + int start = i; + int end = i; + int wordLength; + + while (attrs.get()[end].is_word_end < 1 || wordEndIsAContractionApostrophe(cString.get(), end)) + end++; + + wordLength = end - start; + // Set the iterator to be at the current word end, so we don't + // check characters twice. + i = end; + + gchar* cstart = g_utf8_offset_to_pointer(cString.get(), start); + gint bytes = static_cast<gint>(g_utf8_offset_to_pointer(cString.get(), end) - cstart); + GOwnPtr<gchar> word(g_new0(gchar, bytes + 1)); + + g_utf8_strncpy(word.get(), cstart, wordLength); + + for (; dictIter != m_enchantDictionaries.end(); ++dictIter) { + if (enchant_dict_check(*dictIter, word.get(), wordLength)) { + misspellingLocation = start; + misspellingLength = wordLength; + } else { + // Stop checking, this word is ok in at least one dict. + misspellingLocation = -1; + misspellingLength = 0; + break; + } + } + } + } +} + +Vector<String> TextCheckerEnchant::getGuessesForWord(const String& word) +{ + Vector<String> guesses; + if (m_enchantDictionaries.isEmpty()) + return guesses; + + for (Vector<EnchantDict*>::const_iterator iter = m_enchantDictionaries.begin(); iter != m_enchantDictionaries.end(); ++iter) { + size_t numberOfSuggestions; + size_t i; + + gchar** suggestions = enchant_dict_suggest(*iter, word.utf8().data(), -1, &numberOfSuggestions); + if (numberOfSuggestions <= 0) + continue; + + if (numberOfSuggestions > maximumNumberOfSuggestions) + numberOfSuggestions = maximumNumberOfSuggestions; + + for (i = 0; i < numberOfSuggestions; i++) + guesses.append(String(suggestions[i])); + + enchant_dict_free_suggestions(*iter, suggestions); + } + + return guesses; +} + +void TextCheckerEnchant::updateSpellCheckingLanguages(const String& languages) +{ + Vector<EnchantDict*> spellDictionaries; + + if (!languages.isEmpty()) { + Vector<String> languagesVector; + languages.split(static_cast<UChar>(','), languagesVector); + for (Vector<String>::const_iterator iter = languagesVector.begin(); iter != languagesVector.end(); ++iter) { + GOwnPtr<gchar> currentLanguage(g_strdup(iter->utf8().data())); + if (enchant_broker_dict_exists(m_broker, currentLanguage.get())) { + EnchantDict* dict = enchant_broker_request_dict(m_broker, currentLanguage.get()); + spellDictionaries.append(dict); + } + } + } else { + const char* language = pango_language_to_string(pango_language_get_default()); + if (enchant_broker_dict_exists(m_broker, language)) { + EnchantDict* dict = enchant_broker_request_dict(m_broker, language); + spellDictionaries.append(dict); + } else { + // No dictionaries selected, we get one from the list. + Vector<CString> allDictionaries; + enchant_broker_list_dicts(m_broker, getAvailableDictionariesCallback, &allDictionaries); + if (!allDictionaries.isEmpty()) { + EnchantDict* dict = enchant_broker_request_dict(m_broker, allDictionaries[0].data()); + spellDictionaries.append(dict); + } + } + } + freeEnchantBrokerDictionaries(); + m_enchantDictionaries = spellDictionaries; +} + +void TextCheckerEnchant::freeEnchantBrokerDictionaries() +{ + for (Vector<EnchantDict*>::const_iterator iter = m_enchantDictionaries.begin(); iter != m_enchantDictionaries.end(); ++iter) + enchant_broker_free_dict(m_broker, *iter); +} + +#endif // ENABLE(SPELLCHECK) + diff --git a/Source/WebCore/platform/text/gtk/TextCheckerEnchant.h b/Source/WebCore/platform/text/gtk/TextCheckerEnchant.h new file mode 100644 index 000000000..739755e42 --- /dev/null +++ b/Source/WebCore/platform/text/gtk/TextCheckerEnchant.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef TextCheckerEnchant_h +#define TextCheckerEnchant_h + +#if ENABLE(SPELLCHECK) + +#include <enchant.h> +#include <wtf/FastAllocBase.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class TextCheckerEnchant { + WTF_MAKE_FAST_ALLOCATED; + +public: + static PassOwnPtr<TextCheckerEnchant> create() { return adoptPtr(new TextCheckerEnchant); } + virtual ~TextCheckerEnchant(); + + void ignoreWord(const String&); + void learnWord(const String&); + void checkSpellingOfString(const String&, int& misspellingLocation, int& misspellingLength); + Vector<String> getGuessesForWord(const String&); + void updateSpellCheckingLanguages(const String& languages); + +private: + TextCheckerEnchant(); + void freeEnchantBrokerDictionaries(); + + EnchantBroker* m_broker; + Vector<EnchantDict*> m_enchantDictionaries; +}; + +} // namespace WebCore + +#endif // ENABLE(SPELLCHECK) + +#endif diff --git a/Source/WebCore/platform/win/ClipboardWin.cpp b/Source/WebCore/platform/win/ClipboardWin.cpp index 12cb8bf01..d1c1386a1 100644 --- a/Source/WebCore/platform/win/ClipboardWin.cpp +++ b/Source/WebCore/platform/win/ClipboardWin.cpp @@ -560,7 +560,7 @@ PassRefPtr<FileList> ClipboardWin::files() const for (UINT i = 0; i < fileCount; i++) { if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename))) continue; - files->append(File::create(reinterpret_cast<UChar*>(filename))); + files->append(File::create(reinterpret_cast<UChar*>(filename), File::AllContentTypes)); } GlobalUnlock(medium.hGlobal); diff --git a/Source/WebCore/platform/win/ScrollbarThemeWin.cpp b/Source/WebCore/platform/win/ScrollbarThemeWin.cpp index 5644297d7..ed49f2be6 100644 --- a/Source/WebCore/platform/win/ScrollbarThemeWin.cpp +++ b/Source/WebCore/platform/win/ScrollbarThemeWin.cpp @@ -375,19 +375,18 @@ void ScrollbarThemeWin::paintThumb(GraphicsContext* context, ScrollbarThemeClien bool alphaBlend = false; if (scrollbarTheme) alphaBlend = IsThemeBackgroundPartiallyTransparent(scrollbarTheme, scrollbar->orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state); - HDC hdc = context->getWindowsContext(rect, alphaBlend); + LocalWindowsContext windowsContext(context, rect, alphaBlend); RECT themeRect(rect); if (scrollbarTheme) { - DrawThemeBackground(scrollbarTheme, hdc, scrollbar->orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state, &themeRect, 0); - paintGripper(scrollbar, hdc, gripperRect(scrollbarThickness(), rect)); + DrawThemeBackground(scrollbarTheme, windowsContext.hdc(), scrollbar->orientation() == HorizontalScrollbar ? SP_THUMBHOR : SP_THUMBVERT, state, &themeRect, 0); + paintGripper(scrollbar, windowsContext.hdc(), gripperRect(scrollbarThickness(), rect)); } else - ::DrawEdge(hdc, &themeRect, EDGE_RAISED, BF_RECT | BF_MIDDLE); + ::DrawEdge(windowsContext.hdc(), &themeRect, EDGE_RAISED, BF_RECT | BF_MIDDLE); #if !OS(WINCE) if (!alphaBlend && !context->isInTransparencyLayer()) - DIBPixelData::setRGBABitmapAlpha(hdc, rect, 255); + DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), rect, 255); #endif - context->releaseWindowsContext(hdc, rect, alphaBlend); } } diff --git a/Source/WebCore/rendering/FilterEffectRenderer.cpp b/Source/WebCore/rendering/FilterEffectRenderer.cpp index 11cf5f571..674861d6a 100644 --- a/Source/WebCore/rendering/FilterEffectRenderer.cpp +++ b/Source/WebCore/rendering/FilterEffectRenderer.cpp @@ -161,6 +161,9 @@ PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(Document* do } return effect; #else + UNUSED_PARAM(document); + UNUSED_PARAM(previousEffect); + UNUSED_PARAM(op); return 0; #endif } diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp index 541f5d0af..0f6e4b916 100644 --- a/Source/WebCore/rendering/HitTestResult.cpp +++ b/Source/WebCore/rendering/HitTestResult.cpp @@ -49,28 +49,76 @@ namespace WebCore { using namespace HTMLNames; HitTestPoint::HitTestPoint() - : m_isRectBased(false) + : m_region(0) + , m_isRectBased(false) + , m_isRectilinear(true) { } HitTestPoint::HitTestPoint(const LayoutPoint& point) : m_point(point) , m_boundingBox(rectForPoint(point, 0, 0, 0, 0)) + , m_transformedPoint(point) + , m_transformedRect(m_boundingBox) + , m_region(0) + , m_isRectBased(false) + , m_isRectilinear(true) +{ +} + +HitTestPoint::HitTestPoint(const FloatPoint& point) + : m_point(roundedLayoutPoint(point)) + , m_boundingBox(rectForPoint(m_point, 0, 0, 0, 0)) + , m_transformedPoint(point) + , m_transformedRect(m_boundingBox) + , m_region(0) , m_isRectBased(false) + , m_isRectilinear(true) { } +HitTestPoint::HitTestPoint(const FloatPoint& point, const FloatQuad& quad) + : m_transformedPoint(point) + , m_transformedRect(quad) + , m_region(0) + , m_isRectBased(true) +{ + m_point = roundedLayoutPoint(point); + m_boundingBox = enclosingIntRect(quad.boundingBox()); + m_isRectilinear = quad.isRectilinear(); +} + HitTestPoint::HitTestPoint(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) : m_point(centerPoint) , m_boundingBox(rectForPoint(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)) + , m_transformedPoint(centerPoint) + , m_region(0) , m_isRectBased(topPadding || rightPadding || bottomPadding || leftPadding) + , m_isRectilinear(true) +{ + m_transformedRect = FloatQuad(m_boundingBox); +} + +HitTestPoint::HitTestPoint(const HitTestPoint& other, const LayoutSize& offset, RenderRegion* region) + : m_point(other.m_point) + , m_boundingBox(other.m_boundingBox) + , m_transformedPoint(other.m_transformedPoint) + , m_transformedRect(other.m_transformedRect) + , m_region(region) + , m_isRectBased(other.m_isRectBased) + , m_isRectilinear(other.m_isRectilinear) { + move(offset); } HitTestPoint::HitTestPoint(const HitTestPoint& other) : m_point(other.m_point) , m_boundingBox(other.m_boundingBox) + , m_transformedPoint(other.m_transformedPoint) + , m_transformedRect(other.m_transformedRect) + , m_region(other.m_region) , m_isRectBased(other.m_isRectBased) + , m_isRectilinear(other.m_isRectilinear) { } @@ -82,40 +130,53 @@ HitTestPoint& HitTestPoint::operator=(const HitTestPoint& other) { m_point = other.m_point; m_boundingBox = other.m_boundingBox; + m_transformedPoint = other.m_transformedPoint; + m_transformedRect = other.m_transformedRect; + m_region = other.m_region; m_isRectBased = other.m_isRectBased; + m_isRectilinear = other.m_isRectilinear; return *this; } -void HitTestPoint::setPoint(const LayoutPoint& point) +void HitTestPoint::move(const LayoutSize& offset) { - m_boundingBox.move(roundedIntPoint(point) - roundedIntPoint(m_point)); - m_point = point; + m_point.move(offset); + m_transformedPoint.move(offset); + m_transformedRect.move(offset); + m_boundingBox = enclosingIntRect(m_transformedRect.boundingBox()); } template<typename RectType> -bool hitTestPointIntersects(const HitTestPoint& hitTestPoint, const RectType& rect) +bool HitTestPoint::intersectsRect(const RectType& rect) const { // FIXME: When the hit test is not rect based we should use rect.contains(m_point). // That does change some corner case tests though. - // First check if rect even intersects our bounding rect. - if (!rect.intersects(hitTestPoint.boundingBox())) + // First check if rect even intersects our bounding box. + if (!rect.intersects(m_boundingBox)) return false; - // FIXME: Implement quad based intersection test to handle transformed hit test rectangles. - return true; + // If the transformed rect is rectilinear the bounding box intersection was accurate. + if (m_isRectilinear) + return true; + + // If rect fully contains our bounding box, we are also sure of an intersection. + if (rect.contains(m_boundingBox)) + return true; + // Otherwise we need to do a slower quad based intersection test. + return m_transformedRect.intersectsRect(rect); } bool HitTestPoint::intersects(const LayoutRect& rect) const { - return hitTestPointIntersects(*this, rect); + return intersectsRect(rect); } bool HitTestPoint::intersects(const FloatRect& rect) const { - return hitTestPointIntersects(*this, rect); + return intersectsRect(rect); } IntRect HitTestPoint::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) @@ -134,14 +195,12 @@ IntRect HitTestPoint::rectForPoint(const LayoutPoint& point, unsigned topPadding HitTestResult::HitTestResult() : HitTestPoint() , m_isOverWidget(false) , m_shadowContentFilterPolicy(DoNotAllowShadowContent) - , m_region(0) { } HitTestResult::HitTestResult(const LayoutPoint& point) : HitTestPoint(point) , m_isOverWidget(false) , m_shadowContentFilterPolicy(DoNotAllowShadowContent) - , m_region(0) { } @@ -149,7 +208,6 @@ HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding : HitTestPoint(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding) , m_isOverWidget(false) , m_shadowContentFilterPolicy(allowShadowContent) - , m_region(0) { } @@ -157,7 +215,6 @@ HitTestResult::HitTestResult(const HitTestPoint& other, ShadowContentFilterPolic : HitTestPoint(other) , m_isOverWidget(false) , m_shadowContentFilterPolicy(allowShadowContent) - , m_region(0) { } @@ -170,7 +227,6 @@ HitTestResult::HitTestResult(const HitTestResult& other) , m_scrollbar(other.scrollbar()) , m_isOverWidget(other.isOverWidget()) , m_shadowContentFilterPolicy(other.shadowContentFilterPolicy()) - , m_region(other.region()) { // Only copy the NodeSet in case of rect hit test. m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0); @@ -194,8 +250,6 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other) m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0); m_shadowContentFilterPolicy = other.shadowContentFilterPolicy(); - m_region = other.m_region; - return *this; } diff --git a/Source/WebCore/rendering/HitTestResult.h b/Source/WebCore/rendering/HitTestResult.h index affab95c4..05ca90dc1 100644 --- a/Source/WebCore/rendering/HitTestResult.h +++ b/Source/WebCore/rendering/HitTestResult.h @@ -22,6 +22,7 @@ #ifndef HitTestResult_h #define HitTestResult_h +#include "FloatQuad.h" #include "FloatRect.h" #include "HitTestRequest.h" #include "LayoutTypes.h" @@ -51,8 +52,12 @@ public: HitTestPoint(); HitTestPoint(const LayoutPoint&); + HitTestPoint(const FloatPoint&); + HitTestPoint(const FloatPoint&, const FloatQuad&); // Pass non-zero padding values to perform a rect-based hit test. HitTestPoint(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); + // Make a copy the HitTestPoint in a new region by applying given offset to internal point and area. + HitTestPoint(const HitTestPoint&, const LayoutSize& offset, RenderRegion*); HitTestPoint(const HitTestPoint&); ~HitTestPoint(); HitTestPoint& operator=(const HitTestPoint&); @@ -60,10 +65,11 @@ public: LayoutPoint point() const { return m_point; } IntPoint roundedPoint() const { return roundedIntPoint(m_point); } - void setPoint(const LayoutPoint&); + RenderRegion* region() const { return m_region; } // Rect-based hit test related methods. bool isRectBasedTest() const { return m_isRectBased; } + bool isRectilinear() const { return m_isRectilinear; } IntRect boundingBox() const { return m_boundingBox; } static IntRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); @@ -75,11 +81,25 @@ public: bool intersects(const LayoutRect&) const; bool intersects(const FloatRect&) const; + const FloatPoint& transformedPoint() const { return m_transformedPoint; } + const FloatQuad& transformedRect() const { return m_transformedRect; } + private: - LayoutPoint m_point; + template<typename RectType> + bool intersectsRect(const RectType&) const; + void move(const LayoutSize& offset); + // This is cached forms of the more accurate point and area below. + LayoutPoint m_point; IntRect m_boundingBox; + + FloatPoint m_transformedPoint; + FloatQuad m_transformedRect; + + RenderRegion* m_region; // The region we're inside. + bool m_isRectBased; + bool m_isRectilinear; }; class HitTestResult : public HitTestPoint { @@ -102,9 +122,6 @@ public: Scrollbar* scrollbar() const { return m_scrollbar.get(); } bool isOverWidget() const { return m_isOverWidget; } - RenderRegion* region() const { return m_region; } - void setRegion(RenderRegion* region) { m_region = region; } - void setToNonShadowAncestor(); const HitTestPoint& hitTestPoint() const { return *this; } @@ -177,8 +194,6 @@ private: ShadowContentFilterPolicy m_shadowContentFilterPolicy; - RenderRegion* m_region; // The region we're inside. - mutable OwnPtr<NodeSet> m_rectBasedTestResult; }; diff --git a/Source/WebCore/rendering/HitTestingTransformState.cpp b/Source/WebCore/rendering/HitTestingTransformState.cpp index 4934a7b4f..b089336ab 100644 --- a/Source/WebCore/rendering/HitTestingTransformState.cpp +++ b/Source/WebCore/rendering/HitTestingTransformState.cpp @@ -58,6 +58,7 @@ void HitTestingTransformState::flattenWithTransform(const TransformationMatrix& TransformationMatrix inverseTransform = t.inverse(); m_lastPlanarPoint = inverseTransform.projectPoint(m_lastPlanarPoint); m_lastPlanarQuad = inverseTransform.projectQuad(m_lastPlanarQuad); + m_lastPlanarArea = inverseTransform.projectQuad(m_lastPlanarArea); m_accumulatedTransform.makeIdentity(); m_accumulatingTransform = false; @@ -73,9 +74,14 @@ FloatQuad HitTestingTransformState::mappedQuad() const return m_accumulatedTransform.inverse().projectQuad(m_lastPlanarQuad); } -LayoutRect HitTestingTransformState::boundsOfMappedQuad() const +FloatQuad HitTestingTransformState::mappedArea() const { - return m_accumulatedTransform.inverse().clampedBoundsOfProjectedQuad(m_lastPlanarQuad); + return m_accumulatedTransform.inverse().projectQuad(m_lastPlanarArea); +} + +LayoutRect HitTestingTransformState::boundsOfMappedArea() const +{ + return m_accumulatedTransform.inverse().clampedBoundsOfProjectedQuad(m_lastPlanarArea); } } // namespace WebCore diff --git a/Source/WebCore/rendering/HitTestingTransformState.h b/Source/WebCore/rendering/HitTestingTransformState.h index 2439dff78..95ec25b5f 100644 --- a/Source/WebCore/rendering/HitTestingTransformState.h +++ b/Source/WebCore/rendering/HitTestingTransformState.h @@ -42,9 +42,9 @@ namespace WebCore { // differently than move()) so care has to be taken when this is done. class HitTestingTransformState : public RefCounted<HitTestingTransformState> { public: - static PassRefPtr<HitTestingTransformState> create(const FloatPoint& p, const FloatQuad& quad) + static PassRefPtr<HitTestingTransformState> create(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area) { - return adoptRef(new HitTestingTransformState(p, quad)); + return adoptRef(new HitTestingTransformState(p, quad, area)); } static PassRefPtr<HitTestingTransformState> create(const HitTestingTransformState& other) @@ -58,18 +58,21 @@ public: FloatPoint mappedPoint() const; FloatQuad mappedQuad() const; - LayoutRect boundsOfMappedQuad() const; + FloatQuad mappedArea() const; + LayoutRect boundsOfMappedArea() const; void flatten(); FloatPoint m_lastPlanarPoint; FloatQuad m_lastPlanarQuad; + FloatQuad m_lastPlanarArea; TransformationMatrix m_accumulatedTransform; bool m_accumulatingTransform; private: - HitTestingTransformState(const FloatPoint& p, const FloatQuad& quad) + HitTestingTransformState(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area) : m_lastPlanarPoint(p) , m_lastPlanarQuad(quad) + , m_lastPlanarArea(area) , m_accumulatingTransform(false) { } @@ -78,6 +81,7 @@ private: : RefCounted<HitTestingTransformState>() , m_lastPlanarPoint(other.m_lastPlanarPoint) , m_lastPlanarQuad(other.m_lastPlanarQuad) + , m_lastPlanarArea(other.m_lastPlanarArea) , m_accumulatedTransform(other.m_accumulatedTransform) , m_accumulatingTransform(other.m_accumulatingTransform) { diff --git a/Source/WebCore/rendering/InlineFlowBox.h b/Source/WebCore/rendering/InlineFlowBox.h index 35df7846e..20f59d723 100644 --- a/Source/WebCore/rendering/InlineFlowBox.h +++ b/Source/WebCore/rendering/InlineFlowBox.h @@ -49,6 +49,7 @@ public: , m_baselineType(AlphabeticBaseline) , m_hasAnnotationsBefore(false) , m_hasAnnotationsAfter(false) + , m_isFirstAfterPageBreak(false) #ifndef NDEBUG , m_hasBadChildList(false) #endif @@ -321,6 +322,7 @@ protected: // If the line contains any ruby runs, then this will be true. unsigned m_hasAnnotationsBefore : 1; unsigned m_hasAnnotationsAfter : 1; + unsigned m_isFirstAfterPageBreak : 1; unsigned m_lineBreakBidiStatusEor : 5; // WTF::Unicode::Direction unsigned m_lineBreakBidiStatusLastStrong : 5; // WTF::Unicode::Direction diff --git a/Source/WebCore/rendering/LayoutTypes.h b/Source/WebCore/rendering/LayoutTypes.h index 70a2aa0d7..95055f8eb 100644 --- a/Source/WebCore/rendering/LayoutTypes.h +++ b/Source/WebCore/rendering/LayoutTypes.h @@ -117,7 +117,7 @@ inline int floorToInt(LayoutUnit value) inline LayoutUnit roundedLayoutUnit(float value) { #if ENABLE(SUBPIXEL_LAYOUT) - return FractionalLayoutUnit(value); + return FractionalLayoutUnit::fromFloatRound(value); #else return static_cast<int>(lroundf(value)); #endif @@ -126,7 +126,7 @@ inline LayoutUnit roundedLayoutUnit(float value) inline LayoutUnit ceiledLayoutUnit(float value) { #if ENABLE(SUBPIXEL_LAYOUT) - return FractionalLayoutUnit(value); + return FractionalLayoutUnit::fromFloatCeil(value); #else return ceilf(value); #endif diff --git a/Source/WebCore/rendering/RenderApplet.cpp b/Source/WebCore/rendering/RenderApplet.cpp index 1b8b75e17..120808420 100644 --- a/Source/WebCore/rendering/RenderApplet.cpp +++ b/Source/WebCore/rendering/RenderApplet.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 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 @@ -22,20 +22,12 @@ #include "config.h" #include "RenderApplet.h" -#include "Frame.h" #include "HTMLAppletElement.h" -#include "HTMLNames.h" -#include "HTMLParamElement.h" -#include "PluginViewBase.h" -#include "Widget.h" namespace WebCore { -using namespace HTMLNames; - -RenderApplet::RenderApplet(HTMLAppletElement* applet, const HashMap<String, String>& args) - : RenderWidget(applet) - , m_args(args) +RenderApplet::RenderApplet(HTMLAppletElement* applet) + : RenderEmbeddedObject(applet) { setInline(true); } @@ -44,67 +36,4 @@ RenderApplet::~RenderApplet() { } -IntSize RenderApplet::intrinsicSize() const -{ - // FIXME: This doesn't make sense. We can't just start returning - // a different size once we've created the widget and expect - // layout and sizing to be correct. We should remove this and - // pass the appropriate intrinsic size in the constructor. - return widget() ? IntSize(50, 50) : IntSize(150, 150); -} - -void RenderApplet::createWidgetIfNecessary() -{ - HTMLAppletElement* element = static_cast<HTMLAppletElement*>(node()); - if (widget() || !element->isFinishedParsingChildren()) - return; - - // FIXME: Java applets can't be resized (this is a bug in Apple's Java implementation). - // In order to work around this problem and have a correct size from the start, we will - // use fixed widths/heights from the style system when we can, since the widget might - // not have an accurate m_width/m_height. - LayoutUnit contentWidth = style()->width().isFixed() ? LayoutUnit(style()->width().value()) : - width() - borderAndPaddingWidth(); - LayoutUnit contentHeight = style()->height().isFixed() ? LayoutUnit(style()->height().value()) : - height() - borderAndPaddingHeight(); - for (Node* child = element->firstChild(); child; child = child->nextSibling()) { - if (child->hasTagName(paramTag)) { - HTMLParamElement* p = static_cast<HTMLParamElement*>(child); - if (!p->name().isEmpty()) - m_args.set(p->name(), p->value()); - } - } - - Frame* frame = this->frame(); - ASSERT(frame); - setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(LayoutSize(contentWidth, contentHeight), element, m_args)); -} - -void RenderApplet::layout() -{ - ASSERT(needsLayout()); - - computeLogicalWidth(); - computeLogicalHeight(); - - // The applet's widget gets created lazily upon first layout. - createWidgetIfNecessary(); - setNeedsLayout(false); -} - -#if USE(ACCELERATED_COMPOSITING) -bool RenderApplet::requiresLayer() const -{ - if (RenderWidget::requiresLayer()) - return true; - - return allowsAcceleratedCompositing(); -} - -bool RenderApplet::allowsAcceleratedCompositing() const -{ - return widget() && widget()->isPluginViewBase() && static_cast<PluginViewBase*>(widget())->platformLayer(); -} -#endif - } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderApplet.h b/Source/WebCore/rendering/RenderApplet.h index 007902d1f..151660066 100644 --- a/Source/WebCore/rendering/RenderApplet.h +++ b/Source/WebCore/rendering/RenderApplet.h @@ -22,48 +22,21 @@ #ifndef RenderApplet_h #define RenderApplet_h -#include "RenderWidget.h" -#include <wtf/text/StringHash.h> +#include "RenderEmbeddedObject.h" namespace WebCore { class HTMLAppletElement; -class RenderApplet : public RenderWidget { +class RenderApplet : public RenderEmbeddedObject { public: - RenderApplet(HTMLAppletElement*, const HashMap<String, String>& args); + RenderApplet(HTMLAppletElement*); virtual ~RenderApplet(); - void createWidgetIfNecessary(); - -#if USE(ACCELERATED_COMPOSITING) - virtual bool allowsAcceleratedCompositing() const; -#endif - private: virtual const char* renderName() const { return "RenderApplet"; } - - virtual bool isApplet() const { return true; } - - virtual void layout(); - virtual IntSize intrinsicSize() const; - -#if USE(ACCELERATED_COMPOSITING) - virtual bool requiresLayer() const; -#endif - - HashMap<String, String> m_args; }; -inline RenderApplet* toRenderApplet(RenderObject* object) -{ - ASSERT(!object || object->isApplet()); - return static_cast<RenderApplet*>(object); -} - -// This will catch anyone doing an unnecessary cast. -void toRenderApplet(const RenderApplet*); - } // namespace WebCore #endif // RenderApplet_h diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index f8eaedfda..0e4a77a78 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -1669,12 +1669,8 @@ void RenderBlock::addOverflowFromPositionedObjects() positionedObject = *it; // Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content. - if (positionedObject->style()->position() != FixedPosition) { - int x = positionedObject->x(); - if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) - x -= verticalScrollbarWidth(); - addOverflowFromChild(positionedObject, IntSize(x, positionedObject->y())); - } + if (positionedObject->style()->position() != FixedPosition) + addOverflowFromChild(positionedObject, IntSize(positionedObject->x(), positionedObject->y())); } } @@ -2208,8 +2204,6 @@ LayoutUnit RenderBlock::computeStartPositionDeltaForChildAvoidingFloats(const Re void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child) { LayoutUnit startPosition = borderStart() + paddingStart(); - if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) - startPosition -= verticalScrollbarWidth(); LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth(); // Add in our start margin. @@ -2866,62 +2860,70 @@ void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf if (childrenInline()) m_lineBoxes.paint(this, paintInfo, paintOffset); - else - paintChildren(paintInfo, paintOffset); + else { + PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPhaseOutline : paintInfo.phase; + newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChildBlockBackground : newPhase; + + // We don't paint our own background, but we do let the kids paint their backgrounds. + PaintInfo paintInfoForChild(paintInfo); + paintInfoForChild.phase = newPhase; + paintInfoForChild.updatePaintingRootForChildren(this); + + // FIXME: Paint-time pagination is obsolete and is now only used by embedded WebViews inside AppKit + // NSViews. Do not add any more code for this. + bool usePrintRect = !view()->printRect().isEmpty(); + paintChildren(paintInfo, paintOffset, paintInfoForChild, usePrintRect); + } } -void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset) +void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect) { - PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPhaseOutline : paintInfo.phase; - newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChildBlockBackground : newPhase; - - // We don't paint our own background, but we do let the kids paint their backgrounds. - PaintInfo info(paintInfo); - info.phase = newPhase; - info.updatePaintingRootForChildren(this); - - // FIXME: Paint-time pagination is obsolete and is now only used by embedded WebViews inside AppKit - // NSViews. Do not add any more code for this. - RenderView* renderView = view(); - bool usePrintRect = !renderView->printRect().isEmpty(); - - for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { - // Check for page-break-before: always, and if it's set, break and bail. - bool checkBeforeAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakBefore() == PBALWAYS); - LayoutUnit absoluteChildY = paintOffset.y() + child->y(); - if (checkBeforeAlways - && absoluteChildY > paintInfo.rect.y() - && absoluteChildY < paintInfo.rect.maxY()) { - view()->setBestTruncatedAt(absoluteChildY, this, true); + for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { + if (!paintChild(child, paintInfo, paintOffset, paintInfoForChild, usePrintRect)) return; - } + } +} - if (!child->isFloating() && child->isReplaced() && usePrintRect && child->height() <= renderView->printRect().height()) { - // Paginate block-level replaced elements. - if (absoluteChildY + child->height() > renderView->printRect().maxY()) { - if (absoluteChildY < renderView->truncatedAt()) - renderView->setBestTruncatedAt(absoluteChildY, child); - // If we were able to truncate, don't paint. - if (absoluteChildY >= renderView->truncatedAt()) - break; - } +bool RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect) +{ + // Check for page-break-before: always, and if it's set, break and bail. + bool checkBeforeAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakBefore() == PBALWAYS); + LayoutUnit absoluteChildY = paintOffset.y() + child->y(); + if (checkBeforeAlways + && absoluteChildY > paintInfo.rect.y() + && absoluteChildY < paintInfo.rect.maxY()) { + view()->setBestTruncatedAt(absoluteChildY, this, true); + return false; + } + + RenderView* renderView = view(); + if (!child->isFloating() && child->isReplaced() && usePrintRect && child->height() <= renderView->printRect().height()) { + // Paginate block-level replaced elements. + if (absoluteChildY + child->height() > renderView->printRect().maxY()) { + if (absoluteChildY < renderView->truncatedAt()) + renderView->setBestTruncatedAt(absoluteChildY, child); + // If we were able to truncate, don't paint. + if (absoluteChildY >= renderView->truncatedAt()) + return false; } + } - LayoutPoint childPoint = flipForWritingModeForChild(child, paintOffset); - if (!child->hasSelfPaintingLayer() && !child->isFloating()) - child->paint(info, childPoint); + LayoutPoint childPoint = flipForWritingModeForChild(child, paintOffset); + if (!child->hasSelfPaintingLayer() && !child->isFloating()) + child->paint(paintInfoForChild, childPoint); - // Check for page-break-after: always, and if it's set, break and bail. - bool checkAfterAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakAfter() == PBALWAYS); - if (checkAfterAlways - && (absoluteChildY + child->height()) > paintInfo.rect.y() - && (absoluteChildY + child->height()) < paintInfo.rect.maxY()) { - view()->setBestTruncatedAt(absoluteChildY + child->height() + max(ZERO_LAYOUT_UNIT, child->collapsedMarginAfter()), this, true); - return; - } + // Check for page-break-after: always, and if it's set, break and bail. + bool checkAfterAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakAfter() == PBALWAYS); + if (checkAfterAlways + && (absoluteChildY + child->height()) > paintInfo.rect.y() + && (absoluteChildY + child->height()) < paintInfo.rect.maxY()) { + view()->setBestTruncatedAt(absoluteChildY + child->height() + max(ZERO_LAYOUT_UNIT, child->collapsedMarginAfter()), this, true); + return false; } + return true; } + void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffset, CaretType type) { // Paint the caret if the FrameSelection says so or if caret browsing is enabled @@ -4670,7 +4672,7 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // If we have clipping, then we can't have any spillout. bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); bool useClip = (hasControlClip() || useOverflowClip); - bool checkChildren = !useClip || (hasControlClip() ? pointInContainer.intersects(controlClipRect(adjustedLocation)) : pointInContainer.intersects(overflowClipRect(adjustedLocation, result.region(), IncludeOverlayScrollbarSize))); + bool checkChildren = !useClip || (hasControlClip() ? pointInContainer.intersects(controlClipRect(adjustedLocation)) : pointInContainer.intersects(overflowClipRect(adjustedLocation, pointInContainer.region(), IncludeOverlayScrollbarSize))); if (checkChildren) { // Hit test descendants first. LayoutSize scrolledOffset(localOffset); @@ -4914,6 +4916,9 @@ VisiblePosition RenderBlock::positionForPointWithInlineChildren(const LayoutPoin if (!firstRootBox()) return createVisiblePosition(0, DOWNSTREAM); + bool linesAreFlipped = style()->isFlippedLinesWritingMode(); + bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); + // look for the closest line box in the root box which is at the passed-in y coordinate InlineBox* closestBox = 0; RootInlineBox* firstRootBoxWithChildren = 0; @@ -4923,10 +4928,24 @@ VisiblePosition RenderBlock::positionForPointWithInlineChildren(const LayoutPoin continue; if (!firstRootBoxWithChildren) firstRootBoxWithChildren = root; + + if (!linesAreFlipped && root->isFirstAfterPageBreak() && (pointInLogicalContents.y() < root->lineTopWithLeading() + || (blocksAreFlipped && pointInLogicalContents.y() == root->lineTopWithLeading()))) + break; + lastRootBoxWithChildren = root; // check if this root line box is located at this y coordinate - if (pointInLogicalContents.y() < root->selectionBottom()) { + if (pointInLogicalContents.y() < root->selectionBottom() || (blocksAreFlipped && pointInLogicalContents.y() == root->selectionBottom())) { + if (linesAreFlipped) { + RootInlineBox* nextRootBoxWithChildren = root->nextRootBox(); + while (nextRootBoxWithChildren && !nextRootBoxWithChildren->firstLeafChild()) + nextRootBoxWithChildren = nextRootBoxWithChildren->nextRootBox(); + + if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstAfterPageBreak() && (pointInLogicalContents.y() > nextRootBoxWithChildren->lineTopWithLeading() + || (!blocksAreFlipped && pointInLogicalContents.y() == nextRootBoxWithChildren->lineTopWithLeading()))) + continue; + } closestBox = root->closestLeafChildForLogicalLeftPosition(pointInLogicalContents.x()); if (closestBox) break; @@ -4941,19 +4960,22 @@ VisiblePosition RenderBlock::positionForPointWithInlineChildren(const LayoutPoin } if (closestBox) { - if (moveCaretToBoundary && pointInLogicalContents.y() < firstRootBoxWithChildren->selectionTop() - && pointInLogicalContents.y() < firstRootBoxWithChildren->logicalTop()) { - InlineBox* box = firstRootBoxWithChildren->firstLeafChild(); - if (box->isLineBreak()) { - if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak()) - box = newBox; + if (moveCaretToBoundary) { + LayoutUnit firstRootBoxWithChildrenTop = min<LayoutUnit>(firstRootBoxWithChildren->selectionTop(), firstRootBoxWithChildren->logicalTop()); + if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop + || (blocksAreFlipped && pointInLogicalContents.y() == firstRootBoxWithChildrenTop)) { + InlineBox* box = firstRootBoxWithChildren->firstLeafChild(); + if (box->isLineBreak()) { + if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak()) + box = newBox; + } + // y coordinate is above first root line box, so return the start of the first + return VisiblePosition(positionForBox(box, true), DOWNSTREAM); } - // y coordinate is above first root line box, so return the start of the first - return VisiblePosition(positionForBox(box, true), DOWNSTREAM); } // pass the box a top position that is inside it - LayoutPoint point(pointInLogicalContents.x(), max(closestBox->root()->lineTop(), closestBox->root()->selectionTop())); + LayoutPoint point(pointInLogicalContents.x(), closestBox->root()->blockDirectionPointInLine()); if (!isHorizontalWritingMode()) point = point.transposedPoint(); if (closestBox->renderer()->isReplaced()) @@ -5009,13 +5031,19 @@ VisiblePosition RenderBlock::positionForPoint(const LayoutPoint& point) while (lastCandidateBox && !isChildHitTestCandidate(lastCandidateBox)) lastCandidateBox = lastCandidateBox->previousSiblingBox(); + bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); if (lastCandidateBox) { - if (pointInContents.y() > lastCandidateBox->logicalTop()) + if (pointInLogicalContents.y() > logicalTopForChild(lastCandidateBox) + || (!blocksAreFlipped && pointInLogicalContents.y() == logicalTopForChild(lastCandidateBox))) return positionForPointRespectingEditingBoundaries(this, lastCandidateBox, pointInContents); for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) { + if (!isChildHitTestCandidate(childBox)) + continue; + LayoutUnit childLogicalBottom = logicalTopForChild(childBox) + logicalHeightForChild(childBox); // We hit child if our click is above the bottom of its padding box (like IE6/7 and FF3). - if (isChildHitTestCandidate(childBox) && pointInContents.y() < childBox->logicalBottom()) + if (isChildHitTestCandidate(childBox) && (pointInLogicalContents.y() < childLogicalBottom + || (blocksAreFlipped && pointInLogicalContents.y() == childLogicalBottom))) return positionForPointRespectingEditingBoundaries(this, childBox, pointInContents); } } @@ -5026,11 +5054,15 @@ VisiblePosition RenderBlock::positionForPoint(const LayoutPoint& point) void RenderBlock::offsetForContents(LayoutPoint& offset) const { + offset = flipForWritingMode(offset); + if (hasOverflowClip()) offset += scrolledContentOffset(); if (hasColumns()) adjustPointToColumnContents(offset); + + offset = flipForWritingMode(offset); } LayoutUnit RenderBlock::availableLogicalWidth() const @@ -5245,51 +5277,65 @@ void RenderBlock::adjustPointToColumnContents(LayoutPoint& point) const if (isHorizontalWritingMode() == (colInfo->progressionAxis() == ColumnInfo::InlineAxis)) { LayoutRect gapAndColumnRect(colRect.x() - halfColGap, colRect.y(), colRect.width() + colGap, colRect.height()); if (point.x() >= gapAndColumnRect.x() && point.x() < gapAndColumnRect.maxX()) { - // FIXME: The clamping that follows is not completely right for right-to-left - // content. - // Clamp everything above the column to its top left. - if (point.y() < gapAndColumnRect.y()) - point = gapAndColumnRect.location(); - // Clamp everything below the column to the next column's top left. If there is - // no next column, this still maps to just after this column. - else if (point.y() >= gapAndColumnRect.maxY()) { - point = gapAndColumnRect.location(); - point.move(0, gapAndColumnRect.height()); + if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { + // FIXME: The clamping that follows is not completely right for right-to-left + // content. + // Clamp everything above the column to its top left. + if (point.y() < gapAndColumnRect.y()) + point = gapAndColumnRect.location(); + // Clamp everything below the column to the next column's top left. If there is + // no next column, this still maps to just after this column. + else if (point.y() >= gapAndColumnRect.maxY()) { + point = gapAndColumnRect.location(); + point.move(0, gapAndColumnRect.height()); + } + } else { + if (point.x() < colRect.x()) + point.setX(colRect.x()); + else if (point.x() >= colRect.maxX()) + point.setX(colRect.maxX() - 1); } // We're inside the column. Translate the x and y into our column coordinate space. if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) - point.move(columnPoint.x() - colRect.x(), logicalOffset); + point.move(columnPoint.x() - colRect.x(), (!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset)); else point.move((!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.x() + borderLeft() + paddingLeft(), 0); return; } - + // Move to the next position. logicalOffset += colInfo->progressionAxis() == ColumnInfo::InlineAxis ? colRect.height() : colRect.width(); } else { LayoutRect gapAndColumnRect(colRect.x(), colRect.y() - halfColGap, colRect.width(), colRect.height() + colGap); if (point.y() >= gapAndColumnRect.y() && point.y() < gapAndColumnRect.maxY()) { - // FIXME: The clamping that follows is not completely right for right-to-left - // content. - // Clamp everything above the column to its top left. - if (point.x() < gapAndColumnRect.x()) - point = gapAndColumnRect.location(); - // Clamp everything below the column to the next column's top left. If there is - // no next column, this still maps to just after this column. - else if (point.x() >= gapAndColumnRect.maxX()) { - point = gapAndColumnRect.location(); - point.move(gapAndColumnRect.width(), 0); + if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { + // FIXME: The clamping that follows is not completely right for right-to-left + // content. + // Clamp everything above the column to its top left. + if (point.x() < gapAndColumnRect.x()) + point = gapAndColumnRect.location(); + // Clamp everything below the column to the next column's top left. If there is + // no next column, this still maps to just after this column. + else if (point.x() >= gapAndColumnRect.maxX()) { + point = gapAndColumnRect.location(); + point.move(gapAndColumnRect.width(), 0); + } + } else { + if (point.y() < colRect.y()) + point.setY(colRect.y()); + else if (point.y() >= colRect.maxY()) + point.setY(colRect.maxY() - 1); } // We're inside the column. Translate the x and y into our column coordinate space. if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) - point.move(logicalOffset, columnPoint.y() - colRect.y()); + point.move((!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset), columnPoint.y() - colRect.y()); else point.move(0, (!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.y() + borderTop() + paddingTop()); return; } - + // Move to the next position. logicalOffset += colInfo->progressionAxis() == ColumnInfo::InlineAxis ? colRect.width() : colRect.height(); } @@ -5591,7 +5637,7 @@ static inline void stripTrailingSpace(float& inlineMax, float& inlineMin, static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& result) { - LayoutUnit snappedResult = LayoutUnit::fromFloatCeil(result); + LayoutUnit snappedResult = ceiledLayoutUnit(result); preferredWidth = max(snappedResult, preferredWidth); } @@ -6941,6 +6987,7 @@ void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, Layout layoutState->m_columnInfo->updateMinimumColumnHeight(lineHeight); logicalOffset += delta; lineBox->setPaginationStrut(0); + lineBox->setIsFirstAfterPageBreak(false); LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); bool hasUniformPageLogicalHeight = !inRenderFlowThread() || enclosingRenderFlowThread()->regionsHaveUniformLogicalHeight(); // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflow.height() still fits, we are @@ -6964,8 +7011,10 @@ void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, Layout else { delta += remainingLogicalHeight; lineBox->setPaginationStrut(remainingLogicalHeight); + lineBox->setIsFirstAfterPageBreak(true); } - } + } else if (remainingLogicalHeight == pageLogicalHeight && lineBox != firstRootBox()) + lineBox->setIsFirstAfterPageBreak(true); } LayoutUnit RenderBlock::adjustBlockChildForPagination(LayoutUnit logicalTopAfterClear, LayoutUnit estimateWithoutPagination, RenderBox* child, bool atBeforeSideOfBlock) diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 6951c2624..53a1f202c 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -414,6 +414,8 @@ protected: virtual void paint(PaintInfo&, const LayoutPoint&); virtual void paintObject(PaintInfo&, const LayoutPoint&); + virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect); + bool paintChild(RenderBox*, PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect); LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit logicalHeight = 0) const; LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit logicalHeight = 0) const; @@ -471,9 +473,9 @@ protected: void computeInitialRegionRangeForBlock(); void computeRegionRangeForBlock(); - + virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight); - + private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } @@ -732,7 +734,6 @@ private: void paintContents(PaintInfo&, const LayoutPoint&); void paintColumnContents(PaintInfo&, const LayoutPoint&, bool paintFloats = false); void paintColumnRules(PaintInfo&, const LayoutPoint&); - void paintChildren(PaintInfo&, const LayoutPoint&); void paintEllipsisBoxes(PaintInfo&, const LayoutPoint&); void paintSelection(PaintInfo&, const LayoutPoint&); void paintCaret(PaintInfo&, const LayoutPoint&, CaretType); @@ -806,6 +807,7 @@ private: virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0); + void adjustPointToColumnContents(LayoutPoint&) const; void adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const; // Helper function for borderFitAdjust void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBottom, RootInlineBox* highest = 0); @@ -815,9 +817,6 @@ private: Position positionForBox(InlineBox*, bool start = true) const; VisiblePosition positionForPointWithInlineChildren(const LayoutPoint&); - // Adjust from painting offsets to the local coords of this renderer - void offsetForContents(LayoutPoint&) const; - virtual void calcColumnWidth(); void makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, RenderBlock* newBlockBox, RenderObject* newChild); @@ -963,7 +962,8 @@ protected: void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset); // Computes a deltaOffset value that put a line at the top of the next page if it doesn't fit on the current page. LayoutUnit adjustBlockChildForPagination(LayoutUnit logicalTopAfterClear, LayoutUnit estimateWithoutPagination, RenderBox* child, bool atBeforeSideOfBlock); - void adjustPointToColumnContents(LayoutPoint&) const; + // Adjust from painting offsets to the local coords of this renderer + void offsetForContents(LayoutPoint&) const; // This function is called to test a line box that has moved in the block direction to see if it has ended up in a new // region/page/column that has a different available line width than the old one. Used to know when you have to dirty a diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index d2de4b8a9..9b3b7de86 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -757,7 +757,7 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result // Check our bounds next. For this purpose always assume that we can only be hit in the // foreground phase (which is true for replaced elements like images). - LayoutRect boundsRect = borderBoxRectInRegion(result.region()); + LayoutRect boundsRect = borderBoxRectInRegion(pointInContainer.region()); boundsRect.moveBy(adjustedLocation); if (visibleToHitTesting() && action == HitTestForeground && pointInContainer.intersects(boundsRect)) { updateHitTestResult(result, pointInContainer.point() - toLayoutSize(adjustedLocation)); @@ -3634,7 +3634,14 @@ void RenderBox::addLayoutOverflow(const LayoutRect& rect) else hasTopOverflow = true; } - + + if (hasColumns() && style()->columnProgression() == ReverseColumnProgression) { + if (isHorizontalWritingMode() ^ !style()->hasInlineColumnAxis()) + hasLeftOverflow = !hasLeftOverflow; + else + hasTopOverflow = !hasTopOverflow; + } + if (!hasTopOverflow) overflowRect.shiftYEdgeTo(max(overflowRect.y(), clientBox.y())); else diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 43a8ebc50..bbb034451 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -197,12 +197,12 @@ public: // More IE extensions. clientWidth and clientHeight represent the interior of an object // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth. - LayoutUnit clientLeft() const { return borderLeft() + (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0); } + LayoutUnit clientLeft() const { return borderLeft(); } LayoutUnit clientTop() const { return borderTop(); } LayoutUnit clientWidth() const; LayoutUnit clientHeight() const; - LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? pixelSnappedClientWidth() : pixelSnappedClientHeight(); } - LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedClientHeight() : pixelSnappedClientWidth(); } + LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); } + LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); } LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); } LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); } diff --git a/Source/WebCore/rendering/RenderEmbeddedObject.h b/Source/WebCore/rendering/RenderEmbeddedObject.h index 7da6fc88f..fd44e080f 100644 --- a/Source/WebCore/rendering/RenderEmbeddedObject.h +++ b/Source/WebCore/rendering/RenderEmbeddedObject.h @@ -90,7 +90,7 @@ private: inline RenderEmbeddedObject* toRenderEmbeddedObject(RenderObject* object) { - ASSERT(!object || !strcmp(object->renderName(), "RenderEmbeddedObject")); + ASSERT(!object || object->isEmbeddedObject()); return static_cast<RenderEmbeddedObject*>(object); } diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index e7c0563d6..3b1d4737c 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -259,12 +259,12 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit) WTF::Vector<LineContext> lineContexts; OrderHashSet orderValues; computeMainAxisPreferredSizes(relayoutChildren, orderValues); - OrderIterator flexIterator(this, orderValues); - layoutFlexItems(flexIterator, lineContexts); + m_orderIterator = adoptPtr(new OrderIterator(this, orderValues)); + layoutFlexItems(*m_orderIterator, lineContexts); LayoutUnit oldClientAfterEdge = clientLogicalBottom(); computeLogicalHeight(); - repositionLogicalHeightDependentFlexItems(flexIterator, lineContexts, oldClientAfterEdge); + repositionLogicalHeightDependentFlexItems(*m_orderIterator, lineContexts, oldClientAfterEdge); if (size() != previousSize) relayoutChildren = true; @@ -289,6 +289,16 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit) setNeedsLayout(false); } +void RenderFlexibleBox::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect) +{ + ASSERT(m_orderIterator); + + for (RenderBox* child = m_orderIterator->first(); child; child = m_orderIterator->next()) { + if (!paintChild(child, paintInfo, paintOffset, paintInfoForChild, usePrintRect)) + return; + } +} + void RenderFlexibleBox::repositionLogicalHeightDependentFlexItems(OrderIterator& iterator, WTF::Vector<LineContext>& lineContexts, LayoutUnit& oldClientAfterEdge) { LayoutUnit crossAxisStartEdge = lineContexts.isEmpty() ? ZERO_LAYOUT_UNIT : lineContexts[0].crossAxisOffset; @@ -386,9 +396,11 @@ LayoutUnit RenderFlexibleBox::crossAxisContentExtent() const return isHorizontalFlow() ? contentHeight() : contentWidth(); } -LayoutUnit RenderFlexibleBox::mainAxisContentExtent() const +LayoutUnit RenderFlexibleBox::mainAxisContentExtent() { - return isHorizontalFlow() ? contentWidth() : contentHeight(); + if (isColumnFlow()) + return std::max(LayoutUnit(0), computeContentLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); + return contentLogicalWidth(); } WritingMode RenderFlexibleBox::transformedWritingMode() const @@ -580,7 +592,7 @@ LayoutUnit RenderFlexibleBox::mainAxisScrollbarExtentForChild(RenderBox* child) return isHorizontalFlow() ? child->verticalScrollbarWidth() : child->horizontalScrollbarHeight(); } -LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child) const +LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child) { Length flexBasis = flexBasisForChild(child); if (flexBasis.isAuto()) { @@ -878,9 +890,9 @@ bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(child); LayoutUnit childSize = preferredChildSize; if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && isfinite(totalFlexGrow)) - childSize += static_cast<int>(lroundf(availableFreeSpace * child->style()->flexGrow() / totalFlexGrow)); + childSize += roundedLayoutUnit(availableFreeSpace * child->style()->flexGrow() / totalFlexGrow); else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && isfinite(totalWeightedFlexShrink)) - childSize += static_cast<int>(lroundf(availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink)); + childSize += roundedLayoutUnit(availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink); LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize, flexboxAvailableContentExtent); childSizes.append(adjustedChildSize); @@ -1018,7 +1030,7 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons mainAxisOffset += flowAwareMarginStartForChild(child); LayoutUnit childMainExtent = mainAxisExtentForChild(child); - IntPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent : mainAxisOffset, + LayoutPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent : mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child)); // FIXME: Supporting layout deltas. @@ -1061,7 +1073,7 @@ void RenderFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children, mainAxisOffset -= mainAxisExtentForChild(child) + flowAwareMarginEndForChild(child); LayoutRect oldRect = child->frameRect(); - setFlowAwareLocationForChild(child, IntPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child))); + setFlowAwareLocationForChild(child, LayoutPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child))); if (!selfNeedsLayout() && child->checkForRepaintDuringLayout()) child->repaintDuringLayoutIfMoved(oldRect); diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index 64b1adbed..1a9ebc982 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -32,6 +32,7 @@ #define RenderFlexibleBox_h #include "RenderBlock.h" +#include <wtf/OwnPtr.h> namespace WebCore { @@ -40,11 +41,13 @@ public: RenderFlexibleBox(Node*); virtual ~RenderFlexibleBox(); - virtual const char* renderName() const; + virtual const char* renderName() const OVERRIDE; - virtual bool isFlexibleBox() const { return true; } - virtual void computePreferredLogicalWidths(); - virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0); + virtual bool isFlexibleBox() const OVERRIDE { return true; } + virtual void computePreferredLogicalWidths() OVERRIDE; + virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE; + + virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) OVERRIDE; bool isHorizontalFlow() const; @@ -80,7 +83,7 @@ private: LayoutUnit crossAxisExtent() const; LayoutUnit mainAxisExtent() const; LayoutUnit crossAxisContentExtent() const; - LayoutUnit mainAxisContentExtent() const; + LayoutUnit mainAxisContentExtent(); WritingMode transformedWritingMode() const; LayoutUnit flowAwareBorderStart() const; LayoutUnit flowAwareBorderEnd() const; @@ -102,7 +105,7 @@ private: void adjustAlignmentForChild(RenderBox* child, LayoutUnit); LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const; LayoutUnit mainAxisScrollbarExtentForChild(RenderBox* child) const; - LayoutUnit preferredMainAxisContentExtentForChild(RenderBox* child) const; + LayoutUnit preferredMainAxisContentExtentForChild(RenderBox* child); void layoutFlexItems(OrderIterator&, WTF::Vector<LineContext>&); LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit& availableFreeSpace); @@ -132,6 +135,8 @@ private: void applyStretchAlignmentToChild(RenderBox*, LayoutUnit lineCrossAxisExtent); void flipForRightToLeftColumn(OrderIterator&); void flipForWrapReverse(OrderIterator&, const WTF::Vector<LineContext>&, LayoutUnit crossAxisStartEdge); + + OwnPtr<OrderIterator> m_orderIterator; }; } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp index 669d46d4d..1b09cbb8d 100644 --- a/Source/WebCore/rendering/RenderFlowThread.cpp +++ b/Source/WebCore/rendering/RenderFlowThread.cpp @@ -315,18 +315,13 @@ bool RenderFlowThread::hitTestRegion(RenderRegion* region, const HitTestRequest& } else renderFlowThreadOffset = accumulatedOffset - regionRect.location(); - LayoutPoint transformedPoint = pointInContainer.point() - renderFlowThreadOffset; - // Always ignore clipping, since the RenderFlowThread has nothing to do with the bounds of the FrameView. HitTestRequest newRequest(request.type() | HitTestRequest::IgnoreClipping); - RenderRegion* oldRegion = result.region(); - result.setRegion(region); - LayoutPoint oldPoint = result.point(); - result.setPoint(transformedPoint); - bool isPointInsideFlowThread = layer()->hitTest(newRequest, result); - result.setPoint(oldPoint); - result.setRegion(oldRegion); + // Make a new temporary hitTestPoint in the new region. + HitTestPoint newHitTestPoint(pointInContainer, -renderFlowThreadOffset, region); + + bool isPointInsideFlowThread = layer()->hitTest(newRequest, newHitTestPoint, result); // FIXME: Should we set result.m_localPoint back to the RenderRegion's coordinate space or leave it in the RenderFlowThread's coordinate // space? Right now it's staying in the RenderFlowThread's coordinate space, which may end up being ok. We will know more when we get around to diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 7985268c5..7b9fc2efb 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -302,8 +302,7 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb if (!beforeChild && isAfterContent(lastChild())) beforeChild = lastChild(); - // We don't split table parts as they will be wrapped in an anonymous inline table. - if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned() && !newChild->isTablePart()) { + if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) { // We are placing a block inside an inline. We have to perform a split of this // inline into continuations. This involves creating an anonymous block box to hold // |newChild|. We then make that block box a continuation of this inline. We take all of diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 441c0beaa..74b0f5a67 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -86,6 +86,7 @@ #include "RenderTreeAsText.h" #include "RenderView.h" #include "ScaleTransformOperation.h" +#include "ScrollAnimator.h" #include "Scrollbar.h" #include "ScrollbarTheme.h" #include "Settings.h" @@ -195,6 +196,8 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer) // We save and restore only the scrollOffset as the other scroll values are recalculated. Element* element = toElement(node); m_scrollOffset = element->savedLayerScrollOffset(); + if (!m_scrollOffset.isZero()) + scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width(), m_scrollOffset.height())); element->setSavedLayerScrollOffset(IntSize()); } } @@ -3386,19 +3389,24 @@ static inline LayoutRect frameVisibleRect(RenderObject* renderer) bool RenderLayer::hitTest(const HitTestRequest& request, HitTestResult& result) { + return hitTest(request, result.hitTestPoint(), result); +} + +bool RenderLayer::hitTest(const HitTestRequest& request, const HitTestPoint& hitTestPoint, HitTestResult& result) +{ renderer()->document()->updateLayout(); LayoutRect hitTestArea = renderer()->isRenderFlowThread() ? toRenderFlowThread(renderer())->borderBoxRect() : renderer()->view()->documentRect(); if (!request.ignoreClipping()) hitTestArea.intersect(frameVisibleRect(renderer())); - RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, result.hitTestPoint(), false); + RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, hitTestPoint, false); if (!insideLayer) { // 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.active() || request.release()) && isRootLayer()) { - renderer()->updateHitTestResult(result, result.point()); + renderer()->updateHitTestResult(result, toRenderView(renderer())->flipForWritingMode(result.point())); insideLayer = this; } } @@ -3456,7 +3464,7 @@ PassRefPtr<HitTestingTransformState> RenderLayer::createLocalTransformState(Rend } else { // If this is the first time we need to make transform state, then base it off of hitTestPoint, // which is relative to rootLayer. - transformState = HitTestingTransformState::create(hitTestPoint.point(), FloatQuad(hitTestRect)); + transformState = HitTestingTransformState::create(hitTestPoint.transformedPoint(), hitTestPoint.transformedRect(), FloatQuad(hitTestRect)); convertToLayerCoords(rootLayer, offset); } @@ -3517,7 +3525,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (transform() && !appliedTransform) { // Make sure the parent's clip rects have been calculated. if (parent()) { - ClipRect clipRect = backgroundClipRect(rootLayer, result.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, IncludeOverlayScrollbarSize); + ClipRect clipRect = backgroundClipRect(rootLayer, hitTestPoint.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, IncludeOverlayScrollbarSize); // Go ahead and test the enclosing clip now. if (!clipRect.intersects(hitTestPoint)) return 0; @@ -3536,10 +3544,14 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont // // We can't just map hitTestPoint and hitTestRect because they may have been flattened (losing z) // by our container. - LayoutPoint localPoint = roundedLayoutPoint(newTransformState->mappedPoint()); - LayoutRect localHitTestRect = newTransformState->boundsOfMappedQuad(); - HitTestPoint newHitTestPoint(result.hitTestPoint()); - newHitTestPoint.setPoint(localPoint); + FloatPoint localPoint = newTransformState->mappedPoint(); + FloatQuad localPointQuad = newTransformState->mappedQuad(); + LayoutRect localHitTestRect = newTransformState->boundsOfMappedArea(); + HitTestPoint newHitTestPoint; + if (hitTestPoint.isRectBasedTest()) + newHitTestPoint = HitTestPoint(localPoint, localPointQuad); + else + newHitTestPoint = HitTestPoint(localPoint); // Now do a hit test with the root layer shifted to be us. return hitTestLayer(this, containerLayer, request, result, localHitTestRect, newHitTestPoint, true, newTransformState.get(), zOffset); @@ -3580,7 +3592,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont ClipRect bgRect; ClipRect fgRect; ClipRect outlineRect; - calculateRects(rootLayer, result.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, IncludeOverlayScrollbarSize); + calculateRects(rootLayer, hitTestPoint.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, IncludeOverlayScrollbarSize); // The following are used for keeping track of the z-depth of the hit point of 3d-transformed // descendants. @@ -3835,10 +3847,14 @@ RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, Rend RenderLayer* nextLayer = columnLayers[columnIndex - 1]; RefPtr<HitTestingTransformState> newTransformState = nextLayer->createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestPoint, transformState); newTransformState->translate(offset.width(), offset.height(), HitTestingTransformState::AccumulateTransform); - LayoutPoint localPoint = roundedLayoutPoint(newTransformState->mappedPoint()); - LayoutRect localHitTestRect = newTransformState->mappedQuad().enclosingBoundingBox(); - HitTestPoint newHitTestPoint(result.hitTestPoint()); - newHitTestPoint.setPoint(localPoint); + FloatPoint localPoint = newTransformState->mappedPoint(); + FloatQuad localPointQuad = newTransformState->mappedQuad(); + LayoutRect localHitTestRect = newTransformState->mappedArea().enclosingBoundingBox(); + HitTestPoint newHitTestPoint; + if (hitTestPoint.isRectBasedTest()) + newHitTestPoint = HitTestPoint(localPoint, localPointQuad); + else + newHitTestPoint = HitTestPoint(localPoint); newTransformState->flatten(); hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[columnIndex - 1], request, result, localHitTestRect, newHitTestPoint, @@ -4210,6 +4226,10 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* layer, const Render if (!layer->isSelfPaintingLayer()) return IntRect(); + // FIXME: This could be improved to do a check like hasVisibleNonCompositingDescendantLayers() (bug 92580). + if ((flags & ExcludeHiddenDescendants) && layer != ancestorLayer && !layer->hasVisibleContent() && !layer->hasVisibleDescendant()) + return IntRect(); + LayoutRect boundingBoxRect = layer->localBoundingBox(); if (layer->renderer()->isBox()) layer->renderBox()->flipForWritingMode(boundingBoxRect); @@ -4244,11 +4264,14 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* layer, const Render } } + // FIXME: should probably just pass 'flags' down to descendants. + CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants); + const_cast<RenderLayer*>(layer)->updateLayerListsIfNeeded(); if (RenderLayer* reflection = layer->reflectionLayer()) { if (!reflection->isComposited()) { - IntRect childUnionBounds = calculateLayerBounds(reflection, layer); + IntRect childUnionBounds = calculateLayerBounds(reflection, layer, descendantFlags); unionBounds.unite(childUnionBounds); } } @@ -4264,7 +4287,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* layer, const Render for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = negZOrderList->at(i); if (!curLayer->isComposited()) { - IntRect childUnionBounds = calculateLayerBounds(curLayer, layer); + IntRect childUnionBounds = calculateLayerBounds(curLayer, layer, descendantFlags); unionBounds.unite(childUnionBounds); } } @@ -4275,7 +4298,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* layer, const Render for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = posZOrderList->at(i); if (!curLayer->isComposited()) { - IntRect childUnionBounds = calculateLayerBounds(curLayer, layer); + IntRect childUnionBounds = calculateLayerBounds(curLayer, layer, descendantFlags); unionBounds.unite(childUnionBounds); } } @@ -4286,7 +4309,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* layer, const Render for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = normalFlowList->at(i); if (!curLayer->isComposited()) { - IntRect curAbsBounds = calculateLayerBounds(curLayer, layer); + IntRect curAbsBounds = calculateLayerBounds(curLayer, layer, descendantFlags); unionBounds.unite(curAbsBounds); } } @@ -4731,7 +4754,6 @@ bool RenderLayer::shouldBeNormalFlowOnly() const || renderer()->isCanvas() || renderer()->isVideo() || renderer()->isEmbeddedObject() - || renderer()->isApplet() || renderer()->isRenderIFrame() || renderer()->style()->specifiesColumns()) && !renderer()->isOutOfFlowPositioned() @@ -4753,7 +4775,6 @@ bool RenderLayer::shouldBeSelfPaintingLayer() const || renderer()->isCanvas() || renderer()->isVideo() || renderer()->isEmbeddedObject() - || renderer()->isApplet() || renderer()->isRenderIFrame(); } diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index a863a4c90..be945707a 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -512,6 +512,7 @@ public: void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* paintingRoot = 0, RenderRegion* = 0, PaintLayerFlags = 0); bool hitTest(const HitTestRequest&, HitTestResult&); + bool hitTest(const HitTestRequest&, const HitTestPoint&, HitTestResult&); void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot); // This method figures out our layerBounds in coordinates relative to @@ -546,6 +547,7 @@ public: IncludeSelfTransform = 1 << 0, UseLocalClipRectIfPossible = 1 << 1, IncludeLayerFilterOutsets = 1 << 2, + ExcludeHiddenDescendants = 1 << 3, DefaultCalculateLayerBoundsFlags = IncludeSelfTransform | UseLocalClipRectIfPossible | IncludeLayerFilterOutsets }; typedef unsigned CalculateLayerBoundsFlags; diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index 9886fb319..57b83e352 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -381,8 +381,7 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration() if (isDirectlyCompositedImage()) updateImageContents(); - if ((renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) - || (renderer->isApplet() && toRenderApplet(renderer)->allowsAcceleratedCompositing())) { + if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) { PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(toRenderWidget(renderer)->widget()); m_graphicsLayer->setContentsToMedia(pluginViewBase->platformLayer()); } @@ -599,7 +598,10 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() } m_foregroundLayer->setPosition(foregroundPosition); - m_foregroundLayer->setSize(foregroundSize); + if (foregroundSize != m_foregroundLayer->size()) { + m_foregroundLayer->setSize(foregroundSize); + m_foregroundLayer->setNeedsDisplay(); + } m_foregroundLayer->setOffsetFromRenderer(foregroundOffset); } diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index b2940d050..c3cf9835f 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -612,7 +612,7 @@ IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* laye { if (!canBeComposited(layer)) return IntRect(); - return RenderLayer::calculateLayerBounds(layer, ancestorLayer); + return RenderLayer::calculateLayerBounds(layer, ancestorLayer, RenderLayer::DefaultCalculateLayerBoundsFlags | RenderLayer::ExcludeHiddenDescendants); } void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer* /*child*/) @@ -1701,8 +1701,7 @@ bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer) if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) return false; - bool composite = (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) - || (renderer->isApplet() && toRenderApplet(renderer)->allowsAcceleratedCompositing()); + bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing(); if (!composite) return false; diff --git a/Source/WebCore/rendering/RenderMediaControlsChromium.cpp b/Source/WebCore/rendering/RenderMediaControlsChromium.cpp index b3b82982c..d2954dc3a 100644 --- a/Source/WebCore/rendering/RenderMediaControlsChromium.cpp +++ b/Source/WebCore/rendering/RenderMediaControlsChromium.cpp @@ -111,6 +111,19 @@ static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInf return paintMediaButton(paintInfo.context, rect, mediaElement->canPlay() ? mediaPlay : mediaPause); } +static bool paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) +{ + HTMLMediaElement* mediaElement = toParentMediaElement(object); + if (!mediaElement) + return false; + + if (!hasSource(mediaElement) || !mediaElement->canPlay()) + return false; + + static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay"); + return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay); +} + static Image* getMediaSliderThumb() { static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); @@ -334,6 +347,8 @@ bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType case MediaEnterFullscreenButton: case MediaExitFullscreenButton: return paintMediaFullscreenButton(object, paintInfo, rect); + case MediaOverlayPlayButton: + return paintMediaOverlayPlayButton(object, paintInfo, rect); case MediaVolumeSliderMuteButton: case MediaSeekBackButton: case MediaSeekForwardButton: diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 893e45159..6391334ef 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -1711,7 +1711,7 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style) #if USE(ACCELERATED_COMPOSITING) // We need to run through adjustStyleDifference() for iframes and plugins, so // style sharing is disabled for them. That should ensure that we never hit this code path. - ASSERT(!isRenderIFrame() && !isEmbeddedObject() &&!isApplet()); + ASSERT(!isRenderIFrame() && !isEmbeddedObject()); #endif return; } diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index 7b894feab..2dcd62e5d 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -296,7 +296,6 @@ private: public: RenderArena* renderArena() const { return document()->renderArena(); } - virtual bool isApplet() const { return false; } virtual bool isBR() const { return false; } virtual bool isBlockFlow() const { return false; } virtual bool isBoxModelObject() const { return false; } diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp index 11b2b0f77..5362836a4 100644 --- a/Source/WebCore/rendering/RenderRegion.cpp +++ b/Source/WebCore/rendering/RenderRegion.cpp @@ -127,7 +127,7 @@ bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& res // Check our bounds next. For this purpose always assume that we can only be hit in the // foreground phase (which is true for replaced elements like images). - LayoutRect boundsRect = borderBoxRectInRegion(result.region()); + LayoutRect boundsRect = borderBoxRectInRegion(pointInContainer.region()); boundsRect.moveBy(adjustedLocation); if (visibleToHitTesting() && action == HitTestForeground && pointInContainer.intersects(boundsRect)) { // Check the contents of the RenderFlowThread. diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp index 18cdfc17e..35716be52 100644 --- a/Source/WebCore/rendering/RenderReplaced.cpp +++ b/Source/WebCore/rendering/RenderReplaced.cpp @@ -365,7 +365,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) con // If 'height' and 'width' both have computed values of 'auto' and the element has an intrinsic ratio but no intrinsic height or width, then the used value of // 'width' is undefined in CSS 2.1. However, it is suggested that, if the containing block's width does not itself depend on the replaced element's width, then // the used value of 'width' is calculated from the constraint equation used for block-level, non-replaced elements in normal flow. - if (heightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeight && contentRenderer) { + if (heightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeight) { // The aforementioned 'constraint equation' used for block-level, non-replaced elements in normal flow: // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block LayoutUnit logicalWidth; diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 9c115a037..e939004db 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -1271,7 +1271,7 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu LayoutPoint adjustedLocation = accumulatedOffset + location(); // Check kids first. - if (!hasOverflowClip() || pointInContainer.intersects(overflowClipRect(adjustedLocation, result.region()))) { + if (!hasOverflowClip() || pointInContainer.intersects(overflowClipRect(adjustedLocation, pointInContainer.region()))) { for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) { LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation); @@ -1296,9 +1296,7 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu RenderTable* RenderTable::createAnonymousWithParentRenderer(const RenderObject* parent) { - // CSS 2.1, section 17.2.1: "If a proper table child's parent is an 'inline' box, then the generated anonymous table must be an 'inline-table' box". - EDisplay tableDisplay = parent->isInline() ? INLINE_TABLE : TABLE; - RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), tableDisplay); + RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), TABLE); RenderTable* newTable = new (parent->renderArena()) RenderTable(parent->document() /* is anonymous */); newTable->setStyle(newStyle.release()); return newTable; diff --git a/Source/WebCore/rendering/RenderTableRow.cpp b/Source/WebCore/rendering/RenderTableRow.cpp index 0e424bc11..7ca33ad61 100644 --- a/Source/WebCore/rendering/RenderTableRow.cpp +++ b/Source/WebCore/rendering/RenderTableRow.cpp @@ -217,9 +217,10 @@ bool RenderTableRow::nodeAtPoint(const HitTestRequest& request, HitTestResult& r void RenderTableRow::paintOutlineForRowIfNeeded(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { + LayoutPoint adjustedPaintOffset = paintOffset + location(); PaintPhase paintPhase = paintInfo.phase; if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && style()->visibility() == VISIBLE) - paintOutline(paintInfo.context, LayoutRect(paintOffset, size())); + paintOutline(paintInfo.context, LayoutRect(adjustedPaintOffset, size())); } void RenderTableRow::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 955ef9ade..1f1379e48 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -1379,7 +1379,7 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul // Just forward to our children always. LayoutPoint adjustedLocation = accumulatedOffset + location(); - if (hasOverflowClip() && !pointInContainer.intersects(overflowClipRect(adjustedLocation, result.region()))) + if (hasOverflowClip() && !pointInContainer.intersects(overflowClipRect(adjustedLocation, pointInContainer.region()))) return false; if (hasOverflowingCell()) { diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index baf95475c..f93704dc2 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -613,6 +613,7 @@ VisiblePosition RenderText::positionForPoint(const LayoutPoint& point) LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y(); LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x(); + bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); InlineTextBox* lastBox = 0; for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { @@ -620,12 +621,13 @@ VisiblePosition RenderText::positionForPoint(const LayoutPoint& point) box = box->nextTextBox(); RootInlineBox* rootBox = box->root(); - if (pointBlockDirection >= rootBox->selectionTop() || pointBlockDirection >= rootBox->lineTop()) { + LayoutUnit top = min(rootBox->selectionTop(), rootBox->lineTop()); + if (pointBlockDirection > top || (!blocksAreFlipped && pointBlockDirection == top)) { LayoutUnit bottom = rootBox->selectionBottom(); if (rootBox->nextRootBox()) bottom = min(bottom, rootBox->nextRootBox()->lineTop()); - if (pointBlockDirection < bottom) { + if (pointBlockDirection < bottom || (blocksAreFlipped && pointBlockDirection == bottom)) { ShouldAffinityBeDownstream shouldAffinityBeDownstream; if (lineDirectionPointFitsInBox(pointLineDirection, box, shouldAffinityBeDownstream)) return createVisiblePositionAfterAdjustingOffsetForBiDi(box, box->offsetForPosition(pointLineDirection), shouldAffinityBeDownstream); diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp index f89673237..f1661722e 100644 --- a/Source/WebCore/rendering/RenderTheme.cpp +++ b/Source/WebCore/rendering/RenderTheme.cpp @@ -329,6 +329,8 @@ bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe return paintMediaFullscreenButton(o, paintInfo, r); case MediaPlayButtonPart: return paintMediaPlayButton(o, paintInfo, r); + case MediaOverlayPlayButtonPart: + return paintMediaOverlayPlayButton(o, paintInfo, r); case MediaMuteButtonPart: return paintMediaMuteButton(o, paintInfo, r); case MediaSeekBackButtonPart: diff --git a/Source/WebCore/rendering/RenderTheme.h b/Source/WebCore/rendering/RenderTheme.h index 629834bc8..3d3976266 100644 --- a/Source/WebCore/rendering/RenderTheme.h +++ b/Source/WebCore/rendering/RenderTheme.h @@ -318,6 +318,7 @@ protected: virtual void adjustMediaControlStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaOverlayPlayButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } diff --git a/Source/WebCore/rendering/RenderThemeChromiumAndroid.cpp b/Source/WebCore/rendering/RenderThemeChromiumAndroid.cpp index 9240df34c..be3701913 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumAndroid.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumAndroid.cpp @@ -88,6 +88,18 @@ void RenderThemeChromiumAndroid::adjustInnerSpinButtonStyle(StyleResolver*, Rend } } +bool RenderThemeChromiumAndroid::paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) +{ +#if ENABLE(VIDEO) + return RenderMediaControlsChromium::paintMediaControlsPart(MediaOverlayPlayButton, object, paintInfo, rect); +#else + UNUSED_PARAM(object); + UNUSED_PARAM(paintInfo); + UNUSED_PARAM(rect); + return false; +#endif +} + int RenderThemeChromiumAndroid::menuListArrowPadding() const { // We cannot use the scrollbar thickness here, as it's width is 0 on Android. diff --git a/Source/WebCore/rendering/RenderThemeChromiumAndroid.h b/Source/WebCore/rendering/RenderThemeChromiumAndroid.h index c3e4b8bed..027628e81 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumAndroid.h +++ b/Source/WebCore/rendering/RenderThemeChromiumAndroid.h @@ -41,6 +41,8 @@ public: virtual bool delegatesMenuListRendering() const OVERRIDE { return true; } + virtual bool paintMediaOverlayPlayButton(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE; + #if ENABLE(VIDEO) virtual String extraMediaControlsStyleSheet() OVERRIDE; #endif diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp index f25d4903a..3dae06e07 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp @@ -357,6 +357,7 @@ bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo extraParams.progressBar.valueRectWidth = valueRect.width(); extraParams.progressBar.valueRectHeight = valueRect.height(); + DirectionFlippingScope scope(o, i, rect); PlatformSupport::paintThemePart(i.context, PlatformSupport::PartProgressBar, getWebThemeState(this, o), rect, &extraParams); return false; } diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp index 7910acbc1..7ce2a0cd5 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -604,8 +604,6 @@ static const double progressAnimationInterval = 0.125; IntRect RenderThemeChromiumSkia::determinateProgressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const { int dx = rect.width() * renderProgress->position(); - if (renderProgress->style()->direction() == RTL) - return IntRect(rect.x() + rect.width() - dx, rect.y(), dx, rect.height()); return IntRect(rect.x(), rect.y(), dx, rect.height()); } @@ -638,6 +636,25 @@ IntRect RenderThemeChromiumSkia::progressValueRectFor(RenderProgress* renderProg return renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, rect) : indeterminateProgressValueRectFor(renderProgress, rect); } +RenderThemeChromiumSkia::DirectionFlippingScope::DirectionFlippingScope(RenderObject* renderer, const PaintInfo& paintInfo, const IntRect& rect) + : m_needsFlipping(!renderer->style()->isLeftToRightDirection()) + , m_paintInfo(paintInfo) +{ + if (!m_needsFlipping) + return; + m_paintInfo.context->save(); + m_paintInfo.context->translate(2 * rect.x() + rect.width(), 0); + m_paintInfo.context->scale(FloatSize(-1, 1)); +} + +RenderThemeChromiumSkia::DirectionFlippingScope::~DirectionFlippingScope() +{ + if (!m_needsFlipping) + return; + m_paintInfo.context->restore(); +} + + #endif } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.h b/Source/WebCore/rendering/RenderThemeChromiumSkia.h index ca1c2ed2e..489738c85 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.h @@ -158,6 +158,16 @@ class RenderThemeChromiumSkia : public RenderTheme { IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect progressValueRectFor(RenderProgress*, const IntRect&) const; + + class DirectionFlippingScope { + public: + DirectionFlippingScope(RenderObject*, const PaintInfo&, const IntRect&); + ~DirectionFlippingScope(); + + private: + bool m_needsFlipping; + const PaintInfo& m_paintInfo; + }; #endif private: diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp index f2a79f4cc..9f30a26d2 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -802,6 +802,7 @@ bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const PaintInfo& IntRect valueRect = renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, r) : IntRect(0, 0, 0, 0); double animatedSeconds = renderProgress->animationStartTime() ? WTF::currentTime() - renderProgress->animationStartTime() : 0; ThemePainter painter(i.context, r); + DirectionFlippingScope scope(o, i, r); PlatformSupport::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds); return false; } diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index ebae66e68..8bd49ccfa 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -854,7 +854,7 @@ void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p result.setInnerNonSharedNode(node); LayoutPoint adjustedPoint = point; - adjustPointToColumnContents(adjustedPoint); + offsetForContents(adjustedPoint); result.setLocalPoint(adjustedPoint); } diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp index 3d30cc0b0..4313fa735 100644 --- a/Source/WebCore/rendering/RootInlineBox.cpp +++ b/Source/WebCore/rendering/RootInlineBox.cpp @@ -601,6 +601,11 @@ LayoutUnit RootInlineBox::selectionBottom() const return nextTop; } +int RootInlineBox::blockDirectionPointInLine() const +{ + return !block()->style()->isFlippedBlocksWritingMode() ? max(lineTop(), selectionTop()) : min(lineBottom(), selectionBottom()); +} + RenderBlock* RootInlineBox::block() const { return toRenderBlock(renderer()); diff --git a/Source/WebCore/rendering/RootInlineBox.h b/Source/WebCore/rendering/RootInlineBox.h index dee490fd4..27c1afcea 100644 --- a/Source/WebCore/rendering/RootInlineBox.h +++ b/Source/WebCore/rendering/RootInlineBox.h @@ -56,6 +56,9 @@ public: LayoutUnit paginationStrut() const { return m_paginationStrut; } void setPaginationStrut(LayoutUnit s) { m_paginationStrut = s; } + bool isFirstAfterPageBreak() const { return m_isFirstAfterPageBreak; } + void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { m_isFirstAfterPageBreak = isFirstAfterPageBreak; } + LayoutUnit paginatedLineWidth() const { return m_paginatedLineWidth; } void setPaginatedLineWidth(LayoutUnit width) { m_paginatedLineWidth = width; } @@ -66,7 +69,7 @@ public: LayoutUnit selectionTopAdjustedForPrecedingBlock() const; LayoutUnit selectionHeightAdjustedForPrecedingBlock() const { return max<LayoutUnit>(0, selectionBottom() - selectionTopAdjustedForPrecedingBlock()); } - int blockDirectionPointInLine() const { return max(lineTop(), selectionTop()); } + int blockDirectionPointInLine() const; LayoutUnit alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&); void setLineTopBottomPositions(LayoutUnit top, LayoutUnit bottom, LayoutUnit topWithLeading, LayoutUnit bottomWithLeading) diff --git a/Source/WebCore/rendering/style/WrapShapes.cpp b/Source/WebCore/rendering/style/WrapShapes.cpp new file mode 100644 index 000000000..61a2c9fbf --- /dev/null +++ b/Source/WebCore/rendering/style/WrapShapes.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "config.h" + +#include "WrapShapes.h" + +namespace WebCore { + +void WrapShape::destroy() +{ + switch (m_type) { + case WRAP_SHAPE_RECTANGLE: + delete static_cast<WrapShapeRectangle*>(this); + return; + case WRAP_SHAPE_CIRCLE: + delete static_cast<WrapShapeCircle*>(this); + return; + case WRAP_SHAPE_ELLIPSE: + delete static_cast<WrapShapeEllipse*>(this); + return; + case WRAP_SHAPE_POLYGON: + delete static_cast<WrapShapePolygon*>(this); + return; + } + ASSERT_NOT_REACHED(); +} + +} diff --git a/Source/WebCore/rendering/style/WrapShapes.h b/Source/WebCore/rendering/style/WrapShapes.h index 61052cb0d..86928b68c 100644 --- a/Source/WebCore/rendering/style/WrapShapes.h +++ b/Source/WebCore/rendering/style/WrapShapes.h @@ -13,7 +13,7 @@ * disclaimer in the documentation and/or other materials * provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + * 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 @@ -32,10 +32,12 @@ #include "Length.h" #include "WindRule.h" +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> namespace WebCore { -class WrapShape : public RefCounted<WrapShape> { +class WrapShape : public WTF::RefCountedBase { public: enum Type { WRAP_SHAPE_RECTANGLE = 1, @@ -43,12 +45,23 @@ public: WRAP_SHAPE_ELLIPSE = 3, WRAP_SHAPE_POLYGON = 4 }; + + void deref() + { + if (derefBase()) + destroy(); + } - virtual Type type() const = 0; - virtual ~WrapShape() { } + Type type() const { return m_type; } protected: - WrapShape() { } + WrapShape(Type type) + : m_type(type) + { } + +private: + void destroy(); + Type m_type; }; class WrapShapeRectangle : public WrapShape { @@ -68,12 +81,11 @@ public: void setHeight(Length height) { m_height = height; } void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; } void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; } - - virtual Type type() const { return WRAP_SHAPE_RECTANGLE; } - + private: WrapShapeRectangle() - : m_cornerRadiusX(Undefined) + : WrapShape(WRAP_SHAPE_RECTANGLE) + , m_cornerRadiusX(Undefined) , m_cornerRadiusY(Undefined) { } @@ -97,9 +109,10 @@ public: void setCenterY(Length centerY) { m_centerY = centerY; } void setRadius(Length radius) { m_radius = radius; } - virtual Type type() const { return WRAP_SHAPE_CIRCLE; } private: - WrapShapeCircle() { } + WrapShapeCircle() + : WrapShape(WRAP_SHAPE_CIRCLE) + { } Length m_centerX; Length m_centerY; @@ -120,9 +133,10 @@ public: void setRadiusX(Length radiusX) { m_radiusX = radiusX; } void setRadiusY(Length radiusY) { m_radiusY = radiusY; } - virtual Type type() const { return WRAP_SHAPE_ELLIPSE; } private: - WrapShapeEllipse() { } + WrapShapeEllipse() + : WrapShape(WRAP_SHAPE_ELLIPSE) + { } Length m_centerX; Length m_centerY; @@ -142,10 +156,10 @@ public: void setWindRule(WindRule windRule) { m_windRule = windRule; } void appendPoint(Length x, Length y) { m_values.append(x); m_values.append(y); } - virtual Type type() const { return WRAP_SHAPE_POLYGON; } private: WrapShapePolygon() - : m_windRule(RULE_NONZERO) + : WrapShape(WRAP_SHAPE_POLYGON) + , m_windRule(RULE_NONZERO) { } WindRule m_windRule; diff --git a/Source/WebCore/rendering/svg/RenderSVGText.cpp b/Source/WebCore/rendering/svg/RenderSVGText.cpp index f514e2157..d30ba1cd6 100644 --- a/Source/WebCore/rendering/svg/RenderSVGText.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGText.cpp @@ -451,7 +451,7 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul if (!SVGRenderSupport::pointInClippingArea(this, localPoint)) return false; - HitTestPoint hitTestPoint(flooredIntPoint(localPoint)); + HitTestPoint hitTestPoint(LayoutPoint(flooredIntPoint(localPoint))); return RenderBlock::nodeAtPoint(request, result, hitTestPoint, LayoutPoint(), hitTestAction); } } diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp index c918c0e70..57c579d0e 100644 --- a/Source/WebCore/svg/graphics/SVGImage.cpp +++ b/Source/WebCore/svg/graphics/SVGImage.cpp @@ -164,12 +164,13 @@ void SVGImage::drawSVGToImageBuffer(ImageBuffer* buffer, const IntSize& size, fl // Eventually clear image buffer. IntRect rect(IntPoint(), size); - if (shouldClear == ClearImageBuffer) - buffer->context()->clearRect(rect); FloatRect scaledRect(rect); scaledRect.scale(scale); + if (shouldClear == ClearImageBuffer) + buffer->context()->clearRect(enclosingIntRect(scaledRect)); + // Draw SVG on top of ImageBuffer. draw(buffer->context(), enclosingIntRect(scaledRect), rect, ColorSpaceDeviceRGB, CompositeSourceOver); diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h index 2adb8b66f..261a4006a 100644 --- a/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h +++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h @@ -59,7 +59,7 @@ struct SVGSynchronizableAnimatedProperty { // Attribute directly to avoid a call to Element::attributeChanged // that could cause the SVGElement to erroneously reset its properties. // svg/dom/SVGStringList-basics.xhtml exercises this behavior. - ElementAttributeData* attributeData = ownerElement->ensureUpdatedAttributeData(); + ElementAttributeData* attributeData = ownerElement->mutableAttributeData(); Attribute* old = attributeData->getAttributeItem(attrName); if (old && value.isNull()) attributeData->removeAttribute(old->name(), ownerElement); diff --git a/Source/WebCore/testing/FastMallocStatistics.h b/Source/WebCore/testing/FastMallocStatistics.h new file mode 100644 index 000000000..555630299 --- /dev/null +++ b/Source/WebCore/testing/FastMallocStatistics.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 SoftAtHome. 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 FastMallocStatistics_h +#define FastMallocStatistics_h + +#include <wtf/FastMalloc.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FastMallocStatistics : public RefCounted<FastMallocStatistics> { +public: + static PassRefPtr<FastMallocStatistics> create() { return adoptRef(new FastMallocStatistics()); } + + size_t reservedVMBytes() const { return m_stats.reservedVMBytes; } + size_t committedVMBytes() const { return m_stats.committedVMBytes; } + size_t freeListBytes() const { return m_stats.freeListBytes; } + +private: + FastMallocStatistics() + { + m_stats = WTF::fastMallocStatistics(); + } + + WTF::FastMallocStatistics m_stats; +}; + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/Modules/mediastream/SignalingCallback.h b/Source/WebCore/testing/FastMallocStatistics.idl index 65aa62a6f..8b60ac3d5 100644 --- a/Source/WebCore/Modules/mediastream/SignalingCallback.h +++ b/Source/WebCore/testing/FastMallocStatistics.idl @@ -1,46 +1,34 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 SoftAtHome. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SignalingCallback_h -#define SignalingCallback_h - -#if ENABLE(MEDIA_STREAM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DeprecatedPeerConnection; - -class SignalingCallback : public RefCounted<SignalingCallback> { -public: - virtual ~SignalingCallback() { } - virtual bool handleEvent(const String&, DeprecatedPeerConnection*) = 0; -}; - -} // namespace WebCore - -#endif // ENABLE(MEDIA_STREAM) - -#endif // SignalingCallback_h +module window { + interface [ + OmitConstructor + ] FastMallocStatistics { + readonly attribute unsigned long reservedVMBytes; + readonly attribute unsigned long committedVMBytes; + readonly attribute unsigned long freeListBytes; + }; +} diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index 531b04f6c..552c13a55 100644..100755 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "InternalSettings.h" -#include "CachedResourceLoader.h" #include "Chrome.h" #include "ChromeClient.h" #include "Document.h" @@ -591,4 +590,10 @@ String InternalSettings::configurationForViewport(float devicePixelRatio, int de return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); } +void InternalSettings::setMemoryInfoEnabled(bool enabled, ExceptionCode& ec) +{ + InternalSettingsGuardForSettings(); + settings()->setMemoryInfoEnabled(enabled); +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index f04b1fa30..c3d0cb58d 100644..100755 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -134,6 +134,7 @@ public: bool shouldDisplayTrackKind(const String& kind, ExceptionCode&); void setEnableMockPagePopup(bool, ExceptionCode&); String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&); + void setMemoryInfoEnabled(bool, 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 3b95c6531..dd139c066 100644..100755 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -75,6 +75,7 @@ module window { void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException); boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException); #endif + void setMemoryInfoEnabled(in boolean enabled) raises(DOMException); }; } diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index 4d0315eee..c0502a79f 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -38,6 +38,7 @@ #include "Element.h" #include "ElementShadow.h" #include "ExceptionCode.h" +#include "FastMallocStatistics.h" #include "Frame.h" #include "FrameView.h" #include "HTMLContentElement.h" @@ -55,6 +56,7 @@ #include "Language.h" #include "NodeRenderingContext.h" #include "Page.h" +#include "PrintContext.h" #include "Range.h" #include "RenderObject.h" #include "RenderTreeAsText.h" @@ -1094,6 +1096,19 @@ void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const controller->resumeAnimations(); } +void Internals::garbageCollectDocumentResources(Document* document, ExceptionCode& ec) const +{ + if (!document) { + ec = INVALID_ACCESS_ERR; + return; + } + + CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader(); + if (!cachedResourceLoader) + return; + cachedResourceLoader->garbageCollectDocumentResources(); +} + void Internals::allowRoundingHacks() const { settings()->allowRoundingHacks(); @@ -1107,6 +1122,14 @@ String Internals::counterValue(Element* element) return counterValueForElement(element); } +int Internals::pageNumber(Element* element, float pageWidth, float pageHeight) +{ + if (!element) + return 0; + + return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, pageHeight)); +} + PassRefPtr<DOMStringList> Internals::iconURLs(Document* document) const { Vector<IconURL> iconURLs = document->iconURLs(); @@ -1159,4 +1182,9 @@ void Internals::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(scheme); } +PassRefPtr<FastMallocStatistics> Internals::fastMallocStatistics() const +{ + return FastMallocStatistics::create(); +} + } diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index 58fc86983..157662c3d 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -49,6 +49,7 @@ class Range; class ScriptExecutionContext; class ShadowRoot; class WebKitPoint; +class FastMallocStatistics; typedef int ExceptionCode; @@ -146,7 +147,7 @@ public: int lastSpellCheckRequestSequence(Document*, ExceptionCode&); int lastSpellCheckProcessedSequence(Document*, ExceptionCode&); - + Vector<String> userPreferredLanguages() const; void setUserPreferredLanguages(const Vector<String>&); @@ -182,6 +183,8 @@ public: void suspendAnimations(Document*, ExceptionCode&) const; void resumeAnimations(Document*, ExceptionCode&) const; + void garbageCollectDocumentResources(Document*, ExceptionCode&) const; + void allowRoundingHacks() const; #if ENABLE(INSPECTOR) @@ -191,6 +194,8 @@ public: #endif String counterValue(Element*); + + int pageNumber(Element*, float pageWidth = 800, float pageHeight = 600); PassRefPtr<DOMStringList> iconURLs(Document*) const; #if ENABLE(FULLSCREEN_API) @@ -203,6 +208,8 @@ public: void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme); void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme); + PassRefPtr<FastMallocStatistics> fastMallocStatistics() const; + private: explicit Internals(Document*); Document* contextDocument() const; diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl index d1335991f..601e8a74f 100644 --- a/Source/WebCore/testing/Internals.idl +++ b/Source/WebCore/testing/Internals.idl @@ -155,6 +155,8 @@ module window { void suspendAnimations(in Document document) raises (DOMException); void resumeAnimations(in Document document) raises (DOMException); + void garbageCollectDocumentResources(in Document document) raises (DOMException); + void allowRoundingHacks(); #if defined(ENABLE_BATTERY_STATUS) && ENABLE_BATTERY_STATUS @@ -170,6 +172,7 @@ module window { [Conditional=INSPECTOR] sequence<String> consoleMessageArgumentCounts(in Document document); DOMString counterValue(in Element element); + long pageNumber(in Element element, in [Optional] float pageWidth, in [Optional] float pageHeight); DOMString[] iconURLs(in Document document); #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API @@ -181,6 +184,8 @@ module window { void registerURLSchemeAsBypassingContentSecurityPolicy(in DOMString scheme); void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(in DOMString scheme); + + FastMallocStatistics fastMallocStatistics(); }; } diff --git a/Source/WebCore/xml/XPathFunctions.cpp b/Source/WebCore/xml/XPathFunctions.cpp index 707cc7fce..3c90e3b51 100644 --- a/Source/WebCore/xml/XPathFunctions.cpp +++ b/Source/WebCore/xml/XPathFunctions.cpp @@ -587,7 +587,7 @@ Value FunLang::evaluate() const { String lang = arg(0)->evaluate().toString(); - Attribute* languageAttribute = 0; + const Attribute* languageAttribute = 0; Node* node = evaluationContext().node.get(); while (node) { if (node->isElementNode()) { diff --git a/Source/WebCore/xml/parser/MarkupTokenBase.h b/Source/WebCore/xml/parser/MarkupTokenBase.h index acb5d73a0..6bb0cb8b4 100644 --- a/Source/WebCore/xml/parser/MarkupTokenBase.h +++ b/Source/WebCore/xml/parser/MarkupTokenBase.h @@ -36,6 +36,16 @@ namespace WebCore { +static inline Attribute* findAttributeInVector(Vector<Attribute>& attributes, const QualifiedName& name) +{ + for (unsigned i = 0; i < attributes.size(); ++i) { + if (attributes.at(i).name().matches(name)) + return &attributes.at(i); + } + return 0; +} + + class DoctypeDataBase { WTF_MAKE_NONCOPYABLE(DoctypeDataBase); public: @@ -482,6 +492,11 @@ public: return m_doctypeData->m_systemIdentifier; } + void clearExternalCharacters() + { + m_externalCharacters = 0; + } + protected: typename Token::Type::Type m_type; diff --git a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp index e3db63296..49a316e08 100644 --- a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp +++ b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp @@ -605,11 +605,11 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent Element* element = elemStack.last(); if (element->hasAttributes()) { for (unsigned i = 0; i < element->attributeCount(); i++) { - Attribute* attr = element->attributeItem(i); - if (attr->localName() == xmlnsAtom) - m_defaultNamespaceURI = attr->value(); - else if (attr->prefix() == xmlnsAtom) - m_prefixToNamespaceMap.set(attr->localName(), attr->value()); + const Attribute* attribute = element->attributeItem(i); + if (attribute->localName() == xmlnsAtom) + m_defaultNamespaceURI = attribute->value(); + else if (attribute->prefix() == xmlnsAtom) + m_prefixToNamespaceMap.set(attribute->localName(), attribute->value()); } } } @@ -696,7 +696,7 @@ struct _xmlSAX2Namespace { }; typedef struct _xmlSAX2Namespace xmlSAX2Namespace; -static inline void handleElementNamespaces(Element* newElement, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) +static inline void handleNamespaceAttributes(Vector<Attribute, 8>& prefixedAttributes, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec) { xmlSAX2Namespace* namespaces = reinterpret_cast<xmlSAX2Namespace*>(libxmlNamespaces); for (int i = 0; i < nb_namespaces; i++) { @@ -704,9 +704,12 @@ static inline void handleElementNamespaces(Element* newElement, const xmlChar** AtomicString namespaceURI = toAtomicString(namespaces[i].uri); if (namespaces[i].prefix) namespaceQName = "xmlns:" + toString(namespaces[i].prefix); - newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, namespaceQName, namespaceURI, ec, scriptingPermission); - if (ec) // exception setting attributes + + QualifiedName parsedName = anyName; + if (!Element::parseAttributeName(parsedName, XMLNSNames::xmlnsNamespaceURI, namespaceQName, ec)) return; + + prefixedAttributes.append(Attribute(parsedName, namespaceURI)); } } @@ -719,7 +722,7 @@ struct _xmlSAX2Attributes { }; typedef struct _xmlSAX2Attributes xmlSAX2Attributes; -static inline void handleElementAttributes(Element* newElement, const xmlChar** libxmlAttributes, int nb_attributes, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) +static inline void handleElementAttributes(Vector<Attribute, 8>& prefixedAttributes, const xmlChar** libxmlAttributes, int nb_attributes, ExceptionCode& ec) { xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes); for (int i = 0; i < nb_attributes; i++) { @@ -729,9 +732,11 @@ static inline void handleElementAttributes(Element* newElement, const xmlChar** AtomicString attrURI = attrPrefix.isEmpty() ? AtomicString() : toAtomicString(attributes[i].uri); AtomicString attrQName = attrPrefix.isEmpty() ? toAtomicString(attributes[i].localname) : attrPrefix + ":" + toString(attributes[i].localname); - newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingPermission); - if (ec) // exception setting attributes + QualifiedName parsedName = anyName; + if (!Element::parseAttributeName(parsedName, attrURI, attrQName, ec)) return; + + prefixedAttributes.append(Attribute(parsedName, attrValue)); } } @@ -788,14 +793,17 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha return; } + Vector<Attribute, 8> prefixedAttributes; ExceptionCode ec = 0; - handleElementNamespaces(newElement.get(), libxmlNamespaces, nb_namespaces, ec, m_scriptingPermission); + handleNamespaceAttributes(prefixedAttributes, libxmlNamespaces, nb_namespaces, ec); if (ec) { + newElement->parserSetAttributes(prefixedAttributes, m_scriptingPermission); stopParsing(); return; } - handleElementAttributes(newElement.get(), libxmlAttributes, nb_attributes, ec, m_scriptingPermission); + handleElementAttributes(prefixedAttributes, libxmlAttributes, nb_attributes, ec); + newElement->parserSetAttributes(prefixedAttributes, m_scriptingPermission); if (ec) { stopParsing(); return; diff --git a/Source/WebCore/xml/parser/XMLDocumentParserQt.cpp b/Source/WebCore/xml/parser/XMLDocumentParserQt.cpp index 59d944934..6430accc9 100644 --- a/Source/WebCore/xml/parser/XMLDocumentParserQt.cpp +++ b/Source/WebCore/xml/parser/XMLDocumentParserQt.cpp @@ -52,6 +52,7 @@ #include "ScriptValue.h" #include "TextResourceDecoder.h" #include "TransformSource.h" +#include "XMLNSNames.h" #include <QDebug> #include <wtf/StringExtras.h> #include <wtf/Threading.h> @@ -138,9 +139,9 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent QXmlStreamNamespaceDeclarations namespaces; for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) { - if (ElementAttributeData* attrs = element->updatedAttributeData()) { + if (const ElementAttributeData* attrs = element->updatedAttributeData()) { for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); + const Attribute* attr = attrs->attributeItem(i); if (attr->localName() == "xmlns") m_defaultNamespaceURI = attr->value(); else if (attr->prefix() == "xmlns") @@ -315,22 +316,23 @@ static inline String prefixFromQName(const QString& qName) return qName.left(offset); } -static inline void handleElementNamespaces(Element* newElement, const QXmlStreamNamespaceDeclarations &ns, - ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) +static inline void handleNamespaceAttributes(Vector<Attribute, 8>& prefixedAttributes, const QXmlStreamNamespaceDeclarations &ns, ExceptionCode& ec) { for (int i = 0; i < ns.count(); ++i) { const QXmlStreamNamespaceDeclaration &decl = ns[i]; String namespaceURI = decl.namespaceUri(); String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:"); namespaceQName.append(decl.prefix()); - newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec, scriptingPermission); - if (ec) // exception setting attributes + + QualifiedName parsedName = anyName; + if (!Element::parseAttributeName(parsedName, XMLNSNames::xmlnsNamespaceURI, namespaceQName, ec)) return; + + prefixedAttributes.append(Attribute(parsedName, namespaceURI)); } } -static inline void handleElementAttributes(Element* newElement, const QXmlStreamAttributes &attrs, ExceptionCode& ec, - FragmentScriptingPermission scriptingPermission) +static inline void handleElementAttributes(Vector<Attribute, 8>& prefixedAttributes, const QXmlStreamAttributes &attrs, ExceptionCode& ec) { for (int i = 0; i < attrs.count(); ++i) { const QXmlStreamAttribute &attr = attrs[i]; @@ -338,9 +340,12 @@ static inline void handleElementAttributes(Element* newElement, const QXmlStream String attrValue = attr.value(); String attrURI = attr.namespaceUri().isEmpty() ? String() : String(attr.namespaceUri()); String attrQName = attr.qualifiedName(); - newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingPermission); - if (ec) // exception setting attributes + + QualifiedName parsedName = anyName; + if (!Element::parseAttributeName(parsedName, attrURI, attrQName, ec)) return; + + prefixedAttributes.append(Attribute(parsedName, attrValue)); } } @@ -455,14 +460,17 @@ void XMLDocumentParser::parseStartElement() bool isFirstElement = !m_sawFirstElement; m_sawFirstElement = true; + Vector<Attribute, 8> prefixedAttributes; ExceptionCode ec = 0; - handleElementNamespaces(newElement.get(), m_stream.namespaceDeclarations(), ec, m_scriptingPermission); + handleNamespaceAttributes(prefixedAttributes, m_stream.namespaceDeclarations(), ec); if (ec) { + newElement->parserSetAttributes(prefixedAttributes, m_scriptingPermission); stopParsing(); return; } - handleElementAttributes(newElement.get(), m_stream.attributes(), ec, m_scriptingPermission); + handleElementAttributes(prefixedAttributes, m_stream.attributes(), ec); + newElement->parserSetAttributes(prefixedAttributes, m_scriptingPermission); if (ec) { stopParsing(); return; diff --git a/Source/WebCore/xml/parser/XMLTreeBuilder.cpp b/Source/WebCore/xml/parser/XMLTreeBuilder.cpp index db213cd62..4cd3ac970 100644 --- a/Source/WebCore/xml/parser/XMLTreeBuilder.cpp +++ b/Source/WebCore/xml/parser/XMLTreeBuilder.cpp @@ -82,11 +82,11 @@ XMLTreeBuilder::XMLTreeBuilder(NewXMLDocumentParser* parser, DocumentFragment* f element = nodeStack.last(); if (element->hasAttributes()) { for (size_t i = 0; i < element->attributeCount(); ++i) { - Attribute* attr = element->attributeItem(i); - if (attr->localName() == xmlnsAtom) - stackItem.setNamespaceURI(attr->value()); - else if (attr->prefix() == xmlnsAtom) - stackItem.setNamespaceURI(attr->localName(), attr->value()); + const Attribute* attribute = element->attributeItem(i); + if (attribute->localName() == xmlnsAtom) + stackItem.setNamespaceURI(attribute->value()); + else if (attribute->prefix() == xmlnsAtom) + stackItem.setNamespaceURI(attribute->localName(), attribute->value()); } } } diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt index d25fb8127..03797a374 100644 --- a/Source/WebKit/CMakeLists.txt +++ b/Source/WebKit/CMakeLists.txt @@ -2,6 +2,7 @@ SET(WebKit_INCLUDE_DIRECTORIES "${WEBKIT_DIR}" "${WEBCORE_DIR}" "${WEBCORE_DIR}/Modules/intents" + "${WEBCORE_DIR}/Modules/networkinfo" "${WEBCORE_DIR}/Modules/webdatabase" "${WEBCORE_DIR}/accessibility" "${WEBCORE_DIR}/bindings/generic" @@ -28,6 +29,8 @@ SET(WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/animation" "${WEBCORE_DIR}/platform/graphics" "${WEBCORE_DIR}/platform/graphics/filters" + "${WEBCORE_DIR}/platform/graphics/harfbuzz" + "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng" "${WEBCORE_DIR}/platform/graphics/transforms" "${WEBCORE_DIR}/platform/network" "${WEBCORE_DIR}/platform/sql" diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 9a2adea37..19994d1e6 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,68 @@ +2012-07-30 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Qt/Mac build fix: Use libWebKitSystemInterfaceMountainLion.a + on Mountain Lion. + + * WebKit1.pri: + +2012-07-27 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] WebKit API unit tests needs a timeout + https://bugs.webkit.org/show_bug.cgi?id=92496 + + Reviewed by Antonio Gomes. + + Added the same timeout value that we have for WebKit2. + + * PlatformEfl.cmake: + +2012-07-27 Dominik Röttsches <dominik.rottsches@intel.com> + + [Cairo] Add complex font drawing using HarfbuzzNG + https://bugs.webkit.org/show_bug.cgi?id=91864 + + Reviewed by Simon Hausmann and Martin Robinson. + + Adding includes for harfbuzz folders. + + * CMakeLists.txt: + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + WebKit EFL not longer needs to link against EEZE + library since the Network Information provider + was moved to WebCore. + + * CMakeLists.txt: + * PlatformEfl.cmake: + +2012-07-26 Zoltan Nyul <zoltan.nyul@intel.com> + + [EFL] EFL port should use XDG paths + https://bugs.webkit.org/show_bug.cgi?id=91719 + + Reviewed by Kenneth Rohde Christiansen. + + Add efreet library to get the xdg paths. + + * PlatformEfl.cmake: + +2012-07-25 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Add File Chooser API + https://bugs.webkit.org/show_bug.cgi?id=91957 + + Reviewed by Hajime Morita. + + Add ewk_file_chooser source and header. + + * PlatformEfl.cmake: + 2012-07-22 Kent Tamura <tkent@chromium.org> Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake index 6cdc9b775..a7005228f 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -2,6 +2,7 @@ LIST(APPEND WebKit_LINK_FLAGS ${ECORE_X_LDFLAGS} ${EDJE_LDFLAGS} ${EFLDEPS_LDFLAGS} + ${EFREET_LDFLAGS} ${EVAS_LDFLAGS} ) @@ -18,6 +19,7 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES ${ECORE_X_INCLUDE_DIRS} ${EDJE_INCLUDE_DIRS} ${EFLDEPS_INCLUDE_DIRS} + ${EFREET_INCLUDE_DIRS} ${EVAS_INCLUDE_DIRS} ${EUKIT_INCLUDE_DIRS} ${EDBUS_INCLUDE_DIRS} @@ -68,19 +70,6 @@ IF (WTF_USE_PANGO) ) ENDIF () -IF (ENABLE_NETWORK_INFO) - LIST(APPEND WebKit_LINK_FLAGS - ${EEZE_LDFLAGS} - ) - LIST(APPEND WebKit_INCLUDE_DIRECTORIES - "${WEBCORE_DIR}/Modules/networkinfo" - ${EEZE_INCLUDE_DIRS} - ) - LIST(APPEND WebKit_LIBRARIES - ${EEZE_LIBRARIES} - ) -ENDIF () - IF (ENABLE_NOTIFICATIONS) LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/Modules/notifications" @@ -132,6 +121,7 @@ LIST(APPEND WebKit_SOURCES efl/ewk/ewk_contextmenu.cpp efl/ewk/ewk_cookies.cpp efl/ewk/ewk_custom_handler.cpp + efl/ewk/ewk_file_chooser.cpp efl/ewk/ewk_frame.cpp efl/ewk/ewk_history.cpp efl/ewk/ewk_intent.cpp @@ -158,6 +148,7 @@ LIST(APPEND WebKit_LIBRARIES ${CAIRO_LIBRARIES} ${ECORE_X_LIBRARIES} ${EFLDEPS_LIBRARIES} + ${EFREET_LIBRARIES} ${EUKIT_LIBRARIES} ${EDBUS_LIBRARIES} ${FREETYPE_LIBRARIES} @@ -274,6 +265,7 @@ SET(EWebKit_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_auth.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_contextmenu.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_cookies.h + ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_file_chooser.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_frame.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_history.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_intent.h @@ -359,6 +351,7 @@ IF (ENABLE_API_TESTS) FOREACH (testName ${EWKUnitTests_BINARIES}) ADD_EXECUTABLE(${testName} ${WEBKIT_EFL_TEST_DIR}/${testName}.cpp ${WEBKIT_EFL_TEST_DIR}/test_runner.cpp) ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}) + SET_TESTS_PROPERTIES(${testName} PROPERTIES TIMEOUT 60) TARGET_LINK_LIBRARIES(${testName} ${EWKUnitTests_LIBRARIES} ewkTestUtils) ADD_TARGET_PROPERTIES(${testName} LINK_FLAGS "${EWKUnitTests_LINK_FLAGS}") SET_TARGET_PROPERTIES(${testName} PROPERTIES FOLDER "WebKit") diff --git a/Source/WebKit/WebKit1.pri b/Source/WebKit/WebKit1.pri index cf5b2be88..b16d6f130 100644 --- a/Source/WebKit/WebKit1.pri +++ b/Source/WebKit/WebKit1.pri @@ -18,7 +18,9 @@ contains(DEFINES, ENABLE_VIDEO=1):contains(DEFINES, WTF_USE_QTKIT=1) { # 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, "11") { + 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 diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 78102c179..a0fa295e3 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -228,7 +228,12 @@ BackingStorePrivate::BackingStorePrivate() pthread_mutexattr_destroy(&attr); pthread_mutex_init(&m_blitGenerationLock, 0); - pthread_cond_init(&m_blitGenerationCond, 0); + + pthread_condattr_t condattr; + pthread_condattr_init(&condattr); + pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC); + pthread_cond_init(&m_blitGenerationCond, &condattr); + pthread_condattr_destroy(&condattr); } BackingStorePrivate::~BackingStorePrivate() @@ -399,8 +404,11 @@ void BackingStorePrivate::repaint(const Platform::IntRect& windowRect, #endif if (immediate) { - if (render(rect) && !shouldDirectRenderingToWindow()) - blitVisibleContents(); + if (render(rect)) { + if (!shouldDirectRenderingToWindow()) + blitVisibleContents(); + m_webPage->d->m_client->notifyContentRendered(rect); + } } else m_renderQueue->addToQueue(RenderQueue::RegularRender, rect); } @@ -921,6 +929,9 @@ void BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion(const TileIndex& const Platform::IntRect& backingStoreRect, bool update) { + if (tileNotRenderedRegion.isEmpty()) + return; + // Intersect the tile with the not rendered region to get the areas // of the tile that we need to clear. IntRectList tileNotRenderedRegionRects = tileNotRenderedRegion.rects(); @@ -933,17 +944,43 @@ void BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion(const TileIndex& // Add it again as a regular render job. m_renderQueue->addToQueue(RenderQueue::RegularRender, tileNotRenderedRegionRect); } + } - // Find the origin of this tile. - Platform::IntPoint origin = originOfTile(index, backingStoreRect); + // Find the origin of this tile. + Platform::IntPoint origin = originOfTile(index, backingStoreRect); - // Map to tile coordinates. - tileNotRenderedRegionRect.move(-origin.x(), -origin.y()); + // Map to tile coordinates. + Platform::IntRectRegion translatedRegion(tileNotRenderedRegion); + translatedRegion.move(-origin.x(), -origin.y()); - // Clear the tile of this region. - tile->frontBuffer()->clearRenderedRegion(tileNotRenderedRegionRect); - tile->backBuffer()->clearRenderedRegion(tileNotRenderedRegionRect); - } + // If the region in question is already marked as not rendered, return early + if (Platform::IntRectRegion::intersectRegions(tile->frontBuffer()->renderedRegion(), translatedRegion).isEmpty()) + return; + + // Clear the tile of this region. The back buffer region is invalid anyway, but the front + // buffer must not be manipulated without synchronization with the compositing thread, or + // we have a race. + // Instead of using the customary sequence of copy-back, modify and swap, we send a synchronous + // message to the compositing thread to avoid the copy-back step and save memory bandwidth. + // The trade-off is that the WebKit thread might wait a little longer for the compositing thread + // than it would from a waitForCurrentMessage() call. + + ASSERT(Platform::webKitThreadMessageClient()->isCurrentThread()); + if (!Platform::webKitThreadMessageClient()->isCurrentThread()) + return; + + Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( + Platform::createMethodCallMessage(&BackingStorePrivate::clearRenderedRegion, + this, tile, translatedRegion)); +} + +void BackingStorePrivate::clearRenderedRegion(BackingStoreTile* tile, const Platform::IntRectRegion& region) +{ + ASSERT(Platform::userInterfaceThreadMessageClient()->isCurrentThread()); + if (!Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + return; + + tile->frontBuffer()->clearRenderedRegion(region); } bool BackingStorePrivate::isCurrentVisibleJob(const TileIndex& index, BackingStoreTile* tile, const Platform::IntRect& backingStoreRect) const @@ -1072,8 +1109,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) BackingStoreGeometry* currentState = frontState(); TileMap currentMap = currentState->tileMap(); - Platform::IntRect dirtyContentsRect; - for (size_t i = 0; i < tileRectList.size(); ++i) { TileRect tileRect = tileRectList[i]; TileIndex index = tileRect.first; @@ -1084,15 +1119,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) // transformed contents coordinates. Platform::IntRect dirtyRect = mapFromTilesToTransformedContents(tileRect); - // If we're not yet committed, then commit now by clearing the rendered region - // and setting the committed flag as well as clearing the shift. - if (!tile->isCommitted()) { - tile->setCommitted(true); - tile->frontBuffer()->clearRenderedRegion(); - tile->backBuffer()->clearRenderedRegion(); - tile->clearShift(); - } - // If the tile has been created, but this is the first time we are painting on it // then it hasn't been given a default background yet so that we can save time during // startup. That's why we are doing it here instead... @@ -1112,8 +1138,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) continue; } - copyPreviousContentsToBackSurfaceOfTile(dirtyTileRect, tile); - BlackBerry::Platform::Graphics::Buffer* nativeBuffer = tile->backBuffer()->nativeBuffer(); @@ -1138,6 +1162,17 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) pthread_mutex_unlock(&m_blitGenerationLock); } + // Modify the buffer only after we've waited for the buffer to become available above. + + // If we're not yet committed, then commit only after the tile has back buffer has been + // swapped in so it has some valid content. + // Otherwise the compositing thread could pick up the tile while its front buffer is still invalid. + bool wasCommitted = tile->isCommitted(); + if (wasCommitted) + copyPreviousContentsToBackSurfaceOfTile(dirtyTileRect, tile); + else + tile->backBuffer()->clearRenderedRegion(); + // FIXME: modify render to take a Vector<IntRect> parameter so we're not recreating // GraphicsContext on the stack each time. renderContents(nativeBuffer, originOfTile(index), dirtyRect); @@ -1145,23 +1180,26 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) // Add the newly rendered region to the tile so it can keep track for blits. tile->backBuffer()->addRenderedRegion(dirtyTileRect); - // Check if the contents for this tile's backbuffer are valid when - // compared to the front buffer. - bool backBufferIsValid = tile->backBuffer()->isRendered(tile->frontBuffer()->renderedRegion()); - - // Our current design demands that the backbuffer is valid after any - // rendering operation so assert that here. If we hit this assert we - // know that we're doing something bad that will result in artifacts. - ASSERT(backBufferIsValid); + // Thanks to the copyPreviousContentsToBackSurfaceOfTile() call above, we know that + // the rendered region of the back buffer contains the rendered region of the front buffer. + // Assert this just to make sure. + // For previously uncommitted tiles, the front buffer's rendered region is not relevant. + ASSERT(!wasCommitted || tile->backBuffer()->isRendered(tile->frontBuffer()->renderedRegion())); // We will need a swap here because of the shared back buffer. - if (backBufferIsValid) { - tile->swapBuffers(); - BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); - tile->backBuffer()->clearRenderedRegion(); + tile->swapBuffers(); + + if (!wasCommitted) { + // Commit the tile only after it has valid front buffer contents. Now, the compositing thread + // can finally start blitting this tile. + tile->clearShift(); + tile->setCommitted(true); } - dirtyContentsRect = Platform::unionOfRects(dirtyContentsRect, dirtyRect); + // Before clearing the render region, wait for the compositing thread to stop using the + // buffer, in order to avoid a race on its rendered region. + BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); + tile->backBuffer()->clearRenderedRegion(); } return true; @@ -2871,7 +2909,7 @@ Platform::Graphics::Buffer* BackingStorePrivate::buffer() const #if USE(ACCELERATED_COMPOSITING) if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor()) - return compositor->context()->buffer(); + return compositor->context() ? compositor->context()->buffer() : 0; #endif return 0; diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index 50feb041c..67913b986 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -166,6 +166,9 @@ public: void clearAndUpdateTileOfNotRenderedRegion(const TileIndex&, BackingStoreTile*, const Platform::IntRectRegion&, const Platform::IntRect& backingStoreRect, bool update = true); bool isCurrentVisibleJob(const TileIndex&, BackingStoreTile*, const Platform::IntRect& backingStoreRect) const; + // Not thread safe. Call only when threads are in sync. + void clearRenderedRegion(BackingStoreTile*, const Platform::IntRectRegion&); + // Responsible for scrolling the backing store and updating the // tile matrix geometry. void scrollBackingStore(int deltaX, int deltaY); diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 487a17d72..a8d44aff1 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -547,8 +547,9 @@ void WebPagePrivate::init(const WebString& pageGroupName) // so that we only get one didChangeSettings() callback when we set the page group name. This causes us // to make a copy of the WebSettings since some WebSettings method make use of the page group name. // Instead, we shouldn't be storing the page group name in WebSettings. - m_webSettings->setDelegate(this); m_webSettings->setPageGroupName(pageGroupName); + m_webSettings->setDelegate(this); + didChangeSettings(m_webSettings); RefPtr<Frame> newFrame = Frame::create(m_page, /* HTMLFrameOwnerElement* */ 0, frameLoaderClient); @@ -564,22 +565,16 @@ void WebPagePrivate::init(const WebString& pageGroupName) m_page->settings()->setCanvasUsesAcceleratedDrawing(true); m_page->settings()->setAccelerated2dCanvasEnabled(true); #endif -#if ENABLE(VIEWPORT_REFLOW) - m_page->settings()->setTextReflowEnabled(m_webSettings->textReflowMode() == WebSettings::TextReflowEnabled); -#endif m_page->settings()->setInteractiveFormValidationEnabled(true); m_page->settings()->setAllowUniversalAccessFromFileURLs(false); m_page->settings()->setAllowFileAccessFromFileURLs(false); - m_page->settings()->setShouldUseCrossOriginProtocolCheck(!m_webSettings->allowCrossSiteRequests()); - m_page->settings()->setWebSecurityEnabled(!m_webSettings->allowCrossSiteRequests()); m_backingStoreClient = BackingStoreClient::create(m_mainFrame, /* parent frame */ 0, m_webPage); // The direct access to BackingStore is left here for convenience since it // is owned by BackingStoreClient and then deleted by its destructor. m_backingStore = m_backingStoreClient->backingStore(); - m_page->settings()->setSpatialNavigationEnabled(m_webSettings->isSpatialNavigationEnabled()); blockClickRadius = int(roundf(0.35 * Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(0).width())); // The clicked rectangle area should be a fixed unit of measurement. m_page->settings()->setDelegateSelectionPaint(true); @@ -979,6 +974,11 @@ void WebPage::prepareToDestroy() d->prepareToDestroy(); } +bool WebPage::dispatchBeforeUnloadEvent() +{ + return d->m_page->mainFrame()->loader()->shouldClose(); +} + static void enableCrossSiteXHRRecursively(Frame* frame) { frame->document()->securityOrigin()->grantUniversalAccess(); @@ -3653,12 +3653,14 @@ void WebPagePrivate::resumeBackingStore() m_backingStore->d->orientationChanged(); // Updates tile geometry and creates visible tile buffer. m_backingStore->d->resetTiles(true /* resetBackground */); m_backingStore->d->updateTiles(false /* updateVisible */, false /* immediate */); + // This value may have changed, so we need to update it. directRendering = m_backingStore->d->shouldDirectRenderingToWindow(); - if (m_backingStore->d->renderVisibleContents() && !m_backingStore->d->isSuspended() && !directRendering) - m_backingStore->d->blitVisibleContents(); - - m_client->notifyContentRendered(m_backingStore->d->visibleContentsRect()); + if (m_backingStore->d->renderVisibleContents()) { + if (!m_backingStore->d->isSuspended() && !directRendering) + m_backingStore->d->blitVisibleContents(); + m_client->notifyContentRendered(m_backingStore->d->visibleContentsRect()); + } } else { if (m_backingStore->d->isOpenGLCompositing()) setCompositorDrawsRootLayer(false); @@ -4596,9 +4598,14 @@ void WebPage::setSpellCheckingEnabled(bool enabled) static_cast<EditorClientBlackBerry*>(d->m_page->editorClient())->enableSpellChecking(enabled); } -void WebPage::spellCheckingRequestProcessed(int32_t id, spannable_string_t* spannableString) +void WebPage::spellCheckingRequestCancelled(int32_t transactionId) +{ + d->m_inputHandler->spellCheckingRequestCancelled(transactionId); +} + +void WebPage::spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t* spannableString) { - d->m_inputHandler->spellCheckingRequestProcessed(id, spannableString); + d->m_inputHandler->spellCheckingRequestProcessed(transactionId, spannableString); } class DeferredTaskSelectionCancelled: public DeferredTask<&WebPagePrivate::m_wouldCancelSelection> { @@ -4682,6 +4689,13 @@ void WebPage::paste() d->m_inputHandler->paste(); } +void WebPage::selectAll() +{ + if (d->m_page->defersLoading()) + return; + d->m_inputHandler->selectAll(); +} + void WebPage::setSelection(const Platform::IntPoint& startPoint, const Platform::IntPoint& endPoint) { if (d->m_page->defersLoading()) @@ -5873,7 +5887,7 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit // That seems extremely likely to be the case, but let's assert just to make sure. ASSERT(webKitThreadMessageClient()->isCurrentThread()); - if (m_backingStore->d->buffer()) + if (m_compositor || m_client->window()) m_backingStore->d->suspendScreenAndBackingStoreUpdates(); // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), @@ -5885,7 +5899,7 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit // safe access to m_compositor and its refcount. userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositorHelper, this, compositor, compositingContext)); - if (m_backingStore->d->buffer()) // the new compositor, if one was set + if (m_compositor || m_client->window()) // the new compositor, if one was set m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); } @@ -6400,6 +6414,7 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings) coreSettings->setDefaultTextEncodingName(webSettings->defaultTextEncodingName().impl()); coreSettings->setDownloadableBinaryFontsEnabled(webSettings->downloadableBinaryFontsEnabled()); coreSettings->setSpatialNavigationEnabled(m_webSettings->isSpatialNavigationEnabled()); + coreSettings->setAsynchronousSpellCheckingEnabled(m_webSettings->isAsynchronousSpellCheckingEnabled()); WebString stylesheetURL = webSettings->userStyleSheetString(); if (stylesheetURL.isEmpty()) diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index 026349317..c7227fe8d 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -111,6 +111,8 @@ public: void stopLoading(); + bool dispatchBeforeUnloadEvent(); + // This will force any unload handlers to run. void prepareToDestroy(); @@ -158,6 +160,7 @@ public: void cut(); void copy(); void paste(); + void selectAll(); // Text encoding. WebString textEncoding(); @@ -255,7 +258,8 @@ public: int32_t commitText(spannable_string_t*, int32_t relativeCursorPosition); void setSpellCheckingEnabled(bool); - void spellCheckingRequestProcessed(int32_t id, spannable_string_t*); + void spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t*); + void spellCheckingRequestCancelled(int32_t transactionId); void setSelection(const Platform::IntPoint& startPoint, const Platform::IntPoint& endPoint); void setCaretPosition(const Platform::IntPoint&); diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index e931d6050..96fba7a52 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -113,6 +113,7 @@ public: virtual void runJavaScriptAlert(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0; virtual bool runJavaScriptConfirm(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0; virtual bool runJavaScriptPrompt(const unsigned short* message, unsigned messageLength, const unsigned short* defaultValue, unsigned defaultValueLength, const char* origin, unsigned originLength, WebString& result) = 0; + virtual bool runBeforeUnloadConfirmPanel(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0; virtual bool shouldInterruptJavaScript() = 0; @@ -143,9 +144,7 @@ public: virtual void showVirtualKeyboard(bool) = 0; - virtual void checkSpellingOfString(const unsigned short* text, int length, int& misspellingLocation, int& misspellingLength) = 0; virtual void requestSpellingSuggestionsForString(unsigned start, unsigned end) = 0; - virtual int32_t checkSpellingOfStringAsync(wchar_t* text, int length) = 0; virtual void notifySelectionDetailsChanged(const Platform::IntRect& start, const Platform::IntRect& end, const Platform::IntRectRegion&, bool overrideTouchHandling = false) = 0; diff --git a/Source/WebKit/blackberry/Api/WebSettings.cpp b/Source/WebKit/blackberry/Api/WebSettings.cpp index 1156d741a..dd3a9c49a 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.cpp +++ b/Source/WebKit/blackberry/Api/WebSettings.cpp @@ -38,6 +38,7 @@ namespace BlackBerry { namespace WebKit { DEFINE_STATIC_LOCAL(String, BlackBerryAllowCrossSiteRequests, ("BlackBerryAllowCrossSiteRequests")); +DEFINE_STATIC_LOCAL(String, BlackBerryAsynchronousSpellChecking, ("BlackBerryAsynchronousSpellChecking")); DEFINE_STATIC_LOCAL(String, BlackBerryBackgroundColor, ("BlackBerryBackgroundColor")); DEFINE_STATIC_LOCAL(String, BlackBerryCookiesEnabled, ("BlackBerryCookiesEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryDirectRenderingToWindowEnabled, ("BlackBerryDirectRenderingToWindowEnabled")); @@ -177,6 +178,7 @@ WebSettings* WebSettings::standardSettings() settings->m_private->setBoolean(BlackBerryFullScreenVideoCapable, false); settings->m_private->setBoolean(BlackBerryCredentialAutofillEnabled, false); settings->m_private->setBoolean(BlackBerryFormAutofillEnabled, false); + settings->m_private->setBoolean(BlackBerryAsynchronousSpellChecking, true); if (BlackBerry::Platform::DeviceInfo::instance()->isMobile()) { WebCore::FloatSize currentPPI = Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(-1); @@ -198,10 +200,10 @@ WebSettings* WebSettings::standardSettings() settings->m_private->setInteger(WebKitMinimumFontSize, 8); settings->m_private->setBoolean(WebKitWebSocketsEnabled, true); - settings->m_private->setString(WebKitFixedFontFamily, BlackBerry::Platform::fontFamily("-webkit-monospace", "").c_str()); - settings->m_private->setString(WebKitSansSeriffFontFamily, BlackBerry::Platform::fontFamily("-webkit-sans-serif", "").c_str()); - settings->m_private->setString(WebKitSeriffFontFamily, BlackBerry::Platform::fontFamily("-webkit-serif", "").c_str()); - settings->m_private->setString(WebKitStandardFontFamily, BlackBerry::Platform::fontFamily("-webkit-standard", "").c_str()); + settings->m_private->setString(WebKitFixedFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-monospace", "").c_str()); + settings->m_private->setString(WebKitSansSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-sans-serif", "").c_str()); + settings->m_private->setString(WebKitSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-serif", "").c_str()); + settings->m_private->setString(WebKitStandardFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-standard", "").c_str()); return settings; } @@ -807,6 +809,16 @@ void WebSettings::setSpatialNavigationEnabled(bool enable) m_private->setBoolean(SpatialNavigationEnabled, enable); } +bool WebSettings::isAsynchronousSpellCheckingEnabled() const +{ + return m_private->getBoolean(BlackBerryAsynchronousSpellChecking); +} + +void WebSettings::setAsynchronousSpellCheckingEnabled(bool enable) const +{ + return m_private->setBoolean(BlackBerryAsynchronousSpellChecking, enable); +} + bool WebSettings::fullScreenVideoCapable() const { return m_private->getBoolean(BlackBerryFullScreenVideoCapable); diff --git a/Source/WebKit/blackberry/Api/WebSettings.h b/Source/WebKit/blackberry/Api/WebSettings.h index 39f7c209b..b60cb6dcf 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.h +++ b/Source/WebKit/blackberry/Api/WebSettings.h @@ -228,6 +228,9 @@ public: bool isSpatialNavigationEnabled() const; void setSpatialNavigationEnabled(bool); + bool isAsynchronousSpellCheckingEnabled() const; + void setAsynchronousSpellCheckingEnabled(bool) const; + bool fullScreenVideoCapable() const; void setFullScreenVideoCapable(bool); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index c3ec07f2f..ffaee6de6 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,446 @@ +2012-07-27 Eli Fidler <efidler@rim.com> + + [BlackBerry] Adapt to change in the FontInfo platform API. + https://bugs.webkit.org/show_bug.cgi?id=92547 + + Reviewed by Yong Li + + RIM PR 161263 + + * Api/WebSettings.cpp: + (BlackBerry::WebKit::WebSettings::standardSettings): + +2012-07-27 Yong Li <yoli@rim.com> + + [BlackBerry] Should support onbeforeunload event and show confirmation dialog + https://bugs.webkit.org/show_bug.cgi?id=92510 + + Reviewed by Antonio Gomes. + + RIM PR# 155878. + 1. Export dispatchBeforeUnloadEvent() so client can call it before going to close the page. + 2. Forward runBeforeUnloadConfirmPanel() call to client so it can show a dialog. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::dispatchBeforeUnloadEvent): + (WebKit): + * Api/WebPage.h: + * Api/WebPageClient.h: + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::canRunBeforeUnloadConfirmPanel): + (WebCore::ChromeClientBlackBerry::runBeforeUnloadConfirmPanel): + +2012-07-27 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Switch InputHandler malloc use to fastMalloc for cases that should never fail + https://bugs.webkit.org/show_bug.cgi?id=92508 + + Reviewed by Yong Li. + + Replace common uses of malloc with fastMalloc rather + than trying to recover gracefully. If we are truly + out of memory, crash before corruption occurs. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::spannableTextInRange): + (BlackBerry::WebKit::InputHandler::extractedTextRequest): + +2012-07-26 Nima Ghanavatian <nghanavatian@rim.com> + + [BlackBerry] Remove synchronous spellchecking code + https://bugs.webkit.org/show_bug.cgi?id=92415 + + Removing synchronous spellchecking code path. + + Reviewed by Rob Buis. + + Internally reviewed by Mike Fenton. + + * Api/WebPageClient.h: + * WebCoreSupport/EditorClientBlackBerry.cpp: + (WebCore::EditorClientBlackBerry::checkSpellingOfString): + +2012-07-26 Nima Ghanavatian <nghanavatian@rim.com> + + [BlackBerry] Support async spellcheck for the blackberry port + https://bugs.webkit.org/show_bug.cgi?id=92160 + + PR124517 + Implementing support for async spellcheck. + + Reviewed by Rob Buis. + + Internally reviewed by Mike Fenton. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::spellCheckingRequestCancelled): + (WebKit): + (BlackBerry::WebKit::WebPage::spellCheckingRequestProcessed): + (BlackBerry::WebKit::WebPagePrivate::didChangeSettings): + * Api/WebPage.h: + * Api/WebSettings.cpp: + (WebKit): + (BlackBerry::WebKit::WebSettings::standardSettings): + (BlackBerry::WebKit::WebSettings::isAsynchronousSpellCheckingEnabled): + (BlackBerry::WebKit::WebSettings::setAsynchronousSpellCheckingEnabled): + * Api/WebSettings.h: + * WebCoreSupport/EditorClientBlackBerry.cpp: + (WebCore): + (WebCore::EditorClientBlackBerry::requestCheckingOfString): + (WebCore::EditorClientBlackBerry::checkTextOfParagraph): + * WebCoreSupport/EditorClientBlackBerry.h: + (EditorClientBlackBerry): + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::requestCheckingOfString): + (BlackBerry::WebKit::InputHandler::convertTransactionIdToSequenceId): + (WebKit): + (BlackBerry::WebKit::InputHandler::spellCheckingRequestProcessed): + (BlackBerry::WebKit::InputHandler::spellCheckingRequestCancelled): + (BlackBerry::WebKit::InputHandler::getSpellChecker): + * WebKitSupport/InputHandler.h: + (WebCore): + (InputHandler): + +2012-07-26 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Improve the logs in Selection Handler. + https://bugs.webkit.org/show_bug.cgi?id=92405 + + Reviewed by Rob Buis. + + Clean up selection logging, fix priority and style + of helper function. + + Reviewed Internally by Nima Ghanavatian. + + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::cancelSelection): + (BlackBerry::WebKit::SelectionHandler::shouldUpdateSelectionOrCaretForPoint): + (BlackBerry::WebKit::SelectionHandler::setCaretPosition): + (BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection): + (BlackBerry::WebKit::SelectionHandler::setSelection): + (BlackBerry::WebKit::SelectionHandler::selectObject): + (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged): + (BlackBerry::WebKit::SelectionHandler::caretPositionChanged): + +2012-07-26 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Add timing logs to SelectionHandler. + https://bugs.webkit.org/show_bug.cgi?id=92404 + + Reviewed by Rob Buis. + + Add selection timing logs. + + Reviewed Internally by Nima Ghanavatian. + + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::setSelection): + (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged): + * WebKitSupport/SelectionHandler.h: + (SelectionHandler): + +2012-07-26 Mike Fenton <mifenton@rim.com> + + [BlackBerry] InputHandler failure logs should be logAlways and critical. + https://bugs.webkit.org/show_bug.cgi?id=92403 + + Reviewed by Rob Buis. + + Update Log level for failures and fix mask in log. + + Reviewed Internally by Nima Ghanavatian. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::convertStringToWchar): + (BlackBerry::WebKit::convertStringToWcharVector): + (BlackBerry::WebKit::convertSpannableStringToString): + (BlackBerry::WebKit::InputHandler::spannableTextInRange): + (BlackBerry::WebKit::InputHandler::setTextAttributes): + +2012-07-26 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Refactor BackingStorePrivate::BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion() to avoid touching tile frontbuffer + https://bugs.webkit.org/show_bug.cgi?id=92095 + + Reviewed by George Staikos. + + PR: 141439 + Specifically, we want to avoid changing the rendered region of the + front buffer without proper synchronization. + + The method is trying to force checkerboard to appear on screen because + an area was invalidated but the render job was dropped, so the tile + contents are now invalid. + + Unfortunately it did this in a way which is not thread safe. Fixed by + making it thread safe, in a way that minimizes memory bandwidth usage. + + Instead of using the customary sequence of copy-back, modify and swap, + we send a synchronous message to the compositing thread to avoid the + copy-back step and save memory bandwidth. The trade-off is that the + WebKit thread might wait a little longer for the compositing thread + than it would from a waitForCurrentMessage() call. + + The way we synchronize this is rather expensive for the WebKit thread, + and this method is called rather carelessly, so add various early + returns to avoid doing it redundantly. + + Internally reviewed by Jakob Petsovits and Adam Treat. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::indexOfTile): + (BlackBerry::WebKit::BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion): + * Api/BackingStore_p.h: + (BackingStorePrivate): + +2012-07-26 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Refactor BackingStorePrivate::render() to avoid touching tile frontbuffer + https://bugs.webkit.org/show_bug.cgi?id=91989 + + Reviewed by George Staikos. + + PR: 141439 + Specifically, we want to avoid changing the rendered region of the + front buffer. The code only touched the front buffer rendered region + if the tile was not committed. + + Instead of immediately marking the tile as committed, and clearing the + front buffer's rendered region to make it appear as checkerboard, we + leave the front buffer alone and only mark the tile as committed once + the front buffer has valid content. Un-committed tiles will also be + rendered as checkerboard, so leaving it uncommitted is equivalent to + clearing the front buffer rendered region here. + + In addition to the main change, some related changes follow naturally. + + The copyPreviousContentsToBackSurfaceOfTile() call only makes sense if + the tile is committed, and the front buffer has valid content. + Otherwise, clearing the back buffer is equivalent. The code has been + updated to this effect. + + Since copyPreviousContentsToBackSurfaceOfTile() always sets the + rendered region to the union of the front and back buffer regions, + there is no point in the "backBufferIsValid" check. It has been turned + into an ASSERT instead, just to make sure. + + Internally reviewed by Jakob Petsovits. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + +2012-07-25 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Support RTSP in browser + https://bugs.webkit.org/show_bug.cgi?id=92233 + + Reviewed by Rob Buis. + + Handle URL scheme "rtsp://" before creating the DocumentLoader + and send the request to webkit. As we don't have any application + which can deal with rtsp invocation for now, we need to create + a media document to wrap the rtsp url within a video tag which + makes it load as a normal video clip. + + RIM PR: 169669 + Internally reviewed by Charles Wei <charles.wei@torchmobile.com.cn>. + + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::createDocumentLoader): + +2012-07-25 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Rephrase suspend/resume condition to guard against crashes + https://bugs.webkit.org/show_bug.cgi?id=92300 + PR 182125 + + Reviewed by George Staikos. + + When the compositor is removed from a WebPage, it might + already have unset its context, and issuing a call to + BackingStore::buffer() would therefore cause a crash. + Just guarding buffer() from this crash isn't fully + correct, because then we wouldn't suspend rendering + for a compositor that had been previously enabled. + + Instead, change the condition to suspend/resume in + WebPagePrivate::setCompositor() to focus on the + object that delivers us the buffer. If we can't + listen to the context or buffer being set, better + just take the compositor object itself to determine + whether we have something valid or not... and hope + that they give us a valid context & buffer in all + situations when we can actually be rendering. + + Also check compositor->context() in buffer() to be + non-zero before accessing the context's buffer, + because more defensive coding can't hurt here. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::buffer): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setCompositor): + +2012-07-25 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:config lists + https://bugs.webkit.org/show_bug.cgi?id=92118 + + Reviewed by Rob Buis. + + Remove features from list that have either been removed from WebKit + or that have been moved from one list to another. + + * WebCoreSupport/AboutDataEnableFeatures.in: + * WebCoreSupport/AboutDataHaveFeatures.in: + * WebCoreSupport/AboutDataUseFeatures.in: + +2012-07-25 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] clock_gettime() in BackingStore.cpp should use CLOCK_MONOTONIC + https://bugs.webkit.org/show_bug.cgi?id=91898 + + Reviewed by Yong Li. + + Let pthread condition variable in BackingStore.cpp use monotonic clock + to fix a regression caused by r123266. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate): + +2012-07-25 Andy Chen <andchen@rim.com> + + [BlackBerry] Add "SelectAll" to WebPage + https://bugs.webkit.org/show_bug.cgi?id=92246 + + Reviewed by Antonio Gomes. + + Add "Select All" editor command to WebPage. + Internally reviewed by Mike Fenton. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::selectAll): + (WebKit): + * Api/WebPage.h: + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::selectAll): + (WebKit): + * WebKitSupport/InputHandler.h: + +2012-07-25 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Don't touch a tile buffer while it's still on its way to the GPU + https://bugs.webkit.org/show_bug.cgi?id=91992 + + Reviewed by Adam Treat. + + PR: 141439 + The copyPreviousContentsToBackSurfaceOfTile() call will also modify + buffer contents, move it after the blit generation condvar to make sure + we've waited for the buffer to become available first. + + This is done as part of some general BackingStorePrivate::render() + cleanup in PR 141439. + + Internally reviewed by Jakob Petsovits. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + +2012-07-25 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] notifyContentRendered() call missing in two spots + https://bugs.webkit.org/show_bug.cgi?id=92153 + RIM PR 173340 + + Reviewed by Antonio Gomes. + + In dispatchDidFirstVisualLayout() and repaint() in + immediate mode, we render but don't notify the + WebPageClient that the content was modified. + + In the long run, we should probably keep track of + the modified reason from within render() itself + and use this to automatically notify the client + from within blitContents() and/or invalidateWindow(), + depending on the rendering path. That's somewhat of + a medium-size undertaking though; for now, adding + the call directly to the renderVisibleContents() + call sites will do. + + This patch also adds a blitVisibleContents() to + dispatchDidFirstVisualLayout() where it was + inexplicably missing, probably on account of + old code that was never updated. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::repaint): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::resumeBackingStore): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout): + +2012-07-24 Rob Buis <rbuis@rim.com> + + [BlackBerry] Do not call settings setters twice on page construction + https://bugs.webkit.org/show_bug.cgi?id=92157 + + Reviewed by Yong Li. + + The WebPagePrivate init method sets some settings value that were + already set in didChangeSettings. setUseHixie76WebSocketProtocol just + sets the default value, no need to set it again. + Also call didChangeSettings explicitly from init, before that we are + not calling it since the delegate is not set yet. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + +2012-07-24 Mike Fenton <mifenton@rim.com> + + Throttle calls to request the virtual keyboard be shown. + https://bugs.webkit.org/show_bug.cgi?id=92138 + + Reviewed by Rob Buis. + + PR 178465. + + Do not request keyboard visibility change when + we are actively processing an input event. + + Reviewed Internally by Gen Mak. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::focusedNodeChanged): + +2012-07-24 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:config lists + https://bugs.webkit.org/show_bug.cgi?id=92118 + + Reviewed by Rob Buis. + + We want to have all flags which could be used / have been used by any platform. These lists were created by running: + + * WebCoreSupport/AboutDataEnableFeatures.in: `git grep "ENABLE(" | cut -d "(" -f2 | cut -d ")" -f1 | sort -u` + * WebCoreSupport/AboutDataHaveFeatures.in: `git grep "HAVE(" | cut -d "(" -f2 | cut -d ")" -f1 | sort -u` + * WebCoreSupport/AboutDataUseFeatures.in: `git grep "USE(" | cut -d "(" -f2 | cut -d ")" -f1 | sort -u` + +2012-07-24 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Remove unused variable in BackingStore.cpp + https://bugs.webkit.org/show_bug.cgi?id=91987 + + Reviewed by Antonio Gomes. + + PR: 141439 + This is done as part of some general BackingStorePrivate::render() + cleanup in PR 141439. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + 2012-07-23 Yong Li <yoli@rim.com> [BlackBerry] Move about: URL handling out of WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 012bf0600..1c1fa37ff 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -1,49 +1,81 @@ +3D_CANVAS 3D_RENDERING ACCELERATED_2D_CANVAS -ANIMATION_API +ALL_VARIABLES_CAPTURED ASSEMBLER ASSEMBLER_WX_EXCLUSIVE BATTERY_STATUS +BLACKBERRY_CREDENTIAL_PERSIST +BLACKBERRY_DEBUG_MEMORY BLOB BRANCH_COMPACTION +CALENDAR_PICKER CHANNEL_MESSAGING CLASSIC_INTERPRETER CLIENT_BASED_GEOLOCATION +CODEBLOCK_SAMPLING COMPARE_AND_SWAP +COMPUTED_GOTO COMPUTED_GOTO_CLASSIC_INTERPRETER +COMPUTED_GOTO_INTERPRETER +CONSISTENCY_CHECK +CONTEXT_MENUS CSS_FILTERS CSS_GRID_LAYOUT CSS_IMAGE_SET +CSS_LAYOUT_GRID +CSS_REGIONS CSS_SHADERS -DASHBOARD_SUPPORT +CTI CUSTOM_SCHEME_HANDLER +DASHBOARD_SUPPORT +DATABASE +DATAGRID DATALIST DATA_TRANSFER_ITEMS -DASHBOARD_SUPPORT +DEBUG_MATH_LAYOUT +DEBUG_PROPAGATION_VERBOSE +DEBUG_VERBOSE DEBUG_WITH_BREAKPOINT +DEPRECATED_FEATURE DETAILS DEVICE_ORIENTATION +DFG_FEATURE DFG_JIT DIRECTORY_UPLOAD +DOM_STORAGE DOWNLOAD_ATTRIBUTE DRAG_SUPPORT +DFG_JIT +ENCRYPTED_MEDIA +ESOTERIC_FEATURE +EVENT_MODE_METATAGS +EVENTSOURCE EXECUTABLE_ALLOCATOR_DEMAND EXECUTABLE_ALLOCATOR_FIXED +EXPERIMENTAL_FEATURE +FAST_MALLOC_MATCH_VALIDATION FAST_MOBILE_SCROLLING FILE_SYSTEM FILTERS FIXED_REPORTED_SIZE +FLEXBOX +FOO FTPDIR FULLSCREEN_API GAMEPAD +GC_LOGGING GC_VALIDATION GEOLOCATION GESTURE_EVENTS +GESTURE_RECOGNIZER +GGC GLIB_SUPPORT GLOBAL_FASTMALLOC_NEW HIGH_DPI_CANVAS ICONDATABASE IFRAME_SEAMLESS +IGNORE_FIXED_STYLES IMAGE_DECODER_DOWN_SAMPLING INDEXED_DATABASE INPUT_SPEECH @@ -55,18 +87,31 @@ INPUT_TYPE_MONTH INPUT_TYPE_TIME INPUT_TYPE_WEEK INSPECTOR -JAVASCRIPT_DEBUGGER -JAVASCRIPT_I18N_API +INSPECTOR_SERVER +INTERPRETER JAVA_BRIDGE JAVASCRIPT_DEBUGGER +JAVASCRIPT_I18N_API JIT +JIT_ASSERT +JIT_BREAK_ON_EVERY_BLOCK +JIT_BREAK_ON_EVERY_FUNCTION +JIT_BREAK_ON_EVERY_NODE +JIT_BREAK_ON_SPECULATION_FAILURE +JIT_CONSTANT_BLINDING +JIT_OPTIMIZE_PROPERTY_ACCESS JIT_VERBOSE JIT_VERBOSE_OSR +JSC_MULTIPLE_THREADS +LARGE_HEAP +LAZY_BLOCK_FREEING +LEGACY_CSS_VENDOR_PREFIXES LEGACY_NOTIFICATIONS -LEGACY_WEBKIT_BLOB_BUILDER LINK_PREFETCH LLINT +MAC_JAVA_BRIDGE MATHML +MEDIA_CAPTURE MEDIA_SOURCE MEDIA_STATISTICS MEDIA_STREAM @@ -76,22 +121,31 @@ METER_ELEMENT MHTML MICRODATA MUTATION_OBSERVERS -NETSCAPE_PLUGIN_API +MYSTERIOUS_FEATURE NETSCAPE_PLUGIN_METADATA_CACHE NETWORK_INFO +NEW_XML +Notification NOTIFICATIONS +OFFLINE_WEB_APPLICATIONS +ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL OPCODE_SAMPLING -OPENTYPE_SANITIZER +OPCODE_STATS ORIENTATION_EVENTS +OSR_ENTRY OVERFLOW_SCROLLING +PAGE_CACHE +PAGE_POPUP PAGE_VISIBILITY_API PAN_SCROLLING -PARSED_STYLE_SHEET_CACHING -PAGE_POPUP PARALLEL_GC +PARALLEL_JOBS +PARSED_STYLE_SHEET_CACHING +PASSWORD_ECHO +PERFECT_HASH_SIZE +PERFORMANCE_TIMELINE PLUGIN_PACKAGE_SIMPLE_HASH PLUGIN_PROCESS -PLUGIN_PROXY_FOR_VIDEO POINTER_LOCK PROGRESS_ELEMENT PURGEABLE_MEMORY @@ -101,47 +155,78 @@ REGISTER_PROTOCOL_HANDLER REPAINT_THROTTLING REQUEST_ANIMATION_FRAME RUBBER_BANDING +RUBY +RUN_TIME_HEURISTICS SAMPLING_COUNTERS SAMPLING_FLAGS SAMPLING_REGIONS SAMPLING_THREAD +SANDBOX SCRIPTED_SPEECH SHADOW_DOM SHARED_WORKERS SIMPLE_HEAP_PROFILING +SINGLE_THREADED +SKIA_GPU SMOOTH_SCROLLING +SPEECH_INPUT SPELLCHECK -SUBPIXEL_LAYOUT SQL_DATABASE STYLE_SCOPED +SUBPIXEL_LAYOUT +SUCCESS_STATS SVG +SVG_ANIMATION +SVG_AS_IMAGE SVG_DOM_OBJC_BINDINGS +SVG_EXPERIMENTAL_FEATURES SVG_FONTS +SVG_FOREIGN_OBJECT TEXT_CARET TEXT_NOTIFICATIONS_ONLY THREADED_SCROLLING THREADING_GENERIC -THREADED_SCROLLING THREADING_LIBDISPATCH THREADING_OPENMP +TOUCH_ADJUSTMENT TOUCH_EVENTS TOUCH_ICON_LOADING +TRACK VALUE_PROFILER +VERBOSE_SPECULATION_FAILURE VERBOSE_VALUE_PROFILE +VERBOSE_VALUE_RECOVERIES VIBRATION VIDEO VIDEO_TRACK +VIDEO|XSLT +VIEWPORT VIEWPORT_REFLOW -WEBDOM -WEBGL -WEBKIT2 +WBXML +WCSS WEB_ARCHIVE WEB_AUDIO +WEBDOM +WEBGL WEB_INTENTS +WEB_INTENTS_TAG +WEBKIT2 +WEB_PROCESS_SANDBOX WEB_SOCKETS WEB_TIMING +WML WORKERS +WREC WRITE_BARRIER_PROFILING +WTF_MALLOC_VALIDATION +X86 +XBL +XHR_RESPONSE_BLOB +XHTMLMP +XOR_DEBUG_AID +XPATH +XP_UNIX XSLT +YARR YARR_JIT YARR_JIT_DEBUG diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in index d7e99518d..1ab9d264e 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in @@ -1,24 +1,45 @@ ACCESSIBILITY +AVCF +CA +CFNETWORK +CFNETWORK_DATA_ARRAY_CALLBACK +CG_INTERPOLATION_MEDIUM +CGINTERPOLATION_MEDIUM +CXX_NULLPTR DISPATCH_H +DTRACE +ENABLE_THREADING_LIBDISPATCH ERRNO_H +FLOAT_H +HEADER_DETECTION_H HOSTED_CORE_ANIMATION INVERTED_WHEEL_EVENTS ISDEBUGGERPRESENT +JNI LANGINFO_H LAYER_HOSTING_IN_WINDOW_SERVER MADV_DONTNEED MADV_FREE MADV_FREE_REUSE +MERGESORT MMAP NETWORK_CFDATA_ARRAY_CALLBACK +NULLPTR +PATH_BASED_BORDER_RADIUS_DRAWING +PCRE16 PTHREAD_H +PTHREAD_MACHDEP_H PTHREAD_NP_H PTHREAD_RWLOCK PTHREAD_SETNAME_NP +QRAWFONT +QT5 READLINE RUNLOOP_TIMER SBRK SIGNAL_H +STDINT_H +STRING_H STRINGS_H STRNSTR SYS_PARAM_H @@ -27,5 +48,9 @@ SYS_TIME_H TIMEGM TM_GMTOFF TM_ZONE +UNIX_DOMAIN_SOCKETS +VARIADIC_MACRO VASPRINTF VIRTUALALLOC +WINCE +WKQCA diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in index 80ddd27d7..66f957519 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in @@ -1,68 +1,105 @@ +3D_GRAPHICS +ACCELERATE ACCELERATED_COMPOSITING -ARENA_ALLOC_ALIGNMENT_INTEGER +ACCELERATED_COMPOSITING_PLUGIN_LAYER +ACCESSIBILITY_CONTEXT_MENUS +ALTERNATE_JSIMMEDIATE ATSUI AUTOCORRECTION_PANEL AUTOMATIC_TEXT_REPLACEMENT AVFOUNDATION +BACKTRACE_SYMBOLS +BUILDING_ON_SNOW_LEOPARD +BUILTIN_UTF8_CODEC CA CAIRO CF CFNETWORK +CF_NETWORK CFURLCACHE CFURLSTORAGESESSIONS CG CG_INTERPOLATION_MEDIUM -CHROME_NETWORK_STACK CHROMIUM_NET -CONCATENATED_IMPULSE_RESPONSES -CONSOLE_ENTRY_POINT +CLUTTER COREAUDIO COREMEDIA CORE_TEXT CROSS_PLATFORM_CONTEXT_MENUS +CTI_REPATCH_PIC +CURL +DLADDR DYNAMIC_ANNOTATIONS -DYNAMIC_ANNOTATIONS_NOIMPL -EGL EXPORT_MACROS -EXTERNAL_CRASH +FLOAT_LAYOUT_OFFSETS FREETYPE GCC_COMPUTED_GOTO_WORKAROUND +GLES2_RENDERING GLIB_UNICODE +GLX GOOGLEURL GRAMMAR_CHECKING +GRAPHICS_SURFACE GSTREAMER +GTK ICCJPEG ICU_UNICODE +IOSURFACE IOSURFACE_CANVAS_BACKING_STORE +JAVASCRIPTCORE_BINDINGS JSC JSVALUE32_64 JSVALUE64 LAZY_NATIVE_CURSOR +LEGACY_VIEWPORT_ADAPTION LEVELDB LIBXML2 LOCKFREE_THREADSAFEREFCOUNTED +LOCKFREE_THREADSAFESHARED +LOW_BANDWIDTH_DISPLAY MARKER_REMOVAL_UPON_EDITING MERSENNE_TWISTER_19937 +NATIVE_FULLSCREEN_VIDEO +NetworkingContext NEW_THEME +OPENGL +OPENGL_ES_2 OPENTYPE_SANITIZER +OPENVG +OPENVG_BLUR +OS OS_RANDOMNESS PANGO PLATFORM_STRATEGIES PLUGIN_HOST_PROCESS +POSIX_REGEX PROTECTION_SPACE_AUTH_CALLBACK -PTHREADS +PTHREAD_BASED_QT PTHREAD_GETSPECIFIC_DIRECT +PTHREADS +QT4_UNICODE +QTKIT +QT_MOBILE_THEME +QT_MOBILITY_SYSTEMINFO +QT_MULTIMEDIA QUERY_PERFORMANCE_COUNTER +QXMLQUERY +QXMLSTREAM REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR REQUEST_ANIMATION_FRAME_TIMER +RTL_SCROLLBAR SAFARI_THEME SCROLLBAR_PAINTER SKIA +SKIA_ON_MAC_CHROME SKIA_ON_MAC_CHROMIUM SKIA_TEXT +SOUP SYSTEM_MALLOC TEXTURE_MAPPER +TEXTURE_MAPPER_CAIRO TEXTURE_MAPPER_GL +THREADED_COMPOSITING TILED_BACKING_STORE UI_SIDE_COMPOSITING UNIFIED_TEXT_CHECKING @@ -76,7 +113,8 @@ WEBKIT_IMAGE_DECODERS WEBP WINCE_UNICODE WININET -WTFURL WK_SCROLLBAR_PAINTER +WTFURL +WX WXGC ZLIB diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index e9741a25b..2b7c8f992 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -375,19 +375,19 @@ void ChromeClientBlackBerry::setResizable(bool) bool ChromeClientBlackBerry::canRunBeforeUnloadConfirmPanel() { - notImplemented(); - return false; + return true; } -bool ChromeClientBlackBerry::runBeforeUnloadConfirmPanel(const String& message, Frame*) +bool ChromeClientBlackBerry::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) { #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD if (m_webPagePrivate->m_dumpRenderTree) return m_webPagePrivate->m_dumpRenderTree->runBeforeUnloadConfirmPanel(message); #endif - notImplemented(); - return false; + TimerBase::fireTimersInNestedEventLoop(); + CString latinOrigin = frameOrigin(frame); + return m_webPagePrivate->m_client->runBeforeUnloadConfirmPanel(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length()); } void ChromeClientBlackBerry::closeWindowSoon() diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp index dcec2deb4..95d02f7d5 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp @@ -556,7 +556,7 @@ void EditorClientBlackBerry::learnWord(const WTF::String&) void EditorClientBlackBerry::checkSpellingOfString(const UChar* text, int textLength, int* misspellLocation, int* misspellLength) { - m_webPagePrivate->m_client->checkSpellingOfString(text, textLength, *misspellLocation, *misspellLength); + notImplemented(); } WTF::String EditorClientBlackBerry::getAutoCorrectSuggestionForMisspelledWord(const WTF::String& misspelledWord) @@ -570,7 +570,12 @@ void EditorClientBlackBerry::checkGrammarOfString(const UChar*, int, WTF::Vector notImplemented(); } -void EditorClientBlackBerry::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) +void EditorClientBlackBerry::requestCheckingOfString(PassRefPtr<TextCheckingRequest> testCheckingRequest) +{ + m_webPagePrivate->m_inputHandler->requestCheckingOfString(textCheckingRequest); +} + +void EditorClientBlackBerry::checkTextOfParagraph(const UChar*, int, TextCheckingTypeMask, Vector<TextCheckingResult>&) { notImplemented(); } diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h index 25a8728f5..abc56d1fc 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h @@ -87,6 +87,7 @@ public: virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail, 0u>&, int*, int*); virtual void getGuessesForWord(const String&, const String&, Vector<String>&); virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); + virtual void checkTextOfParagraph(const UChar*, int, TextCheckingTypeMask, Vector<TextCheckingResult>&); virtual TextCheckerClient* textChecker(); virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&); diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index 4902f60f7..cf22ab6ad 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -66,6 +66,7 @@ #include "WebPageClient.h" #include <BlackBerryPlatformLog.h> +#include <BlackBerryPlatformMediaDocument.h> #include <BlackBerryPlatformScreen.h> #include <JavaScriptCore/APICast.h> #include <network/FilterStream.h> @@ -388,10 +389,15 @@ PassRefPtr<DocumentLoader> FrameLoaderClientBlackBerry::createDocumentLoader(con } SubstituteData substituteDataLocal = substituteData; - if (isMainFrame() && request.url().protocolIs("about")) { - // The first 6 letters is "about:" - String aboutWhat = request.url().string().substring(6); - String source = aboutData(aboutWhat); + if (isMainFrame()) { + String source; + if (request.url().protocolIs("about")) { + // The first 6 letters is "about:" + String aboutWhat = request.url().string().substring(6); + source = aboutData(aboutWhat); + } else if (request.url().protocolIs("rtsp")) + source = BlackBerry::Platform::mediaDocument(request.url().string().utf8().data()).c_str(); + if (!source.isEmpty()) { // Always ignore existing substitute data if any. WTF::RefPtr<SharedBuffer> buffer = SharedBuffer::create(source.is8Bit() ? reinterpret_cast<const char*>(source.characters8()) : source.latin1().data(), source.length()); @@ -849,9 +855,14 @@ void FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout() m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true); if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) { + BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d; m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first. - m_webPagePrivate->m_backingStore->d->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. - m_webPagePrivate->m_backingStore->d->renderVisibleContents(); + backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. + if (backingStorePrivate->renderVisibleContents()) { + if (!backingStorePrivate->shouldDirectRenderingToWindow()) + backingStorePrivate->blitVisibleContents(); + m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect()); + } } m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout(); diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index d9cb22d79..3955752a8 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -53,6 +53,8 @@ #include "ScopePointer.h" #include "SelectPopupClient.h" #include "SelectionHandler.h" +#include "SpellChecker.h" +#include "TextCheckerClient.h" #include "TextIterator.h" #include "WebPageClient.h" #include "WebPage_p.h" @@ -360,7 +362,8 @@ void InputHandler::focusedNodeChanged() Node* node = frame->document()->focusedNode(); if (isActiveTextEdit() && m_currentFocusElement == node) { - notifyClientOfKeyboardVisibilityChange(true); + if (!processingChange()) + notifyClientOfKeyboardVisibilityChange(true); return; } @@ -432,7 +435,7 @@ static bool convertStringToWchar(const String& string, wchar_t* dest, int destCa // wchar_t strings sent to IMF are 32 bit so casting to UChar32 is safe. u_strToUTF32(reinterpret_cast<UChar32*>(dest), destCapacity, destLength, string.characters(), string.length(), &ec); if (ec) { - InputLog(LogLevelInfo, "InputHandler::convertStringToWchar Error converting string ec (%d).", ec); + logAlways(LogLevelCritical, "InputHandler::convertStringToWchar Error converting string ec (%d).", ec); destLength = 0; return false; } @@ -448,7 +451,7 @@ static bool convertStringToWcharVector(const String& string, WTF::Vector<wchar_t return true; if (!wcharString.tryReserveCapacity(length + 1)) { - logAlways(LogLevelWarn, "InputHandler::convertStringToWcharVector Cannot allocate memory for string.\n"); + logAlways(LogLevelCritical, "InputHandler::convertStringToWcharVector Cannot allocate memory for string.\n"); return false; } @@ -468,7 +471,7 @@ static String convertSpannableStringToString(spannable_string_t* src) WTF::Vector<UChar> dest; int destCapacity = (src->length * 2) + 1; if (!dest.tryReserveCapacity(destCapacity)) { - logAlways(LogLevelWarn, "InputHandler::convertSpannableStringToString Cannot allocate memory for string.\n"); + logAlways(LogLevelCritical, "InputHandler::convertSpannableStringToString Cannot allocate memory for string.\n"); return String(); } @@ -477,7 +480,7 @@ static String convertSpannableStringToString(spannable_string_t* src) // wchar_t strings sent from IMF are 32 bit so casting to UChar32 is safe. u_strFromUTF32(dest.data(), destCapacity, &destLength, reinterpret_cast<UChar32*>(src->str), src->length, &ec); if (ec) { - InputLog(LogLevelInfo, "InputHandler::convertSpannableStringToString Error converting string ec (%d).", ec); + logAlways(LogLevelCritical, "InputHandler::convertSpannableStringToString Error converting string ec (%d).", ec); return String(); } dest.resize(destLength); @@ -517,12 +520,127 @@ void InputHandler::learnText() sendLearnTextDetails(textInField); } +void InputHandler::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> textCheckingRequest) +{ + RefPtr<WebCore::TextCheckingRequest> request = textCheckingRequest; + + int32_t sequenceId = request->sequence(); + int requestLength = request->text().length(); + if (!requestLength /* || requestLength > maxSpellCheckStringLength */) { + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + + wchar_t* checkingString = (wchar_t*)malloc(sizeof(wchar_t) * (requestLength + 1)); + if (!checkingString) { + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, "InputHandler::requestCheckingOfString Cannot allocate memory for string."); + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } -void InputHandler::spellCheckingRequestProcessed(int32_t id, spannable_string_t* spannableString) + int stringLength = 0; + if (!convertStringToWchar(request->text(), checkingString, requestLength + 1, &stringLength)) { + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, "InputHandler::requestCheckingOfString Failed to convert String to wchar type."); + free(checkingString); + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + + int32_t transactionId = m_webPage->m_client->checkSpellingOfStringAsync(checkingString, stringLength); + free(checkingString); + + // If the call to the input service did not go through, then cancel the request so we don't block endlessly. + // This should still take transactionId as a parameter to maintain the same behavior as if InputMethodSupport + // were to cancel a request during processing. + if (transactionId == -1) { // Error before sending request to input service. + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + + // map sequenceId to transactionId. + m_sequenceMap[transactionId] = sequenceId; +} + +int32_t InputHandler::convertTransactionIdToSequenceId(int32_t transactionId) { - UNUSED_PARAM(id); - UNUSED_PARAM(spannableString); - // TODO implement. + std::map<int32_t, int32_t>::iterator it = m_sequenceMap.find(transactionId); + + if (it == m_sequenceMap.end()) + return 0; + + int32_t sequenceId = it->second; + // We only convert this value when we have received its response, so its safe to remove it from the map. + m_sequenceMap.erase(it); + + return sequenceId; +} + +void InputHandler::spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t* spannableString) +{ + if (!spannableString) { + spellCheckingRequestCancelled(transactionId, false /* isSequenceId */); + return; + } + + Vector<TextCheckingResult> results; + + // Convert the spannableString to TextCheckingResult then append to results vector. + String replacement; + TextCheckingResult textCheckingResult; + textCheckingResult.type = TextCheckingTypeSpelling; + textCheckingResult.replacement = replacement; + textCheckingResult.location = 0; + textCheckingResult.length = 0; + + span_t* span = spannableString->spans; + for (unsigned int i = 0; i < spannableString->spans_count; i++) { + if (!span) + break; + if (span->end < span->start) { + spellCheckingRequestCancelled(transactionId, false /* isSequenceId */); + return; + } + if (span->attributes_mask & MISSPELLED_WORD_ATTRIB) { + textCheckingResult.location = span->start; + // The end point includes the character that it is before. Ie, 0, 0 + // applies to the first character as the end point includes the character + // at the position. This means the endPosition is always +1. + textCheckingResult.length = span->end - span->start + 1; + results.append(textCheckingResult); + } + span++; + } + + // transactionId here is for use with the input service. We need to translate this to sequenceId used with SpellChecker. + int32_t sequenceId = convertTransactionIdToSequenceId(transactionId); + + SpellChecker* sp = getSpellChecker(); + if (!sp || !sequenceId) { + InputLog(LogLevelWarn, "InputHandler::spellCheckingRequestProcessed failed to process the request with sequenceId %d", sequenceId); + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + sp->didCheckSucceeded(sequenceId, results); +} + +void InputHandler::spellCheckingRequestCancelled(int32_t id, bool isSequenceId) +{ + int32_t sequenceId = isSequenceId ? id : convertTransactionIdToSequenceId(id); + SpellChecker* sp = getSpellChecker(); + if (!sp) { + InputLog(LogLevelWarn, "InputHandler::spellCheckingRequestCancelled failed to cancel the request with sequenceId %d", sequenceId); + return; + } + sp->didCheckCanceled(sequenceId); +} + +SpellChecker* InputHandler::getSpellChecker() +{ + if (Frame* frame = m_currentFocusElement->document()->frame()) + if (Editor* editor = frame->editor()) + return editor->spellChecker(); + + return 0; } void InputHandler::setElementUnfocused(bool refocusOccuring) @@ -1167,6 +1285,11 @@ void InputHandler::paste() executeTextEditCommand("Paste"); } +void InputHandler::selectAll() +{ + executeTextEditCommand("SelectAll"); +} + void InputHandler::addAttributedTextMarker(int start, int end, const AttributeTextStyle& style) { if ((end - start) < 1 || end > static_cast<int>(elementText().length())) @@ -1463,21 +1586,20 @@ spannable_string_t* InputHandler::spannableTextInRange(int start, int end, int32 WTF::String textString = elementText().substring(start, length); - spannable_string_t* pst = (spannable_string_t*)malloc(sizeof(spannable_string_t)); - if (!pst) { - InputLog(LogLevelInfo, "InputHandler::spannableTextInRange error allocating spannable string."); - return 0; - } + spannable_string_t* pst = (spannable_string_t*)fastMalloc(sizeof(spannable_string_t)); + // Don't use fastMalloc in case the string is unreasonably long. fastMalloc will + // crash immediately on failure. pst->str = (wchar_t*)malloc(sizeof(wchar_t) * (length + 1)); if (!pst->str) { - InputLog(LogLevelInfo, "InputHandler::spannableTextInRange Cannot allocate memory for string.\n"); + logAlways(LogLevelCritical, "InputHandler::spannableTextInRange Cannot allocate memory for string.\n"); free(pst); return 0; } int stringLength = 0; if (!convertStringToWchar(textString, pst->str, length + 1, &stringLength)) { + logAlways(LogLevelCritical, "InputHandler::spannableTextInRange failed to convert string.\n"); free(pst->str); free(pst); return 0; @@ -1527,7 +1649,7 @@ extracted_text_t* InputHandler::extractedTextRequest(extracted_text_request_t* r if (!isActiveTextEdit()) return 0; - extracted_text_t* extractedText = (extracted_text_t *)malloc(sizeof(extracted_text_t)); + extracted_text_t* extractedText = (extracted_text_t *)fastMalloc(sizeof(extracted_text_t)); // 'flags' indicates whether the text is being monitored. This is not currently used. @@ -1784,7 +1906,7 @@ bool InputHandler::setTextAttributes(int insertionPoint, spannable_string_t* spa // used by IMF. When they add support for on the fly spell checking we can // use it to apply spelling markers and disable continuous spell checking. - InputLog(LogLevelInfo, "InputHandler::setTextAttributes adding marker %d to %d - %d", startPosition, endPosition, span->attributes_mask); + InputLog(LogLevelInfo, "InputHandler::setTextAttributes adding marker %d to %d - %llu", startPosition, endPosition, span->attributes_mask); addAttributedTextMarker(startPosition, endPosition, textStyleFromMask(span->attributes_mask)); span++; diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.h b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h index ec916f824..e492c607f 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.h +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h @@ -22,7 +22,7 @@ #include <BlackBerryPlatformInputEvents.h> #include <imf/input_data.h> - +#include <map> #include <wtf/RefPtr.h> namespace WTF { @@ -37,6 +37,8 @@ class HTMLInputElement; class HTMLSelectElement; class IntRect; class Node; +class SpellChecker; +class TextCheckingRequest; } namespace BlackBerry { @@ -74,6 +76,7 @@ public: void cut(); void copy(); void paste(); + void selectAll(); void cancelSelection(); @@ -121,7 +124,9 @@ public: int32_t setComposingText(spannable_string_t*, int32_t relativeCursorPosition); int32_t commitText(spannable_string_t*, int32_t relativeCursorPosition); - void spellCheckingRequestProcessed(int32_t id, spannable_string_t*); + void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); + void spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t*); + void spellCheckingRequestCancelled(int32_t id, bool isSequenceId = false); private: enum PendingKeyboardStateChange { NoChange, Visible, NotVisible }; @@ -178,6 +183,8 @@ private: void learnText(); void sendLearnTextDetails(const WTF::String&); + int32_t convertTransactionIdToSequenceId(int32_t transactionId); + WebCore::SpellChecker* getSpellChecker(); WebPagePrivate* m_webPage; @@ -195,6 +202,8 @@ private: PendingKeyboardStateChange m_pendingKeyboardVisibilityChange; bool m_delayKeyboardVisibilityChange; + + std::map<int32_t, int32_t> m_sequenceMap; }; } diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp index 51c9b72c3..7047204e7 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp @@ -45,16 +45,23 @@ // Note: This generates a lot of logs when dumping rects lists. It will seriously // impact performance. Do not enable this during performance tests. #define SHOWDEBUG_SELECTIONHANDLER 0 +#define SHOWDEBUG_SELECTIONHANDLER_TIMING 0 using namespace BlackBerry::Platform; using namespace WebCore; #if SHOWDEBUG_SELECTIONHANDLER -#define DEBUG_SELECTION(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__) +#define SelectionLog(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__) #else -#define DEBUG_SELECTION(severity, format, ...) +#define SelectionLog(severity, format, ...) #endif // SHOWDEBUG_SELECTIONHANDLER +#if SHOWDEBUG_SELECTIONHANDLER_TIMING +#define SelectionTimingLog(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__) +#else +#define SelectionTimingLog(severity, format, ...) +#endif // SHOWDEBUG_SELECTIONHANDLER_TIMING + namespace BlackBerry { namespace WebKit { @@ -75,7 +82,7 @@ void SelectionHandler::cancelSelection() m_selectionActive = false; m_lastSelectionRegion = IntRectRegion(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::cancelSelection"); + SelectionLog(LogLevelInfo, "SelectionHandler::cancelSelection"); if (m_webPage->m_inputHandler->isInputMode()) m_webPage->m_inputHandler->cancelSelection(); @@ -205,7 +212,7 @@ bool SelectionHandler::shouldUpdateSelectionOrCaretForPoint(const WebCore::IntPo bool aboveCaret = point.y() < caretRect.y(); bool belowCaret = point.y() >= caretRect.maxY(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::shouldUpdateSelectionOrCaretForPoint multiline = %s above = %s below = %s first line = %s last line = %s start = %s \n" + SelectionLog(LogLevelInfo, "SelectionHandler::shouldUpdateSelectionOrCaretForPoint multiline = %s above = %s below = %s first line = %s last line = %s start = %s" , m_webPage->m_inputHandler->isMultilineInputMode() ? "true" : "false", aboveCaret ? "true" : "false", belowCaret ? "true" : "false" , inSameLine(currentSelection.visibleStart(), startOfEditableContent(currentSelection.visibleStart())) ? "true" : "false" , inSameLine(currentSelection.visibleEnd(), endOfEditableContent(currentSelection.visibleEnd())) ? "true" : "false" @@ -228,7 +235,7 @@ void SelectionHandler::setCaretPosition(const WebCore::IntPoint &position) m_caretActive = true; - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setCaretPosition requested point %d, %d", position.x(), position.y()); + SelectionLog(LogLevelInfo, "SelectionHandler::setCaretPosition requested point %d, %d", position.x(), position.y()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); FrameSelection* controller = focusedFrame->selection(); @@ -258,7 +265,7 @@ void SelectionHandler::setCaretPosition(const WebCore::IntPoint &position) controller->setSelection(newSelection); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setCaretPosition point valid, cursor updated"); + SelectionLog(LogLevelInfo, "SelectionHandler::setCaretPosition point valid, cursor updated"); } // This function makes sure we are not reducing the selection to a caret selection. @@ -426,7 +433,7 @@ bool SelectionHandler::updateOrHandleInputSelection(VisibleSelection& newSelecti if (!character) return false; - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection making selection change attempt using key event %d", character); + SelectionLog(LogLevelInfo, "SelectionHandler::updateOrHandleInputSelection making selection change attempt using key event %d", character); if (shouldExtendSelectionInDirection(controller->selection(), character)) m_webPage->m_inputHandler->handleKeyboardInput(Platform::KeyboardEvent(character, Platform::KeyboardEvent::KeyDown, KEYMOD_SHIFT)); @@ -448,7 +455,11 @@ void SelectionHandler::setSelection(const WebCore::IntPoint& start, const WebCor Frame* focusedFrame = m_webPage->focusedOrMainFrame(); FrameSelection* controller = focusedFrame->selection(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y()); +#if SHOWDEBUG_SELECTIONHANDLER_TIMING + m_timer.start(); +#endif + + SelectionLog(LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y()); // Note that IntPoint(-1, -1) is being our sentinel so far for // clipped out selection starting or ending location. @@ -521,12 +532,12 @@ void SelectionHandler::setSelection(const WebCore::IntPoint& start, const WebCor controller->setSelection(newSelection); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated\n"); + SelectionLog(LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated."); } else { // Requested selection results in an empty selection, skip this change. selectionPositionChanged(); - DEBUG_SELECTION(LogLevelWarn, "SelectionHandler::setSelection selection points invalid, selection not updated\n"); + SelectionLog(LogLevelWarn, "SelectionHandler::setSelection selection points invalid, selection not updated."); } } @@ -606,7 +617,7 @@ void SelectionHandler::selectObject(const WebCore::IntPoint& location, TextGranu ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectObject adjusted points %d, %d", location.x(), location.y()); + SelectionLog(LogLevelInfo, "SelectionHandler::selectObject adjusted points %d, %d", location.x(), location.y()); WebCore::IntPoint relativePoint = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, location); VisiblePosition pointLocation(focusedFrame->visiblePositionForPoint(relativePoint)); @@ -625,7 +636,7 @@ void SelectionHandler::selectObject(TextGranularity granularity) ASSERT(m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectObject using current selection"); + SelectionLog(LogLevelInfo, "SelectionHandler::selectObject using current selection"); // Use the current selection as the selection point. ASSERT(focusedFrame->selection()->selectionType() != VisibleSelection::NoSelection); @@ -642,7 +653,7 @@ void SelectionHandler::selectObject(Node* node) ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectNode"); + SelectionLog(LogLevelInfo, "SelectionHandler::selectNode"); VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(node); focusedFrame->selection()->setSelection(selection); @@ -829,7 +840,7 @@ bool SelectionHandler::inputNodeOverridesTouch() const // system is not entirely WebKit. void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) { - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectionPositionChanged visibleChangeOnly = %s", visualChangeOnly ? "true" : "false"); + SelectionLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged visibleChangeOnly = %s", visualChangeOnly ? "true" : "false"); // This method can get called during WebPage shutdown process. // If that is the case, just bail out since the client is not @@ -858,6 +869,8 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) else if (!m_selectionActive) return; + SelectionTimingLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged starting at %f", m_timer.elapsed()); + WebCore::IntRect startCaret; WebCore::IntRect endCaret; @@ -889,11 +902,11 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) regionForTextQuads(quads, visibleSelectionRegion); -#if SHOWDEBUG_SELECTIONHANDLER // Don't rely just on DEBUG_SELECTION to avoid loop. +#if SHOWDEBUG_SELECTIONHANDLER // Don't rely just on SelectionLog to avoid loop. for (unsigned int i = 0; i < unclippedRegion.numRects(); i++) - DEBUG_SELECTION(LogLevelCritical, "Rect list - Unmodified #%d, (%d, %d) (%d x %d)", i, unclippedRegion.rects()[i].x(), unclippedRegion.rects()[i].y(), unclippedRegion.rects()[i].width(), unclippedRegion.rects()[i].height()); + SelectionLog(LogLevelInfo, "Rect list - Unmodified #%d, (%d, %d) (%d x %d)", i, unclippedRegion.rects()[i].x(), unclippedRegion.rects()[i].y(), unclippedRegion.rects()[i].width(), unclippedRegion.rects()[i].height()); for (unsigned int i = 0; i < visibleSelectionRegion.numRects(); i++) - DEBUG_SELECTION(LogLevelCritical, "Rect list - Clipped to Visible #%d, (%d, %d) (%d x %d)", i, visibleSelectionRegion.rects()[i].x(), visibleSelectionRegion.rects()[i].y(), visibleSelectionRegion.rects()[i].width(), visibleSelectionRegion.rects()[i].height()); + SelectionLog(LogLevelInfo, "Rect list - Clipped to Visible #%d, (%d, %d) (%d x %d)", i, visibleSelectionRegion.rects()[i].x(), visibleSelectionRegion.rects()[i].y(), visibleSelectionRegion.rects()[i].width(), visibleSelectionRegion.rects()[i].height()); #endif bool shouldCareAboutPossibleClippedOutSelection = frame != m_webPage->mainFrame() || m_webPage->m_inputHandler->isInputMode(); @@ -922,19 +935,20 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) } } - DEBUG_SELECTION(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)", + SelectionLog(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)", startCaret.x(), startCaret.y(), startCaret.width(), startCaret.height(), endCaret.x(), endCaret.y(), endCaret.width(), endCaret.height()); if (m_webPage->m_selectionOverlay) m_webPage->m_selectionOverlay->draw(visibleSelectionRegion); m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch()); + SelectionTimingLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged completed at %f", m_timer.elapsed()); } // NOTE: This function is not in WebKit coordinates. void SelectionHandler::caretPositionChanged() { - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::caretPositionChanged"); + SelectionLog(LogLevelInfo, "SelectionHandler::caretPositionChanged"); WebCore::IntRect caretLocation; // If the input field is empty, we always turn off the caret. @@ -965,7 +979,7 @@ void SelectionHandler::caretPositionChanged() m_caretActive = !caretLocation.isEmpty(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::caretPositionChanged caret Rect %d, %d, %dx%d", + SelectionLog(LogLevelInfo, "SelectionHandler::caretPositionChanged caret Rect %d, %d, %dx%d", caretLocation.x(), caretLocation.y(), caretLocation.width(), caretLocation.height()); caretLocation = m_webPage->mapToTransformed(caretLocation); @@ -984,7 +998,7 @@ void SelectionHandler::caretPositionChanged() m_webPage->clipToTransformedContentsRect(nodeBoundingBox); } - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::single line %s single line bounding box %d, %d, %dx%d", + SelectionLog(LogLevelInfo, "SelectionHandler::single line %s single line bounding box %d, %d, %dx%d", singleLineInput ? "true" : "false", nodeBoundingBox.x(), nodeBoundingBox.y(), nodeBoundingBox.width(), nodeBoundingBox.height()); m_webPage->m_client->notifyCaretChanged(caretLocation, m_webPage->m_touchEventHandler->lastFatFingersResult().isTextInput() /* userTouchTriggered */, singleLineInput, nodeBoundingBox); diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h index f72af445c..b0833c2c1 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h @@ -21,6 +21,7 @@ #include "BlackBerryPlatformIntRectRegion.h" #include "BlackBerryPlatformPrimitives.h" +#include "BlackBerryPlatformStopWatch.h" #include "TextGranularity.h" #include <wtf/Vector.h> @@ -89,6 +90,8 @@ private: bool m_caretActive; bool m_lastUpdatedEndPointIsValid; BlackBerry::Platform::IntRectRegion m_lastSelectionRegion; + + BlackBerry::Platform::StopWatch m_timer; }; } diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index ca446fe90..c9b02eb2e 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,561 @@ +2012-07-29 Lu Guanqun <guanqun.lu@intel.com> + + [chromium] pass acceleratePainting info to settings + https://bugs.webkit.org/show_bug.cgi?id=92467 + + Reviewed by Eric Seidel. + + The acceleratePainting info is not passed into settings correctly so + that GPU composition would not use the code path of accelerated painting. + + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::Settings::operator CCLayerTreeSettings): + +2012-07-29 Rik Cabanier <cabanier@adobe.com> + + Add ENABLE_CSS_COMPOSITING flag + https://bugs.webkit.org/show_bug.cgi?id=92553 + + Reviewed by Dirk Schulze. + + Adds compiler flag CSS_COMPOSITING to build systems to enable CSS blending and compositing. See spec https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html + + * features.gypi: + +2012-07-28 Peter Kasting <pkasting@google.com> + + Sigh. Just disable all the AutoResize tests after the first three. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + Unreviewed, making bots happier. + + * tests/WebViewTest.cpp: + +2012-07-28 Peter Kasting <pkasting@google.com> + + Try disabling different test in hopes of tracking down the real problem. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + Unreviewed, making bots happier. + + * tests/WebViewTest.cpp: + +2012-07-27 Peter Kasting <pkasting@google.com> + + Disable failing test. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + Unreviewed, making bots happier. + + * tests/WebViewTest.cpp: + +2012-07-27 Scott Graham <scottmg@chromium.org> + + Change navigator.webkitGamepads[] to navigator.webkitGetGamepads() + https://bugs.webkit.org/show_bug.cgi?id=92533 + + Reviewed by Adam Barth. + + Renames for updated access point. + + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableGamepad): + (WebKit::WebRuntimeFeatures::isGamepadEnabled): + +2012-07-27 Kevin Ellis <kevers@chromium.org> + + [chromium] Calendar for input type=date should be larger on devices that support touch input. + https://bugs.webkit.org/show_bug.cgi?id=92424 + + Reviewed by Kent Tamura. + + Plumbs the deviceSupportsTouch setting through to the popup page so + that the Calendar popup can be enlarged on screens that support touch + input. + + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::initPage): + +2012-07-27 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-27 Oli Lan <olilan@chromium.org> + + [chromium] Fix issues in visiblePositionForWindowPoint (offscreen points / iframes). + https://bugs.webkit.org/show_bug.cgi?id=79117 + + Fix two issues in WebFrameImpl::visiblePositionForWindowPoint. + + 1) If the point is off-screen, the visiblePosition is clipped to the screen. + - The fix is to add HitTestRequest::IgnoreClipping. + + 2) The result is incorrect if the point is within an iframe. + - This is because we are calling convertFromContainingWindow twice: once in windowToContents, + and then explicitly as well. + - This patch removes the explicit call to convertFromContainingWindow. + + Reviewed by Adam Barth. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::visiblePositionForWindowPoint): + +2012-07-27 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-27 Alec Flett <alecflett@chromium.org> + + IndexedDB: inject index keys on cursor/objectstore/index get success handlers + https://bugs.webkit.org/show_bug.cgi?id=91123 + + Reviewed by Tony Chang. + + Remove method no longer used. + + * tests/IDBFakeBackingStore.h: + +2012-07-26 Yoshifumi Inoue <yosin@chromium.org> + + [Forms] Introduce runtime feature flags for input type datetime, datetimelocal, month, time, week + https://bugs.webkit.org/show_bug.cgi?id=92339 + + Reviewed by Kent Tamura. + + To detect compilation errors and test failure earlier, I would like + build and run tests for input type datetime, datetime-local, month, + time and week with runtime feature flags to avoid behavior changes + on chromium browser. + + This patch adds query and change functions for runtime features of + input type datetime, datetime-local, month, time and week to WebRuntimeFeatures + class for exposing DRT and chromium browser expermental flags. + + * features.gypi: Turn on ENABLE_INPUT_TYPE_DATETIME, ENABLE_INPUT_TYPE_DATETIMELOCAL, + ENABLE_INPUT_TYPE_MONTH, ENABLE_INPUT_TYPE_TIME, and ENABLE_INPUT_TYPE_WEEK for all OS. + * public/WebRuntimeFeatures.h: + (WebRuntimeFeatures): + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableInputTypeDateTime): Added. + (WebKit::WebRuntimeFeatures::isInputTypeDateTimeEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeDateTimeLocal): Added. + (WebKit::WebRuntimeFeatures::isInputTypeDateTimeLocalEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeMonth): Added. + (WebKit::WebRuntimeFeatures::isInputTypeMonthEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeTime): Added. + (WebKit::WebRuntimeFeatures::isInputTypeTimeEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeWeek): Added. + (WebKit::WebRuntimeFeatures::isInputTypeWeekEnabled): Added. + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123799. + http://trac.webkit.org/changeset/123799 + https://bugs.webkit.org/show_bug.cgi?id=92431 + + broke the Apple Mac build (Requested by bweinstein on + #webkit). + + * src/WebInputEventConversion.cpp: + (WebKit): + * src/WebInputEventConversion.h: + (WebKit): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleEvent): + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + +2012-07-26 Sadrul Habib Chowdhury <sadrul@chromium.org> + + Propagate gesture events to plugins. + https://bugs.webkit.org/show_bug.cgi?id=92281 + + Reviewed by Adam Barth. + + Propagate gesture events to plugins. + + * src/WebInputEventConversion.cpp: + (WebKit): + (WebKit::WebGestureEventBuilder::WebGestureEventBuilder): + * src/WebInputEventConversion.h: + (WebCore): + (WebKit): + (WebGestureEventBuilder): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleEvent): + * src/WebPluginContainerImpl.h: + (WebCore): + (WebPluginContainerImpl): + +2012-07-26 Adrienne Walker <enne@google.com> + + [chromium] Remove redundant surface origin transforms + https://bugs.webkit.org/show_bug.cgi?id=91815 + + Reviewed by Stephen White. + + Clean up use of origin transforms in tests. Where possible, test + against the equivalent draw transform. + + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + +2012-07-25 David Grogan <dgrogan@chromium.org> + + IndexedDB: WebKit API interfaces for "upgradeneeded" methods and events + https://bugs.webkit.org/show_bug.cgi?id=92203 + + Reviewed by Adam Barth. + + This is the beginning of our typical three-sided-patch process. + + * public/WebIDBCallbacks.h: + (WebKit::WebIDBCallbacks::onBlocked): + (WebKit::WebIDBCallbacks::onUpgradeNeeded): + * public/WebIDBDatabaseCallbacks.h: + (WebKit::WebIDBDatabaseCallbacks::onVersionChange): + * public/WebIDBFactory.h: + (WebIDBFactory): + (WebKit::WebIDBFactory::open): + * src/WebIDBFactoryImpl.cpp: + (WebKit::WebIDBFactoryImpl::open): + (WebKit): + * src/WebIDBFactoryImpl.h: + (WebIDBFactoryImpl): + +2012-07-19 Adrienne Walker <enne@google.com> + + [chromium] Make all compositor screen space transforms operate on content rects + https://bugs.webkit.org/show_bug.cgi?id=91807 + + Reviewed by Kenneth Russell. + + Update tests that deal with screen space transforms to reflect this change. + + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-25 Andrew Wilson <atwilson@chromium.org> + + Unreviewed chromium change to disable failing WebViewTest.AutoResizeInBetweenSizes. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + * tests/WebViewTest.cpp: + +2012-07-25 Scott Graham <scottmg@chromium.org> + + [Chromium] fix double->float warnings in CCLayerTreeHostCommonTest.cpp + https://bugs.webkit.org/show_bug.cgi?id=92271 + + Reviewed by Adrienne Walker. + + Fix compile warnings on Windows. + + * tests/CCLayerTreeHostCommonTest.cpp: + +2012-07-25 Dana Jansens <danakj@chromium.org> + + [chromium] Move WebFilterOperations from RenderPassDrawQuad to RenderPass + https://bugs.webkit.org/show_bug.cgi?id=91885 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/LayerRendererChromiumTest.cpp: + (FakeCCRendererClient::FakeCCRendererClient): + (FakeCCRendererClient::rootRenderPass): + (FakeCCRendererClient::renderPassesInDrawOrder): + (FakeCCRendererClient::renderPasses): + (FakeCCRendererClient): + (TEST_F): + (TEST): + +2012-07-24 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Refactor CCLayerTreeHostCommon: move root layer special case initialization into internal code. + https://bugs.webkit.org/show_bug.cgi?id=88953 + + Reviewed by Adrienne Walker. + + Unit tests updated to account for the new less-special root layer setup. + - most test cases just needed to remove root->renderSurface()->setContentBounds(), createRenderSurface(), and renderSurfaceLayerList.append(). + - some test cases originally relied on setting some awkward unconventional bounds of the rootLayer that were different than the rootLayer's renderSurface. these tests are updated. + - a few minor cleanups otherwise. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::executeCalculateDrawTransformsAndVisibility): + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTest::calcDrawEtc): + +2012-07-25 Taiju Tsuiki <tzik@chromium.org> + + FileSystem should provide a way to delete filesystem. + https://bugs.webkit.org/show_bug.cgi?id=91861 + + Reviewed by Adam Barth. + + * public/WebFrameClient.h: + (WebFrameClient): + (WebKit::WebFrameClient::deleteFileSystem): + * src/LocalFileSystemChromium.cpp: Add deleteFileSystem + (WebCore::deleteFileSystemNotAllowed): + (WebCore): + (WebCore::LocalFileSystem::deleteFileSystem): + +2012-07-25 Alok Priyadarshi <alokp@chromium.org> + + [chromium] WebViewBenchmarkSupport::paint API does not work with recording canvas + https://bugs.webkit.org/show_bug.cgi?id=92008 + + Reviewed by Darin Fisher. + + Moved the ownership of canvas to WebViewBenchmarkSupport::PaintClient. + + * public/WebViewBenchmarkSupport.h: + (PaintClient): + (WebKit::WebViewBenchmarkSupport::PaintClient::willPaint): + (WebKit::WebViewBenchmarkSupport::PaintClient::didPaint): + * src/WebViewBenchmarkSupportImpl.cpp: + (WebKit::WebViewBenchmarkSupportImpl::paintLayer): + (WebKit::WebViewBenchmarkSupportImpl::softwarePaint): + +2012-07-24 Dana Jansens <danakj@chromium.org> + + [chromium] Turn the debug HUD into a layer so that it can be drawn as a WebCompositorQuad + https://bugs.webkit.org/show_bug.cgi?id=92182 + + Reviewed by Adrienne Walker. + + * tests/LayerRendererChromiumTest.cpp: + (TEST): + +2012-07-25 Adrienne Walker <enne@google.com> + + [chromium] Unify compositor quadTransform/drawTransform/originTransform + https://bugs.webkit.org/show_bug.cgi?id=91417 + + Reviewed by Kenneth Russell. + + Clean up tests to refer to the new draw transform semantics. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::createTestTreeWithOneSurface): + (WebKitTests::createTestTreeWithTwoSurfaces): + (WebKitTests::TEST_F): + * tests/CCLayerSorterTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::commitCompleteOnCCThread): + * tests/CCQuadCullerTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-25 Kevin Ellis <kevers@chromium.org> + + [chromium] Calendar picker popup displays at wrong scale when deviceScaleFactor != 1. + https://bugs.webkit.org/show_bug.cgi?id=92177 + + Manually tested at deviceScaleFactor = 1 and 2. + + Reviewed by Kent Tamura. + + The device scale factor was not being set for the calendar popup. + As a result, the popup was rendered too small on hidpi displays. + This patch sets the device scale factor for any page popup. + + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::initPage): + +2012-07-25 MORITA Hajime <morrita@google.com> + + Another unreviewed win build fix against r123569. + + * tests/IDBAbortOnCorruptTest.cpp: + +2012-07-25 MORITA Hajime <morrita@google.com> + + Unreviewed win build fix against r123569. + + * tests/IDBAbortOnCorruptTest.cpp: + * tests/IDBDatabaseBackendTest.cpp: + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-24 Dave Tu <dtu@chromium.org> + + [chromium] Move renderingStats from WebView to WebWidget. + https://bugs.webkit.org/show_bug.cgi?id=92184 + + Reviewed by Adam Barth. + + We are going to add some rendering stats that work in non-composited mode, so the renderingStats() method should be moved from WebView to WebWidget. + + * public/WebView.h: + (WebKit): + (WebView): + * public/WebWidget.h: + (WebKit): + (WebWidget): + (WebKit::WebWidget::renderingStats): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-24 Alec Flett <alecflett@chromium.org> + + IndexedDB: fix #include dependencies so IDBRequest isn't an include root + https://bugs.webkit.org/show_bug.cgi?id=92167 + + Reviewed by Tony Chang. + + Remove implicit dependencies due to using IDBRequest.h, and fix all + places that break as a result. + + * src/IDBCallbacksProxy.cpp: + * src/WebIDBDatabaseImpl.cpp: + * src/WebIDBTransactionImpl.cpp: + +2012-07-24 Adam Barth <abarth@webkit.org> + + [Chromium] Support scrolling and zooming to focused input elements + https://bugs.webkit.org/show_bug.cgi?id=91661 + + Reviewed by Darin Fisher. + + This patch introduces saveScrollAndScaleState and + restoreScrollAndScaleState, which can be used to save and restore the + scroll and scale state of the WebView, respectively. These functions + will be used by Chromium on Android to save the scale and scrolls state + before zoom into a text field so that we can "undo" the zoom if the + user didn't mean to zoom into the text field. + + I wanted to write unit tests for these functions, but it wasn't clear + to me how to write the test because startPageScaleAnimation appears to + complete asynchronously. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::saveScrollAndScaleState): + (WebKit): + (WebKit::WebViewImpl::restoreScrollAndScaleState): + (WebKit::WebViewImpl::resetSavedScrollAndScaleState): + (WebKit::WebViewImpl::didCommitLoad): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-24 Dave Tu <dtu@chromium.org> + + [chromium] Add time spent painting to GPU benchmarking renderingStats() API. + https://bugs.webkit.org/show_bug.cgi?id=90019 + + Reviewed by Adrienne Walker. + + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::renderingStats): + * tests/CCLayerTreeHostTest.cpp: + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::Texture::prepareRect): + (WebKitTests::FakeTiledLayerChromium::update): + * tests/CCTiledLayerTestCommon.h: + (Texture): + (FakeTiledLayerChromium): + * tests/Canvas2DLayerBridgeTest.cpp: + * tests/ContentLayerChromiumTest.cpp: + (WebKit::TEST): + * tests/TiledLayerChromiumTest.cpp: + +2012-07-24 Jian Li <jianli@chromium.org> + + Add per-context setting for html notifications + https://bugs.webkit.org/show_bug.cgi?id=91295 + + Reviewed by Adam Barth. + + Add new per-context feature for chromium port. + + * public/WebPermissionClient.h: + (WebPermissionClient): + (WebKit::WebPermissionClient::allowHTMLNotifications): + * src/ContextFeaturesClientImpl.cpp: + (WebKit::ContextFeaturesClientImpl::askIfIsEnabled): + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123499. + http://trac.webkit.org/changeset/123499 + https://bugs.webkit.org/show_bug.cgi?id=92161 + + Android fails to compile (Requested by zhenyao on #webkit). + + * src/AssertMatchingEnums.cpp: + +2012-07-24 Terry Anderson <tdanderson@chromium.org> + + [chromium] Add a bounding box member in WebGestureEvent + https://bugs.webkit.org/show_bug.cgi?id=92144 + + Reviewed by Adam Barth. + + The new |boundingBox| member will be used to store the touch region for a WebGestureEvent. + This will be useful for gesture target fuzzing across multiple different gesture types + (tap, long press, scroll, etc.) + + * public/WebInputEvent.h: + (WebGestureEvent): + * src/WebInputEvent.cpp: + (SameSizeAsWebGestureEvent): + +2012-07-24 Nico Weber <thakis@chromium.org> + + [chromium/mac] Add cursor resource pngs to the pak file. + https://bugs.webkit.org/show_bug.cgi?id=92148 + + Reviewed by Tony Chang. + + Once https://chromiumcodereview.appspot.com/10817031/ has landed, they can be + removed from WebCore.gyp's mac_bundle_resources. Part of http://crbug.com/137588 + + * WebKit.grd: + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123472. + http://trac.webkit.org/changeset/123472 + https://bugs.webkit.org/show_bug.cgi?id=92134 + + Revert roll to v8 version that crashes sporadically (Requested + by atwilson on #webkit). + + * DEPS: + +2012-07-24 Keishi Hattori <keishi@webkit.org> + + [Chromium] Page popup should close on mouse down + https://bugs.webkit.org/show_bug.cgi?id=92092 + + Reviewed by Kent Tamura. + + Page popup should close on mouse down because some elements(e.g. <input type=color>) don't have a blur event that + we can hook to hide the page popup when the user clicks on the page. + + * src/WebPagePopupImpl.h: + (WebKit::WebPagePopupImpl::hasSamePopupClient): Returns true if the given WebPagePopupImpl have the same popup client. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleMouseDown): Close all popups when the page is clicked. Checks if the + mouse down event opened the same popup we just closed. + 2012-07-24 Jochen Eisinger <jochen@chromium.org> Unreviewed. Rolled DEPS. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 2e48b10e1..2aabb4d59 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': '148093' + 'chromium_rev': '148739' } deps = { diff --git a/Source/WebKit/chromium/WebKit.grd b/Source/WebKit/chromium/WebKit.grd index 4da7600ae..c7c251c21 100644 --- a/Source/WebKit/chromium/WebKit.grd +++ b/Source/WebKit/chromium/WebKit.grd @@ -249,6 +249,36 @@ <include name="IDR_AUDIO_SPATIALIZATION_T345_P315" file="..\..\WebCore\platform\audio\resources\IRC_Composite_C_R0195_T345_P315.wav" type="BINDATA"/> <include name="IDR_AUDIO_SPATIALIZATION_T345_P330" file="..\..\WebCore\platform\audio\resources\IRC_Composite_C_R0195_T345_P330.wav" type="BINDATA"/> <include name="IDR_AUDIO_SPATIALIZATION_T345_P345" file="..\..\WebCore\platform\audio\resources\IRC_Composite_C_R0195_T345_P345.wav" type="BINDATA"/> + <if expr="is_macosx"> + <include name="IDR_ALIAS_CURSOR" file="../../WebCore/Resources/aliasCursor.png" type="BINDATA" /> + <include name="IDR_CELL_CURSOR" file="../../WebCore/Resources/cellCursor.png" type="BINDATA" /> + <include name="IDR_CONTEXTMENU_CURSOR" file="../../WebCore/Resources/contextMenuCursor.png" type="BINDATA" /> + <include name="IDR_COPY_CURSOR" file="../../WebCore/Resources/copyCursor.png" type="BINDATA" /> + <include name="IDR_EAST_RESIZE_CURSOR" file="../../WebCore/Resources/eastResizeCursor.png" type="BINDATA" /> + <include name="IDR_EASTWEST_RESIZE_CURSOR" file="../../WebCore/Resources/eastWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_HELP_CURSOR" file="../../WebCore/Resources/helpCursor.png" type="BINDATA" /> + <include name="IDR_LINK_CURSOR" file="../../WebCore/Resources/linkCursor.png" type="BINDATA" /> + <include name="IDR_MISSING_IMAGE_CURSOR" file="../../WebCore/Resources/missingImage.png" type="BINDATA" /> + <include name="IDR_MOVE_CURSOR" file="../../WebCore/Resources/moveCursor.png" type="BINDATA" /> + <include name="IDR_NODROP_CURSOR" file="../../WebCore/Resources/noDropCursor.png" type="BINDATA" /> + <include name="IDR_NONE_CURSOR" file="../../WebCore/Resources/noneCursor.png" type="BINDATA" /> + <include name="IDR_NORTHEAST_RESIZE_CURSOR" file="../../WebCore/Resources/northEastResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHEASTSOUTHWEST_RESIZE_CURSOR" file="../../WebCore/Resources/northEastSouthWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTH_RESIZE_CURSOR" file="../../WebCore/Resources/northResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHSOUTH_RESIZE_CURSOR" file="../../WebCore/Resources/northSouthResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHWEST_RESIZE_CURSOR" file="../../WebCore/Resources/northWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHWESTSOUTHEAST_RESIZE_CURSOR" file="../../WebCore/Resources/northWestSouthEastResizeCursor.png" type="BINDATA" /> + <include name="IDR_PROGRESS_CURSOR" file="../../WebCore/Resources/progressCursor.png" type="BINDATA" /> + <include name="IDR_SOUTHEAST_RESIZE_CURSOR" file="../../WebCore/Resources/southEastResizeCursor.png" type="BINDATA" /> + <include name="IDR_SOUTH_RESIZE_CURSOR" file="../../WebCore/Resources/southResizeCursor.png" type="BINDATA" /> + <include name="IDR_SOUTHWEST_RESIZE_CURSOR" file="../../WebCore/Resources/southWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_VERTICALTEXT_CURSOR" file="../../WebCore/Resources/verticalTextCursor.png" type="BINDATA" /> + <include name="IDR_WAIT_CURSOR" file="../../WebCore/Resources/waitCursor.png" type="BINDATA" /> + <include name="IDR_WEST_RESIZE_CURSOR" file="../../WebCore/Resources/westResizeCursor.png" type="BINDATA" /> + <include name="IDR_ZOOMIN_CURSOR" file="../../WebCore/Resources/zoomInCursor.png" type="BINDATA" /> + <include name="IDR_ZOOMOUT_CURSOR" file="../../WebCore/Resources/zoomOutCursor.png" type="BINDATA" /> + </if> + </includes> </release> </grit> diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 831241de4..b507189db 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -125,6 +125,7 @@ 'tests/ListenerLeakTest.cpp', 'tests/LocalizedDateICUTest.cpp', 'tests/LocalizedNumberICUTest.cpp', + 'tests/MemoryInfo.cpp', 'tests/MockCCQuadCuller.h', 'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp', 'tests/OpenTypeVerticalDataTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 3432342a9..6aa57be3d 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -42,6 +42,7 @@ 'ENABLE_CSS_BOX_DECORATION_BREAK=1', 'ENABLE_CSS_EXCLUSIONS=1', 'ENABLE_CSS_FILTERS=1', + 'ENABLE_CSS_COMPOSITING=0', 'ENABLE_CSS_IMAGE_SET=1', 'ENABLE_CSS_IMAGE_RESOLUTION=0', 'ENABLE_CSS_REGIONS=1', @@ -68,6 +69,11 @@ 'ENABLE_IFRAME_SEAMLESS=1', 'ENABLE_INDEXED_DATABASE=1', 'ENABLE_INPUT_TYPE_DATE=1', + 'ENABLE_INPUT_TYPE_DATETIME=1', + 'ENABLE_INPUT_TYPE_DATETIMELOCAL=1', + 'ENABLE_INPUT_TYPE_MONTH=1', + 'ENABLE_INPUT_TYPE_TIME=1', + 'ENABLE_INPUT_TYPE_WEEK=1', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0', 'ENABLE_LEGACY_VIEWPORT_ADAPTION=1', @@ -143,11 +149,6 @@ 'ENABLE_CALENDAR_PICKER=0', 'ENABLE_INPUT_SPEECH=0', 'ENABLE_INPUT_TYPE_COLOR=0', - 'ENABLE_INPUT_TYPE_DATETIME=1', - 'ENABLE_INPUT_TYPE_DATETIMELOCAL=1', - 'ENABLE_INPUT_TYPE_MONTH=1', - 'ENABLE_INPUT_TYPE_TIME=1', - 'ENABLE_INPUT_TYPE_WEEK=1', 'ENABLE_JAVASCRIPT_I18N_API=0', 'ENABLE_LEGACY_NOTIFICATIONS=0', 'ENABLE_MEDIA_CAPTURE=1', diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h index 62b5f0de8..bc32d6d84 100644 --- a/Source/WebKit/chromium/public/WebFrameClient.h +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -346,6 +346,15 @@ public: WebFrame*, WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) { } + // Deletes FileSystem. + // WebFileSystemCallbacks::didSucceed() must be called when the operation + // is completed successfully. WebFileSystemCallbacks::didFail() must be + // called otherwise. + // All in-flight operations and following operations may fail after the + // FileSystem is deleted. + virtual void deleteFileSystem( + WebFrame*, WebFileSystem::Type, WebFileSystemCallbacks*) { } + // Quota --------------------------------------------------------- // Queries the origin's storage usage and quota information. diff --git a/Source/WebKit/chromium/public/WebIDBCallbacks.h b/Source/WebKit/chromium/public/WebIDBCallbacks.h index a63c0bc9e..ce100f295 100644 --- a/Source/WebKit/chromium/public/WebIDBCallbacks.h +++ b/Source/WebKit/chromium/public/WebIDBCallbacks.h @@ -58,7 +58,9 @@ public: virtual void onSuccess(const WebSerializedScriptValue&, const WebIDBKey&, const WebIDBKeyPath&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccessWithContinuation() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onBlocked() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onBlocked(long long oldVersion) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccessWithPrefetch(const WebVector<WebIDBKey>& keys, const WebVector<WebIDBKey>& primaryKeys, const WebVector<WebSerializedScriptValue>& values) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onUpgradeNeeded(long long oldVersion, WebIDBTransaction*, WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); } }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h index 838a71ff9..0907b8bf0 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h +++ b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h @@ -35,6 +35,7 @@ class WebIDBDatabaseCallbacks { public: virtual ~WebIDBDatabaseCallbacks() { } + virtual void onVersionChange(long long oldVersion, long long newVersion) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onVersionChange(const WebString& requestedVersion) { WEBKIT_ASSERT_NOT_REACHED(); } }; diff --git a/Source/WebKit/chromium/public/WebIDBFactory.h b/Source/WebKit/chromium/public/WebIDBFactory.h index e956ebded..f10a8eb9a 100644 --- a/Source/WebKit/chromium/public/WebIDBFactory.h +++ b/Source/WebKit/chromium/public/WebIDBFactory.h @@ -31,6 +31,7 @@ #include "WebDOMStringList.h" #include "WebIDBCallbacks.h" +#include "WebIDBMetadata.h" #include "WebSecurityOrigin.h" #include "platform/WebCommon.h" #include "platform/WebString.h" @@ -53,8 +54,15 @@ public: virtual void getDatabaseNames(WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + // FIXME: Delete this method when derived classes in chromium have + // implemented the other open method. + virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) + { + open(name, WebIDBMetadata::NoIntVersion, callbacks, origin, frame, dataDir); + } + // The WebKit implementation of open ignores the WebFrame* parameter. - virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void open(const WebString& name, long long version, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } }; diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h index b7a5ecbd2..40a6fdb3e 100644 --- a/Source/WebKit/chromium/public/WebInputEvent.h +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -33,6 +33,7 @@ #include "WebTouchPoint.h" #include "platform/WebCommon.h" +#include "platform/WebRect.h" #include <string.h> @@ -372,6 +373,7 @@ public: // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor. For a GestureTap event, |deltaX| and |deltaY| represent the horizontal and vertical radii of the touch region. float deltaX; float deltaY; + WebRect boundingBox; WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent)) : WebInputEvent(sizeParam) diff --git a/Source/WebKit/chromium/public/WebPermissionClient.h b/Source/WebKit/chromium/public/WebPermissionClient.h index 014c2c3f4..5adcde2e0 100644 --- a/Source/WebKit/chromium/public/WebPermissionClient.h +++ b/Source/WebKit/chromium/public/WebPermissionClient.h @@ -93,6 +93,9 @@ public: // Controls whether enabling Web Components API for this frame. virtual bool allowWebComponents(const WebDocument&, bool defaultValue) { return defaultValue; } + // Controls whether enabling HTML notifications for this frame. + virtual bool allowHTMLNotifications(const WebDocument&) { return true; } + // Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled. virtual void didNotAllowPlugins(WebFrame*) { } diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h index a0dd04997..c3d61d85a 100644 --- a/Source/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h @@ -139,6 +139,21 @@ public: WEBKIT_EXPORT static void enableInputTypeDate(bool); WEBKIT_EXPORT static bool isInputTypeDateEnabled(); + WEBKIT_EXPORT static void enableInputTypeDateTime(bool); + WEBKIT_EXPORT static bool isInputTypeDateTimeEnabled(); + + WEBKIT_EXPORT static void enableInputTypeDateTimeLocal(bool); + WEBKIT_EXPORT static bool isInputTypeDateTimeLocalEnabled(); + + WEBKIT_EXPORT static void enableInputTypeMonth(bool); + WEBKIT_EXPORT static bool isInputTypeMonthEnabled(); + + WEBKIT_EXPORT static void enableInputTypeTime(bool); + WEBKIT_EXPORT static bool isInputTypeTimeEnabled(); + + WEBKIT_EXPORT static void enableInputTypeWeek(bool); + WEBKIT_EXPORT static bool isInputTypeWeekEnabled(); + WEBKIT_EXPORT static void enableDialogElement(bool); WEBKIT_EXPORT static bool isDialogElementEnabled(); diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index 0085ba51a..4da3363dd 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -63,7 +63,6 @@ struct WebActiveWheelFlingParameters; struct WebMediaPlayerAction; struct WebPluginAction; struct WebPoint; -struct WebRenderingStats; class WebView : public WebWidget { public: @@ -254,6 +253,14 @@ public: virtual float minimumPageScaleFactor() const = 0; virtual float maximumPageScaleFactor() const = 0; + // Save the WebView's current scroll and scale state. Each call to this function + // overwrites the previously saved scroll and scale state. + virtual void saveScrollAndScaleState() = 0; + + // Restore the previously saved scroll and scale state. After restroing the + // state, this function deletes any saved scroll and scale state. + virtual void restoreScrollAndScaleState() = 0; + // Prevent the web page from setting a maximum scale via the viewport meta // tag. This is an accessibility feature that lets folks zoom in to web // pages even if the web page tries to block scaling. @@ -454,10 +461,6 @@ public: virtual bool isSelectionEditable() const = 0; - // Fills in a WebRenderingStats struct containing information about the state of the compositor. - // This call is relatively expensive in threaded mode as it blocks on the compositor thread. - virtual void renderingStats(WebRenderingStats&) const { } - // Benchmarking support -------------------------------------------- virtual WebViewBenchmarkSupport* benchmarkSupport() { return 0; } diff --git a/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h b/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h index c8ace3622..c395e37b0 100644 --- a/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h +++ b/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h @@ -51,14 +51,15 @@ public: // when painting is about to occur and when painting is complete. class PaintClient { public: - virtual WebCanvas* createCanvas(const WebSize&) = 0; - - // Called by the WebViewBenchmarkSupport when painting is about to - // occur. - virtual void willPaint(const WebCanvas&) { } + // Called by the WebViewBenchmarkSupport when painting is about to occur. + // PaintClient is expected to return an appropriately-sized canvas + // for the WebViewBenchmarkSupport to paint on. + virtual WebCanvas* willPaint(const WebSize&) { return 0; } // Called by the WebViewBenchmarkSupport when painting is complete. - virtual void didPaint(const WebCanvas&) { } + // The canvas will not be used after this call and can be destroyed + // if necessary. + virtual void didPaint(WebCanvas*) { } protected: virtual ~PaintClient() { } }; diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h index 600c523f8..b2a57d66e 100644 --- a/Source/WebKit/chromium/public/WebWidget.h +++ b/Source/WebKit/chromium/public/WebWidget.h @@ -48,6 +48,7 @@ class WebInputEvent; class WebMouseEvent; class WebString; struct WebPoint; +struct WebRenderingStats; template <typename T> class WebVector; class WebWidget { @@ -221,6 +222,10 @@ public: // following the call to instrumentBeginFrame(). virtual void instrumentCancelFrame() { } + // Fills in a WebRenderingStats struct containing information about the state of the compositor. + // This call is relatively expensive in threaded mode as it blocks on the compositor thread. + virtual void renderingStats(WebRenderingStats&) const { } + // The page background color. Can be used for filling in areas without // content. virtual WebColor backgroundColor() const { return 0xFFFFFFFF; /* SK_ColorWHITE */ } diff --git a/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py b/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py index fbb878df2..d6d9826cb 100644 --- a/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py +++ b/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py @@ -41,7 +41,7 @@ def write_devtools_extension_api(output, input_names): output.write(""" var tabId; var extensionInfo = {}; - platformExtensionAPI(injectedExtensionAPI("remote-" + top.frames.length)); + platformExtensionAPI(injectedExtensionAPI("remote-" + window.parent.frames.length)); })();""") diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 789d1b623..5f250351a 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -537,6 +537,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePreview, PageVisibilityStateP #if ENABLE(MEDIA_STREAM) COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::TypeAudio, MediaStreamSource::TypeAudio); COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::TypeVideo, MediaStreamSource::TypeVideo); +COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::ReadyStateLive, MediaStreamSource::ReadyStateLive); +COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::ReadyStateMuted, MediaStreamSource::ReadyStateMuted); +COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::ReadyStateEnded, MediaStreamSource::ReadyStateEnded); COMPILE_ASSERT_MATCHING_ENUM(WebICEOptions::CandidateTypeAll, IceOptions::ALL); COMPILE_ASSERT_MATCHING_ENUM(WebICEOptions::CandidateTypeNoRelay, IceOptions::NO_RELAY); diff --git a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp index 63e16726e..bc4cfb834 100644 --- a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp @@ -143,6 +143,8 @@ bool ContextFeaturesClientImpl::askIfIsEnabled(Document* document, ContextFeatur case ContextFeatures::ShadowDOM: case ContextFeatures::StyleScoped: return m_client->allowWebComponents(WebDocument(document), defaultValue); + case ContextFeatures::HTMLNotifications: + return m_client->allowHTMLNotifications(WebDocument(document)); default: return defaultValue; } diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp index a544189b6..7df84d2ff 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -31,8 +31,12 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBCursorBackendInterface.h" +#include "IDBDatabaseBackendInterface.h" #include "IDBDatabaseBackendProxy.h" #include "IDBDatabaseError.h" +#include "IDBObjectStoreBackendInterface.h" +#include "IDBTransactionBackendInterface.h" #include "WebIDBCallbacks.h" #include "WebIDBCursorImpl.h" #include "WebIDBDatabaseImpl.h" diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp index ca390ba90..277a665cf 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp @@ -69,11 +69,6 @@ PassRefPtr<SerializedScriptValue> IDBCursorBackendProxy::value() const return m_idbCursor->value(); } -void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) -{ - m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks), ec); -} - void IDBCursorBackendProxy::advance(unsigned long count, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) { m_idbCursor->advance(count, new WebIDBCallbacksImpl(callbacks), ec); diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h index 9e4b57008..d742f68e5 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h @@ -45,7 +45,6 @@ public: virtual PassRefPtr<WebCore::IDBKey> key() const; virtual PassRefPtr<WebCore::IDBKey> primaryKey() const; virtual PassRefPtr<WebCore::SerializedScriptValue> value() const; - virtual void update(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void advance(unsigned long, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void continueFunction(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void deleteFunction(PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp index 826407330..4d1c91d07 100755 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp @@ -67,14 +67,6 @@ void IDBObjectStoreBackendProxy::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPt m_webIDBObjectStore->get(keyRange, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); } -void IDBObjectStoreBackendProxy::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) -{ - // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, - // all implementations of IDB interfaces are proxy objects. - IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); - m_webIDBObjectStore->put(value, key, static_cast<WebIDBObjectStore::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); -} - void IDBObjectStoreBackendProxy::putWithIndexKeys(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h index c64028cff..0235077fa 100644 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h @@ -44,7 +44,6 @@ public: virtual ~IDBObjectStoreBackendProxy(); virtual void get(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); - virtual void put(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void putWithIndexKeys(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, const WTF::Vector<WTF::String>&, const WTF::Vector<IndexKeys>&, WebCore::ExceptionCode&); virtual void deleteFunction(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void clear(PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp index 6fded29ff..d22412ac8 100644 --- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -183,6 +183,11 @@ static void openFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFi callbacks->didFail(WebKit::WebFileErrorAbort); } +static void deleteFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + callbacks->didFail(WebKit::WebFileErrorAbort); +} + static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType, long long size, CreationFlag create) { bool allowed = true; @@ -226,6 +231,22 @@ void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSys openFileSystemHelper(context, type, callbacks, synchronousType, size, CreateIfNotPresent); } +void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + ASSERT(context); + ASSERT(context->isDocument()); + + Document* document = static_cast<Document*>(context); + WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); + WebKit::WebViewImpl* webView = webFrame->viewImpl(); + if (webView->permissionClient() && !webView->permissionClient()->allowFileSystem(webFrame)) { + context->postTask(createCallbackTask(&deleteFileSystemNotAllowed, callbacks)); + return; + } + + webFrame->client()->deleteFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), new WebFileSystemCallbacksImpl(callbacks)); +} + } // namespace WebCore #endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 0cfbac209..f821562f6 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1465,10 +1465,10 @@ VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move; hitType |= HitTestRequest::ReadOnly; hitType |= HitTestRequest::Active; + hitType |= HitTestRequest::IgnoreClipping; HitTestRequest request(hitType); FrameView* view = frame()->view(); - HitTestResult result(view->windowToContents( - view->convertFromContainingWindow(IntPoint(point.x, point.y)))); + HitTestResult result(view->windowToContents(IntPoint(point.x, point.y))); frame()->document()->renderView()->layer()->hitTest(request, result); diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp index e9c0e04af..0d65a87be 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp @@ -62,11 +62,6 @@ WebSerializedScriptValue WebIDBCursorImpl::value() const return m_idbCursorBackend->value(); } -void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks, WebExceptionCode& ec) -{ - m_idbCursorBackend->update(value, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec); -} - void WebIDBCursorImpl::advance(unsigned long count, WebIDBCallbacks* callbacks, WebExceptionCode& ec) { m_idbCursorBackend->advance(count, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec); diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.h b/Source/WebKit/chromium/src/WebIDBCursorImpl.h index f0d387b62..45a229b38 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.h +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.h @@ -47,7 +47,6 @@ public: virtual WebIDBKey key() const; virtual WebIDBKey primaryKey() const; virtual WebSerializedScriptValue value() const; - virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&); virtual void advance(unsigned long, WebIDBCallbacks*, WebExceptionCode&); virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&); virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 18573cacf..bc6d09fa1 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -33,6 +33,7 @@ #include "IDBDatabaseBackendInterface.h" #include "IDBDatabaseCallbacksProxy.h" #include "IDBMetadata.h" +#include "IDBObjectStoreBackendInterface.h" #include "IDBTransactionBackendInterface.h" #include "WebIDBCallbacks.h" #include "WebIDBDatabaseCallbacks.h" diff --git a/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp index d875e11bc..d14ac71e1 100755 --- a/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp @@ -69,6 +69,13 @@ void WebIDBFactoryImpl::open(const WebString& name, WebIDBCallbacks* callbacks, m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)).get(), origin, 0, dataDir); } +void WebIDBFactoryImpl::open(const WebString& name, long long version, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) +{ + // FIXME: Pass version along when WebCore::IDBFactoryBackendInterface + // has an open method that accepts it. + m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)).get(), origin, 0, dataDir); +} + void WebIDBFactoryImpl::deleteDatabase(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) { m_idbFactoryBackend->deleteDatabase(name, IDBCallbacksProxy::create(adoptPtr(callbacks)), origin, 0, dataDir); diff --git a/Source/WebKit/chromium/src/WebIDBFactoryImpl.h b/Source/WebKit/chromium/src/WebIDBFactoryImpl.h index b3e474df9..fa438d764 100644 --- a/Source/WebKit/chromium/src/WebIDBFactoryImpl.h +++ b/Source/WebKit/chromium/src/WebIDBFactoryImpl.h @@ -46,6 +46,7 @@ public: virtual void getDatabaseNames(WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); virtual void open(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); + virtual void open(const WebString& name, long long version, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); private: diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 53d140f42..22a066807 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -58,11 +58,6 @@ void WebIDBObjectStoreImpl::get(const WebIDBKeyRange& keyRange, WebIDBCallbacks* m_objectStore->get(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); } -void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) -{ - m_objectStore->put(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); -} - void WebIDBObjectStoreImpl::putWithIndexKeys(const WebSerializedScriptValue& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, const WebVector<WebString>& webIndexNames, const WebVector<WebIndexKeys>& webIndexKeys, WebExceptionCode& ec) { ASSERT(webIndexNames.size() == webIndexKeys.size()); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index e6dc88f54..934cffa99 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -46,7 +46,6 @@ public: ~WebIDBObjectStoreImpl(); void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); - void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void putWithIndexKeys(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, const WebVector<WebString>& indexNames, const WebVector<WebIndexKeys>&, WebExceptionCode&); void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp b/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp index 94610eba9..5cbbee663 100644 --- a/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp @@ -28,6 +28,7 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBObjectStoreBackendInterface.h" #include "IDBTransaction.h" #include "IDBTransactionCallbacksProxy.h" #include "WebIDBObjectStoreImpl.h" diff --git a/Source/WebKit/chromium/src/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp index c0690f8d7..66a0480b4 100644 --- a/Source/WebKit/chromium/src/WebInputEvent.cpp +++ b/Source/WebKit/chromium/src/WebInputEvent.cpp @@ -60,7 +60,7 @@ struct SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent { }; struct SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent { - int gestureData[6]; + int gestureData[10]; }; struct SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent { diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index 34eb952fd..b87df0f1b 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -52,6 +52,7 @@ WebLayerTreeView::Settings::operator CCLayerTreeSettings() const settings.refreshRate = refreshRate; settings.defaultTileSize = defaultTileSize; settings.maxUntiledLayerSize = maxUntiledLayerSize; + settings.acceleratePainting = acceleratePainting; // FIXME: showFPSCounter / showPlatformLayerTree / maxPartialTextureUpdates aren't supported currently. return settings; @@ -183,6 +184,8 @@ void WebLayerTreeView::renderingStats(WebRenderingStats& stats) const stats.numAnimationFrames = ccStats.numAnimationFrames; stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; stats.droppedFrameCount = ccStats.droppedFrameCount; + stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; + stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; } void WebLayerTreeView::loseCompositorContext(int numTimes) diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index 6d59cc19c..fd5d2f2ad 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -190,6 +190,8 @@ bool WebPagePopupImpl::initPage() m_page = adoptPtr(new Page(pageClients)); m_page->settings()->setScriptEnabled(true); m_page->settings()->setAllowScriptsToCloseWindows(true); + m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor()); + m_page->settings()->setDeviceSupportsTouch(m_webView->page()->settings()->deviceSupportsTouch()); static ContextFeaturesClient* pagePopupFeaturesClient = new PagePopupFeaturesClient(); provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient); diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.h b/Source/WebKit/chromium/src/WebPagePopupImpl.h index 2e1c8c3f3..2552bacf1 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.h +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.h @@ -63,6 +63,7 @@ public: bool handleKeyEvent(const WebCore::PlatformKeyboardEvent&); void closePopup(); WebWidgetClient* widgetClient() const { return m_widgetClient; } + bool hasSamePopupClient(WebPagePopupImpl* other) { return other && m_popupClient == other->m_popupClient; } private: // WebWidget functions diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index 491a30311..ec08f0a0e 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -462,7 +462,7 @@ bool WebRuntimeFeatures::isVideoTrackEnabled() void WebRuntimeFeatures::enableGamepad(bool enable) { #if ENABLE(GAMEPAD) - RuntimeEnabledFeatures::setWebkitGamepadsEnabled(enable); + RuntimeEnabledFeatures::setWebkitGetGamepadsEnabled(enable); #else UNUSED_PARAM(enable); #endif @@ -471,7 +471,7 @@ void WebRuntimeFeatures::enableGamepad(bool enable) bool WebRuntimeFeatures::isGamepadEnabled() { #if ENABLE(GAMEPAD) - return RuntimeEnabledFeatures::webkitGamepadsEnabled(); + return RuntimeEnabledFeatures::webkitGetGamepadsEnabled(); #else return false; #endif @@ -531,6 +531,96 @@ bool WebRuntimeFeatures::isInputTypeDateEnabled() #endif } +void WebRuntimeFeatures::enableInputTypeDateTime(bool enable) +{ +#if ENABLE(INPUT_TYPE_DATETIME) + RuntimeEnabledFeatures::setInputTypeDateTimeEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeDateTimeEnabled() +{ +#if ENABLE(INPUT_TYPE_DATETIME) + return RuntimeEnabledFeatures::inputTypeDateTimeEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeDateTimeLocal(bool enable) +{ +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + RuntimeEnabledFeatures::setInputTypeDateTimeLocalEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeDateTimeLocalEnabled() +{ +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + return RuntimeEnabledFeatures::inputTypeDateTimeLocalEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeMonth(bool enable) +{ +#if ENABLE(INPUT_TYPE_MONTH) + RuntimeEnabledFeatures::setInputTypeMonthEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeMonthEnabled() +{ +#if ENABLE(INPUT_TYPE_MONTH) + return RuntimeEnabledFeatures::inputTypeMonthEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeTime(bool enable) +{ +#if ENABLE(INPUT_TYPE_TIME) + RuntimeEnabledFeatures::setInputTypeTimeEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeTimeEnabled() +{ +#if ENABLE(INPUT_TYPE_TIME) + return RuntimeEnabledFeatures::inputTypeTimeEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeWeek(bool enable) +{ +#if ENABLE(INPUT_TYPE_WEEK) + RuntimeEnabledFeatures::setInputTypeWeekEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeWeekEnabled() +{ +#if ENABLE(INPUT_TYPE_WEEK) + return RuntimeEnabledFeatures::inputTypeWeekEnabled(); +#else + return false; +#endif +} + void WebRuntimeFeatures::enableDialogElement(bool enable) { #if ENABLE(DIALOG_ELEMENT) diff --git a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp index 2b11f6eb6..9764af138 100644 --- a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp @@ -47,12 +47,11 @@ namespace WebKit { void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsLayer& layer, const IntRect& clip) { WebSize canvasSize(clip.width(), clip.height()); - OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); - GraphicsContextBuilder builder(canvas.get()); + WebCanvas* canvas = paintClient->willPaint(canvasSize); + GraphicsContextBuilder builder(canvas); - paintClient->willPaint(*canvas.get()); layer.paintGraphicsLayerContents(builder.context(), clip); - paintClient->didPaint(*canvas.get()); + paintClient->didPaint(canvas); } void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintClient, GraphicsLayer& layer) @@ -84,10 +83,9 @@ void WebViewBenchmarkSupportImpl::softwarePaint(PaintClient* paintClient, PaintM } WebSize canvasSize(paintSize.width, paintSize.height); - OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); - paintClient->willPaint(*canvas.get()); - m_webViewImpl->paint(canvas.get(), paintSize); - paintClient->didPaint(*canvas.get()); + WebCanvas* canvas = paintClient->willPaint(canvasSize); + m_webViewImpl->paint(canvas, paintSize); + paintClient->didPaint(canvas); } void WebViewBenchmarkSupportImpl::paint(PaintClient* paintClient, PaintMode paintMode) diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 6a253f8e3..7c6da60d9 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -197,6 +197,8 @@ static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; static const double doubleTabZoomAnimationDurationInSeconds = 0.25; +// Constants for zooming in on a focused text field. +static const double scrollAndScaleAnimationDurationInSeconds = 0.2; namespace WebKit { @@ -392,6 +394,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_maximumPageScaleFactor(maxPageScaleFactor) , m_ignoreViewportTagMaximumScale(false) , m_pageScaleFactorIsSet(false) + , m_savedPageScaleFactor(0) , m_contextMenuAllowed(false) , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) @@ -522,14 +525,23 @@ void WebViewImpl::handleMouseLeave(Frame& mainFrame, const WebMouseEvent& event) void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event) { - // If there is a select popup open, close it as the user is clicking on - // the page (outside of the popup). We also save it so we can prevent a - // click on the select element from immediately reopening the popup. + // If there is a popup open, close it as the user is clicking on the page (outside of the + // popup). We also save it so we can prevent a click on an element from immediately + // reopening the same popup. RefPtr<WebCore::PopupContainer> selectPopup; +#if ENABLE(PAGE_POPUP) + RefPtr<WebPagePopupImpl> pagePopup; +#endif if (event.button == WebMouseEvent::ButtonLeft) { selectPopup = m_selectPopup; - hideSelectPopup(); +#if ENABLE(PAGE_POPUP) + pagePopup = m_pagePopup; +#endif + hidePopups(); ASSERT(!m_selectPopup); +#if ENABLE(PAGE_POPUP) + ASSERT(!m_pagePopup); +#endif } m_lastMouseDownPoint = WebPoint(event.x, event.y); @@ -555,6 +567,14 @@ void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event) hideSelectPopup(); } +#if ENABLE(PAGE_POPUP) + if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.get())) { + // That click triggered a page popup that is the same as the one we just closed. + // It needs to be closed. + closePagePopup(m_pagePopup.get()); + } +#endif + // Dispatch the contextmenu event regardless of if the click was swallowed. // On Windows, we handle it on mouse up, not down. #if OS(DARWIN) @@ -2713,6 +2733,33 @@ float WebViewImpl::maximumPageScaleFactor() const return m_maximumPageScaleFactor; } +void WebViewImpl::saveScrollAndScaleState() +{ + m_savedPageScaleFactor = pageScaleFactor(); + m_savedScrollOffset = mainFrame()->scrollOffset(); +} + +void WebViewImpl::restoreScrollAndScaleState() +{ + if (!m_savedPageScaleFactor) + return; + +#if ENABLE(GESTURE_EVENTS) + startPageScaleAnimation(IntPoint(m_savedScrollOffset), false, m_savedPageScaleFactor, scrollAndScaleAnimationDurationInSeconds); +#else + setPageScaleFactor(m_savedPageScaleFactor, WebPoint()); + mainFrame()->setScrollOffset(m_savedScrollOffset); +#endif + + resetSavedScrollAndScaleState(); +} + +void WebViewImpl::resetSavedScrollAndScaleState() +{ + m_savedPageScaleFactor = 0; + m_savedScrollOffset = IntSize(); +} + WebSize WebViewImpl::fixedLayoutSize() const { if (!page()) @@ -3246,6 +3293,7 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa m_pageScaleFactorIsSet = false; m_gestureAnimation.clear(); + resetSavedScrollAndScaleState(); } void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 1155969fd..639d5e61a 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -174,6 +174,7 @@ public: virtual void didChangeWindowResizerRect(); virtual void instrumentBeginFrame(); virtual void instrumentCancelFrame(); + virtual void renderingStats(WebRenderingStats&) const; // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -220,6 +221,8 @@ public: virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale); virtual float minimumPageScaleFactor() const; virtual float maximumPageScaleFactor() const; + virtual void saveScrollAndScaleState(); + virtual void restoreScrollAndScaleState(); virtual void setIgnoreViewportTagMaximumScale(bool); virtual float deviceScaleFactor() const; @@ -296,7 +299,6 @@ public: virtual void updateBatteryStatus(const WebBatteryStatus&); #endif virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); - virtual void renderingStats(WebRenderingStats&) const; virtual WebViewBenchmarkSupport* benchmarkSupport(); // WebLayerTreeViewClient @@ -579,6 +581,8 @@ private: float clampPageScaleFactorToLimits(float scale); WebPoint clampOffsetAtScale(const WebPoint& offset, float scale); + void resetSavedScrollAndScaleState(); + friend class WebView; // So WebView::Create can call our constructor friend class WTF::RefCounted<WebViewImpl>; @@ -707,15 +711,18 @@ private: double m_maximumZoomLevel; + // State related to the page scale float m_pageDefinedMinimumPageScaleFactor; float m_pageDefinedMaximumPageScaleFactor; float m_minimumPageScaleFactor; float m_maximumPageScaleFactor; - bool m_ignoreViewportTagMaximumScale; - bool m_pageScaleFactorIsSet; + // Saved page scale state. + float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. + WebCore::IntSize m_savedScrollOffset; + bool m_contextMenuAllowed; bool m_doingDragAndDrop; diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index 9aa412090..8294ca622 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -46,8 +46,6 @@ namespace { void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList) { CCLayerSorter layerSorter; - WebTransformationMatrix identityMatrix; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; // Sanity check: The test itself should create the root layer's render surface, so @@ -56,9 +54,7 @@ void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLay ASSERT_TRUE(root->renderSurface()); ASSERT_FALSE(renderSurfaceLayerList.size()); - root->renderSurface()->clearLayerList(); - renderSurfaceLayerList.append(root); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, root->renderSurface()->contentRect()); } @@ -99,6 +95,7 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithOneSurface() root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); root->setBounds(IntSize(500, 500)); + root->setContentBounds(IntSize(500, 500)); root->setDrawsContent(true); root->createRenderSurface(); root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))); @@ -106,6 +103,7 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithOneSurface() child->setPosition(FloatPoint(100, 100)); child->setAnchorPoint(FloatPoint::zero()); child->setBounds(IntSize(30, 30)); + child->setContentBounds(IntSize(30, 30)); child->setDrawsContent(true); root->addChild(child.release()); @@ -127,6 +125,7 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); root->setBounds(IntSize(500, 500)); + root->setContentBounds(IntSize(500, 500)); root->setDrawsContent(true); root->createRenderSurface(); root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))); @@ -134,22 +133,26 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() child1->setPosition(FloatPoint(100, 100)); child1->setAnchorPoint(FloatPoint::zero()); child1->setBounds(IntSize(30, 30)); + child1->setContentBounds(IntSize(30, 30)); child1->setOpacity(0.5); // with a child that drawsContent, this will cause the layer to create its own renderSurface. child1->setDrawsContent(false); // this layer does not draw, but is intended to create its own renderSurface. child2->setPosition(FloatPoint(11, 11)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(18, 18)); + child2->setContentBounds(IntSize(18, 18)); child2->setDrawsContent(true); grandChild1->setPosition(FloatPoint(200, 200)); grandChild1->setAnchorPoint(FloatPoint::zero()); grandChild1->setBounds(IntSize(6, 8)); + grandChild1->setContentBounds(IntSize(6, 8)); grandChild1->setDrawsContent(true); grandChild2->setPosition(FloatPoint(190, 190)); grandChild2->setAnchorPoint(FloatPoint::zero()); grandChild2->setBounds(IntSize(6, 8)); + grandChild2->setContentBounds(IntSize(6, 8)); grandChild2->setDrawsContent(true); child1->addChild(grandChild1.release()); @@ -360,6 +363,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) // Set up the child child->setPosition(FloatPoint(0, 0)); child->setBounds(IntSize(100, 100)); + child->setContentBounds(IntSize(100, 100)); child->setTransform(transform); emulateDrawingOneFrame(root.get()); @@ -526,6 +530,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); + child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); root->addChild(child2.release()); } @@ -565,6 +570,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); + child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); child2->resetAllChangeTrackingForSubtree(); // Sanity check the initial conditions of the test, if these asserts trigger, it @@ -594,6 +600,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); + child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); root->addChild(child2.release()); } @@ -812,6 +819,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) grandChild3->setPosition(FloatPoint(240, 240)); grandChild3->setAnchorPoint(FloatPoint::zero()); grandChild3->setBounds(IntSize(10, 10)); + grandChild3->setContentBounds(IntSize(10, 10)); grandChild3->setDrawsContent(true); child1->addChild(grandChild3.release()); } @@ -894,6 +902,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) maskLayer->setPosition(child->position()); maskLayer->setAnchorPoint(FloatPoint::zero()); maskLayer->setBounds(child->bounds()); + maskLayer->setContentBounds(child->bounds()); child->setMaskLayer(maskLayer.release()); } CCLayerImpl* maskLayer = child->maskLayer(); @@ -905,6 +914,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) grandChild->setPosition(FloatPoint(2, 2)); grandChild->setAnchorPoint(FloatPoint::zero()); grandChild->setBounds(IntSize(2, 2)); + grandChild->setContentBounds(IntSize(2, 2)); grandChild->setDrawsContent(true); child->addChild(grandChild.release()); } @@ -989,6 +999,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); replicaMaskLayer->setBounds(grandChild1->bounds()); + replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.release()); } CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); @@ -1050,6 +1061,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. replicaMaskLayer->setBounds(grandChild1->bounds()); + replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.release()); } CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index 76dc425aa..73fda4cb4 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -147,12 +147,7 @@ TEST(CCLayerIteratorTest, simpleTree) rootLayer->addChild(fourth); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(), - WebTransformationMatrix(), WebTransformationMatrix(), - renderSurfaceLayerList, layerList, - 256); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); iterateBackToFront(&renderSurfaceLayerList); @@ -195,12 +190,7 @@ TEST(CCLayerIteratorTest, complexTree) root23->addChild(root231); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(), - WebTransformationMatrix(), WebTransformationMatrix(), - renderSurfaceLayerList, layerList, - 256); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); iterateBackToFront(&renderSurfaceLayerList); @@ -256,13 +246,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) root23->addChild(root231); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(), - WebTransformationMatrix(), WebTransformationMatrix(), - renderSurfaceLayerList, layerList, - 256); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); iterateBackToFront(&renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp index d231e1259..8ffcea24f 100644 --- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp @@ -89,9 +89,11 @@ TEST(CCLayerSorterTest, RightAngleOverlap) WebTransformationMatrix leftFaceMatrix; leftFaceMatrix.rotate3d(0, 1, 0, -90); leftFaceMatrix.translateRight3d(-1, 0, -5); + leftFaceMatrix.translate(-1, -1); CCLayerSorter::LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix); WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); + frontFaceMatrix.translate(-1, -1); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &leftFace, zThreshold, weight); @@ -111,11 +113,13 @@ TEST(CCLayerSorterTest, IntersectingLayerOverlap) // values at the overlapping features but the weight returned should be zero. WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); + frontFaceMatrix.translate(-1, -1); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); WebTransformationMatrix throughMatrix; throughMatrix.rotate3d(0, 1, 0, 45); throughMatrix.translateRight3d(0, 0, -4); + throughMatrix.translate(-1, -1); CCLayerSorter::LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); EXPECT_NE(CCLayerSorter::None, overlapResult); @@ -142,14 +146,17 @@ TEST(CCLayerSorterTest, LayersAtAngleOverlap) WebTransformationMatrix transformA; transformA.translate3d(-6, 0, 1); + transformA.translate(-4, -10); CCLayerSorter::LayerShape layerA(8, 20, transformA); WebTransformationMatrix transformB; transformB.translate3d(6, 0, -1); + transformB.translate(-4, -10); CCLayerSorter::LayerShape layerB(8, 20, transformB); WebTransformationMatrix transformC; transformC.rotate3d(0, 1, 0, 40); + transformC.translate(-4, -10); CCLayerSorter::LayerShape layerC(8, 20, transformC); overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerC, zThreshold, weight); @@ -176,6 +183,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) WebTransformationMatrix transformA; transformA.translate3d(-15, 0, -2); + transformA.translate(-5, -5); CCLayerSorter::LayerShape layerA(10, 10, perspectiveMatrix * transformA); // With this sequence of transforms, when layer B is correctly clipped, it will be @@ -185,6 +193,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) WebTransformationMatrix transformB; transformB.translate3d(0, 0, 0.7); transformB.rotate3d(0, 45, 0); + transformB.translate(-5, -5); CCLayerSorter::LayerShape layerB(10, 10, perspectiveMatrix * transformB); // Sanity check that the test case actually covers the intended scenario, where part @@ -226,22 +235,27 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) FrontMatrix.translate3d(0, 0, 1); layer1->setBounds(IntSize(10, 10)); + layer1->setContentBounds(IntSize(10, 10)); layer1->setDrawTransform(BehindMatrix); layer1->setDrawsContent(true); layer2->setBounds(IntSize(20, 20)); + layer2->setContentBounds(IntSize(20, 20)); layer2->setDrawTransform(BehindMatrix); layer2->setDrawsContent(true); layer3->setBounds(IntSize(30, 30)); + layer3->setContentBounds(IntSize(30, 30)); layer3->setDrawTransform(FrontMatrix); layer3->setDrawsContent(true); layer4->setBounds(IntSize(40, 40)); + layer4->setContentBounds(IntSize(40, 40)); layer4->setDrawTransform(FrontMatrix); layer4->setDrawsContent(true); layer5->setBounds(IntSize(50, 50)); + layer5->setContentBounds(IntSize(50, 50)); layer5->setDrawTransform(BehindMatrix); layer5->setDrawsContent(true); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 86af40a02..9e249f2d7 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -75,25 +75,25 @@ void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) { WebTransformationMatrix identityMatrix; Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - ASSERT(rootLayer->renderSurface()); + // We are probably not testing what is intended if the rootLayer bounds are empty. ASSERT(!rootLayer->bounds().isEmpty()); - rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds())); - - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, dummyMaxTextureSize, dummyRenderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(dummyRenderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); } void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer) { // Note: this version skips layer sorting. + WebTransformationMatrix identityMatrix; Vector<CCLayerImpl*> dummyRenderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + + // We are probably not testing what is intended if the rootLayer bounds are empty. + ASSERT(!rootLayer->bounds().isEmpty()); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(dummyRenderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); } @@ -129,8 +129,6 @@ PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests() grandChild->addChild(greatGrandChild.release()); child->addChild(grandChild.release()); root->addChild(child.release()); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); return root.release(); } @@ -155,7 +153,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -176,7 +173,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) { WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> layer = LayerChromium::create(); - layer->createRenderSurface(); // Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform. WebTransformationMatrix arbitraryTranslation; @@ -184,31 +180,29 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); executeCalculateDrawTransformsAndVisibility(layer.get()); WebTransformationMatrix expectedDrawTransform = identityMatrix; - expectedDrawTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); - // Case 2: setting the bounds of the layer should result in a draw transform that translates to half the width and height. - // The screen-space transform should remain as the identity, because it does not deal with transforming to/from the center of the layer. + // Case 2: Setting the bounds of the layer should not affect either the draw transform or the screenspace transform. WebTransformationMatrix translationToCenter; translationToCenter.translate(5, 6); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 3: The anchor point by itself (without a layer transform) should have no effect on the transforms. setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 4: A change in actual position affects both the draw transform and screen space transform. WebTransformationMatrix positionTransform; positionTransform.translate(0, 1.2); - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2), IntSize(10, 12), false); + setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransform()); // Case 5: In the correct sequence of transforms, the layer transform should pre-multiply the translationToCenter. This is easily tested by @@ -217,7 +211,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) layerTransform.scale3d(2, 2, 1); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform()); // Case 6: The layer transform should occur with respect to the anchor point. @@ -226,16 +220,16 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); // Case 7: Verify that position pre-multiplies the layer transform. // The current implementation of calculateDrawTransforms does this implicitly, but it is // still worth testing to detect accidental regressions. expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse(); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2), IntSize(10, 12), false); + setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); } @@ -245,33 +239,29 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); // Case 1: parent's anchorPoint should not affect child or grandChild. - WebTransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; - childTranslationToCenter.translate(8, 9); - grandChildTranslationToCenter.translate(38, 39); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTransform()); // Case 2: parent's position affects child and grandChild. WebTransformationMatrix parentPositionTransform; parentPositionTransform.translate(0, 1.2); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2), IntSize(10, 12), false); + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenSpaceTransform()); // Case 3: parent's local transform affects child and grandchild @@ -284,9 +274,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screenSpaceTransform()); // Case 4: parent's sublayerMatrix affects child and grandchild @@ -305,9 +295,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->screenSpaceTransform()); // Case 5: same as Case 4, except that child does preserve 3D, so the grandChild should receive the non-flattened composite transform. @@ -316,9 +306,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), true); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screenSpaceTransform()); } @@ -327,7 +317,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -346,11 +335,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - WebTransformationMatrix childTranslationToCenter; - childTranslationToCenter.translate(8, 9); - WebTransformationMatrix grandChildTranslationToCenter; - grandChildTranslationToCenter.translate(4, 5); - // Child's render surface should not exist yet. ASSERT_FALSE(child->renderSurface()); @@ -363,16 +347,13 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) ASSERT_TRUE(child->renderSurface()); ASSERT_EQ(child, child->renderTarget()); - // The child layer's draw transform should refer to its new render surface; they only differ by a translation to center. + // The child layer's draw transform should refer to its new render surface. // The screen-space transform, however, should still refer to the root. - EXPECT_TRANSFORMATION_MATRIX_EQ(childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->originTransform()); - // Because the grandChild is the only drawable content, the child's renderSurface will tighten its bounds to the grandChild. - // Therefore, the draw transform will have a translation of half-width, half-height of the grandChild's bounds. - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * grandChildTranslationToCenter, child->renderTarget()->renderSurface()->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->drawTransform()); // The screen space is the same as the target since the child surface draws into the root. EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->screenSpaceTransform()); @@ -408,22 +389,23 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) IntRect childRect(10, 10, 50, 50); IntRect grandChildRect(5, 5, 150, 150); - root->createRenderSurface(); root->setAnchorPoint(FloatPoint(0, 0)); root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); root->setBounds(IntSize(rootRect.width(), rootRect.height())); + root->setContentBounds(root->bounds()); root->setDrawsContent(true); - root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); child->setAnchorPoint(FloatPoint(0, 0)); child->setPosition(FloatPoint(childRect.x(), childRect.y())); child->setOpacity(0.5); child->setBounds(IntSize(childRect.width(), childRect.height())); + child->setContentBounds(child->bounds()); child->setDrawsContent(true); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); + grandChild->setContentBounds(grandChild->bounds()); grandChild->setDrawsContent(true); CCLayerImpl* childPtr = child.get(); @@ -436,14 +418,9 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) Vector<CCLayerImpl*> renderSurfaceLayerList; { - WebTransformationMatrix identityMatrix; - Vector<CCLayerImpl*> layerList; int dummyMaxTextureSize = 512; CCLayerSorter layerSorter; - - renderSurfaceLayerList.append(root.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); FloatRect dummyDamageRect; CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect); @@ -575,29 +552,31 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) IntRect childRect(10, 10, 50, 50); IntRect grandChildRect(5, 5, 150, 150); - root->createRenderSurface(); root->setAnchorPoint(FloatPoint(0, 0)); root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); root->setBounds(IntSize(rootRect.width(), rootRect.height())); + root->setContentBounds(root->bounds()); root->setDrawsContent(true); - root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); child->setAnchorPoint(FloatPoint(0, 0)); child->setPosition(FloatPoint(childRect.x(), childRect.y())); child->setOpacity(0.5); child->setBounds(IntSize(childRect.width(), childRect.height())); + child->setContentBounds(child->bounds()); child->setDrawsContent(true); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild->setOpacity(0.5); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); + grandChild->setContentBounds(grandChild->bounds()); grandChild->setDrawsContent(true); grandChild2->setAnchorPoint(FloatPoint(0, 0)); grandChild2->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild2->setOpacity(0.5); grandChild2->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); + grandChild2->setContentBounds(grandChild2->bounds()); grandChild2->setDrawsContent(true); CCLayerImpl* childPtr = child.get(); @@ -611,14 +590,9 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) Vector<CCLayerImpl*> renderSurfaceLayerList; { - WebTransformationMatrix identityMatrix; - Vector<CCLayerImpl*> layerList; int dummyMaxTextureSize = 512; CCLayerSorter layerSorter; - - renderSurfaceLayerList.append(root.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); FloatRect dummyDamageRect; CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect); @@ -729,7 +703,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> childReplica = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); child->setReplicaLayer(childReplica.get()); @@ -767,7 +740,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) ASSERT_TRUE(child->renderSurface()); ASSERT_EQ(child, child->renderTarget()); - EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarget()->renderSurface()->replicaOriginTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarget()->renderSurface()->replicaDrawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarget()->renderSurface()->replicaScreenSpaceTransform()); } @@ -791,7 +764,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(renderSurface1); parent->addChild(childOfRoot); renderSurface1->addChild(childOfRS1); @@ -805,7 +777,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface. renderSurface1->setOpacity(0.5); - renderSurface2->setOpacity(0.33); + renderSurface2->setOpacity(0.33f); // All layers in the tree are initialized with an anchor at .25 and a size of (10,10). // matrix "A" is the composite layer transform used in all layers, centered about the anchor point @@ -828,6 +800,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) WebTransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); @@ -875,17 +848,17 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // note that draw transforms are described with respect to the nearest ancestor render surface // but screen space transforms are described with respect to the root. // - EXPECT_TRANSFORMATION_MATRIX_EQ(A * translationToCenter, parent->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * translationToCenter, childOfRoot->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * A * translationToCenter, grandChildOfRoot->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A, parent->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, childOfRoot->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * A, grandChildOfRoot->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, renderSurface1->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * translationToCenter, childOfRS1->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A * translationToCenter, grandChildOfRS1->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, renderSurface1->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, childOfRS1->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A, grandChildOfRS1->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, renderSurface2->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * translationToCenter, childOfRS2->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A * translationToCenter, grandChildOfRS2->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, renderSurface2->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, childOfRS2->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A, grandChildOfRS2->drawTransform()); // Verify layer screen-space transforms // @@ -903,14 +876,14 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // Verify render surface transforms. // - // Origin transform of render surface 1 is described with respect to root. - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->originTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaOriginTransform()); + // Draw transform of render surface 1 is described with respect to root. + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaDrawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->screenSpaceTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaScreenSpaceTransform()); - // Origin transform of render surface 2 is described with respect to render surface 2. - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, renderSurface2->renderSurface()->originTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * R, renderSurface2->renderSurface()->replicaOriginTransform()); + // Draw transform of render surface 2 is described with respect to render surface 2. + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, renderSurface2->renderSurface()->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * R, renderSurface2->renderSurface()->replicaDrawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * A, renderSurface2->renderSurface()->screenSpaceTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * R, renderSurface2->renderSurface()->replicaScreenSpaceTransform()); @@ -930,37 +903,32 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42()); } -TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) +TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClippedLayer) { RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); - renderSurface1->setOpacity(0.9); const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); parent->addChild(renderSurface1); - renderSurface1->createRenderSurface(); renderSurface1->addChild(child); + renderSurface1->setForceRenderSurface(true); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); - - FloatRect dummyDamageRect; + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); // The child layer's content is entirely outside the parent's clip rect, so the intermediate - // render surface should have been removed. Render surfaces without children or visible + // render surface should not be listed here, even if it was forced to be created. Render surfaces without children or visible // content are unexpected at draw time (e.g. we might try to create a content texture of size 0). + ASSERT_TRUE(parent->renderSurface()); ASSERT_FALSE(renderSurface1->renderSurface()); - EXPECT_EQ(renderSurfaceLayerList.size(), 0U); + EXPECT_EQ(1U, renderSurfaceLayerList.size()); } TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) @@ -968,29 +936,28 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); - renderSurface1->setOpacity(0); const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); - parent->createRenderSurface(); parent->addChild(renderSurface1); - renderSurface1->createRenderSurface(); renderSurface1->addChild(child); + renderSurface1->setForceRenderSurface(true); + renderSurface1->setOpacity(0); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); - + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); // Since the layer is transparent, renderSurface1->renderSurface() should not have gotten added anywhere. // Also, the drawable content rect should not have been extended by the children. - EXPECT_EQ(parent->renderSurface()->layerList().size(), 0U); - EXPECT_EQ(renderSurfaceLayerList.size(), 0U); - EXPECT_EQ(parent->drawableContentRect(), IntRect()); + ASSERT_TRUE(parent->renderSurface()); + EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); + EXPECT_EQ(1U, renderSurfaceLayerList.size()); + EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); + EXPECT_EQ(IntRect(), parent->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) @@ -1005,24 +972,28 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); parent->addChild(renderSurface1); renderSurface1->addChild(child); + // Sanity check before the actual test + EXPECT_FALSE(parent->renderSurface()); + EXPECT_FALSE(renderSurface1->renderSurface()); + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + // The root layer always creates a renderSurface + EXPECT_TRUE(parent->renderSurface()); EXPECT_TRUE(renderSurface1->renderSurface()); - EXPECT_EQ(renderSurfaceLayerList.size(), 1U); + EXPECT_EQ(2U, renderSurfaceLayerList.size()); renderSurfaceLayerList.clear(); renderSurface1->setForceRenderSurface(false); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + EXPECT_TRUE(parent->renderSurface()); EXPECT_FALSE(renderSurface1->renderSurface()); - EXPECT_EQ(renderSurfaceLayerList.size(), 0U); + EXPECT_EQ(1U, renderSurfaceLayerList.size()); } TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDirectContainer) @@ -1042,10 +1013,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected drawTransforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform; EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); @@ -1057,7 +1025,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected. expectedChildTransform.makeIdentity(); - expectedChildTransform.translate(40, 40); + expectedChildTransform.translate(-10, -10); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1091,10 +1059,8 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected drawTransforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(nonUniformScale); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform; @@ -1109,7 +1075,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -20); // scrollDelta expectedChildTransform.multiply(nonUniformScale); - expectedChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1135,10 +1100,8 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit executeCalculateDrawTransformsAndVisibility(root.get()); WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(58, 56); + expectedGrandChildTransform.translate(8, 6); WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform; @@ -1152,9 +1115,9 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected. expectedChildTransform.makeIdentity(); - expectedChildTransform.translate(40, 40); + expectedChildTransform.translate(-10, -10); expectedGrandChildTransform.makeIdentity(); - expectedGrandChildTransform.translate(48, 46); + expectedGrandChildTransform.translate(-2, -4); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); @@ -1174,7 +1137,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); - + child->setIsContainerForFixedPositionLayers(true); child->setTransform(rotationAboutZ); grandChild->setPosition(FloatPoint(8, 6)); @@ -1187,13 +1150,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform; @@ -1209,14 +1170,12 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -20); // scrollDelta expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); expectedGrandChildTransform.makeIdentity(); expectedGrandChildTransform.translate(-10, -20); // child's scrollDelta is inherited expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1240,7 +1199,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); - + child->setIsContainerForFixedPositionLayers(true); child->setTransform(rotationAboutZ); grandChild->setPosition(FloatPoint(8, 6)); @@ -1253,13 +1212,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform; @@ -1276,7 +1233,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, 0); // scrollDelta expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); expectedGrandChildTransform.makeIdentity(); expectedGrandChildTransform.translate(-10, 0); // child's scrollDelta is inherited @@ -1284,7 +1240,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedGrandChildTransform.translate(-5, 0); // grandChild's scrollDelta expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1295,7 +1250,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit { // This test checks for correct scroll compensation when the fixed-position container // contributes to a different renderSurface than the fixed-position layer. In this - // case, the surface originTransforms also have to be accounted for when checking the + // case, the surface drawTransforms also have to be accounted for when checking the // scrollDelta. DebugScopedSetImplThread scopedImplThread; @@ -1313,30 +1268,27 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); grandChild->setTransform(rotationAboutZ); - + // Case 1: scrollDelta of 0, 0 child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - + WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedSurfaceOriginTransform; - expectedSurfaceOriginTransform.translate(8, 6); - expectedSurfaceOriginTransform.multiply(rotationAboutZ); + WebTransformationMatrix expectedSurfaceDrawTransform; + expectedSurfaceDrawTransform.translate(8, 6); + expectedSurfaceDrawTransform.multiply(rotationAboutZ); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); WebTransformationMatrix expectedGreatGrandChildTransform; - expectedGreatGrandChildTransform.translate(50, 50); ASSERT_TRUE(grandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); // Case 2: scrollDelta of 10, 30 child->setScrollDelta(IntSize(10, 30)); executeCalculateDrawTransformsAndVisibility(root.get()); - + // Here the grandChild remains unchanged, because it scrolls along with the // renderSurface, and the translation is actually in the renderSurface. But, the fixed // position greatGrandChild is more awkward: its actually being drawn with respect to @@ -1346,12 +1298,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // transform explicitly contains the translation that cancels out the scroll. expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -30); // scrollDelta - expectedChildTransform.translate(50, 50); - expectedSurfaceOriginTransform.makeIdentity(); - expectedSurfaceOriginTransform.translate(-10, -30); // scrollDelta - expectedSurfaceOriginTransform.translate(8, 6); - expectedSurfaceOriginTransform.multiply(rotationAboutZ); + expectedSurfaceDrawTransform.makeIdentity(); + expectedSurfaceDrawTransform.translate(-10, -30); // scrollDelta + expectedSurfaceDrawTransform.translate(8, 6); + expectedSurfaceDrawTransform.multiply(rotationAboutZ); // The rotation and its inverse are needed to place the scrollDelta compensation in // the correct space. This test will fail if the rotation/inverse are backwards, too, @@ -1360,11 +1311,10 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedGreatGrandChildTransform.multiply(rotationAboutZ.inverse()); expectedGreatGrandChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface. expectedGreatGrandChildTransform.multiply(rotationAboutZ); - expectedGreatGrandChildTransform.translate(50, 50); ASSERT_TRUE(grandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); } @@ -1416,31 +1366,27 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit executeCalculateDrawTransformsAndVisibility(root.get()); WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedGrandChildSurfaceOriginTransform; - expectedGrandChildSurfaceOriginTransform.translate(8, 6); - expectedGrandChildSurfaceOriginTransform.multiply(rotationAboutZ); + WebTransformationMatrix expectedGrandChildSurfaceDrawTransform; + expectedGrandChildSurfaceDrawTransform.translate(8, 6); + expectedGrandChildSurfaceDrawTransform.multiply(rotationAboutZ); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); - WebTransformationMatrix expectedGreatGrandChildSurfaceOriginTransform; - expectedGreatGrandChildSurfaceOriginTransform.translate(40, 60); - expectedGreatGrandChildSurfaceOriginTransform.multiply(rotationAboutZ); + WebTransformationMatrix expectedGreatGrandChildSurfaceDrawTransform; + expectedGreatGrandChildSurfaceDrawTransform.translate(40, 60); + expectedGreatGrandChildSurfaceDrawTransform.multiply(rotationAboutZ); WebTransformationMatrix expectedGreatGrandChildTransform; - expectedGreatGrandChildTransform.translate(50, 50); WebTransformationMatrix expectedFixedPositionChildTransform; - expectedFixedPositionChildTransform.translate(50, 50); ASSERT_TRUE(grandChild->renderSurface()); ASSERT_TRUE(greatGrandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceOriginTransform, greatGrandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceDrawTransform, greatGrandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPositionChild->drawTransform()); @@ -1450,12 +1396,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -30); // scrollDelta - expectedChildTransform.translate(50, 50); - expectedGrandChildSurfaceOriginTransform.makeIdentity(); - expectedGrandChildSurfaceOriginTransform.translate(-10, -30); // scrollDelta - expectedGrandChildSurfaceOriginTransform.translate(8, 6); - expectedGrandChildSurfaceOriginTransform.multiply(rotationAboutZ); + expectedGrandChildSurfaceDrawTransform.makeIdentity(); + expectedGrandChildSurfaceDrawTransform.translate(-10, -30); // scrollDelta + expectedGrandChildSurfaceDrawTransform.translate(8, 6); + expectedGrandChildSurfaceDrawTransform.multiply(rotationAboutZ); // grandChild, greatGrandChild, and greatGrandChild's surface are not expected to // change, since they are all not fixed, and they are all drawn with respect to @@ -1463,25 +1408,24 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // But the great-great grandchild, "fixedPositionChild", should have a transform that explicitly cancels out the scrollDelta. // The expected transform is: - // compoundOriginTransform.inverse() * translate(positive scrollDelta) * compoundOriginTransform * half-width-half-height translation - WebTransformationMatrix compoundOriginTransform; // transform from greatGrandChildSurface's origin to the root surface. - compoundOriginTransform.translate(8, 6); // origin translation of grandChild - compoundOriginTransform.multiply(rotationAboutZ); // rotation of grandChild - compoundOriginTransform.translate(40, 60); // origin translation of greatGrandChild - compoundOriginTransform.multiply(rotationAboutZ); // rotation of greatGrandChild + // compoundDrawTransform.inverse() * translate(positive scrollDelta) * compoundOriginTransform + WebTransformationMatrix compoundDrawTransform; // transform from greatGrandChildSurface's origin to the root surface. + compoundDrawTransform.translate(8, 6); // origin translation of grandChild + compoundDrawTransform.multiply(rotationAboutZ); // rotation of grandChild + compoundDrawTransform.translate(40, 60); // origin translation of greatGrandChild + compoundDrawTransform.multiply(rotationAboutZ); // rotation of greatGrandChild expectedFixedPositionChildTransform.makeIdentity(); - expectedFixedPositionChildTransform.multiply(compoundOriginTransform.inverse()); + expectedFixedPositionChildTransform.multiply(compoundDrawTransform.inverse()); expectedFixedPositionChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface. - expectedFixedPositionChildTransform.multiply(compoundOriginTransform); - expectedFixedPositionChildTransform.translate(50, 50); + expectedFixedPositionChildTransform.multiply(compoundDrawTransform); ASSERT_TRUE(grandChild->renderSurface()); ASSERT_TRUE(greatGrandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceOriginTransform, greatGrandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceDrawTransform, greatGrandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPositionChild->drawTransform()); } @@ -1507,15 +1451,12 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). - WebTransformationMatrix expectedSurfaceOriginTransform; - expectedSurfaceOriginTransform.translate(0, 0); + WebTransformationMatrix expectedSurfaceDrawTransform; + expectedSurfaceDrawTransform.translate(0, 0); WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); ASSERT_TRUE(child->renderSurface()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, child->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1526,12 +1467,13 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // The surface is translated by scrollDelta, the child transform doesn't change // because it scrolls along with the surface, but the fixed position grandChild // needs to compensate for the scroll translation. - expectedSurfaceOriginTransform.makeIdentity(); - expectedSurfaceOriginTransform.translate(-10, -10); + expectedSurfaceDrawTransform.makeIdentity(); + expectedSurfaceDrawTransform.translate(-10, -10); expectedGrandChildTransform.makeIdentity(); - expectedGrandChildTransform.translate(60, 60); + expectedGrandChildTransform.translate(10, 10); + ASSERT_TRUE(child->renderSurface()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, child->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } @@ -1557,11 +1499,8 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1571,7 +1510,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha // Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected. expectedChildTransform.makeIdentity(); - expectedChildTransform.translate(40, 40); + expectedChildTransform.translate(-10, -10); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } @@ -1597,14 +1536,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha root->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(rotationByZ); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; expectedGrandChildTransform.multiply(rotationByZ); - expectedGrandChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1617,7 +1553,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -10); // the scrollDelta expectedChildTransform.multiply(rotationByZ); - expectedChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1646,7 +1581,6 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) RefPtr<LayerChromium> greatGrandChild = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); grandChild->addChild(greatGrandChild); @@ -1664,21 +1598,13 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); child->setMasksToBounds(true); - child->setOpacity(0.4); + child->setOpacity(0.4f); grandChild->setOpacity(0.5); - greatGrandChild->setOpacity(0.4); + greatGrandChild->setOpacity(0.4f); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); - - FloatRect dummyDamageRect; + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -1720,18 +1646,12 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); parent->setMasksToBounds(true); - child->setOpacity(0.4); - grandChild->setOpacity(0.4); + child->setOpacity(0.4f); + grandChild->setOpacity(0.4f); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Without an animation, we should cull child and grandChild from the renderSurfaceLayerList. ASSERT_EQ(1U, renderSurfaceLayerList.size()); @@ -1744,13 +1664,8 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) child->clearRenderSurface(); grandChild->clearRenderSurface(); renderSurfaceLayerList.clear(); - dummyLayerList.clear(); - - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // With an animating transform, we should keep child and grandChild in the renderSurfaceLayerList. ASSERT_EQ(3U, renderSurfaceLayerList.size()); @@ -1777,7 +1692,6 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) RefPtr<LayerChromium> grandChild3 = LayerChromium::create(); RefPtr<LayerChromium> grandChild4 = LayerChromium::create(); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild1); child->addChild(grandChild2); @@ -1795,21 +1709,15 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) grandChild3->setMasksToBounds(true); // Force everyone to be a render surface. - child->setOpacity(0.4); + child->setOpacity(0.4f); grandChild1->setOpacity(0.5); grandChild2->setOpacity(0.5); grandChild3->setOpacity(0.5); grandChild4->setOpacity(0.5); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -1841,7 +1749,6 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) RefPtr<LayerChromiumWithForcedDrawsContent> leafNode3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> leafNode4 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild1); child->addChild(grandChild2); @@ -1870,21 +1777,15 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) grandChild4->setMasksToBounds(true); // Force everyone to be a render surface. - child->setOpacity(0.4); + child->setOpacity(0.4f); grandChild1->setOpacity(0.5); grandChild2->setOpacity(0.5); grandChild3->setOpacity(0.5); grandChild4->setOpacity(0.5); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -1910,7 +1811,6 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(renderSurface1); parent->addChild(childOfRoot); renderSurface1->addChild(childOfRS1); @@ -2316,7 +2216,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(frontFacingChild); parent->addChild(backFacingChild); parent->addChild(frontFacingSurface); @@ -2358,12 +2257,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_FALSE(frontFacingChild->renderSurface()); @@ -2415,7 +2310,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(frontFacingChild); parent->addChild(backFacingChild); parent->addChild(frontFacingSurface); @@ -2462,12 +2356,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_FALSE(frontFacingChild->renderSurface()); @@ -2512,7 +2402,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) RefPtr<LayerChromiumWithForcedDrawsContent> animatingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); parent->addChild(animatingSurface); animatingSurface->addChild(childOfAnimatingSurface); @@ -2547,13 +2436,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -2599,7 +2483,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(frontFacingSurface); parent->addChild(backFacingSurface); frontFacingSurface->addChild(child1); @@ -2621,12 +2504,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_TRUE(frontFacingSurface->renderSurface()); @@ -2670,8 +2549,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2681,10 +2558,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2717,8 +2592,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix uninvertibleTransform; uninvertibleTransform.setM11(0); @@ -2735,10 +2608,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2783,8 +2654,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2794,10 +2663,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2831,8 +2698,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; WebTransformationMatrix rotation45DegreesAboutCenter; @@ -2846,10 +2711,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2887,8 +2750,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; @@ -2907,10 +2768,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2945,8 +2804,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // screenSpaceTransform converts from the layer's origin space to screen space. This // test makes sure that hit testing works correctly accounts for the contents scale. // A contentsScale that is not 1 effectively forces a non-identity transform between - // layer's content space and layer's origin space, which is not included in the - // screenSpaceTransform. The hit testing code must take this into account. + // layer's content space and layer's origin space. The hit testing code must take this into account. // // To test this, the layer is positioned at (25, 25), and is size (50, 50). If // contentsScale is ignored, then hit testing will mis-interpret the visibleContentRect @@ -2954,44 +2812,52 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // DebugScopedSetImplThread thisScopeIsOnImplThread; - OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - FloatPoint position(25, 25); - IntSize bounds(50, 50); - setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); - root->setDrawsContent(true); - root->setContentBounds(IntSize(100, 100)); + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); + + { + FloatPoint position(25, 25); + IntSize bounds(50, 50); + OwnPtr<CCLayerImpl> testLayer = CCLayerImpl::create(12345); + setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); + + // override contentBounds + testLayer->setContentBounds(IntSize(100, 100)); + + testLayer->setDrawsContent(true); + root->addChild(testLayer.release()); + } Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. - // The visibleContentRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. - EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleContentRect()); + // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25. + CCLayerImpl* testLayer = root->children()[0].get(); + EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); - // Hit testing for a point outside the layer should return a null pointer. - IntPoint testPoint(24, 24); + // Hit testing for a point outside the layer should return a null pointer (the root layer does not draw content, so it will not be hit tested either). + IntPoint testPoint(101, 101); CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); - // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it. - // This case in particular is likely to fail if contents scale is not correctly accounted for. + testPoint = IntPoint(24, 24); + resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + EXPECT_FALSE(resultLayer); + testPoint = IntPoint(76, 76); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); - // Hit testing for a point inside should return the root layer. + // Hit testing for a point inside should return the test layer. testPoint = IntPoint(26, 26); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); @@ -3009,36 +2875,37 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) // the entire layer bounds. Here we just test the simple axis-aligned case. DebugScopedSetImplThread thisScopeIsOnImplThread; - OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); - WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located. - IntSize bounds(50, 50); - setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); - root->setMasksToBounds(true); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); { + OwnPtr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123); + FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located. + IntSize bounds(50, 50); + setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); + clippingLayer->setMasksToBounds(true); + OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456); position = FloatPoint(-50, -50); bounds = IntSize(300, 300); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); child->setDrawsContent(true); - root->addChild(child.release()); + clippingLayer->addChild(child.release()); + root->addChild(clippingLayer.release()); } Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); + ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); // Hit testing for a point outside the layer should return a null pointer. // Despite the child layer being very large, it should be clipped to the root layer's bounds. @@ -3046,7 +2913,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); - // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it. + // Even though the layer exists at (101, 101), it should not be visible there since the clippingLayer would clamp it. testPoint = IntPoint(76, 76); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); @@ -3078,8 +2945,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3124,10 +2989,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) } Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -3181,8 +3044,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3228,10 +3089,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) CCLayerImpl* grandChild1 = child1->children()[0].get(); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -3291,8 +3150,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3341,10 +3198,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) CCLayerImpl* grandChild1 = child1->children()[0].get(); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -3420,7 +3275,6 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) // Verify draw and screen space transforms of layers not in a surface. MockContentLayerDelegate delegate; WebTransformationMatrix identityMatrix; - WebTransformationMatrix parentMatrix; RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); @@ -3435,40 +3289,27 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) parent->addChild(childNoScale); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - const double deviceScaleFactor = 2.5; - parentMatrix.scale(deviceScaleFactor); parent->setContentsScale(deviceScaleFactor); child->setContentsScale(deviceScaleFactor); EXPECT_EQ(childNoScale->contentsScale(), 1); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), parentMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); EXPECT_EQ(1u, renderSurfaceLayerList.size()); // Verify parent transforms - WebTransformationMatrix expectedParentScreenSpaceTransform; - expectedParentScreenSpaceTransform.setM11(deviceScaleFactor); - expectedParentScreenSpaceTransform.setM22(deviceScaleFactor); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentScreenSpaceTransform, parent->screenSpaceTransform()); - - WebTransformationMatrix expectedParentDrawTransform = expectedParentScreenSpaceTransform; - expectedParentDrawTransform.translate(0.5 * parent->bounds().width(), 0.5 * parent->bounds().height()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentDrawTransform, parent->drawTransform()); + WebTransformationMatrix expectedParentTransform; + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpaceTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform()); // Verify results of transformed parent rects - IntRect parentBounds(IntPoint(), parent->bounds()); - IntRect centeredParentBounds = parentBounds; - centeredParentBounds.move(-parentBounds.width() * 0.5, -parentBounds.height() * 0.5); + FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds())); - FloatRect parentDrawRect = CCMathUtil::mapClippedRect(parent->drawTransform(), FloatRect(centeredParentBounds)); - FloatRect parentScreenSpaceRect = CCMathUtil::mapClippedRect(parent->screenSpaceTransform(), FloatRect(parentBounds)); + FloatRect parentDrawRect = CCMathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds); + FloatRect parentScreenSpaceRect = CCMathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds); FloatRect expectedParentDrawRect(FloatPoint(), parent->bounds()); expectedParentDrawRect.scale(deviceScaleFactor); @@ -3476,23 +3317,16 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect); // Verify child transforms - WebTransformationMatrix expectedChildScreenSpaceTransform; - expectedChildScreenSpaceTransform.setM11(deviceScaleFactor); - expectedChildScreenSpaceTransform.setM22(deviceScaleFactor); - expectedChildScreenSpaceTransform.translate(child->position().x(), child->position().y()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildScreenSpaceTransform, child->screenSpaceTransform()); - - WebTransformationMatrix expectedChildDrawTransform = expectedChildScreenSpaceTransform; - expectedChildDrawTransform.translate(0.5 * child->bounds().width(), 0.5 * child->bounds().height()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildDrawTransform, child->drawTransform()); + WebTransformationMatrix expectedChildTransform; + expectedChildTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform()); // Verify results of transformed child rects - IntRect childBounds(IntPoint(), child->bounds()); - IntRect centeredChildBounds = childBounds; - centeredChildBounds.move(-childBounds.width() * 0.5, -childBounds.height() * 0.5); + FloatRect childContentBounds(FloatPoint(), FloatSize(child->contentBounds())); - FloatRect childDrawRect = CCMathUtil::mapClippedRect(child->drawTransform(), FloatRect(centeredChildBounds)); - FloatRect childScreenSpaceRect = CCMathUtil::mapClippedRect(child->screenSpaceTransform(), FloatRect(childBounds)); + FloatRect childDrawRect = CCMathUtil::mapClippedRect(child->drawTransform(), childContentBounds); + FloatRect childScreenSpaceRect = CCMathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds); FloatRect expectedChildDrawRect(FloatPoint(), child->bounds()); expectedChildDrawRect.move(child->position().x(), child->position().y()); @@ -3501,15 +3335,18 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect); // Verify childNoScale transforms - EXPECT_TRANSFORMATION_MATRIX_EQ(child->drawTransform(), childNoScale->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(child->screenSpaceTransform(), childNoScale->screenSpaceTransform()); + WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform(); + // All transforms operate on content rects. The child's content rect + // incorporates device scale, but the childNoScale does not; add it here. + expectedChildNoScaleTransform.scale(deviceScaleFactor); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->screenSpaceTransform()); } TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) { MockContentLayerDelegate delegate; WebTransformationMatrix identityMatrix; - WebTransformationMatrix parentMatrix; RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true); @@ -3532,59 +3369,44 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) child->setReplicaLayer(replica.get()); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - const double deviceScaleFactor = 1.5; - parentMatrix.scale(deviceScaleFactor); parent->setContentsScale(deviceScaleFactor); child->setContentsScale(deviceScaleFactor); duplicateChildNonOwner->setContentsScale(deviceScaleFactor); replica->setContentsScale(deviceScaleFactor); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), parentMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); // We should have two render surfaces. The root's render surface and child's // render surface (it needs one because it has a replica layer). EXPECT_EQ(2u, renderSurfaceLayerList.size()); - WebTransformationMatrix expectedParentScreenSpaceTransform; - expectedParentScreenSpaceTransform.setM11(deviceScaleFactor); - expectedParentScreenSpaceTransform.setM22(deviceScaleFactor); - WebTransformationMatrix expectedParentDrawTransform = expectedParentScreenSpaceTransform; - expectedParentDrawTransform.translate(0.5 * parent->bounds().width(), 0.5 * parent->bounds().height()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentDrawTransform, parent->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentScreenSpaceTransform, parent->screenSpaceTransform()); + WebTransformationMatrix expectedParentTransform; + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpaceTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform()); WebTransformationMatrix expectedDrawTransform; - expectedDrawTransform.setM11(deviceScaleFactor); - expectedDrawTransform.setM22(deviceScaleFactor); - expectedDrawTransform.setM41(0.5 * deviceScaleFactor * child->bounds().width()); - expectedDrawTransform.setM42(0.5 * deviceScaleFactor * child->bounds().height()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, child->drawTransform()); WebTransformationMatrix expectedScreenSpaceTransform; - expectedScreenSpaceTransform.setM11(deviceScaleFactor); - expectedScreenSpaceTransform.setM22(deviceScaleFactor); - expectedScreenSpaceTransform.translate(child->position().x(), child->position().y()); + expectedScreenSpaceTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedScreenSpaceTransform, child->screenSpaceTransform()); + WebTransformationMatrix expectedDuplicateChildDrawTransform = child->drawTransform(); EXPECT_TRANSFORMATION_MATRIX_EQ(child->drawTransform(), duplicateChildNonOwner->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(child->screenSpaceTransform(), duplicateChildNonOwner->screenSpaceTransform()); EXPECT_INT_RECT_EQ(child->drawableContentRect(), duplicateChildNonOwner->drawableContentRect()); EXPECT_EQ(child->contentBounds(), duplicateChildNonOwner->contentBounds()); WebTransformationMatrix expectedRenderSurfaceDrawTransform; - expectedRenderSurfaceDrawTransform.translate(deviceScaleFactor * (child->position().x() + 0.5 * child->bounds().width()), deviceScaleFactor * (child->position().y() + 0.5 * child->bounds().height())); + expectedRenderSurfaceDrawTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedRenderSurfaceDrawTransform, child->renderSurface()->drawTransform()); - WebTransformationMatrix expectedOriginTransform; - expectedOriginTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedOriginTransform, child->renderSurface()->originTransform()); + WebTransformationMatrix expectedSurfaceDrawTransform; + expectedSurfaceDrawTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform()); WebTransformationMatrix expectedSurfaceScreenSpaceTransform; expectedSurfaceScreenSpaceTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2); @@ -3592,15 +3414,10 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) WebTransformationMatrix expectedReplicaDrawTransform; expectedReplicaDrawTransform.setM22(-1); - expectedReplicaDrawTransform.setM41(13.5); - expectedReplicaDrawTransform.setM42(-1.5); + expectedReplicaDrawTransform.setM41(6); + expectedReplicaDrawTransform.setM42(6); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaDrawTransform, child->renderSurface()->replicaDrawTransform()); - WebTransformationMatrix expectedReplicaOriginTransform = expectedReplicaDrawTransform; - expectedReplicaOriginTransform.setM41(6); - expectedReplicaOriginTransform.setM42(6); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaOriginTransform, child->renderSurface()->replicaOriginTransform()); - WebTransformationMatrix expectedReplicaScreenSpaceTransform; expectedReplicaScreenSpaceTransform.setM22(-1); expectedReplicaScreenSpaceTransform.setM41(6); @@ -3630,17 +3447,4 @@ TEST(CCLayerTreeHostCommonTest, verifySubtreeSearch) EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistentId)); } -// FIXME: -// continue working on https://bugs.webkit.org/show_bug.cgi?id=68942 -// - add a test to verify clipping that changes the "center point" -// - add a case that checks if a render surface's drawTransform is computed correctly. For the general case, and for special cases when clipping. -// - add a case that checks if a render surface's replicaTransform is computed correctly. -// - test all the conditions under which render surfaces are created -// - if possible, test all conditions under which render surfaces are not created -// - verify that the layer lists of render surfaces are correct, verify that renderTarget's RenderSurface values for each layer are correct. -// - test the computation of clip rects and content rects -// - test the special cases for mask layers and replica layers -// - test the other functions in CCLayerTreeHostCommon -// - } // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index 1419164b5..53c312cf5 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -1038,12 +1038,12 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); - WebTransformationMatrix pageScaleTransform; - pageScaleTransform.scale(newPageScale); - pageScaleTransform.translate(0.5 * surfaceSize.width(), 0.5 * surfaceSize.height()); - EXPECT_EQ(root->drawTransform(), pageScaleTransform); - EXPECT_EQ(child->drawTransform(), pageScaleTransform); - EXPECT_EQ(grandChild->drawTransform(), pageScaleTransform); + EXPECT_EQ(root->drawTransform().m11(), newPageScale); + EXPECT_EQ(root->drawTransform().m22(), newPageScale); + EXPECT_EQ(child->drawTransform().m11(), newPageScale); + EXPECT_EQ(child->drawTransform().m22(), newPageScale); + EXPECT_EQ(grandChild->drawTransform().m11(), newPageScale); + EXPECT_EQ(grandChild->drawTransform().m22(), newPageScale); } TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) @@ -1635,9 +1635,11 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) child->setPosition(FloatPoint(12, 13)); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(14, 15)); + child->setContentBounds(IntSize(14, 15)); child->setDrawsContent(true); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(500, 500)); + root->setContentBounds(IntSize(500, 500)); root->setDrawsContent(true); root->addChild(adoptPtr(child)); layerTreeHostImpl->setRootLayer(adoptPtr(root)); @@ -1695,9 +1697,11 @@ TEST_F(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(10, 10)); + child->setContentBounds(IntSize(10, 10)); child->setDrawsContent(true); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); + root->setContentBounds(IntSize(10, 10)); root->setDrawsContent(true); root->setOpacity(0.7f); root->addChild(adoptPtr(child)); @@ -1709,6 +1713,7 @@ TEST_F(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); EXPECT_EQ(1u, frame.renderSurfaceLayerList->size()); EXPECT_EQ(1u, frame.renderPasses.size()); + m_hostImpl->didDrawAllLayers(frame); } } // namespace @@ -3572,12 +3577,12 @@ struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { class CCTestRenderPass: public CCRenderPass { public: - static PassOwnPtr<CCRenderPass> create(CCRenderSurface* targetSurface, int id) { return adoptPtr(new CCTestRenderPass(targetSurface, id)); } + static PassOwnPtr<CCRenderPass> create(CCRenderSurface* renderSurface, int id) { return adoptPtr(new CCTestRenderPass(renderSurface, id)); } void appendQuad(PassOwnPtr<CCDrawQuad> quad) { m_quadList.append(quad); } protected: - CCTestRenderPass(CCRenderSurface* targetSurface, int id) : CCRenderPass(targetSurface, id) { } + CCTestRenderPass(CCRenderSurface* renderSurface, int id) : CCRenderPass(renderSurface, id) { } }; class CCTestRenderer : public LayerRendererChromium, public CCRendererClient { @@ -3693,7 +3698,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova IntRect quadRect = IntRect(0, 0, 1, 1); IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect(); - OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, WebKit::WebTransformationMatrix(), WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); + OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, 1, contentsChangedRect); static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release()); } } diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index ca3e21c3d..ea7678b02 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -1160,9 +1160,9 @@ public: int paintContentsCount() { return m_paintContentsCount; } void resetPaintContentsCount() { m_paintContentsCount = 0; } - virtual void update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE + virtual void update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) OVERRIDE { - ContentLayerChromium::update(updater, occlusion); + ContentLayerChromium::update(updater, occlusion, stats); m_paintContentsCount++; } @@ -1301,7 +1301,6 @@ public: // The root layer is scaled by 2x. WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; WebTransformationMatrix rootDrawTransform = scaleTransform; - rootDrawTransform.translate(root->bounds().width() * 0.5, root->bounds().height() * 0.5); EXPECT_EQ(rootDrawTransform, root->drawTransform()); EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform()); @@ -1311,7 +1310,6 @@ public: childScreenSpaceTransform.translate(2, 2); WebTransformationMatrix childDrawTransform = scaleTransform; childDrawTransform.translate(2, 2); - childDrawTransform.translate(child->bounds().width() * 0.5, child->bounds().height() * 0.5); EXPECT_EQ(childDrawTransform, child->drawTransform()); EXPECT_EQ(childScreenSpaceTransform, child->screenSpaceTransform()); @@ -1576,7 +1574,7 @@ class TestLayerChromium : public LayerChromium { public: static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); } - virtual void update(CCTextureUpdater&, const CCOcclusionTracker* occlusion) OVERRIDE + virtual void update(CCTextureUpdater&, const CCOcclusionTracker* occlusion, CCRenderingStats&) OVERRIDE { // Gain access to internals of the CCOcclusionTracker. const TestCCOcclusionTracker* testOcclusion = static_cast<const TestCCOcclusionTracker*>(occlusion); diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index b559db12c..596b0692c 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -256,16 +256,12 @@ protected: void calcDrawEtc(TestContentLayerImpl* root) { ASSERT(root == m_root.get()); - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; CCLayerSorter layerSorter; ASSERT(!root->renderSurface()); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); - m_renderSurfaceLayerListImpl.append(m_root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListImpl, dummyLayerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(m_renderSurfaceLayerListImpl, root->renderSurface()->contentRect()); @@ -275,15 +271,11 @@ protected: void calcDrawEtc(TestContentLayerChromium* root) { ASSERT(root == m_root.get()); - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; ASSERT(!root->renderSurface()); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); - m_renderSurfaceLayerListChromium.append(m_root); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListChromium, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, dummyMaxTextureSize, m_renderSurfaceLayerListChromium); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(m_renderSurfaceLayerListChromium, root->renderSurface()->contentRect()); diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 526ab4e59..9eff157bc 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -58,17 +58,15 @@ private: typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; -static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& originTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) +static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) { OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); tiler->setBounds(layerRect.size()); layer->setTilingData(*tiler); layer->setSkipsDraw(false); - WebTransformationMatrix drawTransform = originTransform; - drawTransform.translate(0.5 * layerRect.width(), 0.5 * layerRect.height()); layer->setDrawTransform(drawTransform); - layer->setScreenSpaceTransform(originTransform); + layer->setScreenSpaceTransform(drawTransform); layer->setVisibleContentRect(layerRect); layer->setDrawOpacity(opacity); layer->setOpaque(opaque); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index a989cd602..c95d71e84 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -86,7 +86,6 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawOpacity(0.5)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setReplicaDrawTransform(dummyMatrix)); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setOriginTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerList()); } @@ -106,7 +105,7 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) origin.translate(30, 40); - renderSurface->setOriginTransform(origin); + renderSurface->setDrawTransform(origin); renderSurface->setContentRect(contentRect); renderSurface->setClipRect(clipRect); renderSurface->setScissorRect(clipRect); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 7778549b6..ec2105327 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -46,7 +46,7 @@ void FakeLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourcePr m_layer->updateRect(); } -void FakeLayerTextureUpdater::Texture::prepareRect(const IntRect&) +void FakeLayerTextureUpdater::Texture::prepareRect(const IntRect&, WebCore::CCRenderingStats&) { m_layer->prepareRect(); } @@ -62,7 +62,7 @@ FakeLayerTextureUpdater::~FakeLayerTextureUpdater() { } -void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, float, IntRect& resultingOpaqueRect) +void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, float, IntRect& resultingOpaqueRect, CCRenderingStats&) { m_prepareCount++; m_lastUpdateRect = contentRect; @@ -115,9 +115,9 @@ void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect) TiledLayerChromium::setNeedsDisplayRect(rect); } -void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) +void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) { - updateContentRect(updater, visibleContentRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion, stats); } void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index be681d71c..de1eb66c6 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -50,7 +50,7 @@ public: virtual ~Texture(); virtual void updateRect(WebCore::CCResourceProvider* , const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE; - virtual void prepareRect(const WebCore::IntRect&) OVERRIDE; + virtual void prepareRect(const WebCore::IntRect&, WebCore::CCRenderingStats&) OVERRIDE; private: FakeLayerTextureUpdater* m_layer; @@ -62,7 +62,7 @@ public: virtual PassOwnPtr<WebCore::LayerTextureUpdater::Texture> createTexture(WebCore::CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE { return SampledTexelFormatRGBA; } - virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, float, float, WebCore::IntRect& resultingOpaqueRect) OVERRIDE; + virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, float, float, WebCore::IntRect& resultingOpaqueRect, WebCore::CCRenderingStats&) OVERRIDE; // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next // call to prepareToUpdate() the rect is reset. void setRectToInvalidate(const WebCore::IntRect&, FakeTiledLayerChromium*); @@ -122,7 +122,7 @@ public: const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } // Updates the visibleContentRect(). - virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*) OVERRIDE; + virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*, WebCore::CCRenderingStats&) OVERRIDE; virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index c206dda5e..ace7410c3 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -33,6 +33,7 @@ #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCGraphicsContext.h" +#include "cc/CCRenderingStats.h" #include "cc/CCTextureUpdater.h" #include "platform/WebKitPlatformSupport.h" #include "platform/WebThread.h" @@ -151,8 +152,8 @@ TEST(Canvas2DLayerBridgeTest2, testClearClient) RefPtr<LayerChromium> layer = bridge->layer(); bridge.clear(); CCTextureUpdater updater; - layer->update(updater, 0); + CCRenderingStats stats; + layer->update(updater, 0, stats); } } // namespace - diff --git a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp index fcfcce114..007bea446 100644 --- a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp @@ -30,6 +30,7 @@ #include "CCLayerTreeTestCommon.h" #include "GraphicsContext.h" #include "OpaqueRectTrackingContentLayerDelegate.h" +#include "cc/CCRenderingStats.h" #include "skia/ext/platform_canvas.h" #include <gtest/gtest.h> @@ -102,7 +103,8 @@ TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale) RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&delegate)); IntRect resultingOpaqueRect; - updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect); + CCRenderingStats stats; + updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect, stats); EXPECT_INT_RECT_EQ(opaqueRectInContentSpace, resultingOpaqueRect); } diff --git a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp index f53ad50d1..d9e3d697b 100644 --- a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp +++ b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp @@ -24,6 +24,8 @@ */ #include "config.h" +#include "IDBCursorBackendInterface.h" +#include "IDBDatabaseBackendInterface.h" #include "IDBFactoryBackendImpl.h" #include "IDBFakeBackingStore.h" #include "SecurityOrigin.h" diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp index eb3c85abc..5c01e9ecc 100644 --- a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp +++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "IDBBackingStore.h" +#include "IDBCursorBackendInterface.h" #include "IDBDatabaseBackendImpl.h" #include "IDBFactoryBackendImpl.h" #include "IDBFakeBackingStore.h" diff --git a/Source/WebKit/chromium/tests/IDBFakeBackingStore.h b/Source/WebKit/chromium/tests/IDBFakeBackingStore.h index 08405ce0a..536d785b9 100644 --- a/Source/WebKit/chromium/tests/IDBFakeBackingStore.h +++ b/Source/WebKit/chromium/tests/IDBFakeBackingStore.h @@ -59,7 +59,6 @@ public: virtual void deleteIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId) OVERRIDE { } virtual bool putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*) OVERRIDE { return false; } virtual bool deleteIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*) OVERRIDE { return false; } - virtual String getObjectViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) OVERRIDE { return String(); } virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) OVERRIDE { return PassRefPtr<IDBKey>(); } virtual bool keyExistsInIndex(int64_t databaseid, int64_t objectStoreId, int64_t indexId, const IDBKey& indexKey, RefPtr<IDBKey>& foundPrimaryKey) OVERRIDE { return false; } diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 1b6b8028b..d861164f6 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -80,8 +80,9 @@ public: , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) { m_rootLayer->createRenderSurface(); - m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); - m_renderPasses.append(m_rootRenderPass.get()); + OwnPtr<CCRenderPass> rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); + m_renderPassesInDrawOrder.append(rootRenderPass.get()); + m_renderPasses.set(m_rootLayer->id(), rootRenderPass.release()); } // CCRendererClient methods. @@ -96,8 +97,9 @@ public: // Methods added for test. int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; } - CCRenderPass* rootRenderPass() { return m_rootRenderPass.get(); } - const CCRenderPassList& renderPasses() { return m_renderPasses; } + CCRenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.last(); } + const CCRenderPassList& renderPassesInDrawOrder() const { return m_renderPassesInDrawOrder; } + const CCRenderPassIdHashMap& renderPasses() const { return m_renderPasses; } size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; } @@ -105,8 +107,8 @@ private: int m_setFullRootLayerDamageCount; DebugScopedSetImplThread m_implThread; OwnPtr<CCLayerImpl> m_rootLayer; - OwnPtr<CCRenderPass> m_rootRenderPass; - CCRenderPassList m_renderPasses; + CCRenderPassList m_renderPassesInDrawOrder; + CCRenderPassIdHashMap m_renderPasses; size_t m_memoryAllocationLimitBytes; }; @@ -222,7 +224,7 @@ TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); m_layerRendererChromium.setVisible(true); - m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect()); + m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses(), FloatRect()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); swapBuffers(); @@ -237,7 +239,7 @@ TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisibl EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); char pixels[4]; - m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect()); + m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses(), FloatRect()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); m_layerRendererChromium.getFramebufferPixels(pixels, IntRect(0, 0, 1, 1)); @@ -418,8 +420,7 @@ TEST(LayerRendererChromiumTest2, opaqueBackground) EXPECT_TRUE(layerRendererChromium.initialize()); - layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect()); - layerRendererChromium.finishDrawingFrame(); + layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses(), FloatRect()); // On DEBUG builds, render passes with opaque background clear to blue to // easily see regions that were not drawn on the screen. @@ -442,8 +443,7 @@ TEST(LayerRendererChromiumTest2, transparentBackground) EXPECT_TRUE(layerRendererChromium.initialize()); - layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect()); - layerRendererChromium.finishDrawingFrame(); + layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses(), FloatRect()); EXPECT_EQ(1, context->clearCount()); } diff --git a/Source/WebKit/chromium/tests/MemoryInfo.cpp b/Source/WebKit/chromium/tests/MemoryInfo.cpp new file mode 100644 index 000000000..0e093aee4 --- /dev/null +++ b/Source/WebKit/chromium/tests/MemoryInfo.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "MemoryInfo.h" + +#include <gtest/gtest.h> + +using namespace WebCore; + +namespace { + +TEST(MemoryInfo, quantizeMemorySize) +{ + EXPECT_EQ(10000000u, quantizeMemorySize(1024)); + EXPECT_EQ(10000000u, quantizeMemorySize(1024 * 1024)); + EXPECT_EQ(410000000u, quantizeMemorySize(389472983)); + EXPECT_EQ(39600000u, quantizeMemorySize(38947298)); + EXPECT_EQ(29400000u, quantizeMemorySize(28947298)); + EXPECT_EQ(19300000u, quantizeMemorySize(18947298)); + EXPECT_EQ(14300000u, quantizeMemorySize(13947298)); + EXPECT_EQ(10000000u, quantizeMemorySize(3894729)); + EXPECT_EQ(10000000u, quantizeMemorySize(389472)); + EXPECT_EQ(10000000u, quantizeMemorySize(38947)); + EXPECT_EQ(10000000u, quantizeMemorySize(3894)); + EXPECT_EQ(10000000u, quantizeMemorySize(389)); + EXPECT_EQ(10000000u, quantizeMemorySize(38)); + EXPECT_EQ(10000000u, quantizeMemorySize(3)); + EXPECT_EQ(10000000u, quantizeMemorySize(1)); + EXPECT_EQ(10000000u, quantizeMemorySize(0)); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 11bf115b5..e39fe7e56 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -35,6 +35,7 @@ #include "LayerPainterChromium.h" #include "WebCompositor.h" #include "cc/CCOverdrawMetrics.h" +#include "cc/CCRenderingStats.h" #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> @@ -94,6 +95,7 @@ public: OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; CCTextureUpdater m_updater; + CCRenderingStats m_stats; FakeTextureCopier m_copier; FakeTextureUploader m_uploader; CCPriorityCalculator m_priorityCalculator; @@ -116,7 +118,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -129,7 +131,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) // ....but then only update one of them. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); layer->pushPropertiesTo(layerImpl.get()); // We should only have the first tile since the other tile was invalidated but not painted. @@ -147,14 +149,13 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), &occluded, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -170,7 +171,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // ....but the area is occluded. occluded.setOcclusion(IntRect(0, 0, 50, 50)); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -198,7 +199,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -220,7 +221,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // This should recreate and update the deleted textures. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -249,7 +250,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); updateTextures(); // We should need idle-painting for 3x3 tiles in the center. @@ -265,7 +266,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -316,8 +317,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) layer2->setTexturePriorities(m_priorityCalculator); layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer1->updateContentRect(m_updater, layerRect, 0); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer1->updateContentRect(m_updater, layerRect, 0, m_stats); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); // We should need idle-painting for both remaining tiles in layer2. EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect)); @@ -334,7 +335,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) layer2->setTexturePriorities(m_priorityCalculator); layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); // Oh well, commit the frame and push. updateTextures(); @@ -354,8 +355,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) layer2->setTexturePriorities(m_priorityCalculator); layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer2->updateContentRect(m_updater, layer2Rect, 0); - layer1->updateContentRect(m_updater, layerRect, 0); + layer2->updateContentRect(m_updater, layer2Rect, 0, m_stats); + layer1->updateContentRect(m_updater, layerRect, 0, m_stats); updateTextures(); layer1->pushPropertiesTo(layerImpl1.get()); @@ -381,13 +382,12 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) occluded.setOcclusion(IntRect(0, 0, 100, 100)); layer->setBounds(IntSize(100, 100)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); layer->invalidateContentRect(IntRect(0, 0, 100, 100)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -412,7 +412,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -442,11 +442,11 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) layer2->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); // Invalidate a tile on layer1 layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); @@ -482,8 +482,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay // Invalidate a tile on layer2 layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); - layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); layer2->pushPropertiesTo(layer2Impl.get()); @@ -517,7 +517,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); // Idle-painting should see no more priority tiles for painting. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -530,7 +530,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); // We shouldn't signal we need another idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -559,7 +559,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) textureManager->prioritizeTextures(); // Empty layers don't paint or idle-paint. - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); // Empty layers don't have tiles. EXPECT_EQ(0u, layer->numPaintedTiles()); @@ -595,7 +595,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) // Paint / idle-paint. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); // Non-visible layers don't need idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -658,7 +658,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -671,7 +671,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -694,7 +694,7 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); layer->pushPropertiesTo(layerImpl.get()); @@ -705,7 +705,7 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) layer->fakeLayerTextureUpdater()->clearPrepareCount(); // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on // the LayerTextureUpdater. - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); @@ -713,12 +713,12 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect. layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); // The layer should still be invalid as updateContentRect invoked invalidate. - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -745,7 +745,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); updateTextures(); @@ -753,7 +753,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); updateTextures(); @@ -762,7 +762,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->invalidateContentRect(partialDamage); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } @@ -784,7 +784,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Push the tiles to the impl side and check that there is exactly one. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -801,7 +801,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // The impl side should get 2x2 tiles now. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 200, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 200, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -813,7 +813,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // impl side. layer->setNeedsDisplay(); layer->setTexturePriorities(m_priorityCalculator); - layer->updateContentRect(m_updater, IntRect(1, 0, 0, 1), 0); + layer->updateContentRect(m_updater, IntRect(1, 0, 0, 1), 0, m_stats); textureManager->prioritizeTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -885,7 +885,7 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0, m_stats); layer->setBounds(IntSize(200, 200)); layer->invalidateContentRect(IntRect(0, 0, 200, 200)); @@ -904,7 +904,7 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) // Ensure no crash for bounds where size * size would overflow an int. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0, m_stats); } TEST_F(TiledLayerChromiumTest, partialUpdates) @@ -1047,7 +1047,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); } @@ -1060,15 +1060,14 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1079,7 +1078,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) occluded.setOcclusion(IntRect(250, 200, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1090,7 +1089,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) occluded.setOcclusion(IntRect(250, 250, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1107,7 +1106,6 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); @@ -1116,7 +1114,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 360), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 360), &occluded, m_stats); EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1131,7 +1129,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 350), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 350), &occluded, m_stats); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1146,7 +1144,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 340), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 340), &occluded, m_stats); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1164,14 +1162,13 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); { DebugScopedSetImplThread implThread; @@ -1185,7 +1182,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1207,14 +1204,14 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform); occluded.setOcclusion(IntRect(100, 100, 150, 50)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1235,14 +1232,17 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // pixels, which means none should be occluded. layer->setContentsScale(0.5); layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + WebTransformationMatrix drawTransform; + drawTransform.scale(1 / layer->contentsScale()); + layer->setDrawTransform(drawTransform); + layer->setScreenSpaceTransform(drawTransform); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); // The content is half the size of the layer (so the number of tiles is fewer). // In this case, the content is 300x300, and since the tile size is 100, the // number of tiles 3x3. @@ -1258,11 +1258,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // a different layer space. In this case the occluded region catches the // blown up tiles. occluded.setOcclusion(IntRect(200, 200, 300, 200)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1275,14 +1275,14 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform); occluded.setOcclusion(IntRect(100, 100, 150, 100)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1306,7 +1306,6 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) IntRect visibleBounds = IntRect(0, 0, 100, 150); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); @@ -1316,7 +1315,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1329,7 +1328,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) opaquePaintRect = IntRect(10, 10, 90, 190); layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1342,7 +1341,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1357,7 +1356,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1372,7 +1371,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(10, 10, 1, 1)); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); @@ -1400,7 +1399,6 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) IntRect visibleBounds = IntRect(0, 0, 100, 300); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); @@ -1410,7 +1408,7 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) // Invalidates and paints the whole layer. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1425,7 +1423,7 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); layer->invalidateContentRect(IntRect(50, 200, 10, 10)); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1653,7 +1651,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1665,7 +1663,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. layer->invalidateContentRect(contentRect); - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } @@ -1688,7 +1686,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1700,7 +1698,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 33ce2f70c..3ca1094d0 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -254,7 +254,9 @@ TEST_F(WebViewTest, AutoResizeFixedHeightAndWidthOverflow) expectedWidth, expectedHeight, VisibleHorizontalScrollbar, NoVerticalScrollbar); } -TEST_F(WebViewTest, AutoResizeInBetweenSizes) +// Next three tests disabled for https://bugs.webkit.org/show_bug.cgi?id=92318 . +// It seems we can run three AutoResize tests, then the next one breaks. +TEST_F(WebViewTest, DISABLED_AutoResizeInBetweenSizes) { WebSize minAutoResize(90, 95); WebSize maxAutoResize(200, 300); @@ -266,7 +268,7 @@ TEST_F(WebViewTest, AutoResizeInBetweenSizes) expectedWidth, expectedHeight, NoHorizontalScrollbar, NoVerticalScrollbar); } -TEST_F(WebViewTest, AutoResizeOverflowSizes) +TEST_F(WebViewTest, DISABLED_AutoResizeOverflowSizes) { WebSize minAutoResize(90, 95); WebSize maxAutoResize(200, 300); @@ -278,7 +280,7 @@ TEST_F(WebViewTest, AutoResizeOverflowSizes) expectedWidth, expectedHeight, VisibleHorizontalScrollbar, VisibleVerticalScrollbar); } -TEST_F(WebViewTest, AutoResizeMaxSize) +TEST_F(WebViewTest, DISABLED_AutoResizeMaxSize) { WebSize minAutoResize(90, 95); WebSize maxAutoResize(200, 300); diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index fe2e6c56e..8e7f0e2e2 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,201 @@ +2012-07-29 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] TILED_BACKING_STORE support on Efl WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=91582 + + Reviewed by Noam Rosenthal. + + Add a dummy function for fixing building error when enabling TILED_BACKING_STORE. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore): + (WebCore::ChromeClientEfl::delegatedScrollRequested): + * WebCoreSupport/ChromeClientEfl.h: + (ChromeClientEfl): + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Regression(r123858): Default navigation policy decision was switched to "reject" + https://bugs.webkit.org/show_bug.cgi?id=92507 + + Reviewed by Kentaro Hara. + + After r92466, the default navigation policy is to reject the request if the + client does not make a decision explicitly. The default policy should be + to accept. This broke ewk_view unit tests. + + * ewk/ewk_view.cpp: + (ewk_view_navigation_policy_decision): + +2012-07-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Fix wrong return value in EWK_VIEW_XXX macro. + https://bugs.webkit.org/show_bug.cgi?id=92466 + + Reviewed by Simon Hausmann. + + There are wrong return values in EWK_VIEW_XXX macros. The wrong return values + should be fixed. In addition, API description is also modified according to returned + value change. + + * ewk/ewk_view.cpp: + (ewk_view_setting_minimum_timer_interval_get): + (ewk_view_navigation_policy_decision): + (ewk_view_page_rect_get): + (ewk_view_setting_enable_xss_auditor_get): + * ewk/ewk_view.h: + +2012-07-27 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Change prototype of run_open_panel + https://bugs.webkit.org/show_bug.cgi?id=91956 + + Reviewed by Kentaro Hara. + + In order to support all of the file chooser attributes, + change the types of parameters in run_open_panel method. + i.e., change "Eina_Bool allows_multiple_files, Eina_List *accept_types" + to "Ewk_File_Chooser *file_chooser" + In addition, Efl can support the capture attribute for HTML media capture. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::runOpenPanel): + * ewk/ewk_view.cpp: + (ewk_view_run_open_panel): + * ewk/ewk_view.h: + * ewk/ewk_view_private.h: + +2012-07-26 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL] Highlight the element under mouse on web inspector + https://bugs.webkit.org/show_bug.cgi?id=91592 + + Reviewed by Kentaro Hara. + + Implement highlighting the nodes when using the web inspector. + + * WebCoreSupport/InspectorClientEfl.cpp: + (WebCore::InspectorClientEfl::highlight): + (WebCore::InspectorClientEfl::hideHighlight): + (WebCore::InspectorClientEfl::invalidateView): + (WebCore): + * WebCoreSupport/InspectorClientEfl.h: + (InspectorClientEfl): + * ewk/ewk_paint_context.cpp: + (ewk_paint_context_paint_contents): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + Make NetworkInfoClientEfl use NetworkInfoProviderEfl + from WebCore to avoid code duplication with WebKit2. + + * WebCoreSupport/NetworkInfoClientEfl.cpp: + (WebCore::NetworkInfoClientEfl::startUpdating): + (WebCore::NetworkInfoClientEfl::stopUpdating): + (WebCore::NetworkInfoClientEfl::bandwidth): + (WebCore::NetworkInfoClientEfl::metered): + (WebCore): + * WebCoreSupport/NetworkInfoClientEfl.h: + (WebCore): + (NetworkInfoClientEfl): + +2012-07-26 Zoltan Nyul <zoltan.nyul@intel.com> + + [EFL] EFL port should use XDG paths + https://bugs.webkit.org/show_bug.cgi?id=91719 + + Reviewed by Kenneth Rohde Christiansen. + + Using xdg paths instead of home/.webkit directory for application + cache, web-database and local-storage. + + * ewk/ewk_main.cpp: + (_ewk_init_body): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + +2012-07-25 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Use eina_stringshare_add instead of strdup. + https://bugs.webkit.org/show_bug.cgi?id=92072 + + Reviewed by Kentaro Hara. + + Eina of EFL libraries supports a string functionality that replaces strdup. So, EFL port needs + to replace strdup with eina_stringshare_add function. + + In addition, some API descriptions need to be modified according to ewk APIs's parameter and + return type change. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::runJavaScriptPrompt): + * ewk/ewk_cookies.cpp: + (ewk_cookies_get_all): + (ewk_cookies_cookie_free): + * ewk/ewk_cookies.h: + * ewk/ewk_frame.cpp: + (ewk_frame_script_execute): + (ewk_frame_selection_get): + (ewk_frame_resources_location_get): + (ewk_frame_plain_text_get): + * ewk/ewk_frame.h: + * ewk/ewk_intent.cpp: + (ewk_intent_suggestions_get): + (ewk_intent_extra_get): + (ewk_intent_extra_names_get): + * ewk/ewk_intent.h: + * ewk/ewk_js.cpp: + (ewk_js_variant_to_npvariant): + (ewk_js_object_new): + * ewk/ewk_view.cpp: + (_ewk_view_smart_run_javascript_prompt): + (ewk_view_selection_get): + (ewk_view_run_javascript_prompt): + (ewk_view_run_open_panel): + * ewk/ewk_view.h: + * ewk/ewk_view_private.h: + +2012-07-25 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Add File Chooser API + https://bugs.webkit.org/show_bug.cgi?id=91957 + + Reviewed by Hajime Morita. + + Add APIs for file chooser. These APIs allow an application(like a browser) queries informations + about multiple files allowed, directory upload allowed, accept mimetypes list, + accept file extentions list, selected files list and capture to support HTML media capture. + + * ewk/EWebKit.h: + * ewk/ewk_file_chooser.cpp: Added. + (_Ewk_File_Chooser): + (ewk_file_chooser_allows_multiple_files_get): + (ewk_file_chooser_allows_directory_upload_get): + (ewk_file_chooser_accept_mimetypes_get): + (ewk_file_chooser_accept_file_extentions_get): + (ewk_file_chooser_selected_files_get): + (ewk_file_chooser_capture_get): + (ewk_file_chooser_new): + (ewk_file_chooser_free): + * ewk/ewk_file_chooser.h: Added. + * ewk/ewk_file_chooser_private.h: Added. + (WebCore): + 2012-07-23 Pierre Rossi <pierre.rossi@gmail.com> Unify numTouchEventHandlersChanged and needTouchEvents in the chrome client diff --git a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp index 6a859053e..3b327ed78 100644 --- a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp @@ -53,6 +53,7 @@ #include "ViewportArguments.h" #include "WindowFeatures.h" #include "ewk_custom_handler_private.h" +#include "ewk_file_chooser_private.h" #include "ewk_frame_private.h" #include "ewk_private.h" #include "ewk_security_origin_private.h" @@ -294,11 +295,11 @@ bool ChromeClientEfl::runJavaScriptConfirm(Frame* frame, const String& message) bool ChromeClientEfl::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result) { - char* value = 0; + const char* value = 0; ewk_view_run_javascript_prompt(m_view, kit(frame), message.utf8().data(), defaultValue.utf8().data(), &value); if (value) { result = String::fromUTF8(value); - free(value); + eina_stringshare_del(value); return true; } return false; @@ -474,17 +475,16 @@ void ChromeClientEfl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFile { RefPtr<FileChooser> chooser = prpFileChooser; Eina_List* selectedFilenames = 0; - void* filename; - Vector<String> filenames; - - const FileChooserSettings& settings = chooser->settings(); - bool confirm = ewk_view_run_open_panel(m_view, kit(frame), settings.allowsMultipleFiles, settings.acceptMIMETypes, &selectedFilenames); - + Ewk_File_Chooser* fileChooser = ewk_file_chooser_new(chooser.get()); + bool confirm = ewk_view_run_open_panel(m_view, kit(frame), fileChooser, &selectedFilenames); + ewk_file_chooser_free(fileChooser); if (!confirm) return; + void* filename; + Vector<String> filenames; EINA_LIST_FREE(selectedFilenames, filename) { - filenames.append((char*)filename); + filenames.append(String::fromUTF8(static_cast<char*>(filename))); free(filename); } @@ -650,4 +650,11 @@ void ChromeClientEfl::exitFullScreenForElement(WebCore::Element*) } #endif +#if USE(TILED_BACKING_STORE) +void ChromeClientEfl::delegatedScrollRequested(const IntPoint& point) +{ + notImplemented(); +} +#endif + } diff --git a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h index 3cfc678ec..267f5af47 100644 --- a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h @@ -180,6 +180,10 @@ public: virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; } virtual void numWheelEventHandlersChanged(unsigned) { } +#if USE(TILED_BACKING_STORE) + virtual void delegatedScrollRequested(const IntPoint& scrollPoint); +#endif + Evas_Object* m_view; KURL m_hoveredLinkURL; #if ENABLE(FULLSCREEN_API) diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index bc0dc61be..4b804dd62 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -173,21 +173,6 @@ int DumpRenderTreeSupportEfl::numberOfPages(const Evas_Object* ewkFrame, float p return WebCore::PrintContext::numberOfPages(frame, WebCore::FloatSize(pageWidth, pageHeight)); } -int DumpRenderTreeSupportEfl::numberOfPagesForElementId(const Evas_Object* ewkFrame, const char* elementId, float pageWidth, float pageHeight) -{ - WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame); - - if (!frame) - return 0; - - WebCore::Element *element = frame->document()->getElementById(elementId); - - if (!element) - return 0; - - return WebCore::PrintContext::pageNumberForElement(element, WebCore::FloatSize(pageWidth, pageHeight)); -} - String DumpRenderTreeSupportEfl::pageSizeAndMarginsInPixels(const Evas_Object* ewkFrame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) { WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame); diff --git a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp index bdc96e18d..b82039756 100644 --- a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp @@ -37,6 +37,17 @@ static void notifyWebInspectorDestroy(void* userData, Evas_Object* webview, void inspectorFrontendClient->destroyInspectorWindow(true); } +static void invalidateView(Evas_Object* webView) +{ + Evas_Coord width, height; + Evas_Object* mainFrame = ewk_view_frame_main_get(webView); + if (mainFrame && ewk_frame_contents_size_get(mainFrame, &width, &height)) { + WebCore::Page* page = EWKPrivate::corePage(webView); + if (page) + page->mainFrame()->view()->invalidateRect(WebCore::IntRect(0, 0, width, height)); + } +} + class InspectorFrontendSettingsEfl : public InspectorFrontendClientLocal::Settings { public: virtual String getProperty(const String& name) @@ -107,12 +118,12 @@ void InspectorClientEfl::bringFrontendToFront() void InspectorClientEfl::highlight() { - notImplemented(); + invalidateView(m_inspectedView); } void InspectorClientEfl::hideHighlight() { - notImplemented(); + invalidateView(m_inspectedView); } bool InspectorClientEfl::sendMessageToFrontend(const String& message) diff --git a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp index 67e9c16bd..7a7c1c914 100644 --- a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp @@ -29,22 +29,12 @@ #include "NetworkInfoClientEfl.h" #if ENABLE(NETWORK_INFO) -#include "NetworkInfo.h" -#include "NotImplemented.h" -#include "ewk_private.h" -#include <Eeze.h> -#include <Eeze_Net.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> +#include "NotImplemented.h" namespace WebCore { -static const char* ethernetInterface = "eth0"; - NetworkInfoClientEfl::NetworkInfoClientEfl() - : m_controller(0) - , m_metered(false) { } @@ -54,52 +44,26 @@ NetworkInfoClientEfl::~NetworkInfoClientEfl() void NetworkInfoClientEfl::startUpdating() { - if (!eeze_init()) { - ERR("Fail to start network information client."); - return; - } + m_provider.startUpdating(); } void NetworkInfoClientEfl::stopUpdating() { - eeze_shutdown(); + m_provider.stopUpdating(); } double NetworkInfoClientEfl::bandwidth() const { - // FIXME : This function should consider cellular network as well. For example, 2G, 3G and 4G. - // See https://bugs.webkit.org/show_bug.cgi?id=89851 for detail. - Eeze_Net* ethNet = eeze_net_new(ethernetInterface); - if (!ethNet) - return 0; - - eeze_net_scan(ethNet); - - // FIXME : The eeze library doesn't support EEZE_NET_ADDR_TYPE_IP type yet. So, EEZE_NET_ADDR_TYPE_BROADCAST - // is used for now. - // See https://bugs.webkit.org/show_bug.cgi?id=89852 for detail. - const char* address = eeze_net_addr_get(ethNet, EEZE_NET_ADDR_TYPE_BROADCAST); - if (!address) - return 0; // If network is offline, return 0. - - double bandwidth; - const char* attribute = eeze_net_attribute_get(ethNet, "speed"); - if (attribute) { - bool ok; - bandwidth = String::fromUTF8(attribute).toUIntStrict(&ok); - } else - bandwidth = std::numeric_limits<double>::infinity(); // If bandwidth is unknown, return infinity value. - - eeze_net_free(ethNet); - - return bandwidth / 8; // MB/s + return m_provider.bandwidth(); } bool NetworkInfoClientEfl::metered() const { notImplemented(); - return m_metered; -} + return false; } + +} // namespace WebCore + #endif diff --git a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h index 20e8ab756..6908737d1 100644 --- a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h @@ -31,10 +31,11 @@ #if ENABLE(NETWORK_INFO) -#include "NetworkInfoClient.h" -#include "NetworkInfoController.h" +#include <NetworkInfoClient.h> +#include <NetworkInfoProviderEfl.h> namespace WebCore { + class NetworkInfoClientEfl : public WebCore::NetworkInfoClient { public: NetworkInfoClientEfl(); @@ -47,11 +48,10 @@ public: virtual bool metered() const; private: - NetworkInfoController* m_controller; - - bool m_metered; + WebCore::NetworkInfoProviderEfl m_provider; }; -} + +} // namespace WebCore #endif #endif // NetworkInfoClientEfl_h diff --git a/Source/WebKit/efl/ewk/EWebKit.h b/Source/WebKit/efl/ewk/EWebKit.h index f90860373..7c91c3c9a 100644 --- a/Source/WebKit/efl/ewk/EWebKit.h +++ b/Source/WebKit/efl/ewk/EWebKit.h @@ -32,6 +32,7 @@ #include "ewk_auth.h" #include "ewk_contextmenu.h" #include "ewk_cookies.h" +#include "ewk_file_chooser.h" #include "ewk_frame.h" #include "ewk_history.h" #include "ewk_intent.h" diff --git a/Source/WebKit/efl/ewk/ewk_cookies.cpp b/Source/WebKit/efl/ewk/ewk_cookies.cpp index 546651390..bbee8e49d 100644 --- a/Source/WebKit/efl/ewk/ewk_cookies.cpp +++ b/Source/WebKit/efl/ewk/ewk_cookies.cpp @@ -77,10 +77,10 @@ Eina_List* ewk_cookies_get_all(void) for (p = list; p; p = p->next) { SoupCookie* cookie = static_cast<SoupCookie*>(p->data); Ewk_Cookie* ewkCookie = new Ewk_Cookie; - ewkCookie->name = strdup(cookie->name); - ewkCookie->value = strdup(cookie->value); - ewkCookie->domain = strdup(cookie->domain); - ewkCookie->path = strdup(cookie->path); + ewkCookie->name = eina_stringshare_add(cookie->name); + ewkCookie->value = eina_stringshare_add(cookie->value); + ewkCookie->domain = eina_stringshare_add(cookie->domain); + ewkCookie->path = eina_stringshare_add(cookie->path); ewkCookie->expires = soup_date_to_time_t(cookie->expires); ewkCookie->secure = static_cast<Eina_Bool>(cookie->secure); ewkCookie->http_only = static_cast<Eina_Bool>(cookie->http_only); @@ -117,10 +117,10 @@ void ewk_cookies_cookie_del(Ewk_Cookie* cookie) void ewk_cookies_cookie_free(Ewk_Cookie* cookie) { EINA_SAFETY_ON_NULL_RETURN(cookie); - free(cookie->name); - free(cookie->value); - free(cookie->domain); - free(cookie->path); + eina_stringshare_del(cookie->name); + eina_stringshare_del(cookie->value); + eina_stringshare_del(cookie->domain); + eina_stringshare_del(cookie->path); delete cookie; } diff --git a/Source/WebKit/efl/ewk/ewk_cookies.h b/Source/WebKit/efl/ewk/ewk_cookies.h index 939ed3da1..dba0ebe13 100644 --- a/Source/WebKit/efl/ewk/ewk_cookies.h +++ b/Source/WebKit/efl/ewk/ewk_cookies.h @@ -42,16 +42,19 @@ extern "C" { * \struct _Ewk_Cookie * * @brief Describes properties of an HTTP cookie. + * + * All the strings are guaranteed to be stringshared, so use eina_stringshare_ref() + * instead of eina_stringshare_add() or strdup(). */ struct _Ewk_Cookie { /// the cookie name - char *name; + const char *name; /// the cookie value - char *value; + const char *value; /// the "domain" attribute, or else the hostname that the cookie came from - char *domain; + const char *domain; /// the "path" attribute, or @c NULL - char *path; + const char *path; /// the cookie expiration time, or @c 0 for a session cookie time_t expires; /// @c EINA_TRUE if the cookie should only be tranferred over SSL diff --git a/Source/WebKit/efl/ewk/ewk_file_chooser.cpp b/Source/WebKit/efl/ewk/ewk_file_chooser.cpp new file mode 100644 index 000000000..686bdc542 --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_file_chooser.cpp @@ -0,0 +1,117 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "ewk_file_chooser.h" + +#include "FileChooser.h" +#include "ewk_file_chooser_private.h" +#include <wtf/text/CString.h> + +struct _Ewk_File_Chooser { + RefPtr<WebCore::FileChooser> fileChooser; +}; + +Eina_Bool ewk_file_chooser_allows_multiple_files_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, false); + return chooser->fileChooser->settings().allowsMultipleFiles; +} + +Eina_Bool ewk_file_chooser_allows_directory_upload_get(const Ewk_File_Chooser* chooser) +{ +#if ENABLE(DIRECTORY_UPLOAD) + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, false); + return chooser->fileChooser->settings().allowsDirectoryUpload; +#else + return false; +#endif +} + +Eina_List* ewk_file_chooser_accept_mimetypes_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, 0); + + Eina_List* mimetypes = 0; + size_t count = chooser->fileChooser->settings().acceptMIMETypes.size(); + for (size_t i = 0; i < count; ++i) + mimetypes = eina_list_append(mimetypes, eina_stringshare_add(chooser->fileChooser->settings().acceptMIMETypes[i].utf8().data())); + + return mimetypes; +} + +Eina_List* ewk_file_chooser_accept_file_extentions_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, 0); + + Eina_List* fileExtentions = 0; + size_t count = chooser->fileChooser->settings().acceptFileExtensions.size(); + for (size_t i = 0; i < count; ++i) + fileExtentions = eina_list_append(fileExtentions, eina_stringshare_add(chooser->fileChooser->settings().acceptFileExtensions[i].utf8().data())); + + return fileExtentions; +} + +Eina_List* ewk_file_chooser_selected_files_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, 0); + + Eina_List* files = 0; + size_t count = chooser->fileChooser->settings().selectedFiles.size(); + for (size_t i = 0; i < count; ++i) + files = eina_list_append(files, eina_stringshare_add(chooser->fileChooser->settings().selectedFiles[i].utf8().data())); + + return files; +} + +Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser* chooser) +{ +#if ENABLE(MEDIA_CAPTURE) + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID); + + String capture = chooser->fileChooser->settings().capture; + + if (capture == "camera") + return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA; + + if (capture == "camcorder") + return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER; + + if (capture == "microphone") + return EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE; + + return EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM; +#else + return EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID; +#endif +} + +Ewk_File_Chooser* ewk_file_chooser_new(WebCore::FileChooser* fileChooser) +{ + Ewk_File_Chooser* ewkFileChooser = new Ewk_File_Chooser; + ewkFileChooser->fileChooser = fileChooser; + return ewkFileChooser; +} + +void ewk_file_chooser_free(Ewk_File_Chooser* chooser) +{ + chooser->fileChooser = 0; + delete chooser; +} + diff --git a/Source/WebKit/efl/ewk/ewk_file_chooser.h b/Source/WebKit/efl/ewk/ewk_file_chooser.h new file mode 100644 index 000000000..c4590d4dd --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_file_chooser.h @@ -0,0 +1,132 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file ewk_file_chooser.h + * @brief File Chooser API. + * + * File Chooser supports APIs for file selection dialog. + * This support attributes of file chooser regarding: + * - allowance of multiple files selection + * - allowance of upload directory + * - list of accepted mime types + * - list of accepted file extensions + * - list of initial selected file names + * - capture attribute for HTML media capture + */ + +#ifndef ewk_file_chooser_h +#define ewk_file_chooser_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_File_Chooser Ewk_File_Chooser; + +/** + * \enum _Ewk_File_Chooser_Capture_Type + * @brief Types of capture attribute of file chooser to support the HTML media capture. + */ +enum _Ewk_File_Chooser_Capture_Type { + EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID, + EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM, + EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA, + EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER, + EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE +}; +typedef enum _Ewk_File_Chooser_Capture_Type Ewk_File_Chooser_Capture_Type; + +/** + * Query if multiple files are supported by file chooser. + * + * @param f file chooser object. + * + * It returns a boolean value which indicates if multiple file is supported or not. + * + * @return @c EINA_TRUE on support multiple files or @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_file_chooser_allows_multiple_files_get(const Ewk_File_Chooser *f); + +/** + * Query if directory upload is supported by file chooser. + * + * @param f file chooser object. + * + * It returns a boolean value which indicates if directory upload is supported or not. + * + * @return @c EINA_TRUE on support directory upload or @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_file_chooser_allows_directory_upload_get(const Ewk_File_Chooser *f); + +/** + * Returns the list of accepted mimetypes of the file chooser. + * + * @param f file chooser object. + * + * @return Eina_List of accepted mimetypes on success, or @c NULL on failure, + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. + */ +EAPI Eina_List *ewk_file_chooser_accept_mimetypes_get(const Ewk_File_Chooser *f); + +/** + * Returns the list of accepted file extensions of the file chooser. + * + * @param f file chooser object. + * + * @return @c Eina_List of accepted file extensions on success, or @c NULL on failure, + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. + */ +EAPI Eina_List *ewk_file_chooser_accept_file_extentions_get(const Ewk_File_Chooser *f); + +/** + * Returns the list of selected file names of the file chooser. + * + * This list indicates previously selected file names of the file chooser. + * These can be used by initial values of the file dialog. + * + * @param f file chooser object. + * + * @return @c Eina_List of selected file names on success, or @c NULL on failure, + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. + */ +EAPI Eina_List *ewk_file_chooser_selected_files_get(const Ewk_File_Chooser *f); + +/** + * Returns the capture attribute of the file chooser to support HTML media capture. + * + * @see http://www.w3.org/TR/html-media-capture/ for the semantics of the capture attribute. + * + * @param f file chooser object. + * + * @return @c Ewk_File_Chooser_Capture_Type on supporting HTML media capture or + * @c EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID on failure. + */ +EAPI Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser *f); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_file_chooser_h diff --git a/Source/WebKit/efl/ewk/ewk_file_chooser_private.h b/Source/WebKit/efl/ewk/ewk_file_chooser_private.h new file mode 100644 index 000000000..519e54ae1 --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_file_chooser_private.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef ewk_file_chooser_private_h +#define ewk_file_chooser_private_h + +namespace WebCore { +class FileChooser; +} + +Ewk_File_Chooser* ewk_file_chooser_new(WebCore::FileChooser* fileChooser); +void ewk_file_chooser_free(Ewk_File_Chooser* chooser); + +#endif // ewk_file_chooser_private_h + diff --git a/Source/WebKit/efl/ewk/ewk_frame.cpp b/Source/WebKit/efl/ewk/ewk_frame.cpp index 6a4b1a3f2..fba460ec0 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.cpp +++ b/Source/WebKit/efl/ewk/ewk_frame.cpp @@ -439,7 +439,7 @@ Eina_Bool ewk_frame_contents_alternate_set(Evas_Object* ewkFrame, const char* co unreachableUri); } -char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) +const char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); @@ -458,7 +458,7 @@ char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) JSC::ExecState* exec = smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec(); JSC::JSLockHolder lock(exec); resultString = WebCore::ustringToString(result.toString(exec)->value(exec)); - return strdup(resultString.utf8().data()); + return eina_stringshare_add(resultString.utf8().data()); #else notImplemented(); return 0; @@ -485,14 +485,14 @@ Eina_Bool ewk_frame_editable_set(Evas_Object* ewkFrame, Eina_Bool editable) return true; } -char* ewk_frame_selection_get(const Evas_Object* ewkFrame) +const char* ewk_frame_selection_get(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); WTF::CString selectedText = smartData->frame->editor()->selectedText().utf8(); if (selectedText.isNull()) return 0; - return strdup(selectedText.data()); + return eina_stringshare_add(selectedText.data()); } Eina_Bool ewk_frame_text_search(const Evas_Object* ewkFrame, const char* text, Eina_Bool caseSensitive, Eina_Bool forward, Eina_Bool wrap) @@ -1736,7 +1736,7 @@ Eina_List* ewk_frame_resources_location_get(const Evas_Object* ewkFrame) if (found) continue; - char* imageLocationCopy = strdup(imageLocation.utf8().data()); + const char* imageLocationCopy = eina_stringshare_add(imageLocation.utf8().data()); if (!imageLocationCopy) goto out_of_memory_handler; listOfImagesLocation = eina_list_append(listOfImagesLocation, imageLocationCopy); @@ -1754,7 +1754,7 @@ out_of_memory_handler: return 0; } -char* ewk_frame_plain_text_get(const Evas_Object* ewkFrame) +const char* ewk_frame_plain_text_get(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); @@ -1767,7 +1767,7 @@ char* ewk_frame_plain_text_get(const Evas_Object* ewkFrame) if (!documentElement) return 0; - return strdup(documentElement->innerText().utf8().data()); + return eina_stringshare_add(documentElement->innerText().utf8().data()); } Eina_Bool ewk_frame_mixed_content_displayed_get(const Evas_Object* ewkFrame) diff --git a/Source/WebKit/efl/ewk/ewk_frame.h b/Source/WebKit/efl/ewk/ewk_frame.h index 4498a4363..b196332f2 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.h +++ b/Source/WebKit/efl/ewk/ewk_frame.h @@ -446,14 +446,14 @@ EAPI Eina_Bool ewk_frame_contents_alternate_set(Evas_Object *o, const char *c /** * Requests execution of the given script. * - * The returned string @b should be freed after use. + * The returned string @b should be freed by eina_stringshare_del() after use. * * @param o frame object to execute script * @param script Java Script to execute * * @return newly allocated string for result or @c NULL if the result cannot be converted to string or failure */ -EAPI char *ewk_frame_script_execute(Evas_Object *o, const char *script); +EAPI const char *ewk_frame_script_execute(Evas_Object *o, const char *script); /** * Queries if the frame is editable. @@ -477,13 +477,13 @@ EAPI Eina_Bool ewk_frame_editable_set(Evas_Object *o, Eina_Bool editable); /** * Gets the copy of the selected text. * - * The returned string @b should be freed after use. + * The returned string @b should be freed by eina_stringshare_del() after use. * * @param o the frame object to get selected text * * @return a newly allocated string or @c NULL if nothing is selected or on failure */ -EAPI char *ewk_frame_selection_get(const Evas_Object *o); +EAPI const char *ewk_frame_selection_get(const Evas_Object *o); /** * Searches the given string in a document. @@ -968,12 +968,14 @@ EAPI Eina_List *ewk_frame_resources_location_get(const Evas_Object *o); * This function returns the contents of the given frame converted to plain text, * removing all the HTML formatting. * + * The returned string @b should be freed by eina_stringshare_del() after use. + * * @param ewkFrame Frame object whose contents to retrieve. * * @return A newly allocated string (which must be freed by the caller with @c free()) * or @c NULL in case of failure. */ -EAPI char *ewk_frame_plain_text_get(const Evas_Object *o); +EAPI const char *ewk_frame_plain_text_get(const Evas_Object *o); /** * Returns whether the frame has displayed mixed content. diff --git a/Source/WebKit/efl/ewk/ewk_intent.cpp b/Source/WebKit/efl/ewk/ewk_intent.cpp index ef7914186..76c2d68da 100644 --- a/Source/WebKit/efl/ewk/ewk_intent.cpp +++ b/Source/WebKit/efl/ewk/ewk_intent.cpp @@ -106,21 +106,21 @@ Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent) Eina_List* listOfSuggestions = 0; Vector<WebCore::KURL>::const_iterator it; for (it = core->suggestions().begin(); it != core->suggestions().end(); ++it) - listOfSuggestions = eina_list_append(listOfSuggestions, strdup(it->string().utf8().data())); + listOfSuggestions = eina_list_append(listOfSuggestions, eina_stringshare_add(it->string().utf8().data())); return listOfSuggestions; #else return 0; #endif } -char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) +const char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) { #if ENABLE(WEB_INTENTS) EWK_INTENT_CORE_GET_OR_RETURN(intent, core, 0); WTF::HashMap<String, String>::const_iterator val = core->extras().find(String::fromUTF8(key)); if (val == core->extras().end()) return 0; - return strdup(val->second.utf8().data()); + return eina_stringshare_add(val->second.utf8().data()); #else return 0; #endif @@ -133,7 +133,7 @@ Eina_List* ewk_intent_extra_names_get(const Ewk_Intent* intent) Eina_List* listOfNames = 0; WTF::HashMap<String, String>::const_iterator::Keys it = core->extras().begin().keys(); for (; it != core->extras().end().keys(); ++it) - listOfNames = eina_list_append(listOfNames, strdup(it->utf8().data())); + listOfNames = eina_list_append(listOfNames, eina_stringshare_add(it->utf8().data())); return listOfNames; #else return 0; diff --git a/Source/WebKit/efl/ewk/ewk_intent.h b/Source/WebKit/efl/ewk/ewk_intent.h index f49a76dc4..2b779cddc 100644 --- a/Source/WebKit/efl/ewk/ewk_intent.h +++ b/Source/WebKit/efl/ewk/ewk_intent.h @@ -85,12 +85,14 @@ EAPI Eina_List *ewk_intent_suggestions_get(const Ewk_Intent *intent); /** * Retrieves the value (if any) from the extra data dictionary this intent was constructed with. * + * The returned string should be freed by eina_stringshare_del() after use. + * * @param intent intent item to query. * @param key key to query in the dictionary. * * @return a newly allocated string or @c NULL in case of error or if the key does not exist. */ -EAPI char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); +EAPI const char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); /** * Retrieve a list of the names of extra metadata associated with the intent. @@ -98,8 +100,8 @@ EAPI char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); * @param intent intent item to query. * * @return @c Eina_List with names of extra metadata on success, or @c NULL on failure, - * the Eina_List and its items should be freed after use. Use free() to free the - * items. + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. */ EAPI Eina_List *ewk_intent_extra_names_get(const Ewk_Intent *intent); diff --git a/Source/WebKit/efl/ewk/ewk_js.cpp b/Source/WebKit/efl/ewk/ewk_js.cpp index f08f98e15..0cbb18952 100644 --- a/Source/WebKit/efl/ewk/ewk_js.cpp +++ b/Source/WebKit/efl/ewk/ewk_js.cpp @@ -64,7 +64,7 @@ static Eina_Bool ewk_js_variant_to_npvariant(const Ewk_JS_Variant* data, NPVaria DOUBLE_TO_NPVARIANT(data->value.d, *result); break; case EWK_JS_VARIANT_STRING: - string_value = strdup(data->value.s); + string_value = eina_stringshare_add(data->value.s); if (string_value) STRINGZ_TO_NPVARIANT(string_value, *result); else @@ -569,7 +569,7 @@ Ewk_JS_Object* ewk_js_object_new(const Ewk_JS_Class_Meta* jsMetaClass) value->value.o = 0; break; case EWK_JS_VARIANT_STRING: - value->value.s = strdup(prop.value.value.s); + value->value.s = eina_stringshare_add(prop.value.value.s); break; case EWK_JS_VARIANT_BOOL: value->value.b = prop.value.value.b; diff --git a/Source/WebKit/efl/ewk/ewk_main.cpp b/Source/WebKit/efl/ewk/ewk_main.cpp index b48c28a6b..c2ccc6a6d 100644 --- a/Source/WebKit/efl/ewk/ewk_main.cpp +++ b/Source/WebKit/efl/ewk/ewk_main.cpp @@ -39,6 +39,7 @@ #include <Ecore.h> #include <Ecore_Evas.h> #include <Edje.h> +#include <Efreet.h> #include <Eina.h> #include <Evas.h> #include <glib-object.h> @@ -159,23 +160,17 @@ Eina_Bool _ewk_init_body(void) ewk_settings_page_cache_capacity_set(3); WebCore::PageGroup::setShouldTrackVisitedLinks(true); - String home = WebCore::homeDirectoryPath(); - struct stat state; - // check home directory first - if (stat(home.utf8().data(), &state) == -1) { - // Exit now - otherwise you may have some crash later - int errnowas = errno; - CRITICAL("Can't access HOME dir (or /tmp) - no place to save databases: %s", strerror(errnowas)); - return false; - } + String localStorageDirectory = String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/LocalStorage"; + String webDatabaseDirectory = String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl/Databases"; + String applicationCacheDirectory = String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl/Applications"; - WTF::String webkitDirectory = home + "/.webkit"; - if (WebCore::makeAllDirectories(webkitDirectory)) - ewk_settings_web_database_path_set(webkitDirectory.utf8().data()); + ewk_settings_local_storage_path_set(localStorageDirectory.utf8().data()); + ewk_settings_web_database_path_set(webDatabaseDirectory.utf8().data()); + ewk_settings_application_cache_path_set(applicationCacheDirectory.utf8().data()); ewk_network_tls_certificate_check_set(false); - WebCore::StorageTracker::initializeTracker(webkitDirectory.utf8().data(), trackerClient()); + WebCore::StorageTracker::initializeTracker(localStorageDirectory.utf8().data(), trackerClient()); SoupSession* session = WebCore::ResourceHandle::defaultSession(); SoupSessionFeature* auth_dialog = static_cast<SoupSessionFeature*>(g_object_new(EWK_TYPE_SOUP_AUTH_DIALOG, 0)); diff --git a/Source/WebKit/efl/ewk/ewk_paint_context.cpp b/Source/WebKit/efl/ewk/ewk_paint_context.cpp index 9557f0323..bdbd899bc 100644 --- a/Source/WebKit/efl/ewk/ewk_paint_context.cpp +++ b/Source/WebKit/efl/ewk/ewk_paint_context.cpp @@ -23,6 +23,11 @@ #include "ewk_paint_context_private.h" #include "ewk_private.h" +#if ENABLE(INSPECTOR) +#include "InspectorController.h" +#include "Page.h" +#endif + Ewk_Paint_Context* ewk_paint_context_new(cairo_t* cairo) { EINA_SAFETY_ON_NULL_RETURN_VAL(cairo, 0); @@ -169,4 +174,13 @@ void ewk_paint_context_paint_contents(Ewk_Paint_Context* context, WebCore::Frame if (view->isTransparent()) context->graphicContext->clearRect(paintArea); view->paintContents(context->graphicContext.get(), paintArea); + +#if ENABLE(INSPECTOR) + WebCore::Page* page = view->frame()->page(); + if (page) { + WebCore::InspectorController* controller = page->inspectorController(); + if (controller->highlightedNode()) + controller->drawHighlight(*context->graphicContext); + } +#endif } diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index dc8ac88ba..5309181b3 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -633,9 +633,9 @@ static Eina_Bool _ewk_view_smart_should_interrupt_javascript(Ewk_View_Smart_Data return false; } -static Eina_Bool _ewk_view_smart_run_javascript_prompt(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* message, const char* defaultValue, char** value) +static Eina_Bool _ewk_view_smart_run_javascript_prompt(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* message, const char* defaultValue, const char** value) { - *value = strdup("test"); + *value = eina_stringshare_add("test"); Eina_Bool result = true; INF("javascript prompt:\n" "\t message: %s\n" @@ -1585,14 +1585,14 @@ Eina_Bool ewk_view_editable_set(Evas_Object* ewkView, Eina_Bool editable) return ewk_frame_editable_set(smartData->main_frame, editable); } -char* ewk_view_selection_get(const Evas_Object* ewkView) +const char* ewk_view_selection_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); CString selectedString = priv->page->focusController()->focusedOrMainFrame()->editor()->selectedText().utf8(); if (selectedString.isNull()) return 0; - return strdup(selectedString.data()); + return eina_stringshare_add(selectedString.data()); } Eina_Bool ewk_view_editor_command_execute(const Evas_Object* ewkView, const Ewk_Editor_Command command, const char* value) @@ -2614,8 +2614,8 @@ Eina_Bool ewk_view_setting_minimum_timer_interval_set(Evas_Object* ewkView, doub double ewk_view_setting_minimum_timer_interval_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); return priv->settings.domTimerInterval; } @@ -3481,7 +3481,7 @@ bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, Evas_Object* frame, c return smartData->api->run_javascript_confirm(smartData, frame, message); } -bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, char** value) +bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, const char** value) { DBG("ewkView=%p frame=%p message=%s", ewkView, frame, message); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); @@ -3578,9 +3578,9 @@ uint64_t ewk_view_exceeded_database_quota(Evas_Object* ewkView, Evas_Object* fra * * @return @false if user canceled file selection; @true if confirmed. */ -bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const WTF::Vector<WTF::String>& acceptMIMETypes, Eina_List** selectedFilenames) +bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, Ewk_File_Chooser* fileChooser, Eina_List** selectedFilenames) { - DBG("ewkView=%p frame=%p allows_multiple_files=%d", ewkView, frame, allowsMultipleFiles); + DBG("ewkView=%p frame=%p allows_multiple_files=%d", ewkView, frame, ewk_file_chooser_allows_multiple_files_get(fileChooser)); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); @@ -3588,19 +3588,10 @@ bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allo return false; *selectedFilenames = 0; - - Eina_List* cAcceptMIMETypes = 0; - for (WTF::Vector<WTF::String>::const_iterator iterator = acceptMIMETypes.begin(); iterator != acceptMIMETypes.end(); ++iterator) - cAcceptMIMETypes = eina_list_append(cAcceptMIMETypes, strdup((*iterator).utf8().data())); - - bool confirm = smartData->api->run_open_panel(smartData, frame, allowsMultipleFiles, cAcceptMIMETypes, selectedFilenames); + bool confirm = smartData->api->run_open_panel(smartData, frame, fileChooser, selectedFilenames); if (!confirm && *selectedFilenames) ERR("Canceled file selection, but selected filenames != 0. Free names before return."); - void* item = 0; - EINA_LIST_FREE(cAcceptMIMETypes, item) - free(item); - return confirm; } @@ -4027,18 +4018,22 @@ void ewk_view_transition_to_commited_for_newpage(Evas_Object* ewkView) /** * @internal - * Reports a requeset will be loaded. It's client responsibility to decide if - * request would be used. If @return is true, loader will try to load. Else, - * Loader ignore action of request. + * Reports that a navigation policy decision should be taken. If @return + * is true, the navigation request will be accepted, otherwise it will be + * ignored. * * @param ewkView View to load * @param request Request which contain url to navigate * @param navigationType navigation type + * + * @return true if the client accepted the navigation request, false otherwise. If the + * client did not make a decision, we return true by default since the default policy + * is to accept. */ bool ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Frame_Resource_Request* request, Ewk_Navigation_Type navigationType) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, true); - EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, true); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); if (!smartData->api->navigation_policy_decision) return true; @@ -4104,12 +4099,12 @@ void ewk_view_contents_size_changed(Evas_Object* ewkView, int width, int height) * * @param ewkView view. * - * @return page size. + * @return page size, or -1.0 size on failure */ WebCore::FloatRect ewk_view_page_rect_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET(ewkView, smartData); - EWK_VIEW_PRIV_GET(smartData, priv); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0)); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0)); WebCore::Frame* main_frame = priv->page->mainFrame(); return main_frame->view()->frameRect(); @@ -4284,8 +4279,8 @@ void ewk_view_soup_session_set(Evas_Object* ewkView, SoupSession* session) Eina_Bool ewk_view_setting_enable_xss_auditor_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EINA_FALSE); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); return priv->settings.enableXSSAuditor; } diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index 55ed3ee86..a570d655e 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -113,6 +113,7 @@ #ifndef ewk_view_h #define ewk_view_h +#include "ewk_file_chooser.h" #include "ewk_frame.h" #include "ewk_history.h" #include "ewk_js.h" @@ -182,12 +183,12 @@ struct _Ewk_View_Smart_Class { void (*add_console_message)(Ewk_View_Smart_Data *sd, const char *message, unsigned int lineNumber, const char *sourceID); void (*run_javascript_alert)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message); Eina_Bool (*run_javascript_confirm)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message); - Eina_Bool (*run_javascript_prompt)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message, const char *defaultValue, char **value); + Eina_Bool (*run_javascript_prompt)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message, const char *defaultValue, const char **value); Eina_Bool (*should_interrupt_javascript)(Ewk_View_Smart_Data *sd); int64_t (*exceeded_application_cache_quota)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin* origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); uint64_t (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size); - Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames); + Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Ewk_File_Chooser *file_chooser, Eina_List **selected_filenames); Eina_Bool (*navigation_policy_decision)(Ewk_View_Smart_Data *sd, Ewk_Frame_Resource_Request *request, Ewk_Navigation_Type navigation_type); Eina_Bool (*focus_can_cycle)(Ewk_View_Smart_Data *sd, Ewk_Focus_Direction direction); @@ -197,7 +198,7 @@ struct _Ewk_View_Smart_Class { * The version you have to put into the version field * in the @a Ewk_View_Smart_Class structure. */ -#define EWK_VIEW_SMART_CLASS_VERSION 5UL +#define EWK_VIEW_SMART_CLASS_VERSION 6UL /** * Initializes a whole @a Ewk_View_Smart_Class structure. @@ -858,13 +859,13 @@ EAPI void ewk_view_bg_color_get(const Evas_Object *o, int *r, int *g, in /** * Gets the copy of the selected text. * - * The returned string @b should be freed after use. + * The returned string @b should be freed by eina_stringshare_del() after use. * * @param o view object to get selected text * * @return a newly allocated string or @c NULL if nothing is selected or on failure */ -EAPI char *ewk_view_selection_get(const Evas_Object *o); +EAPI const char *ewk_view_selection_get(const Evas_Object *o); /** * Forwards a request of a new Context Menu to WebCore. @@ -2140,7 +2141,7 @@ EAPI Eina_Bool ewk_view_setting_minimum_timer_interval_set(Evas_Object *o, do * * @param o view object to get the minimum interval * - * @return the minimum interval on success or @c 0 on failure + * @return the minimum interval on success or @c -1.0 on failure */ EAPI double ewk_view_setting_minimum_timer_interval_get(const Evas_Object *o); diff --git a/Source/WebKit/efl/ewk/ewk_view_private.h b/Source/WebKit/efl/ewk/ewk_view_private.h index b70e755b1..daee67734 100644 --- a/Source/WebKit/efl/ewk/ewk_view_private.h +++ b/Source/WebKit/efl/ewk/ewk_view_private.h @@ -92,12 +92,12 @@ void ewk_view_add_console_message(Evas_Object* ewkView, const char* message, uns void ewk_view_run_javascript_alert(Evas_Object* ewkView, Evas_Object* frame, const char* message); bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, Evas_Object* frame, const char* message); -bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, char** value); +bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, const char** value); bool ewk_view_should_interrupt_javascript(Evas_Object* ewkView); int64_t ewk_view_exceeded_application_cache_quota(Evas_Object* ewkView, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); uint64_t ewk_view_exceeded_database_quota(Evas_Object* ewkView, Evas_Object* frame, const char* databaseName, uint64_t currentSize, uint64_t expectedSize); -bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const Vector<String>& acceptMIMETypes, Eina_List** selectedFilenames); +bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, Ewk_File_Chooser* fileChooser, Eina_List** selectedFilenames); void ewk_view_repaint(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height); void ewk_view_scroll(Evas_Object* ewkView, Evas_Coord deltaX, Evas_Coord deltaY, Evas_Coord scrollX, Evas_Coord scrollY, Evas_Coord scrollWidth, Evas_Coord scrollHeight, Evas_Coord centerX, Evas_Coord centerY, Evas_Coord centerW, Evas_Coord centerHeight); diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 1501bd2bb..27d0d5774 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,52 @@ +2012-07-28 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] Add a new and reusable enchant-based spellchecker in WebCore + https://bugs.webkit.org/show_bug.cgi?id=90269 + + Reviewed by Martin Robinson. + + Remove enchant specific code from WebKitSpellCheckerEnchant and + implement it relying in the new TextCheckerEnchant class in WebCore. + + * webkit/webkitspellcheckerenchant.cpp: + (_WebKitSpellCheckerEnchantPrivate): + (webkit_spell_checker_enchant_finalize): + (webkit_spell_checker_enchant_class_init): + (webkit_spell_checker_enchant_init): + (checkSpellingOfString): + (getGuessesForWord): + (updateSpellCheckingLanguages): + (learnWord): + (ignoreWord): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + (DumpRenderTreeSupportGtk): + +2012-07-24 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + (DumpRenderTreeSupportGtk): + 2012-07-23 Pierre Rossi <pierre.rossi@gmail.com> Unify numTouchEventHandlersChanged and needTouchEvents in the chrome client diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index 07aa0102b..00febc8b7 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -189,29 +189,6 @@ CString DumpRenderTreeSupportGtk::dumpRenderTree(WebKitWebFrame* frame) } /** - * numberForElementById - * @frame: a #WebKitWebFrame - * @id: an element ID string - * @pageWidth: width of a page - * @pageHeight: height of a page - * - * Return value: The number of page where the specified element will be put - */ -int DumpRenderTreeSupportGtk::pageNumberForElementById(WebKitWebFrame* frame, const char* id, float pageWidth, float pageHeight) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); - - Frame* coreFrame = core(frame); - if (!coreFrame) - return -1; - - Element* coreElement = coreFrame->document()->getElementById(AtomicString(id)); - if (!coreElement) - return -1; - return PrintContext::pageNumberForElement(coreElement, FloatSize(pageWidth, pageHeight)); -} - -/** * numberOfPagesForFrame * @frame: a #WebKitWebFrame * @pageWidth: width of a page diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 99be717a1..ea608d2f5 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -59,7 +59,6 @@ public: static GSList* getFrameChildren(WebKitWebFrame*); static WTF::CString getInnerText(WebKitWebFrame*); static WTF::CString dumpRenderTree(WebKitWebFrame*); - static int pageNumberForElementById(WebKitWebFrame*, const char* id, float pageWidth, float pageHeight); static int numberOfPagesForFrame(WebKitWebFrame*, float pageWidth, float pageHeight); static WTF::CString pageProperty(WebKitWebFrame*, const char* propertyName, int pageNumber); static WTF::CString pageSizeAndMarginsInPixels(WebKitWebFrame*, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft); diff --git a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp index 0eb4986d1..0a226928b 100644 --- a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp +++ b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp @@ -21,12 +21,15 @@ #if ENABLE(SPELLCHECK) +#include "TextCheckerEnchant.h" #include "webkitspellchecker.h" -#include <enchant.h> #include <gtk/gtk.h> +#include <wtf/OwnPtr.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/text/CString.h> +using namespace WebCore; + /** * SECTION:webkitspellcheckerenchant * @short_description: the default spell checking implementation for WebKitGTK+. @@ -35,10 +38,9 @@ * WebKitGTK+. It uses the Enchant dictionaries installed on the system to * correct spelling. */ -static EnchantBroker* broker = 0; struct _WebKitSpellCheckerEnchantPrivate { - GSList* enchantDicts; + OwnPtr<TextCheckerEnchant> textCheckerEnchant; }; static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* interface); @@ -47,35 +49,16 @@ G_DEFINE_TYPE_WITH_CODE(WebKitSpellCheckerEnchant, webkit_spell_checker_enchant, G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_SPELL_CHECKER, webkit_spell_checker_enchant_spell_checker_interface_init)) -static void createEnchantBrokerIfNeeded() -{ - if (!broker) - broker = enchant_broker_init(); -} - -static void freeSpellCheckingLanguage(gpointer data, gpointer) -{ - createEnchantBrokerIfNeeded(); - - enchant_broker_free_dict(broker, static_cast<EnchantDict*>(data)); -} - static void webkit_spell_checker_enchant_finalize(GObject* object) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(object)->priv; - - g_slist_foreach(priv->enchantDicts, freeSpellCheckingLanguage, 0); - g_slist_free(priv->enchantDicts); - - WEBKIT_SPELL_CHECKER_ENCHANT(object)->priv->~WebKitSpellCheckerEnchantPrivate(); + priv->~WebKitSpellCheckerEnchantPrivate(); } static void webkit_spell_checker_enchant_class_init(WebKitSpellCheckerEnchantClass* klass) { GObjectClass* objectClass = G_OBJECT_CLASS(klass); - objectClass->finalize = webkit_spell_checker_enchant_finalize; - g_type_class_add_private(klass, sizeof(WebKitSpellCheckerEnchantPrivate)); } @@ -85,149 +68,38 @@ static void webkit_spell_checker_enchant_init(WebKitSpellCheckerEnchant* checker checker->priv = priv; new (priv) WebKitSpellCheckerEnchantPrivate(); - priv->enchantDicts = 0; -} - -static bool wordEndIsAContractionApostrophe(const char* string, long offset) -{ - if (g_utf8_get_char(g_utf8_offset_to_pointer(string, offset)) != g_utf8_get_char("'")) - return false; - - // If this is the last character in the string, it cannot be the apostrophe part of a contraction. - if (offset == g_utf8_strlen(string, -1)) - return false; - - return g_unichar_isalpha(g_utf8_get_char(g_utf8_offset_to_pointer(string, offset + 1))); + priv->textCheckerEnchant = TextCheckerEnchant::create(); } static void checkSpellingOfString(WebKitSpellChecker* checker, const char* string, int* misspellingLocation, int* misspellingLength) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - - GSList* dicts = priv->enchantDicts; - if (!dicts) - return; - - int length = g_utf8_strlen(string, -1); - - PangoLanguage* language(pango_language_get_default()); - GOwnPtr<PangoLogAttr> attrs(g_new(PangoLogAttr, length + 1)); - - // pango_get_log_attrs uses an aditional position at the end of the text. - pango_get_log_attrs(string, -1, -1, language, attrs.get(), length + 1); - - for (int i = 0; i < length + 1; i++) { - // We go through each character until we find an is_word_start, - // then we get into an inner loop to find the is_word_end corresponding - // to it. - if (attrs.get()[i].is_word_start) { - int start = i; - int end = i; - int wordLength; - - while (attrs.get()[end].is_word_end < 1 || wordEndIsAContractionApostrophe(string, end)) - end++; - - wordLength = end - start; - // Set the iterator to be at the current word end, so we don't - // check characters twice. - i = end; - - gchar* cstart = g_utf8_offset_to_pointer(string, start); - gint bytes = static_cast<gint>(g_utf8_offset_to_pointer(string, end) - cstart); - GOwnPtr<gchar> word(g_new0(gchar, bytes + 1)); - - g_utf8_strncpy(word.get(), cstart, wordLength); - - for (; dicts; dicts = dicts->next) { - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - if (enchant_dict_check(dict, word.get(), wordLength)) { - *misspellingLocation = start; - *misspellingLength = wordLength; - } else { - // Stop checking, this word is ok in at least one dict. - *misspellingLocation = -1; - *misspellingLength = 0; - break; - } - } - } - } + priv->textCheckerEnchant->checkSpellingOfString(String(string), *misspellingLocation, *misspellingLength); } static char** getGuessesForWord(WebKitSpellChecker* checker, const char* word, const char* context) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - GSList* dicts = priv->enchantDicts; - char** guesses = 0; + Vector<String> guesses = priv->textCheckerEnchant->getGuessesForWord(String(word)); - for (; dicts; dicts = dicts->next) { - size_t numberOfSuggestions; - size_t i; + if (guesses.isEmpty()) + return 0; - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - gchar** suggestions = enchant_dict_suggest(dict, word, -1, &numberOfSuggestions); + int i = 0; + int numberOfGuesses = guesses.size(); + char** guessesArray = static_cast<char**>(g_malloc0((numberOfGuesses + 1) * sizeof(char*))); + for (Vector<String>::const_iterator iter = guesses.begin(); iter != guesses.end(); ++iter) + guessesArray[i++] = g_strdup(iter->utf8().data()); + guessesArray[i] = 0; - if (numberOfSuggestions > 0) { - if (numberOfSuggestions > 10) - numberOfSuggestions = 10; - - guesses = static_cast<char**>(g_malloc0((numberOfSuggestions + 1) * sizeof(char*))); - for (i = 0; i < numberOfSuggestions && i < 10; i++) - guesses[i] = g_strdup(suggestions[i]); - - guesses[i] = 0; - - enchant_dict_free_suggestions(dict, suggestions); - } - } - - return guesses; -} - -static void getAvailableDictionariesCallback(const char* const languageTag, const char* const, const char* const, const char* const, void* data) -{ - Vector<CString>* dicts = static_cast<Vector<CString>*>(data); - - dicts->append(languageTag); + return guessesArray; } static void updateSpellCheckingLanguages(WebKitSpellChecker* checker, const char* languages) { - GSList* spellDictionaries = 0; - WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - - createEnchantBrokerIfNeeded(); - - if (languages) { - char** langs = g_strsplit(languages, ",", -1); - for (int i = 0; langs[i]; i++) { - if (enchant_broker_dict_exists(broker, langs[i])) { - EnchantDict* dict = enchant_broker_request_dict(broker, langs[i]); - spellDictionaries = g_slist_append(spellDictionaries, dict); - } - } - g_strfreev(langs); - } else { - const char* language = pango_language_to_string(gtk_get_default_language()); - if (enchant_broker_dict_exists(broker, language)) { - EnchantDict* dict = enchant_broker_request_dict(broker, language); - spellDictionaries = g_slist_append(spellDictionaries, dict); - } else { - // No dictionaries selected, we get one from the list. - Vector<CString> allDictionaries; - enchant_broker_list_dicts(broker, getAvailableDictionariesCallback, &allDictionaries); - if (!allDictionaries.isEmpty()) { - EnchantDict* dict = enchant_broker_request_dict(broker, allDictionaries[0].data()); - spellDictionaries = g_slist_append(spellDictionaries, dict); - } - } - } - g_slist_foreach(priv->enchantDicts, freeSpellCheckingLanguage, 0); - g_slist_free(priv->enchantDicts); - priv->enchantDicts = spellDictionaries; + priv->textCheckerEnchant->updateSpellCheckingLanguages(String(languages)); } static char* getAutocorrectSuggestionsForMisspelledWord(WebKitSpellChecker* checker, const char* word) @@ -238,25 +110,13 @@ static char* getAutocorrectSuggestionsForMisspelledWord(WebKitSpellChecker* chec static void learnWord(WebKitSpellChecker* checker, const char* word) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - GSList* dicts = priv->enchantDicts; - - for (; dicts; dicts = dicts->next) { - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - - enchant_dict_add_to_personal(dict, word, -1); - } + priv->textCheckerEnchant->learnWord(String(word)); } static void ignoreWord(WebKitSpellChecker* checker, const char* word) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - GSList* dicts = priv->enchantDicts; - - for (; dicts; dicts = dicts->next) { - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - - enchant_dict_add_to_session(dict, word, -1); - } + priv->textCheckerEnchant->ignoreWord(String(word)); } static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* interface) diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 9df345021..05df0aed5 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,74 @@ +2012-07-29 Rik Cabanier <cabanier@adobe.com> + + Add ENABLE_CSS_COMPOSITING flag + https://bugs.webkit.org/show_bug.cgi?id=92553 + + Reviewed by Dirk Schulze. + + Adds compiler flag CSS_COMPOSITING to build systems to enable CSS blending and compositing. See spec https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html + + * Configurations/FeatureDefines.xcconfig: + +2012-07-27 Anders Carlsson <andersca@apple.com> + + Show the unavailable plug-in indicator for Java applets as well + https://bugs.webkit.org/show_bug.cgi?id=92521 + + Reviewed by Sam Weinig. + + Check if the Java plug-in is blocked before trying to instantiate it. + + * WebCoreSupport/WebFrameLoaderClient.mm: + +2012-07-25 Jer Noble <jer.noble@apple.com> + + Add setting to enable and disable diagnostic logging. + https://bugs.webkit.org/show_bug.cgi?id=92337 + + Reviewed by Anders Carlsson. + + Add a WebKit WebPreferences API to set set the WebCore diagnosticLoggingEnabled setting. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Register the default value to false. + (-[WebPreferences diagnosticLoggingEnabled]): Simple userDefaults accessor. + (-[WebPreferences setDiagnosticLoggingEnabled:]): Ditto. + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): Ensure this preference is propagated to Settings + whenever the preferences change. + +2012-07-25 Pratik Solanki <psolanki@apple.com> + + Remove catchesDelegateExceptions from WebViewData and related accessor methods + https://bugs.webkit.org/show_bug.cgi?id=90898 + + Reviewed by Darin Adler. + + Remove catchesDelegateException ivar from WebViewData and all its accesor methods from + WebView. All uses of this flag in WebKit set it to YES and no one calls + _setCatchesDelegateExceptions with NO. + + * WebCoreSupport/WebDragClient.mm: + (WebDragClient::startDrag): + * WebView/WebDelegateImplementationCaching.mm: + (CallDelegate): + (CallDelegateReturningFloat): + (CallDelegateReturningBoolean): + (CallResourceLoadDelegateReturningBoolean): + (CallFormDelegate): + (CallFormDelegateReturningBoolean): + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:]): + (-[WebView _policyDelegateForwarder]): + (-[WebView _UIDelegateForwarder]): + (-[WebView _editingDelegateForwarder]): + (-[_WebSafeForwarder initWithTarget:defaultTarget:]): + (-[_WebSafeForwarder forwardInvocation:]): + * WebView/WebViewData.h: + * WebView/WebViewPrivate.h: + 2012-07-23 Simon Fraser <simon.fraser@apple.com> Part 2 of: Implement sticky positioning diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 49182f3a0..70cf60c23 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -44,6 +44,7 @@ ENABLE_CSS_IMAGE_ORIENTATION = ; ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_SHADERS = ENABLE_CSS_SHADERS; +ENABLE_CSS_COMPOSITING = ; ENABLE_CSS_STICKY_POSITION = ENABLE_CSS_STICKY_POSITION; ENABLE_CSS_VARIABLES = ; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; @@ -136,4 +137,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(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_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +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_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(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_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm index 975580f8e..c168df8ad 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm @@ -110,14 +110,11 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const id delegate = [m_webView UIDelegate]; SEL selector = @selector(webView:dragImage:at:offset:event:pasteboard:source:slideBack:forView:); if ([delegate respondsToSelector:selector]) { - if ([m_webView _catchesDelegateExceptions]) { - @try { - [delegate webView:m_webView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES forView:topHTMLView]; - } @catch (id exception) { - ReportDiscardedDelegateException(selector, exception); - } - } else + @try { [delegate webView:m_webView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES forView:topHTMLView]; + } @catch (id exception) { + ReportDiscardedDelegateException(selector, exception); + } } else [topHTMLView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES]; } diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 6364420eb..6d017afac 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -1759,47 +1759,55 @@ PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& s WebBasePluginPackage *pluginPackage = [webView _pluginForMIMEType:MIMEType]; + int errorCode = WebKitErrorJavaUnavailable; + if (pluginPackage) { - if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) { - // For some reason, the Java plug-in requires that we pass the dimension of the plug-in as attributes. - NSMutableArray *names = kit(paramNames); - NSMutableArray *values = kit(paramValues); - if (parameterValue(paramNames, paramValues, "width").isNull()) { - [names addObject:@"width"]; - [values addObject:[NSString stringWithFormat:@"%d", size.width()]]; + if (!WKShouldBlockPlugin([pluginPackage bundleIdentifier], [pluginPackage bundleVersion])) { + if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) { + // For some reason, the Java plug-in requires that we pass the dimension of the plug-in as attributes. + NSMutableArray *names = kit(paramNames); + NSMutableArray *values = kit(paramValues); + if (parameterValue(paramNames, paramValues, "width").isNull()) { + [names addObject:@"width"]; + [values addObject:[NSString stringWithFormat:@"%d", size.width()]]; + } + if (parameterValue(paramNames, paramValues, "height").isNull()) { + [names addObject:@"height"]; + [values addObject:[NSString stringWithFormat:@"%d", size.height()]]; + } + view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, names, values, baseURL, kit(element), NO); + if (view) + return adoptRef(new PluginWidget(view)); } - if (parameterValue(paramNames, paramValues, "height").isNull()) { - [names addObject:@"height"]; - [values addObject:[NSString stringWithFormat:@"%d", size.height()]]; + #if ENABLE(NETSCAPE_PLUGIN_API) + else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) { + view = [[[NETSCAPE_PLUGIN_VIEW alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height()) + pluginPackage:(WebNetscapePluginPackage *)pluginPackage + URL:nil + baseURL:baseURL + MIMEType:MIMEType + attributeKeys:kit(paramNames) + attributeValues:kit(paramValues) + loadManually:NO + element:element] autorelease]; + if (view) + return adoptRef(new NetscapePluginWidget(static_cast<WebBaseNetscapePluginView *>(view))); + } else { + ASSERT_NOT_REACHED(); } - view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, names, values, baseURL, kit(element), NO); - if (view) - return adoptRef(new PluginWidget(view)); - } -#if ENABLE(NETSCAPE_PLUGIN_API) - else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) { - view = [[[NETSCAPE_PLUGIN_VIEW alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height()) - pluginPackage:(WebNetscapePluginPackage *)pluginPackage - URL:nil - baseURL:baseURL - MIMEType:MIMEType - attributeKeys:kit(paramNames) - attributeValues:kit(paramValues) - loadManually:NO - element:element] autorelease]; - if (view) - return adoptRef(new NetscapePluginWidget(static_cast<WebBaseNetscapePluginView *>(view))); + #endif } else { - ASSERT_NOT_REACHED(); + errorCode = WebKitErrorBlockedPlugInVersion; + if (element->renderer()->isEmbeddedObject()) + toRenderEmbeddedObject(element->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion); } -#endif } if (!view) { WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(getWebView(m_webFrame.get())); if (implementations->plugInFailedWithErrorFunc) { NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil; - NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType]; + NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType]; CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView], @selector(webView:plugInFailedWithError:dataSource:), error, [m_webFrame.get() _dataSource]); [error release]; diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm index 542a48495..15f6dffa2 100644 --- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm +++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm @@ -83,8 +83,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector) { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self); @try { return objc_msgSend(delegate, selector, self); } @catch(id exception) { @@ -97,8 +95,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object); @try { return objc_msgSend(delegate, selector, self, object); } @catch(id exception) { @@ -111,8 +107,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, NSRect r { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect); @try { return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect); } @catch(id exception) { @@ -125,8 +119,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object1, object2); @try { return objc_msgSend(delegate, selector, self, object1, object2); } @catch(id exception) { @@ -139,8 +131,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object, boolean); @try { return objc_msgSend(delegate, selector, self, object, boolean); } @catch(id exception) { @@ -153,8 +143,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object1, object2, object3); @try { return objc_msgSend(delegate, selector, self, object1, object2, object3); } @catch(id exception) { @@ -167,8 +155,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object, integer); @try { return objc_msgSend(delegate, selector, self, object, integer); } @catch(id exception) { @@ -181,8 +167,6 @@ static inline float CallDelegateReturningFloat(WebView *self, id delegate, SEL s { if (!delegate || ![delegate respondsToSelector:selector]) return 0.0f; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend_float_return(delegate, selector, self); @try { return objc_msgSend_float_return(delegate, selector, self); } @catch(id exception) { @@ -195,8 +179,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self); } @catch(id exception) { @@ -209,8 +191,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object); } @catch(id exception) { @@ -223,8 +203,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean); } @catch(id exception) { @@ -237,8 +215,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2); } @catch(id exception) { @@ -251,8 +227,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2); } @catch(id exception) { @@ -265,8 +239,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self); @try { return implementation(delegate, selector, self); } @catch(id exception) { @@ -279,8 +251,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object); @try { return implementation(delegate, selector, self, object); } @catch(id exception) { @@ -293,8 +263,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2); @try { return implementation(delegate, selector, self, object1, object2); } @catch(id exception) { @@ -307,8 +275,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2, object3); @try { return implementation(delegate, selector, self, object1, object2, object3); } @catch(id exception) { @@ -321,8 +287,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2, object3, object4); @try { return implementation(delegate, selector, self, object1, object2, object3, object4); } @catch(id exception) { @@ -335,8 +299,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer, object2); @try { return implementation(delegate, selector, self, object1, integer, object2); } @catch(id exception) { @@ -349,8 +311,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer1, integer2, object2); @try { return implementation(delegate, selector, self, object1, integer1, integer2, object2); } @catch(id exception) { @@ -363,8 +323,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2); @try { return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2); } @catch(id exception) { @@ -377,8 +335,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2, integer, object3); @try { return implementation(delegate, selector, self, object1, object2, integer, object3); } @catch(id exception) { @@ -391,8 +347,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3); @try { return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3); } @catch(id exception) { @@ -405,8 +359,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer, object2, object3, object4); @try { return implementation(delegate, selector, self, object1, integer, object2, object3, object4); } @catch(id exception) { @@ -419,8 +371,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, interval, object2, object3); @try { return implementation(delegate, selector, self, object1, interval, object2, object3); } @catch(id exception) { @@ -551,8 +501,6 @@ id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1) { - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1); } @catch(id exception) { @@ -563,8 +511,6 @@ BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, W BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2) { - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2); } @catch(id exception) { @@ -575,8 +521,6 @@ BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, W BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3) { - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3); } @catch(id exception) { @@ -632,8 +576,6 @@ id CallFormDelegate(WebView *self, SEL selector, id object1, id object2) id delegate = self->_private->formDelegate; if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, object1, object2); @try { return objc_msgSend(delegate, selector, object1, object2); } @catch(id exception) { @@ -647,8 +589,6 @@ id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id obje id delegate = self->_private->formDelegate; if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5); @try { return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5); } @catch(id exception) { @@ -662,8 +602,6 @@ BOOL CallFormDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id delegate = self->_private->formDelegate; if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2); } @catch(id exception) { diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 12b54e7c0..b1711bb8b 100644 --- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -124,6 +124,7 @@ #define WebKitRegionBasedColumnsEnabledKey @"WebKitRegionBasedColumnsEnabled" #define WebKitShouldRespectImageOrientationKey @"WebKitShouldRespectImageOrientation" #define WebKitRequestAnimationFrameEnabledPreferenceKey @"WebKitRequestAnimationFrameEnabled" +#define WebKitDiagnosticLoggingEnabledKey @"WebKitDiagnosticLoggingEnabled" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index f209ed80d..8e13f19b4 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -398,6 +398,7 @@ public: [NSNumber numberWithBool:NO], WebKitShouldRespectImageOrientationKey, [NSNumber numberWithBool:YES], WebKitRequestAnimationFrameEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitWantsBalancedSetDefersLoadingBehaviorKey, + [NSNumber numberWithBool:NO], WebKitDiagnosticLoggingEnabledKey, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, @@ -1728,6 +1729,16 @@ static NSString *classIBCreatorID = nil; return [self _floatValueForKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey]; } +- (BOOL)diagnosticLoggingEnabled +{ + return [self _boolValueForKey:WebKitDiagnosticLoggingEnabledKey]; +} + +- (void)setDiagnosticLoggingEnabled:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitDiagnosticLoggingEnabledKey]; +} + @end @implementation WebPreferences (WebInternal) diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 5db85cf55..513540d5d 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -302,4 +302,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification; - (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout; - (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds; +- (BOOL)diagnosticLoggingEnabled; +- (void)setDiagnosticLoggingEnabled:(BOOL)enabled; + @end diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index b85d8f36b..a62f27ecb 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -375,9 +375,8 @@ static const char webViewIsOpen[] = "At least one WebView is still open."; { id target; // Non-retained. Don't retain delegates. id defaultTarget; - BOOL catchExceptions; } -- (id)initWithTarget:(id)target defaultTarget:(id)defaultTarget catchExceptions:(BOOL)catchExceptions; +- (id)initWithTarget:(id)target defaultTarget:(id)defaultTarget; @end FindOptions coreOptions(WebFindOptions options) @@ -709,7 +708,6 @@ static bool shouldRespectPriorityInCSSAttributeSetters() [standardPreferences willAddToWebView]; _private->preferences = [standardPreferences retain]; - _private->catchesDelegateExceptions = YES; _private->mainFrameDocumentReady = NO; _private->drawsBackground = YES; _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain]; @@ -1543,6 +1541,7 @@ static bool needsSelfRetainWhileLoadingQuirk() settings->setNeedsIsLoadingInAPISenseQuirk([self _needsIsLoadingInAPISenseQuirk]); settings->setRequestAnimationFrameEnabled([preferences requestAnimationFrameEnabled]); settings->setNeedsDidFinishLoadOrderQuirk(needsDidFinishLoadOrderQuirk()); + settings->setDiagnosticLoggingEnabled([preferences diagnosticLoggingEnabled]); NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds]; if (timeout > 0) @@ -1679,14 +1678,14 @@ static inline IMP getMethod(id o, SEL s) - (id)_policyDelegateForwarder { if (!_private->policyDelegateForwarder) - _private->policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate] catchExceptions:_private->catchesDelegateExceptions]; + _private->policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate]]; return _private->policyDelegateForwarder; } - (id)_UIDelegateForwarder { if (!_private->UIDelegateForwarder) - _private->UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate] catchExceptions:_private->catchesDelegateExceptions]; + _private->UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate]]; return _private->UIDelegateForwarder; } @@ -1698,7 +1697,7 @@ static inline IMP getMethod(id o, SEL s) return nil; if (!_private->editingDelegateForwarder) - _private->editingDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->editingDelegate defaultTarget:[WebDefaultEditingDelegate sharedEditingDelegate] catchExceptions:_private->catchesDelegateExceptions]; + _private->editingDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->editingDelegate defaultTarget:[WebDefaultEditingDelegate sharedEditingDelegate]]; return _private->editingDelegateForwarder; } @@ -2361,16 +2360,6 @@ static inline IMP getMethod(id o, SEL s) _private->page->clearUndoRedoOperations(); } -- (void)_setCatchesDelegateExceptions:(BOOL)f -{ - _private->catchesDelegateExceptions = f; -} - -- (BOOL)_catchesDelegateExceptions -{ - return _private->catchesDelegateExceptions; -} - - (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value { Frame* coreFrame = [self _mainCoreFrame]; @@ -2987,28 +2976,24 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) // Used to send messages to delegates that implement informal protocols. -- (id)initWithTarget:(id)t defaultTarget:(id)dt catchExceptions:(BOOL)c +- (id)initWithTarget:(id)t defaultTarget:(id)dt { self = [super init]; if (!self) return nil; target = t; // Non retained. defaultTarget = dt; - catchExceptions = c; return self; } - (void)forwardInvocation:(NSInvocation *)invocation { if ([target respondsToSelector:[invocation selector]]) { - if (catchExceptions) { - @try { - [invocation invokeWithTarget:target]; - } @catch(id exception) { - ReportDiscardedDelegateException([invocation selector], exception); - } - } else + @try { [invocation invokeWithTarget:target]; + } @catch(id exception) { + ReportDiscardedDelegateException([invocation selector], exception); + } return; } diff --git a/Source/WebKit/mac/WebView/WebViewData.h b/Source/WebKit/mac/WebView/WebViewData.h index 2ad4200d7..04d7e057a 100644 --- a/Source/WebKit/mac/WebView/WebViewData.h +++ b/Source/WebKit/mac/WebView/WebViewData.h @@ -137,7 +137,6 @@ private: BOOL becomingFirstResponder; BOOL becomingFirstResponderFromOutside; BOOL usesPageCache; - BOOL catchesDelegateExceptions; BOOL cssAnimationsSuspended; NSColor *backgroundColor; diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index 0a9808dbc..c20daabfb 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -361,9 +361,6 @@ Could be worth adding to the API. + (void)_setShouldUseFontSmoothing:(BOOL)f; + (BOOL)_shouldUseFontSmoothing; -- (void)_setCatchesDelegateExceptions:(BOOL)f; -- (BOOL)_catchesDelegateExceptions; - // These two methods are useful for a test harness that needs a consistent appearance for the focus rings // regardless of OS X version. + (void)_setUsesTestModeFocusRingColor:(BOOL)f; diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index fbfcf398c..3262f75a1 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,73 @@ +2012-07-27 Csaba Osztrogonác <ossy@webkit.org> + + [Qt][WK2] REGRESSION(r119127): resetting window.internals settings between tests doesn't work properly + https://bugs.webkit.org/show_bug.cgi?id=88064 + + Reviewed by Zoltan Herczeg. + + Add missing DumpRenderTreeSupportQt::resetInternalsObject(JSContextRef context) function. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::resetInternalsObject): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2012-07-26 Zeno Albisser <zeno@webkit.org> + + Unreviewed Qt buildfix after r123786. + + Qt-minimal builds with ENABLE_REQUEST_ANIMATION_FRAME=0. + Therefore adding #ifdefs to allow for that configuration. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore): + * WebCoreSupport/ChromeClientQt.h: + (ChromeClientQt): + +2012-07-26 Zeno Albisser <zeno@webkit.org> + + [Qt] requestAnimationFrame should only trigger when a new frame can be displayed. + https://bugs.webkit.org/show_bug.cgi?id=88638 + + Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie + the servicing of scripted animations to the renderNextFrame call for WK2. + For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation. + + Reviewed by Jocelyn Turcotte. + + * WebCoreSupport/ChromeClientQt.cpp: + (RefreshAnimation): + Add a RefreshAnimation that is based on QAbstractAnimation + and drives the servicing of the scripted animations for WK1. + (WebCore::RefreshAnimation::RefreshAnimation): + (WebCore::RefreshAnimation::duration): + (WebCore::RefreshAnimation::scheduleAnimation): + Set m_animationScheduled to true and start the animation + timer in case it is not running yet. + (WebCore::RefreshAnimation::updateCurrentTime): + Call serviceScriptedAnimations if m_animationScheduled is true. + If this is not the case, the animation timer can be stopped, + because no animation needs to be scheduled anymore. + (WebCore): + (WebCore::ChromeClientQt::scheduleAnimation): + Create and start the RefreshAnimation instance with the + first call to scheduleAnimation. + * WebCoreSupport/ChromeClientQt.h: + (WebCore): + (ChromeClientQt): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + 2012-07-24 Pierre Rossi <pierre.rossi@gmail.com> [Qt][WK1] color input type support diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 43b105ef3..92814429b 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -70,6 +70,7 @@ #include "qwebsecurityorigin.h" #include "qwebsecurityorigin_p.h" #include "qwebview.h" +#include <qabstractanimation.h> #include <qdebug.h> #include <qeventloop.h> #include <qtooltip.h> @@ -88,6 +89,40 @@ namespace WebCore { +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) +class RefreshAnimation : public QAbstractAnimation { +public: + RefreshAnimation(ChromeClientQt* chromeClient) + : QAbstractAnimation() + , m_chromeClient(chromeClient) + , m_animationScheduled(false) + { } + + virtual int duration() const { return -1; } + + void scheduleAnimation() + { + m_animationScheduled = true; + if (state() != QAbstractAnimation::Running) + start(); + } + +protected: + virtual void updateCurrentTime(int currentTime) + { + UNUSED_PARAM(currentTime); + if (m_animationScheduled) { + m_animationScheduled = false; + m_chromeClient->serviceScriptedAnimations(); + } else + stop(); + } +private: + ChromeClientQt* m_chromeClient; + bool m_animationScheduled; +}; +#endif + bool ChromeClientQt::dumpVisitedLinksCallbacks = false; ChromeClientQt::ChromeClientQt(QWebPage* webPage) @@ -618,6 +653,19 @@ void ChromeClientQt::setCursor(const Cursor& cursor) #endif } +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) +void ChromeClientQt::scheduleAnimation() +{ + if (!m_refreshAnimation) + m_refreshAnimation = adoptPtr(new RefreshAnimation(this)); + m_refreshAnimation->scheduleAnimation(); +} + +void ChromeClientQt::serviceScriptedAnimations() +{ + m_webPage->mainFrame()->d->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime())); +} +#endif #if USE(ACCELERATED_COMPOSITING) void ChromeClientQt::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h index af1fff6d4..79d43b3f7 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -49,6 +49,7 @@ class FileChooser; class FileIconLoader; class FloatRect; class Page; +class RefreshAnimation; struct FrameLoadRequest; class QtAbstractWebPopup; struct ViewportArguments; @@ -176,6 +177,11 @@ public: virtual void setCursor(const Cursor&); virtual void setCursorHiddenUntilMouseMoves(bool) { } +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) + virtual void scheduleAnimation(); + virtual void serviceScriptedAnimations(); +#endif + virtual void scrollRectIntoView(const LayoutRect) const { } virtual bool selectItemWritingDirectionIsNatural(); @@ -201,6 +207,9 @@ public: bool statusBarVisible; bool menuBarVisible; QEventLoop* m_eventLoop; +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) + OwnPtr<RefreshAnimation> m_refreshAnimation; +#endif #if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) FullScreenVideoQt* m_fullScreenVideo; diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index c02e66e66..714f560f0 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -386,19 +386,6 @@ void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool wait gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); } -int DumpRenderTreeSupportQt::pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height) -{ - Frame* coreFrame = QWebFramePrivate::core(frame); - if (!coreFrame) - return -1; - - Element* element = coreFrame->document()->getElementById(AtomicString(id)); - if (!element) - return -1; - - return PrintContext::pageNumberForElement(element, FloatSize(width, height)); -} - int DumpRenderTreeSupportQt::numberOfPages(QWebFrame* frame, float width, float height) { Frame* coreFrame = QWebFramePrivate::core(frame); @@ -1090,6 +1077,11 @@ void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame) WebCoreTestSupport::resetInternalsObject(context); } +void DumpRenderTreeSupportQt::resetInternalsObject(JSContextRef context) +{ + WebCoreTestSupport::resetInternalsObject(context); +} + QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe) { Frame* frame = QWebFramePrivate::core(qframe); diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 0184ee4da..34041ddfa 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -128,7 +128,6 @@ public: static void overwritePluginDirectories(); static int numberOfActiveAnimations(QWebFrame*); static int numberOfPages(QWebFrame* frame, float width, float height); - static int pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height); static bool hasDocumentElement(QWebFrame* frame); static bool elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId); static void setWindowsBehaviorAsEditingBehavior(QWebPage*); @@ -205,6 +204,7 @@ public: static void injectInternalsObject(QWebFrame*); static void injectInternalsObject(JSContextRef); static void resetInternalsObject(QWebFrame*); + static void resetInternalsObject(JSContextRef); static void setInteractiveFormValidationEnabled(QWebPage*, bool); diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 5eb1be3f8..86942ca6a 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,52 @@ +2012-07-26 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [Mac] Fix build break on Apple win bot after r123711 + https://bugs.webkit.org/show_bug.cgi?id=92354 + + Reviewed by Adam Barth. + + Missing return value. + + * WebFrame.cpp: + (WebFrame::pageNumberForElementById): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Moved the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebFrame.cpp: Added comment for removing the function. Removed implementation. + +2012-07-25 Roger Fong <roger_fong@apple.com> + + Changes to the WebFrame API cause dependent apps to crash. + https://bugs.webkit.org/show_bug.cgi?id=91656 + <rdar://problem/11904605> + + Reviewed by Jon Honeycutt. + + Changes to the WebFrame API cause certain apps to crash because of inconsistencies in the COM interface. + The resumeAnimations and suspendAnimations are removed, which are still needed. + The counterValueByElementId method was also removed, although is not needed there. + However, for all of these methods, no method stubs were added where appropriate after removal. + + * Interfaces/IWebFramePrivate.idl: + Added resumeAnimations() and suspendAnimations() methods back in. Added unused method stub for counterValueByElementId method. + + * WebFrame.cpp: + (WebFrame::resumeAnimations): + Added this method back in. + (WebFrame::suspendAnimations): + Added this method back in. + + * WebFrame.h: + (Re)added methods and unused method stubs. + 2012-07-23 Patrick Gansterer <paroga@webkit.org> Build fix if NOMINMAX is defined by the build system. diff --git a/Source/WebKit/win/Interfaces/IWebFramePrivate.idl b/Source/WebKit/win/Interfaces/IWebFramePrivate.idl index 146c300d8..b2dfce8a6 100644 --- a/Source/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/Source/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -96,6 +96,8 @@ interface IWebFramePrivate : IUnknown [local] JSGlobalContextRef globalContextForScriptWorld([in] IWebScriptWorld*); + HRESULT unused3([in] BSTR, [out, retval] BSTR*); + HRESULT visibleContentRect([out, retval] RECT*); HRESULT pageNumberForElementById([in] BSTR id, [in] float pageWidthInPixels, [in] float pageHeightInPixels, [out, retval] int* pageNumber); @@ -108,9 +110,13 @@ interface IWebFramePrivate : IUnknown HRESULT renderTreeAsExternalRepresentation([in] BOOL forPrinting, [out, retval] BSTR* result); + HRESULT suspendAnimations(); + HRESULT resumeAnimations(); + HRESULT loadPlainTextString([in] BSTR string, [in] BSTR url); HRESULT clearOpener(); HRESULT setTextDirection([in] BSTR direction); + } diff --git a/Source/WebKit/win/WebFrame.cpp b/Source/WebKit/win/WebFrame.cpp index 9ce1c7811..ff560c67b 100644 --- a/Source/WebKit/win/WebFrame.cpp +++ b/Source/WebKit/win/WebFrame.cpp @@ -883,20 +883,10 @@ HRESULT STDMETHODCALLTYPE WebFrame::pageNumberForElementById( /* [in] */ float pageHeightInPixels, /* [retval][out] */ int* result) { - if (!result) - return E_POINTER; - - Frame* coreFrame = core(this); - if (!coreFrame) - return E_FAIL; - - String coreId = String(id, SysStringLen(id)); - - Element* element = coreFrame->document()->getElementById(coreId); - if (!element) - return E_FAIL; - *result = PrintContext::pageNumberForElement(element, FloatSize(pageWidthInPixels, pageHeightInPixels)); - return S_OK; + // TODO: Please remove this function if not needed as this is LTC specific function + // and has been moved to Internals. + notImplemented(); + return E_FAIL; } HRESULT STDMETHODCALLTYPE WebFrame::numberOfPages( @@ -1198,6 +1188,26 @@ HRESULT WebFrame::elementDoesAutoComplete(IDOMElement *element, BOOL *result) return S_OK; } +HRESULT STDMETHODCALLTYPE WebFrame::resumeAnimations() +{ + Frame* frame = core(this); + if (!frame) + return E_FAIL; + + frame->animation()->resumeAnimations(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebFrame::suspendAnimations() +{ + Frame* frame = core(this); + if (!frame) + return E_FAIL; + + frame->animation()->suspendAnimations(); + return S_OK; +} + HRESULT WebFrame::pauseAnimation(BSTR animationName, IDOMNode* node, double secondsFromNow, BOOL* animationWasRunning) { if (!node || !animationWasRunning) diff --git a/Source/WebKit/win/WebFrame.h b/Source/WebKit/win/WebFrame.h index c2fbe36a2..d80193dd2 100644 --- a/Source/WebKit/win/WebFrame.h +++ b/Source/WebKit/win/WebFrame.h @@ -280,6 +280,12 @@ public: virtual HRESULT STDMETHODCALLTYPE setTextDirection(BSTR); + virtual HRESULT STDMETHODCALLTYPE unused3(BSTR, BSTR*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE resumeAnimations(); + + virtual HRESULT STDMETHODCALLTYPE suspendAnimations(); + // IWebDocumentText virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding( /* [retval][out] */ BOOL* result); diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index 384d7e6de..104956641 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -45,6 +45,8 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}" "${WEBCORE_DIR}/Modules/battery" "${WEBCORE_DIR}/Modules/intents" + "${WEBCORE_DIR}/Modules/networkinfo" + "${WEBCORE_DIR}/Modules/vibration" "${WEBCORE_DIR}/accessibility" "${WEBCORE_DIR}/bindings/js" "${WEBCORE_DIR}/bindings" @@ -67,6 +69,8 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/animation" "${WEBCORE_DIR}/platform/graphics" "${WEBCORE_DIR}/platform/graphics/filters" + "${WEBCORE_DIR}/platform/graphics/harfbuzz" + "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng" "${WEBCORE_DIR}/platform/graphics/transforms" "${WEBCORE_DIR}/platform/network" "${WEBCORE_DIR}/platform/sql" @@ -94,6 +98,7 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${JAVASCRIPTCORE_DIR}/runtime" "${WTF_DIR}" "${DERIVED_SOURCES_DIR}" + "${DERIVED_SOURCES_DIR}/ForwardingHeaders" "${DERIVED_SOURCES_WEBCORE_DIR}" "${DERIVED_SOURCES_WEBKIT2_DIR}" "${DERIVED_SOURCES_WEBKIT2_DIR}/include" @@ -367,7 +372,9 @@ SET(WebKit2_SOURCES WebProcess/InjectedBundle/InjectedBundleClient.cpp WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp + WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp + WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp @@ -385,6 +392,7 @@ SET(WebKit2_SOURCES WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp + WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -540,8 +548,21 @@ SET(WebProcess_LIBRARIES ${WebKit2_LIBRARY_NAME} ) +SET(WebKit2_LIBRARIES + ${WebCore_LIBRARY_NAME} +) + +SET(WebKit2_FORWARDING_HEADERS_DIRECTORIES + Shared/API/c + UIProcess/API/C + UIProcess/API/cpp + WebProcess/InjectedBundle/API/c +) + WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() +WEBKIT_CREATE_FORWARDING_HEADERS(WebKit2 DIRECTORIES ${WebKit2_FORWARDING_HEADERS_DIRECTORIES}) + # Create JavaScript C++ code given an IDL input FOREACH (_file ${WebKit2_MESSAGES_IN_FILES}) GET_FILENAME_COMPONENT (_name ${_file} NAME_WE) @@ -556,17 +577,11 @@ FOREACH (_file ${WebKit2_MESSAGES_IN_FILES}) LIST(APPEND WebKit2_SOURCES ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp) ENDFOREACH () -SET(WebKit2_LIBRARIES - ${WebCore_LIBRARY_NAME} -) - ADD_DEFINITIONS(-DBUILDING_WEBKIT) INCLUDE_DIRECTORIES(${WebKit2_INCLUDE_DIRECTORIES}) ADD_LIBRARY(${WebKit2_LIBRARY_NAME} ${WebKit2_LIBRARY_TYPE} ${WebKit2_SOURCES}) ADD_DEPENDENCIES(${WebKit2_LIBRARY_NAME} ${WebCore_LIBRARY_NAME}) -ADD_DEPENDENCIES(${WebKit2_LIBRARY_NAME} ${ForwardingHeaders_NAME}) -ADD_DEPENDENCIES(${WebKit2_LIBRARY_NAME} ${ForwardingNetworkHeaders_NAME}) TARGET_LINK_LIBRARIES(${WebKit2_LIBRARY_NAME} ${WebKit2_LIBRARIES}) SET_TARGET_PROPERTIES(${WebKit2_LIBRARY_NAME} PROPERTIES FOLDER "WebKit") SET_TARGET_PROPERTIES(${WebKit2_LIBRARY_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 808b60f2b..b8fec0cf1 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,1166 @@ +2012-07-29 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Resource agent's reference to cached resources should be weak. + https://bugs.webkit.org/show_bug.cgi?id=92108 + + Reviewed by Pavel Feldman. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + +2012-07-29 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] TILED_BACKING_STORE support on Efl WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=91582 + + Reviewed by Noam Rosenthal. + + This patch is a subset of Efl's UI_SIDE_COMPOSITING implementation. + Add a dummy function for fixing building error when enabling TILED_BACKING_STORE. + + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit): + (WebKit::PageClientImpl::pageDidRequestScroll): + * UIProcess/API/efl/PageClientImpl.h: + (PageClientImpl): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + +2012-07-29 Patrick Gansterer <paroga@webkit.org> + + [CMake] Use WEBKIT_CREATE_FORWARDING_HEADERS to generate WK2 forwarding headers + https://bugs.webkit.org/show_bug.cgi?id=83579 + + Reviewed by Daniel Bates. + + Using a list of directories in combination with the WEBKIT_CREATE_FORWARDING_HEADERS + macro allows us to share the common generation of forwarding headers across ports. + + * CMakeLists.txt: + * PlatformEfl.cmake: + +2012-07-28 Sam Weinig <sam@webkit.org> + + Stop copying unnecessary files in WebKit2 build + https://bugs.webkit.org/show_bug.cgi?id=92587 + + Reviewed by Dan Bernstein. + + * WebKit2.xcodeproj/project.pbxproj: + We were accidentally copying ColorSpaceData.h and EventDispatcher.messages.in into the + build products. Stop this. + +2012-07-28 Ryuan Choi <ryuan.choi@samsung.com> + + [WK2][EFL] Add ewk_view_scale_{get|set} to EwkView. + https://bugs.webkit.org/show_bug.cgi?id=92446 + + Reviewed by Kenneth Rohde Christiansen. + + Add methods to Ewk_View to get or set the scale factor of page. + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_scale_set): + (ewk_view_scale_get): + * UIProcess/API/efl/ewk_view.h: + +2012-07-28 Mario Sanchez Prada <msanchez@igalia.com> + + [WK2][GTK] Implement a new spell checker API for WebKit2GTK+ + https://bugs.webkit.org/show_bug.cgi?id=90268 + + Reviewed by Martin Robinson. + + Add a simple spell checking API to WK2, allowing to enable/disable + this feature and to define a list of languages associated to it. + + * GNUmakefile.am: Add flags to handle the SPELLCHECK feature. + * GNUmakefile.list.am: Added new files + + Added new internal class that will act both as the implementation + of TextCheckerClient and as the object WebKitWebContext will + depend on to implement the newly added API. + + * UIProcess/API/gtk/WebKitTextChecker.cpp: Added. + (toTextChecker): + (continuousSpellCheckingEnabledCallback): + (setContinuousSpellCheckingEnabledCallback): + (checkSpellingOfStringCallback): + (guessesForWordCallback): + (learnWordCallback): + (ignoreWordCallback): + (WebKitTextChecker::~WebKitTextChecker): + (WebKitTextChecker::create): + (WebKitTextChecker::WebKitTextChecker): + (WebKitTextChecker::checkSpellingOfString): + (WebKitTextChecker::getGuessesForWord): + (WebKitTextChecker::learnWord): + (WebKitTextChecker::ignoreWord): + (WebKitTextChecker::setSpellCheckingEnabled): + (WebKitTextChecker::setSpellCheckingLanguages): + * UIProcess/API/gtk/WebKitTextChecker.h: Added. + (WebKitTextChecker): + (WebKitTextChecker::isSpellCheckingEnabled): + (WebKitTextChecker::getSpellCheckingLanguages): + + Added WKTextChecker to WebKitPrivate.h, needed in WebKitTextChecker. + + * UIProcess/API/gtk/WebKitPrivate.h: + + Add new API to WebKitWebContext to allow enabling/disabling this + spell checking feature, and to set/get the list of languages used + to decide which dictionaries will be consulted. + + * UIProcess/API/gtk/WebKitWebContext.cpp: + (_WebKitWebContextPrivate): + (createDefaultWebContext): + (webkit_web_context_get_spell_checking_enabled): New API. + (webkit_web_context_set_spell_checking_enabled): Ditto. + (webkit_web_context_get_spell_checking_languages): Ditto. + (webkit_web_context_set_spell_checking_languages): Ditto. + * UIProcess/API/gtk/WebKitWebContext.h: + + New tests for checking the new API added to WebKitWebContext. + + * UIProcess/API/gtk/tests/TestWebKitWebContext.cpp: + (testWebContextSpellChecker): + (beforeAll): + + Update documentation with new sections and symbols. + + * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Assertion hit in ewk_cookie_manager.cpp + https://bugs.webkit.org/show_bug.cgi?id=92544 + + Reviewed by Kenneth Rohde Christiansen. + + Removed wrong assertion in ewk_cookie_manager.cpp + and replace it by an if check. The assertion was + sometimes hit by our unit tests. + + * UIProcess/API/efl/ewk_cookie_manager.cpp: + (cookiesDidChange): + +2012-07-27 Anders Carlsson <andersca@apple.com> + + Don't use an NSUserDefault for disabling the web process sandbox + https://bugs.webkit.org/show_bug.cgi?id=92542 + <rdar://problem/11976060> + + Reviewed by Mark Rowe. + + The user default was really helpful during WebKit2 bringup, but we no longer need to pay the IPC cost of initializing NSUserDefaults at startup, + so get rid of the preference and use a good old #ifdef instead. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::initializeSandbox): + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][WTR] LayoutTestController.deliverWebIntent() needs to be implemented + https://bugs.webkit.org/show_bug.cgi?id=92228 + + Reviewed by Anders Carlsson. + + Add C API to create a WKIntentData and to deliver + it to a frame. This is needed by WebKitTestRunner + to implement LayoutTestController.deliverWebIntent(). + + * UIProcess/API/C/WKIntentData.cpp: + (WKIntentDataCreate): + * UIProcess/API/C/WKIntentData.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageDeliverIntentToFrame): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/WebPage/WebPage.h: + (WebPage): Make deliverIntentToFrame() public so that it can + be used by WKBundlePage. + +2012-07-27 Anders Carlsson <andersca@apple.com> + + Show the unavailable plug-in indicator for Java applets as well + https://bugs.webkit.org/show_bug.cgi?id=92521 + + Reviewed by Sam Weinig. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::unavailablePluginButtonClicked): + This can now be called on applet elements as well. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createJavaAppletWidget): + Get the MIME type from the applet element. + +2012-07-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [WK2] Fix build warning in WebEventConversion.cpp + https://bugs.webkit.org/show_bug.cgi?id=92517 + + Reviewed by Darin Adler. + + There is a build warning related to comparison between signed and unsigned integer expressions. + + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent): + +2012-07-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [WK2] Fix build warning in WebEventConversion.cpp + https://bugs.webkit.org/show_bug.cgi?id=92517 + + Reviewed by Darin Adler. + + There is a build warning related to comparison between signed and unsigned integer expressions. + + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent): + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add download client for Ewk_Context + https://bugs.webkit.org/show_bug.cgi?id=91345 + + Reviewed by Kenneth Rohde Christiansen. + + Add download client for Ewk_Context so that + information about downloads can be reported + to the client application via Ewk_View signals. + + The client application needs to listen for + "download,request" signal on the view and set + the download path for the download in the + callback in order to accept it. If the signal + is ignored or if the download path is not set + the download will fail. + + A new Ewk_Download_Job type is introduced to provide + information relative to a download to the client + and to allow the client to interact with it (e.g. + set its download path, cancel it, ...). + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::handleDownloadRequest): + (WebKit): + * UIProcess/API/efl/PageClientImpl.h: + (PageClientImpl): + * UIProcess/API/efl/ewk_context.cpp: + (_Ewk_Context): + (_Ewk_Context::_Ewk_Context): + (_Ewk_Context::~_Ewk_Context): + (ewk_context_download_job_add): + (ewk_context_download_job_get): + (ewk_context_download_job_remove): + * UIProcess/API/efl/ewk_context_download_client.cpp: Added. + (toEwkContext): + (decideDestinationWithSuggestedFilename): + (didReceiveResponse): + (didCreateDestination): + (didReceiveData): + (didFail): + (didCancel): + (didFinish): + (ewk_context_download_client_attach): + * UIProcess/API/efl/ewk_context_download_client_private.h: Added. + * UIProcess/API/efl/ewk_context_private.h: + * UIProcess/API/efl/ewk_download_job.cpp: Added. + (_Ewk_Download_Job): + (_Ewk_Download_Job::_Ewk_Download_Job): + (_Ewk_Download_Job::~_Ewk_Download_Job): + (ewk_download_job_ref): + (ewk_download_job_unref): + (ewk_download_job_id_get): + (ewk_download_job_view_get): + (ewk_download_job_state_get): + (ewk_download_job_request_get): + (ewk_download_job_response_get): + (ewk_download_job_destination_get): + (ewk_download_job_destination_set): + (ewk_download_job_suggested_filename_get): + (ewk_download_job_cancel): + (ewk_download_job_estimated_progress_get): + (ewk_download_job_elapsed_time_get): + (ewk_download_job_response_set): + (ewk_download_job_suggested_filename_set): + (ewk_download_job_received_data): + (ewk_download_job_state_set): + (ewk_download_job_new): + * UIProcess/API/efl/ewk_download_job.h: Added. + * UIProcess/API/efl/ewk_download_job_private.h: Added. + (WebKit): + * UIProcess/API/efl/ewk_url_response.cpp: + (ewk_url_response_content_length_get): Add a function to + retrieve the content length of a URL response. + * UIProcess/API/efl/ewk_url_response.h: + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_download_job_cancelled): + (ewk_view_download_job_requested): + (ewk_view_download_job_failed): + (ewk_view_download_job_finished): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/ewk_view_private.h: + * UIProcess/API/efl/tests/resources/test.pdf: Added. + * UIProcess/API/efl/tests/test_ewk2_download_job.cpp: Added. This tests + the download functionality. + (DownloadTestData): + (fileExists): + (serverCallback): + (on_download_requested): + (on_download_cancelled): + (on_download_failed): + (on_download_finished): + (TEST_F): + * UIProcess/PageClient.h: + (PageClient): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::receivedPolicyDecision): + (WebKit): + (WebKit::WebPageProxy::handleDownloadRequest): + * UIProcess/WebPageProxy.h: + (WebPageProxy): + +2012-07-27 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] Add an ACCELERATED_COMPOSITING implementation for Efl WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=91581 + + Reviewed by Noam Rosenthal. + + This patch is a subset of Efl's UI_SIDE_COMPOSITING implementation. + When enter accelerated compositing mode, create evas_gl, evas_gl_context, and evas_gl_surface. + + * PlatformEfl.cmake: + * Shared/LayerTreeContext.h: + (LayerTreeContext): + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::viewSize): + (WebKit::PageClientImpl::enterAcceleratedCompositingMode): + (WebKit::PageClientImpl::exitAcceleratedCompositingMode): + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::_Ewk_View_Private_Data): + (ewk_view_size_get): + (ewk_view_create_gl_surface): + (ewk_view_enter_accelerated_compositing_mode): + (ewk_view_exit_accelerated_compositing_mode): + (_ewk_view_smart_calculate): + * UIProcess/API/efl/ewk_view_private.h: + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add API to Ewk_Cookie_Manager to watch for cookie changes + https://bugs.webkit.org/show_bug.cgi?id=92484 + + Reviewed by Kenneth Rohde Christiansen. + + Add API tp Ewk_Cookie_Manager so that the client can watch + for cookie changes. + + * UIProcess/API/efl/ewk_cookie_manager.cpp: + * UIProcess/API/efl/ewk_cookie_manager.h: + * UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp: Add unit tests + for cookie changes watching. + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Stop using C API to interact with the page in Ewk_View + https://bugs.webkit.org/show_bug.cgi?id=92463 + + Reviewed by Simon Hausmann. + + Stop using C API to interact with the PageProxy in Ewk_View + and use the PageProxy object directly. This avoids useless + converting to WK type using toAPI() all the time. + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_base_add): + (ewk_view_uri_update): + (ewk_view_uri_set): + (ewk_view_reload): + (ewk_view_reload_bypass_cache): + (ewk_view_stop): + (ewk_view_load_progress_get): + (ewk_view_device_pixel_ratio_set): + (ewk_view_theme_get): + (ewk_view_cursor_set): + (ewk_view_back): + (ewk_view_forward): + (ewk_view_intent_deliver): + (ewk_view_back_possible): + (ewk_view_forward_possible): + (ewk_view_setting_encoding_custom_get): + (ewk_view_setting_encoding_custom_set): + +2012-07-27 Dominik Röttsches <dominik.rottsches@intel.com> + + [Cairo] Add complex font drawing using HarfbuzzNG + https://bugs.webkit.org/show_bug.cgi?id=91864 + + Reviewed by Simon Hausmann and Martin Robinson. + + Adding includes for harfbuzz folders. + + * CMakeLists.txt: + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add more Ewk_View unit tests + https://bugs.webkit.org/show_bug.cgi?id=92407 + + Reviewed by Kenneth Rohde Christiansen. + + Add more unit tests for WebKit2 Ewk_View API. + In particular, navigation, HTML loading and + device pixel ratio functions are now tested. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: + (EWK2UnitTest::EWK2UnitTestBase::SetUp): Call ewk_init() instead + of duplicating initialization code. + (EWK2UnitTest::EWK2UnitTestBase::TearDown): call ewk_shutdown(). + (TitleChangedData): + (EWK2UnitTest): + (EWK2UnitTest::onTitleChanged): + (EWK2UnitTest::EWK2UnitTestBase::waitUntilTitleChangedTo): Add convenience + method to wait until the view main frame title changes to a given value. + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: + (EWK2UnitTestBase): + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + (serverCallbackNavigation): + +2012-07-27 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Keyboard events miss key location data. + https://bugs.webkit.org/show_bug.cgi?id=92235 + + Reviewed by Simon Hausmann. + + EFL WK2 did not initialize WebKeyboardEvent::m_isKeypad field. + This caused failure of fast/events/keydown-numpad-keys.html test. + + * Shared/efl/WebEventFactory.cpp: WebKeyboardEvent::m_isKeypad is initialized. + (WebKit::WebEventFactory::createWebKeyboardEvent): + +2012-07-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Fix wrong return value in EWK_VIEW_XXX macro. + https://bugs.webkit.org/show_bug.cgi?id=92466 + + Reviewed by Simon Hausmann. + + There are wrong return values in EWK_VIEW_XXX macros. The wrong return values + should be fixed. In addition, API description is also modified according to returned + value change. + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_uri_set): + (ewk_view_load_progress_get): + (ewk_view_device_pixel_ratio_get): + * UIProcess/API/efl/ewk_view.h: + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add unit tests for Ewk_View form client + https://bugs.webkit.org/show_bug.cgi?id=92468 + + Reviewed by Simon Hausmann. + + Add unit test for form client functionality in + Ewk_View. + + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (onFormAboutToBeSubmitted): + (TEST_F): + +2012-07-26 Zeno Albisser <zeno@webkit.org> + + Unreviewed Qt buildfix after r123786. + + Qt-minimal builds with ENABLE_REQUEST_ANIMATION_FRAME=0. + Therefore adding #ifdefs to allow for that configuration. + + * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp: + (WebKit): + * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + +2012-07-26 Zeno Albisser <zeno@webkit.org> + + [Qt] requestAnimationFrame should only trigger when a new frame can be displayed. + https://bugs.webkit.org/show_bug.cgi?id=88638 + + Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie + the servicing of scripted animations to layer syncing for WK2. + For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation. + + Reviewed by Jocelyn Turcotte. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit): + (WebKit::WebChromeClient::scheduleAnimation): + * WebProcess/WebCoreSupport/WebChromeClient.h: + (WebChromeClient): + * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::performScheduledLayerFlush): + (WebKit::LayerTreeCoordinator::scheduleAnimation): + (WebKit): + * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + * WebProcess/WebPage/LayerTreeHost.h: + (LayerTreeHost): + +2012-07-26 Jer Noble <jer.noble@apple.com> + + Add a ChromeClient method to send diagnostic logging messages from WebCore to the client. + https://bugs.webkit.org/show_bug.cgi?id=92340 + + Reviewed by Anders Carlsson. + + Pipe the ChromeClient logDiagnosticMessage() function through WebKit2 to a new bundle class + InjectedBundlePageDiagnosticLoggingClient, to be implemented by the client. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetDiagnosticLoggingClient): Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp: Added. + (WebKit::InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessage): + * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h: Added. + (InjectedBundlePageDiagnosticLoggingClient): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::logDiagnosticMessage): + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleDiagnosticLoggingClient): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundleDiagnosticLoggingClient): + + Add a convenience class to retrieve the diagnostic message keys: + * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp: Added. + (WebKit::InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessage): + * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h: Added. + (InjectedBundlePageDiagnosticLoggingClient): + + Add the InjectedBundlePageDiagnosticLoggingClient.cpp,h files. + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * win/WebKit2.vcproj: + * WebKit2.xcodeproj/project.pbxproj: + +2012-07-25 Jer Noble <jer.noble@apple.com> + + Add setting to enable and disable diagnostic logging. + https://bugs.webkit.org/show_bug.cgi?id=92337 + + Reviewed by Anders Carlsson. + + Add a WebKit2 WKPreferences API to set set the WebCore diagnosticLoggingEnabled setting. + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetDiagnosticLoggingEnabled): + (WKPreferencesGetDiagnosticLoggingEnabled): + * UIProcess/API/C/WKPreferencesPrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): Ensure this preference is propagated to Settings + whenever the preferences change. + +2012-07-26 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL][WK2] Regression(r123731): Linking errors due to efreet functions + https://bugs.webkit.org/show_bug.cgi?id=92378 + + Unreviewed build fix. + + The library list created by PlatformEfl.cmake was being erased by a + SET called after including the platform specific file. Luckily the + dependencies were fulfilled by other targets until efreet was add. + + * CMakeLists.txt: + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Compilation warning in EWK2UnitTestServer.cpp + https://bugs.webkit.org/show_bug.cgi?id=92387 + + Reviewed by Kenneth Rohde Christiansen. + + Fix compilation warning in EWK2UnitTestServer.cpp. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp: + (EWK2UnitTestServer::EWK2UnitTestServer): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + Add Network Information provider for WebKit2 EFL + by using NetworkInfoProviderEfl class from + WebCore. + + * CMakeLists.txt: + * PlatformEfl.cmake: + * UIProcess/API/efl/NetworkInfoProvider.cpp: Added. + (toNetworkInfoProvider): + (startUpdatingCallback): + (stopUpdatingCallback): + (getBandwidthCallback): + (isMeteredCallback): + (NetworkInfoProvider::create): + (NetworkInfoProvider::NetworkInfoProvider): + (NetworkInfoProvider::~NetworkInfoProvider): + (NetworkInfoProvider::bandwidth): + (NetworkInfoProvider::metered): + (NetworkInfoProvider::startUpdating): + (NetworkInfoProvider::stopUpdating): + * UIProcess/API/efl/NetworkInfoProvider.h: Added. + (NetworkInfoProvider): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Compilation warning in EWK2UnitTestServer.cpp + https://bugs.webkit.org/show_bug.cgi?id=92387 + + Reviewed by Kenneth Rohde Christiansen. + + Fix compilation warning in EWK2UnitTestServer.cpp. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp: + (EWK2UnitTestServer::EWK2UnitTestServer): + +2012-07-26 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL][WK2] Regression(r123731): Linking errors due to efreet functions + https://bugs.webkit.org/show_bug.cgi?id=92378 + + Unreviewed build fix. + + The library list created by PlatformEfl.cmake was being erased by a + SET called after including the platform specific file. Luckily the + dependencies were fulfilled by other targets until efreet was add. + + * CMakeLists.txt: + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Compilation warning in EWK2UnitTestServer.cpp + https://bugs.webkit.org/show_bug.cgi?id=92387 + + Reviewed by Kenneth Rohde Christiansen. + + Fix compilation warning in EWK2UnitTestServer.cpp. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp: + (EWK2UnitTestServer::EWK2UnitTestServer): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + Add Network Information provider for WebKit2 EFL + by using NetworkInfoProviderEfl class from + WebCore. + + * CMakeLists.txt: + * PlatformEfl.cmake: + * UIProcess/API/efl/NetworkInfoProvider.cpp: Added. + (toNetworkInfoProvider): + (startUpdatingCallback): + (stopUpdatingCallback): + (getBandwidthCallback): + (isMeteredCallback): + (NetworkInfoProvider::create): + (NetworkInfoProvider::NetworkInfoProvider): + (NetworkInfoProvider::~NetworkInfoProvider): + (NetworkInfoProvider::bandwidth): + (NetworkInfoProvider::metered): + (NetworkInfoProvider::startUpdating): + (NetworkInfoProvider::stopUpdating): + * UIProcess/API/efl/NetworkInfoProvider.h: Added. + (NetworkInfoProvider): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Compilation warning in EWK2UnitTestServer.cpp + https://bugs.webkit.org/show_bug.cgi?id=92387 + + Reviewed by Kenneth Rohde Christiansen. + + Fix compilation warning in EWK2UnitTestServer.cpp. + + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp: + (EWK2UnitTestServer::EWK2UnitTestServer): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add unit tests for Ewk_Context + https://bugs.webkit.org/show_bug.cgi?id=92005 + + Reviewed by Antonio Gomes. + + Add unit tests for WebKit2 Ewk_Context. + + * PlatformEfl.cmake: + * UIProcess/API/efl/ewk_url_scheme_request.cpp: + (ewk_url_scheme_request_finish): + * UIProcess/API/efl/ewk_url_scheme_request.h: Mark content_data + argument as const. + * UIProcess/API/efl/tests/test_ewk2_context.cpp: Added. + (TEST_F): + (schemeRequestCallback): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add form client for Ewk_View + https://bugs.webkit.org/show_bug.cgi?id=92358 + + Reviewed by Kenneth Rohde Christiansen. + + Implement a form client for EFL port in order to + send a "form,request,new" signal on the Ewk_View + whenever a form will be submitted. + + The Ewk_Form_Submission_Request type is + introduced to provide the client with information + about the form (e.g. text fields contained in the + form) and to submit it. + + This is typically used to store login information + that can be used later to pre-fill the form. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_form_submission_request.cpp: Added. + (_Ewk_Form_Submission_Request): + (_Ewk_Form_Submission_Request::_Ewk_Form_Submission_Request): + (_Ewk_Form_Submission_Request::~_Ewk_Form_Submission_Request): + (ewk_form_submission_request_ref): + (ewk_form_submission_request_unref): + (ewk_form_submission_request_field_names_get): + (ewk_form_submission_request_field_value_get): + (ewk_form_submission_request_submit): + (ewk_form_submission_request_new): + * UIProcess/API/efl/ewk_form_submission_request.h: Added. + * UIProcess/API/efl/ewk_form_submission_request_private.h: Added. + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_base_add): + (ewk_view_form_submission_request_new): + * UIProcess/API/efl/ewk_view.h: + * UIProcess/API/efl/ewk_view_form_client.cpp: Added. + (willSubmitForm): + (ewk_view_form_client_attach): + * UIProcess/API/efl/ewk_view_form_client_private.h: Added. + * UIProcess/API/efl/ewk_view_private.h: + +2012-07-26 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [WK2] WebPage::handleEditingKeyboardEvent does not check whether the node allows editing. + https://bugs.webkit.org/show_bug.cgi?id=92364 + + Reviewed by Kenneth Rohde Christiansen. + + Added a check whether the input node allows editing. If editing is not allowed + text input event will not be emitted. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::handleEditingKeyboardEvent): + +2012-07-26 Zoltan Nyul <zoltan.nyul@intel.com> + + [EFL] EFL port should use XDG paths + https://bugs.webkit.org/show_bug.cgi?id=91719 + + Reviewed by Kenneth Rohde Christiansen. + + Setting xdg paths for application cache, web-database and local-storage. + + * PlatformEfl.cmake: + * UIProcess/efl/WebContextEfl.cpp: + (WebKit::WebContext::applicationCacheDirectory): + (WebKit::WebContext::platformDefaultDatabaseDirectory): + (WebKit::WebContext::platformDefaultLocalStorageDirectory): + +2012-07-26 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] [WK2] Memory leak in ewk_view_resource_load_client.cpp + https://bugs.webkit.org/show_bug.cgi?id=92099 + + Reviewed by Kentaro Hara. + + Fix a memory leak by clearing the loadingResources HashMap on exit. + + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data::~_Ewk_View_Private_Data): + (_ewk_view_priv_loading_resources_clear): + (ewk_view_load_provisional_started): + +2012-07-26 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Kentaro Hara. + + Missing a symbol filter for Mac win port. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + +2012-07-25 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL][WK2] Implement the inspector for WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=92213 + + Reviewed by Ryosuke Niwa. + + Partial Implementation of WebInspectorProxyEfl for WebkitTestRunner. + And Web Inspector resources installation. + + * PlatformEfl.cmake: + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::WebInspectorProxy): + * UIProcess/WebInspectorProxy.h: + (WebInspectorProxy): + * UIProcess/efl/WebInspectorProxyEfl.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + (WebKit::WebInspectorProxy::platformDidClose): + (WebKit::WebInspectorProxy::inspectorPageURL): + (WebKit::WebInspectorProxy::inspectorBaseURL): + +2012-07-25 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Create a specialized struct for use in HashMap iterators + https://bugs.webkit.org/show_bug.cgi?id=92137 + + Reviewed by Ryosuke Niwa. + + * Platform/CoreIPC/ArgumentCoders.h: Add encode/decode for KeyValuePair. + +2012-07-25 Anders Carlsson <andersca@apple.com> + + Crash when calling PluginView::pluginFocusOrWindowFocusChanged when the web page is null + https://bugs.webkit.org/show_bug.cgi?id=92289 + <rdar://problem/11785352> + + Reviewed by Andreas Kling. + + Plug-in views that outlive their containing web page for various reasons (such as being protected from + destruction) need to null check the web page. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::pluginFocusOrWindowFocusChanged): + (WebKit::PluginView::setComplexTextInputState): + +2012-07-25 Christophe Dumez <christophe.dumez@intel.com> + + [WK2][WTR] LayoutTestController.sendWebIntentResponse() needs to be implemented + https://bugs.webkit.org/show_bug.cgi?id=92227 + + Reviewed by Kenneth Rohde Christiansen. + + Add new InjectedBundleIntentRequest class to wrap WebCore's + IntentRequest and use it in InjectedBundle's + didReceiveIntentForFrame callback. The WebKitTestRunner needs + to be able to reply to a Web intent request in order to + implement LayoutTestController.sendWebIntentResponse(). As + a consequence, passing a WebIntentData type in not enough. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * Shared/IntentData.cpp: + (WebKit::IntentData::IntentData): + (WebKit): + * Shared/IntentData.h: + (WebCore): + (WebKit::IntentData::IntentData): + (IntentData): + * Target.pri: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + (WebKit): + * WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp: Copied from Source/WebKit2/Shared/IntentData.cpp. + (WKBundleIntentRequestGetTypeID): + (WKBundleIntentRequestCopyIntent): + (WKBundleIntentRequestPostResult): + (WKBundleIntentRequestPostFailure): + * WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h: Copied from Source/WebKit2/Shared/IntentData.h. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp: Copied from Source/WebKit2/Shared/IntentData.cpp. + (WebKit): + (WebKit::InjectedBundleIntentRequest::create): + (WebKit::InjectedBundleIntentRequest::InjectedBundleIntentRequest): + (WebKit::InjectedBundleIntentRequest::postResult): + (WebKit::InjectedBundleIntentRequest::postFailure): + (WebKit::InjectedBundleIntentRequest::intent): + * WebProcess/InjectedBundle/InjectedBundleIntentRequest.h: Copied from Source/WebKit2/Shared/IntentData.h. + (WebCore): + (WebKit): + (InjectedBundleIntentRequest): + (WebKit::InjectedBundleIntentRequest::type): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didReceiveIntentForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + (WebKit): + (InjectedBundlePageLoaderClient): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchIntent): + +2012-07-25 Anders Carlsson <andersca@apple.com> + + Crash when a web page is closed with outstanding scrolling thread barriers + https://bugs.webkit.org/show_bug.cgi?id=92280 + <rdar://problem/11630200> + + Reviewed by Andreas Kling. + + There was a check in forceRepaintAsync to handle the drawing area going away before the block had + been invoked, but this check needs to be done earlier (as the FIXME suggested). + Move this check to dispatchAfterEnsuringUpdatedScrollPosition instead. + + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + (WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync): + (WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition): + +2012-07-25 Alexey Proskuryakov <ap@apple.com> + + Chinese IM receives incorrect/duplicated key events in text fields in webpages in Safari. + https://bugs.webkit.org/show_bug.cgi?id=89048 + <rdar://problem/11786384> + + Reviewed by Andreas Kling. + + Cannot test text input from UI process side. + + Stop relying on IPC to handle key events in order. There are too many complications + where out of order delivery is performed. Instead, queue the events at UI process + side. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::handleKeyboardEvent): + (WebKit::WebPageProxy::didReceiveEvent): + +2012-07-25 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Use eina_stringshare_add instead of strdup. + https://bugs.webkit.org/show_bug.cgi?id=92072 + + Reviewed by Kentaro Hara. + + Eina of EFL libraries supports a string functionality that replaces strdup. So, EFL port needs + to replace strdup with eina_stringshare_add function. + + * UIProcess/API/efl/ewk_intent.cpp: + (ewk_intent_suggestions_get): + (ewk_intent_extra_get): + * UIProcess/API/efl/ewk_intent.h: + +2012-07-25 Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Add ewk_view_cursor_set to change cursor. + https://bugs.webkit.org/show_bug.cgi?id=89140 + + Reviewed by Hajime Morita. + + Implement ewk_view_cursor_set to support cursor changes. + + * UIProcess/API/efl/PageClientImpl.cpp: + (WebKit::PageClientImpl::setCursor): Called ewk_view_cursor_set. + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::~_Ewk_View_Private_Data): + (_ewk_view_priv_new): Check whether ecore_x can be used. + (_ewk_view_smart_add): + Change order of initialization to use base structure in _ewk_view_priv_new. + (ewk_view_cursor_set): Added to set cursor. + * UIProcess/API/efl/ewk_view_private.h: + +2012-07-25 Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Update uri when the active URI is changed while loading. + https://bugs.webkit.org/show_bug.cgi?id=92001 + + Reviewed by Hajime Morita. + + For now, ewk_view_uri_get just return the last uri of setter. + This patch updates the uri of ewk_view when it is changed while loading. + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_uri_update): + Added to check whether current active URI has changed and send uri,changed + signal if it has changed. + (ewk_view_uri_set): + Called ewk_view_uri_update to make sure the active uri is updated when the + load operation is started. + (ewk_view_reload): Ditto. + (ewk_view_reload_bypass_cache): Ditto. + (ewk_view_load_finished): Ditto. + (ewk_view_load_provisional_redirect): Ditto. + (ewk_view_load_provisional_started): Ditto. + (ewk_view_html_string_load): Ditto. + * UIProcess/API/efl/ewk_view.h: Updated comment for uri,changed signal. + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp: + (EWK2UnitTest::EWK2UnitTestEnvironment::urlForResource): + Added to get url of custom resource for test. + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h: + * UIProcess/API/efl/tests/resources/redirect_uri_to_default.html: + Added to test ewk_view_uri_get when the page is redirected. + * UIProcess/API/efl/tests/test_ewk2_view.cpp: Ditto. + (onLoadFinishedForRedirection): + (TEST_F): Added new test case whether ewk_view_uri_get returns correct uri when + the page is redirected. + +2012-07-25 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Add ewk_main.{cpp,h} to EFL WK2 + https://bugs.webkit.org/show_bug.cgi?id=92101 + + Reviewed by Kenneth Rohde Christiansen. + + Added a centralized place for general initialization in UI process for EFL WK2. + + * PlatformEfl.cmake: + * UIProcess/API/efl/EWebKit2.h: + * UIProcess/API/efl/ewk_main.cpp: Added. + (ewk_init): General initialization. + (ewk_shutdown): General freeing. + (_ewk_init_body): An aux function. + * UIProcess/API/efl/ewk_main.h: Added. + +2012-07-24 Jae Hyun Park <jae.park@company100.net> + + WKContextGetGlobalStatistics() assigns wrong value to wkFrameCount in WKContextStatistics + https://bugs.webkit.org/show_bug.cgi?id=92173 + + Reviewed by John Sullivan. + + In WKContextGetGlobalStatistics(), wkViewCount in WebContext::Statistics + is assigned to wkFrameCount in WKContextStatistics. + wkFrameCount in WebContext:Statistics should be assigned to wkFrameCount in WKContextStatistics. + + * UIProcess/API/C/WKContext.cpp: + (WKContextGetGlobalStatistics): + +2012-07-24 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL][WK2] Add unit tests for custom text encoding setting + https://bugs.webkit.org/show_bug.cgi?id=91983 + + Reviewed by Dirk Pranke. + + Add unit tests for get and set custom text encoding methods. Also, fix + a style nit for r123177. + + * UIProcess/API/efl/ewk_view.cpp: + (ewk_view_setting_encoding_custom_set): Fix a style nit - add newline + before return. + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + +2012-07-24 Ryosuke Niwa <rniwa@webkit.org> + + WinCairo build fix attempt. + + * win/WebKit2CFLite.def: + +2012-07-24 Ryosuke Niwa <rniwa@webkit.org> + + Windows build fix attempt. + + * win/WebKit2.def: + +2012-07-24 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] Make sure that an AC sync is triggered when the canvas contents is updated. + https://bugs.webkit.org/show_bug.cgi?id=92128 + + Reviewed by Kenneth Rohde Christiansen. + + This would cause missed frames when animating an accelerated 2D canvas without + touching the document. + + * WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp: + (WebCore::WebGraphicsLayer::setContentsNeedsDisplay): + +2012-07-24 Alexey Proskuryakov <ap@apple.com> + + [Mac WK2] Improve text input logging + https://bugs.webkit.org/show_bug.cgi?id=92147 + + Reviewed by Andreas Kling. + + * UIProcess/API/mac/WKView.mm: + (-[WKView insertText:replacementRange:]): + (-[WKView keyUp:]): + (-[WKView keyDown:]): + (-[WKView flagsChanged:]): + (-[WKView _executeSavedKeypressCommands]): + (-[WKView _notifyInputContextAboutDiscardedComposition]): + (-[WKView _interpretKeyEvent:savingCommandsTo:WebCore::]): + (-[WKView _updateSecureInputState]): + +2012-07-24 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Provide more useful output when an injected bundle cannot be loaded + https://bugs.webkit.org/show_bug.cgi?id=92136 + + Reviewed by Kenneth Rohde Christiansen. + + Call eina_error_get() in case an injected bundle cannot be + loaded in order to print more information about the error. + + * WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp: + (WebKit::InjectedBundle::load): + +2012-07-24 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL][WK2] Add vibration client + https://bugs.webkit.org/show_bug.cgi?id=91371 + + Reviewed by Antonio Gomes. + + Implement Vibration provider for WebKit2 EFL and add an API to set + vibration client callbacks by application to handle the tactile + feedback in the application when the page content ask for vibration. + + * CMakeLists.txt: Add WebCore/Modules/vibration to include path. + * PlatformEfl.cmake: Add VibrationProvider.cpp file to the build + system. + * UIProcess/API/efl/VibrationProvider.cpp: Added. + (_Ewk_Vibration_Client): Structure contains the vibration client + callbacks. + (_Ewk_Vibration_Client::_Ewk_Vibration_Client): + (toVibrationProvider): Helper function to cast the clientinfo to + VibrationProvider. + (vibrateCallback): + (cancelVibrationCallback): + (VibrationProvider::create): + (VibrationProvider::VibrationProvider): + (VibrationProvider::~VibrationProvider): + (VibrationProvider::vibrate): + (VibrationProvider::cancelVibration): + (VibrationProvider::setVibrationClientCallbacks): + * UIProcess/API/efl/VibrationProvider.h: Added. + (VibrationProvider): + * UIProcess/API/efl/ewk_context.cpp: + (_Ewk_Context): + (createDefaultEwkContext): + (ewk_context_vibration_client_callbacks_set): API to set vibration + client callbacks. + * UIProcess/API/efl/ewk_context.h: + 2012-07-24 Simon Hausmann <simon.hausmann@nokia.com> [Qt] Fix compilation after QtQuick API changes diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index 9108bb4c9..eed029672 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -162,7 +162,6 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIB libWebCoreGtk.la \ $(CAIRO_LIBS) \ $(COVERAGE_LDFLAGS) \ - $(ENCHANT_LIBS) \ $(GAIL_LIBS) \ $(GAMEPAD_LIBS) \ $(GEOCLUE_LIBS) \ @@ -183,6 +182,16 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIB $(XT_LIBS) \ $(ZLIB_LIBS) +if ENABLE_SPELLCHECK +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPPFLAGS += \ + -DENABLE_SPELLCHECK=1 \ + $(ENCHANT_CFLAGS) + +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD += \ + $(ENCHANT_LIBS) +endif + + if ENABLE_WEBKIT2 pkgconfig_DATA += Source/WebKit2/webkit2gtk-@WEBKITGTK_API_VERSION@.pc endif diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index ca81d4707..eb6927046 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -701,6 +701,8 @@ webkit2_sources += \ Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h \ Source/WebKit2/UIProcess/API/gtk/WebKitSettingsPrivate.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h \ Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.h \ Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp \ @@ -964,6 +966,8 @@ webkit2_sources += \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \ @@ -996,10 +1000,14 @@ webkit2_sources += \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp \ diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h index 070f45830..dd54dfeef 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h @@ -72,6 +72,29 @@ template<typename T, typename U> struct ArgumentCoder<std::pair<T, U> > { } }; +template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValuePair<KeyType, ValueType> > { + static void encode(ArgumentEncoder* encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair) + { + encoder->encode(pair.first); + encoder->encode(pair.second); + } + + static bool decode(ArgumentDecoder* decoder, WTF::KeyValuePair<KeyType, ValueType>& pair) + { + KeyType key; + if (!decoder->decode(key)) + return false; + + ValueType value; + if (!decoder->decode(value)) + return false; + + pair.first = key; + pair.second = value; + return true; + } +}; + template<bool fixedSizeElements, typename T> struct VectorArgumentCoder; template<typename T> struct VectorArgumentCoder<false, T> { diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 316006e15..0a02c2bf6 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -3,6 +3,7 @@ LIST(APPEND WebKit2_LINK_FLAGS ${ECORE_X_LDFLAGS} ${EDJE_LDFLAGS} ${EFLDEPS_LDFLAGS} + ${EFREET_LDFLAGS} ${EVAS_LDFLAGS} ${LIBSOUP24_LDFLAGS} ) @@ -19,9 +20,9 @@ LIST(APPEND WebKit2_SOURCES Shared/API/c/gtk/WKGraphicsContextGtk.cpp - Shared/cairo/LayerTreeContextCairo.cpp Shared/cairo/ShareableBitmapCairo.cpp + Shared/efl/LayerTreeContextEfl.cpp Shared/efl/NativeWebKeyboardEventEfl.cpp Shared/efl/NativeWebWheelEventEfl.cpp Shared/efl/NativeWebMouseEventEfl.cpp @@ -37,17 +38,24 @@ LIST(APPEND WebKit2_SOURCES UIProcess/API/C/soup/WKSoupRequestManager.cpp UIProcess/API/efl/BatteryProvider.cpp + UIProcess/API/efl/NetworkInfoProvider.cpp UIProcess/API/efl/PageClientImpl.cpp + UIProcess/API/efl/VibrationProvider.cpp UIProcess/API/efl/ewk_context.cpp + UIProcess/API/efl/ewk_context_download_client.cpp UIProcess/API/efl/ewk_context_request_manager_client.cpp UIProcess/API/efl/ewk_cookie_manager.cpp + UIProcess/API/efl/ewk_download_job.cpp + UIProcess/API/efl/ewk_form_submission_request.cpp UIProcess/API/efl/ewk_intent.cpp UIProcess/API/efl/ewk_intent_service.cpp + UIProcess/API/efl/ewk_main.cpp UIProcess/API/efl/ewk_navigation_policy_decision.cpp UIProcess/API/efl/ewk_url_request.cpp UIProcess/API/efl/ewk_url_response.cpp UIProcess/API/efl/ewk_url_scheme_request.cpp UIProcess/API/efl/ewk_view.cpp + UIProcess/API/efl/ewk_view_form_client.cpp UIProcess/API/efl/ewk_view_loader_client.cpp UIProcess/API/efl/ewk_view_policy_client.cpp UIProcess/API/efl/ewk_view_resource_load_client.cpp @@ -122,6 +130,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES ${ECORE_X_INCLUDE_DIRS} ${EDJE_INCLUDE_DIRS} ${EFLDEPS_INCLUDE_DIRS} + ${EFREET_INCLUDE_DIRS} ${EVAS_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${LIBXSLT_INCLUDE_DIRS} @@ -135,6 +144,7 @@ LIST(APPEND WebKit2_LIBRARIES ${CAIRO_LIBRARIES} ${ECORE_X_LIBRARIES} ${EFLDEPS_LIBRARIES} + ${EFREET_LIBRARIES} ${Freetype_LIBRARIES} ${LIBXML2_LIBRARIES} ${SQLITE_LIBRARIES} @@ -146,6 +156,13 @@ LIST(APPEND WebKit2_LIBRARIES ${LIBSOUP24_LIBRARIES} ) +LIST (APPEND WebKit2_FORWARDING_HEADERS_DIRECTORIES + Shared/API/c/efl + Shared/API/c/soup + UIProcess/API/C/efl + UIProcess/API/C/soup +) + LIST (APPEND WebProcess_SOURCES efl/MainEfl.cpp ) @@ -163,23 +180,16 @@ LIST (APPEND WebProcess_LIBRARIES ADD_DEFINITIONS(-DDEFAULT_THEME_PATH=\"${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/themes\") -ADD_CUSTOM_TARGET(forwarding-headerEfl - COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl ${WEBKIT2_DIR} ${DERIVED_SOURCES_WEBKIT2_DIR}/include efl -) -SET(ForwardingHeaders_NAME forwarding-headerEfl) - -ADD_CUSTOM_TARGET(forwarding-headerSoup - COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl ${WEBKIT2_DIR} ${DERIVED_SOURCES_WEBKIT2_DIR}/include soup -) -SET(ForwardingNetworkHeaders_NAME forwarding-headerSoup) - CONFIGURE_FILE(efl/ewebkit2.pc.in ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc @ONLY) SET (EWebKit2_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/EWebKit2.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_context.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_cookie_manager.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_download_job.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_form_submission_request.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_intent_service.h" + "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_main.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_request.h" "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h" @@ -237,7 +247,9 @@ TARGET_LINK_LIBRARIES(ewk2UnitTestUtils ${EWK2UnitTests_LIBRARIES}) # The "ewk" on the test name needs to be suffixed with "2", otherwise it # will clash with tests from the WebKit 1 test suite. SET(EWK2UnitTests_BINARIES + test_ewk2_context test_ewk2_cookie_manager + test_ewk2_download_job test_ewk2_view ) @@ -249,3 +261,24 @@ IF (ENABLE_API_TESTS) TARGET_LINK_LIBRARIES(${testName} ${EWK2UnitTests_LIBRARIES} ewk2UnitTestUtils) ENDFOREACH () ENDIF () + +IF (ENABLE_INSPECTOR) + SET(WK2_WEB_INSPECTOR_DIR ${CMAKE_BINARY_DIR}/WebKit2/efl/webinspector) + SET(WK2_WEB_INSPECTOR_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${WebKit2_LIBRARY_NAME}-${PROJECT_VERSION_MAJOR}) + ADD_DEFINITIONS(-DWK2_WEB_INSPECTOR_DIR="${WK2_WEB_INSPECTOR_DIR}") + ADD_DEFINITIONS(-DWK2_WEB_INSPECTOR_INSTALL_DIR="${WK2_WEB_INSPECTOR_INSTALL_DIR}/webinspector") + ADD_CUSTOM_TARGET( + wk2-web-inspector-resources ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBCORE_DIR}/inspector/front-end ${WK2_WEB_INSPECTOR_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${WEBCORE_DIR}/English.lproj/localizedStrings.js ${WK2_WEB_INSPECTOR_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js ${WK2_WEB_INSPECTOR_DIR}/InspectorBackendCommands.js + DEPENDS ${WebCore_LIBRARY_NAME} + ) + INSTALL(DIRECTORY ${WK2_WEB_INSPECTOR_DIR} + DESTINATION ${WK2_WEB_INSPECTOR_INSTALL_DIR} + FILES_MATCHING PATTERN "*.js" + PATTERN "*.html" + PATTERN "*.css" + PATTERN "*.gif" + PATTERN "*.png") +ENDIF () diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h index 3f707bace..6854ecc27 100644 --- a/Source/WebKit2/Shared/API/c/WKBase.h +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -135,6 +135,7 @@ typedef const struct OpaqueWKBundleDOMWindowExtension* WKBundleDOMWindowExtensio typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef; typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef; typedef const struct OpaqueWKBundleInspector* WKBundleInspectorRef; +typedef const struct OpaqueWKBundleIntentRequest* WKBundleIntentRequestRef; typedef const struct OpaqueWKBundleNavigationAction* WKBundleNavigationActionRef; typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef; typedef const struct OpaqueWKBundlePage* WKBundlePageRef; diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h index 6e9c1d6f6..8e4d29342 100644 --- a/Source/WebKit2/Shared/APIObject.h +++ b/Source/WebKit2/Shared/APIObject.h @@ -117,6 +117,7 @@ public: TypeBundleFrame, TypeBundleHitTestResult, TypeBundleInspector, + TypeBundleIntentRequest, TypeBundleNavigationAction, TypeBundleNodeHandle, TypeBundlePage, diff --git a/Source/WebKit2/Shared/IntentData.cpp b/Source/WebKit2/Shared/IntentData.cpp index 388a3a567..4995b2ef5 100644 --- a/Source/WebKit2/Shared/IntentData.cpp +++ b/Source/WebKit2/Shared/IntentData.cpp @@ -31,11 +31,22 @@ #include "APIObject.h" #include "DataReference.h" #include "WebCoreArgumentCoders.h" +#include <WebCore/Intent.h> using namespace WebCore; namespace WebKit { +IntentData::IntentData(Intent* coreIntent) + : action(coreIntent->action()) + , type(coreIntent->type()) + , service(coreIntent->service()) + , data(coreIntent->data()->data()) + , extras(coreIntent->extras()) + , suggestions(coreIntent->suggestions()) +{ +} + void IntentData::encode(CoreIPC::ArgumentEncoder* encoder) const { encoder->encode(action); diff --git a/Source/WebKit2/Shared/IntentData.h b/Source/WebKit2/Shared/IntentData.h index 293577633..96e2d9f99 100644 --- a/Source/WebKit2/Shared/IntentData.h +++ b/Source/WebKit2/Shared/IntentData.h @@ -37,9 +37,16 @@ class ArgumentDecoder; class ArgumentEncoder; } +namespace WebCore { +class Intent; +} + namespace WebKit { struct IntentData { + IntentData() { } + explicit IntentData(WebCore::Intent*); + void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, IntentData&); diff --git a/Source/WebKit2/Shared/LayerTreeContext.h b/Source/WebKit2/Shared/LayerTreeContext.h index 710d9da81..388514db0 100644 --- a/Source/WebKit2/Shared/LayerTreeContext.h +++ b/Source/WebKit2/Shared/LayerTreeContext.h @@ -58,6 +58,8 @@ public: uint32_t webLayerID; #elif PLATFORM(GTK) uint64_t windowHandle; +#elif PLATFORM(EFL) + uint32_t webLayerID; #endif }; diff --git a/Source/WebKit2/Shared/WebEventConversion.cpp b/Source/WebKit2/Shared/WebEventConversion.cpp index 8b61e27b2..0fad683e6 100644 --- a/Source/WebKit2/Shared/WebEventConversion.cpp +++ b/Source/WebKit2/Shared/WebEventConversion.cpp @@ -319,7 +319,7 @@ public: m_timestamp = webEvent.timestamp(); // PlatformTouchEvent - for (int i = 0; i < webEvent.touchPoints().size(); ++i) + for (size_t i = 0; i < webEvent.touchPoints().size(); ++i) m_touchPoints.append(WebKit2PlatformTouchPoint(webEvent.touchPoints().at(i))); } }; diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h index 0a84cdbf8..83e0596f2 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.h +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -113,6 +113,7 @@ namespace WebKit { macro(ShouldRespectImageOrientation, shouldRespectImageOrientation, Bool, bool, false) \ macro(WantsBalancedSetDefersLoadingBehavior, wantsBalancedSetDefersLoadingBehavior, Bool, bool, false) \ macro(RequestAnimationFrameEnabled, requestAnimationFrameEnabled, Bool, bool, true) \ + macro(DiagnosticLoggingEnabled, diagnosticLoggingEnabled, Bool, bool, false) \ \ #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \ diff --git a/Source/WebKit2/Shared/efl/LayerTreeContextEfl.cpp b/Source/WebKit2/Shared/efl/LayerTreeContextEfl.cpp new file mode 100644 index 000000000..881d78782 --- /dev/null +++ b/Source/WebKit2/Shared/efl/LayerTreeContextEfl.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 Samsung Electronics. 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 "LayerTreeContext.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" + +namespace WebKit { + +LayerTreeContext::LayerTreeContext() + : webLayerID(0) +{ +} + +LayerTreeContext::~LayerTreeContext() +{ +} + +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(webLayerID); +} + +bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& context) +{ + return decoder->decode(context.webLayerID); +} + +bool LayerTreeContext::isEmpty() const +{ + return !webLayerID; +} + +bool operator==(const LayerTreeContext& a, const LayerTreeContext& b) +{ + return a.webLayerID == b.webLayerID; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/efl/WebEventFactory.cpp b/Source/WebKit2/Shared/efl/WebEventFactory.cpp index ffe2cb5a9..74a0530a3 100644 --- a/Source/WebKit2/Shared/efl/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/efl/WebEventFactory.cpp @@ -44,6 +44,8 @@ enum { RightButton = 3 }; +static const char keyPadPrefix[] = "KP_"; + static inline WebEvent::Modifiers modifiersForEvent(const Evas_Modifier* modifiers) { unsigned result = 0; @@ -158,7 +160,7 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(const Evas_Event_Mouse_Wheel* WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Down* event) { - String keyName = String(event->key); + const String keyName(event->key); return WebKeyboardEvent(WebEvent::KeyDown, String::fromUTF8(event->string), String::fromUTF8(event->string), @@ -167,7 +169,7 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Do 0 /* FIXME: nativeVirtualKeyCode */, 0 /* macCharCode */, false /* FIXME: isAutoRepeat */, - false /* FIXME: isKeypad */, + keyName.startsWith(keyPadPrefix), false /* isSystemKey */, modifiersForEvent(event->modifiers), event->timestamp); @@ -175,7 +177,7 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Do WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Up* event) { - String keyName = String(event->key); + const String keyName(event->key); return WebKeyboardEvent(WebEvent::KeyUp, String::fromUTF8(event->string), String::fromUTF8(event->string), @@ -184,7 +186,7 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const Evas_Event_Key_Up 0 /* FIXME: nativeVirtualKeyCode */, 0 /* macCharCode */, false /* FIXME: isAutoRepeat */, - false /* FIXME: isKeypad */, + keyName.startsWith(keyPadPrefix), false /* isSystemKey */, modifiersForEvent(event->modifiers), event->timestamp); diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri index e80967278..f9fc48791 100644 --- a/Source/WebKit2/Target.pri +++ b/Source/WebKit2/Target.pri @@ -319,6 +319,7 @@ HEADERS += \ WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \ WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h \ WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h \ + WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h \ WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \ @@ -331,8 +332,10 @@ HEADERS += \ WebProcess/InjectedBundle/InjectedBundleClient.h \ WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.h \ WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \ + WebProcess/InjectedBundle/InjectedBundleIntentRequest.h \ WebProcess/InjectedBundle/InjectedBundleNavigationAction.h \ WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h \ + WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h \ WebProcess/InjectedBundle/InjectedBundlePageFormClient.h \ WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h \ WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h \ @@ -700,6 +703,7 @@ SOURCES += \ WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp \ WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp \ WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \ + WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp \ WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \ WebProcess/InjectedBundle/API/c/WKBundlePage.cpp \ @@ -714,8 +718,10 @@ SOURCES += \ WebProcess/InjectedBundle/InjectedBundleClient.cpp \ WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp \ WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ + WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp \ WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp \ WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp \ + WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp \ WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp \ WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp \ WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp \ diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index 7fadf3087..e90d1129a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -112,7 +112,7 @@ void WKContextGetGlobalStatistics(WKContextStatistics* statistics) statistics->wkViewCount = webContextStatistics.wkViewCount; statistics->wkPageCount = webContextStatistics.wkPageCount; - statistics->wkFrameCount = webContextStatistics.wkViewCount; + statistics->wkFrameCount = webContextStatistics.wkFrameCount; } void WKContextAddVisitedLink(WKContextRef contextRef, WKStringRef visitedURL) diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp b/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp index a42f530ac..7a92db54c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp @@ -29,6 +29,8 @@ #include "ImmutableArray.h" #include "ImmutableDictionary.h" #include "WKAPICast.h" +#include "WKDictionary.h" +#include "WKString.h" #if ENABLE(WEB_INTENTS) #include "WebIntentData.h" @@ -45,6 +47,27 @@ WKTypeID WKIntentDataGetTypeID() #endif } +WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionaryRef) +{ +#if ENABLE(WEB_INTENTS) + IntentData intentData; + WKStringRef action = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("action"))); + ASSERT(action); + intentData.action = toImpl(action)->string(); + WKStringRef type = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("type"))); + ASSERT(type); + intentData.type = toImpl(type)->string(); + WKSerializedScriptValueRef data = static_cast<WKSerializedScriptValueRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("data"))); + if (data) + intentData.data = toImpl(data)->dataReference().vector(); + + RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData); + return toAPI(webIntentData.release().leakRef()); +#else + return 0; +#endif +} + WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef) { #if ENABLE(WEB_INTENTS) diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.h b/Source/WebKit2/UIProcess/API/C/WKIntentData.h index 030555b4b..1f809ec8d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIntentData.h +++ b/Source/WebKit2/UIProcess/API/C/WKIntentData.h @@ -33,6 +33,9 @@ extern "C" { #endif WK_EXPORT WKTypeID WKIntentDataGetTypeID(); + +WK_EXPORT WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionary); + WK_EXPORT WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef); WK_EXPORT WKStringRef WKIntentDataCopyType(WKIntentDataRef intentRef); WK_EXPORT WKURLRef WKIntentDataCopyService(WKIntentDataRef intentRef); diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 727781f01..243a17369 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -823,3 +823,13 @@ void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef) // are usually always the same (in the UI process), they are not sent to web process, not triggering the reset. toImpl(preferencesRef)->forceUpdate(); } + +void WKPreferencesSetDiagnosticLoggingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDiagnosticLoggingEnabled(enabled); +} + +bool WKPreferencesGetDiagnosticLoggingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->diagnosticLoggingEnabled(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index 6dbc47310..371c539a1 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -187,6 +187,10 @@ WK_EXPORT bool WKPreferencesGetJavaEnabledForLocalFiles(WKPreferencesRef prefere WK_EXPORT void WKPreferencesSetRequestAnimationFrameEnabled(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetRequestAnimationFrameEnabled(WKPreferencesRef); +// Defaults to false +WK_EXPORT void WKPreferencesSetDiagnosticLoggingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetDiagnosticLoggingEnabled(WKPreferencesRef preferencesRef); + WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef); #ifdef __cplusplus diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h index 597cf24cb..9a052da4b 100644 --- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h +++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 Samsung Electronics + * Copyright (C) 2012 Intel Corporation. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,8 +30,11 @@ #include "ewk_context.h" #include "ewk_cookie_manager.h" +#include "ewk_download_job.h" +#include "ewk_form_submission_request.h" #include "ewk_intent.h" #include "ewk_intent_service.h" +#include "ewk_main.h" #include "ewk_navigation_policy_decision.h" #include "ewk_url_request.h" #include "ewk_url_response.h" diff --git a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp new file mode 100644 index 000000000..54a6921da --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp @@ -0,0 +1,106 @@ +/* + * 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 "NetworkInfoProvider.h" + +#if ENABLE(NETWORK_INFO) + +#include "WKNetworkInfoManager.h" +#include <NotImplemented.h> + +static inline NetworkInfoProvider* toNetworkInfoProvider(const void* clientInfo) +{ + return static_cast<NetworkInfoProvider*>(const_cast<void*>(clientInfo)); +} + +static void startUpdatingCallback(WKNetworkInfoManagerRef, const void* clientInfo) +{ + toNetworkInfoProvider(clientInfo)->startUpdating(); +} + +static void stopUpdatingCallback(WKNetworkInfoManagerRef, const void* clientInfo) +{ + toNetworkInfoProvider(clientInfo)->stopUpdating(); +} + +static double getBandwidthCallback(WKNetworkInfoManagerRef, const void* clientInfo) +{ + return toNetworkInfoProvider(clientInfo)->bandwidth(); +} + +static bool isMeteredCallback(WKNetworkInfoManagerRef, const void* clientInfo) +{ + return toNetworkInfoProvider(clientInfo)->metered(); +} + +PassRefPtr<NetworkInfoProvider> NetworkInfoProvider::create(WKNetworkInfoManagerRef wkManager) +{ + return adoptRef(new NetworkInfoProvider(wkManager)); +} + +NetworkInfoProvider::NetworkInfoProvider(WKNetworkInfoManagerRef wkManager) + : m_wkNetworkInfoManager(wkManager) +{ + ASSERT(wkManager); + + WKNetworkInfoProvider wkNetworkInfoProvider = { + kWKNetworkInfoProviderCurrentVersion, + this, // clientInfo + startUpdatingCallback, + stopUpdatingCallback, + getBandwidthCallback, + isMeteredCallback + }; + WKNetworkInfoManagerSetProvider(m_wkNetworkInfoManager.get(), &wkNetworkInfoProvider); +} + +NetworkInfoProvider::~NetworkInfoProvider() +{ +} + +double NetworkInfoProvider::bandwidth() const +{ + return m_provider.bandwidth(); +} + +bool NetworkInfoProvider::metered() const +{ + notImplemented(); + + return false; +} + +void NetworkInfoProvider::startUpdating() +{ + m_provider.startUpdating(); +} + +void NetworkInfoProvider::stopUpdating() +{ + m_provider.stopUpdating(); +} + +#endif // ENABLE(NETWORK_INFO) diff --git a/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h new file mode 100644 index 000000000..b9f86e6e5 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NetworkInfoProvider_h +#define NetworkInfoProvider_h + +#if ENABLE(NETWORK_INFO) + +#include <NetworkInfoClient.h> +#include <NetworkInfoProviderEfl.h> +#include <WebKit2/WKBase.h> +#include <WebKit2/WKRetainPtr.h> +#include <wtf/PassRefPtr.h> + +class NetworkInfoProvider : public RefCounted<NetworkInfoProvider>, public WebCore::NetworkInfoClient { +public: + virtual ~NetworkInfoProvider(); + static PassRefPtr<NetworkInfoProvider> create(WKNetworkInfoManagerRef); + + // NetworkInfoClient interface. + virtual double bandwidth() const; + virtual bool metered() const; + + virtual void startUpdating(); + virtual void stopUpdating(); + +private: + NetworkInfoProvider(WKNetworkInfoManagerRef); + + WKRetainPtr<WKNetworkInfoManagerRef> m_wkNetworkInfoManager; + WebCore::NetworkInfoProviderEfl m_provider; +}; + +#endif // ENABLE(NETWORK_INFO) + +#endif // NetworkInfoProvider_h diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index e69f87d28..79d20a17d 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -32,6 +32,10 @@ #include "WebContext.h" #include "WebContextMenuProxy.h" #include "WebPageProxy.h" +#include "ewk_context.h" +#include "ewk_context_private.h" +#include "ewk_download_job.h" +#include "ewk_download_job_private.h" #include "ewk_view_private.h" using namespace WebCore; @@ -72,9 +76,7 @@ void PageClientImpl::scrollView(const WebCore::IntRect& scrollRect, const WebCor WebCore::IntSize PageClientImpl::viewSize() { - int width, height; - evas_object_geometry_get(m_viewWidget, 0, 0, &width, &height); - return IntSize(width, height); + return ewk_view_size_get(m_viewWidget); } bool PageClientImpl::isViewWindowActive() @@ -121,9 +123,9 @@ void PageClientImpl::toolTipChanged(const String&, const String&) notImplemented(); } -void PageClientImpl::setCursor(const Cursor&) +void PageClientImpl::setCursor(const Cursor& cursor) { - notImplemented(); + ewk_view_cursor_set(m_viewWidget, cursor); } void PageClientImpl::setCursorHiddenUntilMouseMoves(bool) @@ -221,12 +223,12 @@ void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator>, bool, bool) #if USE(ACCELERATED_COMPOSITING) void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext&) { - notImplemented(); + ewk_view_accelerated_compositing_mode_enter(m_viewWidget); } void PageClientImpl::exitAcceleratedCompositingMode() { - notImplemented(); + ewk_view_accelerated_compositing_mode_exit(m_viewWidget); } void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext&) @@ -276,4 +278,21 @@ void PageClientImpl::countStringMatchesInCustomRepresentation(const String&, Fin notImplemented(); } +void PageClientImpl::handleDownloadRequest(DownloadProxy* download) +{ + Ewk_Download_Job* ewkDownload = ewk_download_job_new(download, m_viewWidget); + // For now we only support one default context, but once we support + // multiple contexts, we will need to retrieve the context from the + // view. + ewk_context_download_job_add(ewk_context_default_get(), ewkDownload); + ewk_download_job_unref(ewkDownload); +} + +#if USE(TILED_BACKING_STORE) +void PageClientImpl::pageDidRequestScroll(const IntPoint&) +{ + notImplemented(); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h index 427ef5297..1bd22934a 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h @@ -76,6 +76,8 @@ private: virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&); virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&); + virtual void handleDownloadRequest(DownloadProxy*); + virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool); #if ENABLE(TOUCH_EVENTS) virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); @@ -106,6 +108,10 @@ private: virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned); virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned); +#if USE(TILED_BACKING_STORE) + virtual void pageDidRequestScroll(const WebCore::IntPoint&); +#endif + private: RefPtr<WebPageProxy> m_page; Evas_Object* m_viewWidget; diff --git a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp new file mode 100644 index 000000000..a96910638 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.cpp @@ -0,0 +1,108 @@ +/* + * 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 "VibrationProvider.h" + +#if ENABLE(VIBRATION) + +#include "WKAPICast.h" +#include "WKVibration.h" +#include <Evas.h> + +using namespace WebCore; + +/** + * \struct _Ewk_Vibration_Client + * @brief Contains the vibration client callbacks. + */ +struct _Ewk_Vibration_Client { + Ewk_Vibration_Client_Vibrate_Cb vibrate; + Ewk_Vibration_Client_Vibration_Cancel_Cb cancelVibration; + void* userData; + + _Ewk_Vibration_Client(Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancelVibration, void* userData) + : vibrate(vibrate) + , cancelVibration(cancelVibration) + , userData(userData) + { } +}; + +static inline VibrationProvider* toVibrationProvider(const void* clientInfo) +{ + return static_cast<VibrationProvider*>(const_cast<void*>(clientInfo)); +} + +static void vibrateCallback(WKVibrationRef vibrationRef, uint64_t vibrationTime, const void* clientInfo) +{ + toVibrationProvider(clientInfo)->vibrate(vibrationTime); +} + +static void cancelVibrationCallback(WKVibrationRef vibrationRef, const void* clientInfo) +{ + toVibrationProvider(clientInfo)->cancelVibration(); +} + +PassRefPtr<VibrationProvider> VibrationProvider::create(WKVibrationRef wkVibrationRef) +{ + return adoptRef(new VibrationProvider(wkVibrationRef)); +} + +VibrationProvider::VibrationProvider(WKVibrationRef wkVibrationRef) + : m_wkVibrationRef(wkVibrationRef) +{ + ASSERT(wkVibrationRef); + + WKVibrationProvider wkVibrationProvider = { + kWKVibrationProviderCurrentVersion, + this, // clientInfo + vibrateCallback, + cancelVibrationCallback + }; + WKVibrationSetProvider(m_wkVibrationRef.get(), &wkVibrationProvider); +} + +VibrationProvider::~VibrationProvider() +{ +} + +void VibrationProvider::vibrate(uint64_t vibrationTime) +{ + if (m_vibrationClient && m_vibrationClient->vibrate) + m_vibrationClient->vibrate(vibrationTime, m_vibrationClient->userData); +} + +void VibrationProvider::cancelVibration() +{ + if (m_vibrationClient && m_vibrationClient->cancelVibration) + m_vibrationClient->cancelVibration(m_vibrationClient->userData); +} + +void VibrationProvider::setVibrationClientCallbacks(Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancelVibration, void* data) +{ + m_vibrationClient = adoptPtr(new Ewk_Vibration_Client(vibrate, cancelVibration, data)); +} + +#endif // ENABLE(VIBRATION) diff --git a/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h new file mode 100644 index 000000000..c2643b638 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/VibrationProvider.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef VibrationProvider_h +#define VibrationProvider_h + +#if ENABLE(VIBRATION) + +#include "WKRetainPtr.h" +#include "ewk_context.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +typedef struct _Ewk_Vibration_Client Ewk_Vibration_Client; + +class VibrationProvider : public RefCounted<VibrationProvider> { +public: + static PassRefPtr<VibrationProvider> create(WKVibrationRef); + virtual ~VibrationProvider(); + + void vibrate(uint64_t vibrationTime); + void cancelVibration(); + void setVibrationClientCallbacks(Ewk_Vibration_Client_Vibrate_Cb, Ewk_Vibration_Client_Vibration_Cancel_Cb, void*); + +private: + explicit VibrationProvider(WKVibrationRef); + + WKRetainPtr<WKVibrationRef> m_wkVibrationRef; + OwnPtr<Ewk_Vibration_Client> m_vibrationClient; +}; + +#endif // ENABLE(VIBRATION) + +#endif // VibrationProvider_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp index b8607e584..f2ed417fc 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp @@ -22,13 +22,17 @@ #include "ewk_context.h" #include "BatteryProvider.h" +#include "VibrationProvider.h" #include "WKAPICast.h" #include "WKContextSoup.h" #include "WKRetainPtr.h" #include "WKString.h" +#include "ewk_context_download_client_private.h" #include "ewk_context_private.h" #include "ewk_context_request_manager_client_private.h" #include "ewk_cookie_manager_private.h" +#include "ewk_download_job.h" +#include "ewk_download_job_private.h" #include <wtf/HashMap.h> #include <wtf/text/WTFString.h> @@ -58,6 +62,10 @@ struct _Ewk_Context { #if ENABLE(BATTERY_STATUS) RefPtr<BatteryProvider> batteryProvider; #endif +#if ENABLE(VIBRATION) + RefPtr<VibrationProvider> vibrationProvider; +#endif + HashMap<uint64_t, Ewk_Download_Job*> downloadJobs; WKRetainPtr<WKSoupRequestManagerRef> requestManager; URLSchemeHandlerMap urlSchemeHandlers; @@ -72,13 +80,24 @@ struct _Ewk_Context { batteryProvider = BatteryProvider::create(wkBatteryManager); #endif +#if ENABLE(VIBRATION) + WKVibrationRef wkVibrationRef = WKContextGetVibration(contextRef); + vibrationProvider = VibrationProvider::create(wkVibrationRef); +#endif + ewk_context_request_manager_client_attach(this); + ewk_context_download_client_attach(this); } ~_Ewk_Context() { if (cookieManager) ewk_cookie_manager_free(cookieManager); + + HashMap<uint64_t, Ewk_Download_Job*>::iterator it = downloadJobs.begin(); + HashMap<uint64_t, Ewk_Download_Job*>::iterator end = downloadJobs.end(); + for ( ; it != end; ++it) + ewk_download_job_unref(it->second); } }; @@ -99,6 +118,47 @@ WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext) /** * @internal + * Registers that a new download has been requested. + */ +void ewk_context_download_job_add(Ewk_Context* ewkContext, Ewk_Download_Job* ewkDownload) +{ + EINA_SAFETY_ON_NULL_RETURN(ewkContext); + EINA_SAFETY_ON_NULL_RETURN(ewkDownload); + + uint64_t downloadId = ewk_download_job_id_get(ewkDownload); + if (ewkContext->downloadJobs.contains(downloadId)) + return; + + ewk_download_job_ref(ewkDownload); + ewkContext->downloadJobs.add(downloadId, ewkDownload); +} + +/** + * @internal + * Returns the #Ewk_Download_Job with the given @a downloadId, or + * @c 0 in case of failure. + */ +Ewk_Download_Job* ewk_context_download_job_get(const Ewk_Context* ewkContext, uint64_t downloadId) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0); + + return ewkContext->downloadJobs.get(downloadId); +} + +/** + * @internal + * Removes the #Ewk_Download_Job with the given @a downloadId from the internal + * HashMap. + */ +void ewk_context_download_job_remove(Ewk_Context* ewkContext, uint64_t downloadId) +{ + EINA_SAFETY_ON_NULL_RETURN(ewkContext); + Ewk_Download_Job* download = ewkContext->downloadJobs.take(downloadId); + if (download) + ewk_download_job_unref(download); +} + +/** * Retrieve the request manager for @a ewkContext. * * @param ewkContext a #Ewk_Context object. @@ -151,3 +211,12 @@ Eina_Bool ewk_context_uri_scheme_register(Ewk_Context* ewkContext, const char* s return true; } + +void ewk_context_vibration_client_callbacks_set(Ewk_Context* ewkContext, Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void* data) +{ + EINA_SAFETY_ON_NULL_RETURN(ewkContext); + +#if ENABLE(VIBRATION) + ewkContext->vibrationProvider->setVibrationClientCallbacks(vibrate, cancel, data); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.h b/Source/WebKit2/UIProcess/API/efl/ewk_context.h index 3df362f6f..5e4d34262 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.h @@ -47,6 +47,20 @@ typedef struct _Ewk_Context Ewk_Context; typedef void (*Ewk_Url_Scheme_Request_Cb) (Ewk_Url_Scheme_Request *request, void *user_data); /** + * @typedef Ewk_Vibration_Client_Vibrate_Cb Ewk_Vibration_Client_Vibrate_Cb + * @brief Type definition for a function that will be called back when vibrate + * request receiveed from the vibration controller. + */ +typedef void (*Ewk_Vibration_Client_Vibrate_Cb)(uint64_t vibration_time, void *user_data); + +/** + * @typedef Ewk_Vibration_Client_Vibration_Cancel_Cb Ewk_Vibration_Client_Vibration_Cancel_Cb + * @brief Type definition for a function that will be called back when cancel + * vibration request receiveed from the vibration controller. + */ +typedef void (*Ewk_Vibration_Client_Vibration_Cancel_Cb)(void *user_data); + +/** * Gets default Ewk_Context instance. * * @return Ewk_Context object. @@ -105,6 +119,22 @@ EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *conte */ EAPI Eina_Bool ewk_context_uri_scheme_register(Ewk_Context *context, const char *scheme, Ewk_Url_Scheme_Request_Cb callback, void *user_data); +/** + * Sets vibration client callbacks to handle the tactile feedback in the form of + * vibration in the client application when the content asks for vibration. + * + * To stop listening for vibration events, you may call this function with @c + * NULL for the callbacks. + * + * @param context context object to set vibration client callbacks. + * @param vibrate The function to call when the vibrate request received from the + * controller (may be @c NULL). + * @param cancel The function to call when the cancel vibration request received + * from the controller (may be @c NULL). + * @param data User data (may be @c NULL). + */ +EAPI void ewk_context_vibration_client_callbacks_set(Ewk_Context *context, Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void *data); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp new file mode 100644 index 000000000..1cb7e17f2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp @@ -0,0 +1,145 @@ +/* + * 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 "DownloadProxy.h" +#include "WKAPICast.h" +#include "WKContext.h" +#include "WKString.h" +#include "ewk_context_download_client_private.h" +#include "ewk_context_private.h" +#include "ewk_download_job.h" +#include "ewk_download_job_private.h" +#include "ewk_url_response.h" +#include "ewk_url_response_private.h" +#include "ewk_view_private.h" +#include "ewk_web_error.h" +#include "ewk_web_error_private.h" +#include <string.h> +#include <wtf/text/CString.h> + +using namespace WebKit; + +static inline Ewk_Context* toEwkContext(const void* clientInfo) +{ + return static_cast<Ewk_Context*>(const_cast<void*>(clientInfo)); +} + +static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* allowOverwrite, const void* clientInfo) +{ + Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID()); + ASSERT(download); + + ewk_download_job_suggested_filename_set(download, toImpl(filename)->string().utf8().data()); + + // We send the new download signal on the Ewk_View only once we have received the response + // and the suggested file name. + ewk_view_download_job_requested(ewk_download_job_view_get(download), download); + + // DownloadSoup expects the destination to be a URI. + String destination = String("file://") + String::fromUTF8(ewk_download_job_destination_get(download)); + + return WKStringCreateWithUTF8CString(destination.utf8().data()); +} + +static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* clientInfo) +{ + Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID()); + ASSERT(download); + Ewk_Url_Response* response = ewk_url_response_new(toImpl(wkResponse)->resourceResponse()); + ewk_download_job_response_set(download, response); + ewk_url_response_unref(response); +} + +static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef path, const void* clientInfo) +{ + Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID()); + ASSERT(download); + + ewk_download_job_state_set(download, EWK_DOWNLOAD_JOB_STATE_DOWNLOADING); +} + +static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* clientInfo) +{ + Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID()); + ASSERT(download); + ewk_download_job_received_data(download, length); +} + +static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void *clientInfo) +{ + uint64_t downloadId = toImpl(wkDownload)->downloadID(); + Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), downloadId); + ASSERT(download); + + Ewk_Web_Error* ewkError = ewk_web_error_new(error); + ewk_download_job_state_set(download, EWK_DOWNLOAD_JOB_STATE_FAILED); + ewk_view_download_job_failed(ewk_download_job_view_get(download), download, ewkError); + ewk_web_error_free(ewkError); + ewk_context_download_job_remove(toEwkContext(clientInfo), downloadId); +} + +static void didCancel(WKContextRef, WKDownloadRef wkDownload, const void *clientInfo) +{ + uint64_t downloadId = toImpl(wkDownload)->downloadID(); + Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), downloadId); + ASSERT(download); + + ewk_download_job_state_set(download, EWK_DOWNLOAD_JOB_STATE_CANCELLED); + ewk_view_download_job_cancelled(ewk_download_job_view_get(download), download); + ewk_context_download_job_remove(toEwkContext(clientInfo), downloadId); +} + +static void didFinish(WKContextRef, WKDownloadRef wkDownload, const void *clientInfo) +{ + uint64_t downloadId = toImpl(wkDownload)->downloadID(); + Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), downloadId); + ASSERT(download); + + ewk_download_job_state_set(download, EWK_DOWNLOAD_JOB_STATE_FINISHED); + ewk_view_download_job_finished(ewk_download_job_view_get(download), download); + ewk_context_download_job_remove(toEwkContext(clientInfo), downloadId); +} + +void ewk_context_download_client_attach(Ewk_Context* ewkContext) +{ + WKContextDownloadClient wkDownloadClient; + memset(&wkDownloadClient, 0, sizeof(WKContextDownloadClient)); + + wkDownloadClient.version = kWKContextDownloadClientCurrentVersion; + wkDownloadClient.clientInfo = ewkContext; + wkDownloadClient.didCancel = didCancel; + wkDownloadClient.decideDestinationWithSuggestedFilename = decideDestinationWithSuggestedFilename; + wkDownloadClient.didCreateDestination = didCreateDestination; + wkDownloadClient.didReceiveResponse = didReceiveResponse; + wkDownloadClient.didReceiveData = didReceiveData; + wkDownloadClient.didFail = didFail; + wkDownloadClient.didFinish = didFinish; + + WKContextSetDownloadClient(ewk_context_WKContext_get(ewkContext), &wkDownloadClient); +} + + diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client_private.h new file mode 100644 index 000000000..f7017a863 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client_private.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_context_download_client_private_h +#define ewk_context_download_client_private_h + +typedef struct _Ewk_Context Ewk_Context; + +void ewk_context_download_client_attach(Ewk_Context*); + +#endif // ewk_context_download_client_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h index d78e1e961..db9e911d2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h @@ -23,10 +23,15 @@ #include <WebKit2/WKBase.h> typedef struct _Ewk_Context Ewk_Context; +typedef struct _Ewk_Download_Job Ewk_Download_Job; typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request; WKContextRef ewk_context_WKContext_get(const Ewk_Context*); WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context*); void ewk_context_url_scheme_request_received(Ewk_Context*, Ewk_Url_Scheme_Request*); +void ewk_context_download_job_add(Ewk_Context*, Ewk_Download_Job*); +Ewk_Download_Job* ewk_context_download_job_get(const Ewk_Context*, uint64_t downloadId); +void ewk_context_download_job_remove(Ewk_Context*, uint64_t downloadId); + #endif // ewk_context_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp index 02f1fbd76..45dd75e63 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp @@ -40,16 +40,47 @@ using namespace WebKit; +struct Cookie_Change_Handler { + Ewk_Cookie_Manager_Changes_Watch_Cb callback; + void* userData; + + Cookie_Change_Handler() + : callback(0) + , userData(0) + { } + + Cookie_Change_Handler(Ewk_Cookie_Manager_Changes_Watch_Cb _callback, void* _userData) + : callback(_callback) + , userData(_userData) + { } +}; + +static void cookiesDidChange(WKCookieManagerRef, const void* clientInfo); + /** * \struct _Ewk_Cookie_Manager * @brief Contains the cookie manager data. */ struct _Ewk_Cookie_Manager { WKRetainPtr<WKCookieManagerRef> wkCookieManager; + Cookie_Change_Handler changeHandler; _Ewk_Cookie_Manager(WKCookieManagerRef cookieManagerRef) : wkCookieManager(cookieManagerRef) - { } + { + WKCookieManagerClient wkCookieManagerClient = { + kWKCookieManagerClientCurrentVersion, + this, // clientInfo + cookiesDidChange + }; + WKCookieManagerSetClient(wkCookieManager.get(), &wkCookieManagerClient); + } + + ~_Ewk_Cookie_Manager() + { + if (changeHandler.callback) + WKCookieManagerStopObservingCookieChanges(wkCookieManager.get()); + } }; #define EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager_, ...) \ @@ -72,12 +103,28 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY, kWKHTTPCoo COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText); COMPILE_ASSERT_MATCHING_ENUM(EWK_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite); +static void cookiesDidChange(WKCookieManagerRef, const void* clientInfo) +{ + Ewk_Cookie_Manager* manager = static_cast<Ewk_Cookie_Manager*>(const_cast<void*>(clientInfo)); + + if (!manager->changeHandler.callback) + return; + + manager->changeHandler.callback(manager->changeHandler.userData); +} + void ewk_cookie_manager_persistent_storage_set(Ewk_Cookie_Manager* manager, const char* filename, Ewk_Cookie_Persistent_Storage storage) { EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); EINA_SAFETY_ON_NULL_RETURN(filename); + if (manager->changeHandler.callback) + WKCookieManagerStopObservingCookieChanges(wkManager); + toImpl(wkManager)->setCookiePersistentStorage(String::fromUTF8(filename), storage); + + if (manager->changeHandler.callback) + WKCookieManagerStartObservingCookieChanges(wkManager); } void ewk_cookie_manager_accept_policy_set(Ewk_Cookie_Manager* manager, Ewk_Cookie_Accept_Policy policy) @@ -174,6 +221,18 @@ void ewk_cookie_manager_cookies_clear(Ewk_Cookie_Manager* manager) WKCookieManagerDeleteAllCookies(wkManager); } +void ewk_cookie_manager_changes_watch(Ewk_Cookie_Manager* manager, Ewk_Cookie_Manager_Changes_Watch_Cb callback, void* data) +{ + EWK_COOKIE_MANAGER_WK_GET_OR_RETURN(manager, wkManager); + + manager->changeHandler = Cookie_Change_Handler(callback, data); + + if (callback) + WKCookieManagerStartObservingCookieChanges(wkManager); + else + WKCookieManagerStopObservingCookieChanges(wkManager); +} + /** * @internal * Frees a Ewk_Cookie_Manager object. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h index e93ed8ed8..e37780864 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h @@ -90,6 +90,12 @@ typedef void (*Ewk_Cookie_Manager_Async_Policy_Get_Cb)(Ewk_Cookie_Accept_Policy typedef void (*Ewk_Cookie_Manager_Async_Hostnames_Get_Cb)(Eina_List* hostnames, Ewk_Web_Error *error, void *event_info); /** + * @typedef Ewk_Cookie_Manager_Changes_Watch_Cb Ewk_Cookie_Manager_Changes_Watch_Cb + * @brief Callback type for use with ewk_cookie_manager_changes_watch() + */ +typedef void (*Ewk_Cookie_Manager_Changes_Watch_Cb)(void *event_info); + +/** * Set the @a filename where non-session cookies are stored persistently using @a storage as the format to read/write the cookies. * * Cookies are initially read from @filename to create an initial set of cookies. @@ -144,6 +150,17 @@ EAPI void ewk_cookie_manager_async_hostnames_with_cookies_get(const Ewk_Cookie_M EAPI void ewk_cookie_manager_hostname_cookies_clear(Ewk_Cookie_Manager *manager, const char *hostname); /** + * Watch for cookies changes in @a manager. + * + * Pass @c NULL as value for @a callback to stop watching for changes. + * + * @param manager The cookie manager to watch. + * @param callback function that will be called every time cookies are added, removed or modified. + * @param data User data (may be @c NULL). + */ +EAPI void ewk_cookie_manager_changes_watch(Ewk_Cookie_Manager *manager, Ewk_Cookie_Manager_Changes_Watch_Cb callback, void *data); + +/** * Delete all cookies of @a manager. * * @param manager The cookie manager to update. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp new file mode 100644 index 000000000..c41681071 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ewk_download_job.h" + +#include "DownloadProxy.h" +#include "WKAPICast.h" +#include "WKRetainPtr.h" +#include "WebURLRequest.h" +#include "ewk_download_job_private.h" +#include "ewk_url_request_private.h" +#include <Ecore.h> + +using namespace WebKit; + +/** + * \struct _Ewk_Download_Job + * @brief Contains the download data. + */ +struct _Ewk_Download_Job { + unsigned int __ref; /**< the reference count of the object */ + DownloadProxy* downloadProxy; + Evas_Object* view; + Ewk_Download_Job_State state; + Ewk_Url_Request* request; + Ewk_Url_Response* response; + double startTime; + double endTime; + uint64_t downloaded; /**< length already downloaded */ + const char* destination; + const char* suggestedFilename; + + _Ewk_Download_Job(DownloadProxy* download, Evas_Object* ewkView) + : __ref(1) + , downloadProxy(download) + , view(ewkView) + , state(EWK_DOWNLOAD_JOB_STATE_NOT_STARTED) + , request(0) + , response(0) + , startTime(-1) + , endTime(-1) + , downloaded(0) + , destination(0) + , suggestedFilename(0) + { } + + ~_Ewk_Download_Job() + { + ASSERT(!__ref); + if (request) + ewk_url_request_unref(request); + if (response) + ewk_url_response_unref(response); + eina_stringshare_del(destination); + eina_stringshare_del(suggestedFilename); + } +}; + +void ewk_download_job_ref(Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN(download); + + ++download->__ref; +} + +void ewk_download_job_unref(Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN(download); + + if (--download->__ref) + return; + + delete download; +} + +/** + * @internal + * Queries the identifier for this download + */ +uint64_t ewk_download_job_id_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(download->downloadProxy, 0); + + return download->downloadProxy->downloadID(); +} + +/** + * @internal + * Returns the view this download is attached to. + * The view is needed to send notification signals. + */ +Evas_Object* ewk_download_job_view_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + + return download->view; +} + +Ewk_Download_Job_State ewk_download_job_state_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, EWK_DOWNLOAD_JOB_STATE_UNKNOWN); + + return download->state; +} + +Ewk_Url_Request* ewk_download_job_request_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + + if (!download->request) { + EINA_SAFETY_ON_NULL_RETURN_VAL(download->downloadProxy, 0); + WKRetainPtr<WKURLRequestRef> wkURLRequest(AdoptWK, toAPI(WebURLRequest::create(download->downloadProxy->request()).leakRef())); + const_cast<Ewk_Download_Job*>(download)->request = ewk_url_request_new(wkURLRequest.get()); + } + + return download->request; +} + +Ewk_Url_Response* ewk_download_job_response_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + + return download->response; +} + +const char* ewk_download_job_destination_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + + return download->destination; +} + +Eina_Bool ewk_download_job_destination_set(Ewk_Download_Job* download, const char* destination) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(destination, false); + + eina_stringshare_replace(&download->destination, destination); + + return true; +} + +const char *ewk_download_job_suggested_filename_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + + return download->suggestedFilename; +} + +Eina_Bool ewk_download_job_cancel(Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(download->downloadProxy, false); + + if (download->state != EWK_DOWNLOAD_JOB_STATE_DOWNLOADING) + return false; + + download->state = EWK_DOWNLOAD_JOB_STATE_CANCELLING; + download->downloadProxy->cancel(); + return true; +} + +double ewk_download_job_estimated_progress_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + + if (!download->response) + return 0; + + const unsigned long contentLength = ewk_url_response_content_length_get(download->response); + if (!contentLength) + return 0; + + return static_cast<double>(download->downloaded) / contentLength; +} + +double ewk_download_job_elapsed_time_get(const Ewk_Download_Job* download) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + + // Download has not started yet. + if (download->startTime < 0) + return 0; + + // Download had ended, return the time elapsed between the + // download start and the end event. + if (download->endTime >= 0) + return download->endTime - download->startTime; + + // Download is still going. + return ecore_time_get() - download->startTime; +} + +/** + * @internal + * Sets the URL @a response for this @a download. + */ +void ewk_download_job_response_set(Ewk_Download_Job* download, Ewk_Url_Response* response) +{ + EINA_SAFETY_ON_NULL_RETURN(download); + EINA_SAFETY_ON_NULL_RETURN(response); + + ewk_url_response_ref(response); + download->response = response; +} + +/** + * @internal + * Sets the suggested file name for this @a download. + */ +void ewk_download_job_suggested_filename_set(Ewk_Download_Job* download, const char* suggestedFilename) +{ + EINA_SAFETY_ON_NULL_RETURN(download); + + eina_stringshare_replace(&download->suggestedFilename, suggestedFilename); +} + +/** + * @internal + * Report a given amount of data was received. + */ +void ewk_download_job_received_data(Ewk_Download_Job* download, uint64_t length) +{ + EINA_SAFETY_ON_NULL_RETURN(download); + + download->downloaded += length; +} + +/** + * @internal + * Sets the state of the download. + */ +void ewk_download_job_state_set(Ewk_Download_Job* download, Ewk_Download_Job_State state) +{ + download->state = state; + + // Update start time if the download has started + if (state == EWK_DOWNLOAD_JOB_STATE_DOWNLOADING) + download->startTime = ecore_time_get(); + + // Update end time if the download has finished (successfully or not) + if (state == EWK_DOWNLOAD_JOB_STATE_FAILED + || state == EWK_DOWNLOAD_JOB_STATE_CANCELLED + || state == EWK_DOWNLOAD_JOB_STATE_FINISHED) + download->endTime = ecore_time_get(); +} + +/** + * @internal + * Constructs a Ewk_Download_Job from a DownloadProxy. + */ +Ewk_Download_Job* ewk_download_job_new(DownloadProxy* download, Evas_Object* ewkView) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(download, 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0); + + return new _Ewk_Download_Job(download, ewkView); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h new file mode 100644 index 000000000..68f03fc7e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_download_job.h + * @brief Describes the Download Job API. + * + * @note Ewk_Download_Job encapsulates a WebKit download job in order to provide + * information about it and interact with it (e.g. set the destination + * path, cancel the download, ...). + */ + +#ifndef ewk_download_job_h +#define ewk_download_job_h + +#include "ewk_url_request.h" +#include "ewk_url_response.h" +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Download_Job_Job */ +typedef struct _Ewk_Download_Job Ewk_Download_Job; + +/// Defines the possible states of a download. +enum _Ewk_Download_Job_State { + /// The download state is unknown + EWK_DOWNLOAD_JOB_STATE_UNKNOWN = -1, + /// The download has not started yet + EWK_DOWNLOAD_JOB_STATE_NOT_STARTED, + /// The download has started + EWK_DOWNLOAD_JOB_STATE_DOWNLOADING, + /// The download stopped because of a failure + EWK_DOWNLOAD_JOB_STATE_FAILED, + /// The download is being cancelled + EWK_DOWNLOAD_JOB_STATE_CANCELLING, + /// The download stopped because it was cancelled + EWK_DOWNLOAD_JOB_STATE_CANCELLED, + /// The download completed successfully. + EWK_DOWNLOAD_JOB_STATE_FINISHED +}; +/// Creates a type name for @a _Ewk_Download_Job_State. +typedef enum _Ewk_Download_Job_State Ewk_Download_Job_State; + +/** + * Increases the reference count of the given object. + * + * @param download the download object to increase the reference count + */ +EAPI void ewk_download_job_ref(Ewk_Download_Job *download); + +/** + * Decreases the reference count of the given object, possibly freeing it. + * + * When the reference count reaches 0, the download is freed. + * + * @param download the download object to decrease the reference count + */ +EAPI void ewk_download_job_unref(Ewk_Download_Job *download); + +/** + * Query the state for this download. + * + * @param download a #Ewk_Download_Job to query. + * + * @return the download state. + */ +EAPI Ewk_Download_Job_State ewk_download_job_state_get(const Ewk_Download_Job *download); + +/** + * Query the URL request for this download. + * + * @param download a #Ewk_Download_Job to query. + * + * @return the #Ewk_Url_Request for this download. + */ +EAPI Ewk_Url_Request *ewk_download_job_request_get(const Ewk_Download_Job *download); + +/** + * Query the URL response for this download. + * + * @param download a #Ewk_Download_Job to query. + * + * @return the #Ewk_Url_Response for this download or @c NULL if it was not received yet. + */ +EAPI Ewk_Url_Response *ewk_download_job_response_get(const Ewk_Download_Job *download); + +/** + * Query the URI to which the downloaded file will be written. + * + * @param download a #Ewk_Download_Job to query. + * + * @return the destination pointer, that may be @c NULL. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup(). + */ +EAPI const char *ewk_download_job_destination_get(const Ewk_Download_Job *download); + +/** + * Sets the destination path for this download. + * + * Sets the path to which the downloaded file will be written. + * + * This method needs to be called before the download transfer + * starts, by connecting to the "download,new" signal on the + * Ewk_View and setting the destination in the callback. To set + * the destination using the filename suggested by the server + * use ewk_download_job_suggested_filename_get(). + * + * @param download #Ewk_Download_Job to update. + * @param destination the destination path. + * + * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise. + * + * @see ewk_download_job_suggested_filename_get + */ +EAPI Eina_Bool ewk_download_job_destination_set(Ewk_Download_Job *download, const char *destination); + +/** + * Queries the suggested file name for this download. + * + * It can be useful to use the value returned by this function to construct + * the destination path to pass to ewk_download_job_destination_set(). + * + * @param download #Ewk_Download_Job to query. + * + * @return The suggested file name for this download. This pointer is + * guaranteed to be eina_stringshare, so whenever possible + * save yourself some cpu cycles and use + * eina_stringshare_ref() instead of eina_stringshare_add() or + * strdup(). + * + * @see ewk_download_job_destination_set + */ +EAPI const char *ewk_download_job_suggested_filename_get(const Ewk_Download_Job *download); + +/** + * Cancels the download asynchronously. + * + * When the ongoing download operation is effectively cancelled a "download,cancelled" + * signal will be emitted on the view. + * + * @param download a #Ewk_Download_Job to cancel. + * + * @return @c EINA_TRUE if the cancellation request was taken into account, or + * @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_download_job_cancel(Ewk_Download_Job *download); + +/** + * Query the estimated progress for this download. + * + * @param download a #Ewk_Download_Job to query. + * + * @return an estimate of the of the percent complete for a download + * as a range from 0.0 to 1.0. + */ +EAPI double ewk_download_job_estimated_progress_get(const Ewk_Download_Job *download); + +/** + * Gets the elapsed time in seconds, including any fractional part. + * + * If the download finished, had an error or was cancelled this is + * the time between its start and the event. + * + * @param download a #Ewk_Download_Job + * + * @return seconds since the download was started or 0.0 in case of failure. + */ +EAPI double ewk_download_job_elapsed_time_get(const Ewk_Download_Job *download); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_download_job_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h new file mode 100644 index 000000000..d043494c3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_download_job_private_h +#define ewk_download_job_private_h + +#include "WKBase.h" +#include <Evas.h> + +typedef struct _Ewk_Download_Job Ewk_Download_Job; +typedef struct _Ewk_Url_Response Ewk_Url_Response; +typedef struct _Ewk_Web_Error Ewk_Web_Error; + +namespace WebKit { +class DownloadProxy; +} + +Ewk_Download_Job* ewk_download_job_new(WebKit::DownloadProxy*, Evas_Object* ewkView); +uint64_t ewk_download_job_id_get(const Ewk_Download_Job*); +Evas_Object* ewk_download_job_view_get(const Ewk_Download_Job*); + +void ewk_download_job_state_set(Ewk_Download_Job*, Ewk_Download_Job_State); +void ewk_download_job_cancelled(Ewk_Download_Job*); +void ewk_download_job_failed(Ewk_Download_Job*); +void ewk_download_job_finished(Ewk_Download_Job*); +void ewk_download_job_started(Ewk_Download_Job*); + +void ewk_download_job_received_data(Ewk_Download_Job*, uint64_t length); +void ewk_download_job_response_set(Ewk_Download_Job*, Ewk_Url_Response*); +void ewk_download_job_suggested_filename_set(Ewk_Download_Job*, const char* suggestedFilename); + +#endif // ewk_download_job_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp new file mode 100644 index 000000000..70721735b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ewk_form_submission_request.h" + +#include "WKAPICast.h" +#include "WKArray.h" +#include "WKBase.h" +#include "WKDictionary.h" +#include "WKFormSubmissionListener.h" +#include "WKRetainPtr.h" +#include "WKString.h" +#include "ewk_form_submission_request_private.h" +#include <wtf/text/CString.h> + +using namespace WebKit; + +/** + * \struct _Ewk_Form_Submission_Request + * @brief Contains the form submission request data. + */ +struct _Ewk_Form_Submission_Request { + unsigned int __ref; /**< the reference count of the object */ + WKRetainPtr<WKDictionaryRef> wkValues; + WKRetainPtr<WKFormSubmissionListenerRef> wkListener; + bool handledRequest; + + _Ewk_Form_Submission_Request(WKDictionaryRef values, WKFormSubmissionListenerRef listener) + : __ref(1) + , wkValues(values) + , wkListener(listener) + , handledRequest(false) + { } + + ~_Ewk_Form_Submission_Request() + { + ASSERT(!__ref); + + // Make sure the request is always handled before destroying. + if (!handledRequest) + WKFormSubmissionListenerContinue(wkListener.get()); + } +}; + +void ewk_form_submission_request_ref(Ewk_Form_Submission_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN(request); + ++request->__ref; +} + +void ewk_form_submission_request_unref(Ewk_Form_Submission_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN(request); + + if (--request->__ref) + return; + + delete request; +} + +Eina_List* ewk_form_submission_request_field_names_get(Ewk_Form_Submission_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + + Eina_List* names = 0; + + WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(request->wkValues.get())); + const size_t numKeys = WKArrayGetSize(wkKeys.get()); + for (size_t i = 0; i < numKeys; ++i) { + WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i)); + names = eina_list_append(names, eina_stringshare_add(toImpl(wkKey)->string().utf8().data())); + } + + return names; +} + +const char* ewk_form_submission_request_field_value_get(Ewk_Form_Submission_Request* request, const char* name) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(name, 0); + + WKRetainPtr<WKStringRef> wkKey(AdoptWK, WKStringCreateWithUTF8CString(name)); + WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(request->wkValues.get(), wkKey.get())); + + return wkValue ? eina_stringshare_add(toImpl(wkValue)->string().utf8().data()) : 0; +} + +Eina_Bool ewk_form_submission_request_submit(Ewk_Form_Submission_Request* request) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(request, false); + + WKFormSubmissionListenerContinue(request->wkListener.get()); + request->handledRequest = true; + + return true; +} + +/** + * @internal ewk_form_submission_request_new + * Creates a Ewk_Form_Submission_Request from a dictionary and a WKFormSubmissionListenerRef. + */ +Ewk_Form_Submission_Request* ewk_form_submission_request_new(WKDictionaryRef values, WKFormSubmissionListenerRef listener) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(values, 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(listener, 0); + + return new Ewk_Form_Submission_Request(values, listener); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h new file mode 100644 index 000000000..fa67e9360 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file ewk_form_submission_request.h + * @brief Describes the Ewk Form Submission Request API. + * + * @note Ewk_Form_Submission_Request provides information regarding + * a form about the be submitted, in particular its text fields. + */ + +#ifndef ewk_form_submission_request_h +#define ewk_form_submission_request_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Creates a type name for _Ewk_Form_Submission_Request */ +typedef struct _Ewk_Form_Submission_Request Ewk_Form_Submission_Request; + +/** + * Increases the reference count of the given object. + * + * @param request the request object to increase the reference count + */ +EAPI void ewk_form_submission_request_ref(Ewk_Form_Submission_Request *request); + +/** + * Decreases the reference count of the given object, possibly freeing it. + * + * When the reference count reaches 0, the request is freed. + * + * If the reference count reaches 0 and the form request has not be submitted yet, + * ewk_form_submission_request_submit() will be called automatically before + * destruction. + * + * @param request the request object to decrease the reference count + */ +EAPI void ewk_form_submission_request_unref(Ewk_Form_Submission_Request *request); + +/** + * Returns the list of field names contained in the form associated to @a request. + * + * @param request the request object to query. + * + * @return a #Eina_List with the form text fields names, or @c NULL in case of error. + * The items of the list are guaranteed to be stringshared so use eina_stringshare_add() + * instead of strdup() to copy them and free them using eina_stringshare_del(). + * + * @see ewk_form_submission_request_field_value_get() + */ +EAPI Eina_List *ewk_form_submission_request_field_names_get(Ewk_Form_Submission_Request *request); + +/** + * Returns the value of specific field contained in the form associated to @a request. + * + * @param request the request object to query. + * @param name name of the field to query the value for. + * + * @return a #Eina_List with the form text fields names, or @c NULL in case of error. + * The string returned is guaranteed to be stringshared. You need to call + * eina_stringshare_del() on the returned value once you are done with it. + * + * @see ewk_form_submission_request_field_names_get() + */ +EAPI const char *ewk_form_submission_request_field_value_get(Ewk_Form_Submission_Request *request, const char *name); + +/** + * Continues the form request submission. + * + * If you don't call this function explicitly, the form request will be submitted + * upon @a request object destruction. + * + * @param request the request object to submit. + * + * @return @c EINA_TRUE is if successful, @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_form_submission_request_submit(Ewk_Form_Submission_Request *request); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_form_submission_request_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h new file mode 100644 index 000000000..feb3d606b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_form_submission_request_private_h +#define ewk_form_submission_request_private_h + +typedef struct _Ewk_Form_Submission_Request Ewk_Form_Submission_Request; + +Ewk_Form_Submission_Request* ewk_form_submission_request_new(WKDictionaryRef values, WKFormSubmissionListenerRef); + +#endif // ewk_form_submission_request_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp index 7322108be..856179346 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp @@ -156,7 +156,7 @@ Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent) const size_t numSuggestions = WKArrayGetSize(wkSuggestions.get()); for (size_t i = 0; i < numSuggestions; ++i) { WKURLRef wkSuggestion = static_cast<WKURLRef>(WKArrayGetItemAtIndex(wkSuggestions.get(), i)); - listOfSuggestions = eina_list_append(listOfSuggestions, strdup(toImpl(wkSuggestion)->string().utf8().data())); + listOfSuggestions = eina_list_append(listOfSuggestions, eina_stringshare_add(toImpl(wkSuggestion)->string().utf8().data())); } return listOfSuggestions; @@ -165,7 +165,7 @@ Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent) #endif } -char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) +const char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) { #if ENABLE(WEB_INTENTS) EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0); @@ -176,7 +176,7 @@ char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) if (value.isEmpty()) return 0; - return strdup(value.utf8().data()); + return eina_stringshare_add(value.utf8().data()); #else return 0; #endif @@ -193,7 +193,7 @@ Eina_List* ewk_intent_extra_names_get(const Ewk_Intent* intent) const size_t numKeys = WKArrayGetSize(wkKeys.get()); for (size_t i = 0; i < numKeys; ++i) { WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i)); - listOfKeys = eina_list_append(listOfKeys, strdup(toImpl(wkKey)->string().utf8().data())); + listOfKeys = eina_list_append(listOfKeys, eina_stringshare_add(toImpl(wkKey)->string().utf8().data())); } return listOfKeys; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent.h index ae73c6ce5..abcffa59f 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.h @@ -104,29 +104,33 @@ EAPI const char *ewk_intent_service_get(const Ewk_Intent *intent); * @param intent intent item to query. * * @return @c Eina_List with suggested service URLs on success, or @c NULL on failure, - * the Eina_List and its items should be freed after use. Use free() to free the - * items. + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. */ EAPI Eina_List *ewk_intent_suggestions_get(const Ewk_Intent *intent); /** * Retrieves the value (if any) from the extra data dictionary this intent was constructed with. * + * The returned string should be freed by eina_stringshare_del() after use. + * * @param intent intent item to query. * @param key key to query in the dictionary. * * @return a newly allocated string or @c NULL in case of error or if the key does not exist. */ -EAPI char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); +EAPI const char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); /** * Retrieve a list of the names of extra metadata associated with the intent. * + * The item of a returned list should be freed by eina_stringshare_del() after use. + * * @param intent intent item to query. * * @return @c Eina_List with names of extra metadata on success, or @c NULL on failure, - * the Eina_List and its items should be freed after use. Use free() to free the - * items. + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. */ EAPI Eina_List *ewk_intent_extra_names_get(const Ewk_Intent *intent); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp new file mode 100644 index 000000000..0d01924bc --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_main.cpp @@ -0,0 +1,105 @@ +/* + Copyright (C) 2009-2010 ProFUSION embedded systems + Copyright (C) 2009-2011 Samsung Electronics + Copyright (C) 2012 Intel Corporation + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "ewk_main.h" + +#include <Ecore.h> +#include <Ecore_Evas.h> +#include <Edje.h> +#include <Eina.h> +#include <Evas.h> +#include <glib-object.h> +#include <glib.h> + +static int _ewkInitCount = 0; + +/** + * \var _ewk_log_dom + * @brief the log domain identifier that is used with EINA's macros + */ +int _ewk_log_dom = -1; + +int ewk_init(void) +{ + if (_ewkInitCount) + return ++_ewkInitCount; + + if (!eina_init()) + goto error_eina; + + _ewk_log_dom = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE); + if (_ewk_log_dom < 0) { + EINA_LOG_CRIT("could not register log domain 'ewebkit2'"); + goto error_log_domain; + } + + if (!evas_init()) { + EINA_LOG_DOM_CRIT(_ewk_log_dom, "could not init evas."); + goto error_evas; + } + + if (!ecore_init()) { + EINA_LOG_DOM_CRIT(_ewk_log_dom, "could not init ecore."); + goto error_ecore; + } + + if (!ecore_evas_init()) { + EINA_LOG_DOM_CRIT(_ewk_log_dom, "could not init ecore_evas."); + goto error_ecore_evas; + } + + g_type_init(); + + if (!ecore_main_loop_glib_integrate()) { + EINA_LOG_DOM_WARN(_ewk_log_dom, "Ecore was not compiled with GLib support, some plugins will not " + "work (ie: Adobe Flash)"); + } + + return ++_ewkInitCount; + +error_ecore_evas: + ecore_shutdown(); +error_ecore: + evas_shutdown(); +error_evas: + eina_log_domain_unregister(_ewk_log_dom); + _ewk_log_dom = -1; +error_log_domain: + eina_shutdown(); +error_eina: + return 0; +} + +int ewk_shutdown(void) +{ + if (--_ewkInitCount) + return _ewkInitCount; + + ecore_evas_shutdown(); + ecore_shutdown(); + evas_shutdown(); + eina_log_domain_unregister(_ewk_log_dom); + _ewk_log_dom = -1; + eina_shutdown(); + + return 0; +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_main.h b/Source/WebKit2/UIProcess/API/efl/ewk_main.h new file mode 100644 index 000000000..28e93fe23 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_main.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2009-2010 ProFUSION embedded systems + Copyright (C) 2009-2010 Samsung Electronics + Copyright (C) 2012 Intel Corporation + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file ewk_main.h + * @brief The general initialization of WebKit2-EFL, not tied to any view object. + */ + +#ifndef ewk_main_h +#define ewk_main_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Initializes WebKit's instance. + * + * - initializes components needed by EFL, + * - increases a reference count of WebKit's instance. + * + * @return a reference count of WebKit's instance on success or 0 on failure + */ +EAPI int ewk_init(void); + +/** + * Decreases a reference count of WebKit's instance, possibly destroying it. + * + * If the reference count reaches 0 WebKit's instance is destroyed. + * + * @return a reference count of WebKit's instance + */ +EAPI int ewk_shutdown(void); + +#ifdef __cplusplus +} +#endif +#endif // ewk_main_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp index 137753d60..8f9f5366a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp @@ -98,6 +98,13 @@ const char* ewk_url_response_mime_type_get(const Ewk_Url_Response* response) return response->mimeType; } +unsigned long ewk_url_response_content_length_get(const Ewk_Url_Response* response) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); + + return response->coreResponse.expectedContentLength(); +} + /** * @internal * Constructs a Ewk_Url_Response from a WebCore::ResourceResponse. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h index c02622dd7..35631ebef 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h @@ -94,6 +94,17 @@ EAPI int ewk_url_response_status_code_get(const Ewk_Url_Response *response); */ EAPI const char *ewk_url_response_mime_type_get(const Ewk_Url_Response *response); +/** + * Get the expected content length of the #Ewk_Url_Response. + * + * It can be 0 if the server provided an incorrect or missing Content-Length. + * + * @param response a #Ewk_Url_Response. + * + * @return the expected content length of @a response or 0 in case of failure. + */ +EAPI unsigned long ewk_url_response_content_length_get(const Ewk_Url_Response *response); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp index 693ff3df6..32c3281f9 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp @@ -115,7 +115,7 @@ uint64_t ewk_url_scheme_request_id_get(const Ewk_Url_Scheme_Request* request) return request->requestID; } -Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request* request, void* contentData, unsigned int contentLength, const char* mimeType) +Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request* request, const void* contentData, unsigned int contentLength, const char* mimeType) { EINA_SAFETY_ON_NULL_RETURN_VAL(request, false); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h index 034cbd474..deaaf1892 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h @@ -103,7 +103,7 @@ EAPI const char *ewk_url_scheme_request_path_get(const Ewk_Url_Scheme_Request *r * @param content_length the length of the @a content_data. * @param mime_type the content type of the stream or %c NULL if not known */ -EAPI Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request *request, void *content_data, unsigned int content_length, const char *mime_type); +EAPI Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request *request, const void *content_data, unsigned int content_length, const char *mime_type); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 3f80aa11d..b1b1bcc08 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -32,19 +32,31 @@ #include "ewk_context.h" #include "ewk_context_private.h" #include "ewk_intent_private.h" +#include "ewk_view_form_client_private.h" #include "ewk_view_loader_client_private.h" #include "ewk_view_policy_client_private.h" #include "ewk_view_private.h" #include "ewk_view_resource_load_client_private.h" #include "ewk_web_resource.h" +#include <Ecore_Evas.h> +#include <Edje.h> +#include <WebCore/Cursor.h> +#include <WebCore/EflScreenUtilities.h> #include <wtf/text/CString.h> +#if USE(ACCELERATED_COMPOSITING) +#include <Evas_GL.h> +#endif + using namespace WebKit; using namespace WebCore; static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; +static const int defaultCursorSize = 16; + typedef HashMap<uint64_t, Ewk_Web_Resource*> LoadingResourcesMap; +static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingResourcesMap); struct _Ewk_View_Private_Data { OwnPtr<PageClientImpl> pageClient; @@ -52,13 +64,35 @@ struct _Ewk_View_Private_Data { const char* title; const char* theme; const char* customEncoding; + const char* cursorGroup; + Evas_Object* cursorObject; LoadingResourcesMap loadingResourcesMap; +#ifdef HAVE_ECORE_X + bool isUsingEcoreX; +#endif + +#if USE(ACCELERATED_COMPOSITING) + Evas_GL* evasGl; + Evas_GL_Context* evasGlContext; + Evas_GL_Surface* evasGlSurface; +#endif + _Ewk_View_Private_Data() : uri(0) , title(0) , theme(0) , customEncoding(0) + , cursorGroup(0) + , cursorObject(0) +#ifdef HAVE_ECORE_X + , isUsingEcoreX(false) +#endif +#if USE(ACCELERATED_COMPOSITING) + , evasGl(0) + , evasGlContext(0) + , evasGlSurface(0) +#endif { } ~_Ewk_View_Private_Data() @@ -67,6 +101,10 @@ struct _Ewk_View_Private_Data { eina_stringshare_del(title); eina_stringshare_del(theme); eina_stringshare_del(customEncoding); + _ewk_view_priv_loading_resources_clear(loadingResourcesMap); + + if (cursorObject) + evas_object_del(cursorObject); } }; @@ -284,9 +322,24 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) return 0; } +#ifdef HAVE_ECORE_X + priv->isUsingEcoreX = WebCore::isUsingEcoreX(smartData->base.evas); +#endif + return priv; } +static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingResourcesMap) +{ + // Clear the loadingResources HashMap. + LoadingResourcesMap::iterator it = loadingResourcesMap.begin(); + LoadingResourcesMap::iterator end = loadingResourcesMap.end(); + for ( ; it != end; ++it) + ewk_web_resource_unref(it->second); + + loadingResourcesMap.clear(); +} + static void _ewk_view_priv_del(Ewk_View_Private_Data* priv) { delete priv; @@ -309,9 +362,11 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) } smartData->self = ewkView; - smartData->priv = _ewk_view_priv_new(smartData); smartData->api = api; + g_parentSmartClass.add(ewkView); + + smartData->priv = _ewk_view_priv_new(smartData); if (!smartData->priv) { EINA_LOG_CRIT("could not allocate _Ewk_View_Private_Data"); evas_object_smart_data_set(ewkView, 0); @@ -319,8 +374,6 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) return; } - g_parentSmartClass.add(ewkView); - // Create evas_object_image to draw web contents. smartData->image = evas_object_image_add(smartData->base.evas); evas_object_image_alpha_set(smartData->image, false); @@ -369,6 +422,94 @@ static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord x, Evas_Coord _ewk_view_smart_changed(smartData); } +IntSize ewk_view_size_get(const Evas_Object* ewkView) +{ + int width, height; + evas_object_geometry_get(ewkView, 0, 0, &width, &height); + return IntSize(width, height); +} + +#if USE(ACCELERATED_COMPOSITING) +static bool ewk_view_create_gl_surface(const Evas_Object* ewkView, const IntSize& viewSize) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + Evas_GL_Config evasGlConfig = { + EVAS_GL_RGBA_8888, + EVAS_GL_DEPTH_BIT_8, + EVAS_GL_STENCIL_NONE, + EVAS_GL_OPTIONS_NONE, + EVAS_GL_MULTISAMPLE_NONE + }; + + ASSERT(!priv->evasGlSurface); + priv->evasGlSurface = evas_gl_surface_create(priv->evasGl, &evasGlConfig, viewSize.width(), viewSize.height()); + if (!priv->evasGlSurface) + return false; + + Evas_Native_Surface nativeSurface; + evas_gl_native_surface_get(priv->evasGl, priv->evasGlSurface, &nativeSurface); + evas_object_image_native_surface_set(smartData->image, &nativeSurface); + + return true; +} + +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); + + Evas* evas = evas_object_evas_get(ewkView); + priv->evasGl = evas_gl_new(evas); + if (!priv->evasGl) + return false; + + priv->evasGlContext = evas_gl_context_create(priv->evasGl, 0); + if (!priv->evasGlContext) { + evas_gl_free(priv->evasGl); + priv->evasGl = 0; + return false; + } + + if (!ewk_view_create_gl_surface(ewkView, ewk_view_size_get(ewkView))) { + evas_gl_context_destroy(priv->evasGl, priv->evasGlContext); + priv->evasGlContext = 0; + + evas_gl_free(priv->evasGl); + priv->evasGl = 0; + return false; + } + + return true; +} + +bool ewk_view_accelerated_compositing_mode_exit(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->evasGlSurface) { + evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface); + priv->evasGlSurface = 0; + } + + if (priv->evasGlContext) { + evas_gl_context_destroy(priv->evasGl, priv->evasGlContext); + priv->evasGlContext = 0; + } + + evas_gl_free(priv->evasGl); + priv->evasGl = 0; + + return true; +} +#endif + static void _ewk_view_smart_calculate(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); @@ -382,6 +523,16 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) if (smartData->changed.size) { if (priv->pageClient->page()->drawingArea()) priv->pageClient->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); + +#if USE(ACCELERATED_COMPOSITING) + if (!priv->evasGlSurface) + return; + evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface); + priv->evasGlSurface = 0; + ewk_view_create_gl_surface(ewkView, IntSize(width, height)); + ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height))); +#endif + smartData->view.w = width; smartData->view.h = height; smartData->changed.size = false; @@ -510,9 +661,12 @@ Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGrou } priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView); - ewk_view_loader_client_attach(toAPI(priv->pageClient->page()), ewkView); - ewk_view_policy_client_attach(toAPI(priv->pageClient->page()), ewkView); - ewk_view_resource_load_client_attach(toAPI(priv->pageClient->page()), ewkView); + + WKPageRef wkPage = toAPI(priv->pageClient->page()); + ewk_view_form_client_attach(wkPage, ewkView); + ewk_view_loader_client_attach(wkPage, ewkView); + ewk_view_policy_client_attach(wkPage, ewkView); + ewk_view_resource_load_client_attach(wkPage, ewkView); ewk_view_theme_set(ewkView, DEFAULT_THEME_PATH"/default.edj"); @@ -529,15 +683,35 @@ Evas_Object* ewk_view_add(Evas* canvas) return ewk_view_add_with_context(canvas, ewk_context_default_get()); } -Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri) +/** + * @internal + * The uri of view was changed by the frame loader. + * + * Emits signal: "uri,changed" with pointer to new uri string. + */ +void ewk_view_uri_update(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + String activeURL = priv->pageClient->page()->activeURL(); + if (activeURL.isEmpty()) + return; + + if (!eina_stringshare_replace(&priv->uri, activeURL.utf8().data())) + return; - WKRetainPtr<WKURLRef> url(AdoptWK, WKURLCreateWithUTF8CString(uri)); - WKPageLoadURL(toAPI(priv->pageClient->page()), url.get()); + evas_object_smart_callback_call(ewkView, "uri,changed", static_cast<void*>(const_cast<char*>(priv->uri))); +} - eina_stringshare_replace(&priv->uri, uri); +Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(uri, false); + + priv->pageClient->page()->loadURL(uri); + ewk_view_uri_update(ewkView); return true; } @@ -555,7 +729,9 @@ Eina_Bool ewk_view_reload(Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - WKPageReload(toAPI(priv->pageClient->page())); + priv->pageClient->page()->reload(/*reloadFromOrigin*/ false); + ewk_view_uri_update(ewkView); + return true; } @@ -564,7 +740,8 @@ Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - WKPageReloadFromOrigin(toAPI(priv->pageClient->page())); + priv->pageClient->page()->reload(/*reloadFromOrigin*/ true); + ewk_view_uri_update(ewkView); return true; } @@ -574,7 +751,8 @@ Eina_Bool ewk_view_stop(Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - WKPageStopLoading(toAPI(priv->pageClient->page())); + priv->pageClient->page()->stopLoading(); + return true; } @@ -700,10 +878,27 @@ void ewk_view_title_changed(Evas_Object* ewkView, const char* title) double ewk_view_load_progress_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); + + return priv->pageClient->page()->estimatedProgress(); +} + +Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + priv->pageClient->page()->scalePage(scaleFactor, IntPoint(x, y)); + return true; +} + +double ewk_view_scale_get(const Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1); - return WKPageGetEstimatedProgress(toAPI(priv->pageClient->page())); + return priv->pageClient->page()->pageScaleFactor(); } Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio) @@ -712,13 +907,14 @@ Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio) EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); priv->pageClient->page()->setCustomDeviceScaleFactor(ratio); + return true; } float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 1); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 1); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); return priv->pageClient->page()->deviceScaleFactor(); } @@ -762,9 +958,62 @@ const char* ewk_view_theme_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + return priv->theme; } +void ewk_view_cursor_set(Evas_Object* ewkView, const Cursor& cursor) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + const char* group = cursor.platformCursor(); + if (!group || group == priv->cursorGroup) + return; + + priv->cursorGroup = group; + + if (priv->cursorObject) + evas_object_del(priv->cursorObject); + priv->cursorObject = edje_object_add(smartData->base.evas); + + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); + if (!priv->theme || !edje_object_file_set(priv->cursorObject, priv->theme, group)) { + evas_object_del(priv->cursorObject); + priv->cursorObject = 0; + + ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0); +#ifdef HAVE_ECORE_X + if (priv->isUsingEcoreX) + WebCore::applyFallbackCursor(ecoreEvas, group); +#endif + return; + } + + Evas_Coord width, height; + edje_object_size_min_get(priv->cursorObject, &width, &height); + if (width <= 0 || height <= 0) + edje_object_size_min_calc(priv->cursorObject, &width, &height); + if (width <= 0 || height <= 0) { + width = defaultCursorSize; + height = defaultCursorSize; + } + evas_object_resize(priv->cursorObject, width, height); + + const char* data; + int hotspotX = 0; + data = edje_object_data_get(priv->cursorObject, "hot.x"); + if (data) + hotspotX = atoi(data); + + int hotspotY = 0; + data = edje_object_data_get(priv->cursorObject, "hot.y"); + if (data) + hotspotY = atoi(data); + + ecore_evas_object_cursor_set(ecoreEvas, priv->cursorObject, EVAS_LAYER_MAX, hotspotX, hotspotY); +} + void ewk_view_display(Evas_Object* ewkView, const IntRect& rect) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); @@ -774,16 +1023,62 @@ void ewk_view_display(Evas_Object* ewkView, const IntRect& rect) evas_object_image_data_update_add(smartData->image, rect.x(), rect.y(), rect.width(), rect.height()); } +/** + * @internal + * A download for that view was cancelled. + * + * Emits signal: "download,cancelled" with pointer to a Ewk_Download_Job. + */ +void ewk_view_download_job_cancelled(Evas_Object* ewkView, Ewk_Download_Job* download) +{ + evas_object_smart_callback_call(ewkView, "download,cancelled", download); +} + +/** + * @internal + * A new download has been requested for that view. + * + * Emits signal: "download,request" with pointer to a Ewk_Download_Job. + */ +void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job* download) +{ + evas_object_smart_callback_call(ewkView, "download,request", download); +} + +/** + * @internal + * A download for that view has failed. + * + * Emits signal: "download,failed" with pointer to a Ewk_Download_Job_Error. + */ +void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job* download, Ewk_Web_Error* error) +{ + Ewk_Download_Job_Error downloadError = { download, error }; + evas_object_smart_callback_call(ewkView, "download,failed", &downloadError); +} + +/** + * @internal + * A download for that view finished successfully. + * + * Emits signal: "download,finished" with pointer to a Ewk_Download_Job. + */ +void ewk_view_download_job_finished(Evas_Object* ewkView, Ewk_Download_Job* download) +{ + evas_object_smart_callback_call(ewkView, "download,finished", download); +} + Eina_Bool ewk_view_back(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - WKPageRef pageRef = toAPI(priv->pageClient->page()); - if (WKPageCanGoBack(pageRef)) { - WKPageGoBack(pageRef); + WebPageProxy* page = priv->pageClient->page(); + if (page->canGoBack()) { + page->goBack(); return true; } + return false; } @@ -792,11 +1087,12 @@ Eina_Bool ewk_view_forward(Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - WKPageRef pageRef = toAPI(priv->pageClient->page()); - if (WKPageCanGoForward(pageRef)) { - WKPageGoForward(pageRef); + WebPageProxy* page = priv->pageClient->page(); + if (page->canGoForward()) { + page->goForward(); return true; } + return false; } @@ -807,8 +1103,9 @@ Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent) EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false); - WKPageRef wkPage = toAPI(priv->pageClient->page()); - WKPageDeliverIntentToFrame(wkPage, WKPageGetMainFrame(wkPage), ewk_intent_WKIntentDataRef_get(intent)); + WebPageProxy* page = priv->pageClient->page(); + page->deliverIntentToFrame(page->mainFrame(), toImpl(ewk_intent_WKIntentDataRef_get(intent))); + return true; #else return false; @@ -820,7 +1117,7 @@ Eina_Bool ewk_view_back_possible(Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - return WKPageCanGoBack(toAPI(priv->pageClient->page())); + return priv->pageClient->page()->canGoBack(); } Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView) @@ -828,7 +1125,7 @@ Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - return WKPageCanGoForward(toAPI(priv->pageClient->page())); + return priv->pageClient->page()->canGoForward(); } void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSize& size) @@ -844,6 +1141,17 @@ void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSiz /** * @internal + * Reports that a form request is about to be submitted. + * + * Emits signal: "form,submission,request" with pointer to Ewk_Form_Submission_Request. + */ +void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request* request) +{ + evas_object_smart_callback_call(ewkView, "form,submission,request", request); +} + +/** + * @internal * Reports load failed with error information. * * Emits signal: "load,error" with pointer to Ewk_Web_Error. @@ -861,6 +1169,7 @@ void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error) */ void ewk_view_load_finished(Evas_Object* ewkView) { + ewk_view_uri_update(ewkView); evas_object_smart_callback_call(ewkView, "load,finished", 0); } @@ -883,6 +1192,7 @@ void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* */ void ewk_view_load_provisional_redirect(Evas_Object* ewkView) { + ewk_view_uri_update(ewkView); evas_object_smart_callback_call(ewkView, "load,provisional,redirect", 0); } @@ -899,12 +1209,9 @@ void ewk_view_load_provisional_started(Evas_Object* ewkView) // The main frame started provisional load, we should clear // the loadingResources HashMap to start clean. - LoadingResourcesMap::iterator it = priv->loadingResourcesMap.begin(); - LoadingResourcesMap::iterator end = priv->loadingResourcesMap.end(); - for ( ; it != end; ++it) - ewk_web_resource_unref(it->second); - priv->loadingResourcesMap.clear(); + _ewk_view_priv_loading_resources_clear(priv->loadingResourcesMap); + ewk_view_uri_update(ewkView); evas_object_smart_callback_call(ewkView, "load,provisional,started", 0); } @@ -940,6 +1247,7 @@ Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, cons priv->pageClient->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); else priv->pageClient->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); + ewk_view_uri_update(ewkView); return true; } @@ -970,11 +1278,12 @@ const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - WKRetainPtr<WKStringRef> wkEncodingName(AdoptWK, WKPageCopyCustomTextEncodingName(toAPI(priv->pageClient->page()))); - if (WKStringIsEmpty(wkEncodingName.get())) + String customEncoding = priv->pageClient->page()->customTextEncodingName(); + if (customEncoding.isEmpty()) return 0; - eina_stringshare_replace(&priv->customEncoding, toImpl(wkEncodingName.get())->string().utf8().data()); + eina_stringshare_replace(&priv->customEncoding, customEncoding.utf8().data()); + return priv->customEncoding; } @@ -983,8 +1292,8 @@ Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - WKRetainPtr<WKStringRef> wkEncodingName = encoding ? adoptWK(WKStringCreateWithUTF8CString(encoding)) : 0; if (eina_stringshare_replace(&priv->customEncoding, encoding)) - WKPageSetCustomTextEncodingName(toAPI(priv->pageClient->page()), wkEncodingName.get()); + priv->pageClient->page()->setCustomTextEncodingName(encoding ? encoding : String()); + return true; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index 924dbcf67..057f725bd 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -26,6 +26,20 @@ * * The following signals (see evas_object_smart_callback_add()) are emitted: * + * - "download,cancelled", Ewk_Download_Job*: reports that a download was effectively cancelled. + * - "download,failed", Ewk_Download_Job_Error*: reports that a download failed with the given error. + * - "download,finished", Ewk_Download_Job*: reports that a download completed successfully. + * - "download,request", Ewk_Download_Job*: reports that a new download has been requested. The client should set the + * destination path by calling ewk_download_job_destination_set() or the download will fail. + * - "form,submission,request", Ewk_Form_Submission_Request*: Reports that a form request is about to be submitted. + * The Ewk_Form_Submission_Request passed contains information about the text fields of the form. This + * is typically used to store login information that can be used later to pre-fill the form. + * The form will not be submitted until ewk_form_submission_request_submit() is called. + * It is possible to handle the form submission request asynchronously, by simply calling + * ewk_form_submission_request_ref() on the request and calling ewk_form_submission_request_submit() + * when done to continue with the form submission. If the last reference is removed on a + * #Ewk_Form_Submission_Request and the form has not been submitted yet, + * ewk_form_submission_request_submit() will be called automatically. * - "intent,request,new", Ewk_Intent_Request*: reports new Web intent request. * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration. * - "load,error", const Ewk_Web_Error*: reports main frame load failed. @@ -46,12 +60,14 @@ * - "resource,request,response", Ewk_Web_Resource_Load_Response*: a response to a resource request was received. * - "resource,request,sent", const Ewk_Web_Resource_Request*: a resource request was sent. * - "title,changed", const char*: title of the main frame was changed. + * - "uri,changed", const char*: uri of the main frame was changed. */ #ifndef ewk_view_h #define ewk_view_h #include "ewk_context.h" +#include "ewk_download_job.h" #include "ewk_intent.h" #include "ewk_url_request.h" #include "ewk_url_response.h" @@ -188,6 +204,17 @@ struct _Ewk_Web_Resource_Load_Error { Ewk_Web_Error *error; /**< load error */ }; +/// Creates a type name for _Ewk_Download_Job_Error. +typedef struct _Ewk_Download_Job_Error Ewk_Download_Job_Error; + +/** + * @brief Structure containing details about a download failure. + */ +struct _Ewk_Download_Job_Error { + Ewk_Download_Job *download_job; /**< download that failed */ + Ewk_Web_Error *error; /**< download error */ +}; + /** * Creates a new EFL WebKit view object. * @@ -213,7 +240,8 @@ EAPI Evas_Object *ewk_view_add_with_context(Evas *e, Ewk_Context *context); * @param o view object to load @a URI * @param uri uniform resource identifier to load * - * @return @c EINA_TRUE is returned if @a o is valid, irrespective of load. + * @return @c EINA_TRUE is returned if @a o is valid, irrespective of load, + * or @c EINA_FALSE on failure */ EAPI Eina_Bool ewk_view_uri_set(Evas_Object *o, const char *uri); @@ -326,7 +354,8 @@ EAPI const char *ewk_view_title_get(const Evas_Object *o); * * @param o view object to get the current progress * - * @return the load progres of page, value from 0.0 to 1.0. + * @return the load progress of page, value from 0.0 to 1.0, + * or @c -1.0 on failure */ EAPI double ewk_view_load_progress_get(const Evas_Object *o); @@ -350,6 +379,30 @@ EAPI double ewk_view_load_progress_get(const Evas_Object *o); EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const char *baseUrl, const char *unreachableUrl); /** + * Scales the current page, centered at the given point. + * + * @param o view object to set the zoom level + * @param scale_factor a new level to set + * @param cx x of center coordinate + * @param cy y of center coordinate + * + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise + */ +Eina_Bool ewk_view_scale_set(Evas_Object *o, double scaleFactor, int x, int y); + +/** + * Queries the current scale factor of the page. + * + * It returns previous scale factor after ewk_view_scale_set is called immediately + * until scale factor of page is really changed. + * + * @param o view object to get the scale factor + * + * @return current scale factor in use on success or @c -1.0 on failure + */ +double ewk_view_scale_get(const Evas_Object *o); + +/** * Queries the ratio between the CSS units and device pixels when the content is unscaled. * * When designing touch-friendly contents, knowing the approximated target size on a device @@ -382,7 +435,8 @@ EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const * * @param o view object to get device pixel ratio * - * @return the ratio between the CSS units and device pixels. + * @return the ratio between the CSS units and device pixels, + * or @c -1.0 on failure */ EAPI float ewk_view_device_pixel_ratio_get(const Evas_Object *o); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp new file mode 100644 index 000000000..264ac5e47 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client.cpp @@ -0,0 +1,51 @@ +/* + * 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 "WKPage.h" +#include "ewk_form_submission_request.h" +#include "ewk_form_submission_request_private.h" +#include "ewk_view_form_client_private.h" +#include "ewk_view_private.h" + +static void willSubmitForm(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo) +{ + Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); + + Ewk_Form_Submission_Request* request = ewk_form_submission_request_new(values, listener); + ewk_view_form_submission_request_new(ewkView, request); + ewk_form_submission_request_unref(request); +} + +void ewk_view_form_client_attach(WKPageRef pageRef, Evas_Object* ewkView) +{ + WKPageFormClient formClient; + memset(&formClient, 0, sizeof(WKPageFormClient)); + formClient.version = kWKPageFormClientCurrentVersion; + formClient.clientInfo = ewkView; + formClient.willSubmitForm = willSubmitForm; + WKPageSetPageFormClient(pageRef, &formClient); +} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h new file mode 100644 index 000000000..9feb4a138 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_form_client_private.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ewk_view_form_client_private_h +#define ewk_view_form_client_private_h + +#include <Evas.h> +#include <WebKit2/WKBase.h> + +void ewk_view_form_client_attach(WKPageRef pageRef, Evas_Object* ewkView); + +#endif // ewk_view_form_client_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index 3c9ce94a7..3b57a7618 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -26,10 +26,13 @@ #include <WebKit2/WKBase.h> namespace WebCore { +class Cursor; class IntRect; class IntSize; } +typedef struct _Ewk_Download_Job Ewk_Download_Job; +typedef struct _Ewk_Form_Submission_Request Ewk_Form_Submission_Request; typedef struct _Ewk_Url_Request Ewk_Url_Request; typedef struct _Ewk_Url_Response Ewk_Url_Response; typedef struct _Ewk_Web_Error Ewk_Web_Error; @@ -42,7 +45,13 @@ typedef struct _Ewk_Intent Ewk_Intent; typedef struct _Ewk_Intent_Service Ewk_Intent_Service; #endif +void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor); void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect); +void ewk_view_download_job_cancelled(Evas_Object* ewkView, Ewk_Download_Job*); +void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job*, Ewk_Web_Error*); +void ewk_view_download_job_finished(Evas_Object* ewkView, Ewk_Download_Job*); +void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job*); +void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request*); void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size); void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error); void ewk_view_load_finished(Evas_Object* ewkView); @@ -69,5 +78,11 @@ void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Ser #endif WebKit::WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView); +WebCore::IntSize ewk_view_size_get(const Evas_Object* ewkView); + +#if USE(ACCELERATED_COMPOSITING) +bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView); +bool ewk_view_accelerated_compositing_mode_exit(const Evas_Object* ewkView); +#endif #endif // ewk_view_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp index b8da86dce..4069e25fa 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp @@ -47,12 +47,7 @@ EWK2UnitTestBase::EWK2UnitTestBase() void EWK2UnitTestBase::SetUp() { - ASSERT_GT(ecore_evas_init(), 0); - - // glib support (for libsoup). - g_type_init(); - if (!ecore_main_loop_glib_integrate()) - fprintf(stderr, "WARNING: Glib main loop integration is not working. Some tests may fail."); + ewk_init(); unsigned int width = environment->defaultWidth(); unsigned int height = environment->defaultHeight(); @@ -77,7 +72,7 @@ void EWK2UnitTestBase::TearDown() { evas_object_del(m_webView); ecore_evas_free(m_ecoreEvas); - ecore_evas_shutdown(); + ewk_shutdown(); } void EWK2UnitTestBase::loadUrlSync(const char* url) @@ -93,4 +88,28 @@ void EWK2UnitTestBase::loadUrlSync(const char* url) evas_object_smart_callback_del(m_webView, "load,finished", onLoadFinished); } +struct TitleChangedData { + CString expectedTitle; + bool done; +}; + +static void onTitleChanged(void* userData, Evas_Object* webView, void* eventInfo) +{ + TitleChangedData* data = static_cast<TitleChangedData*>(userData); + + if (!strcmp(ewk_view_title_get(webView), data->expectedTitle.data())) + data->done = true; +} + +void EWK2UnitTestBase::waitUntilTitleChangedTo(const char* expectedTitle) +{ + TitleChangedData data = { expectedTitle, false }; + evas_object_smart_callback_add(m_webView, "title,changed", onTitleChanged, &data); + + while (!data.done) + ecore_main_loop_iterate(); + + evas_object_smart_callback_del(m_webView, "title,changed", onTitleChanged); +} + } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h index 8fa1b5021..64b9bce60 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h @@ -37,6 +37,7 @@ protected: virtual void TearDown(); void loadUrlSync(const char* url); + void waitUntilTitleChangedTo(const char* expectedTitle); private: Evas_Object* m_webView; diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp index e7bc0d621..fae77242f 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "EWK2UnitTestEnvironment.h" +#include <wtf/text/StringConcatenate.h> + namespace EWK2UnitTest { EWK2UnitTestEnvironment::EWK2UnitTestEnvironment(bool useX11Window) @@ -39,4 +41,9 @@ const char* EWK2UnitTestEnvironment::defaultTheme() const return TEST_THEME_DIR"/default.edj"; } +CString EWK2UnitTestEnvironment::urlForResource(const char* resource) +{ + return makeString("file://"TEST_RESOURCES_DIR"/", resource).utf8(); +} + } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h index fac0f5988..d010b6237 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h @@ -19,7 +19,9 @@ #ifndef EWK2UnitTestEnvironment_h #define EWK2UnitTestEnvironment_h +#include <Eina.h> #include <gtest/gtest.h> +#include <wtf/text/CString.h> namespace EWK2UnitTest { @@ -30,6 +32,7 @@ public: bool useX11Window() const { return m_useX11Window; } const char* defaultTestPageUrl() const; const char* defaultTheme() const; + CString urlForResource(const char* resource); virtual unsigned int defaultWidth() const { return m_defaultWidth; } virtual unsigned int defaultHeight() const { return m_defaultHeight; } diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp index 13e577984..52e6af46e 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp @@ -26,7 +26,7 @@ EWK2UnitTestServer::EWK2UnitTestServer() SoupAddress* address = soup_address_new("127.0.0.1", SOUP_ADDRESS_ANY_PORT); soup_address_resolve_sync(address, 0); - m_soupServer = soup_server_new(SOUP_SERVER_INTERFACE, address, 0); + m_soupServer = soup_server_new(SOUP_SERVER_INTERFACE, address, static_cast<char*>(0)); m_baseURI = soup_uri_new("http://127.0.0.1/"); soup_uri_set_port(m_baseURI, soup_server_get_port(m_soupServer)); g_object_unref(address); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/redirect_uri_to_default.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/redirect_uri_to_default.html new file mode 100644 index 000000000..846fd1113 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/redirect_uri_to_default.html @@ -0,0 +1,6 @@ +<!doctype html> +<body> +<script> +location.href="./default_test_page.html"; +</script> +</body> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/test.pdf b/Source/WebKit2/UIProcess/API/efl/tests/resources/test.pdf Binary files differnew file mode 100644 index 000000000..2424c19d9 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/test.pdf diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp new file mode 100644 index 000000000..034f87140 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp @@ -0,0 +1,69 @@ +/* + * 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 <gtest/gtest.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +static const char htmlReply[] = "<html><head><title>Foo</title></head><body>Bar</body></html>"; + +TEST_F(EWK2UnitTestBase, ewk_context_default_get) +{ + Ewk_Context* defaultContext = ewk_context_default_get(); + ASSERT_TRUE(defaultContext); + ASSERT_EQ(defaultContext, ewk_context_default_get()); +} + +TEST_F(EWK2UnitTestBase, ewk_context_cookie_manager_get) +{ + Ewk_Cookie_Manager* cookieManager = ewk_context_cookie_manager_get(ewk_context_default_get()); + ASSERT_TRUE(cookieManager); + ASSERT_EQ(cookieManager, ewk_context_cookie_manager_get(ewk_context_default_get())); +} + +static void schemeRequestCallback(Ewk_Url_Scheme_Request* request, void* userData) +{ + const char* scheme = ewk_url_scheme_request_scheme_get(request); + ASSERT_STREQ(scheme, "fooscheme"); + const char* url = ewk_url_scheme_request_url_get(request); + ASSERT_STREQ(url, "fooscheme:MyPath"); + const char* path = ewk_url_scheme_request_path_get(request); + ASSERT_STREQ(path, "MyPath"); + ASSERT_TRUE(ewk_url_scheme_request_finish(request, htmlReply, strlen(htmlReply), "text/html")); +} + +TEST_F(EWK2UnitTestBase, ewk_context_uri_scheme_register) +{ + ewk_context_uri_scheme_register(ewk_context_default_get(), "fooscheme", schemeRequestCallback, 0); + loadUrlSync("fooscheme:MyPath"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Foo"); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp index 86815b42c..7dbd496bd 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp @@ -153,6 +153,75 @@ TEST_F(EWK2UnitTestBase, ewk_cookie_manager_accept_policy) ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); } +void onCookiesChanged(void *eventInfo) +{ + bool* cookiesChanged = static_cast<bool*>(eventInfo); + *cookiesChanged = true; +} + +TEST_F(EWK2UnitTestBase, ewk_cookie_manager_changes_watch) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallback); + + Ewk_Cookie_Manager* cookieManager = ewk_context_cookie_manager_get(ewk_context_default_get()); + ASSERT_TRUE(cookieManager); + + ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS); + ASSERT_EQ(getAcceptPolicy(cookieManager), EWK_COOKIE_ACCEPT_POLICY_ALWAYS); + + // Watch for changes + bool cookiesChanged = false; + ewk_cookie_manager_changes_watch(cookieManager, onCookiesChanged, &cookiesChanged); + + // Check for cookie changes notifications + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + + while (!cookiesChanged) + ecore_main_loop_iterate(); + ASSERT_TRUE(cookiesChanged); + + cookiesChanged = false; + ewk_cookie_manager_cookies_clear(cookieManager); + while (!cookiesChanged) + ecore_main_loop_iterate(); + ASSERT_TRUE(cookiesChanged); + + // Stop watching for notifications + ewk_cookie_manager_changes_watch(cookieManager, 0, 0); + cookiesChanged = false; + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); + ASSERT_FALSE(cookiesChanged); + + // Watch again for notifications + ewk_cookie_manager_changes_watch(cookieManager, onCookiesChanged, &cookiesChanged); + + // Make sure we don't get notifications when loading setting an existing persistent storage + char textStorage1[] = "/tmp/txt-cookie.XXXXXX"; + ASSERT_TRUE(mktemp(textStorage1)); + char textStorage2[] = "/tmp/txt-cookie.XXXXXX"; + ASSERT_TRUE(mktemp(textStorage2)); + + ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage1, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); + loadUrlSync(httpServer->getURIForPath("/index.html").data()); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); + + cookiesChanged = false; + ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage2, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 0); + + ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage1, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); + ASSERT_EQ(countHostnamesWithCookies(cookieManager), 2); + + ASSERT_FALSE(cookiesChanged); + + // Final clean up. + ewk_cookie_manager_changes_watch(cookieManager, 0, 0); + unlink(textStorage1); + unlink(textStorage2); +} + TEST_F(EWK2UnitTestBase, ewk_cookie_manager_cookies_delete) { OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp new file mode 100644 index 000000000..22c97aad8 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp @@ -0,0 +1,178 @@ +/* + * 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 "UnitTestUtils/EWK2UnitTestServer.h" +#include <EWebKit2.h> +#include <Ecore.h> +#include <gtest/gtest.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +using namespace EWK2UnitTest; +using namespace WTF; + +extern EWK2UnitTestEnvironment* environment; + +static const char serverSuggestedFilename[] = "webkit-downloaded-file"; +static const char testFilePath[] = "/test.pdf"; + +struct DownloadTestData { + const char* fileUrl; + const char* destinationPath; +}; + +static inline bool fileExists(const char* path) +{ + struct stat buf; + return !stat(path, &buf); +} + +static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, void*) +{ + if (message->method != SOUP_METHOD_GET) { + soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + Eina_Strbuf* filePath = eina_strbuf_new(); + eina_strbuf_append(filePath, TEST_RESOURCES_DIR); + eina_strbuf_append(filePath, path); + + Eina_File* f = eina_file_open(eina_strbuf_string_get(filePath), false); + eina_strbuf_free(filePath); + if (!f) { + soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + soup_message_body_complete(message->response_body); + return; + } + + size_t fileSize = eina_file_size_get(f); + + void* contents = eina_file_map_all(f, EINA_FILE_POPULATE); + if (!contents) { + soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); + soup_message_body_complete(message->response_body); + return; + } + + soup_message_set_status(message, SOUP_STATUS_OK); + + Eina_Strbuf* contentDisposition = eina_strbuf_new(); + eina_strbuf_append_printf(contentDisposition, "filename=%s", serverSuggestedFilename); + soup_message_headers_append(message->response_headers, "Content-Disposition", eina_strbuf_string_get(contentDisposition)); + eina_strbuf_free(contentDisposition); + + soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, contents, fileSize); + soup_message_body_complete(message->response_body); + + eina_file_map_free(f, contents); + eina_file_close(f); +} + +static void on_download_requested(void* userData, Evas_Object* webview, void* eventInfo) +{ + DownloadTestData* testData = static_cast<DownloadTestData*>(userData); + Ewk_Download_Job* download = static_cast<Ewk_Download_Job*>(eventInfo); + ASSERT_EQ(ewk_download_job_state_get(download), EWK_DOWNLOAD_JOB_STATE_NOT_STARTED); + ASSERT_EQ(ewk_download_job_estimated_progress_get(download), 0); + ASSERT_EQ(ewk_download_job_elapsed_time_get(download), 0); + + Ewk_Url_Request* request = ewk_download_job_request_get(download); + ASSERT_TRUE(request); + EXPECT_STREQ(ewk_url_request_url_get(request), testData->fileUrl); + + Ewk_Url_Response* response = ewk_download_job_response_get(download); + ASSERT_TRUE(response); + EXPECT_STREQ(ewk_url_response_mime_type_get(response), "application/pdf"); + + EXPECT_STREQ(ewk_download_job_suggested_filename_get(download), serverSuggestedFilename); + + ASSERT_FALSE(fileExists(testData->destinationPath)); + ewk_download_job_destination_set(download, testData->destinationPath); + EXPECT_STREQ(ewk_download_job_destination_get(download), testData->destinationPath); +} + +static void on_download_cancelled(void* userData, Evas_Object* webview, void* eventInfo) +{ + fprintf(stderr, "Download was cancelled.\n"); + ecore_main_loop_quit(); + FAIL(); +} + +static void on_download_failed(void* userData, Evas_Object* webview, void* eventInfo) +{ + Ewk_Download_Job_Error* downloadError = static_cast<Ewk_Download_Job_Error*>(eventInfo); + fprintf(stderr, "Download error: %s\n", ewk_web_error_description_get(downloadError->error)); + ecore_main_loop_quit(); + FAIL(); +} + +static void on_download_finished(void* userData, Evas_Object* webview, void* eventInfo) +{ + DownloadTestData* testData = static_cast<DownloadTestData*>(userData); + Ewk_Download_Job* download = static_cast<Ewk_Download_Job*>(eventInfo); + + ASSERT_EQ(ewk_download_job_estimated_progress_get(download), 1); + ASSERT_EQ(ewk_download_job_state_get(download), EWK_DOWNLOAD_JOB_STATE_FINISHED); + ASSERT_GT(ewk_download_job_elapsed_time_get(download), 0); + + ASSERT_TRUE(fileExists(testData->destinationPath)); + + ecore_main_loop_quit(); +} + +TEST_F(EWK2UnitTestBase, ewk_download) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallback); + + // Generate unique name for destination file. + char destinationPath[] = "/tmp/pdf-file.XXXXXX"; + ASSERT_TRUE(mktemp(destinationPath)); + + CString fileUrl = httpServer->getURIForPath(testFilePath); + + DownloadTestData userData = { fileUrl.data(), destinationPath }; + ASSERT_FALSE(fileExists(destinationPath)); + + evas_object_smart_callback_add(webView(), "download,request", on_download_requested, &userData); + evas_object_smart_callback_add(webView(), "download,cancel", on_download_cancelled, &userData); + evas_object_smart_callback_add(webView(), "download,failed", on_download_failed, &userData); + evas_object_smart_callback_add(webView(), "download,finished", on_download_finished, &userData); + + // Download test pdf + ewk_view_uri_set(webView(), fileUrl.data()); + ecore_main_loop_begin(); + + // Clean up + unlink(destinationPath); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp index 8ee134d35..5edb04379 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -21,15 +21,170 @@ #include "UnitTestUtils/EWK2UnitTestBase.h" #include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include "UnitTestUtils/EWK2UnitTestServer.h" #include <EWebKit2.h> +#include <Ecore.h> #include <gtest/gtest.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/UnusedParam.h> +#include <wtf/text/CString.h> using namespace EWK2UnitTest; extern EWK2UnitTestEnvironment* environment; +static void onLoadFinishedForRedirection(void* userData, Evas_Object*, void*) +{ + int* countLoadFinished = static_cast<int*>(userData); + (*countLoadFinished)--; +} + TEST_F(EWK2UnitTestBase, ewk_view_uri_get) { loadUrlSync(environment->defaultTestPageUrl()); EXPECT_STREQ(ewk_view_uri_get(webView()), environment->defaultTestPageUrl()); + + int countLoadFinished = 2; + evas_object_smart_callback_add(webView(), "load,finished", onLoadFinishedForRedirection, &countLoadFinished); + ewk_view_uri_set(webView(), environment->urlForResource("redirect_uri_to_default.html").data()); + while (countLoadFinished) + ecore_main_loop_iterate(); + evas_object_smart_callback_del(webView(), "load,finished", onLoadFinishedForRedirection); + EXPECT_STREQ(ewk_view_uri_get(webView()), environment->defaultTestPageUrl()); +} + +TEST_F(EWK2UnitTestBase, ewk_view_device_pixel_ratio) +{ + loadUrlSync(environment->defaultTestPageUrl()); + + // Default pixel ratio is 1.0 + ASSERT_FLOAT_EQ(ewk_view_device_pixel_ratio_get(webView()), 1); + + ASSERT_TRUE(ewk_view_device_pixel_ratio_set(webView(), 1.2)); + ASSERT_FLOAT_EQ(ewk_view_device_pixel_ratio_get(webView()), 1.2); + + ASSERT_TRUE(ewk_view_device_pixel_ratio_set(webView(), 1)); + ASSERT_FLOAT_EQ(ewk_view_device_pixel_ratio_get(webView()), 1); +} + +TEST_F(EWK2UnitTestBase, ewk_view_html_string_load) +{ + ewk_view_html_string_load(webView(), "<html><head><title>Foo</title></head><body>Bar</body></html>", 0, 0); + waitUntilTitleChangedTo("Foo"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Foo"); + ewk_view_html_string_load(webView(), "<html><head><title>Bar</title></head><body>Foo</body></html>", 0, 0); + waitUntilTitleChangedTo("Bar"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Bar"); +} + +static void serverCallbackNavigation(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) +{ + if (message->method != SOUP_METHOD_GET) { + soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + soup_message_set_status(message, SOUP_STATUS_OK); + + Eina_Strbuf* body = eina_strbuf_new(); + eina_strbuf_append_printf(body, "<html><title>%s</title><body>%s</body></html>", path + 1, path + 1); + const size_t bodyLength = eina_strbuf_length_get(body); + soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, eina_strbuf_string_steal(body), bodyLength); + eina_strbuf_free(body); + + soup_message_body_complete(message->response_body); +} + +TEST_F(EWK2UnitTestBase, ewk_view_navigation) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallbackNavigation); + + // Visit Page1 + loadUrlSync(httpServer->getURIForPath("/Page1").data()); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page1"); + ASSERT_FALSE(ewk_view_back_possible(webView())); + ASSERT_FALSE(ewk_view_forward_possible(webView())); + + // Visit Page2 + loadUrlSync(httpServer->getURIForPath("/Page2").data()); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page2"); + ASSERT_TRUE(ewk_view_back_possible(webView())); + ASSERT_FALSE(ewk_view_forward_possible(webView())); + + // Go back to Page1 + ewk_view_back(webView()); + waitUntilTitleChangedTo("Page1"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page1"); + ASSERT_FALSE(ewk_view_back_possible(webView())); + ASSERT_TRUE(ewk_view_forward_possible(webView())); + + // Go forward to Page2 + ewk_view_forward(webView()); + waitUntilTitleChangedTo("Page2"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Page2"); + ASSERT_TRUE(ewk_view_back_possible(webView())); + ASSERT_FALSE(ewk_view_forward_possible(webView())); +} + +TEST_F(EWK2UnitTestBase, ewk_view_setting_encoding_custom) +{ + ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); + ASSERT_TRUE(ewk_view_setting_encoding_custom_set(webView(), "UTF-8")); + ASSERT_STREQ(ewk_view_setting_encoding_custom_get(webView()), "UTF-8"); + // Set the default charset. + ASSERT_TRUE(ewk_view_setting_encoding_custom_set(webView(), 0)); + ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); +} + +static void onFormAboutToBeSubmitted(void* userData, Evas_Object*, void* eventInfo) +{ + Ewk_Form_Submission_Request* request = static_cast<Ewk_Form_Submission_Request*>(eventInfo); + bool* handled = static_cast<bool*>(userData); + + ASSERT_TRUE(request); + + Eina_List* fieldNames = ewk_form_submission_request_field_names_get(request); + ASSERT_TRUE(fieldNames); + ASSERT_EQ(eina_list_count(fieldNames), 3); + void* data; + EINA_LIST_FREE(fieldNames, data) + eina_stringshare_del(static_cast<char*>(data)); + + const char* value1 = ewk_form_submission_request_field_value_get(request, "text1"); + ASSERT_STREQ(value1, "value1"); + eina_stringshare_del(value1); + const char* value2 = ewk_form_submission_request_field_value_get(request, "text2"); + ASSERT_STREQ(value2, "value2"); + eina_stringshare_del(value2); + const char* password = ewk_form_submission_request_field_value_get(request, "password"); + ASSERT_STREQ(password, "secret"); + eina_stringshare_del(password); + + *handled = true; +} + +TEST_F(EWK2UnitTestBase, ewk_view_form_submission_request) +{ + const char* formHTML = + "<html><head><script type='text/javascript'>function submitForm() { document.getElementById('myform').submit(); }</script></head>" + "<body onload='submitForm()'>" + " <form id='myform' action='#'>" + " <input type='text' name='text1' value='value1'>" + " <input type='text' name='text2' value='value2'>" + " <input type='password' name='password' value='secret'>" + " <textarea cols='5' rows='5' name='textarea'>Text</textarea>" + " <input type='hidden' name='hidden1' value='hidden1'>" + " <input type='submit' value='Submit'>" + " </form>" + "</body></html>"; + + ewk_view_html_string_load(webView(), formHTML, "file:///", 0); + bool handled = false; + evas_object_smart_callback_add(webView(), "form,submission,request", onFormAboutToBeSubmitted, &handled); + while (!handled) + ecore_main_loop_iterate(); + ASSERT_TRUE(handled); + evas_object_smart_callback_del(webView(), "form,submission,request", onFormAboutToBeSubmitted); } diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h index 7fd5d7861..aa8a71bf9 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h @@ -40,6 +40,7 @@ #include <WebKit2/WKSerializedScriptValue.h> #include <WebKit2/WKSoupRequestManager.h> #include <WebKit2/WKString.h> +#include <WebKit2/WKTextChecker.h> #include <WebKit2/WebKit2.h> #include <glib.h> #include <wtf/Assertions.h> diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp new file mode 100644 index 000000000..5676bb6d7 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitTextChecker.h" + +#if ENABLE(SPELLCHECK) + +#include "WebKitPrivate.h" +#include <wtf/Vector.h> +#include <wtf/text/CString.h> + +using namespace WebKit; + +static inline WebKitTextChecker* toTextChecker(const void* clientInfo) +{ + return static_cast<WebKitTextChecker*>(const_cast<void*>(clientInfo)); +} + +static bool continuousSpellCheckingEnabledCallback(const void* clientInfo) +{ + return toTextChecker(clientInfo)->isSpellCheckingEnabled(); +} + +static void setContinuousSpellCheckingEnabledCallback(bool enabled, const void* clientInfo) +{ + toTextChecker(clientInfo)->setSpellCheckingEnabled(enabled); +} + +static void checkSpellingOfStringCallback(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void* clientInfo) +{ + toTextChecker(clientInfo)->checkSpellingOfString(toImpl(text)->string(), *misspellingLocation, *misspellingLength); +} + +static WKArrayRef guessesForWordCallback(uint64_t tag, WKStringRef word, const void* clientInfo) +{ + Vector<String> guesses = toTextChecker(clientInfo)->getGuessesForWord(toImpl(word)->string()); + if (guesses.isEmpty()) + return 0; + + WKMutableArrayRef wkSuggestions = WKMutableArrayCreate(); + for (Vector<String>::const_iterator iter = guesses.begin(); iter != guesses.end(); ++iter) { + WKRetainPtr<WKStringRef> wkSuggestion(AdoptWK, WKStringCreateWithUTF8CString(iter->utf8().data())); + WKArrayAppendItem(wkSuggestions, wkSuggestion.get()); + } + + return wkSuggestions; +} + +static void learnWordCallback(uint64_t tag, WKStringRef word, const void* clientInfo) +{ + toTextChecker(clientInfo)->learnWord(toImpl(word)->string()); +} + +static void ignoreWordCallback(uint64_t tag, WKStringRef word, const void* clientInfo) +{ + toTextChecker(clientInfo)->ignoreWord(toImpl(word)->string()); +} + +WebKitTextChecker::~WebKitTextChecker() +{ +} + +WebKitTextChecker::WebKitTextChecker() + : m_textChecker(WebCore::TextCheckerEnchant::create()) + , m_spellCheckingEnabled(false) +{ + WKTextCheckerClient wkTextCheckerClient = { + kWKTextCheckerClientCurrentVersion, + this, // clientInfo + 0, // continuousSpellCheckingAllowed + continuousSpellCheckingEnabledCallback, + setContinuousSpellCheckingEnabledCallback, + 0, // grammarCheckingEnabled + 0, // setGrammarCheckingEnabled + 0, // uniqueSpellDocumentTag + 0, // closeSpellDocumentWithTag + checkSpellingOfStringCallback, + 0, // checkGrammarOfString + 0, // spellingUIIsShowing + 0, // toggleSpellingUIIsShowing + 0, // updateSpellingUIWithMisspelledWord + 0, // updateSpellingUIWithGrammarString + guessesForWordCallback, + learnWordCallback, + ignoreWordCallback, + }; + WKTextCheckerSetClient(&wkTextCheckerClient); +} + +void WebKitTextChecker::checkSpellingOfString(const String& string, int& misspellingLocation, int& misspellingLength) +{ + m_textChecker->checkSpellingOfString(string, misspellingLocation, misspellingLength); +} + +Vector<String> WebKitTextChecker::getGuessesForWord(const String& word) +{ + return m_textChecker->getGuessesForWord(word); +} + +void WebKitTextChecker::learnWord(const String& word) +{ + m_textChecker->learnWord(word); +} + +void WebKitTextChecker::ignoreWord(const String& word) +{ + m_textChecker->ignoreWord(word); +} + +void WebKitTextChecker::setSpellCheckingEnabled(bool enabled) +{ + if (m_spellCheckingEnabled == enabled) + return; + m_spellCheckingEnabled = enabled; + + // We need to notify the Web process that this has changed. + WKTextCheckerContinuousSpellCheckingEnabledStateChanged(enabled); +} + +void WebKitTextChecker::setSpellCheckingLanguages(const String& languages) +{ + if (m_spellCheckingLanguages == languages) + return; + m_spellCheckingLanguages = languages; + + // We need to update the languages in the enchant-based checker too. + m_textChecker->updateSpellCheckingLanguages(languages); +} +#endif // ENABLE(SPELLCHECK) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h new file mode 100644 index 000000000..dd7583a3a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebKitTextChecker_h +#define WebKitTextChecker_h + +#if ENABLE(SPELLCHECK) + +#include <WebCore/TextCheckerEnchant.h> +#include <wtf/FastAllocBase.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> + +class WebKitTextChecker { + WTF_MAKE_FAST_ALLOCATED; + +public: + static PassOwnPtr<WebKitTextChecker> create() { return adoptPtr(new WebKitTextChecker()); } + virtual ~WebKitTextChecker(); + + // For implementing TextCheckerClient. + bool isSpellCheckingEnabled() { return m_spellCheckingEnabled; } + void setSpellCheckingEnabled(bool enabled); + void checkSpellingOfString(const String& string, int& misspellingLocation, int& misspellingLength); + Vector<String> getGuessesForWord(const String& word); + void learnWord(const String& word); + void ignoreWord(const String& word); + + // To be called from WebKitWebContext only. + const String getSpellCheckingLanguages() { return m_spellCheckingLanguages; } + void setSpellCheckingLanguages(const String& spellCheckingLanguages); + +private: + WebKitTextChecker(); + + OwnPtr<WebCore::TextCheckerEnchant> m_textChecker; + String m_spellCheckingLanguages; + bool m_spellCheckingEnabled; +}; + +#endif // ENABLE(SPELLCHECK) + +#endif // WebKitTextChecker_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp index 8a0625c07..4008e865f 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp @@ -28,10 +28,13 @@ #include "WebKitPluginPrivate.h" #include "WebKitPrivate.h" #include "WebKitRequestManagerClient.h" +#include "WebKitTextChecker.h" #include "WebKitURISchemeRequestPrivate.h" #include "WebKitWebContextPrivate.h" #include <WebCore/FileSystem.h> #include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> #include <wtf/text/CString.h> @@ -72,6 +75,10 @@ struct _WebKitWebContextPrivate { #if ENABLE(GEOLOCATION) RefPtr<WebKitGeolocationProvider> geolocationProvider; #endif +#if ENABLE(SPELLCHECK) + OwnPtr<WebKitTextChecker> textChecker; + GOwnPtr<gchar> spellCheckingLanguages; +#endif }; static guint signals[LAST_SIGNAL] = { 0, }; @@ -127,6 +134,9 @@ static gpointer createDefaultWebContext(gpointer) WKGeolocationManagerRef wkGeolocationManager = WKContextGetGeolocationManager(webContext->priv->context.get()); webContext->priv->geolocationProvider = WebKitGeolocationProvider::create(wkGeolocationManager); #endif +#if ENABLE(SPELLCHECK) + webContext->priv->textChecker = WebKitTextChecker::create(); +#endif return webContext.get(); } @@ -418,6 +428,88 @@ void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const cha WKSoupRequestManagerRegisterURIScheme(context->priv->requestManager.get(), wkScheme.get()); } +/** + * webkit_web_context_get_spell_checking_enabled: + * @context: a #WebKitWebContext + * + * Get the current status of the spell checking feature. + * + * Returns: %TRUE If spell checking is enabled, or %FALSE otherwise. + */ +gboolean webkit_web_context_get_spell_checking_enabled(WebKitWebContext* context) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), FALSE); + +#if ENABLE(SPELLCHECK) + return context->priv->textChecker->isSpellCheckingEnabled(); +#else + return false; +#endif +} + +/** + * webkit_web_context_set_spell_checking_enabled: + * @context: a #WebKitWebContext + * @enabled: Value to be set + * + * Enable or disable the spell checking feature. + */ +void webkit_web_context_set_spell_checking_enabled(WebKitWebContext* context, gboolean enabled) +{ + g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); + +#if ENABLE(SPELLCHECK) + context->priv->textChecker->setSpellCheckingEnabled(enabled); +#endif +} + +/** + * webkit_web_context_get_spell_checking_languages: + * @context: a #WebKitWebContext + * + * Get the the list of spell checking languages associated with + * @context, separated by commas. See + * webkit_web_context_set_spell_checking_languages() for more details + * on the format of the languages in the list. + * + * Returns: (transfer none): A comma separated list of languages. + */ +const gchar* webkit_web_context_get_spell_checking_languages(WebKitWebContext* context) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0); + +#if ENABLE(SPELLCHECK) + return context->priv->spellCheckingLanguages.get(); +#else + return 0; +#endif +} + +/** + * webkit_web_context_set_spell_checking_languages: + * @context: a #WebKitWebContext + * @languages: (allow-none): new list of spell checking + * languages separated by commas, or %NULL + * + * Set the list of spell checking languages to be used for spell + * checking, separated by commas. In case %NULL is passed, the default + * value as returned by gtk_get_default_language() will be used. + * + * The locale string typically is in the form lang_COUNTRY, where lang + * is an ISO-639 language code, and COUNTRY is an ISO-3166 country code. + * For instance, sv_FI for Swedish as written in Finland or pt_BR + * for Portuguese as written in Brazil. + */ +void webkit_web_context_set_spell_checking_languages(WebKitWebContext* context, const gchar* languages) +{ + g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); + +#if ENABLE(SPELLCHECK) + context->priv->textChecker->setSpellCheckingLanguages(String(languages)); + context->priv->spellCheckingLanguages.set(g_strdup(languages)); +#endif +} + WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef wkDownload) { GRefPtr<WebKitDownload> download = downloadsMap().get(wkDownload); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h index 83b601a38..0d32ba5bb 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h @@ -132,6 +132,20 @@ webkit_web_context_register_uri_scheme (WebKitWebContext const gchar *scheme, WebKitURISchemeRequestCallback callback, gpointer user_data); + +WEBKIT_API gboolean +webkit_web_context_get_spell_checking_enabled (WebKitWebContext *context); + +WEBKIT_API void +webkit_web_context_set_spell_checking_enabled (WebKitWebContext *context, + gboolean enabled); +WEBKIT_API const gchar * +webkit_web_context_get_spell_checking_languages (WebKitWebContext *context); + +WEBKIT_API void +webkit_web_context_set_spell_checking_languages (WebKitWebContext *context, + const gchar *languages); + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index 3164177cc..73f09d5d3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -33,6 +33,10 @@ webkit_web_context_get_cookie_manager webkit_web_context_set_additional_plugins_directory webkit_web_context_get_plugins webkit_web_context_get_plugins_finish +webkit_web_context_get_spell_checking_enabled +webkit_web_context_set_spell_checking_enabled +webkit_web_context_get_spell_checking_languages +webkit_web_context_set_spell_checking_languages <SUBSECTION URI Scheme> WebKitURISchemeRequestCallback diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp index e7d43a13d..f42feafb7 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp @@ -231,11 +231,38 @@ static void testWebContextURIScheme(URISchemeTest* test, gconstpointer) g_assert(!test->m_loadEvents.contains(LoadTrackingTest::LoadFailed)); } +static void testWebContextSpellChecker(Test* test, gconstpointer) +{ + GRefPtr<WebKitWebContext> webContext(webkit_web_context_get_default()); + + // Set the language to a specific one, an empty one and a list of them. + webkit_web_context_set_spell_checking_languages(webContext.get(), "en_US"); + const gchar* currentLanguage(webkit_web_context_get_spell_checking_languages(webContext.get())); + g_assert_cmpstr(currentLanguage, ==, "en_US"); + + webkit_web_context_set_spell_checking_languages(webContext.get(), 0); + currentLanguage = webkit_web_context_get_spell_checking_languages(webContext.get()); + g_assert_cmpstr(currentLanguage, ==, 0); + + webkit_web_context_set_spell_checking_languages(webContext.get(), "es_ES,en_US"); + currentLanguage = webkit_web_context_get_spell_checking_languages(webContext.get()); + g_assert_cmpstr(currentLanguage, ==, "es_ES,en_US"); + + // Check disabling and re-enabling spell checking. + webkit_web_context_set_spell_checking_enabled(webContext.get(), FALSE); + gboolean isSpellCheckingEnabled = webkit_web_context_get_spell_checking_enabled(webContext.get()); + g_assert(!isSpellCheckingEnabled); + webkit_web_context_set_spell_checking_enabled(webContext.get(), TRUE); + isSpellCheckingEnabled = webkit_web_context_get_spell_checking_enabled(webContext.get()); + g_assert(isSpellCheckingEnabled); +} + void beforeAll() { Test::add("WebKitWebContext", "default-context", testWebContextDefault); PluginsTest::add("WebKitWebContext", "get-plugins", testWebContextGetPlugins); URISchemeTest::add("WebKitWebContext", "uri-scheme", testWebContextURIScheme); + Test::add("WebKitWebContext", "spell-checker", testWebContextSpellChecker); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index 27f233b69..a11ef65d0 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -1201,6 +1201,7 @@ static const short kIOHIDEventTypeScroll = 6; // - If it's sent outside of keyboard event processing (e.g. from Character Viewer, or when confirming an inline input area with a mouse), // then we also execute it immediately, as there will be no other chance. if (parameters && !isFromInputMethod) { + // FIXME: Handle replacementRange in this case, too. It's known to occur in practice when canceling Press and Hold (see <rdar://11940670>). ASSERT(replacementRange.location == NSNotFound); KeypressCommand command("insertText:", text); parameters->commands->append(command); @@ -1272,6 +1273,7 @@ static const short kIOHIDEventTypeScroll = 6; - (void)keyUp:(NSEvent *)theEvent { + LOG(TextInput, "keyUp:%p %@", theEvent, theEvent); _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self)); } @@ -1326,13 +1328,17 @@ static const short kIOHIDEventTypeScroll = 6; - (void)keyDown:(NSEvent *)theEvent { + LOG(TextInput, "keyDown:%p %@%s", theEvent, theEvent, (theEvent == _data->_keyDownEventBeingResent) ? " (re-sent)" : ""); + // There's a chance that responding to this event will run a nested event loop, and // fetching a new event might release the old one. Retaining and then autoreleasing // the current event prevents that from causing a problem inside WebKit or AppKit code. [[theEvent retain] autorelease]; - if ([self _tryHandlePluginComplexTextInputKeyDown:theEvent]) + if ([self _tryHandlePluginComplexTextInputKeyDown:theEvent]) { + LOG(TextInput, "...handled by plug-in"); return; + } // We could be receiving a key down from AppKit if we have re-sent an event // that maps to an action that is currently unavailable (for example a copy when @@ -1347,6 +1353,8 @@ static const short kIOHIDEventTypeScroll = 6; - (void)flagsChanged:(NSEvent *)theEvent { + LOG(TextInput, "flagsChanged:%p %@", theEvent, theEvent); + // There's a chance that responding to this event will run a nested event loop, and // fetching a new event might release the old one. Retaining and then autoreleasing // the current event prevents that from causing a problem inside WebKit or AppKit code. @@ -1372,10 +1380,14 @@ static const short kIOHIDEventTypeScroll = 6; if (parameters->executingSavedKeypressCommands) return; + LOG(TextInput, "Executing %u saved keypress commands...", parameters->commands->size()); + parameters->executingSavedKeypressCommands = true; parameters->eventInterpretationHadSideEffects |= _data->_page->executeKeypressCommands(*parameters->commands); parameters->commands->clear(); parameters->executingSavedKeypressCommands = false; + + LOG(TextInput, "...done executing saved keypress commands."); } - (void)_notifyInputContextAboutDiscardedComposition @@ -1386,6 +1398,7 @@ static const short kIOHIDEventTypeScroll = 6; if (![[self window] isKeyWindow] || self != [[self window] firstResponder]) return; + LOG(TextInput, "-> discardMarkedText"); [[super inputContext] discardMarkedText]; // Inform the input method that we won't have an inline input area despite having been asked to. } @@ -2371,14 +2384,19 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I parameters.commands = &commands; _data->_interpretKeyEventsParameters = ¶meters; + LOG(TextInput, "-> interpretKeyEvents:%p %@", event, event); [self interpretKeyEvents:[NSArray arrayWithObject:event]]; _data->_interpretKeyEventsParameters = 0; // An input method may consume an event and not tell us (e.g. when displaying a candidate window), // in which case we should not bubble the event up the DOM. - if (parameters.consumedByIM) + if (parameters.consumedByIM) { + LOG(TextInput, "...event %p was consumed by an input method", event); return YES; + } + + LOG(TextInput, "...interpretKeyEvents for event %p done, returns %d", event, parameters.eventInterpretationHadSideEffects); // If we have already executed all or some of the commands, the event is "handled". Note that there are additional checks on web process side. return parameters.eventInterpretationHadSideEffects; @@ -2827,10 +2845,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) if (!_data->_inSecureInputState) EnableSecureEventInput(); static NSArray *romanInputSources = [[NSArray alloc] initWithObjects:&NSAllRomanInputSourcesLocaleIdentifier count:1]; + LOG(TextInput, "-> setAllowedInputSourceLocales:romanInputSources"); [context setAllowedInputSourceLocales:romanInputSources]; } else { if (_data->_inSecureInputState) DisableSecureEventInput(); + LOG(TextInput, "-> setAllowedInputSourceLocales:nil"); [context setAllowedInputSourceLocales:nil]; } _data->_inSecureInputState = isInPasswordField; diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h index fc5d747c5..518db8e1c 100644 --- a/Source/WebKit2/UIProcess/PageClient.h +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -121,13 +121,16 @@ public: virtual void didChangeContentsSize(const WebCore::IntSize&) = 0; virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0; virtual void didReceiveMessageFromNavigatorQtObject(const String&) = 0; - virtual void handleDownloadRequest(DownloadProxy*) = 0; virtual void updateTextInputState() = 0; virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0; virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0; virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0; #endif // PLATFORM(QT). +#if PLATFORM(QT) || PLATFORM(EFL) + virtual void handleDownloadRequest(DownloadProxy*) = 0; +#endif // PLATFORM(QT) || PLATFORM(EFL) + #if PLATFORM(QT) || PLATFORM(GTK) virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0; #endif diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp index ab19d5d14..3c5c38005 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp @@ -80,7 +80,7 @@ WebInspectorProxy::WebInspectorProxy(WebPageProxy* page) , m_isProfilingPage(false) #if PLATFORM(WIN) , m_inspectorWindow(0) -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) , m_inspectorView(0) , m_inspectorWindow(0) #endif diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h index 0958472e8..5a73a5e8c 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.h +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h @@ -52,6 +52,11 @@ OBJC_CLASS WKWebInspectorWKView; #include "WebInspectorClientGtk.h" #endif +#if PLATFORM(EFL) +#include <Ecore_Evas.h> +#include <Evas.h> +#endif + namespace WebKit { class WebFrameProxy; @@ -217,6 +222,9 @@ private: WebInspectorClientGtk m_client; GtkWidget* m_inspectorView; GtkWidget* m_inspectorWindow; +#elif PLATFORM(EFL) + Evas_Object* m_inspectorView; + Ecore_Evas* m_inspectorWindow; #endif #if ENABLE(INSPECTOR_SERVER) int m_remoteInspectionPageId; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 344ed9846..6cf260a36 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -1136,7 +1136,7 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event) bool handled = false; process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID); didReceiveEvent(event.type(), handled); - } else + } else if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler. process()->send(Messages::WebPage::KeyEvent(event), m_pageID); } @@ -1221,7 +1221,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr // Create a download proxy. DownloadProxy* download = m_process->context()->createDownloadProxy(); downloadID = download->downloadID(); -#if PLATFORM(QT) +#if PLATFORM(QT) || PLATFORM(EFL) // Our design does not suppport downloads without a WebPage. handleDownloadRequest(download); #endif @@ -2642,11 +2642,6 @@ void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents m_pageClient->didReceiveMessageFromNavigatorQtObject(contents); } -void WebPageProxy::handleDownloadRequest(DownloadProxy* download) -{ - m_pageClient->handleDownloadRequest(download); -} - void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) { m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password); @@ -2663,6 +2658,13 @@ void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& } #endif // PLATFORM(QT). +#if PLATFORM(QT) || PLATFORM(EFL) +void WebPageProxy::handleDownloadRequest(DownloadProxy* download) +{ + m_pageClient->handleDownloadRequest(download); +} +#endif // PLATFORM(QT) || PLATFORM(EFL) + #if ENABLE(TOUCH_EVENTS) void WebPageProxy::needTouchEvents(bool needTouchEvents) { @@ -3253,8 +3255,10 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) m_keyEventQueue.removeFirst(); - m_pageClient->doneWithKeyEvent(event, handled); + if (!m_keyEventQueue.isEmpty()) + process()->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID); + m_pageClient->doneWithKeyEvent(event, handled); if (handled) break; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 33c49a3ca..5633ce750 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -635,6 +635,9 @@ public: #if PLATFORM(QT) void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize&); void didReceiveMessageFromNavigatorQtObject(const String&); +#endif + +#if PLATFORM(QT) || PLATFORM(EFL) void handleDownloadRequest(DownloadProxy*); #endif diff --git a/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp b/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp index ac77ef3f2..8a479d29e 100644 --- a/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WebContext.h" +#include <Efreet.h> #include <WebCore/ApplicationCacheStorage.h> #include <WebCore/NotImplemented.h> @@ -33,7 +34,7 @@ namespace WebKit { String WebContext::applicationCacheDirectory() { - return WebCore::cacheStorage().cacheDirectory(); + return String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl/Applications"; } void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&) @@ -48,8 +49,7 @@ void WebContext::platformInvalidateContext() String WebContext::platformDefaultDatabaseDirectory() const { - notImplemented(); - return ""; + return String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/Databases"; } String WebContext::platformDefaultIconDatabasePath() const @@ -60,8 +60,7 @@ String WebContext::platformDefaultIconDatabasePath() const String WebContext::platformDefaultLocalStorageDirectory() const { - notImplemented(); - return ""; + return String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/LocalStorage"; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp index b2b68bccc..2b1537e1b 100644 --- a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp @@ -28,15 +28,25 @@ #if ENABLE(INSPECTOR) +#include "WebProcessProxy.h" +#include "ewk_view_private.h" #include <WebCore/NotImplemented.h> +#include <unistd.h> +#include <wtf/text/CString.h> #include <wtf/text/WTFString.h> namespace WebKit { WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { - notImplemented(); - return 0; + ASSERT(m_page); + + m_inspectorWindow = ecore_evas_buffer_new(initialWindowWidth, initialWindowHeight); + if (!m_inspectorWindow) + return 0; + + m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup())); + return ewk_view_page_get(m_inspectorView); } void WebInspectorProxy::platformOpen() @@ -46,7 +56,15 @@ void WebInspectorProxy::platformOpen() void WebInspectorProxy::platformDidClose() { - notImplemented(); + if (m_inspectorView) { + evas_object_del(m_inspectorView); + m_inspectorView = 0; + } + + if (m_inspectorWindow) { + ecore_evas_free(m_inspectorWindow); + m_inspectorWindow = 0; + } } void WebInspectorProxy::platformBringToFront() @@ -67,14 +85,16 @@ void WebInspectorProxy::platformInspectedURLChanged(const String&) String WebInspectorProxy::inspectorPageURL() const { - notImplemented(); - return String(); + return makeString(inspectorBaseURL(), "/inspector.html"); } String WebInspectorProxy::inspectorBaseURL() const { - notImplemented(); - return String(); + String inspectorFilesPath = makeString("file://", WK2_WEB_INSPECTOR_INSTALL_DIR); + if (access(inspectorFilesPath.utf8().data(), R_OK)) + inspectorFilesPath = makeString("file://", WK2_WEB_INSPECTOR_DIR); + + return inspectorFilesPath; } unsigned WebInspectorProxy::platformInspectedWindowHeight() diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index 6077f6d3e..cf12343df 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -77,7 +77,6 @@ 1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24B5F111F531E800C38269 /* MachUtilities.h */; }; 1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24BED3120894D100FBB059 /* SharedMemory.h */; }; 1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */; }; - 1A2A4B00158693920090C9E9 /* ColorSpaceData.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1A2A4AFE158693920090C9E9 /* ColorSpaceData.h */; }; 1A2A4B0E1586A2240090C9E9 /* ColorSpaceData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A4AFD158693920090C9E9 /* ColorSpaceData.mm */; }; 1A2BB6D014117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2BB6CE14117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp */; }; 1A2BB6D114117B4D000F35D4 /* PluginProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2BB6CF14117B4D000F35D4 /* PluginProcessConnectionMessages.h */; }; @@ -189,7 +188,6 @@ 1AA56F2911E92BC80061B882 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA56F2811E92BC80061B882 /* PluginController.h */; }; 1AA575FA1496B52600A4EE06 /* EventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA575F81496B52600A4EE06 /* EventDispatcher.cpp */; }; 1AA575FB1496B52600A4EE06 /* EventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA575F91496B52600A4EE06 /* EventDispatcher.h */; }; - 1AA575FE1496B6F300A4EE06 /* EventDispatcher.messages.in in Resources */ = {isa = PBXBuildFile; fileRef = 1AA575FD1496B6F300A4EE06 /* EventDispatcher.messages.in */; }; 1AA576021496B97900A4EE06 /* EventDispatcherMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA575FF1496B7C000A4EE06 /* EventDispatcherMessageReceiver.cpp */; }; 1AA5889211EE70400061B882 /* NetscapePluginStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA5889011EE70400061B882 /* NetscapePluginStream.h */; }; 1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */; }; @@ -874,6 +872,7 @@ C574A58212E66681002DFE98 /* PasteboardTypes.mm in Sources */ = {isa = PBXBuildFile; fileRef = C574A58012E66681002DFE98 /* PasteboardTypes.mm */; }; CD5C66A0134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5C669E134B9D36004FE2A8 /* InjectedBundlePageFullScreenClient.cpp */; }; CD5C66A1134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5C669F134B9D37004FE2A8 /* InjectedBundlePageFullScreenClient.h */; }; + CD67D30E15C08F9A00843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD67D30815C07BE000843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp */; }; CD6F75F4131B66D000D6B21E /* WebFullScreenManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD73BA3E131A2E8A00EEDED2 /* WebFullScreenManagerProxy.cpp */; }; CD73BA47131ACC9A00EEDED2 /* WebFullScreenManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD73BA45131ACC8800EEDED2 /* WebFullScreenManagerProxyMessageReceiver.cpp */; }; CD73BA4E131ACDB700EEDED2 /* WebFullScreenManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD73BA48131ACD8E00EEDED2 /* WebFullScreenManagerMessageReceiver.cpp */; }; @@ -993,7 +992,6 @@ files = ( BCDE0ABF13272708001259FB /* PluginProcess.app in CopyFiles */, 1A50DB66110A3D57000D3FE5 /* WebProcess.app in CopyFiles */, - 1A2A4B00158693920090C9E9 /* ColorSpaceData.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1935,6 +1933,8 @@ C574A58012E66681002DFE98 /* PasteboardTypes.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteboardTypes.mm; sourceTree = "<group>"; }; CD5C669E134B9D36004FE2A8 /* InjectedBundlePageFullScreenClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageFullScreenClient.cpp; sourceTree = "<group>"; }; CD5C669F134B9D37004FE2A8 /* InjectedBundlePageFullScreenClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageFullScreenClient.h; sourceTree = "<group>"; }; + CD67D30815C07BE000843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageDiagnosticLoggingClient.cpp; sourceTree = "<group>"; }; + CD67D30915C07BE000843ADF /* InjectedBundlePageDiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageDiagnosticLoggingClient.h; sourceTree = "<group>"; }; CD73BA37131A29FE00EEDED2 /* WebFullScreenManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebFullScreenManager.cpp; path = FullScreen/WebFullScreenManager.cpp; sourceTree = "<group>"; }; CD73BA38131A29FE00EEDED2 /* WebFullScreenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebFullScreenManager.h; path = FullScreen/WebFullScreenManager.h; sourceTree = "<group>"; }; CD73BA39131A29FE00EEDED2 /* WebFullScreenManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebFullScreenManager.messages.in; path = FullScreen/WebFullScreenManager.messages.in; sourceTree = "<group>"; }; @@ -3243,6 +3243,8 @@ BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */, BC8147D412F66D31007B2C32 /* InjectedBundleNavigationAction.cpp */, BC8147D312F66D31007B2C32 /* InjectedBundleNavigationAction.h */, + CD67D30815C07BE000843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp */, + CD67D30915C07BE000843ADF /* InjectedBundlePageDiagnosticLoggingClient.h */, 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */, 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */, E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */, @@ -4346,7 +4348,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 1AA575FE1496B6F300A4EE06 /* EventDispatcher.messages.in in Resources */, E133FD8A1423DD7F00FC7BFB /* WebKit.icns in Resources */, E1967E38150AB5E200C73169 /* com.apple.WebProcess.sb in Resources */, ); @@ -4951,6 +4952,7 @@ 51FA2D7715212E2600C1BA0B /* WKBundleDOMWindowExtension.cpp in Sources */, 1A2A4B0E1586A2240090C9E9 /* ColorSpaceData.mm in Sources */, 3F87B9BD158940120090FF62 /* WebColorChooser.cpp in Sources */, + CD67D30E15C08F9A00843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h index e40c898c7..3355d086d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h @@ -46,6 +46,7 @@ class InjectedBundleBackForwardList; class InjectedBundleBackForwardListItem; class InjectedBundleDOMWindowExtension; class InjectedBundleHitTestResult; +class InjectedBundleIntentRequest; class InjectedBundleNavigationAction; class InjectedBundleNodeHandle; class InjectedBundleRangeHandle; @@ -63,6 +64,7 @@ WK_ADD_API_MAPPING(WKBundleDOMWindowExtensionRef, InjectedBundleDOMWindowExtensi WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame) WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult) WK_ADD_API_MAPPING(WKBundleInspectorRef, WebInspector) +WK_ADD_API_MAPPING(WKBundleIntentRequestRef, InjectedBundleIntentRequest) WK_ADD_API_MAPPING(WKBundleNavigationActionRef, InjectedBundleNavigationAction) WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle) WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp new file mode 100644 index 000000000..81c95c6c5 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp @@ -0,0 +1,69 @@ +/* + * 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 "WKBundleIntentRequest.h" + +#if ENABLE(WEB_INTENTS) +#include "InjectedBundleIntentRequest.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebIntentData.h" + +using namespace WebKit; +#endif + +WKTypeID WKBundleIntentRequestGetTypeID() +{ +#if ENABLE(WEB_INTENTS) + return toAPI(InjectedBundleIntentRequest::APIType); +#else + return 0; +#endif +} + +WKIntentDataRef WKBundleIntentRequestCopyIntentData(WKBundleIntentRequestRef requestRef) +{ +#if ENABLE(WEB_INTENTS) + RefPtr<WebIntentData> webIntentData = toImpl(requestRef)->intent(); + return toAPI(webIntentData.release().leakRef()); +#else + return 0; +#endif +} + +void WKBundleIntentRequestPostResult(WKBundleIntentRequestRef requestRef, WKSerializedScriptValueRef serializedDataRef) +{ +#if ENABLE(WEB_INTENTS) + return toImpl(requestRef)->postResult(toImpl(serializedDataRef)); +#endif +} + +void WKBundleIntentRequestPostFailure(WKBundleIntentRequestRef requestRef, WKSerializedScriptValueRef serializedDataRef) +{ +#if ENABLE(WEB_INTENTS) + return toImpl(requestRef)->postFailure(toImpl(serializedDataRef)); +#endif +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h new file mode 100644 index 000000000..b18136d13 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKBundleIntentRequest_h +#define WKBundleIntentRequest_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleIntentRequestGetTypeID(); + +WK_EXPORT WKIntentDataRef WKBundleIntentRequestCopyIntentData(WKBundleIntentRequestRef request); + +WK_EXPORT void WKBundleIntentRequestPostResult(WKBundleIntentRequestRef request, WKSerializedScriptValueRef serializedData); +WK_EXPORT void WKBundleIntentRequestPostFailure(WKBundleIntentRequestRef request, WKSerializedScriptValueRef serializedData); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleIntentRequest_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 07841d7cc..2ae22371d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -31,6 +31,7 @@ #include "InjectedBundleNodeHandle.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" +#include "WebFrame.h" #include "WebFullScreenManager.h" #include "WebImage.h" #include "WebPage.h" @@ -45,6 +46,10 @@ #include <WebCore/KURL.h> #include <WebCore/Page.h> +#if ENABLE(WEB_INTENTS) +#include "WebIntentData.h" +#endif + using namespace WebKit; WKTypeID WKBundlePageGetTypeID() @@ -124,6 +129,11 @@ void WKBundlePageDidExitFullScreen(WKBundlePageRef pageRef) #endif } +void WKBundlePageSetDiagnosticLoggingClient(WKBundlePageRef pageRef, WKBundlePageDiagnosticLoggingClient* client) +{ + toImpl(pageRef)->initializeInjectedBundleDiagnosticLoggingClient(client); +} + WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef pageRef) { return toAPI(toImpl(pageRef)->pageGroup()); @@ -300,6 +310,13 @@ double WKBundlePageGetBackingScaleFactor(WKBundlePageRef pageRef) return toImpl(pageRef)->deviceScaleFactor(); } +void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKIntentDataRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + toImpl(pageRef)->deliverIntentToFrame(toImpl(frameRef)->frameID(), toImpl(intentRef)->store()); +#endif +} + #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef) { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index f70d5b36b..aa8609244 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -109,7 +109,7 @@ typedef void (*WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallb typedef void (*WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); typedef void (*WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); typedef bool (*WKBundlePageShouldForceUniversalAccessFromLocalURLCallback)(WKBundlePageRef, WKStringRef url, const void* clientInfo); -typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentDataRef intent, WKTypeRef* userData, const void* clientInfo); +typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRequestRef intentRequest, WKTypeRef* userData, const void* clientInfo); typedef void (*WKBundlePageRegisterIntentServiceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo); struct WKBundlePageLoaderClient { @@ -354,6 +354,18 @@ typedef struct WKBundlePageFullScreenClient WKBundlePageFullScreenClient; enum { kWKBundlePageFullScreenClientCurrentVersion = 1 }; +// MessageTrace client +typedef void (*WKBundlePageDiagnosticLoggingCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef description, WKStringRef success, const void* clientInfo); + +struct WKBundlePageDiagnosticLoggingClient { + int version; + const void * clientInfo; + WKBundlePageDiagnosticLoggingCallback logDiagnosticMessage; +}; +typedef struct WKBundlePageDiagnosticLoggingClient WKBundlePageDiagnosticLoggingClient; + +enum { kWKBundlePageDiagnosticLoggingClientCurrentVersion = 0 }; + WK_EXPORT void WKBundlePageWillEnterFullScreen(WKBundlePageRef page); WK_EXPORT void WKBundlePageDidEnterFullScreen(WKBundlePageRef page); WK_EXPORT void WKBundlePageWillExitFullScreen(WKBundlePageRef page); @@ -368,8 +380,8 @@ WK_EXPORT void WKBundlePageSetPageLoaderClient(WKBundlePageRef page, WKBundlePag WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundlePageResourceLoadClient* client); WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClient* client); WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client); - WK_EXPORT void WKBundlePageSetFullScreenClient(WKBundlePageRef page, WKBundlePageFullScreenClient* client); +WK_EXPORT void WKBundlePageSetDiagnosticLoggingClient(WKBundlePageRef page, WKBundlePageDiagnosticLoggingClient* client); WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page); WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page); @@ -392,6 +404,8 @@ WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBun WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page); +WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentDataRef intent); + #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page); #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp new file mode 100644 index 000000000..5ccb19cad --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp @@ -0,0 +1,64 @@ +/* + * 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 "InjectedBundleIntentRequest.h" + +#if ENABLE(WEB_INTENTS) +#include <WebCore/IntentRequest.h> +#include <WebSerializedScriptValue.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<InjectedBundleIntentRequest> InjectedBundleIntentRequest::create(IntentRequest* request) +{ + return adoptRef(new InjectedBundleIntentRequest(request)); +} + +InjectedBundleIntentRequest::InjectedBundleIntentRequest(IntentRequest* request) + : m_intentRequest(request) +{ +} + +void InjectedBundleIntentRequest::postResult(WebSerializedScriptValue* data) +{ + m_intentRequest->postResult(static_cast<SerializedScriptValue*>(data->internalRepresentation())); +} + +void InjectedBundleIntentRequest::postFailure(WebSerializedScriptValue* data) +{ + m_intentRequest->postFailure(static_cast<SerializedScriptValue*>(data->internalRepresentation())); +} + +PassRefPtr<WebIntentData> InjectedBundleIntentRequest::intent() const +{ + return WebIntentData::create(IntentData(m_intentRequest->intent())); +} + +} // namespace WebKit + +#endif // ENABLE(WEB_INTENTS) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h new file mode 100644 index 000000000..b5870d9a2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundleIntentRequest_h +#define InjectedBundleIntentRequest_h + +#if ENABLE(WEB_INTENTS) + +#include "APIObject.h" +#include "WebIntentData.h" +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { +class IntentRequest; +} + +namespace WebKit { + +class WebSerializedScriptValue; + +class InjectedBundleIntentRequest : public APIObject { +public: + static const Type APIType = TypeBundleIntentRequest; + + static PassRefPtr<InjectedBundleIntentRequest> create(WebCore::IntentRequest*); + + void postResult(WebSerializedScriptValue*); + void postFailure(WebSerializedScriptValue*); + + PassRefPtr<WebIntentData> intent() const; + +private: + explicit InjectedBundleIntentRequest(WebCore::IntentRequest*); + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::IntentRequest> m_intentRequest; +}; + +} // namespace WebKit + +#endif // ENABLE(WEB_INTENTS) + +#endif // InjectedBundleIntentRequest_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp new file mode 100644 index 000000000..6f264cb62 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InjectedBundlePageDiagnosticLoggingClient.h" + +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +namespace WebKit { + +void InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessage(WebPage* page, const String& message, const String& description, const String& success) +{ + if (!m_client.logDiagnosticMessage) + return; + m_client.logDiagnosticMessage(toAPI(page), toCopiedAPI(message), toCopiedAPI(description), toCopiedAPI(success), m_client.clientInfo); +} + +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h new file mode 100644 index 000000000..e79e81a03 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundlePageDiagnosticLoggingClient_h +#define InjectedBundlePageDiagnosticLoggingClient_h + +#include "APIClient.h" +#include "WKBundlePage.h" +#include <JavaScriptCore/JSBase.h> +#include <wtf/Forward.h> + +namespace WebKit { + +class APIObject; +class InjectedBundleHitTestResult; +class WebContextMenuItemData; +class WebPage; + +class InjectedBundlePageDiagnosticLoggingClient : public APIClient<WKBundlePageDiagnosticLoggingClient, kWKBundlePageDiagnosticLoggingClientCurrentVersion> { +public: + void logDiagnosticMessage(WebPage*, const String& message, const String& description, const String& success); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageDiagnosticLoggingClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp index 74f8efb1d..a6a06123f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp @@ -34,7 +34,7 @@ #include <wtf/text/WTFString.h> #if ENABLE(WEB_INTENTS) -#include "WebIntentData.h" +#include "InjectedBundleIntentRequest.h" #endif #if ENABLE(WEB_INTENTS_TAG) #include "WebIntentServiceInfo.h" @@ -195,13 +195,13 @@ void InjectedBundlePageLoaderClient::didDetectXSSForFrame(WebPage* page, WebFram } #if ENABLE(WEB_INTENTS) -void InjectedBundlePageLoaderClient::didReceiveIntentForFrame(WebPage* page, WebFrame* frame, WebIntentData* intent, RefPtr<APIObject>& userData) +void InjectedBundlePageLoaderClient::didReceiveIntentForFrame(WebPage* page, WebFrame* frame, InjectedBundleIntentRequest* intentRequest, RefPtr<APIObject>& userData) { if (!m_client.didReceiveIntentForFrame) return; WKTypeRef userDataToPass = 0; - m_client.didReceiveIntentForFrame(toAPI(page), toAPI(frame), toAPI(intent), &userDataToPass, m_client.clientInfo); + m_client.didReceiveIntentForFrame(toAPI(page), toAPI(frame), toAPI(intentRequest), &userDataToPass, m_client.clientInfo); userData = adoptRef(toImpl(userDataToPass)); } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h index 403037e12..81d9be44d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h @@ -47,7 +47,7 @@ class InjectedBundleBackForwardListItem; class WebPage; class WebFrame; #if ENABLE(WEB_INTENTS) -class WebIntentData; +class InjectedBundleIntentRequest; #endif #if ENABLE(WEB_INTENTS_TAG) class WebIntentServiceInfo; @@ -72,7 +72,7 @@ public: void didDetectXSSForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); #if ENABLE(WEB_INTENTS) - void didReceiveIntentForFrame(WebPage*, WebFrame*, WebIntentData*, RefPtr<APIObject>& userData); + void didReceiveIntentForFrame(WebPage*, WebFrame*, InjectedBundleIntentRequest*, RefPtr<APIObject>& userData); #endif #if ENABLE(WEB_INTENTS_TAG) void registerIntentServiceForFrame(WebPage*, WebFrame*, WebIntentServiceInfo*, RefPtr<APIObject>& userData); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp b/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp index a2a61d47d..9cc8c06a7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/efl/InjectedBundleEfl.cpp @@ -42,7 +42,7 @@ bool InjectedBundle::load(APIObject* initializationUserData) return false; } if (!eina_module_load(m_platformBundle)) { - EINA_LOG_CRIT("Error loading the injected bundle: %s", m_path.utf8().data()); + EINA_LOG_CRIT("Error loading the injected bundle from %s: %s", m_path.utf8().data(), eina_error_msg_get(eina_error_get())); eina_module_free(m_platformBundle); m_platformBundle = 0; return false; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index 470c162bb..072a69c9c 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -1180,12 +1180,14 @@ void PluginView::scheduleWindowedPluginGeometryUpdate(const WindowGeometry& geom #if PLATFORM(MAC) void PluginView::pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus) { - m_webPage->send(Messages::WebPageProxy::PluginFocusOrWindowFocusChanged(m_plugin->pluginComplexTextInputIdentifier(), pluginHasFocusAndWindowHasFocus)); + if (m_webPage) + m_webPage->send(Messages::WebPageProxy::PluginFocusOrWindowFocusChanged(m_plugin->pluginComplexTextInputIdentifier(), pluginHasFocusAndWindowHasFocus)); } void PluginView::setComplexTextInputState(PluginComplexTextInputState pluginComplexTextInputState) { - m_webPage->send(Messages::WebPageProxy::SetPluginComplexTextInputState(m_plugin->pluginComplexTextInputIdentifier(), pluginComplexTextInputState)); + if (m_webPage) + m_webPage->send(Messages::WebPageProxy::SetPluginComplexTextInputState(m_plugin->pluginComplexTextInputIdentifier(), pluginComplexTextInputState)); } mach_port_t PluginView::compositingRenderServerPort() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 33370bdef..3af596626 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -440,7 +440,7 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) con if (frame->page()->mainFrame() != frame) return; -#if PLATFORM(QT) +#if PLATFORM(QT) || (PLATFORM(EFL) && USE(TILED_BACKING_STORE)) if (m_page->useFixedLayout()) { // The below method updates the size(). m_page->resizeToContentsIfNeeded(); @@ -483,7 +483,7 @@ bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObjec void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { - ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag)); + ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag)); ASSERT(pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing || pluginUnavailabilityReason == RenderEmbeddedObject::InsecurePluginVersion); HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element); @@ -635,6 +635,15 @@ void WebChromeClient::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves) m_page->send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves)); } +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) +void WebChromeClient::scheduleAnimation() +{ +#if USE(UI_SIDE_COMPOSITING) + m_page->drawingArea()->layerTreeHost()->scheduleAnimation(); +#endif +} +#endif + void WebChromeClient::formStateDidChange(const Node*) { notImplemented(); @@ -773,4 +782,12 @@ void WebChromeClient::numWheelEventHandlersChanged(unsigned count) m_page->numWheelEventHandlersChanged(count); } +void WebChromeClient::logDiagnosticMessage(const String& message, const String& description, const String& success) +{ + if (!m_page->corePage()->settings()->diagnosticLoggingEnabled()) + return; + + m_page->injectedBundleDiagnosticLoggingClient().logDiagnosticMessage(m_page, message, description, success); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h index 383eeac3e..f40d4b174 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -162,6 +162,9 @@ private: virtual void setCursor(const WebCore::Cursor&) OVERRIDE; virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE; +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) + virtual void scheduleAnimation() OVERRIDE; +#endif // Notification that the given form element has changed. This function // will be called frequently, so handling should be very fast. @@ -219,6 +222,8 @@ private: virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE; + virtual void logDiagnosticMessage(const String& message, const String& description, const String& success) OVERRIDE; + String m_cachedToolTip; mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; mutable bool m_cachedMainFrameHasHorizontalScrollbar; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 918e74acd..fbb824974 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -74,8 +74,8 @@ #include <WebCore/WindowFeatures.h> #if ENABLE(WEB_INTENTS) +#include "InjectedBundleIntentRequest.h" #include "IntentData.h" -#include "WebIntentData.h" #include <WebCore/IntentRequest.h> #endif @@ -1364,11 +1364,10 @@ void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* appletElement, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) { - const String mimeType = "application/x-java-applet"; - RefPtr<Widget> plugin = createPlugin(pluginSize, appletElement, KURL(), paramNames, paramValues, mimeType, false); + RefPtr<Widget> plugin = createPlugin(pluginSize, appletElement, KURL(), paramNames, paramValues, appletElement->serviceType(), false); if (!plugin) { if (WebPage* webPage = m_frame->page()) - webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(mimeType)); + webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(appletElement->serviceType())); } return plugin.release(); } @@ -1562,20 +1561,11 @@ void WebFrameLoaderClient::dispatchIntent(PassRefPtr<IntentRequest> request) if (!webPage) return; - IntentData intentData; - Intent* coreIntent = request->intent(); - ASSERT(coreIntent); - intentData.action = coreIntent->action(); - intentData.type = coreIntent->type(); - intentData.service = coreIntent->service(); - intentData.data = coreIntent->data()->data(); - intentData.extras = coreIntent->extras(); - intentData.suggestions = coreIntent->suggestions(); - RefPtr<APIObject> userData; - RefPtr<WebIntentData> webIntent = WebIntentData::create(intentData); - webPage->injectedBundleLoaderClient().didReceiveIntentForFrame(webPage, m_frame, webIntent.get(), userData); + RefPtr<InjectedBundleIntentRequest> bundleIntentRequest = InjectedBundleIntentRequest::create(request.get()); + webPage->injectedBundleLoaderClient().didReceiveIntentForFrame(webPage, m_frame, bundleIntentRequest.get(), userData); + IntentData intentData(request->intent()); webPage->send(Messages::WebPageProxy::DidReceiveIntentForFrame(m_frame->frameID(), intentData, InjectedBundleUserMessageEncoder(userData.get()))); } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp index a3b9a1391..ae3994422 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp @@ -356,6 +356,10 @@ void LayerTreeCoordinator::performScheduledLayerFlush() { if (m_isSuspended || m_waitingForUIProcess) return; +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) + // Make sure that any previously registered animation callbacks are being executed before we flush the layers. + m_webPage->corePage()->mainFrame()->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime())); +#endif m_webPage->layoutIfNeeded(); @@ -544,6 +548,13 @@ void LayerTreeCoordinator::setVisibleContentsRect(const IntRect& rect, float sca m_shouldSendScrollPositionUpdate = true; } +#if USE(UI_SIDE_COMPOSITING) +void LayerTreeCoordinator::scheduleAnimation() +{ + scheduleLayerFlush(); +} +#endif + void LayerTreeCoordinator::renderNextFrame() { m_waitingForUIProcess = false; diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h index 9b5154c36..7f6038005 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h @@ -86,6 +86,9 @@ public: virtual void syncFixedLayers(); virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, ShareableSurface::Handle&, WebCore::IntPoint&); +#if USE(UI_SIDE_COMPOSITING) + virtual void scheduleAnimation() OVERRIDE; +#endif protected: explicit LayerTreeCoordinator(WebPage*); diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp index 581491245..19ce4d031 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/WebGraphicsLayer.cpp @@ -320,6 +320,8 @@ void WebGraphicsLayer::setContentsNeedsDisplay() setContentsToImage(0); setContentsToImage(image.get()); m_canvasNeedsDisplay = true; + if (client()) + client()->notifySyncRequired(this); } void WebGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer) diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h index 368230cc9..1372f2a29 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h @@ -105,6 +105,10 @@ public: virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } #endif +#if USE(UI_SIDE_COMPOSITING) + virtual void scheduleAnimation() = 0; +#endif + protected: explicit LayerTreeHost(WebPage*); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 9571ffbaa..59d3bc5cb 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -419,6 +419,11 @@ void WebPage::initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenCli } #endif +void WebPage::initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClient* client) +{ + m_logDiagnosticMessageClient.initialize(client); +} + PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters) { String pluginPath; @@ -2086,6 +2091,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) settings->setShouldRespectImageOrientation(store.getBoolValueForKey(WebPreferencesKey::shouldRespectImageOrientationKey())); + settings->setDiagnosticLoggingEnabled(store.getBoolValueForKey(WebPreferencesKey::diagnosticLoggingEnabledKey())); + platformPreferencesDidChange(store); if (m_drawingArea) @@ -2145,6 +2152,10 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt) if (command.execute(evt)) return true; + // Don't allow text insertion for nodes that cannot edit. + if (!frame->editor()->canEdit()) + return false; + // Don't insert null or control characters as they can result in unexpected behaviour if (evt->charCode() < ' ') return false; diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 1b7708a4c..e3257a33a 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -35,6 +35,7 @@ #if ENABLE(CONTEXT_MENUS) #include "InjectedBundlePageContextMenuClient.h" #endif +#include "InjectedBundlePageDiagnosticLoggingClient.h" #include "InjectedBundlePageEditorClient.h" #include "InjectedBundlePageFormClient.h" #include "InjectedBundlePageFullScreenClient.h" @@ -248,6 +249,7 @@ public: #if ENABLE(FULLSCREEN_API) void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClient*); #endif + void initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClient*); #if ENABLE(CONTEXT_MENUS) InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; } @@ -258,6 +260,7 @@ public: InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; } InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; } InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; } + InjectedBundlePageDiagnosticLoggingClient& injectedBundleDiagnosticLoggingClient() { return m_logDiagnosticMessageClient; } #if ENABLE(FULLSCREEN_API) InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; } #endif @@ -474,6 +477,10 @@ public: bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; } #endif +#if ENABLE(WEB_INTENTS) + void deliverIntentToFrame(uint64_t frameID, const IntentData&); +#endif + void replaceSelectionWithText(WebCore::Frame*, const String&); void clearSelection(); @@ -652,10 +659,6 @@ private: void runJavaScriptInMainFrame(const String&, uint64_t callbackID); void forceRepaint(uint64_t callbackID); -#if ENABLE(WEB_INTENTS) - void deliverIntentToFrame(uint64_t frameID, const IntentData&); -#endif - void preferencesDidChange(const WebPreferencesStore&); void platformPreferencesDidChange(const WebPreferencesStore&); void updatePreferences(const WebPreferencesStore&); @@ -811,6 +814,7 @@ private: #if ENABLE(FULLSCREEN_API) InjectedBundlePageFullScreenClient m_fullScreenClient; #endif + InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient; #if USE(TILED_BACKING_STORE) WebCore::IntSize m_viewportSize; diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm index 2254152ca..4dffb6edd 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm @@ -144,15 +144,9 @@ bool TiledCoreAnimationDrawingArea::forceRepaintAsync(uint64_t callbackID) if (m_layerTreeStateIsFrozen) return false; - // FIXME: It is possible for the drawing area to be destroyed before the bound block - // is invoked, so grab a reference to the web page here so we can access the drawing area through it. - // (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition). - // A better fix would be to make sure that we keep the drawing area alive if there are outstanding calls. - WebPage* webPage = m_webPage; dispatchAfterEnsuringUpdatedScrollPosition(bind(^{ - if (DrawingArea* drawingArea = webPage->drawingArea()) - drawingArea->forceRepaint(); - webPage->send(Messages::WebPageProxy::VoidCallback(callbackID)); + m_webPage->drawingArea()->forceRepaint(); + m_webPage->send(Messages::WebPageProxy::VoidCallback(callbackID)); })); return true; } @@ -230,13 +224,23 @@ void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(c m_layerFlushScheduler.suspend(); Function<void ()> function = functionRef; + + // It is possible for the drawing area to be destroyed before the bound block + // is invoked, so grab a reference to the web page here so we can access the drawing area through it. + // (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition). + WebPage* webPage = m_webPage; + ScrollingThread::dispatchBarrier(bind(^{ + DrawingArea* drawingArea = webPage->drawingArea(); + if (!drawingArea) + return; + function(); if (!m_layerTreeStateIsFrozen) m_layerFlushScheduler.resume(); - m_webPage->deref(); + webPage->deref(); })); } diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm index 0a8c0a489..18765047b 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -62,6 +62,9 @@ #define SANDBOX_NAMED_EXTERNAL 0x0003 extern "C" int sandbox_init_with_parameters(const char *profile, uint64_t flags, const char *const parameters[], char **errorbuf); +// Define this to 1 to bypass the sandbox for debugging purposes. +#define DEBUG_BYPASS_SANDBOX 0 + #endif using namespace WebCore; @@ -180,10 +183,11 @@ static void appendReadwriteSandboxDirectory(Vector<const char*>& vector, const c static void initializeSandbox(const WebProcessCreationParameters& parameters) { #if ENABLE(WEB_PROCESS_SANDBOX) - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DisableSandbox"]) { - WTFLogAlways("Bypassing sandbox due to DisableSandbox user default.\n"); - return; - } + +#if DEBUG_BYPASS_SANDBOX + WTFLogAlways("Bypassing web process sandbox.\n"); + return; +#endif #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Use private temporary and cache directories. diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 563758064..dea36ed90 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -113,6 +113,7 @@ EXPORTS ??1Mutex@WTF@@QAE@XZ ??1StringImpl@WTF@@QAE@XZ ??1ThreadCondition@WTF@@QAE@XZ + ?addTextMatchMarker@DocumentMarkerController@WebCore@@QAEXPBVRange@2@_N@Z ?broadcast@ThreadCondition@WTF@@QAEXXZ ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z ?consoleMessageArgumentCounts@InspectorConsoleAgent@WebCore@@QAE?AV?$Vector@I$0A@@WTF@@XZ @@ -174,6 +175,7 @@ EXPORTS ?find@StringImpl@WTF@@QAEIPAV12@@Z ?absoluteCaretBounds@FrameSelection@WebCore@@QAE?AVIntRect@2@XZ ?fromUTF8WithLatin1Fallback@String@WTF@@SA?AV12@PBEI@Z + ?garbageCollectDocumentResources@CachedResourceLoader@WebCore@@QAEXXZ ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z ?getData16SlowCase@StringImpl@WTF@@ABEPB_WXZ ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z @@ -197,6 +199,7 @@ EXPORTS ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z ?numberOfScopedHTMLStyleChildren@Node@WebCore@@QBEIXZ ?page@Document@WebCore@@QBEPAVPage@2@XZ + ?pageNumberForElement@PrintContext@WebCore@@SAHPAVElement@2@ABVFloatSize@2@@Z ?paintControlTints@FrameView@WebCore@@AAEXXZ ?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QBE_NXZ ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z @@ -273,4 +276,4 @@ EXPORTS ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@U?$PtrHash@PAVStringImpl@WTF@@@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z ?registerURLSchemeAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z ?removeURLSchemeRegisteredAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z - ?iconURLs@Document@WebCore@@QAEABV?$Vector@UIconURL@WebCore@@$0A@@WTF@@XZ
\ No newline at end of file + ?iconURLs@Document@WebCore@@QAEABV?$Vector@UIconURL@WebCore@@$0A@@WTF@@XZ diff --git a/Source/WebKit2/win/WebKit2.vcproj b/Source/WebKit2/win/WebKit2.vcproj index 0a38c4b82..a362b046d 100755 --- a/Source/WebKit2/win/WebKit2.vcproj +++ b/Source/WebKit2/win/WebKit2.vcproj @@ -2394,6 +2394,14 @@ > </File> <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageDiagnosticLoggingClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageDiagnosticLoggingClient.h" + > + </File> + <File RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageEditorClient.cpp" > </File> diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 0e5d1b2c7..1a47d2f3a 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -106,6 +106,7 @@ EXPORTS ??1Mutex@WTF@@QAE@XZ ??1StringImpl@WTF@@QAE@XZ ??1ThreadCondition@WTF@@QAE@XZ + ?addTextMatchMarker@DocumentMarkerController@WebCore@@QAEXPBVRange@2@_N@Z ?broadcast@ThreadCondition@WTF@@QAEXXZ ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z ?consoleMessageArgumentCounts@InspectorConsoleAgent@WebCore@@QAE?AV?$Vector@I$0A@@WTF@@XZ @@ -117,6 +118,7 @@ EXPORTS ?detachThread@WTF@@YAXI@Z ?didBeginFrameImpl@InspectorInstrumentation@WebCore@@CAXPAVInstrumentingAgents@2@@Z ?didCancelFrameImpl@InspectorInstrumentation@WebCore@@CAXPAVInstrumentingAgents@2@@Z + ?iconURLs@Document@WebCore@@QAEABV?$Vector@UIconURL@WebCore@@$0A@@WTF@@XZ ?initializeMainThread@WTF@@YAXXZ ?initializeThreading@WTF@@YAXXZ ?instrumentationForPage@WebCore@@YAPAVInstrumentingAgents@1@PAVPage@1@@Z @@ -170,6 +172,7 @@ EXPORTS ?find@StringImpl@WTF@@QAEIPAV12@@Z ?absoluteCaretBounds@FrameSelection@WebCore@@QAE?AVIntRect@2@XZ ?fromUTF8WithLatin1Fallback@String@WTF@@SA?AV12@PBEI@Z + ?garbageCollectDocumentResources@CachedResourceLoader@WebCore@@QAEXXZ ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z ?getData16SlowCase@StringImpl@WTF@@ABEPB_WXZ ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z @@ -193,6 +196,7 @@ EXPORTS ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z ?numberOfScopedHTMLStyleChildren@Node@WebCore@@QBEIXZ ?page@Document@WebCore@@QBEPAVPage@2@XZ + ?pageNumberForElement@PrintContext@WebCore@@SAHPAVElement@2@ABVFloatSize@2@@Z ?paintControlTints@FrameView@WebCore@@AAEXXZ ?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QBE_NXZ ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter index 8605125a2..ddeccf605 100644 --- a/Source/autotools/symbols.filter +++ b/Source/autotools/symbols.filter @@ -53,6 +53,7 @@ _ZN7WebCore11HistoryItem16setDocumentStateERKN3WTF6VectorINS1_6StringELm0EEE; _ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_13ContainerNodeEiib; _ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERjS6_; _ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERmS6_; +_ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE; _ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE; _ZN7WebCore14ClientRectListC1ERKN3WTF6VectorINS_9FloatQuadELj0EEE; _ZN7WebCore14ClientRectListC1ERKN3WTF6VectorINS_9FloatQuadELm0EEE; @@ -71,12 +72,13 @@ _ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9C _ZN7WebCore17InspectorCounters12counterValueENS0_11CounterTypeE; _ZN7WebCore18HTMLContentElement6createEPNS_8DocumentE; _ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii; -_ZN7WebCore21InspectorConsoleAgent28consoleMessageArgumentCountsEv; -_ZN7WebCore22instrumentationForPageEPNS_4PageE; +_ZN7WebCore20CachedResourceLoader31garbageCollectDocumentResourcesEv; _ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE; _ZN7WebCore20NodeRenderingContextD1Ev; +_ZN7WebCore21InspectorConsoleAgent28consoleMessageArgumentCountsEv; _ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE; _ZN7WebCore22externalRepresentationEPNS_7ElementEj; +_ZN7WebCore22instrumentationForPageEPNS_4PageE; _ZN7WebCore22userPreferredLanguagesEv; _ZN7WebCore24ComposedShadowTreeWalker10firstChildEv; _ZN7WebCore24ComposedShadowTreeWalker11nextSiblingEv; diff --git a/Source/cmake/FindEFL.cmake b/Source/cmake/FindEFL.cmake index 054b86b19..5755e16da 100644 --- a/Source/cmake/FindEFL.cmake +++ b/Source/cmake/FindEFL.cmake @@ -13,12 +13,14 @@ PKG_CHECK_MODULES (EFLDEPS REQUIRED eukit>=1.1.0 edbus>=1.1.0 ecore-input>=1.0.0 - eeze>=1.2.99) + eeze>=1.2.99 + efreet>=1.0.0) PKG_CHECK_MODULES (EINA REQUIRED eina>=1.2.0) PKG_CHECK_MODULES (ECORE_X ecore-x>=1.0.0) PKG_CHECK_MODULES (EVAS REQUIRED evas>=1.0.0) PKG_CHECK_MODULES (EUKIT REQUIRED eukit>=1.1.0) PKG_CHECK_MODULES (EDBUS REQUIRED edbus>=1.1.0) +PKG_CHECK_MODULES (EFREET REQUIRED efreet>=1.0.0) FIND_PROGRAM (EDJE_CC_EXECUTABLE edje_cc) IF (NOT EDJE_CC_EXECUTABLE) diff --git a/Source/cmake/FindHarfBuzz.cmake b/Source/cmake/FindHarfBuzz.cmake new file mode 100644 index 000000000..8a99019b5 --- /dev/null +++ b/Source/cmake/FindHarfBuzz.cmake @@ -0,0 +1,44 @@ +# Copyright (c) 2012, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# + +INCLUDE(FindPkgConfig) + +PKG_CHECK_MODULES (harfbuzz REQUIRED harfbuzz>=0.9.0) + +PKG_CHECK_MODULES(PC_HARFBUZZ harfbuzz>=0.9.0) + +FIND_PATH(HARFBUZZ_INCLUDE_DIRS NAMES hb.h + HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR} +) + +FIND_LIBRARY(HARFBUZZ_LIBRARIES NAMES harfbuzz + HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR} +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES) diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake index 1bf71f811..3c233162f 100644 --- a/Source/cmake/OptionsEfl.cmake +++ b/Source/cmake/OptionsEfl.cmake @@ -82,6 +82,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GLIB_SUPPORT ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_WEBKIT_BLOB_BUILDER ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CAPTURE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MICRODATA ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_INFO ON) @@ -119,8 +120,11 @@ ENDIF () IF (FONT_BACKEND STREQUAL "freetype") FIND_PACKAGE(Freetype REQUIRED) + FIND_PACKAGE(HarfBuzz REQUIRED) SET(WTF_USE_FREETYPE 1) + SET(WTF_USE_HARFBUZZ_NG 1) ADD_DEFINITIONS(-DWTF_USE_FREETYPE=1) + ADD_DEFINITIONS(-DWTF_USE_HARFBUZZ_NG=1) ELSE () FIND_PACKAGE(Pango REQUIRED) SET(WTF_USE_PANGO 1) diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake index 280a9de5e..7eb3375a1 100644 --- a/Source/cmake/WebKitFeatures.cmake +++ b/Source/cmake/WebKitFeatures.cmake @@ -22,6 +22,7 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_CSP_NEXT "Toggle Content Security Policy 1.1 support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CSS3_FLEXBOX "Toggle CSS3 Flexbox support" ON) WEBKIT_OPTION_DEFINE(ENABLE_CSS_BOX_DECORATION_BREAK "Toggle Box Decoration Break (CSS Backgrounds and Borders) support" ON) + WEBKIT_OPTION_DEFINE(ENABLE_CSS_COMPOSITING "Toggle CSS COMPOSITING support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CSS_EXCLUSIONS "Toggle CSS Exclusion support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CSS_FILTERS "Toggle CSS Filters support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_CSS_IMAGE_ORIENTATION "Toggle CSS image-orientation support" OFF) @@ -70,6 +71,7 @@ MACRO (WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_LINK_PREFETCH "Toggle pre fetching support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_LINK_PRERENDER "Toggle pre rendering support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MATHML "Toggle MathML support" ON) + WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_CAPTURE "Toggle Media Capture support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SOURCE "Toggle Media Source support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STATISTICS "Toggle Media Statistics support" OFF) WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STREAM "Toggle Media Stream API support" OFF) diff --git a/Source/cmakeconfig.h.cmake b/Source/cmakeconfig.h.cmake index d2ed72cd1..e256b0e58 100644 --- a/Source/cmakeconfig.h.cmake +++ b/Source/cmakeconfig.h.cmake @@ -16,6 +16,7 @@ #cmakedefine01 ENABLE_CLIENT_BASED_GEOLOCATION #cmakedefine01 ENABLE_CSP_NEXT #cmakedefine01 ENABLE_CSS_BOX_DECORATION_BREAK +#cmakedefine01 ENABLE_CSS_COMPOSITING #cmakedefine01 ENABLE_CSS_EXCLUSIONS #cmakedefine01 ENABLE_CSS_IMAGE_ORIENTATION #cmakedefine01 ENABLE_CSS_IMAGE_RESOLUTION @@ -61,6 +62,7 @@ #cmakedefine01 ENABLE_LINK_PRERENDER #cmakedefine01 ENABLE_LEGACY_WEBKIT_BLOB_BUILDER #cmakedefine01 ENABLE_MATHML +#cmakedefine01 ENABLE_MEDIA_CAPTURE #cmakedefine01 ENABLE_MEDIA_STREAM #cmakedefine01 ENABLE_METER_ELEMENT #cmakedefine01 ENABLE_MICRODATA |